Function dynparser::ast::get_nodename_and_nodes
source · Expand description
It will get the node name and a slice to the nodes contained by the node
use dynparser::ast::{self, get_nodename_and_nodes, Node};
let ast: Node = Node::Rule((
"root".to_string(),
vec![Node::Val("hello".to_string())],
));
let (node_name, nodes) = get_nodename_and_nodes(&ast).unwrap();
assert!(node_name == "root");
assert!(nodes[0] == ast::Node::Val("hello".to_string()),)