Macro metacall::match_metacall_value_mut
source · macro_rules! match_metacall_value_mut { ( $any:expr, { $( $var:ident : $type:ty => $arm:expr ),*, _ => $default:expr } ) => { ... }; }
Expand description
Same as match_metacall_value but gives a mutable reference. For example: …
use metacall::{metacall_untyped_no_arg, match_metacall_value_mut};
let mut value = metacall_untyped_no_arg("returns_string_or_number").unwrap();
match_metacall_value_mut!(value, {
str: String => str.to_owned(),
num: i16 => num.to_string(),
num: i32 => num.to_string(),
num: i64 => num.to_string(),
num: f32 => num.to_string(),
num: f64 => num.to_string(),
_ => String::from("Invalid output!")
});