macro_rules! extract {
($expression:expr, $(
$(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? => $output:expr
),+ $(,)?) => { ... };
}Expand description
Returns the extracted value from the provided patterns.
Like a match expression, a pattern can be optionally followed by an if guard that has access
to names bound by the pattern.
let array = [1, 2, 3];
let first = extract!(array, [el, ..] => el);
assert_eq!(first, Some(1));