1#![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 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 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 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#[derive(Debug, Clone)]
153pub struct DeviceListenerRegistryProxy {
154 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
155}
156
157impl fidl::endpoints::Proxy for DeviceListenerRegistryProxy {
158 type Protocol = DeviceListenerRegistryMarker;
159
160 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
161 Self::new(inner)
162 }
163
164 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
165 self.client.into_channel().map_err(|client| Self { client })
166 }
167
168 fn as_channel(&self) -> &::fidl::AsyncChannel {
169 self.client.as_channel()
170 }
171}
172
173impl DeviceListenerRegistryProxy {
174 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
176 let protocol_name =
177 <DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
178 Self { client: fidl::client::Client::new(channel, protocol_name) }
179 }
180
181 pub fn take_event_stream(&self) -> DeviceListenerRegistryEventStream {
187 DeviceListenerRegistryEventStream { event_receiver: self.client.take_event_receiver() }
188 }
189
190 pub fn r#register_media_buttons_listener(
193 &self,
194 mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
195 ) -> Result<(), fidl::Error> {
196 DeviceListenerRegistryProxyInterface::r#register_media_buttons_listener(self, listener)
197 }
198
199 pub fn r#register_listener(
204 &self,
205 mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
206 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
207 DeviceListenerRegistryProxyInterface::r#register_listener(self, listener)
208 }
209}
210
211impl DeviceListenerRegistryProxyInterface for DeviceListenerRegistryProxy {
212 fn r#register_media_buttons_listener(
213 &self,
214 mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
215 ) -> Result<(), fidl::Error> {
216 self.client.send::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
217 (listener,),
218 0x3826318765c72e70,
219 fidl::encoding::DynamicFlags::empty(),
220 )
221 }
222
223 type RegisterListenerResponseFut =
224 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
225 fn r#register_listener(
226 &self,
227 mut listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
228 ) -> Self::RegisterListenerResponseFut {
229 fn _decode(
230 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
231 ) -> Result<(), fidl::Error> {
232 let _response = fidl::client::decode_transaction_body::<
233 fidl::encoding::EmptyPayload,
234 fidl::encoding::DefaultFuchsiaResourceDialect,
235 0x2f9e7eea89485a7b,
236 >(_buf?)?;
237 Ok(_response)
238 }
239 self.client.send_query_and_decode::<DeviceListenerRegistryRegisterListenerRequest, ()>(
240 (listener,),
241 0x2f9e7eea89485a7b,
242 fidl::encoding::DynamicFlags::empty(),
243 _decode,
244 )
245 }
246}
247
248pub struct DeviceListenerRegistryEventStream {
249 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
250}
251
252impl std::marker::Unpin for DeviceListenerRegistryEventStream {}
253
254impl futures::stream::FusedStream for DeviceListenerRegistryEventStream {
255 fn is_terminated(&self) -> bool {
256 self.event_receiver.is_terminated()
257 }
258}
259
260impl futures::Stream for DeviceListenerRegistryEventStream {
261 type Item = Result<DeviceListenerRegistryEvent, fidl::Error>;
262
263 fn poll_next(
264 mut self: std::pin::Pin<&mut Self>,
265 cx: &mut std::task::Context<'_>,
266 ) -> std::task::Poll<Option<Self::Item>> {
267 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
268 &mut self.event_receiver,
269 cx
270 )?) {
271 Some(buf) => std::task::Poll::Ready(Some(DeviceListenerRegistryEvent::decode(buf))),
272 None => std::task::Poll::Ready(None),
273 }
274 }
275}
276
277#[derive(Debug)]
278pub enum DeviceListenerRegistryEvent {}
279
280impl DeviceListenerRegistryEvent {
281 fn decode(
283 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
284 ) -> Result<DeviceListenerRegistryEvent, fidl::Error> {
285 let (bytes, _handles) = buf.split_mut();
286 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
287 debug_assert_eq!(tx_header.tx_id, 0);
288 match tx_header.ordinal {
289 _ => Err(fidl::Error::UnknownOrdinal {
290 ordinal: tx_header.ordinal,
291 protocol_name:
292 <DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
293 }),
294 }
295 }
296}
297
298pub struct DeviceListenerRegistryRequestStream {
300 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
301 is_terminated: bool,
302}
303
304impl std::marker::Unpin for DeviceListenerRegistryRequestStream {}
305
306impl futures::stream::FusedStream for DeviceListenerRegistryRequestStream {
307 fn is_terminated(&self) -> bool {
308 self.is_terminated
309 }
310}
311
312impl fidl::endpoints::RequestStream for DeviceListenerRegistryRequestStream {
313 type Protocol = DeviceListenerRegistryMarker;
314 type ControlHandle = DeviceListenerRegistryControlHandle;
315
316 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
317 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
318 }
319
320 fn control_handle(&self) -> Self::ControlHandle {
321 DeviceListenerRegistryControlHandle { inner: self.inner.clone() }
322 }
323
324 fn into_inner(
325 self,
326 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
327 {
328 (self.inner, self.is_terminated)
329 }
330
331 fn from_inner(
332 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
333 is_terminated: bool,
334 ) -> Self {
335 Self { inner, is_terminated }
336 }
337}
338
339impl futures::Stream for DeviceListenerRegistryRequestStream {
340 type Item = Result<DeviceListenerRegistryRequest, fidl::Error>;
341
342 fn poll_next(
343 mut self: std::pin::Pin<&mut Self>,
344 cx: &mut std::task::Context<'_>,
345 ) -> std::task::Poll<Option<Self::Item>> {
346 let this = &mut *self;
347 if this.inner.check_shutdown(cx) {
348 this.is_terminated = true;
349 return std::task::Poll::Ready(None);
350 }
351 if this.is_terminated {
352 panic!("polled DeviceListenerRegistryRequestStream after completion");
353 }
354 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
355 |bytes, handles| {
356 match this.inner.channel().read_etc(cx, bytes, handles) {
357 std::task::Poll::Ready(Ok(())) => {}
358 std::task::Poll::Pending => return std::task::Poll::Pending,
359 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
360 this.is_terminated = true;
361 return std::task::Poll::Ready(None);
362 }
363 std::task::Poll::Ready(Err(e)) => {
364 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
365 e.into(),
366 ))))
367 }
368 }
369
370 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
372
373 std::task::Poll::Ready(Some(match header.ordinal {
374 0x3826318765c72e70 => {
375 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
376 let mut req = fidl::new_empty!(DeviceListenerRegistryRegisterMediaButtonsListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
377 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(&header, _body_bytes, handles, &mut req)?;
378 let control_handle = DeviceListenerRegistryControlHandle {
379 inner: this.inner.clone(),
380 };
381 Ok(DeviceListenerRegistryRequest::RegisterMediaButtonsListener {listener: req.listener,
382
383 control_handle,
384 })
385 }
386 0x2f9e7eea89485a7b => {
387 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
388 let mut req = fidl::new_empty!(DeviceListenerRegistryRegisterListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
389 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceListenerRegistryRegisterListenerRequest>(&header, _body_bytes, handles, &mut req)?;
390 let control_handle = DeviceListenerRegistryControlHandle {
391 inner: this.inner.clone(),
392 };
393 Ok(DeviceListenerRegistryRequest::RegisterListener {listener: req.listener,
394
395 responder: DeviceListenerRegistryRegisterListenerResponder {
396 control_handle: std::mem::ManuallyDrop::new(control_handle),
397 tx_id: header.tx_id,
398 },
399 })
400 }
401 _ => Err(fidl::Error::UnknownOrdinal {
402 ordinal: header.ordinal,
403 protocol_name: <DeviceListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
404 }),
405 }))
406 },
407 )
408 }
409}
410
411#[derive(Debug)]
413pub enum DeviceListenerRegistryRequest {
414 RegisterMediaButtonsListener {
417 listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
418 control_handle: DeviceListenerRegistryControlHandle,
419 },
420 RegisterListener {
425 listener: fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
426 responder: DeviceListenerRegistryRegisterListenerResponder,
427 },
428}
429
430impl DeviceListenerRegistryRequest {
431 #[allow(irrefutable_let_patterns)]
432 pub fn into_register_media_buttons_listener(
433 self,
434 ) -> Option<(
435 fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
436 DeviceListenerRegistryControlHandle,
437 )> {
438 if let DeviceListenerRegistryRequest::RegisterMediaButtonsListener {
439 listener,
440 control_handle,
441 } = self
442 {
443 Some((listener, control_handle))
444 } else {
445 None
446 }
447 }
448
449 #[allow(irrefutable_let_patterns)]
450 pub fn into_register_listener(
451 self,
452 ) -> Option<(
453 fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
454 DeviceListenerRegistryRegisterListenerResponder,
455 )> {
456 if let DeviceListenerRegistryRequest::RegisterListener { listener, responder } = self {
457 Some((listener, responder))
458 } else {
459 None
460 }
461 }
462
463 pub fn method_name(&self) -> &'static str {
465 match *self {
466 DeviceListenerRegistryRequest::RegisterMediaButtonsListener { .. } => {
467 "register_media_buttons_listener"
468 }
469 DeviceListenerRegistryRequest::RegisterListener { .. } => "register_listener",
470 }
471 }
472}
473
474#[derive(Debug, Clone)]
475pub struct DeviceListenerRegistryControlHandle {
476 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
477}
478
479impl fidl::endpoints::ControlHandle for DeviceListenerRegistryControlHandle {
480 fn shutdown(&self) {
481 self.inner.shutdown()
482 }
483 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
484 self.inner.shutdown_with_epitaph(status)
485 }
486
487 fn is_closed(&self) -> bool {
488 self.inner.channel().is_closed()
489 }
490 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
491 self.inner.channel().on_closed()
492 }
493
494 #[cfg(target_os = "fuchsia")]
495 fn signal_peer(
496 &self,
497 clear_mask: zx::Signals,
498 set_mask: zx::Signals,
499 ) -> Result<(), zx_status::Status> {
500 use fidl::Peered;
501 self.inner.channel().signal_peer(clear_mask, set_mask)
502 }
503}
504
505impl DeviceListenerRegistryControlHandle {}
506
507#[must_use = "FIDL methods require a response to be sent"]
508#[derive(Debug)]
509pub struct DeviceListenerRegistryRegisterListenerResponder {
510 control_handle: std::mem::ManuallyDrop<DeviceListenerRegistryControlHandle>,
511 tx_id: u32,
512}
513
514impl std::ops::Drop for DeviceListenerRegistryRegisterListenerResponder {
518 fn drop(&mut self) {
519 self.control_handle.shutdown();
520 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
522 }
523}
524
525impl fidl::endpoints::Responder for DeviceListenerRegistryRegisterListenerResponder {
526 type ControlHandle = DeviceListenerRegistryControlHandle;
527
528 fn control_handle(&self) -> &DeviceListenerRegistryControlHandle {
529 &self.control_handle
530 }
531
532 fn drop_without_shutdown(mut self) {
533 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
535 std::mem::forget(self);
537 }
538}
539
540impl DeviceListenerRegistryRegisterListenerResponder {
541 pub fn send(self) -> Result<(), fidl::Error> {
545 let _result = self.send_raw();
546 if _result.is_err() {
547 self.control_handle.shutdown();
548 }
549 self.drop_without_shutdown();
550 _result
551 }
552
553 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
555 let _result = self.send_raw();
556 self.drop_without_shutdown();
557 _result
558 }
559
560 fn send_raw(&self) -> Result<(), fidl::Error> {
561 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
562 (),
563 self.tx_id,
564 0x2f9e7eea89485a7b,
565 fidl::encoding::DynamicFlags::empty(),
566 )
567 }
568}
569
570#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
571pub struct DisplayBacklightMarker;
572
573impl fidl::endpoints::ProtocolMarker for DisplayBacklightMarker {
574 type Proxy = DisplayBacklightProxy;
575 type RequestStream = DisplayBacklightRequestStream;
576 #[cfg(target_os = "fuchsia")]
577 type SynchronousProxy = DisplayBacklightSynchronousProxy;
578
579 const DEBUG_NAME: &'static str = "fuchsia.ui.policy.DisplayBacklight";
580}
581impl fidl::endpoints::DiscoverableProtocolMarker for DisplayBacklightMarker {}
582
583pub trait DisplayBacklightProxyInterface: Send + Sync {
584 type SetMinimumRgbResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
585 fn r#set_minimum_rgb(&self, minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut;
586}
587#[derive(Debug)]
588#[cfg(target_os = "fuchsia")]
589pub struct DisplayBacklightSynchronousProxy {
590 client: fidl::client::sync::Client,
591}
592
593#[cfg(target_os = "fuchsia")]
594impl fidl::endpoints::SynchronousProxy for DisplayBacklightSynchronousProxy {
595 type Proxy = DisplayBacklightProxy;
596 type Protocol = DisplayBacklightMarker;
597
598 fn from_channel(inner: fidl::Channel) -> Self {
599 Self::new(inner)
600 }
601
602 fn into_channel(self) -> fidl::Channel {
603 self.client.into_channel()
604 }
605
606 fn as_channel(&self) -> &fidl::Channel {
607 self.client.as_channel()
608 }
609}
610
611#[cfg(target_os = "fuchsia")]
612impl DisplayBacklightSynchronousProxy {
613 pub fn new(channel: fidl::Channel) -> Self {
614 let protocol_name = <DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
615 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
616 }
617
618 pub fn into_channel(self) -> fidl::Channel {
619 self.client.into_channel()
620 }
621
622 pub fn wait_for_event(
625 &self,
626 deadline: zx::MonotonicInstant,
627 ) -> Result<DisplayBacklightEvent, fidl::Error> {
628 DisplayBacklightEvent::decode(self.client.wait_for_event(deadline)?)
629 }
630
631 pub fn r#set_minimum_rgb(
640 &self,
641 mut minimum_rgb: u8,
642 ___deadline: zx::MonotonicInstant,
643 ) -> Result<(), fidl::Error> {
644 let _response = self
645 .client
646 .send_query::<DisplayBacklightSetMinimumRgbRequest, fidl::encoding::EmptyPayload>(
647 (minimum_rgb,),
648 0x25604347bb8a1ca3,
649 fidl::encoding::DynamicFlags::empty(),
650 ___deadline,
651 )?;
652 Ok(_response)
653 }
654}
655
656#[cfg(target_os = "fuchsia")]
657impl From<DisplayBacklightSynchronousProxy> for zx::Handle {
658 fn from(value: DisplayBacklightSynchronousProxy) -> Self {
659 value.into_channel().into()
660 }
661}
662
663#[cfg(target_os = "fuchsia")]
664impl From<fidl::Channel> for DisplayBacklightSynchronousProxy {
665 fn from(value: fidl::Channel) -> Self {
666 Self::new(value)
667 }
668}
669
670#[derive(Debug, Clone)]
671pub struct DisplayBacklightProxy {
672 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
673}
674
675impl fidl::endpoints::Proxy for DisplayBacklightProxy {
676 type Protocol = DisplayBacklightMarker;
677
678 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
679 Self::new(inner)
680 }
681
682 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
683 self.client.into_channel().map_err(|client| Self { client })
684 }
685
686 fn as_channel(&self) -> &::fidl::AsyncChannel {
687 self.client.as_channel()
688 }
689}
690
691impl DisplayBacklightProxy {
692 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
694 let protocol_name = <DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
695 Self { client: fidl::client::Client::new(channel, protocol_name) }
696 }
697
698 pub fn take_event_stream(&self) -> DisplayBacklightEventStream {
704 DisplayBacklightEventStream { event_receiver: self.client.take_event_receiver() }
705 }
706
707 pub fn r#set_minimum_rgb(
716 &self,
717 mut minimum_rgb: u8,
718 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
719 DisplayBacklightProxyInterface::r#set_minimum_rgb(self, minimum_rgb)
720 }
721}
722
723impl DisplayBacklightProxyInterface for DisplayBacklightProxy {
724 type SetMinimumRgbResponseFut =
725 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
726 fn r#set_minimum_rgb(&self, mut minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut {
727 fn _decode(
728 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
729 ) -> Result<(), fidl::Error> {
730 let _response = fidl::client::decode_transaction_body::<
731 fidl::encoding::EmptyPayload,
732 fidl::encoding::DefaultFuchsiaResourceDialect,
733 0x25604347bb8a1ca3,
734 >(_buf?)?;
735 Ok(_response)
736 }
737 self.client.send_query_and_decode::<DisplayBacklightSetMinimumRgbRequest, ()>(
738 (minimum_rgb,),
739 0x25604347bb8a1ca3,
740 fidl::encoding::DynamicFlags::empty(),
741 _decode,
742 )
743 }
744}
745
746pub struct DisplayBacklightEventStream {
747 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
748}
749
750impl std::marker::Unpin for DisplayBacklightEventStream {}
751
752impl futures::stream::FusedStream for DisplayBacklightEventStream {
753 fn is_terminated(&self) -> bool {
754 self.event_receiver.is_terminated()
755 }
756}
757
758impl futures::Stream for DisplayBacklightEventStream {
759 type Item = Result<DisplayBacklightEvent, fidl::Error>;
760
761 fn poll_next(
762 mut self: std::pin::Pin<&mut Self>,
763 cx: &mut std::task::Context<'_>,
764 ) -> std::task::Poll<Option<Self::Item>> {
765 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
766 &mut self.event_receiver,
767 cx
768 )?) {
769 Some(buf) => std::task::Poll::Ready(Some(DisplayBacklightEvent::decode(buf))),
770 None => std::task::Poll::Ready(None),
771 }
772 }
773}
774
775#[derive(Debug)]
776pub enum DisplayBacklightEvent {}
777
778impl DisplayBacklightEvent {
779 fn decode(
781 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
782 ) -> Result<DisplayBacklightEvent, fidl::Error> {
783 let (bytes, _handles) = buf.split_mut();
784 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
785 debug_assert_eq!(tx_header.tx_id, 0);
786 match tx_header.ordinal {
787 _ => Err(fidl::Error::UnknownOrdinal {
788 ordinal: tx_header.ordinal,
789 protocol_name:
790 <DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
791 }),
792 }
793 }
794}
795
796pub struct DisplayBacklightRequestStream {
798 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
799 is_terminated: bool,
800}
801
802impl std::marker::Unpin for DisplayBacklightRequestStream {}
803
804impl futures::stream::FusedStream for DisplayBacklightRequestStream {
805 fn is_terminated(&self) -> bool {
806 self.is_terminated
807 }
808}
809
810impl fidl::endpoints::RequestStream for DisplayBacklightRequestStream {
811 type Protocol = DisplayBacklightMarker;
812 type ControlHandle = DisplayBacklightControlHandle;
813
814 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
815 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
816 }
817
818 fn control_handle(&self) -> Self::ControlHandle {
819 DisplayBacklightControlHandle { inner: self.inner.clone() }
820 }
821
822 fn into_inner(
823 self,
824 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
825 {
826 (self.inner, self.is_terminated)
827 }
828
829 fn from_inner(
830 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
831 is_terminated: bool,
832 ) -> Self {
833 Self { inner, is_terminated }
834 }
835}
836
837impl futures::Stream for DisplayBacklightRequestStream {
838 type Item = Result<DisplayBacklightRequest, fidl::Error>;
839
840 fn poll_next(
841 mut self: std::pin::Pin<&mut Self>,
842 cx: &mut std::task::Context<'_>,
843 ) -> std::task::Poll<Option<Self::Item>> {
844 let this = &mut *self;
845 if this.inner.check_shutdown(cx) {
846 this.is_terminated = true;
847 return std::task::Poll::Ready(None);
848 }
849 if this.is_terminated {
850 panic!("polled DisplayBacklightRequestStream after completion");
851 }
852 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
853 |bytes, handles| {
854 match this.inner.channel().read_etc(cx, bytes, handles) {
855 std::task::Poll::Ready(Ok(())) => {}
856 std::task::Poll::Pending => return std::task::Poll::Pending,
857 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
858 this.is_terminated = true;
859 return std::task::Poll::Ready(None);
860 }
861 std::task::Poll::Ready(Err(e)) => {
862 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
863 e.into(),
864 ))))
865 }
866 }
867
868 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
870
871 std::task::Poll::Ready(Some(match header.ordinal {
872 0x25604347bb8a1ca3 => {
873 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
874 let mut req = fidl::new_empty!(
875 DisplayBacklightSetMinimumRgbRequest,
876 fidl::encoding::DefaultFuchsiaResourceDialect
877 );
878 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DisplayBacklightSetMinimumRgbRequest>(&header, _body_bytes, handles, &mut req)?;
879 let control_handle =
880 DisplayBacklightControlHandle { inner: this.inner.clone() };
881 Ok(DisplayBacklightRequest::SetMinimumRgb {
882 minimum_rgb: req.minimum_rgb,
883
884 responder: DisplayBacklightSetMinimumRgbResponder {
885 control_handle: std::mem::ManuallyDrop::new(control_handle),
886 tx_id: header.tx_id,
887 },
888 })
889 }
890 _ => Err(fidl::Error::UnknownOrdinal {
891 ordinal: header.ordinal,
892 protocol_name:
893 <DisplayBacklightMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
894 }),
895 }))
896 },
897 )
898 }
899}
900
901#[derive(Debug)]
916pub enum DisplayBacklightRequest {
917 SetMinimumRgb { minimum_rgb: u8, responder: DisplayBacklightSetMinimumRgbResponder },
926}
927
928impl DisplayBacklightRequest {
929 #[allow(irrefutable_let_patterns)]
930 pub fn into_set_minimum_rgb(self) -> Option<(u8, DisplayBacklightSetMinimumRgbResponder)> {
931 if let DisplayBacklightRequest::SetMinimumRgb { minimum_rgb, responder } = self {
932 Some((minimum_rgb, responder))
933 } else {
934 None
935 }
936 }
937
938 pub fn method_name(&self) -> &'static str {
940 match *self {
941 DisplayBacklightRequest::SetMinimumRgb { .. } => "set_minimum_rgb",
942 }
943 }
944}
945
946#[derive(Debug, Clone)]
947pub struct DisplayBacklightControlHandle {
948 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
949}
950
951impl fidl::endpoints::ControlHandle for DisplayBacklightControlHandle {
952 fn shutdown(&self) {
953 self.inner.shutdown()
954 }
955 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
956 self.inner.shutdown_with_epitaph(status)
957 }
958
959 fn is_closed(&self) -> bool {
960 self.inner.channel().is_closed()
961 }
962 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
963 self.inner.channel().on_closed()
964 }
965
966 #[cfg(target_os = "fuchsia")]
967 fn signal_peer(
968 &self,
969 clear_mask: zx::Signals,
970 set_mask: zx::Signals,
971 ) -> Result<(), zx_status::Status> {
972 use fidl::Peered;
973 self.inner.channel().signal_peer(clear_mask, set_mask)
974 }
975}
976
977impl DisplayBacklightControlHandle {}
978
979#[must_use = "FIDL methods require a response to be sent"]
980#[derive(Debug)]
981pub struct DisplayBacklightSetMinimumRgbResponder {
982 control_handle: std::mem::ManuallyDrop<DisplayBacklightControlHandle>,
983 tx_id: u32,
984}
985
986impl std::ops::Drop for DisplayBacklightSetMinimumRgbResponder {
990 fn drop(&mut self) {
991 self.control_handle.shutdown();
992 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
994 }
995}
996
997impl fidl::endpoints::Responder for DisplayBacklightSetMinimumRgbResponder {
998 type ControlHandle = DisplayBacklightControlHandle;
999
1000 fn control_handle(&self) -> &DisplayBacklightControlHandle {
1001 &self.control_handle
1002 }
1003
1004 fn drop_without_shutdown(mut self) {
1005 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1007 std::mem::forget(self);
1009 }
1010}
1011
1012impl DisplayBacklightSetMinimumRgbResponder {
1013 pub fn send(self) -> Result<(), fidl::Error> {
1017 let _result = self.send_raw();
1018 if _result.is_err() {
1019 self.control_handle.shutdown();
1020 }
1021 self.drop_without_shutdown();
1022 _result
1023 }
1024
1025 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1027 let _result = self.send_raw();
1028 self.drop_without_shutdown();
1029 _result
1030 }
1031
1032 fn send_raw(&self) -> Result<(), fidl::Error> {
1033 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1034 (),
1035 self.tx_id,
1036 0x25604347bb8a1ca3,
1037 fidl::encoding::DynamicFlags::empty(),
1038 )
1039 }
1040}
1041
1042#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1043pub struct MediaButtonsListenerMarker;
1044
1045impl fidl::endpoints::ProtocolMarker for MediaButtonsListenerMarker {
1046 type Proxy = MediaButtonsListenerProxy;
1047 type RequestStream = MediaButtonsListenerRequestStream;
1048 #[cfg(target_os = "fuchsia")]
1049 type SynchronousProxy = MediaButtonsListenerSynchronousProxy;
1050
1051 const DEBUG_NAME: &'static str = "(anonymous) MediaButtonsListener";
1052}
1053
1054pub trait MediaButtonsListenerProxyInterface: Send + Sync {
1055 fn r#on_media_buttons_event(
1056 &self,
1057 event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1058 ) -> Result<(), fidl::Error>;
1059 type OnEventResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1060 fn r#on_event(
1061 &self,
1062 event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1063 ) -> Self::OnEventResponseFut;
1064}
1065#[derive(Debug)]
1066#[cfg(target_os = "fuchsia")]
1067pub struct MediaButtonsListenerSynchronousProxy {
1068 client: fidl::client::sync::Client,
1069}
1070
1071#[cfg(target_os = "fuchsia")]
1072impl fidl::endpoints::SynchronousProxy for MediaButtonsListenerSynchronousProxy {
1073 type Proxy = MediaButtonsListenerProxy;
1074 type Protocol = MediaButtonsListenerMarker;
1075
1076 fn from_channel(inner: fidl::Channel) -> Self {
1077 Self::new(inner)
1078 }
1079
1080 fn into_channel(self) -> fidl::Channel {
1081 self.client.into_channel()
1082 }
1083
1084 fn as_channel(&self) -> &fidl::Channel {
1085 self.client.as_channel()
1086 }
1087}
1088
1089#[cfg(target_os = "fuchsia")]
1090impl MediaButtonsListenerSynchronousProxy {
1091 pub fn new(channel: fidl::Channel) -> Self {
1092 let protocol_name =
1093 <MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1094 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1095 }
1096
1097 pub fn into_channel(self) -> fidl::Channel {
1098 self.client.into_channel()
1099 }
1100
1101 pub fn wait_for_event(
1104 &self,
1105 deadline: zx::MonotonicInstant,
1106 ) -> Result<MediaButtonsListenerEvent, fidl::Error> {
1107 MediaButtonsListenerEvent::decode(self.client.wait_for_event(deadline)?)
1108 }
1109
1110 pub fn r#on_media_buttons_event(
1111 &self,
1112 mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1113 ) -> Result<(), fidl::Error> {
1114 self.client.send::<MediaButtonsListenerOnMediaButtonsEventRequest>(
1115 (event,),
1116 0x2c2068c386964e00,
1117 fidl::encoding::DynamicFlags::empty(),
1118 )
1119 }
1120
1121 pub fn r#on_event(
1122 &self,
1123 mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1124 ___deadline: zx::MonotonicInstant,
1125 ) -> Result<(), fidl::Error> {
1126 let _response = self
1127 .client
1128 .send_query::<MediaButtonsListenerOnEventRequest, fidl::encoding::EmptyPayload>(
1129 (event,),
1130 0x16e7130ddcaf877c,
1131 fidl::encoding::DynamicFlags::empty(),
1132 ___deadline,
1133 )?;
1134 Ok(_response)
1135 }
1136}
1137
1138#[cfg(target_os = "fuchsia")]
1139impl From<MediaButtonsListenerSynchronousProxy> for zx::Handle {
1140 fn from(value: MediaButtonsListenerSynchronousProxy) -> Self {
1141 value.into_channel().into()
1142 }
1143}
1144
1145#[cfg(target_os = "fuchsia")]
1146impl From<fidl::Channel> for MediaButtonsListenerSynchronousProxy {
1147 fn from(value: fidl::Channel) -> Self {
1148 Self::new(value)
1149 }
1150}
1151
1152#[derive(Debug, Clone)]
1153pub struct MediaButtonsListenerProxy {
1154 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1155}
1156
1157impl fidl::endpoints::Proxy for MediaButtonsListenerProxy {
1158 type Protocol = MediaButtonsListenerMarker;
1159
1160 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1161 Self::new(inner)
1162 }
1163
1164 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1165 self.client.into_channel().map_err(|client| Self { client })
1166 }
1167
1168 fn as_channel(&self) -> &::fidl::AsyncChannel {
1169 self.client.as_channel()
1170 }
1171}
1172
1173impl MediaButtonsListenerProxy {
1174 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1176 let protocol_name =
1177 <MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1178 Self { client: fidl::client::Client::new(channel, protocol_name) }
1179 }
1180
1181 pub fn take_event_stream(&self) -> MediaButtonsListenerEventStream {
1187 MediaButtonsListenerEventStream { event_receiver: self.client.take_event_receiver() }
1188 }
1189
1190 pub fn r#on_media_buttons_event(
1191 &self,
1192 mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1193 ) -> Result<(), fidl::Error> {
1194 MediaButtonsListenerProxyInterface::r#on_media_buttons_event(self, event)
1195 }
1196
1197 pub fn r#on_event(
1198 &self,
1199 mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1200 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1201 MediaButtonsListenerProxyInterface::r#on_event(self, event)
1202 }
1203}
1204
1205impl MediaButtonsListenerProxyInterface for MediaButtonsListenerProxy {
1206 fn r#on_media_buttons_event(
1207 &self,
1208 mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1209 ) -> Result<(), fidl::Error> {
1210 self.client.send::<MediaButtonsListenerOnMediaButtonsEventRequest>(
1211 (event,),
1212 0x2c2068c386964e00,
1213 fidl::encoding::DynamicFlags::empty(),
1214 )
1215 }
1216
1217 type OnEventResponseFut =
1218 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1219 fn r#on_event(
1220 &self,
1221 mut event: &fidl_fuchsia_ui_input::MediaButtonsEvent,
1222 ) -> Self::OnEventResponseFut {
1223 fn _decode(
1224 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1225 ) -> Result<(), fidl::Error> {
1226 let _response = fidl::client::decode_transaction_body::<
1227 fidl::encoding::EmptyPayload,
1228 fidl::encoding::DefaultFuchsiaResourceDialect,
1229 0x16e7130ddcaf877c,
1230 >(_buf?)?;
1231 Ok(_response)
1232 }
1233 self.client.send_query_and_decode::<MediaButtonsListenerOnEventRequest, ()>(
1234 (event,),
1235 0x16e7130ddcaf877c,
1236 fidl::encoding::DynamicFlags::empty(),
1237 _decode,
1238 )
1239 }
1240}
1241
1242pub struct MediaButtonsListenerEventStream {
1243 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1244}
1245
1246impl std::marker::Unpin for MediaButtonsListenerEventStream {}
1247
1248impl futures::stream::FusedStream for MediaButtonsListenerEventStream {
1249 fn is_terminated(&self) -> bool {
1250 self.event_receiver.is_terminated()
1251 }
1252}
1253
1254impl futures::Stream for MediaButtonsListenerEventStream {
1255 type Item = Result<MediaButtonsListenerEvent, fidl::Error>;
1256
1257 fn poll_next(
1258 mut self: std::pin::Pin<&mut Self>,
1259 cx: &mut std::task::Context<'_>,
1260 ) -> std::task::Poll<Option<Self::Item>> {
1261 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1262 &mut self.event_receiver,
1263 cx
1264 )?) {
1265 Some(buf) => std::task::Poll::Ready(Some(MediaButtonsListenerEvent::decode(buf))),
1266 None => std::task::Poll::Ready(None),
1267 }
1268 }
1269}
1270
1271#[derive(Debug)]
1272pub enum MediaButtonsListenerEvent {}
1273
1274impl MediaButtonsListenerEvent {
1275 fn decode(
1277 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1278 ) -> Result<MediaButtonsListenerEvent, fidl::Error> {
1279 let (bytes, _handles) = buf.split_mut();
1280 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1281 debug_assert_eq!(tx_header.tx_id, 0);
1282 match tx_header.ordinal {
1283 _ => Err(fidl::Error::UnknownOrdinal {
1284 ordinal: tx_header.ordinal,
1285 protocol_name:
1286 <MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1287 }),
1288 }
1289 }
1290}
1291
1292pub struct MediaButtonsListenerRequestStream {
1294 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1295 is_terminated: bool,
1296}
1297
1298impl std::marker::Unpin for MediaButtonsListenerRequestStream {}
1299
1300impl futures::stream::FusedStream for MediaButtonsListenerRequestStream {
1301 fn is_terminated(&self) -> bool {
1302 self.is_terminated
1303 }
1304}
1305
1306impl fidl::endpoints::RequestStream for MediaButtonsListenerRequestStream {
1307 type Protocol = MediaButtonsListenerMarker;
1308 type ControlHandle = MediaButtonsListenerControlHandle;
1309
1310 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1311 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1312 }
1313
1314 fn control_handle(&self) -> Self::ControlHandle {
1315 MediaButtonsListenerControlHandle { inner: self.inner.clone() }
1316 }
1317
1318 fn into_inner(
1319 self,
1320 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1321 {
1322 (self.inner, self.is_terminated)
1323 }
1324
1325 fn from_inner(
1326 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1327 is_terminated: bool,
1328 ) -> Self {
1329 Self { inner, is_terminated }
1330 }
1331}
1332
1333impl futures::Stream for MediaButtonsListenerRequestStream {
1334 type Item = Result<MediaButtonsListenerRequest, fidl::Error>;
1335
1336 fn poll_next(
1337 mut self: std::pin::Pin<&mut Self>,
1338 cx: &mut std::task::Context<'_>,
1339 ) -> std::task::Poll<Option<Self::Item>> {
1340 let this = &mut *self;
1341 if this.inner.check_shutdown(cx) {
1342 this.is_terminated = true;
1343 return std::task::Poll::Ready(None);
1344 }
1345 if this.is_terminated {
1346 panic!("polled MediaButtonsListenerRequestStream after completion");
1347 }
1348 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1349 |bytes, handles| {
1350 match this.inner.channel().read_etc(cx, bytes, handles) {
1351 std::task::Poll::Ready(Ok(())) => {}
1352 std::task::Poll::Pending => return std::task::Poll::Pending,
1353 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1354 this.is_terminated = true;
1355 return std::task::Poll::Ready(None);
1356 }
1357 std::task::Poll::Ready(Err(e)) => {
1358 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1359 e.into(),
1360 ))))
1361 }
1362 }
1363
1364 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1366
1367 std::task::Poll::Ready(Some(match header.ordinal {
1368 0x2c2068c386964e00 => {
1369 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1370 let mut req = fidl::new_empty!(MediaButtonsListenerOnMediaButtonsEventRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1371 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MediaButtonsListenerOnMediaButtonsEventRequest>(&header, _body_bytes, handles, &mut req)?;
1372 let control_handle = MediaButtonsListenerControlHandle {
1373 inner: this.inner.clone(),
1374 };
1375 Ok(MediaButtonsListenerRequest::OnMediaButtonsEvent {event: req.event,
1376
1377 control_handle,
1378 })
1379 }
1380 0x16e7130ddcaf877c => {
1381 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1382 let mut req = fidl::new_empty!(MediaButtonsListenerOnEventRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1383 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MediaButtonsListenerOnEventRequest>(&header, _body_bytes, handles, &mut req)?;
1384 let control_handle = MediaButtonsListenerControlHandle {
1385 inner: this.inner.clone(),
1386 };
1387 Ok(MediaButtonsListenerRequest::OnEvent {event: req.event,
1388
1389 responder: MediaButtonsListenerOnEventResponder {
1390 control_handle: std::mem::ManuallyDrop::new(control_handle),
1391 tx_id: header.tx_id,
1392 },
1393 })
1394 }
1395 _ => Err(fidl::Error::UnknownOrdinal {
1396 ordinal: header.ordinal,
1397 protocol_name: <MediaButtonsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1398 }),
1399 }))
1400 },
1401 )
1402 }
1403}
1404
1405#[derive(Debug)]
1409pub enum MediaButtonsListenerRequest {
1410 OnMediaButtonsEvent {
1411 event: fidl_fuchsia_ui_input::MediaButtonsEvent,
1412 control_handle: MediaButtonsListenerControlHandle,
1413 },
1414 OnEvent {
1415 event: fidl_fuchsia_ui_input::MediaButtonsEvent,
1416 responder: MediaButtonsListenerOnEventResponder,
1417 },
1418}
1419
1420impl MediaButtonsListenerRequest {
1421 #[allow(irrefutable_let_patterns)]
1422 pub fn into_on_media_buttons_event(
1423 self,
1424 ) -> Option<(fidl_fuchsia_ui_input::MediaButtonsEvent, MediaButtonsListenerControlHandle)> {
1425 if let MediaButtonsListenerRequest::OnMediaButtonsEvent { event, control_handle } = self {
1426 Some((event, control_handle))
1427 } else {
1428 None
1429 }
1430 }
1431
1432 #[allow(irrefutable_let_patterns)]
1433 pub fn into_on_event(
1434 self,
1435 ) -> Option<(fidl_fuchsia_ui_input::MediaButtonsEvent, MediaButtonsListenerOnEventResponder)>
1436 {
1437 if let MediaButtonsListenerRequest::OnEvent { event, responder } = self {
1438 Some((event, responder))
1439 } else {
1440 None
1441 }
1442 }
1443
1444 pub fn method_name(&self) -> &'static str {
1446 match *self {
1447 MediaButtonsListenerRequest::OnMediaButtonsEvent { .. } => "on_media_buttons_event",
1448 MediaButtonsListenerRequest::OnEvent { .. } => "on_event",
1449 }
1450 }
1451}
1452
1453#[derive(Debug, Clone)]
1454pub struct MediaButtonsListenerControlHandle {
1455 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1456}
1457
1458impl fidl::endpoints::ControlHandle for MediaButtonsListenerControlHandle {
1459 fn shutdown(&self) {
1460 self.inner.shutdown()
1461 }
1462 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1463 self.inner.shutdown_with_epitaph(status)
1464 }
1465
1466 fn is_closed(&self) -> bool {
1467 self.inner.channel().is_closed()
1468 }
1469 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1470 self.inner.channel().on_closed()
1471 }
1472
1473 #[cfg(target_os = "fuchsia")]
1474 fn signal_peer(
1475 &self,
1476 clear_mask: zx::Signals,
1477 set_mask: zx::Signals,
1478 ) -> Result<(), zx_status::Status> {
1479 use fidl::Peered;
1480 self.inner.channel().signal_peer(clear_mask, set_mask)
1481 }
1482}
1483
1484impl MediaButtonsListenerControlHandle {}
1485
1486#[must_use = "FIDL methods require a response to be sent"]
1487#[derive(Debug)]
1488pub struct MediaButtonsListenerOnEventResponder {
1489 control_handle: std::mem::ManuallyDrop<MediaButtonsListenerControlHandle>,
1490 tx_id: u32,
1491}
1492
1493impl std::ops::Drop for MediaButtonsListenerOnEventResponder {
1497 fn drop(&mut self) {
1498 self.control_handle.shutdown();
1499 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1501 }
1502}
1503
1504impl fidl::endpoints::Responder for MediaButtonsListenerOnEventResponder {
1505 type ControlHandle = MediaButtonsListenerControlHandle;
1506
1507 fn control_handle(&self) -> &MediaButtonsListenerControlHandle {
1508 &self.control_handle
1509 }
1510
1511 fn drop_without_shutdown(mut self) {
1512 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1514 std::mem::forget(self);
1516 }
1517}
1518
1519impl MediaButtonsListenerOnEventResponder {
1520 pub fn send(self) -> Result<(), fidl::Error> {
1524 let _result = self.send_raw();
1525 if _result.is_err() {
1526 self.control_handle.shutdown();
1527 }
1528 self.drop_without_shutdown();
1529 _result
1530 }
1531
1532 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1534 let _result = self.send_raw();
1535 self.drop_without_shutdown();
1536 _result
1537 }
1538
1539 fn send_raw(&self) -> Result<(), fidl::Error> {
1540 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1541 (),
1542 self.tx_id,
1543 0x16e7130ddcaf877c,
1544 fidl::encoding::DynamicFlags::empty(),
1545 )
1546 }
1547}
1548
1549mod internal {
1550 use super::*;
1551
1552 impl fidl::encoding::ResourceTypeMarker for DeviceListenerRegistryRegisterListenerRequest {
1553 type Borrowed<'a> = &'a mut Self;
1554 fn take_or_borrow<'a>(
1555 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1556 ) -> Self::Borrowed<'a> {
1557 value
1558 }
1559 }
1560
1561 unsafe impl fidl::encoding::TypeMarker for DeviceListenerRegistryRegisterListenerRequest {
1562 type Owned = Self;
1563
1564 #[inline(always)]
1565 fn inline_align(_context: fidl::encoding::Context) -> usize {
1566 4
1567 }
1568
1569 #[inline(always)]
1570 fn inline_size(_context: fidl::encoding::Context) -> usize {
1571 4
1572 }
1573 }
1574
1575 unsafe impl
1576 fidl::encoding::Encode<
1577 DeviceListenerRegistryRegisterListenerRequest,
1578 fidl::encoding::DefaultFuchsiaResourceDialect,
1579 > for &mut DeviceListenerRegistryRegisterListenerRequest
1580 {
1581 #[inline]
1582 unsafe fn encode(
1583 self,
1584 encoder: &mut fidl::encoding::Encoder<
1585 '_,
1586 fidl::encoding::DefaultFuchsiaResourceDialect,
1587 >,
1588 offset: usize,
1589 _depth: fidl::encoding::Depth,
1590 ) -> fidl::Result<()> {
1591 encoder.debug_check_bounds::<DeviceListenerRegistryRegisterListenerRequest>(offset);
1592 fidl::encoding::Encode::<
1594 DeviceListenerRegistryRegisterListenerRequest,
1595 fidl::encoding::DefaultFuchsiaResourceDialect,
1596 >::encode(
1597 (
1598 <fidl::encoding::Endpoint<
1599 fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
1600 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1601 &mut self.listener
1602 ),
1603 ),
1604 encoder,
1605 offset,
1606 _depth,
1607 )
1608 }
1609 }
1610 unsafe impl<
1611 T0: fidl::encoding::Encode<
1612 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
1613 fidl::encoding::DefaultFuchsiaResourceDialect,
1614 >,
1615 >
1616 fidl::encoding::Encode<
1617 DeviceListenerRegistryRegisterListenerRequest,
1618 fidl::encoding::DefaultFuchsiaResourceDialect,
1619 > for (T0,)
1620 {
1621 #[inline]
1622 unsafe fn encode(
1623 self,
1624 encoder: &mut fidl::encoding::Encoder<
1625 '_,
1626 fidl::encoding::DefaultFuchsiaResourceDialect,
1627 >,
1628 offset: usize,
1629 depth: fidl::encoding::Depth,
1630 ) -> fidl::Result<()> {
1631 encoder.debug_check_bounds::<DeviceListenerRegistryRegisterListenerRequest>(offset);
1632 self.0.encode(encoder, offset + 0, depth)?;
1636 Ok(())
1637 }
1638 }
1639
1640 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1641 for DeviceListenerRegistryRegisterListenerRequest
1642 {
1643 #[inline(always)]
1644 fn new_empty() -> Self {
1645 Self {
1646 listener: fidl::new_empty!(
1647 fidl::encoding::Endpoint<
1648 fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
1649 >,
1650 fidl::encoding::DefaultFuchsiaResourceDialect
1651 ),
1652 }
1653 }
1654
1655 #[inline]
1656 unsafe fn decode(
1657 &mut self,
1658 decoder: &mut fidl::encoding::Decoder<
1659 '_,
1660 fidl::encoding::DefaultFuchsiaResourceDialect,
1661 >,
1662 offset: usize,
1663 _depth: fidl::encoding::Depth,
1664 ) -> fidl::Result<()> {
1665 decoder.debug_check_bounds::<Self>(offset);
1666 fidl::decode!(
1668 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
1669 fidl::encoding::DefaultFuchsiaResourceDialect,
1670 &mut self.listener,
1671 decoder,
1672 offset + 0,
1673 _depth
1674 )?;
1675 Ok(())
1676 }
1677 }
1678
1679 impl fidl::encoding::ResourceTypeMarker
1680 for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
1681 {
1682 type Borrowed<'a> = &'a mut Self;
1683 fn take_or_borrow<'a>(
1684 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1685 ) -> Self::Borrowed<'a> {
1686 value
1687 }
1688 }
1689
1690 unsafe impl fidl::encoding::TypeMarker
1691 for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
1692 {
1693 type Owned = Self;
1694
1695 #[inline(always)]
1696 fn inline_align(_context: fidl::encoding::Context) -> usize {
1697 4
1698 }
1699
1700 #[inline(always)]
1701 fn inline_size(_context: fidl::encoding::Context) -> usize {
1702 4
1703 }
1704 }
1705
1706 unsafe impl
1707 fidl::encoding::Encode<
1708 DeviceListenerRegistryRegisterMediaButtonsListenerRequest,
1709 fidl::encoding::DefaultFuchsiaResourceDialect,
1710 > for &mut DeviceListenerRegistryRegisterMediaButtonsListenerRequest
1711 {
1712 #[inline]
1713 unsafe fn encode(
1714 self,
1715 encoder: &mut fidl::encoding::Encoder<
1716 '_,
1717 fidl::encoding::DefaultFuchsiaResourceDialect,
1718 >,
1719 offset: usize,
1720 _depth: fidl::encoding::Depth,
1721 ) -> fidl::Result<()> {
1722 encoder
1723 .debug_check_bounds::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
1724 offset,
1725 );
1726 fidl::encoding::Encode::<
1728 DeviceListenerRegistryRegisterMediaButtonsListenerRequest,
1729 fidl::encoding::DefaultFuchsiaResourceDialect,
1730 >::encode(
1731 (
1732 <fidl::encoding::Endpoint<
1733 fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
1734 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1735 &mut self.listener
1736 ),
1737 ),
1738 encoder,
1739 offset,
1740 _depth,
1741 )
1742 }
1743 }
1744 unsafe impl<
1745 T0: fidl::encoding::Encode<
1746 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
1747 fidl::encoding::DefaultFuchsiaResourceDialect,
1748 >,
1749 >
1750 fidl::encoding::Encode<
1751 DeviceListenerRegistryRegisterMediaButtonsListenerRequest,
1752 fidl::encoding::DefaultFuchsiaResourceDialect,
1753 > for (T0,)
1754 {
1755 #[inline]
1756 unsafe fn encode(
1757 self,
1758 encoder: &mut fidl::encoding::Encoder<
1759 '_,
1760 fidl::encoding::DefaultFuchsiaResourceDialect,
1761 >,
1762 offset: usize,
1763 depth: fidl::encoding::Depth,
1764 ) -> fidl::Result<()> {
1765 encoder
1766 .debug_check_bounds::<DeviceListenerRegistryRegisterMediaButtonsListenerRequest>(
1767 offset,
1768 );
1769 self.0.encode(encoder, offset + 0, depth)?;
1773 Ok(())
1774 }
1775 }
1776
1777 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1778 for DeviceListenerRegistryRegisterMediaButtonsListenerRequest
1779 {
1780 #[inline(always)]
1781 fn new_empty() -> Self {
1782 Self {
1783 listener: fidl::new_empty!(
1784 fidl::encoding::Endpoint<
1785 fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>,
1786 >,
1787 fidl::encoding::DefaultFuchsiaResourceDialect
1788 ),
1789 }
1790 }
1791
1792 #[inline]
1793 unsafe fn decode(
1794 &mut self,
1795 decoder: &mut fidl::encoding::Decoder<
1796 '_,
1797 fidl::encoding::DefaultFuchsiaResourceDialect,
1798 >,
1799 offset: usize,
1800 _depth: fidl::encoding::Depth,
1801 ) -> fidl::Result<()> {
1802 decoder.debug_check_bounds::<Self>(offset);
1803 fidl::decode!(
1805 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MediaButtonsListenerMarker>>,
1806 fidl::encoding::DefaultFuchsiaResourceDialect,
1807 &mut self.listener,
1808 decoder,
1809 offset + 0,
1810 _depth
1811 )?;
1812 Ok(())
1813 }
1814 }
1815}