Macro k::connect

source ยท
macro_rules! connect {
    ($x:expr => $y:expr) => { ... };
    ($x:expr => $y:expr => $($rest:tt)+) => { ... };
}
Expand description

set parents easily

use k::connect;
let l0 = k::NodeBuilder::<f64>::new().into_node();
let l1 = k::NodeBuilder::new().into_node();
let l2 = k::NodeBuilder::new().into_node();

// This is the same as below
// l1.set_parent(&l0);
// l2.set_parent(&l1);
connect![l0 => l1 => l2];

assert!(l0.is_root());
assert!(!l1.is_root());
assert!(!l1.is_end());
assert!(l2.is_end());