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