pub trait ErrorTypeProvider<__Context__>: IsProviderFor<ErrorTypeProviderComponent, __Context__, ()> {
type Error: Debug;
}Expand description
The HasErrorType trait provides an abstract error type that can be used by
CGP components to decouple the code from any concrete error implementation.
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.
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.
More details about how to use HasErrorType is available at
https://patterns.contextgeneric.dev/error-handling.html
Required Associated Types§
Implementations on Foreign Types§
Source§impl<Error, __Context__> ErrorTypeProvider<__Context__> for UseType<Error>where
Error: Debug,
impl<Error, __Context__> ErrorTypeProvider<__Context__> for UseType<Error>where
Error: Debug,
Source§impl<__Context__> ErrorTypeProvider<__Context__> for UseContextwhere
__Context__: HasErrorType,
The HasErrorType trait provides an abstract error type that can be used by
CGP components to decouple the code from any concrete error implementation.
impl<__Context__> ErrorTypeProvider<__Context__> for UseContextwhere
__Context__: HasErrorType,
The HasErrorType trait provides an abstract error type that can be used by
CGP components to decouple the code from any concrete error implementation.
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.
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.
More details about how to use HasErrorType is available at
https://patterns.contextgeneric.dev/error-handling.html
type Error = <__Context__ as HasErrorType>::Error
Source§impl<__Provider__, __Context__> ErrorTypeProvider<__Context__> for WithProvider<__Provider__>where
__Provider__: ProvideType<__Context__, ErrorTypeProviderComponent>,
__Provider__::Type: Debug,
impl<__Provider__, __Context__> ErrorTypeProvider<__Context__> for WithProvider<__Provider__>where
__Provider__: ProvideType<__Context__, ErrorTypeProviderComponent>,
__Provider__::Type: Debug,
type Error = <__Provider__ as ProvideType<__Context__, ErrorTypeProviderComponent>>::Type
Implementors§
Source§impl<__Component__, __Context__> ErrorTypeProvider<__Context__> for __Component__where
__Component__: DelegateComponent<ErrorTypeProviderComponent> + IsProviderFor<ErrorTypeProviderComponent, __Context__, ()>,
__Component__::Delegate: ErrorTypeProvider<__Context__>,
The HasErrorType trait provides an abstract error type that can be used by
CGP components to decouple the code from any concrete error implementation.
impl<__Component__, __Context__> ErrorTypeProvider<__Context__> for __Component__where
__Component__: DelegateComponent<ErrorTypeProviderComponent> + IsProviderFor<ErrorTypeProviderComponent, __Context__, ()>,
__Component__::Delegate: ErrorTypeProvider<__Context__>,
The HasErrorType trait provides an abstract error type that can be used by
CGP components to decouple the code from any concrete error implementation.
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.
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.
More details about how to use HasErrorType is available at
https://patterns.contextgeneric.dev/error-handling.html