Trait OkOrBadRequest

Source
pub trait OkOrBadRequest {
    type S;

    // Required method
    fn ok_or_bad_request<M: AsRef<str>>(
        self,
        reason: M,
    ) -> Result<Self::S, CommonError>;
}
Expand description

Trait to map error to the Bad Request error code

Required Associated Types§

Source

type S

Required Methods§

Source

fn ok_or_bad_request<M: AsRef<str>>( self, reason: M, ) -> Result<Self::S, CommonError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> OkOrBadRequest for Option<T>

Source§

type S = T

Source§

fn ok_or_bad_request<M: AsRef<str>>(self, reason: M) -> Result<T, CommonError>

Source§

impl<T, E> OkOrBadRequest for Result<T, E>
where E: Display,

Source§

type S = T

Source§

fn ok_or_bad_request<M: AsRef<str>>(self, reason: M) -> Result<T, CommonError>

Implementors§