jiff/error/tz/
posix.rs

1use crate::error;
2
3#[derive(Clone, Debug)]
4pub(crate) enum Error {
5    ColonPrefixInvalidUtf8,
6    InvalidPosixTz,
7}
8
9impl From<Error> for error::Error {
10    #[cold]
11    #[inline(never)]
12    fn from(err: Error) -> error::Error {
13        error::ErrorKind::TzPosix(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            ColonPrefixInvalidUtf8 => f.write_str(
29                "POSIX time zone string with a `:` prefix \
30                 contains invalid UTF-8",
31            ),
32            InvalidPosixTz => f.write_str("invalid POSIX time zone string"),
33        }
34    }
35}