Skip to main content

FileSystem

Trait FileSystem 

Source
pub trait FileSystem {
    // Required methods
    fn exists(&self, path: &Path) -> bool;
    fn read_to_string(&self, path: &Path) -> Result<String>;
}
Expand description

Filesystem abstraction so include resolution can be tested without touching real disk. Implement this for a real filesystem in an embedder; FakeFileSystem is the in-memory implementation used by this crate’s own tests.

Required Methods§

Source

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

Returns whether path exists.

Source

fn read_to_string(&self, path: &Path) -> Result<String>

Reads the full contents of path as a UTF-8 string.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§