From 3a7cc95a954f5f5c35457fa2354e62462daa20ac Mon Sep 17 00:00:00 2001 From: Jason Mobarak Date: Fri, 22 May 2020 12:34:43 -0700 Subject: [PATCH] Make generated code more `cargo fmt` friendly --- .../resources/sbp_messages_template.rs | 1 + rust/sbp/src/messages/acquisition.rs | 40 +-- rust/sbp/src/messages/bootload.rs | 30 +- rust/sbp/src/messages/ext_events.rs | 5 +- rust/sbp/src/messages/file_io.rs | 45 +-- rust/sbp/src/messages/flash.rs | 50 ++-- rust/sbp/src/messages/gnss.rs | 35 ++- rust/sbp/src/messages/imu.rs | 10 +- rust/sbp/src/messages/linux.rs | 40 +-- rust/sbp/src/messages/logging.rs | 15 +- rust/sbp/src/messages/mag.rs | 5 +- rust/sbp/src/messages/navigation.rs | 165 ++++++----- rust/sbp/src/messages/ndb.rs | 5 +- rust/sbp/src/messages/observation.rs | 270 +++++++++++------- rust/sbp/src/messages/orientation.rs | 20 +- rust/sbp/src/messages/piksi.rs | 145 ++++++---- rust/sbp/src/messages/sbas.rs | 5 +- rust/sbp/src/messages/settings.rs | 50 ++-- rust/sbp/src/messages/ssr.rs | 100 ++++--- rust/sbp/src/messages/system.rs | 30 +- rust/sbp/src/messages/tracking.rs | 75 +++-- rust/sbp/src/messages/user.rs | 5 +- rust/sbp/src/messages/vehicle.rs | 10 +- 23 files changed, 706 insertions(+), 450 deletions(-) diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index 3b8d45700e..dcdcad9fb3 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -51,6 +51,7 @@ pub struct (((m.identifier|camel_case))) { } impl (((m.identifier|camel_case))) { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result<(((m.identifier|camel_case))), crate::Error> { Ok( (((m.identifier|camel_case))){ ((*- if m.sbp_id *)) diff --git a/rust/sbp/src/messages/acquisition.rs b/rust/sbp/src/messages/acquisition.rs index 19a067420c..6ee3a2b94d 100644 --- a/rust/sbp/src/messages/acquisition.rs +++ b/rust/sbp/src/messages/acquisition.rs @@ -61,8 +61,9 @@ pub struct AcqSvProfile { } impl AcqSvProfile { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(AcqSvProfile { + Ok( AcqSvProfile{ job_type: _buf.read_u8()?, status: _buf.read_u8()?, cn0: _buf.read_u16::()?, @@ -75,7 +76,7 @@ impl AcqSvProfile { cf_max: _buf.read_i32::()?, cf: _buf.read_i32::()?, cp: _buf.read_u32::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -164,8 +165,9 @@ pub struct AcqSvProfileDep { } impl AcqSvProfileDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(AcqSvProfileDep { + Ok( AcqSvProfileDep{ job_type: _buf.read_u8()?, status: _buf.read_u8()?, cn0: _buf.read_u16::()?, @@ -178,7 +180,7 @@ impl AcqSvProfileDep { cf_max: _buf.read_i32::()?, cf: _buf.read_i32::()?, cp: _buf.read_u32::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -259,14 +261,15 @@ pub struct MsgAcqResult { } impl MsgAcqResult { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAcqResult { + Ok( MsgAcqResult{ sender_id: None, cn0: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, sid: GnssSignal::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgAcqResult { @@ -329,14 +332,15 @@ pub struct MsgAcqResultDepA { } impl MsgAcqResultDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAcqResultDepA { + Ok( MsgAcqResultDepA{ sender_id: None, snr: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, prn: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgAcqResultDepA { @@ -398,14 +402,15 @@ pub struct MsgAcqResultDepB { } impl MsgAcqResultDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAcqResultDepB { + Ok( MsgAcqResultDepB{ sender_id: None, snr: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, sid: GnssSignalDep::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgAcqResultDepB { @@ -466,14 +471,15 @@ pub struct MsgAcqResultDepC { } impl MsgAcqResultDepC { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAcqResultDepC { + Ok( MsgAcqResultDepC{ sender_id: None, cn0: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, sid: GnssSignalDep::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgAcqResultDepC { @@ -529,11 +535,12 @@ pub struct MsgAcqSvProfile { } impl MsgAcqSvProfile { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAcqSvProfile { + Ok( MsgAcqSvProfile{ sender_id: None, acq_sv_profile: AcqSvProfile::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgAcqSvProfile { @@ -582,11 +589,12 @@ pub struct MsgAcqSvProfileDep { } impl MsgAcqSvProfileDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAcqSvProfileDep { + Ok( MsgAcqSvProfileDep{ sender_id: None, acq_sv_profile: AcqSvProfileDep::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgAcqSvProfileDep { diff --git a/rust/sbp/src/messages/bootload.rs b/rust/sbp/src/messages/bootload.rs index 2f3c055507..59be8c03f0 100644 --- a/rust/sbp/src/messages/bootload.rs +++ b/rust/sbp/src/messages/bootload.rs @@ -42,11 +42,12 @@ pub struct MsgBootloaderHandshakeDepA { } impl MsgBootloaderHandshakeDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBootloaderHandshakeDepA { + Ok( MsgBootloaderHandshakeDepA{ sender_id: None, handshake: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgBootloaderHandshakeDepA { @@ -95,8 +96,11 @@ pub struct MsgBootloaderHandshakeReq { } impl MsgBootloaderHandshakeReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBootloaderHandshakeReq { sender_id: None }) + Ok( MsgBootloaderHandshakeReq{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgBootloaderHandshakeReq { @@ -147,12 +151,13 @@ pub struct MsgBootloaderHandshakeResp { } impl MsgBootloaderHandshakeResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBootloaderHandshakeResp { + Ok( MsgBootloaderHandshakeResp{ sender_id: None, flags: _buf.read_u32::()?, version: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgBootloaderHandshakeResp { @@ -203,11 +208,12 @@ pub struct MsgBootloaderJumpToApp { } impl MsgBootloaderJumpToApp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBootloaderJumpToApp { + Ok( MsgBootloaderJumpToApp{ sender_id: None, jump: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgBootloaderJumpToApp { @@ -259,8 +265,11 @@ pub struct MsgNapDeviceDnaReq { } impl MsgNapDeviceDnaReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgNapDeviceDnaReq { sender_id: None }) + Ok( MsgNapDeviceDnaReq{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgNapDeviceDnaReq { @@ -310,11 +319,12 @@ pub struct MsgNapDeviceDnaResp { } impl MsgNapDeviceDnaResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgNapDeviceDnaResp { + Ok( MsgNapDeviceDnaResp{ sender_id: None, dna: crate::parser::read_u8_array_limit(_buf, 8)?, - }) + } ) } } impl super::SBPMessage for MsgNapDeviceDnaResp { diff --git a/rust/sbp/src/messages/ext_events.rs b/rust/sbp/src/messages/ext_events.rs index 28d6dea35b..72d9d8d942 100644 --- a/rust/sbp/src/messages/ext_events.rs +++ b/rust/sbp/src/messages/ext_events.rs @@ -49,15 +49,16 @@ pub struct MsgExtEvent { } impl MsgExtEvent { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgExtEvent { + Ok( MsgExtEvent{ sender_id: None, wn: _buf.read_u16::()?, tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, flags: _buf.read_u8()?, pin: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgExtEvent { diff --git a/rust/sbp/src/messages/file_io.rs b/rust/sbp/src/messages/file_io.rs index ade431c762..ec970d1109 100644 --- a/rust/sbp/src/messages/file_io.rs +++ b/rust/sbp/src/messages/file_io.rs @@ -48,11 +48,12 @@ pub struct MsgFileioConfigReq { } impl MsgFileioConfigReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFileioConfigReq { + Ok( MsgFileioConfigReq{ sender_id: None, sequence: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgFileioConfigReq { @@ -111,14 +112,15 @@ pub struct MsgFileioConfigResp { } impl MsgFileioConfigResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFileioConfigResp { + Ok( MsgFileioConfigResp{ sender_id: None, sequence: _buf.read_u32::()?, window_size: _buf.read_u32::()?, batch_size: _buf.read_u32::()?, fileio_version: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgFileioConfigResp { @@ -186,13 +188,14 @@ pub struct MsgFileioReadDirReq { } impl MsgFileioReadDirReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFileioReadDirReq { + Ok( MsgFileioReadDirReq{ sender_id: None, sequence: _buf.read_u32::()?, offset: _buf.read_u32::()?, dirname: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgFileioReadDirReq { @@ -252,12 +255,13 @@ pub struct MsgFileioReadDirResp { } impl MsgFileioReadDirResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFileioReadDirResp { + Ok( MsgFileioReadDirResp{ sender_id: None, sequence: _buf.read_u32::()?, contents: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgFileioReadDirResp { @@ -321,14 +325,15 @@ pub struct MsgFileioReadReq { } impl MsgFileioReadReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFileioReadReq { + Ok( MsgFileioReadReq{ sender_id: None, sequence: _buf.read_u32::()?, offset: _buf.read_u32::()?, chunk_size: _buf.read_u8()?, filename: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgFileioReadReq { @@ -389,12 +394,13 @@ pub struct MsgFileioReadResp { } impl MsgFileioReadResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFileioReadResp { + Ok( MsgFileioReadResp{ sender_id: None, sequence: _buf.read_u32::()?, contents: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgFileioReadResp { @@ -448,11 +454,12 @@ pub struct MsgFileioRemove { } impl MsgFileioRemove { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFileioRemove { + Ok( MsgFileioRemove{ sender_id: None, filename: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgFileioRemove { @@ -514,14 +521,15 @@ pub struct MsgFileioWriteReq { } impl MsgFileioWriteReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFileioWriteReq { + Ok( MsgFileioWriteReq{ sender_id: None, sequence: _buf.read_u32::()?, offset: _buf.read_u32::()?, filename: crate::parser::read_string(_buf)?, data: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgFileioWriteReq { @@ -580,11 +588,12 @@ pub struct MsgFileioWriteResp { } impl MsgFileioWriteResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFileioWriteResp { + Ok( MsgFileioWriteResp{ sender_id: None, sequence: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgFileioWriteResp { diff --git a/rust/sbp/src/messages/flash.rs b/rust/sbp/src/messages/flash.rs index adcb5563e3..8929197a77 100644 --- a/rust/sbp/src/messages/flash.rs +++ b/rust/sbp/src/messages/flash.rs @@ -45,11 +45,12 @@ pub struct MsgFlashDone { } impl MsgFlashDone { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFlashDone { + Ok( MsgFlashDone{ sender_id: None, response: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgFlashDone { @@ -104,12 +105,13 @@ pub struct MsgFlashErase { } impl MsgFlashErase { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFlashErase { + Ok( MsgFlashErase{ sender_id: None, target: _buf.read_u8()?, sector_num: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgFlashErase { @@ -171,14 +173,15 @@ pub struct MsgFlashProgram { } impl MsgFlashProgram { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFlashProgram { + Ok( MsgFlashProgram{ sender_id: None, target: _buf.read_u8()?, addr_start: crate::parser::read_u8_array_limit(_buf, 3)?, addr_len: _buf.read_u8()?, data: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgFlashProgram { @@ -243,13 +246,14 @@ pub struct MsgFlashReadReq { } impl MsgFlashReadReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFlashReadReq { + Ok( MsgFlashReadReq{ sender_id: None, target: _buf.read_u8()?, addr_start: crate::parser::read_u8_array_limit(_buf, 3)?, addr_len: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgFlashReadReq { @@ -312,13 +316,14 @@ pub struct MsgFlashReadResp { } impl MsgFlashReadResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFlashReadResp { + Ok( MsgFlashReadResp{ sender_id: None, target: _buf.read_u8()?, addr_start: crate::parser::read_u8_array_limit(_buf, 3)?, addr_len: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgFlashReadResp { @@ -372,11 +377,12 @@ pub struct MsgM25FlashWriteStatus { } impl MsgM25FlashWriteStatus { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgM25FlashWriteStatus { + Ok( MsgM25FlashWriteStatus{ sender_id: None, status: crate::parser::read_u8_array_limit(_buf, 1)?, - }) + } ) } } impl super::SBPMessage for MsgM25FlashWriteStatus { @@ -426,11 +432,12 @@ pub struct MsgStmFlashLockSector { } impl MsgStmFlashLockSector { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgStmFlashLockSector { + Ok( MsgStmFlashLockSector{ sender_id: None, sector: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgStmFlashLockSector { @@ -480,11 +487,12 @@ pub struct MsgStmFlashUnlockSector { } impl MsgStmFlashUnlockSector { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgStmFlashUnlockSector { + Ok( MsgStmFlashUnlockSector{ sender_id: None, sector: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgStmFlashUnlockSector { @@ -535,8 +543,11 @@ pub struct MsgStmUniqueIdReq { } impl MsgStmUniqueIdReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgStmUniqueIdReq { sender_id: None }) + Ok( MsgStmUniqueIdReq{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgStmUniqueIdReq { @@ -585,11 +596,12 @@ pub struct MsgStmUniqueIdResp { } impl MsgStmUniqueIdResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgStmUniqueIdResp { + Ok( MsgStmUniqueIdResp{ sender_id: None, stm_id: crate::parser::read_u8_array_limit(_buf, 12)?, - }) + } ) } } impl super::SBPMessage for MsgStmUniqueIdResp { diff --git a/rust/sbp/src/messages/gnss.rs b/rust/sbp/src/messages/gnss.rs index 83a1c0d50d..544aadd45a 100644 --- a/rust/sbp/src/messages/gnss.rs +++ b/rust/sbp/src/messages/gnss.rs @@ -41,11 +41,12 @@ pub struct CarrierPhase { } impl CarrierPhase { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(CarrierPhase { + Ok( CarrierPhase{ i: _buf.read_i32::()?, f: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -100,12 +101,13 @@ pub struct GPSTime { } impl GPSTime { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GPSTime { + Ok( GPSTime{ tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, wn: _buf.read_u16::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -158,11 +160,12 @@ pub struct GPSTimeDep { } impl GPSTimeDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GPSTimeDep { + Ok( GPSTimeDep{ tow: _buf.read_u32::()?, wn: _buf.read_u16::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -213,11 +216,12 @@ pub struct GPSTimeSec { } impl GPSTimeSec { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GPSTimeSec { + Ok( GPSTimeSec{ tow: _buf.read_u32::()?, wn: _buf.read_u16::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -267,11 +271,12 @@ pub struct GnssSignal { } impl GnssSignal { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GnssSignal { + Ok( GnssSignal{ sat: _buf.read_u8()?, code: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -324,12 +329,13 @@ pub struct GnssSignalDep { } impl GnssSignalDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GnssSignalDep { + Ok( GnssSignalDep{ sat: _buf.read_u16::()?, code: _buf.read_u8()?, reserved: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -384,11 +390,12 @@ pub struct SvId { } impl SvId { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(SvId { + Ok( SvId{ satId: _buf.read_u8()?, constellation: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); diff --git a/rust/sbp/src/messages/imu.rs b/rust/sbp/src/messages/imu.rs index 53bbfee9d2..fce90e13b1 100644 --- a/rust/sbp/src/messages/imu.rs +++ b/rust/sbp/src/messages/imu.rs @@ -43,13 +43,14 @@ pub struct MsgImuAux { } impl MsgImuAux { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgImuAux { + Ok( MsgImuAux{ sender_id: None, imu_type: _buf.read_u8()?, temp: _buf.read_i16::()?, imu_conf: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgImuAux { @@ -119,8 +120,9 @@ pub struct MsgImuRaw { } impl MsgImuRaw { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgImuRaw { + Ok( MsgImuRaw{ sender_id: None, tow: _buf.read_u32::()?, tow_f: _buf.read_u8()?, @@ -130,7 +132,7 @@ impl MsgImuRaw { gyr_x: _buf.read_i16::()?, gyr_y: _buf.read_i16::()?, gyr_z: _buf.read_i16::()?, - }) + } ) } } impl super::SBPMessage for MsgImuRaw { diff --git a/rust/sbp/src/messages/linux.rs b/rust/sbp/src/messages/linux.rs index f93b5b181d..12f63629fc 100644 --- a/rust/sbp/src/messages/linux.rs +++ b/rust/sbp/src/messages/linux.rs @@ -47,15 +47,16 @@ pub struct MsgLinuxCpuState { } impl MsgLinuxCpuState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgLinuxCpuState { + Ok( MsgLinuxCpuState{ sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, pcpu: _buf.read_u8()?, tname: crate::parser::read_string_limit(_buf, 15)?, cmdline: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgLinuxCpuState { @@ -121,15 +122,16 @@ pub struct MsgLinuxMemState { } impl MsgLinuxMemState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgLinuxMemState { + Ok( MsgLinuxMemState{ sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, pmem: _buf.read_u8()?, tname: crate::parser::read_string_limit(_buf, 15)?, cmdline: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgLinuxMemState { @@ -192,14 +194,15 @@ pub struct MsgLinuxProcessFdCount { } impl MsgLinuxProcessFdCount { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgLinuxProcessFdCount { + Ok( MsgLinuxProcessFdCount{ sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, fd_count: _buf.read_u16::()?, cmdline: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgLinuxProcessFdCount { @@ -260,12 +263,13 @@ pub struct MsgLinuxProcessFdSummary { } impl MsgLinuxProcessFdSummary { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgLinuxProcessFdSummary { + Ok( MsgLinuxProcessFdSummary{ sender_id: None, sys_fd_count: _buf.read_u32::()?, most_opened: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgLinuxProcessFdSummary { @@ -330,8 +334,9 @@ pub struct MsgLinuxProcessSocketCounts { } impl MsgLinuxProcessSocketCounts { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgLinuxProcessSocketCounts { + Ok( MsgLinuxProcessSocketCounts{ sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, @@ -339,7 +344,7 @@ impl MsgLinuxProcessSocketCounts { socket_types: _buf.read_u16::()?, socket_states: _buf.read_u16::()?, cmdline: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgLinuxProcessSocketCounts { @@ -417,8 +422,9 @@ pub struct MsgLinuxProcessSocketQueues { } impl MsgLinuxProcessSocketQueues { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgLinuxProcessSocketQueues { + Ok( MsgLinuxProcessSocketQueues{ sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, @@ -428,7 +434,7 @@ impl MsgLinuxProcessSocketQueues { socket_states: _buf.read_u16::()?, address_of_largest: crate::parser::read_string_limit(_buf, 64)?, cmdline: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgLinuxProcessSocketQueues { @@ -501,14 +507,15 @@ pub struct MsgLinuxSocketUsage { } impl MsgLinuxSocketUsage { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgLinuxSocketUsage { + Ok( MsgLinuxSocketUsage{ sender_id: None, avg_queue_depth: _buf.read_u32::()?, max_queue_depth: _buf.read_u32::()?, socket_state_counts: crate::parser::read_u16_array_limit(_buf, 16)?, socket_type_counts: crate::parser::read_u16_array_limit(_buf, 16)?, - }) + } ) } } impl super::SBPMessage for MsgLinuxSocketUsage { @@ -573,8 +580,9 @@ pub struct MsgLinuxSysState { } impl MsgLinuxSysState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgLinuxSysState { + Ok( MsgLinuxSysState{ sender_id: None, mem_total: _buf.read_u16::()?, pcpu: _buf.read_u8()?, @@ -582,7 +590,7 @@ impl MsgLinuxSysState { procs_starting: _buf.read_u16::()?, procs_stopping: _buf.read_u16::()?, pid_count: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgLinuxSysState { diff --git a/rust/sbp/src/messages/logging.rs b/rust/sbp/src/messages/logging.rs index b111eb4039..1c60c51f93 100644 --- a/rust/sbp/src/messages/logging.rs +++ b/rust/sbp/src/messages/logging.rs @@ -48,13 +48,14 @@ pub struct MsgFwd { } impl MsgFwd { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFwd { + Ok( MsgFwd{ sender_id: None, source: _buf.read_u8()?, protocol: _buf.read_u8()?, fwd_payload: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgFwd { @@ -111,12 +112,13 @@ pub struct MsgLog { } impl MsgLog { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgLog { + Ok( MsgLog{ sender_id: None, level: _buf.read_u8()?, text: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgLog { @@ -167,11 +169,12 @@ pub struct MsgPrintDep { } impl MsgPrintDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPrintDep { + Ok( MsgPrintDep{ sender_id: None, text: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgPrintDep { diff --git a/rust/sbp/src/messages/mag.rs b/rust/sbp/src/messages/mag.rs index 9bd4071c4d..02f246f613 100644 --- a/rust/sbp/src/messages/mag.rs +++ b/rust/sbp/src/messages/mag.rs @@ -46,15 +46,16 @@ pub struct MsgMagRaw { } impl MsgMagRaw { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgMagRaw { + Ok( MsgMagRaw{ sender_id: None, tow: _buf.read_u32::()?, tow_f: _buf.read_u8()?, mag_x: _buf.read_i16::()?, mag_y: _buf.read_i16::()?, mag_z: _buf.read_i16::()?, - }) + } ) } } impl super::SBPMessage for MsgMagRaw { diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs index 0d14f59e8a..edd7a3377a 100644 --- a/rust/sbp/src/messages/navigation.rs +++ b/rust/sbp/src/messages/navigation.rs @@ -58,12 +58,13 @@ pub struct MsgAgeCorrections { } impl MsgAgeCorrections { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAgeCorrections { + Ok( MsgAgeCorrections{ sender_id: None, tow: _buf.read_u32::()?, age: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgAgeCorrections { @@ -130,8 +131,9 @@ pub struct MsgBaselineECEF { } impl MsgBaselineECEF { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBaselineECEF { + Ok( MsgBaselineECEF{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, @@ -140,7 +142,7 @@ impl MsgBaselineECEF { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgBaselineECEF { @@ -217,8 +219,9 @@ pub struct MsgBaselineECEFDepA { } impl MsgBaselineECEFDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBaselineECEFDepA { + Ok( MsgBaselineECEFDepA{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, @@ -227,7 +230,7 @@ impl MsgBaselineECEFDepA { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgBaselineECEFDepA { @@ -296,14 +299,15 @@ pub struct MsgBaselineHeadingDepA { } impl MsgBaselineHeadingDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBaselineHeadingDepA { + Ok( MsgBaselineHeadingDepA{ sender_id: None, tow: _buf.read_u32::()?, heading: _buf.read_u32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgBaselineHeadingDepA { @@ -377,8 +381,9 @@ pub struct MsgBaselineNED { } impl MsgBaselineNED { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBaselineNED { + Ok( MsgBaselineNED{ sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, @@ -388,7 +393,7 @@ impl MsgBaselineNED { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgBaselineNED { @@ -470,8 +475,9 @@ pub struct MsgBaselineNEDDepA { } impl MsgBaselineNEDDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBaselineNEDDepA { + Ok( MsgBaselineNEDDepA{ sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, @@ -481,7 +487,7 @@ impl MsgBaselineNEDDepA { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgBaselineNEDDepA { @@ -559,8 +565,9 @@ pub struct MsgDops { } impl MsgDops { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgDops { + Ok( MsgDops{ sender_id: None, tow: _buf.read_u32::()?, gdop: _buf.read_u16::()?, @@ -569,7 +576,7 @@ impl MsgDops { hdop: _buf.read_u16::()?, vdop: _buf.read_u16::()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgDops { @@ -642,8 +649,9 @@ pub struct MsgDopsDepA { } impl MsgDopsDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgDopsDepA { + Ok( MsgDopsDepA{ sender_id: None, tow: _buf.read_u32::()?, gdop: _buf.read_u16::()?, @@ -651,7 +659,7 @@ impl MsgDopsDepA { tdop: _buf.read_u16::()?, hdop: _buf.read_u16::()?, vdop: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgDopsDepA { @@ -729,14 +737,15 @@ pub struct MsgGPSTime { } impl MsgGPSTime { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgGPSTime { + Ok( MsgGPSTime{ sender_id: None, wn: _buf.read_u16::()?, tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgGPSTime { @@ -810,14 +819,15 @@ pub struct MsgGPSTimeDepA { } impl MsgGPSTimeDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgGPSTimeDepA { + Ok( MsgGPSTimeDepA{ sender_id: None, wn: _buf.read_u16::()?, tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgGPSTimeDepA { @@ -891,8 +901,9 @@ pub struct MsgPosECEF { } impl MsgPosECEF { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosECEF { + Ok( MsgPosECEF{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_f64::()?, @@ -901,7 +912,7 @@ impl MsgPosECEF { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosECEF { @@ -992,8 +1003,9 @@ pub struct MsgPosECEFCov { } impl MsgPosECEFCov { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosECEFCov { + Ok( MsgPosECEFCov{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_f64::()?, @@ -1007,7 +1019,7 @@ impl MsgPosECEFCov { cov_z_z: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosECEFCov { @@ -1108,8 +1120,9 @@ pub struct MsgPosECEFCovGnss { } impl MsgPosECEFCovGnss { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosECEFCovGnss { + Ok( MsgPosECEFCovGnss{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_f64::()?, @@ -1123,7 +1136,7 @@ impl MsgPosECEFCovGnss { cov_z_z: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosECEFCovGnss { @@ -1213,8 +1226,9 @@ pub struct MsgPosECEFDepA { } impl MsgPosECEFDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosECEFDepA { + Ok( MsgPosECEFDepA{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_f64::()?, @@ -1223,7 +1237,7 @@ impl MsgPosECEFDepA { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosECEFDepA { @@ -1303,8 +1317,9 @@ pub struct MsgPosECEFGnss { } impl MsgPosECEFGnss { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosECEFGnss { + Ok( MsgPosECEFGnss{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_f64::()?, @@ -1313,7 +1328,7 @@ impl MsgPosECEFGnss { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosECEFGnss { @@ -1395,8 +1410,9 @@ pub struct MsgPosLLH { } impl MsgPosLLH { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosLLH { + Ok( MsgPosLLH{ sender_id: None, tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, @@ -1406,7 +1422,7 @@ impl MsgPosLLH { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosLLH { @@ -1498,8 +1514,9 @@ pub struct MsgPosLLHCov { } impl MsgPosLLHCov { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosLLHCov { + Ok( MsgPosLLHCov{ sender_id: None, tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, @@ -1513,7 +1530,7 @@ impl MsgPosLLHCov { cov_d_d: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosLLHCov { @@ -1613,8 +1630,9 @@ pub struct MsgPosLLHCovGnss { } impl MsgPosLLHCovGnss { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosLLHCovGnss { + Ok( MsgPosLLHCovGnss{ sender_id: None, tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, @@ -1628,7 +1646,7 @@ impl MsgPosLLHCovGnss { cov_d_d: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosLLHCovGnss { @@ -1720,8 +1738,9 @@ pub struct MsgPosLLHDepA { } impl MsgPosLLHDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosLLHDepA { + Ok( MsgPosLLHDepA{ sender_id: None, tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, @@ -1731,7 +1750,7 @@ impl MsgPosLLHDepA { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosLLHDepA { @@ -1815,8 +1834,9 @@ pub struct MsgPosLLHGnss { } impl MsgPosLLHGnss { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgPosLLHGnss { + Ok( MsgPosLLHGnss{ sender_id: None, tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, @@ -1826,7 +1846,7 @@ impl MsgPosLLHGnss { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgPosLLHGnss { @@ -1903,8 +1923,9 @@ pub struct MsgProtectionLevel { } impl MsgProtectionLevel { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgProtectionLevel { + Ok( MsgProtectionLevel{ sender_id: None, tow: _buf.read_u32::()?, vpl: _buf.read_u16::()?, @@ -1913,7 +1934,7 @@ impl MsgProtectionLevel { lon: _buf.read_f64::()?, height: _buf.read_f64::()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgProtectionLevel { @@ -1991,8 +2012,9 @@ pub struct MsgUtcTime { } impl MsgUtcTime { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgUtcTime { + Ok( MsgUtcTime{ sender_id: None, flags: _buf.read_u8()?, tow: _buf.read_u32::()?, @@ -2003,7 +2025,7 @@ impl MsgUtcTime { minutes: _buf.read_u8()?, seconds: _buf.read_u8()?, ns: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgUtcTime { @@ -2097,8 +2119,9 @@ pub struct MsgVelBody { } impl MsgVelBody { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelBody { + Ok( MsgVelBody{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, @@ -2112,7 +2135,7 @@ impl MsgVelBody { cov_z_z: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelBody { @@ -2197,8 +2220,9 @@ pub struct MsgVelECEF { } impl MsgVelECEF { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelECEF { + Ok( MsgVelECEF{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, @@ -2207,7 +2231,7 @@ impl MsgVelECEF { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelECEF { @@ -2292,8 +2316,9 @@ pub struct MsgVelECEFCov { } impl MsgVelECEFCov { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelECEFCov { + Ok( MsgVelECEFCov{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, @@ -2307,7 +2332,7 @@ impl MsgVelECEFCov { cov_z_z: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelECEFCov { @@ -2402,8 +2427,9 @@ pub struct MsgVelECEFCovGnss { } impl MsgVelECEFCovGnss { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelECEFCovGnss { + Ok( MsgVelECEFCovGnss{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, @@ -2417,7 +2443,7 @@ impl MsgVelECEFCovGnss { cov_z_z: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelECEFCovGnss { @@ -2502,8 +2528,9 @@ pub struct MsgVelECEFDepA { } impl MsgVelECEFDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelECEFDepA { + Ok( MsgVelECEFDepA{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, @@ -2512,7 +2539,7 @@ impl MsgVelECEFDepA { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelECEFDepA { @@ -2587,8 +2614,9 @@ pub struct MsgVelECEFGnss { } impl MsgVelECEFGnss { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelECEFGnss { + Ok( MsgVelECEFGnss{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, @@ -2597,7 +2625,7 @@ impl MsgVelECEFGnss { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelECEFGnss { @@ -2675,8 +2703,9 @@ pub struct MsgVelNED { } impl MsgVelNED { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelNED { + Ok( MsgVelNED{ sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, @@ -2686,7 +2715,7 @@ impl MsgVelNED { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelNED { @@ -2776,8 +2805,9 @@ pub struct MsgVelNEDCov { } impl MsgVelNEDCov { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelNEDCov { + Ok( MsgVelNEDCov{ sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, @@ -2791,7 +2821,7 @@ impl MsgVelNEDCov { cov_d_d: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelNEDCov { @@ -2889,8 +2919,9 @@ pub struct MsgVelNEDCovGnss { } impl MsgVelNEDCovGnss { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelNEDCovGnss { + Ok( MsgVelNEDCovGnss{ sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, @@ -2904,7 +2935,7 @@ impl MsgVelNEDCovGnss { cov_d_d: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelNEDCovGnss { @@ -2992,8 +3023,9 @@ pub struct MsgVelNEDDepA { } impl MsgVelNEDDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelNEDDepA { + Ok( MsgVelNEDDepA{ sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, @@ -3003,7 +3035,7 @@ impl MsgVelNEDDepA { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelNEDDepA { @@ -3083,8 +3115,9 @@ pub struct MsgVelNEDGnss { } impl MsgVelNEDGnss { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgVelNEDGnss { + Ok( MsgVelNEDGnss{ sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, @@ -3094,7 +3127,7 @@ impl MsgVelNEDGnss { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgVelNEDGnss { diff --git a/rust/sbp/src/messages/ndb.rs b/rust/sbp/src/messages/ndb.rs index 64eea667d1..3cf5a73225 100644 --- a/rust/sbp/src/messages/ndb.rs +++ b/rust/sbp/src/messages/ndb.rs @@ -60,8 +60,9 @@ pub struct MsgNdbEvent { } impl MsgNdbEvent { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgNdbEvent { + Ok( MsgNdbEvent{ sender_id: None, recv_time: _buf.read_u64::()?, event: _buf.read_u8()?, @@ -71,7 +72,7 @@ impl MsgNdbEvent { object_sid: GnssSignal::parse(_buf)?, src_sid: GnssSignal::parse(_buf)?, original_sender: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgNdbEvent { diff --git a/rust/sbp/src/messages/observation.rs b/rust/sbp/src/messages/observation.rs index 570003e6dd..951794860d 100644 --- a/rust/sbp/src/messages/observation.rs +++ b/rust/sbp/src/messages/observation.rs @@ -52,15 +52,16 @@ pub struct AlmanacCommonContent { } impl AlmanacCommonContent { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(AlmanacCommonContent { + Ok( AlmanacCommonContent{ sid: GnssSignal::parse(_buf)?, toa: GPSTimeSec::parse(_buf)?, ura: _buf.read_f64::()?, fit_interval: _buf.read_u32::()?, valid: _buf.read_u8()?, health_bits: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -133,15 +134,16 @@ pub struct AlmanacCommonContentDep { } impl AlmanacCommonContentDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(AlmanacCommonContentDep { + Ok( AlmanacCommonContentDep{ sid: GnssSignalDep::parse(_buf)?, toa: GPSTimeSec::parse(_buf)?, ura: _buf.read_f64::()?, fit_interval: _buf.read_u32::()?, valid: _buf.read_u8()?, health_bits: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -205,11 +207,12 @@ pub struct CarrierPhaseDepA { } impl CarrierPhaseDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(CarrierPhaseDepA { + Ok( CarrierPhaseDepA{ i: _buf.read_i32::()?, f: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -264,11 +267,12 @@ pub struct Doppler { } impl Doppler { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(Doppler { + Ok( Doppler{ i: _buf.read_i16::()?, f: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -322,15 +326,16 @@ pub struct EphemerisCommonContent { } impl EphemerisCommonContent { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(EphemerisCommonContent { + Ok( EphemerisCommonContent{ sid: GnssSignal::parse(_buf)?, toe: GPSTimeSec::parse(_buf)?, ura: _buf.read_f32::()?, fit_interval: _buf.read_u32::()?, valid: _buf.read_u8()?, health_bits: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -395,15 +400,16 @@ pub struct EphemerisCommonContentDepA { } impl EphemerisCommonContentDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(EphemerisCommonContentDepA { + Ok( EphemerisCommonContentDepA{ sid: GnssSignalDep::parse(_buf)?, toe: GPSTimeDep::parse(_buf)?, ura: _buf.read_f64::()?, fit_interval: _buf.read_u32::()?, valid: _buf.read_u8()?, health_bits: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -468,15 +474,16 @@ pub struct EphemerisCommonContentDepB { } impl EphemerisCommonContentDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(EphemerisCommonContentDepB { + Ok( EphemerisCommonContentDepB{ sid: GnssSignal::parse(_buf)?, toe: GPSTimeSec::parse(_buf)?, ura: _buf.read_f64::()?, fit_interval: _buf.read_u32::()?, valid: _buf.read_u8()?, health_bits: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -560,8 +567,9 @@ pub struct GnssCapb { } impl GnssCapb { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GnssCapb { + Ok( GnssCapb{ gps_active: _buf.read_u64::()?, gps_l2c: _buf.read_u64::()?, gps_l5: _buf.read_u64::()?, @@ -577,7 +585,7 @@ impl GnssCapb { qzss_active: _buf.read_u32::()?, gal_active: _buf.read_u64::()?, gal_e5: _buf.read_u64::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -669,8 +677,9 @@ pub struct MsgAlmanacGlo { } impl MsgAlmanacGlo { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAlmanacGlo { + Ok( MsgAlmanacGlo{ sender_id: None, common: AlmanacCommonContent::parse(_buf)?, lambda_na: _buf.read_f64::()?, @@ -680,7 +689,7 @@ impl MsgAlmanacGlo { t_dot: _buf.read_f64::()?, epsilon: _buf.read_f64::()?, omega: _buf.read_f64::()?, - }) + } ) } } impl super::SBPMessage for MsgAlmanacGlo { @@ -761,8 +770,9 @@ pub struct MsgAlmanacGloDep { } impl MsgAlmanacGloDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAlmanacGloDep { + Ok( MsgAlmanacGloDep{ sender_id: None, common: AlmanacCommonContentDep::parse(_buf)?, lambda_na: _buf.read_f64::()?, @@ -772,7 +782,7 @@ impl MsgAlmanacGloDep { t_dot: _buf.read_f64::()?, epsilon: _buf.read_f64::()?, omega: _buf.read_f64::()?, - }) + } ) } } impl super::SBPMessage for MsgAlmanacGloDep { @@ -856,8 +866,9 @@ pub struct MsgAlmanacGPS { } impl MsgAlmanacGPS { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAlmanacGPS { + Ok( MsgAlmanacGPS{ sender_id: None, common: AlmanacCommonContent::parse(_buf)?, m0: _buf.read_f64::()?, @@ -869,7 +880,7 @@ impl MsgAlmanacGPS { inc: _buf.read_f64::()?, af0: _buf.read_f64::()?, af1: _buf.read_f64::()?, - }) + } ) } } impl super::SBPMessage for MsgAlmanacGPS { @@ -957,8 +968,9 @@ pub struct MsgAlmanacGPSDep { } impl MsgAlmanacGPSDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAlmanacGPSDep { + Ok( MsgAlmanacGPSDep{ sender_id: None, common: AlmanacCommonContentDep::parse(_buf)?, m0: _buf.read_f64::()?, @@ -970,7 +982,7 @@ impl MsgAlmanacGPSDep { inc: _buf.read_f64::()?, af0: _buf.read_f64::()?, af1: _buf.read_f64::()?, - }) + } ) } } impl super::SBPMessage for MsgAlmanacGPSDep { @@ -1046,13 +1058,14 @@ pub struct MsgBasePosECEF { } impl MsgBasePosECEF { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBasePosECEF { + Ok( MsgBasePosECEF{ sender_id: None, x: _buf.read_f64::()?, y: _buf.read_f64::()?, z: _buf.read_f64::()?, - }) + } ) } } impl super::SBPMessage for MsgBasePosECEF { @@ -1113,13 +1126,14 @@ pub struct MsgBasePosLLH { } impl MsgBasePosLLH { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBasePosLLH { + Ok( MsgBasePosLLH{ sender_id: None, lat: _buf.read_f64::()?, lon: _buf.read_f64::()?, height: _buf.read_f64::()?, - }) + } ) } } impl super::SBPMessage for MsgBasePosLLH { @@ -1225,8 +1239,9 @@ pub struct MsgEphemerisBds { } impl MsgEphemerisBds { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisBds { + Ok( MsgEphemerisBds{ sender_id: None, common: EphemerisCommonContent::parse(_buf)?, tgd1: _buf.read_f32::()?, @@ -1252,7 +1267,7 @@ impl MsgEphemerisBds { toc: GPSTimeSec::parse(_buf)?, iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisBds { @@ -1401,8 +1416,9 @@ pub struct MsgEphemerisDepA { } impl MsgEphemerisDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisDepA { + Ok( MsgEphemerisDepA{ sender_id: None, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, @@ -1430,7 +1446,7 @@ impl MsgEphemerisDepA { valid: _buf.read_u8()?, healthy: _buf.read_u8()?, prn: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisDepA { @@ -1585,8 +1601,9 @@ pub struct MsgEphemerisDepB { } impl MsgEphemerisDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisDepB { + Ok( MsgEphemerisDepB{ sender_id: None, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, @@ -1615,7 +1632,7 @@ impl MsgEphemerisDepB { healthy: _buf.read_u8()?, prn: _buf.read_u8()?, iode: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisDepB { @@ -1780,8 +1797,9 @@ pub struct MsgEphemerisDepC { } impl MsgEphemerisDepC { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisDepC { + Ok( MsgEphemerisDepC{ sender_id: None, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, @@ -1812,7 +1830,7 @@ impl MsgEphemerisDepC { iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, reserved: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisDepC { @@ -1981,8 +1999,9 @@ pub struct MsgEphemerisDepD { } impl MsgEphemerisDepD { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisDepD { + Ok( MsgEphemerisDepD{ sender_id: None, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, @@ -2013,7 +2032,7 @@ impl MsgEphemerisDepD { iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, reserved: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisDepD { @@ -2173,8 +2192,9 @@ pub struct MsgEphemerisGal { } impl MsgEphemerisGal { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGal { + Ok( MsgEphemerisGal{ sender_id: None, common: EphemerisCommonContent::parse(_buf)?, bgd_e1e5a: _buf.read_f32::()?, @@ -2201,7 +2221,7 @@ impl MsgEphemerisGal { iode: _buf.read_u16::()?, iodc: _buf.read_u16::()?, source: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGal { @@ -2349,8 +2369,9 @@ pub struct MsgEphemerisGalDepA { } impl MsgEphemerisGalDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGalDepA { + Ok( MsgEphemerisGalDepA{ sender_id: None, common: EphemerisCommonContent::parse(_buf)?, bgd_e1e5a: _buf.read_f32::()?, @@ -2376,7 +2397,7 @@ impl MsgEphemerisGalDepA { toc: GPSTimeSec::parse(_buf)?, iode: _buf.read_u16::()?, iodc: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGalDepA { @@ -2491,8 +2512,9 @@ pub struct MsgEphemerisGlo { } impl MsgEphemerisGlo { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGlo { + Ok( MsgEphemerisGlo{ sender_id: None, common: EphemerisCommonContent::parse(_buf)?, gamma: _buf.read_f32::()?, @@ -2503,7 +2525,7 @@ impl MsgEphemerisGlo { acc: crate::parser::read_float_array_limit(_buf, 3)?, fcn: _buf.read_u8()?, iod: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGlo { @@ -2582,8 +2604,9 @@ pub struct MsgEphemerisGloDepA { } impl MsgEphemerisGloDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGloDepA { + Ok( MsgEphemerisGloDepA{ sender_id: None, common: EphemerisCommonContentDepA::parse(_buf)?, gamma: _buf.read_f64::()?, @@ -2591,7 +2614,7 @@ impl MsgEphemerisGloDepA { pos: crate::parser::read_double_array_limit(_buf, 3)?, vel: crate::parser::read_double_array_limit(_buf, 3)?, acc: crate::parser::read_double_array_limit(_buf, 3)?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGloDepA { @@ -2664,8 +2687,9 @@ pub struct MsgEphemerisGloDepB { } impl MsgEphemerisGloDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGloDepB { + Ok( MsgEphemerisGloDepB{ sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, gamma: _buf.read_f64::()?, @@ -2673,7 +2697,7 @@ impl MsgEphemerisGloDepB { pos: crate::parser::read_double_array_limit(_buf, 3)?, vel: crate::parser::read_double_array_limit(_buf, 3)?, acc: crate::parser::read_double_array_limit(_buf, 3)?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGloDepB { @@ -2750,8 +2774,9 @@ pub struct MsgEphemerisGloDepC { } impl MsgEphemerisGloDepC { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGloDepC { + Ok( MsgEphemerisGloDepC{ sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, gamma: _buf.read_f64::()?, @@ -2761,7 +2786,7 @@ impl MsgEphemerisGloDepC { vel: crate::parser::read_double_array_limit(_buf, 3)?, acc: crate::parser::read_double_array_limit(_buf, 3)?, fcn: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGloDepC { @@ -2841,8 +2866,9 @@ pub struct MsgEphemerisGloDepD { } impl MsgEphemerisGloDepD { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGloDepD { + Ok( MsgEphemerisGloDepD{ sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, gamma: _buf.read_f64::()?, @@ -2853,7 +2879,7 @@ impl MsgEphemerisGloDepD { acc: crate::parser::read_double_array_limit(_buf, 3)?, fcn: _buf.read_u8()?, iod: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGloDepD { @@ -2970,8 +2996,9 @@ pub struct MsgEphemerisGPS { } impl MsgEphemerisGPS { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGPS { + Ok( MsgEphemerisGPS{ sender_id: None, common: EphemerisCommonContent::parse(_buf)?, tgd: _buf.read_f32::()?, @@ -2996,7 +3023,7 @@ impl MsgEphemerisGPS { toc: GPSTimeSec::parse(_buf)?, iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGPS { @@ -3141,8 +3168,9 @@ pub struct MsgEphemerisGPSDepE { } impl MsgEphemerisGPSDepE { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGPSDepE { + Ok( MsgEphemerisGPSDepE{ sender_id: None, common: EphemerisCommonContentDepA::parse(_buf)?, tgd: _buf.read_f64::()?, @@ -3167,7 +3195,7 @@ impl MsgEphemerisGPSDepE { toc: GPSTimeDep::parse(_buf)?, iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGPSDepE { @@ -3309,8 +3337,9 @@ pub struct MsgEphemerisGPSDepF { } impl MsgEphemerisGPSDepF { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisGPSDepF { + Ok( MsgEphemerisGPSDepF{ sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, tgd: _buf.read_f64::()?, @@ -3335,7 +3364,7 @@ impl MsgEphemerisGPSDepF { toc: GPSTimeSec::parse(_buf)?, iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisGPSDepF { @@ -3478,8 +3507,9 @@ pub struct MsgEphemerisQzss { } impl MsgEphemerisQzss { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisQzss { + Ok( MsgEphemerisQzss{ sender_id: None, common: EphemerisCommonContent::parse(_buf)?, tgd: _buf.read_f32::()?, @@ -3504,7 +3534,7 @@ impl MsgEphemerisQzss { toc: GPSTimeSec::parse(_buf)?, iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisQzss { @@ -3603,8 +3633,9 @@ pub struct MsgEphemerisSbas { } impl MsgEphemerisSbas { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisSbas { + Ok( MsgEphemerisSbas{ sender_id: None, common: EphemerisCommonContent::parse(_buf)?, pos: crate::parser::read_double_array_limit(_buf, 3)?, @@ -3612,7 +3643,7 @@ impl MsgEphemerisSbas { acc: crate::parser::read_float_array_limit(_buf, 3)?, a_gf0: _buf.read_f32::()?, a_gf1: _buf.read_f32::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisSbas { @@ -3677,8 +3708,9 @@ pub struct MsgEphemerisSbasDepA { } impl MsgEphemerisSbasDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisSbasDepA { + Ok( MsgEphemerisSbasDepA{ sender_id: None, common: EphemerisCommonContentDepA::parse(_buf)?, pos: crate::parser::read_double_array_limit(_buf, 3)?, @@ -3686,7 +3718,7 @@ impl MsgEphemerisSbasDepA { acc: crate::parser::read_double_array_limit(_buf, 3)?, a_gf0: _buf.read_f64::()?, a_gf1: _buf.read_f64::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisSbasDepA { @@ -3756,8 +3788,9 @@ pub struct MsgEphemerisSbasDepB { } impl MsgEphemerisSbasDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgEphemerisSbasDepB { + Ok( MsgEphemerisSbasDepB{ sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, pos: crate::parser::read_double_array_limit(_buf, 3)?, @@ -3765,7 +3798,7 @@ impl MsgEphemerisSbasDepB { acc: crate::parser::read_double_array_limit(_buf, 3)?, a_gf0: _buf.read_f64::()?, a_gf1: _buf.read_f64::()?, - }) + } ) } } impl super::SBPMessage for MsgEphemerisSbasDepB { @@ -3835,15 +3868,16 @@ pub struct MsgGloBiases { } impl MsgGloBiases { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgGloBiases { + Ok( MsgGloBiases{ sender_id: None, mask: _buf.read_u8()?, l1ca_bias: _buf.read_i16::()?, l1p_bias: _buf.read_i16::()?, l2ca_bias: _buf.read_i16::()?, l2p_bias: _buf.read_i16::()?, - }) + } ) } } impl super::SBPMessage for MsgGloBiases { @@ -3898,12 +3932,13 @@ pub struct MsgGnssCapb { } impl MsgGnssCapb { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgGnssCapb { + Ok( MsgGnssCapb{ sender_id: None, t_nmct: GPSTimeSec::parse(_buf)?, gc: GnssCapb::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgGnssCapb { @@ -3962,8 +3997,9 @@ pub struct MsgGroupDelay { } impl MsgGroupDelay { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgGroupDelay { + Ok( MsgGroupDelay{ sender_id: None, t_op: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, @@ -3971,7 +4007,7 @@ impl MsgGroupDelay { tgd: _buf.read_i16::()?, isc_l1ca: _buf.read_i16::()?, isc_l2c: _buf.read_i16::()?, - }) + } ) } } impl super::SBPMessage for MsgGroupDelay { @@ -4038,8 +4074,9 @@ pub struct MsgGroupDelayDepA { } impl MsgGroupDelayDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgGroupDelayDepA { + Ok( MsgGroupDelayDepA{ sender_id: None, t_op: GPSTimeDep::parse(_buf)?, prn: _buf.read_u8()?, @@ -4047,7 +4084,7 @@ impl MsgGroupDelayDepA { tgd: _buf.read_i16::()?, isc_l1ca: _buf.read_i16::()?, isc_l2c: _buf.read_i16::()?, - }) + } ) } } impl super::SBPMessage for MsgGroupDelayDepA { @@ -4114,8 +4151,9 @@ pub struct MsgGroupDelayDepB { } impl MsgGroupDelayDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgGroupDelayDepB { + Ok( MsgGroupDelayDepB{ sender_id: None, t_op: GPSTimeSec::parse(_buf)?, sid: GnssSignalDep::parse(_buf)?, @@ -4123,7 +4161,7 @@ impl MsgGroupDelayDepB { tgd: _buf.read_i16::()?, isc_l1ca: _buf.read_i16::()?, isc_l2c: _buf.read_i16::()?, - }) + } ) } } impl super::SBPMessage for MsgGroupDelayDepB { @@ -4192,8 +4230,9 @@ pub struct MsgIono { } impl MsgIono { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgIono { + Ok( MsgIono{ sender_id: None, t_nmct: GPSTimeSec::parse(_buf)?, a0: _buf.read_f64::()?, @@ -4204,7 +4243,7 @@ impl MsgIono { b1: _buf.read_f64::()?, b2: _buf.read_f64::()?, b3: _buf.read_f64::()?, - }) + } ) } } impl super::SBPMessage for MsgIono { @@ -4277,12 +4316,13 @@ pub struct MsgObs { } impl MsgObs { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgObs { + Ok( MsgObs{ sender_id: None, header: ObservationHeader::parse(_buf)?, obs: PackedObsContent::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgObs { @@ -4335,12 +4375,13 @@ pub struct MsgObsDepA { } impl MsgObsDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgObsDepA { + Ok( MsgObsDepA{ sender_id: None, header: ObservationHeaderDep::parse(_buf)?, obs: PackedObsContentDepA::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgObsDepA { @@ -4398,12 +4439,13 @@ pub struct MsgObsDepB { } impl MsgObsDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgObsDepB { + Ok( MsgObsDepB{ sender_id: None, header: ObservationHeaderDep::parse(_buf)?, obs: PackedObsContentDepB::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgObsDepB { @@ -4462,12 +4504,13 @@ pub struct MsgObsDepC { } impl MsgObsDepC { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgObsDepC { + Ok( MsgObsDepC{ sender_id: None, header: ObservationHeaderDep::parse(_buf)?, obs: PackedObsContentDepC::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgObsDepC { @@ -4520,12 +4563,13 @@ pub struct MsgOsr { } impl MsgOsr { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgOsr { + Ok( MsgOsr{ sender_id: None, header: ObservationHeader::parse(_buf)?, obs: PackedOsrContent::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgOsr { @@ -4577,11 +4621,12 @@ pub struct MsgSvAzEl { } impl MsgSvAzEl { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSvAzEl { + Ok( MsgSvAzEl{ sender_id: None, azel: SvAzEl::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSvAzEl { @@ -4632,12 +4677,13 @@ pub struct MsgSvConfigurationGPSDep { } impl MsgSvConfigurationGPSDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSvConfigurationGPSDep { + Ok( MsgSvConfigurationGPSDep{ sender_id: None, t_nmct: GPSTimeSec::parse(_buf)?, l2c_mask: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgSvConfigurationGPSDep { @@ -4690,11 +4736,12 @@ pub struct ObservationHeader { } impl ObservationHeader { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(ObservationHeader { + Ok( ObservationHeader{ t: GPSTime::parse(_buf)?, n_obs: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -4747,11 +4794,12 @@ pub struct ObservationHeaderDep { } impl ObservationHeaderDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(ObservationHeaderDep { + Ok( ObservationHeaderDep{ t: GPSTimeDep::parse(_buf)?, n_obs: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -4826,8 +4874,9 @@ pub struct PackedObsContent { } impl PackedObsContent { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(PackedObsContent { + Ok( PackedObsContent{ P: _buf.read_u32::()?, L: CarrierPhase::parse(_buf)?, D: Doppler::parse(_buf)?, @@ -4835,7 +4884,7 @@ impl PackedObsContent { lock: _buf.read_u8()?, flags: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -4905,14 +4954,15 @@ pub struct PackedObsContentDepA { } impl PackedObsContentDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(PackedObsContentDepA { + Ok( PackedObsContentDepA{ P: _buf.read_u32::()?, L: CarrierPhaseDepA::parse(_buf)?, cn0: _buf.read_u8()?, lock: _buf.read_u16::()?, prn: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -4979,14 +5029,15 @@ pub struct PackedObsContentDepB { } impl PackedObsContentDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(PackedObsContentDepB { + Ok( PackedObsContentDepB{ P: _buf.read_u32::()?, L: CarrierPhaseDepA::parse(_buf)?, cn0: _buf.read_u8()?, lock: _buf.read_u16::()?, sid: GnssSignalDep::parse(_buf)?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -5054,14 +5105,15 @@ pub struct PackedObsContentDepC { } impl PackedObsContentDepC { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(PackedObsContentDepC { + Ok( PackedObsContentDepC{ P: _buf.read_u32::()?, L: CarrierPhase::parse(_buf)?, cn0: _buf.read_u8()?, lock: _buf.read_u16::()?, sid: GnssSignalDep::parse(_buf)?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -5136,8 +5188,9 @@ pub struct PackedOsrContent { } impl PackedOsrContent { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(PackedOsrContent { + Ok( PackedOsrContent{ P: _buf.read_u32::()?, L: CarrierPhase::parse(_buf)?, lock: _buf.read_u8()?, @@ -5146,7 +5199,7 @@ impl PackedOsrContent { iono_std: _buf.read_u16::()?, tropo_std: _buf.read_u16::()?, range_std: _buf.read_u16::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -5212,12 +5265,13 @@ pub struct SvAzEl { } impl SvAzEl { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(SvAzEl { + Ok( SvAzEl{ sid: GnssSignal::parse(_buf)?, az: _buf.read_u8()?, el: _buf.read_i8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); diff --git a/rust/sbp/src/messages/orientation.rs b/rust/sbp/src/messages/orientation.rs index aa74c6dd3a..6faf248090 100644 --- a/rust/sbp/src/messages/orientation.rs +++ b/rust/sbp/src/messages/orientation.rs @@ -53,15 +53,16 @@ pub struct MsgAngularRate { } impl MsgAngularRate { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAngularRate { + Ok( MsgAngularRate{ sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, z: _buf.read_i32::()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgAngularRate { @@ -127,14 +128,15 @@ pub struct MsgBaselineHeading { } impl MsgBaselineHeading { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBaselineHeading { + Ok( MsgBaselineHeading{ sender_id: None, tow: _buf.read_u32::()?, heading: _buf.read_u32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgBaselineHeading { @@ -207,8 +209,9 @@ pub struct MsgOrientEuler { } impl MsgOrientEuler { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgOrientEuler { + Ok( MsgOrientEuler{ sender_id: None, tow: _buf.read_u32::()?, roll: _buf.read_i32::()?, @@ -218,7 +221,7 @@ impl MsgOrientEuler { pitch_accuracy: _buf.read_f32::()?, yaw_accuracy: _buf.read_f32::()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgOrientEuler { @@ -303,8 +306,9 @@ pub struct MsgOrientQuat { } impl MsgOrientQuat { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgOrientQuat { + Ok( MsgOrientQuat{ sender_id: None, tow: _buf.read_u32::()?, w: _buf.read_i32::()?, @@ -316,7 +320,7 @@ impl MsgOrientQuat { y_accuracy: _buf.read_f32::()?, z_accuracy: _buf.read_f32::()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgOrientQuat { diff --git a/rust/sbp/src/messages/piksi.rs b/rust/sbp/src/messages/piksi.rs index 23e1456c8f..ab9b3e1a84 100644 --- a/rust/sbp/src/messages/piksi.rs +++ b/rust/sbp/src/messages/piksi.rs @@ -50,13 +50,14 @@ pub struct Latency { } impl Latency { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(Latency { + Ok( Latency{ avg: _buf.read_i32::()?, lmin: _buf.read_i32::()?, lmax: _buf.read_i32::()?, current: _buf.read_i32::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -107,8 +108,11 @@ pub struct MsgAlmanac { } impl MsgAlmanac { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAlmanac { sender_id: None }) + Ok( MsgAlmanac{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgAlmanac { @@ -159,13 +163,14 @@ pub struct MsgCellModemStatus { } impl MsgCellModemStatus { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCellModemStatus { + Ok( MsgCellModemStatus{ sender_id: None, signal_strength: _buf.read_i8()?, signal_error_rate: _buf.read_f32::()?, reserved: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgCellModemStatus { @@ -223,12 +228,13 @@ pub struct MsgCommandOutput { } impl MsgCommandOutput { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCommandOutput { + Ok( MsgCommandOutput{ sender_id: None, sequence: _buf.read_u32::()?, line: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgCommandOutput { @@ -283,12 +289,13 @@ pub struct MsgCommandReq { } impl MsgCommandReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCommandReq { + Ok( MsgCommandReq{ sender_id: None, sequence: _buf.read_u32::()?, command: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgCommandReq { @@ -342,12 +349,13 @@ pub struct MsgCommandResp { } impl MsgCommandResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCommandResp { + Ok( MsgCommandResp{ sender_id: None, sequence: _buf.read_u32::()?, code: _buf.read_i32::()?, - }) + } ) } } impl super::SBPMessage for MsgCommandResp { @@ -398,8 +406,11 @@ pub struct MsgCwResults { } impl MsgCwResults { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCwResults { sender_id: None }) + Ok( MsgCwResults{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgCwResults { @@ -444,8 +455,11 @@ pub struct MsgCwStart { } impl MsgCwStart { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCwStart { sender_id: None }) + Ok( MsgCwStart{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgCwStart { @@ -500,15 +514,16 @@ pub struct MsgDeviceMonitor { } impl MsgDeviceMonitor { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgDeviceMonitor { + Ok( MsgDeviceMonitor{ sender_id: None, dev_vin: _buf.read_i16::()?, cpu_vint: _buf.read_i16::()?, cpu_vaux: _buf.read_i16::()?, cpu_temperature: _buf.read_i16::()?, fe_temperature: _buf.read_i16::()?, - }) + } ) } } impl super::SBPMessage for MsgDeviceMonitor { @@ -572,12 +587,13 @@ pub struct MsgFrontEndGain { } impl MsgFrontEndGain { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgFrontEndGain { + Ok( MsgFrontEndGain{ sender_id: None, rf_gain: crate::parser::read_s8_array_limit(_buf, 8)?, if_gain: crate::parser::read_s8_array_limit(_buf, 8)?, - }) + } ) } } impl super::SBPMessage for MsgFrontEndGain { @@ -631,11 +647,12 @@ pub struct MsgIarState { } impl MsgIarState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgIarState { + Ok( MsgIarState{ sender_id: None, num_hyps: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgIarState { @@ -682,8 +699,11 @@ pub struct MsgInitBaseDep { } impl MsgInitBaseDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgInitBaseDep { sender_id: None }) + Ok( MsgInitBaseDep{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgInitBaseDep { @@ -731,12 +751,13 @@ pub struct MsgMaskSatellite { } impl MsgMaskSatellite { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgMaskSatellite { + Ok( MsgMaskSatellite{ sender_id: None, mask: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgMaskSatellite { @@ -789,12 +810,13 @@ pub struct MsgMaskSatelliteDep { } impl MsgMaskSatelliteDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgMaskSatelliteDep { + Ok( MsgMaskSatelliteDep{ sender_id: None, mask: _buf.read_u8()?, sid: GnssSignalDep::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgMaskSatelliteDep { @@ -845,11 +867,12 @@ pub struct MsgNetworkBandwidthUsage { } impl MsgNetworkBandwidthUsage { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgNetworkBandwidthUsage { + Ok( MsgNetworkBandwidthUsage{ sender_id: None, interfaces: NetworkUsage::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgNetworkBandwidthUsage { @@ -897,8 +920,11 @@ pub struct MsgNetworkStateReq { } impl MsgNetworkStateReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgNetworkStateReq { sender_id: None }) + Ok( MsgNetworkStateReq{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgNetworkStateReq { @@ -959,8 +985,9 @@ pub struct MsgNetworkStateResp { } impl MsgNetworkStateResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgNetworkStateResp { + Ok( MsgNetworkStateResp{ sender_id: None, ipv4_address: crate::parser::read_u8_array_limit(_buf, 4)?, ipv4_mask_size: _buf.read_u8()?, @@ -970,7 +997,7 @@ impl MsgNetworkStateResp { tx_bytes: _buf.read_u32::()?, interface_name: crate::parser::read_string_limit(_buf, 16)?, flags: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgNetworkStateResp { @@ -1034,11 +1061,12 @@ pub struct MsgReset { } impl MsgReset { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgReset { + Ok( MsgReset{ sender_id: None, flags: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgReset { @@ -1086,8 +1114,11 @@ pub struct MsgResetDep { } impl MsgResetDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgResetDep { sender_id: None }) + Ok( MsgResetDep{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgResetDep { @@ -1133,11 +1164,12 @@ pub struct MsgResetFilters { } impl MsgResetFilters { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgResetFilters { + Ok( MsgResetFilters{ sender_id: None, filter: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgResetFilters { @@ -1185,8 +1217,11 @@ pub struct MsgSetTime { } impl MsgSetTime { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSetTime { sender_id: None }) + Ok( MsgSetTime{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgSetTime { @@ -1243,8 +1278,9 @@ pub struct MsgSpecan { } impl MsgSpecan { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSpecan { + Ok( MsgSpecan{ sender_id: None, channel_tag: _buf.read_u16::()?, t: GPSTime::parse(_buf)?, @@ -1253,7 +1289,7 @@ impl MsgSpecan { amplitude_ref: _buf.read_f32::()?, amplitude_unit: _buf.read_f32::()?, amplitude_value: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSpecan { @@ -1326,8 +1362,9 @@ pub struct MsgSpecanDep { } impl MsgSpecanDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSpecanDep { + Ok( MsgSpecanDep{ sender_id: None, channel_tag: _buf.read_u16::()?, t: GPSTimeDep::parse(_buf)?, @@ -1336,7 +1373,7 @@ impl MsgSpecanDep { amplitude_ref: _buf.read_f32::()?, amplitude_unit: _buf.read_f32::()?, amplitude_value: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSpecanDep { @@ -1404,13 +1441,14 @@ pub struct MsgThreadState { } impl MsgThreadState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgThreadState { + Ok( MsgThreadState{ sender_id: None, name: crate::parser::read_string_limit(_buf, 20)?, cpu: _buf.read_u16::()?, stack_free: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgThreadState { @@ -1479,15 +1517,16 @@ pub struct MsgUartState { } impl MsgUartState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgUartState { + Ok( MsgUartState{ sender_id: None, uart_a: UARTChannel::parse(_buf)?, uart_b: UARTChannel::parse(_buf)?, uart_ftdi: UARTChannel::parse(_buf)?, latency: Latency::parse(_buf)?, obs_period: Period::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgUartState { @@ -1550,14 +1589,15 @@ pub struct MsgUartStateDepa { } impl MsgUartStateDepa { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgUartStateDepa { + Ok( MsgUartStateDepa{ sender_id: None, uart_a: UARTChannel::parse(_buf)?, uart_b: UARTChannel::parse(_buf)?, uart_ftdi: UARTChannel::parse(_buf)?, latency: Latency::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgUartStateDepa { @@ -1624,14 +1664,15 @@ pub struct NetworkUsage { } impl NetworkUsage { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(NetworkUsage { + Ok( NetworkUsage{ duration: _buf.read_u64::()?, total_bytes: _buf.read_u64::()?, rx_bytes: _buf.read_u32::()?, tx_bytes: _buf.read_u32::()?, interface_name: crate::parser::read_string_limit(_buf, 16)?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1695,13 +1736,14 @@ pub struct Period { } impl Period { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(Period { + Ok( Period{ avg: _buf.read_i32::()?, pmin: _buf.read_i32::()?, pmax: _buf.read_i32::()?, current: _buf.read_i32::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1764,15 +1806,16 @@ pub struct UARTChannel { } impl UARTChannel { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(UARTChannel { + Ok( UARTChannel{ tx_throughput: _buf.read_f32::()?, rx_throughput: _buf.read_f32::()?, crc_error_count: _buf.read_u16::()?, io_error_count: _buf.read_u16::()?, tx_buffer_level: _buf.read_u8()?, rx_buffer_level: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); diff --git a/rust/sbp/src/messages/sbas.rs b/rust/sbp/src/messages/sbas.rs index 4b5ca582cc..15291a1ef7 100644 --- a/rust/sbp/src/messages/sbas.rs +++ b/rust/sbp/src/messages/sbas.rs @@ -45,14 +45,15 @@ pub struct MsgSbasRaw { } impl MsgSbasRaw { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSbasRaw { + Ok( MsgSbasRaw{ sender_id: None, sid: GnssSignal::parse(_buf)?, tow: _buf.read_u32::()?, message_type: _buf.read_u8()?, data: crate::parser::read_u8_array_limit(_buf, 27)?, - }) + } ) } } impl super::SBPMessage for MsgSbasRaw { diff --git a/rust/sbp/src/messages/settings.rs b/rust/sbp/src/messages/settings.rs index 15633f654b..641090c52b 100644 --- a/rust/sbp/src/messages/settings.rs +++ b/rust/sbp/src/messages/settings.rs @@ -61,8 +61,11 @@ pub struct MsgSettingsReadByIndexDone { } impl MsgSettingsReadByIndexDone { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsReadByIndexDone { sender_id: None }) + Ok( MsgSettingsReadByIndexDone{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgSettingsReadByIndexDone { @@ -110,11 +113,12 @@ pub struct MsgSettingsReadByIndexReq { } impl MsgSettingsReadByIndexReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsReadByIndexReq { + Ok( MsgSettingsReadByIndexReq{ sender_id: None, index: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgSettingsReadByIndexReq { @@ -176,12 +180,13 @@ pub struct MsgSettingsReadByIndexResp { } impl MsgSettingsReadByIndexResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsReadByIndexResp { + Ok( MsgSettingsReadByIndexResp{ sender_id: None, index: _buf.read_u16::()?, setting: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSettingsReadByIndexResp { @@ -240,11 +245,12 @@ pub struct MsgSettingsReadReq { } impl MsgSettingsReadReq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsReadReq { + Ok( MsgSettingsReadReq{ sender_id: None, setting: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSettingsReadReq { @@ -300,11 +306,12 @@ pub struct MsgSettingsReadResp { } impl MsgSettingsReadResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsReadResp { + Ok( MsgSettingsReadResp{ sender_id: None, setting: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSettingsReadResp { @@ -356,11 +363,12 @@ pub struct MsgSettingsRegister { } impl MsgSettingsRegister { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsRegister { + Ok( MsgSettingsRegister{ sender_id: None, setting: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSettingsRegister { @@ -416,12 +424,13 @@ pub struct MsgSettingsRegisterResp { } impl MsgSettingsRegisterResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsRegisterResp { + Ok( MsgSettingsRegisterResp{ sender_id: None, status: _buf.read_u8()?, setting: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSettingsRegisterResp { @@ -471,8 +480,11 @@ pub struct MsgSettingsSave { } impl MsgSettingsSave { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsSave { sender_id: None }) + Ok( MsgSettingsSave{ + sender_id: None, + } ) } } impl super::SBPMessage for MsgSettingsSave { @@ -524,11 +536,12 @@ pub struct MsgSettingsWrite { } impl MsgSettingsWrite { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsWrite { + Ok( MsgSettingsWrite{ sender_id: None, setting: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSettingsWrite { @@ -586,12 +599,13 @@ pub struct MsgSettingsWriteResp { } impl MsgSettingsWriteResp { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsWriteResp { + Ok( MsgSettingsWriteResp{ sender_id: None, status: _buf.read_u8()?, setting: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSettingsWriteResp { diff --git a/rust/sbp/src/messages/ssr.rs b/rust/sbp/src/messages/ssr.rs index f7f3689661..60ef35fefa 100644 --- a/rust/sbp/src/messages/ssr.rs +++ b/rust/sbp/src/messages/ssr.rs @@ -40,11 +40,12 @@ pub struct CodeBiasesContent { } impl CodeBiasesContent { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(CodeBiasesContent { + Ok( CodeBiasesContent{ code: _buf.read_u8()?, value: _buf.read_i16::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -107,15 +108,16 @@ pub struct GridDefinitionHeader { } impl GridDefinitionHeader { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GridDefinitionHeader { + Ok( GridDefinitionHeader{ region_size_inverse: _buf.read_u8()?, area_width: _buf.read_u16::()?, lat_nw_corner_enc: _buf.read_u16::()?, lon_nw_corner_enc: _buf.read_u16::()?, num_msgs: _buf.read_u8()?, seq_num: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -178,12 +180,13 @@ pub struct GridElement { } impl GridElement { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GridElement { + Ok( GridElement{ index: _buf.read_u16::()?, tropo_delay_correction: TroposphericDelayCorrection::parse(_buf)?, stec_residuals: STECResidual::parse_array(_buf)?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -237,12 +240,13 @@ pub struct GridElementNoStd { } impl GridElementNoStd { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GridElementNoStd { + Ok( GridElementNoStd{ index: _buf.read_u16::()?, tropo_delay_correction: TroposphericDelayCorrectionNoStd::parse(_buf)?, stec_residuals: STECResidualNoStd::parse_array(_buf)?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -308,15 +312,16 @@ pub struct GriddedCorrectionHeader { } impl GriddedCorrectionHeader { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(GriddedCorrectionHeader { + Ok( GriddedCorrectionHeader{ time: GPSTimeSec::parse(_buf)?, num_msgs: _buf.read_u16::()?, seq_num: _buf.read_u16::()?, update_interval: _buf.read_u8()?, iod_atmo: _buf.read_u8()?, tropo_quality_indicator: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -388,15 +393,16 @@ pub struct MsgSsrCodeBiases { } impl MsgSsrCodeBiases { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSsrCodeBiases { + Ok( MsgSsrCodeBiases{ sender_id: None, time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, update_interval: _buf.read_u8()?, iod_ssr: _buf.read_u8()?, biases: CodeBiasesContent::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSsrCodeBiases { @@ -457,12 +463,13 @@ pub struct MsgSsrGriddedCorrection { } impl MsgSsrGriddedCorrection { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSsrGriddedCorrection { + Ok( MsgSsrGriddedCorrection{ sender_id: None, header: GriddedCorrectionHeader::parse(_buf)?, element: GridElement::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSsrGriddedCorrection { @@ -516,12 +523,13 @@ pub struct MsgSsrGriddedCorrectionNoStd { } impl MsgSsrGriddedCorrectionNoStd { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSsrGriddedCorrectionNoStd { + Ok( MsgSsrGriddedCorrectionNoStd{ sender_id: None, header: GriddedCorrectionHeader::parse(_buf)?, element: GridElementNoStd::parse(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSsrGriddedCorrectionNoStd { @@ -578,12 +586,13 @@ pub struct MsgSsrGridDefinition { } impl MsgSsrGridDefinition { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSsrGridDefinition { + Ok( MsgSsrGridDefinition{ sender_id: None, header: GridDefinitionHeader::parse(_buf)?, rle_list: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSsrGridDefinition { @@ -665,8 +674,9 @@ pub struct MsgSsrOrbitClock { } impl MsgSsrOrbitClock { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSsrOrbitClock { + Ok( MsgSsrOrbitClock{ sender_id: None, time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, @@ -682,7 +692,7 @@ impl MsgSsrOrbitClock { c0: _buf.read_i32::()?, c1: _buf.read_i32::()?, c2: _buf.read_i32::()?, - }) + } ) } } impl super::SBPMessage for MsgSsrOrbitClock { @@ -788,8 +798,9 @@ pub struct MsgSsrOrbitClockDepA { } impl MsgSsrOrbitClockDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSsrOrbitClockDepA { + Ok( MsgSsrOrbitClockDepA{ sender_id: None, time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, @@ -805,7 +816,7 @@ impl MsgSsrOrbitClockDepA { c0: _buf.read_i32::()?, c1: _buf.read_i32::()?, c2: _buf.read_i32::()?, - }) + } ) } } impl super::SBPMessage for MsgSsrOrbitClockDepA { @@ -903,8 +914,9 @@ pub struct MsgSsrPhaseBiases { } impl MsgSsrPhaseBiases { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSsrPhaseBiases { + Ok( MsgSsrPhaseBiases{ sender_id: None, time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, @@ -915,7 +927,7 @@ impl MsgSsrPhaseBiases { yaw: _buf.read_u16::()?, yaw_rate: _buf.read_i8()?, biases: PhaseBiasesContent::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSsrPhaseBiases { @@ -985,12 +997,13 @@ pub struct MsgSsrStecCorrection { } impl MsgSsrStecCorrection { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSsrStecCorrection { + Ok( MsgSsrStecCorrection{ sender_id: None, header: STECHeader::parse(_buf)?, stec_sat_list: STECSatElement::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgSsrStecCorrection { @@ -1050,14 +1063,15 @@ pub struct PhaseBiasesContent { } impl PhaseBiasesContent { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(PhaseBiasesContent { + Ok( PhaseBiasesContent{ code: _buf.read_u8()?, integer_indicator: _buf.read_u8()?, widelane_integer_indicator: _buf.read_u8()?, discontinuity_counter: _buf.read_u8()?, bias: _buf.read_i32::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1124,14 +1138,15 @@ pub struct STECHeader { } impl STECHeader { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(STECHeader { + Ok( STECHeader{ time: GPSTimeSec::parse(_buf)?, num_msgs: _buf.read_u8()?, seq_num: _buf.read_u8()?, update_interval: _buf.read_u8()?, iod_atmo: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1189,12 +1204,13 @@ pub struct STECResidual { } impl STECResidual { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(STECResidual { + Ok( STECResidual{ sv_id: SvId::parse(_buf)?, residual: _buf.read_i16::()?, stddev: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1245,11 +1261,12 @@ pub struct STECResidualNoStd { } impl STECResidualNoStd { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(STECResidualNoStd { + Ok( STECResidualNoStd{ sv_id: SvId::parse(_buf)?, residual: _buf.read_i16::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1304,12 +1321,13 @@ pub struct STECSatElement { } impl STECSatElement { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(STECSatElement { + Ok( STECSatElement{ sv_id: SvId::parse(_buf)?, stec_quality_indicator: _buf.read_u8()?, stec_coeff: crate::parser::read_s16_array_limit(_buf, 4)?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1366,12 +1384,13 @@ pub struct TroposphericDelayCorrection { } impl TroposphericDelayCorrection { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(TroposphericDelayCorrection { + Ok( TroposphericDelayCorrection{ hydro: _buf.read_i16::()?, wet: _buf.read_i8()?, stddev: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1425,11 +1444,12 @@ pub struct TroposphericDelayCorrectionNoStd { } impl TroposphericDelayCorrectionNoStd { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(TroposphericDelayCorrectionNoStd { + Ok( TroposphericDelayCorrectionNoStd{ hydro: _buf.read_i16::()?, wet: _buf.read_i8()?, - }) + } ) } pub fn parse_array( buf: &mut &[u8], diff --git a/rust/sbp/src/messages/system.rs b/rust/sbp/src/messages/system.rs index 9acb60e387..fcbd96a867 100644 --- a/rust/sbp/src/messages/system.rs +++ b/rust/sbp/src/messages/system.rs @@ -42,12 +42,13 @@ pub struct MsgCsacTelemetry { } impl MsgCsacTelemetry { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCsacTelemetry { + Ok( MsgCsacTelemetry{ sender_id: None, id: _buf.read_u8()?, telemetry: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgCsacTelemetry { @@ -103,12 +104,13 @@ pub struct MsgCsacTelemetryLabels { } impl MsgCsacTelemetryLabels { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCsacTelemetryLabels { + Ok( MsgCsacTelemetryLabels{ sender_id: None, id: _buf.read_u8()?, telemetry_labels: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgCsacTelemetryLabels { @@ -167,14 +169,15 @@ pub struct MsgDgnssStatus { } impl MsgDgnssStatus { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgDgnssStatus { + Ok( MsgDgnssStatus{ sender_id: None, flags: _buf.read_u8()?, latency: _buf.read_u16::()?, num_signals: _buf.read_u8()?, source: crate::parser::read_string(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgDgnssStatus { @@ -238,11 +241,12 @@ pub struct MsgHeartbeat { } impl MsgHeartbeat { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgHeartbeat { + Ok( MsgHeartbeat{ sender_id: None, flags: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgHeartbeat { @@ -292,11 +296,12 @@ pub struct MsgInsStatus { } impl MsgInsStatus { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgInsStatus { + Ok( MsgInsStatus{ sender_id: None, flags: _buf.read_u32::()?, - }) + } ) } } impl super::SBPMessage for MsgInsStatus { @@ -352,13 +357,14 @@ pub struct MsgStartup { } impl MsgStartup { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgStartup { + Ok( MsgStartup{ sender_id: None, cause: _buf.read_u8()?, startup_type: _buf.read_u8()?, reserved: _buf.read_u16::()?, - }) + } ) } } impl super::SBPMessage for MsgStartup { diff --git a/rust/sbp/src/messages/tracking.rs b/rust/sbp/src/messages/tracking.rs index 09210bad7a..7444040ec0 100644 --- a/rust/sbp/src/messages/tracking.rs +++ b/rust/sbp/src/messages/tracking.rs @@ -41,11 +41,12 @@ pub struct MsgMeasurementState { } impl MsgMeasurementState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgMeasurementState { + Ok( MsgMeasurementState{ sender_id: None, states: MeasurementState::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgMeasurementState { @@ -99,13 +100,14 @@ pub struct MsgTrackingIq { } impl MsgTrackingIq { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgTrackingIq { + Ok( MsgTrackingIq{ sender_id: None, channel: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, corrs: TrackingChannelCorrelation::parse_array_limit(_buf, 3)?, - }) + } ) } } impl super::SBPMessage for MsgTrackingIq { @@ -162,13 +164,14 @@ pub struct MsgTrackingIqDepA { } impl MsgTrackingIqDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgTrackingIqDepA { + Ok( MsgTrackingIqDepA{ sender_id: None, channel: _buf.read_u8()?, sid: GnssSignalDep::parse(_buf)?, corrs: TrackingChannelCorrelationDep::parse_array_limit(_buf, 3)?, - }) + } ) } } impl super::SBPMessage for MsgTrackingIqDepA { @@ -226,13 +229,14 @@ pub struct MsgTrackingIqDepB { } impl MsgTrackingIqDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgTrackingIqDepB { + Ok( MsgTrackingIqDepB{ sender_id: None, channel: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, corrs: TrackingChannelCorrelationDep::parse_array_limit(_buf, 3)?, - }) + } ) } } impl super::SBPMessage for MsgTrackingIqDepB { @@ -287,11 +291,12 @@ pub struct MsgTrackingState { } impl MsgTrackingState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgTrackingState { + Ok( MsgTrackingState{ sender_id: None, states: TrackingChannelState::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgTrackingState { @@ -340,11 +345,12 @@ pub struct MsgTrackingStateDepA { } impl MsgTrackingStateDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgTrackingStateDepA { + Ok( MsgTrackingStateDepA{ sender_id: None, states: TrackingChannelStateDepA::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgTrackingStateDepA { @@ -393,11 +399,12 @@ pub struct MsgTrackingStateDepB { } impl MsgTrackingStateDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgTrackingStateDepB { + Ok( MsgTrackingStateDepB{ sender_id: None, states: TrackingChannelStateDepB::parse_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgTrackingStateDepB { @@ -492,8 +499,9 @@ pub struct MsgTrackingStateDetailedDep { } impl MsgTrackingStateDetailedDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgTrackingStateDetailedDep { + Ok( MsgTrackingStateDetailedDep{ sender_id: None, recv_time: _buf.read_u64::()?, tot: GPSTimeDep::parse(_buf)?, @@ -516,7 +524,7 @@ impl MsgTrackingStateDetailedDep { nav_flags: _buf.read_u8()?, pset_flags: _buf.read_u8()?, misc_flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgTrackingStateDetailedDep { @@ -652,8 +660,9 @@ pub struct MsgTrackingStateDetailedDepA { } impl MsgTrackingStateDetailedDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgTrackingStateDetailedDepA { + Ok( MsgTrackingStateDetailedDepA{ sender_id: None, recv_time: _buf.read_u64::()?, tot: GPSTime::parse(_buf)?, @@ -676,7 +685,7 @@ impl MsgTrackingStateDetailedDepA { nav_flags: _buf.read_u8()?, pset_flags: _buf.read_u8()?, misc_flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgTrackingStateDetailedDepA { @@ -771,11 +780,12 @@ pub struct MeasurementState { } impl MeasurementState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MeasurementState { + Ok( MeasurementState{ mesid: GnssSignal::parse(_buf)?, cn0: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -827,11 +837,12 @@ pub struct TrackingChannelCorrelation { } impl TrackingChannelCorrelation { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(TrackingChannelCorrelation { + Ok( TrackingChannelCorrelation{ I: _buf.read_i16::()?, Q: _buf.read_i16::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -883,11 +894,12 @@ pub struct TrackingChannelCorrelationDep { } impl TrackingChannelCorrelationDep { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(TrackingChannelCorrelationDep { + Ok( TrackingChannelCorrelationDep{ I: _buf.read_i32::()?, Q: _buf.read_i32::()?, - }) + } ) } pub fn parse_array( buf: &mut &[u8], @@ -944,12 +956,13 @@ pub struct TrackingChannelState { } impl TrackingChannelState { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(TrackingChannelState { + Ok( TrackingChannelState{ sid: GnssSignal::parse(_buf)?, fcn: _buf.read_u8()?, cn0: _buf.read_u8()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1005,12 +1018,13 @@ pub struct TrackingChannelStateDepA { } impl TrackingChannelStateDepA { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(TrackingChannelStateDepA { + Ok( TrackingChannelStateDepA{ state: _buf.read_u8()?, prn: _buf.read_u8()?, cn0: _buf.read_f32::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); @@ -1066,12 +1080,13 @@ pub struct TrackingChannelStateDepB { } impl TrackingChannelStateDepB { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(TrackingChannelStateDepB { + Ok( TrackingChannelStateDepB{ state: _buf.read_u8()?, sid: GnssSignalDep::parse(_buf)?, cn0: _buf.read_f32::()?, - }) + } ) } pub fn parse_array(buf: &mut &[u8]) -> Result, crate::Error> { let mut v = Vec::new(); diff --git a/rust/sbp/src/messages/user.rs b/rust/sbp/src/messages/user.rs index eb7455c67e..4c8cbfb65e 100644 --- a/rust/sbp/src/messages/user.rs +++ b/rust/sbp/src/messages/user.rs @@ -39,11 +39,12 @@ pub struct MsgUserData { } impl MsgUserData { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgUserData { + Ok( MsgUserData{ sender_id: None, contents: crate::parser::read_u8_array(_buf)?, - }) + } ) } } impl super::SBPMessage for MsgUserData { diff --git a/rust/sbp/src/messages/vehicle.rs b/rust/sbp/src/messages/vehicle.rs index 39859b3782..019170a85e 100644 --- a/rust/sbp/src/messages/vehicle.rs +++ b/rust/sbp/src/messages/vehicle.rs @@ -47,13 +47,14 @@ pub struct MsgOdometry { } impl MsgOdometry { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgOdometry { + Ok( MsgOdometry{ sender_id: None, tow: _buf.read_u32::()?, velocity: _buf.read_i32::()?, flags: _buf.read_u8()?, - }) + } ) } } impl super::SBPMessage for MsgOdometry { @@ -123,14 +124,15 @@ pub struct MsgWheeltick { } impl MsgWheeltick { + #[rustfmt::skip] pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgWheeltick { + Ok( MsgWheeltick{ sender_id: None, time: _buf.read_u64::()?, flags: _buf.read_u8()?, source: _buf.read_u8()?, ticks: _buf.read_i32::()?, - }) + } ) } } impl super::SBPMessage for MsgWheeltick {