etop_format/bool_format/
builder.rs1use super::types::{BoolAlign, BoolFormat};
2
3impl BoolFormat {
4 pub fn new() -> BoolFormat {
6 BoolFormat::default()
7 }
8
9 pub fn width(mut self, width: usize) -> BoolFormat {
13 self.min_width = width;
14 self.max_width = width;
15 self
16 }
17
18 pub fn min_width(mut self, min_width: usize) -> BoolFormat {
20 self.min_width = min_width;
21 self
22 }
23
24 pub fn max_width(mut self, max_width: usize) -> BoolFormat {
26 self.max_width = max_width;
27 self
28 }
29
30 pub fn width_option(self, width: Option<usize>) -> BoolFormat {
32 self.min_width_option(width).max_width_option(width)
33 }
34
35 pub fn min_width_option(mut self, width: Option<usize>) -> BoolFormat {
37 match width {
38 Some(width) => {
39 self.min_width = width;
40 self
41 }
42 None => self,
43 }
44 }
45
46 pub fn max_width_option(mut self, width: Option<usize>) -> BoolFormat {
48 match width {
49 Some(width) => {
50 self.max_width = width;
51 self
52 }
53 None => self,
54 }
55 }
56
57 pub fn left_align(mut self) -> BoolFormat {
61 self.align = BoolAlign::Left;
62 self
63 }
64
65 pub fn right_align(mut self) -> BoolFormat {
67 self.align = BoolAlign::Right;
68 self
69 }
70
71 pub fn fill_char(mut self, fill_char: char) -> BoolFormat {
75 self.fill_char = fill_char;
76 self
77 }
78
79 pub fn true_text(mut self, true_text: String) -> BoolFormat {
83 self.true_text = true_text;
84 self
85 }
86
87 pub fn false_text(mut self, false_text: String) -> BoolFormat {
89 self.false_text = false_text;
90 self
91 }
92}