pub struct Arena<T, const CHUNK_SIZE: usize>(_);
Expand description

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 CHUNK_SIZE items. All items are allocated on the heap.

Panics

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

Implementations

Creates a new Arena.

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

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.