1use crate::error;
2
3#[derive(#[automatically_derived]impl ::core::clone::Clone for Error {
#[inline]
#[rustc_trivial_field_reads]
fn clone(&self) -> Self {
match self {
Self::ConvertToSystemTime { timestamp: __self_0 } =>
Error::ConvertToSystemTime {
timestamp: ::core::clone::Clone::clone(__self_0),
},
Self::OverflowAddDuration => Error::OverflowAddDuration,
Self::OverflowAddSpan => Error::OverflowAddSpan,
}
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for Error {
#[inline]
#[rustc_trivial_field_reads]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::ConvertToSystemTime { timestamp: __self_0 } =>
::core::fmt::Formatter::debug_struct_field1_finish(f,
"ConvertToSystemTime timestamp", &__self_0),
Self::OverflowAddDuration =>
::core::fmt::Formatter::write_str(f, "OverflowAddDuration"),
Self::OverflowAddSpan =>
::core::fmt::Formatter::write_str(f, "OverflowAddSpan"),
}
}
}Debug)]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5pub(crate) enum Error {
6 #[cfg(feature = "std")]
7 ConvertToSystemTime {
8 timestamp: crate::Timestamp,
9 },
10 OverflowAddDuration,
11 OverflowAddSpan,
12}
13
14impl From<Error> for error::Error {
15 #[cold]
16 #[inline(never)]
17 fn from(err: Error) -> error::Error {
18 error::ErrorKind::Timestamp(err).into()
19 }
20}
21
22impl error::IntoError for Error {
23 fn into_error(self) -> error::Error {
24 self.into()
25 }
26}
27
28impl core::fmt::Display for Error {
29 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
30 use self::Error::*;
31
32 match *self {
33 #[cfg(feature = "std")]
34 ConvertToSystemTime { timestamp } => f.write_fmt(format_args!("timestamp {0} is out of range for `std::time::SystemTime`",
timestamp))write!(
35 f,
36 "timestamp {timestamp} is out of range for \
37 `std::time::SystemTime`",
38 ),
39 OverflowAddDuration => {
40 f.write_str("adding duration overflowed timestamp")
41 }
42 OverflowAddSpan => f.write_str("adding span overflowed timestamp"),
43 }
44 }
45}