pub struct JoinHandle<T> { /* private fields */ }Expand description
A local task handle. It is neither Send nor Sync.
Returned by spawn(). Dropping the handle detaches the task unless
cancel_on_drop is enabled.
Awaiting it returns the task output or JoinError on cancellation or panic.
Implementations§
Source§impl<T> JoinHandle<T>
impl<T> JoinHandle<T>
Sourcepub fn cancel_on_drop(self) -> JoinHandle<T> ⓘ
pub fn cancel_on_drop(self) -> JoinHandle<T> ⓘ
Sourcepub fn cancel(self)
pub fn cancel(self)
Requests cancellation and discards the result without waiting for cleanup.
A running poll is not interrupted; the local task set must make progress for cancellation of a pending task to finish.
Sourcepub fn detach(self)
👎Deprecated since 4.5.0: Drop the handle instead if cancel_on_drop() is not enabled
pub fn detach(self)
Drop the handle instead if cancel_on_drop() is not enabled
Detaches the task to let it keep running in the background.
Overrides cancel_on_drop without requesting cancellation.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Returns true if the task completed, panicked, or finished cancellation.
Trait Implementations§
Source§impl<T> Debug for JoinHandle<T>where
T: Debug,
impl<T> Debug for JoinHandle<T>where
T: Debug,
Source§impl<T> Drop for JoinHandle<T>
impl<T> Drop for JoinHandle<T>
Source§impl<T> Future for JoinHandle<T>
impl<T> Future for JoinHandle<T>
Auto Trait Implementations§
impl<T> !Send for JoinHandle<T>
impl<T> !Sync for JoinHandle<T>
impl<T> Freeze for JoinHandle<T>
impl<T> RefUnwindSafe for JoinHandle<T>
impl<T> Unpin for JoinHandle<T>
impl<T> UnsafeUnpin for JoinHandle<T>
impl<T> UnwindSafe for JoinHandle<T>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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