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
extern crate byteorder;
#[macro_use]
extern crate quick_error;

mod header;

pub use header::{MagicHeader, MagicHeaderParseError, LocateSectionError};
use std::fmt;

#[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub enum Section {
    Header,
    Kernel,
    Ramdisk,
    Second,
    DeviceTree,
}

impl fmt::Display for Section {
    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
        write!(formatter, "{}", match *self {
            Section::Header => "header",
            Section::Kernel => "kernel",
            Section::Ramdisk => "ramdisk",
            Section::Second => "second",
            Section::DeviceTree => "device_tree",
        })
    }
}