From f7766af96c34b17599e8e38875c76600be8ec166 Mon Sep 17 00:00:00 2001 From: gabrik Date: Fri, 17 Nov 2023 08:58:57 +0100 Subject: [PATCH] feat(is-ok-in-reply): added method to reply Signed-off-by: gabrik --- src/value.rs | 4 ++++ zenoh/value.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/value.rs b/src/value.rs index ceb8d727..ab5aa160 100644 --- a/src/value.rs +++ b/src/value.rs @@ -297,6 +297,10 @@ impl _Reply { Ok(_) => Err(zenoh_core::zerror!("Called `Reply.err` on a non-err reply.").to_pyerr()), } } + #[getter] + pub fn is_ok(&self) -> bool { + self.reply.is_ok() + } } impl From for _Reply { fn from(reply: Reply) -> Self { diff --git a/zenoh/value.py b/zenoh/value.py index 6446f52a..e0708f0b 100644 --- a/zenoh/value.py +++ b/zenoh/value.py @@ -181,6 +181,16 @@ def __new__(cls, inner: _Reply): def replier_id(self) -> ZenohId: "The reply's sender's id." return ZenohId._upgrade_(super().replier_id) + + @property + def is_ok(self) -> bool: + """ + Checks if the reply is `ok`. + + Returns `True` if the reply is `ok`, `False` otherwise + """ + return super.is_ok() + @property def ok(self) -> Sample: """