pub trait ErrorCode: Copy + Eq {
const ERROR_CODE_MAX: usize;
const PREFIX: &'static str = "E";
// Required methods
fn code(self) -> usize;
fn description(self) -> &'static str;
}
Expand description
Error codes of an application.
This is intended to be implemented by a flat enum in an application that defines all of its errors.
Required Associated Constants§
Sourceconst ERROR_CODE_MAX: usize
const ERROR_CODE_MAX: usize
Returns the largest possible error code value.
This is used to determine the number of leading 0
s when formatting the
error message.
Provided Associated Constants§
Required Methods§
Sourcefn description(self) -> &'static str
fn description(self) -> &'static str
Returns a short description of the error.
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.