Macro cssparser::match_ignore_ascii_case

source ·
macro_rules! match_ignore_ascii_case {
    ( $input:expr,
        $(
            $( #[$meta: meta] )*
            $( $pattern: pat )|+ $( if $guard: expr )? => $then: expr
        ),+
        $(,)?
    ) => { ... };
}
Expand description

Expands to a match expression with string patterns, matching case-insensitively in the ASCII range.

The patterns must not contain ASCII upper case letters. (They must be already be lower-cased.)

§Example

cssparser::match_ignore_ascii_case! { &function_name,
    "rgb" => parse_rgb(..),
    "rgba" => parse_rgba(..),
    "hsl" => parse_hsl(..),
    "hsla" => parse_hsla(..),
    _ => Err(format!("unknown function: {}", function_name))
}