logic-rs 0.1.1

Library for representing logical formulas with support for temporal robustness semantics
Documentation
#[derive(Debug)]
pub enum BinaryError<L, R>
where
    L: std::error::Error,
    R: std::error::Error,
{
    Left(L),
    Right(R),
}

impl<L, R> std::fmt::Display for BinaryError<L, R>
where
    L: std::error::Error,
    R: std::error::Error,
{
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Left(left) => write!(f, "Left error: {}", left),
            Self::Right(right) => write!(f, "Right error: {}", right),
        }
    }
}

impl<L, R> std::error::Error for BinaryError<L, R>
where
    L: std::error::Error,
    R: std::error::Error,
{
}

#[derive(Debug)]
pub enum TimedOperatorError<E>
where
    E: std::error::Error,
{
    EmptyTrace,
    SubformulaError(E),
}

impl<E> std::fmt::Display for TimedOperatorError<E>
where
    E: std::error::Error,
{
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::EmptyTrace => write!(f, "Not enough elements in trace provided to operator"),
            Self::SubformulaError(error) => write!(f, "Subformula error {}", error),
        }
    }
}

impl<E> std::error::Error for TimedOperatorError<E> where E: std::error::Error {}