Debian Codegraph @

debian/rust-vendor/jiff/src/error/timestamp.rs

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