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
#[derive(Clone, Copy)]
pub struct Formatting<'format> {
pub capitalize: bool,
pub digit_seperator: Option<&'format str>,
pub place_seperator: Option<&'format str>,
pub tens_seperator: Option<&'format str>,
}
impl<'format> Formatting<'format> {
pub fn default() -> Self {
Self {
capitalize: true,
digit_seperator: Some(","),
place_seperator: Some(" "),
tens_seperator: Some("-"),
}
}
pub fn none() -> Self {
Self {
capitalize: false,
digit_seperator: None,
place_seperator: None,
tens_seperator: None,
}
}
pub fn with_seperator(seperator: &'format str) -> Self {
Self {
capitalize: false,
digit_seperator: Some(seperator),
place_seperator: Some(seperator),
tens_seperator: Some(seperator),
}
}
pub fn capitalize(&mut self) -> Self {
self.capitalize = true;
Self {
capitalize: self.capitalize,
digit_seperator: self.digit_seperator,
place_seperator: self.place_seperator,
tens_seperator: self.tens_seperator,
}
}
pub fn decapitalize(&mut self) -> Self {
self.capitalize = false;
Self {
capitalize: self.capitalize,
digit_seperator: self.digit_seperator,
place_seperator: self.place_seperator,
tens_seperator: self.tens_seperator,
}
}
}