external_memory/
ptr.rs

1#[derive(Debug)]
2/// Pointer to a host allocated memory.
3pub struct Ptr(*mut std::ffi::c_void);
4impl Ptr {
5    /// Get the inner ptr
6    pub fn as_raw_ptr(&self) -> *mut std::ffi::c_void {
7        self.0
8    }
9}
10impl<T> From<*mut T> for Ptr {
11    fn from(ptr: *mut T) -> Self {
12        Self(unsafe { std::mem::transmute(ptr) })
13    }
14}
15impl std::ops::Deref for Ptr {
16    type Target = *mut std::ffi::c_void;
17    fn deref(&self) -> &Self::Target {
18        &self.0
19    }
20}