Struct rasslib::tree::Tree [] [src]

pub struct Tree<T> where T: Display + PartialEq + Clone {
    // some fields omitted
}

A Tree structure which contains elements that are also trees?

Note: the paraemter T requires some trait boundaries: * std::fmt::Display * std::clone::Clone * std::cmp::PartialEq

Methods

impl<T> Tree<T> where T: Display + PartialEq + Clone

fn new(name: T) -> Tree<T>

Creates a new structure where name parameter will be the name element of the tree. The sub-tree will initial with empty.

fn set_root(&mut self, is_root: bool)

Sets the Tree as root of the tree structure

fn name(&self) -> &T

Return the name of the element

fn name_mut(&mut self) -> &mut T

Return the name of the element

fn add(&mut self, sub: Tree<T>)

Adds a node to the tree where the note is of type Tree<T>.

fn is_leaf(&self) -> bool

fn remove(&mut self, path: &Path<T>) -> bool

Remove an element from the Tree as specified by the path. Returns true if the element has been found and removed.

fn get_entry_from_path<'a>(&'a self, path: &Path<T>) -> Option<&'a Tree<T>>

Gets an Entry (Tree<T>) from a given path.

Trait Implementations

impl<T> Display for Tree<T> where T: Display + PartialEq + Clone

Display implementation for the tree

fn fmt(&self, f: &mut Formatter) -> Result

impl<'a, T> IntoIterator for &'a Tree<T> where T: Display + PartialEq + Clone

non-consuming version IntoIterator trait implementation for the Tree<T>.

type Item = Path<T>

type IntoIter = TreeIterator<T>

fn into_iter(self) -> Self::IntoIter

Derived Implementations

impl<T: Default> Default for Tree<T> where T: Display + PartialEq + Clone

fn default() -> Tree<T>

impl<T: Debug> Debug for Tree<T> where T: Display + PartialEq + Clone

fn fmt(&self, __arg_0: &mut Formatter) -> Result