1pub mod interface;
2pub mod model;
3pub mod storage;
4
5pub(crate) mod generated {
6 #[cfg(all(feature = "basic", have_basic_prebuilt))]
16 pub mod basic {
17 use lazy_static::lazy_static;
18 use routers_tz_types::storage::basic::BasicStorageBackend;
19
20 const DATA: &[u8] = include_bytes!("../data/prebuilt/basic_timezone_data.postcard.bin");
21
22 lazy_static! {
23 pub static ref STORAGE: BasicStorageBackend =
24 postcard::from_bytes(DATA).expect("Failed to deserialize basic timezone data");
25 }
26
27 pub fn storage() -> &'static BasicStorageBackend {
28 &STORAGE
29 }
30 }
31
32 #[cfg(all(feature = "basic", not(have_basic_prebuilt)))]
33 compile_error!(
34 "The `basic` feature requires the timezone-boundary-builder geojson \
35 at `data/<tz_version>/timezones.geojson` so `build.rs` can generate \
36 `data/prebuilt/basic_timezone_data.postcard.bin`. The pre-built \
37 binary is too large (~113 MiB) to ship via crates.io. Either disable \
38 the `basic` feature (the default is `s2cell`), or build from a git \
39 checkout with the geojson present."
40 );
41
42 #[cfg(feature = "rtree")]
43 pub mod rtree {
44 use lazy_static::lazy_static;
45 use routers_tz_types::storage::rtree::RTreeStorageBackend;
46
47 const DATA: &[u8] = include_bytes!("../data/prebuilt/rtree_timezone_data.postcard.bin");
48
49 lazy_static! {
50 pub static ref STORAGE: RTreeStorageBackend =
51 postcard::from_bytes(DATA).expect("Failed to deserialize rtree timezone data");
52 }
53
54 pub fn storage() -> &'static RTreeStorageBackend {
55 &STORAGE
56 }
57 }
58
59 #[cfg(feature = "s2cell")]
60 pub mod s2cell {
61 use lazy_static::lazy_static;
62 use routers_tz_types::storage::s2cell::S2StorageBackend;
63
64 const DATA: &[u8] = include_bytes!("../data/prebuilt/s2cell_timezone_data.postcard.bin");
65
66 lazy_static! {
67 pub static ref STORAGE: S2StorageBackend =
68 postcard::from_bytes(DATA).expect("Failed to deserialize s2cell timezone data");
69 }
70
71 pub fn storage() -> &'static S2StorageBackend {
72 &STORAGE
73 }
74 }
75}
76
77pub use interface::TimezoneResolver;
79
80pub use routers_tz_types::TimeZone;
82
83#[cfg(feature = "basic")]
85pub use storage::basic::BasicStorage;
86
87#[cfg(feature = "rtree")]
89pub use storage::rtree::RTreeStorage;
90
91#[cfg(feature = "s2cell")]
93pub use storage::s2cell::S2CellStorage;