pub struct StdCancellationToken { /* private fields */ }
Trait Implementations§
Source§impl CancellationToken for StdCancellationToken
impl CancellationToken for StdCancellationToken
Source§fn error_if_cancelled(&self) -> Result<(), CancellationError>
fn error_if_cancelled(&self) -> Result<(), CancellationError>
Performs a one-time check whether the flow of execution is cancelled. Read more
Source§fn on_cancellation<'a>(
&self,
func: &'a mut CancellationFunc<'a>,
) -> CancellationGuard<'a>
fn on_cancellation<'a>( &self, func: &'a mut CancellationFunc<'a>, ) -> CancellationGuard<'a>
Registers a cancellation handler, which will be invoked when the execution flow
is cancelled.
The cancellation handler can be called from any thread which initiates the cancellation.
If the flow is already cancelled when this function is called, the cancellation
handler will be called synchronously.
The function returns a guard which can be used to unregister the cancellation handler.
After the guard is dropped, the handler is guaranteed not be called anymore.
Auto Trait Implementations§
impl Freeze for StdCancellationToken
impl RefUnwindSafe for StdCancellationToken
impl !Send for StdCancellationToken
impl !Sync for StdCancellationToken
impl Unpin for StdCancellationToken
impl UnwindSafe for StdCancellationToken
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