ErrorCode

Trait ErrorCode 

Source
pub trait ErrorCode
where Self: Sized,
{ // Required methods fn to_code(&self) -> u16; fn from_code(code: u16) -> Option<Self>; fn message(&self) -> &'static str; }
Expand description

Trait definable on enun to define error codes and their messages.

Required Methods§

Source

fn to_code(&self) -> u16

Converts error to a code for compression

Source

fn from_code(code: u16) -> Option<Self>

Maps code to error type

Source

fn message(&self) -> &'static str

Returns error message attached to 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.

Implementors§