1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
use crate::{output, ColorType, Output, OutputBuilder};
impl<'a> OutputBuilder<'a> {
/// Creates the struct
///
/// # Returns
/// - `OutputBuilder`: Output
pub fn new() -> Self {
Self {
output: Output::default(),
}
}
/// Creates the struct from output
///
/// # Returns
/// - `OutputBuilder`: Output
pub fn new_from(output: Output<'a>) -> Self {
Self { output }
}
/// Sets the text.
///
/// # Parameters
/// - `text`: The text to be set.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_text(&mut self, text: &'a str) -> &mut Self {
self.output.text = text;
self
}
/// Sets the text color.
///
/// # Parameters
/// - `text_color`: The color to be set for the text.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_text_color(&mut self, text_color: ColorType) -> &mut Self {
self.output.text_color = text_color;
self
}
/// Sets the background color for the text.
///
/// # Parameters
/// - `text_bg_color`: The background color to be set for the text.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_text_bg_color(&mut self, text_bg_color: ColorType) -> &mut Self {
self.output.text_bg_color = text_bg_color;
self
}
/// Sets whether the text should be bold.
///
/// # Parameters
/// - `text_blod`: A boolean indicating whether the text should be bold.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_text_blod(&mut self, text_blod: bool) -> &mut Self {
self.output.text_blod = text_blod;
self
}
/// Sets whether to show the time.
///
/// # Parameters
/// - `show_time`: A boolean indicating whether to display the time.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_show_time(&mut self, show_time: bool) -> &mut Self {
self.output.show_time = show_time;
self
}
/// Sets the time text color.
///
/// # Parameters
/// - `time_text_color`: The color to be set for the time text.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_time_text_color(&mut self, time_text_color: ColorType) -> &mut Self {
self.output.time_text_color = time_text_color;
self
}
/// Sets the background color for the time text.
///
/// # Parameters
/// - `time_bg_color`: The background color to be set for the time text.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_time_bg_color(&mut self, time_bg_color: ColorType) -> &mut Self {
self.output.time_bg_color = time_bg_color;
self
}
/// Sets whether the time text should be bold.
///
/// # Parameters
/// - `time_text_blod`: A boolean indicating whether the time text should be bold.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_time_text_blod(&mut self, time_text_blod: bool) -> &mut Self {
self.output.time_text_blod = time_text_blod;
self
}
/// Sets the separator.
///
/// # Parameters
/// - `split`: The separator string to be set.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_split_text(&mut self, split: &'a str) -> &mut Self {
self.output.split = split;
self
}
/// Sets the separator color.
///
/// # Parameters
/// - `split_color`: The color to be set for the separator.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_split_text_color(&mut self, split_color: ColorType) -> &mut Self {
self.output.split_color = split_color;
self
}
/// Sets the background color for the separator.
///
/// # Parameters
/// - `split_bg_color`: The background color to be set for the separator.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_split_bg_color(&mut self, split_bg_color: ColorType) -> &mut Self {
self.output.split_bg_color = split_bg_color;
self
}
/// Sets whether the separator text should be bold.
///
/// # Parameters
/// - `split_text_blod`: A boolean indicating whether the separator text should be bold.
///
/// # Returns
/// - `&mut Self`: A mutable reference to the struct for method chaining.
pub fn set_split_text_blod(&mut self, split_text_blod: bool) -> &mut Self {
self.output.split_text_blod = split_text_blod;
self
}
/// Sets the `endl` value for the `Output`.
///
/// # Parameters
/// - `endl`: A boolean value that determines whether to add a newline at the end.
///
/// # Returns
/// - `&mut Self`: Returns a mutable reference to the current `Output` instance, allowing method chaining.
pub fn set_endl(&mut self, endl: bool) -> &mut Self {
self.output.endl = endl;
self
}
/// Builds and returns the Output struct.
///
/// # Returns
/// - `Output`: The constructed Output struct.
pub fn build(&self) -> Output {
self.output.clone()
}
/// Outputs the current state of the Output struct.
///
/// # Returns
/// - `()` : Nothing is returned.
pub fn output(&self) {
output(self.output.clone());
}
}