Trait CustomProblem

Source
pub trait CustomProblem:
    Error
    + Send
    + Sync
    + 'static {
    // Required methods
    fn problem_type(&self) -> Uri;
    fn title(&self) -> &'static str;
    fn status_code(&self) -> StatusCode;
    fn details(&self) -> CowStr;
    fn add_extensions(&self, extensions: &mut Extensions);
}
Expand description

A trait defining custom problem types.

Implementing this trait provides enough information to create a Problem instance with the correct values for each field.

There is no need to implement From<Self> for Problem if you implement this trait.

See define_custom_type! for a convenient way of implementing this trait.

Required Methods§

Source

fn problem_type(&self) -> Uri

A URI reference that identifies the problem type.

See Problem::type_ more information.

Source

fn title(&self) -> &'static str

A short, human-readable summary of the problem type.

See Problem::title for more information.

Source

fn status_code(&self) -> StatusCode

The HTTP status code for this problem type.

See Problem::status for more information.

Source

fn details(&self) -> CowStr

A human-readable explanation of the occurrence.

See Problem::details for more information.

Source

fn add_extensions(&self, extensions: &mut Extensions)

Add extensions to the final problem instance.

See Problem::with_extension for more info.

Implementors§