Trait HttpError

Source
pub trait HttpError:
    Debug
    + Display
    + Send
    + Sync
    + 'static {
    // Required method
    fn status_code(&self) -> StatusCode;

    // Provided methods
    fn append_headers(&self, headers: &mut HeaderMap<HeaderValue>) { ... }
    fn as_fail(&self) -> Option<&dyn Fail> { ... }
}
Expand description

Trait representing error values from endpoints.

The types which implements this trait will be implicitly converted to an HTTP response by the runtime.

Required Methods§

Source

fn status_code(&self) -> StatusCode

Return the HTTP status code associated with this error type.

Provided Methods§

Source

fn append_headers(&self, headers: &mut HeaderMap<HeaderValue>)

Append a set of header values to the header map.

Source

fn as_fail(&self) -> Option<&dyn Fail>

Return the reference to a value of Fail if exists.

Implementations on Foreign Types§

Source§

impl<L, R> HttpError for Either<L, R>
where L: HttpError, R: HttpError,

Implementors§