Macro guard::guard[][src]

macro_rules! guard {
    ($($input:tt)*) => { ... };
}

Match a pattern to an expression, binding identifiers in the calling scope. Diverge if the match fails.

Supported syntaxes:

  • let pat = rhs else diverge
  • let pat else diverge = rhs
  • { diverge } unless rhs => 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 pattern
  • pattern: pattern. Most patterns are allowed, with a few limitations. See the module documentation for details.