Skip to content

Commit

Permalink
Mark questionable API items as unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Sep 16, 2024
1 parent 16ade3c commit bf67421
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions zenoh/src/api/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ impl Config {
.map_err(InsertionError)
}

#[zenoh_macros::unstable]
pub fn get<'a>(&'a self, key: &str) -> Result<&'a dyn Any, LookupError> {
<zenoh_config::Config as validated_struct::ValidatedMap>::get(&self.0, key)
.map_err(LookupError)
}

#[zenoh_macros::unstable]
pub fn remove<K: AsRef<str>>(&mut self, key: K) -> ZResult<()> {
self.0.remove(key)
}
Expand Down Expand Up @@ -98,16 +100,19 @@ struct NotifierInner<T> {
inner: Mutex<T>,
subscribers: Mutex<Vec<flume::Sender<Notification>>>,
}

pub struct Notifier<T> {
inner: Arc<NotifierInner<T>>,
}

impl<T> Clone for Notifier<T> {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
}
}
}

impl Notifier<Config> {
pub fn new(inner: Config) -> Self {
Notifier {
Expand Down
4 changes: 2 additions & 2 deletions zenoh/src/api/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ use super::{
SessionPutBuilder,
},
bytes::ZBytes,
config::Notifier,
encoding::Encoding,
handlers::{Callback, DefaultHandler},
info::SessionInfo,
Expand Down Expand Up @@ -651,7 +650,8 @@ impl Session {
/// let _ = session.config().insert_json5("connect/endpoints", r#"["tcp/127.0.0.1/7447"]"#);
/// # }
/// ```
pub fn config(&self) -> &Notifier<Config> {
#[zenoh_macros::unstable]
pub fn config(&self) -> &crate::config::Notifier<Config> {
self.0.runtime.config()
}

Expand Down
5 changes: 4 additions & 1 deletion zenoh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ pub mod time {
pub mod config {
pub use zenoh_config::{WhatAmI, WhatAmIMatcher};

pub use crate::api::config::{Config, InsertionError, LookupError, LookupGuard, Notifier};
pub use crate::api::config::{Config, InsertionError};

#[zenoh_macros::unstable]
pub use crate::api::config::{LookupError, LookupGuard, Notifier};
}

#[cfg(all(
Expand Down

0 comments on commit bf67421

Please sign in to comment.