) .into_response(), } } } pub(super) trait OptionExt<T> { fn ok_or_not_found<F: FnOnce() -> S, S: Into<String>>(self, f: F) -> ServerResult<T>; } impl<T> OptionExt<T> for Option<T> { fn ok_or_not_found<F: FnOnce() -> S, S: Into<String>>(self, f: F) -> ServerResult<T> { match self { Some(value) => Ok(value), None => Err(ServerError::NotFound(f().into() + " not found")), } } } impl From<Error> for ServerError { fn from(error: Error) -> Self { Self::Internal(error) } }
Inscription number 44,982,967
Genesis block 819,059
File type text
File size 528 b
Creation date Nov 30,2023 1:34 am