Struct Box

Source
pub struct Box<'m, T>
where T: ?Sized + Pointee<Metadata = DynMetadata<T>>,
{ /* private fields */ }
Expand description

A box that uses the provided memory to store dynamic objects.

Implementations§

Source§

impl<'m, T> Box<'m, T>
where T: ?Sized + Pointee<Metadata = DynMetadata<T>>,

Source

pub fn new<Value>(mem: &'m mut [u8], value: Value) -> Self
where Value: Unsize<T>,

Places a value into the specified mem buffer. The user should provide enough memory to store the value with its metadata considering alignment requirements.

§Panics
  • If the provided buffer is insufficient to store the value.
Source

pub fn layout_of_dyn<Value>(value: &Value) -> Layout
where Value: Unsize<T> + ?Sized,

Calculates layout describing a record that could be used to allocate backing structure for Value.

Trait Implementations§

Source§

impl<'m, T> AsMut<T> for Box<'m, T>
where T: ?Sized + Pointee<Metadata = DynMetadata<T>>,

Source§

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

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<'m, T> AsRef<T> for Box<'m, T>
where T: ?Sized + Pointee<Metadata = DynMetadata<T>>,

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'m, T> Deref for Box<'m, T>
where T: ?Sized + Pointee<Metadata = DynMetadata<T>>,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<'m, T> DerefMut for Box<'m, T>
where T: ?Sized + Pointee<Metadata = DynMetadata<T>>,

Source§

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

Mutably dereferences the value.
Source§

impl<'m, T> Drop for Box<'m, T>
where T: ?Sized + Pointee<Metadata = DynMetadata<T>>,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'m, T> Freeze for Box<'m, T>
where T: ?Sized,

§

impl<'m, T> RefUnwindSafe for Box<'m, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'m, T> Send for Box<'m, T>
where T: Send + ?Sized,

§

impl<'m, T> Sync for Box<'m, T>
where T: Sync + ?Sized,

§

impl<'m, T> Unpin for Box<'m, T>
where T: Unpin + ?Sized,

§

impl<'m, T> !UnwindSafe for Box<'m, T>

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<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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.