1
0
Fork 0
forked from wry/wry

autocommit 2022-01-03 18:56:52 CET

This commit is contained in:
Julian Orth 2022-01-03 18:56:52 +01:00
parent fc887b339e
commit 30376c595c
39 changed files with 3157 additions and 309 deletions

25
src/utils/ptr_ext.rs Normal file
View file

@ -0,0 +1,25 @@
pub trait PtrExt<T> {
unsafe fn deref<'a>(self) -> &'a T;
}
pub trait MutPtrExt<T> {
unsafe fn deref_mut<'a>(self) -> &'a mut T;
}
impl<T> PtrExt<T> for *const T {
unsafe fn deref<'a>(self) -> &'a T {
&*self
}
}
impl<T> PtrExt<T> for *mut T {
unsafe fn deref<'a>(self) -> &'a T {
&*self
}
}
impl<T> MutPtrExt<T> for *mut T {
unsafe fn deref_mut<'a>(self) -> &'a mut T {
&mut *self
}
}