Skip to content

Commit c9751f0

Browse files
author
Jason Mobarak
committed
rust: version 3.0.0
1 parent abde79e commit c9751f0

File tree

15 files changed

+5506
-279
lines changed

15 files changed

+5506
-279
lines changed

rust/sbp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[package]
99
name = "sbp"
10-
version = "2.8.0"
10+
version = "3.0.0"
1111
description = "Rust native implementation of SBP (Swift Binary Protocol) for communicating with devices made by Swift Navigation"
1212
authors = ["Swift Navigation <[email protected]>"]
1313
repository = "https://github.com/swift-nav/libsbp"

rust/sbp/src/messages/acquisition.rs

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@
1212
// Automatically generated from yaml/swiftnav/sbp/acquisition.yaml
1313
// with generate.py. Please do not hand edit!
1414
//****************************************************************************/
15-
1615
//! Satellite acquisition messages from the device.
1716
1817
extern crate byteorder;
1918
#[allow(unused_imports)]
20-
use self::byteorder::{LittleEndian,ReadBytesExt};
19+
use self::byteorder::{LittleEndian, ReadBytesExt};
2120
#[cfg(feature = "sbp_serde")]
22-
use serde::{Serialize, Deserialize};
21+
use serde::{Deserialize, Serialize};
2322

23+
use super::gnss::*;
2424
#[allow(unused_imports)]
2525
use crate::SbpString;
26-
use super::gnss::*;
27-
2826

