Struct storage_api::SmallStorage
source · [−]pub struct SmallStorage<DataStore, A: Allocator> { /* private fields */ }
Expand description
A single storage which stores memory inline if it fits, otherwise falling
back to using an Allocator
.
The DataStore
type parameter determines the layout of the inline storage.
(It would be nice to use const LAYOUT: Layout
instead, but the needed
features are currently a little too incomplete to be usable here.)
Implementations
sourceimpl<DataStore, A: Allocator> SmallStorage<DataStore, A>
impl<DataStore, A: Allocator> SmallStorage<DataStore, A>
Trait Implementations
sourceimpl<DataStore, A: Allocator> Storage for SmallStorage<DataStore, A>
impl<DataStore, A: Allocator> Storage for SmallStorage<DataStore, A>
sourcefn allocate(&mut self, layout: Layout) -> Result<Self::Handle, AllocError>
fn allocate(&mut self, layout: Layout) -> Result<Self::Handle, AllocError>
Allocate memory handle in this storage. Read more
sourceunsafe fn deallocate(&mut self, handle: Self::Handle, layout: Layout)
unsafe fn deallocate(&mut self, handle: Self::Handle, layout: Layout)
Deallocate an object handle in this storage. Read more
sourceunsafe fn resolve(&self, handle: Self::Handle, layout: Layout) -> &Memory
unsafe fn resolve(&self, handle: Self::Handle, layout: Layout) -> &Memory
Resolve a memory handle in this storage to a reference. Read more
sourceunsafe fn resolve_mut(
&mut self,
handle: Self::Handle,
layout: Layout
) -> &mut Memory
unsafe fn resolve_mut(
&mut self,
handle: Self::Handle,
layout: Layout
) -> &mut Memory
Resolve a memory handle in this storage to a mutable reference. Read more
Auto Trait Implementations
impl<DataStore, A> RefUnwindSafe for SmallStorage<DataStore, A> where
A: RefUnwindSafe,
DataStore: RefUnwindSafe,
impl<DataStore, A> Send for SmallStorage<DataStore, A> where
A: Send,
DataStore: Send,
impl<DataStore, A> Sync for SmallStorage<DataStore, A> where
A: Sync,
DataStore: Sync,
impl<DataStore, A> Unpin for SmallStorage<DataStore, A> where
A: Unpin,
DataStore: Unpin,
impl<DataStore, A> UnwindSafe for SmallStorage<DataStore, A> where
A: UnwindSafe,
DataStore: UnwindSafe,
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