tailwind_css_fixes/systems/css_global/attribute/
traits.rs1use super::*;
2
3impl Display for CssAttributes {
4 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
5 write!(f, "{}", self.normal)?;
8 if !self.transforms.is_empty() {
10 write!(f, "transform:{}", self.transforms)?
11 }
12 if !self.filter.is_empty() {
13 write!(f, "filter:{}", self.filter)?
14 }
15 if !self.backdrop_filter.is_empty() {
16 write!(f, "backdrop-filter:{}", self.backdrop_filter)?
17 }
18
19 for (selector, nested_attrs) in &self.nested {
21 write!(f, "{} {{ {} }}", selector, nested_attrs)?;
22 }
23 Ok(())
24 }
25}
26
27impl Add<Self> for CssAttributes {
28 type Output = CssAttributes;
29
30 fn add(self, rhs: Self) -> Self::Output {
31 let mut out = self;
32 out += rhs;
33 out
34 }
35}
36
37impl AddAssign<Self> for CssAttributes {
38 fn add_assign(&mut self, rhs: Self) {
39 self.normal += rhs.normal;
40 self.transforms += rhs.transforms;
41 self.filter += rhs.filter;
42 self.backdrop_filter += rhs.backdrop_filter;
43 }
44}