2927
/// Acq perfomance measurement and debug
3028
///
@@ -64,7 +62,7 @@ pub struct AcqSvProfile {
6462

6563
impl AcqSvProfile {
6664
pub fn parse(_buf: &mut &[u8]) -> Result<AcqSvProfile, crate::Error> {
67-
Ok( AcqSvProfile{
65+
Ok(AcqSvProfile {
6866
job_type: _buf.read_u8()?,
6967
status: _buf.read_u8()?,
7068
cn0: _buf.read_u16::<LittleEndian>()?,
@@ -77,20 +75,20 @@ impl AcqSvProfile {
7775
cf_max: _buf.read_i32::<LittleEndian>()?,
7876
cf: _buf.read_i32::<LittleEndian>()?,
7977
cp: _buf.read_u32::<LittleEndian>()?,
80-
} )
78+
})
8179
}
8280
pub fn parse_array(buf: &mut &[u8]) -> Result<Vec<AcqSvProfile>, crate::Error> {
8381
let mut v = Vec::new();
8482
while buf.len() > 0 {
85-
v.push( AcqSvProfile::parse(buf)? );
83+
v.push(AcqSvProfile::parse(buf)?);
8684
}
8785
Ok(v)
8886
}
8987

9088
pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result<Vec<AcqSvProfile>, crate::Error> {
9189
let mut v = Vec::new();
9290
for _ in 0..n {
93-
v.push( AcqSvProfile::parse(buf)? );
91+
v.push(AcqSvProfile::parse(buf)?);
9492
}
9593
Ok(v)
9694
}
@@ -167,7 +165,7 @@ pub struct AcqSvProfileDep {
167165

168166
impl AcqSvProfileDep {
169167
pub fn parse(_buf: &mut &[u8]) -> Result<AcqSvProfileDep, crate::Error> {
170-
Ok( AcqSvProfileDep{
168+
Ok(AcqSvProfileDep {
171169
job_type: _buf.read_u8()?,
172170
status: _buf.read_u8()?,
173171
cn0: _buf.read_u16::<LittleEndian>()?,
@@ -180,20 +178,23 @@ impl AcqSvProfileDep {
180178
cf_max: _buf.read_i32::<LittleEndian>()?,
181179
cf: _buf.read_i32::<LittleEndian>()?,
182180
cp: _buf.read_u32::<LittleEndian>()?,
183-
} )
181+
})
184182
}
185183
pub fn parse_array(buf: &mut &[u8]) -> Result<Vec<AcqSvProfileDep>, crate::Error> {
186184
let mut v = Vec::new();
187185
while buf.len() > 0 {
188-
v.push( AcqSvProfileDep::parse(buf)? );
186+
v.push(AcqSvProfileDep::parse(buf)?);
189187
}
190188
Ok(v)
191189
}
192190

193-
pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result<Vec<AcqSvProfileDep>, crate::Error> {
191+
pub fn parse_array_limit(
192+
buf: &mut &[u8],
193+
n: usize,
194+
) -> Result<Vec<AcqSvProfileDep>, crate::Error> {
194195
let mut v = Vec::new();
195196
for _ in 0..n {
196-
v.push( AcqSvProfileDep::parse(buf)? );
197+
v.push(AcqSvProfileDep::parse(buf)?);
197198
}
198199
Ok(v)
199200
}
@@ -259,13 +260,13 @@ pub struct MsgAcqResult {
259260

260261
impl MsgAcqResult {
261262
pub fn parse(_buf: &mut &[u8]) -> Result<MsgAcqResult, crate::Error> {
262-
Ok( MsgAcqResult{
263+
Ok(MsgAcqResult {
263264
sender_id: None,
264265
cn0: _buf.read_f32::<LittleEndian>()?,
265266
cp: _buf.read_f32::<LittleEndian>()?,
266267
cf: _buf.read_f32::<LittleEndian>()?,
267268
sid: GnssSignal::parse(_buf)?,
268-
} )
269+
})
269270
}
270271
}
271272
impl super::SBPMessage for MsgAcqResult {
@@ -329,13 +330,13 @@ pub struct MsgAcqResultDepA {
329330

330331
impl MsgAcqResultDepA {
331332
pub fn parse(_buf: &mut &[u8]) -> Result<MsgAcqResultDepA, crate::Error> {
332-
Ok( MsgAcqResultDepA{
333+
Ok(MsgAcqResultDepA {
333334
sender_id: None,
334335
snr: _buf.read_f32::<LittleEndian>()?,
335336
cp: _buf.read_f32::<LittleEndian>()?,
336337
cf: _buf.read_f32::<LittleEndian>()?,
337338
prn: _buf.read_u8()?,
338-
} )
339+
})
339340
}
340341
}
341342
impl super::SBPMessage for MsgAcqResultDepA {
@@ -398,13 +399,13 @@ pub struct MsgAcqResultDepB {
398399

399400
impl MsgAcqResultDepB {
400401
pub fn parse(_buf: &mut &[u8]) -> Result<MsgAcqResultDepB, crate::Error> {
401-
Ok( MsgAcqResultDepB{
402+
Ok(MsgAcqResultDepB {
402403
sender_id: None,
403404
snr: _buf.read_f32::<LittleEndian>()?,
404405
cp: _buf.read_f32::<LittleEndian>()?,
405406
cf: _buf.read_f32::<LittleEndian>()?,
406407
sid: GnssSignalDep::parse(_buf)?,
407-
} )
408+
})
408409
}
409410
}
410411
impl super::SBPMessage for MsgAcqResultDepB {
@@ -466,13 +467,13 @@ pub struct MsgAcqResultDepC {
466467

467468
impl MsgAcqResultDepC {
468469
pub fn parse(_buf: &mut &[u8]) -> Result<MsgAcqResultDepC, crate::Error> {
469-
Ok( MsgAcqResultDepC{
470+
Ok(MsgAcqResultDepC {
470471
sender_id: None,
471472
cn0: _buf.read_f32::<LittleEndian>()?,
472473
cp: _buf.read_f32::<LittleEndian>()?,
473474
cf: _buf.read_f32::<LittleEndian>()?,
474475
sid: GnssSignalDep::parse(_buf)?,
475-
} )
476+
})
476477
}
477478
}
478479
impl super::SBPMessage for MsgAcqResultDepC {
@@ -529,10 +530,10 @@ pub struct MsgAcqSvProfile {
529530

530531
impl MsgAcqSvProfile {
531532
pub fn parse(_buf: &mut &[u8]) -> Result<MsgAcqSvProfile, crate::Error> {
532-
Ok( MsgAcqSvProfile{
533+
Ok(MsgAcqSvProfile {
533534
sender_id: None,
534535
acq_sv_profile: AcqSvProfile::parse_array(_buf)?,
535-
} )
536+
})
536537
}
537538
}
538539
impl super::SBPMessage for MsgAcqSvProfile {
@@ -582,10 +583,10 @@ pub struct MsgAcqSvProfileDep {
582583

583584
impl MsgAcqSvProfileDep {
584585
pub fn parse(_buf: &mut &[u8]) -> Result<MsgAcqSvProfileDep, crate::Error> {
585-
Ok( MsgAcqSvProfileDep{
586+
Ok(MsgAcqSvProfileDep {
586587
sender_id: None,
587588
acq_sv_profile: AcqSvProfileDep::parse_array(_buf)?,
588-
} )
589+
})
589590
}
590591
}
591592
impl super::SBPMessage for MsgAcqSvProfileDep {

rust/sbp/src/messages/bootload.rs

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,22 @@
1212
// Automatically generated from yaml/swiftnav/sbp/bootload.yaml
1313
// with generate.py. Please do not hand edit!
1414
//****************************************************************************/
15-
1615
//! Messages for the bootloading configuration of a Piksi 2.3.1. This message
1716
//! group does not apply to Piksi Multi.
18-
//!
17+
//!
1918
//! Note that some of these messages share the same message type ID for both the
2019
//! host request and the device response.
21-
//!
20+
//!
2221
2322
extern crate byteorder;
2423
#[allow(unused_imports)]
25-
use self::byteorder::{LittleEndian,ReadBytesExt};
24+
use self::byteorder::{LittleEndian, ReadBytesExt};
2625
#[cfg(feature = "sbp_serde")]
27-
use serde::{Serialize, Deserialize};
26+
use serde::{Deserialize, Serialize};
2827

2928
#[allow(unused_imports)]
3029
use crate::SbpString;
3130

32-
3331
/// Deprecated
3432
///
3533
/// Deprecated.
@@ -45,10 +43,10 @@ pub struct MsgBootloaderHandshakeDepA {
4543

4644
impl MsgBootloaderHandshakeDepA {
4745
pub fn parse(_buf: &mut &[u8]) -> Result<MsgBootloaderHandshakeDepA, crate::Error> {
48-
Ok( MsgBootloaderHandshakeDepA{
46+
Ok(MsgBootloaderHandshakeDepA {
4947
sender_id: None,
5048
handshake: crate::parser::read_u8_array(_buf)?,
51-
} )
49+
})
5250
}
5351
}
5452
impl super::SBPMessage for MsgBootloaderHandshakeDepA {
@@ -98,9 +96,7 @@ pub struct MsgBootloaderHandshakeReq {
9896

9997
impl MsgBootloaderHandshakeReq {
10098
pub fn parse(_buf: &mut &[u8]) -> Result<MsgBootloaderHandshakeReq, crate::Error> {
101-
Ok( MsgBootloaderHandshakeReq{
102-
sender_id: None,
103-
} )
99+
Ok(MsgBootloaderHandshakeReq { sender_id: None })
104100
}
105101
}
106102
impl super::SBPMessage for MsgBootloaderHandshakeReq {
@@ -124,8 +120,7 @@ impl super::SBPMessage for MsgBootloaderHandshakeReq {
124120

125121
impl crate::serialize::SbpSerialize for MsgBootloaderHandshakeReq {
126122
#[allow(unused_variables)]
127-
fn append_to_sbp_buffer(&self, buf: &mut Vec<u8>) {
128-
}
123+
fn append_to_sbp_buffer(&self, buf: &mut Vec<u8>) {}
129124

130125
fn sbp_size(&self) -> usize {
131126
0
@@ -153,11 +148,11 @@ pub struct MsgBootloaderHandshakeResp {
153148

154149
impl MsgBootloaderHandshakeResp {
155150
pub fn parse(_buf: &mut &[u8]) -> Result<MsgBootloaderHandshakeResp, crate::Error> {
156-
Ok( MsgBootloaderHandshakeResp{
151+
Ok(MsgBootloaderHandshakeResp {
157152
sender_id: None,
158153
flags: _buf.read_u32::<LittleEndian>()?,
159154
version: crate::parser::read_string(_buf)?,
160-
} )
155+
})
161156
}
162157
}
163158
impl super::SBPMessage for MsgBootloaderHandshakeResp {
@@ -209,10 +204,10 @@ pub struct MsgBootloaderJumpToApp {
209204

210205
impl MsgBootloaderJumpToApp {
211206
pub fn parse(_buf: &mut &[u8]) -> Result<MsgBootloaderJumpToApp, crate::Error> {
212-
Ok( MsgBootloaderJumpToApp{
207+
Ok(MsgBootloaderJumpToApp {
213208
sender_id: None,
214209
jump: _buf.read_u8()?,
215-
} )
210+
})
216211
}
217212
}
218213
impl super::SBPMessage for MsgBootloaderJumpToApp {
@@ -265,9 +260,7 @@ pub struct MsgNapDeviceDnaReq {
265260

266261
impl MsgNapDeviceDnaReq {
267262
pub fn parse(_buf: &mut &[u8]) -> Result<MsgNapDeviceDnaReq, crate::Error> {
268-
Ok( MsgNapDeviceDnaReq{
269-
sender_id: None,
270-
} )
263+
Ok(MsgNapDeviceDnaReq { sender_id: None })
271264
}
272265
}
273266
impl super::SBPMessage for MsgNapDeviceDnaReq {
@@ -291,8 +284,7 @@ impl super::SBPMessage for MsgNapDeviceDnaReq {
291284

292285
impl crate::serialize::SbpSerialize for MsgNapDeviceDnaReq {
293286
#[allow(unused_variables)]
294-
fn append_to_sbp_buffer(&self, buf: &mut Vec<u8>) {
295-
}
287+
fn append_to_sbp_buffer(&self, buf: &mut Vec<u8>) {}
296288

297289
fn sbp_size(&self) -> usize {
298290
0
@@ -319,10 +311,10 @@ pub struct MsgNapDeviceDnaResp {
319311

320312
impl MsgNapDeviceDnaResp {
321313
pub fn parse(_buf: &mut &[u8]) -> Result<MsgNapDeviceDnaResp, crate::Error> {
322-
Ok( MsgNapDeviceDnaResp{
314+
Ok(MsgNapDeviceDnaResp {
323315
sender_id: None,
324316
dna: crate::parser::read_u8_array_limit(_buf, 8)?,
325-
} )
317+
})
326318
}
327319
}
328320
impl super::SBPMessage for MsgNapDeviceDnaResp {

rust/sbp/src/messages/ext_events.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@
1212
// Automatically generated from yaml/swiftnav/sbp/ext_events.yaml
1313
// with generate.py. Please do not hand edit!
1414
//****************************************************************************/
15-
1615
//! Messages reporting accurately-timestamped external events,
1716
//! e.g. camera shutter time.
18-
//!
17+
//!
1918
2019
extern crate byteorder;
2120
#[allow(unused_imports)]
22-
use self::byteorder::{LittleEndian,ReadBytesExt};
21+
use self::byteorder::{LittleEndian, ReadBytesExt};
2322
#[cfg(feature = "sbp_serde")]
24-
use serde::{Serialize, Deserialize};
23+
use serde::{Deserialize, Serialize};
2524

2625
#[allow(unused_imports)]
2726
use crate::SbpString;
2827

29-
3028
/// Reports timestamped external pin event
3129
///
3230
/// Reports detection of an external event, the GPS time it occurred,
@@ -52,14 +50,14 @@ pub struct MsgExtEvent {
5250

5351
impl MsgExtEvent {
5452
pub fn parse(_buf: &mut &[u8]) -> Result<MsgExtEvent, crate::Error> {
55-
Ok( MsgExtEvent{
53+
Ok(MsgExtEvent {
5654
sender_id: None,
5755
wn: _buf.read_u16::<LittleEndian>()?,
5856
tow: _buf.read_u32::<LittleEndian>()?,
5957
ns_residual: _buf.read_i32::<LittleEndian>()?,
6058
flags: _buf.read_u8()?,
6159
pin: _buf.read_u8()?,
62-
} )
60+
})
6361
}
6462
}
6563
impl super::SBPMessage for MsgExtEvent {

0 commit comments

Comments
 (0)