range_bound_cmp 0.1.0

Comparison operations between primitive `Bound` values
Documentation
use std::fmt::Display;

#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum RangeBoundError {
    LowerBoundConversionError,
    UpperBoundConversionError,
}

impl Display for RangeBoundError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let msg = match self {
            RangeBoundError::LowerBoundConversionError => {
                "Attempted conversion of `LowerBound(Bound::Unbounded)`"
            }

            RangeBoundError::UpperBoundConversionError => {
                "Attempted conversion of `UpperBound(Bound::Unbounded)`"
            }
        };
        write!(f, "{msg}")
    }
}

impl std::error::Error for RangeBoundError {}