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) -> Result<R, TaskExecutionError<E>>
pub fn get(self) -> Result<R, TaskExecutionError<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<TaskHandle<R, E>, R, E>
pub fn try_get(self) -> TryGet<TaskHandle<R, E>, 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) -> <TaskHandle<R, E> as IntoFuture>::IntoFuture
fn into_future(self) -> <TaskHandle<R, E> as IntoFuture>::IntoFuture
Converts this handle into a future resolving to the task result.
Source§type Output = Result<R, TaskExecutionError<E>>
type Output = Result<R, TaskExecutionError<E>>
Source§type IntoFuture = TaskHandleFuture<R, E>
type IntoFuture = TaskHandleFuture<R, E>
Source§impl<R, E> TaskResultHandle<R, E> for TaskHandle<R, E>
impl<R, E> TaskResultHandle<R, E> for TaskHandle<R, E>
Source§fn get(self) -> Result<R, TaskExecutionError<E>>
fn get(self) -> Result<R, TaskExecutionError<E>>
Blocks until the result channel yields a task result.
Source§fn try_get(self) -> TryGet<TaskHandle<R, E>, R, E>
fn try_get(self) -> TryGet<TaskHandle<R, E>, R, E>
Attempts to read the result channel without blocking.