Skip to main content

icu_datetime/scaffold/
names_storage.rs

1// This file is part of ICU4X. For terms of use, please see the file
2// called LICENSE at the top level of the ICU4X source tree
3// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5use crate::error::ErrorField;
6use crate::pattern::{
7    DayPeriodNameLength, MonthNameLength, PatternLoadError, WeekdayNameLength, YearNameLength,
8};
9use crate::provider::names::*;
10use crate::provider::time_zones::tz;
11use core::fmt;
12use icu_provider::prelude::*;
13use yoke::Yokeable;
14
15use super::UnstableSealed;
16
17/// Trait for a type that owns datetime names data, usually in the form of data payloads.
18///
19/// This trait allows for types that contain data for some but not all types of datetime names,
20/// allowing for reduced stack size. For example, a type could contain year and month names but
21/// not weekday, day period, or time zone names.
22///
23/// <div class="stab unstable">
24/// 🚧 This trait is considered unstable; it may change at any time, in breaking or non-breaking ways,
25/// including in SemVer minor releases. Do not implement this trait in userland unless you are prepared for things to occasionally break.
26/// </div>
27#[allow(missing_docs)]
28pub trait DateTimeNamesMarker: UnstableSealed {
29    type YearNames: NamesContainer<YearNamesV1, YearNameLength>;
30    type MonthNames: NamesContainer<MonthNamesV1, MonthNameLength>;
31    type WeekdayNames: NamesContainer<WeekdayNamesV1, WeekdayNameLength>;
32    type DayPeriodNames: NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>;
33    type ZoneEssentials: NamesContainer<tz::EssentialsV1, ()>;
34    type ZoneLocations: NamesContainer<tz::LocationsOverrideV1, ()>;
35    type ZoneLocationsRoot: NamesContainer<tz::LocationsRootV1, ()>;
36    type ZoneExemplars: NamesContainer<tz::CitiesOverrideV1, ()>;
37    type ZoneExemplarsRoot: NamesContainer<tz::CitiesRootV1, ()>;
38    type ZoneGenericLong: NamesContainer<tz::MzGenericLongV1, ()>;
39    type ZoneGenericShort: NamesContainer<tz::MzGenericShortV1, ()>;
40    type ZoneStandardLong: NamesContainer<tz::MzStandardLongV1, ()>;
41    type ZoneSpecificLong: NamesContainer<tz::MzSpecificLongV1, ()>;
42    type ZoneSpecificShort: NamesContainer<tz::MzSpecificShortV1, ()>;
43    type MetazoneLookup: NamesContainer<tz::MzPeriodV1, ()>;
44}
45
46/// A trait for `Variables` that can be converted to [`ErrorField`]
47pub trait MaybeAsErrorField: UnstableSealed {
48    fn maybe_as_error_field(&self) -> Option<ErrorField>;
49}
50
51impl MaybeAsErrorField for () {
52    fn maybe_as_error_field(&self) -> Option<ErrorField> {
53        None
54    }
55}
56
57impl UnstableSealed for YearNameLength {}
58impl MaybeAsErrorField for YearNameLength {
59    fn maybe_as_error_field(&self) -> Option<ErrorField> {
60        Some(self.to_approximate_error_field())
61    }
62}
63
64impl UnstableSealed for MonthNameLength {}
65impl MaybeAsErrorField for MonthNameLength {
66    fn maybe_as_error_field(&self) -> Option<ErrorField> {
67        Some(self.to_approximate_error_field())
68    }
69}
70
71impl UnstableSealed for WeekdayNameLength {}
72impl MaybeAsErrorField for WeekdayNameLength {
73    fn maybe_as_error_field(&self) -> Option<ErrorField> {
74        Some(self.to_approximate_error_field())
75    }
76}
77
78impl UnstableSealed for DayPeriodNameLength {}
79impl MaybeAsErrorField for DayPeriodNameLength {
80    fn maybe_as_error_field(&self) -> Option<ErrorField> {
81        Some(self.to_approximate_error_field())
82    }
83}
84
85/// Trait that associates a container for a payload parameterized by the given variables.
86///
87/// <div class="stab unstable">
88/// 🚧 This trait is considered unstable; it may change at any time, in breaking or non-breaking ways,
89/// including in SemVer minor releases. Do not implement this trait in userland unless you are prepared for things to occasionally break.
90/// </div>
91#[allow(missing_docs)]
92pub trait NamesContainer<M: DynamicDataMarker, Variables>: UnstableSealed
93where
94    Variables: PartialEq + Copy + fmt::Debug,
95{
96    type Container: MaybePayload<M, Variables> + fmt::Debug + Clone;
97}
98
99impl<M: DynamicDataMarker, Variables> NamesContainer<M, Variables> for ()
100where
101    Variables: PartialEq + Copy + fmt::Debug,
102{
103    type Container = ();
104}
105
106macro_rules! impl_holder_trait {
107    ($marker:path) => {
108        impl UnstableSealed for $marker {}
109        impl<Variables> NamesContainer<$marker, Variables> for $marker
110        where
111            Variables: PartialEq + Copy + MaybeAsErrorField + fmt::Debug,
112        {
113            type Container = DataPayloadWithVariables<$marker, Variables>;
114        }
115    };
116}
117
118impl_holder_trait!(YearNamesV1);
119impl_holder_trait!(MonthNamesV1);
120impl_holder_trait!(WeekdayNamesV1);
121impl_holder_trait!(DayPeriodNamesV1);
122impl_holder_trait!(tz::EssentialsV1);
123impl_holder_trait!(tz::LocationsOverrideV1);
124impl_holder_trait!(tz::LocationsRootV1);
125impl_holder_trait!(tz::CitiesOverrideV1);
126impl_holder_trait!(tz::CitiesRootV1);
127impl_holder_trait!(tz::MzGenericLongV1);
128impl_holder_trait!(tz::MzGenericShortV1);
129impl_holder_trait!(tz::MzStandardLongV1);
130impl_holder_trait!(tz::MzSpecificLongV1);
131impl_holder_trait!(tz::MzSpecificShortV1);
132impl_holder_trait!(tz::MzPeriodV1);
133
134/// An error returned by [`MaybePayload`].
135#[allow(missing_docs)]
136#[derive(Debug, Copy, Clone, displaydoc::Display)]
137#[non_exhaustive]
138pub enum MaybePayloadError {
139    /// The container's field set doesn't support the field
140    FormatterTooSpecific,
141    /// The field is already loaded with a different length
142    ConflictingField(ErrorField),
143}
144
145impl core::error::Error for MaybePayloadError {}
146
147impl MaybePayloadError {
148    pub(crate) fn into_load_error(self, error_field: ErrorField) -> PatternLoadError {
149        match self {
150            Self::FormatterTooSpecific => PatternLoadError::FormatterTooSpecific(error_field),
151            Self::ConflictingField(loaded_field) => PatternLoadError::ConflictingField {
152                field: error_field,
153                previous_field: loaded_field,
154            },
155        }
156    }
157}
158
159/// A type that may or may not be a [`DataPayload`] and may or may not contain
160/// a value depending on the type parameter `Variables`.
161///
162/// Helper trait for [`DateTimeNamesMarker`].
163///
164/// <div class="stab unstable">
165/// 🚧 This trait is considered unstable; it may change at any time, in breaking or non-breaking ways,
166/// including in SemVer minor releases. Do not implement this trait in userland unless you are prepared for things to occasionally break.
167/// </div>
168#[allow(missing_docs)]
169pub trait MaybePayload<M: DynamicDataMarker, Variables>: UnstableSealed {
170    fn new_empty() -> Self;
171    fn load_put<P>(
172        &mut self,
173        provider: &P,
174        req: DataRequest,
175        variables: Variables,
176    ) -> Result<Result<DataResponseMetadata, DataError>, MaybePayloadError>
177    where
178        P: BoundDataProvider<M> + ?Sized,
179        Self: Sized;
180    fn get(&self) -> DataPayloadWithVariablesBorrowed<'_, M, Variables>;
181}
182
183/// An implementation of [`MaybePayload`] that wraps an optional [`DataPayload`],
184/// parameterized by `Variables`.
185pub struct DataPayloadWithVariables<M: DynamicDataMarker, Variables> {
186    inner: OptionalNames<Variables, DataPayload<M>>,
187}
188
189impl<M: DynamicDataMarker, Variables> Clone for DataPayloadWithVariables<M, Variables>
190where
191    Variables: Clone,
192    DataPayload<M>: Clone,
193{
194    fn clone(&self) -> Self {
195        Self {
196            inner: self.inner.clone(),
197        }
198    }
199}
200
201impl<M: DynamicDataMarker, Variables> UnstableSealed for DataPayloadWithVariables<M, Variables> {}
202
203impl<M: DynamicDataMarker, Variables> fmt::Debug for DataPayloadWithVariables<M, Variables>
204where
205    Variables: fmt::Debug,
206    DataPayload<M>: fmt::Debug,
207{
208    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
209        self.inner.fmt(f)
210    }
211}
212
213// NOTE: This impl enables `cast_into_fset` functions to work.
214impl<M: DynamicDataMarker, Variables> From<()> for DataPayloadWithVariables<M, Variables> {
215    #[inline]
216    fn from(_: ()) -> Self {
217        Self {
218            inner: OptionalNames::None,
219        }
220    }
221}
222
223/// Borrowed version of [`DataPayloadWithVariables`].
224#[allow(missing_docs)]
225pub struct DataPayloadWithVariablesBorrowed<'data, M: DynamicDataMarker, Variables> {
226    pub(crate) inner: OptionalNames<Variables, &'data <M::DataStruct as Yokeable<'data>>::Output>,
227}
228
229impl<'data, M: DynamicDataMarker, Variables> fmt::Debug
230    for DataPayloadWithVariablesBorrowed<'data, M, Variables>
231where
232    <M::DataStruct as Yokeable<'data>>::Output: fmt::Debug,
233    Variables: fmt::Debug,
234{
235    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
236        f.debug_struct(core::any::type_name::<Self>())
237            .field("inner", &self.inner)
238            .finish()
239    }
240}
241
242impl<M: DynamicDataMarker, Variables> MaybePayload<M, Variables>
243    for DataPayloadWithVariables<M, Variables>
244where
245    Variables: PartialEq + Copy + MaybeAsErrorField,
246{
247    #[inline]
248    fn new_empty() -> Self {
249        Self {
250            inner: OptionalNames::None,
251        }
252    }
253    fn load_put<P>(
254        &mut self,
255        provider: &P,
256        req: DataRequest,
257        variables: Variables,
258    ) -> Result<Result<DataResponseMetadata, DataError>, MaybePayloadError>
259    where
260        P: BoundDataProvider<M> + ?Sized,
261        Self: Sized,
262    {
263        let arg_variables = variables;
264        match &self.inner {
265            OptionalNames::SingleLength { variables, .. } if arg_variables == *variables => {
266                // NOTE: We don't store the checksum so we can't recover it. See #6063
267                return Ok(Ok(Default::default()));
268            }
269            OptionalNames::SingleLength { variables, .. } => {
270                let loaded_field = match variables.maybe_as_error_field() {
271                    Some(x) => x,
272                    None => {
273                        debug_assert!(false, "all non-unit variables implement this trait");
274                        use crate::provider::fields::*;
275                        ErrorField(Field {
276                            symbol: FieldSymbol::Era,
277                            length: FieldLength::Six,
278                        })
279                    }
280                };
281                return Err(MaybePayloadError::ConflictingField(loaded_field));
282            }
283            OptionalNames::None => (),
284        };
285        match provider.load_bound(req) {
286            Ok(response) => {
287                self.inner = OptionalNames::SingleLength {
288                    payload: response.payload,
289                    variables: arg_variables,
290                };
291                Ok(Ok(response.metadata))
292            }
293            Err(e) => Ok(Err(e)),
294        }
295    }
296    #[inline]
297    fn get(&self) -> DataPayloadWithVariablesBorrowed<'_, M, Variables> {
298        DataPayloadWithVariablesBorrowed {
299            inner: self.inner.as_borrowed(),
300        }
301    }
302}
303
304impl<M: DynamicDataMarker, Variables> MaybePayload<M, Variables> for () {
305    #[inline]
306    fn new_empty() -> Self {}
307    #[inline]
308    fn load_put<P>(
309        &mut self,
310        _: &P,
311        _: DataRequest,
312        _: Variables,
313    ) -> Result<Result<DataResponseMetadata, DataError>, MaybePayloadError>
314    where
315        P: BoundDataProvider<M> + ?Sized,
316        Self: Sized,
317    {
318        Err(MaybePayloadError::FormatterTooSpecific)
319    }
320    #[inline]
321    fn get(&self) -> DataPayloadWithVariablesBorrowed<'_, M, Variables> {
322        DataPayloadWithVariablesBorrowed {
323            inner: OptionalNames::None,
324        }
325    }
326}
327
328/// This can be extended in the future to support multiple lengths.
329/// For now, this type wraps a symbols object tagged with a single length. See [#4337](https://github.com/unicode-org/icu4x/issues/4337)
330#[derive(Debug, Copy, Clone)]
331pub(crate) enum OptionalNames<Variables, Payload> {
332    None,
333    SingleLength {
334        variables: Variables,
335        payload: Payload,
336    },
337}
338
339impl<Variables, Payload> OptionalNames<Variables, Payload>
340where
341    Variables: Copy + PartialEq,
342    Payload: Copy,
343{
344    pub(crate) fn get_with_variables(&self, arg_variables: Variables) -> Option<Payload> {
345        match self {
346            Self::None => None,
347            Self::SingleLength { variables, payload } if arg_variables == *variables => {
348                Some(*payload)
349            }
350            _ => None,
351        }
352    }
353
354    /// Returns the underlying payload regardless of variable matching.
355    #[allow(dead_code, reason = "https://github.com/unicode-org/icu4x/issues/5448")]
356    pub(crate) fn get_any(&self) -> Option<Payload> {
357        match self {
358            Self::None => None,
359            Self::SingleLength { payload, .. } => Some(*payload),
360        }
361    }
362}
363
364impl<Payload> OptionalNames<(), Payload>
365where
366    Payload: Copy,
367{
368    pub(crate) fn get_option(&self) -> Option<Payload> {
369        match self {
370            Self::SingleLength {
371                variables: (),
372                payload,
373            } => Some(*payload),
374            _ => None,
375        }
376    }
377}
378
379impl<M: DynamicDataMarker, Variables> OptionalNames<Variables, DataPayload<M>>
380where
381    Variables: Copy,
382{
383    #[inline]
384    pub(crate) fn as_borrowed<'a>(
385        &'a self,
386    ) -> OptionalNames<Variables, &'a <M::DataStruct as Yokeable<'a>>::Output> {
387        match self {
388            Self::None => OptionalNames::None,
389            Self::SingleLength { variables, payload } => OptionalNames::SingleLength {
390                variables: *variables,
391                payload: payload.get(),
392            },
393        }
394    }
395}
396
397/// A trait for a [`DateTimeNamesMarker`] that can be created from a more specific one, `M`.
398///
399/// This trait is blanket-implemented on all [field sets](crate::fieldsets) that are more general than `M`.
400///
401/// # Examples
402///
403/// Example pairs of field sets where the trait is implemented:
404///
405/// ```
406/// use icu::datetime::fieldsets::T;
407/// use icu::datetime::fieldsets::YMD;
408/// use icu::datetime::fieldsets::enums::CompositeDateTimeFieldSet;
409/// use icu::datetime::fieldsets::enums::CompositeFieldSet;
410/// use icu::datetime::fieldsets::enums::DateFieldSet;
411/// use icu::datetime::fieldsets::enums::TimeFieldSet;
412/// use icu::datetime::scaffold::DateTimeNamesFrom;
413/// use icu::datetime::scaffold::DateTimeNamesMarker;
414///
415/// fn is_trait_implemented<Source, Target>()
416/// where
417///     Source: DateTimeNamesMarker,
418///     Target: DateTimeNamesFrom<Source>,
419/// {
420/// }
421///
422/// is_trait_implemented::<YMD, DateFieldSet>();
423/// is_trait_implemented::<YMD, CompositeDateTimeFieldSet>();
424/// is_trait_implemented::<YMD, CompositeFieldSet>();
425/// is_trait_implemented::<T, TimeFieldSet>();
426/// is_trait_implemented::<T, CompositeDateTimeFieldSet>();
427/// is_trait_implemented::<T, CompositeFieldSet>();
428/// is_trait_implemented::<DateFieldSet, CompositeDateTimeFieldSet>();
429/// is_trait_implemented::<DateFieldSet, CompositeFieldSet>();
430/// is_trait_implemented::<TimeFieldSet, CompositeDateTimeFieldSet>();
431/// is_trait_implemented::<TimeFieldSet, CompositeFieldSet>();
432/// ```
433#[allow(missing_docs)]
434// This trait is implicitly sealed due to sealed supertraits
435pub trait DateTimeNamesFrom<M: DateTimeNamesMarker>: DateTimeNamesMarker {
436    fn map_year_names(
437        other: <M::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container,
438    ) -> <Self::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container;
439    fn map_month_names(
440        other: <M::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container,
441    ) -> <Self::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container;
442    fn map_weekday_names(
443        other: <M::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container,
444    ) -> <Self::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container;
445    fn map_day_period_names(
446        other: <M::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container,
447    ) -> <Self::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container;
448    fn map_zone_essentials(
449        other: <M::ZoneEssentials as NamesContainer<tz::EssentialsV1, ()>>::Container,
450    ) -> <Self::ZoneEssentials as NamesContainer<tz::EssentialsV1, ()>>::Container;
451    fn map_zone_locations(
452        other: <M::ZoneLocations as NamesContainer<tz::LocationsOverrideV1, ()>>::Container,
453    ) -> <Self::ZoneLocations as NamesContainer<tz::LocationsOverrideV1, ()>>::Container;
454    fn map_zone_locations_root(
455        other: <M::ZoneLocationsRoot as NamesContainer<tz::LocationsRootV1, ()>>::Container,
456    ) -> <Self::ZoneLocationsRoot as NamesContainer<tz::LocationsRootV1, ()>>::Container;
457    fn map_zone_exemplars(
458        other: <M::ZoneExemplars as NamesContainer<tz::CitiesOverrideV1, ()>>::Container,
459    ) -> <Self::ZoneExemplars as NamesContainer<tz::CitiesOverrideV1, ()>>::Container;
460    fn map_zone_exemplars_root(
461        other: <M::ZoneExemplarsRoot as NamesContainer<tz::CitiesRootV1, ()>>::Container,
462    ) -> <Self::ZoneExemplarsRoot as NamesContainer<tz::CitiesRootV1, ()>>::Container;
463    fn map_zone_generic_long(
464        other: <M::ZoneGenericLong as NamesContainer<tz::MzGenericLongV1, ()>>::Container,
465    ) -> <Self::ZoneGenericLong as NamesContainer<tz::MzGenericLongV1, ()>>::Container;
466    fn map_zone_generic_short(
467        other: <M::ZoneGenericShort as NamesContainer<tz::MzGenericShortV1, ()>>::Container,
468    ) -> <Self::ZoneGenericShort as NamesContainer<tz::MzGenericShortV1, ()>>::Container;
469    fn map_zone_standard_long(
470        other: <M::ZoneStandardLong as NamesContainer<tz::MzStandardLongV1, ()>>::Container,
471    ) -> <Self::ZoneStandardLong as NamesContainer<tz::MzStandardLongV1, ()>>::Container;
472    fn map_zone_specific_long(
473        other: <M::ZoneSpecificLong as NamesContainer<tz::MzSpecificLongV1, ()>>::Container,
474    ) -> <Self::ZoneSpecificLong as NamesContainer<tz::MzSpecificLongV1, ()>>::Container;
475    fn map_zone_specific_short(
476        other: <M::ZoneSpecificShort as NamesContainer<tz::MzSpecificShortV1, ()>>::Container,
477    ) -> <Self::ZoneSpecificShort as NamesContainer<tz::MzSpecificShortV1, ()>>::Container;
478    fn map_metazone_lookup(
479        other: <M::MetazoneLookup as NamesContainer<tz::MzPeriodV1, ()>>::Container,
480    ) -> <Self::MetazoneLookup as NamesContainer<tz::MzPeriodV1, ()>>::Container;
481}
482
483impl<M: DateTimeNamesMarker, T: DateTimeNamesMarker> DateTimeNamesFrom<M> for T
484where
485    <Self::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container:
486        From<<M::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container>,
487    <Self::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container:
488        From<<M::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container>,
489    <Self::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container:
490        From<<M::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container>,
491    <Self::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container:
492        From<
493            <M::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container,
494        >,
495    <Self::ZoneEssentials as NamesContainer<tz::EssentialsV1, ()>>::Container:
496        From<<M::ZoneEssentials as NamesContainer<tz::EssentialsV1, ()>>::Container>,
497    <Self::ZoneLocations as NamesContainer<tz::LocationsOverrideV1, ()>>::Container:
498        From<<M::ZoneLocations as NamesContainer<tz::LocationsOverrideV1, ()>>::Container>,
499    <Self::ZoneLocationsRoot as NamesContainer<tz::LocationsRootV1, ()>>::Container:
500        From<<M::ZoneLocationsRoot as NamesContainer<tz::LocationsRootV1, ()>>::Container>,
501    <Self::ZoneExemplars as NamesContainer<tz::CitiesOverrideV1, ()>>::Container:
502        From<<M::ZoneExemplars as NamesContainer<tz::CitiesOverrideV1, ()>>::Container>,
503    <Self::ZoneExemplarsRoot as NamesContainer<tz::CitiesRootV1, ()>>::Container:
504        From<<M::ZoneExemplarsRoot as NamesContainer<tz::CitiesRootV1, ()>>::Container>,
505    <Self::ZoneGenericLong as NamesContainer<tz::MzGenericLongV1, ()>>::Container:
506        From<<M::ZoneGenericLong as NamesContainer<tz::MzGenericLongV1, ()>>::Container>,
507    <Self::ZoneGenericShort as NamesContainer<tz::MzGenericShortV1, ()>>::Container:
508        From<<M::ZoneGenericShort as NamesContainer<tz::MzGenericShortV1, ()>>::Container>,
509    <Self::ZoneStandardLong as NamesContainer<tz::MzStandardLongV1, ()>>::Container:
510        From<<M::ZoneStandardLong as NamesContainer<tz::MzStandardLongV1, ()>>::Container>,
511    <Self::ZoneSpecificLong as NamesContainer<tz::MzSpecificLongV1, ()>>::Container:
512        From<<M::ZoneSpecificLong as NamesContainer<tz::MzSpecificLongV1, ()>>::Container>,
513    <Self::ZoneSpecificShort as NamesContainer<tz::MzSpecificShortV1, ()>>::Container:
514        From<<M::ZoneSpecificShort as NamesContainer<tz::MzSpecificShortV1, ()>>::Container>,
515    <Self::MetazoneLookup as NamesContainer<tz::MzPeriodV1, ()>>::Container:
516        From<<M::MetazoneLookup as NamesContainer<tz::MzPeriodV1, ()>>::Container>,
517{
518    #[inline]
519    fn map_year_names(
520        other: <M::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container,
521    ) -> <Self::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container {
522        other.into()
523    }
524    #[inline]
525    fn map_month_names(
526        other: <M::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container,
527    ) -> <Self::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container {
528        other.into()
529    }
530    #[inline]
531    fn map_weekday_names(
532        other: <M::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container,
533    ) -> <Self::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container {
534        other.into()
535    }
536    #[inline]
537    fn map_day_period_names(
538        other: <M::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container,
539    ) -> <Self::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container
540    {
541        other.into()
542    }
543    #[inline]
544    fn map_zone_essentials(
545        other: <M::ZoneEssentials as NamesContainer<tz::EssentialsV1, ()>>::Container,
546    ) -> <Self::ZoneEssentials as NamesContainer<tz::EssentialsV1, ()>>::Container {
547        other.into()
548    }
549    #[inline]
550    fn map_zone_locations(
551        other: <M::ZoneLocations as NamesContainer<tz::LocationsOverrideV1, ()>>::Container,
552    ) -> <Self::ZoneLocations as NamesContainer<tz::LocationsOverrideV1, ()>>::Container {
553        other.into()
554    }
555    #[inline]
556    fn map_zone_locations_root(
557        other: <M::ZoneLocationsRoot as NamesContainer<tz::LocationsRootV1, ()>>::Container,
558    ) -> <Self::ZoneLocationsRoot as NamesContainer<tz::LocationsRootV1, ()>>::Container {
559        other.into()
560    }
561    #[inline]
562    fn map_zone_exemplars(
563        other: <M::ZoneExemplars as NamesContainer<tz::CitiesOverrideV1, ()>>::Container,
564    ) -> <Self::ZoneExemplars as NamesContainer<tz::CitiesOverrideV1, ()>>::Container {
565        other.into()
566    }
567    #[inline]
568    fn map_zone_exemplars_root(
569        other: <M::ZoneExemplarsRoot as NamesContainer<tz::CitiesRootV1, ()>>::Container,
570    ) -> <Self::ZoneExemplarsRoot as NamesContainer<tz::CitiesRootV1, ()>>::Container {
571        other.into()
572    }
573    #[inline]
574    fn map_zone_generic_long(
575        other: <M::ZoneGenericLong as NamesContainer<tz::MzGenericLongV1, ()>>::Container,
576    ) -> <Self::ZoneGenericLong as NamesContainer<tz::MzGenericLongV1, ()>>::Container {
577        other.into()
578    }
579    #[inline]
580    fn map_zone_generic_short(
581        other: <M::ZoneGenericShort as NamesContainer<tz::MzGenericShortV1, ()>>::Container,
582    ) -> <Self::ZoneGenericShort as NamesContainer<tz::MzGenericShortV1, ()>>::Container {
583        other.into()
584    }
585    #[inline]
586    fn map_zone_standard_long(
587        other: <M::ZoneStandardLong as NamesContainer<tz::MzStandardLongV1, ()>>::Container,
588    ) -> <Self::ZoneStandardLong as NamesContainer<tz::MzStandardLongV1, ()>>::Container {
589        other.into()
590    }
591    #[inline]
592    fn map_zone_specific_long(
593        other: <M::ZoneSpecificLong as NamesContainer<tz::MzSpecificLongV1, ()>>::Container,
594    ) -> <Self::ZoneSpecificLong as NamesContainer<tz::MzSpecificLongV1, ()>>::Container {
595        other.into()
596    }
597    #[inline]
598    fn map_zone_specific_short(
599        other: <M::ZoneSpecificShort as NamesContainer<tz::MzSpecificShortV1, ()>>::Container,
600    ) -> <Self::ZoneSpecificShort as NamesContainer<tz::MzSpecificShortV1, ()>>::Container {
601        other.into()
602    }
603    #[inline]
604    fn map_metazone_lookup(
605        other: <M::MetazoneLookup as NamesContainer<tz::MzPeriodV1, ()>>::Container,
606    ) -> <Self::MetazoneLookup as NamesContainer<tz::MzPeriodV1, ()>>::Container {
607        other.into()
608    }
609}