Skip to content

Commit

Permalink
handlers to api
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Apr 3, 2024
1 parent 7bc561d commit 98ea8ae
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions zenoh/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

pub(crate) mod builders;
pub(crate) mod encoding;
pub(crate) mod handlers;
pub(crate) mod info;
pub(crate) mod key_expr;
pub(crate) mod payload;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions zenoh/src/api/publication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::net::primitives::Primitives;
use crate::prelude::*;
#[cfg(feature = "unstable")]
use crate::{
handlers::{Callback, DefaultHandler, IntoHandler},
api::handlers::{Callback, DefaultHandler, IntoHandler},
Id,
};
use std::future::Ready;
Expand Down Expand Up @@ -1238,7 +1238,7 @@ impl<'a> MatchingListenerBuilder<'a, DefaultHandler> {
where
CallbackMut: FnMut(MatchingStatus) + Send + Sync + 'static,
{
self.callback(crate::handlers::locked(callback))
self.callback(crate::api::handlers::locked(callback))
}

/// Receive the MatchingStatuses for this listener with a [`Handler`](crate::prelude::IntoHandler).
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/api/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
//

//! Query primitives.
use crate::api::handlers::{locked, Callback, DefaultHandler};
#[zenoh_macros::unstable]
use crate::api::sample::Attachment;
use crate::api::sample::QoSBuilder;
use crate::handlers::{locked, Callback, DefaultHandler};
use crate::prelude::*;
use crate::Session;
use std::collections::HashMap;
Expand Down
4 changes: 2 additions & 2 deletions zenoh/src/api/queryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
//! Queryable primitives.
use crate::api::builders::sample::SampleBuilder;
use crate::api::encoding::Encoding;
use crate::api::handlers::{locked, DefaultHandler};
use crate::api::sample::{QoSBuilder, SourceInfo};
use crate::api::session::SessionRef;
use crate::api::session::Undeclarable;
use crate::encoding::Encoding;
use crate::handlers::{locked, DefaultHandler};
use crate::net::primitives::Primitives;
use crate::prelude::*;
use crate::Id;
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/api/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//
use crate::admin;
use crate::api::encoding::Encoding;
use crate::api::handlers::{Callback, DefaultHandler};
use crate::api::info::SessionInfo;
use crate::api::key_expr::KeyExpr;
use crate::api::key_expr::KeyExprInner;
Expand Down Expand Up @@ -40,7 +41,6 @@ use crate::api::subscriber::SubscriberState;
use crate::api::value::Value;
use crate::config::Config;
use crate::config::Notifier;
use crate::handlers::{Callback, DefaultHandler};
#[zenoh_macros::unstable]
use crate::liveliness::{Liveliness, LivelinessTokenState};
use crate::net::primitives::Primitives;
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/api/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
//

//! Subscribing primitives.
use crate::api::handlers::{locked, Callback, DefaultHandler, IntoHandler};
use crate::api::key_expr::KeyExpr;
use crate::api::sample::Sample;
use crate::api::session::Undeclarable;
use crate::handlers::{locked, Callback, DefaultHandler, IntoHandler};
use crate::prelude::Locality;
use crate::Id;
use crate::{api::session::SessionRef, Result as ZResult};
Expand Down
10 changes: 8 additions & 2 deletions zenoh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ extern crate zenoh_result;

pub(crate) type Id = u32;

use api::handlers::DefaultHandler;
use git_version::git_version;
use handlers::DefaultHandler;
#[cfg(feature = "unstable")]
use prelude::*;
use scouting::ScoutBuilder;
Expand Down Expand Up @@ -208,6 +208,13 @@ pub mod queryable {
pub use crate::api::queryable::QueryableBuilder;
}

pub mod handlers {
pub use crate::api::handlers::locked;
pub use crate::api::handlers::DefaultHandler;
pub use crate::api::handlers::IntoHandler;
pub use crate::api::handlers::RingBuffer;
}

mod admin;
#[macro_use]

Expand All @@ -216,7 +223,6 @@ pub(crate) mod net;
pub use net::runtime;
#[deprecated = "This module is now a separate crate. Use the crate directly for shorter compile-times"]
pub use zenoh_config as config;
pub mod handlers;
#[cfg(feature = "unstable")]
pub mod liveliness;
pub mod plugins;
Expand Down
4 changes: 2 additions & 2 deletions zenoh/src/liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use crate::{api::query::Reply, Id};
#[zenoh_macros::unstable]
use {
crate::{
api::handlers::locked,
api::handlers::DefaultHandler,
api::session::SessionRef,
api::session::Undeclarable,
api::subscriber::{Subscriber, SubscriberInner},
handlers::locked,
handlers::DefaultHandler,
prelude::*,
},
std::convert::TryInto,
Expand Down
3 changes: 1 addition & 2 deletions zenoh/src/scouting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use crate::handlers::{locked, Callback, DefaultHandler};
use crate::api::handlers::{locked, Callback, DefaultHandler};
use crate::net::runtime::{orchestrator::Loop, Runtime};

use futures::StreamExt;
use std::{fmt, future::Ready, net::SocketAddr, ops::Deref};
use tokio::net::UdpSocket;
Expand Down

0 comments on commit 98ea8ae

Please sign in to comment.