elf_utilities/header/
class.rs1#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2pub enum Class {
3 None,
5 Bit32,
7 Bit64,
9 Num,
10
11 Any(u8),
13}
14
15impl Class {
16 pub const INDEX: usize = 4;
17 pub fn to_identifier(&self) -> u8 {
18 match self {
19 Self::None => 0,
20 Self::Bit32 => 1,
21 Self::Bit64 => 2,
22 Self::Num => 3,
23 Self::Any(b) => *b,
24 }
25 }
26}
27
28impl From<u8> for Class {
29 fn from(byte: u8) -> Self {
30 match byte {
31 0 => Self::None,
32 1 => Self::Bit32,
33 2 => Self::Bit64,
34 3 => Self::Num,
35 _ => Self::Any(byte),
36 }
37 }
38}