Struct winsafe::guard::GlobalFreeGuard
source · pub struct GlobalFreeGuard { /* private fields */ }
Available on crate feature
kernel
only.Expand description
RAII implementation for HGLOBAL
which automatically
calls
GlobalFree
when the object goes out of scope.
Implementations§
source§impl GlobalFreeGuard
impl GlobalFreeGuard
sourcepub const unsafe fn new(handle: HGLOBAL) -> Self
pub const unsafe fn new(handle: HGLOBAL) -> Self
Constructs the guard by taking ownership of the handle.
This method can be used as an escape hatch to interoperate with other libraries.
§Safety
Be sure the handle must be freed with the specified function at the end of scope.
sourcepub fn leak(&mut self) -> HGLOBAL
pub fn leak(&mut self) -> HGLOBAL
Ejects the underlying handle, leaving a
Handle::INVALID
in its
place.
Since the internal handle will be invalidated, the destructor will not run. It’s your responsability to run it, otherwise you’ll cause a resource leak.
Trait Implementations§
source§impl Deref for GlobalFreeGuard
impl Deref for GlobalFreeGuard
source§impl DerefMut for GlobalFreeGuard
impl DerefMut for GlobalFreeGuard
Auto Trait Implementations§
impl Freeze for GlobalFreeGuard
impl RefUnwindSafe for GlobalFreeGuard
impl Send for GlobalFreeGuard
impl !Sync for GlobalFreeGuard
impl Unpin for GlobalFreeGuard
impl UnwindSafe for GlobalFreeGuard
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