Expand description
A FAT filesystem library implemented in Rust.
§Usage
This crate is on crates.io and can be
used by adding lamfat to the dependencies in your project’s Cargo.toml.
[dependencies]
lamfat = "0.4"§Examples
use std::io::prelude::*;
fn main() -> std::io::Result<()> {
// Initialize a filesystem object
let img_file = std::fs::OpenOptions::new().read(true).write(true)
.open("tmp/fat.img")?;
let fs = lamfat::FileSystem::new(img_file, lamfat::FsOptions::new())?;
let root_dir = fs.root_dir();
// Write a file
root_dir.create_dir("foo")?;
let mut file = root_dir.create_file("foo/hello.txt")?;
file.truncate()?;
file.write_all(b"Hello World!")?;
// Read a directory
let dir = root_dir.open_dir("foo")?;
for r in dir.iter() {
let entry = r?;
println!("{}", entry.file_name());
}
}Macros§
Structs§
- Chrono
Time Provider chrono TimeProviderimplementation that returns current local time retrieved fromchronocrate.- Date
- A DOS compatible date.
- Date
Time - A DOS compatible date and time.
- Dir
- A FAT filesystem directory.
- DirEntry
- A FAT directory entry.
- DirIter
- An iterator over the directory entries.
- Extent
- An extent containing a file’s data on disk.
- File
- A FAT filesystem file object used for reading and writing data.
- File
Attributes - A FAT file attributes.
- File
System - A FAT filesystem object.
- File
System Stats - A FAT volume statistics.
- Format
Volume Options - A FAT filesystem formatting options
- FsOptions
- A FAT filesystem mount options.
- FsStatus
Flags - A FAT volume status flags retrived from the Boot Sector and the allocation table second entry.
- Lossy
OemCp Converter - Default implementation of
OemCpConverterthat changes all non-ASCII characters to the replacement character (U+FFFD). - Null
Time Provider TimeProviderimplementation that always returns DOS minimal date-time (1980-01-01 00:00:00).- StdIo
Wrapper std - A wrapper struct for types that have implementations for
std::iotraits. - Time
- A DOS compatible time.
Enums§
- Error
- Error enum with all errors that can be returned by functions from this crate
- FatType
- A type of FAT filesystem.
- Seek
From - Enumeration of possible methods to seek within an I/O object.
Traits§
- Into
Storage - IoBase
- Provides IO error as an associated type.
- IoError
- Trait that should be implemented by errors returned from the user supplied storage.
- OemCp
Converter - An OEM code page encoder/decoder.
- Read
- The
Readtrait allows for reading bytes from a source. - Read
Seek - A sum of
ReadandSeektraits. - Read
Write Seek - A sum of
Read,WriteandSeektraits. - Seek
- The
Seektrait provides a cursor which can be moved within a stream of bytes. - Time
Provider - A current time and date provider.
- Write
- The
Writetrait allows for writing bytes into the sink.
Functions§
- format_
volume - Create FAT filesystem on a disk or partition (format a volume)
Type Aliases§
- Default
Time Provider chrono - Default time provider implementation.