cgp_error

Trait ProvideErrorType

Source
pub trait ProvideErrorType<Context> {
    type Error: Async + Debug;
}
Expand description

This is used for contexts to declare that they have a unique Self::Error type.

Although it is possible for each context to declare their own associated Error type, doing so may result in having multiple ambiguous Self::Error types, if there are multiple associated types with the same name in different traits.

As a result, it is better for context traits to include HasError as their parent traits, so that multiple traits can all refer to the same abstract Self::Error type.

Required Associated Types§

Source

type Error: Async + Debug

The Error associated type is also required to implement Debug.

This is to allow Self::Error to be used in calls like .unwrap(), as well as for simpler error logging.

Implementations on Foreign Types§

Source§

impl<Context, Provider, Error> ProvideErrorType<Context> for WithProvider<Provider>
where Provider: ProvideType<Context, ErrorTypeComponent, Type = Error>, Error: Async + Debug,

Source§

type Error = Error

Implementors§

Source§

impl<Component, Context> ProvideErrorType<Context> for Component
where Component: DelegateComponent<ErrorTypeComponent>, Component::Delegate: ProvideErrorType<Context>,

This is used for contexts to declare that they have a unique Self::Error type.

Although it is possible for each context to declare their own associated Error type, doing so may result in having multiple ambiguous Self::Error types, if there are multiple associated types with the same name in different traits.

As a result, it is better for context traits to include HasError as their parent traits, so that multiple traits can all refer to the same abstract Self::Error type.