Skip to content

Commit

Permalink
Merge pull request #1601 from Jezza/jezza/fix
Browse files Browse the repository at this point in the history
Fix version macro & config deserialisation.
  • Loading branch information
Mallets authored Nov 25, 2024
2 parents 9a84e6d + d15f153 commit a75d2a1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
14 changes: 14 additions & 0 deletions commons/zenoh-config/src/mode_dependent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ impl<'a> serde::Deserialize<'a> for ModeDependentValue<i64> {
Ok(ModeDependentValue::Unique(value))
}

fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E>
where
E: de::Error,
{
Ok(ModeDependentValue::Unique(value as i64))
}

fn visit_map<M>(self, map: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'de>,
Expand Down Expand Up @@ -222,6 +229,13 @@ impl<'a> serde::Deserialize<'a> for ModeDependentValue<f64> {
Ok(ModeDependentValue::Unique(value))
}

fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E>
where
E: de::Error,
{
Ok(ModeDependentValue::Unique(value as f64))
}

fn visit_i64<E>(self, value: i64) -> Result<Self::Value, E>
where
E: de::Error,
Expand Down
7 changes: 6 additions & 1 deletion plugins/zenoh-plugin-trait/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//!
//! To build a plugin, implement [`Plugin`].
//!
//! If building a plugin for [`zenohd`](https://crates.io/crates/zenoh), you should use the types exported in [`zenoh::plugins`](https://docs.rs/zenoh/latest/zenoh/plugins) to fill [`Plugin`]'s associated types.
//! If building a plugin for [`zenohd`](https://crates.io/crates/zenoh), you should use the types exported in [`zenoh::plugins`](https://docs.rs/zenoh/latest/zenoh/plugins) to fill [`Plugin`]'s associated types.
//! To check your plugin typing for `zenohd`, have your plugin implement [`zenoh::plugins::ZenohPlugin`](https://docs.rs/zenoh/latest/zenoh/plugins/struct.ZenohPlugin)
//!
//! Plugin is a struct which implements the [`Plugin`] trait. This trait has two associated types:
Expand Down Expand Up @@ -51,3 +51,8 @@ use zenoh_util::concat_enabled_features;

pub const FEATURES: &str =
concat_enabled_features!(prefix = "zenoh-plugin-trait", features = ["default"]);

#[doc(hidden)]
pub mod export {
pub use git_version;
}
2 changes: 1 addition & 1 deletion plugins/zenoh-plugin-trait/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ macro_rules! plugin_version {
#[macro_export]
macro_rules! plugin_long_version {
() => {
git_version::git_version!(prefix = "v", cargo_prefix = "v")
$crate::export::git_version::git_version!(prefix = "v", cargo_prefix = "v")
};
}

Expand Down

0 comments on commit a75d2a1

Please sign in to comment.