pub trait FileOps: Send + Sync {
// Required methods
fn read(&self, path: &Path) -> Result<Vec<u8>>;
fn write(&self, path: &Path, data: &[u8]) -> Result<()>;
fn remove(&self, path: &Path) -> Result<()>;
fn list(&self, dir: &Path) -> Vec<(String, SystemTime)>;
fn is_file(&self, path: &Path) -> bool;
}Expand description
The file operations autosave and recovery need, by path.
Required Methods§
fn read(&self, path: &Path) -> Result<Vec<u8>>
Sourcefn write(&self, path: &Path, data: &[u8]) -> Result<()>
fn write(&self, path: &Path, data: &[u8]) -> Result<()>
Write data to path atomically, creating its folder.
Sourcefn remove(&self, path: &Path) -> Result<()>
fn remove(&self, path: &Path) -> Result<()>
Remove a file; removing a missing file is not an error.
Sourcefn list(&self, dir: &Path) -> Vec<(String, SystemTime)>
fn list(&self, dir: &Path) -> Vec<(String, SystemTime)>
Files directly in dir: (file name, modified time), sorted by name.
fn is_file(&self, path: &Path) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".