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