Skip to main content

fidl_fuchsia_settings/
fidl_fuchsia_settings.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_settings__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct AccessibilityMarker;
16
17impl fidl::endpoints::ProtocolMarker for AccessibilityMarker {
18    type Proxy = AccessibilityProxy;
19    type RequestStream = AccessibilityRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = AccessibilitySynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.settings.Accessibility";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for AccessibilityMarker {}
26pub type AccessibilitySetResult = Result<(), Error>;
27
28pub trait AccessibilityProxyInterface: Send + Sync {
29    type WatchResponseFut: std::future::Future<Output = Result<AccessibilitySettings, fidl::Error>>
30        + Send;
31    fn r#watch(&self) -> Self::WatchResponseFut;
32    type SetResponseFut: std::future::Future<Output = Result<AccessibilitySetResult, fidl::Error>>
33        + Send;
34    fn r#set(&self, settings: &AccessibilitySettings) -> Self::SetResponseFut;
35}
36#[derive(Debug)]
37#[cfg(target_os = "fuchsia")]
38pub struct AccessibilitySynchronousProxy {
39    client: fidl::client::sync::Client,
40}
41
42#[cfg(target_os = "fuchsia")]
43impl fidl::endpoints::SynchronousProxy for AccessibilitySynchronousProxy {
44    type Proxy = AccessibilityProxy;
45    type Protocol = AccessibilityMarker;
46
47    fn from_channel(inner: fidl::Channel) -> Self {
48        Self::new(inner)
49    }
50
51    fn into_channel(self) -> fidl::Channel {
52        self.client.into_channel()
53    }
54
55    fn as_channel(&self) -> &fidl::Channel {
56        self.client.as_channel()
57    }
58}
59
60#[cfg(target_os = "fuchsia")]
61impl AccessibilitySynchronousProxy {
62    pub fn new(channel: fidl::Channel) -> Self {
63        Self { client: fidl::client::sync::Client::new(channel) }
64    }
65
66    pub fn into_channel(self) -> fidl::Channel {
67        self.client.into_channel()
68    }
69
70    /// Waits until an event arrives and returns it. It is safe for other
71    /// threads to make concurrent requests while waiting for an event.
72    pub fn wait_for_event(
73        &self,
74        deadline: zx::MonotonicInstant,
75    ) -> Result<AccessibilityEvent, fidl::Error> {
76        AccessibilityEvent::decode(self.client.wait_for_event::<AccessibilityMarker>(deadline)?)
77    }
78
79    /// Gets the current value of all accessibility settings. Returns
80    /// immediately on first call; subsequent calls return when any of the
81    /// values change.
82    ///
83    /// - `settings` all current values of the accessibility settings.
84    /// * see [`AccessibilitySettings`] for their meaning.
85    ///
86    /// If this call fails, it is considered a fatal error and the channel
87    /// will be closed.
88    pub fn r#watch(
89        &self,
90        ___deadline: zx::MonotonicInstant,
91    ) -> Result<AccessibilitySettings, fidl::Error> {
92        let _response = self.client.send_query::<
93            fidl::encoding::EmptyPayload,
94            AccessibilityWatchResponse,
95            AccessibilityMarker,
96        >(
97            (),
98            0x417d0b95ddbf7674,
99            fidl::encoding::DynamicFlags::empty(),
100            ___deadline,
101        )?;
102        Ok(_response.settings)
103    }
104
105    /// Sets [AccessibilitySettings] settings. Any field not explicitly set in the table performs a
106    /// no-op, and will not make any changes.
107    pub fn r#set(
108        &self,
109        mut settings: &AccessibilitySettings,
110        ___deadline: zx::MonotonicInstant,
111    ) -> Result<AccessibilitySetResult, fidl::Error> {
112        let _response = self.client.send_query::<
113            AccessibilitySetRequest,
114            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
115            AccessibilityMarker,
116        >(
117            (settings,),
118            0x298485ef354fb8cb,
119            fidl::encoding::DynamicFlags::empty(),
120            ___deadline,
121        )?;
122        Ok(_response.map(|x| x))
123    }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl From<AccessibilitySynchronousProxy> for zx::NullableHandle {
128    fn from(value: AccessibilitySynchronousProxy) -> Self {
129        value.into_channel().into()
130    }
131}
132
133#[cfg(target_os = "fuchsia")]
134impl From<fidl::Channel> for AccessibilitySynchronousProxy {
135    fn from(value: fidl::Channel) -> Self {
136        Self::new(value)
137    }
138}
139
140#[cfg(target_os = "fuchsia")]
141impl fidl::endpoints::FromClient for AccessibilitySynchronousProxy {
142    type Protocol = AccessibilityMarker;
143
144    fn from_client(value: fidl::endpoints::ClientEnd<AccessibilityMarker>) -> Self {
145        Self::new(value.into_channel())
146    }
147}
148
149#[derive(Debug, Clone)]
150pub struct AccessibilityProxy {
151    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
152}
153
154impl fidl::endpoints::Proxy for AccessibilityProxy {
155    type Protocol = AccessibilityMarker;
156
157    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
158        Self::new(inner)
159    }
160
161    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
162        self.client.into_channel().map_err(|client| Self { client })
163    }
164
165    fn as_channel(&self) -> &::fidl::AsyncChannel {
166        self.client.as_channel()
167    }
168}
169
170impl AccessibilityProxy {
171    /// Create a new Proxy for fuchsia.settings/Accessibility.
172    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
173        let protocol_name = <AccessibilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
174        Self { client: fidl::client::Client::new(channel, protocol_name) }
175    }
176
177    /// Get a Stream of events from the remote end of the protocol.
178    ///
179    /// # Panics
180    ///
181    /// Panics if the event stream was already taken.
182    pub fn take_event_stream(&self) -> AccessibilityEventStream {
183        AccessibilityEventStream { event_receiver: self.client.take_event_receiver() }
184    }
185
186    /// Gets the current value of all accessibility settings. Returns
187    /// immediately on first call; subsequent calls return when any of the
188    /// values change.
189    ///
190    /// - `settings` all current values of the accessibility settings.
191    /// * see [`AccessibilitySettings`] for their meaning.
192    ///
193    /// If this call fails, it is considered a fatal error and the channel
194    /// will be closed.
195    pub fn r#watch(
196        &self,
197    ) -> fidl::client::QueryResponseFut<
198        AccessibilitySettings,
199        fidl::encoding::DefaultFuchsiaResourceDialect,
200    > {
201        AccessibilityProxyInterface::r#watch(self)
202    }
203
204    /// Sets [AccessibilitySettings] settings. Any field not explicitly set in the table performs a
205    /// no-op, and will not make any changes.
206    pub fn r#set(
207        &self,
208        mut settings: &AccessibilitySettings,
209    ) -> fidl::client::QueryResponseFut<
210        AccessibilitySetResult,
211        fidl::encoding::DefaultFuchsiaResourceDialect,
212    > {
213        AccessibilityProxyInterface::r#set(self, settings)
214    }
215}
216
217impl AccessibilityProxyInterface for AccessibilityProxy {
218    type WatchResponseFut = fidl::client::QueryResponseFut<
219        AccessibilitySettings,
220        fidl::encoding::DefaultFuchsiaResourceDialect,
221    >;
222    fn r#watch(&self) -> Self::WatchResponseFut {
223        fn _decode(
224            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
225        ) -> Result<AccessibilitySettings, fidl::Error> {
226            let _response = fidl::client::decode_transaction_body::<
227                AccessibilityWatchResponse,
228                fidl::encoding::DefaultFuchsiaResourceDialect,
229                0x417d0b95ddbf7674,
230            >(_buf?)?;
231            Ok(_response.settings)
232        }
233        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AccessibilitySettings>(
234            (),
235            0x417d0b95ddbf7674,
236            fidl::encoding::DynamicFlags::empty(),
237            _decode,
238        )
239    }
240
241    type SetResponseFut = fidl::client::QueryResponseFut<
242        AccessibilitySetResult,
243        fidl::encoding::DefaultFuchsiaResourceDialect,
244    >;
245    fn r#set(&self, mut settings: &AccessibilitySettings) -> Self::SetResponseFut {
246        fn _decode(
247            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
248        ) -> Result<AccessibilitySetResult, fidl::Error> {
249            let _response = fidl::client::decode_transaction_body::<
250                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
251                fidl::encoding::DefaultFuchsiaResourceDialect,
252                0x298485ef354fb8cb,
253            >(_buf?)?;
254            Ok(_response.map(|x| x))
255        }
256        self.client.send_query_and_decode::<AccessibilitySetRequest, AccessibilitySetResult>(
257            (settings,),
258            0x298485ef354fb8cb,
259            fidl::encoding::DynamicFlags::empty(),
260            _decode,
261        )
262    }
263}
264
265pub struct AccessibilityEventStream {
266    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
267}
268
269impl std::marker::Unpin for AccessibilityEventStream {}
270
271impl futures::stream::FusedStream for AccessibilityEventStream {
272    fn is_terminated(&self) -> bool {
273        self.event_receiver.is_terminated()
274    }
275}
276
277impl futures::Stream for AccessibilityEventStream {
278    type Item = Result<AccessibilityEvent, fidl::Error>;
279
280    fn poll_next(
281        mut self: std::pin::Pin<&mut Self>,
282        cx: &mut std::task::Context<'_>,
283    ) -> std::task::Poll<Option<Self::Item>> {
284        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
285            &mut self.event_receiver,
286            cx
287        )?) {
288            Some(buf) => std::task::Poll::Ready(Some(AccessibilityEvent::decode(buf))),
289            None => std::task::Poll::Ready(None),
290        }
291    }
292}
293
294#[derive(Debug)]
295pub enum AccessibilityEvent {}
296
297impl AccessibilityEvent {
298    /// Decodes a message buffer as a [`AccessibilityEvent`].
299    fn decode(
300        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
301    ) -> Result<AccessibilityEvent, fidl::Error> {
302        let (bytes, _handles) = buf.split_mut();
303        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
304        debug_assert_eq!(tx_header.tx_id, 0);
305        match tx_header.ordinal {
306            _ => Err(fidl::Error::UnknownOrdinal {
307                ordinal: tx_header.ordinal,
308                protocol_name: <AccessibilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
309            }),
310        }
311    }
312}
313
314/// A Stream of incoming requests for fuchsia.settings/Accessibility.
315pub struct AccessibilityRequestStream {
316    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
317    is_terminated: bool,
318}
319
320impl std::marker::Unpin for AccessibilityRequestStream {}
321
322impl futures::stream::FusedStream for AccessibilityRequestStream {
323    fn is_terminated(&self) -> bool {
324        self.is_terminated
325    }
326}
327
328impl fidl::endpoints::RequestStream for AccessibilityRequestStream {
329    type Protocol = AccessibilityMarker;
330    type ControlHandle = AccessibilityControlHandle;
331
332    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
333        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
334    }
335
336    fn control_handle(&self) -> Self::ControlHandle {
337        AccessibilityControlHandle { inner: self.inner.clone() }
338    }
339
340    fn into_inner(
341        self,
342    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
343    {
344        (self.inner, self.is_terminated)
345    }
346
347    fn from_inner(
348        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
349        is_terminated: bool,
350    ) -> Self {
351        Self { inner, is_terminated }
352    }
353}
354
355impl futures::Stream for AccessibilityRequestStream {
356    type Item = Result<AccessibilityRequest, fidl::Error>;
357
358    fn poll_next(
359        mut self: std::pin::Pin<&mut Self>,
360        cx: &mut std::task::Context<'_>,
361    ) -> std::task::Poll<Option<Self::Item>> {
362        let this = &mut *self;
363        if this.inner.check_shutdown(cx) {
364            this.is_terminated = true;
365            return std::task::Poll::Ready(None);
366        }
367        if this.is_terminated {
368            panic!("polled AccessibilityRequestStream after completion");
369        }
370        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
371            |bytes, handles| {
372                match this.inner.channel().read_etc(cx, bytes, handles) {
373                    std::task::Poll::Ready(Ok(())) => {}
374                    std::task::Poll::Pending => return std::task::Poll::Pending,
375                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
376                        this.is_terminated = true;
377                        return std::task::Poll::Ready(None);
378                    }
379                    std::task::Poll::Ready(Err(e)) => {
380                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
381                            e.into(),
382                        ))));
383                    }
384                }
385
386                // A message has been received from the channel
387                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
388
389                std::task::Poll::Ready(Some(match header.ordinal {
390                    0x417d0b95ddbf7674 => {
391                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
392                        let mut req = fidl::new_empty!(
393                            fidl::encoding::EmptyPayload,
394                            fidl::encoding::DefaultFuchsiaResourceDialect
395                        );
396                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
397                        let control_handle =
398                            AccessibilityControlHandle { inner: this.inner.clone() };
399                        Ok(AccessibilityRequest::Watch {
400                            responder: AccessibilityWatchResponder {
401                                control_handle: std::mem::ManuallyDrop::new(control_handle),
402                                tx_id: header.tx_id,
403                            },
404                        })
405                    }
406                    0x298485ef354fb8cb => {
407                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
408                        let mut req = fidl::new_empty!(
409                            AccessibilitySetRequest,
410                            fidl::encoding::DefaultFuchsiaResourceDialect
411                        );
412                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessibilitySetRequest>(&header, _body_bytes, handles, &mut req)?;
413                        let control_handle =
414                            AccessibilityControlHandle { inner: this.inner.clone() };
415                        Ok(AccessibilityRequest::Set {
416                            settings: req.settings,
417
418                            responder: AccessibilitySetResponder {
419                                control_handle: std::mem::ManuallyDrop::new(control_handle),
420                                tx_id: header.tx_id,
421                            },
422                        })
423                    }
424                    _ => Err(fidl::Error::UnknownOrdinal {
425                        ordinal: header.ordinal,
426                        protocol_name:
427                            <AccessibilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
428                    }),
429                }))
430            },
431        )
432    }
433}
434
435/// Modify or watch accessibility settings that are persisted.
436///
437/// Supported SettingsEpitaph enums:
438/// REQUEST_NOT_SUPPORTED, INTERNAL_SERVICE_ERROR, PERSISTENT_STORAGE_ERROR
439#[derive(Debug)]
440pub enum AccessibilityRequest {
441    /// Gets the current value of all accessibility settings. Returns
442    /// immediately on first call; subsequent calls return when any of the
443    /// values change.
444    ///
445    /// - `settings` all current values of the accessibility settings.
446    /// * see [`AccessibilitySettings`] for their meaning.
447    ///
448    /// If this call fails, it is considered a fatal error and the channel
449    /// will be closed.
450    Watch { responder: AccessibilityWatchResponder },
451    /// Sets [AccessibilitySettings] settings. Any field not explicitly set in the table performs a
452    /// no-op, and will not make any changes.
453    Set { settings: AccessibilitySettings, responder: AccessibilitySetResponder },
454}
455
456impl AccessibilityRequest {
457    #[allow(irrefutable_let_patterns)]
458    pub fn into_watch(self) -> Option<(AccessibilityWatchResponder)> {
459        if let AccessibilityRequest::Watch { responder } = self { Some((responder)) } else { None }
460    }
461
462    #[allow(irrefutable_let_patterns)]
463    pub fn into_set(self) -> Option<(AccessibilitySettings, AccessibilitySetResponder)> {
464        if let AccessibilityRequest::Set { settings, responder } = self {
465            Some((settings, responder))
466        } else {
467            None
468        }
469    }
470
471    /// Name of the method defined in FIDL
472    pub fn method_name(&self) -> &'static str {
473        match *self {
474            AccessibilityRequest::Watch { .. } => "watch",
475            AccessibilityRequest::Set { .. } => "set",
476        }
477    }
478}
479
480#[derive(Debug, Clone)]
481pub struct AccessibilityControlHandle {
482    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
483}
484
485impl fidl::endpoints::ControlHandle for AccessibilityControlHandle {
486    fn shutdown(&self) {
487        self.inner.shutdown()
488    }
489
490    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
491        self.inner.shutdown_with_epitaph(status)
492    }
493
494    fn is_closed(&self) -> bool {
495        self.inner.channel().is_closed()
496    }
497    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
498        self.inner.channel().on_closed()
499    }
500
501    #[cfg(target_os = "fuchsia")]
502    fn signal_peer(
503        &self,
504        clear_mask: zx::Signals,
505        set_mask: zx::Signals,
506    ) -> Result<(), zx_status::Status> {
507        use fidl::Peered;
508        self.inner.channel().signal_peer(clear_mask, set_mask)
509    }
510}
511
512impl AccessibilityControlHandle {}
513
514#[must_use = "FIDL methods require a response to be sent"]
515#[derive(Debug)]
516pub struct AccessibilityWatchResponder {
517    control_handle: std::mem::ManuallyDrop<AccessibilityControlHandle>,
518    tx_id: u32,
519}
520
521/// Set the the channel to be shutdown (see [`AccessibilityControlHandle::shutdown`])
522/// if the responder is dropped without sending a response, so that the client
523/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
524impl std::ops::Drop for AccessibilityWatchResponder {
525    fn drop(&mut self) {
526        self.control_handle.shutdown();
527        // Safety: drops once, never accessed again
528        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
529    }
530}
531
532impl fidl::endpoints::Responder for AccessibilityWatchResponder {
533    type ControlHandle = AccessibilityControlHandle;
534
535    fn control_handle(&self) -> &AccessibilityControlHandle {
536        &self.control_handle
537    }
538
539    fn drop_without_shutdown(mut self) {
540        // Safety: drops once, never accessed again due to mem::forget
541        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
542        // Prevent Drop from running (which would shut down the channel)
543        std::mem::forget(self);
544    }
545}
546
547impl AccessibilityWatchResponder {
548    /// Sends a response to the FIDL transaction.
549    ///
550    /// Sets the channel to shutdown if an error occurs.
551    pub fn send(self, mut settings: &AccessibilitySettings) -> Result<(), fidl::Error> {
552        let _result = self.send_raw(settings);
553        if _result.is_err() {
554            self.control_handle.shutdown();
555        }
556        self.drop_without_shutdown();
557        _result
558    }
559
560    /// Similar to "send" but does not shutdown the channel if an error occurs.
561    pub fn send_no_shutdown_on_err(
562        self,
563        mut settings: &AccessibilitySettings,
564    ) -> Result<(), fidl::Error> {
565        let _result = self.send_raw(settings);
566        self.drop_without_shutdown();
567        _result
568    }
569
570    fn send_raw(&self, mut settings: &AccessibilitySettings) -> Result<(), fidl::Error> {
571        self.control_handle.inner.send::<AccessibilityWatchResponse>(
572            (settings,),
573            self.tx_id,
574            0x417d0b95ddbf7674,
575            fidl::encoding::DynamicFlags::empty(),
576        )
577    }
578}
579
580#[must_use = "FIDL methods require a response to be sent"]
581#[derive(Debug)]
582pub struct AccessibilitySetResponder {
583    control_handle: std::mem::ManuallyDrop<AccessibilityControlHandle>,
584    tx_id: u32,
585}
586
587/// Set the the channel to be shutdown (see [`AccessibilityControlHandle::shutdown`])
588/// if the responder is dropped without sending a response, so that the client
589/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
590impl std::ops::Drop for AccessibilitySetResponder {
591    fn drop(&mut self) {
592        self.control_handle.shutdown();
593        // Safety: drops once, never accessed again
594        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
595    }
596}
597
598impl fidl::endpoints::Responder for AccessibilitySetResponder {
599    type ControlHandle = AccessibilityControlHandle;
600
601    fn control_handle(&self) -> &AccessibilityControlHandle {
602        &self.control_handle
603    }
604
605    fn drop_without_shutdown(mut self) {
606        // Safety: drops once, never accessed again due to mem::forget
607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
608        // Prevent Drop from running (which would shut down the channel)
609        std::mem::forget(self);
610    }
611}
612
613impl AccessibilitySetResponder {
614    /// Sends a response to the FIDL transaction.
615    ///
616    /// Sets the channel to shutdown if an error occurs.
617    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
618        let _result = self.send_raw(result);
619        if _result.is_err() {
620            self.control_handle.shutdown();
621        }
622        self.drop_without_shutdown();
623        _result
624    }
625
626    /// Similar to "send" but does not shutdown the channel if an error occurs.
627    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
628        let _result = self.send_raw(result);
629        self.drop_without_shutdown();
630        _result
631    }
632
633    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
634        self.control_handle
635            .inner
636            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
637                result,
638                self.tx_id,
639                0x298485ef354fb8cb,
640                fidl::encoding::DynamicFlags::empty(),
641            )
642    }
643}
644
645#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
646pub struct AudioMarker;
647
648impl fidl::endpoints::ProtocolMarker for AudioMarker {
649    type Proxy = AudioProxy;
650    type RequestStream = AudioRequestStream;
651    #[cfg(target_os = "fuchsia")]
652    type SynchronousProxy = AudioSynchronousProxy;
653
654    const DEBUG_NAME: &'static str = "fuchsia.settings.Audio";
655}
656impl fidl::endpoints::DiscoverableProtocolMarker for AudioMarker {}
657pub type AudioSetResult = Result<(), Error>;
658pub type AudioSet2Result = Result<(), Error>;
659
660pub trait AudioProxyInterface: Send + Sync {
661    type WatchResponseFut: std::future::Future<Output = Result<AudioSettings, fidl::Error>> + Send;
662    fn r#watch(&self) -> Self::WatchResponseFut;
663    type Watch2ResponseFut: std::future::Future<Output = Result<AudioSettings2, fidl::Error>> + Send;
664    fn r#watch2(&self) -> Self::Watch2ResponseFut;
665    type SetResponseFut: std::future::Future<Output = Result<AudioSetResult, fidl::Error>> + Send;
666    fn r#set(&self, settings: &AudioSettings) -> Self::SetResponseFut;
667    type Set2ResponseFut: std::future::Future<Output = Result<AudioSet2Result, fidl::Error>> + Send;
668    fn r#set2(&self, settings: &AudioSettings2) -> Self::Set2ResponseFut;
669}
670#[derive(Debug)]
671#[cfg(target_os = "fuchsia")]
672pub struct AudioSynchronousProxy {
673    client: fidl::client::sync::Client,
674}
675
676#[cfg(target_os = "fuchsia")]
677impl fidl::endpoints::SynchronousProxy for AudioSynchronousProxy {
678    type Proxy = AudioProxy;
679    type Protocol = AudioMarker;
680
681    fn from_channel(inner: fidl::Channel) -> Self {
682        Self::new(inner)
683    }
684
685    fn into_channel(self) -> fidl::Channel {
686        self.client.into_channel()
687    }
688
689    fn as_channel(&self) -> &fidl::Channel {
690        self.client.as_channel()
691    }
692}
693
694#[cfg(target_os = "fuchsia")]
695impl AudioSynchronousProxy {
696    pub fn new(channel: fidl::Channel) -> Self {
697        Self { client: fidl::client::sync::Client::new(channel) }
698    }
699
700    pub fn into_channel(self) -> fidl::Channel {
701        self.client.into_channel()
702    }
703
704    /// Waits until an event arrives and returns it. It is safe for other
705    /// threads to make concurrent requests while waiting for an event.
706    pub fn wait_for_event(
707        &self,
708        deadline: zx::MonotonicInstant,
709    ) -> Result<AudioEvent, fidl::Error> {
710        AudioEvent::decode(self.client.wait_for_event::<AudioMarker>(deadline)?)
711    }
712
713    /// Gets the current [AudioSettings]. Returns immediately on first call;
714    /// subsequent calls return when the value changes.
715    ///
716    /// If this call fails, it is considered a fatal error and the channel
717    /// will be closed.
718    pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<AudioSettings, fidl::Error> {
719        let _response = self
720            .client
721            .send_query::<fidl::encoding::EmptyPayload, AudioWatchResponse, AudioMarker>(
722                (),
723                0x2995cf83f9d0f805,
724                fidl::encoding::DynamicFlags::empty(),
725                ___deadline,
726            )?;
727        Ok(_response.settings)
728    }
729
730    /// Gets the current [AudioSettings2]. Returns immediately on first call;
731    /// subsequent calls return when the value changes.
732    ///
733    /// If this call fails, it is considered a fatal error and the channel will be closed.
734    pub fn r#watch2(
735        &self,
736        ___deadline: zx::MonotonicInstant,
737    ) -> Result<AudioSettings2, fidl::Error> {
738        let _response = self.client.send_query::<
739            fidl::encoding::EmptyPayload,
740            fidl::encoding::FlexibleType<AudioWatch2Response>,
741            AudioMarker,
742        >(
743            (),
744            0x4d10b204de1796e2,
745            fidl::encoding::DynamicFlags::FLEXIBLE,
746            ___deadline,
747        )?
748        .into_result::<AudioMarker>("watch2")?;
749        Ok(_response.settings)
750    }
751
752    /// Sets audio settings. Any field not explicitly set in the table performs a
753    /// no-op, and will not make any changes.
754    pub fn r#set(
755        &self,
756        mut settings: &AudioSettings,
757        ___deadline: zx::MonotonicInstant,
758    ) -> Result<AudioSetResult, fidl::Error> {
759        let _response = self.client.send_query::<AudioSetRequest, fidl::encoding::ResultType<
760            fidl::encoding::EmptyStruct,
761            Error,
762        >, AudioMarker>(
763            (settings,),
764            0x4f3865db04da626c,
765            fidl::encoding::DynamicFlags::empty(),
766            ___deadline,
767        )?;
768        Ok(_response.map(|x| x))
769    }
770
771    /// Sets audio settings. Only table fields that are set will lead to any changes; otherwise
772    /// existing settings are unchanged.
773    pub fn r#set2(
774        &self,
775        mut settings: &AudioSettings2,
776        ___deadline: zx::MonotonicInstant,
777    ) -> Result<AudioSet2Result, fidl::Error> {
778        let _response = self.client.send_query::<
779            AudioSet2Request,
780            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
781            AudioMarker,
782        >(
783            (settings,),
784            0x1f027e9ed7beefe3,
785            fidl::encoding::DynamicFlags::FLEXIBLE,
786            ___deadline,
787        )?
788        .into_result::<AudioMarker>("set2")?;
789        Ok(_response.map(|x| x))
790    }
791}
792
793#[cfg(target_os = "fuchsia")]
794impl From<AudioSynchronousProxy> for zx::NullableHandle {
795    fn from(value: AudioSynchronousProxy) -> Self {
796        value.into_channel().into()
797    }
798}
799
800#[cfg(target_os = "fuchsia")]
801impl From<fidl::Channel> for AudioSynchronousProxy {
802    fn from(value: fidl::Channel) -> Self {
803        Self::new(value)
804    }
805}
806
807#[cfg(target_os = "fuchsia")]
808impl fidl::endpoints::FromClient for AudioSynchronousProxy {
809    type Protocol = AudioMarker;
810
811    fn from_client(value: fidl::endpoints::ClientEnd<AudioMarker>) -> Self {
812        Self::new(value.into_channel())
813    }
814}
815
816#[derive(Debug, Clone)]
817pub struct AudioProxy {
818    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
819}
820
821impl fidl::endpoints::Proxy for AudioProxy {
822    type Protocol = AudioMarker;
823
824    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
825        Self::new(inner)
826    }
827
828    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
829        self.client.into_channel().map_err(|client| Self { client })
830    }
831
832    fn as_channel(&self) -> &::fidl::AsyncChannel {
833        self.client.as_channel()
834    }
835}
836
837impl AudioProxy {
838    /// Create a new Proxy for fuchsia.settings/Audio.
839    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
840        let protocol_name = <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
841        Self { client: fidl::client::Client::new(channel, protocol_name) }
842    }
843
844    /// Get a Stream of events from the remote end of the protocol.
845    ///
846    /// # Panics
847    ///
848    /// Panics if the event stream was already taken.
849    pub fn take_event_stream(&self) -> AudioEventStream {
850        AudioEventStream { event_receiver: self.client.take_event_receiver() }
851    }
852
853    /// Gets the current [AudioSettings]. Returns immediately on first call;
854    /// subsequent calls return when the value changes.
855    ///
856    /// If this call fails, it is considered a fatal error and the channel
857    /// will be closed.
858    pub fn r#watch(
859        &self,
860    ) -> fidl::client::QueryResponseFut<AudioSettings, fidl::encoding::DefaultFuchsiaResourceDialect>
861    {
862        AudioProxyInterface::r#watch(self)
863    }
864
865    /// Gets the current [AudioSettings2]. Returns immediately on first call;
866    /// subsequent calls return when the value changes.
867    ///
868    /// If this call fails, it is considered a fatal error and the channel will be closed.
869    pub fn r#watch2(
870        &self,
871    ) -> fidl::client::QueryResponseFut<AudioSettings2, fidl::encoding::DefaultFuchsiaResourceDialect>
872    {
873        AudioProxyInterface::r#watch2(self)
874    }
875
876    /// Sets audio settings. Any field not explicitly set in the table performs a
877    /// no-op, and will not make any changes.
878    pub fn r#set(
879        &self,
880        mut settings: &AudioSettings,
881    ) -> fidl::client::QueryResponseFut<AudioSetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
882    {
883        AudioProxyInterface::r#set(self, settings)
884    }
885
886    /// Sets audio settings. Only table fields that are set will lead to any changes; otherwise
887    /// existing settings are unchanged.
888    pub fn r#set2(
889        &self,
890        mut settings: &AudioSettings2,
891    ) -> fidl::client::QueryResponseFut<
892        AudioSet2Result,
893        fidl::encoding::DefaultFuchsiaResourceDialect,
894    > {
895        AudioProxyInterface::r#set2(self, settings)
896    }
897}
898
899impl AudioProxyInterface for AudioProxy {
900    type WatchResponseFut = fidl::client::QueryResponseFut<
901        AudioSettings,
902        fidl::encoding::DefaultFuchsiaResourceDialect,
903    >;
904    fn r#watch(&self) -> Self::WatchResponseFut {
905        fn _decode(
906            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
907        ) -> Result<AudioSettings, fidl::Error> {
908            let _response = fidl::client::decode_transaction_body::<
909                AudioWatchResponse,
910                fidl::encoding::DefaultFuchsiaResourceDialect,
911                0x2995cf83f9d0f805,
912            >(_buf?)?;
913            Ok(_response.settings)
914        }
915        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AudioSettings>(
916            (),
917            0x2995cf83f9d0f805,
918            fidl::encoding::DynamicFlags::empty(),
919            _decode,
920        )
921    }
922
923    type Watch2ResponseFut = fidl::client::QueryResponseFut<
924        AudioSettings2,
925        fidl::encoding::DefaultFuchsiaResourceDialect,
926    >;
927    fn r#watch2(&self) -> Self::Watch2ResponseFut {
928        fn _decode(
929            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
930        ) -> Result<AudioSettings2, fidl::Error> {
931            let _response = fidl::client::decode_transaction_body::<
932                fidl::encoding::FlexibleType<AudioWatch2Response>,
933                fidl::encoding::DefaultFuchsiaResourceDialect,
934                0x4d10b204de1796e2,
935            >(_buf?)?
936            .into_result::<AudioMarker>("watch2")?;
937            Ok(_response.settings)
938        }
939        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AudioSettings2>(
940            (),
941            0x4d10b204de1796e2,
942            fidl::encoding::DynamicFlags::FLEXIBLE,
943            _decode,
944        )
945    }
946
947    type SetResponseFut = fidl::client::QueryResponseFut<
948        AudioSetResult,
949        fidl::encoding::DefaultFuchsiaResourceDialect,
950    >;
951    fn r#set(&self, mut settings: &AudioSettings) -> Self::SetResponseFut {
952        fn _decode(
953            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
954        ) -> Result<AudioSetResult, fidl::Error> {
955            let _response = fidl::client::decode_transaction_body::<
956                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
957                fidl::encoding::DefaultFuchsiaResourceDialect,
958                0x4f3865db04da626c,
959            >(_buf?)?;
960            Ok(_response.map(|x| x))
961        }
962        self.client.send_query_and_decode::<AudioSetRequest, AudioSetResult>(
963            (settings,),
964            0x4f3865db04da626c,
965            fidl::encoding::DynamicFlags::empty(),
966            _decode,
967        )
968    }
969
970    type Set2ResponseFut = fidl::client::QueryResponseFut<
971        AudioSet2Result,
972        fidl::encoding::DefaultFuchsiaResourceDialect,
973    >;
974    fn r#set2(&self, mut settings: &AudioSettings2) -> Self::Set2ResponseFut {
975        fn _decode(
976            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
977        ) -> Result<AudioSet2Result, fidl::Error> {
978            let _response = fidl::client::decode_transaction_body::<
979                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
980                fidl::encoding::DefaultFuchsiaResourceDialect,
981                0x1f027e9ed7beefe3,
982            >(_buf?)?
983            .into_result::<AudioMarker>("set2")?;
984            Ok(_response.map(|x| x))
985        }
986        self.client.send_query_and_decode::<AudioSet2Request, AudioSet2Result>(
987            (settings,),
988            0x1f027e9ed7beefe3,
989            fidl::encoding::DynamicFlags::FLEXIBLE,
990            _decode,
991        )
992    }
993}
994
995pub struct AudioEventStream {
996    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
997}
998
999impl std::marker::Unpin for AudioEventStream {}
1000
1001impl futures::stream::FusedStream for AudioEventStream {
1002    fn is_terminated(&self) -> bool {
1003        self.event_receiver.is_terminated()
1004    }
1005}
1006
1007impl futures::Stream for AudioEventStream {
1008    type Item = Result<AudioEvent, fidl::Error>;
1009
1010    fn poll_next(
1011        mut self: std::pin::Pin<&mut Self>,
1012        cx: &mut std::task::Context<'_>,
1013    ) -> std::task::Poll<Option<Self::Item>> {
1014        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1015            &mut self.event_receiver,
1016            cx
1017        )?) {
1018            Some(buf) => std::task::Poll::Ready(Some(AudioEvent::decode(buf))),
1019            None => std::task::Poll::Ready(None),
1020        }
1021    }
1022}
1023
1024#[derive(Debug)]
1025pub enum AudioEvent {
1026    #[non_exhaustive]
1027    _UnknownEvent {
1028        /// Ordinal of the event that was sent.
1029        ordinal: u64,
1030    },
1031}
1032
1033impl AudioEvent {
1034    /// Decodes a message buffer as a [`AudioEvent`].
1035    fn decode(
1036        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1037    ) -> Result<AudioEvent, fidl::Error> {
1038        let (bytes, _handles) = buf.split_mut();
1039        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1040        debug_assert_eq!(tx_header.tx_id, 0);
1041        match tx_header.ordinal {
1042            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1043                Ok(AudioEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1044            }
1045            _ => Err(fidl::Error::UnknownOrdinal {
1046                ordinal: tx_header.ordinal,
1047                protocol_name: <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1048            }),
1049        }
1050    }
1051}
1052
1053/// A Stream of incoming requests for fuchsia.settings/Audio.
1054pub struct AudioRequestStream {
1055    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1056    is_terminated: bool,
1057}
1058
1059impl std::marker::Unpin for AudioRequestStream {}
1060
1061impl futures::stream::FusedStream for AudioRequestStream {
1062    fn is_terminated(&self) -> bool {
1063        self.is_terminated
1064    }
1065}
1066
1067impl fidl::endpoints::RequestStream for AudioRequestStream {
1068    type Protocol = AudioMarker;
1069    type ControlHandle = AudioControlHandle;
1070
1071    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1072        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1073    }
1074
1075    fn control_handle(&self) -> Self::ControlHandle {
1076        AudioControlHandle { inner: self.inner.clone() }
1077    }
1078
1079    fn into_inner(
1080        self,
1081    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1082    {
1083        (self.inner, self.is_terminated)
1084    }
1085
1086    fn from_inner(
1087        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1088        is_terminated: bool,
1089    ) -> Self {
1090        Self { inner, is_terminated }
1091    }
1092}
1093
1094impl futures::Stream for AudioRequestStream {
1095    type Item = Result<AudioRequest, fidl::Error>;
1096
1097    fn poll_next(
1098        mut self: std::pin::Pin<&mut Self>,
1099        cx: &mut std::task::Context<'_>,
1100    ) -> std::task::Poll<Option<Self::Item>> {
1101        let this = &mut *self;
1102        if this.inner.check_shutdown(cx) {
1103            this.is_terminated = true;
1104            return std::task::Poll::Ready(None);
1105        }
1106        if this.is_terminated {
1107            panic!("polled AudioRequestStream after completion");
1108        }
1109        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1110            |bytes, handles| {
1111                match this.inner.channel().read_etc(cx, bytes, handles) {
1112                    std::task::Poll::Ready(Ok(())) => {}
1113                    std::task::Poll::Pending => return std::task::Poll::Pending,
1114                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1115                        this.is_terminated = true;
1116                        return std::task::Poll::Ready(None);
1117                    }
1118                    std::task::Poll::Ready(Err(e)) => {
1119                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1120                            e.into(),
1121                        ))));
1122                    }
1123                }
1124
1125                // A message has been received from the channel
1126                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1127
1128                std::task::Poll::Ready(Some(match header.ordinal {
1129                    0x2995cf83f9d0f805 => {
1130                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1131                        let mut req = fidl::new_empty!(
1132                            fidl::encoding::EmptyPayload,
1133                            fidl::encoding::DefaultFuchsiaResourceDialect
1134                        );
1135                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1136                        let control_handle = AudioControlHandle { inner: this.inner.clone() };
1137                        Ok(AudioRequest::Watch {
1138                            responder: AudioWatchResponder {
1139                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1140                                tx_id: header.tx_id,
1141                            },
1142                        })
1143                    }
1144                    0x4d10b204de1796e2 => {
1145                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1146                        let mut req = fidl::new_empty!(
1147                            fidl::encoding::EmptyPayload,
1148                            fidl::encoding::DefaultFuchsiaResourceDialect
1149                        );
1150                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1151                        let control_handle = AudioControlHandle { inner: this.inner.clone() };
1152                        Ok(AudioRequest::Watch2 {
1153                            responder: AudioWatch2Responder {
1154                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1155                                tx_id: header.tx_id,
1156                            },
1157                        })
1158                    }
1159                    0x4f3865db04da626c => {
1160                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1161                        let mut req = fidl::new_empty!(
1162                            AudioSetRequest,
1163                            fidl::encoding::DefaultFuchsiaResourceDialect
1164                        );
1165                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioSetRequest>(&header, _body_bytes, handles, &mut req)?;
1166                        let control_handle = AudioControlHandle { inner: this.inner.clone() };
1167                        Ok(AudioRequest::Set {
1168                            settings: req.settings,
1169
1170                            responder: AudioSetResponder {
1171                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1172                                tx_id: header.tx_id,
1173                            },
1174                        })
1175                    }
1176                    0x1f027e9ed7beefe3 => {
1177                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1178                        let mut req = fidl::new_empty!(
1179                            AudioSet2Request,
1180                            fidl::encoding::DefaultFuchsiaResourceDialect
1181                        );
1182                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioSet2Request>(&header, _body_bytes, handles, &mut req)?;
1183                        let control_handle = AudioControlHandle { inner: this.inner.clone() };
1184                        Ok(AudioRequest::Set2 {
1185                            settings: req.settings,
1186
1187                            responder: AudioSet2Responder {
1188                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1189                                tx_id: header.tx_id,
1190                            },
1191                        })
1192                    }
1193                    _ if header.tx_id == 0
1194                        && header
1195                            .dynamic_flags()
1196                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1197                    {
1198                        Ok(AudioRequest::_UnknownMethod {
1199                            ordinal: header.ordinal,
1200                            control_handle: AudioControlHandle { inner: this.inner.clone() },
1201                            method_type: fidl::MethodType::OneWay,
1202                        })
1203                    }
1204                    _ if header
1205                        .dynamic_flags()
1206                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1207                    {
1208                        this.inner.send_framework_err(
1209                            fidl::encoding::FrameworkErr::UnknownMethod,
1210                            header.tx_id,
1211                            header.ordinal,
1212                            header.dynamic_flags(),
1213                            (bytes, handles),
1214                        )?;
1215                        Ok(AudioRequest::_UnknownMethod {
1216                            ordinal: header.ordinal,
1217                            control_handle: AudioControlHandle { inner: this.inner.clone() },
1218                            method_type: fidl::MethodType::TwoWay,
1219                        })
1220                    }
1221                    _ => Err(fidl::Error::UnknownOrdinal {
1222                        ordinal: header.ordinal,
1223                        protocol_name: <AudioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1224                    }),
1225                }))
1226            },
1227        )
1228    }
1229}
1230
1231/// Settings related to audio.
1232///
1233/// Supported SettingsEpitaph enums:
1234/// REQUEST_NOT_SUPPORTED, INTERNAL_SERVICE_ERROR, PERSISTENT_STORAGE_ERROR
1235#[derive(Debug)]
1236pub enum AudioRequest {
1237    /// Gets the current [AudioSettings]. Returns immediately on first call;
1238    /// subsequent calls return when the value changes.
1239    ///
1240    /// If this call fails, it is considered a fatal error and the channel
1241    /// will be closed.
1242    Watch { responder: AudioWatchResponder },
1243    /// Gets the current [AudioSettings2]. Returns immediately on first call;
1244    /// subsequent calls return when the value changes.
1245    ///
1246    /// If this call fails, it is considered a fatal error and the channel will be closed.
1247    Watch2 { responder: AudioWatch2Responder },
1248    /// Sets audio settings. Any field not explicitly set in the table performs a
1249    /// no-op, and will not make any changes.
1250    Set { settings: AudioSettings, responder: AudioSetResponder },
1251    /// Sets audio settings. Only table fields that are set will lead to any changes; otherwise
1252    /// existing settings are unchanged.
1253    Set2 { settings: AudioSettings2, responder: AudioSet2Responder },
1254    /// An interaction was received which does not match any known method.
1255    #[non_exhaustive]
1256    _UnknownMethod {
1257        /// Ordinal of the method that was called.
1258        ordinal: u64,
1259        control_handle: AudioControlHandle,
1260        method_type: fidl::MethodType,
1261    },
1262}
1263
1264impl AudioRequest {
1265    #[allow(irrefutable_let_patterns)]
1266    pub fn into_watch(self) -> Option<(AudioWatchResponder)> {
1267        if let AudioRequest::Watch { responder } = self { Some((responder)) } else { None }
1268    }
1269
1270    #[allow(irrefutable_let_patterns)]
1271    pub fn into_watch2(self) -> Option<(AudioWatch2Responder)> {
1272        if let AudioRequest::Watch2 { responder } = self { Some((responder)) } else { None }
1273    }
1274
1275    #[allow(irrefutable_let_patterns)]
1276    pub fn into_set(self) -> Option<(AudioSettings, AudioSetResponder)> {
1277        if let AudioRequest::Set { settings, responder } = self {
1278            Some((settings, responder))
1279        } else {
1280            None
1281        }
1282    }
1283
1284    #[allow(irrefutable_let_patterns)]
1285    pub fn into_set2(self) -> Option<(AudioSettings2, AudioSet2Responder)> {
1286        if let AudioRequest::Set2 { settings, responder } = self {
1287            Some((settings, responder))
1288        } else {
1289            None
1290        }
1291    }
1292
1293    /// Name of the method defined in FIDL
1294    pub fn method_name(&self) -> &'static str {
1295        match *self {
1296            AudioRequest::Watch { .. } => "watch",
1297            AudioRequest::Watch2 { .. } => "watch2",
1298            AudioRequest::Set { .. } => "set",
1299            AudioRequest::Set2 { .. } => "set2",
1300            AudioRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1301                "unknown one-way method"
1302            }
1303            AudioRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1304                "unknown two-way method"
1305            }
1306        }
1307    }
1308}
1309
1310#[derive(Debug, Clone)]
1311pub struct AudioControlHandle {
1312    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1313}
1314
1315impl fidl::endpoints::ControlHandle for AudioControlHandle {
1316    fn shutdown(&self) {
1317        self.inner.shutdown()
1318    }
1319
1320    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1321        self.inner.shutdown_with_epitaph(status)
1322    }
1323
1324    fn is_closed(&self) -> bool {
1325        self.inner.channel().is_closed()
1326    }
1327    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1328        self.inner.channel().on_closed()
1329    }
1330
1331    #[cfg(target_os = "fuchsia")]
1332    fn signal_peer(
1333        &self,
1334        clear_mask: zx::Signals,
1335        set_mask: zx::Signals,
1336    ) -> Result<(), zx_status::Status> {
1337        use fidl::Peered;
1338        self.inner.channel().signal_peer(clear_mask, set_mask)
1339    }
1340}
1341
1342impl AudioControlHandle {}
1343
1344#[must_use = "FIDL methods require a response to be sent"]
1345#[derive(Debug)]
1346pub struct AudioWatchResponder {
1347    control_handle: std::mem::ManuallyDrop<AudioControlHandle>,
1348    tx_id: u32,
1349}
1350
1351/// Set the the channel to be shutdown (see [`AudioControlHandle::shutdown`])
1352/// if the responder is dropped without sending a response, so that the client
1353/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1354impl std::ops::Drop for AudioWatchResponder {
1355    fn drop(&mut self) {
1356        self.control_handle.shutdown();
1357        // Safety: drops once, never accessed again
1358        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1359    }
1360}
1361
1362impl fidl::endpoints::Responder for AudioWatchResponder {
1363    type ControlHandle = AudioControlHandle;
1364
1365    fn control_handle(&self) -> &AudioControlHandle {
1366        &self.control_handle
1367    }
1368
1369    fn drop_without_shutdown(mut self) {
1370        // Safety: drops once, never accessed again due to mem::forget
1371        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1372        // Prevent Drop from running (which would shut down the channel)
1373        std::mem::forget(self);
1374    }
1375}
1376
1377impl AudioWatchResponder {
1378    /// Sends a response to the FIDL transaction.
1379    ///
1380    /// Sets the channel to shutdown if an error occurs.
1381    pub fn send(self, mut settings: &AudioSettings) -> Result<(), fidl::Error> {
1382        let _result = self.send_raw(settings);
1383        if _result.is_err() {
1384            self.control_handle.shutdown();
1385        }
1386        self.drop_without_shutdown();
1387        _result
1388    }
1389
1390    /// Similar to "send" but does not shutdown the channel if an error occurs.
1391    pub fn send_no_shutdown_on_err(self, mut settings: &AudioSettings) -> Result<(), fidl::Error> {
1392        let _result = self.send_raw(settings);
1393        self.drop_without_shutdown();
1394        _result
1395    }
1396
1397    fn send_raw(&self, mut settings: &AudioSettings) -> Result<(), fidl::Error> {
1398        self.control_handle.inner.send::<AudioWatchResponse>(
1399            (settings,),
1400            self.tx_id,
1401            0x2995cf83f9d0f805,
1402            fidl::encoding::DynamicFlags::empty(),
1403        )
1404    }
1405}
1406
1407#[must_use = "FIDL methods require a response to be sent"]
1408#[derive(Debug)]
1409pub struct AudioWatch2Responder {
1410    control_handle: std::mem::ManuallyDrop<AudioControlHandle>,
1411    tx_id: u32,
1412}
1413
1414/// Set the the channel to be shutdown (see [`AudioControlHandle::shutdown`])
1415/// if the responder is dropped without sending a response, so that the client
1416/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1417impl std::ops::Drop for AudioWatch2Responder {
1418    fn drop(&mut self) {
1419        self.control_handle.shutdown();
1420        // Safety: drops once, never accessed again
1421        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1422    }
1423}
1424
1425impl fidl::endpoints::Responder for AudioWatch2Responder {
1426    type ControlHandle = AudioControlHandle;
1427
1428    fn control_handle(&self) -> &AudioControlHandle {
1429        &self.control_handle
1430    }
1431
1432    fn drop_without_shutdown(mut self) {
1433        // Safety: drops once, never accessed again due to mem::forget
1434        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1435        // Prevent Drop from running (which would shut down the channel)
1436        std::mem::forget(self);
1437    }
1438}
1439
1440impl AudioWatch2Responder {
1441    /// Sends a response to the FIDL transaction.
1442    ///
1443    /// Sets the channel to shutdown if an error occurs.
1444    pub fn send(self, mut settings: &AudioSettings2) -> Result<(), fidl::Error> {
1445        let _result = self.send_raw(settings);
1446        if _result.is_err() {
1447            self.control_handle.shutdown();
1448        }
1449        self.drop_without_shutdown();
1450        _result
1451    }
1452
1453    /// Similar to "send" but does not shutdown the channel if an error occurs.
1454    pub fn send_no_shutdown_on_err(self, mut settings: &AudioSettings2) -> Result<(), fidl::Error> {
1455        let _result = self.send_raw(settings);
1456        self.drop_without_shutdown();
1457        _result
1458    }
1459
1460    fn send_raw(&self, mut settings: &AudioSettings2) -> Result<(), fidl::Error> {
1461        self.control_handle.inner.send::<fidl::encoding::FlexibleType<AudioWatch2Response>>(
1462            fidl::encoding::Flexible::new((settings,)),
1463            self.tx_id,
1464            0x4d10b204de1796e2,
1465            fidl::encoding::DynamicFlags::FLEXIBLE,
1466        )
1467    }
1468}
1469
1470#[must_use = "FIDL methods require a response to be sent"]
1471#[derive(Debug)]
1472pub struct AudioSetResponder {
1473    control_handle: std::mem::ManuallyDrop<AudioControlHandle>,
1474    tx_id: u32,
1475}
1476
1477/// Set the the channel to be shutdown (see [`AudioControlHandle::shutdown`])
1478/// if the responder is dropped without sending a response, so that the client
1479/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1480impl std::ops::Drop for AudioSetResponder {
1481    fn drop(&mut self) {
1482        self.control_handle.shutdown();
1483        // Safety: drops once, never accessed again
1484        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1485    }
1486}
1487
1488impl fidl::endpoints::Responder for AudioSetResponder {
1489    type ControlHandle = AudioControlHandle;
1490
1491    fn control_handle(&self) -> &AudioControlHandle {
1492        &self.control_handle
1493    }
1494
1495    fn drop_without_shutdown(mut self) {
1496        // Safety: drops once, never accessed again due to mem::forget
1497        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1498        // Prevent Drop from running (which would shut down the channel)
1499        std::mem::forget(self);
1500    }
1501}
1502
1503impl AudioSetResponder {
1504    /// Sends a response to the FIDL transaction.
1505    ///
1506    /// Sets the channel to shutdown if an error occurs.
1507    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1508        let _result = self.send_raw(result);
1509        if _result.is_err() {
1510            self.control_handle.shutdown();
1511        }
1512        self.drop_without_shutdown();
1513        _result
1514    }
1515
1516    /// Similar to "send" but does not shutdown the channel if an error occurs.
1517    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1518        let _result = self.send_raw(result);
1519        self.drop_without_shutdown();
1520        _result
1521    }
1522
1523    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1524        self.control_handle
1525            .inner
1526            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1527                result,
1528                self.tx_id,
1529                0x4f3865db04da626c,
1530                fidl::encoding::DynamicFlags::empty(),
1531            )
1532    }
1533}
1534
1535#[must_use = "FIDL methods require a response to be sent"]
1536#[derive(Debug)]
1537pub struct AudioSet2Responder {
1538    control_handle: std::mem::ManuallyDrop<AudioControlHandle>,
1539    tx_id: u32,
1540}
1541
1542/// Set the the channel to be shutdown (see [`AudioControlHandle::shutdown`])
1543/// if the responder is dropped without sending a response, so that the client
1544/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1545impl std::ops::Drop for AudioSet2Responder {
1546    fn drop(&mut self) {
1547        self.control_handle.shutdown();
1548        // Safety: drops once, never accessed again
1549        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1550    }
1551}
1552
1553impl fidl::endpoints::Responder for AudioSet2Responder {
1554    type ControlHandle = AudioControlHandle;
1555
1556    fn control_handle(&self) -> &AudioControlHandle {
1557        &self.control_handle
1558    }
1559
1560    fn drop_without_shutdown(mut self) {
1561        // Safety: drops once, never accessed again due to mem::forget
1562        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1563        // Prevent Drop from running (which would shut down the channel)
1564        std::mem::forget(self);
1565    }
1566}
1567
1568impl AudioSet2Responder {
1569    /// Sends a response to the FIDL transaction.
1570    ///
1571    /// Sets the channel to shutdown if an error occurs.
1572    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1573        let _result = self.send_raw(result);
1574        if _result.is_err() {
1575            self.control_handle.shutdown();
1576        }
1577        self.drop_without_shutdown();
1578        _result
1579    }
1580
1581    /// Similar to "send" but does not shutdown the channel if an error occurs.
1582    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1583        let _result = self.send_raw(result);
1584        self.drop_without_shutdown();
1585        _result
1586    }
1587
1588    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1589        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1590            fidl::encoding::EmptyStruct,
1591            Error,
1592        >>(
1593            fidl::encoding::FlexibleResult::new(result),
1594            self.tx_id,
1595            0x1f027e9ed7beefe3,
1596            fidl::encoding::DynamicFlags::FLEXIBLE,
1597        )
1598    }
1599}
1600
1601#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1602pub struct DisplayMarker;
1603
1604impl fidl::endpoints::ProtocolMarker for DisplayMarker {
1605    type Proxy = DisplayProxy;
1606    type RequestStream = DisplayRequestStream;
1607    #[cfg(target_os = "fuchsia")]
1608    type SynchronousProxy = DisplaySynchronousProxy;
1609
1610    const DEBUG_NAME: &'static str = "fuchsia.settings.Display";
1611}
1612impl fidl::endpoints::DiscoverableProtocolMarker for DisplayMarker {}
1613pub type DisplaySetResult = Result<(), Error>;
1614
1615pub trait DisplayProxyInterface: Send + Sync {
1616    type WatchResponseFut: std::future::Future<Output = Result<DisplaySettings, fidl::Error>> + Send;
1617    fn r#watch(&self) -> Self::WatchResponseFut;
1618    type SetResponseFut: std::future::Future<Output = Result<DisplaySetResult, fidl::Error>> + Send;
1619    fn r#set(&self, settings: &DisplaySettings) -> Self::SetResponseFut;
1620}
1621#[derive(Debug)]
1622#[cfg(target_os = "fuchsia")]
1623pub struct DisplaySynchronousProxy {
1624    client: fidl::client::sync::Client,
1625}
1626
1627#[cfg(target_os = "fuchsia")]
1628impl fidl::endpoints::SynchronousProxy for DisplaySynchronousProxy {
1629    type Proxy = DisplayProxy;
1630    type Protocol = DisplayMarker;
1631
1632    fn from_channel(inner: fidl::Channel) -> Self {
1633        Self::new(inner)
1634    }
1635
1636    fn into_channel(self) -> fidl::Channel {
1637        self.client.into_channel()
1638    }
1639
1640    fn as_channel(&self) -> &fidl::Channel {
1641        self.client.as_channel()
1642    }
1643}
1644
1645#[cfg(target_os = "fuchsia")]
1646impl DisplaySynchronousProxy {
1647    pub fn new(channel: fidl::Channel) -> Self {
1648        Self { client: fidl::client::sync::Client::new(channel) }
1649    }
1650
1651    pub fn into_channel(self) -> fidl::Channel {
1652        self.client.into_channel()
1653    }
1654
1655    /// Waits until an event arrives and returns it. It is safe for other
1656    /// threads to make concurrent requests while waiting for an event.
1657    pub fn wait_for_event(
1658        &self,
1659        deadline: zx::MonotonicInstant,
1660    ) -> Result<DisplayEvent, fidl::Error> {
1661        DisplayEvent::decode(self.client.wait_for_event::<DisplayMarker>(deadline)?)
1662    }
1663
1664    /// Gets the current [DisplaySettings]. Returns immediately on first call;
1665    /// subsequent calls return when the value changes.
1666    ///
1667    /// If this call fails, it is considered a fatal error and the channel
1668    /// will be closed.
1669    pub fn r#watch(
1670        &self,
1671        ___deadline: zx::MonotonicInstant,
1672    ) -> Result<DisplaySettings, fidl::Error> {
1673        let _response = self
1674            .client
1675            .send_query::<fidl::encoding::EmptyPayload, DisplayWatchResponse, DisplayMarker>(
1676                (),
1677                0x7da3212470364db1,
1678                fidl::encoding::DynamicFlags::empty(),
1679                ___deadline,
1680            )?;
1681        Ok(_response.settings)
1682    }
1683
1684    /// Sets display settings. Any field not explicitly set in the table performs a
1685    /// no-op, and will not make any changes.
1686    pub fn r#set(
1687        &self,
1688        mut settings: &DisplaySettings,
1689        ___deadline: zx::MonotonicInstant,
1690    ) -> Result<DisplaySetResult, fidl::Error> {
1691        let _response = self.client.send_query::<DisplaySetRequest, fidl::encoding::ResultType<
1692            fidl::encoding::EmptyStruct,
1693            Error,
1694        >, DisplayMarker>(
1695            (settings,),
1696            0x1029e06ace17479c,
1697            fidl::encoding::DynamicFlags::empty(),
1698            ___deadline,
1699        )?;
1700        Ok(_response.map(|x| x))
1701    }
1702}
1703
1704#[cfg(target_os = "fuchsia")]
1705impl From<DisplaySynchronousProxy> for zx::NullableHandle {
1706    fn from(value: DisplaySynchronousProxy) -> Self {
1707        value.into_channel().into()
1708    }
1709}
1710
1711#[cfg(target_os = "fuchsia")]
1712impl From<fidl::Channel> for DisplaySynchronousProxy {
1713    fn from(value: fidl::Channel) -> Self {
1714        Self::new(value)
1715    }
1716}
1717
1718#[cfg(target_os = "fuchsia")]
1719impl fidl::endpoints::FromClient for DisplaySynchronousProxy {
1720    type Protocol = DisplayMarker;
1721
1722    fn from_client(value: fidl::endpoints::ClientEnd<DisplayMarker>) -> Self {
1723        Self::new(value.into_channel())
1724    }
1725}
1726
1727#[derive(Debug, Clone)]
1728pub struct DisplayProxy {
1729    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1730}
1731
1732impl fidl::endpoints::Proxy for DisplayProxy {
1733    type Protocol = DisplayMarker;
1734
1735    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1736        Self::new(inner)
1737    }
1738
1739    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1740        self.client.into_channel().map_err(|client| Self { client })
1741    }
1742
1743    fn as_channel(&self) -> &::fidl::AsyncChannel {
1744        self.client.as_channel()
1745    }
1746}
1747
1748impl DisplayProxy {
1749    /// Create a new Proxy for fuchsia.settings/Display.
1750    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1751        let protocol_name = <DisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1752        Self { client: fidl::client::Client::new(channel, protocol_name) }
1753    }
1754
1755    /// Get a Stream of events from the remote end of the protocol.
1756    ///
1757    /// # Panics
1758    ///
1759    /// Panics if the event stream was already taken.
1760    pub fn take_event_stream(&self) -> DisplayEventStream {
1761        DisplayEventStream { event_receiver: self.client.take_event_receiver() }
1762    }
1763
1764    /// Gets the current [DisplaySettings]. Returns immediately on first call;
1765    /// subsequent calls return when the value changes.
1766    ///
1767    /// If this call fails, it is considered a fatal error and the channel
1768    /// will be closed.
1769    pub fn r#watch(
1770        &self,
1771    ) -> fidl::client::QueryResponseFut<
1772        DisplaySettings,
1773        fidl::encoding::DefaultFuchsiaResourceDialect,
1774    > {
1775        DisplayProxyInterface::r#watch(self)
1776    }
1777
1778    /// Sets display settings. Any field not explicitly set in the table performs a
1779    /// no-op, and will not make any changes.
1780    pub fn r#set(
1781        &self,
1782        mut settings: &DisplaySettings,
1783    ) -> fidl::client::QueryResponseFut<
1784        DisplaySetResult,
1785        fidl::encoding::DefaultFuchsiaResourceDialect,
1786    > {
1787        DisplayProxyInterface::r#set(self, settings)
1788    }
1789}
1790
1791impl DisplayProxyInterface for DisplayProxy {
1792    type WatchResponseFut = fidl::client::QueryResponseFut<
1793        DisplaySettings,
1794        fidl::encoding::DefaultFuchsiaResourceDialect,
1795    >;
1796    fn r#watch(&self) -> Self::WatchResponseFut {
1797        fn _decode(
1798            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1799        ) -> Result<DisplaySettings, fidl::Error> {
1800            let _response = fidl::client::decode_transaction_body::<
1801                DisplayWatchResponse,
1802                fidl::encoding::DefaultFuchsiaResourceDialect,
1803                0x7da3212470364db1,
1804            >(_buf?)?;
1805            Ok(_response.settings)
1806        }
1807        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DisplaySettings>(
1808            (),
1809            0x7da3212470364db1,
1810            fidl::encoding::DynamicFlags::empty(),
1811            _decode,
1812        )
1813    }
1814
1815    type SetResponseFut = fidl::client::QueryResponseFut<
1816        DisplaySetResult,
1817        fidl::encoding::DefaultFuchsiaResourceDialect,
1818    >;
1819    fn r#set(&self, mut settings: &DisplaySettings) -> Self::SetResponseFut {
1820        fn _decode(
1821            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1822        ) -> Result<DisplaySetResult, fidl::Error> {
1823            let _response = fidl::client::decode_transaction_body::<
1824                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1825                fidl::encoding::DefaultFuchsiaResourceDialect,
1826                0x1029e06ace17479c,
1827            >(_buf?)?;
1828            Ok(_response.map(|x| x))
1829        }
1830        self.client.send_query_and_decode::<DisplaySetRequest, DisplaySetResult>(
1831            (settings,),
1832            0x1029e06ace17479c,
1833            fidl::encoding::DynamicFlags::empty(),
1834            _decode,
1835        )
1836    }
1837}
1838
1839pub struct DisplayEventStream {
1840    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1841}
1842
1843impl std::marker::Unpin for DisplayEventStream {}
1844
1845impl futures::stream::FusedStream for DisplayEventStream {
1846    fn is_terminated(&self) -> bool {
1847        self.event_receiver.is_terminated()
1848    }
1849}
1850
1851impl futures::Stream for DisplayEventStream {
1852    type Item = Result<DisplayEvent, fidl::Error>;
1853
1854    fn poll_next(
1855        mut self: std::pin::Pin<&mut Self>,
1856        cx: &mut std::task::Context<'_>,
1857    ) -> std::task::Poll<Option<Self::Item>> {
1858        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1859            &mut self.event_receiver,
1860            cx
1861        )?) {
1862            Some(buf) => std::task::Poll::Ready(Some(DisplayEvent::decode(buf))),
1863            None => std::task::Poll::Ready(None),
1864        }
1865    }
1866}
1867
1868#[derive(Debug)]
1869pub enum DisplayEvent {}
1870
1871impl DisplayEvent {
1872    /// Decodes a message buffer as a [`DisplayEvent`].
1873    fn decode(
1874        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1875    ) -> Result<DisplayEvent, fidl::Error> {
1876        let (bytes, _handles) = buf.split_mut();
1877        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1878        debug_assert_eq!(tx_header.tx_id, 0);
1879        match tx_header.ordinal {
1880            _ => Err(fidl::Error::UnknownOrdinal {
1881                ordinal: tx_header.ordinal,
1882                protocol_name: <DisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1883            }),
1884        }
1885    }
1886}
1887
1888/// A Stream of incoming requests for fuchsia.settings/Display.
1889pub struct DisplayRequestStream {
1890    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1891    is_terminated: bool,
1892}
1893
1894impl std::marker::Unpin for DisplayRequestStream {}
1895
1896impl futures::stream::FusedStream for DisplayRequestStream {
1897    fn is_terminated(&self) -> bool {
1898        self.is_terminated
1899    }
1900}
1901
1902impl fidl::endpoints::RequestStream for DisplayRequestStream {
1903    type Protocol = DisplayMarker;
1904    type ControlHandle = DisplayControlHandle;
1905
1906    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1907        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1908    }
1909
1910    fn control_handle(&self) -> Self::ControlHandle {
1911        DisplayControlHandle { inner: self.inner.clone() }
1912    }
1913
1914    fn into_inner(
1915        self,
1916    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1917    {
1918        (self.inner, self.is_terminated)
1919    }
1920
1921    fn from_inner(
1922        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1923        is_terminated: bool,
1924    ) -> Self {
1925        Self { inner, is_terminated }
1926    }
1927}
1928
1929impl futures::Stream for DisplayRequestStream {
1930    type Item = Result<DisplayRequest, fidl::Error>;
1931
1932    fn poll_next(
1933        mut self: std::pin::Pin<&mut Self>,
1934        cx: &mut std::task::Context<'_>,
1935    ) -> std::task::Poll<Option<Self::Item>> {
1936        let this = &mut *self;
1937        if this.inner.check_shutdown(cx) {
1938            this.is_terminated = true;
1939            return std::task::Poll::Ready(None);
1940        }
1941        if this.is_terminated {
1942            panic!("polled DisplayRequestStream after completion");
1943        }
1944        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1945            |bytes, handles| {
1946                match this.inner.channel().read_etc(cx, bytes, handles) {
1947                    std::task::Poll::Ready(Ok(())) => {}
1948                    std::task::Poll::Pending => return std::task::Poll::Pending,
1949                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1950                        this.is_terminated = true;
1951                        return std::task::Poll::Ready(None);
1952                    }
1953                    std::task::Poll::Ready(Err(e)) => {
1954                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1955                            e.into(),
1956                        ))));
1957                    }
1958                }
1959
1960                // A message has been received from the channel
1961                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1962
1963                std::task::Poll::Ready(Some(match header.ordinal {
1964                    0x7da3212470364db1 => {
1965                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1966                        let mut req = fidl::new_empty!(
1967                            fidl::encoding::EmptyPayload,
1968                            fidl::encoding::DefaultFuchsiaResourceDialect
1969                        );
1970                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1971                        let control_handle = DisplayControlHandle { inner: this.inner.clone() };
1972                        Ok(DisplayRequest::Watch {
1973                            responder: DisplayWatchResponder {
1974                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1975                                tx_id: header.tx_id,
1976                            },
1977                        })
1978                    }
1979                    0x1029e06ace17479c => {
1980                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1981                        let mut req = fidl::new_empty!(
1982                            DisplaySetRequest,
1983                            fidl::encoding::DefaultFuchsiaResourceDialect
1984                        );
1985                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DisplaySetRequest>(&header, _body_bytes, handles, &mut req)?;
1986                        let control_handle = DisplayControlHandle { inner: this.inner.clone() };
1987                        Ok(DisplayRequest::Set {
1988                            settings: req.settings,
1989
1990                            responder: DisplaySetResponder {
1991                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1992                                tx_id: header.tx_id,
1993                            },
1994                        })
1995                    }
1996                    _ => Err(fidl::Error::UnknownOrdinal {
1997                        ordinal: header.ordinal,
1998                        protocol_name:
1999                            <DisplayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2000                    }),
2001                }))
2002            },
2003        )
2004    }
2005}
2006
2007/// Settings related to display.
2008///
2009/// Supported SettingsEpitaph enums:
2010/// REQUEST_NOT_SUPPORTED, INTERNAL_SERVICE_ERROR, PERSISTENT_STORAGE_ERROR
2011#[derive(Debug)]
2012pub enum DisplayRequest {
2013    /// Gets the current [DisplaySettings]. Returns immediately on first call;
2014    /// subsequent calls return when the value changes.
2015    ///
2016    /// If this call fails, it is considered a fatal error and the channel
2017    /// will be closed.
2018    Watch { responder: DisplayWatchResponder },
2019    /// Sets display settings. Any field not explicitly set in the table performs a
2020    /// no-op, and will not make any changes.
2021    Set { settings: DisplaySettings, responder: DisplaySetResponder },
2022}
2023
2024impl DisplayRequest {
2025    #[allow(irrefutable_let_patterns)]
2026    pub fn into_watch(self) -> Option<(DisplayWatchResponder)> {
2027        if let DisplayRequest::Watch { responder } = self { Some((responder)) } else { None }
2028    }
2029
2030    #[allow(irrefutable_let_patterns)]
2031    pub fn into_set(self) -> Option<(DisplaySettings, DisplaySetResponder)> {
2032        if let DisplayRequest::Set { settings, responder } = self {
2033            Some((settings, responder))
2034        } else {
2035            None
2036        }
2037    }
2038
2039    /// Name of the method defined in FIDL
2040    pub fn method_name(&self) -> &'static str {
2041        match *self {
2042            DisplayRequest::Watch { .. } => "watch",
2043            DisplayRequest::Set { .. } => "set",
2044        }
2045    }
2046}
2047
2048#[derive(Debug, Clone)]
2049pub struct DisplayControlHandle {
2050    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2051}
2052
2053impl fidl::endpoints::ControlHandle for DisplayControlHandle {
2054    fn shutdown(&self) {
2055        self.inner.shutdown()
2056    }
2057
2058    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2059        self.inner.shutdown_with_epitaph(status)
2060    }
2061
2062    fn is_closed(&self) -> bool {
2063        self.inner.channel().is_closed()
2064    }
2065    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2066        self.inner.channel().on_closed()
2067    }
2068
2069    #[cfg(target_os = "fuchsia")]
2070    fn signal_peer(
2071        &self,
2072        clear_mask: zx::Signals,
2073        set_mask: zx::Signals,
2074    ) -> Result<(), zx_status::Status> {
2075        use fidl::Peered;
2076        self.inner.channel().signal_peer(clear_mask, set_mask)
2077    }
2078}
2079
2080impl DisplayControlHandle {}
2081
2082#[must_use = "FIDL methods require a response to be sent"]
2083#[derive(Debug)]
2084pub struct DisplayWatchResponder {
2085    control_handle: std::mem::ManuallyDrop<DisplayControlHandle>,
2086    tx_id: u32,
2087}
2088
2089/// Set the the channel to be shutdown (see [`DisplayControlHandle::shutdown`])
2090/// if the responder is dropped without sending a response, so that the client
2091/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2092impl std::ops::Drop for DisplayWatchResponder {
2093    fn drop(&mut self) {
2094        self.control_handle.shutdown();
2095        // Safety: drops once, never accessed again
2096        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2097    }
2098}
2099
2100impl fidl::endpoints::Responder for DisplayWatchResponder {
2101    type ControlHandle = DisplayControlHandle;
2102
2103    fn control_handle(&self) -> &DisplayControlHandle {
2104        &self.control_handle
2105    }
2106
2107    fn drop_without_shutdown(mut self) {
2108        // Safety: drops once, never accessed again due to mem::forget
2109        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2110        // Prevent Drop from running (which would shut down the channel)
2111        std::mem::forget(self);
2112    }
2113}
2114
2115impl DisplayWatchResponder {
2116    /// Sends a response to the FIDL transaction.
2117    ///
2118    /// Sets the channel to shutdown if an error occurs.
2119    pub fn send(self, mut settings: &DisplaySettings) -> Result<(), fidl::Error> {
2120        let _result = self.send_raw(settings);
2121        if _result.is_err() {
2122            self.control_handle.shutdown();
2123        }
2124        self.drop_without_shutdown();
2125        _result
2126    }
2127
2128    /// Similar to "send" but does not shutdown the channel if an error occurs.
2129    pub fn send_no_shutdown_on_err(
2130        self,
2131        mut settings: &DisplaySettings,
2132    ) -> Result<(), fidl::Error> {
2133        let _result = self.send_raw(settings);
2134        self.drop_without_shutdown();
2135        _result
2136    }
2137
2138    fn send_raw(&self, mut settings: &DisplaySettings) -> Result<(), fidl::Error> {
2139        self.control_handle.inner.send::<DisplayWatchResponse>(
2140            (settings,),
2141            self.tx_id,
2142            0x7da3212470364db1,
2143            fidl::encoding::DynamicFlags::empty(),
2144        )
2145    }
2146}
2147
2148#[must_use = "FIDL methods require a response to be sent"]
2149#[derive(Debug)]
2150pub struct DisplaySetResponder {
2151    control_handle: std::mem::ManuallyDrop<DisplayControlHandle>,
2152    tx_id: u32,
2153}
2154
2155/// Set the the channel to be shutdown (see [`DisplayControlHandle::shutdown`])
2156/// if the responder is dropped without sending a response, so that the client
2157/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2158impl std::ops::Drop for DisplaySetResponder {
2159    fn drop(&mut self) {
2160        self.control_handle.shutdown();
2161        // Safety: drops once, never accessed again
2162        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2163    }
2164}
2165
2166impl fidl::endpoints::Responder for DisplaySetResponder {
2167    type ControlHandle = DisplayControlHandle;
2168
2169    fn control_handle(&self) -> &DisplayControlHandle {
2170        &self.control_handle
2171    }
2172
2173    fn drop_without_shutdown(mut self) {
2174        // Safety: drops once, never accessed again due to mem::forget
2175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2176        // Prevent Drop from running (which would shut down the channel)
2177        std::mem::forget(self);
2178    }
2179}
2180
2181impl DisplaySetResponder {
2182    /// Sends a response to the FIDL transaction.
2183    ///
2184    /// Sets the channel to shutdown if an error occurs.
2185    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2186        let _result = self.send_raw(result);
2187        if _result.is_err() {
2188            self.control_handle.shutdown();
2189        }
2190        self.drop_without_shutdown();
2191        _result
2192    }
2193
2194    /// Similar to "send" but does not shutdown the channel if an error occurs.
2195    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2196        let _result = self.send_raw(result);
2197        self.drop_without_shutdown();
2198        _result
2199    }
2200
2201    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2202        self.control_handle
2203            .inner
2204            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2205                result,
2206                self.tx_id,
2207                0x1029e06ace17479c,
2208                fidl::encoding::DynamicFlags::empty(),
2209            )
2210    }
2211}
2212
2213#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2214pub struct DoNotDisturbMarker;
2215
2216impl fidl::endpoints::ProtocolMarker for DoNotDisturbMarker {
2217    type Proxy = DoNotDisturbProxy;
2218    type RequestStream = DoNotDisturbRequestStream;
2219    #[cfg(target_os = "fuchsia")]
2220    type SynchronousProxy = DoNotDisturbSynchronousProxy;
2221
2222    const DEBUG_NAME: &'static str = "fuchsia.settings.DoNotDisturb";
2223}
2224impl fidl::endpoints::DiscoverableProtocolMarker for DoNotDisturbMarker {}
2225pub type DoNotDisturbSetResult = Result<(), Error>;
2226
2227pub trait DoNotDisturbProxyInterface: Send + Sync {
2228    type WatchResponseFut: std::future::Future<Output = Result<DoNotDisturbSettings, fidl::Error>>
2229        + Send;
2230    fn r#watch(&self) -> Self::WatchResponseFut;
2231    type SetResponseFut: std::future::Future<Output = Result<DoNotDisturbSetResult, fidl::Error>>
2232        + Send;
2233    fn r#set(&self, settings: &DoNotDisturbSettings) -> Self::SetResponseFut;
2234}
2235#[derive(Debug)]
2236#[cfg(target_os = "fuchsia")]
2237pub struct DoNotDisturbSynchronousProxy {
2238    client: fidl::client::sync::Client,
2239}
2240
2241#[cfg(target_os = "fuchsia")]
2242impl fidl::endpoints::SynchronousProxy for DoNotDisturbSynchronousProxy {
2243    type Proxy = DoNotDisturbProxy;
2244    type Protocol = DoNotDisturbMarker;
2245
2246    fn from_channel(inner: fidl::Channel) -> Self {
2247        Self::new(inner)
2248    }
2249
2250    fn into_channel(self) -> fidl::Channel {
2251        self.client.into_channel()
2252    }
2253
2254    fn as_channel(&self) -> &fidl::Channel {
2255        self.client.as_channel()
2256    }
2257}
2258
2259#[cfg(target_os = "fuchsia")]
2260impl DoNotDisturbSynchronousProxy {
2261    pub fn new(channel: fidl::Channel) -> Self {
2262        Self { client: fidl::client::sync::Client::new(channel) }
2263    }
2264
2265    pub fn into_channel(self) -> fidl::Channel {
2266        self.client.into_channel()
2267    }
2268
2269    /// Waits until an event arrives and returns it. It is safe for other
2270    /// threads to make concurrent requests while waiting for an event.
2271    pub fn wait_for_event(
2272        &self,
2273        deadline: zx::MonotonicInstant,
2274    ) -> Result<DoNotDisturbEvent, fidl::Error> {
2275        DoNotDisturbEvent::decode(self.client.wait_for_event::<DoNotDisturbMarker>(deadline)?)
2276    }
2277
2278    /// Gets the current [`DoNotDisturbSettings`]. Returns immediately on first
2279    /// call; subsequent calls return when the values change.
2280    ///
2281    /// If this call fails, it is considered a fatal error and the channel
2282    /// will be closed.
2283    pub fn r#watch(
2284        &self,
2285        ___deadline: zx::MonotonicInstant,
2286    ) -> Result<DoNotDisturbSettings, fidl::Error> {
2287        let _response = self.client.send_query::<
2288            fidl::encoding::EmptyPayload,
2289            DoNotDisturbWatchResponse,
2290            DoNotDisturbMarker,
2291        >(
2292            (),
2293            0x1eeae2f97a5547fb,
2294            fidl::encoding::DynamicFlags::empty(),
2295            ___deadline,
2296        )?;
2297        Ok(_response.settings)
2298    }
2299
2300    /// Sets [`DoNotDisturbSettings`] settings. Any field not explicitly set in
2301    /// the table performs a no-op, and will not make any changes.
2302    pub fn r#set(
2303        &self,
2304        mut settings: &DoNotDisturbSettings,
2305        ___deadline: zx::MonotonicInstant,
2306    ) -> Result<DoNotDisturbSetResult, fidl::Error> {
2307        let _response = self.client.send_query::<
2308            DoNotDisturbSetRequest,
2309            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2310            DoNotDisturbMarker,
2311        >(
2312            (settings,),
2313            0x7fef934e7f5777b0,
2314            fidl::encoding::DynamicFlags::empty(),
2315            ___deadline,
2316        )?;
2317        Ok(_response.map(|x| x))
2318    }
2319}
2320
2321#[cfg(target_os = "fuchsia")]
2322impl From<DoNotDisturbSynchronousProxy> for zx::NullableHandle {
2323    fn from(value: DoNotDisturbSynchronousProxy) -> Self {
2324        value.into_channel().into()
2325    }
2326}
2327
2328#[cfg(target_os = "fuchsia")]
2329impl From<fidl::Channel> for DoNotDisturbSynchronousProxy {
2330    fn from(value: fidl::Channel) -> Self {
2331        Self::new(value)
2332    }
2333}
2334
2335#[cfg(target_os = "fuchsia")]
2336impl fidl::endpoints::FromClient for DoNotDisturbSynchronousProxy {
2337    type Protocol = DoNotDisturbMarker;
2338
2339    fn from_client(value: fidl::endpoints::ClientEnd<DoNotDisturbMarker>) -> Self {
2340        Self::new(value.into_channel())
2341    }
2342}
2343
2344#[derive(Debug, Clone)]
2345pub struct DoNotDisturbProxy {
2346    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2347}
2348
2349impl fidl::endpoints::Proxy for DoNotDisturbProxy {
2350    type Protocol = DoNotDisturbMarker;
2351
2352    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2353        Self::new(inner)
2354    }
2355
2356    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2357        self.client.into_channel().map_err(|client| Self { client })
2358    }
2359
2360    fn as_channel(&self) -> &::fidl::AsyncChannel {
2361        self.client.as_channel()
2362    }
2363}
2364
2365impl DoNotDisturbProxy {
2366    /// Create a new Proxy for fuchsia.settings/DoNotDisturb.
2367    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2368        let protocol_name = <DoNotDisturbMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2369        Self { client: fidl::client::Client::new(channel, protocol_name) }
2370    }
2371
2372    /// Get a Stream of events from the remote end of the protocol.
2373    ///
2374    /// # Panics
2375    ///
2376    /// Panics if the event stream was already taken.
2377    pub fn take_event_stream(&self) -> DoNotDisturbEventStream {
2378        DoNotDisturbEventStream { event_receiver: self.client.take_event_receiver() }
2379    }
2380
2381    /// Gets the current [`DoNotDisturbSettings`]. Returns immediately on first
2382    /// call; subsequent calls return when the values change.
2383    ///
2384    /// If this call fails, it is considered a fatal error and the channel
2385    /// will be closed.
2386    pub fn r#watch(
2387        &self,
2388    ) -> fidl::client::QueryResponseFut<
2389        DoNotDisturbSettings,
2390        fidl::encoding::DefaultFuchsiaResourceDialect,
2391    > {
2392        DoNotDisturbProxyInterface::r#watch(self)
2393    }
2394
2395    /// Sets [`DoNotDisturbSettings`] settings. Any field not explicitly set in
2396    /// the table performs a no-op, and will not make any changes.
2397    pub fn r#set(
2398        &self,
2399        mut settings: &DoNotDisturbSettings,
2400    ) -> fidl::client::QueryResponseFut<
2401        DoNotDisturbSetResult,
2402        fidl::encoding::DefaultFuchsiaResourceDialect,
2403    > {
2404        DoNotDisturbProxyInterface::r#set(self, settings)
2405    }
2406}
2407
2408impl DoNotDisturbProxyInterface for DoNotDisturbProxy {
2409    type WatchResponseFut = fidl::client::QueryResponseFut<
2410        DoNotDisturbSettings,
2411        fidl::encoding::DefaultFuchsiaResourceDialect,
2412    >;
2413    fn r#watch(&self) -> Self::WatchResponseFut {
2414        fn _decode(
2415            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2416        ) -> Result<DoNotDisturbSettings, fidl::Error> {
2417            let _response = fidl::client::decode_transaction_body::<
2418                DoNotDisturbWatchResponse,
2419                fidl::encoding::DefaultFuchsiaResourceDialect,
2420                0x1eeae2f97a5547fb,
2421            >(_buf?)?;
2422            Ok(_response.settings)
2423        }
2424        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DoNotDisturbSettings>(
2425            (),
2426            0x1eeae2f97a5547fb,
2427            fidl::encoding::DynamicFlags::empty(),
2428            _decode,
2429        )
2430    }
2431
2432    type SetResponseFut = fidl::client::QueryResponseFut<
2433        DoNotDisturbSetResult,
2434        fidl::encoding::DefaultFuchsiaResourceDialect,
2435    >;
2436    fn r#set(&self, mut settings: &DoNotDisturbSettings) -> Self::SetResponseFut {
2437        fn _decode(
2438            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2439        ) -> Result<DoNotDisturbSetResult, fidl::Error> {
2440            let _response = fidl::client::decode_transaction_body::<
2441                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2442                fidl::encoding::DefaultFuchsiaResourceDialect,
2443                0x7fef934e7f5777b0,
2444            >(_buf?)?;
2445            Ok(_response.map(|x| x))
2446        }
2447        self.client.send_query_and_decode::<DoNotDisturbSetRequest, DoNotDisturbSetResult>(
2448            (settings,),
2449            0x7fef934e7f5777b0,
2450            fidl::encoding::DynamicFlags::empty(),
2451            _decode,
2452        )
2453    }
2454}
2455
2456pub struct DoNotDisturbEventStream {
2457    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2458}
2459
2460impl std::marker::Unpin for DoNotDisturbEventStream {}
2461
2462impl futures::stream::FusedStream for DoNotDisturbEventStream {
2463    fn is_terminated(&self) -> bool {
2464        self.event_receiver.is_terminated()
2465    }
2466}
2467
2468impl futures::Stream for DoNotDisturbEventStream {
2469    type Item = Result<DoNotDisturbEvent, fidl::Error>;
2470
2471    fn poll_next(
2472        mut self: std::pin::Pin<&mut Self>,
2473        cx: &mut std::task::Context<'_>,
2474    ) -> std::task::Poll<Option<Self::Item>> {
2475        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2476            &mut self.event_receiver,
2477            cx
2478        )?) {
2479            Some(buf) => std::task::Poll::Ready(Some(DoNotDisturbEvent::decode(buf))),
2480            None => std::task::Poll::Ready(None),
2481        }
2482    }
2483}
2484
2485#[derive(Debug)]
2486pub enum DoNotDisturbEvent {}
2487
2488impl DoNotDisturbEvent {
2489    /// Decodes a message buffer as a [`DoNotDisturbEvent`].
2490    fn decode(
2491        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2492    ) -> Result<DoNotDisturbEvent, fidl::Error> {
2493        let (bytes, _handles) = buf.split_mut();
2494        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2495        debug_assert_eq!(tx_header.tx_id, 0);
2496        match tx_header.ordinal {
2497            _ => Err(fidl::Error::UnknownOrdinal {
2498                ordinal: tx_header.ordinal,
2499                protocol_name: <DoNotDisturbMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2500            }),
2501        }
2502    }
2503}
2504
2505/// A Stream of incoming requests for fuchsia.settings/DoNotDisturb.
2506pub struct DoNotDisturbRequestStream {
2507    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2508    is_terminated: bool,
2509}
2510
2511impl std::marker::Unpin for DoNotDisturbRequestStream {}
2512
2513impl futures::stream::FusedStream for DoNotDisturbRequestStream {
2514    fn is_terminated(&self) -> bool {
2515        self.is_terminated
2516    }
2517}
2518
2519impl fidl::endpoints::RequestStream for DoNotDisturbRequestStream {
2520    type Protocol = DoNotDisturbMarker;
2521    type ControlHandle = DoNotDisturbControlHandle;
2522
2523    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2524        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2525    }
2526
2527    fn control_handle(&self) -> Self::ControlHandle {
2528        DoNotDisturbControlHandle { inner: self.inner.clone() }
2529    }
2530
2531    fn into_inner(
2532        self,
2533    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2534    {
2535        (self.inner, self.is_terminated)
2536    }
2537
2538    fn from_inner(
2539        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2540        is_terminated: bool,
2541    ) -> Self {
2542        Self { inner, is_terminated }
2543    }
2544}
2545
2546impl futures::Stream for DoNotDisturbRequestStream {
2547    type Item = Result<DoNotDisturbRequest, fidl::Error>;
2548
2549    fn poll_next(
2550        mut self: std::pin::Pin<&mut Self>,
2551        cx: &mut std::task::Context<'_>,
2552    ) -> std::task::Poll<Option<Self::Item>> {
2553        let this = &mut *self;
2554        if this.inner.check_shutdown(cx) {
2555            this.is_terminated = true;
2556            return std::task::Poll::Ready(None);
2557        }
2558        if this.is_terminated {
2559            panic!("polled DoNotDisturbRequestStream after completion");
2560        }
2561        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2562            |bytes, handles| {
2563                match this.inner.channel().read_etc(cx, bytes, handles) {
2564                    std::task::Poll::Ready(Ok(())) => {}
2565                    std::task::Poll::Pending => return std::task::Poll::Pending,
2566                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2567                        this.is_terminated = true;
2568                        return std::task::Poll::Ready(None);
2569                    }
2570                    std::task::Poll::Ready(Err(e)) => {
2571                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2572                            e.into(),
2573                        ))));
2574                    }
2575                }
2576
2577                // A message has been received from the channel
2578                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2579
2580                std::task::Poll::Ready(Some(match header.ordinal {
2581                    0x1eeae2f97a5547fb => {
2582                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2583                        let mut req = fidl::new_empty!(
2584                            fidl::encoding::EmptyPayload,
2585                            fidl::encoding::DefaultFuchsiaResourceDialect
2586                        );
2587                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2588                        let control_handle =
2589                            DoNotDisturbControlHandle { inner: this.inner.clone() };
2590                        Ok(DoNotDisturbRequest::Watch {
2591                            responder: DoNotDisturbWatchResponder {
2592                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2593                                tx_id: header.tx_id,
2594                            },
2595                        })
2596                    }
2597                    0x7fef934e7f5777b0 => {
2598                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2599                        let mut req = fidl::new_empty!(
2600                            DoNotDisturbSetRequest,
2601                            fidl::encoding::DefaultFuchsiaResourceDialect
2602                        );
2603                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DoNotDisturbSetRequest>(&header, _body_bytes, handles, &mut req)?;
2604                        let control_handle =
2605                            DoNotDisturbControlHandle { inner: this.inner.clone() };
2606                        Ok(DoNotDisturbRequest::Set {
2607                            settings: req.settings,
2608
2609                            responder: DoNotDisturbSetResponder {
2610                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2611                                tx_id: header.tx_id,
2612                            },
2613                        })
2614                    }
2615                    _ => Err(fidl::Error::UnknownOrdinal {
2616                        ordinal: header.ordinal,
2617                        protocol_name:
2618                            <DoNotDisturbMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2619                    }),
2620                }))
2621            },
2622        )
2623    }
2624}
2625
2626/// Modify or watch do-not-disturb (DND) mode. While DND is active, distractions
2627/// created by the device are reduced or eliminated. E.g. bootup is silent,
2628/// incoming calls could be rejected or silent, and notifications could be
2629/// paused, silent, or hidden. High-priority disruptions like alarms can be
2630/// allowed.
2631///
2632/// Supported SettingsEpitaph enums:
2633/// REQUEST_NOT_SUPPORTED, INTERNAL_SERVICE_ERROR, PERSISTENT_STORAGE_ERROR
2634#[derive(Debug)]
2635pub enum DoNotDisturbRequest {
2636    /// Gets the current [`DoNotDisturbSettings`]. Returns immediately on first
2637    /// call; subsequent calls return when the values change.
2638    ///
2639    /// If this call fails, it is considered a fatal error and the channel
2640    /// will be closed.
2641    Watch { responder: DoNotDisturbWatchResponder },
2642    /// Sets [`DoNotDisturbSettings`] settings. Any field not explicitly set in
2643    /// the table performs a no-op, and will not make any changes.
2644    Set { settings: DoNotDisturbSettings, responder: DoNotDisturbSetResponder },
2645}
2646
2647impl DoNotDisturbRequest {
2648    #[allow(irrefutable_let_patterns)]
2649    pub fn into_watch(self) -> Option<(DoNotDisturbWatchResponder)> {
2650        if let DoNotDisturbRequest::Watch { responder } = self { Some((responder)) } else { None }
2651    }
2652
2653    #[allow(irrefutable_let_patterns)]
2654    pub fn into_set(self) -> Option<(DoNotDisturbSettings, DoNotDisturbSetResponder)> {
2655        if let DoNotDisturbRequest::Set { settings, responder } = self {
2656            Some((settings, responder))
2657        } else {
2658            None
2659        }
2660    }
2661
2662    /// Name of the method defined in FIDL
2663    pub fn method_name(&self) -> &'static str {
2664        match *self {
2665            DoNotDisturbRequest::Watch { .. } => "watch",
2666            DoNotDisturbRequest::Set { .. } => "set",
2667        }
2668    }
2669}
2670
2671#[derive(Debug, Clone)]
2672pub struct DoNotDisturbControlHandle {
2673    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2674}
2675
2676impl fidl::endpoints::ControlHandle for DoNotDisturbControlHandle {
2677    fn shutdown(&self) {
2678        self.inner.shutdown()
2679    }
2680
2681    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2682        self.inner.shutdown_with_epitaph(status)
2683    }
2684
2685    fn is_closed(&self) -> bool {
2686        self.inner.channel().is_closed()
2687    }
2688    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2689        self.inner.channel().on_closed()
2690    }
2691
2692    #[cfg(target_os = "fuchsia")]
2693    fn signal_peer(
2694        &self,
2695        clear_mask: zx::Signals,
2696        set_mask: zx::Signals,
2697    ) -> Result<(), zx_status::Status> {
2698        use fidl::Peered;
2699        self.inner.channel().signal_peer(clear_mask, set_mask)
2700    }
2701}
2702
2703impl DoNotDisturbControlHandle {}
2704
2705#[must_use = "FIDL methods require a response to be sent"]
2706#[derive(Debug)]
2707pub struct DoNotDisturbWatchResponder {
2708    control_handle: std::mem::ManuallyDrop<DoNotDisturbControlHandle>,
2709    tx_id: u32,
2710}
2711
2712/// Set the the channel to be shutdown (see [`DoNotDisturbControlHandle::shutdown`])
2713/// if the responder is dropped without sending a response, so that the client
2714/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2715impl std::ops::Drop for DoNotDisturbWatchResponder {
2716    fn drop(&mut self) {
2717        self.control_handle.shutdown();
2718        // Safety: drops once, never accessed again
2719        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2720    }
2721}
2722
2723impl fidl::endpoints::Responder for DoNotDisturbWatchResponder {
2724    type ControlHandle = DoNotDisturbControlHandle;
2725
2726    fn control_handle(&self) -> &DoNotDisturbControlHandle {
2727        &self.control_handle
2728    }
2729
2730    fn drop_without_shutdown(mut self) {
2731        // Safety: drops once, never accessed again due to mem::forget
2732        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2733        // Prevent Drop from running (which would shut down the channel)
2734        std::mem::forget(self);
2735    }
2736}
2737
2738impl DoNotDisturbWatchResponder {
2739    /// Sends a response to the FIDL transaction.
2740    ///
2741    /// Sets the channel to shutdown if an error occurs.
2742    pub fn send(self, mut settings: &DoNotDisturbSettings) -> Result<(), fidl::Error> {
2743        let _result = self.send_raw(settings);
2744        if _result.is_err() {
2745            self.control_handle.shutdown();
2746        }
2747        self.drop_without_shutdown();
2748        _result
2749    }
2750
2751    /// Similar to "send" but does not shutdown the channel if an error occurs.
2752    pub fn send_no_shutdown_on_err(
2753        self,
2754        mut settings: &DoNotDisturbSettings,
2755    ) -> Result<(), fidl::Error> {
2756        let _result = self.send_raw(settings);
2757        self.drop_without_shutdown();
2758        _result
2759    }
2760
2761    fn send_raw(&self, mut settings: &DoNotDisturbSettings) -> Result<(), fidl::Error> {
2762        self.control_handle.inner.send::<DoNotDisturbWatchResponse>(
2763            (settings,),
2764            self.tx_id,
2765            0x1eeae2f97a5547fb,
2766            fidl::encoding::DynamicFlags::empty(),
2767        )
2768    }
2769}
2770
2771#[must_use = "FIDL methods require a response to be sent"]
2772#[derive(Debug)]
2773pub struct DoNotDisturbSetResponder {
2774    control_handle: std::mem::ManuallyDrop<DoNotDisturbControlHandle>,
2775    tx_id: u32,
2776}
2777
2778/// Set the the channel to be shutdown (see [`DoNotDisturbControlHandle::shutdown`])
2779/// if the responder is dropped without sending a response, so that the client
2780/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2781impl std::ops::Drop for DoNotDisturbSetResponder {
2782    fn drop(&mut self) {
2783        self.control_handle.shutdown();
2784        // Safety: drops once, never accessed again
2785        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2786    }
2787}
2788
2789impl fidl::endpoints::Responder for DoNotDisturbSetResponder {
2790    type ControlHandle = DoNotDisturbControlHandle;
2791
2792    fn control_handle(&self) -> &DoNotDisturbControlHandle {
2793        &self.control_handle
2794    }
2795
2796    fn drop_without_shutdown(mut self) {
2797        // Safety: drops once, never accessed again due to mem::forget
2798        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2799        // Prevent Drop from running (which would shut down the channel)
2800        std::mem::forget(self);
2801    }
2802}
2803
2804impl DoNotDisturbSetResponder {
2805    /// Sends a response to the FIDL transaction.
2806    ///
2807    /// Sets the channel to shutdown if an error occurs.
2808    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2809        let _result = self.send_raw(result);
2810        if _result.is_err() {
2811            self.control_handle.shutdown();
2812        }
2813        self.drop_without_shutdown();
2814        _result
2815    }
2816
2817    /// Similar to "send" but does not shutdown the channel if an error occurs.
2818    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2819        let _result = self.send_raw(result);
2820        self.drop_without_shutdown();
2821        _result
2822    }
2823
2824    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2825        self.control_handle
2826            .inner
2827            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2828                result,
2829                self.tx_id,
2830                0x7fef934e7f5777b0,
2831                fidl::encoding::DynamicFlags::empty(),
2832            )
2833    }
2834}
2835
2836#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2837pub struct FactoryResetMarker;
2838
2839impl fidl::endpoints::ProtocolMarker for FactoryResetMarker {
2840    type Proxy = FactoryResetProxy;
2841    type RequestStream = FactoryResetRequestStream;
2842    #[cfg(target_os = "fuchsia")]
2843    type SynchronousProxy = FactoryResetSynchronousProxy;
2844
2845    const DEBUG_NAME: &'static str = "fuchsia.settings.FactoryReset";
2846}
2847impl fidl::endpoints::DiscoverableProtocolMarker for FactoryResetMarker {}
2848pub type FactoryResetSetResult = Result<(), Error>;
2849
2850pub trait FactoryResetProxyInterface: Send + Sync {
2851    type WatchResponseFut: std::future::Future<Output = Result<FactoryResetSettings, fidl::Error>>
2852        + Send;
2853    fn r#watch(&self) -> Self::WatchResponseFut;
2854    type SetResponseFut: std::future::Future<Output = Result<FactoryResetSetResult, fidl::Error>>
2855        + Send;
2856    fn r#set(&self, settings: &FactoryResetSettings) -> Self::SetResponseFut;
2857}
2858#[derive(Debug)]
2859#[cfg(target_os = "fuchsia")]
2860pub struct FactoryResetSynchronousProxy {
2861    client: fidl::client::sync::Client,
2862}
2863
2864#[cfg(target_os = "fuchsia")]
2865impl fidl::endpoints::SynchronousProxy for FactoryResetSynchronousProxy {
2866    type Proxy = FactoryResetProxy;
2867    type Protocol = FactoryResetMarker;
2868
2869    fn from_channel(inner: fidl::Channel) -> Self {
2870        Self::new(inner)
2871    }
2872
2873    fn into_channel(self) -> fidl::Channel {
2874        self.client.into_channel()
2875    }
2876
2877    fn as_channel(&self) -> &fidl::Channel {
2878        self.client.as_channel()
2879    }
2880}
2881
2882#[cfg(target_os = "fuchsia")]
2883impl FactoryResetSynchronousProxy {
2884    pub fn new(channel: fidl::Channel) -> Self {
2885        Self { client: fidl::client::sync::Client::new(channel) }
2886    }
2887
2888    pub fn into_channel(self) -> fidl::Channel {
2889        self.client.into_channel()
2890    }
2891
2892    /// Waits until an event arrives and returns it. It is safe for other
2893    /// threads to make concurrent requests while waiting for an event.
2894    pub fn wait_for_event(
2895        &self,
2896        deadline: zx::MonotonicInstant,
2897    ) -> Result<FactoryResetEvent, fidl::Error> {
2898        FactoryResetEvent::decode(self.client.wait_for_event::<FactoryResetMarker>(deadline)?)
2899    }
2900
2901    /// Notifies of a change in information about the factory reset settings.
2902    ///
2903    /// On a given connection, the first call will return the current `settings`
2904    /// value while subsequent calls will only return the new `settings` value
2905    /// upon a value change. This follows the hanging get pattern.
2906    ///
2907    /// If this call fails, it is considered a fatal error and the channel will
2908    /// be closed.
2909    pub fn r#watch(
2910        &self,
2911        ___deadline: zx::MonotonicInstant,
2912    ) -> Result<FactoryResetSettings, fidl::Error> {
2913        let _response = self.client.send_query::<
2914            fidl::encoding::EmptyPayload,
2915            FactoryResetWatchResponse,
2916            FactoryResetMarker,
2917        >(
2918            (),
2919            0x50cfc9906eb406a1,
2920            fidl::encoding::DynamicFlags::empty(),
2921            ___deadline,
2922        )?;
2923        Ok(_response.settings)
2924    }
2925
2926    /// Sets factory reset settings. Any field not explicitly set in the table
2927    /// performs a no-op, and will not make any changes.
2928    pub fn r#set(
2929        &self,
2930        mut settings: &FactoryResetSettings,
2931        ___deadline: zx::MonotonicInstant,
2932    ) -> Result<FactoryResetSetResult, fidl::Error> {
2933        let _response = self.client.send_query::<
2934            FactoryResetSetRequest,
2935            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2936            FactoryResetMarker,
2937        >(
2938            (settings,),
2939            0x5b35942c1cb1eca8,
2940            fidl::encoding::DynamicFlags::empty(),
2941            ___deadline,
2942        )?;
2943        Ok(_response.map(|x| x))
2944    }
2945}
2946
2947#[cfg(target_os = "fuchsia")]
2948impl From<FactoryResetSynchronousProxy> for zx::NullableHandle {
2949    fn from(value: FactoryResetSynchronousProxy) -> Self {
2950        value.into_channel().into()
2951    }
2952}
2953
2954#[cfg(target_os = "fuchsia")]
2955impl From<fidl::Channel> for FactoryResetSynchronousProxy {
2956    fn from(value: fidl::Channel) -> Self {
2957        Self::new(value)
2958    }
2959}
2960
2961#[cfg(target_os = "fuchsia")]
2962impl fidl::endpoints::FromClient for FactoryResetSynchronousProxy {
2963    type Protocol = FactoryResetMarker;
2964
2965    fn from_client(value: fidl::endpoints::ClientEnd<FactoryResetMarker>) -> Self {
2966        Self::new(value.into_channel())
2967    }
2968}
2969
2970#[derive(Debug, Clone)]
2971pub struct FactoryResetProxy {
2972    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2973}
2974
2975impl fidl::endpoints::Proxy for FactoryResetProxy {
2976    type Protocol = FactoryResetMarker;
2977
2978    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2979        Self::new(inner)
2980    }
2981
2982    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2983        self.client.into_channel().map_err(|client| Self { client })
2984    }
2985
2986    fn as_channel(&self) -> &::fidl::AsyncChannel {
2987        self.client.as_channel()
2988    }
2989}
2990
2991impl FactoryResetProxy {
2992    /// Create a new Proxy for fuchsia.settings/FactoryReset.
2993    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2994        let protocol_name = <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2995        Self { client: fidl::client::Client::new(channel, protocol_name) }
2996    }
2997
2998    /// Get a Stream of events from the remote end of the protocol.
2999    ///
3000    /// # Panics
3001    ///
3002    /// Panics if the event stream was already taken.
3003    pub fn take_event_stream(&self) -> FactoryResetEventStream {
3004        FactoryResetEventStream { event_receiver: self.client.take_event_receiver() }
3005    }
3006
3007    /// Notifies of a change in information about the factory reset settings.
3008    ///
3009    /// On a given connection, the first call will return the current `settings`
3010    /// value while subsequent calls will only return the new `settings` value
3011    /// upon a value change. This follows the hanging get pattern.
3012    ///
3013    /// If this call fails, it is considered a fatal error and the channel will
3014    /// be closed.
3015    pub fn r#watch(
3016        &self,
3017    ) -> fidl::client::QueryResponseFut<
3018        FactoryResetSettings,
3019        fidl::encoding::DefaultFuchsiaResourceDialect,
3020    > {
3021        FactoryResetProxyInterface::r#watch(self)
3022    }
3023
3024    /// Sets factory reset settings. Any field not explicitly set in the table
3025    /// performs a no-op, and will not make any changes.
3026    pub fn r#set(
3027        &self,
3028        mut settings: &FactoryResetSettings,
3029    ) -> fidl::client::QueryResponseFut<
3030        FactoryResetSetResult,
3031        fidl::encoding::DefaultFuchsiaResourceDialect,
3032    > {
3033        FactoryResetProxyInterface::r#set(self, settings)
3034    }
3035}
3036
3037impl FactoryResetProxyInterface for FactoryResetProxy {
3038    type WatchResponseFut = fidl::client::QueryResponseFut<
3039        FactoryResetSettings,
3040        fidl::encoding::DefaultFuchsiaResourceDialect,
3041    >;
3042    fn r#watch(&self) -> Self::WatchResponseFut {
3043        fn _decode(
3044            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3045        ) -> Result<FactoryResetSettings, fidl::Error> {
3046            let _response = fidl::client::decode_transaction_body::<
3047                FactoryResetWatchResponse,
3048                fidl::encoding::DefaultFuchsiaResourceDialect,
3049                0x50cfc9906eb406a1,
3050            >(_buf?)?;
3051            Ok(_response.settings)
3052        }
3053        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, FactoryResetSettings>(
3054            (),
3055            0x50cfc9906eb406a1,
3056            fidl::encoding::DynamicFlags::empty(),
3057            _decode,
3058        )
3059    }
3060
3061    type SetResponseFut = fidl::client::QueryResponseFut<
3062        FactoryResetSetResult,
3063        fidl::encoding::DefaultFuchsiaResourceDialect,
3064    >;
3065    fn r#set(&self, mut settings: &FactoryResetSettings) -> Self::SetResponseFut {
3066        fn _decode(
3067            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3068        ) -> Result<FactoryResetSetResult, fidl::Error> {
3069            let _response = fidl::client::decode_transaction_body::<
3070                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
3071                fidl::encoding::DefaultFuchsiaResourceDialect,
3072                0x5b35942c1cb1eca8,
3073            >(_buf?)?;
3074            Ok(_response.map(|x| x))
3075        }
3076        self.client.send_query_and_decode::<FactoryResetSetRequest, FactoryResetSetResult>(
3077            (settings,),
3078            0x5b35942c1cb1eca8,
3079            fidl::encoding::DynamicFlags::empty(),
3080            _decode,
3081        )
3082    }
3083}
3084
3085pub struct FactoryResetEventStream {
3086    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3087}
3088
3089impl std::marker::Unpin for FactoryResetEventStream {}
3090
3091impl futures::stream::FusedStream for FactoryResetEventStream {
3092    fn is_terminated(&self) -> bool {
3093        self.event_receiver.is_terminated()
3094    }
3095}
3096
3097impl futures::Stream for FactoryResetEventStream {
3098    type Item = Result<FactoryResetEvent, fidl::Error>;
3099
3100    fn poll_next(
3101        mut self: std::pin::Pin<&mut Self>,
3102        cx: &mut std::task::Context<'_>,
3103    ) -> std::task::Poll<Option<Self::Item>> {
3104        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3105            &mut self.event_receiver,
3106            cx
3107        )?) {
3108            Some(buf) => std::task::Poll::Ready(Some(FactoryResetEvent::decode(buf))),
3109            None => std::task::Poll::Ready(None),
3110        }
3111    }
3112}
3113
3114#[derive(Debug)]
3115pub enum FactoryResetEvent {}
3116
3117impl FactoryResetEvent {
3118    /// Decodes a message buffer as a [`FactoryResetEvent`].
3119    fn decode(
3120        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3121    ) -> Result<FactoryResetEvent, fidl::Error> {
3122        let (bytes, _handles) = buf.split_mut();
3123        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3124        debug_assert_eq!(tx_header.tx_id, 0);
3125        match tx_header.ordinal {
3126            _ => Err(fidl::Error::UnknownOrdinal {
3127                ordinal: tx_header.ordinal,
3128                protocol_name: <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3129            }),
3130        }
3131    }
3132}
3133
3134/// A Stream of incoming requests for fuchsia.settings/FactoryReset.
3135pub struct FactoryResetRequestStream {
3136    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3137    is_terminated: bool,
3138}
3139
3140impl std::marker::Unpin for FactoryResetRequestStream {}
3141
3142impl futures::stream::FusedStream for FactoryResetRequestStream {
3143    fn is_terminated(&self) -> bool {
3144        self.is_terminated
3145    }
3146}
3147
3148impl fidl::endpoints::RequestStream for FactoryResetRequestStream {
3149    type Protocol = FactoryResetMarker;
3150    type ControlHandle = FactoryResetControlHandle;
3151
3152    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3153        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3154    }
3155
3156    fn control_handle(&self) -> Self::ControlHandle {
3157        FactoryResetControlHandle { inner: self.inner.clone() }
3158    }
3159
3160    fn into_inner(
3161        self,
3162    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3163    {
3164        (self.inner, self.is_terminated)
3165    }
3166
3167    fn from_inner(
3168        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3169        is_terminated: bool,
3170    ) -> Self {
3171        Self { inner, is_terminated }
3172    }
3173}
3174
3175impl futures::Stream for FactoryResetRequestStream {
3176    type Item = Result<FactoryResetRequest, fidl::Error>;
3177
3178    fn poll_next(
3179        mut self: std::pin::Pin<&mut Self>,
3180        cx: &mut std::task::Context<'_>,
3181    ) -> std::task::Poll<Option<Self::Item>> {
3182        let this = &mut *self;
3183        if this.inner.check_shutdown(cx) {
3184            this.is_terminated = true;
3185            return std::task::Poll::Ready(None);
3186        }
3187        if this.is_terminated {
3188            panic!("polled FactoryResetRequestStream after completion");
3189        }
3190        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3191            |bytes, handles| {
3192                match this.inner.channel().read_etc(cx, bytes, handles) {
3193                    std::task::Poll::Ready(Ok(())) => {}
3194                    std::task::Poll::Pending => return std::task::Poll::Pending,
3195                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3196                        this.is_terminated = true;
3197                        return std::task::Poll::Ready(None);
3198                    }
3199                    std::task::Poll::Ready(Err(e)) => {
3200                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3201                            e.into(),
3202                        ))));
3203                    }
3204                }
3205
3206                // A message has been received from the channel
3207                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3208
3209                std::task::Poll::Ready(Some(match header.ordinal {
3210                    0x50cfc9906eb406a1 => {
3211                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3212                        let mut req = fidl::new_empty!(
3213                            fidl::encoding::EmptyPayload,
3214                            fidl::encoding::DefaultFuchsiaResourceDialect
3215                        );
3216                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3217                        let control_handle =
3218                            FactoryResetControlHandle { inner: this.inner.clone() };
3219                        Ok(FactoryResetRequest::Watch {
3220                            responder: FactoryResetWatchResponder {
3221                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3222                                tx_id: header.tx_id,
3223                            },
3224                        })
3225                    }
3226                    0x5b35942c1cb1eca8 => {
3227                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3228                        let mut req = fidl::new_empty!(
3229                            FactoryResetSetRequest,
3230                            fidl::encoding::DefaultFuchsiaResourceDialect
3231                        );
3232                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FactoryResetSetRequest>(&header, _body_bytes, handles, &mut req)?;
3233                        let control_handle =
3234                            FactoryResetControlHandle { inner: this.inner.clone() };
3235                        Ok(FactoryResetRequest::Set {
3236                            settings: req.settings,
3237
3238                            responder: FactoryResetSetResponder {
3239                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3240                                tx_id: header.tx_id,
3241                            },
3242                        })
3243                    }
3244                    _ => Err(fidl::Error::UnknownOrdinal {
3245                        ordinal: header.ordinal,
3246                        protocol_name:
3247                            <FactoryResetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3248                    }),
3249                }))
3250            },
3251        )
3252    }
3253}
3254
3255/// Settings related to factory reset.
3256#[derive(Debug)]
3257pub enum FactoryResetRequest {
3258    /// Notifies of a change in information about the factory reset settings.
3259    ///
3260    /// On a given connection, the first call will return the current `settings`
3261    /// value while subsequent calls will only return the new `settings` value
3262    /// upon a value change. This follows the hanging get pattern.
3263    ///
3264    /// If this call fails, it is considered a fatal error and the channel will
3265    /// be closed.
3266    Watch { responder: FactoryResetWatchResponder },
3267    /// Sets factory reset settings. Any field not explicitly set in the table
3268    /// performs a no-op, and will not make any changes.
3269    Set { settings: FactoryResetSettings, responder: FactoryResetSetResponder },
3270}
3271
3272impl FactoryResetRequest {
3273    #[allow(irrefutable_let_patterns)]
3274    pub fn into_watch(self) -> Option<(FactoryResetWatchResponder)> {
3275        if let FactoryResetRequest::Watch { responder } = self { Some((responder)) } else { None }
3276    }
3277
3278    #[allow(irrefutable_let_patterns)]
3279    pub fn into_set(self) -> Option<(FactoryResetSettings, FactoryResetSetResponder)> {
3280        if let FactoryResetRequest::Set { settings, responder } = self {
3281            Some((settings, responder))
3282        } else {
3283            None
3284        }
3285    }
3286
3287    /// Name of the method defined in FIDL
3288    pub fn method_name(&self) -> &'static str {
3289        match *self {
3290            FactoryResetRequest::Watch { .. } => "watch",
3291            FactoryResetRequest::Set { .. } => "set",
3292        }
3293    }
3294}
3295
3296#[derive(Debug, Clone)]
3297pub struct FactoryResetControlHandle {
3298    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3299}
3300
3301impl fidl::endpoints::ControlHandle for FactoryResetControlHandle {
3302    fn shutdown(&self) {
3303        self.inner.shutdown()
3304    }
3305
3306    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3307        self.inner.shutdown_with_epitaph(status)
3308    }
3309
3310    fn is_closed(&self) -> bool {
3311        self.inner.channel().is_closed()
3312    }
3313    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3314        self.inner.channel().on_closed()
3315    }
3316
3317    #[cfg(target_os = "fuchsia")]
3318    fn signal_peer(
3319        &self,
3320        clear_mask: zx::Signals,
3321        set_mask: zx::Signals,
3322    ) -> Result<(), zx_status::Status> {
3323        use fidl::Peered;
3324        self.inner.channel().signal_peer(clear_mask, set_mask)
3325    }
3326}
3327
3328impl FactoryResetControlHandle {}
3329
3330#[must_use = "FIDL methods require a response to be sent"]
3331#[derive(Debug)]
3332pub struct FactoryResetWatchResponder {
3333    control_handle: std::mem::ManuallyDrop<FactoryResetControlHandle>,
3334    tx_id: u32,
3335}
3336
3337/// Set the the channel to be shutdown (see [`FactoryResetControlHandle::shutdown`])
3338/// if the responder is dropped without sending a response, so that the client
3339/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3340impl std::ops::Drop for FactoryResetWatchResponder {
3341    fn drop(&mut self) {
3342        self.control_handle.shutdown();
3343        // Safety: drops once, never accessed again
3344        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3345    }
3346}
3347
3348impl fidl::endpoints::Responder for FactoryResetWatchResponder {
3349    type ControlHandle = FactoryResetControlHandle;
3350
3351    fn control_handle(&self) -> &FactoryResetControlHandle {
3352        &self.control_handle
3353    }
3354
3355    fn drop_without_shutdown(mut self) {
3356        // Safety: drops once, never accessed again due to mem::forget
3357        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3358        // Prevent Drop from running (which would shut down the channel)
3359        std::mem::forget(self);
3360    }
3361}
3362
3363impl FactoryResetWatchResponder {
3364    /// Sends a response to the FIDL transaction.
3365    ///
3366    /// Sets the channel to shutdown if an error occurs.
3367    pub fn send(self, mut settings: &FactoryResetSettings) -> Result<(), fidl::Error> {
3368        let _result = self.send_raw(settings);
3369        if _result.is_err() {
3370            self.control_handle.shutdown();
3371        }
3372        self.drop_without_shutdown();
3373        _result
3374    }
3375
3376    /// Similar to "send" but does not shutdown the channel if an error occurs.
3377    pub fn send_no_shutdown_on_err(
3378        self,
3379        mut settings: &FactoryResetSettings,
3380    ) -> Result<(), fidl::Error> {
3381        let _result = self.send_raw(settings);
3382        self.drop_without_shutdown();
3383        _result
3384    }
3385
3386    fn send_raw(&self, mut settings: &FactoryResetSettings) -> Result<(), fidl::Error> {
3387        self.control_handle.inner.send::<FactoryResetWatchResponse>(
3388            (settings,),
3389            self.tx_id,
3390            0x50cfc9906eb406a1,
3391            fidl::encoding::DynamicFlags::empty(),
3392        )
3393    }
3394}
3395
3396#[must_use = "FIDL methods require a response to be sent"]
3397#[derive(Debug)]
3398pub struct FactoryResetSetResponder {
3399    control_handle: std::mem::ManuallyDrop<FactoryResetControlHandle>,
3400    tx_id: u32,
3401}
3402
3403/// Set the the channel to be shutdown (see [`FactoryResetControlHandle::shutdown`])
3404/// if the responder is dropped without sending a response, so that the client
3405/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3406impl std::ops::Drop for FactoryResetSetResponder {
3407    fn drop(&mut self) {
3408        self.control_handle.shutdown();
3409        // Safety: drops once, never accessed again
3410        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3411    }
3412}
3413
3414impl fidl::endpoints::Responder for FactoryResetSetResponder {
3415    type ControlHandle = FactoryResetControlHandle;
3416
3417    fn control_handle(&self) -> &FactoryResetControlHandle {
3418        &self.control_handle
3419    }
3420
3421    fn drop_without_shutdown(mut self) {
3422        // Safety: drops once, never accessed again due to mem::forget
3423        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3424        // Prevent Drop from running (which would shut down the channel)
3425        std::mem::forget(self);
3426    }
3427}
3428
3429impl FactoryResetSetResponder {
3430    /// Sends a response to the FIDL transaction.
3431    ///
3432    /// Sets the channel to shutdown if an error occurs.
3433    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3434        let _result = self.send_raw(result);
3435        if _result.is_err() {
3436            self.control_handle.shutdown();
3437        }
3438        self.drop_without_shutdown();
3439        _result
3440    }
3441
3442    /// Similar to "send" but does not shutdown the channel if an error occurs.
3443    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3444        let _result = self.send_raw(result);
3445        self.drop_without_shutdown();
3446        _result
3447    }
3448
3449    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3450        self.control_handle
3451            .inner
3452            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3453                result,
3454                self.tx_id,
3455                0x5b35942c1cb1eca8,
3456                fidl::encoding::DynamicFlags::empty(),
3457            )
3458    }
3459}
3460
3461#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3462pub struct InputMarker;
3463
3464impl fidl::endpoints::ProtocolMarker for InputMarker {
3465    type Proxy = InputProxy;
3466    type RequestStream = InputRequestStream;
3467    #[cfg(target_os = "fuchsia")]
3468    type SynchronousProxy = InputSynchronousProxy;
3469
3470    const DEBUG_NAME: &'static str = "fuchsia.settings.Input";
3471}
3472impl fidl::endpoints::DiscoverableProtocolMarker for InputMarker {}
3473pub type InputSetResult = Result<(), Error>;
3474
3475pub trait InputProxyInterface: Send + Sync {
3476    type WatchResponseFut: std::future::Future<Output = Result<InputSettings, fidl::Error>> + Send;
3477    fn r#watch(&self) -> Self::WatchResponseFut;
3478    type SetResponseFut: std::future::Future<Output = Result<InputSetResult, fidl::Error>> + Send;
3479    fn r#set(&self, input_states: &[InputState]) -> Self::SetResponseFut;
3480}
3481#[derive(Debug)]
3482#[cfg(target_os = "fuchsia")]
3483pub struct InputSynchronousProxy {
3484    client: fidl::client::sync::Client,
3485}
3486
3487#[cfg(target_os = "fuchsia")]
3488impl fidl::endpoints::SynchronousProxy for InputSynchronousProxy {
3489    type Proxy = InputProxy;
3490    type Protocol = InputMarker;
3491
3492    fn from_channel(inner: fidl::Channel) -> Self {
3493        Self::new(inner)
3494    }
3495
3496    fn into_channel(self) -> fidl::Channel {
3497        self.client.into_channel()
3498    }
3499
3500    fn as_channel(&self) -> &fidl::Channel {
3501        self.client.as_channel()
3502    }
3503}
3504
3505#[cfg(target_os = "fuchsia")]
3506impl InputSynchronousProxy {
3507    pub fn new(channel: fidl::Channel) -> Self {
3508        Self { client: fidl::client::sync::Client::new(channel) }
3509    }
3510
3511    pub fn into_channel(self) -> fidl::Channel {
3512        self.client.into_channel()
3513    }
3514
3515    /// Waits until an event arrives and returns it. It is safe for other
3516    /// threads to make concurrent requests while waiting for an event.
3517    pub fn wait_for_event(
3518        &self,
3519        deadline: zx::MonotonicInstant,
3520    ) -> Result<InputEvent, fidl::Error> {
3521        InputEvent::decode(self.client.wait_for_event::<InputMarker>(deadline)?)
3522    }
3523
3524    /// Gets the current |InputSettings|. Returns immediately on first call;
3525    /// subsequent calls return when the value changes.
3526    ///
3527    /// When any of the input devices' states change, this will return the
3528    /// full [InputSettings] object, containing the states for all the
3529    /// available input devices on the target device.
3530    ///
3531    /// To find the state of a specific input device, the devices vector
3532    /// contained in settings can be iterated through to find a specific
3533    /// [DeviceType]. If there are multiple devices of the same [DeviceType],
3534    /// the [InputDevice]'s device_name can be examined in conjunction with
3535    /// the [DeviceType] to find the desired input device. Together, the
3536    /// device_name and [DeviceType] uniquely identify an [InputDevice].
3537    ///
3538    /// If this call fails, it is considered a fatal error and the channel
3539    /// will be closed.
3540    pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<InputSettings, fidl::Error> {
3541        let _response = self
3542            .client
3543            .send_query::<fidl::encoding::EmptyPayload, InputWatchResponse, InputMarker>(
3544                (),
3545                0x1bc41a7e0edd19c9,
3546                fidl::encoding::DynamicFlags::empty(),
3547                ___deadline,
3548            )?;
3549        Ok(_response.settings)
3550    }
3551
3552    /// Requests software input devices to set their software state. May
3553    /// not necessarily change the overall state of the device, depending on
3554    /// the hardware state. Will modify the software state of the existing
3555    /// device if a known device_name and device_type are passed. Otherwise
3556    /// it will add a new input device. Devices not included in input_states
3557    /// will not be modified.
3558    pub fn r#set(
3559        &self,
3560        mut input_states: &[InputState],
3561        ___deadline: zx::MonotonicInstant,
3562    ) -> Result<InputSetResult, fidl::Error> {
3563        let _response = self.client.send_query::<InputSetRequest, fidl::encoding::ResultType<
3564            fidl::encoding::EmptyStruct,
3565            Error,
3566        >, InputMarker>(
3567            (input_states,),
3568            0x2447379e693141ca,
3569            fidl::encoding::DynamicFlags::empty(),
3570            ___deadline,
3571        )?;
3572        Ok(_response.map(|x| x))
3573    }
3574}
3575
3576#[cfg(target_os = "fuchsia")]
3577impl From<InputSynchronousProxy> for zx::NullableHandle {
3578    fn from(value: InputSynchronousProxy) -> Self {
3579        value.into_channel().into()
3580    }
3581}
3582
3583#[cfg(target_os = "fuchsia")]
3584impl From<fidl::Channel> for InputSynchronousProxy {
3585    fn from(value: fidl::Channel) -> Self {
3586        Self::new(value)
3587    }
3588}
3589
3590#[cfg(target_os = "fuchsia")]
3591impl fidl::endpoints::FromClient for InputSynchronousProxy {
3592    type Protocol = InputMarker;
3593
3594    fn from_client(value: fidl::endpoints::ClientEnd<InputMarker>) -> Self {
3595        Self::new(value.into_channel())
3596    }
3597}
3598
3599#[derive(Debug, Clone)]
3600pub struct InputProxy {
3601    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3602}
3603
3604impl fidl::endpoints::Proxy for InputProxy {
3605    type Protocol = InputMarker;
3606
3607    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3608        Self::new(inner)
3609    }
3610
3611    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3612        self.client.into_channel().map_err(|client| Self { client })
3613    }
3614
3615    fn as_channel(&self) -> &::fidl::AsyncChannel {
3616        self.client.as_channel()
3617    }
3618}
3619
3620impl InputProxy {
3621    /// Create a new Proxy for fuchsia.settings/Input.
3622    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3623        let protocol_name = <InputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3624        Self { client: fidl::client::Client::new(channel, protocol_name) }
3625    }
3626
3627    /// Get a Stream of events from the remote end of the protocol.
3628    ///
3629    /// # Panics
3630    ///
3631    /// Panics if the event stream was already taken.
3632    pub fn take_event_stream(&self) -> InputEventStream {
3633        InputEventStream { event_receiver: self.client.take_event_receiver() }
3634    }
3635
3636    /// Gets the current |InputSettings|. Returns immediately on first call;
3637    /// subsequent calls return when the value changes.
3638    ///
3639    /// When any of the input devices' states change, this will return the
3640    /// full [InputSettings] object, containing the states for all the
3641    /// available input devices on the target device.
3642    ///
3643    /// To find the state of a specific input device, the devices vector
3644    /// contained in settings can be iterated through to find a specific
3645    /// [DeviceType]. If there are multiple devices of the same [DeviceType],
3646    /// the [InputDevice]'s device_name can be examined in conjunction with
3647    /// the [DeviceType] to find the desired input device. Together, the
3648    /// device_name and [DeviceType] uniquely identify an [InputDevice].
3649    ///
3650    /// If this call fails, it is considered a fatal error and the channel
3651    /// will be closed.
3652    pub fn r#watch(
3653        &self,
3654    ) -> fidl::client::QueryResponseFut<InputSettings, fidl::encoding::DefaultFuchsiaResourceDialect>
3655    {
3656        InputProxyInterface::r#watch(self)
3657    }
3658
3659    /// Requests software input devices to set their software state. May
3660    /// not necessarily change the overall state of the device, depending on
3661    /// the hardware state. Will modify the software state of the existing
3662    /// device if a known device_name and device_type are passed. Otherwise
3663    /// it will add a new input device. Devices not included in input_states
3664    /// will not be modified.
3665    pub fn r#set(
3666        &self,
3667        mut input_states: &[InputState],
3668    ) -> fidl::client::QueryResponseFut<InputSetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
3669    {
3670        InputProxyInterface::r#set(self, input_states)
3671    }
3672}
3673
3674impl InputProxyInterface for InputProxy {
3675    type WatchResponseFut = fidl::client::QueryResponseFut<
3676        InputSettings,
3677        fidl::encoding::DefaultFuchsiaResourceDialect,
3678    >;
3679    fn r#watch(&self) -> Self::WatchResponseFut {
3680        fn _decode(
3681            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3682        ) -> Result<InputSettings, fidl::Error> {
3683            let _response = fidl::client::decode_transaction_body::<
3684                InputWatchResponse,
3685                fidl::encoding::DefaultFuchsiaResourceDialect,
3686                0x1bc41a7e0edd19c9,
3687            >(_buf?)?;
3688            Ok(_response.settings)
3689        }
3690        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InputSettings>(
3691            (),
3692            0x1bc41a7e0edd19c9,
3693            fidl::encoding::DynamicFlags::empty(),
3694            _decode,
3695        )
3696    }
3697
3698    type SetResponseFut = fidl::client::QueryResponseFut<
3699        InputSetResult,
3700        fidl::encoding::DefaultFuchsiaResourceDialect,
3701    >;
3702    fn r#set(&self, mut input_states: &[InputState]) -> Self::SetResponseFut {
3703        fn _decode(
3704            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3705        ) -> Result<InputSetResult, fidl::Error> {
3706            let _response = fidl::client::decode_transaction_body::<
3707                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
3708                fidl::encoding::DefaultFuchsiaResourceDialect,
3709                0x2447379e693141ca,
3710            >(_buf?)?;
3711            Ok(_response.map(|x| x))
3712        }
3713        self.client.send_query_and_decode::<InputSetRequest, InputSetResult>(
3714            (input_states,),
3715            0x2447379e693141ca,
3716            fidl::encoding::DynamicFlags::empty(),
3717            _decode,
3718        )
3719    }
3720}
3721
3722pub struct InputEventStream {
3723    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3724}
3725
3726impl std::marker::Unpin for InputEventStream {}
3727
3728impl futures::stream::FusedStream for InputEventStream {
3729    fn is_terminated(&self) -> bool {
3730        self.event_receiver.is_terminated()
3731    }
3732}
3733
3734impl futures::Stream for InputEventStream {
3735    type Item = Result<InputEvent, fidl::Error>;
3736
3737    fn poll_next(
3738        mut self: std::pin::Pin<&mut Self>,
3739        cx: &mut std::task::Context<'_>,
3740    ) -> std::task::Poll<Option<Self::Item>> {
3741        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3742            &mut self.event_receiver,
3743            cx
3744        )?) {
3745            Some(buf) => std::task::Poll::Ready(Some(InputEvent::decode(buf))),
3746            None => std::task::Poll::Ready(None),
3747        }
3748    }
3749}
3750
3751#[derive(Debug)]
3752pub enum InputEvent {}
3753
3754impl InputEvent {
3755    /// Decodes a message buffer as a [`InputEvent`].
3756    fn decode(
3757        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3758    ) -> Result<InputEvent, fidl::Error> {
3759        let (bytes, _handles) = buf.split_mut();
3760        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3761        debug_assert_eq!(tx_header.tx_id, 0);
3762        match tx_header.ordinal {
3763            _ => Err(fidl::Error::UnknownOrdinal {
3764                ordinal: tx_header.ordinal,
3765                protocol_name: <InputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3766            }),
3767        }
3768    }
3769}
3770
3771/// A Stream of incoming requests for fuchsia.settings/Input.
3772pub struct InputRequestStream {
3773    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3774    is_terminated: bool,
3775}
3776
3777impl std::marker::Unpin for InputRequestStream {}
3778
3779impl futures::stream::FusedStream for InputRequestStream {
3780    fn is_terminated(&self) -> bool {
3781        self.is_terminated
3782    }
3783}
3784
3785impl fidl::endpoints::RequestStream for InputRequestStream {
3786    type Protocol = InputMarker;
3787    type ControlHandle = InputControlHandle;
3788
3789    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3790        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3791    }
3792
3793    fn control_handle(&self) -> Self::ControlHandle {
3794        InputControlHandle { inner: self.inner.clone() }
3795    }
3796
3797    fn into_inner(
3798        self,
3799    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3800    {
3801        (self.inner, self.is_terminated)
3802    }
3803
3804    fn from_inner(
3805        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3806        is_terminated: bool,
3807    ) -> Self {
3808        Self { inner, is_terminated }
3809    }
3810}
3811
3812impl futures::Stream for InputRequestStream {
3813    type Item = Result<InputRequest, fidl::Error>;
3814
3815    fn poll_next(
3816        mut self: std::pin::Pin<&mut Self>,
3817        cx: &mut std::task::Context<'_>,
3818    ) -> std::task::Poll<Option<Self::Item>> {
3819        let this = &mut *self;
3820        if this.inner.check_shutdown(cx) {
3821            this.is_terminated = true;
3822            return std::task::Poll::Ready(None);
3823        }
3824        if this.is_terminated {
3825            panic!("polled InputRequestStream after completion");
3826        }
3827        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3828            |bytes, handles| {
3829                match this.inner.channel().read_etc(cx, bytes, handles) {
3830                    std::task::Poll::Ready(Ok(())) => {}
3831                    std::task::Poll::Pending => return std::task::Poll::Pending,
3832                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3833                        this.is_terminated = true;
3834                        return std::task::Poll::Ready(None);
3835                    }
3836                    std::task::Poll::Ready(Err(e)) => {
3837                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3838                            e.into(),
3839                        ))));
3840                    }
3841                }
3842
3843                // A message has been received from the channel
3844                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3845
3846                std::task::Poll::Ready(Some(match header.ordinal {
3847                    0x1bc41a7e0edd19c9 => {
3848                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3849                        let mut req = fidl::new_empty!(
3850                            fidl::encoding::EmptyPayload,
3851                            fidl::encoding::DefaultFuchsiaResourceDialect
3852                        );
3853                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3854                        let control_handle = InputControlHandle { inner: this.inner.clone() };
3855                        Ok(InputRequest::Watch {
3856                            responder: InputWatchResponder {
3857                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3858                                tx_id: header.tx_id,
3859                            },
3860                        })
3861                    }
3862                    0x2447379e693141ca => {
3863                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3864                        let mut req = fidl::new_empty!(
3865                            InputSetRequest,
3866                            fidl::encoding::DefaultFuchsiaResourceDialect
3867                        );
3868                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputSetRequest>(&header, _body_bytes, handles, &mut req)?;
3869                        let control_handle = InputControlHandle { inner: this.inner.clone() };
3870                        Ok(InputRequest::Set {
3871                            input_states: req.input_states,
3872
3873                            responder: InputSetResponder {
3874                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3875                                tx_id: header.tx_id,
3876                            },
3877                        })
3878                    }
3879                    _ => Err(fidl::Error::UnknownOrdinal {
3880                        ordinal: header.ordinal,
3881                        protocol_name: <InputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3882                    }),
3883                }))
3884            },
3885        )
3886    }
3887}
3888
3889/// Settings related to input to the device.
3890///
3891/// Supported SettingsEpitaph enums:
3892/// REQUEST_NOT_SUPPORTED, INTERNAL_SERVICE_ERROR, PERSISTENT_STORAGE_ERROR
3893#[derive(Debug)]
3894pub enum InputRequest {
3895    /// Gets the current |InputSettings|. Returns immediately on first call;
3896    /// subsequent calls return when the value changes.
3897    ///
3898    /// When any of the input devices' states change, this will return the
3899    /// full [InputSettings] object, containing the states for all the
3900    /// available input devices on the target device.
3901    ///
3902    /// To find the state of a specific input device, the devices vector
3903    /// contained in settings can be iterated through to find a specific
3904    /// [DeviceType]. If there are multiple devices of the same [DeviceType],
3905    /// the [InputDevice]'s device_name can be examined in conjunction with
3906    /// the [DeviceType] to find the desired input device. Together, the
3907    /// device_name and [DeviceType] uniquely identify an [InputDevice].
3908    ///
3909    /// If this call fails, it is considered a fatal error and the channel
3910    /// will be closed.
3911    Watch { responder: InputWatchResponder },
3912    /// Requests software input devices to set their software state. May
3913    /// not necessarily change the overall state of the device, depending on
3914    /// the hardware state. Will modify the software state of the existing
3915    /// device if a known device_name and device_type are passed. Otherwise
3916    /// it will add a new input device. Devices not included in input_states
3917    /// will not be modified.
3918    Set { input_states: Vec<InputState>, responder: InputSetResponder },
3919}
3920
3921impl InputRequest {
3922    #[allow(irrefutable_let_patterns)]
3923    pub fn into_watch(self) -> Option<(InputWatchResponder)> {
3924        if let InputRequest::Watch { responder } = self { Some((responder)) } else { None }
3925    }
3926
3927    #[allow(irrefutable_let_patterns)]
3928    pub fn into_set(self) -> Option<(Vec<InputState>, InputSetResponder)> {
3929        if let InputRequest::Set { input_states, responder } = self {
3930            Some((input_states, responder))
3931        } else {
3932            None
3933        }
3934    }
3935
3936    /// Name of the method defined in FIDL
3937    pub fn method_name(&self) -> &'static str {
3938        match *self {
3939            InputRequest::Watch { .. } => "watch",
3940            InputRequest::Set { .. } => "set",
3941        }
3942    }
3943}
3944
3945#[derive(Debug, Clone)]
3946pub struct InputControlHandle {
3947    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3948}
3949
3950impl fidl::endpoints::ControlHandle for InputControlHandle {
3951    fn shutdown(&self) {
3952        self.inner.shutdown()
3953    }
3954
3955    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3956        self.inner.shutdown_with_epitaph(status)
3957    }
3958
3959    fn is_closed(&self) -> bool {
3960        self.inner.channel().is_closed()
3961    }
3962    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3963        self.inner.channel().on_closed()
3964    }
3965
3966    #[cfg(target_os = "fuchsia")]
3967    fn signal_peer(
3968        &self,
3969        clear_mask: zx::Signals,
3970        set_mask: zx::Signals,
3971    ) -> Result<(), zx_status::Status> {
3972        use fidl::Peered;
3973        self.inner.channel().signal_peer(clear_mask, set_mask)
3974    }
3975}
3976
3977impl InputControlHandle {}
3978
3979#[must_use = "FIDL methods require a response to be sent"]
3980#[derive(Debug)]
3981pub struct InputWatchResponder {
3982    control_handle: std::mem::ManuallyDrop<InputControlHandle>,
3983    tx_id: u32,
3984}
3985
3986/// Set the the channel to be shutdown (see [`InputControlHandle::shutdown`])
3987/// if the responder is dropped without sending a response, so that the client
3988/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3989impl std::ops::Drop for InputWatchResponder {
3990    fn drop(&mut self) {
3991        self.control_handle.shutdown();
3992        // Safety: drops once, never accessed again
3993        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3994    }
3995}
3996
3997impl fidl::endpoints::Responder for InputWatchResponder {
3998    type ControlHandle = InputControlHandle;
3999
4000    fn control_handle(&self) -> &InputControlHandle {
4001        &self.control_handle
4002    }
4003
4004    fn drop_without_shutdown(mut self) {
4005        // Safety: drops once, never accessed again due to mem::forget
4006        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4007        // Prevent Drop from running (which would shut down the channel)
4008        std::mem::forget(self);
4009    }
4010}
4011
4012impl InputWatchResponder {
4013    /// Sends a response to the FIDL transaction.
4014    ///
4015    /// Sets the channel to shutdown if an error occurs.
4016    pub fn send(self, mut settings: &InputSettings) -> Result<(), fidl::Error> {
4017        let _result = self.send_raw(settings);
4018        if _result.is_err() {
4019            self.control_handle.shutdown();
4020        }
4021        self.drop_without_shutdown();
4022        _result
4023    }
4024
4025    /// Similar to "send" but does not shutdown the channel if an error occurs.
4026    pub fn send_no_shutdown_on_err(self, mut settings: &InputSettings) -> Result<(), fidl::Error> {
4027        let _result = self.send_raw(settings);
4028        self.drop_without_shutdown();
4029        _result
4030    }
4031
4032    fn send_raw(&self, mut settings: &InputSettings) -> Result<(), fidl::Error> {
4033        self.control_handle.inner.send::<InputWatchResponse>(
4034            (settings,),
4035            self.tx_id,
4036            0x1bc41a7e0edd19c9,
4037            fidl::encoding::DynamicFlags::empty(),
4038        )
4039    }
4040}
4041
4042#[must_use = "FIDL methods require a response to be sent"]
4043#[derive(Debug)]
4044pub struct InputSetResponder {
4045    control_handle: std::mem::ManuallyDrop<InputControlHandle>,
4046    tx_id: u32,
4047}
4048
4049/// Set the the channel to be shutdown (see [`InputControlHandle::shutdown`])
4050/// if the responder is dropped without sending a response, so that the client
4051/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4052impl std::ops::Drop for InputSetResponder {
4053    fn drop(&mut self) {
4054        self.control_handle.shutdown();
4055        // Safety: drops once, never accessed again
4056        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4057    }
4058}
4059
4060impl fidl::endpoints::Responder for InputSetResponder {
4061    type ControlHandle = InputControlHandle;
4062
4063    fn control_handle(&self) -> &InputControlHandle {
4064        &self.control_handle
4065    }
4066
4067    fn drop_without_shutdown(mut self) {
4068        // Safety: drops once, never accessed again due to mem::forget
4069        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4070        // Prevent Drop from running (which would shut down the channel)
4071        std::mem::forget(self);
4072    }
4073}
4074
4075impl InputSetResponder {
4076    /// Sends a response to the FIDL transaction.
4077    ///
4078    /// Sets the channel to shutdown if an error occurs.
4079    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4080        let _result = self.send_raw(result);
4081        if _result.is_err() {
4082            self.control_handle.shutdown();
4083        }
4084        self.drop_without_shutdown();
4085        _result
4086    }
4087
4088    /// Similar to "send" but does not shutdown the channel if an error occurs.
4089    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4090        let _result = self.send_raw(result);
4091        self.drop_without_shutdown();
4092        _result
4093    }
4094
4095    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4096        self.control_handle
4097            .inner
4098            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
4099                result,
4100                self.tx_id,
4101                0x2447379e693141ca,
4102                fidl::encoding::DynamicFlags::empty(),
4103            )
4104    }
4105}
4106
4107#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4108pub struct IntlMarker;
4109
4110impl fidl::endpoints::ProtocolMarker for IntlMarker {
4111    type Proxy = IntlProxy;
4112    type RequestStream = IntlRequestStream;
4113    #[cfg(target_os = "fuchsia")]
4114    type SynchronousProxy = IntlSynchronousProxy;
4115
4116    const DEBUG_NAME: &'static str = "fuchsia.settings.Intl";
4117}
4118impl fidl::endpoints::DiscoverableProtocolMarker for IntlMarker {}
4119pub type IntlSetResult = Result<(), Error>;
4120
4121pub trait IntlProxyInterface: Send + Sync {
4122    type WatchResponseFut: std::future::Future<Output = Result<IntlSettings, fidl::Error>> + Send;
4123    fn r#watch(&self) -> Self::WatchResponseFut;
4124    type SetResponseFut: std::future::Future<Output = Result<IntlSetResult, fidl::Error>> + Send;
4125    fn r#set(&self, settings: &IntlSettings) -> Self::SetResponseFut;
4126}
4127#[derive(Debug)]
4128#[cfg(target_os = "fuchsia")]
4129pub struct IntlSynchronousProxy {
4130    client: fidl::client::sync::Client,
4131}
4132
4133#[cfg(target_os = "fuchsia")]
4134impl fidl::endpoints::SynchronousProxy for IntlSynchronousProxy {
4135    type Proxy = IntlProxy;
4136    type Protocol = IntlMarker;
4137
4138    fn from_channel(inner: fidl::Channel) -> Self {
4139        Self::new(inner)
4140    }
4141
4142    fn into_channel(self) -> fidl::Channel {
4143        self.client.into_channel()
4144    }
4145
4146    fn as_channel(&self) -> &fidl::Channel {
4147        self.client.as_channel()
4148    }
4149}
4150
4151#[cfg(target_os = "fuchsia")]
4152impl IntlSynchronousProxy {
4153    pub fn new(channel: fidl::Channel) -> Self {
4154        Self { client: fidl::client::sync::Client::new(channel) }
4155    }
4156
4157    pub fn into_channel(self) -> fidl::Channel {
4158        self.client.into_channel()
4159    }
4160
4161    /// Waits until an event arrives and returns it. It is safe for other
4162    /// threads to make concurrent requests while waiting for an event.
4163    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<IntlEvent, fidl::Error> {
4164        IntlEvent::decode(self.client.wait_for_event::<IntlMarker>(deadline)?)
4165    }
4166
4167    /// Gets the current [IntlSettings]. Returns immediately on first call;
4168    /// subsequent calls return when the value changes.
4169    ///
4170    /// If this call fails, it is considered a fatal error and the channel
4171    /// will be closed.
4172    pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<IntlSettings, fidl::Error> {
4173        let _response =
4174            self.client.send_query::<fidl::encoding::EmptyPayload, IntlWatchResponse, IntlMarker>(
4175                (),
4176                0x3c85d6b8a85ab6e3,
4177                fidl::encoding::DynamicFlags::empty(),
4178                ___deadline,
4179            )?;
4180        Ok(_response.settings)
4181    }
4182
4183    /// Sets [IntlSettings] settings. Any field not explicitly set in the table performs a
4184    /// no-op, and will not make any changes.
4185    pub fn r#set(
4186        &self,
4187        mut settings: &IntlSettings,
4188        ___deadline: zx::MonotonicInstant,
4189    ) -> Result<IntlSetResult, fidl::Error> {
4190        let _response = self.client.send_query::<IntlSetRequest, fidl::encoding::ResultType<
4191            fidl::encoding::EmptyStruct,
4192            Error,
4193        >, IntlMarker>(
4194            (settings,),
4195            0x273014eb4d880c5a,
4196            fidl::encoding::DynamicFlags::empty(),
4197            ___deadline,
4198        )?;
4199        Ok(_response.map(|x| x))
4200    }
4201}
4202
4203#[cfg(target_os = "fuchsia")]
4204impl From<IntlSynchronousProxy> for zx::NullableHandle {
4205    fn from(value: IntlSynchronousProxy) -> Self {
4206        value.into_channel().into()
4207    }
4208}
4209
4210#[cfg(target_os = "fuchsia")]
4211impl From<fidl::Channel> for IntlSynchronousProxy {
4212    fn from(value: fidl::Channel) -> Self {
4213        Self::new(value)
4214    }
4215}
4216
4217#[cfg(target_os = "fuchsia")]
4218impl fidl::endpoints::FromClient for IntlSynchronousProxy {
4219    type Protocol = IntlMarker;
4220
4221    fn from_client(value: fidl::endpoints::ClientEnd<IntlMarker>) -> Self {
4222        Self::new(value.into_channel())
4223    }
4224}
4225
4226#[derive(Debug, Clone)]
4227pub struct IntlProxy {
4228    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4229}
4230
4231impl fidl::endpoints::Proxy for IntlProxy {
4232    type Protocol = IntlMarker;
4233
4234    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4235        Self::new(inner)
4236    }
4237
4238    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4239        self.client.into_channel().map_err(|client| Self { client })
4240    }
4241
4242    fn as_channel(&self) -> &::fidl::AsyncChannel {
4243        self.client.as_channel()
4244    }
4245}
4246
4247impl IntlProxy {
4248    /// Create a new Proxy for fuchsia.settings/Intl.
4249    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4250        let protocol_name = <IntlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4251        Self { client: fidl::client::Client::new(channel, protocol_name) }
4252    }
4253
4254    /// Get a Stream of events from the remote end of the protocol.
4255    ///
4256    /// # Panics
4257    ///
4258    /// Panics if the event stream was already taken.
4259    pub fn take_event_stream(&self) -> IntlEventStream {
4260        IntlEventStream { event_receiver: self.client.take_event_receiver() }
4261    }
4262
4263    /// Gets the current [IntlSettings]. Returns immediately on first call;
4264    /// subsequent calls return when the value changes.
4265    ///
4266    /// If this call fails, it is considered a fatal error and the channel
4267    /// will be closed.
4268    pub fn r#watch(
4269        &self,
4270    ) -> fidl::client::QueryResponseFut<IntlSettings, fidl::encoding::DefaultFuchsiaResourceDialect>
4271    {
4272        IntlProxyInterface::r#watch(self)
4273    }
4274
4275    /// Sets [IntlSettings] settings. Any field not explicitly set in the table performs a
4276    /// no-op, and will not make any changes.
4277    pub fn r#set(
4278        &self,
4279        mut settings: &IntlSettings,
4280    ) -> fidl::client::QueryResponseFut<IntlSetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
4281    {
4282        IntlProxyInterface::r#set(self, settings)
4283    }
4284}
4285
4286impl IntlProxyInterface for IntlProxy {
4287    type WatchResponseFut =
4288        fidl::client::QueryResponseFut<IntlSettings, fidl::encoding::DefaultFuchsiaResourceDialect>;
4289    fn r#watch(&self) -> Self::WatchResponseFut {
4290        fn _decode(
4291            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4292        ) -> Result<IntlSettings, fidl::Error> {
4293            let _response = fidl::client::decode_transaction_body::<
4294                IntlWatchResponse,
4295                fidl::encoding::DefaultFuchsiaResourceDialect,
4296                0x3c85d6b8a85ab6e3,
4297            >(_buf?)?;
4298            Ok(_response.settings)
4299        }
4300        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, IntlSettings>(
4301            (),
4302            0x3c85d6b8a85ab6e3,
4303            fidl::encoding::DynamicFlags::empty(),
4304            _decode,
4305        )
4306    }
4307
4308    type SetResponseFut = fidl::client::QueryResponseFut<
4309        IntlSetResult,
4310        fidl::encoding::DefaultFuchsiaResourceDialect,
4311    >;
4312    fn r#set(&self, mut settings: &IntlSettings) -> Self::SetResponseFut {
4313        fn _decode(
4314            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4315        ) -> Result<IntlSetResult, fidl::Error> {
4316            let _response = fidl::client::decode_transaction_body::<
4317                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4318                fidl::encoding::DefaultFuchsiaResourceDialect,
4319                0x273014eb4d880c5a,
4320            >(_buf?)?;
4321            Ok(_response.map(|x| x))
4322        }
4323        self.client.send_query_and_decode::<IntlSetRequest, IntlSetResult>(
4324            (settings,),
4325            0x273014eb4d880c5a,
4326            fidl::encoding::DynamicFlags::empty(),
4327            _decode,
4328        )
4329    }
4330}
4331
4332pub struct IntlEventStream {
4333    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4334}
4335
4336impl std::marker::Unpin for IntlEventStream {}
4337
4338impl futures::stream::FusedStream for IntlEventStream {
4339    fn is_terminated(&self) -> bool {
4340        self.event_receiver.is_terminated()
4341    }
4342}
4343
4344impl futures::Stream for IntlEventStream {
4345    type Item = Result<IntlEvent, fidl::Error>;
4346
4347    fn poll_next(
4348        mut self: std::pin::Pin<&mut Self>,
4349        cx: &mut std::task::Context<'_>,
4350    ) -> std::task::Poll<Option<Self::Item>> {
4351        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4352            &mut self.event_receiver,
4353            cx
4354        )?) {
4355            Some(buf) => std::task::Poll::Ready(Some(IntlEvent::decode(buf))),
4356            None => std::task::Poll::Ready(None),
4357        }
4358    }
4359}
4360
4361#[derive(Debug)]
4362pub enum IntlEvent {}
4363
4364impl IntlEvent {
4365    /// Decodes a message buffer as a [`IntlEvent`].
4366    fn decode(
4367        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4368    ) -> Result<IntlEvent, fidl::Error> {
4369        let (bytes, _handles) = buf.split_mut();
4370        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4371        debug_assert_eq!(tx_header.tx_id, 0);
4372        match tx_header.ordinal {
4373            _ => Err(fidl::Error::UnknownOrdinal {
4374                ordinal: tx_header.ordinal,
4375                protocol_name: <IntlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4376            }),
4377        }
4378    }
4379}
4380
4381/// A Stream of incoming requests for fuchsia.settings/Intl.
4382pub struct IntlRequestStream {
4383    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4384    is_terminated: bool,
4385}
4386
4387impl std::marker::Unpin for IntlRequestStream {}
4388
4389impl futures::stream::FusedStream for IntlRequestStream {
4390    fn is_terminated(&self) -> bool {
4391        self.is_terminated
4392    }
4393}
4394
4395impl fidl::endpoints::RequestStream for IntlRequestStream {
4396    type Protocol = IntlMarker;
4397    type ControlHandle = IntlControlHandle;
4398
4399    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4400        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4401    }
4402
4403    fn control_handle(&self) -> Self::ControlHandle {
4404        IntlControlHandle { inner: self.inner.clone() }
4405    }
4406
4407    fn into_inner(
4408        self,
4409    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4410    {
4411        (self.inner, self.is_terminated)
4412    }
4413
4414    fn from_inner(
4415        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4416        is_terminated: bool,
4417    ) -> Self {
4418        Self { inner, is_terminated }
4419    }
4420}
4421
4422impl futures::Stream for IntlRequestStream {
4423    type Item = Result<IntlRequest, fidl::Error>;
4424
4425    fn poll_next(
4426        mut self: std::pin::Pin<&mut Self>,
4427        cx: &mut std::task::Context<'_>,
4428    ) -> std::task::Poll<Option<Self::Item>> {
4429        let this = &mut *self;
4430        if this.inner.check_shutdown(cx) {
4431            this.is_terminated = true;
4432            return std::task::Poll::Ready(None);
4433        }
4434        if this.is_terminated {
4435            panic!("polled IntlRequestStream after completion");
4436        }
4437        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4438            |bytes, handles| {
4439                match this.inner.channel().read_etc(cx, bytes, handles) {
4440                    std::task::Poll::Ready(Ok(())) => {}
4441                    std::task::Poll::Pending => return std::task::Poll::Pending,
4442                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4443                        this.is_terminated = true;
4444                        return std::task::Poll::Ready(None);
4445                    }
4446                    std::task::Poll::Ready(Err(e)) => {
4447                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4448                            e.into(),
4449                        ))));
4450                    }
4451                }
4452
4453                // A message has been received from the channel
4454                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4455
4456                std::task::Poll::Ready(Some(match header.ordinal {
4457                    0x3c85d6b8a85ab6e3 => {
4458                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4459                        let mut req = fidl::new_empty!(
4460                            fidl::encoding::EmptyPayload,
4461                            fidl::encoding::DefaultFuchsiaResourceDialect
4462                        );
4463                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4464                        let control_handle = IntlControlHandle { inner: this.inner.clone() };
4465                        Ok(IntlRequest::Watch {
4466                            responder: IntlWatchResponder {
4467                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4468                                tx_id: header.tx_id,
4469                            },
4470                        })
4471                    }
4472                    0x273014eb4d880c5a => {
4473                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4474                        let mut req = fidl::new_empty!(
4475                            IntlSetRequest,
4476                            fidl::encoding::DefaultFuchsiaResourceDialect
4477                        );
4478                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IntlSetRequest>(&header, _body_bytes, handles, &mut req)?;
4479                        let control_handle = IntlControlHandle { inner: this.inner.clone() };
4480                        Ok(IntlRequest::Set {
4481                            settings: req.settings,
4482
4483                            responder: IntlSetResponder {
4484                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4485                                tx_id: header.tx_id,
4486                            },
4487                        })
4488                    }
4489                    _ => Err(fidl::Error::UnknownOrdinal {
4490                        ordinal: header.ordinal,
4491                        protocol_name: <IntlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4492                    }),
4493                }))
4494            },
4495        )
4496    }
4497}
4498
4499/// Settings related to internationalization such as locale, time zone, and
4500/// temperature units.
4501///
4502/// Supported SettingsEpitaph enums:
4503/// REQUEST_NOT_SUPPORTED, INTERNAL_SERVICE_ERROR, PERSISTENT_STORAGE_ERROR,
4504/// FILE_READ_ERROR
4505#[derive(Debug)]
4506pub enum IntlRequest {
4507    /// Gets the current [IntlSettings]. Returns immediately on first call;
4508    /// subsequent calls return when the value changes.
4509    ///
4510    /// If this call fails, it is considered a fatal error and the channel
4511    /// will be closed.
4512    Watch { responder: IntlWatchResponder },
4513    /// Sets [IntlSettings] settings. Any field not explicitly set in the table performs a
4514    /// no-op, and will not make any changes.
4515    Set { settings: IntlSettings, responder: IntlSetResponder },
4516}
4517
4518impl IntlRequest {
4519    #[allow(irrefutable_let_patterns)]
4520    pub fn into_watch(self) -> Option<(IntlWatchResponder)> {
4521        if let IntlRequest::Watch { responder } = self { Some((responder)) } else { None }
4522    }
4523
4524    #[allow(irrefutable_let_patterns)]
4525    pub fn into_set(self) -> Option<(IntlSettings, IntlSetResponder)> {
4526        if let IntlRequest::Set { settings, responder } = self {
4527            Some((settings, responder))
4528        } else {
4529            None
4530        }
4531    }
4532
4533    /// Name of the method defined in FIDL
4534    pub fn method_name(&self) -> &'static str {
4535        match *self {
4536            IntlRequest::Watch { .. } => "watch",
4537            IntlRequest::Set { .. } => "set",
4538        }
4539    }
4540}
4541
4542#[derive(Debug, Clone)]
4543pub struct IntlControlHandle {
4544    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4545}
4546
4547impl fidl::endpoints::ControlHandle for IntlControlHandle {
4548    fn shutdown(&self) {
4549        self.inner.shutdown()
4550    }
4551
4552    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4553        self.inner.shutdown_with_epitaph(status)
4554    }
4555
4556    fn is_closed(&self) -> bool {
4557        self.inner.channel().is_closed()
4558    }
4559    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4560        self.inner.channel().on_closed()
4561    }
4562
4563    #[cfg(target_os = "fuchsia")]
4564    fn signal_peer(
4565        &self,
4566        clear_mask: zx::Signals,
4567        set_mask: zx::Signals,
4568    ) -> Result<(), zx_status::Status> {
4569        use fidl::Peered;
4570        self.inner.channel().signal_peer(clear_mask, set_mask)
4571    }
4572}
4573
4574impl IntlControlHandle {}
4575
4576#[must_use = "FIDL methods require a response to be sent"]
4577#[derive(Debug)]
4578pub struct IntlWatchResponder {
4579    control_handle: std::mem::ManuallyDrop<IntlControlHandle>,
4580    tx_id: u32,
4581}
4582
4583/// Set the the channel to be shutdown (see [`IntlControlHandle::shutdown`])
4584/// if the responder is dropped without sending a response, so that the client
4585/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4586impl std::ops::Drop for IntlWatchResponder {
4587    fn drop(&mut self) {
4588        self.control_handle.shutdown();
4589        // Safety: drops once, never accessed again
4590        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4591    }
4592}
4593
4594impl fidl::endpoints::Responder for IntlWatchResponder {
4595    type ControlHandle = IntlControlHandle;
4596
4597    fn control_handle(&self) -> &IntlControlHandle {
4598        &self.control_handle
4599    }
4600
4601    fn drop_without_shutdown(mut self) {
4602        // Safety: drops once, never accessed again due to mem::forget
4603        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4604        // Prevent Drop from running (which would shut down the channel)
4605        std::mem::forget(self);
4606    }
4607}
4608
4609impl IntlWatchResponder {
4610    /// Sends a response to the FIDL transaction.
4611    ///
4612    /// Sets the channel to shutdown if an error occurs.
4613    pub fn send(self, mut settings: &IntlSettings) -> Result<(), fidl::Error> {
4614        let _result = self.send_raw(settings);
4615        if _result.is_err() {
4616            self.control_handle.shutdown();
4617        }
4618        self.drop_without_shutdown();
4619        _result
4620    }
4621
4622    /// Similar to "send" but does not shutdown the channel if an error occurs.
4623    pub fn send_no_shutdown_on_err(self, mut settings: &IntlSettings) -> Result<(), fidl::Error> {
4624        let _result = self.send_raw(settings);
4625        self.drop_without_shutdown();
4626        _result
4627    }
4628
4629    fn send_raw(&self, mut settings: &IntlSettings) -> Result<(), fidl::Error> {
4630        self.control_handle.inner.send::<IntlWatchResponse>(
4631            (settings,),
4632            self.tx_id,
4633            0x3c85d6b8a85ab6e3,
4634            fidl::encoding::DynamicFlags::empty(),
4635        )
4636    }
4637}
4638
4639#[must_use = "FIDL methods require a response to be sent"]
4640#[derive(Debug)]
4641pub struct IntlSetResponder {
4642    control_handle: std::mem::ManuallyDrop<IntlControlHandle>,
4643    tx_id: u32,
4644}
4645
4646/// Set the the channel to be shutdown (see [`IntlControlHandle::shutdown`])
4647/// if the responder is dropped without sending a response, so that the client
4648/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4649impl std::ops::Drop for IntlSetResponder {
4650    fn drop(&mut self) {
4651        self.control_handle.shutdown();
4652        // Safety: drops once, never accessed again
4653        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4654    }
4655}
4656
4657impl fidl::endpoints::Responder for IntlSetResponder {
4658    type ControlHandle = IntlControlHandle;
4659
4660    fn control_handle(&self) -> &IntlControlHandle {
4661        &self.control_handle
4662    }
4663
4664    fn drop_without_shutdown(mut self) {
4665        // Safety: drops once, never accessed again due to mem::forget
4666        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4667        // Prevent Drop from running (which would shut down the channel)
4668        std::mem::forget(self);
4669    }
4670}
4671
4672impl IntlSetResponder {
4673    /// Sends a response to the FIDL transaction.
4674    ///
4675    /// Sets the channel to shutdown if an error occurs.
4676    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4677        let _result = self.send_raw(result);
4678        if _result.is_err() {
4679            self.control_handle.shutdown();
4680        }
4681        self.drop_without_shutdown();
4682        _result
4683    }
4684
4685    /// Similar to "send" but does not shutdown the channel if an error occurs.
4686    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4687        let _result = self.send_raw(result);
4688        self.drop_without_shutdown();
4689        _result
4690    }
4691
4692    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4693        self.control_handle
4694            .inner
4695            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
4696                result,
4697                self.tx_id,
4698                0x273014eb4d880c5a,
4699                fidl::encoding::DynamicFlags::empty(),
4700            )
4701    }
4702}
4703
4704#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4705pub struct KeyboardMarker;
4706
4707impl fidl::endpoints::ProtocolMarker for KeyboardMarker {
4708    type Proxy = KeyboardProxy;
4709    type RequestStream = KeyboardRequestStream;
4710    #[cfg(target_os = "fuchsia")]
4711    type SynchronousProxy = KeyboardSynchronousProxy;
4712
4713    const DEBUG_NAME: &'static str = "fuchsia.settings.Keyboard";
4714}
4715impl fidl::endpoints::DiscoverableProtocolMarker for KeyboardMarker {}
4716
4717pub trait KeyboardProxyInterface: Send + Sync {
4718    type SetResponseFut: std::future::Future<Output = Result<KeyboardSetSetResult, fidl::Error>>
4719        + Send;
4720    fn r#set(&self, settings: &KeyboardSettings) -> Self::SetResponseFut;
4721    type WatchResponseFut: std::future::Future<Output = Result<KeyboardSettings, fidl::Error>>
4722        + Send;
4723    fn r#watch(&self) -> Self::WatchResponseFut;
4724}
4725#[derive(Debug)]
4726#[cfg(target_os = "fuchsia")]
4727pub struct KeyboardSynchronousProxy {
4728    client: fidl::client::sync::Client,
4729}
4730
4731#[cfg(target_os = "fuchsia")]
4732impl fidl::endpoints::SynchronousProxy for KeyboardSynchronousProxy {
4733    type Proxy = KeyboardProxy;
4734    type Protocol = KeyboardMarker;
4735
4736    fn from_channel(inner: fidl::Channel) -> Self {
4737        Self::new(inner)
4738    }
4739
4740    fn into_channel(self) -> fidl::Channel {
4741        self.client.into_channel()
4742    }
4743
4744    fn as_channel(&self) -> &fidl::Channel {
4745        self.client.as_channel()
4746    }
4747}
4748
4749#[cfg(target_os = "fuchsia")]
4750impl KeyboardSynchronousProxy {
4751    pub fn new(channel: fidl::Channel) -> Self {
4752        Self { client: fidl::client::sync::Client::new(channel) }
4753    }
4754
4755    pub fn into_channel(self) -> fidl::Channel {
4756        self.client.into_channel()
4757    }
4758
4759    /// Waits until an event arrives and returns it. It is safe for other
4760    /// threads to make concurrent requests while waiting for an event.
4761    pub fn wait_for_event(
4762        &self,
4763        deadline: zx::MonotonicInstant,
4764    ) -> Result<KeyboardEvent, fidl::Error> {
4765        KeyboardEvent::decode(self.client.wait_for_event::<KeyboardMarker>(deadline)?)
4766    }
4767
4768    /// Setting protocol: if a field is left unset, it is not modified.
4769    /// To clear a field, set it to its type's "zero" value.
4770    pub fn r#set(
4771        &self,
4772        mut settings: &KeyboardSettings,
4773        ___deadline: zx::MonotonicInstant,
4774    ) -> Result<KeyboardSetSetResult, fidl::Error> {
4775        let _response = self.client.send_query::<
4776            KeyboardSetSetRequest,
4777            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4778            KeyboardMarker,
4779        >(
4780            (settings,),
4781            0x691f4493d263c843,
4782            fidl::encoding::DynamicFlags::empty(),
4783            ___deadline,
4784        )?;
4785        Ok(_response.map(|x| x))
4786    }
4787
4788    /// The Watch protocol is the same as in the other `fuchsia.settings.*` protocols.
4789    ///
4790    /// Returns immediately on first call; on subsequent calls it blocks until the settings
4791    /// change, and then returns following the "hanging get" pattern.
4792    pub fn r#watch(
4793        &self,
4794        ___deadline: zx::MonotonicInstant,
4795    ) -> Result<KeyboardSettings, fidl::Error> {
4796        let _response = self
4797            .client
4798            .send_query::<fidl::encoding::EmptyPayload, KeyboardWatchWatchResponse, KeyboardMarker>(
4799                (),
4800                0x357f6213b3a54527,
4801                fidl::encoding::DynamicFlags::empty(),
4802                ___deadline,
4803            )?;
4804        Ok(_response.settings)
4805    }
4806}
4807
4808#[cfg(target_os = "fuchsia")]
4809impl From<KeyboardSynchronousProxy> for zx::NullableHandle {
4810    fn from(value: KeyboardSynchronousProxy) -> Self {
4811        value.into_channel().into()
4812    }
4813}
4814
4815#[cfg(target_os = "fuchsia")]
4816impl From<fidl::Channel> for KeyboardSynchronousProxy {
4817    fn from(value: fidl::Channel) -> Self {
4818        Self::new(value)
4819    }
4820}
4821
4822#[cfg(target_os = "fuchsia")]
4823impl fidl::endpoints::FromClient for KeyboardSynchronousProxy {
4824    type Protocol = KeyboardMarker;
4825
4826    fn from_client(value: fidl::endpoints::ClientEnd<KeyboardMarker>) -> Self {
4827        Self::new(value.into_channel())
4828    }
4829}
4830
4831#[derive(Debug, Clone)]
4832pub struct KeyboardProxy {
4833    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4834}
4835
4836impl fidl::endpoints::Proxy for KeyboardProxy {
4837    type Protocol = KeyboardMarker;
4838
4839    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4840        Self::new(inner)
4841    }
4842
4843    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4844        self.client.into_channel().map_err(|client| Self { client })
4845    }
4846
4847    fn as_channel(&self) -> &::fidl::AsyncChannel {
4848        self.client.as_channel()
4849    }
4850}
4851
4852impl KeyboardProxy {
4853    /// Create a new Proxy for fuchsia.settings/Keyboard.
4854    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4855        let protocol_name = <KeyboardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4856        Self { client: fidl::client::Client::new(channel, protocol_name) }
4857    }
4858
4859    /// Get a Stream of events from the remote end of the protocol.
4860    ///
4861    /// # Panics
4862    ///
4863    /// Panics if the event stream was already taken.
4864    pub fn take_event_stream(&self) -> KeyboardEventStream {
4865        KeyboardEventStream { event_receiver: self.client.take_event_receiver() }
4866    }
4867
4868    /// Setting protocol: if a field is left unset, it is not modified.
4869    /// To clear a field, set it to its type's "zero" value.
4870    pub fn r#set(
4871        &self,
4872        mut settings: &KeyboardSettings,
4873    ) -> fidl::client::QueryResponseFut<
4874        KeyboardSetSetResult,
4875        fidl::encoding::DefaultFuchsiaResourceDialect,
4876    > {
4877        KeyboardProxyInterface::r#set(self, settings)
4878    }
4879
4880    /// The Watch protocol is the same as in the other `fuchsia.settings.*` protocols.
4881    ///
4882    /// Returns immediately on first call; on subsequent calls it blocks until the settings
4883    /// change, and then returns following the "hanging get" pattern.
4884    pub fn r#watch(
4885        &self,
4886    ) -> fidl::client::QueryResponseFut<
4887        KeyboardSettings,
4888        fidl::encoding::DefaultFuchsiaResourceDialect,
4889    > {
4890        KeyboardProxyInterface::r#watch(self)
4891    }
4892}
4893
4894impl KeyboardProxyInterface for KeyboardProxy {
4895    type SetResponseFut = fidl::client::QueryResponseFut<
4896        KeyboardSetSetResult,
4897        fidl::encoding::DefaultFuchsiaResourceDialect,
4898    >;
4899    fn r#set(&self, mut settings: &KeyboardSettings) -> Self::SetResponseFut {
4900        fn _decode(
4901            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4902        ) -> Result<KeyboardSetSetResult, fidl::Error> {
4903            let _response = fidl::client::decode_transaction_body::<
4904                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4905                fidl::encoding::DefaultFuchsiaResourceDialect,
4906                0x691f4493d263c843,
4907            >(_buf?)?;
4908            Ok(_response.map(|x| x))
4909        }
4910        self.client.send_query_and_decode::<KeyboardSetSetRequest, KeyboardSetSetResult>(
4911            (settings,),
4912            0x691f4493d263c843,
4913            fidl::encoding::DynamicFlags::empty(),
4914            _decode,
4915        )
4916    }
4917
4918    type WatchResponseFut = fidl::client::QueryResponseFut<
4919        KeyboardSettings,
4920        fidl::encoding::DefaultFuchsiaResourceDialect,
4921    >;
4922    fn r#watch(&self) -> Self::WatchResponseFut {
4923        fn _decode(
4924            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4925        ) -> Result<KeyboardSettings, fidl::Error> {
4926            let _response = fidl::client::decode_transaction_body::<
4927                KeyboardWatchWatchResponse,
4928                fidl::encoding::DefaultFuchsiaResourceDialect,
4929                0x357f6213b3a54527,
4930            >(_buf?)?;
4931            Ok(_response.settings)
4932        }
4933        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyboardSettings>(
4934            (),
4935            0x357f6213b3a54527,
4936            fidl::encoding::DynamicFlags::empty(),
4937            _decode,
4938        )
4939    }
4940}
4941
4942pub struct KeyboardEventStream {
4943    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4944}
4945
4946impl std::marker::Unpin for KeyboardEventStream {}
4947
4948impl futures::stream::FusedStream for KeyboardEventStream {
4949    fn is_terminated(&self) -> bool {
4950        self.event_receiver.is_terminated()
4951    }
4952}
4953
4954impl futures::Stream for KeyboardEventStream {
4955    type Item = Result<KeyboardEvent, fidl::Error>;
4956
4957    fn poll_next(
4958        mut self: std::pin::Pin<&mut Self>,
4959        cx: &mut std::task::Context<'_>,
4960    ) -> std::task::Poll<Option<Self::Item>> {
4961        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4962            &mut self.event_receiver,
4963            cx
4964        )?) {
4965            Some(buf) => std::task::Poll::Ready(Some(KeyboardEvent::decode(buf))),
4966            None => std::task::Poll::Ready(None),
4967        }
4968    }
4969}
4970
4971#[derive(Debug)]
4972pub enum KeyboardEvent {}
4973
4974impl KeyboardEvent {
4975    /// Decodes a message buffer as a [`KeyboardEvent`].
4976    fn decode(
4977        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4978    ) -> Result<KeyboardEvent, fidl::Error> {
4979        let (bytes, _handles) = buf.split_mut();
4980        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4981        debug_assert_eq!(tx_header.tx_id, 0);
4982        match tx_header.ordinal {
4983            _ => Err(fidl::Error::UnknownOrdinal {
4984                ordinal: tx_header.ordinal,
4985                protocol_name: <KeyboardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4986            }),
4987        }
4988    }
4989}
4990
4991/// A Stream of incoming requests for fuchsia.settings/Keyboard.
4992pub struct KeyboardRequestStream {
4993    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4994    is_terminated: bool,
4995}
4996
4997impl std::marker::Unpin for KeyboardRequestStream {}
4998
4999impl futures::stream::FusedStream for KeyboardRequestStream {
5000    fn is_terminated(&self) -> bool {
5001        self.is_terminated
5002    }
5003}
5004
5005impl fidl::endpoints::RequestStream for KeyboardRequestStream {
5006    type Protocol = KeyboardMarker;
5007    type ControlHandle = KeyboardControlHandle;
5008
5009    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5010        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5011    }
5012
5013    fn control_handle(&self) -> Self::ControlHandle {
5014        KeyboardControlHandle { inner: self.inner.clone() }
5015    }
5016
5017    fn into_inner(
5018        self,
5019    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5020    {
5021        (self.inner, self.is_terminated)
5022    }
5023
5024    fn from_inner(
5025        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5026        is_terminated: bool,
5027    ) -> Self {
5028        Self { inner, is_terminated }
5029    }
5030}
5031
5032impl futures::Stream for KeyboardRequestStream {
5033    type Item = Result<KeyboardRequest, fidl::Error>;
5034
5035    fn poll_next(
5036        mut self: std::pin::Pin<&mut Self>,
5037        cx: &mut std::task::Context<'_>,
5038    ) -> std::task::Poll<Option<Self::Item>> {
5039        let this = &mut *self;
5040        if this.inner.check_shutdown(cx) {
5041            this.is_terminated = true;
5042            return std::task::Poll::Ready(None);
5043        }
5044        if this.is_terminated {
5045            panic!("polled KeyboardRequestStream after completion");
5046        }
5047        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5048            |bytes, handles| {
5049                match this.inner.channel().read_etc(cx, bytes, handles) {
5050                    std::task::Poll::Ready(Ok(())) => {}
5051                    std::task::Poll::Pending => return std::task::Poll::Pending,
5052                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5053                        this.is_terminated = true;
5054                        return std::task::Poll::Ready(None);
5055                    }
5056                    std::task::Poll::Ready(Err(e)) => {
5057                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5058                            e.into(),
5059                        ))));
5060                    }
5061                }
5062
5063                // A message has been received from the channel
5064                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5065
5066                std::task::Poll::Ready(Some(match header.ordinal {
5067                    0x691f4493d263c843 => {
5068                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5069                        let mut req = fidl::new_empty!(
5070                            KeyboardSetSetRequest,
5071                            fidl::encoding::DefaultFuchsiaResourceDialect
5072                        );
5073                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyboardSetSetRequest>(&header, _body_bytes, handles, &mut req)?;
5074                        let control_handle = KeyboardControlHandle { inner: this.inner.clone() };
5075                        Ok(KeyboardRequest::Set {
5076                            settings: req.settings,
5077
5078                            responder: KeyboardSetResponder {
5079                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5080                                tx_id: header.tx_id,
5081                            },
5082                        })
5083                    }
5084                    0x357f6213b3a54527 => {
5085                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5086                        let mut req = fidl::new_empty!(
5087                            fidl::encoding::EmptyPayload,
5088                            fidl::encoding::DefaultFuchsiaResourceDialect
5089                        );
5090                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5091                        let control_handle = KeyboardControlHandle { inner: this.inner.clone() };
5092                        Ok(KeyboardRequest::Watch {
5093                            responder: KeyboardWatchResponder {
5094                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5095                                tx_id: header.tx_id,
5096                            },
5097                        })
5098                    }
5099                    _ => Err(fidl::Error::UnknownOrdinal {
5100                        ordinal: header.ordinal,
5101                        protocol_name:
5102                            <KeyboardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5103                    }),
5104                }))
5105            },
5106        )
5107    }
5108}
5109
5110/// The SetUI protocol for reading and modifying the keyboard settings.
5111#[derive(Debug)]
5112pub enum KeyboardRequest {
5113    /// Setting protocol: if a field is left unset, it is not modified.
5114    /// To clear a field, set it to its type's "zero" value.
5115    Set { settings: KeyboardSettings, responder: KeyboardSetResponder },
5116    /// The Watch protocol is the same as in the other `fuchsia.settings.*` protocols.
5117    ///
5118    /// Returns immediately on first call; on subsequent calls it blocks until the settings
5119    /// change, and then returns following the "hanging get" pattern.
5120    Watch { responder: KeyboardWatchResponder },
5121}
5122
5123impl KeyboardRequest {
5124    #[allow(irrefutable_let_patterns)]
5125    pub fn into_set(self) -> Option<(KeyboardSettings, KeyboardSetResponder)> {
5126        if let KeyboardRequest::Set { settings, responder } = self {
5127            Some((settings, responder))
5128        } else {
5129            None
5130        }
5131    }
5132
5133    #[allow(irrefutable_let_patterns)]
5134    pub fn into_watch(self) -> Option<(KeyboardWatchResponder)> {
5135        if let KeyboardRequest::Watch { responder } = self { Some((responder)) } else { None }
5136    }
5137
5138    /// Name of the method defined in FIDL
5139    pub fn method_name(&self) -> &'static str {
5140        match *self {
5141            KeyboardRequest::Set { .. } => "set",
5142            KeyboardRequest::Watch { .. } => "watch",
5143        }
5144    }
5145}
5146
5147#[derive(Debug, Clone)]
5148pub struct KeyboardControlHandle {
5149    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5150}
5151
5152impl fidl::endpoints::ControlHandle for KeyboardControlHandle {
5153    fn shutdown(&self) {
5154        self.inner.shutdown()
5155    }
5156
5157    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5158        self.inner.shutdown_with_epitaph(status)
5159    }
5160
5161    fn is_closed(&self) -> bool {
5162        self.inner.channel().is_closed()
5163    }
5164    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5165        self.inner.channel().on_closed()
5166    }
5167
5168    #[cfg(target_os = "fuchsia")]
5169    fn signal_peer(
5170        &self,
5171        clear_mask: zx::Signals,
5172        set_mask: zx::Signals,
5173    ) -> Result<(), zx_status::Status> {
5174        use fidl::Peered;
5175        self.inner.channel().signal_peer(clear_mask, set_mask)
5176    }
5177}
5178
5179impl KeyboardControlHandle {}
5180
5181#[must_use = "FIDL methods require a response to be sent"]
5182#[derive(Debug)]
5183pub struct KeyboardSetResponder {
5184    control_handle: std::mem::ManuallyDrop<KeyboardControlHandle>,
5185    tx_id: u32,
5186}
5187
5188/// Set the the channel to be shutdown (see [`KeyboardControlHandle::shutdown`])
5189/// if the responder is dropped without sending a response, so that the client
5190/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5191impl std::ops::Drop for KeyboardSetResponder {
5192    fn drop(&mut self) {
5193        self.control_handle.shutdown();
5194        // Safety: drops once, never accessed again
5195        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5196    }
5197}
5198
5199impl fidl::endpoints::Responder for KeyboardSetResponder {
5200    type ControlHandle = KeyboardControlHandle;
5201
5202    fn control_handle(&self) -> &KeyboardControlHandle {
5203        &self.control_handle
5204    }
5205
5206    fn drop_without_shutdown(mut self) {
5207        // Safety: drops once, never accessed again due to mem::forget
5208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5209        // Prevent Drop from running (which would shut down the channel)
5210        std::mem::forget(self);
5211    }
5212}
5213
5214impl KeyboardSetResponder {
5215    /// Sends a response to the FIDL transaction.
5216    ///
5217    /// Sets the channel to shutdown if an error occurs.
5218    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5219        let _result = self.send_raw(result);
5220        if _result.is_err() {
5221            self.control_handle.shutdown();
5222        }
5223        self.drop_without_shutdown();
5224        _result
5225    }
5226
5227    /// Similar to "send" but does not shutdown the channel if an error occurs.
5228    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5229        let _result = self.send_raw(result);
5230        self.drop_without_shutdown();
5231        _result
5232    }
5233
5234    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5235        self.control_handle
5236            .inner
5237            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5238                result,
5239                self.tx_id,
5240                0x691f4493d263c843,
5241                fidl::encoding::DynamicFlags::empty(),
5242            )
5243    }
5244}
5245
5246#[must_use = "FIDL methods require a response to be sent"]
5247#[derive(Debug)]
5248pub struct KeyboardWatchResponder {
5249    control_handle: std::mem::ManuallyDrop<KeyboardControlHandle>,
5250    tx_id: u32,
5251}
5252
5253/// Set the the channel to be shutdown (see [`KeyboardControlHandle::shutdown`])
5254/// if the responder is dropped without sending a response, so that the client
5255/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5256impl std::ops::Drop for KeyboardWatchResponder {
5257    fn drop(&mut self) {
5258        self.control_handle.shutdown();
5259        // Safety: drops once, never accessed again
5260        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5261    }
5262}
5263
5264impl fidl::endpoints::Responder for KeyboardWatchResponder {
5265    type ControlHandle = KeyboardControlHandle;
5266
5267    fn control_handle(&self) -> &KeyboardControlHandle {
5268        &self.control_handle
5269    }
5270
5271    fn drop_without_shutdown(mut self) {
5272        // Safety: drops once, never accessed again due to mem::forget
5273        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5274        // Prevent Drop from running (which would shut down the channel)
5275        std::mem::forget(self);
5276    }
5277}
5278
5279impl KeyboardWatchResponder {
5280    /// Sends a response to the FIDL transaction.
5281    ///
5282    /// Sets the channel to shutdown if an error occurs.
5283    pub fn send(self, mut settings: &KeyboardSettings) -> Result<(), fidl::Error> {
5284        let _result = self.send_raw(settings);
5285        if _result.is_err() {
5286            self.control_handle.shutdown();
5287        }
5288        self.drop_without_shutdown();
5289        _result
5290    }
5291
5292    /// Similar to "send" but does not shutdown the channel if an error occurs.
5293    pub fn send_no_shutdown_on_err(
5294        self,
5295        mut settings: &KeyboardSettings,
5296    ) -> Result<(), fidl::Error> {
5297        let _result = self.send_raw(settings);
5298        self.drop_without_shutdown();
5299        _result
5300    }
5301
5302    fn send_raw(&self, mut settings: &KeyboardSettings) -> Result<(), fidl::Error> {
5303        self.control_handle.inner.send::<KeyboardWatchWatchResponse>(
5304            (settings,),
5305            self.tx_id,
5306            0x357f6213b3a54527,
5307            fidl::encoding::DynamicFlags::empty(),
5308        )
5309    }
5310}
5311
5312#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5313pub struct KeyboardSetMarker;
5314
5315impl fidl::endpoints::ProtocolMarker for KeyboardSetMarker {
5316    type Proxy = KeyboardSetProxy;
5317    type RequestStream = KeyboardSetRequestStream;
5318    #[cfg(target_os = "fuchsia")]
5319    type SynchronousProxy = KeyboardSetSynchronousProxy;
5320
5321    const DEBUG_NAME: &'static str = "(anonymous) KeyboardSet";
5322}
5323pub type KeyboardSetSetResult = Result<(), Error>;
5324
5325pub trait KeyboardSetProxyInterface: Send + Sync {
5326    type SetResponseFut: std::future::Future<Output = Result<KeyboardSetSetResult, fidl::Error>>
5327        + Send;
5328    fn r#set(&self, settings: &KeyboardSettings) -> Self::SetResponseFut;
5329}
5330#[derive(Debug)]
5331#[cfg(target_os = "fuchsia")]
5332pub struct KeyboardSetSynchronousProxy {
5333    client: fidl::client::sync::Client,
5334}
5335
5336#[cfg(target_os = "fuchsia")]
5337impl fidl::endpoints::SynchronousProxy for KeyboardSetSynchronousProxy {
5338    type Proxy = KeyboardSetProxy;
5339    type Protocol = KeyboardSetMarker;
5340
5341    fn from_channel(inner: fidl::Channel) -> Self {
5342        Self::new(inner)
5343    }
5344
5345    fn into_channel(self) -> fidl::Channel {
5346        self.client.into_channel()
5347    }
5348
5349    fn as_channel(&self) -> &fidl::Channel {
5350        self.client.as_channel()
5351    }
5352}
5353
5354#[cfg(target_os = "fuchsia")]
5355impl KeyboardSetSynchronousProxy {
5356    pub fn new(channel: fidl::Channel) -> Self {
5357        Self { client: fidl::client::sync::Client::new(channel) }
5358    }
5359
5360    pub fn into_channel(self) -> fidl::Channel {
5361        self.client.into_channel()
5362    }
5363
5364    /// Waits until an event arrives and returns it. It is safe for other
5365    /// threads to make concurrent requests while waiting for an event.
5366    pub fn wait_for_event(
5367        &self,
5368        deadline: zx::MonotonicInstant,
5369    ) -> Result<KeyboardSetEvent, fidl::Error> {
5370        KeyboardSetEvent::decode(self.client.wait_for_event::<KeyboardSetMarker>(deadline)?)
5371    }
5372
5373    /// Setting protocol: if a field is left unset, it is not modified.
5374    /// To clear a field, set it to its type's "zero" value.
5375    pub fn r#set(
5376        &self,
5377        mut settings: &KeyboardSettings,
5378        ___deadline: zx::MonotonicInstant,
5379    ) -> Result<KeyboardSetSetResult, fidl::Error> {
5380        let _response = self.client.send_query::<
5381            KeyboardSetSetRequest,
5382            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5383            KeyboardSetMarker,
5384        >(
5385            (settings,),
5386            0x691f4493d263c843,
5387            fidl::encoding::DynamicFlags::empty(),
5388            ___deadline,
5389        )?;
5390        Ok(_response.map(|x| x))
5391    }
5392}
5393
5394#[cfg(target_os = "fuchsia")]
5395impl From<KeyboardSetSynchronousProxy> for zx::NullableHandle {
5396    fn from(value: KeyboardSetSynchronousProxy) -> Self {
5397        value.into_channel().into()
5398    }
5399}
5400
5401#[cfg(target_os = "fuchsia")]
5402impl From<fidl::Channel> for KeyboardSetSynchronousProxy {
5403    fn from(value: fidl::Channel) -> Self {
5404        Self::new(value)
5405    }
5406}
5407
5408#[cfg(target_os = "fuchsia")]
5409impl fidl::endpoints::FromClient for KeyboardSetSynchronousProxy {
5410    type Protocol = KeyboardSetMarker;
5411
5412    fn from_client(value: fidl::endpoints::ClientEnd<KeyboardSetMarker>) -> Self {
5413        Self::new(value.into_channel())
5414    }
5415}
5416
5417#[derive(Debug, Clone)]
5418pub struct KeyboardSetProxy {
5419    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5420}
5421
5422impl fidl::endpoints::Proxy for KeyboardSetProxy {
5423    type Protocol = KeyboardSetMarker;
5424
5425    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5426        Self::new(inner)
5427    }
5428
5429    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5430        self.client.into_channel().map_err(|client| Self { client })
5431    }
5432
5433    fn as_channel(&self) -> &::fidl::AsyncChannel {
5434        self.client.as_channel()
5435    }
5436}
5437
5438impl KeyboardSetProxy {
5439    /// Create a new Proxy for fuchsia.settings/KeyboardSet.
5440    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5441        let protocol_name = <KeyboardSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5442        Self { client: fidl::client::Client::new(channel, protocol_name) }
5443    }
5444
5445    /// Get a Stream of events from the remote end of the protocol.
5446    ///
5447    /// # Panics
5448    ///
5449    /// Panics if the event stream was already taken.
5450    pub fn take_event_stream(&self) -> KeyboardSetEventStream {
5451        KeyboardSetEventStream { event_receiver: self.client.take_event_receiver() }
5452    }
5453
5454    /// Setting protocol: if a field is left unset, it is not modified.
5455    /// To clear a field, set it to its type's "zero" value.
5456    pub fn r#set(
5457        &self,
5458        mut settings: &KeyboardSettings,
5459    ) -> fidl::client::QueryResponseFut<
5460        KeyboardSetSetResult,
5461        fidl::encoding::DefaultFuchsiaResourceDialect,
5462    > {
5463        KeyboardSetProxyInterface::r#set(self, settings)
5464    }
5465}
5466
5467impl KeyboardSetProxyInterface for KeyboardSetProxy {
5468    type SetResponseFut = fidl::client::QueryResponseFut<
5469        KeyboardSetSetResult,
5470        fidl::encoding::DefaultFuchsiaResourceDialect,
5471    >;
5472    fn r#set(&self, mut settings: &KeyboardSettings) -> Self::SetResponseFut {
5473        fn _decode(
5474            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5475        ) -> Result<KeyboardSetSetResult, fidl::Error> {
5476            let _response = fidl::client::decode_transaction_body::<
5477                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5478                fidl::encoding::DefaultFuchsiaResourceDialect,
5479                0x691f4493d263c843,
5480            >(_buf?)?;
5481            Ok(_response.map(|x| x))
5482        }
5483        self.client.send_query_and_decode::<KeyboardSetSetRequest, KeyboardSetSetResult>(
5484            (settings,),
5485            0x691f4493d263c843,
5486            fidl::encoding::DynamicFlags::empty(),
5487            _decode,
5488        )
5489    }
5490}
5491
5492pub struct KeyboardSetEventStream {
5493    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5494}
5495
5496impl std::marker::Unpin for KeyboardSetEventStream {}
5497
5498impl futures::stream::FusedStream for KeyboardSetEventStream {
5499    fn is_terminated(&self) -> bool {
5500        self.event_receiver.is_terminated()
5501    }
5502}
5503
5504impl futures::Stream for KeyboardSetEventStream {
5505    type Item = Result<KeyboardSetEvent, fidl::Error>;
5506
5507    fn poll_next(
5508        mut self: std::pin::Pin<&mut Self>,
5509        cx: &mut std::task::Context<'_>,
5510    ) -> std::task::Poll<Option<Self::Item>> {
5511        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5512            &mut self.event_receiver,
5513            cx
5514        )?) {
5515            Some(buf) => std::task::Poll::Ready(Some(KeyboardSetEvent::decode(buf))),
5516            None => std::task::Poll::Ready(None),
5517        }
5518    }
5519}
5520
5521#[derive(Debug)]
5522pub enum KeyboardSetEvent {}
5523
5524impl KeyboardSetEvent {
5525    /// Decodes a message buffer as a [`KeyboardSetEvent`].
5526    fn decode(
5527        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5528    ) -> Result<KeyboardSetEvent, fidl::Error> {
5529        let (bytes, _handles) = buf.split_mut();
5530        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5531        debug_assert_eq!(tx_header.tx_id, 0);
5532        match tx_header.ordinal {
5533            _ => Err(fidl::Error::UnknownOrdinal {
5534                ordinal: tx_header.ordinal,
5535                protocol_name: <KeyboardSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5536            }),
5537        }
5538    }
5539}
5540
5541/// A Stream of incoming requests for fuchsia.settings/KeyboardSet.
5542pub struct KeyboardSetRequestStream {
5543    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5544    is_terminated: bool,
5545}
5546
5547impl std::marker::Unpin for KeyboardSetRequestStream {}
5548
5549impl futures::stream::FusedStream for KeyboardSetRequestStream {
5550    fn is_terminated(&self) -> bool {
5551        self.is_terminated
5552    }
5553}
5554
5555impl fidl::endpoints::RequestStream for KeyboardSetRequestStream {
5556    type Protocol = KeyboardSetMarker;
5557    type ControlHandle = KeyboardSetControlHandle;
5558
5559    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5560        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5561    }
5562
5563    fn control_handle(&self) -> Self::ControlHandle {
5564        KeyboardSetControlHandle { inner: self.inner.clone() }
5565    }
5566
5567    fn into_inner(
5568        self,
5569    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5570    {
5571        (self.inner, self.is_terminated)
5572    }
5573
5574    fn from_inner(
5575        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5576        is_terminated: bool,
5577    ) -> Self {
5578        Self { inner, is_terminated }
5579    }
5580}
5581
5582impl futures::Stream for KeyboardSetRequestStream {
5583    type Item = Result<KeyboardSetRequest, fidl::Error>;
5584
5585    fn poll_next(
5586        mut self: std::pin::Pin<&mut Self>,
5587        cx: &mut std::task::Context<'_>,
5588    ) -> std::task::Poll<Option<Self::Item>> {
5589        let this = &mut *self;
5590        if this.inner.check_shutdown(cx) {
5591            this.is_terminated = true;
5592            return std::task::Poll::Ready(None);
5593        }
5594        if this.is_terminated {
5595            panic!("polled KeyboardSetRequestStream after completion");
5596        }
5597        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5598            |bytes, handles| {
5599                match this.inner.channel().read_etc(cx, bytes, handles) {
5600                    std::task::Poll::Ready(Ok(())) => {}
5601                    std::task::Poll::Pending => return std::task::Poll::Pending,
5602                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5603                        this.is_terminated = true;
5604                        return std::task::Poll::Ready(None);
5605                    }
5606                    std::task::Poll::Ready(Err(e)) => {
5607                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5608                            e.into(),
5609                        ))));
5610                    }
5611                }
5612
5613                // A message has been received from the channel
5614                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5615
5616                std::task::Poll::Ready(Some(match header.ordinal {
5617                    0x691f4493d263c843 => {
5618                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5619                        let mut req = fidl::new_empty!(
5620                            KeyboardSetSetRequest,
5621                            fidl::encoding::DefaultFuchsiaResourceDialect
5622                        );
5623                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyboardSetSetRequest>(&header, _body_bytes, handles, &mut req)?;
5624                        let control_handle = KeyboardSetControlHandle { inner: this.inner.clone() };
5625                        Ok(KeyboardSetRequest::Set {
5626                            settings: req.settings,
5627
5628                            responder: KeyboardSetSetResponder {
5629                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5630                                tx_id: header.tx_id,
5631                            },
5632                        })
5633                    }
5634                    _ => Err(fidl::Error::UnknownOrdinal {
5635                        ordinal: header.ordinal,
5636                        protocol_name:
5637                            <KeyboardSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5638                    }),
5639                }))
5640            },
5641        )
5642    }
5643}
5644
5645/// The mutable API for modifying the keyboard settings.
5646#[derive(Debug)]
5647pub enum KeyboardSetRequest {
5648    /// Setting protocol: if a field is left unset, it is not modified.
5649    /// To clear a field, set it to its type's "zero" value.
5650    Set { settings: KeyboardSettings, responder: KeyboardSetSetResponder },
5651}
5652
5653impl KeyboardSetRequest {
5654    #[allow(irrefutable_let_patterns)]
5655    pub fn into_set(self) -> Option<(KeyboardSettings, KeyboardSetSetResponder)> {
5656        if let KeyboardSetRequest::Set { settings, responder } = self {
5657            Some((settings, responder))
5658        } else {
5659            None
5660        }
5661    }
5662
5663    /// Name of the method defined in FIDL
5664    pub fn method_name(&self) -> &'static str {
5665        match *self {
5666            KeyboardSetRequest::Set { .. } => "set",
5667        }
5668    }
5669}
5670
5671#[derive(Debug, Clone)]
5672pub struct KeyboardSetControlHandle {
5673    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5674}
5675
5676impl fidl::endpoints::ControlHandle for KeyboardSetControlHandle {
5677    fn shutdown(&self) {
5678        self.inner.shutdown()
5679    }
5680
5681    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5682        self.inner.shutdown_with_epitaph(status)
5683    }
5684
5685    fn is_closed(&self) -> bool {
5686        self.inner.channel().is_closed()
5687    }
5688    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5689        self.inner.channel().on_closed()
5690    }
5691
5692    #[cfg(target_os = "fuchsia")]
5693    fn signal_peer(
5694        &self,
5695        clear_mask: zx::Signals,
5696        set_mask: zx::Signals,
5697    ) -> Result<(), zx_status::Status> {
5698        use fidl::Peered;
5699        self.inner.channel().signal_peer(clear_mask, set_mask)
5700    }
5701}
5702
5703impl KeyboardSetControlHandle {}
5704
5705#[must_use = "FIDL methods require a response to be sent"]
5706#[derive(Debug)]
5707pub struct KeyboardSetSetResponder {
5708    control_handle: std::mem::ManuallyDrop<KeyboardSetControlHandle>,
5709    tx_id: u32,
5710}
5711
5712/// Set the the channel to be shutdown (see [`KeyboardSetControlHandle::shutdown`])
5713/// if the responder is dropped without sending a response, so that the client
5714/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5715impl std::ops::Drop for KeyboardSetSetResponder {
5716    fn drop(&mut self) {
5717        self.control_handle.shutdown();
5718        // Safety: drops once, never accessed again
5719        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5720    }
5721}
5722
5723impl fidl::endpoints::Responder for KeyboardSetSetResponder {
5724    type ControlHandle = KeyboardSetControlHandle;
5725
5726    fn control_handle(&self) -> &KeyboardSetControlHandle {
5727        &self.control_handle
5728    }
5729
5730    fn drop_without_shutdown(mut self) {
5731        // Safety: drops once, never accessed again due to mem::forget
5732        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5733        // Prevent Drop from running (which would shut down the channel)
5734        std::mem::forget(self);
5735    }
5736}
5737
5738impl KeyboardSetSetResponder {
5739    /// Sends a response to the FIDL transaction.
5740    ///
5741    /// Sets the channel to shutdown if an error occurs.
5742    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5743        let _result = self.send_raw(result);
5744        if _result.is_err() {
5745            self.control_handle.shutdown();
5746        }
5747        self.drop_without_shutdown();
5748        _result
5749    }
5750
5751    /// Similar to "send" but does not shutdown the channel if an error occurs.
5752    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5753        let _result = self.send_raw(result);
5754        self.drop_without_shutdown();
5755        _result
5756    }
5757
5758    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5759        self.control_handle
5760            .inner
5761            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5762                result,
5763                self.tx_id,
5764                0x691f4493d263c843,
5765                fidl::encoding::DynamicFlags::empty(),
5766            )
5767    }
5768}
5769
5770#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5771pub struct KeyboardWatchMarker;
5772
5773impl fidl::endpoints::ProtocolMarker for KeyboardWatchMarker {
5774    type Proxy = KeyboardWatchProxy;
5775    type RequestStream = KeyboardWatchRequestStream;
5776    #[cfg(target_os = "fuchsia")]
5777    type SynchronousProxy = KeyboardWatchSynchronousProxy;
5778
5779    const DEBUG_NAME: &'static str = "(anonymous) KeyboardWatch";
5780}
5781
5782pub trait KeyboardWatchProxyInterface: Send + Sync {
5783    type WatchResponseFut: std::future::Future<Output = Result<KeyboardSettings, fidl::Error>>
5784        + Send;
5785    fn r#watch(&self) -> Self::WatchResponseFut;
5786}
5787#[derive(Debug)]
5788#[cfg(target_os = "fuchsia")]
5789pub struct KeyboardWatchSynchronousProxy {
5790    client: fidl::client::sync::Client,
5791}
5792
5793#[cfg(target_os = "fuchsia")]
5794impl fidl::endpoints::SynchronousProxy for KeyboardWatchSynchronousProxy {
5795    type Proxy = KeyboardWatchProxy;
5796    type Protocol = KeyboardWatchMarker;
5797
5798    fn from_channel(inner: fidl::Channel) -> Self {
5799        Self::new(inner)
5800    }
5801
5802    fn into_channel(self) -> fidl::Channel {
5803        self.client.into_channel()
5804    }
5805
5806    fn as_channel(&self) -> &fidl::Channel {
5807        self.client.as_channel()
5808    }
5809}
5810
5811#[cfg(target_os = "fuchsia")]
5812impl KeyboardWatchSynchronousProxy {
5813    pub fn new(channel: fidl::Channel) -> Self {
5814        Self { client: fidl::client::sync::Client::new(channel) }
5815    }
5816
5817    pub fn into_channel(self) -> fidl::Channel {
5818        self.client.into_channel()
5819    }
5820
5821    /// Waits until an event arrives and returns it. It is safe for other
5822    /// threads to make concurrent requests while waiting for an event.
5823    pub fn wait_for_event(
5824        &self,
5825        deadline: zx::MonotonicInstant,
5826    ) -> Result<KeyboardWatchEvent, fidl::Error> {
5827        KeyboardWatchEvent::decode(self.client.wait_for_event::<KeyboardWatchMarker>(deadline)?)
5828    }
5829
5830    /// The Watch protocol is the same as in the other `fuchsia.settings.*` protocols.
5831    ///
5832    /// Returns immediately on first call; on subsequent calls it blocks until the settings
5833    /// change, and then returns following the "hanging get" pattern.
5834    pub fn r#watch(
5835        &self,
5836        ___deadline: zx::MonotonicInstant,
5837    ) -> Result<KeyboardSettings, fidl::Error> {
5838        let _response = self.client.send_query::<
5839            fidl::encoding::EmptyPayload,
5840            KeyboardWatchWatchResponse,
5841            KeyboardWatchMarker,
5842        >(
5843            (),
5844            0x357f6213b3a54527,
5845            fidl::encoding::DynamicFlags::empty(),
5846            ___deadline,
5847        )?;
5848        Ok(_response.settings)
5849    }
5850}
5851
5852#[cfg(target_os = "fuchsia")]
5853impl From<KeyboardWatchSynchronousProxy> for zx::NullableHandle {
5854    fn from(value: KeyboardWatchSynchronousProxy) -> Self {
5855        value.into_channel().into()
5856    }
5857}
5858
5859#[cfg(target_os = "fuchsia")]
5860impl From<fidl::Channel> for KeyboardWatchSynchronousProxy {
5861    fn from(value: fidl::Channel) -> Self {
5862        Self::new(value)
5863    }
5864}
5865
5866#[cfg(target_os = "fuchsia")]
5867impl fidl::endpoints::FromClient for KeyboardWatchSynchronousProxy {
5868    type Protocol = KeyboardWatchMarker;
5869
5870    fn from_client(value: fidl::endpoints::ClientEnd<KeyboardWatchMarker>) -> Self {
5871        Self::new(value.into_channel())
5872    }
5873}
5874
5875#[derive(Debug, Clone)]
5876pub struct KeyboardWatchProxy {
5877    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5878}
5879
5880impl fidl::endpoints::Proxy for KeyboardWatchProxy {
5881    type Protocol = KeyboardWatchMarker;
5882
5883    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5884        Self::new(inner)
5885    }
5886
5887    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5888        self.client.into_channel().map_err(|client| Self { client })
5889    }
5890
5891    fn as_channel(&self) -> &::fidl::AsyncChannel {
5892        self.client.as_channel()
5893    }
5894}
5895
5896impl KeyboardWatchProxy {
5897    /// Create a new Proxy for fuchsia.settings/KeyboardWatch.
5898    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5899        let protocol_name = <KeyboardWatchMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5900        Self { client: fidl::client::Client::new(channel, protocol_name) }
5901    }
5902
5903    /// Get a Stream of events from the remote end of the protocol.
5904    ///
5905    /// # Panics
5906    ///
5907    /// Panics if the event stream was already taken.
5908    pub fn take_event_stream(&self) -> KeyboardWatchEventStream {
5909        KeyboardWatchEventStream { event_receiver: self.client.take_event_receiver() }
5910    }
5911
5912    /// The Watch protocol is the same as in the other `fuchsia.settings.*` protocols.
5913    ///
5914    /// Returns immediately on first call; on subsequent calls it blocks until the settings
5915    /// change, and then returns following the "hanging get" pattern.
5916    pub fn r#watch(
5917        &self,
5918    ) -> fidl::client::QueryResponseFut<
5919        KeyboardSettings,
5920        fidl::encoding::DefaultFuchsiaResourceDialect,
5921    > {
5922        KeyboardWatchProxyInterface::r#watch(self)
5923    }
5924}
5925
5926impl KeyboardWatchProxyInterface for KeyboardWatchProxy {
5927    type WatchResponseFut = fidl::client::QueryResponseFut<
5928        KeyboardSettings,
5929        fidl::encoding::DefaultFuchsiaResourceDialect,
5930    >;
5931    fn r#watch(&self) -> Self::WatchResponseFut {
5932        fn _decode(
5933            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5934        ) -> Result<KeyboardSettings, fidl::Error> {
5935            let _response = fidl::client::decode_transaction_body::<
5936                KeyboardWatchWatchResponse,
5937                fidl::encoding::DefaultFuchsiaResourceDialect,
5938                0x357f6213b3a54527,
5939            >(_buf?)?;
5940            Ok(_response.settings)
5941        }
5942        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyboardSettings>(
5943            (),
5944            0x357f6213b3a54527,
5945            fidl::encoding::DynamicFlags::empty(),
5946            _decode,
5947        )
5948    }
5949}
5950
5951pub struct KeyboardWatchEventStream {
5952    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5953}
5954
5955impl std::marker::Unpin for KeyboardWatchEventStream {}
5956
5957impl futures::stream::FusedStream for KeyboardWatchEventStream {
5958    fn is_terminated(&self) -> bool {
5959        self.event_receiver.is_terminated()
5960    }
5961}
5962
5963impl futures::Stream for KeyboardWatchEventStream {
5964    type Item = Result<KeyboardWatchEvent, fidl::Error>;
5965
5966    fn poll_next(
5967        mut self: std::pin::Pin<&mut Self>,
5968        cx: &mut std::task::Context<'_>,
5969    ) -> std::task::Poll<Option<Self::Item>> {
5970        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5971            &mut self.event_receiver,
5972            cx
5973        )?) {
5974            Some(buf) => std::task::Poll::Ready(Some(KeyboardWatchEvent::decode(buf))),
5975            None => std::task::Poll::Ready(None),
5976        }
5977    }
5978}
5979
5980#[derive(Debug)]
5981pub enum KeyboardWatchEvent {}
5982
5983impl KeyboardWatchEvent {
5984    /// Decodes a message buffer as a [`KeyboardWatchEvent`].
5985    fn decode(
5986        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5987    ) -> Result<KeyboardWatchEvent, fidl::Error> {
5988        let (bytes, _handles) = buf.split_mut();
5989        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5990        debug_assert_eq!(tx_header.tx_id, 0);
5991        match tx_header.ordinal {
5992            _ => Err(fidl::Error::UnknownOrdinal {
5993                ordinal: tx_header.ordinal,
5994                protocol_name: <KeyboardWatchMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5995            }),
5996        }
5997    }
5998}
5999
6000/// A Stream of incoming requests for fuchsia.settings/KeyboardWatch.
6001pub struct KeyboardWatchRequestStream {
6002    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6003    is_terminated: bool,
6004}
6005
6006impl std::marker::Unpin for KeyboardWatchRequestStream {}
6007
6008impl futures::stream::FusedStream for KeyboardWatchRequestStream {
6009    fn is_terminated(&self) -> bool {
6010        self.is_terminated
6011    }
6012}
6013
6014impl fidl::endpoints::RequestStream for KeyboardWatchRequestStream {
6015    type Protocol = KeyboardWatchMarker;
6016    type ControlHandle = KeyboardWatchControlHandle;
6017
6018    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6019        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6020    }
6021
6022    fn control_handle(&self) -> Self::ControlHandle {
6023        KeyboardWatchControlHandle { inner: self.inner.clone() }
6024    }
6025
6026    fn into_inner(
6027        self,
6028    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6029    {
6030        (self.inner, self.is_terminated)
6031    }
6032
6033    fn from_inner(
6034        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6035        is_terminated: bool,
6036    ) -> Self {
6037        Self { inner, is_terminated }
6038    }
6039}
6040
6041impl futures::Stream for KeyboardWatchRequestStream {
6042    type Item = Result<KeyboardWatchRequest, fidl::Error>;
6043
6044    fn poll_next(
6045        mut self: std::pin::Pin<&mut Self>,
6046        cx: &mut std::task::Context<'_>,
6047    ) -> std::task::Poll<Option<Self::Item>> {
6048        let this = &mut *self;
6049        if this.inner.check_shutdown(cx) {
6050            this.is_terminated = true;
6051            return std::task::Poll::Ready(None);
6052        }
6053        if this.is_terminated {
6054            panic!("polled KeyboardWatchRequestStream after completion");
6055        }
6056        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6057            |bytes, handles| {
6058                match this.inner.channel().read_etc(cx, bytes, handles) {
6059                    std::task::Poll::Ready(Ok(())) => {}
6060                    std::task::Poll::Pending => return std::task::Poll::Pending,
6061                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6062                        this.is_terminated = true;
6063                        return std::task::Poll::Ready(None);
6064                    }
6065                    std::task::Poll::Ready(Err(e)) => {
6066                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6067                            e.into(),
6068                        ))));
6069                    }
6070                }
6071
6072                // A message has been received from the channel
6073                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6074
6075                std::task::Poll::Ready(Some(match header.ordinal {
6076                    0x357f6213b3a54527 => {
6077                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6078                        let mut req = fidl::new_empty!(
6079                            fidl::encoding::EmptyPayload,
6080                            fidl::encoding::DefaultFuchsiaResourceDialect
6081                        );
6082                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6083                        let control_handle =
6084                            KeyboardWatchControlHandle { inner: this.inner.clone() };
6085                        Ok(KeyboardWatchRequest::Watch {
6086                            responder: KeyboardWatchWatchResponder {
6087                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6088                                tx_id: header.tx_id,
6089                            },
6090                        })
6091                    }
6092                    _ => Err(fidl::Error::UnknownOrdinal {
6093                        ordinal: header.ordinal,
6094                        protocol_name:
6095                            <KeyboardWatchMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6096                    }),
6097                }))
6098            },
6099        )
6100    }
6101}
6102
6103/// The read-only API for monitoring the changes to the keyboard settings.
6104#[derive(Debug)]
6105pub enum KeyboardWatchRequest {
6106    /// The Watch protocol is the same as in the other `fuchsia.settings.*` protocols.
6107    ///
6108    /// Returns immediately on first call; on subsequent calls it blocks until the settings
6109    /// change, and then returns following the "hanging get" pattern.
6110    Watch { responder: KeyboardWatchWatchResponder },
6111}
6112
6113impl KeyboardWatchRequest {
6114    #[allow(irrefutable_let_patterns)]
6115    pub fn into_watch(self) -> Option<(KeyboardWatchWatchResponder)> {
6116        if let KeyboardWatchRequest::Watch { responder } = self { Some((responder)) } else { None }
6117    }
6118
6119    /// Name of the method defined in FIDL
6120    pub fn method_name(&self) -> &'static str {
6121        match *self {
6122            KeyboardWatchRequest::Watch { .. } => "watch",
6123        }
6124    }
6125}
6126
6127#[derive(Debug, Clone)]
6128pub struct KeyboardWatchControlHandle {
6129    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6130}
6131
6132impl fidl::endpoints::ControlHandle for KeyboardWatchControlHandle {
6133    fn shutdown(&self) {
6134        self.inner.shutdown()
6135    }
6136
6137    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6138        self.inner.shutdown_with_epitaph(status)
6139    }
6140
6141    fn is_closed(&self) -> bool {
6142        self.inner.channel().is_closed()
6143    }
6144    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6145        self.inner.channel().on_closed()
6146    }
6147
6148    #[cfg(target_os = "fuchsia")]
6149    fn signal_peer(
6150        &self,
6151        clear_mask: zx::Signals,
6152        set_mask: zx::Signals,
6153    ) -> Result<(), zx_status::Status> {
6154        use fidl::Peered;
6155        self.inner.channel().signal_peer(clear_mask, set_mask)
6156    }
6157}
6158
6159impl KeyboardWatchControlHandle {}
6160
6161#[must_use = "FIDL methods require a response to be sent"]
6162#[derive(Debug)]
6163pub struct KeyboardWatchWatchResponder {
6164    control_handle: std::mem::ManuallyDrop<KeyboardWatchControlHandle>,
6165    tx_id: u32,
6166}
6167
6168/// Set the the channel to be shutdown (see [`KeyboardWatchControlHandle::shutdown`])
6169/// if the responder is dropped without sending a response, so that the client
6170/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6171impl std::ops::Drop for KeyboardWatchWatchResponder {
6172    fn drop(&mut self) {
6173        self.control_handle.shutdown();
6174        // Safety: drops once, never accessed again
6175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6176    }
6177}
6178
6179impl fidl::endpoints::Responder for KeyboardWatchWatchResponder {
6180    type ControlHandle = KeyboardWatchControlHandle;
6181
6182    fn control_handle(&self) -> &KeyboardWatchControlHandle {
6183        &self.control_handle
6184    }
6185
6186    fn drop_without_shutdown(mut self) {
6187        // Safety: drops once, never accessed again due to mem::forget
6188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6189        // Prevent Drop from running (which would shut down the channel)
6190        std::mem::forget(self);
6191    }
6192}
6193
6194impl KeyboardWatchWatchResponder {
6195    /// Sends a response to the FIDL transaction.
6196    ///
6197    /// Sets the channel to shutdown if an error occurs.
6198    pub fn send(self, mut settings: &KeyboardSettings) -> Result<(), fidl::Error> {
6199        let _result = self.send_raw(settings);
6200        if _result.is_err() {
6201            self.control_handle.shutdown();
6202        }
6203        self.drop_without_shutdown();
6204        _result
6205    }
6206
6207    /// Similar to "send" but does not shutdown the channel if an error occurs.
6208    pub fn send_no_shutdown_on_err(
6209        self,
6210        mut settings: &KeyboardSettings,
6211    ) -> Result<(), fidl::Error> {
6212        let _result = self.send_raw(settings);
6213        self.drop_without_shutdown();
6214        _result
6215    }
6216
6217    fn send_raw(&self, mut settings: &KeyboardSettings) -> Result<(), fidl::Error> {
6218        self.control_handle.inner.send::<KeyboardWatchWatchResponse>(
6219            (settings,),
6220            self.tx_id,
6221            0x357f6213b3a54527,
6222            fidl::encoding::DynamicFlags::empty(),
6223        )
6224    }
6225}
6226
6227#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6228pub struct LightMarker;
6229
6230impl fidl::endpoints::ProtocolMarker for LightMarker {
6231    type Proxy = LightProxy;
6232    type RequestStream = LightRequestStream;
6233    #[cfg(target_os = "fuchsia")]
6234    type SynchronousProxy = LightSynchronousProxy;
6235
6236    const DEBUG_NAME: &'static str = "fuchsia.settings.Light";
6237}
6238impl fidl::endpoints::DiscoverableProtocolMarker for LightMarker {}
6239pub type LightSetLightGroupValuesResult = Result<(), LightError>;
6240
6241pub trait LightProxyInterface: Send + Sync {
6242    type WatchLightGroupsResponseFut: std::future::Future<Output = Result<Vec<LightGroup>, fidl::Error>>
6243        + Send;
6244    fn r#watch_light_groups(&self) -> Self::WatchLightGroupsResponseFut;
6245    type WatchLightGroupResponseFut: std::future::Future<Output = Result<LightGroup, fidl::Error>>
6246        + Send;
6247    fn r#watch_light_group(&self, name: &str) -> Self::WatchLightGroupResponseFut;
6248    type SetLightGroupValuesResponseFut: std::future::Future<Output = Result<LightSetLightGroupValuesResult, fidl::Error>>
6249        + Send;
6250    fn r#set_light_group_values(
6251        &self,
6252        name: &str,
6253        state: &[LightState],
6254    ) -> Self::SetLightGroupValuesResponseFut;
6255}
6256#[derive(Debug)]
6257#[cfg(target_os = "fuchsia")]
6258pub struct LightSynchronousProxy {
6259    client: fidl::client::sync::Client,
6260}
6261
6262#[cfg(target_os = "fuchsia")]
6263impl fidl::endpoints::SynchronousProxy for LightSynchronousProxy {
6264    type Proxy = LightProxy;
6265    type Protocol = LightMarker;
6266
6267    fn from_channel(inner: fidl::Channel) -> Self {
6268        Self::new(inner)
6269    }
6270
6271    fn into_channel(self) -> fidl::Channel {
6272        self.client.into_channel()
6273    }
6274
6275    fn as_channel(&self) -> &fidl::Channel {
6276        self.client.as_channel()
6277    }
6278}
6279
6280#[cfg(target_os = "fuchsia")]
6281impl LightSynchronousProxy {
6282    pub fn new(channel: fidl::Channel) -> Self {
6283        Self { client: fidl::client::sync::Client::new(channel) }
6284    }
6285
6286    pub fn into_channel(self) -> fidl::Channel {
6287        self.client.into_channel()
6288    }
6289
6290    /// Waits until an event arrives and returns it. It is safe for other
6291    /// threads to make concurrent requests while waiting for an event.
6292    pub fn wait_for_event(
6293        &self,
6294        deadline: zx::MonotonicInstant,
6295    ) -> Result<LightEvent, fidl::Error> {
6296        LightEvent::decode(self.client.wait_for_event::<LightMarker>(deadline)?)
6297    }
6298
6299    /// Fetches information on the controllable light groups on the device.
6300    /// Returns immediately on first call; subsequent calls return when the
6301    /// value changes.
6302    ///
6303    /// If this call fails, it is considered a fatal error and the channel
6304    /// will be closed.
6305    pub fn r#watch_light_groups(
6306        &self,
6307        ___deadline: zx::MonotonicInstant,
6308    ) -> Result<Vec<LightGroup>, fidl::Error> {
6309        let _response = self
6310            .client
6311            .send_query::<fidl::encoding::EmptyPayload, LightWatchLightGroupsResponse, LightMarker>(
6312                (),
6313                0x3f506de229db5930,
6314                fidl::encoding::DynamicFlags::empty(),
6315                ___deadline,
6316            )?;
6317        Ok(_response.groups)
6318    }
6319
6320    /// Fetches information on an individual light group on the device with the
6321    /// given name. Returns immediately on first call; subsequent calls return
6322    /// when the value changes.
6323    ///
6324    /// If this call fails, it is considered a fatal error and the channel
6325    /// will be closed. If the failure is due to an invalid light group name,
6326    /// the channel will be closed with a NOT_FOUND epitaph.
6327    pub fn r#watch_light_group(
6328        &self,
6329        mut name: &str,
6330        ___deadline: zx::MonotonicInstant,
6331    ) -> Result<LightGroup, fidl::Error> {
6332        let _response = self
6333            .client
6334            .send_query::<LightWatchLightGroupRequest, LightWatchLightGroupResponse, LightMarker>(
6335                (name,),
6336                0x3ef0331c388d56a3,
6337                fidl::encoding::DynamicFlags::empty(),
6338                ___deadline,
6339            )?;
6340        Ok(_response.group)
6341    }
6342
6343    /// Sets the values for the lights in the group with the given name.
6344    ///
6345    /// If the provided value does not match the light group's type, this
6346    /// call will fail.
6347    ///
6348    /// The requested changes may not take immediate effect if
6349    /// the light is forced to a certain state by the device's hardware. This
6350    /// call will still succeed, but the light's value may not change.
6351    pub fn r#set_light_group_values(
6352        &self,
6353        mut name: &str,
6354        mut state: &[LightState],
6355        ___deadline: zx::MonotonicInstant,
6356    ) -> Result<LightSetLightGroupValuesResult, fidl::Error> {
6357        let _response = self.client.send_query::<
6358            LightSetLightGroupValuesRequest,
6359            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LightError>,
6360            LightMarker,
6361        >(
6362            (name, state,),
6363            0x15d9b62431fdf8d5,
6364            fidl::encoding::DynamicFlags::empty(),
6365            ___deadline,
6366        )?;
6367        Ok(_response.map(|x| x))
6368    }
6369}
6370
6371#[cfg(target_os = "fuchsia")]
6372impl From<LightSynchronousProxy> for zx::NullableHandle {
6373    fn from(value: LightSynchronousProxy) -> Self {
6374        value.into_channel().into()
6375    }
6376}
6377
6378#[cfg(target_os = "fuchsia")]
6379impl From<fidl::Channel> for LightSynchronousProxy {
6380    fn from(value: fidl::Channel) -> Self {
6381        Self::new(value)
6382    }
6383}
6384
6385#[cfg(target_os = "fuchsia")]
6386impl fidl::endpoints::FromClient for LightSynchronousProxy {
6387    type Protocol = LightMarker;
6388
6389    fn from_client(value: fidl::endpoints::ClientEnd<LightMarker>) -> Self {
6390        Self::new(value.into_channel())
6391    }
6392}
6393
6394#[derive(Debug, Clone)]
6395pub struct LightProxy {
6396    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6397}
6398
6399impl fidl::endpoints::Proxy for LightProxy {
6400    type Protocol = LightMarker;
6401
6402    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6403        Self::new(inner)
6404    }
6405
6406    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6407        self.client.into_channel().map_err(|client| Self { client })
6408    }
6409
6410    fn as_channel(&self) -> &::fidl::AsyncChannel {
6411        self.client.as_channel()
6412    }
6413}
6414
6415impl LightProxy {
6416    /// Create a new Proxy for fuchsia.settings/Light.
6417    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6418        let protocol_name = <LightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6419        Self { client: fidl::client::Client::new(channel, protocol_name) }
6420    }
6421
6422    /// Get a Stream of events from the remote end of the protocol.
6423    ///
6424    /// # Panics
6425    ///
6426    /// Panics if the event stream was already taken.
6427    pub fn take_event_stream(&self) -> LightEventStream {
6428        LightEventStream { event_receiver: self.client.take_event_receiver() }
6429    }
6430
6431    /// Fetches information on the controllable light groups on the device.
6432    /// Returns immediately on first call; subsequent calls return when the
6433    /// value changes.
6434    ///
6435    /// If this call fails, it is considered a fatal error and the channel
6436    /// will be closed.
6437    pub fn r#watch_light_groups(
6438        &self,
6439    ) -> fidl::client::QueryResponseFut<
6440        Vec<LightGroup>,
6441        fidl::encoding::DefaultFuchsiaResourceDialect,
6442    > {
6443        LightProxyInterface::r#watch_light_groups(self)
6444    }
6445
6446    /// Fetches information on an individual light group on the device with the
6447    /// given name. Returns immediately on first call; subsequent calls return
6448    /// when the value changes.
6449    ///
6450    /// If this call fails, it is considered a fatal error and the channel
6451    /// will be closed. If the failure is due to an invalid light group name,
6452    /// the channel will be closed with a NOT_FOUND epitaph.
6453    pub fn r#watch_light_group(
6454        &self,
6455        mut name: &str,
6456    ) -> fidl::client::QueryResponseFut<LightGroup, fidl::encoding::DefaultFuchsiaResourceDialect>
6457    {
6458        LightProxyInterface::r#watch_light_group(self, name)
6459    }
6460
6461    /// Sets the values for the lights in the group with the given name.
6462    ///
6463    /// If the provided value does not match the light group's type, this
6464    /// call will fail.
6465    ///
6466    /// The requested changes may not take immediate effect if
6467    /// the light is forced to a certain state by the device's hardware. This
6468    /// call will still succeed, but the light's value may not change.
6469    pub fn r#set_light_group_values(
6470        &self,
6471        mut name: &str,
6472        mut state: &[LightState],
6473    ) -> fidl::client::QueryResponseFut<
6474        LightSetLightGroupValuesResult,
6475        fidl::encoding::DefaultFuchsiaResourceDialect,
6476    > {
6477        LightProxyInterface::r#set_light_group_values(self, name, state)
6478    }
6479}
6480
6481impl LightProxyInterface for LightProxy {
6482    type WatchLightGroupsResponseFut = fidl::client::QueryResponseFut<
6483        Vec<LightGroup>,
6484        fidl::encoding::DefaultFuchsiaResourceDialect,
6485    >;
6486    fn r#watch_light_groups(&self) -> Self::WatchLightGroupsResponseFut {
6487        fn _decode(
6488            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6489        ) -> Result<Vec<LightGroup>, fidl::Error> {
6490            let _response = fidl::client::decode_transaction_body::<
6491                LightWatchLightGroupsResponse,
6492                fidl::encoding::DefaultFuchsiaResourceDialect,
6493                0x3f506de229db5930,
6494            >(_buf?)?;
6495            Ok(_response.groups)
6496        }
6497        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<LightGroup>>(
6498            (),
6499            0x3f506de229db5930,
6500            fidl::encoding::DynamicFlags::empty(),
6501            _decode,
6502        )
6503    }
6504
6505    type WatchLightGroupResponseFut =
6506        fidl::client::QueryResponseFut<LightGroup, fidl::encoding::DefaultFuchsiaResourceDialect>;
6507    fn r#watch_light_group(&self, mut name: &str) -> Self::WatchLightGroupResponseFut {
6508        fn _decode(
6509            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6510        ) -> Result<LightGroup, fidl::Error> {
6511            let _response = fidl::client::decode_transaction_body::<
6512                LightWatchLightGroupResponse,
6513                fidl::encoding::DefaultFuchsiaResourceDialect,
6514                0x3ef0331c388d56a3,
6515            >(_buf?)?;
6516            Ok(_response.group)
6517        }
6518        self.client.send_query_and_decode::<LightWatchLightGroupRequest, LightGroup>(
6519            (name,),
6520            0x3ef0331c388d56a3,
6521            fidl::encoding::DynamicFlags::empty(),
6522            _decode,
6523        )
6524    }
6525
6526    type SetLightGroupValuesResponseFut = fidl::client::QueryResponseFut<
6527        LightSetLightGroupValuesResult,
6528        fidl::encoding::DefaultFuchsiaResourceDialect,
6529    >;
6530    fn r#set_light_group_values(
6531        &self,
6532        mut name: &str,
6533        mut state: &[LightState],
6534    ) -> Self::SetLightGroupValuesResponseFut {
6535        fn _decode(
6536            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6537        ) -> Result<LightSetLightGroupValuesResult, fidl::Error> {
6538            let _response = fidl::client::decode_transaction_body::<
6539                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LightError>,
6540                fidl::encoding::DefaultFuchsiaResourceDialect,
6541                0x15d9b62431fdf8d5,
6542            >(_buf?)?;
6543            Ok(_response.map(|x| x))
6544        }
6545        self.client.send_query_and_decode::<
6546            LightSetLightGroupValuesRequest,
6547            LightSetLightGroupValuesResult,
6548        >(
6549            (name, state,),
6550            0x15d9b62431fdf8d5,
6551            fidl::encoding::DynamicFlags::empty(),
6552            _decode,
6553        )
6554    }
6555}
6556
6557pub struct LightEventStream {
6558    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6559}
6560
6561impl std::marker::Unpin for LightEventStream {}
6562
6563impl futures::stream::FusedStream for LightEventStream {
6564    fn is_terminated(&self) -> bool {
6565        self.event_receiver.is_terminated()
6566    }
6567}
6568
6569impl futures::Stream for LightEventStream {
6570    type Item = Result<LightEvent, fidl::Error>;
6571
6572    fn poll_next(
6573        mut self: std::pin::Pin<&mut Self>,
6574        cx: &mut std::task::Context<'_>,
6575    ) -> std::task::Poll<Option<Self::Item>> {
6576        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6577            &mut self.event_receiver,
6578            cx
6579        )?) {
6580            Some(buf) => std::task::Poll::Ready(Some(LightEvent::decode(buf))),
6581            None => std::task::Poll::Ready(None),
6582        }
6583    }
6584}
6585
6586#[derive(Debug)]
6587pub enum LightEvent {}
6588
6589impl LightEvent {
6590    /// Decodes a message buffer as a [`LightEvent`].
6591    fn decode(
6592        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6593    ) -> Result<LightEvent, fidl::Error> {
6594        let (bytes, _handles) = buf.split_mut();
6595        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6596        debug_assert_eq!(tx_header.tx_id, 0);
6597        match tx_header.ordinal {
6598            _ => Err(fidl::Error::UnknownOrdinal {
6599                ordinal: tx_header.ordinal,
6600                protocol_name: <LightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6601            }),
6602        }
6603    }
6604}
6605
6606/// A Stream of incoming requests for fuchsia.settings/Light.
6607pub struct LightRequestStream {
6608    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6609    is_terminated: bool,
6610}
6611
6612impl std::marker::Unpin for LightRequestStream {}
6613
6614impl futures::stream::FusedStream for LightRequestStream {
6615    fn is_terminated(&self) -> bool {
6616        self.is_terminated
6617    }
6618}
6619
6620impl fidl::endpoints::RequestStream for LightRequestStream {
6621    type Protocol = LightMarker;
6622    type ControlHandle = LightControlHandle;
6623
6624    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6625        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6626    }
6627
6628    fn control_handle(&self) -> Self::ControlHandle {
6629        LightControlHandle { inner: self.inner.clone() }
6630    }
6631
6632    fn into_inner(
6633        self,
6634    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6635    {
6636        (self.inner, self.is_terminated)
6637    }
6638
6639    fn from_inner(
6640        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6641        is_terminated: bool,
6642    ) -> Self {
6643        Self { inner, is_terminated }
6644    }
6645}
6646
6647impl futures::Stream for LightRequestStream {
6648    type Item = Result<LightRequest, fidl::Error>;
6649
6650    fn poll_next(
6651        mut self: std::pin::Pin<&mut Self>,
6652        cx: &mut std::task::Context<'_>,
6653    ) -> std::task::Poll<Option<Self::Item>> {
6654        let this = &mut *self;
6655        if this.inner.check_shutdown(cx) {
6656            this.is_terminated = true;
6657            return std::task::Poll::Ready(None);
6658        }
6659        if this.is_terminated {
6660            panic!("polled LightRequestStream after completion");
6661        }
6662        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6663            |bytes, handles| {
6664                match this.inner.channel().read_etc(cx, bytes, handles) {
6665                    std::task::Poll::Ready(Ok(())) => {}
6666                    std::task::Poll::Pending => return std::task::Poll::Pending,
6667                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6668                        this.is_terminated = true;
6669                        return std::task::Poll::Ready(None);
6670                    }
6671                    std::task::Poll::Ready(Err(e)) => {
6672                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6673                            e.into(),
6674                        ))));
6675                    }
6676                }
6677
6678                // A message has been received from the channel
6679                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6680
6681                std::task::Poll::Ready(Some(match header.ordinal {
6682                    0x3f506de229db5930 => {
6683                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6684                        let mut req = fidl::new_empty!(
6685                            fidl::encoding::EmptyPayload,
6686                            fidl::encoding::DefaultFuchsiaResourceDialect
6687                        );
6688                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6689                        let control_handle = LightControlHandle { inner: this.inner.clone() };
6690                        Ok(LightRequest::WatchLightGroups {
6691                            responder: LightWatchLightGroupsResponder {
6692                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6693                                tx_id: header.tx_id,
6694                            },
6695                        })
6696                    }
6697                    0x3ef0331c388d56a3 => {
6698                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6699                        let mut req = fidl::new_empty!(
6700                            LightWatchLightGroupRequest,
6701                            fidl::encoding::DefaultFuchsiaResourceDialect
6702                        );
6703                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LightWatchLightGroupRequest>(&header, _body_bytes, handles, &mut req)?;
6704                        let control_handle = LightControlHandle { inner: this.inner.clone() };
6705                        Ok(LightRequest::WatchLightGroup {
6706                            name: req.name,
6707
6708                            responder: LightWatchLightGroupResponder {
6709                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6710                                tx_id: header.tx_id,
6711                            },
6712                        })
6713                    }
6714                    0x15d9b62431fdf8d5 => {
6715                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6716                        let mut req = fidl::new_empty!(
6717                            LightSetLightGroupValuesRequest,
6718                            fidl::encoding::DefaultFuchsiaResourceDialect
6719                        );
6720                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LightSetLightGroupValuesRequest>(&header, _body_bytes, handles, &mut req)?;
6721                        let control_handle = LightControlHandle { inner: this.inner.clone() };
6722                        Ok(LightRequest::SetLightGroupValues {
6723                            name: req.name,
6724                            state: req.state,
6725
6726                            responder: LightSetLightGroupValuesResponder {
6727                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6728                                tx_id: header.tx_id,
6729                            },
6730                        })
6731                    }
6732                    _ => Err(fidl::Error::UnknownOrdinal {
6733                        ordinal: header.ordinal,
6734                        protocol_name: <LightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6735                    }),
6736                }))
6737            },
6738        )
6739    }
6740}
6741
6742#[derive(Debug)]
6743pub enum LightRequest {
6744    /// Fetches information on the controllable light groups on the device.
6745    /// Returns immediately on first call; subsequent calls return when the
6746    /// value changes.
6747    ///
6748    /// If this call fails, it is considered a fatal error and the channel
6749    /// will be closed.
6750    WatchLightGroups { responder: LightWatchLightGroupsResponder },
6751    /// Fetches information on an individual light group on the device with the
6752    /// given name. Returns immediately on first call; subsequent calls return
6753    /// when the value changes.
6754    ///
6755    /// If this call fails, it is considered a fatal error and the channel
6756    /// will be closed. If the failure is due to an invalid light group name,
6757    /// the channel will be closed with a NOT_FOUND epitaph.
6758    WatchLightGroup { name: String, responder: LightWatchLightGroupResponder },
6759    /// Sets the values for the lights in the group with the given name.
6760    ///
6761    /// If the provided value does not match the light group's type, this
6762    /// call will fail.
6763    ///
6764    /// The requested changes may not take immediate effect if
6765    /// the light is forced to a certain state by the device's hardware. This
6766    /// call will still succeed, but the light's value may not change.
6767    SetLightGroupValues {
6768        name: String,
6769        state: Vec<LightState>,
6770        responder: LightSetLightGroupValuesResponder,
6771    },
6772}
6773
6774impl LightRequest {
6775    #[allow(irrefutable_let_patterns)]
6776    pub fn into_watch_light_groups(self) -> Option<(LightWatchLightGroupsResponder)> {
6777        if let LightRequest::WatchLightGroups { responder } = self {
6778            Some((responder))
6779        } else {
6780            None
6781        }
6782    }
6783
6784    #[allow(irrefutable_let_patterns)]
6785    pub fn into_watch_light_group(self) -> Option<(String, LightWatchLightGroupResponder)> {
6786        if let LightRequest::WatchLightGroup { name, responder } = self {
6787            Some((name, responder))
6788        } else {
6789            None
6790        }
6791    }
6792
6793    #[allow(irrefutable_let_patterns)]
6794    pub fn into_set_light_group_values(
6795        self,
6796    ) -> Option<(String, Vec<LightState>, LightSetLightGroupValuesResponder)> {
6797        if let LightRequest::SetLightGroupValues { name, state, responder } = self {
6798            Some((name, state, responder))
6799        } else {
6800            None
6801        }
6802    }
6803
6804    /// Name of the method defined in FIDL
6805    pub fn method_name(&self) -> &'static str {
6806        match *self {
6807            LightRequest::WatchLightGroups { .. } => "watch_light_groups",
6808            LightRequest::WatchLightGroup { .. } => "watch_light_group",
6809            LightRequest::SetLightGroupValues { .. } => "set_light_group_values",
6810        }
6811    }
6812}
6813
6814#[derive(Debug, Clone)]
6815pub struct LightControlHandle {
6816    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6817}
6818
6819impl fidl::endpoints::ControlHandle for LightControlHandle {
6820    fn shutdown(&self) {
6821        self.inner.shutdown()
6822    }
6823
6824    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6825        self.inner.shutdown_with_epitaph(status)
6826    }
6827
6828    fn is_closed(&self) -> bool {
6829        self.inner.channel().is_closed()
6830    }
6831    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6832        self.inner.channel().on_closed()
6833    }
6834
6835    #[cfg(target_os = "fuchsia")]
6836    fn signal_peer(
6837        &self,
6838        clear_mask: zx::Signals,
6839        set_mask: zx::Signals,
6840    ) -> Result<(), zx_status::Status> {
6841        use fidl::Peered;
6842        self.inner.channel().signal_peer(clear_mask, set_mask)
6843    }
6844}
6845
6846impl LightControlHandle {}
6847
6848#[must_use = "FIDL methods require a response to be sent"]
6849#[derive(Debug)]
6850pub struct LightWatchLightGroupsResponder {
6851    control_handle: std::mem::ManuallyDrop<LightControlHandle>,
6852    tx_id: u32,
6853}
6854
6855/// Set the the channel to be shutdown (see [`LightControlHandle::shutdown`])
6856/// if the responder is dropped without sending a response, so that the client
6857/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6858impl std::ops::Drop for LightWatchLightGroupsResponder {
6859    fn drop(&mut self) {
6860        self.control_handle.shutdown();
6861        // Safety: drops once, never accessed again
6862        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6863    }
6864}
6865
6866impl fidl::endpoints::Responder for LightWatchLightGroupsResponder {
6867    type ControlHandle = LightControlHandle;
6868
6869    fn control_handle(&self) -> &LightControlHandle {
6870        &self.control_handle
6871    }
6872
6873    fn drop_without_shutdown(mut self) {
6874        // Safety: drops once, never accessed again due to mem::forget
6875        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6876        // Prevent Drop from running (which would shut down the channel)
6877        std::mem::forget(self);
6878    }
6879}
6880
6881impl LightWatchLightGroupsResponder {
6882    /// Sends a response to the FIDL transaction.
6883    ///
6884    /// Sets the channel to shutdown if an error occurs.
6885    pub fn send(self, mut groups: &[LightGroup]) -> Result<(), fidl::Error> {
6886        let _result = self.send_raw(groups);
6887        if _result.is_err() {
6888            self.control_handle.shutdown();
6889        }
6890        self.drop_without_shutdown();
6891        _result
6892    }
6893
6894    /// Similar to "send" but does not shutdown the channel if an error occurs.
6895    pub fn send_no_shutdown_on_err(self, mut groups: &[LightGroup]) -> Result<(), fidl::Error> {
6896        let _result = self.send_raw(groups);
6897        self.drop_without_shutdown();
6898        _result
6899    }
6900
6901    fn send_raw(&self, mut groups: &[LightGroup]) -> Result<(), fidl::Error> {
6902        self.control_handle.inner.send::<LightWatchLightGroupsResponse>(
6903            (groups,),
6904            self.tx_id,
6905            0x3f506de229db5930,
6906            fidl::encoding::DynamicFlags::empty(),
6907        )
6908    }
6909}
6910
6911#[must_use = "FIDL methods require a response to be sent"]
6912#[derive(Debug)]
6913pub struct LightWatchLightGroupResponder {
6914    control_handle: std::mem::ManuallyDrop<LightControlHandle>,
6915    tx_id: u32,
6916}
6917
6918/// Set the the channel to be shutdown (see [`LightControlHandle::shutdown`])
6919/// if the responder is dropped without sending a response, so that the client
6920/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6921impl std::ops::Drop for LightWatchLightGroupResponder {
6922    fn drop(&mut self) {
6923        self.control_handle.shutdown();
6924        // Safety: drops once, never accessed again
6925        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6926    }
6927}
6928
6929impl fidl::endpoints::Responder for LightWatchLightGroupResponder {
6930    type ControlHandle = LightControlHandle;
6931
6932    fn control_handle(&self) -> &LightControlHandle {
6933        &self.control_handle
6934    }
6935
6936    fn drop_without_shutdown(mut self) {
6937        // Safety: drops once, never accessed again due to mem::forget
6938        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6939        // Prevent Drop from running (which would shut down the channel)
6940        std::mem::forget(self);
6941    }
6942}
6943
6944impl LightWatchLightGroupResponder {
6945    /// Sends a response to the FIDL transaction.
6946    ///
6947    /// Sets the channel to shutdown if an error occurs.
6948    pub fn send(self, mut group: &LightGroup) -> Result<(), fidl::Error> {
6949        let _result = self.send_raw(group);
6950        if _result.is_err() {
6951            self.control_handle.shutdown();
6952        }
6953        self.drop_without_shutdown();
6954        _result
6955    }
6956
6957    /// Similar to "send" but does not shutdown the channel if an error occurs.
6958    pub fn send_no_shutdown_on_err(self, mut group: &LightGroup) -> Result<(), fidl::Error> {
6959        let _result = self.send_raw(group);
6960        self.drop_without_shutdown();
6961        _result
6962    }
6963
6964    fn send_raw(&self, mut group: &LightGroup) -> Result<(), fidl::Error> {
6965        self.control_handle.inner.send::<LightWatchLightGroupResponse>(
6966            (group,),
6967            self.tx_id,
6968            0x3ef0331c388d56a3,
6969            fidl::encoding::DynamicFlags::empty(),
6970        )
6971    }
6972}
6973
6974#[must_use = "FIDL methods require a response to be sent"]
6975#[derive(Debug)]
6976pub struct LightSetLightGroupValuesResponder {
6977    control_handle: std::mem::ManuallyDrop<LightControlHandle>,
6978    tx_id: u32,
6979}
6980
6981/// Set the the channel to be shutdown (see [`LightControlHandle::shutdown`])
6982/// if the responder is dropped without sending a response, so that the client
6983/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6984impl std::ops::Drop for LightSetLightGroupValuesResponder {
6985    fn drop(&mut self) {
6986        self.control_handle.shutdown();
6987        // Safety: drops once, never accessed again
6988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6989    }
6990}
6991
6992impl fidl::endpoints::Responder for LightSetLightGroupValuesResponder {
6993    type ControlHandle = LightControlHandle;
6994
6995    fn control_handle(&self) -> &LightControlHandle {
6996        &self.control_handle
6997    }
6998
6999    fn drop_without_shutdown(mut self) {
7000        // Safety: drops once, never accessed again due to mem::forget
7001        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7002        // Prevent Drop from running (which would shut down the channel)
7003        std::mem::forget(self);
7004    }
7005}
7006
7007impl LightSetLightGroupValuesResponder {
7008    /// Sends a response to the FIDL transaction.
7009    ///
7010    /// Sets the channel to shutdown if an error occurs.
7011    pub fn send(self, mut result: Result<(), LightError>) -> Result<(), fidl::Error> {
7012        let _result = self.send_raw(result);
7013        if _result.is_err() {
7014            self.control_handle.shutdown();
7015        }
7016        self.drop_without_shutdown();
7017        _result
7018    }
7019
7020    /// Similar to "send" but does not shutdown the channel if an error occurs.
7021    pub fn send_no_shutdown_on_err(
7022        self,
7023        mut result: Result<(), LightError>,
7024    ) -> Result<(), fidl::Error> {
7025        let _result = self.send_raw(result);
7026        self.drop_without_shutdown();
7027        _result
7028    }
7029
7030    fn send_raw(&self, mut result: Result<(), LightError>) -> Result<(), fidl::Error> {
7031        self.control_handle
7032            .inner
7033            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LightError>>(
7034                result,
7035                self.tx_id,
7036                0x15d9b62431fdf8d5,
7037                fidl::encoding::DynamicFlags::empty(),
7038            )
7039    }
7040}
7041
7042#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7043pub struct NightModeMarker;
7044
7045impl fidl::endpoints::ProtocolMarker for NightModeMarker {
7046    type Proxy = NightModeProxy;
7047    type RequestStream = NightModeRequestStream;
7048    #[cfg(target_os = "fuchsia")]
7049    type SynchronousProxy = NightModeSynchronousProxy;
7050
7051    const DEBUG_NAME: &'static str = "fuchsia.settings.NightMode";
7052}
7053impl fidl::endpoints::DiscoverableProtocolMarker for NightModeMarker {}
7054pub type NightModeSetResult = Result<(), Error>;
7055
7056pub trait NightModeProxyInterface: Send + Sync {
7057    type WatchResponseFut: std::future::Future<Output = Result<NightModeSettings, fidl::Error>>
7058        + Send;
7059    fn r#watch(&self) -> Self::WatchResponseFut;
7060    type SetResponseFut: std::future::Future<Output = Result<NightModeSetResult, fidl::Error>>
7061        + Send;
7062    fn r#set(&self, settings: &NightModeSettings) -> Self::SetResponseFut;
7063}
7064#[derive(Debug)]
7065#[cfg(target_os = "fuchsia")]
7066pub struct NightModeSynchronousProxy {
7067    client: fidl::client::sync::Client,
7068}
7069
7070#[cfg(target_os = "fuchsia")]
7071impl fidl::endpoints::SynchronousProxy for NightModeSynchronousProxy {
7072    type Proxy = NightModeProxy;
7073    type Protocol = NightModeMarker;
7074
7075    fn from_channel(inner: fidl::Channel) -> Self {
7076        Self::new(inner)
7077    }
7078
7079    fn into_channel(self) -> fidl::Channel {
7080        self.client.into_channel()
7081    }
7082
7083    fn as_channel(&self) -> &fidl::Channel {
7084        self.client.as_channel()
7085    }
7086}
7087
7088#[cfg(target_os = "fuchsia")]
7089impl NightModeSynchronousProxy {
7090    pub fn new(channel: fidl::Channel) -> Self {
7091        Self { client: fidl::client::sync::Client::new(channel) }
7092    }
7093
7094    pub fn into_channel(self) -> fidl::Channel {
7095        self.client.into_channel()
7096    }
7097
7098    /// Waits until an event arrives and returns it. It is safe for other
7099    /// threads to make concurrent requests while waiting for an event.
7100    pub fn wait_for_event(
7101        &self,
7102        deadline: zx::MonotonicInstant,
7103    ) -> Result<NightModeEvent, fidl::Error> {
7104        NightModeEvent::decode(self.client.wait_for_event::<NightModeMarker>(deadline)?)
7105    }
7106
7107    /// Gets the current [`NightModeSettings`]. Returns immediately on first
7108    /// call; subsequent calls return when the values change.
7109    ///
7110    /// If this call fails, it is considered a fatal error and the channel
7111    /// will be closed.
7112    pub fn r#watch(
7113        &self,
7114        ___deadline: zx::MonotonicInstant,
7115    ) -> Result<NightModeSettings, fidl::Error> {
7116        let _response = self
7117            .client
7118            .send_query::<fidl::encoding::EmptyPayload, NightModeWatchResponse, NightModeMarker>(
7119                (),
7120                0x7e1509bf8c7582f6,
7121                fidl::encoding::DynamicFlags::empty(),
7122                ___deadline,
7123            )?;
7124        Ok(_response.settings)
7125    }
7126
7127    /// Sets [`NightModeSettings`] settings. Any field not explicitly set in
7128    /// the table performs a no-op, and will not make any changes.
7129    pub fn r#set(
7130        &self,
7131        mut settings: &NightModeSettings,
7132        ___deadline: zx::MonotonicInstant,
7133    ) -> Result<NightModeSetResult, fidl::Error> {
7134        let _response = self.client.send_query::<NightModeSetRequest, fidl::encoding::ResultType<
7135            fidl::encoding::EmptyStruct,
7136            Error,
7137        >, NightModeMarker>(
7138            (settings,),
7139            0x28c3d78ab05b55cd,
7140            fidl::encoding::DynamicFlags::empty(),
7141            ___deadline,
7142        )?;
7143        Ok(_response.map(|x| x))
7144    }
7145}
7146
7147#[cfg(target_os = "fuchsia")]
7148impl From<NightModeSynchronousProxy> for zx::NullableHandle {
7149    fn from(value: NightModeSynchronousProxy) -> Self {
7150        value.into_channel().into()
7151    }
7152}
7153
7154#[cfg(target_os = "fuchsia")]
7155impl From<fidl::Channel> for NightModeSynchronousProxy {
7156    fn from(value: fidl::Channel) -> Self {
7157        Self::new(value)
7158    }
7159}
7160
7161#[cfg(target_os = "fuchsia")]
7162impl fidl::endpoints::FromClient for NightModeSynchronousProxy {
7163    type Protocol = NightModeMarker;
7164
7165    fn from_client(value: fidl::endpoints::ClientEnd<NightModeMarker>) -> Self {
7166        Self::new(value.into_channel())
7167    }
7168}
7169
7170#[derive(Debug, Clone)]
7171pub struct NightModeProxy {
7172    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7173}
7174
7175impl fidl::endpoints::Proxy for NightModeProxy {
7176    type Protocol = NightModeMarker;
7177
7178    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7179        Self::new(inner)
7180    }
7181
7182    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7183        self.client.into_channel().map_err(|client| Self { client })
7184    }
7185
7186    fn as_channel(&self) -> &::fidl::AsyncChannel {
7187        self.client.as_channel()
7188    }
7189}
7190
7191impl NightModeProxy {
7192    /// Create a new Proxy for fuchsia.settings/NightMode.
7193    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7194        let protocol_name = <NightModeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7195        Self { client: fidl::client::Client::new(channel, protocol_name) }
7196    }
7197
7198    /// Get a Stream of events from the remote end of the protocol.
7199    ///
7200    /// # Panics
7201    ///
7202    /// Panics if the event stream was already taken.
7203    pub fn take_event_stream(&self) -> NightModeEventStream {
7204        NightModeEventStream { event_receiver: self.client.take_event_receiver() }
7205    }
7206
7207    /// Gets the current [`NightModeSettings`]. Returns immediately on first
7208    /// call; subsequent calls return when the values change.
7209    ///
7210    /// If this call fails, it is considered a fatal error and the channel
7211    /// will be closed.
7212    pub fn r#watch(
7213        &self,
7214    ) -> fidl::client::QueryResponseFut<
7215        NightModeSettings,
7216        fidl::encoding::DefaultFuchsiaResourceDialect,
7217    > {
7218        NightModeProxyInterface::r#watch(self)
7219    }
7220
7221    /// Sets [`NightModeSettings`] settings. Any field not explicitly set in
7222    /// the table performs a no-op, and will not make any changes.
7223    pub fn r#set(
7224        &self,
7225        mut settings: &NightModeSettings,
7226    ) -> fidl::client::QueryResponseFut<
7227        NightModeSetResult,
7228        fidl::encoding::DefaultFuchsiaResourceDialect,
7229    > {
7230        NightModeProxyInterface::r#set(self, settings)
7231    }
7232}
7233
7234impl NightModeProxyInterface for NightModeProxy {
7235    type WatchResponseFut = fidl::client::QueryResponseFut<
7236        NightModeSettings,
7237        fidl::encoding::DefaultFuchsiaResourceDialect,
7238    >;
7239    fn r#watch(&self) -> Self::WatchResponseFut {
7240        fn _decode(
7241            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7242        ) -> Result<NightModeSettings, fidl::Error> {
7243            let _response = fidl::client::decode_transaction_body::<
7244                NightModeWatchResponse,
7245                fidl::encoding::DefaultFuchsiaResourceDialect,
7246                0x7e1509bf8c7582f6,
7247            >(_buf?)?;
7248            Ok(_response.settings)
7249        }
7250        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NightModeSettings>(
7251            (),
7252            0x7e1509bf8c7582f6,
7253            fidl::encoding::DynamicFlags::empty(),
7254            _decode,
7255        )
7256    }
7257
7258    type SetResponseFut = fidl::client::QueryResponseFut<
7259        NightModeSetResult,
7260        fidl::encoding::DefaultFuchsiaResourceDialect,
7261    >;
7262    fn r#set(&self, mut settings: &NightModeSettings) -> Self::SetResponseFut {
7263        fn _decode(
7264            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7265        ) -> Result<NightModeSetResult, fidl::Error> {
7266            let _response = fidl::client::decode_transaction_body::<
7267                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7268                fidl::encoding::DefaultFuchsiaResourceDialect,
7269                0x28c3d78ab05b55cd,
7270            >(_buf?)?;
7271            Ok(_response.map(|x| x))
7272        }
7273        self.client.send_query_and_decode::<NightModeSetRequest, NightModeSetResult>(
7274            (settings,),
7275            0x28c3d78ab05b55cd,
7276            fidl::encoding::DynamicFlags::empty(),
7277            _decode,
7278        )
7279    }
7280}
7281
7282pub struct NightModeEventStream {
7283    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7284}
7285
7286impl std::marker::Unpin for NightModeEventStream {}
7287
7288impl futures::stream::FusedStream for NightModeEventStream {
7289    fn is_terminated(&self) -> bool {
7290        self.event_receiver.is_terminated()
7291    }
7292}
7293
7294impl futures::Stream for NightModeEventStream {
7295    type Item = Result<NightModeEvent, fidl::Error>;
7296
7297    fn poll_next(
7298        mut self: std::pin::Pin<&mut Self>,
7299        cx: &mut std::task::Context<'_>,
7300    ) -> std::task::Poll<Option<Self::Item>> {
7301        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7302            &mut self.event_receiver,
7303            cx
7304        )?) {
7305            Some(buf) => std::task::Poll::Ready(Some(NightModeEvent::decode(buf))),
7306            None => std::task::Poll::Ready(None),
7307        }
7308    }
7309}
7310
7311#[derive(Debug)]
7312pub enum NightModeEvent {}
7313
7314impl NightModeEvent {
7315    /// Decodes a message buffer as a [`NightModeEvent`].
7316    fn decode(
7317        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7318    ) -> Result<NightModeEvent, fidl::Error> {
7319        let (bytes, _handles) = buf.split_mut();
7320        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7321        debug_assert_eq!(tx_header.tx_id, 0);
7322        match tx_header.ordinal {
7323            _ => Err(fidl::Error::UnknownOrdinal {
7324                ordinal: tx_header.ordinal,
7325                protocol_name: <NightModeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7326            }),
7327        }
7328    }
7329}
7330
7331/// A Stream of incoming requests for fuchsia.settings/NightMode.
7332pub struct NightModeRequestStream {
7333    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7334    is_terminated: bool,
7335}
7336
7337impl std::marker::Unpin for NightModeRequestStream {}
7338
7339impl futures::stream::FusedStream for NightModeRequestStream {
7340    fn is_terminated(&self) -> bool {
7341        self.is_terminated
7342    }
7343}
7344
7345impl fidl::endpoints::RequestStream for NightModeRequestStream {
7346    type Protocol = NightModeMarker;
7347    type ControlHandle = NightModeControlHandle;
7348
7349    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7350        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7351    }
7352
7353    fn control_handle(&self) -> Self::ControlHandle {
7354        NightModeControlHandle { inner: self.inner.clone() }
7355    }
7356
7357    fn into_inner(
7358        self,
7359    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7360    {
7361        (self.inner, self.is_terminated)
7362    }
7363
7364    fn from_inner(
7365        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7366        is_terminated: bool,
7367    ) -> Self {
7368        Self { inner, is_terminated }
7369    }
7370}
7371
7372impl futures::Stream for NightModeRequestStream {
7373    type Item = Result<NightModeRequest, fidl::Error>;
7374
7375    fn poll_next(
7376        mut self: std::pin::Pin<&mut Self>,
7377        cx: &mut std::task::Context<'_>,
7378    ) -> std::task::Poll<Option<Self::Item>> {
7379        let this = &mut *self;
7380        if this.inner.check_shutdown(cx) {
7381            this.is_terminated = true;
7382            return std::task::Poll::Ready(None);
7383        }
7384        if this.is_terminated {
7385            panic!("polled NightModeRequestStream after completion");
7386        }
7387        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7388            |bytes, handles| {
7389                match this.inner.channel().read_etc(cx, bytes, handles) {
7390                    std::task::Poll::Ready(Ok(())) => {}
7391                    std::task::Poll::Pending => return std::task::Poll::Pending,
7392                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7393                        this.is_terminated = true;
7394                        return std::task::Poll::Ready(None);
7395                    }
7396                    std::task::Poll::Ready(Err(e)) => {
7397                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7398                            e.into(),
7399                        ))));
7400                    }
7401                }
7402
7403                // A message has been received from the channel
7404                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7405
7406                std::task::Poll::Ready(Some(match header.ordinal {
7407                    0x7e1509bf8c7582f6 => {
7408                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7409                        let mut req = fidl::new_empty!(
7410                            fidl::encoding::EmptyPayload,
7411                            fidl::encoding::DefaultFuchsiaResourceDialect
7412                        );
7413                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7414                        let control_handle = NightModeControlHandle { inner: this.inner.clone() };
7415                        Ok(NightModeRequest::Watch {
7416                            responder: NightModeWatchResponder {
7417                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7418                                tx_id: header.tx_id,
7419                            },
7420                        })
7421                    }
7422                    0x28c3d78ab05b55cd => {
7423                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7424                        let mut req = fidl::new_empty!(
7425                            NightModeSetRequest,
7426                            fidl::encoding::DefaultFuchsiaResourceDialect
7427                        );
7428                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NightModeSetRequest>(&header, _body_bytes, handles, &mut req)?;
7429                        let control_handle = NightModeControlHandle { inner: this.inner.clone() };
7430                        Ok(NightModeRequest::Set {
7431                            settings: req.settings,
7432
7433                            responder: NightModeSetResponder {
7434                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7435                                tx_id: header.tx_id,
7436                            },
7437                        })
7438                    }
7439                    _ => Err(fidl::Error::UnknownOrdinal {
7440                        ordinal: header.ordinal,
7441                        protocol_name:
7442                            <NightModeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7443                    }),
7444                }))
7445            },
7446        )
7447    }
7448}
7449
7450/// Modify or watch Night Mode setting. Night mode puts the device in a
7451/// restricted mode which can be overrided if the user prefers. During night
7452/// mode, the following settings apply as per night mode parameters:
7453/// 1. DoNotDisturb is enabled/not.
7454/// 2. System volume is set to an override maximum.
7455/// 3. LED Brightness is set to an overridable maximum.
7456/// 4. Sleep mode is enabled/not.
7457///
7458/// Supported SettingsEpitaph enums:
7459/// REQUEST_NOT_SUPPORTED, INTERNAL_SERVICE_ERROR, PERSISTENT_STORAGE_ERROR
7460#[derive(Debug)]
7461pub enum NightModeRequest {
7462    /// Gets the current [`NightModeSettings`]. Returns immediately on first
7463    /// call; subsequent calls return when the values change.
7464    ///
7465    /// If this call fails, it is considered a fatal error and the channel
7466    /// will be closed.
7467    Watch { responder: NightModeWatchResponder },
7468    /// Sets [`NightModeSettings`] settings. Any field not explicitly set in
7469    /// the table performs a no-op, and will not make any changes.
7470    Set { settings: NightModeSettings, responder: NightModeSetResponder },
7471}
7472
7473impl NightModeRequest {
7474    #[allow(irrefutable_let_patterns)]
7475    pub fn into_watch(self) -> Option<(NightModeWatchResponder)> {
7476        if let NightModeRequest::Watch { responder } = self { Some((responder)) } else { None }
7477    }
7478
7479    #[allow(irrefutable_let_patterns)]
7480    pub fn into_set(self) -> Option<(NightModeSettings, NightModeSetResponder)> {
7481        if let NightModeRequest::Set { settings, responder } = self {
7482            Some((settings, responder))
7483        } else {
7484            None
7485        }
7486    }
7487
7488    /// Name of the method defined in FIDL
7489    pub fn method_name(&self) -> &'static str {
7490        match *self {
7491            NightModeRequest::Watch { .. } => "watch",
7492            NightModeRequest::Set { .. } => "set",
7493        }
7494    }
7495}
7496
7497#[derive(Debug, Clone)]
7498pub struct NightModeControlHandle {
7499    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7500}
7501
7502impl fidl::endpoints::ControlHandle for NightModeControlHandle {
7503    fn shutdown(&self) {
7504        self.inner.shutdown()
7505    }
7506
7507    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7508        self.inner.shutdown_with_epitaph(status)
7509    }
7510
7511    fn is_closed(&self) -> bool {
7512        self.inner.channel().is_closed()
7513    }
7514    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7515        self.inner.channel().on_closed()
7516    }
7517
7518    #[cfg(target_os = "fuchsia")]
7519    fn signal_peer(
7520        &self,
7521        clear_mask: zx::Signals,
7522        set_mask: zx::Signals,
7523    ) -> Result<(), zx_status::Status> {
7524        use fidl::Peered;
7525        self.inner.channel().signal_peer(clear_mask, set_mask)
7526    }
7527}
7528
7529impl NightModeControlHandle {}
7530
7531#[must_use = "FIDL methods require a response to be sent"]
7532#[derive(Debug)]
7533pub struct NightModeWatchResponder {
7534    control_handle: std::mem::ManuallyDrop<NightModeControlHandle>,
7535    tx_id: u32,
7536}
7537
7538/// Set the the channel to be shutdown (see [`NightModeControlHandle::shutdown`])
7539/// if the responder is dropped without sending a response, so that the client
7540/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7541impl std::ops::Drop for NightModeWatchResponder {
7542    fn drop(&mut self) {
7543        self.control_handle.shutdown();
7544        // Safety: drops once, never accessed again
7545        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7546    }
7547}
7548
7549impl fidl::endpoints::Responder for NightModeWatchResponder {
7550    type ControlHandle = NightModeControlHandle;
7551
7552    fn control_handle(&self) -> &NightModeControlHandle {
7553        &self.control_handle
7554    }
7555
7556    fn drop_without_shutdown(mut self) {
7557        // Safety: drops once, never accessed again due to mem::forget
7558        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7559        // Prevent Drop from running (which would shut down the channel)
7560        std::mem::forget(self);
7561    }
7562}
7563
7564impl NightModeWatchResponder {
7565    /// Sends a response to the FIDL transaction.
7566    ///
7567    /// Sets the channel to shutdown if an error occurs.
7568    pub fn send(self, mut settings: &NightModeSettings) -> Result<(), fidl::Error> {
7569        let _result = self.send_raw(settings);
7570        if _result.is_err() {
7571            self.control_handle.shutdown();
7572        }
7573        self.drop_without_shutdown();
7574        _result
7575    }
7576
7577    /// Similar to "send" but does not shutdown the channel if an error occurs.
7578    pub fn send_no_shutdown_on_err(
7579        self,
7580        mut settings: &NightModeSettings,
7581    ) -> Result<(), fidl::Error> {
7582        let _result = self.send_raw(settings);
7583        self.drop_without_shutdown();
7584        _result
7585    }
7586
7587    fn send_raw(&self, mut settings: &NightModeSettings) -> Result<(), fidl::Error> {
7588        self.control_handle.inner.send::<NightModeWatchResponse>(
7589            (settings,),
7590            self.tx_id,
7591            0x7e1509bf8c7582f6,
7592            fidl::encoding::DynamicFlags::empty(),
7593        )
7594    }
7595}
7596
7597#[must_use = "FIDL methods require a response to be sent"]
7598#[derive(Debug)]
7599pub struct NightModeSetResponder {
7600    control_handle: std::mem::ManuallyDrop<NightModeControlHandle>,
7601    tx_id: u32,
7602}
7603
7604/// Set the the channel to be shutdown (see [`NightModeControlHandle::shutdown`])
7605/// if the responder is dropped without sending a response, so that the client
7606/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7607impl std::ops::Drop for NightModeSetResponder {
7608    fn drop(&mut self) {
7609        self.control_handle.shutdown();
7610        // Safety: drops once, never accessed again
7611        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7612    }
7613}
7614
7615impl fidl::endpoints::Responder for NightModeSetResponder {
7616    type ControlHandle = NightModeControlHandle;
7617
7618    fn control_handle(&self) -> &NightModeControlHandle {
7619        &self.control_handle
7620    }
7621
7622    fn drop_without_shutdown(mut self) {
7623        // Safety: drops once, never accessed again due to mem::forget
7624        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7625        // Prevent Drop from running (which would shut down the channel)
7626        std::mem::forget(self);
7627    }
7628}
7629
7630impl NightModeSetResponder {
7631    /// Sends a response to the FIDL transaction.
7632    ///
7633    /// Sets the channel to shutdown if an error occurs.
7634    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7635        let _result = self.send_raw(result);
7636        if _result.is_err() {
7637            self.control_handle.shutdown();
7638        }
7639        self.drop_without_shutdown();
7640        _result
7641    }
7642
7643    /// Similar to "send" but does not shutdown the channel if an error occurs.
7644    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7645        let _result = self.send_raw(result);
7646        self.drop_without_shutdown();
7647        _result
7648    }
7649
7650    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7651        self.control_handle
7652            .inner
7653            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7654                result,
7655                self.tx_id,
7656                0x28c3d78ab05b55cd,
7657                fidl::encoding::DynamicFlags::empty(),
7658            )
7659    }
7660}
7661
7662#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7663pub struct PrivacyMarker;
7664
7665impl fidl::endpoints::ProtocolMarker for PrivacyMarker {
7666    type Proxy = PrivacyProxy;
7667    type RequestStream = PrivacyRequestStream;
7668    #[cfg(target_os = "fuchsia")]
7669    type SynchronousProxy = PrivacySynchronousProxy;
7670
7671    const DEBUG_NAME: &'static str = "fuchsia.settings.Privacy";
7672}
7673impl fidl::endpoints::DiscoverableProtocolMarker for PrivacyMarker {}
7674pub type PrivacySetResult = Result<(), Error>;
7675
7676pub trait PrivacyProxyInterface: Send + Sync {
7677    type WatchResponseFut: std::future::Future<Output = Result<PrivacySettings, fidl::Error>> + Send;
7678    fn r#watch(&self) -> Self::WatchResponseFut;
7679    type SetResponseFut: std::future::Future<Output = Result<PrivacySetResult, fidl::Error>> + Send;
7680    fn r#set(&self, settings: &PrivacySettings) -> Self::SetResponseFut;
7681}
7682#[derive(Debug)]
7683#[cfg(target_os = "fuchsia")]
7684pub struct PrivacySynchronousProxy {
7685    client: fidl::client::sync::Client,
7686}
7687
7688#[cfg(target_os = "fuchsia")]
7689impl fidl::endpoints::SynchronousProxy for PrivacySynchronousProxy {
7690    type Proxy = PrivacyProxy;
7691    type Protocol = PrivacyMarker;
7692
7693    fn from_channel(inner: fidl::Channel) -> Self {
7694        Self::new(inner)
7695    }
7696
7697    fn into_channel(self) -> fidl::Channel {
7698        self.client.into_channel()
7699    }
7700
7701    fn as_channel(&self) -> &fidl::Channel {
7702        self.client.as_channel()
7703    }
7704}
7705
7706#[cfg(target_os = "fuchsia")]
7707impl PrivacySynchronousProxy {
7708    pub fn new(channel: fidl::Channel) -> Self {
7709        Self { client: fidl::client::sync::Client::new(channel) }
7710    }
7711
7712    pub fn into_channel(self) -> fidl::Channel {
7713        self.client.into_channel()
7714    }
7715
7716    /// Waits until an event arrives and returns it. It is safe for other
7717    /// threads to make concurrent requests while waiting for an event.
7718    pub fn wait_for_event(
7719        &self,
7720        deadline: zx::MonotonicInstant,
7721    ) -> Result<PrivacyEvent, fidl::Error> {
7722        PrivacyEvent::decode(self.client.wait_for_event::<PrivacyMarker>(deadline)?)
7723    }
7724
7725    /// Notifies of a change in privacy settings.
7726    ///
7727    /// On a given connection, the server will return immediately if this is the first call made,
7728    /// or if the `settings` value has changed since a previous call. Otherwise, the server will
7729    /// wait on a value change before returning the new value. This follows the hanging get pattern.
7730    ///
7731    /// If this call fails, it is considered a fatal error and the channel will be closed.
7732    pub fn r#watch(
7733        &self,
7734        ___deadline: zx::MonotonicInstant,
7735    ) -> Result<PrivacySettings, fidl::Error> {
7736        let _response = self
7737            .client
7738            .send_query::<fidl::encoding::EmptyPayload, PrivacyWatchResponse, PrivacyMarker>(
7739                (),
7740                0x1cb0c420ed81f47c,
7741                fidl::encoding::DynamicFlags::empty(),
7742                ___deadline,
7743            )?;
7744        Ok(_response.settings)
7745    }
7746
7747    /// Sets the privacy settings.
7748    ///
7749    /// Any field not explicitly set in `settings` performs a no-op, and will not make any changes.
7750    pub fn r#set(
7751        &self,
7752        mut settings: &PrivacySettings,
7753        ___deadline: zx::MonotonicInstant,
7754    ) -> Result<PrivacySetResult, fidl::Error> {
7755        let _response = self.client.send_query::<PrivacySetRequest, fidl::encoding::ResultType<
7756            fidl::encoding::EmptyStruct,
7757            Error,
7758        >, PrivacyMarker>(
7759            (settings,),
7760            0xe2f4a1c85885537,
7761            fidl::encoding::DynamicFlags::empty(),
7762            ___deadline,
7763        )?;
7764        Ok(_response.map(|x| x))
7765    }
7766}
7767
7768#[cfg(target_os = "fuchsia")]
7769impl From<PrivacySynchronousProxy> for zx::NullableHandle {
7770    fn from(value: PrivacySynchronousProxy) -> Self {
7771        value.into_channel().into()
7772    }
7773}
7774
7775#[cfg(target_os = "fuchsia")]
7776impl From<fidl::Channel> for PrivacySynchronousProxy {
7777    fn from(value: fidl::Channel) -> Self {
7778        Self::new(value)
7779    }
7780}
7781
7782#[cfg(target_os = "fuchsia")]
7783impl fidl::endpoints::FromClient for PrivacySynchronousProxy {
7784    type Protocol = PrivacyMarker;
7785
7786    fn from_client(value: fidl::endpoints::ClientEnd<PrivacyMarker>) -> Self {
7787        Self::new(value.into_channel())
7788    }
7789}
7790
7791#[derive(Debug, Clone)]
7792pub struct PrivacyProxy {
7793    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7794}
7795
7796impl fidl::endpoints::Proxy for PrivacyProxy {
7797    type Protocol = PrivacyMarker;
7798
7799    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7800        Self::new(inner)
7801    }
7802
7803    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7804        self.client.into_channel().map_err(|client| Self { client })
7805    }
7806
7807    fn as_channel(&self) -> &::fidl::AsyncChannel {
7808        self.client.as_channel()
7809    }
7810}
7811
7812impl PrivacyProxy {
7813    /// Create a new Proxy for fuchsia.settings/Privacy.
7814    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7815        let protocol_name = <PrivacyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7816        Self { client: fidl::client::Client::new(channel, protocol_name) }
7817    }
7818
7819    /// Get a Stream of events from the remote end of the protocol.
7820    ///
7821    /// # Panics
7822    ///
7823    /// Panics if the event stream was already taken.
7824    pub fn take_event_stream(&self) -> PrivacyEventStream {
7825        PrivacyEventStream { event_receiver: self.client.take_event_receiver() }
7826    }
7827
7828    /// Notifies of a change in privacy settings.
7829    ///
7830    /// On a given connection, the server will return immediately if this is the first call made,
7831    /// or if the `settings` value has changed since a previous call. Otherwise, the server will
7832    /// wait on a value change before returning the new value. This follows the hanging get pattern.
7833    ///
7834    /// If this call fails, it is considered a fatal error and the channel will be closed.
7835    pub fn r#watch(
7836        &self,
7837    ) -> fidl::client::QueryResponseFut<
7838        PrivacySettings,
7839        fidl::encoding::DefaultFuchsiaResourceDialect,
7840    > {
7841        PrivacyProxyInterface::r#watch(self)
7842    }
7843
7844    /// Sets the privacy settings.
7845    ///
7846    /// Any field not explicitly set in `settings` performs a no-op, and will not make any changes.
7847    pub fn r#set(
7848        &self,
7849        mut settings: &PrivacySettings,
7850    ) -> fidl::client::QueryResponseFut<
7851        PrivacySetResult,
7852        fidl::encoding::DefaultFuchsiaResourceDialect,
7853    > {
7854        PrivacyProxyInterface::r#set(self, settings)
7855    }
7856}
7857
7858impl PrivacyProxyInterface for PrivacyProxy {
7859    type WatchResponseFut = fidl::client::QueryResponseFut<
7860        PrivacySettings,
7861        fidl::encoding::DefaultFuchsiaResourceDialect,
7862    >;
7863    fn r#watch(&self) -> Self::WatchResponseFut {
7864        fn _decode(
7865            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7866        ) -> Result<PrivacySettings, fidl::Error> {
7867            let _response = fidl::client::decode_transaction_body::<
7868                PrivacyWatchResponse,
7869                fidl::encoding::DefaultFuchsiaResourceDialect,
7870                0x1cb0c420ed81f47c,
7871            >(_buf?)?;
7872            Ok(_response.settings)
7873        }
7874        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PrivacySettings>(
7875            (),
7876            0x1cb0c420ed81f47c,
7877            fidl::encoding::DynamicFlags::empty(),
7878            _decode,
7879        )
7880    }
7881
7882    type SetResponseFut = fidl::client::QueryResponseFut<
7883        PrivacySetResult,
7884        fidl::encoding::DefaultFuchsiaResourceDialect,
7885    >;
7886    fn r#set(&self, mut settings: &PrivacySettings) -> Self::SetResponseFut {
7887        fn _decode(
7888            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7889        ) -> Result<PrivacySetResult, fidl::Error> {
7890            let _response = fidl::client::decode_transaction_body::<
7891                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7892                fidl::encoding::DefaultFuchsiaResourceDialect,
7893                0xe2f4a1c85885537,
7894            >(_buf?)?;
7895            Ok(_response.map(|x| x))
7896        }
7897        self.client.send_query_and_decode::<PrivacySetRequest, PrivacySetResult>(
7898            (settings,),
7899            0xe2f4a1c85885537,
7900            fidl::encoding::DynamicFlags::empty(),
7901            _decode,
7902        )
7903    }
7904}
7905
7906pub struct PrivacyEventStream {
7907    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7908}
7909
7910impl std::marker::Unpin for PrivacyEventStream {}
7911
7912impl futures::stream::FusedStream for PrivacyEventStream {
7913    fn is_terminated(&self) -> bool {
7914        self.event_receiver.is_terminated()
7915    }
7916}
7917
7918impl futures::Stream for PrivacyEventStream {
7919    type Item = Result<PrivacyEvent, fidl::Error>;
7920
7921    fn poll_next(
7922        mut self: std::pin::Pin<&mut Self>,
7923        cx: &mut std::task::Context<'_>,
7924    ) -> std::task::Poll<Option<Self::Item>> {
7925        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7926            &mut self.event_receiver,
7927            cx
7928        )?) {
7929            Some(buf) => std::task::Poll::Ready(Some(PrivacyEvent::decode(buf))),
7930            None => std::task::Poll::Ready(None),
7931        }
7932    }
7933}
7934
7935#[derive(Debug)]
7936pub enum PrivacyEvent {}
7937
7938impl PrivacyEvent {
7939    /// Decodes a message buffer as a [`PrivacyEvent`].
7940    fn decode(
7941        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7942    ) -> Result<PrivacyEvent, fidl::Error> {
7943        let (bytes, _handles) = buf.split_mut();
7944        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7945        debug_assert_eq!(tx_header.tx_id, 0);
7946        match tx_header.ordinal {
7947            _ => Err(fidl::Error::UnknownOrdinal {
7948                ordinal: tx_header.ordinal,
7949                protocol_name: <PrivacyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7950            }),
7951        }
7952    }
7953}
7954
7955/// A Stream of incoming requests for fuchsia.settings/Privacy.
7956pub struct PrivacyRequestStream {
7957    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7958    is_terminated: bool,
7959}
7960
7961impl std::marker::Unpin for PrivacyRequestStream {}
7962
7963impl futures::stream::FusedStream for PrivacyRequestStream {
7964    fn is_terminated(&self) -> bool {
7965        self.is_terminated
7966    }
7967}
7968
7969impl fidl::endpoints::RequestStream for PrivacyRequestStream {
7970    type Protocol = PrivacyMarker;
7971    type ControlHandle = PrivacyControlHandle;
7972
7973    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7974        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7975    }
7976
7977    fn control_handle(&self) -> Self::ControlHandle {
7978        PrivacyControlHandle { inner: self.inner.clone() }
7979    }
7980
7981    fn into_inner(
7982        self,
7983    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7984    {
7985        (self.inner, self.is_terminated)
7986    }
7987
7988    fn from_inner(
7989        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7990        is_terminated: bool,
7991    ) -> Self {
7992        Self { inner, is_terminated }
7993    }
7994}
7995
7996impl futures::Stream for PrivacyRequestStream {
7997    type Item = Result<PrivacyRequest, fidl::Error>;
7998
7999    fn poll_next(
8000        mut self: std::pin::Pin<&mut Self>,
8001        cx: &mut std::task::Context<'_>,
8002    ) -> std::task::Poll<Option<Self::Item>> {
8003        let this = &mut *self;
8004        if this.inner.check_shutdown(cx) {
8005            this.is_terminated = true;
8006            return std::task::Poll::Ready(None);
8007        }
8008        if this.is_terminated {
8009            panic!("polled PrivacyRequestStream after completion");
8010        }
8011        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8012            |bytes, handles| {
8013                match this.inner.channel().read_etc(cx, bytes, handles) {
8014                    std::task::Poll::Ready(Ok(())) => {}
8015                    std::task::Poll::Pending => return std::task::Poll::Pending,
8016                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8017                        this.is_terminated = true;
8018                        return std::task::Poll::Ready(None);
8019                    }
8020                    std::task::Poll::Ready(Err(e)) => {
8021                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8022                            e.into(),
8023                        ))));
8024                    }
8025                }
8026
8027                // A message has been received from the channel
8028                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8029
8030                std::task::Poll::Ready(Some(match header.ordinal {
8031                    0x1cb0c420ed81f47c => {
8032                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8033                        let mut req = fidl::new_empty!(
8034                            fidl::encoding::EmptyPayload,
8035                            fidl::encoding::DefaultFuchsiaResourceDialect
8036                        );
8037                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8038                        let control_handle = PrivacyControlHandle { inner: this.inner.clone() };
8039                        Ok(PrivacyRequest::Watch {
8040                            responder: PrivacyWatchResponder {
8041                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8042                                tx_id: header.tx_id,
8043                            },
8044                        })
8045                    }
8046                    0xe2f4a1c85885537 => {
8047                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8048                        let mut req = fidl::new_empty!(
8049                            PrivacySetRequest,
8050                            fidl::encoding::DefaultFuchsiaResourceDialect
8051                        );
8052                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrivacySetRequest>(&header, _body_bytes, handles, &mut req)?;
8053                        let control_handle = PrivacyControlHandle { inner: this.inner.clone() };
8054                        Ok(PrivacyRequest::Set {
8055                            settings: req.settings,
8056
8057                            responder: PrivacySetResponder {
8058                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8059                                tx_id: header.tx_id,
8060                            },
8061                        })
8062                    }
8063                    _ => Err(fidl::Error::UnknownOrdinal {
8064                        ordinal: header.ordinal,
8065                        protocol_name:
8066                            <PrivacyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8067                    }),
8068                }))
8069            },
8070        )
8071    }
8072}
8073
8074/// Settings related to privacy.
8075///
8076/// Supported SettingsEpitaph enums:
8077/// REQUEST_NOT_SUPPORTED, INTERNAL_SERVICE_ERROR, PERSISTENT_STORAGE_ERROR
8078#[derive(Debug)]
8079pub enum PrivacyRequest {
8080    /// Notifies of a change in privacy settings.
8081    ///
8082    /// On a given connection, the server will return immediately if this is the first call made,
8083    /// or if the `settings` value has changed since a previous call. Otherwise, the server will
8084    /// wait on a value change before returning the new value. This follows the hanging get pattern.
8085    ///
8086    /// If this call fails, it is considered a fatal error and the channel will be closed.
8087    Watch { responder: PrivacyWatchResponder },
8088    /// Sets the privacy settings.
8089    ///
8090    /// Any field not explicitly set in `settings` performs a no-op, and will not make any changes.
8091    Set { settings: PrivacySettings, responder: PrivacySetResponder },
8092}
8093
8094impl PrivacyRequest {
8095    #[allow(irrefutable_let_patterns)]
8096    pub fn into_watch(self) -> Option<(PrivacyWatchResponder)> {
8097        if let PrivacyRequest::Watch { responder } = self { Some((responder)) } else { None }
8098    }
8099
8100    #[allow(irrefutable_let_patterns)]
8101    pub fn into_set(self) -> Option<(PrivacySettings, PrivacySetResponder)> {
8102        if let PrivacyRequest::Set { settings, responder } = self {
8103            Some((settings, responder))
8104        } else {
8105            None
8106        }
8107    }
8108
8109    /// Name of the method defined in FIDL
8110    pub fn method_name(&self) -> &'static str {
8111        match *self {
8112            PrivacyRequest::Watch { .. } => "watch",
8113            PrivacyRequest::Set { .. } => "set",
8114        }
8115    }
8116}
8117
8118#[derive(Debug, Clone)]
8119pub struct PrivacyControlHandle {
8120    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8121}
8122
8123impl fidl::endpoints::ControlHandle for PrivacyControlHandle {
8124    fn shutdown(&self) {
8125        self.inner.shutdown()
8126    }
8127
8128    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8129        self.inner.shutdown_with_epitaph(status)
8130    }
8131
8132    fn is_closed(&self) -> bool {
8133        self.inner.channel().is_closed()
8134    }
8135    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8136        self.inner.channel().on_closed()
8137    }
8138
8139    #[cfg(target_os = "fuchsia")]
8140    fn signal_peer(
8141        &self,
8142        clear_mask: zx::Signals,
8143        set_mask: zx::Signals,
8144    ) -> Result<(), zx_status::Status> {
8145        use fidl::Peered;
8146        self.inner.channel().signal_peer(clear_mask, set_mask)
8147    }
8148}
8149
8150impl PrivacyControlHandle {}
8151
8152#[must_use = "FIDL methods require a response to be sent"]
8153#[derive(Debug)]
8154pub struct PrivacyWatchResponder {
8155    control_handle: std::mem::ManuallyDrop<PrivacyControlHandle>,
8156    tx_id: u32,
8157}
8158
8159/// Set the the channel to be shutdown (see [`PrivacyControlHandle::shutdown`])
8160/// if the responder is dropped without sending a response, so that the client
8161/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8162impl std::ops::Drop for PrivacyWatchResponder {
8163    fn drop(&mut self) {
8164        self.control_handle.shutdown();
8165        // Safety: drops once, never accessed again
8166        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8167    }
8168}
8169
8170impl fidl::endpoints::Responder for PrivacyWatchResponder {
8171    type ControlHandle = PrivacyControlHandle;
8172
8173    fn control_handle(&self) -> &PrivacyControlHandle {
8174        &self.control_handle
8175    }
8176
8177    fn drop_without_shutdown(mut self) {
8178        // Safety: drops once, never accessed again due to mem::forget
8179        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8180        // Prevent Drop from running (which would shut down the channel)
8181        std::mem::forget(self);
8182    }
8183}
8184
8185impl PrivacyWatchResponder {
8186    /// Sends a response to the FIDL transaction.
8187    ///
8188    /// Sets the channel to shutdown if an error occurs.
8189    pub fn send(self, mut settings: &PrivacySettings) -> Result<(), fidl::Error> {
8190        let _result = self.send_raw(settings);
8191        if _result.is_err() {
8192            self.control_handle.shutdown();
8193        }
8194        self.drop_without_shutdown();
8195        _result
8196    }
8197
8198    /// Similar to "send" but does not shutdown the channel if an error occurs.
8199    pub fn send_no_shutdown_on_err(
8200        self,
8201        mut settings: &PrivacySettings,
8202    ) -> Result<(), fidl::Error> {
8203        let _result = self.send_raw(settings);
8204        self.drop_without_shutdown();
8205        _result
8206    }
8207
8208    fn send_raw(&self, mut settings: &PrivacySettings) -> Result<(), fidl::Error> {
8209        self.control_handle.inner.send::<PrivacyWatchResponse>(
8210            (settings,),
8211            self.tx_id,
8212            0x1cb0c420ed81f47c,
8213            fidl::encoding::DynamicFlags::empty(),
8214        )
8215    }
8216}
8217
8218#[must_use = "FIDL methods require a response to be sent"]
8219#[derive(Debug)]
8220pub struct PrivacySetResponder {
8221    control_handle: std::mem::ManuallyDrop<PrivacyControlHandle>,
8222    tx_id: u32,
8223}
8224
8225/// Set the the channel to be shutdown (see [`PrivacyControlHandle::shutdown`])
8226/// if the responder is dropped without sending a response, so that the client
8227/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8228impl std::ops::Drop for PrivacySetResponder {
8229    fn drop(&mut self) {
8230        self.control_handle.shutdown();
8231        // Safety: drops once, never accessed again
8232        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8233    }
8234}
8235
8236impl fidl::endpoints::Responder for PrivacySetResponder {
8237    type ControlHandle = PrivacyControlHandle;
8238
8239    fn control_handle(&self) -> &PrivacyControlHandle {
8240        &self.control_handle
8241    }
8242
8243    fn drop_without_shutdown(mut self) {
8244        // Safety: drops once, never accessed again due to mem::forget
8245        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8246        // Prevent Drop from running (which would shut down the channel)
8247        std::mem::forget(self);
8248    }
8249}
8250
8251impl PrivacySetResponder {
8252    /// Sends a response to the FIDL transaction.
8253    ///
8254    /// Sets the channel to shutdown if an error occurs.
8255    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8256        let _result = self.send_raw(result);
8257        if _result.is_err() {
8258            self.control_handle.shutdown();
8259        }
8260        self.drop_without_shutdown();
8261        _result
8262    }
8263
8264    /// Similar to "send" but does not shutdown the channel if an error occurs.
8265    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8266        let _result = self.send_raw(result);
8267        self.drop_without_shutdown();
8268        _result
8269    }
8270
8271    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8272        self.control_handle
8273            .inner
8274            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
8275                result,
8276                self.tx_id,
8277                0xe2f4a1c85885537,
8278                fidl::encoding::DynamicFlags::empty(),
8279            )
8280    }
8281}
8282
8283#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8284pub struct SetupMarker;
8285
8286impl fidl::endpoints::ProtocolMarker for SetupMarker {
8287    type Proxy = SetupProxy;
8288    type RequestStream = SetupRequestStream;
8289    #[cfg(target_os = "fuchsia")]
8290    type SynchronousProxy = SetupSynchronousProxy;
8291
8292    const DEBUG_NAME: &'static str = "fuchsia.settings.Setup";
8293}
8294impl fidl::endpoints::DiscoverableProtocolMarker for SetupMarker {}
8295pub type SetupSetResult = Result<(), Error>;
8296
8297pub trait SetupProxyInterface: Send + Sync {
8298    type WatchResponseFut: std::future::Future<Output = Result<SetupSettings, fidl::Error>> + Send;
8299    fn r#watch(&self) -> Self::WatchResponseFut;
8300    type SetResponseFut: std::future::Future<Output = Result<SetupSetResult, fidl::Error>> + Send;
8301    fn r#set(&self, settings: &SetupSettings, reboot_device: bool) -> Self::SetResponseFut;
8302}
8303#[derive(Debug)]
8304#[cfg(target_os = "fuchsia")]
8305pub struct SetupSynchronousProxy {
8306    client: fidl::client::sync::Client,
8307}
8308
8309#[cfg(target_os = "fuchsia")]
8310impl fidl::endpoints::SynchronousProxy for SetupSynchronousProxy {
8311    type Proxy = SetupProxy;
8312    type Protocol = SetupMarker;
8313
8314    fn from_channel(inner: fidl::Channel) -> Self {
8315        Self::new(inner)
8316    }
8317
8318    fn into_channel(self) -> fidl::Channel {
8319        self.client.into_channel()
8320    }
8321
8322    fn as_channel(&self) -> &fidl::Channel {
8323        self.client.as_channel()
8324    }
8325}
8326
8327#[cfg(target_os = "fuchsia")]
8328impl SetupSynchronousProxy {
8329    pub fn new(channel: fidl::Channel) -> Self {
8330        Self { client: fidl::client::sync::Client::new(channel) }
8331    }
8332
8333    pub fn into_channel(self) -> fidl::Channel {
8334        self.client.into_channel()
8335    }
8336
8337    /// Waits until an event arrives and returns it. It is safe for other
8338    /// threads to make concurrent requests while waiting for an event.
8339    pub fn wait_for_event(
8340        &self,
8341        deadline: zx::MonotonicInstant,
8342    ) -> Result<SetupEvent, fidl::Error> {
8343        SetupEvent::decode(self.client.wait_for_event::<SetupMarker>(deadline)?)
8344    }
8345
8346    /// Gets the current [SetupSettings]. Returns immediately on first call;
8347    /// subsequent calls return when the value changes.
8348    ///
8349    /// If this call fails, it is considered a fatal error and the channel
8350    /// will be closed.
8351    pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<SetupSettings, fidl::Error> {
8352        let _response = self
8353            .client
8354            .send_query::<fidl::encoding::EmptyPayload, SetupWatchResponse, SetupMarker>(
8355                (),
8356                0xd3893c0e63c0a6e,
8357                fidl::encoding::DynamicFlags::empty(),
8358                ___deadline,
8359            )?;
8360        Ok(_response.settings)
8361    }
8362
8363    /// Changes the settings specified in [SetupSettings]. Any field not set in
8364    /// the table will not perform any system operation. An error will be
8365    /// returned if the provided settings is an invalid change (for example, if
8366    /// it is empty).
8367    pub fn r#set(
8368        &self,
8369        mut settings: &SetupSettings,
8370        mut reboot_device: bool,
8371        ___deadline: zx::MonotonicInstant,
8372    ) -> Result<SetupSetResult, fidl::Error> {
8373        let _response = self.client.send_query::<SetupSetRequest, fidl::encoding::ResultType<
8374            fidl::encoding::EmptyStruct,
8375            Error,
8376        >, SetupMarker>(
8377            (settings, reboot_device),
8378            0x66a20be769388128,
8379            fidl::encoding::DynamicFlags::empty(),
8380            ___deadline,
8381        )?;
8382        Ok(_response.map(|x| x))
8383    }
8384}
8385
8386#[cfg(target_os = "fuchsia")]
8387impl From<SetupSynchronousProxy> for zx::NullableHandle {
8388    fn from(value: SetupSynchronousProxy) -> Self {
8389        value.into_channel().into()
8390    }
8391}
8392
8393#[cfg(target_os = "fuchsia")]
8394impl From<fidl::Channel> for SetupSynchronousProxy {
8395    fn from(value: fidl::Channel) -> Self {
8396        Self::new(value)
8397    }
8398}
8399
8400#[cfg(target_os = "fuchsia")]
8401impl fidl::endpoints::FromClient for SetupSynchronousProxy {
8402    type Protocol = SetupMarker;
8403
8404    fn from_client(value: fidl::endpoints::ClientEnd<SetupMarker>) -> Self {
8405        Self::new(value.into_channel())
8406    }
8407}
8408
8409#[derive(Debug, Clone)]
8410pub struct SetupProxy {
8411    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8412}
8413
8414impl fidl::endpoints::Proxy for SetupProxy {
8415    type Protocol = SetupMarker;
8416
8417    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8418        Self::new(inner)
8419    }
8420
8421    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8422        self.client.into_channel().map_err(|client| Self { client })
8423    }
8424
8425    fn as_channel(&self) -> &::fidl::AsyncChannel {
8426        self.client.as_channel()
8427    }
8428}
8429
8430impl SetupProxy {
8431    /// Create a new Proxy for fuchsia.settings/Setup.
8432    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8433        let protocol_name = <SetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8434        Self { client: fidl::client::Client::new(channel, protocol_name) }
8435    }
8436
8437    /// Get a Stream of events from the remote end of the protocol.
8438    ///
8439    /// # Panics
8440    ///
8441    /// Panics if the event stream was already taken.
8442    pub fn take_event_stream(&self) -> SetupEventStream {
8443        SetupEventStream { event_receiver: self.client.take_event_receiver() }
8444    }
8445
8446    /// Gets the current [SetupSettings]. Returns immediately on first call;
8447    /// subsequent calls return when the value changes.
8448    ///
8449    /// If this call fails, it is considered a fatal error and the channel
8450    /// will be closed.
8451    pub fn r#watch(
8452        &self,
8453    ) -> fidl::client::QueryResponseFut<SetupSettings, fidl::encoding::DefaultFuchsiaResourceDialect>
8454    {
8455        SetupProxyInterface::r#watch(self)
8456    }
8457
8458    /// Changes the settings specified in [SetupSettings]. Any field not set in
8459    /// the table will not perform any system operation. An error will be
8460    /// returned if the provided settings is an invalid change (for example, if
8461    /// it is empty).
8462    pub fn r#set(
8463        &self,
8464        mut settings: &SetupSettings,
8465        mut reboot_device: bool,
8466    ) -> fidl::client::QueryResponseFut<SetupSetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
8467    {
8468        SetupProxyInterface::r#set(self, settings, reboot_device)
8469    }
8470}
8471
8472impl SetupProxyInterface for SetupProxy {
8473    type WatchResponseFut = fidl::client::QueryResponseFut<
8474        SetupSettings,
8475        fidl::encoding::DefaultFuchsiaResourceDialect,
8476    >;
8477    fn r#watch(&self) -> Self::WatchResponseFut {
8478        fn _decode(
8479            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8480        ) -> Result<SetupSettings, fidl::Error> {
8481            let _response = fidl::client::decode_transaction_body::<
8482                SetupWatchResponse,
8483                fidl::encoding::DefaultFuchsiaResourceDialect,
8484                0xd3893c0e63c0a6e,
8485            >(_buf?)?;
8486            Ok(_response.settings)
8487        }
8488        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SetupSettings>(
8489            (),
8490            0xd3893c0e63c0a6e,
8491            fidl::encoding::DynamicFlags::empty(),
8492            _decode,
8493        )
8494    }
8495
8496    type SetResponseFut = fidl::client::QueryResponseFut<
8497        SetupSetResult,
8498        fidl::encoding::DefaultFuchsiaResourceDialect,
8499    >;
8500    fn r#set(&self, mut settings: &SetupSettings, mut reboot_device: bool) -> Self::SetResponseFut {
8501        fn _decode(
8502            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8503        ) -> Result<SetupSetResult, fidl::Error> {
8504            let _response = fidl::client::decode_transaction_body::<
8505                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
8506                fidl::encoding::DefaultFuchsiaResourceDialect,
8507                0x66a20be769388128,
8508            >(_buf?)?;
8509            Ok(_response.map(|x| x))
8510        }
8511        self.client.send_query_and_decode::<SetupSetRequest, SetupSetResult>(
8512            (settings, reboot_device),
8513            0x66a20be769388128,
8514            fidl::encoding::DynamicFlags::empty(),
8515            _decode,
8516        )
8517    }
8518}
8519
8520pub struct SetupEventStream {
8521    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8522}
8523
8524impl std::marker::Unpin for SetupEventStream {}
8525
8526impl futures::stream::FusedStream for SetupEventStream {
8527    fn is_terminated(&self) -> bool {
8528        self.event_receiver.is_terminated()
8529    }
8530}
8531
8532impl futures::Stream for SetupEventStream {
8533    type Item = Result<SetupEvent, fidl::Error>;
8534
8535    fn poll_next(
8536        mut self: std::pin::Pin<&mut Self>,
8537        cx: &mut std::task::Context<'_>,
8538    ) -> std::task::Poll<Option<Self::Item>> {
8539        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8540            &mut self.event_receiver,
8541            cx
8542        )?) {
8543            Some(buf) => std::task::Poll::Ready(Some(SetupEvent::decode(buf))),
8544            None => std::task::Poll::Ready(None),
8545        }
8546    }
8547}
8548
8549#[derive(Debug)]
8550pub enum SetupEvent {}
8551
8552impl SetupEvent {
8553    /// Decodes a message buffer as a [`SetupEvent`].
8554    fn decode(
8555        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8556    ) -> Result<SetupEvent, fidl::Error> {
8557        let (bytes, _handles) = buf.split_mut();
8558        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8559        debug_assert_eq!(tx_header.tx_id, 0);
8560        match tx_header.ordinal {
8561            _ => Err(fidl::Error::UnknownOrdinal {
8562                ordinal: tx_header.ordinal,
8563                protocol_name: <SetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8564            }),
8565        }
8566    }
8567}
8568
8569/// A Stream of incoming requests for fuchsia.settings/Setup.
8570pub struct SetupRequestStream {
8571    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8572    is_terminated: bool,
8573}
8574
8575impl std::marker::Unpin for SetupRequestStream {}
8576
8577impl futures::stream::FusedStream for SetupRequestStream {
8578    fn is_terminated(&self) -> bool {
8579        self.is_terminated
8580    }
8581}
8582
8583impl fidl::endpoints::RequestStream for SetupRequestStream {
8584    type Protocol = SetupMarker;
8585    type ControlHandle = SetupControlHandle;
8586
8587    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8588        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8589    }
8590
8591    fn control_handle(&self) -> Self::ControlHandle {
8592        SetupControlHandle { inner: self.inner.clone() }
8593    }
8594
8595    fn into_inner(
8596        self,
8597    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8598    {
8599        (self.inner, self.is_terminated)
8600    }
8601
8602    fn from_inner(
8603        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8604        is_terminated: bool,
8605    ) -> Self {
8606        Self { inner, is_terminated }
8607    }
8608}
8609
8610impl futures::Stream for SetupRequestStream {
8611    type Item = Result<SetupRequest, fidl::Error>;
8612
8613    fn poll_next(
8614        mut self: std::pin::Pin<&mut Self>,
8615        cx: &mut std::task::Context<'_>,
8616    ) -> std::task::Poll<Option<Self::Item>> {
8617        let this = &mut *self;
8618        if this.inner.check_shutdown(cx) {
8619            this.is_terminated = true;
8620            return std::task::Poll::Ready(None);
8621        }
8622        if this.is_terminated {
8623            panic!("polled SetupRequestStream after completion");
8624        }
8625        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8626            |bytes, handles| {
8627                match this.inner.channel().read_etc(cx, bytes, handles) {
8628                    std::task::Poll::Ready(Ok(())) => {}
8629                    std::task::Poll::Pending => return std::task::Poll::Pending,
8630                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8631                        this.is_terminated = true;
8632                        return std::task::Poll::Ready(None);
8633                    }
8634                    std::task::Poll::Ready(Err(e)) => {
8635                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8636                            e.into(),
8637                        ))));
8638                    }
8639                }
8640
8641                // A message has been received from the channel
8642                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8643
8644                std::task::Poll::Ready(Some(match header.ordinal {
8645                    0xd3893c0e63c0a6e => {
8646                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8647                        let mut req = fidl::new_empty!(
8648                            fidl::encoding::EmptyPayload,
8649                            fidl::encoding::DefaultFuchsiaResourceDialect
8650                        );
8651                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8652                        let control_handle = SetupControlHandle { inner: this.inner.clone() };
8653                        Ok(SetupRequest::Watch {
8654                            responder: SetupWatchResponder {
8655                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8656                                tx_id: header.tx_id,
8657                            },
8658                        })
8659                    }
8660                    0x66a20be769388128 => {
8661                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8662                        let mut req = fidl::new_empty!(
8663                            SetupSetRequest,
8664                            fidl::encoding::DefaultFuchsiaResourceDialect
8665                        );
8666                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SetupSetRequest>(&header, _body_bytes, handles, &mut req)?;
8667                        let control_handle = SetupControlHandle { inner: this.inner.clone() };
8668                        Ok(SetupRequest::Set {
8669                            settings: req.settings,
8670                            reboot_device: req.reboot_device,
8671
8672                            responder: SetupSetResponder {
8673                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8674                                tx_id: header.tx_id,
8675                            },
8676                        })
8677                    }
8678                    _ => Err(fidl::Error::UnknownOrdinal {
8679                        ordinal: header.ordinal,
8680                        protocol_name: <SetupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8681                    }),
8682                }))
8683            },
8684        )
8685    }
8686}
8687
8688/// Settings that influence the device's setup behavior.
8689///
8690/// Supported SettingsEpitaph enums:
8691/// REQUEST_NOT_SUPPORTED, INTERNAL_SERVICE_ERROR, PERSISTENT_STORAGE_ERROR
8692#[derive(Debug)]
8693pub enum SetupRequest {
8694    /// Gets the current [SetupSettings]. Returns immediately on first call;
8695    /// subsequent calls return when the value changes.
8696    ///
8697    /// If this call fails, it is considered a fatal error and the channel
8698    /// will be closed.
8699    Watch { responder: SetupWatchResponder },
8700    /// Changes the settings specified in [SetupSettings]. Any field not set in
8701    /// the table will not perform any system operation. An error will be
8702    /// returned if the provided settings is an invalid change (for example, if
8703    /// it is empty).
8704    Set { settings: SetupSettings, reboot_device: bool, responder: SetupSetResponder },
8705}
8706
8707impl SetupRequest {
8708    #[allow(irrefutable_let_patterns)]
8709    pub fn into_watch(self) -> Option<(SetupWatchResponder)> {
8710        if let SetupRequest::Watch { responder } = self { Some((responder)) } else { None }
8711    }
8712
8713    #[allow(irrefutable_let_patterns)]
8714    pub fn into_set(self) -> Option<(SetupSettings, bool, SetupSetResponder)> {
8715        if let SetupRequest::Set { settings, reboot_device, responder } = self {
8716            Some((settings, reboot_device, responder))
8717        } else {
8718            None
8719        }
8720    }
8721
8722    /// Name of the method defined in FIDL
8723    pub fn method_name(&self) -> &'static str {
8724        match *self {
8725            SetupRequest::Watch { .. } => "watch",
8726            SetupRequest::Set { .. } => "set",
8727        }
8728    }
8729}
8730
8731#[derive(Debug, Clone)]
8732pub struct SetupControlHandle {
8733    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8734}
8735
8736impl fidl::endpoints::ControlHandle for SetupControlHandle {
8737    fn shutdown(&self) {
8738        self.inner.shutdown()
8739    }
8740
8741    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8742        self.inner.shutdown_with_epitaph(status)
8743    }
8744
8745    fn is_closed(&self) -> bool {
8746        self.inner.channel().is_closed()
8747    }
8748    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8749        self.inner.channel().on_closed()
8750    }
8751
8752    #[cfg(target_os = "fuchsia")]
8753    fn signal_peer(
8754        &self,
8755        clear_mask: zx::Signals,
8756        set_mask: zx::Signals,
8757    ) -> Result<(), zx_status::Status> {
8758        use fidl::Peered;
8759        self.inner.channel().signal_peer(clear_mask, set_mask)
8760    }
8761}
8762
8763impl SetupControlHandle {}
8764
8765#[must_use = "FIDL methods require a response to be sent"]
8766#[derive(Debug)]
8767pub struct SetupWatchResponder {
8768    control_handle: std::mem::ManuallyDrop<SetupControlHandle>,
8769    tx_id: u32,
8770}
8771
8772/// Set the the channel to be shutdown (see [`SetupControlHandle::shutdown`])
8773/// if the responder is dropped without sending a response, so that the client
8774/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8775impl std::ops::Drop for SetupWatchResponder {
8776    fn drop(&mut self) {
8777        self.control_handle.shutdown();
8778        // Safety: drops once, never accessed again
8779        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8780    }
8781}
8782
8783impl fidl::endpoints::Responder for SetupWatchResponder {
8784    type ControlHandle = SetupControlHandle;
8785
8786    fn control_handle(&self) -> &SetupControlHandle {
8787        &self.control_handle
8788    }
8789
8790    fn drop_without_shutdown(mut self) {
8791        // Safety: drops once, never accessed again due to mem::forget
8792        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8793        // Prevent Drop from running (which would shut down the channel)
8794        std::mem::forget(self);
8795    }
8796}
8797
8798impl SetupWatchResponder {
8799    /// Sends a response to the FIDL transaction.
8800    ///
8801    /// Sets the channel to shutdown if an error occurs.
8802    pub fn send(self, mut settings: &SetupSettings) -> Result<(), fidl::Error> {
8803        let _result = self.send_raw(settings);
8804        if _result.is_err() {
8805            self.control_handle.shutdown();
8806        }
8807        self.drop_without_shutdown();
8808        _result
8809    }
8810
8811    /// Similar to "send" but does not shutdown the channel if an error occurs.
8812    pub fn send_no_shutdown_on_err(self, mut settings: &SetupSettings) -> Result<(), fidl::Error> {
8813        let _result = self.send_raw(settings);
8814        self.drop_without_shutdown();
8815        _result
8816    }
8817
8818    fn send_raw(&self, mut settings: &SetupSettings) -> Result<(), fidl::Error> {
8819        self.control_handle.inner.send::<SetupWatchResponse>(
8820            (settings,),
8821            self.tx_id,
8822            0xd3893c0e63c0a6e,
8823            fidl::encoding::DynamicFlags::empty(),
8824        )
8825    }
8826}
8827
8828#[must_use = "FIDL methods require a response to be sent"]
8829#[derive(Debug)]
8830pub struct SetupSetResponder {
8831    control_handle: std::mem::ManuallyDrop<SetupControlHandle>,
8832    tx_id: u32,
8833}
8834
8835/// Set the the channel to be shutdown (see [`SetupControlHandle::shutdown`])
8836/// if the responder is dropped without sending a response, so that the client
8837/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8838impl std::ops::Drop for SetupSetResponder {
8839    fn drop(&mut self) {
8840        self.control_handle.shutdown();
8841        // Safety: drops once, never accessed again
8842        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8843    }
8844}
8845
8846impl fidl::endpoints::Responder for SetupSetResponder {
8847    type ControlHandle = SetupControlHandle;
8848
8849    fn control_handle(&self) -> &SetupControlHandle {
8850        &self.control_handle
8851    }
8852
8853    fn drop_without_shutdown(mut self) {
8854        // Safety: drops once, never accessed again due to mem::forget
8855        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8856        // Prevent Drop from running (which would shut down the channel)
8857        std::mem::forget(self);
8858    }
8859}
8860
8861impl SetupSetResponder {
8862    /// Sends a response to the FIDL transaction.
8863    ///
8864    /// Sets the channel to shutdown if an error occurs.
8865    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8866        let _result = self.send_raw(result);
8867        if _result.is_err() {
8868            self.control_handle.shutdown();
8869        }
8870        self.drop_without_shutdown();
8871        _result
8872    }
8873
8874    /// Similar to "send" but does not shutdown the channel if an error occurs.
8875    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8876        let _result = self.send_raw(result);
8877        self.drop_without_shutdown();
8878        _result
8879    }
8880
8881    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
8882        self.control_handle
8883            .inner
8884            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
8885                result,
8886                self.tx_id,
8887                0x66a20be769388128,
8888                fidl::encoding::DynamicFlags::empty(),
8889            )
8890    }
8891}
8892
8893mod internal {
8894    use super::*;
8895}