[][src]Enum arenatree::Arena

pub enum Arena<'a, T: 'a> {
    Owned(Vec<Option<T>>),
    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.

Variants

Methods

impl<'a, T> Arena<'a, T>
[src]

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

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.

Get an iterator over all existing NodeIds in the arena.

Trait Implementations

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

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

impl<'a, T> Clone for Arena<'a, T> where
    T: Clone
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a, T> Default for Arena<'a, T>
[src]

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

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

Formats the value using the given formatter. Read more

impl<'a, T> Index<NodeId> for Arena<'a, T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<'a, T> IndexMut<NodeId> for Arena<'a, T>
[src]

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

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

Blanket Implementations

impl<T> From for T
[src]

Performs the conversion.

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

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

Immutably borrows from an owned value. Read more

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

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

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

Mutably borrows from an owned value. Read more