Struct TaskHandle

Source
pub struct TaskHandle<Output> {
    pub task_id: TaskId,
    /* private fields */
}
Expand description

A handle to a task that has been submitted to the system.

This is the public-facing handle (wrapped by Job) that allows a user to retrieve the result of their function once it’s complete.

Fields§

§task_id: TaskId

Implementations§

Source§

impl<Output> TaskHandle<Output>

Source

pub fn get_task_id(&self) -> TaskId

Returns the unique ID of the associated task.

Source

pub fn recv_result(&self) -> Result<Result<Output, TaskError>, RecvError>

Waits (blocks) until the task’s result is available and returns it.

Source

pub fn try_recv_result(&self) -> Result<Result<Output, TaskError>, TryRecvError>

Attempts to receive the result without blocking.

Trait Implementations§

Source§

impl<Output: Debug> Debug for TaskHandle<Output>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Output> Freeze for TaskHandle<Output>

§

impl<Output> RefUnwindSafe for TaskHandle<Output>

§

impl<Output> Send for TaskHandle<Output>
where Output: Send,

§

impl<Output> !Sync for TaskHandle<Output>

§

impl<Output> Unpin for TaskHandle<Output>

§

impl<Output> UnwindSafe for TaskHandle<Output>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.