From cc68ffb8f0f3d8b429ffcdab6230d1a5cbb79a8a Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Wed, 13 Mar 2024 15:10:45 +0100 Subject: [PATCH] remove Publisher::write (#819) * build plugins with default zenoh features * update documentation to the new api for keformat's generated Parsed (#783) * fix: Relax dependency requirements (#758) - async-io - unix-named-pipe - filepath - advisory-lock * feat: Improve release workflow (#756) * wip: Improve Release workflow * feat: Add DockerHub & GHCR releases * feat: Refactor checks and tests into pre-release workflow * chore: Remove crates_check.sh and crates_publish.sh * fix: Remove Dockerfile * restore SN in case of frame drops caused by congestion control (#815) * remove Publisher::write * test fix * remove unrelated changes added by rebasing --------- Co-authored-by: Pierre Avital Co-authored-by: Mahmoud Mazouz Co-authored-by: Dmitrii Bannov <104833606+yellowhatter@users.noreply.github.com> --- zenoh/src/publication.rs | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/zenoh/src/publication.rs b/zenoh/src/publication.rs index 2a1a58ebd9..f12842d081 100644 --- a/zenoh/src/publication.rs +++ b/zenoh/src/publication.rs @@ -350,25 +350,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, "payload").res().await.unwrap(); - /// # }) - /// ``` - pub fn write(&self, kind: SampleKind, value: IntoPayload) -> Publication - where - IntoPayload: Into, - { - self._write(kind, value.into()) - } - /// Put data. /// /// # Examples @@ -1451,11 +1432,17 @@ 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); - assert_eq!(sample.payload.deserialize::().unwrap(), VALUE); + if let SampleKind::Put = kind { + assert_eq!(sample.payload.deserialize::().unwrap(), VALUE); + } } sample_kind_integrity_in_publication_with(SampleKind::Put);