1 stable release
1.0.0 | Jun 6, 2024 |
---|
#1078 in Filesystem
Used in 2 crates
20KB
387 lines
Neotron ROMFS Library
A no_std
library for creating and parsing ROMFS images.
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(())
}
Licence
Copyright (c) The Neotron Developers, 2024
Licensed under either MIT or Apache-2.0 at your option.
lib.rs
:
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;
}
}
Dependencies
~155KB