From bb7ba707e7c7262af2d84c091a38ac652d05f11e Mon Sep 17 00:00:00 2001 From: Luca Cominardi Date: Sat, 2 Mar 2024 15:41:18 +0100 Subject: [PATCH] Fix some erroneous prelude usage --- zenoh/src/lib.rs | 4 +++- zenoh/src/liveliness.rs | 5 ++--- zenoh/src/prelude.rs | 2 -- zenoh/src/publication.rs | 22 +++++++++++++--------- zenoh/src/queryable.rs | 8 +++----- zenoh/src/subscriber.rs | 6 ++++-- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/zenoh/src/lib.rs b/zenoh/src/lib.rs index 54f848d8ee..22c0464e5c 100644 --- a/zenoh/src/lib.rs +++ b/zenoh/src/lib.rs @@ -79,9 +79,11 @@ extern crate zenoh_core; #[macro_use] extern crate zenoh_result; +pub(crate) type Id = usize; + use git_version::git_version; use handlers::DefaultHandler; -#[zenoh_macros::unstable] +#[cfg(feature = "unstable")] use net::runtime::Runtime; use prelude::*; use scouting::ScoutBuilder; diff --git a/zenoh/src/liveliness.rs b/zenoh/src/liveliness.rs index 74d2759948..9f14866363 100644 --- a/zenoh/src/liveliness.rs +++ b/zenoh/src/liveliness.rs @@ -15,8 +15,7 @@ //! Liveliness primitives. //! //! see [`Liveliness`] - -use crate::query::Reply; +use crate::{query::Reply, Id}; #[zenoh_macros::unstable] use { @@ -508,7 +507,7 @@ impl<'a, 'b> LivelinessSubscriberBuilder<'a, 'b, DefaultHandler> { #[zenoh_macros::unstable] pub fn with(self, handler: Handler) -> LivelinessSubscriberBuilder<'a, 'b, Handler> where - Handler: crate::prelude::IntoCallbackReceiverPair<'static, Sample>, + Handler: crate::handlers::IntoCallbackReceiverPair<'static, Sample>, { let LivelinessSubscriberBuilder { session, diff --git a/zenoh/src/prelude.rs b/zenoh/src/prelude.rs index a6f09b3b41..e9dd105c75 100644 --- a/zenoh/src/prelude.rs +++ b/zenoh/src/prelude.rs @@ -33,8 +33,6 @@ pub(crate) mod common { pub use zenoh_core::Resolve; pub use zenoh_protocol::core::{Encoding, EncodingPrefix, EndPoint, Locator, ZenohId}; - pub(crate) type Id = usize; - pub use crate::config::{self, Config, ValidatedMap}; pub use crate::handlers::IntoCallbackReceiverPair; pub use crate::session::{Session, SessionDeclarations}; diff --git a/zenoh/src/publication.rs b/zenoh/src/publication.rs index 26bac16b6e..3da06d61b2 100644 --- a/zenoh/src/publication.rs +++ b/zenoh/src/publication.rs @@ -13,21 +13,22 @@ // //! Publishing primitives. -#[zenoh_macros::unstable] -use crate::handlers::Callback; -#[zenoh_macros::unstable] -use crate::handlers::DefaultHandler; +use crate::key_expr::KeyExpr; use crate::net::primitives::Primitives; use crate::payload::Payload; -use crate::prelude::*; -#[zenoh_macros::unstable] -use crate::sample::Attachment; -use crate::sample::DataInfo; -use crate::Encoding; +use crate::sample::{DataInfo, Sample, SampleKind}; +use crate::Locality; use crate::SessionRef; use crate::Undeclarable; +#[cfg(feature = "unstable")] +use crate::{ + handlers::{Callback, DefaultHandler, IntoCallbackReceiverPair}, + sample::Attachment, +}; use std::future::Ready; use zenoh_core::{zread, AsyncResolve, Resolvable, Resolve, SyncResolve}; +use zenoh_keyexpr::keyexpr; +use zenoh_protocol::core::Encoding; use zenoh_protocol::network::push::ext; use zenoh_protocol::network::Mapping; use zenoh_protocol::network::Push; @@ -36,6 +37,9 @@ use zenoh_protocol::zenoh::PushBody; use zenoh_protocol::zenoh::Put; use zenoh_result::ZResult; +#[cfg(feature = "unstable")] +pub(crate) type Id = usize; + /// The kind of congestion control. pub use zenoh_protocol::core::CongestionControl; diff --git a/zenoh/src/queryable.rs b/zenoh/src/queryable.rs index 969c8088a4..5acd4c542a 100644 --- a/zenoh/src/queryable.rs +++ b/zenoh/src/queryable.rs @@ -17,14 +17,12 @@ use crate::handlers::{locked, DefaultHandler}; use crate::net::primitives::Primitives; use crate::prelude::*; -#[zenoh_macros::unstable] -use crate::query::ReplyKeyExpr; -#[zenoh_macros::unstable] -use crate::sample::Attachment; use crate::sample::DataInfo; +use crate::Id; use crate::SessionRef; use crate::Undeclarable; - +#[cfg(feature = "unstable")] +use crate::{query::ReplyKeyExpr, sample::Attachment}; use std::fmt; use std::future::Ready; use std::ops::Deref; diff --git a/zenoh/src/subscriber.rs b/zenoh/src/subscriber.rs index 610104f68b..9d4adfe205 100644 --- a/zenoh/src/subscriber.rs +++ b/zenoh/src/subscriber.rs @@ -13,9 +13,11 @@ // //! Subscribing primitives. -use crate::handlers::{locked, Callback, DefaultHandler}; +use crate::handlers::{locked, Callback, DefaultHandler, IntoCallbackReceiverPair}; +use crate::key_expr::KeyExpr; use crate::prelude::Locality; -use crate::prelude::{Id, IntoCallbackReceiverPair, KeyExpr, Sample}; +use crate::sample::Sample; +use crate::Id; use crate::Undeclarable; use crate::{Result as ZResult, SessionRef}; use std::fmt;