Trait ajars_surf::surf::Status
[−]pub trait Status<T, E>: Sealed {
fn status<S>(self, status: S) -> Result<T, Error>
where
S: TryInto<StatusCode>,
<S as TryInto<StatusCode>>::Error: Debug;
fn with_status<S, F>(self, f: F) -> Result<T, Error>
where
S: TryInto<StatusCode>,
F: FnOnce() -> S,
<S as TryInto<StatusCode>>::Error: Debug;
}
Expand description
Provides the status
method for Result
and Option
.
This trait is sealed and cannot be implemented outside of http-types
.
Required methods
fn status<S>(self, status: S) -> Result<T, Error> where
S: TryInto<StatusCode>,
<S as TryInto<StatusCode>>::Error: Debug,
fn status<S>(self, status: S) -> Result<T, Error> where
S: TryInto<StatusCode>,
<S as TryInto<StatusCode>>::Error: Debug,
Wrap the error value with an additional status code.
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
F: FnOnce() -> S,
<S as TryInto<StatusCode>>::Error: Debug,
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
F: FnOnce() -> S,
<S as TryInto<StatusCode>>::Error: Debug,
Wrap the error value with an additional status code that is evaluated lazily only once an error does occur.
Implementations on Foreign Types
impl<T> Status<T, Infallible> for Option<T>
impl<T> Status<T, Infallible> for Option<T>
fn status<S>(self, status: S) -> Result<T, Error> where
S: TryInto<StatusCode>,
<S as TryInto<StatusCode>>::Error: Debug,
fn status<S>(self, status: S) -> Result<T, Error> where
S: TryInto<StatusCode>,
<S as TryInto<StatusCode>>::Error: Debug,
Wrap the error value with an additional status code.
Panics
Panics if Status
is not a valid StatusCode
.
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
F: FnOnce() -> S,
<S as TryInto<StatusCode>>::Error: Debug,
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
F: FnOnce() -> S,
<S as TryInto<StatusCode>>::Error: Debug,
Wrap the error value with an additional status code that is evaluated lazily only once an error does occur.
Panics
Panics if Status
is not a valid StatusCode
.
impl<T, E> Status<T, E> for Result<T, E> where
E: 'static + Error + Send + Sync,
impl<T, E> Status<T, E> for Result<T, E> where
E: 'static + Error + Send + Sync,
fn status<S>(self, status: S) -> Result<T, Error> where
S: TryInto<StatusCode>,
<S as TryInto<StatusCode>>::Error: Debug,
fn status<S>(self, status: S) -> Result<T, Error> where
S: TryInto<StatusCode>,
<S as TryInto<StatusCode>>::Error: Debug,
Wrap the error value with an additional status code.
Panics
Panics if Status
is not a valid StatusCode
.
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
F: FnOnce() -> S,
<S as TryInto<StatusCode>>::Error: Debug,
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
F: FnOnce() -> S,
<S as TryInto<StatusCode>>::Error: Debug,
Wrap the error value with an additional status code that is evaluated lazily only once an error does occur.
Panics
Panics if Status
is not a valid StatusCode
.