Struct synctree::arena::Arena[][src]

pub struct Arena<T> { /* fields omitted */ }

A map, providing fast indexing, insertion and removal of elements, but not preserving element order.

Every element is associated with a unique id.

Inside, it uses a fast FnvHashSet with free ids.

Every time an element is removed, it's id is being written there, so there is no need to shift other elements to the empty space.

Methods

impl<T> Arena<T>
[src]

Constructs an empty Arena.

The arena won't allocate until elements are pushed onto it.

Constructs a new Arena with specified capacity. If capacity is 0, the arena won't allocate.

Returns the capacity of Arena.

Returns the number of elements in Arena.

Returns true if the arena contains no elements.

Inserts a new element into the arena and returns an id associated with it.

Returns true if the arena contains given id.

Returns a reference to an element in the arena.

If the specified id does not exists, returns None.

Returns a mutable reference to an element in the arena.

If the specified id does not exists, returns None.

Removes and returns the element with specified id.

If the id does not exists, returns None.

Clears the arena.

This method does not change the capacity of the arena.

Important traits for Iter<'a, T>

Returns an iterator over the arena.

Important traits for IterMut<'a, T>

Returns a mutable iterator over the arena.

Trait Implementations

impl<T: Debug> Debug for Arena<T>
[src]

Formats the value using the given formatter. Read more

impl<T: Clone> Clone for Arena<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T> Index<Id> for Arena<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<Id> for Arena<T>
[src]

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

Auto Trait Implementations

impl<T> Send for Arena<T> where
    T: Send

impl<T> Sync for Arena<T> where
    T: Sync