Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: implement missing fmt::Debug for all public types #968

Open
wants to merge 1 commit into
base: dev/1.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zenoh/src/handlers/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl<T: Send + 'static> IntoHandler<'static, T> for (flume::Sender<T>, flume::Re
/// - `callback` will never be called once `drop` has started.
/// - `drop` will only be called **once**, and **after every** `callback` has ended.
/// - The two previous guarantees imply that `call` and `drop` are never called concurrently.
#[derive(Debug)]
pub struct CallbackDrop<Callback, DropFn>
where
DropFn: FnMut() + Send + Sync + 'static,
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/handlers/fifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use super::{callback::Callback, Dyn, IntoHandler, API_DATA_RECEPTION_CHANNEL_SIZ

/// The default handler in Zenoh is a FIFO queue.

#[derive(Debug)]
pub struct FifoChannel {
capacity: usize,
}
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub trait IntoHandler<'a, T> {

/// The default handler in Zenoh is a FIFO queue.
#[repr(transparent)]
#[derive(Default)]
#[derive(Default, Debug)]
pub struct DefaultHandler(FifoChannel);

impl<T: Send + 'static> IntoHandler<'static, T> for DefaultHandler {
Expand Down
2 changes: 2 additions & 0 deletions zenoh/src/handlers/ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use zenoh_collections::RingBuffer;
use zenoh_result::ZResult;

/// A synchrounous ring channel with a limited size that allows users to keep the last N data.
#[derive(Debug)]
pub struct RingChannel {
capacity: usize,
}
Expand All @@ -43,6 +44,7 @@ struct RingChannelInner<T> {
not_empty: flume::Receiver<()>,
}

// TODO impl `fmt::Debug`, but obviously `Weak` implementation is not really user-friendly
pub struct RingChannelHandler<T> {
ring: Weak<RingChannelInner<T>>,
}
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ impl<'a> AsyncResolve for PeersZidBuilder<'a> {
/// let zid = info.zid().res().await;
/// # }
/// ```
#[derive(Debug)]
pub struct SessionInfo<'a> {
pub(crate) session: SessionRef<'a>,
}
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/key_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ impl<'a> Undeclarable<&'a Session, KeyExprUndeclaration<'a>> for KeyExpr<'a> {
/// # }
/// ```
#[must_use = "Resolvables do nothing unless you resolve them using the `res` method from either `SyncResolve` or `AsyncResolve`"]
#[derive(Debug)]
pub struct KeyExprUndeclaration<'a> {
session: &'a Session,
expr: KeyExpr<'a>,
Expand Down
3 changes: 3 additions & 0 deletions zenoh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
//! }
//! }
//! ```
#![deny(missing_debug_implementations)]
#[macro_use]
extern crate zenoh_core;
#[macro_use]
Expand Down Expand Up @@ -280,6 +281,7 @@ where
/// # }
/// ```
#[must_use = "Resolvables do nothing unless you resolve them using the `res` method from either `SyncResolve` or `AsyncResolve`"]
#[derive(Debug)]
pub struct OpenBuilder<TryIntoConfig>
where
TryIntoConfig: std::convert::TryInto<crate::config::Config> + Send + 'static,
Expand Down Expand Up @@ -357,6 +359,7 @@ pub fn init(runtime: Runtime) -> InitBuilder {
#[must_use = "Resolvables do nothing unless you resolve them using the `res` method from either `SyncResolve` or `AsyncResolve`"]
#[doc(hidden)]
#[zenoh_macros::unstable]
// TODO impl `fmt::Debug`, but `Runtime` doesn't implement it
pub struct InitBuilder {
runtime: Runtime,
aggregated_subscribers: Vec<OwnedKeyExpr>,
Expand Down
2 changes: 2 additions & 0 deletions zenoh/src/liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ lazy_static::lazy_static!(
/// # }
/// ```
#[zenoh_macros::unstable]
#[derive(Debug)]
pub struct Liveliness<'a> {
pub(crate) session: SessionRef<'a>,
}
Expand Down Expand Up @@ -324,6 +325,7 @@ pub struct LivelinessToken<'a> {
/// ```
#[must_use = "Resolvables do nothing unless you resolve them using the `res` method from either `SyncResolve` or `AsyncResolve`"]
#[zenoh_macros::unstable]
#[derive(Debug)]
pub struct LivelinessTokenUndeclaration<'a> {
token: LivelinessToken<'a>,
}
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/net/runtime/adminspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub struct AdminContext {

type Handler = Arc<dyn Fn(&AdminContext, Query) + Send + Sync>;

// TODO impl `fmt::Debug`
pub struct AdminSpace {
zid: ZenohId,
queryable_id: QueryableId,
Expand Down
3 changes: 3 additions & 0 deletions zenoh/src/net/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub(crate) struct RuntimeState {
plugins_manager: Mutex<PluginsManager>,
}

#[derive(Debug)]
pub struct WeakRuntime {
state: Weak<RuntimeState>,
}
Expand All @@ -81,6 +82,7 @@ impl WeakRuntime {
}
}

// TODO impl `fmt::Debug`, but `PluginsManager` doesn't implement it
pub struct RuntimeBuilder {
config: Config,
#[cfg(all(feature = "unstable", feature = "plugins"))]
Expand Down Expand Up @@ -222,6 +224,7 @@ impl RuntimeBuilder {
}
}

// TODO impl `fmt::Debug`, but `RuntimeState` doesn't implement it
#[derive(Clone)]
pub struct Runtime {
state: Arc<RuntimeState>,
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/net/runtime/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const SCOUT_PERIOD_INCREASE_FACTOR: u32 = 2;
const ROUTER_DEFAULT_LISTENER: &str = "tcp/[::]:7447";
const PEER_DEFAULT_LISTENER: &str = "tcp/[::]:0";

#[derive(Debug)]
pub enum Loop {
Continue,
Break,
Expand Down
3 changes: 3 additions & 0 deletions zenoh/src/publication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ impl<'a> Undeclarable<(), PublisherUndeclaration<'a>> for Publisher<'a> {
/// # }
/// ```
#[must_use = "Resolvables do nothing unless you resolve them using the `res` method from either `SyncResolve` or `AsyncResolve`"]
#[derive(Debug)]
pub struct PublisherUndeclaration<'a> {
publisher: Publisher<'a>,
}
Expand Down Expand Up @@ -1399,6 +1400,7 @@ impl<'a> Undeclarable<(), MatchingListenerUndeclaration<'a>> for MatchingListene
/// # }
/// ```
#[zenoh_macros::unstable]
// TODO impl `fmt::Debug`, but `MatchingListenerInner` doesn't implement it
pub struct MatchingListener<'a, Receiver> {
pub(crate) listener: MatchingListenerInner<'a>,
pub(crate) receiver: Receiver,
Expand Down Expand Up @@ -1452,6 +1454,7 @@ impl<Receiver> std::ops::DerefMut for MatchingListener<'_, Receiver> {
}

#[zenoh_macros::unstable]
// TODO impl `fmt::Debug`, but `MatchingListenerInner` doesn't implement it
pub struct MatchingListenerUndeclaration<'a> {
subscriber: MatchingListenerInner<'a>,
}
Expand Down
2 changes: 2 additions & 0 deletions zenoh/src/queryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ impl fmt::Display for Query {
}
}

#[derive(Debug)]
pub struct ReplySample<'a> {
query: &'a Query,
sample: Sample,
Expand Down Expand Up @@ -627,6 +628,7 @@ impl<'a> Undeclarable<(), QueryableUndeclaration<'a>> for CallbackQueryable<'a>
/// # }
/// ```
#[must_use = "Resolvables do nothing unless you resolve them using the `res` method from either `SyncResolve` or `AsyncResolve`"]
#[derive(Debug)]
pub struct QueryableUndeclaration<'a> {
queryable: CallbackQueryable<'a>,
}
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/sample/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ impl TryFrom<u64> for SampleKind {
}

/// Structure with public fields for sample. It's convenient if it's necessary to decompose a sample into its fields.
#[derive(Debug)]
pub struct SampleFields {
pub key_expr: KeyExpr<'static>,
pub payload: ZBytes,
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl<'a> Undeclarable<(), SubscriberUndeclaration<'a>> for SubscriberInner<'a> {
/// # }
/// ```
#[must_use = "Resolvables do nothing unless you resolve them using the `res` method from either `SyncResolve` or `AsyncResolve`"]
#[derive(Debug)]
pub struct SubscriberUndeclaration<'a> {
subscriber: SubscriberInner<'a>,
}
Expand Down
Loading