tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

zoned_date_time_formatter.rs (53498B)


      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 
      5 // @generated by tools/make/codegen/src/capi_datetime.rs
      6 
      7 #[rustfmt::skip]
      8 #[diplomat::bridge]
      9 #[diplomat::abi_rename = "icu4x_{0}_mv1"]
     10 #[diplomat::attr(auto, namespace = "icu4x")]
     11 pub mod ffi {
     12    use alloc::boxed::Box;
     13    use icu_calendar::Gregorian;
     14    use writeable::TryWriteable;
     15 
     16    #[allow(unused_imports)]
     17    use crate::datetime_helpers::{self, map_or_default};
     18 
     19    #[allow(unused_imports)]
     20    use crate::unstable::{
     21        date_formatter::ffi::{DateFormatter, DateFormatterGregorian},
     22        date_time_formatter::ffi::{DateTimeFormatter, DateTimeFormatterGregorian},
     23        date::ffi::IsoDate,
     24        datetime_options::ffi::{DateTimeAlignment, DateTimeLength, TimePrecision},
     25        errors::ffi::DateTimeFormatterLoadError,
     26        errors::ffi::DateTimeWriteError,
     27        locale_core::ffi::Locale,
     28        time_formatter::ffi::TimeFormatter,
     29        time::ffi::Time,
     30        timezone::ffi::TimeZoneInfo,
     31    };
     32 
     33    #[cfg(feature = "buffer_provider")]
     34    use crate::unstable::provider::ffi::DataProvider;
     35 
     36    #[diplomat::opaque]
     37    #[diplomat::rust_link(icu::datetime::DateTimeFormatter, Struct)]
     38    pub struct ZonedDateTimeFormatter(
     39        pub  icu_datetime::DateTimeFormatter<
     40            icu_datetime::fieldsets::enums::ZonedDateAndTimeFieldSet
     41        >,
     42    );
     43 
     44    impl ZonedDateTimeFormatter {
     45        /// Creates a zoned formatter based on a non-zoned formatter.
     46        ///
     47        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
     48        /// or else unexpected behavior may occur!
     49        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_long")]
     50        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificLong, Struct)]
     51        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
     52        #[cfg(feature = "compiled_data")]
     53        pub fn create_specific_long(
     54            locale: &Locale,
     55            formatter: &DateTimeFormatter,
     56        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
     57            let zone = icu_datetime::fieldsets::zone::SpecificLong;
     58            datetime_helpers::datetime_formatter_with_zone(
     59                &formatter.0,
     60                locale,
     61                zone,
     62                |names| {
     63                    names
     64                        .as_mut()
     65                        .include_time_zone_specific_long_names_with_fallback(
     66                        )?;
     67                    Ok(())
     68                },
     69                |names, field_set| names.try_into_formatter(
     70                    field_set
     71                ),
     72            )
     73        }
     74        
     75        /// Creates a zoned formatter based on a non-zoned formatter.
     76        ///
     77        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
     78        /// or else unexpected behavior may occur!
     79        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_long_with_provider")]
     80        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificLong, Struct)]
     81        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
     82        #[cfg(feature = "buffer_provider")]
     83        pub fn create_specific_long_with_provider(
     84            provider: &DataProvider,
     85            locale: &Locale,
     86            formatter: &DateTimeFormatter,
     87        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
     88            let provider = provider.get()?;
     89            let zone = icu_datetime::fieldsets::zone::SpecificLong;
     90            datetime_helpers::datetime_formatter_with_zone(
     91                &formatter.0,
     92                locale,
     93                zone,
     94                |names| {
     95                    use icu_provider::buf::AsDeserializingBufferProvider;
     96                    let provider = provider.as_deserializing();
     97                    names
     98                        .as_mut()
     99                        .load_time_zone_specific_long_names_with_fallback(
    100                            &provider
    101                        )?;
    102                    Ok(())
    103                },
    104                |names, field_set| names.try_into_formatter_with_buffer_provider(
    105                    &provider,
    106                    field_set
    107                ),
    108            )
    109        }
    110        
    111        /// Creates a zoned formatter based on a non-zoned formatter.
    112        ///
    113        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    114        /// or else unexpected behavior may occur!
    115        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_short")]
    116        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificShort, Struct)]
    117        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    118        #[cfg(feature = "compiled_data")]
    119        pub fn create_specific_short(
    120            locale: &Locale,
    121            formatter: &DateTimeFormatter,
    122        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    123            let zone = icu_datetime::fieldsets::zone::SpecificShort;
    124            datetime_helpers::datetime_formatter_with_zone(
    125                &formatter.0,
    126                locale,
    127                zone,
    128                |names| {
    129                    names
    130                        .as_mut()
    131                        .include_time_zone_specific_short_names_with_fallback(
    132                        )?;
    133                    Ok(())
    134                },
    135                |names, field_set| names.try_into_formatter(
    136                    field_set
    137                ),
    138            )
    139        }
    140        
    141        /// Creates a zoned formatter based on a non-zoned formatter.
    142        ///
    143        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    144        /// or else unexpected behavior may occur!
    145        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_short_with_provider")]
    146        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificShort, Struct)]
    147        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    148        #[cfg(feature = "buffer_provider")]
    149        pub fn create_specific_short_with_provider(
    150            provider: &DataProvider,
    151            locale: &Locale,
    152            formatter: &DateTimeFormatter,
    153        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    154            let provider = provider.get()?;
    155            let zone = icu_datetime::fieldsets::zone::SpecificShort;
    156            datetime_helpers::datetime_formatter_with_zone(
    157                &formatter.0,
    158                locale,
    159                zone,
    160                |names| {
    161                    use icu_provider::buf::AsDeserializingBufferProvider;
    162                    let provider = provider.as_deserializing();
    163                    names
    164                        .as_mut()
    165                        .load_time_zone_specific_short_names_with_fallback(
    166                            &provider
    167                        )?;
    168                    Ok(())
    169                },
    170                |names, field_set| names.try_into_formatter_with_buffer_provider(
    171                    &provider,
    172                    field_set
    173                ),
    174            )
    175        }
    176        
    177        /// Creates a zoned formatter based on a non-zoned formatter.
    178        ///
    179        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    180        /// or else unexpected behavior may occur!
    181        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_long")]
    182        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetLong, Struct)]
    183        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    184        #[cfg(feature = "compiled_data")]
    185        pub fn create_localized_offset_long(
    186            locale: &Locale,
    187            formatter: &DateTimeFormatter,
    188        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    189            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetLong;
    190            datetime_helpers::datetime_formatter_with_zone(
    191                &formatter.0,
    192                locale,
    193                zone,
    194                |names| {
    195                    names
    196                        .as_mut()
    197                        .include_time_zone_localized_offset_names_with_fallback(
    198                        )?;
    199                    Ok(())
    200                },
    201                |names, field_set| names.try_into_formatter(
    202                    field_set
    203                ),
    204            )
    205        }
    206        
    207        /// Creates a zoned formatter based on a non-zoned formatter.
    208        ///
    209        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    210        /// or else unexpected behavior may occur!
    211        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_long_with_provider")]
    212        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetLong, Struct)]
    213        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    214        #[cfg(feature = "buffer_provider")]
    215        pub fn create_localized_offset_long_with_provider(
    216            provider: &DataProvider,
    217            locale: &Locale,
    218            formatter: &DateTimeFormatter,
    219        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    220            let provider = provider.get()?;
    221            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetLong;
    222            datetime_helpers::datetime_formatter_with_zone(
    223                &formatter.0,
    224                locale,
    225                zone,
    226                |names| {
    227                    use icu_provider::buf::AsDeserializingBufferProvider;
    228                    let provider = provider.as_deserializing();
    229                    names
    230                        .as_mut()
    231                        .load_time_zone_localized_offset_names_with_fallback(
    232                            &provider
    233                        )?;
    234                    Ok(())
    235                },
    236                |names, field_set| names.try_into_formatter_with_buffer_provider(
    237                    &provider,
    238                    field_set
    239                ),
    240            )
    241        }
    242        
    243        /// Creates a zoned formatter based on a non-zoned formatter.
    244        ///
    245        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    246        /// or else unexpected behavior may occur!
    247        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_short")]
    248        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetShort, Struct)]
    249        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    250        #[cfg(feature = "compiled_data")]
    251        pub fn create_localized_offset_short(
    252            locale: &Locale,
    253            formatter: &DateTimeFormatter,
    254        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    255            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetShort;
    256            datetime_helpers::datetime_formatter_with_zone(
    257                &formatter.0,
    258                locale,
    259                zone,
    260                |names| {
    261                    names
    262                        .as_mut()
    263                        .include_time_zone_localized_offset_names_with_fallback(
    264                        )?;
    265                    Ok(())
    266                },
    267                |names, field_set| names.try_into_formatter(
    268                    field_set
    269                ),
    270            )
    271        }
    272        
    273        /// Creates a zoned formatter based on a non-zoned formatter.
    274        ///
    275        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    276        /// or else unexpected behavior may occur!
    277        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_short_with_provider")]
    278        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetShort, Struct)]
    279        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    280        #[cfg(feature = "buffer_provider")]
    281        pub fn create_localized_offset_short_with_provider(
    282            provider: &DataProvider,
    283            locale: &Locale,
    284            formatter: &DateTimeFormatter,
    285        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    286            let provider = provider.get()?;
    287            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetShort;
    288            datetime_helpers::datetime_formatter_with_zone(
    289                &formatter.0,
    290                locale,
    291                zone,
    292                |names| {
    293                    use icu_provider::buf::AsDeserializingBufferProvider;
    294                    let provider = provider.as_deserializing();
    295                    names
    296                        .as_mut()
    297                        .load_time_zone_localized_offset_names_with_fallback(
    298                            &provider
    299                        )?;
    300                    Ok(())
    301                },
    302                |names, field_set| names.try_into_formatter_with_buffer_provider(
    303                    &provider,
    304                    field_set
    305                ),
    306            )
    307        }
    308        
    309        /// Creates a zoned formatter based on a non-zoned formatter.
    310        ///
    311        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    312        /// or else unexpected behavior may occur!
    313        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_long")]
    314        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericLong, Struct)]
    315        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    316        #[cfg(feature = "compiled_data")]
    317        pub fn create_generic_long(
    318            locale: &Locale,
    319            formatter: &DateTimeFormatter,
    320        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    321            let zone = icu_datetime::fieldsets::zone::GenericLong;
    322            datetime_helpers::datetime_formatter_with_zone(
    323                &formatter.0,
    324                locale,
    325                zone,
    326                |names| {
    327                    names
    328                        .as_mut()
    329                        .include_time_zone_generic_long_names_with_fallback(
    330                        )?;
    331                    Ok(())
    332                },
    333                |names, field_set| names.try_into_formatter(
    334                    field_set
    335                ),
    336            )
    337        }
    338        
    339        /// Creates a zoned formatter based on a non-zoned formatter.
    340        ///
    341        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    342        /// or else unexpected behavior may occur!
    343        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_long_with_provider")]
    344        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericLong, Struct)]
    345        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    346        #[cfg(feature = "buffer_provider")]
    347        pub fn create_generic_long_with_provider(
    348            provider: &DataProvider,
    349            locale: &Locale,
    350            formatter: &DateTimeFormatter,
    351        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    352            let provider = provider.get()?;
    353            let zone = icu_datetime::fieldsets::zone::GenericLong;
    354            datetime_helpers::datetime_formatter_with_zone(
    355                &formatter.0,
    356                locale,
    357                zone,
    358                |names| {
    359                    use icu_provider::buf::AsDeserializingBufferProvider;
    360                    let provider = provider.as_deserializing();
    361                    names
    362                        .as_mut()
    363                        .load_time_zone_generic_long_names_with_fallback(
    364                            &provider
    365                        )?;
    366                    Ok(())
    367                },
    368                |names, field_set| names.try_into_formatter_with_buffer_provider(
    369                    &provider,
    370                    field_set
    371                ),
    372            )
    373        }
    374        
    375        /// Creates a zoned formatter based on a non-zoned formatter.
    376        ///
    377        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    378        /// or else unexpected behavior may occur!
    379        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_short")]
    380        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericShort, Struct)]
    381        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    382        #[diplomat::demo(default_constructor)]
    383        #[cfg(feature = "compiled_data")]
    384        pub fn create_generic_short(
    385            locale: &Locale,
    386            formatter: &DateTimeFormatter,
    387        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    388            let zone = icu_datetime::fieldsets::zone::GenericShort;
    389            datetime_helpers::datetime_formatter_with_zone(
    390                &formatter.0,
    391                locale,
    392                zone,
    393                |names| {
    394                    names
    395                        .as_mut()
    396                        .include_time_zone_generic_short_names_with_fallback(
    397                        )?;
    398                    Ok(())
    399                },
    400                |names, field_set| names.try_into_formatter(
    401                    field_set
    402                ),
    403            )
    404        }
    405        
    406        /// Creates a zoned formatter based on a non-zoned formatter.
    407        ///
    408        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    409        /// or else unexpected behavior may occur!
    410        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_short_with_provider")]
    411        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericShort, Struct)]
    412        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    413        #[cfg(feature = "buffer_provider")]
    414        pub fn create_generic_short_with_provider(
    415            provider: &DataProvider,
    416            locale: &Locale,
    417            formatter: &DateTimeFormatter,
    418        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    419            let provider = provider.get()?;
    420            let zone = icu_datetime::fieldsets::zone::GenericShort;
    421            datetime_helpers::datetime_formatter_with_zone(
    422                &formatter.0,
    423                locale,
    424                zone,
    425                |names| {
    426                    use icu_provider::buf::AsDeserializingBufferProvider;
    427                    let provider = provider.as_deserializing();
    428                    names
    429                        .as_mut()
    430                        .load_time_zone_generic_short_names_with_fallback(
    431                            &provider
    432                        )?;
    433                    Ok(())
    434                },
    435                |names, field_set| names.try_into_formatter_with_buffer_provider(
    436                    &provider,
    437                    field_set
    438                ),
    439            )
    440        }
    441        
    442        /// Creates a zoned formatter based on a non-zoned formatter.
    443        ///
    444        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    445        /// or else unexpected behavior may occur!
    446        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "location")]
    447        #[diplomat::rust_link(icu::datetime::fieldsets::zone::Location, Struct)]
    448        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    449        #[cfg(feature = "compiled_data")]
    450        pub fn create_location(
    451            locale: &Locale,
    452            formatter: &DateTimeFormatter,
    453        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    454            let zone = icu_datetime::fieldsets::zone::Location;
    455            datetime_helpers::datetime_formatter_with_zone(
    456                &formatter.0,
    457                locale,
    458                zone,
    459                |names| {
    460                    names
    461                        .as_mut()
    462                        .include_time_zone_location_names(
    463                        )?;
    464                    Ok(())
    465                },
    466                |names, field_set| names.try_into_formatter(
    467                    field_set
    468                ),
    469            )
    470        }
    471        
    472        /// Creates a zoned formatter based on a non-zoned formatter.
    473        ///
    474        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    475        /// or else unexpected behavior may occur!
    476        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "location_with_provider")]
    477        #[diplomat::rust_link(icu::datetime::fieldsets::zone::Location, Struct)]
    478        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    479        #[cfg(feature = "buffer_provider")]
    480        pub fn create_location_with_provider(
    481            provider: &DataProvider,
    482            locale: &Locale,
    483            formatter: &DateTimeFormatter,
    484        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    485            let provider = provider.get()?;
    486            let zone = icu_datetime::fieldsets::zone::Location;
    487            datetime_helpers::datetime_formatter_with_zone(
    488                &formatter.0,
    489                locale,
    490                zone,
    491                |names| {
    492                    use icu_provider::buf::AsDeserializingBufferProvider;
    493                    let provider = provider.as_deserializing();
    494                    names
    495                        .as_mut()
    496                        .load_time_zone_location_names(
    497                            &provider
    498                        )?;
    499                    Ok(())
    500                },
    501                |names, field_set| names.try_into_formatter_with_buffer_provider(
    502                    &provider,
    503                    field_set
    504                ),
    505            )
    506        }
    507        
    508        /// Creates a zoned formatter based on a non-zoned formatter.
    509        ///
    510        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    511        /// or else unexpected behavior may occur!
    512        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "exemplar_city")]
    513        #[diplomat::rust_link(icu::datetime::fieldsets::zone::ExemplarCity, Struct)]
    514        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    515        #[cfg(feature = "compiled_data")]
    516        pub fn create_exemplar_city(
    517            locale: &Locale,
    518            formatter: &DateTimeFormatter,
    519        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    520            let zone = icu_datetime::fieldsets::zone::ExemplarCity;
    521            datetime_helpers::datetime_formatter_with_zone(
    522                &formatter.0,
    523                locale,
    524                zone,
    525                |names| {
    526                    names
    527                        .as_mut()
    528                        .include_time_zone_exemplar_city_names(
    529                        )?;
    530                    Ok(())
    531                },
    532                |names, field_set| names.try_into_formatter(
    533                    field_set
    534                ),
    535            )
    536        }
    537        
    538        /// Creates a zoned formatter based on a non-zoned formatter.
    539        ///
    540        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    541        /// or else unexpected behavior may occur!
    542        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "exemplar_city_with_provider")]
    543        #[diplomat::rust_link(icu::datetime::fieldsets::zone::ExemplarCity, Struct)]
    544        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    545        #[cfg(feature = "buffer_provider")]
    546        pub fn create_exemplar_city_with_provider(
    547            provider: &DataProvider,
    548            locale: &Locale,
    549            formatter: &DateTimeFormatter,
    550        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    551            let provider = provider.get()?;
    552            let zone = icu_datetime::fieldsets::zone::ExemplarCity;
    553            datetime_helpers::datetime_formatter_with_zone(
    554                &formatter.0,
    555                locale,
    556                zone,
    557                |names| {
    558                    use icu_provider::buf::AsDeserializingBufferProvider;
    559                    let provider = provider.as_deserializing();
    560                    names
    561                        .as_mut()
    562                        .load_time_zone_exemplar_city_names(
    563                            &provider
    564                        )?;
    565                    Ok(())
    566                },
    567                |names, field_set| names.try_into_formatter_with_buffer_provider(
    568                    &provider,
    569                    field_set
    570                ),
    571            )
    572        }
    573        
    574        #[diplomat::rust_link(icu::datetime::DateTimeFormatter::format, FnInStruct)]
    575        #[diplomat::rust_link(icu::datetime::FormattedDateTime, Struct, hidden)]
    576        #[diplomat::rust_link(icu::datetime::FormattedDateTime::to_string, FnInStruct, hidden)]
    577        pub fn format_iso(
    578            &self,
    579            date: &IsoDate,
    580            time: &Time,
    581            zone: &TimeZoneInfo,
    582            write: &mut diplomat_runtime::DiplomatWrite,
    583        ) -> Result<(), DateTimeWriteError> {
    584            let mut input = icu_datetime::unchecked::DateTimeInputUnchecked::default();
    585            let date_in_calendar = date.0.to_calendar(self.0.calendar());
    586            input.set_date_fields_unchecked(date_in_calendar); // calendar conversion on previous line
    587            input.set_time_fields(time.0);
    588            input.set_time_zone_id(zone.id);
    589            if let Some(offset) = zone.offset {
    590                input.set_time_zone_utc_offset(offset);
    591            }
    592            if let Some(zone_name_timestamp) = zone.zone_name_timestamp {
    593                input.set_time_zone_name_timestamp(zone_name_timestamp);
    594            }
    595            else {
    596                input.set_time_zone_name_timestamp(icu_time::zone::ZoneNameTimestamp::from_date_time_iso(icu_time::DateTime {
    597                    date: date.0,
    598                    time: time.0
    599                }))
    600            }
    601            if let Some(variant) = zone.variant {
    602                input.set_time_zone_variant(variant);
    603            }
    604            let _infallible = self
    605                .0
    606                .format_unchecked(input)
    607                .try_write_to(write)
    608                .ok()
    609                .transpose()?;
    610            Ok(())
    611        }
    612    }
    613    
    614 
    615    #[diplomat::opaque]
    616    #[diplomat::rust_link(icu::datetime::FixedCalendarDateTimeFormatter, Struct)]
    617    pub struct ZonedDateTimeFormatterGregorian(
    618        pub  icu_datetime::FixedCalendarDateTimeFormatter<
    619            Gregorian,
    620            icu_datetime::fieldsets::enums::ZonedDateAndTimeFieldSet
    621        >,
    622    );
    623 
    624    impl ZonedDateTimeFormatterGregorian {
    625        /// Creates a zoned formatter based on a non-zoned formatter.
    626        ///
    627        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    628        /// or else unexpected behavior may occur!
    629        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_long")]
    630        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificLong, Struct)]
    631        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    632        #[cfg(feature = "compiled_data")]
    633        pub fn create_specific_long(
    634            locale: &Locale,
    635            formatter: &DateTimeFormatterGregorian,
    636        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    637            let zone = icu_datetime::fieldsets::zone::SpecificLong;
    638            datetime_helpers::datetime_formatter_gregorian_with_zone(
    639                &formatter.0,
    640                locale,
    641                zone,
    642                |names| {
    643                    names
    644                        .include_time_zone_specific_long_names_with_fallback(
    645                        )?;
    646                    Ok(())
    647                },
    648                |names, field_set| names.try_into_formatter(
    649                    field_set
    650                ),
    651            )
    652        }
    653        
    654        /// Creates a zoned formatter based on a non-zoned formatter.
    655        ///
    656        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    657        /// or else unexpected behavior may occur!
    658        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_long_with_provider")]
    659        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificLong, Struct)]
    660        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    661        #[cfg(feature = "buffer_provider")]
    662        pub fn create_specific_long_with_provider(
    663            provider: &DataProvider,
    664            locale: &Locale,
    665            formatter: &DateTimeFormatterGregorian,
    666        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    667            let provider = provider.get()?;
    668            let zone = icu_datetime::fieldsets::zone::SpecificLong;
    669            datetime_helpers::datetime_formatter_gregorian_with_zone(
    670                &formatter.0,
    671                locale,
    672                zone,
    673                |names| {
    674                    use icu_provider::buf::AsDeserializingBufferProvider;
    675                    let provider = provider.as_deserializing();
    676                    names
    677                        .load_time_zone_specific_long_names_with_fallback(
    678                            &provider
    679                        )?;
    680                    Ok(())
    681                },
    682                |names, field_set| names.try_into_formatter_with_buffer_provider(
    683                    &provider,
    684                    field_set
    685                ),
    686            )
    687        }
    688        
    689        /// Creates a zoned formatter based on a non-zoned formatter.
    690        ///
    691        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    692        /// or else unexpected behavior may occur!
    693        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_short")]
    694        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificShort, Struct)]
    695        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    696        #[cfg(feature = "compiled_data")]
    697        pub fn create_specific_short(
    698            locale: &Locale,
    699            formatter: &DateTimeFormatterGregorian,
    700        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    701            let zone = icu_datetime::fieldsets::zone::SpecificShort;
    702            datetime_helpers::datetime_formatter_gregorian_with_zone(
    703                &formatter.0,
    704                locale,
    705                zone,
    706                |names| {
    707                    names
    708                        .include_time_zone_specific_short_names_with_fallback(
    709                        )?;
    710                    Ok(())
    711                },
    712                |names, field_set| names.try_into_formatter(
    713                    field_set
    714                ),
    715            )
    716        }
    717        
    718        /// Creates a zoned formatter based on a non-zoned formatter.
    719        ///
    720        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    721        /// or else unexpected behavior may occur!
    722        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_short_with_provider")]
    723        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificShort, Struct)]
    724        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    725        #[cfg(feature = "buffer_provider")]
    726        pub fn create_specific_short_with_provider(
    727            provider: &DataProvider,
    728            locale: &Locale,
    729            formatter: &DateTimeFormatterGregorian,
    730        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    731            let provider = provider.get()?;
    732            let zone = icu_datetime::fieldsets::zone::SpecificShort;
    733            datetime_helpers::datetime_formatter_gregorian_with_zone(
    734                &formatter.0,
    735                locale,
    736                zone,
    737                |names| {
    738                    use icu_provider::buf::AsDeserializingBufferProvider;
    739                    let provider = provider.as_deserializing();
    740                    names
    741                        .load_time_zone_specific_short_names_with_fallback(
    742                            &provider
    743                        )?;
    744                    Ok(())
    745                },
    746                |names, field_set| names.try_into_formatter_with_buffer_provider(
    747                    &provider,
    748                    field_set
    749                ),
    750            )
    751        }
    752        
    753        /// Creates a zoned formatter based on a non-zoned formatter.
    754        ///
    755        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    756        /// or else unexpected behavior may occur!
    757        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_long")]
    758        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetLong, Struct)]
    759        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    760        #[cfg(feature = "compiled_data")]
    761        pub fn create_localized_offset_long(
    762            locale: &Locale,
    763            formatter: &DateTimeFormatterGregorian,
    764        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    765            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetLong;
    766            datetime_helpers::datetime_formatter_gregorian_with_zone(
    767                &formatter.0,
    768                locale,
    769                zone,
    770                |names| {
    771                    names
    772                        .include_time_zone_localized_offset_names_with_fallback(
    773                        )?;
    774                    Ok(())
    775                },
    776                |names, field_set| names.try_into_formatter(
    777                    field_set
    778                ),
    779            )
    780        }
    781        
    782        /// Creates a zoned formatter based on a non-zoned formatter.
    783        ///
    784        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    785        /// or else unexpected behavior may occur!
    786        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_long_with_provider")]
    787        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetLong, Struct)]
    788        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    789        #[cfg(feature = "buffer_provider")]
    790        pub fn create_localized_offset_long_with_provider(
    791            provider: &DataProvider,
    792            locale: &Locale,
    793            formatter: &DateTimeFormatterGregorian,
    794        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    795            let provider = provider.get()?;
    796            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetLong;
    797            datetime_helpers::datetime_formatter_gregorian_with_zone(
    798                &formatter.0,
    799                locale,
    800                zone,
    801                |names| {
    802                    use icu_provider::buf::AsDeserializingBufferProvider;
    803                    let provider = provider.as_deserializing();
    804                    names
    805                        .load_time_zone_localized_offset_names_with_fallback(
    806                            &provider
    807                        )?;
    808                    Ok(())
    809                },
    810                |names, field_set| names.try_into_formatter_with_buffer_provider(
    811                    &provider,
    812                    field_set
    813                ),
    814            )
    815        }
    816        
    817        /// Creates a zoned formatter based on a non-zoned formatter.
    818        ///
    819        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    820        /// or else unexpected behavior may occur!
    821        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_short")]
    822        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetShort, Struct)]
    823        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    824        #[cfg(feature = "compiled_data")]
    825        pub fn create_localized_offset_short(
    826            locale: &Locale,
    827            formatter: &DateTimeFormatterGregorian,
    828        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    829            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetShort;
    830            datetime_helpers::datetime_formatter_gregorian_with_zone(
    831                &formatter.0,
    832                locale,
    833                zone,
    834                |names| {
    835                    names
    836                        .include_time_zone_localized_offset_names_with_fallback(
    837                        )?;
    838                    Ok(())
    839                },
    840                |names, field_set| names.try_into_formatter(
    841                    field_set
    842                ),
    843            )
    844        }
    845        
    846        /// Creates a zoned formatter based on a non-zoned formatter.
    847        ///
    848        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    849        /// or else unexpected behavior may occur!
    850        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_short_with_provider")]
    851        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetShort, Struct)]
    852        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    853        #[cfg(feature = "buffer_provider")]
    854        pub fn create_localized_offset_short_with_provider(
    855            provider: &DataProvider,
    856            locale: &Locale,
    857            formatter: &DateTimeFormatterGregorian,
    858        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    859            let provider = provider.get()?;
    860            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetShort;
    861            datetime_helpers::datetime_formatter_gregorian_with_zone(
    862                &formatter.0,
    863                locale,
    864                zone,
    865                |names| {
    866                    use icu_provider::buf::AsDeserializingBufferProvider;
    867                    let provider = provider.as_deserializing();
    868                    names
    869                        .load_time_zone_localized_offset_names_with_fallback(
    870                            &provider
    871                        )?;
    872                    Ok(())
    873                },
    874                |names, field_set| names.try_into_formatter_with_buffer_provider(
    875                    &provider,
    876                    field_set
    877                ),
    878            )
    879        }
    880        
    881        /// Creates a zoned formatter based on a non-zoned formatter.
    882        ///
    883        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    884        /// or else unexpected behavior may occur!
    885        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_long")]
    886        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericLong, Struct)]
    887        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    888        #[cfg(feature = "compiled_data")]
    889        pub fn create_generic_long(
    890            locale: &Locale,
    891            formatter: &DateTimeFormatterGregorian,
    892        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    893            let zone = icu_datetime::fieldsets::zone::GenericLong;
    894            datetime_helpers::datetime_formatter_gregorian_with_zone(
    895                &formatter.0,
    896                locale,
    897                zone,
    898                |names| {
    899                    names
    900                        .include_time_zone_generic_long_names_with_fallback(
    901                        )?;
    902                    Ok(())
    903                },
    904                |names, field_set| names.try_into_formatter(
    905                    field_set
    906                ),
    907            )
    908        }
    909        
    910        /// Creates a zoned formatter based on a non-zoned formatter.
    911        ///
    912        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    913        /// or else unexpected behavior may occur!
    914        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_long_with_provider")]
    915        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericLong, Struct)]
    916        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    917        #[cfg(feature = "buffer_provider")]
    918        pub fn create_generic_long_with_provider(
    919            provider: &DataProvider,
    920            locale: &Locale,
    921            formatter: &DateTimeFormatterGregorian,
    922        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    923            let provider = provider.get()?;
    924            let zone = icu_datetime::fieldsets::zone::GenericLong;
    925            datetime_helpers::datetime_formatter_gregorian_with_zone(
    926                &formatter.0,
    927                locale,
    928                zone,
    929                |names| {
    930                    use icu_provider::buf::AsDeserializingBufferProvider;
    931                    let provider = provider.as_deserializing();
    932                    names
    933                        .load_time_zone_generic_long_names_with_fallback(
    934                            &provider
    935                        )?;
    936                    Ok(())
    937                },
    938                |names, field_set| names.try_into_formatter_with_buffer_provider(
    939                    &provider,
    940                    field_set
    941                ),
    942            )
    943        }
    944        
    945        /// Creates a zoned formatter based on a non-zoned formatter.
    946        ///
    947        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    948        /// or else unexpected behavior may occur!
    949        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_short")]
    950        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericShort, Struct)]
    951        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    952        #[diplomat::demo(default_constructor)]
    953        #[cfg(feature = "compiled_data")]
    954        pub fn create_generic_short(
    955            locale: &Locale,
    956            formatter: &DateTimeFormatterGregorian,
    957        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    958            let zone = icu_datetime::fieldsets::zone::GenericShort;
    959            datetime_helpers::datetime_formatter_gregorian_with_zone(
    960                &formatter.0,
    961                locale,
    962                zone,
    963                |names| {
    964                    names
    965                        .include_time_zone_generic_short_names_with_fallback(
    966                        )?;
    967                    Ok(())
    968                },
    969                |names, field_set| names.try_into_formatter(
    970                    field_set
    971                ),
    972            )
    973        }
    974        
    975        /// Creates a zoned formatter based on a non-zoned formatter.
    976        ///
    977        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    978        /// or else unexpected behavior may occur!
    979        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_short_with_provider")]
    980        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericShort, Struct)]
    981        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    982        #[cfg(feature = "buffer_provider")]
    983        pub fn create_generic_short_with_provider(
    984            provider: &DataProvider,
    985            locale: &Locale,
    986            formatter: &DateTimeFormatterGregorian,
    987        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    988            let provider = provider.get()?;
    989            let zone = icu_datetime::fieldsets::zone::GenericShort;
    990            datetime_helpers::datetime_formatter_gregorian_with_zone(
    991                &formatter.0,
    992                locale,
    993                zone,
    994                |names| {
    995                    use icu_provider::buf::AsDeserializingBufferProvider;
    996                    let provider = provider.as_deserializing();
    997                    names
    998                        .load_time_zone_generic_short_names_with_fallback(
    999                            &provider
   1000                        )?;
   1001                    Ok(())
   1002                },
   1003                |names, field_set| names.try_into_formatter_with_buffer_provider(
   1004                    &provider,
   1005                    field_set
   1006                ),
   1007            )
   1008        }
   1009        
   1010        /// Creates a zoned formatter based on a non-zoned formatter.
   1011        ///
   1012        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
   1013        /// or else unexpected behavior may occur!
   1014        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "location")]
   1015        #[diplomat::rust_link(icu::datetime::fieldsets::zone::Location, Struct)]
   1016        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
   1017        #[cfg(feature = "compiled_data")]
   1018        pub fn create_location(
   1019            locale: &Locale,
   1020            formatter: &DateTimeFormatterGregorian,
   1021        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
   1022            let zone = icu_datetime::fieldsets::zone::Location;
   1023            datetime_helpers::datetime_formatter_gregorian_with_zone(
   1024                &formatter.0,
   1025                locale,
   1026                zone,
   1027                |names| {
   1028                    names
   1029                        .include_time_zone_location_names(
   1030                        )?;
   1031                    Ok(())
   1032                },
   1033                |names, field_set| names.try_into_formatter(
   1034                    field_set
   1035                ),
   1036            )
   1037        }
   1038        
   1039        /// Creates a zoned formatter based on a non-zoned formatter.
   1040        ///
   1041        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
   1042        /// or else unexpected behavior may occur!
   1043        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "location_with_provider")]
   1044        #[diplomat::rust_link(icu::datetime::fieldsets::zone::Location, Struct)]
   1045        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
   1046        #[cfg(feature = "buffer_provider")]
   1047        pub fn create_location_with_provider(
   1048            provider: &DataProvider,
   1049            locale: &Locale,
   1050            formatter: &DateTimeFormatterGregorian,
   1051        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
   1052            let provider = provider.get()?;
   1053            let zone = icu_datetime::fieldsets::zone::Location;
   1054            datetime_helpers::datetime_formatter_gregorian_with_zone(
   1055                &formatter.0,
   1056                locale,
   1057                zone,
   1058                |names| {
   1059                    use icu_provider::buf::AsDeserializingBufferProvider;
   1060                    let provider = provider.as_deserializing();
   1061                    names
   1062                        .load_time_zone_location_names(
   1063                            &provider
   1064                        )?;
   1065                    Ok(())
   1066                },
   1067                |names, field_set| names.try_into_formatter_with_buffer_provider(
   1068                    &provider,
   1069                    field_set
   1070                ),
   1071            )
   1072        }
   1073        
   1074        /// Creates a zoned formatter based on a non-zoned formatter.
   1075        ///
   1076        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
   1077        /// or else unexpected behavior may occur!
   1078        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "exemplar_city")]
   1079        #[diplomat::rust_link(icu::datetime::fieldsets::zone::ExemplarCity, Struct)]
   1080        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
   1081        #[cfg(feature = "compiled_data")]
   1082        pub fn create_exemplar_city(
   1083            locale: &Locale,
   1084            formatter: &DateTimeFormatterGregorian,
   1085        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
   1086            let zone = icu_datetime::fieldsets::zone::ExemplarCity;
   1087            datetime_helpers::datetime_formatter_gregorian_with_zone(
   1088                &formatter.0,
   1089                locale,
   1090                zone,
   1091                |names| {
   1092                    names
   1093                        .include_time_zone_exemplar_city_names(
   1094                        )?;
   1095                    Ok(())
   1096                },
   1097                |names, field_set| names.try_into_formatter(
   1098                    field_set
   1099                ),
   1100            )
   1101        }
   1102        
   1103        /// Creates a zoned formatter based on a non-zoned formatter.
   1104        ///
   1105        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
   1106        /// or else unexpected behavior may occur!
   1107        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "exemplar_city_with_provider")]
   1108        #[diplomat::rust_link(icu::datetime::fieldsets::zone::ExemplarCity, Struct)]
   1109        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
   1110        #[cfg(feature = "buffer_provider")]
   1111        pub fn create_exemplar_city_with_provider(
   1112            provider: &DataProvider,
   1113            locale: &Locale,
   1114            formatter: &DateTimeFormatterGregorian,
   1115        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
   1116            let provider = provider.get()?;
   1117            let zone = icu_datetime::fieldsets::zone::ExemplarCity;
   1118            datetime_helpers::datetime_formatter_gregorian_with_zone(
   1119                &formatter.0,
   1120                locale,
   1121                zone,
   1122                |names| {
   1123                    use icu_provider::buf::AsDeserializingBufferProvider;
   1124                    let provider = provider.as_deserializing();
   1125                    names
   1126                        .load_time_zone_exemplar_city_names(
   1127                            &provider
   1128                        )?;
   1129                    Ok(())
   1130                },
   1131                |names, field_set| names.try_into_formatter_with_buffer_provider(
   1132                    &provider,
   1133                    field_set
   1134                ),
   1135            )
   1136        }
   1137        
   1138        #[diplomat::rust_link(icu::datetime::FixedCalendarDateTimeFormatter::format, FnInStruct)]
   1139        #[diplomat::rust_link(icu::datetime::FormattedDateTime, Struct, hidden)]
   1140        #[diplomat::rust_link(icu::datetime::FormattedDateTime::to_string, FnInStruct, hidden)]
   1141        pub fn format_iso(
   1142            &self,
   1143            date: &IsoDate,
   1144            time: &Time,
   1145            zone: &TimeZoneInfo,
   1146            write: &mut diplomat_runtime::DiplomatWrite,
   1147        ) -> Result<(), DateTimeWriteError> {
   1148            let mut input = icu_datetime::unchecked::DateTimeInputUnchecked::default();
   1149            let date_in_calendar = date.0.to_calendar(Gregorian);
   1150            input.set_date_fields_unchecked(date_in_calendar); // calendar conversion on previous line
   1151            input.set_time_fields(time.0);
   1152            input.set_time_zone_id(zone.id);
   1153            if let Some(offset) = zone.offset {
   1154                input.set_time_zone_utc_offset(offset);
   1155            }
   1156            if let Some(zone_name_timestamp) = zone.zone_name_timestamp {
   1157                input.set_time_zone_name_timestamp(zone_name_timestamp);
   1158            }
   1159            else {
   1160                input.set_time_zone_name_timestamp(icu_time::zone::ZoneNameTimestamp::from_date_time_iso(icu_time::DateTime {
   1161                    date: date.0,
   1162                    time: time.0
   1163                }))
   1164            }
   1165            if let Some(variant) = zone.variant {
   1166                input.set_time_zone_variant(variant);
   1167            }
   1168            let _infallible = self
   1169                .0
   1170                .format_unchecked(input)
   1171                .try_write_to(write)
   1172                .ok()
   1173                .transpose()?;
   1174            Ok(())
   1175        }
   1176    }
   1177    
   1178 }