pub struct Scope<T, F: FnOnce(T)> { /* private fields */ }
Expand description
RAII Scope, running closure in destructor.
Implementations§
Source§impl<T, F: FnOnce(T)> Scope<T, F>
impl<T, F: FnOnce(T)> Scope<T, F>
Sourcepub fn stack<NF: FnOnce(&mut T)>(self, dtor: NF) -> Scope<T, impl FnOnce(T)>
pub fn stack<NF: FnOnce(&mut T)>(self, dtor: NF) -> Scope<T, impl FnOnce(T)>
Adds new function to be invoked in scope of the guard.
This function is executed before current one. Similarly to how stack variables dtors are invoked in reverse order.
Note that stacked function cannot take guarded by value, only original function will retain owned value.
Trait Implementations§
Auto Trait Implementations§
impl<T, F> Freeze for Scope<T, F>
impl<T, F> RefUnwindSafe for Scope<T, F>where
T: RefUnwindSafe,
F: RefUnwindSafe,
impl<T, F> Send for Scope<T, F>
impl<T, F> Sync for Scope<T, F>
impl<T, F> Unpin for Scope<T, F>
impl<T, F> UnwindSafe for Scope<T, F>where
T: UnwindSafe,
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