pub struct CancellationToken { /* private fields */ }Expand description
Propagates notification that operations should be canceled.
Implementations§
Source§impl CancellationToken
impl CancellationToken
Sourcepub const fn none() -> CancellationToken
pub const fn none() -> CancellationToken
A token that can never be canceled.
Sourcepub fn can_be_canceled(&self) -> bool
pub fn can_be_canceled(&self) -> bool
Whether this token is capable of being in the canceled state.
pub fn is_cancellation_requested(&self) -> bool
Sourcepub fn register(
&self,
callback: impl FnOnce() + Send + 'static,
) -> CancellationTokenRegistration
pub fn register( &self, callback: impl FnOnce() + Send + 'static, ) -> CancellationTokenRegistration
Registers a callback that runs when the token is canceled. When the token is already canceled the callback runs immediately.
Source§impl CancellationToken
impl CancellationToken
Sourcepub fn register_local(
&self,
callback: impl FnOnce() + 'static,
) -> LocalCancellationTokenRegistration
pub fn register_local( &self, callback: impl FnOnce() + 'static, ) -> LocalCancellationTokenRegistration
Registers a callback that runs on the current thread when the token is canceled: at once
when it is canceled on this thread, or already canceled; through the poster of this thread,
or its queue of run_pending_wakes, when it is
canceled on another thread. The callback need not be Send.
Trait Implementations§
Source§impl Clone for CancellationToken
impl Clone for CancellationToken
Source§fn clone(&self) -> CancellationToken
fn clone(&self) -> CancellationToken
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§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 UnsafeUnpin 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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more