//! The module including all wrapper types for FFI. use std::ffi::c_void; use num_enum::TryFromPrimitive; // region: HICON /// The type representing Win32 HICON handle. /// /// In theory, we can fetch HICON type from "windows_sys" crate. /// However, I don't want to add it as this crate's dependency, /// because I don't use anything within it except this type. /// So I check Microsoft document, re-define it in there for this crate. /// Reference: pub type HICON = *mut c_void; /// The invalid value of Win32 HICON handle. /// /// The same reason like [WFHICON] to re-define it in there. pub const INVALID_HICON: HICON = std::ptr::null_mut(); // endregion // region: Scope /// The FFI wrapper for [wfassoc::Scope]. #[repr(u32)] #[derive(Debug, Copy, Clone, TryFromPrimitive)] pub enum Scope { User = 0, System = 1, } impl From for wfassoc::Scope { fn from(value: Scope) -> Self { match value { Scope::User => wfassoc::Scope::User, Scope::System => wfassoc::Scope::System, } } } // endregion // region: View /// The FFI wrapper for [wfassoc::View]. #[repr(u32)] #[derive(Debug, Copy, Clone, TryFromPrimitive)] pub enum View { User = 0, System = 1, Hybrid = 2, } impl From for wfassoc::View { fn from(value: View) -> Self { match value { View::User => wfassoc::View::User, View::System => wfassoc::View::System, View::Hybrid => wfassoc::View::Hybrid, } } } // endregion // region: Misc Types and Constants /// The invalid value of index. pub const INVALID_INDEX: usize = usize::MAX; // endregion