[−][src]Trait sysfs_class::SysClass
Required methods
fn class() -> &'static str
Return the class of the sys object, the name of a folder in `/sys/${base}``
unsafe fn from_path_unchecked(path: PathBuf) -> Self
Create a sys object from an absolute path without checking path for validity
fn path(&self) -> &Path
Return the path of the sys object
Provided methods
fn base() -> &'static str
Sets the base directory, which defaults to class
.
fn dir() -> PathBuf
Return the path to the sys objects, the full path of a folder in /sys/class
fn from_path(path: &Path) -> Result<Self>
Create a sys object from a path, checking it for validity
fn all() -> Result<Vec<Self>>
Retrieve all of the object instances of a sys class
fn iter() -> Box<dyn Iterator<Item = Result<Self>>> where
Self: 'static,
Self: 'static,
Retrieve all of the object instances of a sys class, with a boxed iterator
fn new(id: &str) -> Result<Self>
Create a sys object by id, checking it for validity
fn id(&self) -> &str
Return the id of the sys object
fn read_file<P: AsRef<Path>>(&self, name: P) -> Result<String>
Read a file underneath the sys object
fn parse_file<F: FromStr, P: AsRef<Path>>(&self, name: P) -> Result<F> where
F::Err: Display,
F::Err: Display,
Parse a number from a file underneath the sys object
fn trim_file<P: AsRef<Path>>(&self, name: P) -> Result<String>
Read a file underneath the sys object and trim whitespace
fn write_file<P: AsRef<Path>, S: AsRef<[u8]>>(
&self,
name: P,
data: S
) -> Result<()>
&self,
name: P,
data: S
) -> Result<()>
Write a file underneath the sys object