jiff/error/
timestamp.rs

1use crate::error;
2
3#[derive(Clone, Debug)]
4pub(crate) enum Error {
5    OverflowAddDuration,
6    OverflowAddSpan,
7}
8
9impl From<Error> for error::Error {
10    #[cold]
11    #[inline(never)]
12    fn from(err: Error) -> error::Error {
13        error::ErrorKind::Timestamp(err).into()
14    }
15}
16
17impl error::IntoError for Error {
18    fn into_error(self) -> error::Error {
19        self.into()
20    }
21}
22
23impl core::fmt::Display for Error {
24    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
25        use self::Error::*;
26
27        match *self {
28            OverflowAddDuration => {
29                f.write_str("adding duration overflowed timestamp")
30            }
31            OverflowAddSpan => f.write_str("adding span overflowed timestamp"),
32        }
33    }
34}