Skip to main content

FileSystem

Trait FileSystem 

Source
pub trait FileSystem {
    // Required methods
    fn read_to_string(&self, path: &Path) -> Result<String>;
    fn write(&self, path: &Path, contents: &[u8]) -> Result<()>;
    fn create_dir_all(&self, path: &Path) -> Result<()>;
    fn rename(&self, from: &Path, to: &Path) -> Result<()>;
    fn exists(&self, path: &Path) -> bool;
    fn open_read(&self, path: &Path) -> Result<Box<dyn BufRead>>;
    fn open_write(&self, path: &Path) -> Result<Box<dyn Write>>;
}

Required Methods§

Source

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

Source

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

Source

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

Source

fn rename(&self, from: &Path, to: &Path) -> Result<()>

Source

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

Source

fn open_read(&self, path: &Path) -> Result<Box<dyn BufRead>>

Source

fn open_write(&self, path: &Path) -> Result<Box<dyn Write>>

Implementors§

Source§

impl FileSystem for StdFileSystem

Available on non-WebAssembly only.