pub struct AbortOnDrop(/* private fields */);Available on crate feature
rt only.Expand description
A wrapper around a [tokio::task::AbortHandle],
which aborts the task when it is dropped.
Unlike AbortOnDropHandle, AbortOnDrop cannot be .awaited for a result.
It has no generic parameter, making it suitable when you only need to keep a task handle in a struct and do not care about the output.
Implementations§
Source§impl AbortOnDrop
impl AbortOnDrop
Sourcepub fn new(handle: AbortHandle) -> Self
pub fn new(handle: AbortHandle) -> Self
Create an AbortOnDrop from a [AbortHandle].
Sourcepub fn abort(&self)
pub fn abort(&self)
Abort the task associated with this handle,
equivalent to [AbortHandle::abort].
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Checks if the task associated with this handle is finished,
equivalent to [AbortHandle::is_finished].
Trait Implementations§
Source§impl Debug for AbortOnDrop
impl Debug for AbortOnDrop
Auto Trait Implementations§
impl Freeze for AbortOnDrop
impl RefUnwindSafe for AbortOnDrop
impl Send for AbortOnDrop
impl Sync for AbortOnDrop
impl Unpin for AbortOnDrop
impl UnsafeUnpin for AbortOnDrop
impl UnwindSafe for AbortOnDrop
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