Function dynparser::ast::flat::get_node_val

source ·
pub fn get_node_val(node: &Node) -> Result<&str, Error>
Expand description

Get the value of the Node If node is not a Node::Val, it will return an error

     use dynparser::ast::flat;
     let node = flat::Node::Val("hello".to_string());
     
     let val = flat::get_node_val(&node).unwrap();
     
     assert!(val == "hello");