Skip to main content

FileSystem

Trait FileSystem 

Source
pub trait FileSystem:
    Debug
    + Send
    + Sync {
    // Required method
    fn read(&self, path: &Path) -> Result<SourceBytes>;
}
Expand description

Where the compiler reads source from.

The one method is deliberate. Everything the preprocessor wants to know about a file, up to and including whether it exists, is answered by trying to read it, and an interface with a separate exists invites the race where the answer changes between the two calls.

Required Methods§

Source

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

Reads a file.

§Errors

Whatever the underlying file system says. io::ErrorKind::NotFound is the ordinary case during an include search and is not by itself a problem.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§