Skip to main content

CodedError

Trait CodedError 

Source
pub trait CodedError: Error {
    // Required method
    fn code(&self) -> u64;
}
Expand description

An application failure a request is answered with. The peer dispatches on the code and may show the message. Codes below 0x100 are the protocol’s schema::ReservedErrors, an application assigns its own from 0x100 up.

Implementing it converts the error into schema::Error, so a handler can fail a request with ? and super::Responder::fail takes it directly.

Required Methods§

Source

fn code(&self) -> u64

Code identifying the failure to the peer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§