external_memory/handle.rs
1#[derive(Debug)]
2/// Windows handle.
3pub struct Handle(*mut std::ffi::c_void);
4impl From<*mut std::ffi::c_void> for Handle {
5 fn from(ptr: *mut std::ffi::c_void) -> Self {
6 Self(ptr)
7 }
8}
9#[cfg(windows)]
10impl std::os::windows::io::AsRawHandle for Handle {
11 fn as_raw_handle(&self) -> std::os::windows::raw::HANDLE {
12 self.0
13 }
14}
15impl std::ops::Deref for Handle {
16 type Target = *mut std::ffi::c_void;
17 fn deref(&self) -> &Self::Target {
18 &self.0
19 }
20}