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§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
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__, __Components__, __Path__> ErrorTypeProvider<__Context__> for RedirectLookup<__Components__, __Path__>where
__Components__: DelegateComponent<__Path__>,
<__Components__ as DelegateComponent<__Path__>>::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<__Context__, __Components__, __Path__> ErrorTypeProvider<__Context__> for RedirectLookup<__Components__, __Path__>where
__Components__: DelegateComponent<__Path__>,
<__Components__ as DelegateComponent<__Path__>>::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
type Error = <<__Components__ as DelegateComponent<__Path__>>::Delegate as ErrorTypeProvider<__Context__>>::Error
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__, Error, __Context__> ErrorTypeProvider<__Context__> for WithProvider<__Provider__>where
Error: Debug,
__Provider__: TypeProvider<__Context__, ErrorTypeProviderComponent, Type = Error>,
impl<__Provider__, Error, __Context__> ErrorTypeProvider<__Context__> for WithProvider<__Provider__>where
Error: Debug,
__Provider__: TypeProvider<__Context__, ErrorTypeProviderComponent, Type = Error>,
Implementors§
Source§impl<__Provider__, __Context__> ErrorTypeProvider<__Context__> for __Provider__where
__Provider__: DelegateComponent<ErrorTypeProviderComponent> + IsProviderFor<ErrorTypeProviderComponent, __Context__, ()>,
<__Provider__ as DelegateComponent<ErrorTypeProviderComponent>>::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<__Provider__, __Context__> ErrorTypeProvider<__Context__> for __Provider__where
__Provider__: DelegateComponent<ErrorTypeProviderComponent> + IsProviderFor<ErrorTypeProviderComponent, __Context__, ()>,
<__Provider__ as DelegateComponent<ErrorTypeProviderComponent>>::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