#[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
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)