Struct DropGuard

pub struct DropGuard { /* private fields */ }

A wrapper for cancellation token which automatically cancels it on drop. It is created using drop_guard method on the CancellationToken.

Implementations

impl DropGuard

fn token(&self) -> &CancellationToken

Returns a reference to the cancellation token wrapped by this guard.

fn disarm(self) -> CancellationToken

Returns stored cancellation token and removes this drop guard instance (i.e. it will no longer cancel token). Other guards for this token are not affected.

Trait Implementations

impl Debug for DropGuard

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Drop for DropGuard

fn drop(&mut self)

Auto Trait Implementations

impl Freeze for DropGuard

impl RefUnwindSafe for DropGuard

impl Send for DropGuard

impl Sync for DropGuard

impl Unpin for DropGuard

impl UnsafeUnpin for DropGuard

impl UnwindSafe for DropGuard

Blanket Implementations

impl<T> Any for DropGuard where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for DropGuard where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for DropGuard where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for DropGuard

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for DropGuard where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for DropGuard where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for DropGuard where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>