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