pub struct Tree<T> { /* private fields */ }

Implementations

Returns an iterator that traverses the tree in breadth-first order.

Returns an iterator that traverses the tree in depth-first order.

Returns an iterator that traverses the tree in depth-first order starting from the node at index.

Arguments
  • index - Index to start iterating from.

Returns an iterator that traverses the tree in breadth-first order starting from the node at index.

Arguments
  • index - Index to start iterating from.

Add child to node at index. Child is pushed to the end of the node’s current children.

Arguments
  • parent_index - Index of the parent node.

  • val - Value of the new child node.

Remove a node from the tree and any child nodes. Complexity is usually O(n) where n depends on the amount of nodes in the tree. If nodes typically have a lot of children, complexity should be closer to O(n * log n).

Arguments
  • index - Index of the node to be removed.

Place a node to the position of another node, pointed to by index. Pushes siblings to right. Fails if no node found at index or if node at index is the root.

Arguments
  • index - Index to emplace at.

  • val - Value of the new node.

Trait Implementations

Formats the value using the given formatter. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more

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.