pub trait ApiErrorKind:
Copy
+ Clone
+ Default
+ Eq
+ PartialEq
+ Debug
+ Display
+ ToHttpStatus
+ From<CommonErrorKind>
+ From<ErrorCode>
+ Sized
+ 'static {
const KINDS: &'static [Self];
// Required methods
fn is_unknown(&self) -> bool;
fn to_name(self) -> &'static str;
fn to_msg(self) -> &'static str;
fn to_code(self) -> ErrorCode;
fn from_code(code: ErrorCode) -> Self;
}Expand description
ApiErrorKind defines the methods required of all API error kinds.
Implementations of this trait are derived by api_error_kind!.
Try to keep this light, since debugging macros is a pain : )
Required Associated Constants§
Required Methods§
Sourcefn is_unknown(&self) -> bool
fn is_unknown(&self) -> bool
Returns true if the error kind is unrecognized (at least by this
version of the software).
Sourcefn to_name(self) -> &'static str
fn to_name(self) -> &'static str
Returns the variant name of this error kind.
Ex: MyErrorKind::Foo.to_name() == "Foo"
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.