1use std::fmt::{Debug, Display};
2
3#[derive(Copy, Clone, PartialEq, Eq, Hash)]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10pub enum Alphabet {
11 A,
12 B,
13 C,
14 D,
15 E,
16 F,
17 G,
18}
19
20impl Debug for Alphabet {
21 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
22 match self {
23 Alphabet::A => write!(f, "A"),
24 Alphabet::B => write!(f, "B"),
25 Alphabet::C => write!(f, "C"),
26 Alphabet::D => write!(f, "D"),
27 Alphabet::E => write!(f, "E"),
28 Alphabet::F => write!(f, "F"),
29 Alphabet::G => write!(f, "G"),
30 }
31 }
32}
33
34impl Display for Alphabet {
35 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
36 write!(f, "{:?}", self)
37 }
38}
39
40impl Alphabet {
41 pub const fn next(&self) -> Self {
43 match self {
44 Alphabet::A => Alphabet::B,
45 Alphabet::B => Alphabet::C,
46 Alphabet::C => Alphabet::D,
47 Alphabet::D => Alphabet::E,
48 Alphabet::E => Alphabet::F,
49 Alphabet::F => Alphabet::G,
50 Alphabet::G => Alphabet::A,
51 }
52 }
53}