oct/error/
system_time_decode_error.rs1use core::convert::Infallible;
10use core::error::Error;
11use core::fmt::{self, Display, Formatter};
12use core::hint::unreachable_unchecked;
13
14#[cfg_attr(doc, doc(cfg(feature = "std")))]
19#[derive(Debug, Eq, PartialEq)]
20#[must_use]
21pub struct SystemTimeDecodeError {
22 pub timestamp: i64,
24}
25
26#[cfg_attr(doc, doc(cfg(feature = "std")))]
27impl Display for SystemTimeDecodeError {
28 #[inline(always)]
29 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
30 write!(f, "could not represent `{}` as a system timestamp", self.timestamp)
31 }
32}
33
34#[cfg_attr(doc, doc(cfg(feature = "std")))]
35impl Error for SystemTimeDecodeError { }
36
37#[cfg_attr(doc, doc(cfg(feature = "std")))]
38impl From<Infallible> for SystemTimeDecodeError {
39 #[inline(always)]
40 fn from(_value: Infallible) -> Self {
41 unsafe { unreachable_unchecked() };
44 }
45}