I am working with the below macro. I need a help to extract the value inside the matched pattern.
macro_rules! match_value {
($p:pat, $v:expr) => {
match $v {
$p => println!("the pattern matched."),
_ => println!("the pattern does not match."),
}
};
}
fn main() {
let value = Some(42);
match_value!(Some(_), value);
match_value!(None, value);
}