pub struct TokioTaskHandle<R, E> { /* private fields */ }Expand description
Async handle returned by Tokio-backed executor services.
Awaiting this handle reports the accepted task’s final result, including task failure, panic, or cancellation.
§Type Parameters
R- The task success value.E- The task error value.
Implementations§
Source§impl<R, E> TokioTaskHandle<R, E>
impl<R, E> TokioTaskHandle<R, E>
Sourcepub fn cancel(&self) -> CancelResult
pub fn cancel(&self) -> CancelResult
Sends a best-effort abort request to the underlying Tokio task.
CancelResult::Cancelled means this handle requested Tokio abort for a
task that was not observed as finished at the instant of the check.
Completion may still win the race with cancellation, so the final task
outcome is always the value produced by awaiting this handle.
§Returns
CancelResult::Cancelled when an abort request was sent, or
CancelResult::AlreadyFinished if the Tokio task had already
completed.
Trait Implementations§
Source§impl<R, E> Future for TokioTaskHandle<R, E>
impl<R, E> Future for TokioTaskHandle<R, E>
Source§fn poll(
self: Pin<&mut TokioTaskHandle<R, E>>,
cx: &mut Context<'_>,
) -> Poll<<TokioTaskHandle<R, E> as Future>::Output>
fn poll( self: Pin<&mut TokioTaskHandle<R, E>>, cx: &mut Context<'_>, ) -> Poll<<TokioTaskHandle<R, E> as Future>::Output>
Polls the underlying Tokio task.
§Parameters
cx- Async task context used to register the current waker.
§Returns
Poll::Ready with the task result when the Tokio task completes, or
Poll::Pending while it is still running. Tokio cancellation and panic
join errors are converted to TaskExecutionError values.
Source§type Output = Result<R, TaskExecutionError<E>>
type Output = Result<R, TaskExecutionError<E>>
Auto Trait Implementations§
impl<R, E> Freeze for TokioTaskHandle<R, E>
impl<R, E> RefUnwindSafe for TokioTaskHandle<R, E>
impl<R, E> Send for TokioTaskHandle<R, E>
impl<R, E> Sync for TokioTaskHandle<R, E>
impl<R, E> Unpin for TokioTaskHandle<R, E>
impl<R, E> UnsafeUnpin for TokioTaskHandle<R, E>
impl<R, E> UnwindSafe for TokioTaskHandle<R, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more