Update exif module

This commit is contained in:
2022-05-13 15:25:27 +08:00
parent 3868d69d23
commit cbbec08db6
8 changed files with 149 additions and 31 deletions

View File

@@ -8,3 +8,17 @@ pub trait ToRawHandle<T> {
self.to_raw_handle() as *const T
}
}
pub trait FromRawHandle<T> {
unsafe fn from_raw_handle<'a>(ptr: *mut T) -> &'a mut Self;
unsafe fn from_const_handle<'a>(ptr: *const T) -> &'a Self;
}
impl<T> FromRawHandle<Self> for T {
unsafe fn from_raw_handle<'a>(ptr: *mut T) -> &'a mut Self {
&mut *(ptr)
}
unsafe fn from_const_handle<'a>(ptr: *const Self) -> &'a Self {
&*(ptr)
}
}