Trait srcerr::ErrorCode[][src]

pub trait ErrorCode: Copy + Eq {
    const ERROR_CODE_MAX: usize;
    const PREFIX: &'static str;

    fn code(self) -> usize;
fn description(self) -> &'static str; }

Error codes of an application.

This is intended to be implemented by a flat enum in an application that defines all of its errors.

Associated Constants

const ERROR_CODE_MAX: usize[src]

Returns the largest possible error code value.

This is used to determine the number of leading 0s when formatting the error message.

const PREFIX: &'static str[src]

Returns the &str to prefix the error code – the "E" in "E001".

Defaults to "E".

Loading content...

Required methods

fn code(self) -> usize[src]

Returns the error code.

fn description(self) -> &'static str[src]

Returns a short description of the error.

Loading content...

Implementors

Loading content...