Skip to content

Commit

Permalink
More API leaks fixed (#1143)
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowhatter authored Jun 14, 2024
1 parent a2964e6 commit 2293649
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions commons/zenoh-config/src/wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl Hello {
}

/// Get the zenoh id of this Hello message.
pub fn zid(&self) -> ZenohIdProto {
self.0.zid
pub fn zid(&self) -> ZenohId {
self.0.zid.into()
}

/// Get the whatami of this Hello message.
Expand Down
5 changes: 3 additions & 2 deletions zenoh/src/api/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::{
time::Duration,
};

use zenoh_config::ZenohId;
use zenoh_core::{Resolvable, Wait};
use zenoh_keyexpr::OwnedKeyExpr;
use zenoh_protocol::core::{CongestionControl, Parameters, ZenohIdProto};
Expand Down Expand Up @@ -137,8 +138,8 @@ impl Reply {
}

/// Gets the id of the zenoh instance that answered this Reply.
pub fn replier_id(&self) -> ZenohIdProto {
self.replier_id
pub fn replier_id(&self) -> ZenohId {
self.replier_id.into()
}
}

Expand Down
4 changes: 3 additions & 1 deletion zenoh/src/api/queryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use zenoh_result::ZResult;
#[zenoh_macros::unstable]
use {
super::{query::ReplyKeyExpr, sample::SourceInfo},
zenoh_config::wrappers::EntityGlobalId,
zenoh_protocol::core::EntityGlobalIdProto,
};

Expand Down Expand Up @@ -823,11 +824,12 @@ impl<'a, Handler> Queryable<'a, Handler> {
/// # }
/// ```
#[zenoh_macros::unstable]
pub fn id(&self) -> EntityGlobalIdProto {
pub fn id(&self) -> EntityGlobalId {
EntityGlobalIdProto {
zid: self.queryable.session.zid().into(),
eid: self.queryable.state.id,
}
.into()
}

/// Returns a reference to this queryable's handler.
Expand Down
7 changes: 4 additions & 3 deletions zenoh/src/api/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ use std::{
};

use zenoh_core::{Resolvable, Wait};
#[cfg(feature = "unstable")]
use zenoh_protocol::core::EntityGlobalIdProto;
use zenoh_protocol::{core::Reliability, network::declare::subscriber::ext::SubscriberInfo};
use zenoh_result::ZResult;
#[cfg(feature = "unstable")]
use {zenoh_config::wrappers::EntityGlobalId, zenoh_protocol::core::EntityGlobalIdProto};

use super::{
handlers::{locked, Callback, DefaultHandler, IntoHandler},
Expand Down Expand Up @@ -458,11 +458,12 @@ impl<'a, Handler> Subscriber<'a, Handler> {
/// # }
/// ```
#[zenoh_macros::unstable]
pub fn id(&self) -> EntityGlobalIdProto {
pub fn id(&self) -> EntityGlobalId {
EntityGlobalIdProto {
zid: self.subscriber.session.zid().into(),
eid: self.subscriber.state.id,
}
.into()
}

/// Returns the [`KeyExpr`] this Subscriber subscribes to.
Expand Down

0 comments on commit 2293649

Please sign in to comment.