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 _};
10pub use fidl_fuchsia_intl__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct PropertyProviderMarker;
16
17impl fidl::endpoints::ProtocolMarker for PropertyProviderMarker {
18    type Proxy = PropertyProviderProxy;
19    type RequestStream = PropertyProviderRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = PropertyProviderSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.intl.PropertyProvider";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for PropertyProviderMarker {}
26
27pub trait PropertyProviderProxyInterface: Send + Sync {
28    type GetProfileResponseFut: std::future::Future<Output = Result<Profile, fidl::Error>> + Send;
29    fn r#get_profile(&self) -> Self::GetProfileResponseFut;
30}
31#[derive(Debug)]
32#[cfg(target_os = "fuchsia")]
33pub struct PropertyProviderSynchronousProxy {
34    client: fidl::client::sync::Client,
35}
36
37#[cfg(target_os = "fuchsia")]
38impl fidl::endpoints::SynchronousProxy for PropertyProviderSynchronousProxy {
39    type Proxy = PropertyProviderProxy;
40    type Protocol = PropertyProviderMarker;
41
42    fn from_channel(inner: fidl::Channel) -> Self {
43        Self::new(inner)
44    }
45
46    fn into_channel(self) -> fidl::Channel {
47        self.client.into_channel()
48    }
49
50    fn as_channel(&self) -> &fidl::Channel {
51        self.client.as_channel()
52    }
53}
54
55#[cfg(target_os = "fuchsia")]
56impl PropertyProviderSynchronousProxy {
57    pub fn new(channel: fidl::Channel) -> Self {
58        let protocol_name = <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
59        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
60    }
61
62    pub fn into_channel(self) -> fidl::Channel {
63        self.client.into_channel()
64    }
65
66    /// Waits until an event arrives and returns it. It is safe for other
67    /// threads to make concurrent requests while waiting for an event.
68    pub fn wait_for_event(
69        &self,
70        deadline: zx::MonotonicInstant,
71    ) -> Result<PropertyProviderEvent, fidl::Error> {
72        PropertyProviderEvent::decode(self.client.wait_for_event(deadline)?)
73    }
74
75    /// Gets the user's internationalization profile.
76    pub fn r#get_profile(&self, ___deadline: zx::MonotonicInstant) -> Result<Profile, fidl::Error> {
77        let _response = self
78            .client
79            .send_query::<fidl::encoding::EmptyPayload, PropertyProviderGetProfileResponse>(
80                (),
81                0x10bf06e68d36d3eb,
82                fidl::encoding::DynamicFlags::empty(),
83                ___deadline,
84            )?;
85        Ok(_response.profile)
86    }
87}
88
89#[cfg(target_os = "fuchsia")]
90impl From<PropertyProviderSynchronousProxy> for zx::Handle {
91    fn from(value: PropertyProviderSynchronousProxy) -> Self {
92        value.into_channel().into()
93    }
94}
95
96#[cfg(target_os = "fuchsia")]
97impl From<fidl::Channel> for PropertyProviderSynchronousProxy {
98    fn from(value: fidl::Channel) -> Self {
99        Self::new(value)
100    }
101}
102
103#[cfg(target_os = "fuchsia")]
104impl fidl::endpoints::FromClient for PropertyProviderSynchronousProxy {
105    type Protocol = PropertyProviderMarker;
106
107    fn from_client(value: fidl::endpoints::ClientEnd<PropertyProviderMarker>) -> Self {
108        Self::new(value.into_channel())
109    }
110}
111
112#[derive(Debug, Clone)]
113pub struct PropertyProviderProxy {
114    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
115}
116
117impl fidl::endpoints::Proxy for PropertyProviderProxy {
118    type Protocol = PropertyProviderMarker;
119
120    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
121        Self::new(inner)
122    }
123
124    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
125        self.client.into_channel().map_err(|client| Self { client })
126    }
127
128    fn as_channel(&self) -> &::fidl::AsyncChannel {
129        self.client.as_channel()
130    }
131}
132
133impl PropertyProviderProxy {
134    /// Create a new Proxy for fuchsia.intl/PropertyProvider.
135    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
136        let protocol_name = <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
137        Self { client: fidl::client::Client::new(channel, protocol_name) }
138    }
139
140    /// Get a Stream of events from the remote end of the protocol.
141    ///
142    /// # Panics
143    ///
144    /// Panics if the event stream was already taken.
145    pub fn take_event_stream(&self) -> PropertyProviderEventStream {
146        PropertyProviderEventStream { event_receiver: self.client.take_event_receiver() }
147    }
148
149    /// Gets the user's internationalization profile.
150    pub fn r#get_profile(
151        &self,
152    ) -> fidl::client::QueryResponseFut<Profile, fidl::encoding::DefaultFuchsiaResourceDialect>
153    {
154        PropertyProviderProxyInterface::r#get_profile(self)
155    }
156}
157
158impl PropertyProviderProxyInterface for PropertyProviderProxy {
159    type GetProfileResponseFut =
160        fidl::client::QueryResponseFut<Profile, fidl::encoding::DefaultFuchsiaResourceDialect>;
161    fn r#get_profile(&self) -> Self::GetProfileResponseFut {
162        fn _decode(
163            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
164        ) -> Result<Profile, fidl::Error> {
165            let _response = fidl::client::decode_transaction_body::<
166                PropertyProviderGetProfileResponse,
167                fidl::encoding::DefaultFuchsiaResourceDialect,
168                0x10bf06e68d36d3eb,
169            >(_buf?)?;
170            Ok(_response.profile)
171        }
172        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Profile>(
173            (),
174            0x10bf06e68d36d3eb,
175            fidl::encoding::DynamicFlags::empty(),
176            _decode,
177        )
178    }
179}
180
181pub struct PropertyProviderEventStream {
182    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
183}
184
185impl std::marker::Unpin for PropertyProviderEventStream {}
186
187impl futures::stream::FusedStream for PropertyProviderEventStream {
188    fn is_terminated(&self) -> bool {
189        self.event_receiver.is_terminated()
190    }
191}
192
193impl futures::Stream for PropertyProviderEventStream {
194    type Item = Result<PropertyProviderEvent, fidl::Error>;
195
196    fn poll_next(
197        mut self: std::pin::Pin<&mut Self>,
198        cx: &mut std::task::Context<'_>,
199    ) -> std::task::Poll<Option<Self::Item>> {
200        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
201            &mut self.event_receiver,
202            cx
203        )?) {
204            Some(buf) => std::task::Poll::Ready(Some(PropertyProviderEvent::decode(buf))),
205            None => std::task::Poll::Ready(None),
206        }
207    }
208}
209
210#[derive(Debug)]
211pub enum PropertyProviderEvent {
212    OnChange {},
213}
214
215impl PropertyProviderEvent {
216    #[allow(irrefutable_let_patterns)]
217    pub fn into_on_change(self) -> Option<()> {
218        if let PropertyProviderEvent::OnChange {} = self { Some(()) } else { None }
219    }
220
221    /// Decodes a message buffer as a [`PropertyProviderEvent`].
222    fn decode(
223        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
224    ) -> Result<PropertyProviderEvent, fidl::Error> {
225        let (bytes, _handles) = buf.split_mut();
226        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
227        debug_assert_eq!(tx_header.tx_id, 0);
228        match tx_header.ordinal {
229            0x26b9ed6e23c46991 => {
230                let mut out = fidl::new_empty!(
231                    fidl::encoding::EmptyPayload,
232                    fidl::encoding::DefaultFuchsiaResourceDialect
233                );
234                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
235                Ok((PropertyProviderEvent::OnChange {}))
236            }
237            _ => Err(fidl::Error::UnknownOrdinal {
238                ordinal: tx_header.ordinal,
239                protocol_name:
240                    <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
241            }),
242        }
243    }
244}
245
246/// A Stream of incoming requests for fuchsia.intl/PropertyProvider.
247pub struct PropertyProviderRequestStream {
248    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
249    is_terminated: bool,
250}
251
252impl std::marker::Unpin for PropertyProviderRequestStream {}
253
254impl futures::stream::FusedStream for PropertyProviderRequestStream {
255    fn is_terminated(&self) -> bool {
256        self.is_terminated
257    }
258}
259
260impl fidl::endpoints::RequestStream for PropertyProviderRequestStream {
261    type Protocol = PropertyProviderMarker;
262    type ControlHandle = PropertyProviderControlHandle;
263
264    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
265        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
266    }
267
268    fn control_handle(&self) -> Self::ControlHandle {
269        PropertyProviderControlHandle { inner: self.inner.clone() }
270    }
271
272    fn into_inner(
273        self,
274    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
275    {
276        (self.inner, self.is_terminated)
277    }
278
279    fn from_inner(
280        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
281        is_terminated: bool,
282    ) -> Self {
283        Self { inner, is_terminated }
284    }
285}
286
287impl futures::Stream for PropertyProviderRequestStream {
288    type Item = Result<PropertyProviderRequest, fidl::Error>;
289
290    fn poll_next(
291        mut self: std::pin::Pin<&mut Self>,
292        cx: &mut std::task::Context<'_>,
293    ) -> std::task::Poll<Option<Self::Item>> {
294        let this = &mut *self;
295        if this.inner.check_shutdown(cx) {
296            this.is_terminated = true;
297            return std::task::Poll::Ready(None);
298        }
299        if this.is_terminated {
300            panic!("polled PropertyProviderRequestStream after completion");
301        }
302        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
303            |bytes, handles| {
304                match this.inner.channel().read_etc(cx, bytes, handles) {
305                    std::task::Poll::Ready(Ok(())) => {}
306                    std::task::Poll::Pending => return std::task::Poll::Pending,
307                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
308                        this.is_terminated = true;
309                        return std::task::Poll::Ready(None);
310                    }
311                    std::task::Poll::Ready(Err(e)) => {
312                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
313                            e.into(),
314                        ))));
315                    }
316                }
317
318                // A message has been received from the channel
319                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
320
321                std::task::Poll::Ready(Some(match header.ordinal {
322                    0x10bf06e68d36d3eb => {
323                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
324                        let mut req = fidl::new_empty!(
325                            fidl::encoding::EmptyPayload,
326                            fidl::encoding::DefaultFuchsiaResourceDialect
327                        );
328                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
329                        let control_handle =
330                            PropertyProviderControlHandle { inner: this.inner.clone() };
331                        Ok(PropertyProviderRequest::GetProfile {
332                            responder: PropertyProviderGetProfileResponder {
333                                control_handle: std::mem::ManuallyDrop::new(control_handle),
334                                tx_id: header.tx_id,
335                            },
336                        })
337                    }
338                    _ => Err(fidl::Error::UnknownOrdinal {
339                        ordinal: header.ordinal,
340                        protocol_name:
341                            <PropertyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
342                    }),
343                }))
344            },
345        )
346    }
347}
348
349/// Provides internationalization properties.
350///
351/// Components that need to change their behavior in response to the user's internationalization
352/// profile may request an instance of this service from their namespace, if available. A component
353/// may choose to pass along the service that it received from its parent to its own children, or to
354/// override it and apply additional customizations.
355///
356/// See also `fuchsia.ui.views.View`.
357#[derive(Debug)]
358pub enum PropertyProviderRequest {
359    /// Gets the user's internationalization profile.
360    GetProfile { responder: PropertyProviderGetProfileResponder },
361}
362
363impl PropertyProviderRequest {
364    #[allow(irrefutable_let_patterns)]
365    pub fn into_get_profile(self) -> Option<(PropertyProviderGetProfileResponder)> {
366        if let PropertyProviderRequest::GetProfile { responder } = self {
367            Some((responder))
368        } else {
369            None
370        }
371    }
372
373    /// Name of the method defined in FIDL
374    pub fn method_name(&self) -> &'static str {
375        match *self {
376            PropertyProviderRequest::GetProfile { .. } => "get_profile",
377        }
378    }
379}
380
381#[derive(Debug, Clone)]
382pub struct PropertyProviderControlHandle {
383    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
384}
385
386impl fidl::endpoints::ControlHandle for PropertyProviderControlHandle {
387    fn shutdown(&self) {
388        self.inner.shutdown()
389    }
390    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
391        self.inner.shutdown_with_epitaph(status)
392    }
393
394    fn is_closed(&self) -> bool {
395        self.inner.channel().is_closed()
396    }
397    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
398        self.inner.channel().on_closed()
399    }
400
401    #[cfg(target_os = "fuchsia")]
402    fn signal_peer(
403        &self,
404        clear_mask: zx::Signals,
405        set_mask: zx::Signals,
406    ) -> Result<(), zx_status::Status> {
407        use fidl::Peered;
408        self.inner.channel().signal_peer(clear_mask, set_mask)
409    }
410}
411
412impl PropertyProviderControlHandle {
413    pub fn send_on_change(&self) -> Result<(), fidl::Error> {
414        self.inner.send::<fidl::encoding::EmptyPayload>(
415            (),
416            0,
417            0x26b9ed6e23c46991,
418            fidl::encoding::DynamicFlags::empty(),
419        )
420    }
421}
422
423#[must_use = "FIDL methods require a response to be sent"]
424#[derive(Debug)]
425pub struct PropertyProviderGetProfileResponder {
426    control_handle: std::mem::ManuallyDrop<PropertyProviderControlHandle>,
427    tx_id: u32,
428}
429
430/// Set the the channel to be shutdown (see [`PropertyProviderControlHandle::shutdown`])
431/// if the responder is dropped without sending a response, so that the client
432/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
433impl std::ops::Drop for PropertyProviderGetProfileResponder {
434    fn drop(&mut self) {
435        self.control_handle.shutdown();
436        // Safety: drops once, never accessed again
437        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
438    }
439}
440
441impl fidl::endpoints::Responder for PropertyProviderGetProfileResponder {
442    type ControlHandle = PropertyProviderControlHandle;
443
444    fn control_handle(&self) -> &PropertyProviderControlHandle {
445        &self.control_handle
446    }
447
448    fn drop_without_shutdown(mut self) {
449        // Safety: drops once, never accessed again due to mem::forget
450        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
451        // Prevent Drop from running (which would shut down the channel)
452        std::mem::forget(self);
453    }
454}
455
456impl PropertyProviderGetProfileResponder {
457    /// Sends a response to the FIDL transaction.
458    ///
459    /// Sets the channel to shutdown if an error occurs.
460    pub fn send(self, mut profile: &Profile) -> Result<(), fidl::Error> {
461        let _result = self.send_raw(profile);
462        if _result.is_err() {
463            self.control_handle.shutdown();
464        }
465        self.drop_without_shutdown();
466        _result
467    }
468
469    /// Similar to "send" but does not shutdown the channel if an error occurs.
470    pub fn send_no_shutdown_on_err(self, mut profile: &Profile) -> Result<(), fidl::Error> {
471        let _result = self.send_raw(profile);
472        self.drop_without_shutdown();
473        _result
474    }
475
476    fn send_raw(&self, mut profile: &Profile) -> Result<(), fidl::Error> {
477        self.control_handle.inner.send::<PropertyProviderGetProfileResponse>(
478            (profile,),
479            self.tx_id,
480            0x10bf06e68d36d3eb,
481            fidl::encoding::DynamicFlags::empty(),
482        )
483    }
484}
485
486#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
487pub struct TimeZonesMarker;
488
489impl fidl::endpoints::ProtocolMarker for TimeZonesMarker {
490    type Proxy = TimeZonesProxy;
491    type RequestStream = TimeZonesRequestStream;
492    #[cfg(target_os = "fuchsia")]
493    type SynchronousProxy = TimeZonesSynchronousProxy;
494
495    const DEBUG_NAME: &'static str = "fuchsia.intl.TimeZones";
496}
497impl fidl::endpoints::DiscoverableProtocolMarker for TimeZonesMarker {}
498pub type TimeZonesAbsoluteToCivilTimeResult = Result<CivilTime, TimeZonesError>;
499pub type TimeZonesCivilToAbsoluteTimeResult = Result<i64, TimeZonesError>;
500pub type TimeZonesGetTimeZoneInfoResult = Result<TimeZoneInfo, TimeZonesError>;
501
502pub trait TimeZonesProxyInterface: Send + Sync {
503    type AbsoluteToCivilTimeResponseFut: std::future::Future<Output = Result<TimeZonesAbsoluteToCivilTimeResult, fidl::Error>>
504        + Send;
505    fn r#absolute_to_civil_time(
506        &self,
507        time_zone_id: &TimeZoneId,
508        absolute_time: i64,
509    ) -> Self::AbsoluteToCivilTimeResponseFut;
510    type CivilToAbsoluteTimeResponseFut: std::future::Future<Output = Result<TimeZonesCivilToAbsoluteTimeResult, fidl::Error>>
511        + Send;
512    fn r#civil_to_absolute_time(
513        &self,
514        civil_time: &CivilTime,
515        options: &CivilToAbsoluteTimeOptions,
516    ) -> Self::CivilToAbsoluteTimeResponseFut;
517    type GetTimeZoneInfoResponseFut: std::future::Future<Output = Result<TimeZonesGetTimeZoneInfoResult, fidl::Error>>
518        + Send;
519    fn r#get_time_zone_info(
520        &self,
521        time_zone_id: &TimeZoneId,
522        at_time: i64,
523    ) -> Self::GetTimeZoneInfoResponseFut;
524}
525#[derive(Debug)]
526#[cfg(target_os = "fuchsia")]
527pub struct TimeZonesSynchronousProxy {
528    client: fidl::client::sync::Client,
529}
530
531#[cfg(target_os = "fuchsia")]
532impl fidl::endpoints::SynchronousProxy for TimeZonesSynchronousProxy {
533    type Proxy = TimeZonesProxy;
534    type Protocol = TimeZonesMarker;
535
536    fn from_channel(inner: fidl::Channel) -> Self {
537        Self::new(inner)
538    }
539
540    fn into_channel(self) -> fidl::Channel {
541        self.client.into_channel()
542    }
543
544    fn as_channel(&self) -> &fidl::Channel {
545        self.client.as_channel()
546    }
547}
548
549#[cfg(target_os = "fuchsia")]
550impl TimeZonesSynchronousProxy {
551    pub fn new(channel: fidl::Channel) -> Self {
552        let protocol_name = <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
553        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
554    }
555
556    pub fn into_channel(self) -> fidl::Channel {
557        self.client.into_channel()
558    }
559
560    /// Waits until an event arrives and returns it. It is safe for other
561    /// threads to make concurrent requests while waiting for an event.
562    pub fn wait_for_event(
563        &self,
564        deadline: zx::MonotonicInstant,
565    ) -> Result<TimeZonesEvent, fidl::Error> {
566        TimeZonesEvent::decode(self.client.wait_for_event(deadline)?)
567    }
568
569    /// Converts the given absolute time to a civil date and time in the given time zone, using the
570    /// Gregorian calendar.
571    pub fn r#absolute_to_civil_time(
572        &self,
573        mut time_zone_id: &TimeZoneId,
574        mut absolute_time: i64,
575        ___deadline: zx::MonotonicInstant,
576    ) -> Result<TimeZonesAbsoluteToCivilTimeResult, fidl::Error> {
577        let _response = self.client.send_query::<
578            TimeZonesAbsoluteToCivilTimeRequest,
579            fidl::encoding::ResultType<TimeZonesAbsoluteToCivilTimeResponse, TimeZonesError>,
580        >(
581            (time_zone_id, absolute_time,),
582            0x25377a4d9196e205,
583            fidl::encoding::DynamicFlags::empty(),
584            ___deadline,
585        )?;
586        Ok(_response.map(|x| x.civil_time))
587    }
588
589    /// Converts the given civil date and time in the given time zone to nanoseconds since the Unix
590    /// epoch.
591    pub fn r#civil_to_absolute_time(
592        &self,
593        mut civil_time: &CivilTime,
594        mut options: &CivilToAbsoluteTimeOptions,
595        ___deadline: zx::MonotonicInstant,
596    ) -> Result<TimeZonesCivilToAbsoluteTimeResult, fidl::Error> {
597        let _response = self.client.send_query::<
598            TimeZonesCivilToAbsoluteTimeRequest,
599            fidl::encoding::ResultType<TimeZonesCivilToAbsoluteTimeResponse, TimeZonesError>,
600        >(
601            (civil_time, options,),
602            0xc1277c7a1413aa6,
603            fidl::encoding::DynamicFlags::empty(),
604            ___deadline,
605        )?;
606        Ok(_response.map(|x| x.absolute_time))
607    }
608
609    /// Retrieves details about a time zone at a specified one.
610    pub fn r#get_time_zone_info(
611        &self,
612        mut time_zone_id: &TimeZoneId,
613        mut at_time: i64,
614        ___deadline: zx::MonotonicInstant,
615    ) -> Result<TimeZonesGetTimeZoneInfoResult, fidl::Error> {
616        let _response =
617            self.client.send_query::<TimeZonesGetTimeZoneInfoRequest, fidl::encoding::ResultType<
618                TimeZonesGetTimeZoneInfoResponse,
619                TimeZonesError,
620            >>(
621                (time_zone_id, at_time),
622                0x2144cbac1d76fe65,
623                fidl::encoding::DynamicFlags::empty(),
624                ___deadline,
625            )?;
626        Ok(_response.map(|x| x.time_zone_info))
627    }
628}
629
630#[cfg(target_os = "fuchsia")]
631impl From<TimeZonesSynchronousProxy> for zx::Handle {
632    fn from(value: TimeZonesSynchronousProxy) -> Self {
633        value.into_channel().into()
634    }
635}
636
637#[cfg(target_os = "fuchsia")]
638impl From<fidl::Channel> for TimeZonesSynchronousProxy {
639    fn from(value: fidl::Channel) -> Self {
640        Self::new(value)
641    }
642}
643
644#[cfg(target_os = "fuchsia")]
645impl fidl::endpoints::FromClient for TimeZonesSynchronousProxy {
646    type Protocol = TimeZonesMarker;
647
648    fn from_client(value: fidl::endpoints::ClientEnd<TimeZonesMarker>) -> Self {
649        Self::new(value.into_channel())
650    }
651}
652
653#[derive(Debug, Clone)]
654pub struct TimeZonesProxy {
655    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
656}
657
658impl fidl::endpoints::Proxy for TimeZonesProxy {
659    type Protocol = TimeZonesMarker;
660
661    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
662        Self::new(inner)
663    }
664
665    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
666        self.client.into_channel().map_err(|client| Self { client })
667    }
668
669    fn as_channel(&self) -> &::fidl::AsyncChannel {
670        self.client.as_channel()
671    }
672}
673
674impl TimeZonesProxy {
675    /// Create a new Proxy for fuchsia.intl/TimeZones.
676    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
677        let protocol_name = <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
678        Self { client: fidl::client::Client::new(channel, protocol_name) }
679    }
680
681    /// Get a Stream of events from the remote end of the protocol.
682    ///
683    /// # Panics
684    ///
685    /// Panics if the event stream was already taken.
686    pub fn take_event_stream(&self) -> TimeZonesEventStream {
687        TimeZonesEventStream { event_receiver: self.client.take_event_receiver() }
688    }
689
690    /// Converts the given absolute time to a civil date and time in the given time zone, using the
691    /// Gregorian calendar.
692    pub fn r#absolute_to_civil_time(
693        &self,
694        mut time_zone_id: &TimeZoneId,
695        mut absolute_time: i64,
696    ) -> fidl::client::QueryResponseFut<
697        TimeZonesAbsoluteToCivilTimeResult,
698        fidl::encoding::DefaultFuchsiaResourceDialect,
699    > {
700        TimeZonesProxyInterface::r#absolute_to_civil_time(self, time_zone_id, absolute_time)
701    }
702
703    /// Converts the given civil date and time in the given time zone to nanoseconds since the Unix
704    /// epoch.
705    pub fn r#civil_to_absolute_time(
706        &self,
707        mut civil_time: &CivilTime,
708        mut options: &CivilToAbsoluteTimeOptions,
709    ) -> fidl::client::QueryResponseFut<
710        TimeZonesCivilToAbsoluteTimeResult,
711        fidl::encoding::DefaultFuchsiaResourceDialect,
712    > {
713        TimeZonesProxyInterface::r#civil_to_absolute_time(self, civil_time, options)
714    }
715
716    /// Retrieves details about a time zone at a specified one.
717    pub fn r#get_time_zone_info(
718        &self,
719        mut time_zone_id: &TimeZoneId,
720        mut at_time: i64,
721    ) -> fidl::client::QueryResponseFut<
722        TimeZonesGetTimeZoneInfoResult,
723        fidl::encoding::DefaultFuchsiaResourceDialect,
724    > {
725        TimeZonesProxyInterface::r#get_time_zone_info(self, time_zone_id, at_time)
726    }
727}
728
729impl TimeZonesProxyInterface for TimeZonesProxy {
730    type AbsoluteToCivilTimeResponseFut = fidl::client::QueryResponseFut<
731        TimeZonesAbsoluteToCivilTimeResult,
732        fidl::encoding::DefaultFuchsiaResourceDialect,
733    >;
734    fn r#absolute_to_civil_time(
735        &self,
736        mut time_zone_id: &TimeZoneId,
737        mut absolute_time: i64,
738    ) -> Self::AbsoluteToCivilTimeResponseFut {
739        fn _decode(
740            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
741        ) -> Result<TimeZonesAbsoluteToCivilTimeResult, fidl::Error> {
742            let _response = fidl::client::decode_transaction_body::<
743                fidl::encoding::ResultType<TimeZonesAbsoluteToCivilTimeResponse, TimeZonesError>,
744                fidl::encoding::DefaultFuchsiaResourceDialect,
745                0x25377a4d9196e205,
746            >(_buf?)?;
747            Ok(_response.map(|x| x.civil_time))
748        }
749        self.client.send_query_and_decode::<
750            TimeZonesAbsoluteToCivilTimeRequest,
751            TimeZonesAbsoluteToCivilTimeResult,
752        >(
753            (time_zone_id, absolute_time,),
754            0x25377a4d9196e205,
755            fidl::encoding::DynamicFlags::empty(),
756            _decode,
757        )
758    }
759
760    type CivilToAbsoluteTimeResponseFut = fidl::client::QueryResponseFut<
761        TimeZonesCivilToAbsoluteTimeResult,
762        fidl::encoding::DefaultFuchsiaResourceDialect,
763    >;
764    fn r#civil_to_absolute_time(
765        &self,
766        mut civil_time: &CivilTime,
767        mut options: &CivilToAbsoluteTimeOptions,
768    ) -> Self::CivilToAbsoluteTimeResponseFut {
769        fn _decode(
770            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
771        ) -> Result<TimeZonesCivilToAbsoluteTimeResult, fidl::Error> {
772            let _response = fidl::client::decode_transaction_body::<
773                fidl::encoding::ResultType<TimeZonesCivilToAbsoluteTimeResponse, TimeZonesError>,
774                fidl::encoding::DefaultFuchsiaResourceDialect,
775                0xc1277c7a1413aa6,
776            >(_buf?)?;
777            Ok(_response.map(|x| x.absolute_time))
778        }
779        self.client.send_query_and_decode::<
780            TimeZonesCivilToAbsoluteTimeRequest,
781            TimeZonesCivilToAbsoluteTimeResult,
782        >(
783            (civil_time, options,),
784            0xc1277c7a1413aa6,
785            fidl::encoding::DynamicFlags::empty(),
786            _decode,
787        )
788    }
789
790    type GetTimeZoneInfoResponseFut = fidl::client::QueryResponseFut<
791        TimeZonesGetTimeZoneInfoResult,
792        fidl::encoding::DefaultFuchsiaResourceDialect,
793    >;
794    fn r#get_time_zone_info(
795        &self,
796        mut time_zone_id: &TimeZoneId,
797        mut at_time: i64,
798    ) -> Self::GetTimeZoneInfoResponseFut {
799        fn _decode(
800            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
801        ) -> Result<TimeZonesGetTimeZoneInfoResult, fidl::Error> {
802            let _response = fidl::client::decode_transaction_body::<
803                fidl::encoding::ResultType<TimeZonesGetTimeZoneInfoResponse, TimeZonesError>,
804                fidl::encoding::DefaultFuchsiaResourceDialect,
805                0x2144cbac1d76fe65,
806            >(_buf?)?;
807            Ok(_response.map(|x| x.time_zone_info))
808        }
809        self.client.send_query_and_decode::<
810            TimeZonesGetTimeZoneInfoRequest,
811            TimeZonesGetTimeZoneInfoResult,
812        >(
813            (time_zone_id, at_time,),
814            0x2144cbac1d76fe65,
815            fidl::encoding::DynamicFlags::empty(),
816            _decode,
817        )
818    }
819}
820
821pub struct TimeZonesEventStream {
822    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
823}
824
825impl std::marker::Unpin for TimeZonesEventStream {}
826
827impl futures::stream::FusedStream for TimeZonesEventStream {
828    fn is_terminated(&self) -> bool {
829        self.event_receiver.is_terminated()
830    }
831}
832
833impl futures::Stream for TimeZonesEventStream {
834    type Item = Result<TimeZonesEvent, fidl::Error>;
835
836    fn poll_next(
837        mut self: std::pin::Pin<&mut Self>,
838        cx: &mut std::task::Context<'_>,
839    ) -> std::task::Poll<Option<Self::Item>> {
840        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
841            &mut self.event_receiver,
842            cx
843        )?) {
844            Some(buf) => std::task::Poll::Ready(Some(TimeZonesEvent::decode(buf))),
845            None => std::task::Poll::Ready(None),
846        }
847    }
848}
849
850#[derive(Debug)]
851pub enum TimeZonesEvent {}
852
853impl TimeZonesEvent {
854    /// Decodes a message buffer as a [`TimeZonesEvent`].
855    fn decode(
856        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
857    ) -> Result<TimeZonesEvent, fidl::Error> {
858        let (bytes, _handles) = buf.split_mut();
859        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
860        debug_assert_eq!(tx_header.tx_id, 0);
861        match tx_header.ordinal {
862            _ => Err(fidl::Error::UnknownOrdinal {
863                ordinal: tx_header.ordinal,
864                protocol_name: <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
865            }),
866        }
867    }
868}
869
870/// A Stream of incoming requests for fuchsia.intl/TimeZones.
871pub struct TimeZonesRequestStream {
872    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
873    is_terminated: bool,
874}
875
876impl std::marker::Unpin for TimeZonesRequestStream {}
877
878impl futures::stream::FusedStream for TimeZonesRequestStream {
879    fn is_terminated(&self) -> bool {
880        self.is_terminated
881    }
882}
883
884impl fidl::endpoints::RequestStream for TimeZonesRequestStream {
885    type Protocol = TimeZonesMarker;
886    type ControlHandle = TimeZonesControlHandle;
887
888    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
889        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
890    }
891
892    fn control_handle(&self) -> Self::ControlHandle {
893        TimeZonesControlHandle { inner: self.inner.clone() }
894    }
895
896    fn into_inner(
897        self,
898    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
899    {
900        (self.inner, self.is_terminated)
901    }
902
903    fn from_inner(
904        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
905        is_terminated: bool,
906    ) -> Self {
907        Self { inner, is_terminated }
908    }
909}
910
911impl futures::Stream for TimeZonesRequestStream {
912    type Item = Result<TimeZonesRequest, fidl::Error>;
913
914    fn poll_next(
915        mut self: std::pin::Pin<&mut Self>,
916        cx: &mut std::task::Context<'_>,
917    ) -> std::task::Poll<Option<Self::Item>> {
918        let this = &mut *self;
919        if this.inner.check_shutdown(cx) {
920            this.is_terminated = true;
921            return std::task::Poll::Ready(None);
922        }
923        if this.is_terminated {
924            panic!("polled TimeZonesRequestStream after completion");
925        }
926        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
927            |bytes, handles| {
928                match this.inner.channel().read_etc(cx, bytes, handles) {
929                    std::task::Poll::Ready(Ok(())) => {}
930                    std::task::Poll::Pending => return std::task::Poll::Pending,
931                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
932                        this.is_terminated = true;
933                        return std::task::Poll::Ready(None);
934                    }
935                    std::task::Poll::Ready(Err(e)) => {
936                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
937                            e.into(),
938                        ))));
939                    }
940                }
941
942                // A message has been received from the channel
943                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
944
945                std::task::Poll::Ready(Some(match header.ordinal {
946                    0x25377a4d9196e205 => {
947                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
948                        let mut req = fidl::new_empty!(
949                            TimeZonesAbsoluteToCivilTimeRequest,
950                            fidl::encoding::DefaultFuchsiaResourceDialect
951                        );
952                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeZonesAbsoluteToCivilTimeRequest>(&header, _body_bytes, handles, &mut req)?;
953                        let control_handle = TimeZonesControlHandle { inner: this.inner.clone() };
954                        Ok(TimeZonesRequest::AbsoluteToCivilTime {
955                            time_zone_id: req.time_zone_id,
956                            absolute_time: req.absolute_time,
957
958                            responder: TimeZonesAbsoluteToCivilTimeResponder {
959                                control_handle: std::mem::ManuallyDrop::new(control_handle),
960                                tx_id: header.tx_id,
961                            },
962                        })
963                    }
964                    0xc1277c7a1413aa6 => {
965                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
966                        let mut req = fidl::new_empty!(
967                            TimeZonesCivilToAbsoluteTimeRequest,
968                            fidl::encoding::DefaultFuchsiaResourceDialect
969                        );
970                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeZonesCivilToAbsoluteTimeRequest>(&header, _body_bytes, handles, &mut req)?;
971                        let control_handle = TimeZonesControlHandle { inner: this.inner.clone() };
972                        Ok(TimeZonesRequest::CivilToAbsoluteTime {
973                            civil_time: req.civil_time,
974                            options: req.options,
975
976                            responder: TimeZonesCivilToAbsoluteTimeResponder {
977                                control_handle: std::mem::ManuallyDrop::new(control_handle),
978                                tx_id: header.tx_id,
979                            },
980                        })
981                    }
982                    0x2144cbac1d76fe65 => {
983                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
984                        let mut req = fidl::new_empty!(
985                            TimeZonesGetTimeZoneInfoRequest,
986                            fidl::encoding::DefaultFuchsiaResourceDialect
987                        );
988                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TimeZonesGetTimeZoneInfoRequest>(&header, _body_bytes, handles, &mut req)?;
989                        let control_handle = TimeZonesControlHandle { inner: this.inner.clone() };
990                        Ok(TimeZonesRequest::GetTimeZoneInfo {
991                            time_zone_id: req.time_zone_id,
992                            at_time: req.at_time,
993
994                            responder: TimeZonesGetTimeZoneInfoResponder {
995                                control_handle: std::mem::ManuallyDrop::new(control_handle),
996                                tx_id: header.tx_id,
997                            },
998                        })
999                    }
1000                    _ => Err(fidl::Error::UnknownOrdinal {
1001                        ordinal: header.ordinal,
1002                        protocol_name:
1003                            <TimeZonesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1004                    }),
1005                }))
1006            },
1007        )
1008    }
1009}
1010
1011/// Provides information about time zones and offers date-time conversion methods.
1012///
1013/// TODO(https://fxbug.dev/42162409): Add time zone info methods, including offsets from UTC.
1014#[derive(Debug)]
1015pub enum TimeZonesRequest {
1016    /// Converts the given absolute time to a civil date and time in the given time zone, using the
1017    /// Gregorian calendar.
1018    AbsoluteToCivilTime {
1019        time_zone_id: TimeZoneId,
1020        absolute_time: i64,
1021        responder: TimeZonesAbsoluteToCivilTimeResponder,
1022    },
1023    /// Converts the given civil date and time in the given time zone to nanoseconds since the Unix
1024    /// epoch.
1025    CivilToAbsoluteTime {
1026        civil_time: CivilTime,
1027        options: CivilToAbsoluteTimeOptions,
1028        responder: TimeZonesCivilToAbsoluteTimeResponder,
1029    },
1030    /// Retrieves details about a time zone at a specified one.
1031    GetTimeZoneInfo {
1032        time_zone_id: TimeZoneId,
1033        at_time: i64,
1034        responder: TimeZonesGetTimeZoneInfoResponder,
1035    },
1036}
1037
1038impl TimeZonesRequest {
1039    #[allow(irrefutable_let_patterns)]
1040    pub fn into_absolute_to_civil_time(
1041        self,
1042    ) -> Option<(TimeZoneId, i64, TimeZonesAbsoluteToCivilTimeResponder)> {
1043        if let TimeZonesRequest::AbsoluteToCivilTime { time_zone_id, absolute_time, responder } =
1044            self
1045        {
1046            Some((time_zone_id, absolute_time, responder))
1047        } else {
1048            None
1049        }
1050    }
1051
1052    #[allow(irrefutable_let_patterns)]
1053    pub fn into_civil_to_absolute_time(
1054        self,
1055    ) -> Option<(CivilTime, CivilToAbsoluteTimeOptions, TimeZonesCivilToAbsoluteTimeResponder)>
1056    {
1057        if let TimeZonesRequest::CivilToAbsoluteTime { civil_time, options, responder } = self {
1058            Some((civil_time, options, responder))
1059        } else {
1060            None
1061        }
1062    }
1063
1064    #[allow(irrefutable_let_patterns)]
1065    pub fn into_get_time_zone_info(
1066        self,
1067    ) -> Option<(TimeZoneId, i64, TimeZonesGetTimeZoneInfoResponder)> {
1068        if let TimeZonesRequest::GetTimeZoneInfo { time_zone_id, at_time, responder } = self {
1069            Some((time_zone_id, at_time, responder))
1070        } else {
1071            None
1072        }
1073    }
1074
1075    /// Name of the method defined in FIDL
1076    pub fn method_name(&self) -> &'static str {
1077        match *self {
1078            TimeZonesRequest::AbsoluteToCivilTime { .. } => "absolute_to_civil_time",
1079            TimeZonesRequest::CivilToAbsoluteTime { .. } => "civil_to_absolute_time",
1080            TimeZonesRequest::GetTimeZoneInfo { .. } => "get_time_zone_info",
1081        }
1082    }
1083}
1084
1085#[derive(Debug, Clone)]
1086pub struct TimeZonesControlHandle {
1087    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1088}
1089
1090impl fidl::endpoints::ControlHandle for TimeZonesControlHandle {
1091    fn shutdown(&self) {
1092        self.inner.shutdown()
1093    }
1094    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1095        self.inner.shutdown_with_epitaph(status)
1096    }
1097
1098    fn is_closed(&self) -> bool {
1099        self.inner.channel().is_closed()
1100    }
1101    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1102        self.inner.channel().on_closed()
1103    }
1104
1105    #[cfg(target_os = "fuchsia")]
1106    fn signal_peer(
1107        &self,
1108        clear_mask: zx::Signals,
1109        set_mask: zx::Signals,
1110    ) -> Result<(), zx_status::Status> {
1111        use fidl::Peered;
1112        self.inner.channel().signal_peer(clear_mask, set_mask)
1113    }
1114}
1115
1116impl TimeZonesControlHandle {}
1117
1118#[must_use = "FIDL methods require a response to be sent"]
1119#[derive(Debug)]
1120pub struct TimeZonesAbsoluteToCivilTimeResponder {
1121    control_handle: std::mem::ManuallyDrop<TimeZonesControlHandle>,
1122    tx_id: u32,
1123}
1124
1125/// Set the the channel to be shutdown (see [`TimeZonesControlHandle::shutdown`])
1126/// if the responder is dropped without sending a response, so that the client
1127/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1128impl std::ops::Drop for TimeZonesAbsoluteToCivilTimeResponder {
1129    fn drop(&mut self) {
1130        self.control_handle.shutdown();
1131        // Safety: drops once, never accessed again
1132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1133    }
1134}
1135
1136impl fidl::endpoints::Responder for TimeZonesAbsoluteToCivilTimeResponder {
1137    type ControlHandle = TimeZonesControlHandle;
1138
1139    fn control_handle(&self) -> &TimeZonesControlHandle {
1140        &self.control_handle
1141    }
1142
1143    fn drop_without_shutdown(mut self) {
1144        // Safety: drops once, never accessed again due to mem::forget
1145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1146        // Prevent Drop from running (which would shut down the channel)
1147        std::mem::forget(self);
1148    }
1149}
1150
1151impl TimeZonesAbsoluteToCivilTimeResponder {
1152    /// Sends a response to the FIDL transaction.
1153    ///
1154    /// Sets the channel to shutdown if an error occurs.
1155    pub fn send(self, mut result: Result<&CivilTime, TimeZonesError>) -> Result<(), fidl::Error> {
1156        let _result = self.send_raw(result);
1157        if _result.is_err() {
1158            self.control_handle.shutdown();
1159        }
1160        self.drop_without_shutdown();
1161        _result
1162    }
1163
1164    /// Similar to "send" but does not shutdown the channel if an error occurs.
1165    pub fn send_no_shutdown_on_err(
1166        self,
1167        mut result: Result<&CivilTime, TimeZonesError>,
1168    ) -> Result<(), fidl::Error> {
1169        let _result = self.send_raw(result);
1170        self.drop_without_shutdown();
1171        _result
1172    }
1173
1174    fn send_raw(&self, mut result: Result<&CivilTime, TimeZonesError>) -> Result<(), fidl::Error> {
1175        self.control_handle.inner.send::<fidl::encoding::ResultType<
1176            TimeZonesAbsoluteToCivilTimeResponse,
1177            TimeZonesError,
1178        >>(
1179            result.map(|civil_time| (civil_time,)),
1180            self.tx_id,
1181            0x25377a4d9196e205,
1182            fidl::encoding::DynamicFlags::empty(),
1183        )
1184    }
1185}
1186
1187#[must_use = "FIDL methods require a response to be sent"]
1188#[derive(Debug)]
1189pub struct TimeZonesCivilToAbsoluteTimeResponder {
1190    control_handle: std::mem::ManuallyDrop<TimeZonesControlHandle>,
1191    tx_id: u32,
1192}
1193
1194/// Set the the channel to be shutdown (see [`TimeZonesControlHandle::shutdown`])
1195/// if the responder is dropped without sending a response, so that the client
1196/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1197impl std::ops::Drop for TimeZonesCivilToAbsoluteTimeResponder {
1198    fn drop(&mut self) {
1199        self.control_handle.shutdown();
1200        // Safety: drops once, never accessed again
1201        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1202    }
1203}
1204
1205impl fidl::endpoints::Responder for TimeZonesCivilToAbsoluteTimeResponder {
1206    type ControlHandle = TimeZonesControlHandle;
1207
1208    fn control_handle(&self) -> &TimeZonesControlHandle {
1209        &self.control_handle
1210    }
1211
1212    fn drop_without_shutdown(mut self) {
1213        // Safety: drops once, never accessed again due to mem::forget
1214        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1215        // Prevent Drop from running (which would shut down the channel)
1216        std::mem::forget(self);
1217    }
1218}
1219
1220impl TimeZonesCivilToAbsoluteTimeResponder {
1221    /// Sends a response to the FIDL transaction.
1222    ///
1223    /// Sets the channel to shutdown if an error occurs.
1224    pub fn send(self, mut result: Result<i64, TimeZonesError>) -> Result<(), fidl::Error> {
1225        let _result = self.send_raw(result);
1226        if _result.is_err() {
1227            self.control_handle.shutdown();
1228        }
1229        self.drop_without_shutdown();
1230        _result
1231    }
1232
1233    /// Similar to "send" but does not shutdown the channel if an error occurs.
1234    pub fn send_no_shutdown_on_err(
1235        self,
1236        mut result: Result<i64, TimeZonesError>,
1237    ) -> Result<(), fidl::Error> {
1238        let _result = self.send_raw(result);
1239        self.drop_without_shutdown();
1240        _result
1241    }
1242
1243    fn send_raw(&self, mut result: Result<i64, TimeZonesError>) -> Result<(), fidl::Error> {
1244        self.control_handle.inner.send::<fidl::encoding::ResultType<
1245            TimeZonesCivilToAbsoluteTimeResponse,
1246            TimeZonesError,
1247        >>(
1248            result.map(|absolute_time| (absolute_time,)),
1249            self.tx_id,
1250            0xc1277c7a1413aa6,
1251            fidl::encoding::DynamicFlags::empty(),
1252        )
1253    }
1254}
1255
1256#[must_use = "FIDL methods require a response to be sent"]
1257#[derive(Debug)]
1258pub struct TimeZonesGetTimeZoneInfoResponder {
1259    control_handle: std::mem::ManuallyDrop<TimeZonesControlHandle>,
1260    tx_id: u32,
1261}
1262
1263/// Set the the channel to be shutdown (see [`TimeZonesControlHandle::shutdown`])
1264/// if the responder is dropped without sending a response, so that the client
1265/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1266impl std::ops::Drop for TimeZonesGetTimeZoneInfoResponder {
1267    fn drop(&mut self) {
1268        self.control_handle.shutdown();
1269        // Safety: drops once, never accessed again
1270        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1271    }
1272}
1273
1274impl fidl::endpoints::Responder for TimeZonesGetTimeZoneInfoResponder {
1275    type ControlHandle = TimeZonesControlHandle;
1276
1277    fn control_handle(&self) -> &TimeZonesControlHandle {
1278        &self.control_handle
1279    }
1280
1281    fn drop_without_shutdown(mut self) {
1282        // Safety: drops once, never accessed again due to mem::forget
1283        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1284        // Prevent Drop from running (which would shut down the channel)
1285        std::mem::forget(self);
1286    }
1287}
1288
1289impl TimeZonesGetTimeZoneInfoResponder {
1290    /// Sends a response to the FIDL transaction.
1291    ///
1292    /// Sets the channel to shutdown if an error occurs.
1293    pub fn send(
1294        self,
1295        mut result: Result<&TimeZoneInfo, TimeZonesError>,
1296    ) -> Result<(), fidl::Error> {
1297        let _result = self.send_raw(result);
1298        if _result.is_err() {
1299            self.control_handle.shutdown();
1300        }
1301        self.drop_without_shutdown();
1302        _result
1303    }
1304
1305    /// Similar to "send" but does not shutdown the channel if an error occurs.
1306    pub fn send_no_shutdown_on_err(
1307        self,
1308        mut result: Result<&TimeZoneInfo, TimeZonesError>,
1309    ) -> Result<(), fidl::Error> {
1310        let _result = self.send_raw(result);
1311        self.drop_without_shutdown();
1312        _result
1313    }
1314
1315    fn send_raw(
1316        &self,
1317        mut result: Result<&TimeZoneInfo, TimeZonesError>,
1318    ) -> Result<(), fidl::Error> {
1319        self.control_handle.inner.send::<fidl::encoding::ResultType<
1320            TimeZonesGetTimeZoneInfoResponse,
1321            TimeZonesError,
1322        >>(
1323            result.map(|time_zone_info| (time_zone_info,)),
1324            self.tx_id,
1325            0x2144cbac1d76fe65,
1326            fidl::encoding::DynamicFlags::empty(),
1327        )
1328    }
1329}
1330
1331mod internal {
1332    use super::*;
1333}