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§
Provided Methods§
Sourcefn read_file(&self, file: impl AsRef<Path> + Debug) -> Result<String, Error>
fn read_file(&self, file: impl AsRef<Path> + Debug) -> Result<String, Error>
Reads the content of a file in the SysFS
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.