From 23931f92d5f9c321d8a0247a1379cc76b0275def Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Mon, 1 Apr 2024 15:48:02 +0200 Subject: [PATCH] more cleanup --- plugins/zenoh-plugin-rest/src/lib.rs | 1 - zenoh/src/query.rs | 1 - zenoh/src/sample/builder.rs | 2 ++ zenoh/src/sample/mod.rs | 8 +++++++- zenoh/src/session.rs | 1 + zenoh/tests/attachments.rs | 2 +- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/zenoh-plugin-rest/src/lib.rs b/plugins/zenoh-plugin-rest/src/lib.rs index f78c541eff..43c3f33776 100644 --- a/plugins/zenoh-plugin-rest/src/lib.rs +++ b/plugins/zenoh-plugin-rest/src/lib.rs @@ -34,7 +34,6 @@ use zenoh::plugins::{RunningPluginTrait, ZenohPlugin}; use zenoh::prelude::r#async::*; use zenoh::query::{QueryConsolidation, Reply}; use zenoh::runtime::Runtime; -use zenoh::sample::builder::ValueBuilderTrait; use zenoh::selector::TIME_RANGE_KEY; use zenoh::Session; use zenoh_plugin_trait::{plugin_long_version, plugin_version, Plugin, PluginControl}; diff --git a/zenoh/src/query.rs b/zenoh/src/query.rs index 9f96db4f4b..cb1116130d 100644 --- a/zenoh/src/query.rs +++ b/zenoh/src/query.rs @@ -15,7 +15,6 @@ //! Query primitives. use crate::handlers::{locked, Callback, DefaultHandler}; use crate::prelude::*; -use crate::sample::builder::{QoSBuilderTrait, SampleBuilderTrait, ValueBuilderTrait}; #[zenoh_macros::unstable] use crate::sample::Attachment; use crate::sample::QoSBuilder; diff --git a/zenoh/src/sample/builder.rs b/zenoh/src/sample/builder.rs index 295451abc1..5fab36617d 100644 --- a/zenoh/src/sample/builder.rs +++ b/zenoh/src/sample/builder.rs @@ -14,9 +14,11 @@ use std::marker::PhantomData; +#[cfg(feature = "unstable")] use crate::sample::Attachment; use crate::sample::QoS; use crate::sample::QoSBuilder; +#[cfg(feature = "unstable")] use crate::sample::SourceInfo; use crate::Encoding; use crate::KeyExpr; diff --git a/zenoh/src/sample/mod.rs b/zenoh/src/sample/mod.rs index be80f8277e..6e457578a3 100644 --- a/zenoh/src/sample/mod.rs +++ b/zenoh/src/sample/mod.rs @@ -117,7 +117,12 @@ impl DataInfoIntoSample for Option { IntoPayload: Into, { if let Some(data_info) = self { - data_info.into_sample(key_expr, payload, attachment) + data_info.into_sample( + key_expr, + payload, + #[cfg(feature = "unstable")] + attachment, + ) } else { Sample { key_expr: key_expr.into(), @@ -172,6 +177,7 @@ impl SourceInfo { } } +#[zenoh_macros::unstable] impl From for Option { fn from(source_info: SourceInfo) -> Option { if source_info.is_empty() { diff --git a/zenoh/src/session.rs b/zenoh/src/session.rs index 63cc0bb7fa..c44cb4f817 100644 --- a/zenoh/src/session.rs +++ b/zenoh/src/session.rs @@ -809,6 +809,7 @@ impl Session { #[cfg(feature = "unstable")] attachment: None, handler: DefaultHandler, + #[cfg(feature = "unstable")] source_info: SourceInfo::empty(), } } diff --git a/zenoh/tests/attachments.rs b/zenoh/tests/attachments.rs index 2725351ab0..9fb99b7cc0 100644 --- a/zenoh/tests/attachments.rs +++ b/zenoh/tests/attachments.rs @@ -14,7 +14,7 @@ #[cfg(feature = "unstable")] #[test] fn pubsub() { - use zenoh::{prelude::sync::*, sample::builder::SampleBuilderTrait}; + use zenoh::prelude::sync::*; let zenoh = zenoh::open(Config::default()).res().unwrap(); let _sub = zenoh