jsonc_tools/parser/
errors.rs1use std::{error::Error, fmt};
2
3#[derive(Debug, Default, Clone, Hash, PartialEq, PartialOrd, Eq, Ord)]
4pub struct ErrorGeneric {
5 b: u32,
6}
7
8impl ErrorGeneric {
9 pub fn new(b: u32) -> Self {
10 Self {
11 b,
12 }
13 }
14}
15
16impl fmt::Display for ErrorGeneric {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 write!(
19 f,
20 "parser.ErrorGeneric: expected=(4 <= b <= 16), got b=({:?})",
21 self.b
22 )
23 }
24}
25
26impl Error for ErrorGeneric {}
27
28#[cfg(test)]
29mod tests {
30 #[test]
31 fn it_works() {
32 assert_eq!(2 + 2, 4);
33 }
34
35 use pretty_assertions::assert_eq;
36
37 #[test]
38 fn it_works_pretty_assertions() {
39 assert_eq!(2 + 2, 4);
40 }
41}