1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use bitvec::prelude::*;
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Mode {
Byte,
}
impl Mode {
pub fn from_str(s: &str) -> Mode {
if Mode::in_byte(s) {
Mode::Byte
} else {
panic!("Unsupported mode for string {}", s);
}
}
pub fn matches(&self, s: &str) -> bool {
match self {
Mode::Byte => Mode::in_byte(s),
}
}
pub fn to_bitvec(&self) -> BitVec<Lsb0, u8> {
match self {
Mode::Byte => bitvec![Lsb0, u8;0, 1, 0, 0],
}
}
pub fn in_byte(_s: &str) -> bool {
true
}
}