pub struct Driver { /* private fields */ }
Expand description
Helper struct that manages attributes.
It creates an Attribute
instance if it does not exists or uses a cached one.
Implementations§
Source§impl Driver
impl Driver
Sourcepub fn new(class_name: &str, name: &str) -> Driver
pub fn new(class_name: &str, name: &str) -> Driver
Returns a new Driver
.
All attributes created by this driver will use the path /sys/class/{class_name}/{name}
.
Sourcepub fn find_name_by_port_and_driver(
class_name: &str,
port: &dyn Port,
driver_name_vec: &[&str],
) -> Ev3Result<String>
pub fn find_name_by_port_and_driver( class_name: &str, port: &dyn Port, driver_name_vec: &[&str], ) -> Ev3Result<String>
Returns the name of the device with the given class_name
, driver_name
and at the given port
.
Returns Ev3Error::NotFound
if no such device exists.
Sourcepub fn find_name_by_driver(
class_name: &str,
driver_name_vec: &[&str],
) -> Ev3Result<String>
pub fn find_name_by_driver( class_name: &str, driver_name_vec: &[&str], ) -> Ev3Result<String>
Returns the name of the device with the given class_name
.
Returns Ev3Error::NotFound
if no such device exists.
Returns Ev3Error::MultipleMatches
if more then one matching device exists.
Sourcepub fn find_names_by_driver(
class_name: &str,
driver_name_vec: &[&str],
) -> Ev3Result<Vec<String>>
pub fn find_names_by_driver( class_name: &str, driver_name_vec: &[&str], ) -> Ev3Result<Vec<String>>
Returns the names of the devices with the given class_name
.
Sourcepub fn get_attribute(&self, attribute_name: &str) -> Attribute
pub fn get_attribute(&self, attribute_name: &str) -> Attribute
Return the Attribute
wrapper for the given attribute_name
.
Creates a new one if it does not exist.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Driver
impl !RefUnwindSafe for Driver
impl Send for Driver
impl !Sync for Driver
impl Unpin for Driver
impl UnwindSafe for Driver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more