Struct binary_tree::test::TestNode [] [src]

pub struct TestNode<T> {
    pub val: T,
    pub left: Option<Box<TestNode<T>>>,
    pub right: Option<Box<TestNode<T>>>,
}

A minimal Node implementation.

When should you use TestNode?

You should not use TestNode for anything, except may be to get to know what a binary tree is!

Fields

Methods

impl<T> TestNode<T>
[src]

Trait Implementations

impl<T: Debug> Debug for TestNode<T>
[src]

Formats the value using the given formatter.

impl<T> Node for TestNode<T>
[src]

Get a reference to the left subtree

Get a reference to the right subtree

Returns the value of the current node.

Walk down the tree

impl<T> NodeMut for TestNode<T>
[src]

Try to detach the left sub-tree

Try to detach the right sub-tree

Replace the left subtree with tree and return the old one.

Replace the right subtree with tree and return the old one.

Returns a mutable reference to the value of the current node.

Consume a Node and return its parts: (value, left, right)

Returns a mutable reference to the left child

Returns a mutable reference to the right child

Try to rotate the tree left if right subtree exists

Try to rotate the tree right if left subtree exists

Simple mutable walk Read more

Walks down the tree by detaching subtrees, then up reattaching them back. step_in should guide the path taken, stop will be called on the node where either step_in returned Stop or it was not possible to proceed. Then step_out will be called for each node along the way to root, except the final one (that for which stop was called). Read more

Insert new_node in-order before self. step_out will be invoked for all nodes in path from (excluding) the point of insertion, to (including) self, unless self is the point of insertion. Read more

Extract out a node. This can be used in conjuction with try_remove to remove any node except the root. Read more

Replace this node with one of its descendant, returns None if it has no children. Read more