Struct winsafe::guard::CloseHandlePiGuard
source · pub struct CloseHandlePiGuard { /* private fields */ }
Available on crate feature
kernel
only.Expand description
RAII implementation for PROCESS_INFORMATION
which automatically calls
CloseHandle
on hProcess
and hThread
fields when the object goes out of scope.
Implementations§
source§impl CloseHandlePiGuard
impl CloseHandlePiGuard
sourcepub const unsafe fn new(pi: PROCESS_INFORMATION) -> Self
pub const unsafe fn new(pi: PROCESS_INFORMATION) -> Self
Constructs the guard by taking ownership of the struct.
§Safety
Be sure the handles must be freed with
CloseHandle
at the end of the scope.
sourcepub fn leak(&mut self) -> PROCESS_INFORMATION
pub fn leak(&mut self) -> PROCESS_INFORMATION
Ejects the underlying struct, leaving
PROCESS_INFORMATION::default
in
its place.
Since the internal handles 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 CloseHandlePiGuard
impl Deref for CloseHandlePiGuard
source§impl DerefMut for CloseHandlePiGuard
impl DerefMut for CloseHandlePiGuard
Auto Trait Implementations§
impl RefUnwindSafe for CloseHandlePiGuard
impl Send for CloseHandlePiGuard
impl !Sync for CloseHandlePiGuard
impl Unpin for CloseHandlePiGuard
impl UnwindSafe for CloseHandlePiGuard
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