fidl_fuchsia_intl/
fidl_fuchsia_intl.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// This is the time zone reported when no time zones have been set.
14pub const DEFAULT_TIME_ZONE_ID: &str = "UTC";
15
16/// Enumeration of the days of the week.
17#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
18#[repr(u8)]
19pub enum DayOfWeek {
20    Sunday = 1,
21    Monday = 2,
22    Tuesday = 3,
23    Wednesday = 4,
24    Thursday = 5,
25    Friday = 6,
26    Saturday = 7,
27}
28
29impl DayOfWeek {
30    #[inline]
31    pub fn from_primitive(prim: u8) -> Option<Self> {
32        match prim {
33            1 => Some(Self::Sunday),
34            2 => Some(Self::Monday),
35            3 => Some(Self::Tuesday),
36            4 => Some(Self::Wednesday),
37            5 => Some(Self::Thursday),
38            6 => Some(Self::Friday),
39            7 => Some(Self::Saturday),
40            _ => None,
41        }
42    }
43
44    #[inline]
45    pub const fn into_primitive(self) -> u8 {
46        self as u8
47    }
48
49    #[deprecated = "Strict enums should not use `is_unknown`"]
50    #[inline]
51    pub fn is_unknown(&self) -> bool {
52        false
53    }
54}
55
56/// Enumeration of the months of the year.
57#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
58#[repr(u8)]
59pub enum Month {
60    January = 1,
61    February = 2,
62    March = 3,
63    April = 4,
64    May = 5,
65    June = 6,
66    July = 7,
67    August = 8,
68    September = 9,
69    October = 10,
70    November = 11,
71    December = 12,
72}
73
74impl Month {
75    #[inline]
76    pub fn from_primitive(prim: u8) -> Option<Self> {
77        match prim {
78            1 => Some(Self::January),
79            2 => Some(Self::February),
80            3 => Some(Self::March),
81            4 => Some(Self::April),
82            5 => Some(Self::May),
83            6 => Some(Self::June),
84            7 => Some(Self::July),
85            8 => Some(Self::August),
86            9 => Some(Self::September),
87            10 => Some(Self::October),
88            11 => Some(Self::November),
89            12 => Some(Self::December),
90            _ => None,
91        }
92    }
93
94    #[inline]
95    pub const fn into_primitive(self) -> u8 {
96        self as u8
97    }
98
99    #[deprecated = "Strict enums should not use `is_unknown`"]
100    #[inline]
101    pub fn is_unknown(&self) -> bool {
102        false
103    }
104}
105
106/// During a transition from daylight savings to standard time (when the clock is turned back), a
107/// civil time can correspond to two possible absolute times. This setting determines which of those
108/// times should be assumed during the conversion to absolute time.
109///
110/// TODO(https://fxbug.dev/42162861): Implement `AFTER_TRANSITION`.
111#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
112pub enum RepeatedTimeConversion {
113    /// Returns the wall clock time before the transition.
114    ///
115    /// For example, in "America/New_York" on the night of the fall transition to standard time,
116    /// `1:30 AM` is interpreted as `01:30-04:00` (EDT), which is `05:30Z`.
117    BeforeTransition,
118    #[doc(hidden)]
119    __SourceBreaking { unknown_ordinal: i32 },
120}
121
122/// Pattern that matches an unknown `RepeatedTimeConversion` member.
123#[macro_export]
124macro_rules! RepeatedTimeConversionUnknown {
125    () => {
126        _
127    };
128}
129
130impl RepeatedTimeConversion {
131    #[inline]
132    pub fn from_primitive(prim: i32) -> Option<Self> {
133        match prim {
134            1 => Some(Self::BeforeTransition),
135            _ => None,
136        }
137    }
138
139    #[inline]
140    pub fn from_primitive_allow_unknown(prim: i32) -> Self {
141        match prim {
142            1 => Self::BeforeTransition,
143            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
144        }
145    }
146
147    #[inline]
148    pub fn unknown() -> Self {
149        Self::__SourceBreaking { unknown_ordinal: 0x7fffffff }
150    }
151
152    #[inline]
153    pub const fn into_primitive(self) -> i32 {
154        match self {
155            Self::BeforeTransition => 1,
156            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
157        }
158    }
159
160    #[inline]
161    pub fn is_unknown(&self) -> bool {
162        match self {
163            Self::__SourceBreaking { unknown_ordinal: _ } => true,
164            _ => false,
165        }
166    }
167}
168
169/// During a transition from standard time to daylight savings time (when the clock is turned
170/// forward), a span of civil times is skipped (usually one hour). This setting determines how
171/// invalid civil times within this span should be treated.
172///
173/// TODO(https://fxbug.dev/42162861): Implement `BEFORE_TRANSITION` and `AFTER_TRANSITION`.
174#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
175pub enum SkippedTimeConversion {
176    /// Returns `TimeZonesError::INVALID_DATE` when trying to convert a skipped civil time.
177    Reject,
178    /// Returns the closest valid time after the requested time.
179    ///
180    /// For example, in "America/New_York" on the night of the spring transition to daylight savings
181    /// time, `2:30 AM` doesn't exist, so the next valid time, `3:00 AM` (EDT) is returned instead.
182    NextValidTime,
183    #[doc(hidden)]
184    __SourceBreaking { unknown_ordinal: i32 },
185}
186
187/// Pattern that matches an unknown `SkippedTimeConversion` member.
188#[macro_export]
189macro_rules! SkippedTimeConversionUnknown {
190    () => {
191        _
192    };
193}
194
195impl SkippedTimeConversion {
196    #[inline]
197    pub fn from_primitive(prim: i32) -> Option<Self> {
198        match prim {
199            1 => Some(Self::Reject),
200            2 => Some(Self::NextValidTime),
201            _ => None,
202        }
203    }
204
205    #[inline]
206    pub fn from_primitive_allow_unknown(prim: i32) -> Self {
207        match prim {
208            1 => Self::Reject,
209            2 => Self::NextValidTime,
210            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
211        }
212    }
213
214    #[inline]
215    pub fn unknown() -> Self {
216        Self::__SourceBreaking { unknown_ordinal: 0x7fffffff }
217    }
218
219    #[inline]
220    pub const fn into_primitive(self) -> i32 {
221        match self {
222            Self::Reject => 1,
223            Self::NextValidTime => 2,
224            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
225        }
226    }
227
228    #[inline]
229    pub fn is_unknown(&self) -> bool {
230        match self {
231            Self::__SourceBreaking { unknown_ordinal: _ } => true,
232            _ => false,
233        }
234    }
235}
236
237/// Selection of [temperature units](https://en.wikipedia.org/wiki/Degree_(temperature)).
238#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
239#[repr(u32)]
240pub enum TemperatureUnit {
241    /// The temperature should be formatted to show temperature in degrees Celsius.
242    Celsius = 0,
243    /// The temperature should be formatted to show temperature in degrees Fahrenheit.
244    Fahrenheit = 1,
245}
246
247impl TemperatureUnit {
248    #[inline]
249    pub fn from_primitive(prim: u32) -> Option<Self> {
250        match prim {
251            0 => Some(Self::Celsius),
252            1 => Some(Self::Fahrenheit),
253            _ => None,
254        }
255    }
256
257    #[inline]
258    pub const fn into_primitive(self) -> u32 {
259        self as u32
260    }
261
262    #[deprecated = "Strict enums should not use `is_unknown`"]
263    #[inline]
264    pub fn is_unknown(&self) -> bool {
265        false
266    }
267}
268
269#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
270pub enum TimeZonesError {
271    /// An internal error has occurred within the service.
272    InternalError,
273    /// The requested time zone ID is invalid.
274    UnknownTimeZone,
275    /// The provided date is out of range or invalid.
276    InvalidDate,
277    #[doc(hidden)]
278    __SourceBreaking { unknown_ordinal: i32 },
279}
280
281/// Pattern that matches an unknown `TimeZonesError` member.
282#[macro_export]
283macro_rules! TimeZonesErrorUnknown {
284    () => {
285        _
286    };
287}
288
289impl TimeZonesError {
290    #[inline]
291    pub fn from_primitive(prim: i32) -> Option<Self> {
292        match prim {
293            1 => Some(Self::InternalError),
294            2 => Some(Self::UnknownTimeZone),
295            3 => Some(Self::InvalidDate),
296            _ => None,
297        }
298    }
299
300    #[inline]
301    pub fn from_primitive_allow_unknown(prim: i32) -> Self {
302        match prim {
303            1 => Self::InternalError,
304            2 => Self::UnknownTimeZone,
305            3 => Self::InvalidDate,
306            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
307        }
308    }
309
310    #[inline]
311    pub fn unknown() -> Self {
312        Self::__SourceBreaking { unknown_ordinal: 0x7fffffff }
313    }
314
315    #[inline]
316    pub const fn into_primitive(self) -> i32 {
317        match self {
318            Self::InternalError => 1,
319            Self::UnknownTimeZone => 2,
320            Self::InvalidDate => 3,
321            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
322        }
323    }
324
325    #[inline]
326    pub fn is_unknown(&self) -> bool {
327        match self {
328            Self::__SourceBreaking { unknown_ordinal: _ } => true,
329            _ => false,
330        }
331    }
332}
333
334/// Typed identifier for a single calendar system. Currently consists only of a calendar ID.
335#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
336pub struct CalendarId {
337    /// Unicode BCP-47 Locale Identifier with an undefined language tag and a single extension
338    /// specifying the calendar ID (from
339    /// https://unicode.org/repos/cldr/trunk/common/bcp47/calendar.xml).
340    ///
341    /// Examples:
342    ///   "und-u-ca-gregory"
343    ///   "und-u-ca-islamic"
344    pub id: String,
345}
346
347impl fidl::Persistable for CalendarId {}
348
349/// Typed identifier for a single Locale, which is a set of internationalization-related properties.
350///
351/// Most APIs that consume locales will probably want to accept a vector of locales to account for
352/// priority.
353#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
354pub struct LocaleId {
355    /// Unicode BCP-47 Locale Identifier
356    /// (http://www.unicode.org/reports/tr35/#BCP_47_Conformance).
357    ///
358    /// Must be canonicalized and well-formed. This field should not be populated from arbitrary
359    /// user- or third-party input, but instead generated programmatically.
360    ///
361    /// Includes language, region, script, and variant, plus Unicode extensions (under the "u"
362    /// singleton). Other extensions are allowed but ignored.
363    ///
364    /// Examples:
365    ///   "en-US"
366    ///     American English
367    ///   "fr-u-hc-h12"
368    ///     French, with 12-hour clock
369    ///   "ar-EG-u-fw-mon-nu-latn"
370    ///     Egyptian Arabic with "Latin" numerals and first day of week on Monday
371    pub id: String,
372}
373
374impl fidl::Persistable for LocaleId {}
375
376#[derive(Clone, Debug, PartialEq)]
377pub struct PropertyProviderGetProfileResponse {
378    pub profile: Profile,
379}
380
381impl fidl::Persistable for PropertyProviderGetProfileResponse {}
382
383/// Typed identifier for a time zone.
384#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
385pub struct TimeZoneId {
386    /// Time zone ID from tzdata, e.g. "America/New_York". See https://www.iana.org/time-zones.
387    pub id: String,
388}
389
390impl fidl::Persistable for TimeZoneId {}
391
392#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
393pub struct TimeZonesAbsoluteToCivilTimeRequest {
394    /// The time zone in which to calculate a civil date and time.
395    pub time_zone_id: TimeZoneId,
396    /// The number of nanoseconds since the Unix epoch.
397    /// For example, `at_time == 0` corresponds to 1970-01-01T00:00:00.000000000Z.
398    pub absolute_time: i64,
399}
400
401impl fidl::Persistable for TimeZonesAbsoluteToCivilTimeRequest {}
402
403#[derive(Clone, Debug, PartialEq)]
404pub struct TimeZonesCivilToAbsoluteTimeRequest {
405    /// The civil date and time to convert.
406    ///
407    /// Note that `civil_time.weekday` and `civil_time.year_day` may be omitted for this method.
408    /// If present, they must be consistent with the other fields.
409    pub civil_time: CivilTime,
410    /// Conversion options for civil times that cross a daylight savings transition.
411    pub options: CivilToAbsoluteTimeOptions,
412}
413
414impl fidl::Persistable for TimeZonesCivilToAbsoluteTimeRequest {}
415
416#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
417pub struct TimeZonesGetTimeZoneInfoRequest {
418    /// The time zone ID for which to retrieve information.
419    pub time_zone_id: TimeZoneId,
420    /// The date and time at which to calculate values, in nanoseconds since the Unix epoch.
421    /// For example, `at_time == 0` corresponds to 1970-01-01T00:00:00.000000000Z.
422    pub at_time: i64,
423}
424
425impl fidl::Persistable for TimeZonesGetTimeZoneInfoRequest {}
426
427#[derive(Clone, Debug, PartialEq)]
428pub struct TimeZonesAbsoluteToCivilTimeResponse {
429    pub civil_time: CivilTime,
430}
431
432impl fidl::Persistable for TimeZonesAbsoluteToCivilTimeResponse {}
433
434#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
435#[repr(C)]
436pub struct TimeZonesCivilToAbsoluteTimeResponse {
437    pub absolute_time: i64,
438}
439
440impl fidl::Persistable for TimeZonesCivilToAbsoluteTimeResponse {}
441
442#[derive(Clone, Debug, PartialEq)]
443pub struct TimeZonesGetTimeZoneInfoResponse {
444    pub time_zone_info: TimeZoneInfo,
445}
446
447impl fidl::Persistable for TimeZonesGetTimeZoneInfoResponse {}
448
449/// Describes a time on a civil calendar (Gregorian), with nanosecond precision. This is roughly
450/// equivalent to the `tm` struct in `time.h` in the C standard library, and is intended as a
451/// structured intermediate format for printing or parsing dates.
452#[derive(Clone, Debug, Default, PartialEq)]
453pub struct CivilTime {
454    /// Year, in the closed range `[1678, 2262]`.
455    pub year: Option<u16>,
456    /// Month of the year.
457    pub month: Option<Month>,
458    /// Day of the month, in the closed range `[1, 31]`.
459    pub day: Option<u8>,
460    /// Hour of the day, in the closed range `[0, 23]`.
461    pub hour: Option<u8>,
462    /// Minute of the hour, in the closed range `[0, 59]`.
463    pub minute: Option<u8>,
464    /// Second of the minute, in the closed range `[0, 59]`.
465    ///
466    /// (Note that Fuchsia does not currently calculate leap seconds when converting dates.)
467    pub second: Option<u8>,
468    /// Nanosecond, in the closed range `[0, 999_999_999]`.
469    pub nanos: Option<u64>,
470    /// Day of the week.
471    pub weekday: Option<DayOfWeek>,
472    /// Day of the year, in the closed range `[0, 365]`.
473    pub year_day: Option<u16>,
474    /// The time zone corresponding to this time. If omitted, the default is UTC.
475    pub time_zone_id: Option<TimeZoneId>,
476    #[doc(hidden)]
477    pub __source_breaking: fidl::marker::SourceBreaking,
478}
479
480impl fidl::Persistable for CivilTime {}
481
482/// Options for `TimeZones.CivilToAbsoluteTime`.
483#[derive(Clone, Debug, Default, PartialEq)]
484pub struct CivilToAbsoluteTimeOptions {
485    /// Optional setting for handling repeated times during backward daylight savings time
486    /// transitions.
487    ///
488    /// Default: `BEFORE_TRANSITION`.
489    pub repeated_time_conversion: Option<RepeatedTimeConversion>,
490    /// Optional setting for handling skipped times during forward daylight savings time
491    /// transitions.
492    ///
493    /// Default: `NEXT_VALID_TIME`.
494    pub skipped_time_conversion: Option<SkippedTimeConversion>,
495    #[doc(hidden)]
496    pub __source_breaking: fidl::marker::SourceBreaking,
497}
498
499impl fidl::Persistable for CivilToAbsoluteTimeOptions {}
500
501/// A collection of ranked internationalization properties.
502///
503/// There is no implied origin for this information; it might come from a user account, device
504/// settings, a synthesis of user settings and app-specific overrides, or anywhere else.
505///
506/// Language-independent properties that are supported by Unicode BCP-47 Locale IDs (e.g.
507/// first-day-of-week, time zone) are denormalized into the locale IDs in `locales`.
508#[derive(Clone, Debug, Default, PartialEq)]
509pub struct Profile {
510    /// Ranked list of locales (in descending order of preference).  The vector will always
511    /// be set, and always contain at least one element. For example,
512    /// locales = [ LocaleId("en-US") ] is valid, but locales = [], or locales = <unset> is not.
513    pub locales: Option<Vec<LocaleId>>,
514    /// Ranked list of calendars (in descending order of preference).
515    /// The first entry is the primary calendar, and will be equal to the calendar indicated
516    /// in `locales`.
517    /// The vector will always be set, and always contain at least one element.
518    /// The list allows multiple ranked preferences, and is intended for use
519    /// by applications that can display multiple calendar systems.
520    pub calendars: Option<Vec<CalendarId>>,
521    /// Ranked list of time zones (in descending order). The first entry is the primary time zone,
522    /// which should be used by default for formatting dates and times; it will be equal to the
523    /// calendar indicated in `locales`.
524    /// The list is intended for use by applications that can display multiple time zones, e.g.
525    /// a world clock.
526    /// The vector will always be set, and always contain at least one element.
527    /// On Fuchsia, the default time zone is always `DEFAULT_TIME_ZONE_ID` when
528    /// no more specific time zones have been defined or selected.
529    pub time_zones: Option<Vec<TimeZoneId>>,
530    /// Selected temperature unit. The unit is always reported: if there is no
531    /// setting in the current environment, the default value of CELSIUS is
532    /// used.
533    pub temperature_unit: Option<TemperatureUnit>,
534    #[doc(hidden)]
535    pub __source_breaking: fidl::marker::SourceBreaking,
536}
537
538impl fidl::Persistable for Profile {}
539
540/// Typed identifier for a regulatory domain as specified in the IEEE 802.11 standard.
541#[derive(Clone, Debug, Default, PartialEq)]
542pub struct RegulatoryDomain {
543    /// ISO 3166-1 alpha-2, a two-letter code representing a domain of operation.
544    /// (https://www.iso.org/publication/PUB500001.html)
545    pub country_code: Option<String>,
546    #[doc(hidden)]
547    pub __source_breaking: fidl::marker::SourceBreaking,
548}
549
550impl fidl::Persistable for RegulatoryDomain {}
551
552/// Describes a Time Zone's properties at a particular moment in time.
553///
554/// TODO(https://fxbug.dev/42162409): Additional fields with a breakdown of offsets and DST status.
555#[derive(Clone, Debug, Default, PartialEq)]
556pub struct TimeZoneInfo {
557    /// The time zone's IANA ID.
558    pub id: Option<TimeZoneId>,
559    /// The total offset (including Daylight Savings, if the time zone is in Daylight Savings Time)
560    /// from UTC at the queried time (`at_time`). If the time zone is ahead of UTC, this will be a
561    /// positive value; if behind UTC, a negative value.
562    pub total_offset_at_time: Option<i64>,
563    /// Indicates whether the time zone is in Daylight Savings Time at the queried time
564    /// (`at_time`).
565    pub in_dst_at_time: Option<bool>,
566    #[doc(hidden)]
567    pub __source_breaking: fidl::marker::SourceBreaking,
568}
569
570impl fidl::Persistable for TimeZoneInfo {}
571
572#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
573pub struct PropertyProviderMarker;
574
575impl fidl::endpoints::ProtocolMarker for PropertyProviderMarker {
576    type Proxy = PropertyProviderProxy;
577    type RequestStream = PropertyProviderRequestStream;
578    #[cfg(target_os = "fuchsia")]
579    type SynchronousProxy = PropertyProviderSynchronousProxy;
580
581    const DEBUG_NAME: &'static str = "fuchsia.intl.PropertyProvider";
582}
583impl fidl::endpoints::DiscoverableProtocolMarker for PropertyProviderMarker {}
584
585pub trait PropertyProviderProxyInterface: Send + Sync {
586    type GetProfileResponseFut: std::future::Future<Output = Result<Profile, fidl::Error>> + Send;
587    fn r#get_profile(&self) -> Self::GetProfileResponseFut;
588}
589#[derive(Debug)]
590#[cfg(target_os = "fuchsia")]
591pub struct PropertyProviderSynchronousProxy {
592    client: fidl::client::sync::Client,
593}
594
595#[cfg(target_os = "fuchsia")]
596impl fidl::endpoints::SynchronousProxy for PropertyProviderSynchronousProxy {
597    type Proxy = PropertyProviderProxy;
598    type Protocol = PropertyProviderMarker;
599
600    fn from_channel(inner: fidl::Channel) -> Self {
601        Self::new(inner)
602    }
603
604    fn into_channel(self) -> fidl::Channel {
605        self.client.into_channel()
606    }
607
608    fn as_channel(&self) -> &fidl::Channel {
609        self.client.as_channel()
610    }
611}
612
613#[cfg(target_os = "fuchsia")]
614impl PropertyProviderSynchronousProxy {
615    pub fn new(channel: fidl::Channel) -> Self {
616        let protocol_name = <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
617        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
618    }
619
620    pub fn into_channel(self) -> fidl::Channel {
621        self.client.into_channel()
622    }
623
624    /// Waits until an event arrives and returns it. It is safe for other
625    /// threads to make concurrent requests while waiting for an event.
626    pub fn wait_for_event(
627        &self,
628        deadline: zx::MonotonicInstant,
629    ) -> Result<PropertyProviderEvent, fidl::Error> {
630        PropertyProviderEvent::decode(self.client.wait_for_event(deadline)?)
631    }
632
633    /// Gets the user's internationalization profile.
634    pub fn r#get_profile(&self, ___deadline: zx::MonotonicInstant) -> Result<Profile, fidl::Error> {
635        let _response = self
636            .client
637            .send_query::<fidl::encoding::EmptyPayload, PropertyProviderGetProfileResponse>(
638                (),
639                0x10bf06e68d36d3eb,
640                fidl::encoding::DynamicFlags::empty(),
641                ___deadline,
642            )?;
643        Ok(_response.profile)
644    }
645}
646
647#[derive(Debug, Clone)]
648pub struct PropertyProviderProxy {
649    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
650}
651
652impl fidl::endpoints::Proxy for PropertyProviderProxy {
653    type Protocol = PropertyProviderMarker;
654
655    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
656        Self::new(inner)
657    }
658
659    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
660        self.client.into_channel().map_err(|client| Self { client })
661    }
662
663    fn as_channel(&self) -> &::fidl::AsyncChannel {
664        self.client.as_channel()
665    }
666}
667
668impl PropertyProviderProxy {
669    /// Create a new Proxy for fuchsia.intl/PropertyProvider.
670    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
671        let protocol_name = <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
672        Self { client: fidl::client::Client::new(channel, protocol_name) }
673    }
674
675    /// Get a Stream of events from the remote end of the protocol.
676    ///
677    /// # Panics
678    ///
679    /// Panics if the event stream was already taken.
680    pub fn take_event_stream(&self) -> PropertyProviderEventStream {
681        PropertyProviderEventStream { event_receiver: self.client.take_event_receiver() }
682    }
683
684    /// Gets the user's internationalization profile.
685    pub fn r#get_profile(
686        &self,
687    ) -> fidl::client::QueryResponseFut<Profile, fidl::encoding::DefaultFuchsiaResourceDialect>
688    {
689        PropertyProviderProxyInterface::r#get_profile(self)
690    }
691}
692
693impl PropertyProviderProxyInterface for PropertyProviderProxy {
694    type GetProfileResponseFut =
695        fidl::client::QueryResponseFut<Profile, fidl::encoding::DefaultFuchsiaResourceDialect>;
696    fn r#get_profile(&self) -> Self::GetProfileResponseFut {
697        fn _decode(
698            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
699        ) -> Result<Profile, fidl::Error> {
700            let _response = fidl::client::decode_transaction_body::<
701                PropertyProviderGetProfileResponse,
702                fidl::encoding::DefaultFuchsiaResourceDialect,
703                0x10bf06e68d36d3eb,
704            >(_buf?)?;
705            Ok(_response.profile)
706        }
707        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Profile>(
708            (),
709            0x10bf06e68d36d3eb,
710            fidl::encoding::DynamicFlags::empty(),
711            _decode,
712        )
713    }
714}
715
716pub struct PropertyProviderEventStream {
717    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
718}
719
720impl std::marker::Unpin for PropertyProviderEventStream {}
721
722impl futures::stream::FusedStream for PropertyProviderEventStream {
723    fn is_terminated(&self) -> bool {
724        self.event_receiver.is_terminated()
725    }
726}
727
728impl futures::Stream for PropertyProviderEventStream {
729    type Item = Result<PropertyProviderEvent, fidl::Error>;
730
731    fn poll_next(
732        mut self: std::pin::Pin<&mut Self>,
733        cx: &mut std::task::Context<'_>,
734    ) -> std::task::Poll<Option<Self::Item>> {
735        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
736            &mut self.event_receiver,
737            cx
738        )?) {
739            Some(buf) => std::task::Poll::Ready(Some(PropertyProviderEvent::decode(buf))),
740            None => std::task::Poll::Ready(None),
741        }
742    }
743}
744
745#[derive(Debug)]
746pub enum PropertyProviderEvent {
747    OnChange {},
748}
749
750impl PropertyProviderEvent {
751    #[allow(irrefutable_let_patterns)]
752    pub fn into_on_change(self) -> Option<()> {
753        if let PropertyProviderEvent::OnChange {} = self {
754            Some(())
755        } else {
756            None
757        }
758    }
759
760    /// Decodes a message buffer as a [`PropertyProviderEvent`].
761    fn decode(
762        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
763    ) -> Result<PropertyProviderEvent, fidl::Error> {
764        let (bytes, _handles) = buf.split_mut();
765        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
766        debug_assert_eq!(tx_header.tx_id, 0);
767        match tx_header.ordinal {
768            0x26b9ed6e23c46991 => {
769                let mut out = fidl::new_empty!(
770                    fidl::encoding::EmptyPayload,
771                    fidl::encoding::DefaultFuchsiaResourceDialect
772                );
773                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
774                Ok((PropertyProviderEvent::OnChange {}))
775            }
776            _ => Err(fidl::Error::UnknownOrdinal {
777                ordinal: tx_header.ordinal,
778                protocol_name:
779                    <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
780            }),
781        }
782    }
783}
784
785/// A Stream of incoming requests for fuchsia.intl/PropertyProvider.
786pub struct PropertyProviderRequestStream {
787    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
788    is_terminated: bool,
789}
790
791impl std::marker::Unpin for PropertyProviderRequestStream {}
792
793impl futures::stream::FusedStream for PropertyProviderRequestStream {
794    fn is_terminated(&self) -> bool {
795        self.is_terminated
796    }
797}
798
799impl fidl::endpoints::RequestStream for PropertyProviderRequestStream {
800    type Protocol = PropertyProviderMarker;
801    type ControlHandle = PropertyProviderControlHandle;
802
803    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
804        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
805    }
806
807    fn control_handle(&self) -> Self::ControlHandle {
808        PropertyProviderControlHandle { inner: self.inner.clone() }
809    }
810
811    fn into_inner(
812        self,
813    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
814    {
815        (self.inner, self.is_terminated)
816    }
817
818    fn from_inner(
819        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
820        is_terminated: bool,
821    ) -> Self {
822        Self { inner, is_terminated }
823    }
824}
825
826impl futures::Stream for PropertyProviderRequestStream {
827    type Item = Result<PropertyProviderRequest, fidl::Error>;
828
829    fn poll_next(
830        mut self: std::pin::Pin<&mut Self>,
831        cx: &mut std::task::Context<'_>,
832    ) -> std::task::Poll<Option<Self::Item>> {
833        let this = &mut *self;
834        if this.inner.check_shutdown(cx) {
835            this.is_terminated = true;
836            return std::task::Poll::Ready(None);
837        }
838        if this.is_terminated {
839            panic!("polled PropertyProviderRequestStream after completion");
840        }
841        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
842            |bytes, handles| {
843                match this.inner.channel().read_etc(cx, bytes, handles) {
844                    std::task::Poll::Ready(Ok(())) => {}
845                    std::task::Poll::Pending => return std::task::Poll::Pending,
846                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
847                        this.is_terminated = true;
848                        return std::task::Poll::Ready(None);
849                    }
850                    std::task::Poll::Ready(Err(e)) => {
851                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
852                            e.into(),
853                        ))))
854                    }
855                }
856
857                // A message has been received from the channel
858                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
859
860                std::task::Poll::Ready(Some(match header.ordinal {
861                    0x10bf06e68d36d3eb => {
862                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
863                        let mut req = fidl::new_empty!(
864                            fidl::encoding::EmptyPayload,
865                            fidl::encoding::DefaultFuchsiaResourceDialect
866                        );
867                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
868                        let control_handle =
869                            PropertyProviderControlHandle { inner: this.inner.clone() };
870                        Ok(PropertyProviderRequest::GetProfile {
871                            responder: PropertyProviderGetProfileResponder {
872                                control_handle: std::mem::ManuallyDrop::new(control_handle),
873                                tx_id: header.tx_id,
874                            },
875                        })
876                    }
877                    _ => Err(fidl::Error::UnknownOrdinal {
878                        ordinal: header.ordinal,
879                        protocol_name:
880                            <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
881                    }),
882                }))
883            },
884        )
885    }
886}
887
888/// Provides internationalization properties.
889///
890/// Components that need to change their behavior in response to the user's internationalization
891/// profile may request an instance of this service from their namespace, if available. A component
892/// may choose to pass along the service that it received from its parent to its own children, or to
893/// override it and apply additional customizations.
894///
895/// See also `fuchsia.ui.views.View`.
896#[derive(Debug)]
897pub enum PropertyProviderRequest {
898    /// Gets the user's internationalization profile.
899    GetProfile { responder: PropertyProviderGetProfileResponder },
900}
901
902impl PropertyProviderRequest {
903    #[allow(irrefutable_let_patterns)]
904    pub fn into_get_profile(self) -> Option<(PropertyProviderGetProfileResponder)> {
905        if let PropertyProviderRequest::GetProfile { responder } = self {
906            Some((responder))
907        } else {
908            None
909        }
910    }
911
912    /// Name of the method defined in FIDL
913    pub fn method_name(&self) -> &'static str {
914        match *self {
915            PropertyProviderRequest::GetProfile { .. } => "get_profile",
916        }
917    }
918}
919
920#[derive(Debug, Clone)]
921pub struct PropertyProviderControlHandle {
922    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
923}
924
925impl fidl::endpoints::ControlHandle for PropertyProviderControlHandle {
926    fn shutdown(&self) {
927        self.inner.shutdown()
928    }
929    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
930        self.inner.shutdown_with_epitaph(status)
931    }
932
933    fn is_closed(&self) -> bool {
934        self.inner.channel().is_closed()
935    }
936    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
937        self.inner.channel().on_closed()
938    }
939
940    #[cfg(target_os = "fuchsia")]
941    fn signal_peer(
942        &self,
943        clear_mask: zx::Signals,
944        set_mask: zx::Signals,
945    ) -> Result<(), zx_status::Status> {
946        use fidl::Peered;
947        self.inner.channel().signal_peer(clear_mask, set_mask)
948    }
949}
950
951impl PropertyProviderControlHandle {
952    pub fn send_on_change(&self) -> Result<(), fidl::Error> {
953        self.inner.send::<fidl::encoding::EmptyPayload>(
954            (),
955            0,
956            0x26b9ed6e23c46991,
957            fidl::encoding::DynamicFlags::empty(),
958        )
959    }
960}
961
962#[must_use = "FIDL methods require a response to be sent"]
963#[derive(Debug)]
964pub struct PropertyProviderGetProfileResponder {
965    control_handle: std::mem::ManuallyDrop<PropertyProviderControlHandle>,
966    tx_id: u32,
967}
968
969/// Set the the channel to be shutdown (see [`PropertyProviderControlHandle::shutdown`])
970/// if the responder is dropped without sending a response, so that the client
971/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
972impl std::ops::Drop for PropertyProviderGetProfileResponder {
973    fn drop(&mut self) {
974        self.control_handle.shutdown();
975        // Safety: drops once, never accessed again
976        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
977    }
978}
979
980impl fidl::endpoints::Responder for PropertyProviderGetProfileResponder {
981    type ControlHandle = PropertyProviderControlHandle;
982
983    fn control_handle(&self) -> &PropertyProviderControlHandle {
984        &self.control_handle
985    }
986
987    fn drop_without_shutdown(mut self) {
988        // Safety: drops once, never accessed again due to mem::forget
989        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
990        // Prevent Drop from running (which would shut down the channel)
991        std::mem::forget(self);
992    }
993}
994
995impl PropertyProviderGetProfileResponder {
996    /// Sends a response to the FIDL transaction.
997    ///
998    /// Sets the channel to shutdown if an error occurs.
999    pub fn send(self, mut profile: &Profile) -> Result<(), fidl::Error> {
1000        let _result = self.send_raw(profile);
1001        if _result.is_err() {
1002            self.control_handle.shutdown();
1003        }
1004        self.drop_without_shutdown();
1005        _result
1006    }
1007
1008    /// Similar to "send" but does not shutdown the channel if an error occurs.
1009    pub fn send_no_shutdown_on_err(self, mut profile: &Profile) -> Result<(), fidl::Error> {
1010        let _result = self.send_raw(profile);
1011        self.drop_without_shutdown();
1012        _result
1013    }
1014
1015    fn send_raw(&self, mut profile: &Profile) -> Result<(), fidl::Error> {
1016        self.control_handle.inner.send::<PropertyProviderGetProfileResponse>(
1017            (profile,),
1018            self.tx_id,
1019            0x10bf06e68d36d3eb,
1020            fidl::encoding::DynamicFlags::empty(),
1021        )
1022    }
1023}
1024
1025#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1026pub struct TimeZonesMarker;
1027
1028impl fidl::endpoints::ProtocolMarker for TimeZonesMarker {
1029    type Proxy = TimeZonesProxy;
1030    type RequestStream = TimeZonesRequestStream;
1031    #[cfg(target_os = "fuchsia")]
1032    type SynchronousProxy = TimeZonesSynchronousProxy;
1033
1034    const DEBUG_NAME: &'static str = "fuchsia.intl.TimeZones";
1035}
1036impl fidl::endpoints::DiscoverableProtocolMarker for TimeZonesMarker {}
1037pub type TimeZonesAbsoluteToCivilTimeResult = Result<CivilTime, TimeZonesError>;
1038pub type TimeZonesCivilToAbsoluteTimeResult = Result<i64, TimeZonesError>;
1039pub type TimeZonesGetTimeZoneInfoResult = Result<TimeZoneInfo, TimeZonesError>;
1040
1041pub trait TimeZonesProxyInterface: Send + Sync {
1042    type AbsoluteToCivilTimeResponseFut: std::future::Future<Output = Result<TimeZonesAbsoluteToCivilTimeResult, fidl::Error>>
1043        + Send;
1044    fn r#absolute_to_civil_time(
1045        &self,
1046        time_zone_id: &TimeZoneId,
1047        absolute_time: i64,
1048    ) -> Self::AbsoluteToCivilTimeResponseFut;
1049    type CivilToAbsoluteTimeResponseFut: std::future::Future<Output = Result<TimeZonesCivilToAbsoluteTimeResult, fidl::Error>>
1050        + Send;
1051    fn r#civil_to_absolute_time(
1052        &self,
1053        civil_time: &CivilTime,
1054        options: &CivilToAbsoluteTimeOptions,
1055    ) -> Self::CivilToAbsoluteTimeResponseFut;
1056    type GetTimeZoneInfoResponseFut: std::future::Future<Output = Result<TimeZonesGetTimeZoneInfoResult, fidl::Error>>
1057        + Send;
1058    fn r#get_time_zone_info(
1059        &self,
1060        time_zone_id: &TimeZoneId,
1061        at_time: i64,
1062    ) -> Self::GetTimeZoneInfoResponseFut;
1063}
1064#[derive(Debug)]
1065#[cfg(target_os = "fuchsia")]
1066pub struct TimeZonesSynchronousProxy {
1067    client: fidl::client::sync::Client,
1068}
1069
1070#[cfg(target_os = "fuchsia")]
1071impl fidl::endpoints::SynchronousProxy for TimeZonesSynchronousProxy {
1072    type Proxy = TimeZonesProxy;
1073    type Protocol = TimeZonesMarker;
1074
1075    fn from_channel(inner: fidl::Channel) -> Self {
1076        Self::new(inner)
1077    }
1078
1079    fn into_channel(self) -> fidl::Channel {
1080        self.client.into_channel()
1081    }
1082
1083    fn as_channel(&self) -> &fidl::Channel {
1084        self.client.as_channel()
1085    }
1086}
1087
1088#[cfg(target_os = "fuchsia")]
1089impl TimeZonesSynchronousProxy {
1090    pub fn new(channel: fidl::Channel) -> Self {
1091        let protocol_name = <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1092        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1093    }
1094
1095    pub fn into_channel(self) -> fidl::Channel {
1096        self.client.into_channel()
1097    }
1098
1099    /// Waits until an event arrives and returns it. It is safe for other
1100    /// threads to make concurrent requests while waiting for an event.
1101    pub fn wait_for_event(
1102        &self,
1103        deadline: zx::MonotonicInstant,
1104    ) -> Result<TimeZonesEvent, fidl::Error> {
1105        TimeZonesEvent::decode(self.client.wait_for_event(deadline)?)
1106    }
1107
1108    /// Converts the given absolute time to a civil date and time in the given time zone, using the
1109    /// Gregorian calendar.
1110    pub fn r#absolute_to_civil_time(
1111        &self,
1112        mut time_zone_id: &TimeZoneId,
1113        mut absolute_time: i64,
1114        ___deadline: zx::MonotonicInstant,
1115    ) -> Result<TimeZonesAbsoluteToCivilTimeResult, fidl::Error> {
1116        let _response = self.client.send_query::<
1117            TimeZonesAbsoluteToCivilTimeRequest,
1118            fidl::encoding::ResultType<TimeZonesAbsoluteToCivilTimeResponse, TimeZonesError>,
1119        >(
1120            (time_zone_id, absolute_time,),
1121            0x25377a4d9196e205,
1122            fidl::encoding::DynamicFlags::empty(),
1123            ___deadline,
1124        )?;
1125        Ok(_response.map(|x| x.civil_time))
1126    }
1127
1128    /// Converts the given civil date and time in the given time zone to nanoseconds since the Unix
1129    /// epoch.
1130    pub fn r#civil_to_absolute_time(
1131        &self,
1132        mut civil_time: &CivilTime,
1133        mut options: &CivilToAbsoluteTimeOptions,
1134        ___deadline: zx::MonotonicInstant,
1135    ) -> Result<TimeZonesCivilToAbsoluteTimeResult, fidl::Error> {
1136        let _response = self.client.send_query::<
1137            TimeZonesCivilToAbsoluteTimeRequest,
1138            fidl::encoding::ResultType<TimeZonesCivilToAbsoluteTimeResponse, TimeZonesError>,
1139        >(
1140            (civil_time, options,),
1141            0xc1277c7a1413aa6,
1142            fidl::encoding::DynamicFlags::empty(),
1143            ___deadline,
1144        )?;
1145        Ok(_response.map(|x| x.absolute_time))
1146    }
1147
1148    /// Retrieves details about a time zone at a specified one.
1149    pub fn r#get_time_zone_info(
1150        &self,
1151        mut time_zone_id: &TimeZoneId,
1152        mut at_time: i64,
1153        ___deadline: zx::MonotonicInstant,
1154    ) -> Result<TimeZonesGetTimeZoneInfoResult, fidl::Error> {
1155        let _response =
1156            self.client.send_query::<TimeZonesGetTimeZoneInfoRequest, fidl::encoding::ResultType<
1157                TimeZonesGetTimeZoneInfoResponse,
1158                TimeZonesError,
1159            >>(
1160                (time_zone_id, at_time),
1161                0x2144cbac1d76fe65,
1162                fidl::encoding::DynamicFlags::empty(),
1163                ___deadline,
1164            )?;
1165        Ok(_response.map(|x| x.time_zone_info))
1166    }
1167}
1168
1169#[derive(Debug, Clone)]
1170pub struct TimeZonesProxy {
1171    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1172}
1173
1174impl fidl::endpoints::Proxy for TimeZonesProxy {
1175    type Protocol = TimeZonesMarker;
1176
1177    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1178        Self::new(inner)
1179    }
1180
1181    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1182        self.client.into_channel().map_err(|client| Self { client })
1183    }
1184
1185    fn as_channel(&self) -> &::fidl::AsyncChannel {
1186        self.client.as_channel()
1187    }
1188}
1189
1190impl TimeZonesProxy {
1191    /// Create a new Proxy for fuchsia.intl/TimeZones.
1192    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1193        let protocol_name = <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1194        Self { client: fidl::client::Client::new(channel, protocol_name) }
1195    }
1196
1197    /// Get a Stream of events from the remote end of the protocol.
1198    ///
1199    /// # Panics
1200    ///
1201    /// Panics if the event stream was already taken.
1202    pub fn take_event_stream(&self) -> TimeZonesEventStream {
1203        TimeZonesEventStream { event_receiver: self.client.take_event_receiver() }
1204    }
1205
1206    /// Converts the given absolute time to a civil date and time in the given time zone, using the
1207    /// Gregorian calendar.
1208    pub fn r#absolute_to_civil_time(
1209        &self,
1210        mut time_zone_id: &TimeZoneId,
1211        mut absolute_time: i64,
1212    ) -> fidl::client::QueryResponseFut<
1213        TimeZonesAbsoluteToCivilTimeResult,
1214        fidl::encoding::DefaultFuchsiaResourceDialect,
1215    > {
1216        TimeZonesProxyInterface::r#absolute_to_civil_time(self, time_zone_id, absolute_time)
1217    }
1218
1219    /// Converts the given civil date and time in the given time zone to nanoseconds since the Unix
1220    /// epoch.
1221    pub fn r#civil_to_absolute_time(
1222        &self,
1223        mut civil_time: &CivilTime,
1224        mut options: &CivilToAbsoluteTimeOptions,
1225    ) -> fidl::client::QueryResponseFut<
1226        TimeZonesCivilToAbsoluteTimeResult,
1227        fidl::encoding::DefaultFuchsiaResourceDialect,
1228    > {
1229        TimeZonesProxyInterface::r#civil_to_absolute_time(self, civil_time, options)
1230    }
1231
1232    /// Retrieves details about a time zone at a specified one.
1233    pub fn r#get_time_zone_info(
1234        &self,
1235        mut time_zone_id: &TimeZoneId,
1236        mut at_time: i64,
1237    ) -> fidl::client::QueryResponseFut<
1238        TimeZonesGetTimeZoneInfoResult,
1239        fidl::encoding::DefaultFuchsiaResourceDialect,
1240    > {
1241        TimeZonesProxyInterface::r#get_time_zone_info(self, time_zone_id, at_time)
1242    }
1243}
1244
1245impl TimeZonesProxyInterface for TimeZonesProxy {
1246    type AbsoluteToCivilTimeResponseFut = fidl::client::QueryResponseFut<
1247        TimeZonesAbsoluteToCivilTimeResult,
1248        fidl::encoding::DefaultFuchsiaResourceDialect,
1249    >;
1250    fn r#absolute_to_civil_time(
1251        &self,
1252        mut time_zone_id: &TimeZoneId,
1253        mut absolute_time: i64,
1254    ) -> Self::AbsoluteToCivilTimeResponseFut {
1255        fn _decode(
1256            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1257        ) -> Result<TimeZonesAbsoluteToCivilTimeResult, fidl::Error> {
1258            let _response = fidl::client::decode_transaction_body::<
1259                fidl::encoding::ResultType<TimeZonesAbsoluteToCivilTimeResponse, TimeZonesError>,
1260                fidl::encoding::DefaultFuchsiaResourceDialect,
1261                0x25377a4d9196e205,
1262            >(_buf?)?;
1263            Ok(_response.map(|x| x.civil_time))
1264        }
1265        self.client.send_query_and_decode::<
1266            TimeZonesAbsoluteToCivilTimeRequest,
1267            TimeZonesAbsoluteToCivilTimeResult,
1268        >(
1269            (time_zone_id, absolute_time,),
1270            0x25377a4d9196e205,
1271            fidl::encoding::DynamicFlags::empty(),
1272            _decode,
1273        )
1274    }
1275
1276    type CivilToAbsoluteTimeResponseFut = fidl::client::QueryResponseFut<
1277        TimeZonesCivilToAbsoluteTimeResult,
1278        fidl::encoding::DefaultFuchsiaResourceDialect,
1279    >;
1280    fn r#civil_to_absolute_time(
1281        &self,
1282        mut civil_time: &CivilTime,
1283        mut options: &CivilToAbsoluteTimeOptions,
1284    ) -> Self::CivilToAbsoluteTimeResponseFut {
1285        fn _decode(
1286            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1287        ) -> Result<TimeZonesCivilToAbsoluteTimeResult, fidl::Error> {
1288            let _response = fidl::client::decode_transaction_body::<
1289                fidl::encoding::ResultType<TimeZonesCivilToAbsoluteTimeResponse, TimeZonesError>,
1290                fidl::encoding::DefaultFuchsiaResourceDialect,
1291                0xc1277c7a1413aa6,
1292            >(_buf?)?;
1293            Ok(_response.map(|x| x.absolute_time))
1294        }
1295        self.client.send_query_and_decode::<
1296            TimeZonesCivilToAbsoluteTimeRequest,
1297            TimeZonesCivilToAbsoluteTimeResult,
1298        >(
1299            (civil_time, options,),
1300            0xc1277c7a1413aa6,
1301            fidl::encoding::DynamicFlags::empty(),
1302            _decode,
1303        )
1304    }
1305
1306    type GetTimeZoneInfoResponseFut = fidl::client::QueryResponseFut<
1307        TimeZonesGetTimeZoneInfoResult,
1308        fidl::encoding::DefaultFuchsiaResourceDialect,
1309    >;
1310    fn r#get_time_zone_info(
1311        &self,
1312        mut time_zone_id: &TimeZoneId,
1313        mut at_time: i64,
1314    ) -> Self::GetTimeZoneInfoResponseFut {
1315        fn _decode(
1316            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1317        ) -> Result<TimeZonesGetTimeZoneInfoResult, fidl::Error> {
1318            let _response = fidl::client::decode_transaction_body::<
1319                fidl::encoding::ResultType<TimeZonesGetTimeZoneInfoResponse, TimeZonesError>,
1320                fidl::encoding::DefaultFuchsiaResourceDialect,
1321                0x2144cbac1d76fe65,
1322            >(_buf?)?;
1323            Ok(_response.map(|x| x.time_zone_info))
1324        }
1325        self.client.send_query_and_decode::<
1326            TimeZonesGetTimeZoneInfoRequest,
1327            TimeZonesGetTimeZoneInfoResult,
1328        >(
1329            (time_zone_id, at_time,),
1330            0x2144cbac1d76fe65,
1331            fidl::encoding::DynamicFlags::empty(),
1332            _decode,
1333        )
1334    }
1335}
1336
1337pub struct TimeZonesEventStream {
1338    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1339}
1340
1341impl std::marker::Unpin for TimeZonesEventStream {}
1342
1343impl futures::stream::FusedStream for TimeZonesEventStream {
1344    fn is_terminated(&self) -> bool {
1345        self.event_receiver.is_terminated()
1346    }
1347}
1348
1349impl futures::Stream for TimeZonesEventStream {
1350    type Item = Result<TimeZonesEvent, fidl::Error>;
1351
1352    fn poll_next(
1353        mut self: std::pin::Pin<&mut Self>,
1354        cx: &mut std::task::Context<'_>,
1355    ) -> std::task::Poll<Option<Self::Item>> {
1356        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1357            &mut self.event_receiver,
1358            cx
1359        )?) {
1360            Some(buf) => std::task::Poll::Ready(Some(TimeZonesEvent::decode(buf))),
1361            None => std::task::Poll::Ready(None),
1362        }
1363    }
1364}
1365
1366#[derive(Debug)]
1367pub enum TimeZonesEvent {}
1368
1369impl TimeZonesEvent {
1370    /// Decodes a message buffer as a [`TimeZonesEvent`].
1371    fn decode(
1372        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1373    ) -> Result<TimeZonesEvent, fidl::Error> {
1374        let (bytes, _handles) = buf.split_mut();
1375        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1376        debug_assert_eq!(tx_header.tx_id, 0);
1377        match tx_header.ordinal {
1378            _ => Err(fidl::Error::UnknownOrdinal {
1379                ordinal: tx_header.ordinal,
1380                protocol_name: <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1381            }),
1382        }
1383    }
1384}
1385
1386/// A Stream of incoming requests for fuchsia.intl/TimeZones.
1387pub struct TimeZonesRequestStream {
1388    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1389    is_terminated: bool,
1390}
1391
1392impl std::marker::Unpin for TimeZonesRequestStream {}
1393
1394impl futures::stream::FusedStream for TimeZonesRequestStream {
1395    fn is_terminated(&self) -> bool {
1396        self.is_terminated
1397    }
1398}
1399
1400impl fidl::endpoints::RequestStream for TimeZonesRequestStream {
1401    type Protocol = TimeZonesMarker;
1402    type ControlHandle = TimeZonesControlHandle;
1403
1404    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1405        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1406    }
1407
1408    fn control_handle(&self) -> Self::ControlHandle {
1409        TimeZonesControlHandle { inner: self.inner.clone() }
1410    }
1411
1412    fn into_inner(
1413        self,
1414    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1415    {
1416        (self.inner, self.is_terminated)
1417    }
1418
1419    fn from_inner(
1420        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1421        is_terminated: bool,
1422    ) -> Self {
1423        Self { inner, is_terminated }
1424    }
1425}
1426
1427impl futures::Stream for TimeZonesRequestStream {
1428    type Item = Result<TimeZonesRequest, fidl::Error>;
1429
1430    fn poll_next(
1431        mut self: std::pin::Pin<&mut Self>,
1432        cx: &mut std::task::Context<'_>,
1433    ) -> std::task::Poll<Option<Self::Item>> {
1434        let this = &mut *self;
1435        if this.inner.check_shutdown(cx) {
1436            this.is_terminated = true;
1437            return std::task::Poll::Ready(None);
1438        }
1439        if this.is_terminated {
1440            panic!("polled TimeZonesRequestStream after completion");
1441        }
1442        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1443            |bytes, handles| {
1444                match this.inner.channel().read_etc(cx, bytes, handles) {
1445                    std::task::Poll::Ready(Ok(())) => {}
1446                    std::task::Poll::Pending => return std::task::Poll::Pending,
1447                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1448                        this.is_terminated = true;
1449                        return std::task::Poll::Ready(None);
1450                    }
1451                    std::task::Poll::Ready(Err(e)) => {
1452                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1453                            e.into(),
1454                        ))))
1455                    }
1456                }
1457
1458                // A message has been received from the channel
1459                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1460
1461                std::task::Poll::Ready(Some(match header.ordinal {
1462                    0x25377a4d9196e205 => {
1463                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1464                        let mut req = fidl::new_empty!(
1465                            TimeZonesAbsoluteToCivilTimeRequest,
1466                            fidl::encoding::DefaultFuchsiaResourceDialect
1467                        );
1468                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeZonesAbsoluteToCivilTimeRequest>(&header, _body_bytes, handles, &mut req)?;
1469                        let control_handle = TimeZonesControlHandle { inner: this.inner.clone() };
1470                        Ok(TimeZonesRequest::AbsoluteToCivilTime {
1471                            time_zone_id: req.time_zone_id,
1472                            absolute_time: req.absolute_time,
1473
1474                            responder: TimeZonesAbsoluteToCivilTimeResponder {
1475                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1476                                tx_id: header.tx_id,
1477                            },
1478                        })
1479                    }
1480                    0xc1277c7a1413aa6 => {
1481                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1482                        let mut req = fidl::new_empty!(
1483                            TimeZonesCivilToAbsoluteTimeRequest,
1484                            fidl::encoding::DefaultFuchsiaResourceDialect
1485                        );
1486                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeZonesCivilToAbsoluteTimeRequest>(&header, _body_bytes, handles, &mut req)?;
1487                        let control_handle = TimeZonesControlHandle { inner: this.inner.clone() };
1488                        Ok(TimeZonesRequest::CivilToAbsoluteTime {
1489                            civil_time: req.civil_time,
1490                            options: req.options,
1491
1492                            responder: TimeZonesCivilToAbsoluteTimeResponder {
1493                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1494                                tx_id: header.tx_id,
1495                            },
1496                        })
1497                    }
1498                    0x2144cbac1d76fe65 => {
1499                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1500                        let mut req = fidl::new_empty!(
1501                            TimeZonesGetTimeZoneInfoRequest,
1502                            fidl::encoding::DefaultFuchsiaResourceDialect
1503                        );
1504                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeZonesGetTimeZoneInfoRequest>(&header, _body_bytes, handles, &mut req)?;
1505                        let control_handle = TimeZonesControlHandle { inner: this.inner.clone() };
1506                        Ok(TimeZonesRequest::GetTimeZoneInfo {
1507                            time_zone_id: req.time_zone_id,
1508                            at_time: req.at_time,
1509
1510                            responder: TimeZonesGetTimeZoneInfoResponder {
1511                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1512                                tx_id: header.tx_id,
1513                            },
1514                        })
1515                    }
1516                    _ => Err(fidl::Error::UnknownOrdinal {
1517                        ordinal: header.ordinal,
1518                        protocol_name:
1519                            <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1520                    }),
1521                }))
1522            },
1523        )
1524    }
1525}
1526
1527/// Provides information about time zones and offers date-time conversion methods.
1528///
1529/// TODO(https://fxbug.dev/42162409): Add time zone info methods, including offsets from UTC.
1530#[derive(Debug)]
1531pub enum TimeZonesRequest {
1532    /// Converts the given absolute time to a civil date and time in the given time zone, using the
1533    /// Gregorian calendar.
1534    AbsoluteToCivilTime {
1535        time_zone_id: TimeZoneId,
1536        absolute_time: i64,
1537        responder: TimeZonesAbsoluteToCivilTimeResponder,
1538    },
1539    /// Converts the given civil date and time in the given time zone to nanoseconds since the Unix
1540    /// epoch.
1541    CivilToAbsoluteTime {
1542        civil_time: CivilTime,
1543        options: CivilToAbsoluteTimeOptions,
1544        responder: TimeZonesCivilToAbsoluteTimeResponder,
1545    },
1546    /// Retrieves details about a time zone at a specified one.
1547    GetTimeZoneInfo {
1548        time_zone_id: TimeZoneId,
1549        at_time: i64,
1550        responder: TimeZonesGetTimeZoneInfoResponder,
1551    },
1552}
1553
1554impl TimeZonesRequest {
1555    #[allow(irrefutable_let_patterns)]
1556    pub fn into_absolute_to_civil_time(
1557        self,
1558    ) -> Option<(TimeZoneId, i64, TimeZonesAbsoluteToCivilTimeResponder)> {
1559        if let TimeZonesRequest::AbsoluteToCivilTime { time_zone_id, absolute_time, responder } =
1560            self
1561        {
1562            Some((time_zone_id, absolute_time, responder))
1563        } else {
1564            None
1565        }
1566    }
1567
1568    #[allow(irrefutable_let_patterns)]
1569    pub fn into_civil_to_absolute_time(
1570        self,
1571    ) -> Option<(CivilTime, CivilToAbsoluteTimeOptions, TimeZonesCivilToAbsoluteTimeResponder)>
1572    {
1573        if let TimeZonesRequest::CivilToAbsoluteTime { civil_time, options, responder } = self {
1574            Some((civil_time, options, responder))
1575        } else {
1576            None
1577        }
1578    }
1579
1580    #[allow(irrefutable_let_patterns)]
1581    pub fn into_get_time_zone_info(
1582        self,
1583    ) -> Option<(TimeZoneId, i64, TimeZonesGetTimeZoneInfoResponder)> {
1584        if let TimeZonesRequest::GetTimeZoneInfo { time_zone_id, at_time, responder } = self {
1585            Some((time_zone_id, at_time, responder))
1586        } else {
1587            None
1588        }
1589    }
1590
1591    /// Name of the method defined in FIDL
1592    pub fn method_name(&self) -> &'static str {
1593        match *self {
1594            TimeZonesRequest::AbsoluteToCivilTime { .. } => "absolute_to_civil_time",
1595            TimeZonesRequest::CivilToAbsoluteTime { .. } => "civil_to_absolute_time",
1596            TimeZonesRequest::GetTimeZoneInfo { .. } => "get_time_zone_info",
1597        }
1598    }
1599}
1600
1601#[derive(Debug, Clone)]
1602pub struct TimeZonesControlHandle {
1603    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1604}
1605
1606impl fidl::endpoints::ControlHandle for TimeZonesControlHandle {
1607    fn shutdown(&self) {
1608        self.inner.shutdown()
1609    }
1610    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1611        self.inner.shutdown_with_epitaph(status)
1612    }
1613
1614    fn is_closed(&self) -> bool {
1615        self.inner.channel().is_closed()
1616    }
1617    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1618        self.inner.channel().on_closed()
1619    }
1620
1621    #[cfg(target_os = "fuchsia")]
1622    fn signal_peer(
1623        &self,
1624        clear_mask: zx::Signals,
1625        set_mask: zx::Signals,
1626    ) -> Result<(), zx_status::Status> {
1627        use fidl::Peered;
1628        self.inner.channel().signal_peer(clear_mask, set_mask)
1629    }
1630}
1631
1632impl TimeZonesControlHandle {}
1633
1634#[must_use = "FIDL methods require a response to be sent"]
1635#[derive(Debug)]
1636pub struct TimeZonesAbsoluteToCivilTimeResponder {
1637    control_handle: std::mem::ManuallyDrop<TimeZonesControlHandle>,
1638    tx_id: u32,
1639}
1640
1641/// Set the the channel to be shutdown (see [`TimeZonesControlHandle::shutdown`])
1642/// if the responder is dropped without sending a response, so that the client
1643/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1644impl std::ops::Drop for TimeZonesAbsoluteToCivilTimeResponder {
1645    fn drop(&mut self) {
1646        self.control_handle.shutdown();
1647        // Safety: drops once, never accessed again
1648        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1649    }
1650}
1651
1652impl fidl::endpoints::Responder for TimeZonesAbsoluteToCivilTimeResponder {
1653    type ControlHandle = TimeZonesControlHandle;
1654
1655    fn control_handle(&self) -> &TimeZonesControlHandle {
1656        &self.control_handle
1657    }
1658
1659    fn drop_without_shutdown(mut self) {
1660        // Safety: drops once, never accessed again due to mem::forget
1661        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1662        // Prevent Drop from running (which would shut down the channel)
1663        std::mem::forget(self);
1664    }
1665}
1666
1667impl TimeZonesAbsoluteToCivilTimeResponder {
1668    /// Sends a response to the FIDL transaction.
1669    ///
1670    /// Sets the channel to shutdown if an error occurs.
1671    pub fn send(self, mut result: Result<&CivilTime, TimeZonesError>) -> Result<(), fidl::Error> {
1672        let _result = self.send_raw(result);
1673        if _result.is_err() {
1674            self.control_handle.shutdown();
1675        }
1676        self.drop_without_shutdown();
1677        _result
1678    }
1679
1680    /// Similar to "send" but does not shutdown the channel if an error occurs.
1681    pub fn send_no_shutdown_on_err(
1682        self,
1683        mut result: Result<&CivilTime, TimeZonesError>,
1684    ) -> Result<(), fidl::Error> {
1685        let _result = self.send_raw(result);
1686        self.drop_without_shutdown();
1687        _result
1688    }
1689
1690    fn send_raw(&self, mut result: Result<&CivilTime, TimeZonesError>) -> Result<(), fidl::Error> {
1691        self.control_handle.inner.send::<fidl::encoding::ResultType<
1692            TimeZonesAbsoluteToCivilTimeResponse,
1693            TimeZonesError,
1694        >>(
1695            result.map(|civil_time| (civil_time,)),
1696            self.tx_id,
1697            0x25377a4d9196e205,
1698            fidl::encoding::DynamicFlags::empty(),
1699        )
1700    }
1701}
1702
1703#[must_use = "FIDL methods require a response to be sent"]
1704#[derive(Debug)]
1705pub struct TimeZonesCivilToAbsoluteTimeResponder {
1706    control_handle: std::mem::ManuallyDrop<TimeZonesControlHandle>,
1707    tx_id: u32,
1708}
1709
1710/// Set the the channel to be shutdown (see [`TimeZonesControlHandle::shutdown`])
1711/// if the responder is dropped without sending a response, so that the client
1712/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1713impl std::ops::Drop for TimeZonesCivilToAbsoluteTimeResponder {
1714    fn drop(&mut self) {
1715        self.control_handle.shutdown();
1716        // Safety: drops once, never accessed again
1717        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1718    }
1719}
1720
1721impl fidl::endpoints::Responder for TimeZonesCivilToAbsoluteTimeResponder {
1722    type ControlHandle = TimeZonesControlHandle;
1723
1724    fn control_handle(&self) -> &TimeZonesControlHandle {
1725        &self.control_handle
1726    }
1727
1728    fn drop_without_shutdown(mut self) {
1729        // Safety: drops once, never accessed again due to mem::forget
1730        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1731        // Prevent Drop from running (which would shut down the channel)
1732        std::mem::forget(self);
1733    }
1734}
1735
1736impl TimeZonesCivilToAbsoluteTimeResponder {
1737    /// Sends a response to the FIDL transaction.
1738    ///
1739    /// Sets the channel to shutdown if an error occurs.
1740    pub fn send(self, mut result: Result<i64, TimeZonesError>) -> Result<(), fidl::Error> {
1741        let _result = self.send_raw(result);
1742        if _result.is_err() {
1743            self.control_handle.shutdown();
1744        }
1745        self.drop_without_shutdown();
1746        _result
1747    }
1748
1749    /// Similar to "send" but does not shutdown the channel if an error occurs.
1750    pub fn send_no_shutdown_on_err(
1751        self,
1752        mut result: Result<i64, TimeZonesError>,
1753    ) -> Result<(), fidl::Error> {
1754        let _result = self.send_raw(result);
1755        self.drop_without_shutdown();
1756        _result
1757    }
1758
1759    fn send_raw(&self, mut result: Result<i64, TimeZonesError>) -> Result<(), fidl::Error> {
1760        self.control_handle.inner.send::<fidl::encoding::ResultType<
1761            TimeZonesCivilToAbsoluteTimeResponse,
1762            TimeZonesError,
1763        >>(
1764            result.map(|absolute_time| (absolute_time,)),
1765            self.tx_id,
1766            0xc1277c7a1413aa6,
1767            fidl::encoding::DynamicFlags::empty(),
1768        )
1769    }
1770}
1771
1772#[must_use = "FIDL methods require a response to be sent"]
1773#[derive(Debug)]
1774pub struct TimeZonesGetTimeZoneInfoResponder {
1775    control_handle: std::mem::ManuallyDrop<TimeZonesControlHandle>,
1776    tx_id: u32,
1777}
1778
1779/// Set the the channel to be shutdown (see [`TimeZonesControlHandle::shutdown`])
1780/// if the responder is dropped without sending a response, so that the client
1781/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1782impl std::ops::Drop for TimeZonesGetTimeZoneInfoResponder {
1783    fn drop(&mut self) {
1784        self.control_handle.shutdown();
1785        // Safety: drops once, never accessed again
1786        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1787    }
1788}
1789
1790impl fidl::endpoints::Responder for TimeZonesGetTimeZoneInfoResponder {
1791    type ControlHandle = TimeZonesControlHandle;
1792
1793    fn control_handle(&self) -> &TimeZonesControlHandle {
1794        &self.control_handle
1795    }
1796
1797    fn drop_without_shutdown(mut self) {
1798        // Safety: drops once, never accessed again due to mem::forget
1799        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1800        // Prevent Drop from running (which would shut down the channel)
1801        std::mem::forget(self);
1802    }
1803}
1804
1805impl TimeZonesGetTimeZoneInfoResponder {
1806    /// Sends a response to the FIDL transaction.
1807    ///
1808    /// Sets the channel to shutdown if an error occurs.
1809    pub fn send(
1810        self,
1811        mut result: Result<&TimeZoneInfo, TimeZonesError>,
1812    ) -> Result<(), fidl::Error> {
1813        let _result = self.send_raw(result);
1814        if _result.is_err() {
1815            self.control_handle.shutdown();
1816        }
1817        self.drop_without_shutdown();
1818        _result
1819    }
1820
1821    /// Similar to "send" but does not shutdown the channel if an error occurs.
1822    pub fn send_no_shutdown_on_err(
1823        self,
1824        mut result: Result<&TimeZoneInfo, TimeZonesError>,
1825    ) -> Result<(), fidl::Error> {
1826        let _result = self.send_raw(result);
1827        self.drop_without_shutdown();
1828        _result
1829    }
1830
1831    fn send_raw(
1832        &self,
1833        mut result: Result<&TimeZoneInfo, TimeZonesError>,
1834    ) -> Result<(), fidl::Error> {
1835        self.control_handle.inner.send::<fidl::encoding::ResultType<
1836            TimeZonesGetTimeZoneInfoResponse,
1837            TimeZonesError,
1838        >>(
1839            result.map(|time_zone_info| (time_zone_info,)),
1840            self.tx_id,
1841            0x2144cbac1d76fe65,
1842            fidl::encoding::DynamicFlags::empty(),
1843        )
1844    }
1845}
1846
1847mod internal {
1848    use super::*;
1849    unsafe impl fidl::encoding::TypeMarker for DayOfWeek {
1850        type Owned = Self;
1851
1852        #[inline(always)]
1853        fn inline_align(_context: fidl::encoding::Context) -> usize {
1854            std::mem::align_of::<u8>()
1855        }
1856
1857        #[inline(always)]
1858        fn inline_size(_context: fidl::encoding::Context) -> usize {
1859            std::mem::size_of::<u8>()
1860        }
1861
1862        #[inline(always)]
1863        fn encode_is_copy() -> bool {
1864            true
1865        }
1866
1867        #[inline(always)]
1868        fn decode_is_copy() -> bool {
1869            false
1870        }
1871    }
1872
1873    impl fidl::encoding::ValueTypeMarker for DayOfWeek {
1874        type Borrowed<'a> = Self;
1875        #[inline(always)]
1876        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1877            *value
1878        }
1879    }
1880
1881    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DayOfWeek {
1882        #[inline]
1883        unsafe fn encode(
1884            self,
1885            encoder: &mut fidl::encoding::Encoder<'_, D>,
1886            offset: usize,
1887            _depth: fidl::encoding::Depth,
1888        ) -> fidl::Result<()> {
1889            encoder.debug_check_bounds::<Self>(offset);
1890            encoder.write_num(self.into_primitive(), offset);
1891            Ok(())
1892        }
1893    }
1894
1895    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DayOfWeek {
1896        #[inline(always)]
1897        fn new_empty() -> Self {
1898            Self::Sunday
1899        }
1900
1901        #[inline]
1902        unsafe fn decode(
1903            &mut self,
1904            decoder: &mut fidl::encoding::Decoder<'_, D>,
1905            offset: usize,
1906            _depth: fidl::encoding::Depth,
1907        ) -> fidl::Result<()> {
1908            decoder.debug_check_bounds::<Self>(offset);
1909            let prim = decoder.read_num::<u8>(offset);
1910
1911            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1912            Ok(())
1913        }
1914    }
1915    unsafe impl fidl::encoding::TypeMarker for Month {
1916        type Owned = Self;
1917
1918        #[inline(always)]
1919        fn inline_align(_context: fidl::encoding::Context) -> usize {
1920            std::mem::align_of::<u8>()
1921        }
1922
1923        #[inline(always)]
1924        fn inline_size(_context: fidl::encoding::Context) -> usize {
1925            std::mem::size_of::<u8>()
1926        }
1927
1928        #[inline(always)]
1929        fn encode_is_copy() -> bool {
1930            true
1931        }
1932
1933        #[inline(always)]
1934        fn decode_is_copy() -> bool {
1935            false
1936        }
1937    }
1938
1939    impl fidl::encoding::ValueTypeMarker for Month {
1940        type Borrowed<'a> = Self;
1941        #[inline(always)]
1942        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1943            *value
1944        }
1945    }
1946
1947    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Month {
1948        #[inline]
1949        unsafe fn encode(
1950            self,
1951            encoder: &mut fidl::encoding::Encoder<'_, D>,
1952            offset: usize,
1953            _depth: fidl::encoding::Depth,
1954        ) -> fidl::Result<()> {
1955            encoder.debug_check_bounds::<Self>(offset);
1956            encoder.write_num(self.into_primitive(), offset);
1957            Ok(())
1958        }
1959    }
1960
1961    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Month {
1962        #[inline(always)]
1963        fn new_empty() -> Self {
1964            Self::January
1965        }
1966
1967        #[inline]
1968        unsafe fn decode(
1969            &mut self,
1970            decoder: &mut fidl::encoding::Decoder<'_, D>,
1971            offset: usize,
1972            _depth: fidl::encoding::Depth,
1973        ) -> fidl::Result<()> {
1974            decoder.debug_check_bounds::<Self>(offset);
1975            let prim = decoder.read_num::<u8>(offset);
1976
1977            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1978            Ok(())
1979        }
1980    }
1981    unsafe impl fidl::encoding::TypeMarker for RepeatedTimeConversion {
1982        type Owned = Self;
1983
1984        #[inline(always)]
1985        fn inline_align(_context: fidl::encoding::Context) -> usize {
1986            std::mem::align_of::<i32>()
1987        }
1988
1989        #[inline(always)]
1990        fn inline_size(_context: fidl::encoding::Context) -> usize {
1991            std::mem::size_of::<i32>()
1992        }
1993
1994        #[inline(always)]
1995        fn encode_is_copy() -> bool {
1996            false
1997        }
1998
1999        #[inline(always)]
2000        fn decode_is_copy() -> bool {
2001            false
2002        }
2003    }
2004
2005    impl fidl::encoding::ValueTypeMarker for RepeatedTimeConversion {
2006        type Borrowed<'a> = Self;
2007        #[inline(always)]
2008        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2009            *value
2010        }
2011    }
2012
2013    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2014        for RepeatedTimeConversion
2015    {
2016        #[inline]
2017        unsafe fn encode(
2018            self,
2019            encoder: &mut fidl::encoding::Encoder<'_, D>,
2020            offset: usize,
2021            _depth: fidl::encoding::Depth,
2022        ) -> fidl::Result<()> {
2023            encoder.debug_check_bounds::<Self>(offset);
2024            encoder.write_num(self.into_primitive(), offset);
2025            Ok(())
2026        }
2027    }
2028
2029    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2030        for RepeatedTimeConversion
2031    {
2032        #[inline(always)]
2033        fn new_empty() -> Self {
2034            Self::unknown()
2035        }
2036
2037        #[inline]
2038        unsafe fn decode(
2039            &mut self,
2040            decoder: &mut fidl::encoding::Decoder<'_, D>,
2041            offset: usize,
2042            _depth: fidl::encoding::Depth,
2043        ) -> fidl::Result<()> {
2044            decoder.debug_check_bounds::<Self>(offset);
2045            let prim = decoder.read_num::<i32>(offset);
2046
2047            *self = Self::from_primitive_allow_unknown(prim);
2048            Ok(())
2049        }
2050    }
2051    unsafe impl fidl::encoding::TypeMarker for SkippedTimeConversion {
2052        type Owned = Self;
2053
2054        #[inline(always)]
2055        fn inline_align(_context: fidl::encoding::Context) -> usize {
2056            std::mem::align_of::<i32>()
2057        }
2058
2059        #[inline(always)]
2060        fn inline_size(_context: fidl::encoding::Context) -> usize {
2061            std::mem::size_of::<i32>()
2062        }
2063
2064        #[inline(always)]
2065        fn encode_is_copy() -> bool {
2066            false
2067        }
2068
2069        #[inline(always)]
2070        fn decode_is_copy() -> bool {
2071            false
2072        }
2073    }
2074
2075    impl fidl::encoding::ValueTypeMarker for SkippedTimeConversion {
2076        type Borrowed<'a> = Self;
2077        #[inline(always)]
2078        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2079            *value
2080        }
2081    }
2082
2083    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2084        for SkippedTimeConversion
2085    {
2086        #[inline]
2087        unsafe fn encode(
2088            self,
2089            encoder: &mut fidl::encoding::Encoder<'_, D>,
2090            offset: usize,
2091            _depth: fidl::encoding::Depth,
2092        ) -> fidl::Result<()> {
2093            encoder.debug_check_bounds::<Self>(offset);
2094            encoder.write_num(self.into_primitive(), offset);
2095            Ok(())
2096        }
2097    }
2098
2099    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SkippedTimeConversion {
2100        #[inline(always)]
2101        fn new_empty() -> Self {
2102            Self::unknown()
2103        }
2104
2105        #[inline]
2106        unsafe fn decode(
2107            &mut self,
2108            decoder: &mut fidl::encoding::Decoder<'_, D>,
2109            offset: usize,
2110            _depth: fidl::encoding::Depth,
2111        ) -> fidl::Result<()> {
2112            decoder.debug_check_bounds::<Self>(offset);
2113            let prim = decoder.read_num::<i32>(offset);
2114
2115            *self = Self::from_primitive_allow_unknown(prim);
2116            Ok(())
2117        }
2118    }
2119    unsafe impl fidl::encoding::TypeMarker for TemperatureUnit {
2120        type Owned = Self;
2121
2122        #[inline(always)]
2123        fn inline_align(_context: fidl::encoding::Context) -> usize {
2124            std::mem::align_of::<u32>()
2125        }
2126
2127        #[inline(always)]
2128        fn inline_size(_context: fidl::encoding::Context) -> usize {
2129            std::mem::size_of::<u32>()
2130        }
2131
2132        #[inline(always)]
2133        fn encode_is_copy() -> bool {
2134            true
2135        }
2136
2137        #[inline(always)]
2138        fn decode_is_copy() -> bool {
2139            false
2140        }
2141    }
2142
2143    impl fidl::encoding::ValueTypeMarker for TemperatureUnit {
2144        type Borrowed<'a> = Self;
2145        #[inline(always)]
2146        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2147            *value
2148        }
2149    }
2150
2151    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2152        for TemperatureUnit
2153    {
2154        #[inline]
2155        unsafe fn encode(
2156            self,
2157            encoder: &mut fidl::encoding::Encoder<'_, D>,
2158            offset: usize,
2159            _depth: fidl::encoding::Depth,
2160        ) -> fidl::Result<()> {
2161            encoder.debug_check_bounds::<Self>(offset);
2162            encoder.write_num(self.into_primitive(), offset);
2163            Ok(())
2164        }
2165    }
2166
2167    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TemperatureUnit {
2168        #[inline(always)]
2169        fn new_empty() -> Self {
2170            Self::Celsius
2171        }
2172
2173        #[inline]
2174        unsafe fn decode(
2175            &mut self,
2176            decoder: &mut fidl::encoding::Decoder<'_, D>,
2177            offset: usize,
2178            _depth: fidl::encoding::Depth,
2179        ) -> fidl::Result<()> {
2180            decoder.debug_check_bounds::<Self>(offset);
2181            let prim = decoder.read_num::<u32>(offset);
2182
2183            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2184            Ok(())
2185        }
2186    }
2187    unsafe impl fidl::encoding::TypeMarker for TimeZonesError {
2188        type Owned = Self;
2189
2190        #[inline(always)]
2191        fn inline_align(_context: fidl::encoding::Context) -> usize {
2192            std::mem::align_of::<i32>()
2193        }
2194
2195        #[inline(always)]
2196        fn inline_size(_context: fidl::encoding::Context) -> usize {
2197            std::mem::size_of::<i32>()
2198        }
2199
2200        #[inline(always)]
2201        fn encode_is_copy() -> bool {
2202            false
2203        }
2204
2205        #[inline(always)]
2206        fn decode_is_copy() -> bool {
2207            false
2208        }
2209    }
2210
2211    impl fidl::encoding::ValueTypeMarker for TimeZonesError {
2212        type Borrowed<'a> = Self;
2213        #[inline(always)]
2214        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2215            *value
2216        }
2217    }
2218
2219    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TimeZonesError {
2220        #[inline]
2221        unsafe fn encode(
2222            self,
2223            encoder: &mut fidl::encoding::Encoder<'_, D>,
2224            offset: usize,
2225            _depth: fidl::encoding::Depth,
2226        ) -> fidl::Result<()> {
2227            encoder.debug_check_bounds::<Self>(offset);
2228            encoder.write_num(self.into_primitive(), offset);
2229            Ok(())
2230        }
2231    }
2232
2233    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TimeZonesError {
2234        #[inline(always)]
2235        fn new_empty() -> Self {
2236            Self::unknown()
2237        }
2238
2239        #[inline]
2240        unsafe fn decode(
2241            &mut self,
2242            decoder: &mut fidl::encoding::Decoder<'_, D>,
2243            offset: usize,
2244            _depth: fidl::encoding::Depth,
2245        ) -> fidl::Result<()> {
2246            decoder.debug_check_bounds::<Self>(offset);
2247            let prim = decoder.read_num::<i32>(offset);
2248
2249            *self = Self::from_primitive_allow_unknown(prim);
2250            Ok(())
2251        }
2252    }
2253
2254    impl fidl::encoding::ValueTypeMarker for CalendarId {
2255        type Borrowed<'a> = &'a Self;
2256        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2257            value
2258        }
2259    }
2260
2261    unsafe impl fidl::encoding::TypeMarker for CalendarId {
2262        type Owned = Self;
2263
2264        #[inline(always)]
2265        fn inline_align(_context: fidl::encoding::Context) -> usize {
2266            8
2267        }
2268
2269        #[inline(always)]
2270        fn inline_size(_context: fidl::encoding::Context) -> usize {
2271            16
2272        }
2273    }
2274
2275    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CalendarId, D>
2276        for &CalendarId
2277    {
2278        #[inline]
2279        unsafe fn encode(
2280            self,
2281            encoder: &mut fidl::encoding::Encoder<'_, D>,
2282            offset: usize,
2283            _depth: fidl::encoding::Depth,
2284        ) -> fidl::Result<()> {
2285            encoder.debug_check_bounds::<CalendarId>(offset);
2286            // Delegate to tuple encoding.
2287            fidl::encoding::Encode::<CalendarId, D>::encode(
2288                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
2289                    &self.id,
2290                ),),
2291                encoder,
2292                offset,
2293                _depth,
2294            )
2295        }
2296    }
2297    unsafe impl<
2298            D: fidl::encoding::ResourceDialect,
2299            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
2300        > fidl::encoding::Encode<CalendarId, D> for (T0,)
2301    {
2302        #[inline]
2303        unsafe fn encode(
2304            self,
2305            encoder: &mut fidl::encoding::Encoder<'_, D>,
2306            offset: usize,
2307            depth: fidl::encoding::Depth,
2308        ) -> fidl::Result<()> {
2309            encoder.debug_check_bounds::<CalendarId>(offset);
2310            // Zero out padding regions. There's no need to apply masks
2311            // because the unmasked parts will be overwritten by fields.
2312            // Write the fields.
2313            self.0.encode(encoder, offset + 0, depth)?;
2314            Ok(())
2315        }
2316    }
2317
2318    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CalendarId {
2319        #[inline(always)]
2320        fn new_empty() -> Self {
2321            Self { id: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
2322        }
2323
2324        #[inline]
2325        unsafe fn decode(
2326            &mut self,
2327            decoder: &mut fidl::encoding::Decoder<'_, D>,
2328            offset: usize,
2329            _depth: fidl::encoding::Depth,
2330        ) -> fidl::Result<()> {
2331            decoder.debug_check_bounds::<Self>(offset);
2332            // Verify that padding bytes are zero.
2333            fidl::decode!(
2334                fidl::encoding::UnboundedString,
2335                D,
2336                &mut self.id,
2337                decoder,
2338                offset + 0,
2339                _depth
2340            )?;
2341            Ok(())
2342        }
2343    }
2344
2345    impl fidl::encoding::ValueTypeMarker for LocaleId {
2346        type Borrowed<'a> = &'a Self;
2347        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2348            value
2349        }
2350    }
2351
2352    unsafe impl fidl::encoding::TypeMarker for LocaleId {
2353        type Owned = Self;
2354
2355        #[inline(always)]
2356        fn inline_align(_context: fidl::encoding::Context) -> usize {
2357            8
2358        }
2359
2360        #[inline(always)]
2361        fn inline_size(_context: fidl::encoding::Context) -> usize {
2362            16
2363        }
2364    }
2365
2366    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LocaleId, D> for &LocaleId {
2367        #[inline]
2368        unsafe fn encode(
2369            self,
2370            encoder: &mut fidl::encoding::Encoder<'_, D>,
2371            offset: usize,
2372            _depth: fidl::encoding::Depth,
2373        ) -> fidl::Result<()> {
2374            encoder.debug_check_bounds::<LocaleId>(offset);
2375            // Delegate to tuple encoding.
2376            fidl::encoding::Encode::<LocaleId, D>::encode(
2377                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
2378                    &self.id,
2379                ),),
2380                encoder,
2381                offset,
2382                _depth,
2383            )
2384        }
2385    }
2386    unsafe impl<
2387            D: fidl::encoding::ResourceDialect,
2388            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
2389        > fidl::encoding::Encode<LocaleId, D> for (T0,)
2390    {
2391        #[inline]
2392        unsafe fn encode(
2393            self,
2394            encoder: &mut fidl::encoding::Encoder<'_, D>,
2395            offset: usize,
2396            depth: fidl::encoding::Depth,
2397        ) -> fidl::Result<()> {
2398            encoder.debug_check_bounds::<LocaleId>(offset);
2399            // Zero out padding regions. There's no need to apply masks
2400            // because the unmasked parts will be overwritten by fields.
2401            // Write the fields.
2402            self.0.encode(encoder, offset + 0, depth)?;
2403            Ok(())
2404        }
2405    }
2406
2407    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LocaleId {
2408        #[inline(always)]
2409        fn new_empty() -> Self {
2410            Self { id: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
2411        }
2412
2413        #[inline]
2414        unsafe fn decode(
2415            &mut self,
2416            decoder: &mut fidl::encoding::Decoder<'_, D>,
2417            offset: usize,
2418            _depth: fidl::encoding::Depth,
2419        ) -> fidl::Result<()> {
2420            decoder.debug_check_bounds::<Self>(offset);
2421            // Verify that padding bytes are zero.
2422            fidl::decode!(
2423                fidl::encoding::UnboundedString,
2424                D,
2425                &mut self.id,
2426                decoder,
2427                offset + 0,
2428                _depth
2429            )?;
2430            Ok(())
2431        }
2432    }
2433
2434    impl fidl::encoding::ValueTypeMarker for PropertyProviderGetProfileResponse {
2435        type Borrowed<'a> = &'a Self;
2436        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2437            value
2438        }
2439    }
2440
2441    unsafe impl fidl::encoding::TypeMarker for PropertyProviderGetProfileResponse {
2442        type Owned = Self;
2443
2444        #[inline(always)]
2445        fn inline_align(_context: fidl::encoding::Context) -> usize {
2446            8
2447        }
2448
2449        #[inline(always)]
2450        fn inline_size(_context: fidl::encoding::Context) -> usize {
2451            16
2452        }
2453    }
2454
2455    unsafe impl<D: fidl::encoding::ResourceDialect>
2456        fidl::encoding::Encode<PropertyProviderGetProfileResponse, D>
2457        for &PropertyProviderGetProfileResponse
2458    {
2459        #[inline]
2460        unsafe fn encode(
2461            self,
2462            encoder: &mut fidl::encoding::Encoder<'_, D>,
2463            offset: usize,
2464            _depth: fidl::encoding::Depth,
2465        ) -> fidl::Result<()> {
2466            encoder.debug_check_bounds::<PropertyProviderGetProfileResponse>(offset);
2467            // Delegate to tuple encoding.
2468            fidl::encoding::Encode::<PropertyProviderGetProfileResponse, D>::encode(
2469                (<Profile as fidl::encoding::ValueTypeMarker>::borrow(&self.profile),),
2470                encoder,
2471                offset,
2472                _depth,
2473            )
2474        }
2475    }
2476    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Profile, D>>
2477        fidl::encoding::Encode<PropertyProviderGetProfileResponse, D> for (T0,)
2478    {
2479        #[inline]
2480        unsafe fn encode(
2481            self,
2482            encoder: &mut fidl::encoding::Encoder<'_, D>,
2483            offset: usize,
2484            depth: fidl::encoding::Depth,
2485        ) -> fidl::Result<()> {
2486            encoder.debug_check_bounds::<PropertyProviderGetProfileResponse>(offset);
2487            // Zero out padding regions. There's no need to apply masks
2488            // because the unmasked parts will be overwritten by fields.
2489            // Write the fields.
2490            self.0.encode(encoder, offset + 0, depth)?;
2491            Ok(())
2492        }
2493    }
2494
2495    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2496        for PropertyProviderGetProfileResponse
2497    {
2498        #[inline(always)]
2499        fn new_empty() -> Self {
2500            Self { profile: fidl::new_empty!(Profile, D) }
2501        }
2502
2503        #[inline]
2504        unsafe fn decode(
2505            &mut self,
2506            decoder: &mut fidl::encoding::Decoder<'_, D>,
2507            offset: usize,
2508            _depth: fidl::encoding::Depth,
2509        ) -> fidl::Result<()> {
2510            decoder.debug_check_bounds::<Self>(offset);
2511            // Verify that padding bytes are zero.
2512            fidl::decode!(Profile, D, &mut self.profile, decoder, offset + 0, _depth)?;
2513            Ok(())
2514        }
2515    }
2516
2517    impl fidl::encoding::ValueTypeMarker for TimeZoneId {
2518        type Borrowed<'a> = &'a Self;
2519        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2520            value
2521        }
2522    }
2523
2524    unsafe impl fidl::encoding::TypeMarker for TimeZoneId {
2525        type Owned = Self;
2526
2527        #[inline(always)]
2528        fn inline_align(_context: fidl::encoding::Context) -> usize {
2529            8
2530        }
2531
2532        #[inline(always)]
2533        fn inline_size(_context: fidl::encoding::Context) -> usize {
2534            16
2535        }
2536    }
2537
2538    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TimeZoneId, D>
2539        for &TimeZoneId
2540    {
2541        #[inline]
2542        unsafe fn encode(
2543            self,
2544            encoder: &mut fidl::encoding::Encoder<'_, D>,
2545            offset: usize,
2546            _depth: fidl::encoding::Depth,
2547        ) -> fidl::Result<()> {
2548            encoder.debug_check_bounds::<TimeZoneId>(offset);
2549            // Delegate to tuple encoding.
2550            fidl::encoding::Encode::<TimeZoneId, D>::encode(
2551                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
2552                    &self.id,
2553                ),),
2554                encoder,
2555                offset,
2556                _depth,
2557            )
2558        }
2559    }
2560    unsafe impl<
2561            D: fidl::encoding::ResourceDialect,
2562            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
2563        > fidl::encoding::Encode<TimeZoneId, D> for (T0,)
2564    {
2565        #[inline]
2566        unsafe fn encode(
2567            self,
2568            encoder: &mut fidl::encoding::Encoder<'_, D>,
2569            offset: usize,
2570            depth: fidl::encoding::Depth,
2571        ) -> fidl::Result<()> {
2572            encoder.debug_check_bounds::<TimeZoneId>(offset);
2573            // Zero out padding regions. There's no need to apply masks
2574            // because the unmasked parts will be overwritten by fields.
2575            // Write the fields.
2576            self.0.encode(encoder, offset + 0, depth)?;
2577            Ok(())
2578        }
2579    }
2580
2581    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TimeZoneId {
2582        #[inline(always)]
2583        fn new_empty() -> Self {
2584            Self { id: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
2585        }
2586
2587        #[inline]
2588        unsafe fn decode(
2589            &mut self,
2590            decoder: &mut fidl::encoding::Decoder<'_, D>,
2591            offset: usize,
2592            _depth: fidl::encoding::Depth,
2593        ) -> fidl::Result<()> {
2594            decoder.debug_check_bounds::<Self>(offset);
2595            // Verify that padding bytes are zero.
2596            fidl::decode!(
2597                fidl::encoding::UnboundedString,
2598                D,
2599                &mut self.id,
2600                decoder,
2601                offset + 0,
2602                _depth
2603            )?;
2604            Ok(())
2605        }
2606    }
2607
2608    impl fidl::encoding::ValueTypeMarker for TimeZonesAbsoluteToCivilTimeRequest {
2609        type Borrowed<'a> = &'a Self;
2610        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2611            value
2612        }
2613    }
2614
2615    unsafe impl fidl::encoding::TypeMarker for TimeZonesAbsoluteToCivilTimeRequest {
2616        type Owned = Self;
2617
2618        #[inline(always)]
2619        fn inline_align(_context: fidl::encoding::Context) -> usize {
2620            8
2621        }
2622
2623        #[inline(always)]
2624        fn inline_size(_context: fidl::encoding::Context) -> usize {
2625            24
2626        }
2627    }
2628
2629    unsafe impl<D: fidl::encoding::ResourceDialect>
2630        fidl::encoding::Encode<TimeZonesAbsoluteToCivilTimeRequest, D>
2631        for &TimeZonesAbsoluteToCivilTimeRequest
2632    {
2633        #[inline]
2634        unsafe fn encode(
2635            self,
2636            encoder: &mut fidl::encoding::Encoder<'_, D>,
2637            offset: usize,
2638            _depth: fidl::encoding::Depth,
2639        ) -> fidl::Result<()> {
2640            encoder.debug_check_bounds::<TimeZonesAbsoluteToCivilTimeRequest>(offset);
2641            // Delegate to tuple encoding.
2642            fidl::encoding::Encode::<TimeZonesAbsoluteToCivilTimeRequest, D>::encode(
2643                (
2644                    <TimeZoneId as fidl::encoding::ValueTypeMarker>::borrow(&self.time_zone_id),
2645                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.absolute_time),
2646                ),
2647                encoder,
2648                offset,
2649                _depth,
2650            )
2651        }
2652    }
2653    unsafe impl<
2654            D: fidl::encoding::ResourceDialect,
2655            T0: fidl::encoding::Encode<TimeZoneId, D>,
2656            T1: fidl::encoding::Encode<i64, D>,
2657        > fidl::encoding::Encode<TimeZonesAbsoluteToCivilTimeRequest, D> for (T0, T1)
2658    {
2659        #[inline]
2660        unsafe fn encode(
2661            self,
2662            encoder: &mut fidl::encoding::Encoder<'_, D>,
2663            offset: usize,
2664            depth: fidl::encoding::Depth,
2665        ) -> fidl::Result<()> {
2666            encoder.debug_check_bounds::<TimeZonesAbsoluteToCivilTimeRequest>(offset);
2667            // Zero out padding regions. There's no need to apply masks
2668            // because the unmasked parts will be overwritten by fields.
2669            // Write the fields.
2670            self.0.encode(encoder, offset + 0, depth)?;
2671            self.1.encode(encoder, offset + 16, depth)?;
2672            Ok(())
2673        }
2674    }
2675
2676    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2677        for TimeZonesAbsoluteToCivilTimeRequest
2678    {
2679        #[inline(always)]
2680        fn new_empty() -> Self {
2681            Self {
2682                time_zone_id: fidl::new_empty!(TimeZoneId, D),
2683                absolute_time: fidl::new_empty!(i64, D),
2684            }
2685        }
2686
2687        #[inline]
2688        unsafe fn decode(
2689            &mut self,
2690            decoder: &mut fidl::encoding::Decoder<'_, D>,
2691            offset: usize,
2692            _depth: fidl::encoding::Depth,
2693        ) -> fidl::Result<()> {
2694            decoder.debug_check_bounds::<Self>(offset);
2695            // Verify that padding bytes are zero.
2696            fidl::decode!(TimeZoneId, D, &mut self.time_zone_id, decoder, offset + 0, _depth)?;
2697            fidl::decode!(i64, D, &mut self.absolute_time, decoder, offset + 16, _depth)?;
2698            Ok(())
2699        }
2700    }
2701
2702    impl fidl::encoding::ValueTypeMarker for TimeZonesCivilToAbsoluteTimeRequest {
2703        type Borrowed<'a> = &'a Self;
2704        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2705            value
2706        }
2707    }
2708
2709    unsafe impl fidl::encoding::TypeMarker for TimeZonesCivilToAbsoluteTimeRequest {
2710        type Owned = Self;
2711
2712        #[inline(always)]
2713        fn inline_align(_context: fidl::encoding::Context) -> usize {
2714            8
2715        }
2716
2717        #[inline(always)]
2718        fn inline_size(_context: fidl::encoding::Context) -> usize {
2719            32
2720        }
2721    }
2722
2723    unsafe impl<D: fidl::encoding::ResourceDialect>
2724        fidl::encoding::Encode<TimeZonesCivilToAbsoluteTimeRequest, D>
2725        for &TimeZonesCivilToAbsoluteTimeRequest
2726    {
2727        #[inline]
2728        unsafe fn encode(
2729            self,
2730            encoder: &mut fidl::encoding::Encoder<'_, D>,
2731            offset: usize,
2732            _depth: fidl::encoding::Depth,
2733        ) -> fidl::Result<()> {
2734            encoder.debug_check_bounds::<TimeZonesCivilToAbsoluteTimeRequest>(offset);
2735            // Delegate to tuple encoding.
2736            fidl::encoding::Encode::<TimeZonesCivilToAbsoluteTimeRequest, D>::encode(
2737                (
2738                    <CivilTime as fidl::encoding::ValueTypeMarker>::borrow(&self.civil_time),
2739                    <CivilToAbsoluteTimeOptions as fidl::encoding::ValueTypeMarker>::borrow(
2740                        &self.options,
2741                    ),
2742                ),
2743                encoder,
2744                offset,
2745                _depth,
2746            )
2747        }
2748    }
2749    unsafe impl<
2750            D: fidl::encoding::ResourceDialect,
2751            T0: fidl::encoding::Encode<CivilTime, D>,
2752            T1: fidl::encoding::Encode<CivilToAbsoluteTimeOptions, D>,
2753        > fidl::encoding::Encode<TimeZonesCivilToAbsoluteTimeRequest, D> for (T0, T1)
2754    {
2755        #[inline]
2756        unsafe fn encode(
2757            self,
2758            encoder: &mut fidl::encoding::Encoder<'_, D>,
2759            offset: usize,
2760            depth: fidl::encoding::Depth,
2761        ) -> fidl::Result<()> {
2762            encoder.debug_check_bounds::<TimeZonesCivilToAbsoluteTimeRequest>(offset);
2763            // Zero out padding regions. There's no need to apply masks
2764            // because the unmasked parts will be overwritten by fields.
2765            // Write the fields.
2766            self.0.encode(encoder, offset + 0, depth)?;
2767            self.1.encode(encoder, offset + 16, depth)?;
2768            Ok(())
2769        }
2770    }
2771
2772    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2773        for TimeZonesCivilToAbsoluteTimeRequest
2774    {
2775        #[inline(always)]
2776        fn new_empty() -> Self {
2777            Self {
2778                civil_time: fidl::new_empty!(CivilTime, D),
2779                options: fidl::new_empty!(CivilToAbsoluteTimeOptions, D),
2780            }
2781        }
2782
2783        #[inline]
2784        unsafe fn decode(
2785            &mut self,
2786            decoder: &mut fidl::encoding::Decoder<'_, D>,
2787            offset: usize,
2788            _depth: fidl::encoding::Depth,
2789        ) -> fidl::Result<()> {
2790            decoder.debug_check_bounds::<Self>(offset);
2791            // Verify that padding bytes are zero.
2792            fidl::decode!(CivilTime, D, &mut self.civil_time, decoder, offset + 0, _depth)?;
2793            fidl::decode!(
2794                CivilToAbsoluteTimeOptions,
2795                D,
2796                &mut self.options,
2797                decoder,
2798                offset + 16,
2799                _depth
2800            )?;
2801            Ok(())
2802        }
2803    }
2804
2805    impl fidl::encoding::ValueTypeMarker for TimeZonesGetTimeZoneInfoRequest {
2806        type Borrowed<'a> = &'a Self;
2807        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2808            value
2809        }
2810    }
2811
2812    unsafe impl fidl::encoding::TypeMarker for TimeZonesGetTimeZoneInfoRequest {
2813        type Owned = Self;
2814
2815        #[inline(always)]
2816        fn inline_align(_context: fidl::encoding::Context) -> usize {
2817            8
2818        }
2819
2820        #[inline(always)]
2821        fn inline_size(_context: fidl::encoding::Context) -> usize {
2822            24
2823        }
2824    }
2825
2826    unsafe impl<D: fidl::encoding::ResourceDialect>
2827        fidl::encoding::Encode<TimeZonesGetTimeZoneInfoRequest, D>
2828        for &TimeZonesGetTimeZoneInfoRequest
2829    {
2830        #[inline]
2831        unsafe fn encode(
2832            self,
2833            encoder: &mut fidl::encoding::Encoder<'_, D>,
2834            offset: usize,
2835            _depth: fidl::encoding::Depth,
2836        ) -> fidl::Result<()> {
2837            encoder.debug_check_bounds::<TimeZonesGetTimeZoneInfoRequest>(offset);
2838            // Delegate to tuple encoding.
2839            fidl::encoding::Encode::<TimeZonesGetTimeZoneInfoRequest, D>::encode(
2840                (
2841                    <TimeZoneId as fidl::encoding::ValueTypeMarker>::borrow(&self.time_zone_id),
2842                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.at_time),
2843                ),
2844                encoder,
2845                offset,
2846                _depth,
2847            )
2848        }
2849    }
2850    unsafe impl<
2851            D: fidl::encoding::ResourceDialect,
2852            T0: fidl::encoding::Encode<TimeZoneId, D>,
2853            T1: fidl::encoding::Encode<i64, D>,
2854        > fidl::encoding::Encode<TimeZonesGetTimeZoneInfoRequest, D> for (T0, T1)
2855    {
2856        #[inline]
2857        unsafe fn encode(
2858            self,
2859            encoder: &mut fidl::encoding::Encoder<'_, D>,
2860            offset: usize,
2861            depth: fidl::encoding::Depth,
2862        ) -> fidl::Result<()> {
2863            encoder.debug_check_bounds::<TimeZonesGetTimeZoneInfoRequest>(offset);
2864            // Zero out padding regions. There's no need to apply masks
2865            // because the unmasked parts will be overwritten by fields.
2866            // Write the fields.
2867            self.0.encode(encoder, offset + 0, depth)?;
2868            self.1.encode(encoder, offset + 16, depth)?;
2869            Ok(())
2870        }
2871    }
2872
2873    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2874        for TimeZonesGetTimeZoneInfoRequest
2875    {
2876        #[inline(always)]
2877        fn new_empty() -> Self {
2878            Self {
2879                time_zone_id: fidl::new_empty!(TimeZoneId, D),
2880                at_time: fidl::new_empty!(i64, D),
2881            }
2882        }
2883
2884        #[inline]
2885        unsafe fn decode(
2886            &mut self,
2887            decoder: &mut fidl::encoding::Decoder<'_, D>,
2888            offset: usize,
2889            _depth: fidl::encoding::Depth,
2890        ) -> fidl::Result<()> {
2891            decoder.debug_check_bounds::<Self>(offset);
2892            // Verify that padding bytes are zero.
2893            fidl::decode!(TimeZoneId, D, &mut self.time_zone_id, decoder, offset + 0, _depth)?;
2894            fidl::decode!(i64, D, &mut self.at_time, decoder, offset + 16, _depth)?;
2895            Ok(())
2896        }
2897    }
2898
2899    impl fidl::encoding::ValueTypeMarker for TimeZonesAbsoluteToCivilTimeResponse {
2900        type Borrowed<'a> = &'a Self;
2901        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2902            value
2903        }
2904    }
2905
2906    unsafe impl fidl::encoding::TypeMarker for TimeZonesAbsoluteToCivilTimeResponse {
2907        type Owned = Self;
2908
2909        #[inline(always)]
2910        fn inline_align(_context: fidl::encoding::Context) -> usize {
2911            8
2912        }
2913
2914        #[inline(always)]
2915        fn inline_size(_context: fidl::encoding::Context) -> usize {
2916            16
2917        }
2918    }
2919
2920    unsafe impl<D: fidl::encoding::ResourceDialect>
2921        fidl::encoding::Encode<TimeZonesAbsoluteToCivilTimeResponse, D>
2922        for &TimeZonesAbsoluteToCivilTimeResponse
2923    {
2924        #[inline]
2925        unsafe fn encode(
2926            self,
2927            encoder: &mut fidl::encoding::Encoder<'_, D>,
2928            offset: usize,
2929            _depth: fidl::encoding::Depth,
2930        ) -> fidl::Result<()> {
2931            encoder.debug_check_bounds::<TimeZonesAbsoluteToCivilTimeResponse>(offset);
2932            // Delegate to tuple encoding.
2933            fidl::encoding::Encode::<TimeZonesAbsoluteToCivilTimeResponse, D>::encode(
2934                (<CivilTime as fidl::encoding::ValueTypeMarker>::borrow(&self.civil_time),),
2935                encoder,
2936                offset,
2937                _depth,
2938            )
2939        }
2940    }
2941    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CivilTime, D>>
2942        fidl::encoding::Encode<TimeZonesAbsoluteToCivilTimeResponse, D> for (T0,)
2943    {
2944        #[inline]
2945        unsafe fn encode(
2946            self,
2947            encoder: &mut fidl::encoding::Encoder<'_, D>,
2948            offset: usize,
2949            depth: fidl::encoding::Depth,
2950        ) -> fidl::Result<()> {
2951            encoder.debug_check_bounds::<TimeZonesAbsoluteToCivilTimeResponse>(offset);
2952            // Zero out padding regions. There's no need to apply masks
2953            // because the unmasked parts will be overwritten by fields.
2954            // Write the fields.
2955            self.0.encode(encoder, offset + 0, depth)?;
2956            Ok(())
2957        }
2958    }
2959
2960    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2961        for TimeZonesAbsoluteToCivilTimeResponse
2962    {
2963        #[inline(always)]
2964        fn new_empty() -> Self {
2965            Self { civil_time: fidl::new_empty!(CivilTime, D) }
2966        }
2967
2968        #[inline]
2969        unsafe fn decode(
2970            &mut self,
2971            decoder: &mut fidl::encoding::Decoder<'_, D>,
2972            offset: usize,
2973            _depth: fidl::encoding::Depth,
2974        ) -> fidl::Result<()> {
2975            decoder.debug_check_bounds::<Self>(offset);
2976            // Verify that padding bytes are zero.
2977            fidl::decode!(CivilTime, D, &mut self.civil_time, decoder, offset + 0, _depth)?;
2978            Ok(())
2979        }
2980    }
2981
2982    impl fidl::encoding::ValueTypeMarker for TimeZonesCivilToAbsoluteTimeResponse {
2983        type Borrowed<'a> = &'a Self;
2984        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2985            value
2986        }
2987    }
2988
2989    unsafe impl fidl::encoding::TypeMarker for TimeZonesCivilToAbsoluteTimeResponse {
2990        type Owned = Self;
2991
2992        #[inline(always)]
2993        fn inline_align(_context: fidl::encoding::Context) -> usize {
2994            8
2995        }
2996
2997        #[inline(always)]
2998        fn inline_size(_context: fidl::encoding::Context) -> usize {
2999            8
3000        }
3001        #[inline(always)]
3002        fn encode_is_copy() -> bool {
3003            true
3004        }
3005
3006        #[inline(always)]
3007        fn decode_is_copy() -> bool {
3008            true
3009        }
3010    }
3011
3012    unsafe impl<D: fidl::encoding::ResourceDialect>
3013        fidl::encoding::Encode<TimeZonesCivilToAbsoluteTimeResponse, D>
3014        for &TimeZonesCivilToAbsoluteTimeResponse
3015    {
3016        #[inline]
3017        unsafe fn encode(
3018            self,
3019            encoder: &mut fidl::encoding::Encoder<'_, D>,
3020            offset: usize,
3021            _depth: fidl::encoding::Depth,
3022        ) -> fidl::Result<()> {
3023            encoder.debug_check_bounds::<TimeZonesCivilToAbsoluteTimeResponse>(offset);
3024            unsafe {
3025                // Copy the object into the buffer.
3026                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3027                (buf_ptr as *mut TimeZonesCivilToAbsoluteTimeResponse)
3028                    .write_unaligned((self as *const TimeZonesCivilToAbsoluteTimeResponse).read());
3029                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3030                // done second because the memcpy will write garbage to these bytes.
3031            }
3032            Ok(())
3033        }
3034    }
3035    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
3036        fidl::encoding::Encode<TimeZonesCivilToAbsoluteTimeResponse, D> for (T0,)
3037    {
3038        #[inline]
3039        unsafe fn encode(
3040            self,
3041            encoder: &mut fidl::encoding::Encoder<'_, D>,
3042            offset: usize,
3043            depth: fidl::encoding::Depth,
3044        ) -> fidl::Result<()> {
3045            encoder.debug_check_bounds::<TimeZonesCivilToAbsoluteTimeResponse>(offset);
3046            // Zero out padding regions. There's no need to apply masks
3047            // because the unmasked parts will be overwritten by fields.
3048            // Write the fields.
3049            self.0.encode(encoder, offset + 0, depth)?;
3050            Ok(())
3051        }
3052    }
3053
3054    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3055        for TimeZonesCivilToAbsoluteTimeResponse
3056    {
3057        #[inline(always)]
3058        fn new_empty() -> Self {
3059            Self { absolute_time: fidl::new_empty!(i64, D) }
3060        }
3061
3062        #[inline]
3063        unsafe fn decode(
3064            &mut self,
3065            decoder: &mut fidl::encoding::Decoder<'_, D>,
3066            offset: usize,
3067            _depth: fidl::encoding::Depth,
3068        ) -> fidl::Result<()> {
3069            decoder.debug_check_bounds::<Self>(offset);
3070            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3071            // Verify that padding bytes are zero.
3072            // Copy from the buffer into the object.
3073            unsafe {
3074                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3075            }
3076            Ok(())
3077        }
3078    }
3079
3080    impl fidl::encoding::ValueTypeMarker for TimeZonesGetTimeZoneInfoResponse {
3081        type Borrowed<'a> = &'a Self;
3082        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3083            value
3084        }
3085    }
3086
3087    unsafe impl fidl::encoding::TypeMarker for TimeZonesGetTimeZoneInfoResponse {
3088        type Owned = Self;
3089
3090        #[inline(always)]
3091        fn inline_align(_context: fidl::encoding::Context) -> usize {
3092            8
3093        }
3094
3095        #[inline(always)]
3096        fn inline_size(_context: fidl::encoding::Context) -> usize {
3097            16
3098        }
3099    }
3100
3101    unsafe impl<D: fidl::encoding::ResourceDialect>
3102        fidl::encoding::Encode<TimeZonesGetTimeZoneInfoResponse, D>
3103        for &TimeZonesGetTimeZoneInfoResponse
3104    {
3105        #[inline]
3106        unsafe fn encode(
3107            self,
3108            encoder: &mut fidl::encoding::Encoder<'_, D>,
3109            offset: usize,
3110            _depth: fidl::encoding::Depth,
3111        ) -> fidl::Result<()> {
3112            encoder.debug_check_bounds::<TimeZonesGetTimeZoneInfoResponse>(offset);
3113            // Delegate to tuple encoding.
3114            fidl::encoding::Encode::<TimeZonesGetTimeZoneInfoResponse, D>::encode(
3115                (<TimeZoneInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.time_zone_info),),
3116                encoder,
3117                offset,
3118                _depth,
3119            )
3120        }
3121    }
3122    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TimeZoneInfo, D>>
3123        fidl::encoding::Encode<TimeZonesGetTimeZoneInfoResponse, D> for (T0,)
3124    {
3125        #[inline]
3126        unsafe fn encode(
3127            self,
3128            encoder: &mut fidl::encoding::Encoder<'_, D>,
3129            offset: usize,
3130            depth: fidl::encoding::Depth,
3131        ) -> fidl::Result<()> {
3132            encoder.debug_check_bounds::<TimeZonesGetTimeZoneInfoResponse>(offset);
3133            // Zero out padding regions. There's no need to apply masks
3134            // because the unmasked parts will be overwritten by fields.
3135            // Write the fields.
3136            self.0.encode(encoder, offset + 0, depth)?;
3137            Ok(())
3138        }
3139    }
3140
3141    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3142        for TimeZonesGetTimeZoneInfoResponse
3143    {
3144        #[inline(always)]
3145        fn new_empty() -> Self {
3146            Self { time_zone_info: fidl::new_empty!(TimeZoneInfo, D) }
3147        }
3148
3149        #[inline]
3150        unsafe fn decode(
3151            &mut self,
3152            decoder: &mut fidl::encoding::Decoder<'_, D>,
3153            offset: usize,
3154            _depth: fidl::encoding::Depth,
3155        ) -> fidl::Result<()> {
3156            decoder.debug_check_bounds::<Self>(offset);
3157            // Verify that padding bytes are zero.
3158            fidl::decode!(TimeZoneInfo, D, &mut self.time_zone_info, decoder, offset + 0, _depth)?;
3159            Ok(())
3160        }
3161    }
3162
3163    impl CivilTime {
3164        #[inline(always)]
3165        fn max_ordinal_present(&self) -> u64 {
3166            if let Some(_) = self.time_zone_id {
3167                return 10;
3168            }
3169            if let Some(_) = self.year_day {
3170                return 9;
3171            }
3172            if let Some(_) = self.weekday {
3173                return 8;
3174            }
3175            if let Some(_) = self.nanos {
3176                return 7;
3177            }
3178            if let Some(_) = self.second {
3179                return 6;
3180            }
3181            if let Some(_) = self.minute {
3182                return 5;
3183            }
3184            if let Some(_) = self.hour {
3185                return 4;
3186            }
3187            if let Some(_) = self.day {
3188                return 3;
3189            }
3190            if let Some(_) = self.month {
3191                return 2;
3192            }
3193            if let Some(_) = self.year {
3194                return 1;
3195            }
3196            0
3197        }
3198    }
3199
3200    impl fidl::encoding::ValueTypeMarker for CivilTime {
3201        type Borrowed<'a> = &'a Self;
3202        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3203            value
3204        }
3205    }
3206
3207    unsafe impl fidl::encoding::TypeMarker for CivilTime {
3208        type Owned = Self;
3209
3210        #[inline(always)]
3211        fn inline_align(_context: fidl::encoding::Context) -> usize {
3212            8
3213        }
3214
3215        #[inline(always)]
3216        fn inline_size(_context: fidl::encoding::Context) -> usize {
3217            16
3218        }
3219    }
3220
3221    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CivilTime, D>
3222        for &CivilTime
3223    {
3224        unsafe fn encode(
3225            self,
3226            encoder: &mut fidl::encoding::Encoder<'_, D>,
3227            offset: usize,
3228            mut depth: fidl::encoding::Depth,
3229        ) -> fidl::Result<()> {
3230            encoder.debug_check_bounds::<CivilTime>(offset);
3231            // Vector header
3232            let max_ordinal: u64 = self.max_ordinal_present();
3233            encoder.write_num(max_ordinal, offset);
3234            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3235            // Calling encoder.out_of_line_offset(0) is not allowed.
3236            if max_ordinal == 0 {
3237                return Ok(());
3238            }
3239            depth.increment()?;
3240            let envelope_size = 8;
3241            let bytes_len = max_ordinal as usize * envelope_size;
3242            #[allow(unused_variables)]
3243            let offset = encoder.out_of_line_offset(bytes_len);
3244            let mut _prev_end_offset: usize = 0;
3245            if 1 > max_ordinal {
3246                return Ok(());
3247            }
3248
3249            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3250            // are envelope_size bytes.
3251            let cur_offset: usize = (1 - 1) * envelope_size;
3252
3253            // Zero reserved fields.
3254            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3255
3256            // Safety:
3257            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3258            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3259            //   envelope_size bytes, there is always sufficient room.
3260            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3261                self.year.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3262                encoder,
3263                offset + cur_offset,
3264                depth,
3265            )?;
3266
3267            _prev_end_offset = cur_offset + envelope_size;
3268            if 2 > max_ordinal {
3269                return Ok(());
3270            }
3271
3272            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3273            // are envelope_size bytes.
3274            let cur_offset: usize = (2 - 1) * envelope_size;
3275
3276            // Zero reserved fields.
3277            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3278
3279            // Safety:
3280            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3281            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3282            //   envelope_size bytes, there is always sufficient room.
3283            fidl::encoding::encode_in_envelope_optional::<Month, D>(
3284                self.month.as_ref().map(<Month as fidl::encoding::ValueTypeMarker>::borrow),
3285                encoder,
3286                offset + cur_offset,
3287                depth,
3288            )?;
3289
3290            _prev_end_offset = cur_offset + envelope_size;
3291            if 3 > max_ordinal {
3292                return Ok(());
3293            }
3294
3295            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3296            // are envelope_size bytes.
3297            let cur_offset: usize = (3 - 1) * envelope_size;
3298
3299            // Zero reserved fields.
3300            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3301
3302            // Safety:
3303            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3304            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3305            //   envelope_size bytes, there is always sufficient room.
3306            fidl::encoding::encode_in_envelope_optional::<u8, D>(
3307                self.day.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3308                encoder,
3309                offset + cur_offset,
3310                depth,
3311            )?;
3312
3313            _prev_end_offset = cur_offset + envelope_size;
3314            if 4 > max_ordinal {
3315                return Ok(());
3316            }
3317
3318            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3319            // are envelope_size bytes.
3320            let cur_offset: usize = (4 - 1) * envelope_size;
3321
3322            // Zero reserved fields.
3323            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3324
3325            // Safety:
3326            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3327            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3328            //   envelope_size bytes, there is always sufficient room.
3329            fidl::encoding::encode_in_envelope_optional::<u8, D>(
3330                self.hour.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3331                encoder,
3332                offset + cur_offset,
3333                depth,
3334            )?;
3335
3336            _prev_end_offset = cur_offset + envelope_size;
3337            if 5 > max_ordinal {
3338                return Ok(());
3339            }
3340
3341            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3342            // are envelope_size bytes.
3343            let cur_offset: usize = (5 - 1) * envelope_size;
3344
3345            // Zero reserved fields.
3346            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3347
3348            // Safety:
3349            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3350            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3351            //   envelope_size bytes, there is always sufficient room.
3352            fidl::encoding::encode_in_envelope_optional::<u8, D>(
3353                self.minute.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3354                encoder,
3355                offset + cur_offset,
3356                depth,
3357            )?;
3358
3359            _prev_end_offset = cur_offset + envelope_size;
3360            if 6 > max_ordinal {
3361                return Ok(());
3362            }
3363
3364            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3365            // are envelope_size bytes.
3366            let cur_offset: usize = (6 - 1) * envelope_size;
3367
3368            // Zero reserved fields.
3369            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3370
3371            // Safety:
3372            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3373            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3374            //   envelope_size bytes, there is always sufficient room.
3375            fidl::encoding::encode_in_envelope_optional::<u8, D>(
3376                self.second.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3377                encoder,
3378                offset + cur_offset,
3379                depth,
3380            )?;
3381
3382            _prev_end_offset = cur_offset + envelope_size;
3383            if 7 > max_ordinal {
3384                return Ok(());
3385            }
3386
3387            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3388            // are envelope_size bytes.
3389            let cur_offset: usize = (7 - 1) * envelope_size;
3390
3391            // Zero reserved fields.
3392            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3393
3394            // Safety:
3395            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3396            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3397            //   envelope_size bytes, there is always sufficient room.
3398            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3399                self.nanos.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3400                encoder,
3401                offset + cur_offset,
3402                depth,
3403            )?;
3404
3405            _prev_end_offset = cur_offset + envelope_size;
3406            if 8 > max_ordinal {
3407                return Ok(());
3408            }
3409
3410            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3411            // are envelope_size bytes.
3412            let cur_offset: usize = (8 - 1) * envelope_size;
3413
3414            // Zero reserved fields.
3415            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3416
3417            // Safety:
3418            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3419            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3420            //   envelope_size bytes, there is always sufficient room.
3421            fidl::encoding::encode_in_envelope_optional::<DayOfWeek, D>(
3422                self.weekday.as_ref().map(<DayOfWeek as fidl::encoding::ValueTypeMarker>::borrow),
3423                encoder,
3424                offset + cur_offset,
3425                depth,
3426            )?;
3427
3428            _prev_end_offset = cur_offset + envelope_size;
3429            if 9 > max_ordinal {
3430                return Ok(());
3431            }
3432
3433            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3434            // are envelope_size bytes.
3435            let cur_offset: usize = (9 - 1) * envelope_size;
3436
3437            // Zero reserved fields.
3438            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3439
3440            // Safety:
3441            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3442            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3443            //   envelope_size bytes, there is always sufficient room.
3444            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3445                self.year_day.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3446                encoder,
3447                offset + cur_offset,
3448                depth,
3449            )?;
3450
3451            _prev_end_offset = cur_offset + envelope_size;
3452            if 10 > max_ordinal {
3453                return Ok(());
3454            }
3455
3456            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3457            // are envelope_size bytes.
3458            let cur_offset: usize = (10 - 1) * envelope_size;
3459
3460            // Zero reserved fields.
3461            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3462
3463            // Safety:
3464            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3465            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3466            //   envelope_size bytes, there is always sufficient room.
3467            fidl::encoding::encode_in_envelope_optional::<TimeZoneId, D>(
3468                self.time_zone_id
3469                    .as_ref()
3470                    .map(<TimeZoneId as fidl::encoding::ValueTypeMarker>::borrow),
3471                encoder,
3472                offset + cur_offset,
3473                depth,
3474            )?;
3475
3476            _prev_end_offset = cur_offset + envelope_size;
3477
3478            Ok(())
3479        }
3480    }
3481
3482    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CivilTime {
3483        #[inline(always)]
3484        fn new_empty() -> Self {
3485            Self::default()
3486        }
3487
3488        unsafe fn decode(
3489            &mut self,
3490            decoder: &mut fidl::encoding::Decoder<'_, D>,
3491            offset: usize,
3492            mut depth: fidl::encoding::Depth,
3493        ) -> fidl::Result<()> {
3494            decoder.debug_check_bounds::<Self>(offset);
3495            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3496                None => return Err(fidl::Error::NotNullable),
3497                Some(len) => len,
3498            };
3499            // Calling decoder.out_of_line_offset(0) is not allowed.
3500            if len == 0 {
3501                return Ok(());
3502            };
3503            depth.increment()?;
3504            let envelope_size = 8;
3505            let bytes_len = len * envelope_size;
3506            let offset = decoder.out_of_line_offset(bytes_len)?;
3507            // Decode the envelope for each type.
3508            let mut _next_ordinal_to_read = 0;
3509            let mut next_offset = offset;
3510            let end_offset = offset + bytes_len;
3511            _next_ordinal_to_read += 1;
3512            if next_offset >= end_offset {
3513                return Ok(());
3514            }
3515
3516            // Decode unknown envelopes for gaps in ordinals.
3517            while _next_ordinal_to_read < 1 {
3518                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3519                _next_ordinal_to_read += 1;
3520                next_offset += envelope_size;
3521            }
3522
3523            let next_out_of_line = decoder.next_out_of_line();
3524            let handles_before = decoder.remaining_handles();
3525            if let Some((inlined, num_bytes, num_handles)) =
3526                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3527            {
3528                let member_inline_size =
3529                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3530                if inlined != (member_inline_size <= 4) {
3531                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3532                }
3533                let inner_offset;
3534                let mut inner_depth = depth.clone();
3535                if inlined {
3536                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3537                    inner_offset = next_offset;
3538                } else {
3539                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3540                    inner_depth.increment()?;
3541                }
3542                let val_ref = self.year.get_or_insert_with(|| fidl::new_empty!(u16, D));
3543                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3544                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3545                {
3546                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3547                }
3548                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3549                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3550                }
3551            }
3552
3553            next_offset += envelope_size;
3554            _next_ordinal_to_read += 1;
3555            if next_offset >= end_offset {
3556                return Ok(());
3557            }
3558
3559            // Decode unknown envelopes for gaps in ordinals.
3560            while _next_ordinal_to_read < 2 {
3561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3562                _next_ordinal_to_read += 1;
3563                next_offset += envelope_size;
3564            }
3565
3566            let next_out_of_line = decoder.next_out_of_line();
3567            let handles_before = decoder.remaining_handles();
3568            if let Some((inlined, num_bytes, num_handles)) =
3569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3570            {
3571                let member_inline_size =
3572                    <Month as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3573                if inlined != (member_inline_size <= 4) {
3574                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3575                }
3576                let inner_offset;
3577                let mut inner_depth = depth.clone();
3578                if inlined {
3579                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3580                    inner_offset = next_offset;
3581                } else {
3582                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3583                    inner_depth.increment()?;
3584                }
3585                let val_ref = self.month.get_or_insert_with(|| fidl::new_empty!(Month, D));
3586                fidl::decode!(Month, D, val_ref, decoder, inner_offset, inner_depth)?;
3587                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3588                {
3589                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3590                }
3591                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3592                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3593                }
3594            }
3595
3596            next_offset += envelope_size;
3597            _next_ordinal_to_read += 1;
3598            if next_offset >= end_offset {
3599                return Ok(());
3600            }
3601
3602            // Decode unknown envelopes for gaps in ordinals.
3603            while _next_ordinal_to_read < 3 {
3604                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3605                _next_ordinal_to_read += 1;
3606                next_offset += envelope_size;
3607            }
3608
3609            let next_out_of_line = decoder.next_out_of_line();
3610            let handles_before = decoder.remaining_handles();
3611            if let Some((inlined, num_bytes, num_handles)) =
3612                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3613            {
3614                let member_inline_size =
3615                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3616                if inlined != (member_inline_size <= 4) {
3617                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3618                }
3619                let inner_offset;
3620                let mut inner_depth = depth.clone();
3621                if inlined {
3622                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3623                    inner_offset = next_offset;
3624                } else {
3625                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3626                    inner_depth.increment()?;
3627                }
3628                let val_ref = self.day.get_or_insert_with(|| fidl::new_empty!(u8, D));
3629                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
3630                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3631                {
3632                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3633                }
3634                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3635                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3636                }
3637            }
3638
3639            next_offset += envelope_size;
3640            _next_ordinal_to_read += 1;
3641            if next_offset >= end_offset {
3642                return Ok(());
3643            }
3644
3645            // Decode unknown envelopes for gaps in ordinals.
3646            while _next_ordinal_to_read < 4 {
3647                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3648                _next_ordinal_to_read += 1;
3649                next_offset += envelope_size;
3650            }
3651
3652            let next_out_of_line = decoder.next_out_of_line();
3653            let handles_before = decoder.remaining_handles();
3654            if let Some((inlined, num_bytes, num_handles)) =
3655                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3656            {
3657                let member_inline_size =
3658                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3659                if inlined != (member_inline_size <= 4) {
3660                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3661                }
3662                let inner_offset;
3663                let mut inner_depth = depth.clone();
3664                if inlined {
3665                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3666                    inner_offset = next_offset;
3667                } else {
3668                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3669                    inner_depth.increment()?;
3670                }
3671                let val_ref = self.hour.get_or_insert_with(|| fidl::new_empty!(u8, D));
3672                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
3673                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3674                {
3675                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3676                }
3677                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3678                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3679                }
3680            }
3681
3682            next_offset += envelope_size;
3683            _next_ordinal_to_read += 1;
3684            if next_offset >= end_offset {
3685                return Ok(());
3686            }
3687
3688            // Decode unknown envelopes for gaps in ordinals.
3689            while _next_ordinal_to_read < 5 {
3690                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3691                _next_ordinal_to_read += 1;
3692                next_offset += envelope_size;
3693            }
3694
3695            let next_out_of_line = decoder.next_out_of_line();
3696            let handles_before = decoder.remaining_handles();
3697            if let Some((inlined, num_bytes, num_handles)) =
3698                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3699            {
3700                let member_inline_size =
3701                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3702                if inlined != (member_inline_size <= 4) {
3703                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3704                }
3705                let inner_offset;
3706                let mut inner_depth = depth.clone();
3707                if inlined {
3708                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3709                    inner_offset = next_offset;
3710                } else {
3711                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3712                    inner_depth.increment()?;
3713                }
3714                let val_ref = self.minute.get_or_insert_with(|| fidl::new_empty!(u8, D));
3715                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
3716                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3717                {
3718                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3719                }
3720                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3721                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3722                }
3723            }
3724
3725            next_offset += envelope_size;
3726            _next_ordinal_to_read += 1;
3727            if next_offset >= end_offset {
3728                return Ok(());
3729            }
3730
3731            // Decode unknown envelopes for gaps in ordinals.
3732            while _next_ordinal_to_read < 6 {
3733                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3734                _next_ordinal_to_read += 1;
3735                next_offset += envelope_size;
3736            }
3737
3738            let next_out_of_line = decoder.next_out_of_line();
3739            let handles_before = decoder.remaining_handles();
3740            if let Some((inlined, num_bytes, num_handles)) =
3741                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3742            {
3743                let member_inline_size =
3744                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3745                if inlined != (member_inline_size <= 4) {
3746                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3747                }
3748                let inner_offset;
3749                let mut inner_depth = depth.clone();
3750                if inlined {
3751                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3752                    inner_offset = next_offset;
3753                } else {
3754                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3755                    inner_depth.increment()?;
3756                }
3757                let val_ref = self.second.get_or_insert_with(|| fidl::new_empty!(u8, D));
3758                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
3759                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3760                {
3761                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3762                }
3763                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3764                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3765                }
3766            }
3767
3768            next_offset += envelope_size;
3769            _next_ordinal_to_read += 1;
3770            if next_offset >= end_offset {
3771                return Ok(());
3772            }
3773
3774            // Decode unknown envelopes for gaps in ordinals.
3775            while _next_ordinal_to_read < 7 {
3776                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3777                _next_ordinal_to_read += 1;
3778                next_offset += envelope_size;
3779            }
3780
3781            let next_out_of_line = decoder.next_out_of_line();
3782            let handles_before = decoder.remaining_handles();
3783            if let Some((inlined, num_bytes, num_handles)) =
3784                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3785            {
3786                let member_inline_size =
3787                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3788                if inlined != (member_inline_size <= 4) {
3789                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3790                }
3791                let inner_offset;
3792                let mut inner_depth = depth.clone();
3793                if inlined {
3794                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3795                    inner_offset = next_offset;
3796                } else {
3797                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3798                    inner_depth.increment()?;
3799                }
3800                let val_ref = self.nanos.get_or_insert_with(|| fidl::new_empty!(u64, D));
3801                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3802                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3803                {
3804                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3805                }
3806                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3807                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3808                }
3809            }
3810
3811            next_offset += envelope_size;
3812            _next_ordinal_to_read += 1;
3813            if next_offset >= end_offset {
3814                return Ok(());
3815            }
3816
3817            // Decode unknown envelopes for gaps in ordinals.
3818            while _next_ordinal_to_read < 8 {
3819                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3820                _next_ordinal_to_read += 1;
3821                next_offset += envelope_size;
3822            }
3823
3824            let next_out_of_line = decoder.next_out_of_line();
3825            let handles_before = decoder.remaining_handles();
3826            if let Some((inlined, num_bytes, num_handles)) =
3827                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3828            {
3829                let member_inline_size =
3830                    <DayOfWeek as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3831                if inlined != (member_inline_size <= 4) {
3832                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3833                }
3834                let inner_offset;
3835                let mut inner_depth = depth.clone();
3836                if inlined {
3837                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3838                    inner_offset = next_offset;
3839                } else {
3840                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3841                    inner_depth.increment()?;
3842                }
3843                let val_ref = self.weekday.get_or_insert_with(|| fidl::new_empty!(DayOfWeek, D));
3844                fidl::decode!(DayOfWeek, D, val_ref, decoder, inner_offset, inner_depth)?;
3845                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3846                {
3847                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3848                }
3849                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3850                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3851                }
3852            }
3853
3854            next_offset += envelope_size;
3855            _next_ordinal_to_read += 1;
3856            if next_offset >= end_offset {
3857                return Ok(());
3858            }
3859
3860            // Decode unknown envelopes for gaps in ordinals.
3861            while _next_ordinal_to_read < 9 {
3862                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3863                _next_ordinal_to_read += 1;
3864                next_offset += envelope_size;
3865            }
3866
3867            let next_out_of_line = decoder.next_out_of_line();
3868            let handles_before = decoder.remaining_handles();
3869            if let Some((inlined, num_bytes, num_handles)) =
3870                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3871            {
3872                let member_inline_size =
3873                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3874                if inlined != (member_inline_size <= 4) {
3875                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3876                }
3877                let inner_offset;
3878                let mut inner_depth = depth.clone();
3879                if inlined {
3880                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3881                    inner_offset = next_offset;
3882                } else {
3883                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3884                    inner_depth.increment()?;
3885                }
3886                let val_ref = self.year_day.get_or_insert_with(|| fidl::new_empty!(u16, D));
3887                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3888                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3889                {
3890                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3891                }
3892                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3893                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3894                }
3895            }
3896
3897            next_offset += envelope_size;
3898            _next_ordinal_to_read += 1;
3899            if next_offset >= end_offset {
3900                return Ok(());
3901            }
3902
3903            // Decode unknown envelopes for gaps in ordinals.
3904            while _next_ordinal_to_read < 10 {
3905                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3906                _next_ordinal_to_read += 1;
3907                next_offset += envelope_size;
3908            }
3909
3910            let next_out_of_line = decoder.next_out_of_line();
3911            let handles_before = decoder.remaining_handles();
3912            if let Some((inlined, num_bytes, num_handles)) =
3913                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3914            {
3915                let member_inline_size =
3916                    <TimeZoneId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3917                if inlined != (member_inline_size <= 4) {
3918                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3919                }
3920                let inner_offset;
3921                let mut inner_depth = depth.clone();
3922                if inlined {
3923                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3924                    inner_offset = next_offset;
3925                } else {
3926                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3927                    inner_depth.increment()?;
3928                }
3929                let val_ref =
3930                    self.time_zone_id.get_or_insert_with(|| fidl::new_empty!(TimeZoneId, D));
3931                fidl::decode!(TimeZoneId, D, val_ref, decoder, inner_offset, inner_depth)?;
3932                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3933                {
3934                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3935                }
3936                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3937                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3938                }
3939            }
3940
3941            next_offset += envelope_size;
3942
3943            // Decode the remaining unknown envelopes.
3944            while next_offset < end_offset {
3945                _next_ordinal_to_read += 1;
3946                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3947                next_offset += envelope_size;
3948            }
3949
3950            Ok(())
3951        }
3952    }
3953
3954    impl CivilToAbsoluteTimeOptions {
3955        #[inline(always)]
3956        fn max_ordinal_present(&self) -> u64 {
3957            if let Some(_) = self.skipped_time_conversion {
3958                return 2;
3959            }
3960            if let Some(_) = self.repeated_time_conversion {
3961                return 1;
3962            }
3963            0
3964        }
3965    }
3966
3967    impl fidl::encoding::ValueTypeMarker for CivilToAbsoluteTimeOptions {
3968        type Borrowed<'a> = &'a Self;
3969        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3970            value
3971        }
3972    }
3973
3974    unsafe impl fidl::encoding::TypeMarker for CivilToAbsoluteTimeOptions {
3975        type Owned = Self;
3976
3977        #[inline(always)]
3978        fn inline_align(_context: fidl::encoding::Context) -> usize {
3979            8
3980        }
3981
3982        #[inline(always)]
3983        fn inline_size(_context: fidl::encoding::Context) -> usize {
3984            16
3985        }
3986    }
3987
3988    unsafe impl<D: fidl::encoding::ResourceDialect>
3989        fidl::encoding::Encode<CivilToAbsoluteTimeOptions, D> for &CivilToAbsoluteTimeOptions
3990    {
3991        unsafe fn encode(
3992            self,
3993            encoder: &mut fidl::encoding::Encoder<'_, D>,
3994            offset: usize,
3995            mut depth: fidl::encoding::Depth,
3996        ) -> fidl::Result<()> {
3997            encoder.debug_check_bounds::<CivilToAbsoluteTimeOptions>(offset);
3998            // Vector header
3999            let max_ordinal: u64 = self.max_ordinal_present();
4000            encoder.write_num(max_ordinal, offset);
4001            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4002            // Calling encoder.out_of_line_offset(0) is not allowed.
4003            if max_ordinal == 0 {
4004                return Ok(());
4005            }
4006            depth.increment()?;
4007            let envelope_size = 8;
4008            let bytes_len = max_ordinal as usize * envelope_size;
4009            #[allow(unused_variables)]
4010            let offset = encoder.out_of_line_offset(bytes_len);
4011            let mut _prev_end_offset: usize = 0;
4012            if 1 > max_ordinal {
4013                return Ok(());
4014            }
4015
4016            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4017            // are envelope_size bytes.
4018            let cur_offset: usize = (1 - 1) * envelope_size;
4019
4020            // Zero reserved fields.
4021            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4022
4023            // Safety:
4024            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4025            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4026            //   envelope_size bytes, there is always sufficient room.
4027            fidl::encoding::encode_in_envelope_optional::<RepeatedTimeConversion, D>(
4028                self.repeated_time_conversion
4029                    .as_ref()
4030                    .map(<RepeatedTimeConversion as fidl::encoding::ValueTypeMarker>::borrow),
4031                encoder,
4032                offset + cur_offset,
4033                depth,
4034            )?;
4035
4036            _prev_end_offset = cur_offset + envelope_size;
4037            if 2 > max_ordinal {
4038                return Ok(());
4039            }
4040
4041            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4042            // are envelope_size bytes.
4043            let cur_offset: usize = (2 - 1) * envelope_size;
4044
4045            // Zero reserved fields.
4046            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4047
4048            // Safety:
4049            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4050            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4051            //   envelope_size bytes, there is always sufficient room.
4052            fidl::encoding::encode_in_envelope_optional::<SkippedTimeConversion, D>(
4053                self.skipped_time_conversion
4054                    .as_ref()
4055                    .map(<SkippedTimeConversion as fidl::encoding::ValueTypeMarker>::borrow),
4056                encoder,
4057                offset + cur_offset,
4058                depth,
4059            )?;
4060
4061            _prev_end_offset = cur_offset + envelope_size;
4062
4063            Ok(())
4064        }
4065    }
4066
4067    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4068        for CivilToAbsoluteTimeOptions
4069    {
4070        #[inline(always)]
4071        fn new_empty() -> Self {
4072            Self::default()
4073        }
4074
4075        unsafe fn decode(
4076            &mut self,
4077            decoder: &mut fidl::encoding::Decoder<'_, D>,
4078            offset: usize,
4079            mut depth: fidl::encoding::Depth,
4080        ) -> fidl::Result<()> {
4081            decoder.debug_check_bounds::<Self>(offset);
4082            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4083                None => return Err(fidl::Error::NotNullable),
4084                Some(len) => len,
4085            };
4086            // Calling decoder.out_of_line_offset(0) is not allowed.
4087            if len == 0 {
4088                return Ok(());
4089            };
4090            depth.increment()?;
4091            let envelope_size = 8;
4092            let bytes_len = len * envelope_size;
4093            let offset = decoder.out_of_line_offset(bytes_len)?;
4094            // Decode the envelope for each type.
4095            let mut _next_ordinal_to_read = 0;
4096            let mut next_offset = offset;
4097            let end_offset = offset + bytes_len;
4098            _next_ordinal_to_read += 1;
4099            if next_offset >= end_offset {
4100                return Ok(());
4101            }
4102
4103            // Decode unknown envelopes for gaps in ordinals.
4104            while _next_ordinal_to_read < 1 {
4105                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4106                _next_ordinal_to_read += 1;
4107                next_offset += envelope_size;
4108            }
4109
4110            let next_out_of_line = decoder.next_out_of_line();
4111            let handles_before = decoder.remaining_handles();
4112            if let Some((inlined, num_bytes, num_handles)) =
4113                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4114            {
4115                let member_inline_size =
4116                    <RepeatedTimeConversion as fidl::encoding::TypeMarker>::inline_size(
4117                        decoder.context,
4118                    );
4119                if inlined != (member_inline_size <= 4) {
4120                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4121                }
4122                let inner_offset;
4123                let mut inner_depth = depth.clone();
4124                if inlined {
4125                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4126                    inner_offset = next_offset;
4127                } else {
4128                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4129                    inner_depth.increment()?;
4130                }
4131                let val_ref = self
4132                    .repeated_time_conversion
4133                    .get_or_insert_with(|| fidl::new_empty!(RepeatedTimeConversion, D));
4134                fidl::decode!(
4135                    RepeatedTimeConversion,
4136                    D,
4137                    val_ref,
4138                    decoder,
4139                    inner_offset,
4140                    inner_depth
4141                )?;
4142                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4143                {
4144                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4145                }
4146                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4147                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4148                }
4149            }
4150
4151            next_offset += envelope_size;
4152            _next_ordinal_to_read += 1;
4153            if next_offset >= end_offset {
4154                return Ok(());
4155            }
4156
4157            // Decode unknown envelopes for gaps in ordinals.
4158            while _next_ordinal_to_read < 2 {
4159                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4160                _next_ordinal_to_read += 1;
4161                next_offset += envelope_size;
4162            }
4163
4164            let next_out_of_line = decoder.next_out_of_line();
4165            let handles_before = decoder.remaining_handles();
4166            if let Some((inlined, num_bytes, num_handles)) =
4167                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4168            {
4169                let member_inline_size =
4170                    <SkippedTimeConversion as fidl::encoding::TypeMarker>::inline_size(
4171                        decoder.context,
4172                    );
4173                if inlined != (member_inline_size <= 4) {
4174                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4175                }
4176                let inner_offset;
4177                let mut inner_depth = depth.clone();
4178                if inlined {
4179                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4180                    inner_offset = next_offset;
4181                } else {
4182                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4183                    inner_depth.increment()?;
4184                }
4185                let val_ref = self
4186                    .skipped_time_conversion
4187                    .get_or_insert_with(|| fidl::new_empty!(SkippedTimeConversion, D));
4188                fidl::decode!(
4189                    SkippedTimeConversion,
4190                    D,
4191                    val_ref,
4192                    decoder,
4193                    inner_offset,
4194                    inner_depth
4195                )?;
4196                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4197                {
4198                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4199                }
4200                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4201                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4202                }
4203            }
4204
4205            next_offset += envelope_size;
4206
4207            // Decode the remaining unknown envelopes.
4208            while next_offset < end_offset {
4209                _next_ordinal_to_read += 1;
4210                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4211                next_offset += envelope_size;
4212            }
4213
4214            Ok(())
4215        }
4216    }
4217
4218    impl Profile {
4219        #[inline(always)]
4220        fn max_ordinal_present(&self) -> u64 {
4221            if let Some(_) = self.temperature_unit {
4222                return 4;
4223            }
4224            if let Some(_) = self.time_zones {
4225                return 3;
4226            }
4227            if let Some(_) = self.calendars {
4228                return 2;
4229            }
4230            if let Some(_) = self.locales {
4231                return 1;
4232            }
4233            0
4234        }
4235    }
4236
4237    impl fidl::encoding::ValueTypeMarker for Profile {
4238        type Borrowed<'a> = &'a Self;
4239        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4240            value
4241        }
4242    }
4243
4244    unsafe impl fidl::encoding::TypeMarker for Profile {
4245        type Owned = Self;
4246
4247        #[inline(always)]
4248        fn inline_align(_context: fidl::encoding::Context) -> usize {
4249            8
4250        }
4251
4252        #[inline(always)]
4253        fn inline_size(_context: fidl::encoding::Context) -> usize {
4254            16
4255        }
4256    }
4257
4258    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Profile, D> for &Profile {
4259        unsafe fn encode(
4260            self,
4261            encoder: &mut fidl::encoding::Encoder<'_, D>,
4262            offset: usize,
4263            mut depth: fidl::encoding::Depth,
4264        ) -> fidl::Result<()> {
4265            encoder.debug_check_bounds::<Profile>(offset);
4266            // Vector header
4267            let max_ordinal: u64 = self.max_ordinal_present();
4268            encoder.write_num(max_ordinal, offset);
4269            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4270            // Calling encoder.out_of_line_offset(0) is not allowed.
4271            if max_ordinal == 0 {
4272                return Ok(());
4273            }
4274            depth.increment()?;
4275            let envelope_size = 8;
4276            let bytes_len = max_ordinal as usize * envelope_size;
4277            #[allow(unused_variables)]
4278            let offset = encoder.out_of_line_offset(bytes_len);
4279            let mut _prev_end_offset: usize = 0;
4280            if 1 > max_ordinal {
4281                return Ok(());
4282            }
4283
4284            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4285            // are envelope_size bytes.
4286            let cur_offset: usize = (1 - 1) * envelope_size;
4287
4288            // Zero reserved fields.
4289            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4290
4291            // Safety:
4292            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4293            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4294            //   envelope_size bytes, there is always sufficient room.
4295            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<LocaleId>, D>(
4296            self.locales.as_ref().map(<fidl::encoding::UnboundedVector<LocaleId> as fidl::encoding::ValueTypeMarker>::borrow),
4297            encoder, offset + cur_offset, depth
4298        )?;
4299
4300            _prev_end_offset = cur_offset + envelope_size;
4301            if 2 > max_ordinal {
4302                return Ok(());
4303            }
4304
4305            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4306            // are envelope_size bytes.
4307            let cur_offset: usize = (2 - 1) * envelope_size;
4308
4309            // Zero reserved fields.
4310            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4311
4312            // Safety:
4313            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4314            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4315            //   envelope_size bytes, there is always sufficient room.
4316            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<CalendarId>, D>(
4317            self.calendars.as_ref().map(<fidl::encoding::UnboundedVector<CalendarId> as fidl::encoding::ValueTypeMarker>::borrow),
4318            encoder, offset + cur_offset, depth
4319        )?;
4320
4321            _prev_end_offset = cur_offset + envelope_size;
4322            if 3 > max_ordinal {
4323                return Ok(());
4324            }
4325
4326            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4327            // are envelope_size bytes.
4328            let cur_offset: usize = (3 - 1) * envelope_size;
4329
4330            // Zero reserved fields.
4331            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4332
4333            // Safety:
4334            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4335            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4336            //   envelope_size bytes, there is always sufficient room.
4337            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<TimeZoneId>, D>(
4338            self.time_zones.as_ref().map(<fidl::encoding::UnboundedVector<TimeZoneId> as fidl::encoding::ValueTypeMarker>::borrow),
4339            encoder, offset + cur_offset, depth
4340        )?;
4341
4342            _prev_end_offset = cur_offset + envelope_size;
4343            if 4 > max_ordinal {
4344                return Ok(());
4345            }
4346
4347            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4348            // are envelope_size bytes.
4349            let cur_offset: usize = (4 - 1) * envelope_size;
4350
4351            // Zero reserved fields.
4352            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4353
4354            // Safety:
4355            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4356            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4357            //   envelope_size bytes, there is always sufficient room.
4358            fidl::encoding::encode_in_envelope_optional::<TemperatureUnit, D>(
4359                self.temperature_unit
4360                    .as_ref()
4361                    .map(<TemperatureUnit as fidl::encoding::ValueTypeMarker>::borrow),
4362                encoder,
4363                offset + cur_offset,
4364                depth,
4365            )?;
4366
4367            _prev_end_offset = cur_offset + envelope_size;
4368
4369            Ok(())
4370        }
4371    }
4372
4373    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Profile {
4374        #[inline(always)]
4375        fn new_empty() -> Self {
4376            Self::default()
4377        }
4378
4379        unsafe fn decode(
4380            &mut self,
4381            decoder: &mut fidl::encoding::Decoder<'_, D>,
4382            offset: usize,
4383            mut depth: fidl::encoding::Depth,
4384        ) -> fidl::Result<()> {
4385            decoder.debug_check_bounds::<Self>(offset);
4386            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4387                None => return Err(fidl::Error::NotNullable),
4388                Some(len) => len,
4389            };
4390            // Calling decoder.out_of_line_offset(0) is not allowed.
4391            if len == 0 {
4392                return Ok(());
4393            };
4394            depth.increment()?;
4395            let envelope_size = 8;
4396            let bytes_len = len * envelope_size;
4397            let offset = decoder.out_of_line_offset(bytes_len)?;
4398            // Decode the envelope for each type.
4399            let mut _next_ordinal_to_read = 0;
4400            let mut next_offset = offset;
4401            let end_offset = offset + bytes_len;
4402            _next_ordinal_to_read += 1;
4403            if next_offset >= end_offset {
4404                return Ok(());
4405            }
4406
4407            // Decode unknown envelopes for gaps in ordinals.
4408            while _next_ordinal_to_read < 1 {
4409                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4410                _next_ordinal_to_read += 1;
4411                next_offset += envelope_size;
4412            }
4413
4414            let next_out_of_line = decoder.next_out_of_line();
4415            let handles_before = decoder.remaining_handles();
4416            if let Some((inlined, num_bytes, num_handles)) =
4417                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4418            {
4419                let member_inline_size = <fidl::encoding::UnboundedVector<LocaleId> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4420                if inlined != (member_inline_size <= 4) {
4421                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4422                }
4423                let inner_offset;
4424                let mut inner_depth = depth.clone();
4425                if inlined {
4426                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4427                    inner_offset = next_offset;
4428                } else {
4429                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4430                    inner_depth.increment()?;
4431                }
4432                let val_ref = self.locales.get_or_insert_with(|| {
4433                    fidl::new_empty!(fidl::encoding::UnboundedVector<LocaleId>, D)
4434                });
4435                fidl::decode!(
4436                    fidl::encoding::UnboundedVector<LocaleId>,
4437                    D,
4438                    val_ref,
4439                    decoder,
4440                    inner_offset,
4441                    inner_depth
4442                )?;
4443                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4444                {
4445                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4446                }
4447                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4448                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4449                }
4450            }
4451
4452            next_offset += envelope_size;
4453            _next_ordinal_to_read += 1;
4454            if next_offset >= end_offset {
4455                return Ok(());
4456            }
4457
4458            // Decode unknown envelopes for gaps in ordinals.
4459            while _next_ordinal_to_read < 2 {
4460                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4461                _next_ordinal_to_read += 1;
4462                next_offset += envelope_size;
4463            }
4464
4465            let next_out_of_line = decoder.next_out_of_line();
4466            let handles_before = decoder.remaining_handles();
4467            if let Some((inlined, num_bytes, num_handles)) =
4468                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4469            {
4470                let member_inline_size = <fidl::encoding::UnboundedVector<CalendarId> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4471                if inlined != (member_inline_size <= 4) {
4472                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4473                }
4474                let inner_offset;
4475                let mut inner_depth = depth.clone();
4476                if inlined {
4477                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4478                    inner_offset = next_offset;
4479                } else {
4480                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4481                    inner_depth.increment()?;
4482                }
4483                let val_ref = self.calendars.get_or_insert_with(|| {
4484                    fidl::new_empty!(fidl::encoding::UnboundedVector<CalendarId>, D)
4485                });
4486                fidl::decode!(
4487                    fidl::encoding::UnboundedVector<CalendarId>,
4488                    D,
4489                    val_ref,
4490                    decoder,
4491                    inner_offset,
4492                    inner_depth
4493                )?;
4494                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4495                {
4496                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4497                }
4498                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4499                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4500                }
4501            }
4502
4503            next_offset += envelope_size;
4504            _next_ordinal_to_read += 1;
4505            if next_offset >= end_offset {
4506                return Ok(());
4507            }
4508
4509            // Decode unknown envelopes for gaps in ordinals.
4510            while _next_ordinal_to_read < 3 {
4511                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4512                _next_ordinal_to_read += 1;
4513                next_offset += envelope_size;
4514            }
4515
4516            let next_out_of_line = decoder.next_out_of_line();
4517            let handles_before = decoder.remaining_handles();
4518            if let Some((inlined, num_bytes, num_handles)) =
4519                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4520            {
4521                let member_inline_size = <fidl::encoding::UnboundedVector<TimeZoneId> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4522                if inlined != (member_inline_size <= 4) {
4523                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4524                }
4525                let inner_offset;
4526                let mut inner_depth = depth.clone();
4527                if inlined {
4528                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4529                    inner_offset = next_offset;
4530                } else {
4531                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4532                    inner_depth.increment()?;
4533                }
4534                let val_ref = self.time_zones.get_or_insert_with(|| {
4535                    fidl::new_empty!(fidl::encoding::UnboundedVector<TimeZoneId>, D)
4536                });
4537                fidl::decode!(
4538                    fidl::encoding::UnboundedVector<TimeZoneId>,
4539                    D,
4540                    val_ref,
4541                    decoder,
4542                    inner_offset,
4543                    inner_depth
4544                )?;
4545                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4546                {
4547                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4548                }
4549                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4550                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4551                }
4552            }
4553
4554            next_offset += envelope_size;
4555            _next_ordinal_to_read += 1;
4556            if next_offset >= end_offset {
4557                return Ok(());
4558            }
4559
4560            // Decode unknown envelopes for gaps in ordinals.
4561            while _next_ordinal_to_read < 4 {
4562                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4563                _next_ordinal_to_read += 1;
4564                next_offset += envelope_size;
4565            }
4566
4567            let next_out_of_line = decoder.next_out_of_line();
4568            let handles_before = decoder.remaining_handles();
4569            if let Some((inlined, num_bytes, num_handles)) =
4570                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4571            {
4572                let member_inline_size =
4573                    <TemperatureUnit as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4574                if inlined != (member_inline_size <= 4) {
4575                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4576                }
4577                let inner_offset;
4578                let mut inner_depth = depth.clone();
4579                if inlined {
4580                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4581                    inner_offset = next_offset;
4582                } else {
4583                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4584                    inner_depth.increment()?;
4585                }
4586                let val_ref = self
4587                    .temperature_unit
4588                    .get_or_insert_with(|| fidl::new_empty!(TemperatureUnit, D));
4589                fidl::decode!(TemperatureUnit, D, val_ref, decoder, inner_offset, inner_depth)?;
4590                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4591                {
4592                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4593                }
4594                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4595                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4596                }
4597            }
4598
4599            next_offset += envelope_size;
4600
4601            // Decode the remaining unknown envelopes.
4602            while next_offset < end_offset {
4603                _next_ordinal_to_read += 1;
4604                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4605                next_offset += envelope_size;
4606            }
4607
4608            Ok(())
4609        }
4610    }
4611
4612    impl RegulatoryDomain {
4613        #[inline(always)]
4614        fn max_ordinal_present(&self) -> u64 {
4615            if let Some(_) = self.country_code {
4616                return 1;
4617            }
4618            0
4619        }
4620    }
4621
4622    impl fidl::encoding::ValueTypeMarker for RegulatoryDomain {
4623        type Borrowed<'a> = &'a Self;
4624        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4625            value
4626        }
4627    }
4628
4629    unsafe impl fidl::encoding::TypeMarker for RegulatoryDomain {
4630        type Owned = Self;
4631
4632        #[inline(always)]
4633        fn inline_align(_context: fidl::encoding::Context) -> usize {
4634            8
4635        }
4636
4637        #[inline(always)]
4638        fn inline_size(_context: fidl::encoding::Context) -> usize {
4639            16
4640        }
4641    }
4642
4643    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RegulatoryDomain, D>
4644        for &RegulatoryDomain
4645    {
4646        unsafe fn encode(
4647            self,
4648            encoder: &mut fidl::encoding::Encoder<'_, D>,
4649            offset: usize,
4650            mut depth: fidl::encoding::Depth,
4651        ) -> fidl::Result<()> {
4652            encoder.debug_check_bounds::<RegulatoryDomain>(offset);
4653            // Vector header
4654            let max_ordinal: u64 = self.max_ordinal_present();
4655            encoder.write_num(max_ordinal, offset);
4656            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4657            // Calling encoder.out_of_line_offset(0) is not allowed.
4658            if max_ordinal == 0 {
4659                return Ok(());
4660            }
4661            depth.increment()?;
4662            let envelope_size = 8;
4663            let bytes_len = max_ordinal as usize * envelope_size;
4664            #[allow(unused_variables)]
4665            let offset = encoder.out_of_line_offset(bytes_len);
4666            let mut _prev_end_offset: usize = 0;
4667            if 1 > max_ordinal {
4668                return Ok(());
4669            }
4670
4671            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4672            // are envelope_size bytes.
4673            let cur_offset: usize = (1 - 1) * envelope_size;
4674
4675            // Zero reserved fields.
4676            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4677
4678            // Safety:
4679            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4680            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4681            //   envelope_size bytes, there is always sufficient room.
4682            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
4683                self.country_code.as_ref().map(
4684                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
4685                ),
4686                encoder,
4687                offset + cur_offset,
4688                depth,
4689            )?;
4690
4691            _prev_end_offset = cur_offset + envelope_size;
4692
4693            Ok(())
4694        }
4695    }
4696
4697    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RegulatoryDomain {
4698        #[inline(always)]
4699        fn new_empty() -> Self {
4700            Self::default()
4701        }
4702
4703        unsafe fn decode(
4704            &mut self,
4705            decoder: &mut fidl::encoding::Decoder<'_, D>,
4706            offset: usize,
4707            mut depth: fidl::encoding::Depth,
4708        ) -> fidl::Result<()> {
4709            decoder.debug_check_bounds::<Self>(offset);
4710            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4711                None => return Err(fidl::Error::NotNullable),
4712                Some(len) => len,
4713            };
4714            // Calling decoder.out_of_line_offset(0) is not allowed.
4715            if len == 0 {
4716                return Ok(());
4717            };
4718            depth.increment()?;
4719            let envelope_size = 8;
4720            let bytes_len = len * envelope_size;
4721            let offset = decoder.out_of_line_offset(bytes_len)?;
4722            // Decode the envelope for each type.
4723            let mut _next_ordinal_to_read = 0;
4724            let mut next_offset = offset;
4725            let end_offset = offset + bytes_len;
4726            _next_ordinal_to_read += 1;
4727            if next_offset >= end_offset {
4728                return Ok(());
4729            }
4730
4731            // Decode unknown envelopes for gaps in ordinals.
4732            while _next_ordinal_to_read < 1 {
4733                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4734                _next_ordinal_to_read += 1;
4735                next_offset += envelope_size;
4736            }
4737
4738            let next_out_of_line = decoder.next_out_of_line();
4739            let handles_before = decoder.remaining_handles();
4740            if let Some((inlined, num_bytes, num_handles)) =
4741                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4742            {
4743                let member_inline_size =
4744                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
4745                        decoder.context,
4746                    );
4747                if inlined != (member_inline_size <= 4) {
4748                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4749                }
4750                let inner_offset;
4751                let mut inner_depth = depth.clone();
4752                if inlined {
4753                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4754                    inner_offset = next_offset;
4755                } else {
4756                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4757                    inner_depth.increment()?;
4758                }
4759                let val_ref = self
4760                    .country_code
4761                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
4762                fidl::decode!(
4763                    fidl::encoding::UnboundedString,
4764                    D,
4765                    val_ref,
4766                    decoder,
4767                    inner_offset,
4768                    inner_depth
4769                )?;
4770                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4771                {
4772                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4773                }
4774                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4775                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4776                }
4777            }
4778
4779            next_offset += envelope_size;
4780
4781            // Decode the remaining unknown envelopes.
4782            while next_offset < end_offset {
4783                _next_ordinal_to_read += 1;
4784                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4785                next_offset += envelope_size;
4786            }
4787
4788            Ok(())
4789        }
4790    }
4791
4792    impl TimeZoneInfo {
4793        #[inline(always)]
4794        fn max_ordinal_present(&self) -> u64 {
4795            if let Some(_) = self.in_dst_at_time {
4796                return 3;
4797            }
4798            if let Some(_) = self.total_offset_at_time {
4799                return 2;
4800            }
4801            if let Some(_) = self.id {
4802                return 1;
4803            }
4804            0
4805        }
4806    }
4807
4808    impl fidl::encoding::ValueTypeMarker for TimeZoneInfo {
4809        type Borrowed<'a> = &'a Self;
4810        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4811            value
4812        }
4813    }
4814
4815    unsafe impl fidl::encoding::TypeMarker for TimeZoneInfo {
4816        type Owned = Self;
4817
4818        #[inline(always)]
4819        fn inline_align(_context: fidl::encoding::Context) -> usize {
4820            8
4821        }
4822
4823        #[inline(always)]
4824        fn inline_size(_context: fidl::encoding::Context) -> usize {
4825            16
4826        }
4827    }
4828
4829    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TimeZoneInfo, D>
4830        for &TimeZoneInfo
4831    {
4832        unsafe fn encode(
4833            self,
4834            encoder: &mut fidl::encoding::Encoder<'_, D>,
4835            offset: usize,
4836            mut depth: fidl::encoding::Depth,
4837        ) -> fidl::Result<()> {
4838            encoder.debug_check_bounds::<TimeZoneInfo>(offset);
4839            // Vector header
4840            let max_ordinal: u64 = self.max_ordinal_present();
4841            encoder.write_num(max_ordinal, offset);
4842            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4843            // Calling encoder.out_of_line_offset(0) is not allowed.
4844            if max_ordinal == 0 {
4845                return Ok(());
4846            }
4847            depth.increment()?;
4848            let envelope_size = 8;
4849            let bytes_len = max_ordinal as usize * envelope_size;
4850            #[allow(unused_variables)]
4851            let offset = encoder.out_of_line_offset(bytes_len);
4852            let mut _prev_end_offset: usize = 0;
4853            if 1 > max_ordinal {
4854                return Ok(());
4855            }
4856
4857            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4858            // are envelope_size bytes.
4859            let cur_offset: usize = (1 - 1) * envelope_size;
4860
4861            // Zero reserved fields.
4862            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4863
4864            // Safety:
4865            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4866            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4867            //   envelope_size bytes, there is always sufficient room.
4868            fidl::encoding::encode_in_envelope_optional::<TimeZoneId, D>(
4869                self.id.as_ref().map(<TimeZoneId as fidl::encoding::ValueTypeMarker>::borrow),
4870                encoder,
4871                offset + cur_offset,
4872                depth,
4873            )?;
4874
4875            _prev_end_offset = cur_offset + envelope_size;
4876            if 2 > max_ordinal {
4877                return Ok(());
4878            }
4879
4880            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4881            // are envelope_size bytes.
4882            let cur_offset: usize = (2 - 1) * envelope_size;
4883
4884            // Zero reserved fields.
4885            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4886
4887            // Safety:
4888            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4889            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4890            //   envelope_size bytes, there is always sufficient room.
4891            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4892                self.total_offset_at_time
4893                    .as_ref()
4894                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4895                encoder,
4896                offset + cur_offset,
4897                depth,
4898            )?;
4899
4900            _prev_end_offset = cur_offset + envelope_size;
4901            if 3 > max_ordinal {
4902                return Ok(());
4903            }
4904
4905            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4906            // are envelope_size bytes.
4907            let cur_offset: usize = (3 - 1) * envelope_size;
4908
4909            // Zero reserved fields.
4910            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4911
4912            // Safety:
4913            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4914            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4915            //   envelope_size bytes, there is always sufficient room.
4916            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4917                self.in_dst_at_time.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4918                encoder,
4919                offset + cur_offset,
4920                depth,
4921            )?;
4922
4923            _prev_end_offset = cur_offset + envelope_size;
4924
4925            Ok(())
4926        }
4927    }
4928
4929    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TimeZoneInfo {
4930        #[inline(always)]
4931        fn new_empty() -> Self {
4932            Self::default()
4933        }
4934
4935        unsafe fn decode(
4936            &mut self,
4937            decoder: &mut fidl::encoding::Decoder<'_, D>,
4938            offset: usize,
4939            mut depth: fidl::encoding::Depth,
4940        ) -> fidl::Result<()> {
4941            decoder.debug_check_bounds::<Self>(offset);
4942            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4943                None => return Err(fidl::Error::NotNullable),
4944                Some(len) => len,
4945            };
4946            // Calling decoder.out_of_line_offset(0) is not allowed.
4947            if len == 0 {
4948                return Ok(());
4949            };
4950            depth.increment()?;
4951            let envelope_size = 8;
4952            let bytes_len = len * envelope_size;
4953            let offset = decoder.out_of_line_offset(bytes_len)?;
4954            // Decode the envelope for each type.
4955            let mut _next_ordinal_to_read = 0;
4956            let mut next_offset = offset;
4957            let end_offset = offset + bytes_len;
4958            _next_ordinal_to_read += 1;
4959            if next_offset >= end_offset {
4960                return Ok(());
4961            }
4962
4963            // Decode unknown envelopes for gaps in ordinals.
4964            while _next_ordinal_to_read < 1 {
4965                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4966                _next_ordinal_to_read += 1;
4967                next_offset += envelope_size;
4968            }
4969
4970            let next_out_of_line = decoder.next_out_of_line();
4971            let handles_before = decoder.remaining_handles();
4972            if let Some((inlined, num_bytes, num_handles)) =
4973                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4974            {
4975                let member_inline_size =
4976                    <TimeZoneId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4977                if inlined != (member_inline_size <= 4) {
4978                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4979                }
4980                let inner_offset;
4981                let mut inner_depth = depth.clone();
4982                if inlined {
4983                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4984                    inner_offset = next_offset;
4985                } else {
4986                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4987                    inner_depth.increment()?;
4988                }
4989                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(TimeZoneId, D));
4990                fidl::decode!(TimeZoneId, D, val_ref, decoder, inner_offset, inner_depth)?;
4991                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4992                {
4993                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4994                }
4995                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4996                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4997                }
4998            }
4999
5000            next_offset += envelope_size;
5001            _next_ordinal_to_read += 1;
5002            if next_offset >= end_offset {
5003                return Ok(());
5004            }
5005
5006            // Decode unknown envelopes for gaps in ordinals.
5007            while _next_ordinal_to_read < 2 {
5008                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5009                _next_ordinal_to_read += 1;
5010                next_offset += envelope_size;
5011            }
5012
5013            let next_out_of_line = decoder.next_out_of_line();
5014            let handles_before = decoder.remaining_handles();
5015            if let Some((inlined, num_bytes, num_handles)) =
5016                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5017            {
5018                let member_inline_size =
5019                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5020                if inlined != (member_inline_size <= 4) {
5021                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5022                }
5023                let inner_offset;
5024                let mut inner_depth = depth.clone();
5025                if inlined {
5026                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5027                    inner_offset = next_offset;
5028                } else {
5029                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5030                    inner_depth.increment()?;
5031                }
5032                let val_ref =
5033                    self.total_offset_at_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
5034                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5035                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5036                {
5037                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5038                }
5039                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5040                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5041                }
5042            }
5043
5044            next_offset += envelope_size;
5045            _next_ordinal_to_read += 1;
5046            if next_offset >= end_offset {
5047                return Ok(());
5048            }
5049
5050            // Decode unknown envelopes for gaps in ordinals.
5051            while _next_ordinal_to_read < 3 {
5052                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5053                _next_ordinal_to_read += 1;
5054                next_offset += envelope_size;
5055            }
5056
5057            let next_out_of_line = decoder.next_out_of_line();
5058            let handles_before = decoder.remaining_handles();
5059            if let Some((inlined, num_bytes, num_handles)) =
5060                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5061            {
5062                let member_inline_size =
5063                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5064                if inlined != (member_inline_size <= 4) {
5065                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5066                }
5067                let inner_offset;
5068                let mut inner_depth = depth.clone();
5069                if inlined {
5070                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5071                    inner_offset = next_offset;
5072                } else {
5073                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5074                    inner_depth.increment()?;
5075                }
5076                let val_ref = self.in_dst_at_time.get_or_insert_with(|| fidl::new_empty!(bool, D));
5077                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5078                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5079                {
5080                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5081                }
5082                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5083                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5084                }
5085            }
5086
5087            next_offset += envelope_size;
5088
5089            // Decode the remaining unknown envelopes.
5090            while next_offset < end_offset {
5091                _next_ordinal_to_read += 1;
5092                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5093                next_offset += envelope_size;
5094            }
5095
5096            Ok(())
5097        }
5098    }
5099}