Trait sysfs_class::SysClass

source ·
pub trait SysClass: Sized {
    fn class() -> &'static str;
    unsafe fn from_path_unchecked(path: PathBuf) -> Self;
    fn path(&self) -> &Path;

    fn dir() -> PathBuf { ... }
    fn from_path(path: &Path) -> Result<Self> { ... }
    fn all() -> Result<Vec<Self>> { ... }
    fn new(id: &str) -> Result<Self> { ... }
    fn id(&self) -> &str { ... }
    fn read_file<P: AsRef<Path>>(&self, name: P) -> Result<String> { ... }
    fn parse_file<F: FromStr, P: AsRef<Path>>(&self, name: P) -> Result<F>
    where
        F::Err: Display
, { ... } fn trim_file<P: AsRef<Path>>(&self, name: P) -> Result<String> { ... } fn write_file<P: AsRef<Path>, S: AsRef<[u8]>>(
        &self,
        name: P,
        data: S
    ) -> Result<()> { ... } }

Required Methods

Return the class of the sys object, the name of a folder in /sys/class

Create a sys object from an absolute path without checking path for validity

Return the path of the sys object

Provided Methods

Return the path to the sys objects, the full path of a folder in /sys/class

Create a sys object from a path, checking it for validity

Retrieve all of the object instances of a sys class

Create a sys object by id, checking it for validity

Return the id of the sys object

Read a file underneath the sys object

Parse a number from a file underneath the sys object

Read a file underneath the sys object and trim whitespace

Write a file underneath the sys object

Implementors