Struct socarel::Tree[][src]

pub struct Tree<T: NodeContent = RawNode> { /* fields omitted */ }
Expand description

Struct that contains a tree.

Implementations

Create new empty tree.

Set root node.

Arguments

  • content - Node content.

Return

  • An Option with the root node index (always 0).

Create new node and link it to its parent.

Arguments

  • node_content - Node content.
  • parent_node_index - Parent node index.

Return

  • An Option with the new node index.

Get reference to node content.

Arguments

  • node_index - Node index.

Return

  • An Option with the node content reference.

Overwrite node content. It must exist.

Arguments

  • node_content - Node content.
  • node_index - Node index.

Return

  • An Option with the node index.

Unlink node. It doesn’t remove node from the tree, it just disconnects it from parent.

This process is O(l) complexity, where l is the number of nodes of the same level of node_index.

Arguments

  • node_index - Node index.

Return

  • An Option with the node index.

Find node in the try by content.

The complexity of this operation is O(p), where p is the number of elements in the path.

Arguments

  • path - Path of nodes, starting from root.

Return

  • An Option with the node index.

Get iterators interface.

Return

  • Iterators interface.

Get reference to nodes array.

Return

  • Array reference.

Get size of nodes array.

Return

  • Size.

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.