Skip to main content

FileProvider

Trait FileProvider 

Source
pub trait FileProvider:
    Send
    + Sync
    + Debug {
    // Required methods
    fn read_file(&self, pb: PathBuf) -> Result<Arc<FileSource>, CompilerError>;
    fn transform_paths(
        &self,
        sources: &[String],
    ) -> Result<Vec<PathBuf>, CompilerError>;
}
Expand description

Provides functions to supply file contents by paths.

Required Methods§

Source

fn read_file(&self, pb: PathBuf) -> Result<Arc<FileSource>, CompilerError>

Returns a FileSource containing the file contents referred to by the supplied path.

Source

fn transform_paths( &self, sources: &[String], ) -> Result<Vec<PathBuf>, CompilerError>

Takes a list of strings and returns a transformed list PathBufs.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§