pub trait HttpErrorAlg {
const HTTP_STATUSES: &'static [HttpStatus];
// Required methods
fn http_status(&self) -> HttpStatus;
fn http_message(&self) -> String;
}Expand description
States what one failure means to a caller.
A handler that can fail returns a Result, and its endpoint answers with what the failure means
rather than with the failure itself. That meaning is HTTP vocabulary rather than domain
vocabulary, which is why a domain states its failures and this states how they are answered.
Required Associated Constants§
Sourceconst HTTP_STATUSES: &'static [HttpStatus]
const HTTP_STATUSES: &'static [HttpStatus]
Every status this failure can be answered with.
An interpretation that runs asks a failure what it means and is given one status. An interpretation that only reads a program has no failure to ask, so what an endpoint can answer with has to be stated by the type rather than by a value.
Required Methods§
Sourcefn http_status(&self) -> HttpStatus
fn http_status(&self) -> HttpStatus
Returns the status this failure is answered with.
Sourcefn http_message(&self) -> String
fn http_message(&self) -> String
Returns the message this failure is answered with.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".