Skip to main content

HttpStatusFallback

Trait HttpStatusFallback 

Source
pub trait HttpStatusFallback {
    // Required method
    fn http_status_code(&self) -> u16;
}
Expand description

Fallback trait used by HttpStatusHelper when the concrete error type does not implement IntoErrorCode.

This is part of the autoref specialization pattern. Generated HTTP handler code brings this trait into scope with use ... as _ so that HttpStatusHelper(&err).http_status_code() resolves to 500 when the error type does not implement IntoErrorCode, without requiring specialization.

Not intended for direct use. Call HttpStatusHelper(&err).http_status_code() from generated code instead.

Required Methods§

Source

fn http_status_code(&self) -> u16

Returns the HTTP status code for this error, defaulting to 500.

Implementors§