pub trait FileSystem {
// Required methods
fn read_file(&self, path: &Path) -> Result<Vec<u8>>;
fn file_exists(&self, path: &Path) -> bool;
// Provided method
fn read_file_string(&self, path: &Path) -> Result<String> { ... }
}Expand description
Environment trait for file system operations.
Abstraction over file system to enable testing without real files.
Required Methods§
Sourcefn file_exists(&self, path: &Path) -> bool
fn file_exists(&self, path: &Path) -> bool
Check if file exists.
Provided Methods§
Sourcefn read_file_string(&self, path: &Path) -> Result<String>
fn read_file_string(&self, path: &Path) -> Result<String>
Read file contents as UTF-8 string.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".