Skip to main content

Crate hadris_fat

Crate hadris_fat 

Source
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

FeatureDefaultDescription
stdYesStandard library support (enables alloc, sync, chrono clock)
allocNoHeap allocation without full std
syncNoSynchronous API via hadris-io sync traits
asyncNoAsynchronous API via hadris-io async traits
readYesRead operations
writeYesWrite operations (requires alloc + read)
lfnYesLong filename (VFAT) support
cacheNoFAT sector caching for reduced I/O
toolNoAnalysis and diagnostic utilities
exfatNoexFAT 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:

  • sync module: synchronous API (enabled by sync or std feature)
  • async module: asynchronous API (enabled by async feature)

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 operations
  • file — Short filename (8.3) types and validation
  • raw — On-disk structures: boot sector, BPB, directory entries
  • sync::fs — Filesystem handle and metadata
  • sync::dir — Directory iteration and entry types
  • sync::read — Read extension trait for file content
  • sync::write — Write extension trait for file modification
  • sync::fat_table — FAT table access (FAT12/16/32)
  • sync::cache — Optional FAT sector caching
  • sync::format — Filesystem formatting (requires write)
  • sync::tool — Analysis and verification (requires tool)

Re-exports§

pub use error::FatError;
pub use error::Result;
pub use sync::*;
pub use raw::*;

Modules§

error
Error types for the hadris-fat crate.
file
raw
sync
Synchronous FAT filesystem API.