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