Skip to main content

sequoia_style/
divider_style.rs

1use sequoia_core::Color;
2
3#[derive(Clone, Copy, Debug, Default, PartialEq)]
4pub struct DividerStyle {
5    pub color: Option<Color>,
6    pub thickness: Option<f32>,
7}
8
9impl DividerStyle {
10    pub const fn new() -> Self {
11        Self {
12            color: None,
13            thickness: None,
14        }
15    }
16
17    pub const fn color(mut self, color: Color) -> Self {
18        self.color = Some(color);
19        self
20    }
21
22    pub const fn thickness(mut self, px: f32) -> Self {
23        self.thickness = Some(px);
24        self
25    }
26}
27
28#[cfg(test)]
29mod tests {
30    use super::*;
31
32    #[test]
33    fn const_composition_keeps_base() {
34        const CUSTOM: DividerStyle = DividerStyle::new().thickness(2.0);
35        assert_eq!(CUSTOM.thickness, Some(2.0));
36        assert_eq!(CUSTOM.color, None);
37    }
38}