pub trait FileSystem {
    // Required methods
    fn read_to_string(&self, path: &Path) -> Result<String>;
    fn write_bytes(&self, path: &Path, contents: &[u8]) -> Result<()>;
}
Expand description

File system operations that TeX may need to perform.

These operations are extracted to a trait so that they be mocked out in unit testing and in execution contexts like WASM.

Required Methods§

source

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

Read the entire contents of a file into a string.

This is implemented by std::fs::read_to_string.

source

fn write_bytes(&self, path: &Path, contents: &[u8]) -> Result<()>

Write a slice of bytes to a file.

This is implemented by std::fs::write.

Implementors§