cgp-error 0.7.0

Context-generic programming error components
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use cgp_component::{DelegateComponent, IsProviderFor, UseContext, UseDelegate};
use cgp_macro::cgp_component;

use crate::traits::has_error_type::HasErrorType;

/**
   The `CanRaiseError` trait is used to raise any concrete error type into
   an abstract error provided by [`HasErrorType`].
*/
#[cgp_component {
    provider: ErrorRaiser,
    derive_delegate: UseDelegate<SourceError>,
}]
pub trait CanRaiseError<SourceError>: HasErrorType {
    fn raise_error(error: SourceError) -> Self::Error;
}