From a14a85123ac4e4a3b8830388cac72bc926799d17 Mon Sep 17 00:00:00 2001 From: Jason Mobarak Date: Wed, 22 Sep 2021 16:45:14 -0700 Subject: [PATCH] rust: update to swiftnav 0.6.1 (#1073) --- .../sbpg/targets/resources/sbp-cargo.toml | 6 +- .../targets/resources/sbp2json-cargo.toml | 4 +- .../targets/resources/sbp_messages_mod.rs | 4 +- generator/sbpg/targets/rust.py | 2 +- rust/sbp/Cargo.toml | 6 +- rust/sbp/src/lib.rs | 75 +++++++++---------- rust/sbp/src/messages/ext_events.rs | 2 +- rust/sbp/src/messages/imu.rs | 2 +- rust/sbp/src/messages/mag.rs | 2 +- rust/sbp/src/messages/mod.rs | 4 +- rust/sbp/src/messages/navigation.rs | 74 +++++++++--------- rust/sbp/src/messages/observation.rs | 10 +-- rust/sbp/src/messages/orientation.rs | 8 +- rust/sbp/src/messages/sbas.rs | 2 +- rust/sbp/src/messages/solution_meta.rs | 2 +- rust/sbp/src/messages/system.rs | 2 +- rust/sbp/src/messages/vehicle.rs | 4 +- rust/sbp/src/sbp_tools.rs | 14 ++-- rust/sbp/src/time.rs | 4 +- rust/sbp2json/Cargo.toml | 4 +- rust/sbp2json/tests/common/mod.rs | 6 +- 21 files changed, 118 insertions(+), 119 deletions(-) diff --git a/generator/sbpg/targets/resources/sbp-cargo.toml b/generator/sbpg/targets/resources/sbp-cargo.toml index 4c14b7d93a..94cd4633e9 100644 --- a/generator/sbpg/targets/resources/sbp-cargo.toml +++ b/generator/sbpg/targets/resources/sbp-cargo.toml @@ -34,9 +34,9 @@ log = "0.4" nom = "6.0" thiserror = "1.0" -[dependencies.swiftnav-rs] +[dependencies.swiftnav] git = "https://github.com/swift-nav/swiftnav-rs" -tag = "v0.5.1" +tag = "v0.6.1" optional = true [dependencies.slotmap] @@ -49,7 +49,7 @@ features = ["derive"] optional = true [dependencies.serde_json] -version = "1" +version = "1.0" optional = true [dependencies.base64] diff --git a/generator/sbpg/targets/resources/sbp2json-cargo.toml b/generator/sbpg/targets/resources/sbp2json-cargo.toml index 218c0ecbfc..69b42e4f2d 100644 --- a/generator/sbpg/targets/resources/sbp2json-cargo.toml +++ b/generator/sbpg/targets/resources/sbp2json-cargo.toml @@ -31,8 +31,8 @@ jemallocator = "0.3" sha2 = "0.8" hex = "0.4" assert_cmd = "1.0.1" -serde_json = "1" -assert-json-diff = "1.1.0" +serde_json = "1.0" +assert-json-diff = "2.0" [profile.release] lto = true diff --git a/generator/sbpg/targets/resources/sbp_messages_mod.rs b/generator/sbpg/targets/resources/sbp_messages_mod.rs index d777a6423c..41d9b4175e 100644 --- a/generator/sbpg/targets/resources/sbp_messages_mod.rs +++ b/generator/sbpg/targets/resources/sbp_messages_mod.rs @@ -31,7 +31,7 @@ pub trait SBPMessage: SbpSerialize { fn set_sender_id(&mut self, new_id: u16); fn to_frame(&self) -> std::result::Result, crate::FramerError>; fn write_frame(&self, buf: &mut Vec) -> std::result::Result<(), crate::FramerError>; - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time(&self) -> Option> { None } @@ -156,7 +156,7 @@ impl crate::SBPMessage for SBP { } } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time(&self) -> Option> { match self { ((*- for m in msgs *)) diff --git a/generator/sbpg/targets/rust.py b/generator/sbpg/targets/rust.py index 93a016fe1a..a957f060a6 100644 --- a/generator/sbpg/targets/rust.py +++ b/generator/sbpg/targets/rust.py @@ -203,7 +203,7 @@ def gen_ret(): ret = gen_ret() return f""" - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time(&self) -> Option> {{ {body} {ret} diff --git a/rust/sbp/Cargo.toml b/rust/sbp/Cargo.toml index b1daf2ab35..20d7e12a7f 100644 --- a/rust/sbp/Cargo.toml +++ b/rust/sbp/Cargo.toml @@ -34,9 +34,9 @@ log = "0.4" nom = "6.0" thiserror = "1.0" -[dependencies.swiftnav-rs] +[dependencies.swiftnav] git = "https://github.com/swift-nav/swiftnav-rs" -tag = "v0.5.1" +tag = "v0.6.1" optional = true [dependencies.slotmap] @@ -49,7 +49,7 @@ features = ["derive"] optional = true [dependencies.serde_json] -version = "1" +version = "1.0" optional = true [dependencies.base64] diff --git a/rust/sbp/src/lib.rs b/rust/sbp/src/lib.rs index e661cd3993..5ba79abb44 100644 --- a/rust/sbp/src/lib.rs +++ b/rust/sbp/src/lib.rs @@ -9,7 +9,7 @@ pub mod messages; pub(crate) mod parser; pub mod sbp_tools; pub mod serialize; -#[cfg(feature = "swiftnav-rs")] +#[cfg(feature = "swiftnav")] pub mod time; use std::{fmt, result}; @@ -161,8 +161,8 @@ pub enum FramerError { NoSenderId, } -#[cfg(feature = "swiftnav-rs")] -mod swiftnav_rs_conversions { +#[cfg(feature = "swiftnav")] +mod swiftnav_conversions { use std::convert::{TryFrom, TryInto}; use crate::messages; @@ -170,7 +170,7 @@ mod swiftnav_rs_conversions { #[derive(Debug, Clone, thiserror::Error)] pub enum GpsTimeError { #[error(transparent)] - InvalidGpsTime(#[from] swiftnav_rs::time::InvalidGpsTime), + InvalidGpsTime(#[from] swiftnav::time::InvalidGpsTime), #[error("Failed to convert week number to i16")] TryFromIntError(#[from] std::num::TryFromIntError), @@ -182,45 +182,44 @@ mod swiftnav_rs_conversions { } } - impl TryFrom for swiftnav_rs::time::GpsTime { - type Error = swiftnav_rs::time::InvalidGpsTime; + impl TryFrom for swiftnav::time::GpsTime { + type Error = swiftnav::time::InvalidGpsTime; fn try_from( msg: messages::gnss::GPSTime, - ) -> Result { + ) -> Result { let tow = (msg.tow as f64) * 1e-3 + (msg.ns_residual as f64) * 1e-9; - swiftnav_rs::time::GpsTime::new(msg.wn as i16, tow) + swiftnav::time::GpsTime::new(msg.wn as i16, tow) } } - impl TryFrom for swiftnav_rs::time::GpsTime { - type Error = swiftnav_rs::time::InvalidGpsTime; + impl TryFrom for swiftnav::time::GpsTime { + type Error = swiftnav::time::InvalidGpsTime; fn try_from( msg: messages::gnss::GPSTimeSec, - ) -> Result { - swiftnav_rs::time::GpsTime::new(msg.wn as i16, msg.tow as f64) + ) -> Result { + swiftnav::time::GpsTime::new(msg.wn as i16, msg.tow as f64) } } - impl TryFrom for swiftnav_rs::signal::GnssSignal { - type Error = swiftnav_rs::signal::InvalidGnssSignal; + impl TryFrom for swiftnav::signal::GnssSignal { + type Error = swiftnav::signal::InvalidGnssSignal; fn try_from( value: messages::gnss::GnssSignal, - ) -> Result - { - swiftnav_rs::signal::GnssSignal::new(value.sat as u16, value.code.try_into()?) + ) -> Result { + swiftnav::signal::GnssSignal::new(value.sat as u16, value.code.try_into()?) } } - impl TryFrom for swiftnav_rs::ephemeris::Ephemeris { + impl TryFrom for swiftnav::ephemeris::Ephemeris { type Error = EphemerisDecodeError; fn try_from( eph: messages::observation::MsgEphemerisGPS, - ) -> Result { - Ok(swiftnav_rs::ephemeris::Ephemeris::new( + ) -> Result { + Ok(swiftnav::ephemeris::Ephemeris::new( eph.common.sid.try_into()?, eph.common.toe.try_into()?, eph.common.ura, @@ -228,8 +227,8 @@ mod swiftnav_rs_conversions { eph.common.valid, eph.common.health_bits, 0, - swiftnav_rs::ephemeris::EphemerisTerms::new_kepler( - swiftnav_rs::signal::Constellation::Gps, + swiftnav::ephemeris::EphemerisTerms::new_kepler( + swiftnav::signal::Constellation::Gps, [eph.tgd, 0.], eph.c_rc as f64, eph.c_rs as f64, @@ -257,13 +256,13 @@ mod swiftnav_rs_conversions { } } - impl TryFrom for swiftnav_rs::ephemeris::Ephemeris { + impl TryFrom for swiftnav::ephemeris::Ephemeris { type Error = EphemerisDecodeError; fn try_from( eph: messages::observation::MsgEphemerisGal, - ) -> Result { - Ok(swiftnav_rs::ephemeris::Ephemeris::new( + ) -> Result { + Ok(swiftnav::ephemeris::Ephemeris::new( eph.common.sid.try_into()?, eph.common.toe.try_into()?, eph.common.ura, @@ -271,8 +270,8 @@ mod swiftnav_rs_conversions { eph.common.valid, eph.common.health_bits, eph.source, - swiftnav_rs::ephemeris::EphemerisTerms::new_kepler( - swiftnav_rs::signal::Constellation::Gal, + swiftnav::ephemeris::EphemerisTerms::new_kepler( + swiftnav::signal::Constellation::Gal, [eph.bgd_e1e5a, eph.bgd_e1e5b], eph.c_rc as f64, eph.c_rs as f64, @@ -303,26 +302,22 @@ mod swiftnav_rs_conversions { #[derive(Debug, Copy, Clone, PartialOrd, PartialEq, thiserror::Error)] pub enum EphemerisDecodeError { #[error(transparent)] - InvalidTime(#[from] swiftnav_rs::time::InvalidGpsTime), + InvalidTime(#[from] swiftnav::time::InvalidGpsTime), #[error(transparent)] - InvalidSignal(#[from] swiftnav_rs::signal::InvalidGnssSignal), + InvalidSignal(#[from] swiftnav::signal::InvalidGnssSignal), } - impl TryFrom - for swiftnav_rs::navmeas::NavigationMeasurement - { - type Error = swiftnav_rs::signal::InvalidGnssSignal; + impl TryFrom for swiftnav::navmeas::NavigationMeasurement { + type Error = swiftnav::signal::InvalidGnssSignal; fn try_from( observation: messages::observation::PackedObsContent, - ) -> Result< - swiftnav_rs::navmeas::NavigationMeasurement, - swiftnav_rs::signal::InvalidGnssSignal, - > { - let mut measurement = swiftnav_rs::navmeas::NavigationMeasurement::new(); + ) -> Result + { + let mut measurement = swiftnav::navmeas::NavigationMeasurement::new(); - measurement.set_lock_time(swiftnav_rs::navmeas::decode_lock_time(observation.lock)); + measurement.set_lock_time(swiftnav::navmeas::decode_lock_time(observation.lock)); measurement.set_sid(observation.sid.try_into()?); // A CN0 of 0 is considered invalid if observation.cn0 != 0 { @@ -337,7 +332,7 @@ mod swiftnav_rs_conversions { } if observation.flags & 0x80 != 0 { measurement.set_flags( - measurement.get_flags() | swiftnav_rs::navmeas::NAV_MEAS_FLAG_RAIM_EXCLUSION, + measurement.flags() | swiftnav::navmeas::NAV_MEAS_FLAG_RAIM_EXCLUSION, ); } diff --git a/rust/sbp/src/messages/ext_events.rs b/rust/sbp/src/messages/ext_events.rs index 6c8bd59797..2da912c55e 100644 --- a/rust/sbp/src/messages/ext_events.rs +++ b/rust/sbp/src/messages/ext_events.rs @@ -90,7 +90,7 @@ impl super::SBPMessage for MsgExtEvent { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/imu.rs b/rust/sbp/src/messages/imu.rs index 6ab5d190bb..cd2cf0b01b 100644 --- a/rust/sbp/src/messages/imu.rs +++ b/rust/sbp/src/messages/imu.rs @@ -195,7 +195,7 @@ impl super::SBPMessage for MsgImuRaw { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/mag.rs b/rust/sbp/src/messages/mag.rs index 5600d13486..39a195437a 100644 --- a/rust/sbp/src/messages/mag.rs +++ b/rust/sbp/src/messages/mag.rs @@ -88,7 +88,7 @@ impl super::SBPMessage for MsgMagRaw { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/mod.rs b/rust/sbp/src/messages/mod.rs index ddd3935635..0363766a39 100644 --- a/rust/sbp/src/messages/mod.rs +++ b/rust/sbp/src/messages/mod.rs @@ -244,7 +244,7 @@ pub trait SBPMessage: SbpSerialize { fn set_sender_id(&mut self, new_id: u16); fn to_frame(&self) -> std::result::Result, crate::FramerError>; fn write_frame(&self, buf: &mut Vec) -> std::result::Result<(), crate::FramerError>; - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -2749,7 +2749,7 @@ impl crate::SBPMessage for SBP { } } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs index 9743207563..972e2e391b 100644 --- a/rust/sbp/src/messages/navigation.rs +++ b/rust/sbp/src/messages/navigation.rs @@ -165,7 +165,7 @@ impl super::SBPMessage for MsgAgeCorrections { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -278,7 +278,7 @@ impl super::SBPMessage for MsgBaselineECEF { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -401,7 +401,7 @@ impl super::SBPMessage for MsgBaselineECEFDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -514,7 +514,7 @@ impl super::SBPMessage for MsgBaselineHeadingDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -636,7 +636,7 @@ impl super::SBPMessage for MsgBaselineNED { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -766,7 +766,7 @@ impl super::SBPMessage for MsgBaselineNEDDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -891,7 +891,7 @@ impl super::SBPMessage for MsgDops { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -1009,7 +1009,7 @@ impl super::SBPMessage for MsgDopsDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -1129,7 +1129,7 @@ impl super::SBPMessage for MsgGPSTime { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -1249,7 +1249,7 @@ impl super::SBPMessage for MsgGPSTimeDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -1369,7 +1369,7 @@ impl super::SBPMessage for MsgGPSTimeGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -1493,7 +1493,7 @@ impl super::SBPMessage for MsgPosECEF { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -1635,7 +1635,7 @@ impl super::SBPMessage for MsgPosECEFCov { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -1787,7 +1787,7 @@ impl super::SBPMessage for MsgPosECEFCovGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -1923,7 +1923,7 @@ impl super::SBPMessage for MsgPosECEFDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -2049,7 +2049,7 @@ impl super::SBPMessage for MsgPosECEFGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -2178,7 +2178,7 @@ impl super::SBPMessage for MsgPosLLH { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -2335,7 +2335,7 @@ impl super::SBPMessage for MsgPosLLHAcc { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -2489,7 +2489,7 @@ impl super::SBPMessage for MsgPosLLHCov { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -2641,7 +2641,7 @@ impl super::SBPMessage for MsgPosLLHCovGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -2780,7 +2780,7 @@ impl super::SBPMessage for MsgPosLLHDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -2911,7 +2911,7 @@ impl super::SBPMessage for MsgPosLLHGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -3079,7 +3079,7 @@ impl super::SBPMessage for MsgProtectionLevel { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -3233,7 +3233,7 @@ impl super::SBPMessage for MsgProtectionLevelDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -3361,7 +3361,7 @@ impl super::SBPMessage for MsgUtcTime { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -3493,7 +3493,7 @@ impl super::SBPMessage for MsgUtcTimeGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -3640,7 +3640,7 @@ impl super::SBPMessage for MsgVelBody { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -3772,7 +3772,7 @@ impl super::SBPMessage for MsgVelECEF { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -3909,7 +3909,7 @@ impl super::SBPMessage for MsgVelECEFCov { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -4056,7 +4056,7 @@ impl super::SBPMessage for MsgVelECEFCovGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -4188,7 +4188,7 @@ impl super::SBPMessage for MsgVelECEFDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -4310,7 +4310,7 @@ impl super::SBPMessage for MsgVelECEFGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -4436,7 +4436,7 @@ impl super::SBPMessage for MsgVelNED { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -4578,7 +4578,7 @@ impl super::SBPMessage for MsgVelNEDCov { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -4728,7 +4728,7 @@ impl super::SBPMessage for MsgVelNEDCovGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -4864,7 +4864,7 @@ impl super::SBPMessage for MsgVelNEDDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -4992,7 +4992,7 @@ impl super::SBPMessage for MsgVelNEDGnss { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/observation.rs b/rust/sbp/src/messages/observation.rs index 8befee65c8..c0b7201113 100644 --- a/rust/sbp/src/messages/observation.rs +++ b/rust/sbp/src/messages/observation.rs @@ -5103,7 +5103,7 @@ impl super::SBPMessage for MsgObs { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -5202,7 +5202,7 @@ impl super::SBPMessage for MsgObsDepA { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -5304,7 +5304,7 @@ impl super::SBPMessage for MsgObsDepB { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -5408,7 +5408,7 @@ impl super::SBPMessage for MsgObsDepC { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -5508,7 +5508,7 @@ impl super::SBPMessage for MsgOsr { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/orientation.rs b/rust/sbp/src/messages/orientation.rs index 0b7d4d9af0..dfe7f122dc 100644 --- a/rust/sbp/src/messages/orientation.rs +++ b/rust/sbp/src/messages/orientation.rs @@ -95,7 +95,7 @@ impl super::SBPMessage for MsgAngularRate { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -206,7 +206,7 @@ impl super::SBPMessage for MsgBaselineHeading { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -328,7 +328,7 @@ impl super::SBPMessage for MsgOrientEuler { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -464,7 +464,7 @@ impl super::SBPMessage for MsgOrientQuat { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/sbas.rs b/rust/sbp/src/messages/sbas.rs index 7fa903a4ef..058033051a 100644 --- a/rust/sbp/src/messages/sbas.rs +++ b/rust/sbp/src/messages/sbas.rs @@ -86,7 +86,7 @@ impl super::SBPMessage for MsgSbasRaw { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/solution_meta.rs b/rust/sbp/src/messages/solution_meta.rs index 95ffd49d34..8497fe6a2a 100644 --- a/rust/sbp/src/messages/solution_meta.rs +++ b/rust/sbp/src/messages/solution_meta.rs @@ -214,7 +214,7 @@ impl super::SBPMessage for MsgSolnMeta { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/system.rs b/rust/sbp/src/messages/system.rs index 72c8eb05f3..7ed3c13904 100644 --- a/rust/sbp/src/messages/system.rs +++ b/rust/sbp/src/messages/system.rs @@ -718,7 +718,7 @@ impl super::SBPMessage for MsgInsUpdates { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/messages/vehicle.rs b/rust/sbp/src/messages/vehicle.rs index 41d1499030..788667b242 100644 --- a/rust/sbp/src/messages/vehicle.rs +++ b/rust/sbp/src/messages/vehicle.rs @@ -91,7 +91,7 @@ impl super::SBPMessage for MsgOdometry { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { @@ -209,7 +209,7 @@ impl super::SBPMessage for MsgWheeltick { crate::write_frame(self, frame) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn gps_time( &self, ) -> Option> { diff --git a/rust/sbp/src/sbp_tools.rs b/rust/sbp/src/sbp_tools.rs index f327b70ba2..8e2afd40fe 100644 --- a/rust/sbp/src/sbp_tools.rs +++ b/rust/sbp/src/sbp_tools.rs @@ -1,7 +1,7 @@ -#[cfg(feature = "swiftnav-rs")] -use swiftnav_rs::time::GpsTime; +#[cfg(feature = "swiftnav")] +use swiftnav::time::GpsTime; -#[cfg(feature = "swiftnav-rs")] +#[cfg(feature = "swiftnav")] use crate::{ messages::SBPMessage, time::{GpsTimeError, MessageTime, RoverTime}, @@ -41,7 +41,7 @@ pub trait SBPTools: Iterator { HandleErrorsIter::new(self, on_err) } - #[cfg(feature = "swiftnav-rs")] + #[cfg(feature = "swiftnav")] fn with_rover_time(self) -> RoverTimeIter where Self: Sized, @@ -107,13 +107,13 @@ where } } -#[cfg(feature = "swiftnav-rs")] +#[cfg(feature = "swiftnav")] pub struct RoverTimeIter { messages: I, clock: Option, } -#[cfg(feature = "swiftnav-rs")] +#[cfg(feature = "swiftnav")] impl RoverTimeIter where I: Iterator, @@ -149,7 +149,7 @@ where } } -#[cfg(feature = "swiftnav-rs")] +#[cfg(feature = "swiftnav")] impl Iterator for RoverTimeIter where I: Iterator, diff --git a/rust/sbp/src/time.rs b/rust/sbp/src/time.rs index c25c519cb8..260706a28f 100644 --- a/rust/sbp/src/time.rs +++ b/rust/sbp/src/time.rs @@ -1,6 +1,6 @@ -pub use swiftnav_rs::time::GpsTime; +pub use swiftnav::time::GpsTime; -pub use crate::swiftnav_rs_conversions::GpsTimeError; +pub use crate::swiftnav_conversions::GpsTimeError; #[derive(Debug, Clone, Copy)] pub enum MessageTime { diff --git a/rust/sbp2json/Cargo.toml b/rust/sbp2json/Cargo.toml index b1b0b3fe3e..6a1639cccc 100644 --- a/rust/sbp2json/Cargo.toml +++ b/rust/sbp2json/Cargo.toml @@ -31,8 +31,8 @@ jemallocator = "0.3" sha2 = "0.8" hex = "0.4" assert_cmd = "1.0.1" -serde_json = "1" -assert-json-diff = "1.1.0" +serde_json = "1.0" +assert-json-diff = "2.0" [profile.release] lto = true diff --git a/rust/sbp2json/tests/common/mod.rs b/rust/sbp2json/tests/common/mod.rs index d8f1c5cc3f..6ab7b0ab18 100644 --- a/rust/sbp2json/tests/common/mod.rs +++ b/rust/sbp2json/tests/common/mod.rs @@ -8,6 +8,7 @@ use std::{ }; use assert_cmd::{assert::OutputAssertExt, cargo::CommandCargoExt}; +use assert_json_diff::{assert_json_matches_no_panic, CompareMode, Config, NumericMode}; use serde_json::{Deserializer, Value}; use sha2::{Digest, Sha256}; @@ -234,7 +235,10 @@ fn json_file_equals(a: File, b: File) -> bool { let wrong = a .iter() .zip(b.iter()) - .map(|(a, b)| assert_json_diff::assert_json_eq_no_panic(a, b)) + .map(|(a, b)| { + let config = Config::new(CompareMode::Strict).numeric_mode(NumericMode::AssumeFloat); + assert_json_matches_no_panic(a, b, config) + }) .enumerate() .find(|(_, res)| res.is_err());