Skip to main content

TaskResultHandle

Trait TaskResultHandle 

Source
pub trait TaskResultHandle<R, E>: Send {
    // Required methods
    fn is_done(&self) -> bool;
    fn get(self) -> Result<R, TaskExecutionError<E>>
       where Self: Sized;
    fn try_get(self) -> TryGet<Self, R, E>
       where Self: Sized;
}
Expand description

Common interface for handles that expose a submitted task’s final result.

Required Methods§

Source

fn is_done(&self) -> bool

Returns whether the task has installed a terminal state.

§Returns

true after the task has reached a terminal lifecycle state. Result publication to the handle may still be racing with this observation.

Source

fn get(self) -> Result<R, TaskExecutionError<E>>
where Self: Sized,

Blocks until the task produces its final result.

§Returns

The final task result. If the completion endpoint is dropped without publishing a result, a dropped-result error is reported.

Source

fn try_get(self) -> TryGet<Self, R, E>
where Self: Sized,

Attempts to retrieve the final result without blocking.

§Returns

TryGet::Ready when a result is available, otherwise TryGet::Pending containing the original handle.

Implementors§

Source§

impl<R, E> TaskResultHandle<R, E> for TrackedTask<R, E>
where R: Send, E: Send,

Source§

impl<R, E> TaskResultHandle<R, E> for RayonTaskHandle<R, E>
where R: Send, E: Send,

Source§

impl<R, E> TaskResultHandle<R, E> for TaskHandle<R, E>
where R: Send, E: Send,