pub trait FileLoader {
// Required methods
fn file_exists(&self, path: &Path) -> bool;
fn read_file(&self, path: &Path) -> Result<String>;
fn read_binary_file(&self, path: &Path) -> Result<Arc<[u8]>>;
fn current_directory(&self) -> Result<PathBuf>;
}Expand description
An abstraction over the fs operations used by the Parser.
Required Methods§
Sourcefn file_exists(&self, path: &Path) -> bool
fn file_exists(&self, path: &Path) -> bool
Query the existence of a file.
Sourcefn read_file(&self, path: &Path) -> Result<String>
fn read_file(&self, path: &Path) -> Result<String>
Read the contents of a UTF-8 file into memory. This function must return a String because we normalize source files, which may require resizing.
Sourcefn read_binary_file(&self, path: &Path) -> Result<Arc<[u8]>>
fn read_binary_file(&self, path: &Path) -> Result<Arc<[u8]>>
Read the contents of a potentially non-UTF-8 file into memory. We don’t normalize binary files, so we can start in an Arc.
Sourcefn current_directory(&self) -> Result<PathBuf>
fn current_directory(&self) -> Result<PathBuf>
Current working directory