Type Alias fixed_typed_arena::Arena

source ·
pub type Arena<T, const CHUNK_SIZE: usize = 16, const SUPPORTS_POSITIONS: bool = false, const MUTABLE: bool = true> = Arena<T, Options<CHUNK_SIZE, SUPPORTS_POSITIONS, MUTABLE>>;
Expand description

Convenience alias for arena::Arena.

Aliased Type§

struct Arena<T, const CHUNK_SIZE: usize = 16, const SUPPORTS_POSITIONS: bool = false, const MUTABLE: bool = true>(/* private fields */);

Implementations§

source§

impl<T, Options: ArenaOptions<T>> Arena<T, Options>

source

pub fn new() -> Self

Creates a new Arena.

source

pub fn len(&self) -> usize

Returns the total number of items that have been allocated.

source

pub fn is_empty(&self) -> bool

Checks whether the arena is empty.

source

pub fn alloc(&self, value: T) -> &mut Twhere Options: ArenaOptions<T, Mutable = Bool<true>>,

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

This method calls handle_alloc_error if memory allocation fails; for a version that returns None instead, see Self::try_alloc.

source

pub fn try_alloc(&self, value: T) -> Option<&mut T>where Options: ArenaOptions<T, Mutable = Bool<true>>,

Like Self::alloc, but returns None if memory allocation fails.

source

pub fn alloc_shared(&self, value: T) -> &T

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

This method calls handle_alloc_error if memory allocation fails; for a version that returns None instead, see Self::try_alloc.

source

pub fn try_alloc_shared(&self, value: T) -> Option<&T>

Like Self::alloc_shared, but returns None if memory allocation fails.

source

pub fn iter(&self) -> Iter<'_, T, Options> where Options: ArenaOptions<T, Mutable = Bool<false>>,

Returns an iterator over the items in this arena.

source

pub unsafe fn iter_unchecked(&self) -> Iter<'_, T, Options>

Returns an iterator over the items in this arena.

Safety

There must be no mutable references (or references derived from mutable references) to items (or parts of items) in this arena or instances of IterMut for this arena.

source

pub fn iter_mut(&mut self) -> IterMut<'_, T, Options>

Returns a mutable iterator over the items in this arena.

source§

impl<T, Options> Arena<T, Options>where Options: ArenaOptions<T, SupportsPositions = Bool<true>>,

source

pub fn iter_at(&self, position: &Position) -> Iter<'_, T, Options> where Options: ArenaOptions<T, Mutable = Bool<false>>,

Returns an iterator starting at the specified position.

Panics

May panic if position does not refer to a position in this arena.

source

pub unsafe fn iter_at_unchecked( &self, position: &Position ) -> Iter<'_, T, Options>

Returns an iterator starting at the specified position.

Panics

May panic if position does not refer to a position in this arena.

Safety

Same requirements as Self::iter_unchecked.

source

pub fn iter_mut_at(&mut self, position: &Position) -> IterMut<'_, T, Options>

Returns a mutable iterator starting at the specified position.

Panics

May panic if position does not refer to a position in this arena.

Trait Implementations§

source§

impl<T, Options: ArenaOptions<T>> Default for Arena<T, Options>

source§

fn default() -> Self

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

impl<T, Options> Drop for Arena<T, Options>where Options: ArenaOptions<T>,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T, Options: ArenaOptions<T>> IntoIterator for Arena<T, Options>

§

type IntoIter = IntoIter<T, Options>

Which kind of iterator are we turning this into?
§

type Item = T

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T, Options> Send for Arena<T, Options>where T: Send, Options: ArenaOptions<T>,