Struct fixed_typed_arena::Arena[][src]

pub struct Arena<T, ChunkSize: Unsigned = U16>(_);

An arena that allocates items of type T in non-amortized O(1) (constant) time.

The arena allocates fixed-size chunks of memory, each able to hold up to ChunkSize items. ChunkSize is an unsigned type-level integer.

All items are allocated on the heap.

Panics

The arena may panic when created or used if mem::size_of::<T>() times ChunkSize::USIZE is greater than usize::MAX.

Implementations

impl<T, ChunkSize: Unsigned> Arena<T, ChunkSize>[src]

pub fn new() -> Self[src]

Creates a new Arena.

#[must_use]pub fn alloc(&self, value: T) -> &mut T[src]

Allocates a new item in the arena and initializes it with value. Returns a reference to the allocated item.

Trait Implementations

impl<T, ChunkSize: Unsigned> Default for Arena<T, ChunkSize>[src]

Auto Trait Implementations

impl<T, ChunkSize = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>> !Send for Arena<T, ChunkSize>

impl<T, ChunkSize = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>> !Sync for Arena<T, ChunkSize>

impl<T, ChunkSize> Unpin for Arena<T, ChunkSize> where
    T: Unpin

Blanket Implementations

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

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

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

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

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

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

type Output = T

Should always be Self

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.