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