pub struct SendableJoinHandle<T> { /* private fields */ }Expand description
A sendable task handle returned by spawn_sendable().
The handle is Send when T is Send, but is not Sync. It may be moved
and polled on another thread while the task stays on its original runtime.
That runtime must keep being driven for the task to make progress.
Dropping the handle detaches the task unless
cancel_on_drop is enabled. Awaiting it yields the
output, or crate::JoinError if the task ends without one, including on
panic or runtime shutdown.
Implementations§
Source§impl<T> SendableJoinHandle<T>
impl<T> SendableJoinHandle<T>
Sourcepub fn cancel_on_drop(self) -> Self
pub fn cancel_on_drop(self) -> Self
Requests cancellation when this handle is dropped instead of detaching the task.
Cancellation follows cancel and does not wait for cleanup.
A running poll is not interrupted.
Sourcepub fn cancel(self)
pub fn cancel(self)
Requests cancellation and discards the result without waiting for cleanup.
The future is dropped on its runtime thread when the runtime next processes the task, or during shutdown. A running poll is not interrupted. This method may be called from another thread without a runtime context.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Returns true if the task completed or was closed without an output.