Struct ego_tree::Tree
[−]
[src]
pub struct Tree<T> { /* fields omitted */ }A Vec-backed tree.
Nodes are allocated in a Vec which is only ever pushed to. NodeId is an opaque index into
the Vec.
Each Tree has a unique ID which is also given to each NodeId it creates. This is used to
bounds check a NodeId.
Methods
impl<T> Tree<T>[src]
fn values(&self) -> Values<T>[src]
Returns an iterator over node values in creation order.
fn values_mut(&mut self) -> ValuesMut<T>[src]
Returns a mutable iterator over node values in creation order.
fn into_values(self) -> IntoValues<T>[src]
Returns an iterator that moves node values out of the tree in creation order.
fn nodes(&self) -> Nodes<T>[src]
Returns an iterator over all nodes, including orphans, in creation order.
impl<T> Tree<T>[src]
fn new(root: T) -> Self[src]
Creates a new tree with a root node.
fn with_capacity(root: T, capacity: usize) -> Self[src]
Creates a new tree of the specified capacity with a root node.
fn root(&self) -> NodeRef<T>[src]
Returns a reference to the root node.
fn root_mut(&mut self) -> NodeMut<T>[src]
Returns a mutator of the root node.
fn orphan(&mut self, value: T) -> NodeMut<T>[src]
Creates an orphan node, returning a mutator of it.
fn get(&self, id: NodeId<T>) -> NodeRef<T>[src]
Returns a reference to the specified node.
Panics
Panics if id does not refer to a node in this tree.
fn get_mut(&mut self, id: NodeId<T>) -> NodeMut<T>[src]
Trait Implementations
impl<T: Debug> Debug for Tree<T>[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
Formats the value using the given formatter.
impl<T: Default> Default for Tree<T>[src]
impl<T: Clone> Clone for Tree<T>[src]
fn clone(&self) -> Self[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more