pub struct SelectObjectGuard<'a, G>where
G: GdiObject,{ /* private fields */ }
Available on crate features
kernel
and gdi
only.Expand description
RAII implementation for HDC::SelectObject
calls, which automatically selects the previous GDI object at the end of the
scope.
Implementations§
Source§impl<'a, G> SelectObjectGuard<'a, G>where
G: GdiObject,
impl<'a, G> SelectObjectGuard<'a, G>where
G: GdiObject,
Sourcepub const unsafe fn new(
hdc: &'a HDC,
prev_hgdi: G,
region: Option<REGION>,
) -> Self
pub const unsafe fn new( hdc: &'a HDC, prev_hgdi: G, region: Option<REGION>, ) -> Self
Constructs the guard by taking ownership of the handle.
§Safety
Be sure the handle must be again passed to
HDC::SelectObject
at the end of scope.
Sourcepub const fn prev_object(&self) -> &G
pub const fn prev_object(&self) -> &G
Returns a handle to the object that has been replaced.
Sourcepub const fn region(&self) -> Option<REGION>
pub const fn region(&self) -> Option<REGION>
Returns the region information returned by the source
HDC::SelectObject
call, if the
GdiObject
was an HRGN
;
otherwise returns None
.
Sourcepub fn leak(&mut self) -> G
pub fn leak(&mut self) -> G
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§
Auto Trait Implementations§
impl<'a, G> Freeze for SelectObjectGuard<'a, G>where
G: Freeze,
impl<'a, G> RefUnwindSafe for SelectObjectGuard<'a, G>where
G: RefUnwindSafe,
impl<'a, G> !Send for SelectObjectGuard<'a, G>
impl<'a, G> !Sync for SelectObjectGuard<'a, G>
impl<'a, G> Unpin for SelectObjectGuard<'a, G>where
G: Unpin,
impl<'a, G> UnwindSafe for SelectObjectGuard<'a, G>where
G: UnwindSafe,
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