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 Self>, cx: &mut Context<'_>) -> Poll<Self::Output>
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::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.