Struct winsafe::guard::CloseDesktopGuard
source · pub struct CloseDesktopGuard { /* private fields */ }
Available on crate features
kernel
and user
only.Expand description
RAII implementation for HDESK
which automatically
calls
CloseDesktop
when the object goes out of scope.
Implementations§
source§impl CloseDesktopGuard
impl CloseDesktopGuard
sourcepub const unsafe fn new(handle: HDESK) -> Self
pub const unsafe fn new(handle: HDESK) -> 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) -> HDESK
pub fn leak(&mut self) -> HDESK
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 CloseDesktopGuard
impl Deref for CloseDesktopGuard
source§impl DerefMut for CloseDesktopGuard
impl DerefMut for CloseDesktopGuard
Auto Trait Implementations§
impl RefUnwindSafe for CloseDesktopGuard
impl Send for CloseDesktopGuard
impl !Sync for CloseDesktopGuard
impl Unpin for CloseDesktopGuard
impl UnwindSafe for CloseDesktopGuard
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