Skip to main content

BoundedStore

Trait BoundedStore 

Source
pub trait BoundedStore: SlabStore {
    // Required method
    fn try_alloc(
        &self,
        value: Self::Item,
    ) -> Result<Slot<Self::Item>, Full<Self::Item>>;
}
Expand description

Bounded (fixed-capacity) storage — provides fallible allocation.

Use try_alloc when you need graceful error handling. For the common case where capacity exhaustion is a fatal error, use SlabStore::alloc directly (it panics on bounded-full).

Required Methods§

Source

fn try_alloc( &self, value: Self::Item, ) -> Result<Slot<Self::Item>, Full<Self::Item>>

Attempts to allocate a slot with the given value.

Returns Err(Full(value)) if storage is at capacity.

Implementors§

Source§

impl<T> BoundedStore for Slab<T>