Skip to content

Commit e61d4e1

Browse files
authored
Merge pull request #61 from pheki/fix-tokio
Fix compilation with use_tokio feature
2 parents 62e267c + 0ee1da0 commit e61d4e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use std::fs;
5454
use std::fs::File;
5555
use std::io;
5656
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"))]
5858
use std::io::SeekFrom;
5959
use std::os::unix::prelude::*;
6060
use std::path::Path;
@@ -102,7 +102,7 @@ macro_rules! try_unexport {
102102
match $e {
103103
Ok(res) => res,
104104
Err(e) => {
105-
try!($gpio.unexport());
105+
$gpio.unexport()?;
106106
return Err(e);
107107
}
108108
}
@@ -123,7 +123,7 @@ fn flush_input_from_file(dev_file: &mut File, max: usize) -> io::Result<usize> {
123123
}
124124

125125
/// 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"))]
127127
fn get_value_from_file(dev_file: &mut File) -> Result<u8> {
128128
let mut s = String::with_capacity(10);
129129
dev_file.seek(SeekFrom::Start(0))?;
@@ -217,8 +217,8 @@ impl Pin {
217217
/// let gpio = Pin::new(24);
218218
/// let res = gpio.with_exported(|| {
219219
/// 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)?;
222222
/// // ...
223223
/// Ok(())
224224
/// });
@@ -731,7 +731,7 @@ impl Stream for PinValueStream {
731731
fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
732732
match self.0.poll() {
733733
Ok(Async::Ready(Some(()))) => {
734-
let value = try!(self.get_value());
734+
let value = self.get_value()?;
735735
Ok(Async::Ready(Some(value)))
736736
}
737737
Ok(Async::Ready(None)) => Ok(Async::Ready(None)),

0 commit comments

Comments
 (0)