pub struct BasicEntityPath { /* private fields */ }
Expand description

Generic entity path with basic functionality

Implementations§

source§

impl BasicEntityPath

source

pub fn new(path: impl AsRef<Path>) -> Self

Create a new BasicEntityPath for manipulating path

source

pub fn filter_capabilities<A: SysAttribute>( &self, attributes: impl Iterator<Item = A> ) -> impl Iterator<Item = A>

Filter out attributes that do not exist on this entity

Trait Implementations§

source§

impl AsRef<Path> for BasicEntityPath

source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl SysEntity for BasicEntityPath

source§

fn to_entity_path(self) -> EntityPath

Convert specialized entity into general entity path container
source§

fn name(&self) -> IoResult<String>

Get the entity’s name
source§

fn root(&self) -> Option<SysPath>

Try to get the entity’s root sysfs dir (probably /)
source§

impl SysEntityAttributes<String> for BasicEntityPath

source§

fn capabilities(&self) -> Vec<String>

Get attributes available on this entity;
source§

fn read_value(&self, attr: A) -> IoResult<Vec<u8>>

Read entity attribute value
source§

fn write_value(&self, attr: A, value: &[u8]) -> IoResult<()>

Write entity attribute value

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<A, X> SysEntityAttributesExt<A> for Xwhere A: SysAttribute + Eq, X: SysEntityAttributes<A>,

source§

fn capable<C: Capabilities<A, A>>(&self, capabilities: C) -> bool

Returns true if self is capable of the provided capabilities
source§

fn attribute<T: FromStr<Err = E>, E>( &self, attr: A ) -> Result<T, EitherErr2<Error, E>>

Get an attribute on the entity
source§

fn set<V: ToString>(&self, attr: A, value: V) -> IoResult<()>

Set an attribute on the entity
source§

impl<X> SysEntityRawExt for Xwhere X: SysEntity,

source§

fn attribute<A, T, E>(&self, attr: A) -> Result<T, EitherErr2<Error, E>>where A: SysAttribute + Eq, T: FromStr<Err = E>,

Get an attribute on the entity
source§

fn attribute_str<A>(&self, attr: A) -> Result<String, Error>where A: AsRef<Path>,

Get an attribute by filename in the entity’s directory
source§

fn exists_str<A>(&self, attr: A) -> boolwhere A: AsRef<Path>,

Returns true when the entity has the attribute
source§

fn exists<A>(&self, attr: A) -> boolwhere A: SysAttribute,

Returns true when the entity has the attribute
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.