pub trait FileSystem:
Send
+ Sync
+ Debug {
// Required methods
fn read(&self, path: &Path) -> Result<Arc<str>, LoadError>;
fn exists(&self, path: &Path) -> bool;
fn is_encrypted(&self, path: &Path) -> bool;
fn normalize(&self, path: &Path) -> PathBuf;
// Provided methods
fn supports_parallel_read(&self) -> bool { ... }
fn glob(&self, pattern: &str) -> Result<Vec<PathBuf>, String> { ... }
}Expand description
Abstract file system interface for file loading.
This trait allows the loader to work with different file system backends:
DiskFileSystem: Reads from the actual filesystem (default)VirtualFileSystem: Reads from an in-memory file map (for WASM)
Required Methods§
Sourcefn is_encrypted(&self, path: &Path) -> bool
fn is_encrypted(&self, path: &Path) -> bool
Check if a path is a GPG-encrypted file.
For virtual filesystems, this always returns false since encrypted files should be decrypted before being added.
Provided Methods§
Sourcefn supports_parallel_read(&self) -> bool
fn supports_parallel_read(&self) -> bool
Whether this filesystem supports parallel file reads.
Disk filesystems return true — multiple files can be read
concurrently from different threads. Virtual filesystems return
false since they may use shared mutable state.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".