Crates.io | iso9660_simple |
lib.rs | iso9660_simple |
version | 0.1.25 |
created_at | 2025-02-19 13:48:18.677933+00 |
updated_at | 2025-08-30 01:57:42.517714+00 |
description | ISO9660 reading library |
homepage | |
repository | https://github.com/NDRAEY/iso9660_simple |
max_upload_size | |
id | 1561396 |
size | 22,319 |
It's a Rust crate that provides minimal ISO9660 images reading and parsing functionality.
Firstly, add iso9660_simple
to your project:
cargo add iso9660_simple
Then, implement reading device trait for your device (it may be a real device, or just a file).
The complete implementation of reading device trait for file looks like this:
use std::fs::File;
use iso9660_simple::Read as ISORead;
struct FileDevice(File);
impl ISORead for FileDevice {
fn read(&mut self, position: usize, buffer: &mut [u8]) -> Option<()> {
if self.0.seek(SeekFrom::Start(position as u64)).is_err() {
return None;
}
if self.0.read_exact(buffer).is_ok() {
Some(())
} else {
None
}
}
}
Then, you're ready to open the device and make ISO9660 reader from it. For example:
let device = FileDevice(File::open("image.iso").unwrap());
let mut iso = ISO9660::from_device(device);
And now, you can do parse an ISO9660 file:
let root_directory_lba = iso.root().lba.lsb;
let data = iso.read_directory(root_directory_lba); // Read root directory
let first_file = data.first().unwrap(); // Get first file info
let mut buffer = vec![0u8; first_file.file_size()];
let data = iso.read_file(fist_file, 0, &mut buffer); // Read the whole file into Vec<u8>.