add is_not_found functor to error; tweak status code matcher

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-09-12 00:01:25 +00:00 committed by strawberry
parent a5822ebc27
commit f7ce4db0b0
3 changed files with 30 additions and 7 deletions

View 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) }
}