[][src]Struct chunky::MultiArena

pub struct MultiArena { /* fields omitted */ }

Based on a collection type for fixed-size items ("Bin"), creates a collection for heterogenously-sized items which will be stored in the most appropriately-sized bin.

All Bins will use children of a main chunker to create their chunks.

Methods

impl MultiArena[src]

pub fn new(
    ident: Ident,
    typical_chunk_size: usize,
    base_size: usize,
    storage: Rc<dyn ChunkStorage>
) -> Self
[src]

Create a new MultiArena collection using Arena bins and a base size that represents the smallest expected item size (used as the item size of the smallest-sized bin)

pub fn size_to_index(&self, size: usize) -> usize[src]

Get the index of the Bin which stores items of size size

pub fn at(&self, index: MultiArenaIndex) -> *const u8[src]

Get an (untyped) pointer to the item at the given index

pub fn at_mut(&mut self, index: MultiArenaIndex) -> *mut u8[src]

Get an (untyped) mutable pointer to the item at the given index

pub fn push(&mut self, size: usize) -> (*mut u8, MultiArenaIndex)[src]

Add an item to the end of the bin corresponding to its size

pub fn swap_remove_within_bin(
    &mut self,
    index: MultiArenaIndex
) -> Option<*const u8>
[src]

Remove the item referenced by index from its bin by swapping with the bin's last item

pub fn populated_bin_indices_and_lens<'a>(
    &'a self
) -> impl Iterator<Item = (usize, usize)> + 'a
[src]

Return indices of bins that actually contain items and their respective lengths

pub fn bin_len(&self, bin_index: usize) -> usize[src]

Get the length of the bin of the given bin index

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]