ContextError

Trait ContextError 

Source
pub trait ContextError<A> {
    // Required methods
    fn custom<T>(alloc: A, error: T) -> Self
       where T: 'static + Send + Sync + Error;
    fn message<T>(alloc: A, message: T) -> Self
       where T: Display;
}
Expand description

Trait governing errors raised during encodeing or decoding.

Required Methods§

Source

fn custom<T>(alloc: A, error: T) -> Self
where T: 'static + Send + Sync + Error,

Construct a custom error.

Source

fn message<T>(alloc: A, message: T) -> Self
where T: Display,

Collect an error from something that can be displayed.

This is made available to format custom error messages in no_std environments. The error message is to be collected by formatting T.

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.

Implementations on Foreign Types§

Source§

impl<A> ContextError<A> for String

Available on crate feature alloc only.
Source§

fn custom<T>(_: A, message: T) -> Self
where T: Display,

Source§

fn message<T>(_: A, message: T) -> Self
where T: Display,

Source§

impl<A> ContextError<A> for Error

Available on crate feature std only.
Source§

fn custom<T>(_: A, message: T) -> Self
where T: 'static + Send + Sync + Error,

Source§

fn message<T>(_: A, message: T) -> Self
where T: Display,

Implementors§

Source§

impl<A> ContextError<A> for musli::packed::Error<A>
where A: Allocator,

Source§

impl<A> ContextError<A> for musli::storage::Error<A>
where A: Allocator,

Source§

impl<A> ContextError<A> for ErrorMarker
where A: Allocator,