@@ -54,7 +54,7 @@ use std::fs;
54
54
use std:: fs:: File ;
55
55
use std:: io;
56
56
use std:: io:: prelude:: * ;
57
- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
57
+ #[ cfg( any( target_os = "linux" , target_os = "android" , feature = "use_tokio" ) ) ]
58
58
use std:: io:: SeekFrom ;
59
59
use std:: os:: unix:: prelude:: * ;
60
60
use std:: path:: Path ;
@@ -102,7 +102,7 @@ macro_rules! try_unexport {
102
102
match $e {
103
103
Ok ( res) => res,
104
104
Err ( e) => {
105
- try! ( $gpio. unexport( ) ) ;
105
+ $gpio. unexport( ) ? ;
106
106
return Err ( e) ;
107
107
}
108
108
}
@@ -123,7 +123,7 @@ fn flush_input_from_file(dev_file: &mut File, max: usize) -> io::Result<usize> {
123
123
}
124
124
125
125
/// Get the pin value from the provided file
126
- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
126
+ #[ cfg( any( target_os = "linux" , target_os = "android" , feature = "use_tokio" ) ) ]
127
127
fn get_value_from_file ( dev_file : & mut File ) -> Result < u8 > {
128
128
let mut s = String :: with_capacity ( 10 ) ;
129
129
dev_file. seek ( SeekFrom :: Start ( 0 ) ) ?;
@@ -217,8 +217,8 @@ impl Pin {
217
217
/// let gpio = Pin::new(24);
218
218
/// let res = gpio.with_exported(|| {
219
219
/// println!("At this point, the Pin is exported");
220
- /// try!( gpio.set_direction(Direction::Low)) ;
221
- /// try!( gpio.set_value(1)) ;
220
+ /// gpio.set_direction(Direction::Low)? ;
221
+ /// gpio.set_value(1)? ;
222
222
/// // ...
223
223
/// Ok(())
224
224
/// });
@@ -731,7 +731,7 @@ impl Stream for PinValueStream {
731
731
fn poll ( & mut self ) -> Poll < Option < Self :: Item > , Self :: Error > {
732
732
match self . 0 . poll ( ) {
733
733
Ok ( Async :: Ready ( Some ( ( ) ) ) ) => {
734
- let value = try! ( self . get_value ( ) ) ;
734
+ let value = self . get_value ( ) ? ;
735
735
Ok ( Async :: Ready ( Some ( value) ) )
736
736
}
737
737
Ok ( Async :: Ready ( None ) ) => Ok ( Async :: Ready ( None ) ) ,
0 commit comments