pub trait RespError {
type ExtraMessage: Serialize + 'static + Sized + Display;
// Required methods
fn log_message(&self) -> Cow<'_, str>;
fn extra_message(&self) -> Self::ExtraMessage;
// Provided methods
fn resp_message(&self) -> Cow<'_, str> { ... }
fn http_code(&self) -> StatusCode { ... }
fn resp_message_default() -> Option<Cow<'static, str>> { ... }
fn extra_message_default() -> Option<Self::ExtraMessage> { ... }
}Expand description
the error when RespResult is Err(_)
Required Associated Types§
Sourcetype ExtraMessage: Serialize + 'static + Sized + Display
type ExtraMessage: Serialize + 'static + Sized + Display
the associate type of extra message
Required Methods§
Sourcefn log_message(&self) -> Cow<'_, str>
fn log_message(&self) -> Cow<'_, str>
message for logger
Sourcefn extra_message(&self) -> Self::ExtraMessage
fn extra_message(&self) -> Self::ExtraMessage
get the extra message
Provided Methods§
Sourcefn resp_message(&self) -> Cow<'_, str>
fn resp_message(&self) -> Cow<'_, str>
message for response
§Default
the RespError::resp_message default is equal to RespError::log_message
Sourcefn http_code(&self) -> StatusCode
fn http_code(&self) -> StatusCode
Sourcefn resp_message_default() -> Option<Cow<'static, str>>
fn resp_message_default() -> Option<Cow<'static, str>>
Sourcefn extra_message_default() -> Option<Self::ExtraMessage>
fn extra_message_default() -> Option<Self::ExtraMessage>
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.