use std::{error::Error, fmt};
#[derive(Debug, Default, Clone, Hash, PartialEq, PartialOrd, Eq, Ord)]
pub struct ErrorGeneric {
b: u32,
}
impl ErrorGeneric {
pub fn new(b: u32) -> Self {
Self {
b,
}
}
}
impl fmt::Display for ErrorGeneric {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"parser.ErrorGeneric: expected=(4 <= b <= 16), got b=({:?})",
self.b
)
}
}
impl Error for ErrorGeneric {}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
use pretty_assertions::assert_eq;
#[test]
fn it_works_pretty_assertions() {
assert_eq!(2 + 2, 4);
}
}