macro_rules! matches { ($expression:expr, $pattern:pat $(if $guard:expr)? $(,)?) => { ... };}Expand description
Returns whether the given expression matches the provided pattern.
The pattern syntax is exactly the same as found in a match arm. The optional if guard can beused to add additional checks that must be true for the matched value, otherwise this macro willreturnfalse.
When testing that a value matches a pattern, it’s generally preferable to useassert_matches! as it will print the debug representation of the value if the assertionfails.