pub struct DropGuard {
pub(super) inner: Option<CancellationToken>,
}Expand description
A wrapper for cancellation token which automatically cancels
it on drop. It is created using drop_guard method on the CancellationToken.
Fields§
§inner: Option<CancellationToken>Implementations§
Source§impl DropGuard
impl DropGuard
Sourcepub fn token(&self) -> &CancellationToken
pub fn token(&self) -> &CancellationToken
Returns a reference to the cancellation token wrapped by this guard.
Sourcepub fn disarm(self) -> CancellationToken
pub 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§
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§
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