Skip to content

Commit

Permalink
Rustdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Nov 9, 2023
1 parent 0e440f0 commit 765e5af
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion zenoh/src/publication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,12 @@ impl<'a> Publisher<'a> {
///
/// let session = zenoh::open(config::peer()).res().await.unwrap().into_arc();
/// let publisher = session.declare_publisher("key/expression").res().await.unwrap();
/// let matching_subscribers: bool = publisher.matching_status().res().await.unwrap().matching_subscribers();
/// let matching_subscribers: bool = publisher
/// .matching_status()
/// .res()
/// .await
/// .unwrap()
/// .matching_subscribers();
/// # })
/// ```
#[zenoh_macros::unstable]
Expand Down Expand Up @@ -902,6 +907,17 @@ impl From<Priority> for zenoh_protocol::core::Priority {
}

/// A struct that indicates if there exist Subscribers matching the Publisher's key expression.
///
/// # Examples
/// ```
/// # async_std::task::block_on(async {
/// use zenoh::prelude::r#async::*;
///
/// let session = zenoh::open(config::peer()).res().await.unwrap().into_arc();
/// let publisher = session.declare_publisher("key/expression").res().await.unwrap();
/// let matching_status = publisher.matching_status().res().await.unwrap();
/// # })
/// ```
#[zenoh_macros::unstable]
#[derive(Copy, Clone, Debug)]
pub struct MatchingStatus {
Expand All @@ -911,6 +927,22 @@ pub struct MatchingStatus {
#[zenoh_macros::unstable]
impl MatchingStatus {
/// Return true if there exist Subscribers matching the Publisher's key expression.
///
/// # Examples
/// ```
/// # async_std::task::block_on(async {
/// use zenoh::prelude::r#async::*;
///
/// let session = zenoh::open(config::peer()).res().await.unwrap().into_arc();
/// let publisher = session.declare_publisher("key/expression").res().await.unwrap();
/// let matching_subscribers: bool = publisher
/// .matching_status()
/// .res()
/// .await
/// .unwrap()
/// .matching_subscribers();
/// # })
/// ```
pub fn matching_subscribers(&self) -> bool {
self.matching
}
Expand Down

0 comments on commit 765e5af

Please sign in to comment.