control_code/csi/
combination.rs1use nom;
16
17#[derive(Eq, PartialEq, Copy, Clone, Debug)]
18pub enum Combination {
19 Next,
20 Start,
21 End,
22}
23
24impl Combination {
25 #[inline]
26 pub fn parse<'a>(value: u32) -> Result<Self, nom::ErrorKind> {
27 match value {
28 0 => Ok(Combination::Next),
29 1 => Ok(Combination::Start),
30 2 => Ok(Combination::End),
31 _ => Err(nom::ErrorKind::Custom(9005)),
32 }
33 }
34}
35
36impl Into<u32> for Combination {
37 #[inline]
38 fn into(self) -> u32 {
39 match self {
40 Combination::Next => 0,
41 Combination::Start => 1,
42 Combination::End => 2,
43 }
44 }
45}