Expand description
§hadris-fat
A no_std-compatible library for reading and writing FAT filesystems
(FAT12, FAT16, FAT32) with optional exFAT support.
§Quick Start
use std::fs::File;
use hadris_fat::sync::FatFs;
let file = File::open("disk.img").unwrap();
let fs = FatFs::open(file).unwrap();
let root = fs.root_dir();
let mut iter = root.entries();
while let Some(Ok(entry)) = iter.next_entry() {
println!("{}", entry.name());
}§Feature Flags
| Feature | Default | Description |
|---|---|---|
std | Yes | Standard library support (enables alloc, sync, chrono clock) |
alloc | No | Heap allocation without full std |
sync | No | Synchronous API via hadris-io sync traits |
async | No | Asynchronous API via hadris-io async traits |
read | Yes | Read operations |
write | Yes | Write operations (requires alloc + read) |
lfn | Yes | Long filename (VFAT) support |
cache | No | FAT sector caching for reduced I/O |
tool | No | Analysis and diagnostic utilities |
exfat | No | exFAT filesystem support (WIP) |
§Dual Sync/Async Architecture
This crate provides both synchronous and asynchronous APIs through a compile-time code transformation system. The same implementation source is compiled twice:
syncmodule: synchronous API (enabled bysyncorstdfeature)asyncmodule: asynchronous API (enabled byasyncfeature)
When the std feature is enabled (default), the synchronous API types
are re-exported at the crate root for convenience.
§Modules
error— Error types for FAT operationsfile— Short filename (8.3) types and validationraw— On-disk structures: boot sector, BPB, directory entriessync::fs— Filesystem handle and metadatasync::dir— Directory iteration and entry typessync::read— Read extension trait for file contentsync::write— Write extension trait for file modificationsync::fat_table— FAT table access (FAT12/16/32)sync::cache— Optional FAT sector cachingsync::format— Filesystem formatting (requireswrite)sync::tool— Analysis and verification (requirestool)