Skip to main content

FileSystem

Trait FileSystem 

Source
pub trait FileSystem:
    Debug
    + Send
    + Sync {
    // Required methods
    fn read(&self, path: &Path) -> Result<Vec<u8>>;
    fn write(&self, path: &Path, contents: &[u8]) -> Result<()>;
    fn exists(&self, path: &Path) -> bool;
}
Expand description

Minimal file system access used by the odx library crates.

Required Methods§

Source

fn read(&self, path: &Path) -> Result<Vec<u8>>

Read the whole file at path.

§Errors

Returns an error when the file does not exist or cannot be read.

Source

fn write(&self, path: &Path, contents: &[u8]) -> Result<()>

Create or replace the file at path with contents.

§Errors

Returns an error when the file cannot be written.

Source

fn exists(&self, path: &Path) -> bool

Whether a file or directory exists at path.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§