Enum arenatree::Arena[][src]

pub enum Arena<'a, T: 'a> {
    Borrowed(&'a mut Vec<Option<T>>),

Arenas are efficient ways of storing trees: All nodes are actually on a flat surface, but have IDs to other nodes.



impl<'a, T> Arena<'a, T>

Create a new arena instance

Create a new arena instance that reuses an existing vector

Create a new arena reference that shares the inner vector. This reference will make the existing instance invalid for use while the reference is active.

Return the arena instance


Panics if this arena instance was created with Borrowed

Return a slice pointing to the inner arena representation

Important traits for ArenaIter<'a, T>

Return an iterator over the nodes in this arena

Place an element into the arena

Move out of an element in the arena. This will make following indexing calls on that index panic. This will not deallocate any space. This is due to the fact that all indexes need to stay the same. We could use a different data type instead of a tree to prevent this, but that instead means lookup will be slightly slower.

Trait Implementations

impl<'a, T: Debug + 'a> Debug for Arena<'a, T>

Formats the value using the given formatter. Read more

impl<'a, T> Default for Arena<'a, T>

Returns the "default value" for a type. Read more

impl<'a, T> Index<NodeId> for Arena<'a, T>

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<'a, T> IndexMut<NodeId> for Arena<'a, T>

Performs the mutable indexing (container[index]) operation.

impl<'r, 'a, T> IntoIterator for &'r Arena<'a, T>

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

impl<'a, T> Send for Arena<'a, T> where
    T: Send

impl<'a, T> Sync for Arena<'a, T> where
    T: Sync