Struct ev3dev_lang_rust::Driver
source · 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 !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