Skip to main content

OwnedPtr

Struct OwnedPtr 

Source
pub struct OwnedPtr<T: Any> { /* private fields */ }

Implementations§

Source§

impl<T: Any> OwnedPtr<T>

Source

pub fn new(value: T) -> Self

Source

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.

Source

pub const fn null() -> Self

Source

pub fn is_null(&self) -> bool

Source

pub fn with_value<R: Any, F>(self, op: F) -> Result<R>
where F: FnOnce(T) -> Result<R>,

Source

pub fn with_value_ok<R: Any, F>(self, op: F) -> Result<R>
where F: FnOnce(T) -> R,

Trait Implementations§

Source§

impl<T: Any> Default for OwnedPtr<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Any> Drop for OwnedPtr<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Any> From<T> for OwnedPtr<T>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.