swc_css_ast/lib.rs
1#![deny(clippy::all)]
2#![allow(clippy::large_enum_variant)]
3
4//! AST definitions for CSS.
5pub use self::{at_rule::*, base::*, selector::*, token::*, value::*};
6
7mod at_rule;
8mod base;
9mod selector;
10mod token;
11mod value;
12
13/// Returns true if the given value matches one of the given patterns.
14///
15/// The type of value and patterns should be identical.
16///
17/// # Examples
18///
19/// ```
20/// use swc_atoms::Atom;
21/// use swc_atoms::atom;
22/// use swc_css_ast::*;
23///
24/// assert!(matches_eq_ignore_ascii_case!(Atom::from("A"), "a"));
25/// assert!(matches_eq_ignore_ascii_case!("A", "a"));
26/// ```
27#[macro_export]
28macro_rules! matches_eq_ignore_ascii_case {
29 ($value:expr, $($pat:expr),*) => {{
30 $(
31 $value.eq_ignore_ascii_case(&$pat) ||
32 )* false
33 }};
34}
35
36/// Returns true if the given value matches one of the given patterns.
37///
38/// The type of value and patterns should be identical.
39///
40/// # Examples
41///
42/// ```
43/// use swc_atoms::Atom;
44/// use swc_atoms::atom;
45/// use swc_css_ast::*;
46///
47/// assert!(matches_eq!(Atom::from("a"), "a"));
48/// assert!(matches_eq!("a", "a"));
49/// ```
50#[macro_export]
51macro_rules! matches_eq {
52 ($value:expr, $($pat:expr),*) => {{
53 $(
54 $value == $pat ||
55 )* false
56 }};
57}