Crate neotron_romfs

Source
Expand description

Library for creating or parsing a Neotron ROM Filing System (ROMFS) image

To view the contents of a ROMFS, use a for loop:

fn process_rom(data: &[u8]) -> Result<(), neotron_romfs::Error> {
    let romfs = neotron_romfs::RomFs::new(data)?;
    for entry in romfs {
        if let Ok(entry) = entry {
           println!("{} is {} bytes", entry.metadata.file_name, entry.metadata.file_size);
        }
    }
    Ok(())
}

To open a specific file, use RomFs::find:

fn process_rom(romfs: &neotron_romfs::RomFs) {
    if let Some(entry) = romfs.find("HELLO.ELF") {
        let data: &[u8] = entry.contents;
    }
}

Structs§

Entry
An entry in the ROMFS, including its contents.
EntryMetadata
Metadata for an entry in the ROMFS.
RomFs
Represents a ROM Filing System (ROMFS), as backed by a byte slice in memory.
RomFsEntryIter
An iterator for working through the entries in a ROMFS

Enums§

Error
The ways in which this module can fail
FormatVersion
The different image formats we support