Refactor: Mv AutoAbortJoinHandle into helpers

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-08 20:44:20 +10:00
parent 6367bfc1e3
commit 12931fc024
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 16 additions and 15 deletions

View file

@ -300,3 +300,12 @@ impl AsyncFileWriter {
}
}
}
#[derive(Debug)]
pub struct AutoAbortJoinHandle<T>(pub task::JoinHandle<T>);
impl<T> Drop for AutoAbortJoinHandle<T> {
fn drop(&mut self) {
self.0.abort();
}
}