Skip to content

Commit

Permalink
remove Publisher::write
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Mar 13, 2024
1 parent 1c8ed89 commit 4c798fc
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions zenoh/src/publication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,25 +318,6 @@ impl<'a> Publisher<'a> {
}
}

/// Send data with [`kind`](SampleKind) (Put or Delete).
///
/// # 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();
/// publisher.write(SampleKind::Put, "value").res().await.unwrap();
/// # })
/// ```
pub fn write<IntoValue>(&self, kind: SampleKind, value: IntoValue) -> Publication
where
IntoValue: Into<Value>,
{
self._write(kind, value.into())
}

/// Put data.
///
/// # Examples
Expand Down Expand Up @@ -1361,7 +1342,11 @@ mod tests {
let session = open(Config::default()).res().unwrap();
let sub = session.declare_subscriber(KEY_EXPR).res().unwrap();
let pub_ = session.declare_publisher(KEY_EXPR).res().unwrap();
pub_.write(kind, VALUE).res().unwrap();

match kind {
SampleKind::Put => pub_.put(VALUE).res().unwrap(),
SampleKind::Delete => pub_.delete().res().unwrap(),
}
let sample = sub.recv().unwrap();

assert_eq!(sample.kind, kind);
Expand Down

0 comments on commit 4c798fc

Please sign in to comment.