ev3dev_lang_rust/
device.rs1use crate::{Attribute, Ev3Result};
2
3pub trait Device {
5 fn get_attribute(&self, name: &str) -> Attribute;
7
8 fn get_address(&self) -> Ev3Result<String> {
10 self.get_attribute("address").get()
11 }
12
13 fn set_command(&self, command: &str) -> Ev3Result<()> {
15 self.get_attribute("command").set_str_slice(command)
16 }
17
18 fn get_commands(&self) -> Ev3Result<Vec<String>> {
20 self.get_attribute("commands").get_vec()
21 }
22
23 fn get_driver_name(&self) -> Ev3Result<String> {
25 self.get_attribute("driver_name").get()
26 }
27}