//! Error handling. pub use failure::{err_msg, Error, Fail}; use crate::durandal::traits::PrimInt; use std::fmt; #[derive(PartialEq)] pub struct ReprError(pub T) where T: PrimInt; impl Fail for ReprError where T: PrimInt {} impl fmt::Display for ReprError where T: PrimInt { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "representation error (got {})", self.0) } } impl fmt::Debug for ReprError where T: PrimInt { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(self, f) } } pub type ResultS = Result; // EOF