Struct tokio_tasks::RunToken
source · pub struct RunToken(/* private fields */);
Expand description
Similar to a [tokio_util::sync::CancellationToken
],
the RunToken encapsulates the possibility of canceling an async command.
However it also allows pausing and resuming the async command,
and it is possible to wait in both a blocking fashion and an asynchronous fashion.
Implementations§
source§impl RunToken
impl RunToken
sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Return true iff we are canceled
sourcepub fn cancelled(&self) -> WaitForCancellationFuture<'_> ⓘ
pub fn cancelled(&self) -> WaitForCancellationFuture<'_> ⓘ
Suspend the async coroutine until cancel() is called
sourcepub fn set_location(&self, file: &'static str, line: u32)
pub fn set_location(&self, file: &'static str, line: u32)
Store a file line location in the run_token
pub fn location(&self) -> Option<(&'static str, u32)>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RunToken
impl Send for RunToken
impl Sync for RunToken
impl Unpin for RunToken
impl !UnwindSafe for RunToken
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