Trait http_types::Status [−][src]
pub trait Status<T, E>: Sealed { fn status<S>(self, status: S) -> Result<T, Error>
where
S: TryInto<StatusCode>,
S::Error: Debug; fn with_status<S, F>(self, f: F) -> Result<T, Error>
where
S: TryInto<StatusCode>,
S::Error: Debug,
F: FnOnce() -> S; }
Expand description
Provides the status
method for Result
and Option
.
This trait is sealed and cannot be implemented outside of http-types
.
Required methods
Wrap the error value with an additional status code.
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
S::Error: Debug,
F: FnOnce() -> S,
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
S::Error: Debug,
F: FnOnce() -> S,
Wrap the error value with an additional status code that is evaluated lazily only once an error does occur.
Implementations on Foreign Types
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>,
S::Error: Debug,
F: FnOnce() -> S,
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
S::Error: Debug,
F: FnOnce() -> S,
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
.
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>,
S::Error: Debug,
F: FnOnce() -> S,
fn with_status<S, F>(self, f: F) -> Result<T, Error> where
S: TryInto<StatusCode>,
S::Error: Debug,
F: FnOnce() -> S,
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
.