@@ -7,14 +7,14 @@ use std::fs::{self, File};
7
7
use std:: io;
8
8
use std:: io:: prelude:: * ;
9
9
use std:: path:: Path ;
10
- use sysfs_gpio:: Direction as SysfsDirection ;
10
+ use sysfs_gpio;
11
11
use toml;
12
12
13
13
#[ derive( Debug , PartialEq , Clone ) ]
14
- pub struct Direction ( pub SysfsDirection ) ;
14
+ pub struct Direction ( pub sysfs_gpio :: Direction ) ;
15
15
16
- impl From < SysfsDirection > for Direction {
17
- fn from ( e : SysfsDirection ) -> Self {
16
+ impl From < sysfs_gpio :: Direction > for Direction {
17
+ fn from ( e : sysfs_gpio :: Direction ) -> Self {
18
18
Direction ( e)
19
19
}
20
20
}
@@ -31,15 +31,15 @@ struct RawPinConfig {
31
31
#[ derive( Debug , Clone , PartialEq ) ]
32
32
pub struct PinConfig {
33
33
pub num : u64 ,
34
- pub direction : SysfsDirection ,
34
+ pub direction : sysfs_gpio :: Direction ,
35
35
pub names : BTreeSet < String > ,
36
36
pub export : bool ,
37
37
pub active_low : bool ,
38
38
}
39
39
40
40
impl Into < PinConfig > for RawPinConfig {
41
41
fn into ( self ) -> PinConfig {
42
- let default_direction = Direction ( SysfsDirection :: In ) ;
42
+ let default_direction = Direction ( sysfs_gpio :: Direction :: In ) ;
43
43
PinConfig {
44
44
num : self . num ,
45
45
direction : self . direction . unwrap_or ( default_direction) . 0 ,
@@ -53,10 +53,10 @@ impl Into<PinConfig> for RawPinConfig {
53
53
impl Decodable for Direction {
54
54
fn decode < D : Decoder > ( d : & mut D ) -> Result < Direction , D :: Error > {
55
55
match try!( d. read_str ( ) ) . as_str ( ) {
56
- "in" => Ok ( Direction ( SysfsDirection :: In ) ) ,
57
- "out" => Ok ( Direction ( SysfsDirection :: Out ) ) ,
58
- "high" => Ok ( Direction ( SysfsDirection :: High ) ) ,
59
- "low" => Ok ( Direction ( SysfsDirection :: Low ) ) ,
56
+ "in" => Ok ( Direction ( sysfs_gpio :: Direction :: In ) ) ,
57
+ "out" => Ok ( Direction ( sysfs_gpio :: Direction :: Out ) ) ,
58
+ "high" => Ok ( Direction ( sysfs_gpio :: Direction :: High ) ) ,
59
+ "low" => Ok ( Direction ( sysfs_gpio :: Direction :: Low ) ) ,
60
60
_ => Err ( d. error ( "Expected one of: {in, out, high, low}" ) ) ,
61
61
}
62
62
}
@@ -211,7 +211,7 @@ direction = "out"
211
211
"# ;
212
212
let config = GpioConfig :: from_str ( configstr) . unwrap ( ) ;
213
213
let status_led = config. pins . get ( 1 ) . unwrap ( ) ;
214
- let mut names = BTreeSet :: from_iter (
214
+ let names = BTreeSet :: from_iter (
215
215
vec ! ( String :: from( "status_led" ) ,
216
216
String :: from( "A27" ) ,
217
217
String :: from( "green_led" ) ) ) ;
@@ -231,7 +231,7 @@ pins = [
231
231
"# ;
232
232
let config = GpioConfig :: from_str ( configstr) . unwrap ( ) ;
233
233
let status_led = config. pins . get ( 1 ) . unwrap ( ) ;
234
- let mut names = BTreeSet :: from_iter (
234
+ let names = BTreeSet :: from_iter (
235
235
vec ! ( String :: from( "status_led" ) ,
236
236
String :: from( "A27" ) ,
237
237
String :: from( "green_led" ) ) ) ;
0 commit comments