Skip to content

Commit

Permalink
separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Mar 28, 2024
1 parent 48cb96b commit ddb93a2
Show file tree
Hide file tree
Showing 26 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion examples/examples/z_ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::time::{Duration, Instant};
use zenoh::config::Config;
use zenoh::prelude::sync::*;
use zenoh::publication::CongestionControl;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh_examples::CommonArgs;

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::sync::*;
use zenoh::publication::CongestionControl;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh_examples::CommonArgs;

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_pub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use clap::Parser;
use std::time::Duration;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh::sample_builder::SampleBuilderTrait;
use zenoh::sample::builder::SampleBuilderTrait;
use zenoh_examples::CommonArgs;

#[async_std::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_pub_shm_thr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh::publication::CongestionControl;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh::shm::SharedMemoryManager;
use zenoh_examples::CommonArgs;

Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_pub_thr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use clap::Parser;
use std::convert::TryInto;
use zenoh::prelude::sync::*;
use zenoh::publication::CongestionControl;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh_examples::CommonArgs;

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion plugins/zenoh-plugin-rest/examples/z_serve_sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use clap::{arg, Command};
use std::time::Duration;
use zenoh::prelude::r#async::*;
use zenoh::publication::CongestionControl;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh::{config::Config, key_expr::keyexpr};

const HTML: &str = r#"
Expand Down
2 changes: 1 addition & 1 deletion plugins/zenoh-plugin-rest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ 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::sample::builder::ValueBuilderTrait;
use zenoh::selector::TIME_RANGE_KEY;
use zenoh::Session;
use zenoh_plugin_trait::{plugin_long_version, plugin_version, Plugin, PluginControl};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use std::str;
use std::str::FromStr;
use zenoh::payload::StringOrBase64;
use zenoh::prelude::r#async::*;
use zenoh::sample_builder::TimestampBuilderTrait;
use zenoh::sample_builder::ValueBuilderTrait;
use zenoh::sample::builder::TimestampBuilderTrait;
use zenoh::sample::builder::ValueBuilderTrait;
use zenoh::time::Timestamp;
use zenoh::Session;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::str;
use zenoh::key_expr::{KeyExpr, OwnedKeyExpr};
use zenoh::payload::StringOrBase64;
use zenoh::prelude::r#async::*;
use zenoh::sample_builder::{PutSampleBuilder, TimestampBuilderTrait, ValueBuilderTrait};
use zenoh::sample::builder::{PutSampleBuilder, TimestampBuilderTrait, ValueBuilderTrait};
use zenoh::time::Timestamp;
use zenoh::Session;

