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