tor-browser

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

zoned_date_formatter.rs (53108B)


      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 ZonedDateFormatter(
     39        pub  icu_datetime::DateTimeFormatter<
     40            icu_datetime::fieldsets::enums::ZonedDateFieldSet
     41        >,
     42    );
     43 
     44    impl ZonedDateFormatter {
     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: &DateFormatter,
     56        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
     57            let zone = icu_datetime::fieldsets::zone::SpecificLong;
     58            datetime_helpers::date_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: &DateFormatter,
     87        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
     88            let provider = provider.get()?;
     89            let zone = icu_datetime::fieldsets::zone::SpecificLong;
     90            datetime_helpers::date_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: &DateFormatter,
    122        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    123            let zone = icu_datetime::fieldsets::zone::SpecificShort;
    124            datetime_helpers::date_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: &DateFormatter,
    153        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    154            let provider = provider.get()?;
    155            let zone = icu_datetime::fieldsets::zone::SpecificShort;
    156            datetime_helpers::date_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: &DateFormatter,
    188        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    189            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetLong;
    190            datetime_helpers::date_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: &DateFormatter,
    219        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    220            let provider = provider.get()?;
    221            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetLong;
    222            datetime_helpers::date_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: &DateFormatter,
    254        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    255            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetShort;
    256            datetime_helpers::date_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: &DateFormatter,
    285        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    286            let provider = provider.get()?;
    287            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetShort;
    288            datetime_helpers::date_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: &DateFormatter,
    320        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    321            let zone = icu_datetime::fieldsets::zone::GenericLong;
    322            datetime_helpers::date_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: &DateFormatter,
    351        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    352            let provider = provider.get()?;
    353            let zone = icu_datetime::fieldsets::zone::GenericLong;
    354            datetime_helpers::date_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: &DateFormatter,
    387        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    388            let zone = icu_datetime::fieldsets::zone::GenericShort;
    389            datetime_helpers::date_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: &DateFormatter,
    418        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    419            let provider = provider.get()?;
    420            let zone = icu_datetime::fieldsets::zone::GenericShort;
    421            datetime_helpers::date_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: &DateFormatter,
    453        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    454            let zone = icu_datetime::fieldsets::zone::Location;
    455            datetime_helpers::date_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: &DateFormatter,
    484        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    485            let provider = provider.get()?;
    486            let zone = icu_datetime::fieldsets::zone::Location;
    487            datetime_helpers::date_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: &DateFormatter,
    519        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    520            let zone = icu_datetime::fieldsets::zone::ExemplarCity;
    521            datetime_helpers::date_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: &DateFormatter,
    550        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    551            let provider = provider.get()?;
    552            let zone = icu_datetime::fieldsets::zone::ExemplarCity;
    553            datetime_helpers::date_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            zone: &TimeZoneInfo,
    581            write: &mut diplomat_runtime::DiplomatWrite,
    582        ) -> Result<(), DateTimeWriteError> {
    583            let mut input = icu_datetime::unchecked::DateTimeInputUnchecked::default();
    584            let date_in_calendar = date.0.to_calendar(self.0.calendar());
    585            input.set_date_fields_unchecked(date_in_calendar); // calendar conversion on previous line
    586            input.set_time_zone_id(zone.id);
    587            if let Some(offset) = zone.offset {
    588                input.set_time_zone_utc_offset(offset);
    589            }
    590            if let Some(zone_name_timestamp) = zone.zone_name_timestamp {
    591                input.set_time_zone_name_timestamp(zone_name_timestamp);
    592            }
    593            else {
    594                input.set_time_zone_name_timestamp(icu_time::zone::ZoneNameTimestamp::from_date_time_iso(icu_time::DateTime {
    595                    date: date.0,
    596                    time: icu_time::Time::noon()
    597                }))
    598            }
    599            if let Some(variant) = zone.variant {
    600                input.set_time_zone_variant(variant);
    601            }
    602            let _infallible = self
    603                .0
    604                .format_unchecked(input)
    605                .try_write_to(write)
    606                .ok()
    607                .transpose()?;
    608            Ok(())
    609        }
    610    }
    611    
    612 
    613    #[diplomat::opaque]
    614    #[diplomat::rust_link(icu::datetime::FixedCalendarDateTimeFormatter, Struct)]
    615    pub struct ZonedDateFormatterGregorian(
    616        pub  icu_datetime::FixedCalendarDateTimeFormatter<
    617            Gregorian,
    618            icu_datetime::fieldsets::enums::ZonedDateFieldSet
    619        >,
    620    );
    621 
    622    impl ZonedDateFormatterGregorian {
    623        /// Creates a zoned formatter based on a non-zoned formatter.
    624        ///
    625        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    626        /// or else unexpected behavior may occur!
    627        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_long")]
    628        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificLong, Struct)]
    629        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    630        #[cfg(feature = "compiled_data")]
    631        pub fn create_specific_long(
    632            locale: &Locale,
    633            formatter: &DateFormatterGregorian,
    634        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    635            let zone = icu_datetime::fieldsets::zone::SpecificLong;
    636            datetime_helpers::date_formatter_gregorian_with_zone(
    637                &formatter.0,
    638                locale,
    639                zone,
    640                |names| {
    641                    names
    642                        .include_time_zone_specific_long_names_with_fallback(
    643                        )?;
    644                    Ok(())
    645                },
    646                |names, field_set| names.try_into_formatter(
    647                    field_set
    648                ),
    649            )
    650        }
    651        
    652        /// Creates a zoned formatter based on a non-zoned formatter.
    653        ///
    654        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    655        /// or else unexpected behavior may occur!
    656        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_long_with_provider")]
    657        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificLong, Struct)]
    658        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    659        #[cfg(feature = "buffer_provider")]
    660        pub fn create_specific_long_with_provider(
    661            provider: &DataProvider,
    662            locale: &Locale,
    663            formatter: &DateFormatterGregorian,
    664        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    665            let provider = provider.get()?;
    666            let zone = icu_datetime::fieldsets::zone::SpecificLong;
    667            datetime_helpers::date_formatter_gregorian_with_zone(
    668                &formatter.0,
    669                locale,
    670                zone,
    671                |names| {
    672                    use icu_provider::buf::AsDeserializingBufferProvider;
    673                    let provider = provider.as_deserializing();
    674                    names
    675                        .load_time_zone_specific_long_names_with_fallback(
    676                            &provider
    677                        )?;
    678                    Ok(())
    679                },
    680                |names, field_set| names.try_into_formatter_with_buffer_provider(
    681                    &provider,
    682                    field_set
    683                ),
    684            )
    685        }
    686        
    687        /// Creates a zoned formatter based on a non-zoned formatter.
    688        ///
    689        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    690        /// or else unexpected behavior may occur!
    691        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_short")]
    692        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificShort, Struct)]
    693        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    694        #[cfg(feature = "compiled_data")]
    695        pub fn create_specific_short(
    696            locale: &Locale,
    697            formatter: &DateFormatterGregorian,
    698        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    699            let zone = icu_datetime::fieldsets::zone::SpecificShort;
    700            datetime_helpers::date_formatter_gregorian_with_zone(
    701                &formatter.0,
    702                locale,
    703                zone,
    704                |names| {
    705                    names
    706                        .include_time_zone_specific_short_names_with_fallback(
    707                        )?;
    708                    Ok(())
    709                },
    710                |names, field_set| names.try_into_formatter(
    711                    field_set
    712                ),
    713            )
    714        }
    715        
    716        /// Creates a zoned formatter based on a non-zoned formatter.
    717        ///
    718        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    719        /// or else unexpected behavior may occur!
    720        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "specific_short_with_provider")]
    721        #[diplomat::rust_link(icu::datetime::fieldsets::zone::SpecificShort, Struct)]
    722        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    723        #[cfg(feature = "buffer_provider")]
    724        pub fn create_specific_short_with_provider(
    725            provider: &DataProvider,
    726            locale: &Locale,
    727            formatter: &DateFormatterGregorian,
    728        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    729            let provider = provider.get()?;
    730            let zone = icu_datetime::fieldsets::zone::SpecificShort;
    731            datetime_helpers::date_formatter_gregorian_with_zone(
    732                &formatter.0,
    733                locale,
    734                zone,
    735                |names| {
    736                    use icu_provider::buf::AsDeserializingBufferProvider;
    737                    let provider = provider.as_deserializing();
    738                    names
    739                        .load_time_zone_specific_short_names_with_fallback(
    740                            &provider
    741                        )?;
    742                    Ok(())
    743                },
    744                |names, field_set| names.try_into_formatter_with_buffer_provider(
    745                    &provider,
    746                    field_set
    747                ),
    748            )
    749        }
    750        
    751        /// Creates a zoned formatter based on a non-zoned formatter.
    752        ///
    753        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    754        /// or else unexpected behavior may occur!
    755        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_long")]
    756        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetLong, Struct)]
    757        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    758        #[cfg(feature = "compiled_data")]
    759        pub fn create_localized_offset_long(
    760            locale: &Locale,
    761            formatter: &DateFormatterGregorian,
    762        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    763            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetLong;
    764            datetime_helpers::date_formatter_gregorian_with_zone(
    765                &formatter.0,
    766                locale,
    767                zone,
    768                |names| {
    769                    names
    770                        .include_time_zone_localized_offset_names_with_fallback(
    771                        )?;
    772                    Ok(())
    773                },
    774                |names, field_set| names.try_into_formatter(
    775                    field_set
    776                ),
    777            )
    778        }
    779        
    780        /// Creates a zoned formatter based on a non-zoned formatter.
    781        ///
    782        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    783        /// or else unexpected behavior may occur!
    784        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_long_with_provider")]
    785        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetLong, Struct)]
    786        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    787        #[cfg(feature = "buffer_provider")]
    788        pub fn create_localized_offset_long_with_provider(
    789            provider: &DataProvider,
    790            locale: &Locale,
    791            formatter: &DateFormatterGregorian,
    792        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    793            let provider = provider.get()?;
    794            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetLong;
    795            datetime_helpers::date_formatter_gregorian_with_zone(
    796                &formatter.0,
    797                locale,
    798                zone,
    799                |names| {
    800                    use icu_provider::buf::AsDeserializingBufferProvider;
    801                    let provider = provider.as_deserializing();
    802                    names
    803                        .load_time_zone_localized_offset_names_with_fallback(
    804                            &provider
    805                        )?;
    806                    Ok(())
    807                },
    808                |names, field_set| names.try_into_formatter_with_buffer_provider(
    809                    &provider,
    810                    field_set
    811                ),
    812            )
    813        }
    814        
    815        /// Creates a zoned formatter based on a non-zoned formatter.
    816        ///
    817        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    818        /// or else unexpected behavior may occur!
    819        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_short")]
    820        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetShort, Struct)]
    821        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    822        #[cfg(feature = "compiled_data")]
    823        pub fn create_localized_offset_short(
    824            locale: &Locale,
    825            formatter: &DateFormatterGregorian,
    826        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    827            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetShort;
    828            datetime_helpers::date_formatter_gregorian_with_zone(
    829                &formatter.0,
    830                locale,
    831                zone,
    832                |names| {
    833                    names
    834                        .include_time_zone_localized_offset_names_with_fallback(
    835                        )?;
    836                    Ok(())
    837                },
    838                |names, field_set| names.try_into_formatter(
    839                    field_set
    840                ),
    841            )
    842        }
    843        
    844        /// Creates a zoned formatter based on a non-zoned formatter.
    845        ///
    846        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    847        /// or else unexpected behavior may occur!
    848        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "localized_offset_short_with_provider")]
    849        #[diplomat::rust_link(icu::datetime::fieldsets::zone::LocalizedOffsetShort, Struct)]
    850        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    851        #[cfg(feature = "buffer_provider")]
    852        pub fn create_localized_offset_short_with_provider(
    853            provider: &DataProvider,
    854            locale: &Locale,
    855            formatter: &DateFormatterGregorian,
    856        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    857            let provider = provider.get()?;
    858            let zone = icu_datetime::fieldsets::zone::LocalizedOffsetShort;
    859            datetime_helpers::date_formatter_gregorian_with_zone(
    860                &formatter.0,
    861                locale,
    862                zone,
    863                |names| {
    864                    use icu_provider::buf::AsDeserializingBufferProvider;
    865                    let provider = provider.as_deserializing();
    866                    names
    867                        .load_time_zone_localized_offset_names_with_fallback(
    868                            &provider
    869                        )?;
    870                    Ok(())
    871                },
    872                |names, field_set| names.try_into_formatter_with_buffer_provider(
    873                    &provider,
    874                    field_set
    875                ),
    876            )
    877        }
    878        
    879        /// Creates a zoned formatter based on a non-zoned formatter.
    880        ///
    881        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    882        /// or else unexpected behavior may occur!
    883        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_long")]
    884        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericLong, Struct)]
    885        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    886        #[cfg(feature = "compiled_data")]
    887        pub fn create_generic_long(
    888            locale: &Locale,
    889            formatter: &DateFormatterGregorian,
    890        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    891            let zone = icu_datetime::fieldsets::zone::GenericLong;
    892            datetime_helpers::date_formatter_gregorian_with_zone(
    893                &formatter.0,
    894                locale,
    895                zone,
    896                |names| {
    897                    names
    898                        .include_time_zone_generic_long_names_with_fallback(
    899                        )?;
    900                    Ok(())
    901                },
    902                |names, field_set| names.try_into_formatter(
    903                    field_set
    904                ),
    905            )
    906        }
    907        
    908        /// Creates a zoned formatter based on a non-zoned formatter.
    909        ///
    910        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    911        /// or else unexpected behavior may occur!
    912        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_long_with_provider")]
    913        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericLong, Struct)]
    914        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    915        #[cfg(feature = "buffer_provider")]
    916        pub fn create_generic_long_with_provider(
    917            provider: &DataProvider,
    918            locale: &Locale,
    919            formatter: &DateFormatterGregorian,
    920        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    921            let provider = provider.get()?;
    922            let zone = icu_datetime::fieldsets::zone::GenericLong;
    923            datetime_helpers::date_formatter_gregorian_with_zone(
    924                &formatter.0,
    925                locale,
    926                zone,
    927                |names| {
    928                    use icu_provider::buf::AsDeserializingBufferProvider;
    929                    let provider = provider.as_deserializing();
    930                    names
    931                        .load_time_zone_generic_long_names_with_fallback(
    932                            &provider
    933                        )?;
    934                    Ok(())
    935                },
    936                |names, field_set| names.try_into_formatter_with_buffer_provider(
    937                    &provider,
    938                    field_set
    939                ),
    940            )
    941        }
    942        
    943        /// Creates a zoned formatter based on a non-zoned formatter.
    944        ///
    945        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    946        /// or else unexpected behavior may occur!
    947        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_short")]
    948        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericShort, Struct)]
    949        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    950        #[diplomat::demo(default_constructor)]
    951        #[cfg(feature = "compiled_data")]
    952        pub fn create_generic_short(
    953            locale: &Locale,
    954            formatter: &DateFormatterGregorian,
    955        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    956            let zone = icu_datetime::fieldsets::zone::GenericShort;
    957            datetime_helpers::date_formatter_gregorian_with_zone(
    958                &formatter.0,
    959                locale,
    960                zone,
    961                |names| {
    962                    names
    963                        .include_time_zone_generic_short_names_with_fallback(
    964                        )?;
    965                    Ok(())
    966                },
    967                |names, field_set| names.try_into_formatter(
    968                    field_set
    969                ),
    970            )
    971        }
    972        
    973        /// Creates a zoned formatter based on a non-zoned formatter.
    974        ///
    975        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
    976        /// or else unexpected behavior may occur!
    977        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "generic_short_with_provider")]
    978        #[diplomat::rust_link(icu::datetime::fieldsets::zone::GenericShort, Struct)]
    979        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
    980        #[cfg(feature = "buffer_provider")]
    981        pub fn create_generic_short_with_provider(
    982            provider: &DataProvider,
    983            locale: &Locale,
    984            formatter: &DateFormatterGregorian,
    985        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
    986            let provider = provider.get()?;
    987            let zone = icu_datetime::fieldsets::zone::GenericShort;
    988            datetime_helpers::date_formatter_gregorian_with_zone(
    989                &formatter.0,
    990                locale,
    991                zone,
    992                |names| {
    993                    use icu_provider::buf::AsDeserializingBufferProvider;
    994                    let provider = provider.as_deserializing();
    995                    names
    996                        .load_time_zone_generic_short_names_with_fallback(
    997                            &provider
    998                        )?;
    999                    Ok(())
   1000                },
   1001                |names, field_set| names.try_into_formatter_with_buffer_provider(
   1002                    &provider,
   1003                    field_set
   1004                ),
   1005            )
   1006        }
   1007        
   1008        /// Creates a zoned formatter based on a non-zoned formatter.
   1009        ///
   1010        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
   1011        /// or else unexpected behavior may occur!
   1012        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "location")]
   1013        #[diplomat::rust_link(icu::datetime::fieldsets::zone::Location, Struct)]
   1014        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
   1015        #[cfg(feature = "compiled_data")]
   1016        pub fn create_location(
   1017            locale: &Locale,
   1018            formatter: &DateFormatterGregorian,
   1019        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
   1020            let zone = icu_datetime::fieldsets::zone::Location;
   1021            datetime_helpers::date_formatter_gregorian_with_zone(
   1022                &formatter.0,
   1023                locale,
   1024                zone,
   1025                |names| {
   1026                    names
   1027                        .include_time_zone_location_names(
   1028                        )?;
   1029                    Ok(())
   1030                },
   1031                |names, field_set| names.try_into_formatter(
   1032                    field_set
   1033                ),
   1034            )
   1035        }
   1036        
   1037        /// Creates a zoned formatter based on a non-zoned formatter.
   1038        ///
   1039        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
   1040        /// or else unexpected behavior may occur!
   1041        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "location_with_provider")]
   1042        #[diplomat::rust_link(icu::datetime::fieldsets::zone::Location, Struct)]
   1043        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
   1044        #[cfg(feature = "buffer_provider")]
   1045        pub fn create_location_with_provider(
   1046            provider: &DataProvider,
   1047            locale: &Locale,
   1048            formatter: &DateFormatterGregorian,
   1049        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
   1050            let provider = provider.get()?;
   1051            let zone = icu_datetime::fieldsets::zone::Location;
   1052            datetime_helpers::date_formatter_gregorian_with_zone(
   1053                &formatter.0,
   1054                locale,
   1055                zone,
   1056                |names| {
   1057                    use icu_provider::buf::AsDeserializingBufferProvider;
   1058                    let provider = provider.as_deserializing();
   1059                    names
   1060                        .load_time_zone_location_names(
   1061                            &provider
   1062                        )?;
   1063                    Ok(())
   1064                },
   1065                |names, field_set| names.try_into_formatter_with_buffer_provider(
   1066                    &provider,
   1067                    field_set
   1068                ),
   1069            )
   1070        }
   1071        
   1072        /// Creates a zoned formatter based on a non-zoned formatter.
   1073        ///
   1074        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
   1075        /// or else unexpected behavior may occur!
   1076        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "exemplar_city")]
   1077        #[diplomat::rust_link(icu::datetime::fieldsets::zone::ExemplarCity, Struct)]
   1078        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
   1079        #[cfg(feature = "compiled_data")]
   1080        pub fn create_exemplar_city(
   1081            locale: &Locale,
   1082            formatter: &DateFormatterGregorian,
   1083        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
   1084            let zone = icu_datetime::fieldsets::zone::ExemplarCity;
   1085            datetime_helpers::date_formatter_gregorian_with_zone(
   1086                &formatter.0,
   1087                locale,
   1088                zone,
   1089                |names| {
   1090                    names
   1091                        .include_time_zone_exemplar_city_names(
   1092                        )?;
   1093                    Ok(())
   1094                },
   1095                |names, field_set| names.try_into_formatter(
   1096                    field_set
   1097                ),
   1098            )
   1099        }
   1100        
   1101        /// Creates a zoned formatter based on a non-zoned formatter.
   1102        ///
   1103        /// Caution: The locale provided here must match the locale used to construct the non-zoned formatter,
   1104        /// or else unexpected behavior may occur!
   1105        #[diplomat::attr(all(supports = fallible_constructors, supports = named_constructors), named_constructor = "exemplar_city_with_provider")]
   1106        #[diplomat::rust_link(icu::datetime::fieldsets::zone::ExemplarCity, Struct)]
   1107        #[diplomat::rust_link(icu::datetime::fieldsets::Combo, Struct, hidden)]
   1108        #[cfg(feature = "buffer_provider")]
   1109        pub fn create_exemplar_city_with_provider(
   1110            provider: &DataProvider,
   1111            locale: &Locale,
   1112            formatter: &DateFormatterGregorian,
   1113        ) -> Result<Box<Self>, DateTimeFormatterLoadError> {
   1114            let provider = provider.get()?;
   1115            let zone = icu_datetime::fieldsets::zone::ExemplarCity;
   1116            datetime_helpers::date_formatter_gregorian_with_zone(
   1117                &formatter.0,
   1118                locale,
   1119                zone,
   1120                |names| {
   1121                    use icu_provider::buf::AsDeserializingBufferProvider;
   1122                    let provider = provider.as_deserializing();
   1123                    names
   1124                        .load_time_zone_exemplar_city_names(
   1125                            &provider
   1126                        )?;
   1127                    Ok(())
   1128                },
   1129                |names, field_set| names.try_into_formatter_with_buffer_provider(
   1130                    &provider,
   1131                    field_set
   1132                ),
   1133            )
   1134        }
   1135        
   1136        #[diplomat::rust_link(icu::datetime::FixedCalendarDateTimeFormatter::format, FnInStruct)]
   1137        #[diplomat::rust_link(icu::datetime::FormattedDateTime, Struct, hidden)]
   1138        #[diplomat::rust_link(icu::datetime::FormattedDateTime::to_string, FnInStruct, hidden)]
   1139        pub fn format_iso(
   1140            &self,
   1141            date: &IsoDate,
   1142            zone: &TimeZoneInfo,
   1143            write: &mut diplomat_runtime::DiplomatWrite,
   1144        ) -> Result<(), DateTimeWriteError> {
   1145            let mut input = icu_datetime::unchecked::DateTimeInputUnchecked::default();
   1146            let date_in_calendar = date.0.to_calendar(Gregorian);
   1147            input.set_date_fields_unchecked(date_in_calendar); // calendar conversion on previous line
   1148            input.set_time_zone_id(zone.id);
   1149            if let Some(offset) = zone.offset {
   1150                input.set_time_zone_utc_offset(offset);
   1151            }
   1152            if let Some(zone_name_timestamp) = zone.zone_name_timestamp {
   1153                input.set_time_zone_name_timestamp(zone_name_timestamp);
   1154            }
   1155            else {
   1156                input.set_time_zone_name_timestamp(icu_time::zone::ZoneNameTimestamp::from_date_time_iso(icu_time::DateTime {
   1157                    date: date.0,
   1158                    time: icu_time::Time::noon()
   1159                }))
   1160            }
   1161            if let Some(variant) = zone.variant {
   1162                input.set_time_zone_variant(variant);
   1163            }
   1164            let _infallible = self
   1165                .0
   1166                .format_unchecked(input)
   1167                .try_write_to(write)
   1168                .ok()
   1169                .transpose()?;
   1170            Ok(())
   1171        }
   1172    }
   1173    
   1174 }