Skip to main content

FileSystem

Trait FileSystem 

Source
pub trait FileSystem: Send + Sync {
    // Required method
    fn read_file(&self, path: &str) -> Option<Vec<u8>>;

    // Provided methods
    fn write_file(&self, _path: &str, _data: &[u8]) -> bool { ... }
    fn file_exists(&self, path: &str) -> bool { ... }
}
Expand description

A file system the library resolves by path.

Send + Sync is mandatory, not conservative: the C++ header documents that these methods may be called concurrently from worker threads.

Required Methods§

Source

fn read_file(&self, path: &str) -> Option<Vec<u8>>

Provided Methods§

Source

fn write_file(&self, _path: &str, _data: &[u8]) -> bool

Source

fn file_exists(&self, path: &str) -> bool

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§