pub struct OwnedPtr<T: Any> { /* private fields */ }Implementations§
Source§impl<T: Any> OwnedPtr<T>
impl<T: Any> OwnedPtr<T>
pub fn new(value: T) -> Self
Sourcepub const unsafe fn from_raw(ptr: *mut T) -> Self
pub const unsafe fn from_raw(ptr: *mut T) -> Self
§Safety
ptr must be uniquely owned, created by Box::into_raw(Box<T>) for the
same T, and must not have already been reclaimed.
pub const fn null() -> Self
pub fn is_null(&self) -> bool
pub fn with_value<R: Any, F>(self, op: F) -> Result<R>
pub fn with_value_ok<R: Any, F>(self, op: F) -> Result<R>where
F: FnOnce(T) -> R,
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for OwnedPtr<T>
impl<T> RefUnwindSafe for OwnedPtr<T>where
T: RefUnwindSafe,
impl<T> !Send for OwnedPtr<T>
impl<T> !Sync for OwnedPtr<T>
impl<T> Unpin for OwnedPtr<T>
impl<T> UnsafeUnpin for OwnedPtr<T>
impl<T> UnwindSafe for OwnedPtr<T>where
T: RefUnwindSafe,
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