feat: add Response::is_ok

This commit is contained in:
DarkCat09 2024-08-06 20:15:40 +04:00
parent 17531f7938
commit e93a177b25
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3

View file

@ -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)