1#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash)]
2#[cfg_attr(feature = "serde", derive(serde::Serialize), serde(rename_all = "lowercase"))]
3pub enum Spacing {
4 #[default]
5 Alone,
6 Joint,
7}
8
9impl Spacing {
10 #[inline]
11 pub fn is_alone(&self) -> bool {
12 matches!(self, Self::Alone)
13 }
14
15 #[inline]
16 pub fn is_joint(&self) -> bool {
17 matches!(self, Self::Joint)
18 }
19
20 #[inline]
21 pub fn as_str(&self) -> &'static str {
22 match self {
23 Self::Alone => "alone",
24 Self::Joint => "joint",
25 }
26 }
27}
28
29impl std::fmt::Display for Spacing {
30 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31 f.write_str(self.as_str())
32 }
33}