Skip to main content

SysFS

Trait SysFS 

Source
pub trait SysFS {
    // Required method
    fn get_path(&self) -> &Path;

    // Provided methods
    fn read_file(&self, file: impl AsRef<Path> + Debug) -> Result<String, Error> { ... }
    fn read_file_parsed<T: FromStr<Err = E>, E: ToString>(
        &self,
        file: &str,
    ) -> Result<T, Error> { ... }
    fn write_file<C: AsRef<[u8]> + Send>(
        &self,
        file: &str,
        contents: C,
    ) -> Result<(), Error> { ... }
}
Expand description

General functionality of a SysFS.

Required Methods§

Source

fn get_path(&self) -> &Path

Gets the path of the current SysFS.

Provided Methods§

Source

fn read_file(&self, file: impl AsRef<Path> + Debug) -> Result<String, Error>

Reads the content of a file in the SysFS.

Source

fn read_file_parsed<T: FromStr<Err = E>, E: ToString>( &self, file: &str, ) -> Result<T, Error>

Reads the content of a file and then parses it

Source

fn write_file<C: AsRef<[u8]> + Send>( &self, file: &str, contents: C, ) -> Result<(), Error>

Write to a file in the SysFS.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§