expand

Function expand 

Source
pub fn expand(node: &Node) -> Result<Vec<String>, ExpansionError>
Expand description

Expands the given parsed node into a vector of strings representing the expanded values.

§Arguments

  • node - The parsed node to be expanded.

§Returns

Returns a result containing a vector of strings representing the expanded values. If the expansion fails, an ExpansionError is returned.

§Examples

use bracoxide::parser::Node;
use bracoxide::{expand, ExpansionError};

let node = Node::Text { message: "Hello".to_owned().into(), start: 0 };
let expanded = expand(&node);
assert_eq!(expanded, Ok(vec!["Hello".to_owned()]));

§Panics

This function does not panic.

§Errors

Returns an ExpansionError if the expansion fails due to various reasons, such as failed number conversion or invalid syntax.

§Safety

This function operates on valid parsed nodes and does not use unsafe code internally.