pub trait ToAttribute: Display {
    fn to_attr(&self) -> Result<String> { ... }
}
Expand description

Trait to convert a value to a proper attribute string.

Provided Methods§

source

fn to_attr(&self) -> Result<String>

Converts the attribute name and value to an attribute string that can be sent to the C library.

attr The name of the attribute val The value to write.

Implementations on Foreign Types§

source§

impl ToAttribute for bool

Attribute conversion for the bool type.

The bool type needs a special implementation of the attribute conversion trait because it’s default Rust string counterparts are “true” and “false” for true and false values respectively. However, sysfs expects these to be “1” or “0”.

source§

impl ToAttribute for i32

source§

impl ToAttribute for u32

source§

impl ToAttribute for i64

source§

impl ToAttribute for u64

source§

impl ToAttribute for i128

source§

impl ToAttribute for u128

source§

impl ToAttribute for f64

source§

impl ToAttribute for str

source§

impl ToAttribute for &str

source§

impl ToAttribute for String

Implementors§