vfs_kit/lib.rs
1//! A lightweight, extensible virtual filesystem (VFS) toolkit for Rust. Provides in‑process abstractions over real
2//! or simulated filesystems, ideal for testing, sandboxing, custom storage backends, and so on.
3//!
4//! ### Overview
5//!
6//! `vfs-kit` lets you work with filesystem-like structures in Rust without touching the real disk (unless you want to).
7//! It defines a common `FsBackend` trait and provides concrete implementations like `DirFS` that map to real directories.
8//!
9//! **Key ideas**:
10//! - **Abstraction**: Treat different storage backends (real dirs, memory maps, etc.) via a unified API.
11//! - **Safety**: Operations are confined to a root path; no accidental host filesystem access.
12//! - **Testability**: Use in unit tests to simulate filesystems without side effects.
13//! - **Extensibility**: Plug in new backends by implementing `FsBackend`.
14//! - **Clarity**: Comprehensive error messages and documentation.
15//!
16//! ### Features
17//!
18//! - Path normalization (`.`, `..`, trailing slashes)
19//! - Current working directory (`cwd`) support
20//! - Create/read/write/remove files and directories
21//! - Existence checks and state tracking
22//! - Auto‑cleanup on drop (optional)
23//! - Cross‑platform path handling
24//! - Rich error messages via `anyhow`
25//! - Clean, documented API
26//! - Easy to extend with custom backends
27
28mod core;
29mod vfs;
30
31pub use core::{Result, FsBackend};
32pub use vfs::{DirFS, DirEntry, DirEntryType};