| 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::Error::from( |
| 16 |
crate::error::CrateFeatureError::TzdbZoneInfo, |
| 17 |
) |
| 18 |
.context(crate::error::tz::db::Error::DisabledZoneInfo)) |
| 19 |
} |
| 20 |
|
| 21 |
pub(crate) fn none() -> Database { |
| 22 |
Database |
| 23 |
} |
| 24 |
|
| 25 |
pub(crate) fn reset(&self) {} |
| 26 |
|
| 27 |
pub(crate) fn get(&self, _query: &str) -> Option<TimeZone> { |
| 28 |
None |
| 29 |
} |
| 30 |
|
| 31 |
pub(crate) fn available<'d>(&'d self) -> TimeZoneNameIter<'d> { |
| 32 |
TimeZoneNameIter::empty() |
| 33 |
} |
| 34 |
|
| 35 |
pub(crate) fn is_definitively_empty(&self) -> bool { |
| 36 |
true |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
impl core::fmt::Debug for Database { |
| 41 |
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { |
| 42 |
f.write_str("ZoneInfo(unavailable)") |
| 43 |
} |
| 44 |
} |