Struct raw_window_handle::Win32WindowHandle
source · #[non_exhaustive]pub struct Win32WindowHandle {
pub hwnd: NonZeroIsize,
pub hinstance: Option<NonZeroIsize>,
}
Expand description
Raw window handle for Win32.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.hwnd: NonZeroIsize
A Win32 HWND
handle.
hinstance: Option<NonZeroIsize>
The GWLP_HINSTANCE
associated with this type’s HWND
.
Implementations§
source§impl Win32WindowHandle
impl Win32WindowHandle
sourcepub fn new(hwnd: NonZeroIsize) -> Self
pub fn new(hwnd: NonZeroIsize) -> Self
Create a new handle to a window.
§Safety
It is assumed that the Win32 handle belongs to the current thread. This is necessary for the handle to be considered “valid” in all cases.
§Example
let window: HWND;
let mut handle = Win32WindowHandle::new(NonZeroIsize::new(window.0).unwrap());
// Optionally set the GWLP_HINSTANCE.
let hinstance = NonZeroIsize::new(unsafe { GetWindowLongPtrW(window, GWLP_HINSTANCE) }).unwrap();
handle.hinstance = hinstance;
Trait Implementations§
source§impl Clone for Win32WindowHandle
impl Clone for Win32WindowHandle
source§fn clone(&self) -> Win32WindowHandle
fn clone(&self) -> Win32WindowHandle
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Win32WindowHandle
impl Debug for Win32WindowHandle
source§impl From<Win32WindowHandle> for RawWindowHandle
impl From<Win32WindowHandle> for RawWindowHandle
source§fn from(value: Win32WindowHandle) -> Self
fn from(value: Win32WindowHandle) -> Self
Converts to this type from the input type.
source§impl Hash for Win32WindowHandle
impl Hash for Win32WindowHandle
source§impl PartialEq for Win32WindowHandle
impl PartialEq for Win32WindowHandle
source§fn eq(&self, other: &Win32WindowHandle) -> bool
fn eq(&self, other: &Win32WindowHandle) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for Win32WindowHandle
impl Eq for Win32WindowHandle
impl StructuralPartialEq for Win32WindowHandle
Auto Trait Implementations§
impl Freeze for Win32WindowHandle
impl RefUnwindSafe for Win32WindowHandle
impl Send for Win32WindowHandle
impl Sync for Win32WindowHandle
impl Unpin for Win32WindowHandle
impl UnwindSafe for Win32WindowHandle
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