mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 04:58:42 +00:00
Ret BinstallError
in <AutoAbortJoinHandle as Future>::poll
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
36066fd4df
commit
a13180f79a
1 changed files with 7 additions and 3 deletions
|
@ -5,7 +5,9 @@ use std::{
|
||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
|
||||||
use tokio::task::{JoinError, JoinHandle};
|
use tokio::task::JoinHandle;
|
||||||
|
|
||||||
|
use super::BinstallError;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AutoAbortJoinHandle<T>(JoinHandle<T>);
|
pub struct AutoAbortJoinHandle<T>(JoinHandle<T>);
|
||||||
|
@ -49,9 +51,11 @@ impl<T> DerefMut for AutoAbortJoinHandle<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Future for AutoAbortJoinHandle<T> {
|
impl<T> Future for AutoAbortJoinHandle<T> {
|
||||||
type Output = Result<T, JoinError>;
|
type Output = Result<T, BinstallError>;
|
||||||
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
Pin::new(&mut Pin::into_inner(self).0).poll(cx)
|
Pin::new(&mut Pin::into_inner(self).0)
|
||||||
|
.poll(cx)
|
||||||
|
.map(|res| res.map_err(BinstallError::TaskJoinError))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue