Skip to content

Commit

Permalink
feat(is-ok-in-reply): added method to reply
Browse files Browse the repository at this point in the history
Signed-off-by: gabrik <[email protected]>
  • Loading branch information
gabrik committed Nov 17, 2023
1 parent 2484833 commit f7766af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Reply> for _Reply {
fn from(reply: Reply) -> Self {
Expand Down
10 changes: 10 additions & 0 deletions zenoh/value.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down

0 comments on commit f7766af

Please sign in to comment.