Struct windows_helpers::ResGuard
source · pub struct ResGuard<R, F>where
F: FnOnce(R),{ /* private fields */ }Expand description
Holds a resource and a free-closure that is called when the guard is dropped.
Allows to couple resource acquisition and freeing, while treating the guard as the contained resource and ensuring freeing will happen. When writing the code, it’s also nice to transfer the documentation into everything that has to happen in one go without having to split it into upper and lower or here- and there-code. In a function, Rust’s drop order should ensure that later aquired resources are freed first.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<R, F> RefUnwindSafe for ResGuard<R, F>where
F: RefUnwindSafe,
R: RefUnwindSafe,
impl<R, F> Send for ResGuard<R, F>
impl<R, F> Sync for ResGuard<R, F>
impl<R, F> Unpin for ResGuard<R, F>
impl<R, F> UnwindSafe for ResGuard<R, F>where
F: UnwindSafe,
R: 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