@@ -9,19 +9,18 @@ use std::{
99 collections:: { BTreeMap , BTreeSet } ,
1010 path:: Path ,
1111} ;
12- use zerotrie:: { ZeroTrieBuildError , ZeroTrieSimpleAscii } ;
13- use zerovec:: { VarZeroVec , ZeroVec } ;
12+ use zerotrie:: { ZeroAsciiIgnoreCaseTrie , ZeroTrieBuildError } ;
13+ use zerovec:: { vecs :: Index32 , VarZeroVec , ZeroVec } ;
1414use zoneinfo_compiler:: { TransitionData , ZoneInfoCompileSettings } ;
1515
1616use crate :: tzdb:: TzdbDataProvider ;
1717
1818#[ derive( Debug , Clone , yoke:: Yokeable , databake:: Bake , serde:: Serialize ) ]
1919#[ databake( path = temporal_provider:: tzif) ]
20- pub struct ZeroZoneInfo < ' data > {
21- // Why u16? It would suck to have to refactor because there are > 256 TZifs
22- ids : ZeroTrieSimpleAscii < ZeroVec < ' data , u8 > > ,
20+ pub struct ZoneInfoProvider < ' data > {
21+ ids : ZeroAsciiIgnoreCaseTrie < ZeroVec < ' data , u8 > > ,
2322
24- tzifs : VarZeroVec < ' data , ZeroTzifULE > ,
23+ tzifs : VarZeroVec < ' data , ZeroTzifULE , Index32 > ,
2524}
2625
2726#[ zerovec:: make_varule( ZeroTzifULE ) ]
@@ -84,11 +83,12 @@ impl ZeroTzif<'_> {
8483 }
8584}
8685
86+ #[ derive( Debug ) ]
8787pub enum ZoneInfoDataError {
8888 Build ( ZeroTrieBuildError ) ,
8989}
9090
91- impl ZeroZoneInfo < ' _ > {
91+ impl ZoneInfoProvider < ' _ > {
9292 pub fn build ( tzdata : & Path ) -> Result < Self , ZoneInfoDataError > {
9393 let mut provider = TzdbDataProvider :: try_from_zoneinfo_directory ( tzdata) . unwrap ( ) ;
9494 let mut identifiers = BTreeMap :: default ( ) ;
@@ -110,7 +110,12 @@ impl ZeroZoneInfo<'_> {
110110
111111 let identier_map: BTreeMap < Vec < u8 > , usize > = identifiers
112112 . iter ( )
113- . map ( |( id, zoneid) | ( id. as_bytes ( ) . to_vec ( ) , zones. binary_search ( zoneid) . unwrap ( ) ) )
113+ . map ( |( id, zoneid) | {
114+ (
115+ id. to_ascii_lowercase ( ) . as_bytes ( ) . to_vec ( ) ,
116+ zones. binary_search ( zoneid) . unwrap ( ) ,
117+ )
118+ } )
114119 . collect ( ) ;
115120
116121 let tzifs: Vec < ZeroTzif < ' _ > > = zones
@@ -124,13 +129,13 @@ impl ZeroZoneInfo<'_> {
124129 } )
125130 . collect ( ) ;
126131
127- let tzifs_zerovec: VarZeroVec < ' static , ZeroTzifULE > = tzifs. as_slice ( ) . into ( ) ;
132+ let tzifs_zerovec: VarZeroVec < ' static , ZeroTzifULE , Index32 > = tzifs. as_slice ( ) . into ( ) ;
128133
129- let ids = ZeroTrieSimpleAscii :: try_from ( & identier_map)
134+ let ids = ZeroAsciiIgnoreCaseTrie :: try_from ( & identier_map)
130135 . map_err ( ZoneInfoDataError :: Build ) ?
131136 . convert_store ( ) ;
132137
133- Ok ( ZeroZoneInfo {
138+ Ok ( ZoneInfoProvider {
134139 ids,
135140 tzifs : tzifs_zerovec,
136141 } )
0 commit comments