Trait rem_utils::filesystem::FileSystem

source ·
pub trait FileSystem: Clone {
    type FSError: Debug;

    // Required methods
    fn exists<P: AsRef<Path>>(&self, path: P) -> Result<bool, Self::FSError>;
    fn read<P: AsRef<Path>>(&self, filename: P) -> Result<String, Self::FSError>;
    fn write<P: AsRef<Path>, C: AsRef<[u8]>>(
        &self,
        filename: P,
        contents: C,
    ) -> Result<(), Self::FSError>;
}
Expand description

Representation of a file system

Required Associated Types§

source

type FSError: Debug

Errors

Required Methods§

source

fn exists<P: AsRef<Path>>(&self, path: P) -> Result<bool, Self::FSError>

Tests for the existence of a given file

source

fn read<P: AsRef<Path>>(&self, filename: P) -> Result<String, Self::FSError>

Reads a file, specified by a path into a string

source

fn write<P: AsRef<Path>, C: AsRef<[u8]>>( &self, filename: P, contents: C, ) -> Result<(), Self::FSError>

Writes into a file specified by a path

Object Safety§

This trait is not object safe.

Implementors§