affs_read/
lib.rs

1//! # affs-read
2//!
3//! A `no_std` compatible crate for reading Amiga Fast File System (AFFS) disk images.
4//!
5//! This crate provides zero-allocation reading of ADF (Amiga Disk File) images,
6//! supporting both OFS (Original File System) and FFS (Fast File System) variants.
7//!
8//! ## Features
9//!
10//! - `no_std` compatible by default
11//! - Zero heap allocations in core functionality
12//! - Support for OFS and FFS filesystems
13//! - Support for INTL and DIRCACHE modes
14//! - Streaming file reading
15//! - Directory traversal
16//! - Extensively fuzz-tested for safety and correctness
17//!
18//! See `PERFORMANCE.md` for detailed benchmarks and optimization documentation.
19//!
20//! ## Example
21//!
22//! ```ignore
23//! use affs_read::{AffsReader, BlockDevice};
24//!
25//! // Implement BlockDevice for your storage
26//! struct MyDevice { /* ... */ }
27//!
28//! impl BlockDevice for MyDevice {
29//!     fn read_block(&self, block: u32, buf: &mut [u8; 512]) -> Result<(), ()> {
30//!         // Read block from storage
31//!         Ok(())
32//!     }
33//! }
34//!
35//! let device = MyDevice { /* ... */ };
36//! let reader = AffsReader::new(&device)?;
37//!
38//! // List root directory
39//! for entry in reader.read_dir(reader.root_block())? {
40//!     println!("{}", entry.name());
41//! }
42//! ```
43
44#![no_std]
45#![deny(unsafe_op_in_unsafe_fn)]
46#![warn(missing_docs)]
47#![warn(clippy::all)]
48
49#[cfg(feature = "std")]
50extern crate std;
51
52#[cfg(feature = "alloc")]
53extern crate alloc;
54
55mod block;
56mod checksum;
57mod constants;
58mod date;
59mod dir;
60mod error;
61mod file;
62mod reader;
63mod symlink;
64mod types;
65mod utf8;
66mod varblock;
67
68pub use block::*;
69pub use checksum::{bitmap_sum, boot_sum, normal_sum, normal_sum_slice, read_u16_be};
70pub use constants::*;
71pub use date::AmigaDate;
72pub use dir::{DirEntry, DirIter};
73pub use error::AffsError;
74pub use file::FileReader;
75pub use reader::AffsReader;
76pub use symlink::{
77    MAX_SYMLINK_LEN, max_utf8_len, read_symlink_target, read_symlink_target_with_block_size,
78};
79pub use types::*;
80pub use varblock::{AffsReaderVar, MAX_BLOCK_SIZE, VarDirEntry, VarDirIter};