macro_rules! match_metacall_value {
( $any:expr, { $( $var:ident : $type:ty => $arm:expr ),*, _ => $default:expr } ) => { ... };
}
Expand description
Matches MetaCallValue trait object. For example: …
use metacall::{metacall_untyped_no_arg, match_metacall_value};
let value = metacall_untyped_no_arg("returns_string_or_number").unwrap();
match_metacall_value!(value, {
str: String => str,
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!")
});