FileSystem

Trait FileSystem 

Source
pub trait FileSystem {
    // Required methods
    fn canonicalize_path<'a>(path: &'a Path) -> Cow<'a, Path>;
    fn file_content_utf8<P: AsRef<Path>>(
        &self,
        path: P,
    ) -> Result<String, Error>;
    fn glob(&self, pattern: &str) -> Result<Vec<PathBuf>, LoadError>;
}
Expand description

Interface to abstract file system. Normally you want to use ProdFileSystem.

Required Methods§

Source

fn canonicalize_path<'a>(path: &'a Path) -> Cow<'a, Path>

canonicalize the given path.

Source

fn file_content_utf8<P: AsRef<Path>>(&self, path: P) -> Result<String, Error>

Load the given path and returns it as UTF-8 String.

Source

fn glob(&self, pattern: &str) -> Result<Vec<PathBuf>, LoadError>

Returns all paths matching the given glob. Paths can be in arbitrary order, and caller must sort it beforehand.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§