Function dynparser::ast::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::{self, get_node_val};
     let ast = ast::Node::Val("hello".to_string());
     
     let val = get_node_val(&ast).unwrap();
     
     assert!(val == "hello");