macro_rules! convert_expr_to_str_or_err {
($expr:expr, $traversal_state:expr, $fns:expr, $error_msg:expr) => { ... };
}Expand description
Macro to safely convert an expression to a string with error Result handling. Returns the string on success, or returns Err(anyhow::Error) on failure.
This macro is designed for use in functions that return Result<T, anyhow::Error>.
§Usage
ⓘ
let str_value = expr_to_str_or_err!(expr, traversal_state, fns, "Expression is not a string");§Arguments
$expr: The expression to convert$traversal_state: Mutable reference to StateManager$fns: Reference to FunctionMap$error_msg: Error message string literal