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
2115mod internal {
2116 use super::*;
2117}