diff --git a/ci/valgrind-check/src/queryable_get/bin/z_queryable_get.rs b/ci/valgrind-check/src/queryable_get/bin/z_queryable_get.rs index 70945a4926..8ea7be201b 100644 --- a/ci/valgrind-check/src/queryable_get/bin/z_queryable_get.rs +++ b/ci/valgrind-check/src/queryable_get/bin/z_queryable_get.rs @@ -14,7 +14,10 @@ use std::{convert::TryFrom, time::Duration}; use zenoh::{ - config::Config, key_expr::KeyExpr, prelude::*, query::QueryTarget, selector::Selector, + config::Config, + key_expr::KeyExpr, + prelude::*, + query::{QueryTarget, Selector}, }; #[tokio::main] diff --git a/commons/zenoh-keyexpr/src/key_expr/borrowed.rs b/commons/zenoh-keyexpr/src/key_expr/borrowed.rs index 6d1774bcd8..a98337b987 100644 --- a/commons/zenoh-keyexpr/src/key_expr/borrowed.rs +++ b/commons/zenoh-keyexpr/src/key_expr/borrowed.rs @@ -27,7 +27,7 @@ use core::{ use zenoh_result::{bail, Error as ZError, ZResult}; -use super::{canon::Canonizable, OwnedKeyExpr, FORBIDDEN_CHARS}; +use super::{canon::Canonize, OwnedKeyExpr, FORBIDDEN_CHARS}; /// A [`str`] newtype that is statically known to be a valid key expression. /// @@ -72,7 +72,7 @@ impl keyexpr { pub fn autocanonize<'a, T, E>(t: &'a mut T) -> Result<&'a Self, E> where &'a Self: TryFrom<&'a T, Error = E>, - T: Canonizable + ?Sized, + T: Canonize + ?Sized, { t.canonize(); Self::new(t) diff --git a/commons/zenoh-keyexpr/src/key_expr/canon.rs b/commons/zenoh-keyexpr/src/key_expr/canon.rs index cccccdfba3..7080dbde1a 100644 --- a/commons/zenoh-keyexpr/src/key_expr/canon.rs +++ b/commons/zenoh-keyexpr/src/key_expr/canon.rs @@ -19,13 +19,13 @@ use crate::key_expr::{ DELIMITER, DOUBLE_WILD, SINGLE_WILD, }; -pub trait Canonizable { +pub trait Canonize { fn canonize(&mut self); } const DOLLAR_STAR: &[u8; 2] = b"$*"; -impl Canonizable for &mut str { +impl Canonize for &mut str { fn canonize(&mut self) { let mut writer = Writer { ptr: self.as_mut_ptr(), @@ -114,7 +114,7 @@ impl Canonizable for &mut str { } } -impl Canonizable for String { +impl Canonize for String { fn canonize(&mut self) { let mut s = self.as_mut(); s.canonize(); diff --git a/commons/zenoh-keyexpr/src/key_expr/owned.rs b/commons/zenoh-keyexpr/src/key_expr/owned.rs index a53fdec2f0..6089df2a1e 100644 --- a/commons/zenoh-keyexpr/src/key_expr/owned.rs +++ b/commons/zenoh-keyexpr/src/key_expr/owned.rs @@ -22,7 +22,7 @@ use core::{ str::FromStr, }; -use super::{canon::Canonizable, keyexpr}; +use super::{canon::Canonize, keyexpr}; /// A [`Arc`] newtype that is statically known to be a valid key expression. /// @@ -60,7 +60,7 @@ impl OwnedKeyExpr { pub fn autocanonize(mut t: T) -> Result where Self: TryFrom, - T: Canonizable, + T: Canonize, { t.canonize(); Self::new(t) diff --git a/commons/zenoh-macros/src/lib.rs b/commons/zenoh-macros/src/lib.rs index c1c58d725e..003525daa9 100644 --- a/commons/zenoh-macros/src/lib.rs +++ b/commons/zenoh-macros/src/lib.rs @@ -287,7 +287,7 @@ fn keformat_support(source: &str) -> proc_macro2::TokenStream { let formatter_doc = format!("And instance of a formatter for `{source}`."); quote! { - use ::zenoh::core::Result as ZResult; + use ::zenoh::Result as ZResult; const FORMAT_INNER: ::zenoh::key_expr::format::KeFormat<'static, [::zenoh::key_expr::format::Segment<'static>; #len]> = unsafe { ::zenoh::key_expr::format::macro_support::const_new(#source, [#(#segments)*]) }; diff --git a/examples/examples/z_get.rs b/examples/examples/z_get.rs index 2069e20b31..eebe582f98 100644 --- a/examples/examples/z_get.rs +++ b/examples/examples/z_get.rs @@ -14,7 +14,10 @@ use std::time::Duration; use clap::Parser; -use zenoh::{query::QueryTarget, selector::Selector, Config}; +use zenoh::{ + query::{QueryTarget, Selector}, + Config, +}; use zenoh_examples::CommonArgs; #[tokio::main] diff --git a/examples/examples/z_get_shm.rs b/examples/examples/z_get_shm.rs index 71a3e3aa65..d8ea97da33 100644 --- a/examples/examples/z_get_shm.rs +++ b/examples/examples/z_get_shm.rs @@ -15,8 +15,7 @@ use std::time::Duration; use clap::Parser; use zenoh::{ - query::QueryTarget, - selector::Selector, + query::{QueryTarget, Selector}, shm::{ zshm, BlockOn, GarbageCollect, PosixShmProviderBackend, ShmProviderBuilder, POSIX_PROTOCOL_ID, diff --git a/examples/examples/z_info.rs b/examples/examples/z_info.rs index d2e4bfdbc0..aa40ef62d4 100644 --- a/examples/examples/z_info.rs +++ b/examples/examples/z_info.rs @@ -12,7 +12,7 @@ // ZettaScale Zenoh Team, // use clap::Parser; -use zenoh::{info::ZenohId, prelude::*}; +use zenoh::{prelude::*, session::ZenohId}; use zenoh_examples::CommonArgs; #[tokio::main] diff --git a/examples/examples/z_ping.rs b/examples/examples/z_ping.rs index 96454da614..eec9324173 100644 --- a/examples/examples/z_ping.rs +++ b/examples/examples/z_ping.rs @@ -14,7 +14,7 @@ use std::time::{Duration, Instant}; use clap::Parser; -use zenoh::{bytes::ZBytes, key_expr::keyexpr, prelude::*, publisher::CongestionControl, Config}; +use zenoh::{bytes::ZBytes, key_expr::keyexpr, prelude::*, qos::CongestionControl, Config}; use zenoh_examples::CommonArgs; fn main() { diff --git a/examples/examples/z_ping_shm.rs b/examples/examples/z_ping_shm.rs index 5e809c9341..4c6f8fed01 100644 --- a/examples/examples/z_ping_shm.rs +++ b/examples/examples/z_ping_shm.rs @@ -18,7 +18,7 @@ use zenoh::{ bytes::ZBytes, key_expr::keyexpr, prelude::*, - publisher::CongestionControl, + qos::CongestionControl, shm::{PosixShmProviderBackend, ShmProviderBuilder, POSIX_PROTOCOL_ID}, Config, }; diff --git a/examples/examples/z_pong.rs b/examples/examples/z_pong.rs index 6a1b8580c7..ef022d234c 100644 --- a/examples/examples/z_pong.rs +++ b/examples/examples/z_pong.rs @@ -12,7 +12,7 @@ // ZettaScale Zenoh Team, // use clap::Parser; -use zenoh::{key_expr::keyexpr, prelude::*, publisher::CongestionControl, Config}; +use zenoh::{key_expr::keyexpr, prelude::*, qos::CongestionControl, Config}; use zenoh_examples::CommonArgs; fn main() { diff --git a/examples/examples/z_pub.rs b/examples/examples/z_pub.rs index 56584f53c4..9f84ba118f 100644 --- a/examples/examples/z_pub.rs +++ b/examples/examples/z_pub.rs @@ -14,7 +14,7 @@ use std::time::Duration; use clap::Parser; -use zenoh::{encoding::Encoding, key_expr::KeyExpr, prelude::*, Config}; +use zenoh::{bytes::Encoding, key_expr::KeyExpr, prelude::*, Config}; use zenoh_examples::CommonArgs; #[tokio::main] diff --git a/examples/examples/z_pub_shm_thr.rs b/examples/examples/z_pub_shm_thr.rs index 3093a0962d..4641c51c95 100644 --- a/examples/examples/z_pub_shm_thr.rs +++ b/examples/examples/z_pub_shm_thr.rs @@ -15,7 +15,7 @@ use clap::Parser; use zenoh::{ bytes::ZBytes, prelude::*, - publisher::CongestionControl, + qos::CongestionControl, shm::{PosixShmProviderBackend, ShmProviderBuilder, POSIX_PROTOCOL_ID}, Config, }; diff --git a/examples/examples/z_pub_thr.rs b/examples/examples/z_pub_thr.rs index 359e375203..e6c063318e 100644 --- a/examples/examples/z_pub_thr.rs +++ b/examples/examples/z_pub_thr.rs @@ -15,7 +15,11 @@ use std::convert::TryInto; use clap::Parser; -use zenoh::{bytes::ZBytes, core::Priority, prelude::*, publisher::CongestionControl}; +use zenoh::{ + bytes::ZBytes, + prelude::*, + qos::{CongestionControl, Priority}, +}; use zenoh_examples::CommonArgs; fn main() { diff --git a/plugins/zenoh-backend-traits/src/config.rs b/plugins/zenoh-backend-traits/src/config.rs index 0d710d9942..98167680c8 100644 --- a/plugins/zenoh-backend-traits/src/config.rs +++ b/plugins/zenoh-backend-traits/src/config.rs @@ -18,8 +18,8 @@ use derive_more::{AsMut, AsRef}; use schemars::JsonSchema; use serde_json::{Map, Value}; use zenoh::{ - core::Result as ZResult, key_expr::{keyexpr, OwnedKeyExpr}, + Result as ZResult, }; use zenoh_plugin_trait::{PluginStartArgs, StructVersion}; use zenoh_result::{bail, zerror, Error}; diff --git a/plugins/zenoh-backend-traits/src/lib.rs b/plugins/zenoh-backend-traits/src/lib.rs index 851e9cfbb0..a75d934050 100644 --- a/plugins/zenoh-backend-traits/src/lib.rs +++ b/plugins/zenoh-backend-traits/src/lib.rs @@ -124,10 +124,10 @@ use async_trait::async_trait; use const_format::concatcp; use zenoh::{ - core::Result as ZResult, internal::Value, key_expr::{keyexpr, OwnedKeyExpr}, time::Timestamp, + Result as ZResult, }; use zenoh_plugin_trait::{PluginControl, PluginInstance, PluginStatusRec, StructVersion}; use zenoh_util::concat_enabled_features; diff --git a/plugins/zenoh-plugin-rest/examples/z_serve_sse.rs b/plugins/zenoh-plugin-rest/examples/z_serve_sse.rs index e39d7c28b2..5f7d466f13 100644 --- a/plugins/zenoh-plugin-rest/examples/z_serve_sse.rs +++ b/plugins/zenoh-plugin-rest/examples/z_serve_sse.rs @@ -15,7 +15,9 @@ use std::time::Duration; use clap::{arg, Command}; use zenoh::{ - config::Config, key_expr::keyexpr, publisher::CongestionControl, sample::QoSBuilderTrait, + config::Config, + key_expr::keyexpr, + qos::{CongestionControl, QoSBuilderTrait}, session::SessionDeclarations, }; diff --git a/plugins/zenoh-plugin-rest/src/lib.rs b/plugins/zenoh-plugin-rest/src/lib.rs index a35025e26e..e3dcc0130e 100644 --- a/plugins/zenoh-plugin-rest/src/lib.rs +++ b/plugins/zenoh-plugin-rest/src/lib.rs @@ -26,8 +26,7 @@ use http_types::Method; use serde::{Deserialize, Serialize}; use tide::{http::Mime, sse::Sender, Request, Response, Server, StatusCode}; use zenoh::{ - bytes::ZBytes, - encoding::Encoding, + bytes::{Encoding, ZBytes}, internal::{ bail, plugins::{RunningPluginTrait, ZenohPlugin}, @@ -36,16 +35,15 @@ use zenoh::{ }, key_expr::{keyexpr, KeyExpr}, prelude::*, - query::{QueryConsolidation, Reply}, - sample::{EncodingBuilderTrait, Sample, SampleKind}, - selector::{Parameters, Selector, ZenohParameters}, + query::{Parameters, QueryConsolidation, Reply, Selector, ZenohParameters}, + sample::{Sample, SampleKind}, session::{Session, SessionDeclarations}, }; use zenoh_plugin_trait::{plugin_long_version, plugin_version, Plugin, PluginControl}; mod config; pub use config::Config; -use zenoh::query::ReplyError; +use zenoh::{bytes::EncodingBuilderTrait, query::ReplyError}; const GIT_VERSION: &str = git_version::git_version!(prefix = "v", cargo_prefix = "v"); lazy_static::lazy_static! { diff --git a/plugins/zenoh-plugin-storage-manager/src/backends_mgt.rs b/plugins/zenoh-plugin-storage-manager/src/backends_mgt.rs index 1bb8af4330..b789b563d2 100644 --- a/plugins/zenoh-plugin-storage-manager/src/backends_mgt.rs +++ b/plugins/zenoh-plugin-storage-manager/src/backends_mgt.rs @@ -14,7 +14,7 @@ use std::sync::Arc; use flume::Sender; -use zenoh::{core::Result as ZResult, session::Session}; +use zenoh::{session::Session, Result as ZResult}; use zenoh_backend_traits::{config::StorageConfig, Capability, VolumeInstance}; use super::storages_mgt::*; diff --git a/plugins/zenoh-plugin-storage-manager/src/lib.rs b/plugins/zenoh-plugin-storage-manager/src/lib.rs index 6ea19ce25c..c916b649d9 100644 --- a/plugins/zenoh-plugin-storage-manager/src/lib.rs +++ b/plugins/zenoh-plugin-storage-manager/src/lib.rs @@ -30,7 +30,6 @@ use flume::Sender; use memory_backend::MemoryBackend; use storages_mgt::StorageMessage; use zenoh::{ - core::Result as ZResult, internal::{ plugins::{Response, RunningPlugin, RunningPluginTrait, ZenohPlugin}, runtime::Runtime, @@ -39,6 +38,7 @@ use zenoh::{ key_expr::{keyexpr, KeyExpr}, prelude::Wait, session::Session, + Result as ZResult, }; use zenoh_backend_traits::{ config::{ConfigDiff, PluginConfig, StorageConfig, VolumeConfig}, diff --git a/plugins/zenoh-plugin-storage-manager/src/memory_backend/mod.rs b/plugins/zenoh-plugin-storage-manager/src/memory_backend/mod.rs index e3a9cd9196..7c74d9f7f9 100644 --- a/plugins/zenoh-plugin-storage-manager/src/memory_backend/mod.rs +++ b/plugins/zenoh-plugin-storage-manager/src/memory_backend/mod.rs @@ -15,7 +15,7 @@ use std::{collections::HashMap, sync::Arc}; use async_std::sync::RwLock; use async_trait::async_trait; -use zenoh::{core::Result as ZResult, internal::Value, key_expr::OwnedKeyExpr, time::Timestamp}; +use zenoh::{internal::Value, key_expr::OwnedKeyExpr, time::Timestamp, Result as ZResult}; use zenoh_backend_traits::{ config::{StorageConfig, VolumeConfig}, *, diff --git a/plugins/zenoh-plugin-storage-manager/src/replica/align_queryable.rs b/plugins/zenoh-plugin-storage-manager/src/replica/align_queryable.rs index 802e420636..c11a632e41 100644 --- a/plugins/zenoh-plugin-storage-manager/src/replica/align_queryable.rs +++ b/plugins/zenoh-plugin-storage-manager/src/replica/align_queryable.rs @@ -21,7 +21,7 @@ use std::{ use async_std::sync::Arc; use zenoh::{ - internal::Value, key_expr::OwnedKeyExpr, prelude::*, sample::Sample, selector::Parameters, + internal::Value, key_expr::OwnedKeyExpr, prelude::*, query::Parameters, sample::Sample, time::Timestamp, Session, }; diff --git a/plugins/zenoh-plugin-storage-manager/src/replica/aligner.rs b/plugins/zenoh-plugin-storage-manager/src/replica/aligner.rs index 8ffeddd71f..7992053a67 100644 --- a/plugins/zenoh-plugin-storage-manager/src/replica/aligner.rs +++ b/plugins/zenoh-plugin-storage-manager/src/replica/aligner.rs @@ -24,8 +24,8 @@ use zenoh::{ internal::Value, key_expr::{KeyExpr, OwnedKeyExpr}, prelude::*, + query::Selector, sample::{Sample, SampleBuilder}, - selector::Selector, time::Timestamp, Session, }; diff --git a/plugins/zenoh-plugin-storage-manager/src/replica/snapshotter.rs b/plugins/zenoh-plugin-storage-manager/src/replica/snapshotter.rs index c5b2573335..6bb2cf113b 100644 --- a/plugins/zenoh-plugin-storage-manager/src/replica/snapshotter.rs +++ b/plugins/zenoh-plugin-storage-manager/src/replica/snapshotter.rs @@ -24,7 +24,7 @@ use async_std::{ }; use flume::Receiver; use futures::join; -use zenoh::{info::ZenohId, key_expr::OwnedKeyExpr, time::Timestamp}; +use zenoh::{key_expr::OwnedKeyExpr, session::ZenohId, time::Timestamp}; use zenoh_backend_traits::config::ReplicaConfig; use super::{Digest, DigestConfig, LogEntry}; diff --git a/plugins/zenoh-plugin-storage-manager/src/replica/storage.rs b/plugins/zenoh-plugin-storage-manager/src/replica/storage.rs index 9d12dbd599..f926417743 100644 --- a/plugins/zenoh-plugin-storage-manager/src/replica/storage.rs +++ b/plugins/zenoh-plugin-storage-manager/src/replica/storage.rs @@ -22,7 +22,7 @@ use async_trait::async_trait; use flume::{Receiver, Sender}; use futures::select; use zenoh::{ - core::Result as ZResult, + bytes::EncodingBuilderTrait, internal::{ bail, buffers::{SplitBuffer, ZBuf}, @@ -35,9 +35,10 @@ use zenoh::{ KeyExpr, OwnedKeyExpr, }, query::{ConsolidationMode, QueryTarget}, - sample::{EncodingBuilderTrait, Sample, SampleBuilder, SampleKind, TimestampBuilderTrait}, + sample::{Sample, SampleBuilder, SampleKind, TimestampBuilderTrait}, session::{Session, SessionDeclarations}, time::{new_timestamp, Timestamp, NTP64}, + Result as ZResult, }; use zenoh_backend_traits::{ config::{GarbageCollectionConfig, StorageConfig}, diff --git a/plugins/zenoh-plugin-storage-manager/src/storages_mgt.rs b/plugins/zenoh-plugin-storage-manager/src/storages_mgt.rs index 1670310fcf..27dbaf58f6 100644 --- a/plugins/zenoh-plugin-storage-manager/src/storages_mgt.rs +++ b/plugins/zenoh-plugin-storage-manager/src/storages_mgt.rs @@ -12,7 +12,7 @@ // ZettaScale Zenoh Team, // use async_std::sync::Arc; -use zenoh::{core::Result as ZResult, session::Session}; +use zenoh::{session::Session, Result as ZResult}; use zenoh_backend_traits::config::StorageConfig; pub use super::replica::{Replica, StorageService}; diff --git a/zenoh-ext/src/group.rs b/zenoh-ext/src/group.rs index 9120a323ae..4078db08dc 100644 --- a/zenoh-ext/src/group.rs +++ b/zenoh-ext/src/group.rs @@ -28,11 +28,11 @@ use serde::{Deserialize, Serialize}; use tokio::sync::Mutex; use zenoh::{ bytes::ZBytesReader, - core::Priority, internal::{bail, Condition, TaskController}, key_expr::{keyexpr, KeyExpr, OwnedKeyExpr}, prelude::*, - publisher::Publisher, + pubsub::Publisher, + qos::Priority, Session, }; diff --git a/zenoh-ext/src/lib.rs b/zenoh-ext/src/lib.rs index 9802d04e3a..659afa006d 100644 --- a/zenoh-ext/src/lib.rs +++ b/zenoh-ext/src/lib.rs @@ -22,7 +22,7 @@ pub use querying_subscriber::{ }; pub use session_ext::SessionExt; pub use subscriber_ext::{SubscriberBuilderExt, SubscriberForward}; -use zenoh::{core::Result as ZResult, internal::zerror, query::Reply, sample::Sample}; +use zenoh::{internal::zerror, query::Reply, sample::Sample, Result as ZResult}; /// The space of keys to use in a [`FetchingSubscriber`]. pub enum KeySpace { diff --git a/zenoh-ext/src/publication_cache.rs b/zenoh-ext/src/publication_cache.rs index b50f5affb4..09a21f2e16 100644 --- a/zenoh-ext/src/publication_cache.rs +++ b/zenoh-ext/src/publication_cache.rs @@ -19,16 +19,14 @@ use std::{ }; use zenoh::{ - core::{Error, Resolvable, Resolve, Result as ZResult}, internal::{bail, runtime::ZRuntime, ResolveFuture, TerminatableTask}, key_expr::{keyexpr, KeyExpr, OwnedKeyExpr}, prelude::Wait, - query::Query, - queryable::Queryable, + pubsub::FlumeSubscriber, + query::{Query, Queryable, ZenohParameters}, sample::{Locality, Sample}, - selector::ZenohParameters, session::{SessionDeclarations, SessionRef}, - subscriber::FlumeSubscriber, + Error, Resolvable, Resolve, Result as ZResult, }; /// The builder of PublicationCache, allowing to configure it. diff --git a/zenoh-ext/src/querying_subscriber.rs b/zenoh-ext/src/querying_subscriber.rs index e26de62ae0..baf486601d 100644 --- a/zenoh-ext/src/querying_subscriber.rs +++ b/zenoh-ext/src/querying_subscriber.rs @@ -21,17 +21,16 @@ use std::{ }; use zenoh::{ - core::{Error, Resolvable, Resolve, Result as ZResult}, handlers::{locked, DefaultHandler, IntoHandler}, internal::zlock, key_expr::KeyExpr, prelude::Wait, - query::{QueryConsolidation, QueryTarget, ReplyKeyExpr}, + pubsub::{Reliability, Subscriber}, + query::{QueryConsolidation, QueryTarget, ReplyKeyExpr, Selector}, sample::{Locality, Sample, SampleBuilder, TimestampBuilderTrait}, - selector::Selector, session::{SessionDeclarations, SessionRef}, - subscriber::{Reliability, Subscriber}, time::{new_timestamp, Timestamp}, + Error, Resolvable, Resolve, Result as ZResult, }; use crate::ExtractSample; diff --git a/zenoh-ext/src/session_ext.rs b/zenoh-ext/src/session_ext.rs index 2b9cda7cb0..606f00743b 100644 --- a/zenoh-ext/src/session_ext.rs +++ b/zenoh-ext/src/session_ext.rs @@ -14,9 +14,9 @@ use std::{convert::TryInto, sync::Arc}; use zenoh::{ - core::Error, key_expr::KeyExpr, session::{Session, SessionRef}, + Error, }; use super::PublicationCacheBuilder; diff --git a/zenoh-ext/src/subscriber_ext.rs b/zenoh-ext/src/subscriber_ext.rs index bac334035d..a7356f86dc 100644 --- a/zenoh-ext/src/subscriber_ext.rs +++ b/zenoh-ext/src/subscriber_ext.rs @@ -16,11 +16,11 @@ use std::time::Duration; use flume::r#async::RecvStream; use futures::stream::{Forward, Map}; use zenoh::{ - core::Result as ZResult, liveliness::LivelinessSubscriberBuilder, + pubsub::{Reliability, Subscriber, SubscriberBuilder}, query::{QueryConsolidation, QueryTarget, ReplyKeyExpr}, sample::{Locality, Sample}, - subscriber::{Reliability, Subscriber, SubscriberBuilder}, + Result as ZResult, }; use crate::{ @@ -42,7 +42,7 @@ where } } -/// Some extensions to the [`zenoh::subscriber::SubscriberBuilder`](zenoh::subscriber::SubscriberBuilder) +/// Some extensions to the [`zenoh::subscriber::SubscriberBuilder`](zenoh::pubsub::SubscriberBuilder) pub trait SubscriberBuilderExt<'a, 'b, Handler> { type KeySpace; diff --git a/zenoh/src/api/builders/publisher.rs b/zenoh/src/api/builders/publisher.rs index 380a9251d5..666b4378e0 100644 --- a/zenoh/src/api/builders/publisher.rs +++ b/zenoh/src/api/builders/publisher.rs @@ -50,13 +50,13 @@ pub struct PublicationBuilderPut { pub struct PublicationBuilderDelete; /// A builder for initializing [`Session::put`](crate::session::Session::put), [`Session::delete`](crate::session::Session::delete), -/// [`Publisher::put`](crate::publisher::Publisher::put), and [`Publisher::delete`](crate::publisher::Publisher::delete) operations. +/// [`Publisher::put`](crate::pubsub::Publisher::put), and [`Publisher::delete`](crate::pubsub::Publisher::delete) operations. /// /// # Examples /// ``` /// # #[tokio::main] /// # async fn main() { -/// use zenoh::{encoding::Encoding, prelude::*, publisher::CongestionControl}; +/// use zenoh::{bytes::Encoding, prelude::*, qos::CongestionControl}; /// /// let session = zenoh::open(zenoh::config::peer()).await.unwrap(); /// session @@ -220,7 +220,7 @@ impl IntoFuture for PublicationBuilder, PublicationBuil /// ``` /// # #[tokio::main] /// # async fn main() { -/// use zenoh::{prelude::*, publisher::CongestionControl}; +/// use zenoh::{prelude::*, qos::CongestionControl}; /// /// let session = zenoh::open(zenoh::config::peer()).await.unwrap(); /// let publisher = session diff --git a/zenoh/src/api/bytes.rs b/zenoh/src/api/bytes.rs index b1d1ff079f..572ac16cab 100644 --- a/zenoh/src/api/bytes.rs +++ b/zenoh/src/api/bytes.rs @@ -2959,6 +2959,7 @@ impl From> for ZBytes { } mod tests { + #[test] fn serializer() { use std::borrow::Cow; diff --git a/zenoh/src/api/encoding.rs b/zenoh/src/api/encoding.rs index 2b6cee2b23..7e86e9091a 100644 --- a/zenoh/src/api/encoding.rs +++ b/zenoh/src/api/encoding.rs @@ -37,7 +37,7 @@ use super::bytes::ZBytes; /// /// Create an [`Encoding`] from a string and viceversa. /// ``` -/// use zenoh::encoding::Encoding; +/// use zenoh::bytes::Encoding; /// /// let encoding: Encoding = "text/plain".into(); /// let text: String = encoding.clone().into(); @@ -49,7 +49,7 @@ use super::bytes::ZBytes; /// Since some encoding values are internally optimized by Zenoh, it's generally more efficient to use /// the defined constants and [`Cow`][std::borrow::Cow] conversion to obtain its string representation. /// ``` -/// use zenoh::encoding::Encoding; +/// use zenoh::bytes::Encoding; /// use std::borrow::Cow; /// /// // This allocates @@ -64,7 +64,7 @@ use super::bytes::ZBytes; /// The conventions is to use the `;` separator if an encoding is created from a string. /// Alternatively, [`with_schema()`](Encoding::with_schema) can be used to add a scheme to one of the associated constants. /// ``` -/// use zenoh::encoding::Encoding; +/// use zenoh::bytes::Encoding; /// /// let encoding1 = Encoding::from("text/plain;utf-8"); /// let encoding2 = Encoding::TEXT_PLAIN.with_schema("utf-8"); diff --git a/zenoh/src/api/key_expr.rs b/zenoh/src/api/key_expr.rs index c6ece3f129..50ce79180b 100644 --- a/zenoh/src/api/key_expr.rs +++ b/zenoh/src/api/key_expr.rs @@ -21,7 +21,7 @@ use std::{ use zenoh_core::{Resolvable, Wait}; use zenoh_keyexpr::{keyexpr, OwnedKeyExpr}; use zenoh_protocol::{ - core::{key_expr::canon::Canonizable, ExprId, WireExpr}, + core::{key_expr::canon::Canonize, ExprId, WireExpr}, network::{declare, DeclareBody, Mapping, UndeclareKeyExpr}, }; use zenoh_result::ZResult; @@ -145,7 +145,7 @@ impl<'a> KeyExpr<'a> { pub fn autocanonize(mut t: T) -> Result where Self: TryFrom, - T: Canonizable, + T: Canonize, { t.canonize(); Self::new(t) diff --git a/zenoh/src/api/query.rs b/zenoh/src/api/query.rs index e9598a0064..8cf62344f2 100644 --- a/zenoh/src/api/query.rs +++ b/zenoh/src/api/query.rs @@ -42,7 +42,7 @@ use super::{ value::Value, }; -/// The [`Queryable`](crate::queryable::Queryable)s that should be target of a [`get`](Session::get). +/// The [`Queryable`](crate::query::Queryable)s that should be target of a [`get`](Session::get). pub type QueryTarget = zenoh_protocol::network::request::ext::TargetType; /// The kind of consolidation. diff --git a/zenoh/src/api/session.rs b/zenoh/src/api/session.rs index 3125e90225..f97e5d7541 100644 --- a/zenoh/src/api/session.rs +++ b/zenoh/src/api/session.rs @@ -515,8 +515,8 @@ impl Session { /// pointer to it (`Arc`). This is equivalent to `Arc::new(session)`. /// /// This is useful to share ownership of the `Session` between several threads - /// and tasks. It also allows to create [`Subscriber`](crate::subscriber::Subscriber) and - /// [`Queryable`](crate::queryable::Queryable) with static lifetime that can be moved to several + /// and tasks. It also allows to create [`Subscriber`](crate::pubsub::Subscriber) and + /// [`Queryable`](crate::query::Queryable) with static lifetime that can be moved to several /// threads and tasks /// /// Note: the given zenoh `Session` will be closed when the last reference to @@ -548,7 +548,7 @@ impl Session { /// the program's life. Dropping the returned reference will cause a memory /// leak. /// - /// This is useful to move entities (like [`Subscriber`](crate::subscriber::Subscriber)) which + /// This is useful to move entities (like [`Subscriber`](crate::pubsub::Subscriber)) which /// lifetimes are bound to the session lifetime in several threads or tasks. /// /// Note: the given zenoh `Session` cannot be closed any more. At process @@ -793,7 +793,7 @@ impl Session { /// ``` /// # #[tokio::main] /// # async fn main() { - /// use zenoh::{encoding::Encoding, prelude::*}; + /// use zenoh::{bytes::Encoding, prelude::*}; /// /// let session = zenoh::open(zenoh::config::peer()).await.unwrap(); /// session @@ -1979,7 +1979,7 @@ impl Session { } impl<'s> SessionDeclarations<'s, 'static> for Arc { - /// Create a [`Subscriber`](crate::subscriber::Subscriber) for the given key expression. + /// Create a [`Subscriber`](crate::pubsub::Subscriber) for the given key expression. /// /// # Arguments /// @@ -2019,12 +2019,12 @@ impl<'s> SessionDeclarations<'s, 'static> for Arc { } } - /// Create a [`Queryable`](crate::queryable::Queryable) for the given key expression. + /// Create a [`Queryable`](crate::query::Queryable) for the given key expression. /// /// # Arguments /// /// * `key_expr` - The key expression matching the queries the - /// [`Queryable`](crate::queryable::Queryable) will reply to + /// [`Queryable`](crate::query::Queryable) will reply to /// /// # Examples /// ```no_run @@ -2063,7 +2063,7 @@ impl<'s> SessionDeclarations<'s, 'static> for Arc { } } - /// Create a [`Publisher`](crate::publisher::Publisher) for the given key expression. + /// Create a [`Publisher`](crate::pubsub::Publisher) for the given key expression. /// /// # Arguments /// @@ -2620,8 +2620,8 @@ impl fmt::Debug for Session { /// Functions to create zenoh entities /// /// This trait contains functions to create zenoh entities like -/// [`Subscriber`](crate::subscriber::Subscriber), and -/// [`Queryable`](crate::queryable::Queryable) +/// [`Subscriber`](crate::pubsub::Subscriber), and +/// [`Queryable`](crate::query::Queryable) /// /// This trait is implemented by [`Session`](crate::session::Session) itself and /// by wrappers [`SessionRef`](crate::session::SessionRef) and [`Arc`](std::sync::Arc) @@ -2644,7 +2644,7 @@ impl fmt::Debug for Session { /// # } /// ``` pub trait SessionDeclarations<'s, 'a> { - /// Create a [`Subscriber`](crate::subscriber::Subscriber) for the given key expression. + /// Create a [`Subscriber`](crate::pubsub::Subscriber) for the given key expression. /// /// # Arguments /// @@ -2675,12 +2675,12 @@ pub trait SessionDeclarations<'s, 'a> { TryIntoKeyExpr: TryInto>, >>::Error: Into; - /// Create a [`Queryable`](crate::queryable::Queryable) for the given key expression. + /// Create a [`Queryable`](crate::query::Queryable) for the given key expression. /// /// # Arguments /// /// * `key_expr` - The key expression matching the queries the - /// [`Queryable`](crate::queryable::Queryable) will reply to + /// [`Queryable`](crate::query::Queryable) will reply to /// /// # Examples /// ```no_run @@ -2710,7 +2710,7 @@ pub trait SessionDeclarations<'s, 'a> { TryIntoKeyExpr: TryInto>, >>::Error: Into; - /// Create a [`Publisher`](crate::publisher::Publisher) for the given key expression. + /// Create a [`Publisher`](crate::pubsub::Publisher) for the given key expression. /// /// # Arguments /// @@ -2826,7 +2826,7 @@ impl crate::net::primitives::EPrimitives for Session { /// # #[tokio::main] /// # async fn main() { /// use std::str::FromStr; -/// use zenoh::{info::ZenohId, prelude::*}; +/// use zenoh::{session::ZenohId, prelude::*}; /// /// let mut config = zenoh::config::peer(); /// config.set_id(ZenohId::from_str("221b72df20924c15b8794c6bdb471150").unwrap()); diff --git a/zenoh/src/lib.rs b/zenoh/src/lib.rs index 1a01ff922d..77db49f525 100644 --- a/zenoh/src/lib.rs +++ b/zenoh/src/lib.rs @@ -111,34 +111,25 @@ pub const FEATURES: &str = zenoh_util::concat_enabled_features!( ] ); +#[allow(deprecated)] +pub use zenoh_core::{AsyncResolve, SyncResolve}; +pub use zenoh_core::{Resolvable, Resolve, Wait}; +/// A zenoh error. +pub use zenoh_result::Error; +/// A zenoh result. +pub use zenoh_result::ZResult as Result; #[doc(inline)] -pub use { - crate::{ - config::Config, - core::{Error, Result}, - scouting::scout, - session::{open, Session}, - }, - zenoh_util::{init_log_from_env_or, try_init_log_from_env}, +pub use zenoh_util::{init_log_from_env_or, try_init_log_from_env}; + +#[doc(inline)] +pub use crate::{ + config::Config, + scouting::scout, + session::{open, Session}, }; pub mod prelude; -/// Zenoh core types -pub mod core { - #[allow(deprecated)] - pub use zenoh_core::{AsyncResolve, SyncResolve}; - pub use zenoh_core::{Resolvable, Resolve, Wait}; - pub use zenoh_result::ErrNo; - /// A zenoh error. - pub use zenoh_result::Error; - /// A zenoh result. - pub use zenoh_result::ZResult as Result; - - /// Zenoh message priority - pub use crate::api::publisher::Priority; -} - /// [Key expression](https://github.com/eclipse-zenoh/roadmap/blob/main/rfcs/ALL/Key%20Expressions.md) are Zenoh's address space. /// /// In Zenoh, operations are performed on keys. To allow addressing multiple keys with a single operation, we use Key Expressions (KE). @@ -180,7 +171,7 @@ pub mod key_expr { } #[zenoh_macros::unstable] pub use zenoh_keyexpr::SetIntersectionLevel; - pub use zenoh_keyexpr::{keyexpr, OwnedKeyExpr}; + pub use zenoh_keyexpr::{canon::Canonize, keyexpr, OwnedKeyExpr}; pub use crate::api::key_expr::{KeyExpr, KeyExprUndeclaration}; // keyexpr format macro support @@ -196,25 +187,20 @@ pub mod key_expr { /// Zenoh [`Session`] and associated types pub mod session { + #[zenoh_macros::unstable] + pub use zenoh_config::wrappers::{EntityGlobalId, ZenohId}; + pub use zenoh_protocol::core::EntityId; + #[zenoh_macros::internal] pub use crate::api::session::{init, InitBuilder}; pub use crate::api::{ builders::publisher::{SessionDeleteBuilder, SessionPutBuilder}, + info::{PeersZenohIdBuilder, RoutersZenohIdBuilder, SessionInfo, ZenohIdBuilder}, query::SessionGetBuilder, session::{open, OpenBuilder, Session, SessionDeclarations, SessionRef, Undeclarable}, }; } -/// Tools to access information about the current zenoh [`Session`]. -pub mod info { - pub use zenoh_config::wrappers::{EntityGlobalId, ZenohId}; - pub use zenoh_protocol::core::EntityId; - - pub use crate::api::info::{ - PeersZenohIdBuilder, RoutersZenohIdBuilder, SessionInfo, ZenohIdBuilder, - }; -} - /// Sample primitives pub mod sample { #[zenoh_macros::unstable] @@ -223,93 +209,64 @@ pub mod sample { pub use crate::api::sample::SourceInfo; pub use crate::api::{ builders::sample::{ - EncodingBuilderTrait, QoSBuilderTrait, SampleBuilder, SampleBuilderAny, - SampleBuilderDelete, SampleBuilderPut, SampleBuilderTrait, TimestampBuilderTrait, + SampleBuilder, SampleBuilderAny, SampleBuilderDelete, SampleBuilderPut, + SampleBuilderTrait, TimestampBuilderTrait, }, sample::{Sample, SampleFields, SampleKind, SourceSn}, }; } -/// Encoding support -pub mod encoding { - pub use crate::api::encoding::Encoding; -} - /// Payload primitives pub mod bytes { - pub use crate::api::bytes::{ - Deserialize, OptionZBytes, Serialize, ZBytes, ZBytesIterator, ZBytesReader, ZBytesWriter, - ZDeserializeError, ZSerde, + pub use crate::api::{ + builders::sample::EncodingBuilderTrait, + bytes::{ + Deserialize, OptionZBytes, Serialize, ZBytes, ZBytesIterator, ZBytesReader, + ZBytesWriter, ZDeserializeError, ZSerde, + }, + encoding::Encoding, }; } -/// [Selector](https://github.com/eclipse-zenoh/roadmap/tree/main/rfcs/ALL/Selectors) to issue queries -pub mod selector { - pub use zenoh_protocol::core::Parameters; - #[zenoh_macros::unstable] - pub use zenoh_util::time_range::{TimeBound, TimeExpr, TimeRange}; - - pub use crate::api::selector::Selector; - #[zenoh_macros::unstable] - pub use crate::api::selector::ZenohParameters; -} - -/// Subscribing primitives -pub mod subscriber { - /// The kind of reliability. +/// Pub/sub primitives +pub mod pubsub { pub use zenoh_protocol::core::Reliability; - pub use crate::api::subscriber::{FlumeSubscriber, Subscriber, SubscriberBuilder}; -} - -/// Publishing primitives -pub mod publisher { - pub use zenoh_protocol::core::CongestionControl; - - #[zenoh_macros::unstable] - pub use crate::api::publisher::MatchingListener; - #[zenoh_macros::unstable] - pub use crate::api::publisher::MatchingListenerBuilder; #[zenoh_macros::unstable] - pub use crate::api::publisher::MatchingListenerUndeclaration; - #[zenoh_macros::unstable] - pub use crate::api::publisher::MatchingStatus; - #[zenoh_macros::unstable] - pub use crate::api::publisher::PublisherDeclarations; - #[zenoh_macros::unstable] - pub use crate::api::publisher::PublisherRef; + pub use crate::api::publisher::{ + MatchingListener, MatchingListenerBuilder, MatchingListenerUndeclaration, MatchingStatus, + PublisherDeclarations, PublisherRef, + }; pub use crate::api::{ builders::publisher::{ PublicationBuilder, PublicationBuilderDelete, PublicationBuilderPut, PublisherBuilder, PublisherDeleteBuilder, PublisherPutBuilder, }, publisher::{Publisher, PublisherUndeclaration}, + subscriber::{FlumeSubscriber, Subscriber, SubscriberBuilder}, }; } -/// Get operation primitives -pub mod querier { - // Later the `Querier` with `get`` operation will be added here, in addition to `Session::get`, - // similarly to the `Publisher` with `put` operation and `Session::put` -} - -/// Query and Reply primitives +/// Query/reply primitives pub mod query { + pub use zenoh_protocol::core::Parameters; #[zenoh_macros::unstable] - pub use crate::api::query::ReplyKeyExpr; + pub use zenoh_util::time_range::{TimeBound, TimeExpr, TimeRange}; + #[zenoh_macros::internal] pub use crate::api::queryable::ReplySample; + #[zenoh_macros::unstable] + pub use crate::api::{query::ReplyKeyExpr, selector::ZenohParameters}; pub use crate::api::{ query::{ConsolidationMode, QueryConsolidation, QueryTarget, Reply, ReplyError}, - queryable::{Query, ReplyBuilder, ReplyBuilderDelete, ReplyBuilderPut, ReplyErrBuilder}, + queryable::{ + Query, Queryable, QueryableBuilder, QueryableUndeclaration, ReplyBuilder, + ReplyBuilderDelete, ReplyBuilderPut, ReplyErrBuilder, + }, + selector::Selector, }; } -/// Queryable primitives -pub mod queryable { - pub use crate::api::queryable::{Queryable, QueryableBuilder, QueryableUndeclaration}; -} - /// Callback handler trait pub mod handlers { pub use crate::api::handlers::{ @@ -318,6 +275,13 @@ pub mod handlers { }; } +/// Quality of service primitives +pub mod qos { + pub use zenoh_protocol::core::CongestionControl; + + pub use crate::api::{builders::sample::QoSBuilderTrait, publisher::Priority}; +} + /// Scouting primitives pub mod scouting { pub use zenoh_config::wrappers::Hello; @@ -455,6 +419,8 @@ pub mod internal { }; } + pub use zenoh_result::ErrNo; + pub use crate::api::value::Value; } diff --git a/zenoh/src/net/runtime/adminspace.rs b/zenoh/src/net/runtime/adminspace.rs index eb010f9037..26807e8907 100644 --- a/zenoh/src/net/runtime/adminspace.rs +++ b/zenoh/src/net/runtime/adminspace.rs @@ -50,7 +50,7 @@ use crate::{ queryable::{Query, QueryInner}, value::Value, }, - encoding::Encoding, + bytes::Encoding, net::primitives::Primitives, }; diff --git a/zenoh/src/prelude.rs b/zenoh/src/prelude.rs index 63cb397e38..373d56c65a 100644 --- a/zenoh/src/prelude.rs +++ b/zenoh/src/prelude.rs @@ -37,29 +37,29 @@ mod _prelude { session::{SessionDeclarations, Undeclarable}, }, config::ValidatedMap, - core::{Error as ZError, Resolvable, Resolve, Result as ZResult}, + Error as ZError, Resolvable, Resolve, Result as ZResult, }; } pub use _prelude::*; #[allow(deprecated)] -pub use crate::core::AsyncResolve; +pub use crate::AsyncResolve; #[allow(deprecated)] -pub use crate::core::SyncResolve; -pub use crate::core::Wait; +pub use crate::SyncResolve; +pub use crate::Wait; /// Prelude to import when using Zenoh's sync API. #[deprecated(since = "1.0.0", note = "use `zenoh::prelude` instead")] pub mod sync { pub use super::_prelude::*; #[allow(deprecated)] - pub use crate::core::SyncResolve; + pub use crate::SyncResolve; } /// Prelude to import when using Zenoh's async API. #[deprecated(since = "1.0.0", note = "use `zenoh::prelude` instead")] pub mod r#async { pub use super::_prelude::*; #[allow(deprecated)] - pub use crate::core::AsyncResolve; + pub use crate::AsyncResolve; } diff --git a/zenoh/tests/qos.rs b/zenoh/tests/qos.rs index 77e7e43a10..8d7d7e7322 100644 --- a/zenoh/tests/qos.rs +++ b/zenoh/tests/qos.rs @@ -13,7 +13,11 @@ // use std::time::Duration; -use zenoh::{core::Priority, encoding::Encoding, prelude::*, publisher::CongestionControl}; +use zenoh::{ + bytes::Encoding, + prelude::*, + qos::{CongestionControl, Priority}, +}; use zenoh_core::ztimeout; const TIMEOUT: Duration = Duration::from_secs(60); diff --git a/zenoh/tests/routing.rs b/zenoh/tests/routing.rs index 7f61f459d6..2256455be5 100644 --- a/zenoh/tests/routing.rs +++ b/zenoh/tests/routing.rs @@ -24,7 +24,7 @@ use tokio_util::{sync::CancellationToken, task::TaskTracker}; use zenoh::{ config::{ModeDependentValue, WhatAmI, WhatAmIMatcher}, prelude::*, - publisher::CongestionControl, + qos::CongestionControl, Config, Result, Session, }; use zenoh_core::ztimeout; diff --git a/zenoh/tests/session.rs b/zenoh/tests/session.rs index 25adaf42e0..859ff43f7d 100644 --- a/zenoh/tests/session.rs +++ b/zenoh/tests/session.rs @@ -22,8 +22,8 @@ use std::{ #[cfg(feature = "internal")] use zenoh::internal::runtime::{Runtime, RuntimeBuilder}; use zenoh::{ - config, key_expr::KeyExpr, prelude::*, publisher::CongestionControl, sample::SampleKind, - subscriber::Reliability, Session, + config, key_expr::KeyExpr, prelude::*, pubsub::Reliability, qos::CongestionControl, + sample::SampleKind, Session, }; use zenoh_core::ztimeout; diff --git a/zenoh/tests/shm.rs b/zenoh/tests/shm.rs index 43205e8e47..33665913ed 100644 --- a/zenoh/tests/shm.rs +++ b/zenoh/tests/shm.rs @@ -23,11 +23,11 @@ use std::{ use zenoh::{ config, prelude::*, - publisher::CongestionControl, + pubsub::Reliability, + qos::CongestionControl, shm::{ BlockOn, GarbageCollect, PosixShmProviderBackend, ShmProviderBuilder, POSIX_PROTOCOL_ID, }, - subscriber::Reliability, Session, }; use zenoh_core::ztimeout; diff --git a/zenoh/tests/unicity.rs b/zenoh/tests/unicity.rs index 6ce01ff2bf..a89ddb4b04 100644 --- a/zenoh/tests/unicity.rs +++ b/zenoh/tests/unicity.rs @@ -25,7 +25,7 @@ use zenoh::{ config::{EndPoint, WhatAmI}, key_expr::KeyExpr, prelude::*, - publisher::CongestionControl, + qos::CongestionControl, Session, }; use zenoh_core::ztimeout; diff --git a/zenohd/src/main.rs b/zenohd/src/main.rs index 81ca715f44..e69dd3d263 100644 --- a/zenohd/src/main.rs +++ b/zenohd/src/main.rs @@ -19,7 +19,7 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilte use url::Url; use zenoh::{ config::{Config, EndPoint, ModeDependentValue, PermissionsConf, ValidatedMap, WhatAmI}, - core::Result, + Result, }; #[cfg(feature = "loki")]