use core::fmt; pub enum SerializerError { /// A unexpected error (should never get this). Unexpected(&'static str) } impl fmt::Debug for SerializerError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use SerializerError::*; match self { Unexpected(ref err) => write!(f, "unexpected error: {}", err) } } } pub trait Error: fmt::Debug + From {} impl Error for T where T: fmt::Debug + From {}