Macro guard::guard [−][src]
Match a pattern to an expression, binding identifiers in the calling scope. Diverge if the match fails.
Supported syntaxes:
- let
pat
=rhs
elsediverge
- let
pat
elsediverge
=rhs
- {
diverge
} unlessrhs
=>pat
Inputs:
diverge
: expression which is run if the match fails. Must diverge, or you will get a “match arms have incompatible types” error.rhs
: expression to match against the patternpattern
: pattern. Most patterns are allowed, with a few limitations. See the module documentation for details.