Impl Deref{Mut} for AutoAbortJoinHandle

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-08 20:48:31 +10:00
parent d6a372a160
commit 52210d1a8c
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -1,6 +1,7 @@
use std::{
fs,
io::{self, stderr, stdin, Write},
ops::{Deref, DerefMut},
path::{Path, PathBuf},
};
@ -311,3 +312,17 @@ impl<T> Drop for AutoAbortJoinHandle<T> {
self.0.abort();
}
}
impl<T> Deref for AutoAbortJoinHandle<T> {
type Target = task::JoinHandle<T>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<T> DerefMut for AutoAbortJoinHandle<T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}