BasicEntityPath

Struct BasicEntityPath 

Source
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;

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 X

Source§

fn capable<C: Capabilities<A, Self>>(&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§

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
Source§

fn exists(&self, attr: &A) -> bool

Returns true when the entity has the attribute
Source§

impl<X> SysEntityRawExt for X
where X: SysEntity,

Source§

fn attribute<A, T, E>(&self, attr: A) -> Result<T, EitherErr2<Error, E>>
where A: SysAttribute, 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) -> bool
where A: AsRef<Path>,

Returns true when the entity has the attribute
Source§

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

Returns true when the entity has the attribute
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.