feat: add Response::is_ok
This commit is contained in:
parent
17531f7938
commit
e93a177b25
1 changed files with 5 additions and 0 deletions
|
@ -21,6 +21,11 @@ impl Response {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn is_ok(self: &Self) -> bool {
|
||||||
|
self.status.reply_type() == ReplyType::Success
|
||||||
|
}
|
||||||
|
|
||||||
pub fn ensure_ok(self: Self) -> Result<Self, Self> {
|
pub fn ensure_ok(self: Self) -> Result<Self, Self> {
|
||||||
if self.status.reply_type() == ReplyType::Success {
|
if self.status.reply_type() == ReplyType::Success {
|
||||||
Ok(self)
|
Ok(self)
|
||||||
|
|
Loading…
Add table
Reference in a new issue