From 7bc133d63859f7f8e61189a44a30ae8404ea0eae Mon Sep 17 00:00:00 2001 From: ChenYing Kuo Date: Tue, 23 Jan 2024 11:57:25 +0800 Subject: [PATCH] Able to set encoding to query value. Signed-off-by: ChenYing Kuo --- zenoh/src/query.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/zenoh/src/query.rs b/zenoh/src/query.rs index c4f3fb35e9..7a7c3c8ae0 100644 --- a/zenoh/src/query.rs +++ b/zenoh/src/query.rs @@ -306,6 +306,18 @@ impl<'a, 'b, Handler> GetBuilder<'a, 'b, Handler> { self } + /// Change the encoding of the query value. + #[inline] + pub fn encoding(mut self, encoding: IntoEncoding) -> Self + where + IntoEncoding: Into, + { + if let Some(ref mut value) = self.value { + value.encoding = encoding.into(); + } + self + } + #[zenoh_macros::unstable] pub fn with_attachment(mut self, attachment: Attachment) -> Self { self.attachment = Some(attachment);