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_brightness_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct ColorAdjustmentMarker;
16
17impl fidl::endpoints::ProtocolMarker for ColorAdjustmentMarker {
18 type Proxy = ColorAdjustmentProxy;
19 type RequestStream = ColorAdjustmentRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = ColorAdjustmentSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.ColorAdjustment";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for ColorAdjustmentMarker {}
26
27pub trait ColorAdjustmentProxyInterface: Send + Sync {
28 type SetDiscreteColorAdjustmentResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
29 + Send;
30 fn r#set_discrete_color_adjustment(
31 &self,
32 color_adjustment: &ColorAdjustmentTable,
33 ) -> Self::SetDiscreteColorAdjustmentResponseFut;
34}
35#[derive(Debug)]
36#[cfg(target_os = "fuchsia")]
37pub struct ColorAdjustmentSynchronousProxy {
38 client: fidl::client::sync::Client,
39}
40
41#[cfg(target_os = "fuchsia")]
42impl fidl::endpoints::SynchronousProxy for ColorAdjustmentSynchronousProxy {
43 type Proxy = ColorAdjustmentProxy;
44 type Protocol = ColorAdjustmentMarker;
45
46 fn from_channel(inner: fidl::Channel) -> Self {
47 Self::new(inner)
48 }
49
50 fn into_channel(self) -> fidl::Channel {
51 self.client.into_channel()
52 }
53
54 fn as_channel(&self) -> &fidl::Channel {
55 self.client.as_channel()
56 }
57}
58
59#[cfg(target_os = "fuchsia")]
60impl ColorAdjustmentSynchronousProxy {
61 pub fn new(channel: fidl::Channel) -> Self {
62 Self { client: fidl::client::sync::Client::new(channel) }
63 }
64
65 pub fn into_channel(self) -> fidl::Channel {
66 self.client.into_channel()
67 }
68
69 pub fn wait_for_event(
72 &self,
73 deadline: zx::MonotonicInstant,
74 ) -> Result<ColorAdjustmentEvent, fidl::Error> {
75 ColorAdjustmentEvent::decode(self.client.wait_for_event::<ColorAdjustmentMarker>(deadline)?)
76 }
77
78 pub fn r#set_discrete_color_adjustment(
83 &self,
84 mut color_adjustment: &ColorAdjustmentTable,
85 ___deadline: zx::MonotonicInstant,
86 ) -> Result<(), fidl::Error> {
87 let _response = self.client.send_query::<
88 ColorAdjustmentSetDiscreteColorAdjustmentRequest,
89 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
90 ColorAdjustmentMarker,
91 >(
92 (color_adjustment,),
93 0x48d90d2e62d451c4,
94 fidl::encoding::DynamicFlags::FLEXIBLE,
95 ___deadline,
96 )?
97 .into_result::<ColorAdjustmentMarker>("set_discrete_color_adjustment")?;
98 Ok(_response)
99 }
100}
101
102#[cfg(target_os = "fuchsia")]
103impl From<ColorAdjustmentSynchronousProxy> for zx::NullableHandle {
104 fn from(value: ColorAdjustmentSynchronousProxy) -> Self {
105 value.into_channel().into()
106 }
107}
108
109#[cfg(target_os = "fuchsia")]
110impl From<fidl::Channel> for ColorAdjustmentSynchronousProxy {
111 fn from(value: fidl::Channel) -> Self {
112 Self::new(value)
113 }
114}
115
116#[cfg(target_os = "fuchsia")]
117impl fidl::endpoints::FromClient for ColorAdjustmentSynchronousProxy {
118 type Protocol = ColorAdjustmentMarker;
119
120 fn from_client(value: fidl::endpoints::ClientEnd<ColorAdjustmentMarker>) -> Self {
121 Self::new(value.into_channel())
122 }
123}
124
125#[derive(Debug, Clone)]
126pub struct ColorAdjustmentProxy {
127 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
128}
129
130impl fidl::endpoints::Proxy for ColorAdjustmentProxy {
131 type Protocol = ColorAdjustmentMarker;
132
133 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
134 Self::new(inner)
135 }
136
137 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
138 self.client.into_channel().map_err(|client| Self { client })
139 }
140
141 fn as_channel(&self) -> &::fidl::AsyncChannel {
142 self.client.as_channel()
143 }
144}
145
146impl ColorAdjustmentProxy {
147 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
149 let protocol_name = <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
150 Self { client: fidl::client::Client::new(channel, protocol_name) }
151 }
152
153 pub fn take_event_stream(&self) -> ColorAdjustmentEventStream {
159 ColorAdjustmentEventStream { event_receiver: self.client.take_event_receiver() }
160 }
161
162 pub fn r#set_discrete_color_adjustment(
167 &self,
168 mut color_adjustment: &ColorAdjustmentTable,
169 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
170 ColorAdjustmentProxyInterface::r#set_discrete_color_adjustment(self, color_adjustment)
171 }
172}
173
174impl ColorAdjustmentProxyInterface for ColorAdjustmentProxy {
175 type SetDiscreteColorAdjustmentResponseFut =
176 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
177 fn r#set_discrete_color_adjustment(
178 &self,
179 mut color_adjustment: &ColorAdjustmentTable,
180 ) -> Self::SetDiscreteColorAdjustmentResponseFut {
181 fn _decode(
182 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
183 ) -> Result<(), fidl::Error> {
184 let _response = fidl::client::decode_transaction_body::<
185 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
186 fidl::encoding::DefaultFuchsiaResourceDialect,
187 0x48d90d2e62d451c4,
188 >(_buf?)?
189 .into_result::<ColorAdjustmentMarker>("set_discrete_color_adjustment")?;
190 Ok(_response)
191 }
192 self.client.send_query_and_decode::<ColorAdjustmentSetDiscreteColorAdjustmentRequest, ()>(
193 (color_adjustment,),
194 0x48d90d2e62d451c4,
195 fidl::encoding::DynamicFlags::FLEXIBLE,
196 _decode,
197 )
198 }
199}
200
201pub struct ColorAdjustmentEventStream {
202 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
203}
204
205impl std::marker::Unpin for ColorAdjustmentEventStream {}
206
207impl futures::stream::FusedStream for ColorAdjustmentEventStream {
208 fn is_terminated(&self) -> bool {
209 self.event_receiver.is_terminated()
210 }
211}
212
213impl futures::Stream for ColorAdjustmentEventStream {
214 type Item = Result<ColorAdjustmentEvent, fidl::Error>;
215
216 fn poll_next(
217 mut self: std::pin::Pin<&mut Self>,
218 cx: &mut std::task::Context<'_>,
219 ) -> std::task::Poll<Option<Self::Item>> {
220 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
221 &mut self.event_receiver,
222 cx
223 )?) {
224 Some(buf) => std::task::Poll::Ready(Some(ColorAdjustmentEvent::decode(buf))),
225 None => std::task::Poll::Ready(None),
226 }
227 }
228}
229
230#[derive(Debug)]
231pub enum ColorAdjustmentEvent {
232 #[non_exhaustive]
233 _UnknownEvent {
234 ordinal: u64,
236 },
237}
238
239impl ColorAdjustmentEvent {
240 fn decode(
242 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
243 ) -> Result<ColorAdjustmentEvent, fidl::Error> {
244 let (bytes, _handles) = buf.split_mut();
245 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
246 debug_assert_eq!(tx_header.tx_id, 0);
247 match tx_header.ordinal {
248 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
249 Ok(ColorAdjustmentEvent::_UnknownEvent { ordinal: tx_header.ordinal })
250 }
251 _ => Err(fidl::Error::UnknownOrdinal {
252 ordinal: tx_header.ordinal,
253 protocol_name:
254 <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
255 }),
256 }
257 }
258}
259
260pub struct ColorAdjustmentRequestStream {
262 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
263 is_terminated: bool,
264}
265
266impl std::marker::Unpin for ColorAdjustmentRequestStream {}
267
268impl futures::stream::FusedStream for ColorAdjustmentRequestStream {
269 fn is_terminated(&self) -> bool {
270 self.is_terminated
271 }
272}
273
274impl fidl::endpoints::RequestStream for ColorAdjustmentRequestStream {
275 type Protocol = ColorAdjustmentMarker;
276 type ControlHandle = ColorAdjustmentControlHandle;
277
278 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
279 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
280 }
281
282 fn control_handle(&self) -> Self::ControlHandle {
283 ColorAdjustmentControlHandle { inner: self.inner.clone() }
284 }
285
286 fn into_inner(
287 self,
288 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
289 {
290 (self.inner, self.is_terminated)
291 }
292
293 fn from_inner(
294 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
295 is_terminated: bool,
296 ) -> Self {
297 Self { inner, is_terminated }
298 }
299}
300
301impl futures::Stream for ColorAdjustmentRequestStream {
302 type Item = Result<ColorAdjustmentRequest, fidl::Error>;
303
304 fn poll_next(
305 mut self: std::pin::Pin<&mut Self>,
306 cx: &mut std::task::Context<'_>,
307 ) -> std::task::Poll<Option<Self::Item>> {
308 let this = &mut *self;
309 if this.inner.check_shutdown(cx) {
310 this.is_terminated = true;
311 return std::task::Poll::Ready(None);
312 }
313 if this.is_terminated {
314 panic!("polled ColorAdjustmentRequestStream after completion");
315 }
316 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
317 |bytes, handles| {
318 match this.inner.channel().read_etc(cx, bytes, handles) {
319 std::task::Poll::Ready(Ok(())) => {}
320 std::task::Poll::Pending => return std::task::Poll::Pending,
321 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
322 this.is_terminated = true;
323 return std::task::Poll::Ready(None);
324 }
325 std::task::Poll::Ready(Err(e)) => {
326 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
327 e.into(),
328 ))));
329 }
330 }
331
332 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
334
335 std::task::Poll::Ready(Some(match header.ordinal {
336 0x48d90d2e62d451c4 => {
337 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
338 let mut req = fidl::new_empty!(
339 ColorAdjustmentSetDiscreteColorAdjustmentRequest,
340 fidl::encoding::DefaultFuchsiaResourceDialect
341 );
342 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
343 let control_handle =
344 ColorAdjustmentControlHandle { inner: this.inner.clone() };
345 Ok(ColorAdjustmentRequest::SetDiscreteColorAdjustment {
346 color_adjustment: req.color_adjustment,
347
348 responder: ColorAdjustmentSetDiscreteColorAdjustmentResponder {
349 control_handle: std::mem::ManuallyDrop::new(control_handle),
350 tx_id: header.tx_id,
351 },
352 })
353 }
354 _ if header.tx_id == 0
355 && header
356 .dynamic_flags()
357 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
358 {
359 Ok(ColorAdjustmentRequest::_UnknownMethod {
360 ordinal: header.ordinal,
361 control_handle: ColorAdjustmentControlHandle {
362 inner: this.inner.clone(),
363 },
364 method_type: fidl::MethodType::OneWay,
365 })
366 }
367 _ if header
368 .dynamic_flags()
369 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
370 {
371 this.inner.send_framework_err(
372 fidl::encoding::FrameworkErr::UnknownMethod,
373 header.tx_id,
374 header.ordinal,
375 header.dynamic_flags(),
376 (bytes, handles),
377 )?;
378 Ok(ColorAdjustmentRequest::_UnknownMethod {
379 ordinal: header.ordinal,
380 control_handle: ColorAdjustmentControlHandle {
381 inner: this.inner.clone(),
382 },
383 method_type: fidl::MethodType::TwoWay,
384 })
385 }
386 _ => Err(fidl::Error::UnknownOrdinal {
387 ordinal: header.ordinal,
388 protocol_name:
389 <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
390 }),
391 }))
392 },
393 )
394 }
395}
396
397#[derive(Debug)]
400pub enum ColorAdjustmentRequest {
401 SetDiscreteColorAdjustment {
406 color_adjustment: ColorAdjustmentTable,
407 responder: ColorAdjustmentSetDiscreteColorAdjustmentResponder,
408 },
409 #[non_exhaustive]
411 _UnknownMethod {
412 ordinal: u64,
414 control_handle: ColorAdjustmentControlHandle,
415 method_type: fidl::MethodType,
416 },
417}
418
419impl ColorAdjustmentRequest {
420 #[allow(irrefutable_let_patterns)]
421 pub fn into_set_discrete_color_adjustment(
422 self,
423 ) -> Option<(ColorAdjustmentTable, ColorAdjustmentSetDiscreteColorAdjustmentResponder)> {
424 if let ColorAdjustmentRequest::SetDiscreteColorAdjustment { color_adjustment, responder } =
425 self
426 {
427 Some((color_adjustment, responder))
428 } else {
429 None
430 }
431 }
432
433 pub fn method_name(&self) -> &'static str {
435 match *self {
436 ColorAdjustmentRequest::SetDiscreteColorAdjustment { .. } => {
437 "set_discrete_color_adjustment"
438 }
439 ColorAdjustmentRequest::_UnknownMethod {
440 method_type: fidl::MethodType::OneWay,
441 ..
442 } => "unknown one-way method",
443 ColorAdjustmentRequest::_UnknownMethod {
444 method_type: fidl::MethodType::TwoWay,
445 ..
446 } => "unknown two-way method",
447 }
448 }
449}
450
451#[derive(Debug, Clone)]
452pub struct ColorAdjustmentControlHandle {
453 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
454}
455
456impl ColorAdjustmentControlHandle {
457 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
458 self.inner.shutdown_with_epitaph(status.into())
459 }
460}
461
462impl fidl::endpoints::ControlHandle for ColorAdjustmentControlHandle {
463 fn shutdown(&self) {
464 self.inner.shutdown()
465 }
466
467 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
468 self.inner.shutdown_with_epitaph(status)
469 }
470
471 fn is_closed(&self) -> bool {
472 self.inner.channel().is_closed()
473 }
474 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
475 self.inner.channel().on_closed()
476 }
477
478 #[cfg(target_os = "fuchsia")]
479 fn signal_peer(
480 &self,
481 clear_mask: zx::Signals,
482 set_mask: zx::Signals,
483 ) -> Result<(), zx_status::Status> {
484 use fidl::Peered;
485 self.inner.channel().signal_peer(clear_mask, set_mask)
486 }
487}
488
489impl ColorAdjustmentControlHandle {}
490
491#[must_use = "FIDL methods require a response to be sent"]
492#[derive(Debug)]
493pub struct ColorAdjustmentSetDiscreteColorAdjustmentResponder {
494 control_handle: std::mem::ManuallyDrop<ColorAdjustmentControlHandle>,
495 tx_id: u32,
496}
497
498impl std::ops::Drop for ColorAdjustmentSetDiscreteColorAdjustmentResponder {
502 fn drop(&mut self) {
503 self.control_handle.shutdown();
504 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
506 }
507}
508
509impl fidl::endpoints::Responder for ColorAdjustmentSetDiscreteColorAdjustmentResponder {
510 type ControlHandle = ColorAdjustmentControlHandle;
511
512 fn control_handle(&self) -> &ColorAdjustmentControlHandle {
513 &self.control_handle
514 }
515
516 fn drop_without_shutdown(mut self) {
517 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
519 std::mem::forget(self);
521 }
522}
523
524impl ColorAdjustmentSetDiscreteColorAdjustmentResponder {
525 pub fn send(self) -> Result<(), fidl::Error> {
529 let _result = self.send_raw();
530 if _result.is_err() {
531 self.control_handle.shutdown();
532 }
533 self.drop_without_shutdown();
534 _result
535 }
536
537 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
539 let _result = self.send_raw();
540 self.drop_without_shutdown();
541 _result
542 }
543
544 fn send_raw(&self) -> Result<(), fidl::Error> {
545 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
546 fidl::encoding::Flexible::new(()),
547 self.tx_id,
548 0x48d90d2e62d451c4,
549 fidl::encoding::DynamicFlags::FLEXIBLE,
550 )
551 }
552}
553
554#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
555pub struct ColorAdjustmentHandlerMarker;
556
557impl fidl::endpoints::ProtocolMarker for ColorAdjustmentHandlerMarker {
558 type Proxy = ColorAdjustmentHandlerProxy;
559 type RequestStream = ColorAdjustmentHandlerRequestStream;
560 #[cfg(target_os = "fuchsia")]
561 type SynchronousProxy = ColorAdjustmentHandlerSynchronousProxy;
562
563 const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.ColorAdjustmentHandler";
564}
565impl fidl::endpoints::DiscoverableProtocolMarker for ColorAdjustmentHandlerMarker {}
566
567pub trait ColorAdjustmentHandlerProxyInterface: Send + Sync {
568 fn r#set_color_adjustment(
569 &self,
570 color_adjustment: &ColorAdjustmentTable,
571 ) -> Result<(), fidl::Error>;
572}
573#[derive(Debug)]
574#[cfg(target_os = "fuchsia")]
575pub struct ColorAdjustmentHandlerSynchronousProxy {
576 client: fidl::client::sync::Client,
577}
578
579#[cfg(target_os = "fuchsia")]
580impl fidl::endpoints::SynchronousProxy for ColorAdjustmentHandlerSynchronousProxy {
581 type Proxy = ColorAdjustmentHandlerProxy;
582 type Protocol = ColorAdjustmentHandlerMarker;
583
584 fn from_channel(inner: fidl::Channel) -> Self {
585 Self::new(inner)
586 }
587
588 fn into_channel(self) -> fidl::Channel {
589 self.client.into_channel()
590 }
591
592 fn as_channel(&self) -> &fidl::Channel {
593 self.client.as_channel()
594 }
595}
596
597#[cfg(target_os = "fuchsia")]
598impl ColorAdjustmentHandlerSynchronousProxy {
599 pub fn new(channel: fidl::Channel) -> Self {
600 Self { client: fidl::client::sync::Client::new(channel) }
601 }
602
603 pub fn into_channel(self) -> fidl::Channel {
604 self.client.into_channel()
605 }
606
607 pub fn wait_for_event(
610 &self,
611 deadline: zx::MonotonicInstant,
612 ) -> Result<ColorAdjustmentHandlerEvent, fidl::Error> {
613 ColorAdjustmentHandlerEvent::decode(
614 self.client.wait_for_event::<ColorAdjustmentHandlerMarker>(deadline)?,
615 )
616 }
617
618 pub fn r#set_color_adjustment(
620 &self,
621 mut color_adjustment: &ColorAdjustmentTable,
622 ) -> Result<(), fidl::Error> {
623 self.client.send::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(
624 (color_adjustment,),
625 0x6277992fee8aea3d,
626 fidl::encoding::DynamicFlags::empty(),
627 )
628 }
629}
630
631#[cfg(target_os = "fuchsia")]
632impl From<ColorAdjustmentHandlerSynchronousProxy> for zx::NullableHandle {
633 fn from(value: ColorAdjustmentHandlerSynchronousProxy) -> Self {
634 value.into_channel().into()
635 }
636}
637
638#[cfg(target_os = "fuchsia")]
639impl From<fidl::Channel> for ColorAdjustmentHandlerSynchronousProxy {
640 fn from(value: fidl::Channel) -> Self {
641 Self::new(value)
642 }
643}
644
645#[cfg(target_os = "fuchsia")]
646impl fidl::endpoints::FromClient for ColorAdjustmentHandlerSynchronousProxy {
647 type Protocol = ColorAdjustmentHandlerMarker;
648
649 fn from_client(value: fidl::endpoints::ClientEnd<ColorAdjustmentHandlerMarker>) -> Self {
650 Self::new(value.into_channel())
651 }
652}
653
654#[derive(Debug, Clone)]
655pub struct ColorAdjustmentHandlerProxy {
656 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
657}
658
659impl fidl::endpoints::Proxy for ColorAdjustmentHandlerProxy {
660 type Protocol = ColorAdjustmentHandlerMarker;
661
662 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
663 Self::new(inner)
664 }
665
666 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
667 self.client.into_channel().map_err(|client| Self { client })
668 }
669
670 fn as_channel(&self) -> &::fidl::AsyncChannel {
671 self.client.as_channel()
672 }
673}
674
675impl ColorAdjustmentHandlerProxy {
676 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
678 let protocol_name =
679 <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
680 Self { client: fidl::client::Client::new(channel, protocol_name) }
681 }
682
683 pub fn take_event_stream(&self) -> ColorAdjustmentHandlerEventStream {
689 ColorAdjustmentHandlerEventStream { event_receiver: self.client.take_event_receiver() }
690 }
691
692 pub fn r#set_color_adjustment(
694 &self,
695 mut color_adjustment: &ColorAdjustmentTable,
696 ) -> Result<(), fidl::Error> {
697 ColorAdjustmentHandlerProxyInterface::r#set_color_adjustment(self, color_adjustment)
698 }
699}
700
701impl ColorAdjustmentHandlerProxyInterface for ColorAdjustmentHandlerProxy {
702 fn r#set_color_adjustment(
703 &self,
704 mut color_adjustment: &ColorAdjustmentTable,
705 ) -> Result<(), fidl::Error> {
706 self.client.send::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(
707 (color_adjustment,),
708 0x6277992fee8aea3d,
709 fidl::encoding::DynamicFlags::empty(),
710 )
711 }
712}
713
714pub struct ColorAdjustmentHandlerEventStream {
715 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
716}
717
718impl std::marker::Unpin for ColorAdjustmentHandlerEventStream {}
719
720impl futures::stream::FusedStream for ColorAdjustmentHandlerEventStream {
721 fn is_terminated(&self) -> bool {
722 self.event_receiver.is_terminated()
723 }
724}
725
726impl futures::Stream for ColorAdjustmentHandlerEventStream {
727 type Item = Result<ColorAdjustmentHandlerEvent, fidl::Error>;
728
729 fn poll_next(
730 mut self: std::pin::Pin<&mut Self>,
731 cx: &mut std::task::Context<'_>,
732 ) -> std::task::Poll<Option<Self::Item>> {
733 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
734 &mut self.event_receiver,
735 cx
736 )?) {
737 Some(buf) => std::task::Poll::Ready(Some(ColorAdjustmentHandlerEvent::decode(buf))),
738 None => std::task::Poll::Ready(None),
739 }
740 }
741}
742
743#[derive(Debug)]
744pub enum ColorAdjustmentHandlerEvent {}
745
746impl ColorAdjustmentHandlerEvent {
747 fn decode(
749 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
750 ) -> Result<ColorAdjustmentHandlerEvent, fidl::Error> {
751 let (bytes, _handles) = buf.split_mut();
752 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
753 debug_assert_eq!(tx_header.tx_id, 0);
754 match tx_header.ordinal {
755 _ => Err(fidl::Error::UnknownOrdinal {
756 ordinal: tx_header.ordinal,
757 protocol_name:
758 <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
759 }),
760 }
761 }
762}
763
764pub struct ColorAdjustmentHandlerRequestStream {
766 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
767 is_terminated: bool,
768}
769
770impl std::marker::Unpin for ColorAdjustmentHandlerRequestStream {}
771
772impl futures::stream::FusedStream for ColorAdjustmentHandlerRequestStream {
773 fn is_terminated(&self) -> bool {
774 self.is_terminated
775 }
776}
777
778impl fidl::endpoints::RequestStream for ColorAdjustmentHandlerRequestStream {
779 type Protocol = ColorAdjustmentHandlerMarker;
780 type ControlHandle = ColorAdjustmentHandlerControlHandle;
781
782 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
783 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
784 }
785
786 fn control_handle(&self) -> Self::ControlHandle {
787 ColorAdjustmentHandlerControlHandle { inner: self.inner.clone() }
788 }
789
790 fn into_inner(
791 self,
792 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
793 {
794 (self.inner, self.is_terminated)
795 }
796
797 fn from_inner(
798 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
799 is_terminated: bool,
800 ) -> Self {
801 Self { inner, is_terminated }
802 }
803}
804
805impl futures::Stream for ColorAdjustmentHandlerRequestStream {
806 type Item = Result<ColorAdjustmentHandlerRequest, fidl::Error>;
807
808 fn poll_next(
809 mut self: std::pin::Pin<&mut Self>,
810 cx: &mut std::task::Context<'_>,
811 ) -> std::task::Poll<Option<Self::Item>> {
812 let this = &mut *self;
813 if this.inner.check_shutdown(cx) {
814 this.is_terminated = true;
815 return std::task::Poll::Ready(None);
816 }
817 if this.is_terminated {
818 panic!("polled ColorAdjustmentHandlerRequestStream after completion");
819 }
820 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
821 |bytes, handles| {
822 match this.inner.channel().read_etc(cx, bytes, handles) {
823 std::task::Poll::Ready(Ok(())) => {}
824 std::task::Poll::Pending => return std::task::Poll::Pending,
825 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
826 this.is_terminated = true;
827 return std::task::Poll::Ready(None);
828 }
829 std::task::Poll::Ready(Err(e)) => {
830 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
831 e.into(),
832 ))));
833 }
834 }
835
836 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
838
839 std::task::Poll::Ready(Some(match header.ordinal {
840 0x6277992fee8aea3d => {
841 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
842 let mut req = fidl::new_empty!(ColorAdjustmentHandlerSetColorAdjustmentRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
843 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
844 let control_handle = ColorAdjustmentHandlerControlHandle {
845 inner: this.inner.clone(),
846 };
847 Ok(ColorAdjustmentHandlerRequest::SetColorAdjustment {color_adjustment: req.color_adjustment,
848
849 control_handle,
850 })
851 }
852 _ => Err(fidl::Error::UnknownOrdinal {
853 ordinal: header.ordinal,
854 protocol_name: <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
855 }),
856 }))
857 },
858 )
859 }
860}
861
862#[derive(Debug)]
866pub enum ColorAdjustmentHandlerRequest {
867 SetColorAdjustment {
869 color_adjustment: ColorAdjustmentTable,
870 control_handle: ColorAdjustmentHandlerControlHandle,
871 },
872}
873
874impl ColorAdjustmentHandlerRequest {
875 #[allow(irrefutable_let_patterns)]
876 pub fn into_set_color_adjustment(
877 self,
878 ) -> Option<(ColorAdjustmentTable, ColorAdjustmentHandlerControlHandle)> {
879 if let ColorAdjustmentHandlerRequest::SetColorAdjustment {
880 color_adjustment,
881 control_handle,
882 } = self
883 {
884 Some((color_adjustment, control_handle))
885 } else {
886 None
887 }
888 }
889
890 pub fn method_name(&self) -> &'static str {
892 match *self {
893 ColorAdjustmentHandlerRequest::SetColorAdjustment { .. } => "set_color_adjustment",
894 }
895 }
896}
897
898#[derive(Debug, Clone)]
899pub struct ColorAdjustmentHandlerControlHandle {
900 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
901}
902
903impl ColorAdjustmentHandlerControlHandle {
904 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
905 self.inner.shutdown_with_epitaph(status.into())
906 }
907}
908
909impl fidl::endpoints::ControlHandle for ColorAdjustmentHandlerControlHandle {
910 fn shutdown(&self) {
911 self.inner.shutdown()
912 }
913
914 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
915 self.inner.shutdown_with_epitaph(status)
916 }
917
918 fn is_closed(&self) -> bool {
919 self.inner.channel().is_closed()
920 }
921 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
922 self.inner.channel().on_closed()
923 }
924
925 #[cfg(target_os = "fuchsia")]
926 fn signal_peer(
927 &self,
928 clear_mask: zx::Signals,
929 set_mask: zx::Signals,
930 ) -> Result<(), zx_status::Status> {
931 use fidl::Peered;
932 self.inner.channel().signal_peer(clear_mask, set_mask)
933 }
934}
935
936impl ColorAdjustmentHandlerControlHandle {}
937
938#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
939pub struct ControlMarker;
940
941impl fidl::endpoints::ProtocolMarker for ControlMarker {
942 type Proxy = ControlProxy;
943 type RequestStream = ControlRequestStream;
944 #[cfg(target_os = "fuchsia")]
945 type SynchronousProxy = ControlSynchronousProxy;
946
947 const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.Control";
948}
949impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
950pub type ControlGetMaxAbsoluteBrightnessResult = Result<f64, i32>;
951
952pub trait ControlProxyInterface: Send + Sync {
953 fn r#set_auto_brightness(&self) -> Result<(), fidl::Error>;
954 type WatchAutoBrightnessResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
955 + Send;
956 fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut;
957 fn r#set_manual_brightness(&self, value: f32) -> Result<(), fidl::Error>;
958 fn r#set_manual_brightness_smooth(&self, value: f32, duration: i64) -> Result<(), fidl::Error>;
959 type WatchCurrentBrightnessResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
960 + Send;
961 fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut;
962 fn r#set_auto_brightness_adjustment(&self, adjustment: f32) -> Result<(), fidl::Error>;
963 type WatchAutoBrightnessAdjustmentResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
964 + Send;
965 fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut;
966 fn r#set_brightness_table(&self, table: &BrightnessTable) -> Result<(), fidl::Error>;
967 type GetMaxAbsoluteBrightnessResponseFut: std::future::Future<Output = Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error>>
968 + Send;
969 fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut;
970}
971#[derive(Debug)]
972#[cfg(target_os = "fuchsia")]
973pub struct ControlSynchronousProxy {
974 client: fidl::client::sync::Client,
975}
976
977#[cfg(target_os = "fuchsia")]
978impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
979 type Proxy = ControlProxy;
980 type Protocol = ControlMarker;
981
982 fn from_channel(inner: fidl::Channel) -> Self {
983 Self::new(inner)
984 }
985
986 fn into_channel(self) -> fidl::Channel {
987 self.client.into_channel()
988 }
989
990 fn as_channel(&self) -> &fidl::Channel {
991 self.client.as_channel()
992 }
993}
994
995#[cfg(target_os = "fuchsia")]
996impl ControlSynchronousProxy {
997 pub fn new(channel: fidl::Channel) -> Self {
998 Self { client: fidl::client::sync::Client::new(channel) }
999 }
1000
1001 pub fn into_channel(self) -> fidl::Channel {
1002 self.client.into_channel()
1003 }
1004
1005 pub fn wait_for_event(
1008 &self,
1009 deadline: zx::MonotonicInstant,
1010 ) -> Result<ControlEvent, fidl::Error> {
1011 ControlEvent::decode(self.client.wait_for_event::<ControlMarker>(deadline)?)
1012 }
1013
1014 pub fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
1017 self.client.send::<fidl::encoding::EmptyPayload>(
1018 (),
1019 0x46b623a7fa77a979,
1020 fidl::encoding::DynamicFlags::empty(),
1021 )
1022 }
1023
1024 pub fn r#watch_auto_brightness(
1027 &self,
1028 ___deadline: zx::MonotonicInstant,
1029 ) -> Result<bool, fidl::Error> {
1030 let _response = self.client.send_query::<
1031 fidl::encoding::EmptyPayload,
1032 ControlWatchAutoBrightnessResponse,
1033 ControlMarker,
1034 >(
1035 (),
1036 0xd956a90c115186b,
1037 fidl::encoding::DynamicFlags::empty(),
1038 ___deadline,
1039 )?;
1040 Ok(_response.enabled)
1041 }
1042
1043 pub fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
1048 self.client.send::<ControlSetManualBrightnessRequest>(
1049 (value,),
1050 0x1e333aa49771e1eb,
1051 fidl::encoding::DynamicFlags::empty(),
1052 )
1053 }
1054
1055 pub fn r#set_manual_brightness_smooth(
1058 &self,
1059 mut value: f32,
1060 mut duration: i64,
1061 ) -> Result<(), fidl::Error> {
1062 self.client.send::<ControlSetManualBrightnessSmoothRequest>(
1063 (value, duration),
1064 0x7b7d273c20a61d0c,
1065 fidl::encoding::DynamicFlags::empty(),
1066 )
1067 }
1068
1069 pub fn r#watch_current_brightness(
1074 &self,
1075 ___deadline: zx::MonotonicInstant,
1076 ) -> Result<f32, fidl::Error> {
1077 let _response = self.client.send_query::<
1078 fidl::encoding::EmptyPayload,
1079 ControlWatchCurrentBrightnessResponse,
1080 ControlMarker,
1081 >(
1082 (),
1083 0x2cc3011e2326d4d8,
1084 fidl::encoding::DynamicFlags::empty(),
1085 ___deadline,
1086 )?;
1087 Ok(_response.value)
1088 }
1089
1090 pub fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1094 self.client.send::<ControlSetAutoBrightnessAdjustmentRequest>(
1095 (adjustment,),
1096 0x678ee26bc217d996,
1097 fidl::encoding::DynamicFlags::empty(),
1098 )
1099 }
1100
1101 pub fn r#watch_auto_brightness_adjustment(
1104 &self,
1105 ___deadline: zx::MonotonicInstant,
1106 ) -> Result<f32, fidl::Error> {
1107 let _response = self.client.send_query::<
1108 fidl::encoding::EmptyPayload,
1109 ControlWatchAutoBrightnessAdjustmentResponse,
1110 ControlMarker,
1111 >(
1112 (),
1113 0x7c373aafe0058135,
1114 fidl::encoding::DynamicFlags::empty(),
1115 ___deadline,
1116 )?;
1117 Ok(_response.adjustment)
1118 }
1119
1120 pub fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
1125 self.client.send::<ControlSetBrightnessTableRequest>(
1126 (table,),
1127 0x11d419413129dcee,
1128 fidl::encoding::DynamicFlags::empty(),
1129 )
1130 }
1131
1132 pub fn r#get_max_absolute_brightness(
1134 &self,
1135 ___deadline: zx::MonotonicInstant,
1136 ) -> Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error> {
1137 let _response = self.client.send_query::<
1138 fidl::encoding::EmptyPayload,
1139 fidl::encoding::ResultType<ControlGetMaxAbsoluteBrightnessResponse, i32>,
1140 ControlMarker,
1141 >(
1142 (),
1143 0x73055a8d6422caf8,
1144 fidl::encoding::DynamicFlags::empty(),
1145 ___deadline,
1146 )?;
1147 Ok(_response.map(|x| x.max_brightness))
1148 }
1149}
1150
1151#[cfg(target_os = "fuchsia")]
1152impl From<ControlSynchronousProxy> for zx::NullableHandle {
1153 fn from(value: ControlSynchronousProxy) -> Self {
1154 value.into_channel().into()
1155 }
1156}
1157
1158#[cfg(target_os = "fuchsia")]
1159impl From<fidl::Channel> for ControlSynchronousProxy {
1160 fn from(value: fidl::Channel) -> Self {
1161 Self::new(value)
1162 }
1163}
1164
1165#[cfg(target_os = "fuchsia")]
1166impl fidl::endpoints::FromClient for ControlSynchronousProxy {
1167 type Protocol = ControlMarker;
1168
1169 fn from_client(value: fidl::endpoints::ClientEnd<ControlMarker>) -> Self {
1170 Self::new(value.into_channel())
1171 }
1172}
1173
1174#[derive(Debug, Clone)]
1175pub struct ControlProxy {
1176 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1177}
1178
1179impl fidl::endpoints::Proxy for ControlProxy {
1180 type Protocol = ControlMarker;
1181
1182 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1183 Self::new(inner)
1184 }
1185
1186 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1187 self.client.into_channel().map_err(|client| Self { client })
1188 }
1189
1190 fn as_channel(&self) -> &::fidl::AsyncChannel {
1191 self.client.as_channel()
1192 }
1193}
1194
1195impl ControlProxy {
1196 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1198 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1199 Self { client: fidl::client::Client::new(channel, protocol_name) }
1200 }
1201
1202 pub fn take_event_stream(&self) -> ControlEventStream {
1208 ControlEventStream { event_receiver: self.client.take_event_receiver() }
1209 }
1210
1211 pub fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
1214 ControlProxyInterface::r#set_auto_brightness(self)
1215 }
1216
1217 pub fn r#watch_auto_brightness(
1220 &self,
1221 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
1222 ControlProxyInterface::r#watch_auto_brightness(self)
1223 }
1224
1225 pub fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
1230 ControlProxyInterface::r#set_manual_brightness(self, value)
1231 }
1232
1233 pub fn r#set_manual_brightness_smooth(
1236 &self,
1237 mut value: f32,
1238 mut duration: i64,
1239 ) -> Result<(), fidl::Error> {
1240 ControlProxyInterface::r#set_manual_brightness_smooth(self, value, duration)
1241 }
1242
1243 pub fn r#watch_current_brightness(
1248 &self,
1249 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1250 ControlProxyInterface::r#watch_current_brightness(self)
1251 }
1252
1253 pub fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1257 ControlProxyInterface::r#set_auto_brightness_adjustment(self, adjustment)
1258 }
1259
1260 pub fn r#watch_auto_brightness_adjustment(
1263 &self,
1264 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1265 ControlProxyInterface::r#watch_auto_brightness_adjustment(self)
1266 }
1267
1268 pub fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
1273 ControlProxyInterface::r#set_brightness_table(self, table)
1274 }
1275
1276 pub fn r#get_max_absolute_brightness(
1278 &self,
1279 ) -> fidl::client::QueryResponseFut<
1280 ControlGetMaxAbsoluteBrightnessResult,
1281 fidl::encoding::DefaultFuchsiaResourceDialect,
1282 > {
1283 ControlProxyInterface::r#get_max_absolute_brightness(self)
1284 }
1285}
1286
1287impl ControlProxyInterface for ControlProxy {
1288 fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
1289 self.client.send::<fidl::encoding::EmptyPayload>(
1290 (),
1291 0x46b623a7fa77a979,
1292 fidl::encoding::DynamicFlags::empty(),
1293 )
1294 }
1295
1296 type WatchAutoBrightnessResponseFut =
1297 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
1298 fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut {
1299 fn _decode(
1300 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1301 ) -> Result<bool, fidl::Error> {
1302 let _response = fidl::client::decode_transaction_body::<
1303 ControlWatchAutoBrightnessResponse,
1304 fidl::encoding::DefaultFuchsiaResourceDialect,
1305 0xd956a90c115186b,
1306 >(_buf?)?;
1307 Ok(_response.enabled)
1308 }
1309 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
1310 (),
1311 0xd956a90c115186b,
1312 fidl::encoding::DynamicFlags::empty(),
1313 _decode,
1314 )
1315 }
1316
1317 fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
1318 self.client.send::<ControlSetManualBrightnessRequest>(
1319 (value,),
1320 0x1e333aa49771e1eb,
1321 fidl::encoding::DynamicFlags::empty(),
1322 )
1323 }
1324
1325 fn r#set_manual_brightness_smooth(
1326 &self,
1327 mut value: f32,
1328 mut duration: i64,
1329 ) -> Result<(), fidl::Error> {
1330 self.client.send::<ControlSetManualBrightnessSmoothRequest>(
1331 (value, duration),
1332 0x7b7d273c20a61d0c,
1333 fidl::encoding::DynamicFlags::empty(),
1334 )
1335 }
1336
1337 type WatchCurrentBrightnessResponseFut =
1338 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1339 fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut {
1340 fn _decode(
1341 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1342 ) -> Result<f32, fidl::Error> {
1343 let _response = fidl::client::decode_transaction_body::<
1344 ControlWatchCurrentBrightnessResponse,
1345 fidl::encoding::DefaultFuchsiaResourceDialect,
1346 0x2cc3011e2326d4d8,
1347 >(_buf?)?;
1348 Ok(_response.value)
1349 }
1350 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
1351 (),
1352 0x2cc3011e2326d4d8,
1353 fidl::encoding::DynamicFlags::empty(),
1354 _decode,
1355 )
1356 }
1357
1358 fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1359 self.client.send::<ControlSetAutoBrightnessAdjustmentRequest>(
1360 (adjustment,),
1361 0x678ee26bc217d996,
1362 fidl::encoding::DynamicFlags::empty(),
1363 )
1364 }
1365
1366 type WatchAutoBrightnessAdjustmentResponseFut =
1367 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1368 fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut {
1369 fn _decode(
1370 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1371 ) -> Result<f32, fidl::Error> {
1372 let _response = fidl::client::decode_transaction_body::<
1373 ControlWatchAutoBrightnessAdjustmentResponse,
1374 fidl::encoding::DefaultFuchsiaResourceDialect,
1375 0x7c373aafe0058135,
1376 >(_buf?)?;
1377 Ok(_response.adjustment)
1378 }
1379 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
1380 (),
1381 0x7c373aafe0058135,
1382 fidl::encoding::DynamicFlags::empty(),
1383 _decode,
1384 )
1385 }
1386
1387 fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
1388 self.client.send::<ControlSetBrightnessTableRequest>(
1389 (table,),
1390 0x11d419413129dcee,
1391 fidl::encoding::DynamicFlags::empty(),
1392 )
1393 }
1394
1395 type GetMaxAbsoluteBrightnessResponseFut = fidl::client::QueryResponseFut<
1396 ControlGetMaxAbsoluteBrightnessResult,
1397 fidl::encoding::DefaultFuchsiaResourceDialect,
1398 >;
1399 fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut {
1400 fn _decode(
1401 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1402 ) -> Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error> {
1403 let _response = fidl::client::decode_transaction_body::<
1404 fidl::encoding::ResultType<ControlGetMaxAbsoluteBrightnessResponse, i32>,
1405 fidl::encoding::DefaultFuchsiaResourceDialect,
1406 0x73055a8d6422caf8,
1407 >(_buf?)?;
1408 Ok(_response.map(|x| x.max_brightness))
1409 }
1410 self.client.send_query_and_decode::<
1411 fidl::encoding::EmptyPayload,
1412 ControlGetMaxAbsoluteBrightnessResult,
1413 >(
1414 (),
1415 0x73055a8d6422caf8,
1416 fidl::encoding::DynamicFlags::empty(),
1417 _decode,
1418 )
1419 }
1420}
1421
1422pub struct ControlEventStream {
1423 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1424}
1425
1426impl std::marker::Unpin for ControlEventStream {}
1427
1428impl futures::stream::FusedStream for ControlEventStream {
1429 fn is_terminated(&self) -> bool {
1430 self.event_receiver.is_terminated()
1431 }
1432}
1433
1434impl futures::Stream for ControlEventStream {
1435 type Item = Result<ControlEvent, fidl::Error>;
1436
1437 fn poll_next(
1438 mut self: std::pin::Pin<&mut Self>,
1439 cx: &mut std::task::Context<'_>,
1440 ) -> std::task::Poll<Option<Self::Item>> {
1441 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1442 &mut self.event_receiver,
1443 cx
1444 )?) {
1445 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
1446 None => std::task::Poll::Ready(None),
1447 }
1448 }
1449}
1450
1451#[derive(Debug)]
1452pub enum ControlEvent {}
1453
1454impl ControlEvent {
1455 fn decode(
1457 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1458 ) -> Result<ControlEvent, fidl::Error> {
1459 let (bytes, _handles) = buf.split_mut();
1460 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1461 debug_assert_eq!(tx_header.tx_id, 0);
1462 match tx_header.ordinal {
1463 _ => Err(fidl::Error::UnknownOrdinal {
1464 ordinal: tx_header.ordinal,
1465 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1466 }),
1467 }
1468 }
1469}
1470
1471pub struct ControlRequestStream {
1473 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1474 is_terminated: bool,
1475}
1476
1477impl std::marker::Unpin for ControlRequestStream {}
1478
1479impl futures::stream::FusedStream for ControlRequestStream {
1480 fn is_terminated(&self) -> bool {
1481 self.is_terminated
1482 }
1483}
1484
1485impl fidl::endpoints::RequestStream for ControlRequestStream {
1486 type Protocol = ControlMarker;
1487 type ControlHandle = ControlControlHandle;
1488
1489 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1490 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1491 }
1492
1493 fn control_handle(&self) -> Self::ControlHandle {
1494 ControlControlHandle { inner: self.inner.clone() }
1495 }
1496
1497 fn into_inner(
1498 self,
1499 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1500 {
1501 (self.inner, self.is_terminated)
1502 }
1503
1504 fn from_inner(
1505 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1506 is_terminated: bool,
1507 ) -> Self {
1508 Self { inner, is_terminated }
1509 }
1510}
1511
1512impl futures::Stream for ControlRequestStream {
1513 type Item = Result<ControlRequest, fidl::Error>;
1514
1515 fn poll_next(
1516 mut self: std::pin::Pin<&mut Self>,
1517 cx: &mut std::task::Context<'_>,
1518 ) -> std::task::Poll<Option<Self::Item>> {
1519 let this = &mut *self;
1520 if this.inner.check_shutdown(cx) {
1521 this.is_terminated = true;
1522 return std::task::Poll::Ready(None);
1523 }
1524 if this.is_terminated {
1525 panic!("polled ControlRequestStream after completion");
1526 }
1527 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1528 |bytes, handles| {
1529 match this.inner.channel().read_etc(cx, bytes, handles) {
1530 std::task::Poll::Ready(Ok(())) => {}
1531 std::task::Poll::Pending => return std::task::Poll::Pending,
1532 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1533 this.is_terminated = true;
1534 return std::task::Poll::Ready(None);
1535 }
1536 std::task::Poll::Ready(Err(e)) => {
1537 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1538 e.into(),
1539 ))));
1540 }
1541 }
1542
1543 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1545
1546 std::task::Poll::Ready(Some(match header.ordinal {
1547 0x46b623a7fa77a979 => {
1548 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1549 let mut req = fidl::new_empty!(
1550 fidl::encoding::EmptyPayload,
1551 fidl::encoding::DefaultFuchsiaResourceDialect
1552 );
1553 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1554 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1555 Ok(ControlRequest::SetAutoBrightness { control_handle })
1556 }
1557 0xd956a90c115186b => {
1558 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1559 let mut req = fidl::new_empty!(
1560 fidl::encoding::EmptyPayload,
1561 fidl::encoding::DefaultFuchsiaResourceDialect
1562 );
1563 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1564 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1565 Ok(ControlRequest::WatchAutoBrightness {
1566 responder: ControlWatchAutoBrightnessResponder {
1567 control_handle: std::mem::ManuallyDrop::new(control_handle),
1568 tx_id: header.tx_id,
1569 },
1570 })
1571 }
1572 0x1e333aa49771e1eb => {
1573 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1574 let mut req = fidl::new_empty!(
1575 ControlSetManualBrightnessRequest,
1576 fidl::encoding::DefaultFuchsiaResourceDialect
1577 );
1578 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetManualBrightnessRequest>(&header, _body_bytes, handles, &mut req)?;
1579 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1580 Ok(ControlRequest::SetManualBrightness { value: req.value, control_handle })
1581 }
1582 0x7b7d273c20a61d0c => {
1583 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1584 let mut req = fidl::new_empty!(
1585 ControlSetManualBrightnessSmoothRequest,
1586 fidl::encoding::DefaultFuchsiaResourceDialect
1587 );
1588 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetManualBrightnessSmoothRequest>(&header, _body_bytes, handles, &mut req)?;
1589 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1590 Ok(ControlRequest::SetManualBrightnessSmooth {
1591 value: req.value,
1592 duration: req.duration,
1593
1594 control_handle,
1595 })
1596 }
1597 0x2cc3011e2326d4d8 => {
1598 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1599 let mut req = fidl::new_empty!(
1600 fidl::encoding::EmptyPayload,
1601 fidl::encoding::DefaultFuchsiaResourceDialect
1602 );
1603 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1604 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1605 Ok(ControlRequest::WatchCurrentBrightness {
1606 responder: ControlWatchCurrentBrightnessResponder {
1607 control_handle: std::mem::ManuallyDrop::new(control_handle),
1608 tx_id: header.tx_id,
1609 },
1610 })
1611 }
1612 0x678ee26bc217d996 => {
1613 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1614 let mut req = fidl::new_empty!(
1615 ControlSetAutoBrightnessAdjustmentRequest,
1616 fidl::encoding::DefaultFuchsiaResourceDialect
1617 );
1618 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetAutoBrightnessAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
1619 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1620 Ok(ControlRequest::SetAutoBrightnessAdjustment {
1621 adjustment: req.adjustment,
1622
1623 control_handle,
1624 })
1625 }
1626 0x7c373aafe0058135 => {
1627 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1628 let mut req = fidl::new_empty!(
1629 fidl::encoding::EmptyPayload,
1630 fidl::encoding::DefaultFuchsiaResourceDialect
1631 );
1632 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1633 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1634 Ok(ControlRequest::WatchAutoBrightnessAdjustment {
1635 responder: ControlWatchAutoBrightnessAdjustmentResponder {
1636 control_handle: std::mem::ManuallyDrop::new(control_handle),
1637 tx_id: header.tx_id,
1638 },
1639 })
1640 }
1641 0x11d419413129dcee => {
1642 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1643 let mut req = fidl::new_empty!(
1644 ControlSetBrightnessTableRequest,
1645 fidl::encoding::DefaultFuchsiaResourceDialect
1646 );
1647 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetBrightnessTableRequest>(&header, _body_bytes, handles, &mut req)?;
1648 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1649 Ok(ControlRequest::SetBrightnessTable { table: req.table, control_handle })
1650 }
1651 0x73055a8d6422caf8 => {
1652 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1653 let mut req = fidl::new_empty!(
1654 fidl::encoding::EmptyPayload,
1655 fidl::encoding::DefaultFuchsiaResourceDialect
1656 );
1657 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1658 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1659 Ok(ControlRequest::GetMaxAbsoluteBrightness {
1660 responder: ControlGetMaxAbsoluteBrightnessResponder {
1661 control_handle: std::mem::ManuallyDrop::new(control_handle),
1662 tx_id: header.tx_id,
1663 },
1664 })
1665 }
1666 _ => Err(fidl::Error::UnknownOrdinal {
1667 ordinal: header.ordinal,
1668 protocol_name:
1669 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1670 }),
1671 }))
1672 },
1673 )
1674 }
1675}
1676
1677#[derive(Debug)]
1679pub enum ControlRequest {
1680 SetAutoBrightness { control_handle: ControlControlHandle },
1683 WatchAutoBrightness { responder: ControlWatchAutoBrightnessResponder },
1686 SetManualBrightness { value: f32, control_handle: ControlControlHandle },
1691 SetManualBrightnessSmooth { value: f32, duration: i64, control_handle: ControlControlHandle },
1694 WatchCurrentBrightness { responder: ControlWatchCurrentBrightnessResponder },
1699 SetAutoBrightnessAdjustment { adjustment: f32, control_handle: ControlControlHandle },
1703 WatchAutoBrightnessAdjustment { responder: ControlWatchAutoBrightnessAdjustmentResponder },
1706 SetBrightnessTable { table: BrightnessTable, control_handle: ControlControlHandle },
1711 GetMaxAbsoluteBrightness { responder: ControlGetMaxAbsoluteBrightnessResponder },
1713}
1714
1715impl ControlRequest {
1716 #[allow(irrefutable_let_patterns)]
1717 pub fn into_set_auto_brightness(self) -> Option<(ControlControlHandle)> {
1718 if let ControlRequest::SetAutoBrightness { control_handle } = self {
1719 Some((control_handle))
1720 } else {
1721 None
1722 }
1723 }
1724
1725 #[allow(irrefutable_let_patterns)]
1726 pub fn into_watch_auto_brightness(self) -> Option<(ControlWatchAutoBrightnessResponder)> {
1727 if let ControlRequest::WatchAutoBrightness { responder } = self {
1728 Some((responder))
1729 } else {
1730 None
1731 }
1732 }
1733
1734 #[allow(irrefutable_let_patterns)]
1735 pub fn into_set_manual_brightness(self) -> Option<(f32, ControlControlHandle)> {
1736 if let ControlRequest::SetManualBrightness { value, control_handle } = self {
1737 Some((value, control_handle))
1738 } else {
1739 None
1740 }
1741 }
1742
1743 #[allow(irrefutable_let_patterns)]
1744 pub fn into_set_manual_brightness_smooth(self) -> Option<(f32, i64, ControlControlHandle)> {
1745 if let ControlRequest::SetManualBrightnessSmooth { value, duration, control_handle } = self
1746 {
1747 Some((value, duration, control_handle))
1748 } else {
1749 None
1750 }
1751 }
1752
1753 #[allow(irrefutable_let_patterns)]
1754 pub fn into_watch_current_brightness(self) -> Option<(ControlWatchCurrentBrightnessResponder)> {
1755 if let ControlRequest::WatchCurrentBrightness { responder } = self {
1756 Some((responder))
1757 } else {
1758 None
1759 }
1760 }
1761
1762 #[allow(irrefutable_let_patterns)]
1763 pub fn into_set_auto_brightness_adjustment(self) -> Option<(f32, ControlControlHandle)> {
1764 if let ControlRequest::SetAutoBrightnessAdjustment { adjustment, control_handle } = self {
1765 Some((adjustment, control_handle))
1766 } else {
1767 None
1768 }
1769 }
1770
1771 #[allow(irrefutable_let_patterns)]
1772 pub fn into_watch_auto_brightness_adjustment(
1773 self,
1774 ) -> Option<(ControlWatchAutoBrightnessAdjustmentResponder)> {
1775 if let ControlRequest::WatchAutoBrightnessAdjustment { responder } = self {
1776 Some((responder))
1777 } else {
1778 None
1779 }
1780 }
1781
1782 #[allow(irrefutable_let_patterns)]
1783 pub fn into_set_brightness_table(self) -> Option<(BrightnessTable, ControlControlHandle)> {
1784 if let ControlRequest::SetBrightnessTable { table, control_handle } = self {
1785 Some((table, control_handle))
1786 } else {
1787 None
1788 }
1789 }
1790
1791 #[allow(irrefutable_let_patterns)]
1792 pub fn into_get_max_absolute_brightness(
1793 self,
1794 ) -> Option<(ControlGetMaxAbsoluteBrightnessResponder)> {
1795 if let ControlRequest::GetMaxAbsoluteBrightness { responder } = self {
1796 Some((responder))
1797 } else {
1798 None
1799 }
1800 }
1801
1802 pub fn method_name(&self) -> &'static str {
1804 match *self {
1805 ControlRequest::SetAutoBrightness { .. } => "set_auto_brightness",
1806 ControlRequest::WatchAutoBrightness { .. } => "watch_auto_brightness",
1807 ControlRequest::SetManualBrightness { .. } => "set_manual_brightness",
1808 ControlRequest::SetManualBrightnessSmooth { .. } => "set_manual_brightness_smooth",
1809 ControlRequest::WatchCurrentBrightness { .. } => "watch_current_brightness",
1810 ControlRequest::SetAutoBrightnessAdjustment { .. } => "set_auto_brightness_adjustment",
1811 ControlRequest::WatchAutoBrightnessAdjustment { .. } => {
1812 "watch_auto_brightness_adjustment"
1813 }
1814 ControlRequest::SetBrightnessTable { .. } => "set_brightness_table",
1815 ControlRequest::GetMaxAbsoluteBrightness { .. } => "get_max_absolute_brightness",
1816 }
1817 }
1818}
1819
1820#[derive(Debug, Clone)]
1821pub struct ControlControlHandle {
1822 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1823}
1824
1825impl ControlControlHandle {
1826 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1827 self.inner.shutdown_with_epitaph(status.into())
1828 }
1829}
1830
1831impl fidl::endpoints::ControlHandle for ControlControlHandle {
1832 fn shutdown(&self) {
1833 self.inner.shutdown()
1834 }
1835
1836 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1837 self.inner.shutdown_with_epitaph(status)
1838 }
1839
1840 fn is_closed(&self) -> bool {
1841 self.inner.channel().is_closed()
1842 }
1843 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1844 self.inner.channel().on_closed()
1845 }
1846
1847 #[cfg(target_os = "fuchsia")]
1848 fn signal_peer(
1849 &self,
1850 clear_mask: zx::Signals,
1851 set_mask: zx::Signals,
1852 ) -> Result<(), zx_status::Status> {
1853 use fidl::Peered;
1854 self.inner.channel().signal_peer(clear_mask, set_mask)
1855 }
1856}
1857
1858impl ControlControlHandle {}
1859
1860#[must_use = "FIDL methods require a response to be sent"]
1861#[derive(Debug)]
1862pub struct ControlWatchAutoBrightnessResponder {
1863 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1864 tx_id: u32,
1865}
1866
1867impl std::ops::Drop for ControlWatchAutoBrightnessResponder {
1871 fn drop(&mut self) {
1872 self.control_handle.shutdown();
1873 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1875 }
1876}
1877
1878impl fidl::endpoints::Responder for ControlWatchAutoBrightnessResponder {
1879 type ControlHandle = ControlControlHandle;
1880
1881 fn control_handle(&self) -> &ControlControlHandle {
1882 &self.control_handle
1883 }
1884
1885 fn drop_without_shutdown(mut self) {
1886 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1888 std::mem::forget(self);
1890 }
1891}
1892
1893impl ControlWatchAutoBrightnessResponder {
1894 pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
1898 let _result = self.send_raw(enabled);
1899 if _result.is_err() {
1900 self.control_handle.shutdown();
1901 }
1902 self.drop_without_shutdown();
1903 _result
1904 }
1905
1906 pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
1908 let _result = self.send_raw(enabled);
1909 self.drop_without_shutdown();
1910 _result
1911 }
1912
1913 fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
1914 self.control_handle.inner.send::<ControlWatchAutoBrightnessResponse>(
1915 (enabled,),
1916 self.tx_id,
1917 0xd956a90c115186b,
1918 fidl::encoding::DynamicFlags::empty(),
1919 )
1920 }
1921}
1922
1923#[must_use = "FIDL methods require a response to be sent"]
1924#[derive(Debug)]
1925pub struct ControlWatchCurrentBrightnessResponder {
1926 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1927 tx_id: u32,
1928}
1929
1930impl std::ops::Drop for ControlWatchCurrentBrightnessResponder {
1934 fn drop(&mut self) {
1935 self.control_handle.shutdown();
1936 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1938 }
1939}
1940
1941impl fidl::endpoints::Responder for ControlWatchCurrentBrightnessResponder {
1942 type ControlHandle = ControlControlHandle;
1943
1944 fn control_handle(&self) -> &ControlControlHandle {
1945 &self.control_handle
1946 }
1947
1948 fn drop_without_shutdown(mut self) {
1949 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1951 std::mem::forget(self);
1953 }
1954}
1955
1956impl ControlWatchCurrentBrightnessResponder {
1957 pub fn send(self, mut value: f32) -> Result<(), fidl::Error> {
1961 let _result = self.send_raw(value);
1962 if _result.is_err() {
1963 self.control_handle.shutdown();
1964 }
1965 self.drop_without_shutdown();
1966 _result
1967 }
1968
1969 pub fn send_no_shutdown_on_err(self, mut value: f32) -> Result<(), fidl::Error> {
1971 let _result = self.send_raw(value);
1972 self.drop_without_shutdown();
1973 _result
1974 }
1975
1976 fn send_raw(&self, mut value: f32) -> Result<(), fidl::Error> {
1977 self.control_handle.inner.send::<ControlWatchCurrentBrightnessResponse>(
1978 (value,),
1979 self.tx_id,
1980 0x2cc3011e2326d4d8,
1981 fidl::encoding::DynamicFlags::empty(),
1982 )
1983 }
1984}
1985
1986#[must_use = "FIDL methods require a response to be sent"]
1987#[derive(Debug)]
1988pub struct ControlWatchAutoBrightnessAdjustmentResponder {
1989 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1990 tx_id: u32,
1991}
1992
1993impl std::ops::Drop for ControlWatchAutoBrightnessAdjustmentResponder {
1997 fn drop(&mut self) {
1998 self.control_handle.shutdown();
1999 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2001 }
2002}
2003
2004impl fidl::endpoints::Responder for ControlWatchAutoBrightnessAdjustmentResponder {
2005 type ControlHandle = ControlControlHandle;
2006
2007 fn control_handle(&self) -> &ControlControlHandle {
2008 &self.control_handle
2009 }
2010
2011 fn drop_without_shutdown(mut self) {
2012 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2014 std::mem::forget(self);
2016 }
2017}
2018
2019impl ControlWatchAutoBrightnessAdjustmentResponder {
2020 pub fn send(self, mut adjustment: f32) -> Result<(), fidl::Error> {
2024 let _result = self.send_raw(adjustment);
2025 if _result.is_err() {
2026 self.control_handle.shutdown();
2027 }
2028 self.drop_without_shutdown();
2029 _result
2030 }
2031
2032 pub fn send_no_shutdown_on_err(self, mut adjustment: f32) -> Result<(), fidl::Error> {
2034 let _result = self.send_raw(adjustment);
2035 self.drop_without_shutdown();
2036 _result
2037 }
2038
2039 fn send_raw(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
2040 self.control_handle.inner.send::<ControlWatchAutoBrightnessAdjustmentResponse>(
2041 (adjustment,),
2042 self.tx_id,
2043 0x7c373aafe0058135,
2044 fidl::encoding::DynamicFlags::empty(),
2045 )
2046 }
2047}
2048
2049#[must_use = "FIDL methods require a response to be sent"]
2050#[derive(Debug)]
2051pub struct ControlGetMaxAbsoluteBrightnessResponder {
2052 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2053 tx_id: u32,
2054}
2055
2056impl std::ops::Drop for ControlGetMaxAbsoluteBrightnessResponder {
2060 fn drop(&mut self) {
2061 self.control_handle.shutdown();
2062 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2064 }
2065}
2066
2067impl fidl::endpoints::Responder for ControlGetMaxAbsoluteBrightnessResponder {
2068 type ControlHandle = ControlControlHandle;
2069
2070 fn control_handle(&self) -> &ControlControlHandle {
2071 &self.control_handle
2072 }
2073
2074 fn drop_without_shutdown(mut self) {
2075 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2077 std::mem::forget(self);
2079 }
2080}
2081
2082impl ControlGetMaxAbsoluteBrightnessResponder {
2083 pub fn send(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
2087 let _result = self.send_raw(result);
2088 if _result.is_err() {
2089 self.control_handle.shutdown();
2090 }
2091 self.drop_without_shutdown();
2092 _result
2093 }
2094
2095 pub fn send_no_shutdown_on_err(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
2097 let _result = self.send_raw(result);
2098 self.drop_without_shutdown();
2099 _result
2100 }
2101
2102 fn send_raw(&self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
2103 self.control_handle.inner.send::<fidl::encoding::ResultType<
2104 ControlGetMaxAbsoluteBrightnessResponse,
2105 i32,
2106 >>(
2107 result.map(|max_brightness| (max_brightness,)),
2108 self.tx_id,
2109 0x73055a8d6422caf8,
2110 fidl::encoding::DynamicFlags::empty(),
2111 )
2112 }
2113}
2114
2115#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2116pub struct ReaderMarker;
2117
2118impl fidl::endpoints::ProtocolMarker for ReaderMarker {
2119 type Proxy = ReaderProxy;
2120 type RequestStream = ReaderRequestStream;
2121 #[cfg(target_os = "fuchsia")]
2122 type SynchronousProxy = ReaderSynchronousProxy;
2123
2124 const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.Reader";
2125}
2126impl fidl::endpoints::DiscoverableProtocolMarker for ReaderMarker {}
2127pub type ReaderGetMaxAbsoluteBrightnessResult = Result<f64, i32>;
2128
2129pub trait ReaderProxyInterface: Send + Sync {
2130 type WatchAutoBrightnessResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
2131 + Send;
2132 fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut;
2133 type WatchCurrentBrightnessResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
2134 + Send;
2135 fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut;
2136 type WatchAutoBrightnessAdjustmentResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
2137 + Send;
2138 fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut;
2139 type GetMaxAbsoluteBrightnessResponseFut: std::future::Future<Output = Result<ReaderGetMaxAbsoluteBrightnessResult, fidl::Error>>
2140 + Send;
2141 fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut;
2142}
2143#[derive(Debug)]
2144#[cfg(target_os = "fuchsia")]
2145pub struct ReaderSynchronousProxy {
2146 client: fidl::client::sync::Client,
2147}
2148
2149#[cfg(target_os = "fuchsia")]
2150impl fidl::endpoints::SynchronousProxy for ReaderSynchronousProxy {
2151 type Proxy = ReaderProxy;
2152 type Protocol = ReaderMarker;
2153
2154 fn from_channel(inner: fidl::Channel) -> Self {
2155 Self::new(inner)
2156 }
2157
2158 fn into_channel(self) -> fidl::Channel {
2159 self.client.into_channel()
2160 }
2161
2162 fn as_channel(&self) -> &fidl::Channel {
2163 self.client.as_channel()
2164 }
2165}
2166
2167#[cfg(target_os = "fuchsia")]
2168impl ReaderSynchronousProxy {
2169 pub fn new(channel: fidl::Channel) -> Self {
2170 Self { client: fidl::client::sync::Client::new(channel) }
2171 }
2172
2173 pub fn into_channel(self) -> fidl::Channel {
2174 self.client.into_channel()
2175 }
2176
2177 pub fn wait_for_event(
2180 &self,
2181 deadline: zx::MonotonicInstant,
2182 ) -> Result<ReaderEvent, fidl::Error> {
2183 ReaderEvent::decode(self.client.wait_for_event::<ReaderMarker>(deadline)?)
2184 }
2185
2186 pub fn r#watch_auto_brightness(
2189 &self,
2190 ___deadline: zx::MonotonicInstant,
2191 ) -> Result<bool, fidl::Error> {
2192 let _response = self.client.send_query::<
2193 fidl::encoding::EmptyPayload,
2194 fidl::encoding::FlexibleType<ReaderWatchAutoBrightnessResponse>,
2195 ReaderMarker,
2196 >(
2197 (),
2198 0x2340adb613c927fe,
2199 fidl::encoding::DynamicFlags::FLEXIBLE,
2200 ___deadline,
2201 )?
2202 .into_result::<ReaderMarker>("watch_auto_brightness")?;
2203 Ok(_response.enabled)
2204 }
2205
2206 pub fn r#watch_current_brightness(
2211 &self,
2212 ___deadline: zx::MonotonicInstant,
2213 ) -> Result<f32, fidl::Error> {
2214 let _response = self.client.send_query::<
2215 fidl::encoding::EmptyPayload,
2216 fidl::encoding::FlexibleType<ReaderWatchCurrentBrightnessResponse>,
2217 ReaderMarker,
2218 >(
2219 (),
2220 0x261947be9be0c158,
2221 fidl::encoding::DynamicFlags::FLEXIBLE,
2222 ___deadline,
2223 )?
2224 .into_result::<ReaderMarker>("watch_current_brightness")?;
2225 Ok(_response.value)
2226 }
2227
2228 pub fn r#watch_auto_brightness_adjustment(
2231 &self,
2232 ___deadline: zx::MonotonicInstant,
2233 ) -> Result<f32, fidl::Error> {
2234 let _response = self.client.send_query::<
2235 fidl::encoding::EmptyPayload,
2236 fidl::encoding::FlexibleType<ReaderWatchAutoBrightnessAdjustmentResponse>,
2237 ReaderMarker,
2238 >(
2239 (),
2240 0x63843519b3bc0f41,
2241 fidl::encoding::DynamicFlags::FLEXIBLE,
2242 ___deadline,
2243 )?
2244 .into_result::<ReaderMarker>("watch_auto_brightness_adjustment")?;
2245 Ok(_response.adjustment)
2246 }
2247
2248 pub fn r#get_max_absolute_brightness(
2250 &self,
2251 ___deadline: zx::MonotonicInstant,
2252 ) -> Result<ReaderGetMaxAbsoluteBrightnessResult, fidl::Error> {
2253 let _response = self.client.send_query::<
2254 fidl::encoding::EmptyPayload,
2255 fidl::encoding::FlexibleResultType<ReaderGetMaxAbsoluteBrightnessResponse, i32>,
2256 ReaderMarker,
2257 >(
2258 (),
2259 0x27070157807d6424,
2260 fidl::encoding::DynamicFlags::FLEXIBLE,
2261 ___deadline,
2262 )?
2263 .into_result::<ReaderMarker>("get_max_absolute_brightness")?;
2264 Ok(_response.map(|x| x.max_brightness))
2265 }
2266}
2267
2268#[cfg(target_os = "fuchsia")]
2269impl From<ReaderSynchronousProxy> for zx::NullableHandle {
2270 fn from(value: ReaderSynchronousProxy) -> Self {
2271 value.into_channel().into()
2272 }
2273}
2274
2275#[cfg(target_os = "fuchsia")]
2276impl From<fidl::Channel> for ReaderSynchronousProxy {
2277 fn from(value: fidl::Channel) -> Self {
2278 Self::new(value)
2279 }
2280}
2281
2282#[cfg(target_os = "fuchsia")]
2283impl fidl::endpoints::FromClient for ReaderSynchronousProxy {
2284 type Protocol = ReaderMarker;
2285
2286 fn from_client(value: fidl::endpoints::ClientEnd<ReaderMarker>) -> Self {
2287 Self::new(value.into_channel())
2288 }
2289}
2290
2291#[derive(Debug, Clone)]
2292pub struct ReaderProxy {
2293 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2294}
2295
2296impl fidl::endpoints::Proxy for ReaderProxy {
2297 type Protocol = ReaderMarker;
2298
2299 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2300 Self::new(inner)
2301 }
2302
2303 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2304 self.client.into_channel().map_err(|client| Self { client })
2305 }
2306
2307 fn as_channel(&self) -> &::fidl::AsyncChannel {
2308 self.client.as_channel()
2309 }
2310}
2311
2312impl ReaderProxy {
2313 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2315 let protocol_name = <ReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2316 Self { client: fidl::client::Client::new(channel, protocol_name) }
2317 }
2318
2319 pub fn take_event_stream(&self) -> ReaderEventStream {
2325 ReaderEventStream { event_receiver: self.client.take_event_receiver() }
2326 }
2327
2328 pub fn r#watch_auto_brightness(
2331 &self,
2332 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
2333 ReaderProxyInterface::r#watch_auto_brightness(self)
2334 }
2335
2336 pub fn r#watch_current_brightness(
2341 &self,
2342 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2343 ReaderProxyInterface::r#watch_current_brightness(self)
2344 }
2345
2346 pub fn r#watch_auto_brightness_adjustment(
2349 &self,
2350 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
2351 ReaderProxyInterface::r#watch_auto_brightness_adjustment(self)
2352 }
2353
2354 pub fn r#get_max_absolute_brightness(
2356 &self,
2357 ) -> fidl::client::QueryResponseFut<
2358 ReaderGetMaxAbsoluteBrightnessResult,
2359 fidl::encoding::DefaultFuchsiaResourceDialect,
2360 > {
2361 ReaderProxyInterface::r#get_max_absolute_brightness(self)
2362 }
2363}
2364
2365impl ReaderProxyInterface for ReaderProxy {
2366 type WatchAutoBrightnessResponseFut =
2367 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
2368 fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut {
2369 fn _decode(
2370 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2371 ) -> Result<bool, fidl::Error> {
2372 let _response = fidl::client::decode_transaction_body::<
2373 fidl::encoding::FlexibleType<ReaderWatchAutoBrightnessResponse>,
2374 fidl::encoding::DefaultFuchsiaResourceDialect,
2375 0x2340adb613c927fe,
2376 >(_buf?)?
2377 .into_result::<ReaderMarker>("watch_auto_brightness")?;
2378 Ok(_response.enabled)
2379 }
2380 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
2381 (),
2382 0x2340adb613c927fe,
2383 fidl::encoding::DynamicFlags::FLEXIBLE,
2384 _decode,
2385 )
2386 }
2387
2388 type WatchCurrentBrightnessResponseFut =
2389 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2390 fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut {
2391 fn _decode(
2392 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2393 ) -> Result<f32, fidl::Error> {
2394 let _response = fidl::client::decode_transaction_body::<
2395 fidl::encoding::FlexibleType<ReaderWatchCurrentBrightnessResponse>,
2396 fidl::encoding::DefaultFuchsiaResourceDialect,
2397 0x261947be9be0c158,
2398 >(_buf?)?
2399 .into_result::<ReaderMarker>("watch_current_brightness")?;
2400 Ok(_response.value)
2401 }
2402 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
2403 (),
2404 0x261947be9be0c158,
2405 fidl::encoding::DynamicFlags::FLEXIBLE,
2406 _decode,
2407 )
2408 }
2409
2410 type WatchAutoBrightnessAdjustmentResponseFut =
2411 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
2412 fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut {
2413 fn _decode(
2414 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2415 ) -> Result<f32, fidl::Error> {
2416 let _response = fidl::client::decode_transaction_body::<
2417 fidl::encoding::FlexibleType<ReaderWatchAutoBrightnessAdjustmentResponse>,
2418 fidl::encoding::DefaultFuchsiaResourceDialect,
2419 0x63843519b3bc0f41,
2420 >(_buf?)?
2421 .into_result::<ReaderMarker>("watch_auto_brightness_adjustment")?;
2422 Ok(_response.adjustment)
2423 }
2424 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
2425 (),
2426 0x63843519b3bc0f41,
2427 fidl::encoding::DynamicFlags::FLEXIBLE,
2428 _decode,
2429 )
2430 }
2431
2432 type GetMaxAbsoluteBrightnessResponseFut = fidl::client::QueryResponseFut<
2433 ReaderGetMaxAbsoluteBrightnessResult,
2434 fidl::encoding::DefaultFuchsiaResourceDialect,
2435 >;
2436 fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut {
2437 fn _decode(
2438 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2439 ) -> Result<ReaderGetMaxAbsoluteBrightnessResult, fidl::Error> {
2440 let _response = fidl::client::decode_transaction_body::<
2441 fidl::encoding::FlexibleResultType<ReaderGetMaxAbsoluteBrightnessResponse, i32>,
2442 fidl::encoding::DefaultFuchsiaResourceDialect,
2443 0x27070157807d6424,
2444 >(_buf?)?
2445 .into_result::<ReaderMarker>("get_max_absolute_brightness")?;
2446 Ok(_response.map(|x| x.max_brightness))
2447 }
2448 self.client.send_query_and_decode::<
2449 fidl::encoding::EmptyPayload,
2450 ReaderGetMaxAbsoluteBrightnessResult,
2451 >(
2452 (),
2453 0x27070157807d6424,
2454 fidl::encoding::DynamicFlags::FLEXIBLE,
2455 _decode,
2456 )
2457 }
2458}
2459
2460pub struct ReaderEventStream {
2461 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2462}
2463
2464impl std::marker::Unpin for ReaderEventStream {}
2465
2466impl futures::stream::FusedStream for ReaderEventStream {
2467 fn is_terminated(&self) -> bool {
2468 self.event_receiver.is_terminated()
2469 }
2470}
2471
2472impl futures::Stream for ReaderEventStream {
2473 type Item = Result<ReaderEvent, fidl::Error>;
2474
2475 fn poll_next(
2476 mut self: std::pin::Pin<&mut Self>,
2477 cx: &mut std::task::Context<'_>,
2478 ) -> std::task::Poll<Option<Self::Item>> {
2479 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2480 &mut self.event_receiver,
2481 cx
2482 )?) {
2483 Some(buf) => std::task::Poll::Ready(Some(ReaderEvent::decode(buf))),
2484 None => std::task::Poll::Ready(None),
2485 }
2486 }
2487}
2488
2489#[derive(Debug)]
2490pub enum ReaderEvent {
2491 #[non_exhaustive]
2492 _UnknownEvent {
2493 ordinal: u64,
2495 },
2496}
2497
2498impl ReaderEvent {
2499 fn decode(
2501 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2502 ) -> Result<ReaderEvent, fidl::Error> {
2503 let (bytes, _handles) = buf.split_mut();
2504 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2505 debug_assert_eq!(tx_header.tx_id, 0);
2506 match tx_header.ordinal {
2507 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2508 Ok(ReaderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2509 }
2510 _ => Err(fidl::Error::UnknownOrdinal {
2511 ordinal: tx_header.ordinal,
2512 protocol_name: <ReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2513 }),
2514 }
2515 }
2516}
2517
2518pub struct ReaderRequestStream {
2520 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2521 is_terminated: bool,
2522}
2523
2524impl std::marker::Unpin for ReaderRequestStream {}
2525
2526impl futures::stream::FusedStream for ReaderRequestStream {
2527 fn is_terminated(&self) -> bool {
2528 self.is_terminated
2529 }
2530}
2531
2532impl fidl::endpoints::RequestStream for ReaderRequestStream {
2533 type Protocol = ReaderMarker;
2534 type ControlHandle = ReaderControlHandle;
2535
2536 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2537 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2538 }
2539
2540 fn control_handle(&self) -> Self::ControlHandle {
2541 ReaderControlHandle { inner: self.inner.clone() }
2542 }
2543
2544 fn into_inner(
2545 self,
2546 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2547 {
2548 (self.inner, self.is_terminated)
2549 }
2550
2551 fn from_inner(
2552 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2553 is_terminated: bool,
2554 ) -> Self {
2555 Self { inner, is_terminated }
2556 }
2557}
2558
2559impl futures::Stream for ReaderRequestStream {
2560 type Item = Result<ReaderRequest, fidl::Error>;
2561
2562 fn poll_next(
2563 mut self: std::pin::Pin<&mut Self>,
2564 cx: &mut std::task::Context<'_>,
2565 ) -> std::task::Poll<Option<Self::Item>> {
2566 let this = &mut *self;
2567 if this.inner.check_shutdown(cx) {
2568 this.is_terminated = true;
2569 return std::task::Poll::Ready(None);
2570 }
2571 if this.is_terminated {
2572 panic!("polled ReaderRequestStream after completion");
2573 }
2574 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2575 |bytes, handles| {
2576 match this.inner.channel().read_etc(cx, bytes, handles) {
2577 std::task::Poll::Ready(Ok(())) => {}
2578 std::task::Poll::Pending => return std::task::Poll::Pending,
2579 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2580 this.is_terminated = true;
2581 return std::task::Poll::Ready(None);
2582 }
2583 std::task::Poll::Ready(Err(e)) => {
2584 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2585 e.into(),
2586 ))));
2587 }
2588 }
2589
2590 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2592
2593 std::task::Poll::Ready(Some(match header.ordinal {
2594 0x2340adb613c927fe => {
2595 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2596 let mut req = fidl::new_empty!(
2597 fidl::encoding::EmptyPayload,
2598 fidl::encoding::DefaultFuchsiaResourceDialect
2599 );
2600 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2601 let control_handle = ReaderControlHandle { inner: this.inner.clone() };
2602 Ok(ReaderRequest::WatchAutoBrightness {
2603 responder: ReaderWatchAutoBrightnessResponder {
2604 control_handle: std::mem::ManuallyDrop::new(control_handle),
2605 tx_id: header.tx_id,
2606 },
2607 })
2608 }
2609 0x261947be9be0c158 => {
2610 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2611 let mut req = fidl::new_empty!(
2612 fidl::encoding::EmptyPayload,
2613 fidl::encoding::DefaultFuchsiaResourceDialect
2614 );
2615 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2616 let control_handle = ReaderControlHandle { inner: this.inner.clone() };
2617 Ok(ReaderRequest::WatchCurrentBrightness {
2618 responder: ReaderWatchCurrentBrightnessResponder {
2619 control_handle: std::mem::ManuallyDrop::new(control_handle),
2620 tx_id: header.tx_id,
2621 },
2622 })
2623 }
2624 0x63843519b3bc0f41 => {
2625 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2626 let mut req = fidl::new_empty!(
2627 fidl::encoding::EmptyPayload,
2628 fidl::encoding::DefaultFuchsiaResourceDialect
2629 );
2630 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2631 let control_handle = ReaderControlHandle { inner: this.inner.clone() };
2632 Ok(ReaderRequest::WatchAutoBrightnessAdjustment {
2633 responder: ReaderWatchAutoBrightnessAdjustmentResponder {
2634 control_handle: std::mem::ManuallyDrop::new(control_handle),
2635 tx_id: header.tx_id,
2636 },
2637 })
2638 }
2639 0x27070157807d6424 => {
2640 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2641 let mut req = fidl::new_empty!(
2642 fidl::encoding::EmptyPayload,
2643 fidl::encoding::DefaultFuchsiaResourceDialect
2644 );
2645 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2646 let control_handle = ReaderControlHandle { inner: this.inner.clone() };
2647 Ok(ReaderRequest::GetMaxAbsoluteBrightness {
2648 responder: ReaderGetMaxAbsoluteBrightnessResponder {
2649 control_handle: std::mem::ManuallyDrop::new(control_handle),
2650 tx_id: header.tx_id,
2651 },
2652 })
2653 }
2654 _ if header.tx_id == 0
2655 && header
2656 .dynamic_flags()
2657 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2658 {
2659 Ok(ReaderRequest::_UnknownMethod {
2660 ordinal: header.ordinal,
2661 control_handle: ReaderControlHandle { inner: this.inner.clone() },
2662 method_type: fidl::MethodType::OneWay,
2663 })
2664 }
2665 _ if header
2666 .dynamic_flags()
2667 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2668 {
2669 this.inner.send_framework_err(
2670 fidl::encoding::FrameworkErr::UnknownMethod,
2671 header.tx_id,
2672 header.ordinal,
2673 header.dynamic_flags(),
2674 (bytes, handles),
2675 )?;
2676 Ok(ReaderRequest::_UnknownMethod {
2677 ordinal: header.ordinal,
2678 control_handle: ReaderControlHandle { inner: this.inner.clone() },
2679 method_type: fidl::MethodType::TwoWay,
2680 })
2681 }
2682 _ => Err(fidl::Error::UnknownOrdinal {
2683 ordinal: header.ordinal,
2684 protocol_name:
2685 <ReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2686 }),
2687 }))
2688 },
2689 )
2690 }
2691}
2692
2693#[derive(Debug)]
2695pub enum ReaderRequest {
2696 WatchAutoBrightness { responder: ReaderWatchAutoBrightnessResponder },
2699 WatchCurrentBrightness { responder: ReaderWatchCurrentBrightnessResponder },
2704 WatchAutoBrightnessAdjustment { responder: ReaderWatchAutoBrightnessAdjustmentResponder },
2707 GetMaxAbsoluteBrightness { responder: ReaderGetMaxAbsoluteBrightnessResponder },
2709 #[non_exhaustive]
2711 _UnknownMethod {
2712 ordinal: u64,
2714 control_handle: ReaderControlHandle,
2715 method_type: fidl::MethodType,
2716 },
2717}
2718
2719impl ReaderRequest {
2720 #[allow(irrefutable_let_patterns)]
2721 pub fn into_watch_auto_brightness(self) -> Option<(ReaderWatchAutoBrightnessResponder)> {
2722 if let ReaderRequest::WatchAutoBrightness { responder } = self {
2723 Some((responder))
2724 } else {
2725 None
2726 }
2727 }
2728
2729 #[allow(irrefutable_let_patterns)]
2730 pub fn into_watch_current_brightness(self) -> Option<(ReaderWatchCurrentBrightnessResponder)> {
2731 if let ReaderRequest::WatchCurrentBrightness { responder } = self {
2732 Some((responder))
2733 } else {
2734 None
2735 }
2736 }
2737
2738 #[allow(irrefutable_let_patterns)]
2739 pub fn into_watch_auto_brightness_adjustment(
2740 self,
2741 ) -> Option<(ReaderWatchAutoBrightnessAdjustmentResponder)> {
2742 if let ReaderRequest::WatchAutoBrightnessAdjustment { responder } = self {
2743 Some((responder))
2744 } else {
2745 None
2746 }
2747 }
2748
2749 #[allow(irrefutable_let_patterns)]
2750 pub fn into_get_max_absolute_brightness(
2751 self,
2752 ) -> Option<(ReaderGetMaxAbsoluteBrightnessResponder)> {
2753 if let ReaderRequest::GetMaxAbsoluteBrightness { responder } = self {
2754 Some((responder))
2755 } else {
2756 None
2757 }
2758 }
2759
2760 pub fn method_name(&self) -> &'static str {
2762 match *self {
2763 ReaderRequest::WatchAutoBrightness { .. } => "watch_auto_brightness",
2764 ReaderRequest::WatchCurrentBrightness { .. } => "watch_current_brightness",
2765 ReaderRequest::WatchAutoBrightnessAdjustment { .. } => {
2766 "watch_auto_brightness_adjustment"
2767 }
2768 ReaderRequest::GetMaxAbsoluteBrightness { .. } => "get_max_absolute_brightness",
2769 ReaderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2770 "unknown one-way method"
2771 }
2772 ReaderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2773 "unknown two-way method"
2774 }
2775 }
2776 }
2777}
2778
2779#[derive(Debug, Clone)]
2780pub struct ReaderControlHandle {
2781 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2782}
2783
2784impl ReaderControlHandle {
2785 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2786 self.inner.shutdown_with_epitaph(status.into())
2787 }
2788}
2789
2790impl fidl::endpoints::ControlHandle for ReaderControlHandle {
2791 fn shutdown(&self) {
2792 self.inner.shutdown()
2793 }
2794
2795 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2796 self.inner.shutdown_with_epitaph(status)
2797 }
2798
2799 fn is_closed(&self) -> bool {
2800 self.inner.channel().is_closed()
2801 }
2802 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2803 self.inner.channel().on_closed()
2804 }
2805
2806 #[cfg(target_os = "fuchsia")]
2807 fn signal_peer(
2808 &self,
2809 clear_mask: zx::Signals,
2810 set_mask: zx::Signals,
2811 ) -> Result<(), zx_status::Status> {
2812 use fidl::Peered;
2813 self.inner.channel().signal_peer(clear_mask, set_mask)
2814 }
2815}
2816
2817impl ReaderControlHandle {}
2818
2819#[must_use = "FIDL methods require a response to be sent"]
2820#[derive(Debug)]
2821pub struct ReaderWatchAutoBrightnessResponder {
2822 control_handle: std::mem::ManuallyDrop<ReaderControlHandle>,
2823 tx_id: u32,
2824}
2825
2826impl std::ops::Drop for ReaderWatchAutoBrightnessResponder {
2830 fn drop(&mut self) {
2831 self.control_handle.shutdown();
2832 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2834 }
2835}
2836
2837impl fidl::endpoints::Responder for ReaderWatchAutoBrightnessResponder {
2838 type ControlHandle = ReaderControlHandle;
2839
2840 fn control_handle(&self) -> &ReaderControlHandle {
2841 &self.control_handle
2842 }
2843
2844 fn drop_without_shutdown(mut self) {
2845 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2847 std::mem::forget(self);
2849 }
2850}
2851
2852impl ReaderWatchAutoBrightnessResponder {
2853 pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
2857 let _result = self.send_raw(enabled);
2858 if _result.is_err() {
2859 self.control_handle.shutdown();
2860 }
2861 self.drop_without_shutdown();
2862 _result
2863 }
2864
2865 pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
2867 let _result = self.send_raw(enabled);
2868 self.drop_without_shutdown();
2869 _result
2870 }
2871
2872 fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
2873 self.control_handle
2874 .inner
2875 .send::<fidl::encoding::FlexibleType<ReaderWatchAutoBrightnessResponse>>(
2876 fidl::encoding::Flexible::new((enabled,)),
2877 self.tx_id,
2878 0x2340adb613c927fe,
2879 fidl::encoding::DynamicFlags::FLEXIBLE,
2880 )
2881 }
2882}
2883
2884#[must_use = "FIDL methods require a response to be sent"]
2885#[derive(Debug)]
2886pub struct ReaderWatchCurrentBrightnessResponder {
2887 control_handle: std::mem::ManuallyDrop<ReaderControlHandle>,
2888 tx_id: u32,
2889}
2890
2891impl std::ops::Drop for ReaderWatchCurrentBrightnessResponder {
2895 fn drop(&mut self) {
2896 self.control_handle.shutdown();
2897 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2899 }
2900}
2901
2902impl fidl::endpoints::Responder for ReaderWatchCurrentBrightnessResponder {
2903 type ControlHandle = ReaderControlHandle;
2904
2905 fn control_handle(&self) -> &ReaderControlHandle {
2906 &self.control_handle
2907 }
2908
2909 fn drop_without_shutdown(mut self) {
2910 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2912 std::mem::forget(self);
2914 }
2915}
2916
2917impl ReaderWatchCurrentBrightnessResponder {
2918 pub fn send(self, mut value: f32) -> Result<(), fidl::Error> {
2922 let _result = self.send_raw(value);
2923 if _result.is_err() {
2924 self.control_handle.shutdown();
2925 }
2926 self.drop_without_shutdown();
2927 _result
2928 }
2929
2930 pub fn send_no_shutdown_on_err(self, mut value: f32) -> Result<(), fidl::Error> {
2932 let _result = self.send_raw(value);
2933 self.drop_without_shutdown();
2934 _result
2935 }
2936
2937 fn send_raw(&self, mut value: f32) -> Result<(), fidl::Error> {
2938 self.control_handle
2939 .inner
2940 .send::<fidl::encoding::FlexibleType<ReaderWatchCurrentBrightnessResponse>>(
2941 fidl::encoding::Flexible::new((value,)),
2942 self.tx_id,
2943 0x261947be9be0c158,
2944 fidl::encoding::DynamicFlags::FLEXIBLE,
2945 )
2946 }
2947}
2948
2949#[must_use = "FIDL methods require a response to be sent"]
2950#[derive(Debug)]
2951pub struct ReaderWatchAutoBrightnessAdjustmentResponder {
2952 control_handle: std::mem::ManuallyDrop<ReaderControlHandle>,
2953 tx_id: u32,
2954}
2955
2956impl std::ops::Drop for ReaderWatchAutoBrightnessAdjustmentResponder {
2960 fn drop(&mut self) {
2961 self.control_handle.shutdown();
2962 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2964 }
2965}
2966
2967impl fidl::endpoints::Responder for ReaderWatchAutoBrightnessAdjustmentResponder {
2968 type ControlHandle = ReaderControlHandle;
2969
2970 fn control_handle(&self) -> &ReaderControlHandle {
2971 &self.control_handle
2972 }
2973
2974 fn drop_without_shutdown(mut self) {
2975 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2977 std::mem::forget(self);
2979 }
2980}
2981
2982impl ReaderWatchAutoBrightnessAdjustmentResponder {
2983 pub fn send(self, mut adjustment: f32) -> Result<(), fidl::Error> {
2987 let _result = self.send_raw(adjustment);
2988 if _result.is_err() {
2989 self.control_handle.shutdown();
2990 }
2991 self.drop_without_shutdown();
2992 _result
2993 }
2994
2995 pub fn send_no_shutdown_on_err(self, mut adjustment: f32) -> Result<(), fidl::Error> {
2997 let _result = self.send_raw(adjustment);
2998 self.drop_without_shutdown();
2999 _result
3000 }
3001
3002 fn send_raw(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
3003 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
3004 ReaderWatchAutoBrightnessAdjustmentResponse,
3005 >>(
3006 fidl::encoding::Flexible::new((adjustment,)),
3007 self.tx_id,
3008 0x63843519b3bc0f41,
3009 fidl::encoding::DynamicFlags::FLEXIBLE,
3010 )
3011 }
3012}
3013
3014#[must_use = "FIDL methods require a response to be sent"]
3015#[derive(Debug)]
3016pub struct ReaderGetMaxAbsoluteBrightnessResponder {
3017 control_handle: std::mem::ManuallyDrop<ReaderControlHandle>,
3018 tx_id: u32,
3019}
3020
3021impl std::ops::Drop for ReaderGetMaxAbsoluteBrightnessResponder {
3025 fn drop(&mut self) {
3026 self.control_handle.shutdown();
3027 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3029 }
3030}
3031
3032impl fidl::endpoints::Responder for ReaderGetMaxAbsoluteBrightnessResponder {
3033 type ControlHandle = ReaderControlHandle;
3034
3035 fn control_handle(&self) -> &ReaderControlHandle {
3036 &self.control_handle
3037 }
3038
3039 fn drop_without_shutdown(mut self) {
3040 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3042 std::mem::forget(self);
3044 }
3045}
3046
3047impl ReaderGetMaxAbsoluteBrightnessResponder {
3048 pub fn send(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
3052 let _result = self.send_raw(result);
3053 if _result.is_err() {
3054 self.control_handle.shutdown();
3055 }
3056 self.drop_without_shutdown();
3057 _result
3058 }
3059
3060 pub fn send_no_shutdown_on_err(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
3062 let _result = self.send_raw(result);
3063 self.drop_without_shutdown();
3064 _result
3065 }
3066
3067 fn send_raw(&self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
3068 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3069 ReaderGetMaxAbsoluteBrightnessResponse,
3070 i32,
3071 >>(
3072 fidl::encoding::FlexibleResult::new(result.map(|max_brightness| (max_brightness,))),
3073 self.tx_id,
3074 0x27070157807d6424,
3075 fidl::encoding::DynamicFlags::FLEXIBLE,
3076 )
3077 }
3078}
3079
3080mod internal {
3081 use super::*;
3082}