use std::ffi; use types::raw; pub struct WinRaw { view: *mut ffi::c_void, } impl From<*mut ffi::c_void> for WinRaw { fn from(value: *mut ffi::c_void) -> Self { Self { view: value } } } unsafe impl Send for WinRaw {} unsafe impl Sync for WinRaw {} impl raw::HasWindowHandle for WinRaw { fn window_handle(&self) -> Result, raw::HandleError> { if let Some(view) = core::num::NonZeroIsize::new(self.view as isize) { Ok(unsafe { raw::WindowHandle::borrow_raw(raw::RawWindowHandle::Win32(raw::Win32WindowHandle::new(view))) }) } else { Err(raw::HandleError::Unavailable) } } } impl raw::HasDisplayHandle for WinRaw { fn display_handle(&self) -> Result, raw::HandleError> { Ok(unsafe { raw::DisplayHandle::borrow_raw(raw::RawDisplayHandle::Windows(raw::WindowsDisplayHandle::new())) }) } }