pub struct TaskHandle<R, E> { /* private fields */ }Expand description
Lightweight result handle for a submitted callable task.
TaskHandle owns the receiving endpoint for exactly one task result. It can
block through Self::get, poll non-blockingly through Self::try_get,
or be awaited by value.
Implementations§
Source§impl<R, E> TaskHandle<R, E>
impl<R, E> TaskHandle<R, E>
Sourcepub fn get(self) -> TaskResult<R, E>
pub fn get(self) -> TaskResult<R, E>
Waits for the task to finish and returns its final result.
This method blocks the current thread until a result is available.
§Returns
Ok(R) if the task succeeds. If the accepted task returns Err(E),
panics, is cancelled, or loses its completion endpoint before producing
a value, the corresponding crate::TaskExecutionError is returned.
Sourcepub fn try_get(self) -> TryGet<Self, R, E>
pub fn try_get(self) -> TryGet<Self, R, E>
Attempts to retrieve the final result without blocking.
§Returns
TryGet::Ready with the final result when available, otherwise
TryGet::Pending containing this handle.
Trait Implementations§
Source§impl<R, E> IntoFuture for TaskHandle<R, E>
impl<R, E> IntoFuture for TaskHandle<R, E>
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Converts this handle into a future resolving to the task result.