macro_rules! matches { ($expr:expr, $($pat:tt)+) => { ... }; }
Expand description
Returns true if an expression matches a pattern.
ยงExample
assert!(matches!(2, 1 | 2 | 3));
assert!(matches!('x', 'a' ... 'z'));
assert!(!matches!(Some(1), None));
assert!(matches!(Some(42), Some(n) if n == 42));