1use std::sync::{Arc, Mutex};
2
3use crate::{BarStyle, Gradient};
4
5#[derive(Debug, Clone)]
6pub struct Config {
7 pub style: BarStyle,
8 pub gradient: Option<Gradient>,
9 pub bar_width: usize,
10 pub unit: Option<String>,
11}
12
13impl Config {
14 pub fn new(
15 style: BarStyle,
16 gradient: Option<Gradient>,
17 bar_width: usize,
18 unit: Option<String>,
19 ) -> Self {
20 Self {
21 style,
22 gradient,
23 bar_width,
24 unit,
25 }
26 }
27
28 pub fn arc_mutex(
29 style: BarStyle,
30 gradient: Option<Gradient>,
31 bar_width: usize,
32 unit: Option<String>,
33 ) -> Arc<Mutex<Self>> {
34 Arc::new(Mutex::new(Self::new(style, gradient, bar_width, unit)))
35 }
36}