pub trait ApiError {
// Required methods
fn from_error_code(code: u16) -> Self;
fn to_error_code(&self) -> u16;
}
Expand description
Used on enums representing errors that a call to an API returned.
Required Methods§
Sourcefn from_error_code(code: u16) -> Self
fn from_error_code(code: u16) -> Self
Converts an error code to the enum variant.
Sourcefn to_error_code(&self) -> u16
fn to_error_code(&self) -> u16
Converts an error variant to the matching error code.
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.