Impl AutoAbortJoinHandle::new & make its field private

plus change all its users to use its new APIs.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-08 20:53:49 +10:00
parent f41391a53c
commit d9bcca8b78
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 12 additions and 6 deletions

View file

@ -64,13 +64,13 @@ impl MultiFetcher {
.map(|fetcher| {
(
fetcher.clone(),
AutoAbortJoinHandle(tokio::spawn(async move { fetcher.check().await })),
AutoAbortJoinHandle::new(tokio::spawn(async move { fetcher.check().await })),
)
})
.collect();
for (fetcher, mut handle) in handles {
match (&mut handle.0).await {
for (fetcher, handle) in handles {
match handle.await {
Ok(Ok(true)) => return Some(fetcher),
Ok(Ok(false)) => (),
Ok(Err(err)) => {