tailwind_css_fixes/systems/css_global/important/
traits.rs

1use super::*;
2
3impl Display for ImportantSet {
4    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
5        match self.important {
6            true => write!(f, "{} !important;", self.set.iter().join(" ")),
7            false => write!(f, "{};", self.set.iter().join(" ")),
8        }
9    }
10}
11
12impl Display for ImportantMap {
13    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
14        for (k, (important, v)) in &self.map {
15            match important {
16                true => write!(f, "{}:{}!important;", k, v)?,
17                false => write!(f, "{}:{};", k, v)?,
18            }
19        }
20        Ok(())
21    }
22}
23
24impl AddAssign<Self> for ImportantSet {
25    fn add_assign(&mut self, rhs: Self) {
26        self.important = rhs.important;
27        self.set.extend(rhs.set.into_iter());
28    }
29}
30
31impl AddAssign<Self> for ImportantMap {
32    fn add_assign(&mut self, rhs: Self) {
33        self.map.extend(rhs.map.into_iter());
34    }
35}