Expand Down
4 changes: 2 additions & 2 deletions plugins/zenoh-plugin-storage-manager/src/replica/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ use zenoh::buffers::ZBuf;
use zenoh::key_expr::KeyExpr;
use zenoh::prelude::r#async::*;
use zenoh::query::{ConsolidationMode, QueryTarget};
use zenoh::sample::{Sample, SampleKind};
use zenoh::sample_builder::{
use zenoh::sample::builder::{
DeleteSampleBuilder, PutSampleBuilder, SampleBuilder, TimestampBuilderTrait, ValueBuilderTrait,
};
use zenoh::sample::{Sample, SampleKind};
use zenoh::time::{new_reception_timestamp, Timestamp, NTP64};
use zenoh::value::Value;
use zenoh::{Result as ZResult, Session, SessionDeclarations};
Expand Down
2 changes: 1 addition & 1 deletion zenoh-ext/src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use zenoh::payload::PayloadReader;
use zenoh::prelude::r#async::*;
use zenoh::publication::Publisher;
use zenoh::query::ConsolidationMode;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh::Error as ZError;
use zenoh::Result as ZResult;
use zenoh::Session;
Expand Down
2 changes: 1 addition & 1 deletion zenoh-ext/src/querying_subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::time::Duration;
use zenoh::handlers::{locked, DefaultHandler};
use zenoh::prelude::r#async::*;
use zenoh::query::{QueryConsolidation, QueryTarget, ReplyKeyExpr};
use zenoh::sample_builder::{SampleBuilder, TimestampBuilderTrait};
use zenoh::sample::builder::{SampleBuilder, TimestampBuilderTrait};
use zenoh::subscriber::{Reliability, Subscriber};
use zenoh::time::{new_reception_timestamp, Timestamp};
use zenoh::Result as ZResult;
Expand Down
1 change: 0 additions & 1 deletion zenoh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ pub mod publication;
pub mod query;
pub mod queryable;
pub mod sample;
pub mod sample_builder;
pub mod subscriber;
pub mod value;
#[cfg(feature = "shared-memory")]
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/net/runtime/adminspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::plugins::sealed::{self as plugins};
use crate::prelude::sync::SyncResolve;
use crate::queryable::Query;
use crate::queryable::QueryInner;
use crate::sample_builder::ValueBuilderTrait;
use crate::sample::builder::ValueBuilderTrait;
use crate::value::Value;
use async_std::task;
use log::{error, trace};
Expand Down
4 changes: 4 additions & 0 deletions zenoh/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ pub(crate) mod common {
#[zenoh_macros::unstable]
pub use crate::publication::PublisherDeclarations;
pub use zenoh_protocol::core::{CongestionControl, Reliability, WhatAmI};

pub use crate::sample::builder::{
QoSBuilderTrait, SampleBuilderTrait, TimestampBuilderTrait, ValueBuilderTrait,
};
}

/// Prelude to import when using Zenoh's sync API.
Expand Down
10 changes: 5 additions & 5 deletions zenoh/src/publication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
//! Publishing primitives.
use crate::net::primitives::Primitives;
use crate::prelude::*;
use crate::sample::builder::{
QoSBuilderTrait, SampleBuilderTrait, TimestampBuilderTrait, ValueBuilderTrait,
};
#[zenoh_macros::unstable]
use crate::sample::Attachment;
use crate::sample::{DataInfo, QoS, Sample, SampleFields, SampleKind};
use crate::sample_builder::{
QoSBuilderTrait, SampleBuilderTrait, TimestampBuilderTrait, ValueBuilderTrait,
};
use crate::SessionRef;
use crate::Undeclarable;
#[cfg(feature = "unstable")]
Expand Down Expand Up @@ -73,7 +73,7 @@ pub struct DeleteBuilder<'a, 'b> {
/// # async_std::task::block_on(async {
/// use zenoh::prelude::r#async::*;
/// use zenoh::publication::CongestionControl;
/// use zenoh::sample_builder::{ValueBuilderTrait, QoSBuilderTrait};
/// use zenoh::sample::builder::{ValueBuilderTrait, QoSBuilderTrait};
///
/// let session = zenoh::open(config::peer()).res().await.unwrap();
/// session
Expand Down Expand Up @@ -932,7 +932,7 @@ impl<'a> Sink<Sample> for Publisher<'a> {
/// # async_std::task::block_on(async {
/// use zenoh::prelude::r#async::*;
/// use zenoh::publication::CongestionControl;
/// use zenoh::sample_builder::QoSBuilderTrait;
/// use zenoh::sample::builder::QoSBuilderTrait;
///
/// let session = zenoh::open(config::peer()).res().await.unwrap();
/// let publisher = session
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
//! 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;
use crate::sample_builder::{QoSBuilderTrait, SampleBuilderTrait, ValueBuilderTrait};
use crate::Session;
use std::collections::HashMap;
use std::future::Ready;
Expand Down
4 changes: 2 additions & 2 deletions zenoh/src/queryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ use crate::encoding::Encoding;
use crate::handlers::{locked, DefaultHandler};
use crate::net::primitives::Primitives;
use crate::prelude::*;
use crate::sample::SourceInfo;
use crate::sample_builder::{
use crate::sample::builder::{
DeleteSampleBuilder, PutSampleBuilder, QoSBuilderTrait, SampleBuilder, SampleBuilderTrait,
TimestampBuilderTrait, ValueBuilderTrait,
};
use crate::sample::SourceInfo;
use crate::Id;
use crate::SessionRef;
use crate::Undeclarable;
Expand Down
4 changes: 3 additions & 1 deletion zenoh/src/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use crate::encoding::Encoding;
use crate::payload::Payload;
use crate::prelude::{KeyExpr, Value};
use crate::sample_builder::{QoSBuilderTrait, ValueBuilderTrait};
use crate::sample::builder::{QoSBuilderTrait, ValueBuilderTrait};
use crate::time::Timestamp;
use crate::Priority;
#[zenoh_macros::unstable]
Expand All @@ -26,6 +26,8 @@ use zenoh_protocol::core::EntityGlobalId;
use zenoh_protocol::network::declare::ext::QoSType;
use zenoh_protocol::{core::CongestionControl, zenoh};

pub mod builder;

pub type SourceSn = u64;

/// The locality of samples to be received by subscribers or targeted by publishers.
Expand Down
3 changes: 1 addition & 2 deletions zenoh/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,7 @@ impl Session {
/// ```
/// # async_std::task::block_on(async {
/// use zenoh::prelude::r#async::*;
/// use zenoh::sample_builder::SampleBuilderTrait;
/// use zenoh::sample_builder::ValueBuilderTrait;
/// use zenoh::prelude::*;
///
/// let session = zenoh::open(config::peer()).res().await.unwrap();
/// session
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//

//! Value primitives.
use crate::{encoding::Encoding, payload::Payload, sample_builder::ValueBuilderTrait};
use crate::{encoding::Encoding, payload::Payload, sample::builder::ValueBuilderTrait};

/// A zenoh [`Value`] contains a `payload` and an [`Encoding`] that indicates how the [`Payload`] should be interpreted.
#[non_exhaustive]
Expand Down
4 changes: 2 additions & 2 deletions zenoh/tests/attachments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#[cfg(feature = "unstable")]
#[test]
fn pubsub() {
use zenoh::{prelude::sync::*, sample_builder::SampleBuilderTrait};
use zenoh::{prelude::sync::*, sample::builder::SampleBuilderTrait};

let zenoh = zenoh::open(Config::default()).res().unwrap();
let _sub = zenoh
Expand Down Expand Up @@ -61,7 +61,7 @@ fn pubsub() {
#[cfg(feature = "unstable")]
#[test]
fn queries() {
use zenoh::{prelude::sync::*, sample::Attachment, sample_builder::SampleBuilderTrait};
use zenoh::{prelude::sync::*, sample::builder::SampleBuilderTrait, sample::Attachment};

let zenoh = zenoh::open(Config::default()).res().unwrap();
let _sub = zenoh
Expand Down
2 changes: 1 addition & 1 deletion zenoh/tests/qos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use async_std::prelude::FutureExt;
use async_std::task;
use std::time::Duration;
use zenoh::prelude::r#async::*;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh::{publication::Priority, SessionDeclarations};
use zenoh_core::zasync_executor_init;

Expand Down
2 changes: 1 addition & 1 deletion zenoh/tests/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::sync::{atomic::AtomicUsize, Arc};
use std::time::Duration;
use zenoh::config::{Config, ModeDependentValue};
use zenoh::prelude::r#async::*;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh::{value::Value, Result};
use zenoh_core::zasync_executor_init;
use zenoh_protocol::core::{WhatAmI, WhatAmIMatcher};
Expand Down
2 changes: 1 addition & 1 deletion zenoh/tests/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::time::Duration;
use zenoh::prelude::r#async::*;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh_core::zasync_executor_init;

const TIMEOUT: Duration = Duration::from_secs(60);
Expand Down
2 changes: 1 addition & 1 deletion zenoh/tests/unicity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::time::Duration;
use zenoh::prelude::r#async::*;
use zenoh::sample_builder::QoSBuilderTrait;
use zenoh::sample::builder::QoSBuilderTrait;
use zenoh_core::zasync_executor_init;

const TIMEOUT: Duration = Duration::from_secs(60);
Expand Down

0 comments on commit ddb93a2

Please sign in to comment.