Coverage Report

Created: 2026-01-25 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/papergrid-0.17.0/src/config/indent.rs
Line
Count
Source
1
/// Indent represent a filled space.
2
///
3
/// # Example
4
///
5
/// ```
6
/// # use papergrid::config::Indent;
7
/// let pad = Indent::new(10, ' ');
8
/// ```
9
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10
pub struct Indent {
11
    /// A fill character.
12
    pub fill: char,
13
    /// A number of repeats of a fill character.
14
    pub size: usize,
15
}
16
17
impl Indent {
18
    /// Creates a new Indent structure.
19
0
    pub const fn new(size: usize, fill: char) -> Self {
20
0
        Self { fill, size }
21
0
    }
22
23
    /// Creates a new Indent structure with space (`' '`) as a fill character.
24
0
    pub const fn spaced(size: usize) -> Self {
25
0
        Self { size, fill: ' ' }
26
0
    }
27
28
    /// Creates a new Indent structure with space (`' '`) as a fill character.
29
0
    pub const fn zero() -> Self {
30
0
        Self::new(0, ' ')
31
0
    }
32
33
    /// Verifies whether an indent is set to 0.
34
0
    pub const fn is_empty(&self) -> bool {
35
0
        self.size == 0
36
0
    }
37
}
38
39
impl Default for Indent {
40
0
    fn default() -> Self {
41
0
        Self { size: 0, fill: ' ' }
42
0
    }
43
}