From 8fb58753f96c456cc84fca086df3adfa3e4779af Mon Sep 17 00:00:00 2001 From: pv42 Date: Thu, 22 Aug 2024 22:24:20 +0200 Subject: [PATCH] Emit extensions --- mavlink-bindgen/Cargo.toml | 4 +++- mavlink-core/Cargo.toml | 2 +- mavlink-core/src/utils.rs | 2 +- mavlink/Cargo.toml | 6 +++--- mavlink/src/lib.rs | 4 ++++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mavlink-bindgen/Cargo.toml b/mavlink-bindgen/Cargo.toml index 32403c9a2f..4a6e365f7d 100644 --- a/mavlink-bindgen/Cargo.toml +++ b/mavlink-bindgen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mavlink-bindgen" -version = "0.13.1" +version = "0.13.2" edition = "2021" license = "MIT/Apache-2.0" description = "Library used by rust-mavlink." @@ -28,3 +28,5 @@ anstyle-parse = { version = "=0.2.1", optional=true } [features] cli = ["dep:clap", "dep:clap_lex", "dep:clap_builder", "dep:anstyle", "dep:anstyle-query", "dep:anstyle-parse"] +emit-extensions = [] +emit-description = [] diff --git a/mavlink-core/Cargo.toml b/mavlink-core/Cargo.toml index db3504e1cc..8883a15ded 100644 --- a/mavlink-core/Cargo.toml +++ b/mavlink-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mavlink-core" -version = "0.13.1" +version = "0.13.2" authors = [ "Todd Stellanova", "Michal Podhradsky", diff --git a/mavlink-core/src/utils.rs b/mavlink-core/src/utils.rs index c0516c154e..efefcbadb8 100644 --- a/mavlink-core/src/utils.rs +++ b/mavlink-core/src/utils.rs @@ -22,7 +22,7 @@ pub fn remove_trailing_zeroes(data: &[u8]) -> usize { /// `MavType`s. This is only needed because rust doesn't currently implement `Default` for arrays /// of all sizes. In particular this trait is only ever used when the "serde" feature is enabled. /// For more information, check out [this issue](https://users.rust-lang.org/t/issue-for-derives-for-arrays-greater-than-size-32/59055/3). -pub(crate) trait RustDefault: Copy { +pub trait RustDefault: Copy { fn rust_default() -> Self; } diff --git a/mavlink/Cargo.toml b/mavlink/Cargo.toml index 476c80b0b8..597a6c756b 100644 --- a/mavlink/Cargo.toml +++ b/mavlink/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mavlink" -version = "0.13.1" +version = "0.13.2" authors = [ "Todd Stellanova", "Michal Podhradsky", @@ -87,8 +87,8 @@ serde_arrays = { version = "0.1.0", optional = true } ] "format-generated-code" = [] -"emit-description" = [] -"emit-extensions" = [] +"emit-description" = ["mavlink-bindgen/emit-description"] +"emit-extensions" = ["mavlink-bindgen/emit-extensions"] "std" = ["mavlink-core/std"] "udp" = ["mavlink-core/udp"] "tcp" = ["mavlink-core/tcp"] diff --git a/mavlink/src/lib.rs b/mavlink/src/lib.rs index a1b71eaa5a..3690dd954c 100644 --- a/mavlink/src/lib.rs +++ b/mavlink/src/lib.rs @@ -3,3 +3,7 @@ include!(concat!(env!("OUT_DIR"), "/mod.rs")); pub use mavlink_core::*; + +#[cfg(feature = "emit-extensions")] +#[allow(unused_imports)] +pub(crate) use mavlink_core::utils::RustDefault;