Expand description
Virtual File System Abstraction
Provides platform-agnostic async file operations through the Vfs trait.
This enables the same code to work on native platforms and in the browser.
§Platform Implementations
- Native (
NativeVfs): Usestokio::fswith atomic write operations - WASM (
OpfsVfs): Uses the browser’s Origin Private File System API
§Features
Requires the persistence feature.
§Example
use logicaffeine_system::fs::{Vfs, NativeVfs};
use std::sync::Arc;
let vfs: Arc<dyn Vfs + Send + Sync> = Arc::new(NativeVfs::new("/data"));
// Write and read files
vfs.write("config.json", b"{}").await?;
let data = vfs.read("config.json").await?;
// Atomic append for journaling
vfs.append("log.txt", b"entry\n").await?;Structs§
Enums§
- VfsError
- Error type for VFS operations
Traits§
- Vfs
- Virtual File System trait for platform-agnostic file operations.
Functions§
- get_
platform_ vfs - Get the platform-default VFS instance.
Type Aliases§
- Platform
Vfs - Type alias for platform-specific VFS.
- VfsResult