chinese_format/currency/
errors.rs1use std::{error::Error, fmt::Display};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
14pub struct DimesOutOfRange(pub u8);
15
16impl Display for DimesOutOfRange {
17 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18 write!(f, "Dimes out of range: {}", self.0)
19 }
20}
21
22impl Error for DimesOutOfRange {}
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
35pub struct CentsOutOfRange(pub u8);
36
37impl Display for CentsOutOfRange {
38 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39 write!(f, "Cents out of range: {}", self.0)
40 }
41}
42
43impl Error for CentsOutOfRange {}