Impl Future for AutoAbortJoinHandle

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

View file

@ -1,8 +1,11 @@
use std::{ use std::{
fs, fs,
future::Future,
io::{self, stderr, stdin, Write}, io::{self, stderr, stdin, Write},
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
path::{Path, PathBuf}, path::{Path, PathBuf},
pin::Pin,
task::{Context, Poll},
}; };
use bytes::Bytes; use bytes::Bytes;
@ -326,3 +329,11 @@ impl<T> DerefMut for AutoAbortJoinHandle<T> {
&mut self.0 &mut self.0
} }
} }
impl<T> Future for AutoAbortJoinHandle<T> {
type Output = Result<T, task::JoinError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Pin::new(&mut Pin::into_inner(self).0).poll(cx)
}
}