papergrid/config/
sides.rs

1/// A structure which represents 4 box sides.
2#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
3pub struct Sides<T> {
4    /// Top side.
5    pub top: T,
6    /// Bottom side.
7    pub bottom: T,
8    /// Left side.
9    pub left: T,
10    /// Right side.
11    pub right: T,
12}
13
14impl<T> Sides<T> {
15    /// Creates a new object.
16    pub fn new(left: T, right: T, top: T, bottom: T) -> Self {
17        Self {
18            top,
19            bottom,
20            left,
21            right,
22        }
23    }
24}
25
26/// Indent represent a filled space.
27#[derive(Debug, Clone, Copy, PartialEq, Eq)]
28pub struct Indent {
29    /// A fill character.
30    pub fill: char,
31    /// A number of repeats of a fill character.
32    pub size: usize,
33}
34
35impl Indent {
36    /// Creates a new Indent structure.
37    pub fn new(size: usize, fill: char) -> Self {
38        Self { fill, size }
39    }
40
41    /// Creates a new Indent startucture with space (`' '`) as a fill character.
42    pub fn spaced(size: usize) -> Self {
43        Self { size, fill: ' ' }
44    }
45}
46
47impl Default for Indent {
48    fn default() -> Self {
49        Self { size: 0, fill: ' ' }
50    }
51}