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