pub struct UnsafeObject { /* private fields */ }Expand description
Smart pointer point to object stored in Bump It use TypeId to check when downcast in runtime, so only ’static type supported
Implementations§
Source§impl UnsafeObject
impl UnsafeObject
Sourcepub unsafe fn new<T>(bump: &Bump, inner: T) -> Selfwhere
T: Send + 'static,
pub unsafe fn new<T>(bump: &Bump, inner: T) -> Selfwhere
T: Send + 'static,
§Safety
the safety depends on Bump used to create this object not reset or droped while this object is still live
Sourcepub unsafe fn downcast_ref<T>(&self) -> Option<&T>where
T: 'static,
pub unsafe fn downcast_ref<T>(&self) -> Option<&T>where
T: 'static,
§Safety
The safety depends on Bump used to create this object not reset or droped while this object is still live if this object is of type T, will return the reference of T otherwise will return None
Sourcepub unsafe fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: 'static,
pub unsafe fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: 'static,
§Safety
The safety depends on Bump used to create this object not reset or droped while this object is still live if this object is of type T, will return the mutable reference of T otherwise will return None
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UnsafeObject
impl !RefUnwindSafe for UnsafeObject
impl Send for UnsafeObject
impl !Sync for UnsafeObject
impl Unpin for UnsafeObject
impl UnwindSafe for UnsafeObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more