tuix_core/state/style/
specificity.rs

1use std::ops::{Add, AddAssign};
2
3#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
4pub struct Specificity(pub [u8; 3]);
5
6impl Add<Self> for Specificity {
7    type Output = Self;
8
9    fn add(self, rhs: Self) -> Self::Output {
10        Specificity([
11            self.0[0] + rhs.0[0],
12            self.0[1] + rhs.0[1],
13            self.0[2] + rhs.0[2],
14        ])
15    }
16}
17
18impl AddAssign for Specificity {
19    fn add_assign(&mut self, rhs: Self) {
20        *self = Specificity([
21            self.0[0] + rhs.0[0],
22            self.0[1] + rhs.0[1],
23            self.0[2] + rhs.0[2],
24        ]);
25    }
26}