diff --git a/.travis.yml b/.travis.yml index eb15b3553f..9503c5bc89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,6 +75,9 @@ matrix: after_success: bash <(curl -s https://codecov.io/bash) -s c/build || echo "Codecov did not collect coverage reports"; - env: + before_install: + - sudo apt-get -qq update + - sudo apt-get install libudev-dev language: rust rust: - stable diff --git a/Makefile b/Makefile index 2e8fa15327..b3b0cf76b6 100644 --- a/Makefile +++ b/Makefile @@ -319,6 +319,8 @@ test-haskell: test-rust: $(call announce-begin,"Running Rust tests") cd $(SWIFTNAV_ROOT)/rust/sbp && cargo test --verbose + $(call announce-begin,"Building Rust example") + cd $(SWIFTNAV_ROOT)/rust/example && cargo build --verbose $(call announce-end,"Finished running Rust tests") test-protobuf: diff --git a/rust/example/src/main.rs b/rust/example/src/main.rs index 1c5489e5b5..056e9cc64b 100644 --- a/rust/example/src/main.rs +++ b/rust/example/src/main.rs @@ -19,16 +19,17 @@ fn main() { let mut port = serialport::open_with_settings("/dev/ttyUSB0", &s) .expect("open failed"); + let mut parser = sbp::parser::Parser::new(); loop { - match sbp::client::parser::parse(&mut port) { + match parser.parse(&mut port) { Ok(SBP::MsgLog(x)) => println!("{}", x.text), Ok(SBP::MsgPosLLH(x)) => println!("{} {} {}", x.lat, x.lon, x.height), Ok(_) => (), - Err(Error::InvalidPreamble) => (), - Err(Error::CRCMismatch) => (), + Err(Error::NotEnoughData) => (), + Err(Error::UnrecoverableFailure) => (), Err(Error::ParseError) => (), Err(Error::IoError(ref x)) if x.kind() == std::io::ErrorKind::TimedOut => (),