1414// See the License for the specific language governing permissions and
1515// limitations under the License.
1616
17+ #[ path = "../../tzdb/src/lower.rs" ]
18+ mod lower;
1719mod parse;
1820
1921use std:: cmp:: Ordering ;
@@ -27,6 +29,8 @@ use indexmap::IndexMap;
2729use itertools:: Itertools ;
2830use tz:: TimeZone ;
2931
32+ use crate :: lower:: full_to_lower;
33+
3034struct TzName {
3135 /// to_pascal("Europe/Belfast")
3236 canon : String ,
@@ -198,6 +202,8 @@ pub fn main() -> anyhow::Result<()> {
198202// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
199203
200204use tz::TimeZoneRef;
205+ #[cfg(feature = "by-name")]
206+ use crate::lower::Lower;
201207"#
202208 ) ?;
203209
@@ -253,7 +259,7 @@ use tz::TimeZoneRef;
253259 for entries in entries_by_bytes. values ( ) {
254260 for entry in entries {
255261 phf. entry (
256- entry. full . to_ascii_lowercase ( ) ,
262+ full_to_lower ( entry. full . as_bytes ( ) ) ,
257263 & format ! ( "&tzdata::{}" , entry. canon) ,
258264 ) ;
259265 }
@@ -262,7 +268,7 @@ use tz::TimeZoneRef;
262268 writeln ! (
263269 f,
264270 "\
265- pub(crate) const TIME_ZONES_BY_NAME: phf::Map<&'static str , &'static TimeZoneRef<'static>> = {};",
271+ pub(crate) const TIME_ZONES_BY_NAME: phf::Map<Lower , &'static TimeZoneRef<'static>> = {};",
266272 phf. build( ) ,
267273 ) ?;
268274 writeln ! ( f) ?;
@@ -272,7 +278,7 @@ pub(crate) const TIME_ZONES_BY_NAME: phf::Map<&'static str, &'static TimeZoneRef
272278 for entries in entries_by_bytes. values ( ) {
273279 for entry in entries {
274280 phf. entry (
275- entry. full . to_ascii_lowercase ( ) ,
281+ full_to_lower ( entry. full . as_bytes ( ) ) ,
276282 & format ! ( "raw_tzdata::{}" , entry. canon) ,
277283 ) ;
278284 }
@@ -281,7 +287,7 @@ pub(crate) const TIME_ZONES_BY_NAME: phf::Map<&'static str, &'static TimeZoneRef
281287 writeln ! (
282288 f,
283289 "\
284- pub(crate) const RAW_TIME_ZONES_BY_NAME: phf::Map<&'static str , &'static [u8]> = {};",
290+ pub(crate) const RAW_TIME_ZONES_BY_NAME: phf::Map<Lower , &'static [u8]> = {};",
285291 phf. build( ) ,
286292 ) ?;
287293 writeln ! ( f) ?;
0 commit comments