Trait http_problem::prelude::OptionExt
source · [−]pub trait OptionExt: Sealed + Sized {
fn or_not_found<I>(
self,
entity: &'static str,
identifier: I
) -> Result<Self::Value>
where
I: Display;
fn or_not_found_unknown(self, entity: &'static str) -> Result<Self::Value>;
}
Expand description
Extension methods on Option<T>
.
Required Methods
fn or_not_found<I>(
self,
entity: &'static str,
identifier: I
) -> Result<Self::Value> where
I: Display,
fn or_not_found<I>(
self,
entity: &'static str,
identifier: I
) -> Result<Self::Value> where
I: Display,
Returns Ok(_)
if the source is Some(_)
, otherwise, returns a
Problem
that can downcast to NotFound
.
Errors
Returns Err
when self
is None
.
fn or_not_found_unknown(self, entity: &'static str) -> Result<Self::Value>
fn or_not_found_unknown(self, entity: &'static str) -> Result<Self::Value>
It’s a wrapper to or_not_found
to be used when
there is no a specific identifier to entity message.
Returns Ok(_)
if the source is Some(_)
, otherwise, returns a
Problem
that can downcast to NotFound
.
Errors
Returns Err
when self
is None
.