pub struct DynStorage<'a> { /* private fields */ }
Expand description

Dynamic single storage for use with RawBox<dyn Trait, DynStorage<A>>.

DynStorage cannot be constructed directly. Instead, you can convert any of the following pointer types into RawBox<dyn Trait, DynStorage>, given you have T: Trait:

  • RawBox<T, AllocStorage<A>> where size_of::<A>() == 0
  • RawBox<T, InlineStorage<usize>>
  • RawBox<T, SmallStorage<usize, A>> where size_of::<A>() == 0
  • &mut ManuallyDrop<T> (used as “&move T”)
  • T where Layout::new::<T>().fits_in(Layout::new::<usize>())

Trait Implementations

Deallocation is a no-op. When the boxed T is dropped, the drop_in_place call handles any required deallocation. XXX: This might break the actual Box’s normal API, as it isn’t properly “DerefPlace” anymore – normally you can move out of a box and dealloc it separately, or drop the contents of a box and then reinitialize it with new contents. If comandeering drop_in_place like this isn’t viable, we’ll have to instead add a separate entry for dealloc into the vtable at the end, so it can still be used as the normal dyn Trait vtable. This might even be preferable if this is done through more compiler magic than libs code.

The handle which is used to access the stored memory. Read more

Allocate memory handle in this storage. Read more

Resolve a memory handle in this storage to a reference. Read more

Resolve a memory handle in this storage to a mutable reference. Read more

Grow a memory handle to a larger size. Read more

Shrink a memory handle to a smaller size. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.