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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub trait ConcreteMessage: SbpMessage + TryFrom<Sbp, Error = TryFromSbpError> {

/// The error returned when using [TryFrom] to convert [Sbp] to the wrong message type.
#[derive(Debug, Clone)]
pub struct TryFromSbpError;
pub struct TryFromSbpError(pub Sbp);

impl std::fmt::Display for TryFromSbpError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl TryFrom<Sbp> for (((m.msg_name))) {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::(((m.msg_name)))(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions rust/sbp/src/messages/acquisition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ pub mod msg_acq_result {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgAcqResult(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -409,7 +409,7 @@ pub mod msg_acq_result_dep_a {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgAcqResultDepA(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -504,7 +504,7 @@ pub mod msg_acq_result_dep_b {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgAcqResultDepB(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -598,7 +598,7 @@ pub mod msg_acq_result_dep_c {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgAcqResultDepC(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -684,7 +684,7 @@ pub mod msg_acq_sv_profile {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgAcqSvProfile(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -757,7 +757,7 @@ pub mod msg_acq_sv_profile_dep {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgAcqSvProfileDep(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions rust/sbp/src/messages/bootload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub mod msg_bootloader_handshake_dep_a {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgBootloaderHandshakeDepA(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -145,7 +145,7 @@ pub mod msg_bootloader_handshake_req {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgBootloaderHandshakeReq(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -260,7 +260,7 @@ pub mod msg_bootloader_handshake_resp {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgBootloaderHandshakeResp(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -335,7 +335,7 @@ pub mod msg_bootloader_jump_to_app {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgBootloaderJumpToApp(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -409,7 +409,7 @@ pub mod msg_nap_device_dna_req {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgNapDeviceDnaReq(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -481,7 +481,7 @@ pub mod msg_nap_device_dna_resp {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgNapDeviceDnaResp(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/sbp/src/messages/ext_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub mod msg_ext_event {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgExtEvent(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions rust/sbp/src/messages/file_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub mod msg_fileio_config_req {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioConfigReq(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ pub mod msg_fileio_config_resp {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioConfigResp(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -266,7 +266,7 @@ pub mod msg_fileio_read_dir_req {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioReadDirReq(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -353,7 +353,7 @@ pub mod msg_fileio_read_dir_resp {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioReadDirResp(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -442,7 +442,7 @@ pub mod msg_fileio_read_req {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioReadReq(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -532,7 +532,7 @@ pub mod msg_fileio_read_resp {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioReadResp(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -609,7 +609,7 @@ pub mod msg_fileio_remove {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioRemove(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -696,7 +696,7 @@ pub mod msg_fileio_write_req {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioWriteReq(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -783,7 +783,7 @@ pub mod msg_fileio_write_resp {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioWriteResp(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions rust/sbp/src/messages/flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub mod msg_flash_done {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFlashDone(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -240,7 +240,7 @@ pub mod msg_flash_erase {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFlashErase(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -373,7 +373,7 @@ pub mod msg_flash_program {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFlashProgram(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -514,7 +514,7 @@ pub mod msg_flash_read_req {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFlashReadReq(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -651,7 +651,7 @@ pub mod msg_flash_read_resp {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFlashReadResp(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -762,7 +762,7 @@ pub mod msg_m25_flash_write_status {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgM25FlashWriteStatus(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -835,7 +835,7 @@ pub mod msg_stm_flash_lock_sector {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgStmFlashLockSector(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -908,7 +908,7 @@ pub mod msg_stm_flash_unlock_sector {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgStmFlashUnlockSector(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -980,7 +980,7 @@ pub mod msg_stm_unique_id_req {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgStmUniqueIdReq(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -1050,7 +1050,7 @@ pub mod msg_stm_unique_id_resp {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgStmUniqueIdResp(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions rust/sbp/src/messages/imu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub mod msg_imu_aux {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgImuAux(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -394,7 +394,7 @@ pub mod msg_imu_raw {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgImuRaw(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions rust/sbp/src/messages/integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ pub mod msg_ssr_flag_high_level {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgSsrFlagHighLevel(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -752,7 +752,7 @@ pub mod msg_ssr_flag_iono_grid_points {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgSsrFlagIonoGridPoints(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -838,7 +838,7 @@ pub mod msg_ssr_flag_iono_grid_point_sat_los {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgSsrFlagIonoGridPointSatLos(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -925,7 +925,7 @@ pub mod msg_ssr_flag_iono_tile_sat_los {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgSsrFlagIonoTileSatLos(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -1023,7 +1023,7 @@ pub mod msg_ssr_flag_satellites {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgSsrFlagSatellites(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down Expand Up @@ -1126,7 +1126,7 @@ pub mod msg_ssr_flag_tropo_grid_points {
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgSsrFlagTropoGridPoints(m) => Ok(m),
_ => Err(TryFromSbpError),
_ => Err(TryFromSbpError(msg)),
}
}
}
Expand Down
Loading