Skip to content

Commit

Permalink
chore: add derive(Format) for WncData
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <[email protected]>
  • Loading branch information
elpiel committed Feb 13, 2024
1 parent e88cfaa commit 9ded564
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/sentences/wnc.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
use arrayvec::ArrayString;
use nom::{
bytes::complete::is_not, character::complete::char, combinator::opt, number::complete::float,
};

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

use super::utils::array_string;
use crate::{
parse::{NmeaSentence, TEXT_PARAMETER_MAX_LEN},
Error, SentenceType,
};
use arrayvec::ArrayString;
use nom::{
bytes::complete::is_not, character::complete::char, combinator::opt, number::complete::float,
};

/// WNC - Distance - Waypoint to Waypoint
///
Expand All @@ -28,16 +32,19 @@ use nom::{
/// 4. K = Kilometers
/// 5. Waypoint ID, Destination
/// 6. Waypoint ID, Origin

#[derive(Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub struct WncData {
/// Distance, Nautical Miles
pub distance_nautical_miles: Option<f32>,
/// Distance, Kilometers
pub distance_kilometers: Option<f32>,
/// Waypoint ID, Destination
#[cfg_attr(feature = "defmt-03", defmt(Debug2Format))]
pub waypoint_id_destination: Option<ArrayString<TEXT_PARAMETER_MAX_LEN>>,
/// Waypoint ID, Origin
#[cfg_attr(feature = "defmt-03", defmt(Debug2Format))]
pub waypoint_id_origin: Option<ArrayString<TEXT_PARAMETER_MAX_LEN>>,
}

Expand Down

0 comments on commit 9ded564

Please sign in to comment.