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