1/// Indent represent a filled space.
2#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
3pub struct Indent {
4 /// A fill character.
5 pub fill: char,
6 /// A number of repeats of a fill character.
7 pub size: usize,
8}
9
10impl Indent {
11 /// Creates a new Indent structure.
12 pub const fn new(size: usize, fill: char) -> Self {
13 Self { fill, size }
14 }
15
16 /// Creates a new Indent structure with space (`' '`) as a fill character.
17 pub const fn spaced(size: usize) -> Self {
18 Self { size, fill: ' ' }
19 }
20
21 /// Creates a new Indent structure with space (`' '`) as a fill character.
22 pub const fn zero() -> Self {
23 Self::new(size:0, fill:' ')
24 }
25}
26
27impl Default for Indent {
28 fn default() -> Self {
29 Self { size: 0, fill: ' ' }
30 }
31}
32