1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::rc::Rc;
use std::sync::Arc;
pub unsafe trait IGetMutUnchecked<T: ?Sized>{
#[allow(clippy::mut_from_ref)]
unsafe fn get_mut_unchecked(&self)->&mut T;
}
unsafe impl <T: ?Sized> IGetMutUnchecked<T> for crate::Arc::SharedPtr<T> {
unsafe fn get_mut_unchecked(&self) -> &mut T {
&mut *(Arc::<T>::as_ptr(&**self) as *mut T)
}
}
unsafe impl <T: ?Sized> IGetMutUnchecked<T> for crate::Rc::SharedPtr<T> {
unsafe fn get_mut_unchecked(&self) -> &mut T {
&mut *(Rc::<T>::as_ptr(&**self) as *mut T)
}
}