node

Macro node 

Source
macro_rules! node {
    ( $id:expr, $value:expr, $( $more:expr ),* ) => { ... };
    ( $id:expr, $value:expr ) => { ... };
}
Expand description

Create a new Node using a macro

§Arguments

  • id: The node identifier
  • value: The node value
  • more: Node children

§Examples

Create a node with no children

use orange_trees::{Node, node};

let node: Node<&'static str, usize> = node!("root", 0);

Create a node with children

use orange_trees::{Node, node};

let node: Node<&'static str, usize> = node!("root", 0, node!("a", 1));

Create a nested node structure

use orange_trees::{Node, node};

let node: Node<&'static str, usize> = node!("root", 0, node!("a", 1, node!("a1", 3), node!("a2", 4)), node!("b", 0));