pub trait FileProvider: Send + Sync {
// Required methods
fn get(&self, path: &str) -> Result<Vec<u8>>;
fn exists(&self, path: &str) -> bool;
fn glob(&self, pattern: &str) -> Result<Vec<FileEntry>>;
fn lines(&self, path: &str) -> Result<Vec<String>>;
// Provided method
fn get_string(&self, path: &str) -> Result<String> { ... }
}Expand description
Trait for file access providers
This trait allows for different implementations:
SandboxedFileProvider: Real filesystem access (sandboxed to pack root)MockFileProvider: In-memory files for testingArchiveFileProvider: Read files from a tar.gz archive (future)
Required Methods§
Provided Methods§
Sourcefn get_string(&self, path: &str) -> Result<String>
fn get_string(&self, path: &str) -> Result<String>
Read the contents of a file as a string (UTF-8)