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
impl<'a, T> IntoIterator for &'a Tree<T> where T: Display + PartialEq + Clone
non-consuming version IntoIterator trait implementation for the Tree<T>
.