Struct nrf_modem::CancellationToken
source · pub struct CancellationToken { /* private fields */ }
Expand description
A token you can pass to certain async functions that let you cancel them.
This can be nice for example when you have a task that is ‘stuck’ receiving data that never arrives, but you want it to stop doing that so it can continue doing something else.
Implementations§
source§impl CancellationToken
impl CancellationToken
sourcepub fn cancel(&self)
pub fn cancel(&self)
Set the token to cancel the operation that uses this token.
This may not cancel the task immediately because that may not always be possible.
sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns whether or not the cancel function has been called already
Trait Implementations§
source§impl Default for CancellationToken
impl Default for CancellationToken
source§fn default() -> CancellationToken
fn default() -> CancellationToken
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for CancellationToken
impl !RefUnwindSafe for CancellationToken
impl Send for CancellationToken
impl Sync for CancellationToken
impl Unpin for CancellationToken
impl UnwindSafe for CancellationToken
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