chinese_format/gregorian/time/
errors.rs1use std::{error::Error, fmt::Display};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
14pub struct HourOutOfRange(pub u8);
15
16impl Display for HourOutOfRange {
17 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18 write!(f, "Hour out of range: {}", self.0)
19 }
20}
21
22impl Error for HourOutOfRange {}
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
35pub struct MinuteOutOfRange(pub u8);
36
37impl Display for MinuteOutOfRange {
38 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39 write!(f, "Minute out of range: {}", self.0)
40 }
41}
42
43impl Error for MinuteOutOfRange {}
44
45#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
56pub struct SecondOutOfRange(pub u8);
57
58impl Display for SecondOutOfRange {
59 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
60 write!(f, "Second out of range: {}", self.0)
61 }
62}
63
64impl Error for SecondOutOfRange {}