Trait flex_error::ErrorSource[][src]

pub trait ErrorSource<Trace> {
    type Source;
    type Detail;
    fn error_details(source: Self::Source) -> (Self::Detail, Option<Trace>);
}
Expand description

A type implementing ErrorSource<Trace> is a proxy type that provides the capability of extracting from an error source of type Self::Source, returning error detail of type Self::Detail, and an optional error tracer of type Tracer.

The proxy type Self is not used anywhere. We separate out Self and Self::Source so that there can be different generic implementations of error sources, such as for all E: Display or for all E: Error.

There are currently 4 types of error sources:

  • NoSource - Indicating the lack of any error source
  • DisplayError - An error source that implements Display.
  • DetailOnly - An error source that do not contain any error trace
  • StdError - An error source that implements Error with no detail.
  • ErrorReport - An error type defined by flex-error that contains both error details and error traces.

Associated Types

type Source[src]

The type of the error source.

type Detail[src]

The type of the error detail that can be extracted from the error source

Required methods

fn error_details(source: Self::Source) -> (Self::Detail, Option<Trace>)[src]

Extracts the error details out from the error source, together with an optional error trace.

Implementors

impl<Detail, Trace> ErrorSource<Trace> for DetailOnly<Detail>[src]

type Detail = Detail

type Source = Detail

fn error_details(source: Self::Source) -> (Self::Detail, Option<Trace>)[src]

impl<Detail, Trace> ErrorSource<Trace> for ErrorReport<Detail, Trace>[src]

type Source = Self

type Detail = Detail

fn error_details(source: Self::Source) -> (Self::Detail, Option<Trace>)[src]

impl<E, Tracer> ErrorSource<Tracer> for DisplayError<E> where
    E: Display,
    Tracer: ErrorMessageTracer
[src]

type Detail = E

type Source = E

fn error_details(source: Self::Source) -> (Self::Detail, Option<Tracer>)[src]

impl<E, Tracer> ErrorSource<Tracer> for StdError<E> where
    Tracer: ErrorTracer<E>, 
[src]

type Detail = ()

type Source = E

fn error_details(source: Self::Source) -> (Self::Detail, Option<Tracer>)[src]

impl<Trace> ErrorSource<Trace> for NoSource[src]

type Detail = ()

type Source = ()

fn error_details(_: Self::Source) -> (Self::Detail, Option<Trace>)[src]

impl<Trace> ErrorSource<Trace> for TraceOnly<Trace>[src]

type Detail = ()

type Source = Trace

fn error_details(source: Self::Source) -> (Self::Detail, Option<Trace>)[src]