Macro 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)* ) => { ... };
}

Expands to an expression equivalent to a match with string patterns, but matching is case-insensitive in the ASCII range.

Requirements:

  • The cssparser_macros crate must also be imported at the crate root
  • The patterns must not contain ASCII upper case letters. (They must be already be lower-cased.)

Example

#[macro_use] extern crate cssparser;
#[macro_use] extern crate cssparser_macros;

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