macro_rules! tree { (@ $n:ident { }) => { ... }; (@ $n:ident { $value:expr }) => { ... }; (@ $n:ident { $value:expr, $($tail:tt)* }) => { ... }; (@ $n:ident { $value:expr => $children:tt }) => { ... }; (@ $n:ident { $value:expr => $children:tt, $($tail:tt)* }) => { ... }; ($root:expr) => { ... }; ($root:expr => $children:tt) => { ... }; }
Expand description
Creates a tree from expressions.
§Examples
#[macro_use] extern crate ego_tree;
let tree = tree!("root");
#[macro_use] extern crate ego_tree;
let tree = tree! {
"root" => {
"child a",
"child b" => {
"grandchild a",
"grandchild b",
},
"child c",
}
};