cssparser::match_ignore_ascii_case
[−]
[src]
macro_rules! match_ignore_ascii_case { (@inner $value:expr, ($string:expr => $result:expr, _ => $fallback:expr) -> ($($parsed:tt)*) ) => { ... }; (@inner $value:expr, ($string:expr => $result:expr, $($rest:tt)*) -> ($($parsed:tt)*) ) => { ... }; (@inner $value:expr, () -> ($(($string:expr => $result:expr))*) $fallback:expr ) => { ... }; ( $value:expr, $($rest:tt)* ) => { ... }; }
This macro is equivalent to a match
expression on an &str
value,
but matching is case-insensitive in the ASCII range.
Usage example:
match_ignore_ascii_case! { string, "foo" => Some(Foo), "bar" => Some(Bar), "baz" => Some(Baz), _ => None }
The macro also takes a slice of the value,
so that a String
or CowString
could be passed directly instead of a &str
.