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
/// The alignment of a column within a table.
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Alignment {
  Left,
  Right,
}

impl Default for Alignment {
  fn default() -> Self {
    Self::Left
  }
}

#[derive(Clone, Copy)]
pub struct Array<const N: usize> {
  alignments: [Alignment; N],
}

impl<const N: usize> Default for Array<N> {
  fn default() -> Self {
    Self {
      alignments: [(); N].map(|_| Alignment::default()),
    }
  }
}

impl<const N: usize> From<Array<N>> for [Alignment; N] {
  fn from(array: Array<N>) -> Self {
    array.alignments
  }
}

impl<const N: usize> From<[Alignment; N]> for Array<N> {
  fn from(alignments: [Alignment; N]) -> Self {
    Self { alignments }
  }
}