fidl_fuchsia_ui_policy/
fidl_fuchsia_ui_policy.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_ui_policy__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceListenerRegistryRegisterListenerRequest {
16    pub listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for DeviceListenerRegistryRegisterListenerRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct DeviceListenerRegistryRegisterMediaButtonsListenerRequest {
26    pub listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
31{
32}
33
34#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
35pub struct DeviceListenerRegistryMarker;
36
37impl fidl::endpoints::ProtocolMarker for DeviceListenerRegistryMarker {
38    type Proxy = DeviceListenerRegistryProxy;
39    type RequestStream = DeviceListenerRegistryRequestStream;
40    #[cfg(target_os = "fuchsia")]
41    type SynchronousProxy = DeviceListenerRegistrySynchronousProxy;
42
43    const DEBUG_NAME: &'static str = "fuchsia.ui.policy.DeviceListenerRegistry";
44}
45impl fidl::endpoints::DiscoverableProtocolMarker for DeviceListenerRegistryMarker {}
46
47pub trait DeviceListenerRegistryProxyInterface: Send + Sync {
48    fn r#register_media_buttons_listener(
49        &self,
50        listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
51    ) -> Result<(), fidl::Error>;
52    type RegisterListenerResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
53    fn r#register_listener(
54        &self,
55        listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
56    ) -> Self::RegisterListenerResponseFut;
57}
58#[derive(Debug)]
59#[cfg(target_os = "fuchsia")]
60pub struct DeviceListenerRegistrySynchronousProxy {
61    client: fidl::client::sync::Client,
62}
63
64#[cfg(target_os = "fuchsia")]
65impl fidl::endpoints::SynchronousProxy for DeviceListenerRegistrySynchronousProxy {
66    type Proxy = DeviceListenerRegistryProxy;
67    type Protocol = DeviceListenerRegistryMarker;
68
69    fn from_channel(inner: fidl::Channel) -> Self {
70        Self::new(inner)
71    }
72
73    fn into_channel(self) -> fidl::Channel {
74        self.client.into_channel()
75    }
76
77    fn as_channel(&self) -> &fidl::Channel {
78        self.client.as_channel()
79    }
80}
81
82#[cfg(target_os = "fuchsia")]
83impl DeviceListenerRegistrySynchronousProxy {
84    pub fn new(channel: fidl::Channel) -> Self {
85        let protocol_name =
86            <DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
87        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
88    }
89
90    pub fn into_channel(self) -> fidl::Channel {
91        self.client.into_channel()
92    }
93
94    /// Waits until an event arrives and returns it. It is safe for other
95    /// threads to make concurrent requests while waiting for an event.
96    pub fn wait_for_event(
97        &self,
98        deadline: zx::MonotonicInstant,
99    ) -> Result<DeviceListenerRegistryEvent, fidl::Error> {
100        DeviceListenerRegistryEvent::decode(self.client.wait_for_event(deadline)?)
101    }
102
103    /// Registers a listener to receive media button related events, such as
104    /// changes from volume buttons and mute switches.
105    pub fn r#register_media_buttons_listener(
106        &self,
107        mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
108    ) -> Result<(), fidl::Error> {
109        self.client.send::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
110            (listener,),
111            0x3826318765c72e70,
112            fidl::encoding::DynamicFlags::empty(),
113        )
114    }
115
116    /// Registers a listener to receive media button related events, such as
117    /// changes from volume buttons and mute switches.
118    /// On registration, the `listener` receives the last media button event that
119    /// occurred, if one exists, and all media button events going forward.
120    pub fn r#register_listener(
121        &self,
122        mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
123        ___deadline: zx::MonotonicInstant,
124    ) -> Result<(), fidl::Error> {
125        let _response = self.client.send_query::<
126            DeviceListenerRegistryRegisterListenerRequest,
127            fidl::encoding::EmptyPayload,
128        >(
129            (listener,),
130            0x2f9e7eea89485a7b,
131            fidl::encoding::DynamicFlags::empty(),
132            ___deadline,
133        )?;
134        Ok(_response)
135    }
136}
137
138#[cfg(target_os = "fuchsia")]
139impl From<DeviceListenerRegistrySynchronousProxy> for zx::Handle {
140    fn from(value: DeviceListenerRegistrySynchronousProxy) -> Self {
141        value.into_channel().into()
142    }
143}
144
145#[cfg(target_os = "fuchsia")]
146impl From<fidl::Channel> for DeviceListenerRegistrySynchronousProxy {
147    fn from(value: fidl::Channel) -> Self {
148        Self::new(value)
149    }
150}
151
152#[cfg(target_os = "fuchsia")]
153impl fidl::endpoints::FromClient for DeviceListenerRegistrySynchronousProxy {
154    type Protocol = DeviceListenerRegistryMarker;
155
156    fn from_client(value: fidl::endpoints::ClientEnd<DeviceListenerRegistryMarker>) -> Self {
157        Self::new(value.into_channel())
158    }
159}
160
161#[derive(Debug, Clone)]
162pub struct DeviceListenerRegistryProxy {
163    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
164}
165
166impl fidl::endpoints::Proxy for DeviceListenerRegistryProxy {
167    type Protocol = DeviceListenerRegistryMarker;
168
169    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
170        Self::new(inner)
171    }
172
173    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
174        self.client.into_channel().map_err(|client| Self { client })
175    }
176
177    fn as_channel(&self) -> &::fidl::AsyncChannel {
178        self.client.as_channel()
179    }
180}
181
182impl DeviceListenerRegistryProxy {
183    /// Create a new Proxy for fuchsia.ui.policy/DeviceListenerRegistry.
184    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
185        let protocol_name =
186            <DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
187        Self { client: fidl::client::Client::new(channel, protocol_name) }
188    }
189
190    /// Get a Stream of events from the remote end of the protocol.
191    ///
192    /// # Panics
193    ///
194    /// Panics if the event stream was already taken.
195    pub fn take_event_stream(&self) -> DeviceListenerRegistryEventStream {
196        DeviceListenerRegistryEventStream { event_receiver: self.client.take_event_receiver() }
197    }
198
199    /// Registers a listener to receive media button related events, such as
200    /// changes from volume buttons and mute switches.
201    pub fn r#register_media_buttons_listener(
202        &self,
203        mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
204    ) -> Result<(), fidl::Error> {
205        DeviceListenerRegistryProxyInterface::r#register_media_buttons_listener(self, listener)
206    }
207
208    /// Registers a listener to receive media button related events, such as
209    /// changes from volume buttons and mute switches.
210    /// On registration, the `listener` receives the last media button event that
211    /// occurred, if one exists, and all media button events going forward.
212    pub fn r#register_listener(
213        &self,
214        mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
215    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
216        DeviceListenerRegistryProxyInterface::r#register_listener(self, listener)
217    }
218}
219
220impl DeviceListenerRegistryProxyInterface for DeviceListenerRegistryProxy {
221    fn r#register_media_buttons_listener(
222        &self,
223        mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
224    ) -> Result<(), fidl::Error> {
225        self.client.send::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
226            (listener,),
227            0x3826318765c72e70,
228            fidl::encoding::DynamicFlags::empty(),
229        )
230    }
231
232    type RegisterListenerResponseFut =
233        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
234    fn r#register_listener(
235        &self,
236        mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
237    ) -> Self::RegisterListenerResponseFut {
238        fn _decode(
239            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
240        ) -> Result<(), fidl::Error> {
241            let _response = fidl::client::decode_transaction_body::<
242                fidl::encoding::EmptyPayload,
243                fidl::encoding::DefaultFuchsiaResourceDialect,
244                0x2f9e7eea89485a7b,
245            >(_buf?)?;
246            Ok(_response)
247        }
248        self.client.send_query_and_decode::<DeviceListenerRegistryRegisterListenerRequest, ()>(
249            (listener,),
250            0x2f9e7eea89485a7b,
251            fidl::encoding::DynamicFlags::empty(),
252            _decode,
253        )
254    }
255}
256
257pub struct DeviceListenerRegistryEventStream {
258    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
259}
260
261impl std::marker::Unpin for DeviceListenerRegistryEventStream {}
262
263impl futures::stream::FusedStream for DeviceListenerRegistryEventStream {
264    fn is_terminated(&self) -> bool {
265        self.event_receiver.is_terminated()
266    }
267}
268
269impl futures::Stream for DeviceListenerRegistryEventStream {
270    type Item = Result<DeviceListenerRegistryEvent, fidl::Error>;
271
272    fn poll_next(
273        mut self: std::pin::Pin<&mut Self>,
274        cx: &mut std::task::Context<'_>,
275    ) -> std::task::Poll<Option<Self::Item>> {
276        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
277            &mut self.event_receiver,
278            cx
279        )?) {
280            Some(buf) => std::task::Poll::Ready(Some(DeviceListenerRegistryEvent::decode(buf))),
281            None => std::task::Poll::Ready(None),
282        }
283    }
284}
285
286#[derive(Debug)]
287pub enum DeviceListenerRegistryEvent {}
288
289impl DeviceListenerRegistryEvent {
290    /// Decodes a message buffer as a [`DeviceListenerRegistryEvent`].
291    fn decode(
292        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
293    ) -> Result<DeviceListenerRegistryEvent, fidl::Error> {
294        let (bytes, _handles) = buf.split_mut();
295        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
296        debug_assert_eq!(tx_header.tx_id, 0);
297        match tx_header.ordinal {
298            _ => Err(fidl::Error::UnknownOrdinal {
299                ordinal: tx_header.ordinal,
300                protocol_name:
301                    <DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
302            }),
303        }
304    }
305}
306
307/// A Stream of incoming requests for fuchsia.ui.policy/DeviceListenerRegistry.
308pub struct DeviceListenerRegistryRequestStream {
309    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
310    is_terminated: bool,
311}
312
313impl std::marker::Unpin for DeviceListenerRegistryRequestStream {}
314
315impl futures::stream::FusedStream for DeviceListenerRegistryRequestStream {
316    fn is_terminated(&self) -> bool {
317        self.is_terminated
318    }
319}
320
321impl fidl::endpoints::RequestStream for DeviceListenerRegistryRequestStream {
322    type Protocol = DeviceListenerRegistryMarker;
323    type ControlHandle = DeviceListenerRegistryControlHandle;
324
325    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
326        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
327    }
328
329    fn control_handle(&self) -> Self::ControlHandle {
330        DeviceListenerRegistryControlHandle { inner: self.inner.clone() }
331    }
332
333    fn into_inner(
334        self,
335    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
336    {
337        (self.inner, self.is_terminated)
338    }
339
340    fn from_inner(
341        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
342        is_terminated: bool,
343    ) -> Self {
344        Self { inner, is_terminated }
345    }
346}
347
348impl futures::Stream for DeviceListenerRegistryRequestStream {
349    type Item = Result<DeviceListenerRegistryRequest, fidl::Error>;
350
351    fn poll_next(
352        mut self: std::pin::Pin<&mut Self>,
353        cx: &mut std::task::Context<'_>,
354    ) -> std::task::Poll<Option<Self::Item>> {
355        let this = &mut *self;
356        if this.inner.check_shutdown(cx) {
357            this.is_terminated = true;
358            return std::task::Poll::Ready(None);
359        }
360        if this.is_terminated {
361            panic!("polled DeviceListenerRegistryRequestStream after completion");
362        }
363        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
364            |bytes, handles| {
365                match this.inner.channel().read_etc(cx, bytes, handles) {
366                    std::task::Poll::Ready(Ok(())) => {}
367                    std::task::Poll::Pending => return std::task::Poll::Pending,
368                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
369                        this.is_terminated = true;
370                        return std::task::Poll::Ready(None);
371                    }
372                    std::task::Poll::Ready(Err(e)) => {
373                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
374                            e.into(),
375                        ))))
376                    }
377                }
378
379                // A message has been received from the channel
380                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
381
382                std::task::Poll::Ready(Some(match header.ordinal {
383                0x3826318765c72e70 => {
384                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
385                    let mut req = fidl::new_empty!(DeviceListenerRegistryRegisterMediaButtonsListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
386                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(&header, _body_bytes, handles, &mut req)?;
387                    let control_handle = DeviceListenerRegistryControlHandle {
388                        inner: this.inner.clone(),
389                    };
390                    Ok(DeviceListenerRegistryRequest::RegisterMediaButtonsListener {listener: req.listener,
391
392                        control_handle,
393                    })
394                }
395                0x2f9e7eea89485a7b => {
396                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
397                    let mut req = fidl::new_empty!(DeviceListenerRegistryRegisterListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
398                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceListenerRegistryRegisterListenerRequest>(&header, _body_bytes, handles, &mut req)?;
399                    let control_handle = DeviceListenerRegistryControlHandle {
400                        inner: this.inner.clone(),
401                    };
402                    Ok(DeviceListenerRegistryRequest::RegisterListener {listener: req.listener,
403
404                        responder: DeviceListenerRegistryRegisterListenerResponder {
405                            control_handle: std::mem::ManuallyDrop::new(control_handle),
406                            tx_id: header.tx_id,
407                        },
408                    })
409                }
410                _ => Err(fidl::Error::UnknownOrdinal {
411                    ordinal: header.ordinal,
412                    protocol_name: <DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
413                }),
414            }))
415            },
416        )
417    }
418}
419
420/// Service for exposing state and events of devices, such as media buttons.
421#[derive(Debug)]
422pub enum DeviceListenerRegistryRequest {
423    /// Registers a listener to receive media button related events, such as
424    /// changes from volume buttons and mute switches.
425    RegisterMediaButtonsListener {
426        listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
427        control_handle: DeviceListenerRegistryControlHandle,
428    },
429    /// Registers a listener to receive media button related events, such as
430    /// changes from volume buttons and mute switches.
431    /// On registration, the `listener` receives the last media button event that
432    /// occurred, if one exists, and all media button events going forward.
433    RegisterListener {
434        listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
435        responder: DeviceListenerRegistryRegisterListenerResponder,
436    },
437}
438
439impl DeviceListenerRegistryRequest {
440    #[allow(irrefutable_let_patterns)]
441    pub fn into_register_media_buttons_listener(
442        self,
443    ) -> Option<(
444        fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
445        DeviceListenerRegistryControlHandle,
446    )> {
447        if let DeviceListenerRegistryRequest::RegisterMediaButtonsListener {
448            listener,
449            control_handle,
450        } = self
451        {
452            Some((listener, control_handle))
453        } else {
454            None
455        }
456    }
457
458    #[allow(irrefutable_let_patterns)]
459    pub fn into_register_listener(
460        self,
461    ) -> Option<(
462        fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
463        DeviceListenerRegistryRegisterListenerResponder,
464    )> {
465        if let DeviceListenerRegistryRequest::RegisterListener { listener, responder } = self {
466            Some((listener, 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            DeviceListenerRegistryRequest::RegisterMediaButtonsListener { .. } => {
476                "register_media_buttons_listener"
477            }
478            DeviceListenerRegistryRequest::RegisterListener { .. } => "register_listener",
479        }
480    }
481}
482
483#[derive(Debug, Clone)]
484pub struct DeviceListenerRegistryControlHandle {
485    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
486}
487
488impl fidl::endpoints::ControlHandle for DeviceListenerRegistryControlHandle {
489    fn shutdown(&self) {
490        self.inner.shutdown()
491    }
492    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
493        self.inner.shutdown_with_epitaph(status)
494    }
495
496    fn is_closed(&self) -> bool {
497        self.inner.channel().is_closed()
498    }
499    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
500        self.inner.channel().on_closed()
501    }
502
503    #[cfg(target_os = "fuchsia")]
504    fn signal_peer(
505        &self,
506        clear_mask: zx::Signals,
507        set_mask: zx::Signals,
508    ) -> Result<(), zx_status::Status> {
509        use fidl::Peered;
510        self.inner.channel().signal_peer(clear_mask, set_mask)
511    }
512}
513
514impl DeviceListenerRegistryControlHandle {}
515
516#[must_use = "FIDL methods require a response to be sent"]
517#[derive(Debug)]
518pub struct DeviceListenerRegistryRegisterListenerResponder {
519    control_handle: std::mem::ManuallyDrop<DeviceListenerRegistryControlHandle>,
520    tx_id: u32,
521}
522
523/// Set the the channel to be shutdown (see [`DeviceListenerRegistryControlHandle::shutdown`])
524/// if the responder is dropped without sending a response, so that the client
525/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
526impl std::ops::Drop for DeviceListenerRegistryRegisterListenerResponder {
527    fn drop(&mut self) {
528        self.control_handle.shutdown();
529        // Safety: drops once, never accessed again
530        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
531    }
532}
533
534impl fidl::endpoints::Responder for DeviceListenerRegistryRegisterListenerResponder {
535    type ControlHandle = DeviceListenerRegistryControlHandle;
536
537    fn control_handle(&self) -> &DeviceListenerRegistryControlHandle {
538        &self.control_handle
539    }
540
541    fn drop_without_shutdown(mut self) {
542        // Safety: drops once, never accessed again due to mem::forget
543        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
544        // Prevent Drop from running (which would shut down the channel)
545        std::mem::forget(self);
546    }
547}
548
549impl DeviceListenerRegistryRegisterListenerResponder {
550    /// Sends a response to the FIDL transaction.
551    ///
552    /// Sets the channel to shutdown if an error occurs.
553    pub fn send(self) -> Result<(), fidl::Error> {
554        let _result = self.send_raw();
555        if _result.is_err() {
556            self.control_handle.shutdown();
557        }
558        self.drop_without_shutdown();
559        _result
560    }
561
562    /// Similar to "send" but does not shutdown the channel if an error occurs.
563    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
564        let _result = self.send_raw();
565        self.drop_without_shutdown();
566        _result
567    }
568
569    fn send_raw(&self) -> Result<(), fidl::Error> {
570        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
571            (),
572            self.tx_id,
573            0x2f9e7eea89485a7b,
574            fidl::encoding::DynamicFlags::empty(),
575        )
576    }
577}
578
579#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
580pub struct DisplayBacklightMarker;
581
582impl fidl::endpoints::ProtocolMarker for DisplayBacklightMarker {
583    type Proxy = DisplayBacklightProxy;
584    type RequestStream = DisplayBacklightRequestStream;
585    #[cfg(target_os = "fuchsia")]
586    type SynchronousProxy = DisplayBacklightSynchronousProxy;
587
588    const DEBUG_NAME: &'static str = "fuchsia.ui.policy.DisplayBacklight";
589}
590impl fidl::endpoints::DiscoverableProtocolMarker for DisplayBacklightMarker {}
591
592pub trait DisplayBacklightProxyInterface: Send + Sync {
593    type SetMinimumRgbResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
594    fn r#set_minimum_rgb(&self, minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut;
595}
596#[derive(Debug)]
597#[cfg(target_os = "fuchsia")]
598pub struct DisplayBacklightSynchronousProxy {
599    client: fidl::client::sync::Client,
600}
601
602#[cfg(target_os = "fuchsia")]
603impl fidl::endpoints::SynchronousProxy for DisplayBacklightSynchronousProxy {
604    type Proxy = DisplayBacklightProxy;
605    type Protocol = DisplayBacklightMarker;
606
607    fn from_channel(inner: fidl::Channel) -> Self {
608        Self::new(inner)
609    }
610
611    fn into_channel(self) -> fidl::Channel {
612        self.client.into_channel()
613    }
614
615    fn as_channel(&self) -> &fidl::Channel {
616        self.client.as_channel()
617    }
618}
619
620#[cfg(target_os = "fuchsia")]
621impl DisplayBacklightSynchronousProxy {
622    pub fn new(channel: fidl::Channel) -> Self {
623        let protocol_name = <DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
624        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
625    }
626
627    pub fn into_channel(self) -> fidl::Channel {
628        self.client.into_channel()
629    }
630
631    /// Waits until an event arrives and returns it. It is safe for other
632    /// threads to make concurrent requests while waiting for an event.
633    pub fn wait_for_event(
634        &self,
635        deadline: zx::MonotonicInstant,
636    ) -> Result<DisplayBacklightEvent, fidl::Error> {
637        DisplayBacklightEvent::decode(self.client.wait_for_event(deadline)?)
638    }
639
640    /// Submits a new minimum color channel value for display backlight.
641    ///
642    /// The valid range for a minimum value is [0, 255] (inclusive).  For a new
643    /// minimum value M, each color channel's range will be limited to [M, 255].
644    ///
645    /// Flow control: The caller is allowed at most one in-flight
646    /// |SetMinimumRgb| at at time. Subsequent calls must wait until the
647    /// acknowledgment returns. Non-compliance results in channel closure.
648    pub fn r#set_minimum_rgb(
649        &self,
650        mut minimum_rgb: u8,
651        ___deadline: zx::MonotonicInstant,
652    ) -> Result<(), fidl::Error> {
653        let _response = self
654            .client
655            .send_query::<DisplayBacklightSetMinimumRgbRequest, fidl::encoding::EmptyPayload>(
656                (minimum_rgb,),
657                0x25604347bb8a1ca3,
658                fidl::encoding::DynamicFlags::empty(),
659                ___deadline,
660            )?;
661        Ok(_response)
662    }
663}
664
665#[cfg(target_os = "fuchsia")]
666impl From<DisplayBacklightSynchronousProxy> for zx::Handle {
667    fn from(value: DisplayBacklightSynchronousProxy) -> Self {
668        value.into_channel().into()
669    }
670}
671
672#[cfg(target_os = "fuchsia")]
673impl From<fidl::Channel> for DisplayBacklightSynchronousProxy {
674    fn from(value: fidl::Channel) -> Self {
675        Self::new(value)
676    }
677}
678
679#[cfg(target_os = "fuchsia")]
680impl fidl::endpoints::FromClient for DisplayBacklightSynchronousProxy {
681    type Protocol = DisplayBacklightMarker;
682
683    fn from_client(value: fidl::endpoints::ClientEnd<DisplayBacklightMarker>) -> Self {
684        Self::new(value.into_channel())
685    }
686}
687
688#[derive(Debug, Clone)]
689pub struct DisplayBacklightProxy {
690    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
691}
692
693impl fidl::endpoints::Proxy for DisplayBacklightProxy {
694    type Protocol = DisplayBacklightMarker;
695
696    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
697        Self::new(inner)
698    }
699
700    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
701        self.client.into_channel().map_err(|client| Self { client })
702    }
703
704    fn as_channel(&self) -> &::fidl::AsyncChannel {
705        self.client.as_channel()
706    }
707}
708
709impl DisplayBacklightProxy {
710    /// Create a new Proxy for fuchsia.ui.policy/DisplayBacklight.
711    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
712        let protocol_name = <DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
713        Self { client: fidl::client::Client::new(channel, protocol_name) }
714    }
715
716    /// Get a Stream of events from the remote end of the protocol.
717    ///
718    /// # Panics
719    ///
720    /// Panics if the event stream was already taken.
721    pub fn take_event_stream(&self) -> DisplayBacklightEventStream {
722        DisplayBacklightEventStream { event_receiver: self.client.take_event_receiver() }
723    }
724
725    /// Submits a new minimum color channel value for display backlight.
726    ///
727    /// The valid range for a minimum value is [0, 255] (inclusive).  For a new
728    /// minimum value M, each color channel's range will be limited to [M, 255].
729    ///
730    /// Flow control: The caller is allowed at most one in-flight
731    /// |SetMinimumRgb| at at time. Subsequent calls must wait until the
732    /// acknowledgment returns. Non-compliance results in channel closure.
733    pub fn r#set_minimum_rgb(
734        &self,
735        mut minimum_rgb: u8,
736    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
737        DisplayBacklightProxyInterface::r#set_minimum_rgb(self, minimum_rgb)
738    }
739}
740
741impl DisplayBacklightProxyInterface for DisplayBacklightProxy {
742    type SetMinimumRgbResponseFut =
743        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
744    fn r#set_minimum_rgb(&self, mut minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut {
745        fn _decode(
746            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
747        ) -> Result<(), fidl::Error> {
748            let _response = fidl::client::decode_transaction_body::<
749                fidl::encoding::EmptyPayload,
750                fidl::encoding::DefaultFuchsiaResourceDialect,
751                0x25604347bb8a1ca3,
752            >(_buf?)?;
753            Ok(_response)
754        }
755        self.client.send_query_and_decode::<DisplayBacklightSetMinimumRgbRequest, ()>(
756            (minimum_rgb,),
757            0x25604347bb8a1ca3,
758            fidl::encoding::DynamicFlags::empty(),
759            _decode,
760        )
761    }
762}
763
764pub struct DisplayBacklightEventStream {
765    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
766}
767
768impl std::marker::Unpin for DisplayBacklightEventStream {}
769
770impl futures::stream::FusedStream for DisplayBacklightEventStream {
771    fn is_terminated(&self) -> bool {
772        self.event_receiver.is_terminated()
773    }
774}
775
776impl futures::Stream for DisplayBacklightEventStream {
777    type Item = Result<DisplayBacklightEvent, fidl::Error>;
778
779    fn poll_next(
780        mut self: std::pin::Pin<&mut Self>,
781        cx: &mut std::task::Context<'_>,
782    ) -> std::task::Poll<Option<Self::Item>> {
783        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
784            &mut self.event_receiver,
785            cx
786        )?) {
787            Some(buf) => std::task::Poll::Ready(Some(DisplayBacklightEvent::decode(buf))),
788            None => std::task::Poll::Ready(None),
789        }
790    }
791}
792
793#[derive(Debug)]
794pub enum DisplayBacklightEvent {}
795
796impl DisplayBacklightEvent {
797    /// Decodes a message buffer as a [`DisplayBacklightEvent`].
798    fn decode(
799        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
800    ) -> Result<DisplayBacklightEvent, fidl::Error> {
801        let (bytes, _handles) = buf.split_mut();
802        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
803        debug_assert_eq!(tx_header.tx_id, 0);
804        match tx_header.ordinal {
805            _ => Err(fidl::Error::UnknownOrdinal {
806                ordinal: tx_header.ordinal,
807                protocol_name:
808                    <DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
809            }),
810        }
811    }
812}
813
814/// A Stream of incoming requests for fuchsia.ui.policy/DisplayBacklight.
815pub struct DisplayBacklightRequestStream {
816    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
817    is_terminated: bool,
818}
819
820impl std::marker::Unpin for DisplayBacklightRequestStream {}
821
822impl futures::stream::FusedStream for DisplayBacklightRequestStream {
823    fn is_terminated(&self) -> bool {
824        self.is_terminated
825    }
826}
827
828impl fidl::endpoints::RequestStream for DisplayBacklightRequestStream {
829    type Protocol = DisplayBacklightMarker;
830    type ControlHandle = DisplayBacklightControlHandle;
831
832    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
833        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
834    }
835
836    fn control_handle(&self) -> Self::ControlHandle {
837        DisplayBacklightControlHandle { inner: self.inner.clone() }
838    }
839
840    fn into_inner(
841        self,
842    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
843    {
844        (self.inner, self.is_terminated)
845    }
846
847    fn from_inner(
848        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
849        is_terminated: bool,
850    ) -> Self {
851        Self { inner, is_terminated }
852    }
853}
854
855impl futures::Stream for DisplayBacklightRequestStream {
856    type Item = Result<DisplayBacklightRequest, fidl::Error>;
857
858    fn poll_next(
859        mut self: std::pin::Pin<&mut Self>,
860        cx: &mut std::task::Context<'_>,
861    ) -> std::task::Poll<Option<Self::Item>> {
862        let this = &mut *self;
863        if this.inner.check_shutdown(cx) {
864            this.is_terminated = true;
865            return std::task::Poll::Ready(None);
866        }
867        if this.is_terminated {
868            panic!("polled DisplayBacklightRequestStream after completion");
869        }
870        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
871            |bytes, handles| {
872                match this.inner.channel().read_etc(cx, bytes, handles) {
873                    std::task::Poll::Ready(Ok(())) => {}
874                    std::task::Poll::Pending => return std::task::Poll::Pending,
875                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
876                        this.is_terminated = true;
877                        return std::task::Poll::Ready(None);
878                    }
879                    std::task::Poll::Ready(Err(e)) => {
880                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
881                            e.into(),
882                        ))))
883                    }
884                }
885
886                // A message has been received from the channel
887                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
888
889                std::task::Poll::Ready(Some(match header.ordinal {
890                    0x25604347bb8a1ca3 => {
891                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
892                        let mut req = fidl::new_empty!(
893                            DisplayBacklightSetMinimumRgbRequest,
894                            fidl::encoding::DefaultFuchsiaResourceDialect
895                        );
896                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DisplayBacklightSetMinimumRgbRequest>(&header, _body_bytes, handles, &mut req)?;
897                        let control_handle =
898                            DisplayBacklightControlHandle { inner: this.inner.clone() };
899                        Ok(DisplayBacklightRequest::SetMinimumRgb {
900                            minimum_rgb: req.minimum_rgb,
901
902                            responder: DisplayBacklightSetMinimumRgbResponder {
903                                control_handle: std::mem::ManuallyDrop::new(control_handle),
904                                tx_id: header.tx_id,
905                            },
906                        })
907                    }
908                    _ => Err(fidl::Error::UnknownOrdinal {
909                        ordinal: header.ordinal,
910                        protocol_name:
911                            <DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
912                    }),
913                }))
914            },
915        )
916    }
917}
918
919/// Manipulates global policy for display backlight. Serves as the main "front
920/// end" interface for usage by UX components; other protocols (such as
921/// fuchsia.ui.scenic.Session and fuchsia.hardware.display.Controller) act as
922/// implementation.
923///
924/// Global Scope. All displays, in all display controllers, are affected uniformly.
925///
926/// Effect Timing. This protocol does not guarantee a deadline by which the
927/// minimum value is applied to a display; it is best effort.
928///
929/// Multiple clients. This protocol does not guarantee unique access to
930/// manipulate display backlight functionality.
931///
932/// Reference. Related to fuchsia.hardware.display.Controller.
933#[derive(Debug)]
934pub enum DisplayBacklightRequest {
935    /// Submits a new minimum color channel value for display backlight.
936    ///
937    /// The valid range for a minimum value is [0, 255] (inclusive).  For a new
938    /// minimum value M, each color channel's range will be limited to [M, 255].
939    ///
940    /// Flow control: The caller is allowed at most one in-flight
941    /// |SetMinimumRgb| at at time. Subsequent calls must wait until the
942    /// acknowledgment returns. Non-compliance results in channel closure.
943    SetMinimumRgb { minimum_rgb: u8, responder: DisplayBacklightSetMinimumRgbResponder },
944}
945
946impl DisplayBacklightRequest {
947    #[allow(irrefutable_let_patterns)]
948    pub fn into_set_minimum_rgb(self) -> Option<(u8, DisplayBacklightSetMinimumRgbResponder)> {
949        if let DisplayBacklightRequest::SetMinimumRgb { minimum_rgb, responder } = self {
950            Some((minimum_rgb, responder))
951        } else {
952            None
953        }
954    }
955
956    /// Name of the method defined in FIDL
957    pub fn method_name(&self) -> &'static str {
958        match *self {
959            DisplayBacklightRequest::SetMinimumRgb { .. } => "set_minimum_rgb",
960        }
961    }
962}
963
964#[derive(Debug, Clone)]
965pub struct DisplayBacklightControlHandle {
966    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
967}
968
969impl fidl::endpoints::ControlHandle for DisplayBacklightControlHandle {
970    fn shutdown(&self) {
971        self.inner.shutdown()
972    }
973    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
974        self.inner.shutdown_with_epitaph(status)
975    }
976
977    fn is_closed(&self) -> bool {
978        self.inner.channel().is_closed()
979    }
980    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
981        self.inner.channel().on_closed()
982    }
983
984    #[cfg(target_os = "fuchsia")]
985    fn signal_peer(
986        &self,
987        clear_mask: zx::Signals,
988        set_mask: zx::Signals,
989    ) -> Result<(), zx_status::Status> {
990        use fidl::Peered;
991        self.inner.channel().signal_peer(clear_mask, set_mask)
992    }
993}
994
995impl DisplayBacklightControlHandle {}
996
997#[must_use = "FIDL methods require a response to be sent"]
998#[derive(Debug)]
999pub struct DisplayBacklightSetMinimumRgbResponder {
1000    control_handle: std::mem::ManuallyDrop<DisplayBacklightControlHandle>,
1001    tx_id: u32,
1002}
1003
1004/// Set the the channel to be shutdown (see [`DisplayBacklightControlHandle::shutdown`])
1005/// if the responder is dropped without sending a response, so that the client
1006/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1007impl std::ops::Drop for DisplayBacklightSetMinimumRgbResponder {
1008    fn drop(&mut self) {
1009        self.control_handle.shutdown();
1010        // Safety: drops once, never accessed again
1011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1012    }
1013}
1014
1015impl fidl::endpoints::Responder for DisplayBacklightSetMinimumRgbResponder {
1016    type ControlHandle = DisplayBacklightControlHandle;
1017
1018    fn control_handle(&self) -> &DisplayBacklightControlHandle {
1019        &self.control_handle
1020    }
1021
1022    fn drop_without_shutdown(mut self) {
1023        // Safety: drops once, never accessed again due to mem::forget
1024        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1025        // Prevent Drop from running (which would shut down the channel)
1026        std::mem::forget(self);
1027    }
1028}
1029
1030impl DisplayBacklightSetMinimumRgbResponder {
1031    /// Sends a response to the FIDL transaction.
1032    ///
1033    /// Sets the channel to shutdown if an error occurs.
1034    pub fn send(self) -> Result<(), fidl::Error> {
1035        let _result = self.send_raw();
1036        if _result.is_err() {
1037            self.control_handle.shutdown();
1038        }
1039        self.drop_without_shutdown();
1040        _result
1041    }
1042
1043    /// Similar to "send" but does not shutdown the channel if an error occurs.
1044    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1045        let _result = self.send_raw();
1046        self.drop_without_shutdown();
1047        _result
1048    }
1049
1050    fn send_raw(&self) -> Result<(), fidl::Error> {
1051        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1052            (),
1053            self.tx_id,
1054            0x25604347bb8a1ca3,
1055            fidl::encoding::DynamicFlags::empty(),
1056        )
1057    }
1058}
1059
1060#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1061pub struct MediaButtonsListenerMarker;
1062
1063impl fidl::endpoints::ProtocolMarker for MediaButtonsListenerMarker {
1064    type Proxy = MediaButtonsListenerProxy;
1065    type RequestStream = MediaButtonsListenerRequestStream;
1066    #[cfg(target_os = "fuchsia")]
1067    type SynchronousProxy = MediaButtonsListenerSynchronousProxy;
1068
1069    const DEBUG_NAME: &'static str = "(anonymous) MediaButtonsListener";
1070}
1071
1072pub trait MediaButtonsListenerProxyInterface: Send + Sync {
1073    fn r#on_media_buttons_event(
1074        &self,
1075        event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1076    ) -> Result<(), fidl::Error>;
1077    type OnEventResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1078    fn r#on_event(
1079        &self,
1080        event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1081    ) -> Self::OnEventResponseFut;
1082}
1083#[derive(Debug)]
1084#[cfg(target_os = "fuchsia")]
1085pub struct MediaButtonsListenerSynchronousProxy {
1086    client: fidl::client::sync::Client,
1087}
1088
1089#[cfg(target_os = "fuchsia")]
1090impl fidl::endpoints::SynchronousProxy for MediaButtonsListenerSynchronousProxy {
1091    type Proxy = MediaButtonsListenerProxy;
1092    type Protocol = MediaButtonsListenerMarker;
1093
1094    fn from_channel(inner: fidl::Channel) -> Self {
1095        Self::new(inner)
1096    }
1097
1098    fn into_channel(self) -> fidl::Channel {
1099        self.client.into_channel()
1100    }
1101
1102    fn as_channel(&self) -> &fidl::Channel {
1103        self.client.as_channel()
1104    }
1105}
1106
1107#[cfg(target_os = "fuchsia")]
1108impl MediaButtonsListenerSynchronousProxy {
1109    pub fn new(channel: fidl::Channel) -> Self {
1110        let protocol_name =
1111            <MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1112        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1113    }
1114
1115    pub fn into_channel(self) -> fidl::Channel {
1116        self.client.into_channel()
1117    }
1118
1119    /// Waits until an event arrives and returns it. It is safe for other
1120    /// threads to make concurrent requests while waiting for an event.
1121    pub fn wait_for_event(
1122        &self,
1123        deadline: zx::MonotonicInstant,
1124    ) -> Result<MediaButtonsListenerEvent, fidl::Error> {
1125        MediaButtonsListenerEvent::decode(self.client.wait_for_event(deadline)?)
1126    }
1127
1128    pub fn r#on_media_buttons_event(
1129        &self,
1130        mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1131    ) -> Result<(), fidl::Error> {
1132        self.client.send::<MediaButtonsListenerOnMediaButtonsEventRequest>(
1133            (event,),
1134            0x2c2068c386964e00,
1135            fidl::encoding::DynamicFlags::empty(),
1136        )
1137    }
1138
1139    pub fn r#on_event(
1140        &self,
1141        mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1142        ___deadline: zx::MonotonicInstant,
1143    ) -> Result<(), fidl::Error> {
1144        let _response = self
1145            .client
1146            .send_query::<MediaButtonsListenerOnEventRequest, fidl::encoding::EmptyPayload>(
1147                (event,),
1148                0x16e7130ddcaf877c,
1149                fidl::encoding::DynamicFlags::empty(),
1150                ___deadline,
1151            )?;
1152        Ok(_response)
1153    }
1154}
1155
1156#[cfg(target_os = "fuchsia")]
1157impl From<MediaButtonsListenerSynchronousProxy> for zx::Handle {
1158    fn from(value: MediaButtonsListenerSynchronousProxy) -> Self {
1159        value.into_channel().into()
1160    }
1161}
1162
1163#[cfg(target_os = "fuchsia")]
1164impl From<fidl::Channel> for MediaButtonsListenerSynchronousProxy {
1165    fn from(value: fidl::Channel) -> Self {
1166        Self::new(value)
1167    }
1168}
1169
1170#[cfg(target_os = "fuchsia")]
1171impl fidl::endpoints::FromClient for MediaButtonsListenerSynchronousProxy {
1172    type Protocol = MediaButtonsListenerMarker;
1173
1174    fn from_client(value: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>) -> Self {
1175        Self::new(value.into_channel())
1176    }
1177}
1178
1179#[derive(Debug, Clone)]
1180pub struct MediaButtonsListenerProxy {
1181    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1182}
1183
1184impl fidl::endpoints::Proxy for MediaButtonsListenerProxy {
1185    type Protocol = MediaButtonsListenerMarker;
1186
1187    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1188        Self::new(inner)
1189    }
1190
1191    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1192        self.client.into_channel().map_err(|client| Self { client })
1193    }
1194
1195    fn as_channel(&self) -> &::fidl::AsyncChannel {
1196        self.client.as_channel()
1197    }
1198}
1199
1200impl MediaButtonsListenerProxy {
1201    /// Create a new Proxy for fuchsia.ui.policy/MediaButtonsListener.
1202    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1203        let protocol_name =
1204            <MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1205        Self { client: fidl::client::Client::new(channel, protocol_name) }
1206    }
1207
1208    /// Get a Stream of events from the remote end of the protocol.
1209    ///
1210    /// # Panics
1211    ///
1212    /// Panics if the event stream was already taken.
1213    pub fn take_event_stream(&self) -> MediaButtonsListenerEventStream {
1214        MediaButtonsListenerEventStream { event_receiver: self.client.take_event_receiver() }
1215    }
1216
1217    pub fn r#on_media_buttons_event(
1218        &self,
1219        mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1220    ) -> Result<(), fidl::Error> {
1221        MediaButtonsListenerProxyInterface::r#on_media_buttons_event(self, event)
1222    }
1223
1224    pub fn r#on_event(
1225        &self,
1226        mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1227    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1228        MediaButtonsListenerProxyInterface::r#on_event(self, event)
1229    }
1230}
1231
1232impl MediaButtonsListenerProxyInterface for MediaButtonsListenerProxy {
1233    fn r#on_media_buttons_event(
1234        &self,
1235        mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1236    ) -> Result<(), fidl::Error> {
1237        self.client.send::<MediaButtonsListenerOnMediaButtonsEventRequest>(
1238            (event,),
1239            0x2c2068c386964e00,
1240            fidl::encoding::DynamicFlags::empty(),
1241        )
1242    }
1243
1244    type OnEventResponseFut =
1245        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1246    fn r#on_event(
1247        &self,
1248        mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1249    ) -> Self::OnEventResponseFut {
1250        fn _decode(
1251            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1252        ) -> Result<(), fidl::Error> {
1253            let _response = fidl::client::decode_transaction_body::<
1254                fidl::encoding::EmptyPayload,
1255                fidl::encoding::DefaultFuchsiaResourceDialect,
1256                0x16e7130ddcaf877c,
1257            >(_buf?)?;
1258            Ok(_response)
1259        }
1260        self.client.send_query_and_decode::<MediaButtonsListenerOnEventRequest, ()>(
1261            (event,),
1262            0x16e7130ddcaf877c,
1263            fidl::encoding::DynamicFlags::empty(),
1264            _decode,
1265        )
1266    }
1267}
1268
1269pub struct MediaButtonsListenerEventStream {
1270    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1271}
1272
1273impl std::marker::Unpin for MediaButtonsListenerEventStream {}
1274
1275impl futures::stream::FusedStream for MediaButtonsListenerEventStream {
1276    fn is_terminated(&self) -> bool {
1277        self.event_receiver.is_terminated()
1278    }
1279}
1280
1281impl futures::Stream for MediaButtonsListenerEventStream {
1282    type Item = Result<MediaButtonsListenerEvent, fidl::Error>;
1283
1284    fn poll_next(
1285        mut self: std::pin::Pin<&mut Self>,
1286        cx: &mut std::task::Context<'_>,
1287    ) -> std::task::Poll<Option<Self::Item>> {
1288        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1289            &mut self.event_receiver,
1290            cx
1291        )?) {
1292            Some(buf) => std::task::Poll::Ready(Some(MediaButtonsListenerEvent::decode(buf))),
1293            None => std::task::Poll::Ready(None),
1294        }
1295    }
1296}
1297
1298#[derive(Debug)]
1299pub enum MediaButtonsListenerEvent {}
1300
1301impl MediaButtonsListenerEvent {
1302    /// Decodes a message buffer as a [`MediaButtonsListenerEvent`].
1303    fn decode(
1304        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1305    ) -> Result<MediaButtonsListenerEvent, fidl::Error> {
1306        let (bytes, _handles) = buf.split_mut();
1307        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1308        debug_assert_eq!(tx_header.tx_id, 0);
1309        match tx_header.ordinal {
1310            _ => Err(fidl::Error::UnknownOrdinal {
1311                ordinal: tx_header.ordinal,
1312                protocol_name:
1313                    <MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1314            }),
1315        }
1316    }
1317}
1318
1319/// A Stream of incoming requests for fuchsia.ui.policy/MediaButtonsListener.
1320pub struct MediaButtonsListenerRequestStream {
1321    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1322    is_terminated: bool,
1323}
1324
1325impl std::marker::Unpin for MediaButtonsListenerRequestStream {}
1326
1327impl futures::stream::FusedStream for MediaButtonsListenerRequestStream {
1328    fn is_terminated(&self) -> bool {
1329        self.is_terminated
1330    }
1331}
1332
1333impl fidl::endpoints::RequestStream for MediaButtonsListenerRequestStream {
1334    type Protocol = MediaButtonsListenerMarker;
1335    type ControlHandle = MediaButtonsListenerControlHandle;
1336
1337    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1338        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1339    }
1340
1341    fn control_handle(&self) -> Self::ControlHandle {
1342        MediaButtonsListenerControlHandle { inner: self.inner.clone() }
1343    }
1344
1345    fn into_inner(
1346        self,
1347    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1348    {
1349        (self.inner, self.is_terminated)
1350    }
1351
1352    fn from_inner(
1353        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1354        is_terminated: bool,
1355    ) -> Self {
1356        Self { inner, is_terminated }
1357    }
1358}
1359
1360impl futures::Stream for MediaButtonsListenerRequestStream {
1361    type Item = Result<MediaButtonsListenerRequest, fidl::Error>;
1362
1363    fn poll_next(
1364        mut self: std::pin::Pin<&mut Self>,
1365        cx: &mut std::task::Context<'_>,
1366    ) -> std::task::Poll<Option<Self::Item>> {
1367        let this = &mut *self;
1368        if this.inner.check_shutdown(cx) {
1369            this.is_terminated = true;
1370            return std::task::Poll::Ready(None);
1371        }
1372        if this.is_terminated {
1373            panic!("polled MediaButtonsListenerRequestStream after completion");
1374        }
1375        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1376            |bytes, handles| {
1377                match this.inner.channel().read_etc(cx, bytes, handles) {
1378                    std::task::Poll::Ready(Ok(())) => {}
1379                    std::task::Poll::Pending => return std::task::Poll::Pending,
1380                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1381                        this.is_terminated = true;
1382                        return std::task::Poll::Ready(None);
1383                    }
1384                    std::task::Poll::Ready(Err(e)) => {
1385                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1386                            e.into(),
1387                        ))))
1388                    }
1389                }
1390
1391                // A message has been received from the channel
1392                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1393
1394                std::task::Poll::Ready(Some(match header.ordinal {
1395                0x2c2068c386964e00 => {
1396                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1397                    let mut req = fidl::new_empty!(MediaButtonsListenerOnMediaButtonsEventRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1398                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MediaButtonsListenerOnMediaButtonsEventRequest>(&header, _body_bytes, handles, &mut req)?;
1399                    let control_handle = MediaButtonsListenerControlHandle {
1400                        inner: this.inner.clone(),
1401                    };
1402                    Ok(MediaButtonsListenerRequest::OnMediaButtonsEvent {event: req.event,
1403
1404                        control_handle,
1405                    })
1406                }
1407                0x16e7130ddcaf877c => {
1408                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1409                    let mut req = fidl::new_empty!(MediaButtonsListenerOnEventRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1410                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MediaButtonsListenerOnEventRequest>(&header, _body_bytes, handles, &mut req)?;
1411                    let control_handle = MediaButtonsListenerControlHandle {
1412                        inner: this.inner.clone(),
1413                    };
1414                    Ok(MediaButtonsListenerRequest::OnEvent {event: req.event,
1415
1416                        responder: MediaButtonsListenerOnEventResponder {
1417                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1418                            tx_id: header.tx_id,
1419                        },
1420                    })
1421                }
1422                _ => Err(fidl::Error::UnknownOrdinal {
1423                    ordinal: header.ordinal,
1424                    protocol_name: <MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1425                }),
1426            }))
1427            },
1428        )
1429    }
1430}
1431
1432/// A listener for media buttons events. `DeviceListenerRegistry.RegisterMediaButtonsListener`
1433/// will consume this listener interface and call `OnMediaButtonsEvent` when the
1434/// registered media buttons event occurs.
1435#[derive(Debug)]
1436pub enum MediaButtonsListenerRequest {
1437    OnMediaButtonsEvent {
1438        event: fidl_fuchsia_ui_input::MediaButtonsEvent,
1439        control_handle: MediaButtonsListenerControlHandle,
1440    },
1441    OnEvent {
1442        event: fidl_fuchsia_ui_input::MediaButtonsEvent,
1443        responder: MediaButtonsListenerOnEventResponder,
1444    },
1445}
1446
1447impl MediaButtonsListenerRequest {
1448    #[allow(irrefutable_let_patterns)]
1449    pub fn into_on_media_buttons_event(
1450        self,
1451    ) -> Option<(fidl_fuchsia_ui_input::MediaButtonsEvent, MediaButtonsListenerControlHandle)> {
1452        if let MediaButtonsListenerRequest::OnMediaButtonsEvent { event, control_handle } = self {
1453            Some((event, control_handle))
1454        } else {
1455            None
1456        }
1457    }
1458
1459    #[allow(irrefutable_let_patterns)]
1460    pub fn into_on_event(
1461        self,
1462    ) -> Option<(fidl_fuchsia_ui_input::MediaButtonsEvent, MediaButtonsListenerOnEventResponder)>
1463    {
1464        if let MediaButtonsListenerRequest::OnEvent { event, responder } = self {
1465            Some((event, responder))
1466        } else {
1467            None
1468        }
1469    }
1470
1471    /// Name of the method defined in FIDL
1472    pub fn method_name(&self) -> &'static str {
1473        match *self {
1474            MediaButtonsListenerRequest::OnMediaButtonsEvent { .. } => "on_media_buttons_event",
1475            MediaButtonsListenerRequest::OnEvent { .. } => "on_event",
1476        }
1477    }
1478}
1479
1480#[derive(Debug, Clone)]
1481pub struct MediaButtonsListenerControlHandle {
1482    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1483}
1484
1485impl fidl::endpoints::ControlHandle for MediaButtonsListenerControlHandle {
1486    fn shutdown(&self) {
1487        self.inner.shutdown()
1488    }
1489    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1490        self.inner.shutdown_with_epitaph(status)
1491    }
1492
1493    fn is_closed(&self) -> bool {
1494        self.inner.channel().is_closed()
1495    }
1496    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1497        self.inner.channel().on_closed()
1498    }
1499
1500    #[cfg(target_os = "fuchsia")]
1501    fn signal_peer(
1502        &self,
1503        clear_mask: zx::Signals,
1504        set_mask: zx::Signals,
1505    ) -> Result<(), zx_status::Status> {
1506        use fidl::Peered;
1507        self.inner.channel().signal_peer(clear_mask, set_mask)
1508    }
1509}
1510
1511impl MediaButtonsListenerControlHandle {}
1512
1513#[must_use = "FIDL methods require a response to be sent"]
1514#[derive(Debug)]
1515pub struct MediaButtonsListenerOnEventResponder {
1516    control_handle: std::mem::ManuallyDrop<MediaButtonsListenerControlHandle>,
1517    tx_id: u32,
1518}
1519
1520/// Set the the channel to be shutdown (see [`MediaButtonsListenerControlHandle::shutdown`])
1521/// if the responder is dropped without sending a response, so that the client
1522/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1523impl std::ops::Drop for MediaButtonsListenerOnEventResponder {
1524    fn drop(&mut self) {
1525        self.control_handle.shutdown();
1526        // Safety: drops once, never accessed again
1527        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1528    }
1529}
1530
1531impl fidl::endpoints::Responder for MediaButtonsListenerOnEventResponder {
1532    type ControlHandle = MediaButtonsListenerControlHandle;
1533
1534    fn control_handle(&self) -> &MediaButtonsListenerControlHandle {
1535        &self.control_handle
1536    }
1537
1538    fn drop_without_shutdown(mut self) {
1539        // Safety: drops once, never accessed again due to mem::forget
1540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1541        // Prevent Drop from running (which would shut down the channel)
1542        std::mem::forget(self);
1543    }
1544}
1545
1546impl MediaButtonsListenerOnEventResponder {
1547    /// Sends a response to the FIDL transaction.
1548    ///
1549    /// Sets the channel to shutdown if an error occurs.
1550    pub fn send(self) -> Result<(), fidl::Error> {
1551        let _result = self.send_raw();
1552        if _result.is_err() {
1553            self.control_handle.shutdown();
1554        }
1555        self.drop_without_shutdown();
1556        _result
1557    }
1558
1559    /// Similar to "send" but does not shutdown the channel if an error occurs.
1560    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1561        let _result = self.send_raw();
1562        self.drop_without_shutdown();
1563        _result
1564    }
1565
1566    fn send_raw(&self) -> Result<(), fidl::Error> {
1567        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1568            (),
1569            self.tx_id,
1570            0x16e7130ddcaf877c,
1571            fidl::encoding::DynamicFlags::empty(),
1572        )
1573    }
1574}
1575
1576mod internal {
1577    use super::*;
1578
1579    impl fidl::encoding::ResourceTypeMarker for DeviceListenerRegistryRegisterListenerRequest {
1580        type Borrowed<'a> = &'a mut Self;
1581        fn take_or_borrow<'a>(
1582            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1583        ) -> Self::Borrowed<'a> {
1584            value
1585        }
1586    }
1587
1588    unsafe impl fidl::encoding::TypeMarker for DeviceListenerRegistryRegisterListenerRequest {
1589        type Owned = Self;
1590
1591        #[inline(always)]
1592        fn inline_align(_context: fidl::encoding::Context) -> usize {
1593            4
1594        }
1595
1596        #[inline(always)]
1597        fn inline_size(_context: fidl::encoding::Context) -> usize {
1598            4
1599        }
1600    }
1601
1602    unsafe impl
1603        fidl::encoding::Encode<
1604            DeviceListenerRegistryRegisterListenerRequest,
1605            fidl::encoding::DefaultFuchsiaResourceDialect,
1606        > for &mut DeviceListenerRegistryRegisterListenerRequest
1607    {
1608        #[inline]
1609        unsafe fn encode(
1610            self,
1611            encoder: &mut fidl::encoding::Encoder<
1612                '_,
1613                fidl::encoding::DefaultFuchsiaResourceDialect,
1614            >,
1615            offset: usize,
1616            _depth: fidl::encoding::Depth,
1617        ) -> fidl::Result<()> {
1618            encoder.debug_check_bounds::<DeviceListenerRegistryRegisterListenerRequest>(offset);
1619            // Delegate to tuple encoding.
1620            fidl::encoding::Encode::<
1621                DeviceListenerRegistryRegisterListenerRequest,
1622                fidl::encoding::DefaultFuchsiaResourceDialect,
1623            >::encode(
1624                (
1625                    <fidl::encoding::Endpoint<
1626                        fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
1627                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1628                        &mut self.listener
1629                    ),
1630                ),
1631                encoder,
1632                offset,
1633                _depth,
1634            )
1635        }
1636    }
1637    unsafe impl<
1638            T0: fidl::encoding::Encode<
1639                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
1640                fidl::encoding::DefaultFuchsiaResourceDialect,
1641            >,
1642        >
1643        fidl::encoding::Encode<
1644            DeviceListenerRegistryRegisterListenerRequest,
1645            fidl::encoding::DefaultFuchsiaResourceDialect,
1646        > for (T0,)
1647    {
1648        #[inline]
1649        unsafe fn encode(
1650            self,
1651            encoder: &mut fidl::encoding::Encoder<
1652                '_,
1653                fidl::encoding::DefaultFuchsiaResourceDialect,
1654            >,
1655            offset: usize,
1656            depth: fidl::encoding::Depth,
1657        ) -> fidl::Result<()> {
1658            encoder.debug_check_bounds::<DeviceListenerRegistryRegisterListenerRequest>(offset);
1659            // Zero out padding regions. There's no need to apply masks
1660            // because the unmasked parts will be overwritten by fields.
1661            // Write the fields.
1662            self.0.encode(encoder, offset + 0, depth)?;
1663            Ok(())
1664        }
1665    }
1666
1667    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1668        for DeviceListenerRegistryRegisterListenerRequest
1669    {
1670        #[inline(always)]
1671        fn new_empty() -> Self {
1672            Self {
1673                listener: fidl::new_empty!(
1674                    fidl::encoding::Endpoint<
1675                        fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
1676                    >,
1677                    fidl::encoding::DefaultFuchsiaResourceDialect
1678                ),
1679            }
1680        }
1681
1682        #[inline]
1683        unsafe fn decode(
1684            &mut self,
1685            decoder: &mut fidl::encoding::Decoder<
1686                '_,
1687                fidl::encoding::DefaultFuchsiaResourceDialect,
1688            >,
1689            offset: usize,
1690            _depth: fidl::encoding::Depth,
1691        ) -> fidl::Result<()> {
1692            decoder.debug_check_bounds::<Self>(offset);
1693            // Verify that padding bytes are zero.
1694            fidl::decode!(
1695                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
1696                fidl::encoding::DefaultFuchsiaResourceDialect,
1697                &mut self.listener,
1698                decoder,
1699                offset + 0,
1700                _depth
1701            )?;
1702            Ok(())
1703        }
1704    }
1705
1706    impl fidl::encoding::ResourceTypeMarker
1707        for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
1708    {
1709        type Borrowed<'a> = &'a mut Self;
1710        fn take_or_borrow<'a>(
1711            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1712        ) -> Self::Borrowed<'a> {
1713            value
1714        }
1715    }
1716
1717    unsafe impl fidl::encoding::TypeMarker
1718        for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
1719    {
1720        type Owned = Self;
1721
1722        #[inline(always)]
1723        fn inline_align(_context: fidl::encoding::Context) -> usize {
1724            4
1725        }
1726
1727        #[inline(always)]
1728        fn inline_size(_context: fidl::encoding::Context) -> usize {
1729            4
1730        }
1731    }
1732
1733    unsafe impl
1734        fidl::encoding::Encode<
1735            DeviceListenerRegistryRegisterMediaButtonsListenerRequest,
1736            fidl::encoding::DefaultFuchsiaResourceDialect,
1737        > for &mut DeviceListenerRegistryRegisterMediaButtonsListenerRequest
1738    {
1739        #[inline]
1740        unsafe fn encode(
1741            self,
1742            encoder: &mut fidl::encoding::Encoder<
1743                '_,
1744                fidl::encoding::DefaultFuchsiaResourceDialect,
1745            >,
1746            offset: usize,
1747            _depth: fidl::encoding::Depth,
1748        ) -> fidl::Result<()> {
1749            encoder
1750                .debug_check_bounds::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
1751                    offset,
1752                );
1753            // Delegate to tuple encoding.
1754            fidl::encoding::Encode::<
1755                DeviceListenerRegistryRegisterMediaButtonsListenerRequest,
1756                fidl::encoding::DefaultFuchsiaResourceDialect,
1757            >::encode(
1758                (
1759                    <fidl::encoding::Endpoint<
1760                        fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
1761                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1762                        &mut self.listener
1763                    ),
1764                ),
1765                encoder,
1766                offset,
1767                _depth,
1768            )
1769        }
1770    }
1771    unsafe impl<
1772            T0: fidl::encoding::Encode<
1773                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
1774                fidl::encoding::DefaultFuchsiaResourceDialect,
1775            >,
1776        >
1777        fidl::encoding::Encode<
1778            DeviceListenerRegistryRegisterMediaButtonsListenerRequest,
1779            fidl::encoding::DefaultFuchsiaResourceDialect,
1780        > for (T0,)
1781    {
1782        #[inline]
1783        unsafe fn encode(
1784            self,
1785            encoder: &mut fidl::encoding::Encoder<
1786                '_,
1787                fidl::encoding::DefaultFuchsiaResourceDialect,
1788            >,
1789            offset: usize,
1790            depth: fidl::encoding::Depth,
1791        ) -> fidl::Result<()> {
1792            encoder
1793                .debug_check_bounds::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
1794                    offset,
1795                );
1796            // Zero out padding regions. There's no need to apply masks
1797            // because the unmasked parts will be overwritten by fields.
1798            // Write the fields.
1799            self.0.encode(encoder, offset + 0, depth)?;
1800            Ok(())
1801        }
1802    }
1803
1804    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1805        for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
1806    {
1807        #[inline(always)]
1808        fn new_empty() -> Self {
1809            Self {
1810                listener: fidl::new_empty!(
1811                    fidl::encoding::Endpoint<
1812                        fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
1813                    >,
1814                    fidl::encoding::DefaultFuchsiaResourceDialect
1815                ),
1816            }
1817        }
1818
1819        #[inline]
1820        unsafe fn decode(
1821            &mut self,
1822            decoder: &mut fidl::encoding::Decoder<
1823                '_,
1824                fidl::encoding::DefaultFuchsiaResourceDialect,
1825            >,
1826            offset: usize,
1827            _depth: fidl::encoding::Depth,
1828        ) -> fidl::Result<()> {
1829            decoder.debug_check_bounds::<Self>(offset);
1830            // Verify that padding bytes are zero.
1831            fidl::decode!(
1832                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
1833                fidl::encoding::DefaultFuchsiaResourceDialect,
1834                &mut self.listener,
1835                decoder,
1836                offset + 0,
1837                _depth
1838            )?;
1839            Ok(())
1840        }
1841    }
1842}