Struct tref::TreeModel[][src]

pub struct TreeModel<'a, T: NodeContent> {
    pub tree_ref: &'a Tree<T>,
    pub level_ref: Option<&'a Vec<TreeLevel>>,
}
Expand description

Struct that represents a tree.

Fields

tree_ref: &'a Tree<T>

Reference to the tree structure, contained in the Forest.

level_ref: Option<&'a Vec<TreeLevel>>

Reference to the tree levels structure, contained in the Forest.

Implementations

Create a new tree model.

Arguments

  • forest - A Forest structure
  • tree_id - ID of the tree.

Return

  • An Option with the tree model.

Create an iterator using simple traversal.

It traverses the node array from the first position to the last, ignoring the tree structure.

The iterator returns instances of TreeNode.

Examples

let forest = ... // Obtain a Forest structure
if let Some(tree_model) = forest.tree("my_tree") {
    for (n, _) in tree_model.iter() {
        println!("{}", n.content.get_content());
    }
}

Create an iterator using simple inverse traversal.

It traverses the node array from the last position to the first, ignoring the tree structure.

Examples

Check iter(), all iterators work the same way.

Create an iterator using the BFS algorithm.

Examples

Check iter(), all iterators work the same way.

Create an iterator using the Inverse BFS algorithm.

Examples

Check iter(), all iterators work the same way.

Create an iterator using the Inverse Levels BFS algorithm. Only available if using the levels structure.

Examples

Check iter(), all iterators work the same way.

Create an iterator using the Pre-DFS algorithm.

Examples

Check iter(), all iterators work the same way.

Create an iterator using the Inverse Pre-DFS algorithm.

Examples

Check iter(), all iterators work the same way.

Create an iterator using the Post-DFS algorithm.

Examples

Check iter(), all iterators work the same way.

pub fn inv_post_dfs_iter(&'b self) -> InvPostDfsIter<'a, 'b, T>

Create an iterator using the Inverse Post-DFS algorithm.

Examples

Check iter(), all iterators work the same way.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.