macro_rules! scan {
($input:expr;
$(($($patterns:tt)*) => $bodies:expr),+
) => { ... };
($input:expr;
($($head_pattern:tt)*) => $head_body:expr
, $(($($tail_patterns:tt)*) => $tail_bodies:expr,)*
) => { ... };
}
Expand description
Scans the provided input, using the specified rules. The result is a Result<T, ScanError>
where T
is the type of the rule bodies; just as with match
, all bodies must agree on their result type.
The input may be any value which implements IntoScanCursor
, which includes &str
, String
, and Cow<str>
.
See also: Pattern Syntax.