Trait Node

Source
pub trait Node {
    type Value;

    // Required methods
    fn left(&self) -> Option<&Self>;
    fn right(&self) -> Option<&Self>;
    fn value(&self) -> &Self::Value;

    // Provided method
    fn walk<'a, F>(&'a self, step_in: F)
       where F: FnMut(&'a Self) -> WalkAction { ... }
}
Expand description

Generic methods for traversing a binary tree.

Required Associated Types§

Required Methods§

Source

fn left(&self) -> Option<&Self>

Get a reference to the left subtree

Source

fn right(&self) -> Option<&Self>

Get a reference to the right subtree

Source

fn value(&self) -> &Self::Value

Returns the value of the current node.

Provided Methods§

Source

fn walk<'a, F>(&'a self, step_in: F)
where F: FnMut(&'a Self) -> WalkAction,

Walk down the tree

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Node for CountNode<T>

Source§

type Value = T

Source§

impl<T> Node for TestNode<T>

Source§

type Value = T