torin/values/
alignment.rs1#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2#[derive(PartialEq, Eq, Clone, Debug, Default)]
3pub enum Alignment {
4 #[default]
5 Start,
6 Center,
7 End,
8 SpaceBetween,
9 SpaceEvenly,
10 SpaceAround,
11}
12
13impl Alignment {
14 pub const fn is_not_start(&self) -> bool {
15 !matches!(self, Self::Start)
16 }
17
18 pub const fn is_spaced(&self) -> bool {
19 matches!(
20 self,
21 Self::SpaceBetween | Self::SpaceAround | Self::SpaceEvenly
22 )
23 }
24
25 pub fn pretty(&self) -> String {
26 match self {
27 Self::Start => "start".to_string(),
28 Self::Center => "center".to_string(),
29 Self::End => "end".to_string(),
30 Self::SpaceBetween => "space-between".to_string(),
31 Self::SpaceEvenly => "space-evenly".to_string(),
32 Self::SpaceAround => "space-around".to_string(),
33 }
34 }
35}