[][src]Trait sysfs_class::SysClass

pub trait SysClass: Sized {
    fn class() -> &'static str;
unsafe fn from_path_unchecked(path: PathBuf) -> Self;
fn path(&self) -> &Path; fn base() -> &'static str { ... }
fn dir() -> PathBuf { ... }
fn from_path(path: &Path) -> Result<Self> { ... }
fn all() -> Result<Vec<Self>> { ... }
fn iter() -> Box<dyn Iterator<Item = Result<Self>>>
    where
        Self: 'static
, { ... }
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

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

Loading content...

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, 

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

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<()>

Write a file underneath the sys object

Loading content...

Implementors

impl SysClass for Backlight[src]

impl SysClass for Block[src]

impl SysClass for DmiId[src]

impl SysClass for HwMon[src]

impl SysClass for Leds[src]

impl SysClass for Net[src]

impl SysClass for PciDevice[src]

impl SysClass for PciDriver[src]

impl SysClass for ScsiHost[src]

Loading content...