1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2#[non_exhaustive]
3pub struct Column<'a> {
4 pub(crate) title: &'a str,
5 pub(crate) min: u16,
6 pub(crate) preferred: u16,
7 pub(crate) rank: u8,
8 pub(crate) pinned: bool,
9 pub(crate) right: bool,
10 pub(crate) flex: bool,
11 pub(crate) fit: Option<u16>,
12}
13
14impl<'a> Column<'a> {
15 pub const fn new(title: &'a str, min: u16, preferred: u16) -> Self {
16 Column {
17 title,
18 min,
19 preferred,
20 rank: 0,
21 pinned: false,
22 right: false,
23 flex: false,
24 fit: None,
25 }
26 }
27
28 pub const fn priority(mut self, rank: u8) -> Self {
29 self.rank = rank;
30 self
31 }
32
33 pub const fn pinned(mut self) -> Self {
34 self.pinned = true;
35 self
36 }
37
38 pub const fn right(mut self) -> Self {
39 self.right = true;
40 self
41 }
42
43 pub const fn flex(mut self) -> Self {
44 self.flex = true;
45 self
46 }
47
48 pub const fn fit(mut self, max: u16) -> Self {
49 self.fit = Some(max);
50 self
51 }
52}