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.
Auto Trait Implementations§
impl<R, E> Freeze for TaskHandle<R, E>
impl<R, E> !RefUnwindSafe for TaskHandle<R, E>
impl<R, E> Send for TaskHandle<R, E>
impl<R, E> !Sync for TaskHandle<R, E>
impl<R, E> Unpin for TaskHandle<R, E>
impl<R, E> UnsafeUnpin for TaskHandle<R, E>
impl<R, E> !UnwindSafe for TaskHandle<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