pub struct JoinHandle<T> { /* private fields */ }Expand description
A native local task handle. It is neither Send nor Sync.
Returned by crate::rt::spawn() and crate::rt::Runtime::spawn(). Dropping
the handle detaches the task.
Awaiting it yields the task’s output, or an error if no output is available,
for example after cancellation, a task panic, or runtime shutdown.
Implementations§
Source§impl<T> JoinHandle<T>
impl<T> JoinHandle<T>
Sourcepub fn cancel(self)
pub fn cancel(self)
Requests cancellation and discards the result without waiting for cleanup.
The future is dropped when the runtime next processes the task, or during runtime shutdown. A running poll is not interrupted.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Returns true if the task completed or was closed without an output.
Trait Implementations§
Source§impl<T: Debug> Debug for JoinHandle<T>
impl<T: Debug> Debug for JoinHandle<T>
Source§impl<T> Future for JoinHandle<T>
impl<T> Future for JoinHandle<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for JoinHandle<T>
impl<T> !Send for JoinHandle<T>
impl<T> !Sync for JoinHandle<T>
impl<T> !UnwindSafe for JoinHandle<T>
impl<T> Freeze for JoinHandle<T>where
Task<T>: Freeze,
impl<T> Unpin for JoinHandle<T>where
Task<T>: Unpin,
impl<T> UnsafeUnpin for JoinHandle<T>where
Task<T>: UnsafeUnpin,
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
Mutably borrows from an owned value. Read more
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more