pub struct JoinHandle<T: Send> {
    pub receiver: Receiver<T>,
}
Expand description

Handle returned by ThreadPool::evaluate and ThreadPool::complete that allows to block the current thread and wait for the result of a submitted task. The returned JoinHandle may also be sent to the ThreadPool to create a task that blocks a worker thread until the task is completed and then does something with the result. This handle communicates with the worker thread using a oneshot channel blocking the thread when try_await_complete() is called until a message, i.e. the result of the task, is received.

Fields

receiver: Receiver<T>

Implementations

Block the current thread until the result of the task is received.

Errors

This function might return a oneshot::Canceled if the channel was broken before the result was received. This is generally the case if execution of the task panicked.

Block the current thread until the result of the task is received.

Panics

This function might panic if try_await_complete() returns oneshot::Canceled. This is generally the case if execution of the task panicked and the sender was dropped before sending a result to the receiver.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.