Whitespace only; the fork has no own rustfmt.toml so the Oak root policy applies.
54 lines
868 B
Rust
54 lines
868 B
Rust
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
|
|
}
|
|
}
|