cole14/rust-elf

Access to parse::Endian and parse::Class

guncha opened this issue · 2 comments

Hello!

I'm trying to use the Class and Endian enums to make some assertions, but they're in a private module and so are not accessible:

static PROCESS1: &'static [u8] = include_bytes!("../process1.bin");
fn parse() {
    let file = elf::File::open_stream(PROCESS1).unwrap();
    assert_eq!(file.ehdr.e_type, elf::gabi::ET_EXEC);
    assert_eq!(file.ehdr.e_machine, elf::gabi::EM_RISCV);
    assert_eq!(file.ehdr.class, elf::parse::Class::ELF64); // Error: module `parse` is private
    assert_eq!(file.ehdr.endianness, elf::parse::Endian::Little); // ditto
    // etc
}

Wondering if this is an oversight or if there's a correct way to do this?

That was just an oversight. I have exposed them in a new release for you: v0.6.1 (6e62d2f), let me know if that works for you.

Works great! Much obliged 🙌