Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions rust/example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => (),

Expand Down