swc_core::common

Trait FileLoader

pub trait FileLoader {
    // Required methods
    fn file_exists(&self, path: &Path) -> bool;
    fn abs_path(&self, path: &Path) -> Option<PathBuf>;
    fn read_file(&self, path: &Path) -> Result<String, Error>;
}
Available on crate feature __common only.
Expand description

An abstraction over the fs operations used by the Parser.

Required Methods§

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

Query the existence of a file.

fn abs_path(&self, path: &Path) -> Option<PathBuf>

Return an absolute path to a file, if possible.

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

Read the contents of an UTF-8 file into memory.

Implementors§