53 lines · 940 B · Rust
RawDownload
use std::ops::Deref; use windows::Win32::{Foundation::HWND, UI::WindowsAndMessaging::HCURSOR}; #[derive(Debug, Clone, Copy)]pub(crate) struct SafeCursor {    raw: HCURSOR,} unsafe impl Send for SafeCursor {}unsafe impl Sync for SafeCursor {} impl From<HCURSOR> for SafeCursor {    fn from(value: HCURSOR) -> Self {        SafeCursor { raw: value }    }} impl Deref for SafeCursor {    type Target = HCURSOR;     fn deref(&self) -> &Self::Target {        &self.raw    }} #[derive(Debug, Clone, Copy)]pub(crate) struct SafeHwnd {    raw: HWND,} impl SafeHwnd {    pub(crate) fn as_raw(&self) -> HWND {        self.raw    }} unsafe impl Send for SafeHwnd {}unsafe impl Sync for SafeHwnd {} impl From<HWND> for SafeHwnd {    fn from(value: HWND) -> Self {        SafeHwnd { raw: value }    }} impl Deref for SafeHwnd {    type Target = HWND;     fn deref(&self) -> &Self::Target {        &self.raw    }}