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 core::fmt::Debug;
use core::marker::PhantomData;

use crate::HasErrorType;

pub struct ErrorOnly<E>(pub PhantomData<E>);

impl<E> Default for ErrorOnly<E> {
    fn default() -> Self {
        Self(PhantomData)
    }
}

impl<E: Debug> HasErrorType for ErrorOnly<E> {
    type Error = E;
}