macro_rules! read_vec_values {
( $vec:expr, $($x:ident),* ) => { ... };
}Expand description
Given a Value of type ValueType::VectorType it declares variables with the provided names.
The generated code may return and Err(ErrorType) and should be executed in a function that expects
an EvalResult<...> as result.
ยงExamples
use num_parser::{*, function:: *};
fn read_values() -> EvalResult<()> {
let vec_values = Value::Vector(vec![
Value::from(1),
Value::from(7),
Value::from(-9)
]);
read_vec_values!(vec_values, foo, bar, baz);
assert_eq!(foo, &Value::from(1));
assert_eq!(bar, &Value::from(7));
assert_eq!(baz, &Value::from(-9));
Ok(())
}