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
32 changes: 1 addition & 31 deletions mavlink-bindgen/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1560,36 +1560,6 @@ impl MavDeprecation {
}
}

#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct MavSuperseded {
// YYYY-MM
pub since: String,
// maybe empty, may be encapuslated in `` and contain a wildcard
pub replaced_by: String,
pub note: Option<String>,
}

impl MavSuperseded {
pub fn emit_tokens(&self) -> TokenStream {
let since = &self.since;
let note = match &self.note {
Some(str) if str.is_empty() || str.ends_with(".") => str.clone(),
Some(str) => format!("{str}."),
None => String::new(),
};
let replaced_by = if self.replaced_by.starts_with("`") {
format!("See {}", self.replaced_by)
} else if self.replaced_by.is_empty() {
String::new()
} else {
format!("See `{}`", self.replaced_by)
};
let message = format!("{note} {replaced_by} (Superseded since {since})");
quote!(#[superseded = #message])
}
}

#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
Expand Down Expand Up @@ -2066,7 +2036,7 @@ pub fn parse_profile(
Some(t.parse().expect("Invalid dialect number format"));
}
}
Some(&MavXmlElement::Deprecated) => {
Some(&MavXmlElement::Deprecated) | Some(&MavXmlElement::Superseded) => {
if let Some(t) = text {
deprecated.as_mut().unwrap().note = Some(t);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use ts_rs::TS;
#[repr(u32)]
#[doc = "Coordinate frames used by MAVLink. Not all frames are supported by all commands, messages, or vehicles."]
pub enum MavFrame {
#[deprecated = " See `MAV_FRAME_GLOBAL` (Superseded since 2024-03)"]
#[deprecated = "Use MAV_FRAME_GLOBAL in COMMAND_INT (and elsewhere) as a synonymous replacement. See `MAV_FRAME_GLOBAL` (Superseded since 2024-03)"]
#[doc = "Global (WGS84) coordinate frame (scaled) + altitude relative to mean sea level (MSL)."]
MAV_FRAME_GLOBAL_INT = 5,
}
Expand Down Expand Up @@ -74,7 +74,7 @@ impl Default for MavRoi {
Self::DEFAULT
}
}
#[deprecated = " See `BATTERY_INFO` (Superseded since 2024-02)"]
#[deprecated = "The BATTERY_INFO message is better aligned with UAVCAN messages, and in any case is useful even if a battery is not \"smart\". See `BATTERY_INFO` (Superseded since 2024-02)"]
#[doc = "Smart Battery information (static/infrequent update). Use for updates from: smart battery to flight stack, flight stack to GCS. Use BATTERY_STATUS for the frequent battery updates."]
#[doc = ""]
#[doc = "ID: 370"]
Expand Down Expand Up @@ -238,7 +238,7 @@ pub enum MavMessage {
#[doc = "Smart Battery information (static/infrequent update). Use for updates from: smart battery to flight stack, flight stack to GCS. Use BATTERY_STATUS for the frequent battery updates."]
#[doc = ""]
#[doc = "ID: 370"]
#[deprecated = " See `BATTERY_INFO` (Superseded since 2024-02)"]
#[deprecated = "The BATTERY_INFO message is better aligned with UAVCAN messages, and in any case is useful even if a battery is not \"smart\". See `BATTERY_INFO` (Superseded since 2024-02)"]
SMART_BATTERY_INFO(SMART_BATTERY_INFO_DATA),
}
impl MavMessage {
Expand Down
Loading