pub struct SpawnHandle { /* private fields */ }Expand description
Opaque handle to a spawned task. Created by Runtime::spawn.
Calling abort requests the runtime cancel the task at
the next .await point. The cancellation is cooperative — a task that
never yields will run to completion regardless.
Dropping a SpawnHandle without calling abort detaches the task: it
continues running independently. This matches tokio::task::JoinHandle
semantics.
Implementations§
Source§impl SpawnHandle
impl SpawnHandle
Sourcepub fn from_inner<T: SpawnHandleInner>(inner: T) -> Self
pub fn from_inner<T: SpawnHandleInner>(inner: T) -> Self
Build a handle from any inner abort-capable implementation.
Used by runtime adapters (e.g. TokioRuntime) to wrap their
concrete JoinHandle-equivalent into the trait object.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether the task has finished (success or cancellation).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SpawnHandle
impl !Sync for SpawnHandle
impl !UnwindSafe for SpawnHandle
impl Freeze for SpawnHandle
impl Send for SpawnHandle
impl Unpin for SpawnHandle
impl UnsafeUnpin for SpawnHandle
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