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 let protocol_name = <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
63 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
64 }
65
66 pub fn into_channel(self) -> fidl::Channel {
67 self.client.into_channel()
68 }
69
70 pub fn wait_for_event(
73 &self,
74 deadline: zx::MonotonicInstant,
75 ) -> Result<ColorAdjustmentEvent, fidl::Error> {
76 ColorAdjustmentEvent::decode(self.client.wait_for_event(deadline)?)
77 }
78
79 pub fn r#set_discrete_color_adjustment(
84 &self,
85 mut color_adjustment: &ColorAdjustmentTable,
86 ___deadline: zx::MonotonicInstant,
87 ) -> Result<(), fidl::Error> {
88 let _response = self.client.send_query::<
89 ColorAdjustmentSetDiscreteColorAdjustmentRequest,
90 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
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::Handle {
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#[derive(Debug, Clone)]
117pub struct ColorAdjustmentProxy {
118 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
119}
120
121impl fidl::endpoints::Proxy for ColorAdjustmentProxy {
122 type Protocol = ColorAdjustmentMarker;
123
124 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
125 Self::new(inner)
126 }
127
128 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
129 self.client.into_channel().map_err(|client| Self { client })
130 }
131
132 fn as_channel(&self) -> &::fidl::AsyncChannel {
133 self.client.as_channel()
134 }
135}
136
137impl ColorAdjustmentProxy {
138 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
140 let protocol_name = <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
141 Self { client: fidl::client::Client::new(channel, protocol_name) }
142 }
143
144 pub fn take_event_stream(&self) -> ColorAdjustmentEventStream {
150 ColorAdjustmentEventStream { event_receiver: self.client.take_event_receiver() }
151 }
152
153 pub fn r#set_discrete_color_adjustment(
158 &self,
159 mut color_adjustment: &ColorAdjustmentTable,
160 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
161 ColorAdjustmentProxyInterface::r#set_discrete_color_adjustment(self, color_adjustment)
162 }
163}
164
165impl ColorAdjustmentProxyInterface for ColorAdjustmentProxy {
166 type SetDiscreteColorAdjustmentResponseFut =
167 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
168 fn r#set_discrete_color_adjustment(
169 &self,
170 mut color_adjustment: &ColorAdjustmentTable,
171 ) -> Self::SetDiscreteColorAdjustmentResponseFut {
172 fn _decode(
173 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
174 ) -> Result<(), fidl::Error> {
175 let _response = fidl::client::decode_transaction_body::<
176 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
177 fidl::encoding::DefaultFuchsiaResourceDialect,
178 0x48d90d2e62d451c4,
179 >(_buf?)?
180 .into_result::<ColorAdjustmentMarker>("set_discrete_color_adjustment")?;
181 Ok(_response)
182 }
183 self.client.send_query_and_decode::<ColorAdjustmentSetDiscreteColorAdjustmentRequest, ()>(
184 (color_adjustment,),
185 0x48d90d2e62d451c4,
186 fidl::encoding::DynamicFlags::FLEXIBLE,
187 _decode,
188 )
189 }
190}
191
192pub struct ColorAdjustmentEventStream {
193 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
194}
195
196impl std::marker::Unpin for ColorAdjustmentEventStream {}
197
198impl futures::stream::FusedStream for ColorAdjustmentEventStream {
199 fn is_terminated(&self) -> bool {
200 self.event_receiver.is_terminated()
201 }
202}
203
204impl futures::Stream for ColorAdjustmentEventStream {
205 type Item = Result<ColorAdjustmentEvent, fidl::Error>;
206
207 fn poll_next(
208 mut self: std::pin::Pin<&mut Self>,
209 cx: &mut std::task::Context<'_>,
210 ) -> std::task::Poll<Option<Self::Item>> {
211 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
212 &mut self.event_receiver,
213 cx
214 )?) {
215 Some(buf) => std::task::Poll::Ready(Some(ColorAdjustmentEvent::decode(buf))),
216 None => std::task::Poll::Ready(None),
217 }
218 }
219}
220
221#[derive(Debug)]
222pub enum ColorAdjustmentEvent {
223 #[non_exhaustive]
224 _UnknownEvent {
225 ordinal: u64,
227 },
228}
229
230impl ColorAdjustmentEvent {
231 fn decode(
233 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
234 ) -> Result<ColorAdjustmentEvent, fidl::Error> {
235 let (bytes, _handles) = buf.split_mut();
236 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
237 debug_assert_eq!(tx_header.tx_id, 0);
238 match tx_header.ordinal {
239 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
240 Ok(ColorAdjustmentEvent::_UnknownEvent { ordinal: tx_header.ordinal })
241 }
242 _ => Err(fidl::Error::UnknownOrdinal {
243 ordinal: tx_header.ordinal,
244 protocol_name:
245 <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
246 }),
247 }
248 }
249}
250
251pub struct ColorAdjustmentRequestStream {
253 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
254 is_terminated: bool,
255}
256
257impl std::marker::Unpin for ColorAdjustmentRequestStream {}
258
259impl futures::stream::FusedStream for ColorAdjustmentRequestStream {
260 fn is_terminated(&self) -> bool {
261 self.is_terminated
262 }
263}
264
265impl fidl::endpoints::RequestStream for ColorAdjustmentRequestStream {
266 type Protocol = ColorAdjustmentMarker;
267 type ControlHandle = ColorAdjustmentControlHandle;
268
269 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
270 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
271 }
272
273 fn control_handle(&self) -> Self::ControlHandle {
274 ColorAdjustmentControlHandle { inner: self.inner.clone() }
275 }
276
277 fn into_inner(
278 self,
279 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
280 {
281 (self.inner, self.is_terminated)
282 }
283
284 fn from_inner(
285 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
286 is_terminated: bool,
287 ) -> Self {
288 Self { inner, is_terminated }
289 }
290}
291
292impl futures::Stream for ColorAdjustmentRequestStream {
293 type Item = Result<ColorAdjustmentRequest, fidl::Error>;
294
295 fn poll_next(
296 mut self: std::pin::Pin<&mut Self>,
297 cx: &mut std::task::Context<'_>,
298 ) -> std::task::Poll<Option<Self::Item>> {
299 let this = &mut *self;
300 if this.inner.check_shutdown(cx) {
301 this.is_terminated = true;
302 return std::task::Poll::Ready(None);
303 }
304 if this.is_terminated {
305 panic!("polled ColorAdjustmentRequestStream after completion");
306 }
307 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
308 |bytes, handles| {
309 match this.inner.channel().read_etc(cx, bytes, handles) {
310 std::task::Poll::Ready(Ok(())) => {}
311 std::task::Poll::Pending => return std::task::Poll::Pending,
312 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
313 this.is_terminated = true;
314 return std::task::Poll::Ready(None);
315 }
316 std::task::Poll::Ready(Err(e)) => {
317 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
318 e.into(),
319 ))))
320 }
321 }
322
323 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
325
326 std::task::Poll::Ready(Some(match header.ordinal {
327 0x48d90d2e62d451c4 => {
328 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
329 let mut req = fidl::new_empty!(
330 ColorAdjustmentSetDiscreteColorAdjustmentRequest,
331 fidl::encoding::DefaultFuchsiaResourceDialect
332 );
333 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
334 let control_handle =
335 ColorAdjustmentControlHandle { inner: this.inner.clone() };
336 Ok(ColorAdjustmentRequest::SetDiscreteColorAdjustment {
337 color_adjustment: req.color_adjustment,
338
339 responder: ColorAdjustmentSetDiscreteColorAdjustmentResponder {
340 control_handle: std::mem::ManuallyDrop::new(control_handle),
341 tx_id: header.tx_id,
342 },
343 })
344 }
345 _ if header.tx_id == 0
346 && header
347 .dynamic_flags()
348 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
349 {
350 Ok(ColorAdjustmentRequest::_UnknownMethod {
351 ordinal: header.ordinal,
352 control_handle: ColorAdjustmentControlHandle {
353 inner: this.inner.clone(),
354 },
355 method_type: fidl::MethodType::OneWay,
356 })
357 }
358 _ if header
359 .dynamic_flags()
360 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
361 {
362 this.inner.send_framework_err(
363 fidl::encoding::FrameworkErr::UnknownMethod,
364 header.tx_id,
365 header.ordinal,
366 header.dynamic_flags(),
367 (bytes, handles),
368 )?;
369 Ok(ColorAdjustmentRequest::_UnknownMethod {
370 ordinal: header.ordinal,
371 control_handle: ColorAdjustmentControlHandle {
372 inner: this.inner.clone(),
373 },
374 method_type: fidl::MethodType::TwoWay,
375 })
376 }
377 _ => Err(fidl::Error::UnknownOrdinal {
378 ordinal: header.ordinal,
379 protocol_name:
380 <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
381 }),
382 }))
383 },
384 )
385 }
386}
387
388#[derive(Debug)]
391pub enum ColorAdjustmentRequest {
392 SetDiscreteColorAdjustment {
397 color_adjustment: ColorAdjustmentTable,
398 responder: ColorAdjustmentSetDiscreteColorAdjustmentResponder,
399 },
400 #[non_exhaustive]
402 _UnknownMethod {
403 ordinal: u64,
405 control_handle: ColorAdjustmentControlHandle,
406 method_type: fidl::MethodType,
407 },
408}
409
410impl ColorAdjustmentRequest {
411 #[allow(irrefutable_let_patterns)]
412 pub fn into_set_discrete_color_adjustment(
413 self,
414 ) -> Option<(ColorAdjustmentTable, ColorAdjustmentSetDiscreteColorAdjustmentResponder)> {
415 if let ColorAdjustmentRequest::SetDiscreteColorAdjustment { color_adjustment, responder } =
416 self
417 {
418 Some((color_adjustment, responder))
419 } else {
420 None
421 }
422 }
423
424 pub fn method_name(&self) -> &'static str {
426 match *self {
427 ColorAdjustmentRequest::SetDiscreteColorAdjustment { .. } => {
428 "set_discrete_color_adjustment"
429 }
430 ColorAdjustmentRequest::_UnknownMethod {
431 method_type: fidl::MethodType::OneWay,
432 ..
433 } => "unknown one-way method",
434 ColorAdjustmentRequest::_UnknownMethod {
435 method_type: fidl::MethodType::TwoWay,
436 ..
437 } => "unknown two-way method",
438 }
439 }
440}
441
442#[derive(Debug, Clone)]
443pub struct ColorAdjustmentControlHandle {
444 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
445}
446
447impl fidl::endpoints::ControlHandle for ColorAdjustmentControlHandle {
448 fn shutdown(&self) {
449 self.inner.shutdown()
450 }
451 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
452 self.inner.shutdown_with_epitaph(status)
453 }
454
455 fn is_closed(&self) -> bool {
456 self.inner.channel().is_closed()
457 }
458 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
459 self.inner.channel().on_closed()
460 }
461
462 #[cfg(target_os = "fuchsia")]
463 fn signal_peer(
464 &self,
465 clear_mask: zx::Signals,
466 set_mask: zx::Signals,
467 ) -> Result<(), zx_status::Status> {
468 use fidl::Peered;
469 self.inner.channel().signal_peer(clear_mask, set_mask)
470 }
471}
472
473impl ColorAdjustmentControlHandle {}
474
475#[must_use = "FIDL methods require a response to be sent"]
476#[derive(Debug)]
477pub struct ColorAdjustmentSetDiscreteColorAdjustmentResponder {
478 control_handle: std::mem::ManuallyDrop<ColorAdjustmentControlHandle>,
479 tx_id: u32,
480}
481
482impl std::ops::Drop for ColorAdjustmentSetDiscreteColorAdjustmentResponder {
486 fn drop(&mut self) {
487 self.control_handle.shutdown();
488 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
490 }
491}
492
493impl fidl::endpoints::Responder for ColorAdjustmentSetDiscreteColorAdjustmentResponder {
494 type ControlHandle = ColorAdjustmentControlHandle;
495
496 fn control_handle(&self) -> &ColorAdjustmentControlHandle {
497 &self.control_handle
498 }
499
500 fn drop_without_shutdown(mut self) {
501 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
503 std::mem::forget(self);
505 }
506}
507
508impl ColorAdjustmentSetDiscreteColorAdjustmentResponder {
509 pub fn send(self) -> Result<(), fidl::Error> {
513 let _result = self.send_raw();
514 if _result.is_err() {
515 self.control_handle.shutdown();
516 }
517 self.drop_without_shutdown();
518 _result
519 }
520
521 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
523 let _result = self.send_raw();
524 self.drop_without_shutdown();
525 _result
526 }
527
528 fn send_raw(&self) -> Result<(), fidl::Error> {
529 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
530 fidl::encoding::Flexible::new(()),
531 self.tx_id,
532 0x48d90d2e62d451c4,
533 fidl::encoding::DynamicFlags::FLEXIBLE,
534 )
535 }
536}
537
538#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
539pub struct ColorAdjustmentHandlerMarker;
540
541impl fidl::endpoints::ProtocolMarker for ColorAdjustmentHandlerMarker {
542 type Proxy = ColorAdjustmentHandlerProxy;
543 type RequestStream = ColorAdjustmentHandlerRequestStream;
544 #[cfg(target_os = "fuchsia")]
545 type SynchronousProxy = ColorAdjustmentHandlerSynchronousProxy;
546
547 const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.ColorAdjustmentHandler";
548}
549impl fidl::endpoints::DiscoverableProtocolMarker for ColorAdjustmentHandlerMarker {}
550
551pub trait ColorAdjustmentHandlerProxyInterface: Send + Sync {
552 fn r#set_color_adjustment(
553 &self,
554 color_adjustment: &ColorAdjustmentTable,
555 ) -> Result<(), fidl::Error>;
556}
557#[derive(Debug)]
558#[cfg(target_os = "fuchsia")]
559pub struct ColorAdjustmentHandlerSynchronousProxy {
560 client: fidl::client::sync::Client,
561}
562
563#[cfg(target_os = "fuchsia")]
564impl fidl::endpoints::SynchronousProxy for ColorAdjustmentHandlerSynchronousProxy {
565 type Proxy = ColorAdjustmentHandlerProxy;
566 type Protocol = ColorAdjustmentHandlerMarker;
567
568 fn from_channel(inner: fidl::Channel) -> Self {
569 Self::new(inner)
570 }
571
572 fn into_channel(self) -> fidl::Channel {
573 self.client.into_channel()
574 }
575
576 fn as_channel(&self) -> &fidl::Channel {
577 self.client.as_channel()
578 }
579}
580
581#[cfg(target_os = "fuchsia")]
582impl ColorAdjustmentHandlerSynchronousProxy {
583 pub fn new(channel: fidl::Channel) -> Self {
584 let protocol_name =
585 <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
586 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
587 }
588
589 pub fn into_channel(self) -> fidl::Channel {
590 self.client.into_channel()
591 }
592
593 pub fn wait_for_event(
596 &self,
597 deadline: zx::MonotonicInstant,
598 ) -> Result<ColorAdjustmentHandlerEvent, fidl::Error> {
599 ColorAdjustmentHandlerEvent::decode(self.client.wait_for_event(deadline)?)
600 }
601
602 pub fn r#set_color_adjustment(
604 &self,
605 mut color_adjustment: &ColorAdjustmentTable,
606 ) -> Result<(), fidl::Error> {
607 self.client.send::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(
608 (color_adjustment,),
609 0x6277992fee8aea3d,
610 fidl::encoding::DynamicFlags::empty(),
611 )
612 }
613}
614
615#[cfg(target_os = "fuchsia")]
616impl From<ColorAdjustmentHandlerSynchronousProxy> for zx::Handle {
617 fn from(value: ColorAdjustmentHandlerSynchronousProxy) -> Self {
618 value.into_channel().into()
619 }
620}
621
622#[cfg(target_os = "fuchsia")]
623impl From<fidl::Channel> for ColorAdjustmentHandlerSynchronousProxy {
624 fn from(value: fidl::Channel) -> Self {
625 Self::new(value)
626 }
627}
628
629#[derive(Debug, Clone)]
630pub struct ColorAdjustmentHandlerProxy {
631 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
632}
633
634impl fidl::endpoints::Proxy for ColorAdjustmentHandlerProxy {
635 type Protocol = ColorAdjustmentHandlerMarker;
636
637 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
638 Self::new(inner)
639 }
640
641 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
642 self.client.into_channel().map_err(|client| Self { client })
643 }
644
645 fn as_channel(&self) -> &::fidl::AsyncChannel {
646 self.client.as_channel()
647 }
648}
649
650impl ColorAdjustmentHandlerProxy {
651 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
653 let protocol_name =
654 <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
655 Self { client: fidl::client::Client::new(channel, protocol_name) }
656 }
657
658 pub fn take_event_stream(&self) -> ColorAdjustmentHandlerEventStream {
664 ColorAdjustmentHandlerEventStream { event_receiver: self.client.take_event_receiver() }
665 }
666
667 pub fn r#set_color_adjustment(
669 &self,
670 mut color_adjustment: &ColorAdjustmentTable,
671 ) -> Result<(), fidl::Error> {
672 ColorAdjustmentHandlerProxyInterface::r#set_color_adjustment(self, color_adjustment)
673 }
674}
675
676impl ColorAdjustmentHandlerProxyInterface for ColorAdjustmentHandlerProxy {
677 fn r#set_color_adjustment(
678 &self,
679 mut color_adjustment: &ColorAdjustmentTable,
680 ) -> Result<(), fidl::Error> {
681 self.client.send::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(
682 (color_adjustment,),
683 0x6277992fee8aea3d,
684 fidl::encoding::DynamicFlags::empty(),
685 )
686 }
687}
688
689pub struct ColorAdjustmentHandlerEventStream {
690 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
691}
692
693impl std::marker::Unpin for ColorAdjustmentHandlerEventStream {}
694
695impl futures::stream::FusedStream for ColorAdjustmentHandlerEventStream {
696 fn is_terminated(&self) -> bool {
697 self.event_receiver.is_terminated()
698 }
699}
700
701impl futures::Stream for ColorAdjustmentHandlerEventStream {
702 type Item = Result<ColorAdjustmentHandlerEvent, fidl::Error>;
703
704 fn poll_next(
705 mut self: std::pin::Pin<&mut Self>,
706 cx: &mut std::task::Context<'_>,
707 ) -> std::task::Poll<Option<Self::Item>> {
708 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
709 &mut self.event_receiver,
710 cx
711 )?) {
712 Some(buf) => std::task::Poll::Ready(Some(ColorAdjustmentHandlerEvent::decode(buf))),
713 None => std::task::Poll::Ready(None),
714 }
715 }
716}
717
718#[derive(Debug)]
719pub enum ColorAdjustmentHandlerEvent {}
720
721impl ColorAdjustmentHandlerEvent {
722 fn decode(
724 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
725 ) -> Result<ColorAdjustmentHandlerEvent, fidl::Error> {
726 let (bytes, _handles) = buf.split_mut();
727 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
728 debug_assert_eq!(tx_header.tx_id, 0);
729 match tx_header.ordinal {
730 _ => Err(fidl::Error::UnknownOrdinal {
731 ordinal: tx_header.ordinal,
732 protocol_name:
733 <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
734 }),
735 }
736 }
737}
738
739pub struct ColorAdjustmentHandlerRequestStream {
741 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
742 is_terminated: bool,
743}
744
745impl std::marker::Unpin for ColorAdjustmentHandlerRequestStream {}
746
747impl futures::stream::FusedStream for ColorAdjustmentHandlerRequestStream {
748 fn is_terminated(&self) -> bool {
749 self.is_terminated
750 }
751}
752
753impl fidl::endpoints::RequestStream for ColorAdjustmentHandlerRequestStream {
754 type Protocol = ColorAdjustmentHandlerMarker;
755 type ControlHandle = ColorAdjustmentHandlerControlHandle;
756
757 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
758 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
759 }
760
761 fn control_handle(&self) -> Self::ControlHandle {
762 ColorAdjustmentHandlerControlHandle { inner: self.inner.clone() }
763 }
764
765 fn into_inner(
766 self,
767 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
768 {
769 (self.inner, self.is_terminated)
770 }
771
772 fn from_inner(
773 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
774 is_terminated: bool,
775 ) -> Self {
776 Self { inner, is_terminated }
777 }
778}
779
780impl futures::Stream for ColorAdjustmentHandlerRequestStream {
781 type Item = Result<ColorAdjustmentHandlerRequest, fidl::Error>;
782
783 fn poll_next(
784 mut self: std::pin::Pin<&mut Self>,
785 cx: &mut std::task::Context<'_>,
786 ) -> std::task::Poll<Option<Self::Item>> {
787 let this = &mut *self;
788 if this.inner.check_shutdown(cx) {
789 this.is_terminated = true;
790 return std::task::Poll::Ready(None);
791 }
792 if this.is_terminated {
793 panic!("polled ColorAdjustmentHandlerRequestStream after completion");
794 }
795 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
796 |bytes, handles| {
797 match this.inner.channel().read_etc(cx, bytes, handles) {
798 std::task::Poll::Ready(Ok(())) => {}
799 std::task::Poll::Pending => return std::task::Poll::Pending,
800 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
801 this.is_terminated = true;
802 return std::task::Poll::Ready(None);
803 }
804 std::task::Poll::Ready(Err(e)) => {
805 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
806 e.into(),
807 ))))
808 }
809 }
810
811 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
813
814 std::task::Poll::Ready(Some(match header.ordinal {
815 0x6277992fee8aea3d => {
816 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
817 let mut req = fidl::new_empty!(ColorAdjustmentHandlerSetColorAdjustmentRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
818 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
819 let control_handle = ColorAdjustmentHandlerControlHandle {
820 inner: this.inner.clone(),
821 };
822 Ok(ColorAdjustmentHandlerRequest::SetColorAdjustment {color_adjustment: req.color_adjustment,
823
824 control_handle,
825 })
826 }
827 _ => Err(fidl::Error::UnknownOrdinal {
828 ordinal: header.ordinal,
829 protocol_name: <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
830 }),
831 }))
832 },
833 )
834 }
835}
836
837#[derive(Debug)]
841pub enum ColorAdjustmentHandlerRequest {
842 SetColorAdjustment {
844 color_adjustment: ColorAdjustmentTable,
845 control_handle: ColorAdjustmentHandlerControlHandle,
846 },
847}
848
849impl ColorAdjustmentHandlerRequest {
850 #[allow(irrefutable_let_patterns)]
851 pub fn into_set_color_adjustment(
852 self,
853 ) -> Option<(ColorAdjustmentTable, ColorAdjustmentHandlerControlHandle)> {
854 if let ColorAdjustmentHandlerRequest::SetColorAdjustment {
855 color_adjustment,
856 control_handle,
857 } = self
858 {
859 Some((color_adjustment, control_handle))
860 } else {
861 None
862 }
863 }
864
865 pub fn method_name(&self) -> &'static str {
867 match *self {
868 ColorAdjustmentHandlerRequest::SetColorAdjustment { .. } => "set_color_adjustment",
869 }
870 }
871}
872
873#[derive(Debug, Clone)]
874pub struct ColorAdjustmentHandlerControlHandle {
875 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
876}
877
878impl fidl::endpoints::ControlHandle for ColorAdjustmentHandlerControlHandle {
879 fn shutdown(&self) {
880 self.inner.shutdown()
881 }
882 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
883 self.inner.shutdown_with_epitaph(status)
884 }
885
886 fn is_closed(&self) -> bool {
887 self.inner.channel().is_closed()
888 }
889 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
890 self.inner.channel().on_closed()
891 }
892
893 #[cfg(target_os = "fuchsia")]
894 fn signal_peer(
895 &self,
896 clear_mask: zx::Signals,
897 set_mask: zx::Signals,
898 ) -> Result<(), zx_status::Status> {
899 use fidl::Peered;
900 self.inner.channel().signal_peer(clear_mask, set_mask)
901 }
902}
903
904impl ColorAdjustmentHandlerControlHandle {}
905
906#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
907pub struct ControlMarker;
908
909impl fidl::endpoints::ProtocolMarker for ControlMarker {
910 type Proxy = ControlProxy;
911 type RequestStream = ControlRequestStream;
912 #[cfg(target_os = "fuchsia")]
913 type SynchronousProxy = ControlSynchronousProxy;
914
915 const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.Control";
916}
917impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
918pub type ControlGetMaxAbsoluteBrightnessResult = Result<f64, i32>;
919
920pub trait ControlProxyInterface: Send + Sync {
921 fn r#set_auto_brightness(&self) -> Result<(), fidl::Error>;
922 type WatchAutoBrightnessResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
923 + Send;
924 fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut;
925 fn r#set_manual_brightness(&self, value: f32) -> Result<(), fidl::Error>;
926 fn r#set_manual_brightness_smooth(&self, value: f32, duration: i64) -> Result<(), fidl::Error>;
927 type WatchCurrentBrightnessResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
928 + Send;
929 fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut;
930 fn r#set_auto_brightness_adjustment(&self, adjustment: f32) -> Result<(), fidl::Error>;
931 type WatchAutoBrightnessAdjustmentResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
932 + Send;
933 fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut;
934 fn r#set_brightness_table(&self, table: &BrightnessTable) -> Result<(), fidl::Error>;
935 type GetMaxAbsoluteBrightnessResponseFut: std::future::Future<Output = Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error>>
936 + Send;
937 fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut;
938}
939#[derive(Debug)]
940#[cfg(target_os = "fuchsia")]
941pub struct ControlSynchronousProxy {
942 client: fidl::client::sync::Client,
943}
944
945#[cfg(target_os = "fuchsia")]
946impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
947 type Proxy = ControlProxy;
948 type Protocol = ControlMarker;
949
950 fn from_channel(inner: fidl::Channel) -> Self {
951 Self::new(inner)
952 }
953
954 fn into_channel(self) -> fidl::Channel {
955 self.client.into_channel()
956 }
957
958 fn as_channel(&self) -> &fidl::Channel {
959 self.client.as_channel()
960 }
961}
962
963#[cfg(target_os = "fuchsia")]
964impl ControlSynchronousProxy {
965 pub fn new(channel: fidl::Channel) -> Self {
966 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
967 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
968 }
969
970 pub fn into_channel(self) -> fidl::Channel {
971 self.client.into_channel()
972 }
973
974 pub fn wait_for_event(
977 &self,
978 deadline: zx::MonotonicInstant,
979 ) -> Result<ControlEvent, fidl::Error> {
980 ControlEvent::decode(self.client.wait_for_event(deadline)?)
981 }
982
983 pub fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
986 self.client.send::<fidl::encoding::EmptyPayload>(
987 (),
988 0x46b623a7fa77a979,
989 fidl::encoding::DynamicFlags::empty(),
990 )
991 }
992
993 pub fn r#watch_auto_brightness(
996 &self,
997 ___deadline: zx::MonotonicInstant,
998 ) -> Result<bool, fidl::Error> {
999 let _response = self
1000 .client
1001 .send_query::<fidl::encoding::EmptyPayload, ControlWatchAutoBrightnessResponse>(
1002 (),
1003 0xd956a90c115186b,
1004 fidl::encoding::DynamicFlags::empty(),
1005 ___deadline,
1006 )?;
1007 Ok(_response.enabled)
1008 }
1009
1010 pub fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
1015 self.client.send::<ControlSetManualBrightnessRequest>(
1016 (value,),
1017 0x1e333aa49771e1eb,
1018 fidl::encoding::DynamicFlags::empty(),
1019 )
1020 }
1021
1022 pub fn r#set_manual_brightness_smooth(
1025 &self,
1026 mut value: f32,
1027 mut duration: i64,
1028 ) -> Result<(), fidl::Error> {
1029 self.client.send::<ControlSetManualBrightnessSmoothRequest>(
1030 (value, duration),
1031 0x7b7d273c20a61d0c,
1032 fidl::encoding::DynamicFlags::empty(),
1033 )
1034 }
1035
1036 pub fn r#watch_current_brightness(
1041 &self,
1042 ___deadline: zx::MonotonicInstant,
1043 ) -> Result<f32, fidl::Error> {
1044 let _response = self
1045 .client
1046 .send_query::<fidl::encoding::EmptyPayload, ControlWatchCurrentBrightnessResponse>(
1047 (),
1048 0x2cc3011e2326d4d8,
1049 fidl::encoding::DynamicFlags::empty(),
1050 ___deadline,
1051 )?;
1052 Ok(_response.value)
1053 }
1054
1055 pub fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1059 self.client.send::<ControlSetAutoBrightnessAdjustmentRequest>(
1060 (adjustment,),
1061 0x678ee26bc217d996,
1062 fidl::encoding::DynamicFlags::empty(),
1063 )
1064 }
1065
1066 pub fn r#watch_auto_brightness_adjustment(
1069 &self,
1070 ___deadline: zx::MonotonicInstant,
1071 ) -> Result<f32, fidl::Error> {
1072 let _response = self.client.send_query::<
1073 fidl::encoding::EmptyPayload,
1074 ControlWatchAutoBrightnessAdjustmentResponse,
1075 >(
1076 (),
1077 0x7c373aafe0058135,
1078 fidl::encoding::DynamicFlags::empty(),
1079 ___deadline,
1080 )?;
1081 Ok(_response.adjustment)
1082 }
1083
1084 pub fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
1089 self.client.send::<ControlSetBrightnessTableRequest>(
1090 (table,),
1091 0x11d419413129dcee,
1092 fidl::encoding::DynamicFlags::empty(),
1093 )
1094 }
1095
1096 pub fn r#get_max_absolute_brightness(
1098 &self,
1099 ___deadline: zx::MonotonicInstant,
1100 ) -> Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error> {
1101 let _response = self.client.send_query::<
1102 fidl::encoding::EmptyPayload,
1103 fidl::encoding::ResultType<ControlGetMaxAbsoluteBrightnessResponse, i32>,
1104 >(
1105 (),
1106 0x73055a8d6422caf8,
1107 fidl::encoding::DynamicFlags::empty(),
1108 ___deadline,
1109 )?;
1110 Ok(_response.map(|x| x.max_brightness))
1111 }
1112}
1113
1114#[cfg(target_os = "fuchsia")]
1115impl From<ControlSynchronousProxy> for zx::Handle {
1116 fn from(value: ControlSynchronousProxy) -> Self {
1117 value.into_channel().into()
1118 }
1119}
1120
1121#[cfg(target_os = "fuchsia")]
1122impl From<fidl::Channel> for ControlSynchronousProxy {
1123 fn from(value: fidl::Channel) -> Self {
1124 Self::new(value)
1125 }
1126}
1127
1128#[derive(Debug, Clone)]
1129pub struct ControlProxy {
1130 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1131}
1132
1133impl fidl::endpoints::Proxy for ControlProxy {
1134 type Protocol = ControlMarker;
1135
1136 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1137 Self::new(inner)
1138 }
1139
1140 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1141 self.client.into_channel().map_err(|client| Self { client })
1142 }
1143
1144 fn as_channel(&self) -> &::fidl::AsyncChannel {
1145 self.client.as_channel()
1146 }
1147}
1148
1149impl ControlProxy {
1150 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1152 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1153 Self { client: fidl::client::Client::new(channel, protocol_name) }
1154 }
1155
1156 pub fn take_event_stream(&self) -> ControlEventStream {
1162 ControlEventStream { event_receiver: self.client.take_event_receiver() }
1163 }
1164
1165 pub fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
1168 ControlProxyInterface::r#set_auto_brightness(self)
1169 }
1170
1171 pub fn r#watch_auto_brightness(
1174 &self,
1175 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
1176 ControlProxyInterface::r#watch_auto_brightness(self)
1177 }
1178
1179 pub fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
1184 ControlProxyInterface::r#set_manual_brightness(self, value)
1185 }
1186
1187 pub fn r#set_manual_brightness_smooth(
1190 &self,
1191 mut value: f32,
1192 mut duration: i64,
1193 ) -> Result<(), fidl::Error> {
1194 ControlProxyInterface::r#set_manual_brightness_smooth(self, value, duration)
1195 }
1196
1197 pub fn r#watch_current_brightness(
1202 &self,
1203 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1204 ControlProxyInterface::r#watch_current_brightness(self)
1205 }
1206
1207 pub fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1211 ControlProxyInterface::r#set_auto_brightness_adjustment(self, adjustment)
1212 }
1213
1214 pub fn r#watch_auto_brightness_adjustment(
1217 &self,
1218 ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1219 ControlProxyInterface::r#watch_auto_brightness_adjustment(self)
1220 }
1221
1222 pub fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
1227 ControlProxyInterface::r#set_brightness_table(self, table)
1228 }
1229
1230 pub fn r#get_max_absolute_brightness(
1232 &self,
1233 ) -> fidl::client::QueryResponseFut<
1234 ControlGetMaxAbsoluteBrightnessResult,
1235 fidl::encoding::DefaultFuchsiaResourceDialect,
1236 > {
1237 ControlProxyInterface::r#get_max_absolute_brightness(self)
1238 }
1239}
1240
1241impl ControlProxyInterface for ControlProxy {
1242 fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
1243 self.client.send::<fidl::encoding::EmptyPayload>(
1244 (),
1245 0x46b623a7fa77a979,
1246 fidl::encoding::DynamicFlags::empty(),
1247 )
1248 }
1249
1250 type WatchAutoBrightnessResponseFut =
1251 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
1252 fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut {
1253 fn _decode(
1254 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1255 ) -> Result<bool, fidl::Error> {
1256 let _response = fidl::client::decode_transaction_body::<
1257 ControlWatchAutoBrightnessResponse,
1258 fidl::encoding::DefaultFuchsiaResourceDialect,
1259 0xd956a90c115186b,
1260 >(_buf?)?;
1261 Ok(_response.enabled)
1262 }
1263 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
1264 (),
1265 0xd956a90c115186b,
1266 fidl::encoding::DynamicFlags::empty(),
1267 _decode,
1268 )
1269 }
1270
1271 fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
1272 self.client.send::<ControlSetManualBrightnessRequest>(
1273 (value,),
1274 0x1e333aa49771e1eb,
1275 fidl::encoding::DynamicFlags::empty(),
1276 )
1277 }
1278
1279 fn r#set_manual_brightness_smooth(
1280 &self,
1281 mut value: f32,
1282 mut duration: i64,
1283 ) -> Result<(), fidl::Error> {
1284 self.client.send::<ControlSetManualBrightnessSmoothRequest>(
1285 (value, duration),
1286 0x7b7d273c20a61d0c,
1287 fidl::encoding::DynamicFlags::empty(),
1288 )
1289 }
1290
1291 type WatchCurrentBrightnessResponseFut =
1292 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1293 fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut {
1294 fn _decode(
1295 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1296 ) -> Result<f32, fidl::Error> {
1297 let _response = fidl::client::decode_transaction_body::<
1298 ControlWatchCurrentBrightnessResponse,
1299 fidl::encoding::DefaultFuchsiaResourceDialect,
1300 0x2cc3011e2326d4d8,
1301 >(_buf?)?;
1302 Ok(_response.value)
1303 }
1304 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
1305 (),
1306 0x2cc3011e2326d4d8,
1307 fidl::encoding::DynamicFlags::empty(),
1308 _decode,
1309 )
1310 }
1311
1312 fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1313 self.client.send::<ControlSetAutoBrightnessAdjustmentRequest>(
1314 (adjustment,),
1315 0x678ee26bc217d996,
1316 fidl::encoding::DynamicFlags::empty(),
1317 )
1318 }
1319
1320 type WatchAutoBrightnessAdjustmentResponseFut =
1321 fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1322 fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut {
1323 fn _decode(
1324 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1325 ) -> Result<f32, fidl::Error> {
1326 let _response = fidl::client::decode_transaction_body::<
1327 ControlWatchAutoBrightnessAdjustmentResponse,
1328 fidl::encoding::DefaultFuchsiaResourceDialect,
1329 0x7c373aafe0058135,
1330 >(_buf?)?;
1331 Ok(_response.adjustment)
1332 }
1333 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
1334 (),
1335 0x7c373aafe0058135,
1336 fidl::encoding::DynamicFlags::empty(),
1337 _decode,
1338 )
1339 }
1340
1341 fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
1342 self.client.send::<ControlSetBrightnessTableRequest>(
1343 (table,),
1344 0x11d419413129dcee,
1345 fidl::encoding::DynamicFlags::empty(),
1346 )
1347 }
1348
1349 type GetMaxAbsoluteBrightnessResponseFut = fidl::client::QueryResponseFut<
1350 ControlGetMaxAbsoluteBrightnessResult,
1351 fidl::encoding::DefaultFuchsiaResourceDialect,
1352 >;
1353 fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut {
1354 fn _decode(
1355 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1356 ) -> Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error> {
1357 let _response = fidl::client::decode_transaction_body::<
1358 fidl::encoding::ResultType<ControlGetMaxAbsoluteBrightnessResponse, i32>,
1359 fidl::encoding::DefaultFuchsiaResourceDialect,
1360 0x73055a8d6422caf8,
1361 >(_buf?)?;
1362 Ok(_response.map(|x| x.max_brightness))
1363 }
1364 self.client.send_query_and_decode::<
1365 fidl::encoding::EmptyPayload,
1366 ControlGetMaxAbsoluteBrightnessResult,
1367 >(
1368 (),
1369 0x73055a8d6422caf8,
1370 fidl::encoding::DynamicFlags::empty(),
1371 _decode,
1372 )
1373 }
1374}
1375
1376pub struct ControlEventStream {
1377 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1378}
1379
1380impl std::marker::Unpin for ControlEventStream {}
1381
1382impl futures::stream::FusedStream for ControlEventStream {
1383 fn is_terminated(&self) -> bool {
1384 self.event_receiver.is_terminated()
1385 }
1386}
1387
1388impl futures::Stream for ControlEventStream {
1389 type Item = Result<ControlEvent, fidl::Error>;
1390
1391 fn poll_next(
1392 mut self: std::pin::Pin<&mut Self>,
1393 cx: &mut std::task::Context<'_>,
1394 ) -> std::task::Poll<Option<Self::Item>> {
1395 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1396 &mut self.event_receiver,
1397 cx
1398 )?) {
1399 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
1400 None => std::task::Poll::Ready(None),
1401 }
1402 }
1403}
1404
1405#[derive(Debug)]
1406pub enum ControlEvent {}
1407
1408impl ControlEvent {
1409 fn decode(
1411 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1412 ) -> Result<ControlEvent, fidl::Error> {
1413 let (bytes, _handles) = buf.split_mut();
1414 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1415 debug_assert_eq!(tx_header.tx_id, 0);
1416 match tx_header.ordinal {
1417 _ => Err(fidl::Error::UnknownOrdinal {
1418 ordinal: tx_header.ordinal,
1419 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1420 }),
1421 }
1422 }
1423}
1424
1425pub struct ControlRequestStream {
1427 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1428 is_terminated: bool,
1429}
1430
1431impl std::marker::Unpin for ControlRequestStream {}
1432
1433impl futures::stream::FusedStream for ControlRequestStream {
1434 fn is_terminated(&self) -> bool {
1435 self.is_terminated
1436 }
1437}
1438
1439impl fidl::endpoints::RequestStream for ControlRequestStream {
1440 type Protocol = ControlMarker;
1441 type ControlHandle = ControlControlHandle;
1442
1443 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1444 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1445 }
1446
1447 fn control_handle(&self) -> Self::ControlHandle {
1448 ControlControlHandle { inner: self.inner.clone() }
1449 }
1450
1451 fn into_inner(
1452 self,
1453 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1454 {
1455 (self.inner, self.is_terminated)
1456 }
1457
1458 fn from_inner(
1459 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1460 is_terminated: bool,
1461 ) -> Self {
1462 Self { inner, is_terminated }
1463 }
1464}
1465
1466impl futures::Stream for ControlRequestStream {
1467 type Item = Result<ControlRequest, fidl::Error>;
1468
1469 fn poll_next(
1470 mut self: std::pin::Pin<&mut Self>,
1471 cx: &mut std::task::Context<'_>,
1472 ) -> std::task::Poll<Option<Self::Item>> {
1473 let this = &mut *self;
1474 if this.inner.check_shutdown(cx) {
1475 this.is_terminated = true;
1476 return std::task::Poll::Ready(None);
1477 }
1478 if this.is_terminated {
1479 panic!("polled ControlRequestStream after completion");
1480 }
1481 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1482 |bytes, handles| {
1483 match this.inner.channel().read_etc(cx, bytes, handles) {
1484 std::task::Poll::Ready(Ok(())) => {}
1485 std::task::Poll::Pending => return std::task::Poll::Pending,
1486 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1487 this.is_terminated = true;
1488 return std::task::Poll::Ready(None);
1489 }
1490 std::task::Poll::Ready(Err(e)) => {
1491 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1492 e.into(),
1493 ))))
1494 }
1495 }
1496
1497 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1499
1500 std::task::Poll::Ready(Some(match header.ordinal {
1501 0x46b623a7fa77a979 => {
1502 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1503 let mut req = fidl::new_empty!(
1504 fidl::encoding::EmptyPayload,
1505 fidl::encoding::DefaultFuchsiaResourceDialect
1506 );
1507 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1508 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1509 Ok(ControlRequest::SetAutoBrightness { control_handle })
1510 }
1511 0xd956a90c115186b => {
1512 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1513 let mut req = fidl::new_empty!(
1514 fidl::encoding::EmptyPayload,
1515 fidl::encoding::DefaultFuchsiaResourceDialect
1516 );
1517 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1518 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1519 Ok(ControlRequest::WatchAutoBrightness {
1520 responder: ControlWatchAutoBrightnessResponder {
1521 control_handle: std::mem::ManuallyDrop::new(control_handle),
1522 tx_id: header.tx_id,
1523 },
1524 })
1525 }
1526 0x1e333aa49771e1eb => {
1527 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1528 let mut req = fidl::new_empty!(
1529 ControlSetManualBrightnessRequest,
1530 fidl::encoding::DefaultFuchsiaResourceDialect
1531 );
1532 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetManualBrightnessRequest>(&header, _body_bytes, handles, &mut req)?;
1533 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1534 Ok(ControlRequest::SetManualBrightness { value: req.value, control_handle })
1535 }
1536 0x7b7d273c20a61d0c => {
1537 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1538 let mut req = fidl::new_empty!(
1539 ControlSetManualBrightnessSmoothRequest,
1540 fidl::encoding::DefaultFuchsiaResourceDialect
1541 );
1542 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetManualBrightnessSmoothRequest>(&header, _body_bytes, handles, &mut req)?;
1543 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1544 Ok(ControlRequest::SetManualBrightnessSmooth {
1545 value: req.value,
1546 duration: req.duration,
1547
1548 control_handle,
1549 })
1550 }
1551 0x2cc3011e2326d4d8 => {
1552 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1553 let mut req = fidl::new_empty!(
1554 fidl::encoding::EmptyPayload,
1555 fidl::encoding::DefaultFuchsiaResourceDialect
1556 );
1557 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1558 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1559 Ok(ControlRequest::WatchCurrentBrightness {
1560 responder: ControlWatchCurrentBrightnessResponder {
1561 control_handle: std::mem::ManuallyDrop::new(control_handle),
1562 tx_id: header.tx_id,
1563 },
1564 })
1565 }
1566 0x678ee26bc217d996 => {
1567 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1568 let mut req = fidl::new_empty!(
1569 ControlSetAutoBrightnessAdjustmentRequest,
1570 fidl::encoding::DefaultFuchsiaResourceDialect
1571 );
1572 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetAutoBrightnessAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
1573 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1574 Ok(ControlRequest::SetAutoBrightnessAdjustment {
1575 adjustment: req.adjustment,
1576
1577 control_handle,
1578 })
1579 }
1580 0x7c373aafe0058135 => {
1581 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1582 let mut req = fidl::new_empty!(
1583 fidl::encoding::EmptyPayload,
1584 fidl::encoding::DefaultFuchsiaResourceDialect
1585 );
1586 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1587 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1588 Ok(ControlRequest::WatchAutoBrightnessAdjustment {
1589 responder: ControlWatchAutoBrightnessAdjustmentResponder {
1590 control_handle: std::mem::ManuallyDrop::new(control_handle),
1591 tx_id: header.tx_id,
1592 },
1593 })
1594 }
1595 0x11d419413129dcee => {
1596 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1597 let mut req = fidl::new_empty!(
1598 ControlSetBrightnessTableRequest,
1599 fidl::encoding::DefaultFuchsiaResourceDialect
1600 );
1601 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetBrightnessTableRequest>(&header, _body_bytes, handles, &mut req)?;
1602 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1603 Ok(ControlRequest::SetBrightnessTable { table: req.table, control_handle })
1604 }
1605 0x73055a8d6422caf8 => {
1606 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1607 let mut req = fidl::new_empty!(
1608 fidl::encoding::EmptyPayload,
1609 fidl::encoding::DefaultFuchsiaResourceDialect
1610 );
1611 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1612 let control_handle = ControlControlHandle { inner: this.inner.clone() };
1613 Ok(ControlRequest::GetMaxAbsoluteBrightness {
1614 responder: ControlGetMaxAbsoluteBrightnessResponder {
1615 control_handle: std::mem::ManuallyDrop::new(control_handle),
1616 tx_id: header.tx_id,
1617 },
1618 })
1619 }
1620 _ => Err(fidl::Error::UnknownOrdinal {
1621 ordinal: header.ordinal,
1622 protocol_name:
1623 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1624 }),
1625 }))
1626 },
1627 )
1628 }
1629}
1630
1631#[derive(Debug)]
1633pub enum ControlRequest {
1634 SetAutoBrightness { control_handle: ControlControlHandle },
1637 WatchAutoBrightness { responder: ControlWatchAutoBrightnessResponder },
1640 SetManualBrightness { value: f32, control_handle: ControlControlHandle },
1645 SetManualBrightnessSmooth { value: f32, duration: i64, control_handle: ControlControlHandle },
1648 WatchCurrentBrightness { responder: ControlWatchCurrentBrightnessResponder },
1653 SetAutoBrightnessAdjustment { adjustment: f32, control_handle: ControlControlHandle },
1657 WatchAutoBrightnessAdjustment { responder: ControlWatchAutoBrightnessAdjustmentResponder },
1660 SetBrightnessTable { table: BrightnessTable, control_handle: ControlControlHandle },
1665 GetMaxAbsoluteBrightness { responder: ControlGetMaxAbsoluteBrightnessResponder },
1667}
1668
1669impl ControlRequest {
1670 #[allow(irrefutable_let_patterns)]
1671 pub fn into_set_auto_brightness(self) -> Option<(ControlControlHandle)> {
1672 if let ControlRequest::SetAutoBrightness { control_handle } = self {
1673 Some((control_handle))
1674 } else {
1675 None
1676 }
1677 }
1678
1679 #[allow(irrefutable_let_patterns)]
1680 pub fn into_watch_auto_brightness(self) -> Option<(ControlWatchAutoBrightnessResponder)> {
1681 if let ControlRequest::WatchAutoBrightness { responder } = self {
1682 Some((responder))
1683 } else {
1684 None
1685 }
1686 }
1687
1688 #[allow(irrefutable_let_patterns)]
1689 pub fn into_set_manual_brightness(self) -> Option<(f32, ControlControlHandle)> {
1690 if let ControlRequest::SetManualBrightness { value, control_handle } = self {
1691 Some((value, control_handle))
1692 } else {
1693 None
1694 }
1695 }
1696
1697 #[allow(irrefutable_let_patterns)]
1698 pub fn into_set_manual_brightness_smooth(self) -> Option<(f32, i64, ControlControlHandle)> {
1699 if let ControlRequest::SetManualBrightnessSmooth { value, duration, control_handle } = self
1700 {
1701 Some((value, duration, control_handle))
1702 } else {
1703 None
1704 }
1705 }
1706
1707 #[allow(irrefutable_let_patterns)]
1708 pub fn into_watch_current_brightness(self) -> Option<(ControlWatchCurrentBrightnessResponder)> {
1709 if let ControlRequest::WatchCurrentBrightness { responder } = self {
1710 Some((responder))
1711 } else {
1712 None
1713 }
1714 }
1715
1716 #[allow(irrefutable_let_patterns)]
1717 pub fn into_set_auto_brightness_adjustment(self) -> Option<(f32, ControlControlHandle)> {
1718 if let ControlRequest::SetAutoBrightnessAdjustment { adjustment, control_handle } = self {
1719 Some((adjustment, control_handle))
1720 } else {
1721 None
1722 }
1723 }
1724
1725 #[allow(irrefutable_let_patterns)]
1726 pub fn into_watch_auto_brightness_adjustment(
1727 self,
1728 ) -> Option<(ControlWatchAutoBrightnessAdjustmentResponder)> {
1729 if let ControlRequest::WatchAutoBrightnessAdjustment { responder } = self {
1730 Some((responder))
1731 } else {
1732 None
1733 }
1734 }
1735
1736 #[allow(irrefutable_let_patterns)]
1737 pub fn into_set_brightness_table(self) -> Option<(BrightnessTable, ControlControlHandle)> {
1738 if let ControlRequest::SetBrightnessTable { table, control_handle } = self {
1739 Some((table, control_handle))
1740 } else {
1741 None
1742 }
1743 }
1744
1745 #[allow(irrefutable_let_patterns)]
1746 pub fn into_get_max_absolute_brightness(
1747 self,
1748 ) -> Option<(ControlGetMaxAbsoluteBrightnessResponder)> {
1749 if let ControlRequest::GetMaxAbsoluteBrightness { responder } = self {
1750 Some((responder))
1751 } else {
1752 None
1753 }
1754 }
1755
1756 pub fn method_name(&self) -> &'static str {
1758 match *self {
1759 ControlRequest::SetAutoBrightness { .. } => "set_auto_brightness",
1760 ControlRequest::WatchAutoBrightness { .. } => "watch_auto_brightness",
1761 ControlRequest::SetManualBrightness { .. } => "set_manual_brightness",
1762 ControlRequest::SetManualBrightnessSmooth { .. } => "set_manual_brightness_smooth",
1763 ControlRequest::WatchCurrentBrightness { .. } => "watch_current_brightness",
1764 ControlRequest::SetAutoBrightnessAdjustment { .. } => "set_auto_brightness_adjustment",
1765 ControlRequest::WatchAutoBrightnessAdjustment { .. } => {
1766 "watch_auto_brightness_adjustment"
1767 }
1768 ControlRequest::SetBrightnessTable { .. } => "set_brightness_table",
1769 ControlRequest::GetMaxAbsoluteBrightness { .. } => "get_max_absolute_brightness",
1770 }
1771 }
1772}
1773
1774#[derive(Debug, Clone)]
1775pub struct ControlControlHandle {
1776 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1777}
1778
1779impl fidl::endpoints::ControlHandle for ControlControlHandle {
1780 fn shutdown(&self) {
1781 self.inner.shutdown()
1782 }
1783 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1784 self.inner.shutdown_with_epitaph(status)
1785 }
1786
1787 fn is_closed(&self) -> bool {
1788 self.inner.channel().is_closed()
1789 }
1790 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1791 self.inner.channel().on_closed()
1792 }
1793
1794 #[cfg(target_os = "fuchsia")]
1795 fn signal_peer(
1796 &self,
1797 clear_mask: zx::Signals,
1798 set_mask: zx::Signals,
1799 ) -> Result<(), zx_status::Status> {
1800 use fidl::Peered;
1801 self.inner.channel().signal_peer(clear_mask, set_mask)
1802 }
1803}
1804
1805impl ControlControlHandle {}
1806
1807#[must_use = "FIDL methods require a response to be sent"]
1808#[derive(Debug)]
1809pub struct ControlWatchAutoBrightnessResponder {
1810 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1811 tx_id: u32,
1812}
1813
1814impl std::ops::Drop for ControlWatchAutoBrightnessResponder {
1818 fn drop(&mut self) {
1819 self.control_handle.shutdown();
1820 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1822 }
1823}
1824
1825impl fidl::endpoints::Responder for ControlWatchAutoBrightnessResponder {
1826 type ControlHandle = ControlControlHandle;
1827
1828 fn control_handle(&self) -> &ControlControlHandle {
1829 &self.control_handle
1830 }
1831
1832 fn drop_without_shutdown(mut self) {
1833 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1835 std::mem::forget(self);
1837 }
1838}
1839
1840impl ControlWatchAutoBrightnessResponder {
1841 pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
1845 let _result = self.send_raw(enabled);
1846 if _result.is_err() {
1847 self.control_handle.shutdown();
1848 }
1849 self.drop_without_shutdown();
1850 _result
1851 }
1852
1853 pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
1855 let _result = self.send_raw(enabled);
1856 self.drop_without_shutdown();
1857 _result
1858 }
1859
1860 fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
1861 self.control_handle.inner.send::<ControlWatchAutoBrightnessResponse>(
1862 (enabled,),
1863 self.tx_id,
1864 0xd956a90c115186b,
1865 fidl::encoding::DynamicFlags::empty(),
1866 )
1867 }
1868}
1869
1870#[must_use = "FIDL methods require a response to be sent"]
1871#[derive(Debug)]
1872pub struct ControlWatchCurrentBrightnessResponder {
1873 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1874 tx_id: u32,
1875}
1876
1877impl std::ops::Drop for ControlWatchCurrentBrightnessResponder {
1881 fn drop(&mut self) {
1882 self.control_handle.shutdown();
1883 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1885 }
1886}
1887
1888impl fidl::endpoints::Responder for ControlWatchCurrentBrightnessResponder {
1889 type ControlHandle = ControlControlHandle;
1890
1891 fn control_handle(&self) -> &ControlControlHandle {
1892 &self.control_handle
1893 }
1894
1895 fn drop_without_shutdown(mut self) {
1896 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1898 std::mem::forget(self);
1900 }
1901}
1902
1903impl ControlWatchCurrentBrightnessResponder {
1904 pub fn send(self, mut value: f32) -> Result<(), fidl::Error> {
1908 let _result = self.send_raw(value);
1909 if _result.is_err() {
1910 self.control_handle.shutdown();
1911 }
1912 self.drop_without_shutdown();
1913 _result
1914 }
1915
1916 pub fn send_no_shutdown_on_err(self, mut value: f32) -> Result<(), fidl::Error> {
1918 let _result = self.send_raw(value);
1919 self.drop_without_shutdown();
1920 _result
1921 }
1922
1923 fn send_raw(&self, mut value: f32) -> Result<(), fidl::Error> {
1924 self.control_handle.inner.send::<ControlWatchCurrentBrightnessResponse>(
1925 (value,),
1926 self.tx_id,
1927 0x2cc3011e2326d4d8,
1928 fidl::encoding::DynamicFlags::empty(),
1929 )
1930 }
1931}
1932
1933#[must_use = "FIDL methods require a response to be sent"]
1934#[derive(Debug)]
1935pub struct ControlWatchAutoBrightnessAdjustmentResponder {
1936 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1937 tx_id: u32,
1938}
1939
1940impl std::ops::Drop for ControlWatchAutoBrightnessAdjustmentResponder {
1944 fn drop(&mut self) {
1945 self.control_handle.shutdown();
1946 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1948 }
1949}
1950
1951impl fidl::endpoints::Responder for ControlWatchAutoBrightnessAdjustmentResponder {
1952 type ControlHandle = ControlControlHandle;
1953
1954 fn control_handle(&self) -> &ControlControlHandle {
1955 &self.control_handle
1956 }
1957
1958 fn drop_without_shutdown(mut self) {
1959 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1961 std::mem::forget(self);
1963 }
1964}
1965
1966impl ControlWatchAutoBrightnessAdjustmentResponder {
1967 pub fn send(self, mut adjustment: f32) -> Result<(), fidl::Error> {
1971 let _result = self.send_raw(adjustment);
1972 if _result.is_err() {
1973 self.control_handle.shutdown();
1974 }
1975 self.drop_without_shutdown();
1976 _result
1977 }
1978
1979 pub fn send_no_shutdown_on_err(self, mut adjustment: f32) -> Result<(), fidl::Error> {
1981 let _result = self.send_raw(adjustment);
1982 self.drop_without_shutdown();
1983 _result
1984 }
1985
1986 fn send_raw(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1987 self.control_handle.inner.send::<ControlWatchAutoBrightnessAdjustmentResponse>(
1988 (adjustment,),
1989 self.tx_id,
1990 0x7c373aafe0058135,
1991 fidl::encoding::DynamicFlags::empty(),
1992 )
1993 }
1994}
1995
1996#[must_use = "FIDL methods require a response to be sent"]
1997#[derive(Debug)]
1998pub struct ControlGetMaxAbsoluteBrightnessResponder {
1999 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2000 tx_id: u32,
2001}
2002
2003impl std::ops::Drop for ControlGetMaxAbsoluteBrightnessResponder {
2007 fn drop(&mut self) {
2008 self.control_handle.shutdown();
2009 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2011 }
2012}
2013
2014impl fidl::endpoints::Responder for ControlGetMaxAbsoluteBrightnessResponder {
2015 type ControlHandle = ControlControlHandle;
2016
2017 fn control_handle(&self) -> &ControlControlHandle {
2018 &self.control_handle
2019 }
2020
2021 fn drop_without_shutdown(mut self) {
2022 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2024 std::mem::forget(self);
2026 }
2027}
2028
2029impl ControlGetMaxAbsoluteBrightnessResponder {
2030 pub fn send(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
2034 let _result = self.send_raw(result);
2035 if _result.is_err() {
2036 self.control_handle.shutdown();
2037 }
2038 self.drop_without_shutdown();
2039 _result
2040 }
2041
2042 pub fn send_no_shutdown_on_err(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
2044 let _result = self.send_raw(result);
2045 self.drop_without_shutdown();
2046 _result
2047 }
2048
2049 fn send_raw(&self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
2050 self.control_handle.inner.send::<fidl::encoding::ResultType<
2051 ControlGetMaxAbsoluteBrightnessResponse,
2052 i32,
2053 >>(
2054 result.map(|max_brightness| (max_brightness,)),
2055 self.tx_id,
2056 0x73055a8d6422caf8,
2057 fidl::encoding::DynamicFlags::empty(),
2058 )
2059 }
2060}
2061
2062mod internal {
2063 use super::*;
2064}