Skip to main content

Config

Trait Config 

Source
pub trait Config {
    type Id;

    const CODE: Option<&'static str> = None;
    const TAGS: Option<&'static [&'static str]> = None;

    // Provided methods
    fn id() -> Option<Self::Id> { ... }
    fn display<C: Config, D>(gerr: &GErr<C, D>) -> String
       where C::Id: Display,
             D: Debug { ... }
}
Expand description

Error config.

Provided Associated Constants§

Source

const CODE: Option<&'static str> = None

Error code.

Source

const TAGS: Option<&'static [&'static str]> = None

Error tags.

Required Associated Types§

Source

type Id

Error id.

§Must be:
  • Implementing Display & Debug.
  • Implementing serde’s Serialize and Deserialize for serde feature.

Provided Methods§

Source

fn id() -> Option<Self::Id>

Auto-generate error id.

Defaults to None.

Source

fn display<C: Config, D>(gerr: &GErr<C, D>) -> String
where C::Id: Display, D: Debug,

Display error message.

It will be invoked in Display implementation.

Defaults to [<id>][<code>] <message>.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Config for ()

Implementors§