#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum NoError {}
impl std::fmt::Display for NoError {
fn fmt(&self, _: &mut std::fmt::Formatter) -> std::fmt::Result { match *self {} }
}
impl std::error::Error for NoError {
fn description(&self) -> &str { match *self {} }
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum UnaryError<I, O> {
Inner(I),
Output(O),
}
impl<I, O> std::fmt::Display for UnaryError<I, O>
where
I: std::fmt::Display,
O: std::fmt::Display,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
UnaryError::Inner(e) => e.fmt(f),
UnaryError::Output(e) => e.fmt(f),
}
}
}
impl<I, O> std::error::Error for UnaryError<I, O>
where
I: std::fmt::Debug + std::fmt::Display,
O: std::fmt::Debug + std::fmt::Display,
{
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum BinaryError<L, R, O> {
Left(L),
Right(R),
Output(O),
}
impl<L, R, O> std::fmt::Display for BinaryError<L, R, O>
where
L: std::fmt::Display,
R: std::fmt::Display,
O: std::fmt::Display,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
BinaryError::Left(e) => e.fmt(f),
BinaryError::Right(e) => e.fmt(f),
BinaryError::Output(e) => e.fmt(f),
}
}
}
impl<L, R, O> std::error::Error for BinaryError<L, R, O>
where
L: std::fmt::Debug + std::fmt::Display,
R: std::fmt::Debug + std::fmt::Display,
O: std::fmt::Debug + std::fmt::Display,
{
}