[−][src]Struct ev3dev_lang_rust::Attribute
A wrapper to a attribute file in the /sys/class/ directory.
Implementations
impl Attribute[src]
pub fn new(
class_name: &str,
name: &str,
attribute_name: &str
) -> Ev3Result<Attribute>[src]
class_name: &str,
name: &str,
attribute_name: &str
) -> Ev3Result<Attribute>
Create a new Attribute instance that wrappes
the file /sys/class/{class_name}/{name}{attribute_name}.
pub fn get<T>(&self) -> Ev3Result<T> where
T: FromStr,
<T as FromStr>::Err: Error, [src]
T: FromStr,
<T as FromStr>::Err: Error,
Returns the current value of the wrapped file.
The value is parsed to the type T.
Returns a Ev3Result::InternalError if the current value is not parsable to type T.
pub fn set<T>(&self, value: T) -> Ev3Result<()> where
T: ToString, [src]
T: ToString,
Sets the value of the wrapped file.
The value is parsed from the type T.
Returns a Ev3Result::InternalError if the file is not writable.
pub fn set_str_slice(&self, value: &str) -> Ev3Result<()>[src]
Sets the value of the wrapped file.
This function skips the string parsing of the self.set<T>() function.
Returns a Ev3Result::InternalError if the file is not writable.
pub fn get_vec(&self) -> Ev3Result<Vec<String>>[src]
Returns a string vector representation of the wrapped file. The file value is splitet at whitespaces.
pub fn get_raw_fd(&self) -> RawFd[src]
Returns a C pointer to the wrapped file.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Attribute[src]
impl !Send for Attribute[src]
impl !Sync for Attribute[src]
impl Unpin for Attribute[src]
impl !UnwindSafe for Attribute[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,