[−][src]Macro try_match::try_match
Try to match $in
against a given pattern $p
. Produces Ok($out)
if
successful; Err($in)
otherwise.
=> $out
can be left out, in which case it's implied based on the number of
bound variables in $p
:
- If there are no bound variables, it is implied to be
()
. - If there is exactly one bound variables
var
, it is implied to bevar
. - If there are multiple bound variables
var1, var2, ...
, it is implied to beAnonymousType { var1, var2 }
.
AnonymousType
derives Clone
and Copy
, and Debug
if std
feature is
enabled.
See the crate-level documentation for examples.