Struct storage_api::DynStorage
source · [−]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>>
wheresize_of::<A>() == 0
RawBox<T, InlineStorage<usize>>
RawBox<T, SmallStorage<usize, A>>
wheresize_of::<A>() == 0
&mut ManuallyDrop<T>
(used as “&move T
”)T
whereLayout::new::<T>().fits_in(Layout::new::<usize>())
Trait Implementations
sourceimpl<'a> Storage for DynStorage<'a>
impl<'a> Storage for DynStorage<'a>
sourceunsafe fn deallocate(&mut self, _: Self::Handle, _: Layout)
unsafe fn deallocate(&mut self, _: Self::Handle, _: Layout)
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
sourcefn allocate(&mut self, _: Layout) -> Result<Self::Handle, AllocError>
fn allocate(&mut self, _: Layout) -> Result<Self::Handle, AllocError>
Allocate memory handle in this storage. Read more
sourceunsafe fn resolve(&self, _: Self::Handle, layout: Layout) -> &Memory
unsafe fn resolve(&self, _: Self::Handle, layout: Layout) -> &Memory
Resolve a memory handle in this storage to a reference. Read more
sourceunsafe fn resolve_mut(&mut self, _: Self::Handle, layout: Layout) -> &mut Memory
unsafe fn resolve_mut(&mut self, _: Self::Handle, layout: Layout) -> &mut Memory
Resolve a memory handle in this storage to a mutable reference. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for DynStorage<'a>
impl<'a> Send for DynStorage<'a>
impl<'a> Sync for DynStorage<'a>
impl<'a> Unpin for DynStorage<'a>
impl<'a> UnwindSafe for DynStorage<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more