elf_utilities/header/
version.rs1pub enum Version {
2 Current,
4
5 Any(u8),
7 Any32(u32),
8}
9
10impl Version {
11 pub const INDEX: usize = 6;
12
13 pub fn to_identifier(&self) -> u8 {
14 match self {
15 Self::Current => 1,
16 Self::Any(c) => *c,
17 _ => unreachable!(),
18 }
19 }
20 pub fn to_object_version(&self) -> u32 {
21 match self {
22 Self::Current => 1,
23 Self::Any32(c) => *c,
24 _ => unreachable!(),
25 }
26 }
27}
28
29impl From<u8> for Version {
30 fn from(byte: u8) -> Self {
31 match byte {
32 1 => Self::Current,
33 _ => Self::Any(byte),
34 }
35 }
36}
37impl From<u32> for Version {
38 fn from(byte: u32) -> Self {
39 match byte {
40 1 => Self::Current,
41 _ => Self::Any32(byte),
42 }
43 }
44}