pub struct JoinHandle { /* private fields */ }Expand description
A handle to a spawned task, allowing individual cancellation.
Created by TaskScope::spawn and TaskScope::spawn_with_priority.
Dropping the handle does not cancel the task — call cancel
explicitly, or drop the owning TaskScope to cancel all tasks at once.
Implementations§
Source§impl JoinHandle
impl JoinHandle
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Cancel this specific task.
Cancellation drops the task’s Future on the next executor
flush — it is cooperative (.await-bound), same as all async
cancellation in Rust.
No-op if the task has already completed or was spawned into an already-cancelled scope.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Return true if the task has completed (normally or via cancellation).
Returns true for handles created by spawning into an already-cancelled
scope (they never had a real task).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JoinHandle
impl !RefUnwindSafe for JoinHandle
impl !Send for JoinHandle
impl !Sync for JoinHandle
impl Unpin for JoinHandle
impl UnsafeUnpin for JoinHandle
impl !UnwindSafe for JoinHandle
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