add is_not_found functor to error; tweak status code matcher
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
a5822ebc27
commit
f7ce4db0b0
3 changed files with 30 additions and 7 deletions
12
src/core/result/not_found.rs
Normal file
12
src/core/result/not_found.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use super::Result;
|
||||
use crate::{error, Error};
|
||||
|
||||
pub trait NotFound<T> {
|
||||
#[must_use]
|
||||
fn is_not_found(&self) -> bool;
|
||||
}
|
||||
|
||||
impl<T> NotFound<T> for Result<T, Error> {
|
||||
#[inline]
|
||||
fn is_not_found(&self) -> bool { self.as_ref().is_err_and(error::is_not_found) }
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue