| 1 | use crate::tz::{TimeZone, TimeZoneNameIter}; |
| 2 | |
| 3 | #[derive (Clone)] |
| 4 | pub(crate) struct Database; |
| 5 | |
| 6 | impl Database { |
| 7 | pub(crate) fn from_env() -> Database { |
| 8 | Database |
| 9 | } |
| 10 | |
| 11 | #[cfg (feature = "std" )] |
| 12 | pub(crate) fn from_dir( |
| 13 | dir: &std::path::Path, |
| 14 | ) -> Result<Database, crate::Error> { |
| 15 | Err(crate::error::err!( |
| 16 | "system tzdb unavailable: \ |
| 17 | crate feature `tzdb-zoneinfo` is disabled, \ |
| 18 | opening tzdb at {dir} has therefore failed" , |
| 19 | dir = dir.display(), |
| 20 | )) |
| 21 | } |
| 22 | |
| 23 | pub(crate) fn none() -> Database { |
| 24 | Database |
| 25 | } |
| 26 | |
| 27 | pub(crate) fn reset(&self) {} |
| 28 | |
| 29 | pub(crate) fn get(&self, _query: &str) -> Option<TimeZone> { |
| 30 | None |
| 31 | } |
| 32 | |
| 33 | pub(crate) fn available<'d>(&'d self) -> TimeZoneNameIter<'d> { |
| 34 | TimeZoneNameIter::empty() |
| 35 | } |
| 36 | |
| 37 | pub(crate) fn is_definitively_empty(&self) -> bool { |
| 38 | true |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | impl core::fmt::Debug for Database { |
| 43 | fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 44 | write!(f, "ZoneInfo(unavailable)" ) |
| 45 | } |
| 46 | } |
| 47 | |