pub struct DeferGuard<F: FnOnce(), S: Strategy = Always> { /* private fields */ }Expand description
Holds a synchronous action for at-most-once deferred execution.
The strategy decides whether the action runs when the guard is dropped.
Calling DeferGuard::disarm returns the action without executing it, while
DeferGuard::run_now executes it immediately regardless of the strategy.
Panics from the strategy or a drop-time action propagate. A second panic
during unwinding may abort the process.
Implementations§
Source§impl<F: FnOnce()> DeferGuard<F>
impl<F: FnOnce()> DeferGuard<F>
Source§impl<F: FnOnce(), S: Strategy> DeferGuard<F, S>
impl<F: FnOnce(), S: Strategy> DeferGuard<F, S>
Trait Implementations§
Auto Trait Implementations§
impl<F, S> Freeze for DeferGuard<F, S>where
F: Freeze,
impl<F, S> RefUnwindSafe for DeferGuard<F, S>where
F: RefUnwindSafe,
impl<F, S> Send for DeferGuard<F, S>where
F: Send,
impl<F, S> Sync for DeferGuard<F, S>where
F: Sync,
impl<F, S> Unpin for DeferGuard<F, S>where
F: Unpin,
impl<F, S> UnsafeUnpin for DeferGuard<F, S>where
F: UnsafeUnpin,
impl<F, S> UnwindSafe for DeferGuard<F, S>where
F: UnwindSafe,
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