cgp-error 0.8.0-alpha

A language extension for Rust, with pluggable trait implementations at compile-time.
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;
}