fidl_fuchsia_ui_brightness/
fidl_fuchsia_ui_brightness.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// A normalized relative brightness adjustment in the range
14/// 0.0 (off/minimum) to 1.0 (maximum).
15pub type Brightness = f32;
16
17/// A tuple representing a point on the auto-brightness curve
18/// Ambient_lux and nits must be positive values.
19#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
20pub struct BrightnessPoint {
21    pub ambient_lux: f32,
22    pub display_nits: f32,
23}
24
25impl fidl::Persistable for BrightnessPoint {}
26
27/// A set of points defining the auto-brightness curve.
28/// The ambient_lux values must be monotonically increasing.
29#[derive(Clone, Debug, PartialEq, PartialOrd)]
30pub struct BrightnessTable {
31    pub points: Vec<BrightnessPoint>,
32}
33
34impl fidl::Persistable for BrightnessTable {}
35
36#[derive(Clone, Debug, PartialEq)]
37pub struct ColorAdjustmentHandlerSetColorAdjustmentRequest {
38    pub color_adjustment: ColorAdjustmentTable,
39}
40
41impl fidl::Persistable for ColorAdjustmentHandlerSetColorAdjustmentRequest {}
42
43#[derive(Clone, Debug, PartialEq)]
44pub struct ColorAdjustmentSetDiscreteColorAdjustmentRequest {
45    pub color_adjustment: ColorAdjustmentTable,
46}
47
48impl fidl::Persistable for ColorAdjustmentSetDiscreteColorAdjustmentRequest {}
49
50#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
51pub struct ControlSetAutoBrightnessAdjustmentRequest {
52    pub adjustment: f32,
53}
54
55impl fidl::Persistable for ControlSetAutoBrightnessAdjustmentRequest {}
56
57#[derive(Clone, Debug, PartialEq, PartialOrd)]
58pub struct ControlSetBrightnessTableRequest {
59    pub table: BrightnessTable,
60}
61
62impl fidl::Persistable for ControlSetBrightnessTableRequest {}
63
64#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
65pub struct ControlSetManualBrightnessRequest {
66    pub value: f32,
67}
68
69impl fidl::Persistable for ControlSetManualBrightnessRequest {}
70
71#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
72pub struct ControlSetManualBrightnessSmoothRequest {
73    pub value: f32,
74    pub duration: i64,
75}
76
77impl fidl::Persistable for ControlSetManualBrightnessSmoothRequest {}
78
79#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
80pub struct ControlWatchAutoBrightnessAdjustmentResponse {
81    pub adjustment: f32,
82}
83
84impl fidl::Persistable for ControlWatchAutoBrightnessAdjustmentResponse {}
85
86#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
87pub struct ControlWatchAutoBrightnessResponse {
88    pub enabled: bool,
89}
90
91impl fidl::Persistable for ControlWatchAutoBrightnessResponse {}
92
93#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
94pub struct ControlWatchCurrentBrightnessResponse {
95    pub value: f32,
96}
97
98impl fidl::Persistable for ControlWatchCurrentBrightnessResponse {}
99
100#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
101pub struct ControlGetMaxAbsoluteBrightnessResponse {
102    pub max_brightness: f64,
103}
104
105impl fidl::Persistable for ControlGetMaxAbsoluteBrightnessResponse {}
106
107/// The table for screen color tint adjustments.
108#[derive(Clone, Debug, Default, PartialEq)]
109pub struct ColorAdjustmentTable {
110    /// 3x3 Matrix in row-major form which will be used by root presenter
111    /// to apply color adjustment.
112    /// This field may be omitted to disable color adjustment.
113    pub matrix: Option<[f32; 9]>,
114    #[doc(hidden)]
115    pub __source_breaking: fidl::marker::SourceBreaking,
116}
117
118impl fidl::Persistable for ColorAdjustmentTable {}
119
120#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
121pub struct ColorAdjustmentMarker;
122
123impl fidl::endpoints::ProtocolMarker for ColorAdjustmentMarker {
124    type Proxy = ColorAdjustmentProxy;
125    type RequestStream = ColorAdjustmentRequestStream;
126    #[cfg(target_os = "fuchsia")]
127    type SynchronousProxy = ColorAdjustmentSynchronousProxy;
128
129    const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.ColorAdjustment";
130}
131impl fidl::endpoints::DiscoverableProtocolMarker for ColorAdjustmentMarker {}
132
133pub trait ColorAdjustmentProxyInterface: Send + Sync {
134    type SetDiscreteColorAdjustmentResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
135        + Send;
136    fn r#set_discrete_color_adjustment(
137        &self,
138        color_adjustment: &ColorAdjustmentTable,
139    ) -> Self::SetDiscreteColorAdjustmentResponseFut;
140}
141#[derive(Debug)]
142#[cfg(target_os = "fuchsia")]
143pub struct ColorAdjustmentSynchronousProxy {
144    client: fidl::client::sync::Client,
145}
146
147#[cfg(target_os = "fuchsia")]
148impl fidl::endpoints::SynchronousProxy for ColorAdjustmentSynchronousProxy {
149    type Proxy = ColorAdjustmentProxy;
150    type Protocol = ColorAdjustmentMarker;
151
152    fn from_channel(inner: fidl::Channel) -> Self {
153        Self::new(inner)
154    }
155
156    fn into_channel(self) -> fidl::Channel {
157        self.client.into_channel()
158    }
159
160    fn as_channel(&self) -> &fidl::Channel {
161        self.client.as_channel()
162    }
163}
164
165#[cfg(target_os = "fuchsia")]
166impl ColorAdjustmentSynchronousProxy {
167    pub fn new(channel: fidl::Channel) -> Self {
168        let protocol_name = <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
169        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
170    }
171
172    pub fn into_channel(self) -> fidl::Channel {
173        self.client.into_channel()
174    }
175
176    /// Waits until an event arrives and returns it. It is safe for other
177    /// threads to make concurrent requests while waiting for an event.
178    pub fn wait_for_event(
179        &self,
180        deadline: zx::MonotonicInstant,
181    ) -> Result<ColorAdjustmentEvent, fidl::Error> {
182        ColorAdjustmentEvent::decode(self.client.wait_for_event(deadline)?)
183    }
184
185    /// Called to change the color adjustment to a discrete value.
186    /// The server will send a response once the request has been serviced.
187    /// A client can then use this response to determine when to make
188    /// additional calls when limiting the amount of requests being sent.
189    pub fn r#set_discrete_color_adjustment(
190        &self,
191        mut color_adjustment: &ColorAdjustmentTable,
192        ___deadline: zx::MonotonicInstant,
193    ) -> Result<(), fidl::Error> {
194        let _response = self.client.send_query::<
195            ColorAdjustmentSetDiscreteColorAdjustmentRequest,
196            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
197        >(
198            (color_adjustment,),
199            0x48d90d2e62d451c4,
200            fidl::encoding::DynamicFlags::FLEXIBLE,
201            ___deadline,
202        )?
203        .into_result::<ColorAdjustmentMarker>("set_discrete_color_adjustment")?;
204        Ok(_response)
205    }
206}
207
208#[derive(Debug, Clone)]
209pub struct ColorAdjustmentProxy {
210    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
211}
212
213impl fidl::endpoints::Proxy for ColorAdjustmentProxy {
214    type Protocol = ColorAdjustmentMarker;
215
216    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
217        Self::new(inner)
218    }
219
220    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
221        self.client.into_channel().map_err(|client| Self { client })
222    }
223
224    fn as_channel(&self) -> &::fidl::AsyncChannel {
225        self.client.as_channel()
226    }
227}
228
229impl ColorAdjustmentProxy {
230    /// Create a new Proxy for fuchsia.ui.brightness/ColorAdjustment.
231    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
232        let protocol_name = <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
233        Self { client: fidl::client::Client::new(channel, protocol_name) }
234    }
235
236    /// Get a Stream of events from the remote end of the protocol.
237    ///
238    /// # Panics
239    ///
240    /// Panics if the event stream was already taken.
241    pub fn take_event_stream(&self) -> ColorAdjustmentEventStream {
242        ColorAdjustmentEventStream { event_receiver: self.client.take_event_receiver() }
243    }
244
245    /// Called to change the color adjustment to a discrete value.
246    /// The server will send a response once the request has been serviced.
247    /// A client can then use this response to determine when to make
248    /// additional calls when limiting the amount of requests being sent.
249    pub fn r#set_discrete_color_adjustment(
250        &self,
251        mut color_adjustment: &ColorAdjustmentTable,
252    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
253        ColorAdjustmentProxyInterface::r#set_discrete_color_adjustment(self, color_adjustment)
254    }
255}
256
257impl ColorAdjustmentProxyInterface for ColorAdjustmentProxy {
258    type SetDiscreteColorAdjustmentResponseFut =
259        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
260    fn r#set_discrete_color_adjustment(
261        &self,
262        mut color_adjustment: &ColorAdjustmentTable,
263    ) -> Self::SetDiscreteColorAdjustmentResponseFut {
264        fn _decode(
265            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
266        ) -> Result<(), fidl::Error> {
267            let _response = fidl::client::decode_transaction_body::<
268                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
269                fidl::encoding::DefaultFuchsiaResourceDialect,
270                0x48d90d2e62d451c4,
271            >(_buf?)?
272            .into_result::<ColorAdjustmentMarker>("set_discrete_color_adjustment")?;
273            Ok(_response)
274        }
275        self.client.send_query_and_decode::<ColorAdjustmentSetDiscreteColorAdjustmentRequest, ()>(
276            (color_adjustment,),
277            0x48d90d2e62d451c4,
278            fidl::encoding::DynamicFlags::FLEXIBLE,
279            _decode,
280        )
281    }
282}
283
284pub struct ColorAdjustmentEventStream {
285    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
286}
287
288impl std::marker::Unpin for ColorAdjustmentEventStream {}
289
290impl futures::stream::FusedStream for ColorAdjustmentEventStream {
291    fn is_terminated(&self) -> bool {
292        self.event_receiver.is_terminated()
293    }
294}
295
296impl futures::Stream for ColorAdjustmentEventStream {
297    type Item = Result<ColorAdjustmentEvent, fidl::Error>;
298
299    fn poll_next(
300        mut self: std::pin::Pin<&mut Self>,
301        cx: &mut std::task::Context<'_>,
302    ) -> std::task::Poll<Option<Self::Item>> {
303        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
304            &mut self.event_receiver,
305            cx
306        )?) {
307            Some(buf) => std::task::Poll::Ready(Some(ColorAdjustmentEvent::decode(buf))),
308            None => std::task::Poll::Ready(None),
309        }
310    }
311}
312
313#[derive(Debug)]
314pub enum ColorAdjustmentEvent {
315    #[non_exhaustive]
316    _UnknownEvent {
317        /// Ordinal of the event that was sent.
318        ordinal: u64,
319    },
320}
321
322impl ColorAdjustmentEvent {
323    /// Decodes a message buffer as a [`ColorAdjustmentEvent`].
324    fn decode(
325        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
326    ) -> Result<ColorAdjustmentEvent, fidl::Error> {
327        let (bytes, _handles) = buf.split_mut();
328        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
329        debug_assert_eq!(tx_header.tx_id, 0);
330        match tx_header.ordinal {
331            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
332                Ok(ColorAdjustmentEvent::_UnknownEvent { ordinal: tx_header.ordinal })
333            }
334            _ => Err(fidl::Error::UnknownOrdinal {
335                ordinal: tx_header.ordinal,
336                protocol_name:
337                    <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
338            }),
339        }
340    }
341}
342
343/// A Stream of incoming requests for fuchsia.ui.brightness/ColorAdjustment.
344pub struct ColorAdjustmentRequestStream {
345    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
346    is_terminated: bool,
347}
348
349impl std::marker::Unpin for ColorAdjustmentRequestStream {}
350
351impl futures::stream::FusedStream for ColorAdjustmentRequestStream {
352    fn is_terminated(&self) -> bool {
353        self.is_terminated
354    }
355}
356
357impl fidl::endpoints::RequestStream for ColorAdjustmentRequestStream {
358    type Protocol = ColorAdjustmentMarker;
359    type ControlHandle = ColorAdjustmentControlHandle;
360
361    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
362        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
363    }
364
365    fn control_handle(&self) -> Self::ControlHandle {
366        ColorAdjustmentControlHandle { inner: self.inner.clone() }
367    }
368
369    fn into_inner(
370        self,
371    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
372    {
373        (self.inner, self.is_terminated)
374    }
375
376    fn from_inner(
377        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
378        is_terminated: bool,
379    ) -> Self {
380        Self { inner, is_terminated }
381    }
382}
383
384impl futures::Stream for ColorAdjustmentRequestStream {
385    type Item = Result<ColorAdjustmentRequest, fidl::Error>;
386
387    fn poll_next(
388        mut self: std::pin::Pin<&mut Self>,
389        cx: &mut std::task::Context<'_>,
390    ) -> std::task::Poll<Option<Self::Item>> {
391        let this = &mut *self;
392        if this.inner.check_shutdown(cx) {
393            this.is_terminated = true;
394            return std::task::Poll::Ready(None);
395        }
396        if this.is_terminated {
397            panic!("polled ColorAdjustmentRequestStream after completion");
398        }
399        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
400            |bytes, handles| {
401                match this.inner.channel().read_etc(cx, bytes, handles) {
402                    std::task::Poll::Ready(Ok(())) => {}
403                    std::task::Poll::Pending => return std::task::Poll::Pending,
404                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
405                        this.is_terminated = true;
406                        return std::task::Poll::Ready(None);
407                    }
408                    std::task::Poll::Ready(Err(e)) => {
409                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
410                            e.into(),
411                        ))))
412                    }
413                }
414
415                // A message has been received from the channel
416                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
417
418                std::task::Poll::Ready(Some(match header.ordinal {
419                    0x48d90d2e62d451c4 => {
420                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
421                        let mut req = fidl::new_empty!(
422                            ColorAdjustmentSetDiscreteColorAdjustmentRequest,
423                            fidl::encoding::DefaultFuchsiaResourceDialect
424                        );
425                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
426                        let control_handle =
427                            ColorAdjustmentControlHandle { inner: this.inner.clone() };
428                        Ok(ColorAdjustmentRequest::SetDiscreteColorAdjustment {
429                            color_adjustment: req.color_adjustment,
430
431                            responder: ColorAdjustmentSetDiscreteColorAdjustmentResponder {
432                                control_handle: std::mem::ManuallyDrop::new(control_handle),
433                                tx_id: header.tx_id,
434                            },
435                        })
436                    }
437                    _ if header.tx_id == 0
438                        && header
439                            .dynamic_flags()
440                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
441                    {
442                        Ok(ColorAdjustmentRequest::_UnknownMethod {
443                            ordinal: header.ordinal,
444                            control_handle: ColorAdjustmentControlHandle {
445                                inner: this.inner.clone(),
446                            },
447                            method_type: fidl::MethodType::OneWay,
448                        })
449                    }
450                    _ if header
451                        .dynamic_flags()
452                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
453                    {
454                        this.inner.send_framework_err(
455                            fidl::encoding::FrameworkErr::UnknownMethod,
456                            header.tx_id,
457                            header.ordinal,
458                            header.dynamic_flags(),
459                            (bytes, handles),
460                        )?;
461                        Ok(ColorAdjustmentRequest::_UnknownMethod {
462                            ordinal: header.ordinal,
463                            control_handle: ColorAdjustmentControlHandle {
464                                inner: this.inner.clone(),
465                            },
466                            method_type: fidl::MethodType::TwoWay,
467                        })
468                    }
469                    _ => Err(fidl::Error::UnknownOrdinal {
470                        ordinal: header.ordinal,
471                        protocol_name:
472                            <ColorAdjustmentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
473                    }),
474                }))
475            },
476        )
477    }
478}
479
480/// Allows clients to request changes to the screen's color adjustment matrix.
481/// This protocol should be implemented and served by the owner of screen presentation.
482#[derive(Debug)]
483pub enum ColorAdjustmentRequest {
484    /// Called to change the color adjustment to a discrete value.
485    /// The server will send a response once the request has been serviced.
486    /// A client can then use this response to determine when to make
487    /// additional calls when limiting the amount of requests being sent.
488    SetDiscreteColorAdjustment {
489        color_adjustment: ColorAdjustmentTable,
490        responder: ColorAdjustmentSetDiscreteColorAdjustmentResponder,
491    },
492    /// An interaction was received which does not match any known method.
493    #[non_exhaustive]
494    _UnknownMethod {
495        /// Ordinal of the method that was called.
496        ordinal: u64,
497        control_handle: ColorAdjustmentControlHandle,
498        method_type: fidl::MethodType,
499    },
500}
501
502impl ColorAdjustmentRequest {
503    #[allow(irrefutable_let_patterns)]
504    pub fn into_set_discrete_color_adjustment(
505        self,
506    ) -> Option<(ColorAdjustmentTable, ColorAdjustmentSetDiscreteColorAdjustmentResponder)> {
507        if let ColorAdjustmentRequest::SetDiscreteColorAdjustment { color_adjustment, responder } =
508            self
509        {
510            Some((color_adjustment, responder))
511        } else {
512            None
513        }
514    }
515
516    /// Name of the method defined in FIDL
517    pub fn method_name(&self) -> &'static str {
518        match *self {
519            ColorAdjustmentRequest::SetDiscreteColorAdjustment { .. } => {
520                "set_discrete_color_adjustment"
521            }
522            ColorAdjustmentRequest::_UnknownMethod {
523                method_type: fidl::MethodType::OneWay,
524                ..
525            } => "unknown one-way method",
526            ColorAdjustmentRequest::_UnknownMethod {
527                method_type: fidl::MethodType::TwoWay,
528                ..
529            } => "unknown two-way method",
530        }
531    }
532}
533
534#[derive(Debug, Clone)]
535pub struct ColorAdjustmentControlHandle {
536    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
537}
538
539impl fidl::endpoints::ControlHandle for ColorAdjustmentControlHandle {
540    fn shutdown(&self) {
541        self.inner.shutdown()
542    }
543    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
544        self.inner.shutdown_with_epitaph(status)
545    }
546
547    fn is_closed(&self) -> bool {
548        self.inner.channel().is_closed()
549    }
550    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
551        self.inner.channel().on_closed()
552    }
553
554    #[cfg(target_os = "fuchsia")]
555    fn signal_peer(
556        &self,
557        clear_mask: zx::Signals,
558        set_mask: zx::Signals,
559    ) -> Result<(), zx_status::Status> {
560        use fidl::Peered;
561        self.inner.channel().signal_peer(clear_mask, set_mask)
562    }
563}
564
565impl ColorAdjustmentControlHandle {}
566
567#[must_use = "FIDL methods require a response to be sent"]
568#[derive(Debug)]
569pub struct ColorAdjustmentSetDiscreteColorAdjustmentResponder {
570    control_handle: std::mem::ManuallyDrop<ColorAdjustmentControlHandle>,
571    tx_id: u32,
572}
573
574/// Set the the channel to be shutdown (see [`ColorAdjustmentControlHandle::shutdown`])
575/// if the responder is dropped without sending a response, so that the client
576/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
577impl std::ops::Drop for ColorAdjustmentSetDiscreteColorAdjustmentResponder {
578    fn drop(&mut self) {
579        self.control_handle.shutdown();
580        // Safety: drops once, never accessed again
581        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
582    }
583}
584
585impl fidl::endpoints::Responder for ColorAdjustmentSetDiscreteColorAdjustmentResponder {
586    type ControlHandle = ColorAdjustmentControlHandle;
587
588    fn control_handle(&self) -> &ColorAdjustmentControlHandle {
589        &self.control_handle
590    }
591
592    fn drop_without_shutdown(mut self) {
593        // Safety: drops once, never accessed again due to mem::forget
594        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
595        // Prevent Drop from running (which would shut down the channel)
596        std::mem::forget(self);
597    }
598}
599
600impl ColorAdjustmentSetDiscreteColorAdjustmentResponder {
601    /// Sends a response to the FIDL transaction.
602    ///
603    /// Sets the channel to shutdown if an error occurs.
604    pub fn send(self) -> Result<(), fidl::Error> {
605        let _result = self.send_raw();
606        if _result.is_err() {
607            self.control_handle.shutdown();
608        }
609        self.drop_without_shutdown();
610        _result
611    }
612
613    /// Similar to "send" but does not shutdown the channel if an error occurs.
614    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
615        let _result = self.send_raw();
616        self.drop_without_shutdown();
617        _result
618    }
619
620    fn send_raw(&self) -> Result<(), fidl::Error> {
621        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
622            fidl::encoding::Flexible::new(()),
623            self.tx_id,
624            0x48d90d2e62d451c4,
625            fidl::encoding::DynamicFlags::FLEXIBLE,
626        )
627    }
628}
629
630#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
631pub struct ColorAdjustmentHandlerMarker;
632
633impl fidl::endpoints::ProtocolMarker for ColorAdjustmentHandlerMarker {
634    type Proxy = ColorAdjustmentHandlerProxy;
635    type RequestStream = ColorAdjustmentHandlerRequestStream;
636    #[cfg(target_os = "fuchsia")]
637    type SynchronousProxy = ColorAdjustmentHandlerSynchronousProxy;
638
639    const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.ColorAdjustmentHandler";
640}
641impl fidl::endpoints::DiscoverableProtocolMarker for ColorAdjustmentHandlerMarker {}
642
643pub trait ColorAdjustmentHandlerProxyInterface: Send + Sync {
644    fn r#set_color_adjustment(
645        &self,
646        color_adjustment: &ColorAdjustmentTable,
647    ) -> Result<(), fidl::Error>;
648}
649#[derive(Debug)]
650#[cfg(target_os = "fuchsia")]
651pub struct ColorAdjustmentHandlerSynchronousProxy {
652    client: fidl::client::sync::Client,
653}
654
655#[cfg(target_os = "fuchsia")]
656impl fidl::endpoints::SynchronousProxy for ColorAdjustmentHandlerSynchronousProxy {
657    type Proxy = ColorAdjustmentHandlerProxy;
658    type Protocol = ColorAdjustmentHandlerMarker;
659
660    fn from_channel(inner: fidl::Channel) -> Self {
661        Self::new(inner)
662    }
663
664    fn into_channel(self) -> fidl::Channel {
665        self.client.into_channel()
666    }
667
668    fn as_channel(&self) -> &fidl::Channel {
669        self.client.as_channel()
670    }
671}
672
673#[cfg(target_os = "fuchsia")]
674impl ColorAdjustmentHandlerSynchronousProxy {
675    pub fn new(channel: fidl::Channel) -> Self {
676        let protocol_name =
677            <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
678        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
679    }
680
681    pub fn into_channel(self) -> fidl::Channel {
682        self.client.into_channel()
683    }
684
685    /// Waits until an event arrives and returns it. It is safe for other
686    /// threads to make concurrent requests while waiting for an event.
687    pub fn wait_for_event(
688        &self,
689        deadline: zx::MonotonicInstant,
690    ) -> Result<ColorAdjustmentHandlerEvent, fidl::Error> {
691        ColorAdjustmentHandlerEvent::decode(self.client.wait_for_event(deadline)?)
692    }
693
694    /// Called when the color adjustment  has changed.
695    pub fn r#set_color_adjustment(
696        &self,
697        mut color_adjustment: &ColorAdjustmentTable,
698    ) -> Result<(), fidl::Error> {
699        self.client.send::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(
700            (color_adjustment,),
701            0x6277992fee8aea3d,
702            fidl::encoding::DynamicFlags::empty(),
703        )
704    }
705}
706
707#[derive(Debug, Clone)]
708pub struct ColorAdjustmentHandlerProxy {
709    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
710}
711
712impl fidl::endpoints::Proxy for ColorAdjustmentHandlerProxy {
713    type Protocol = ColorAdjustmentHandlerMarker;
714
715    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
716        Self::new(inner)
717    }
718
719    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
720        self.client.into_channel().map_err(|client| Self { client })
721    }
722
723    fn as_channel(&self) -> &::fidl::AsyncChannel {
724        self.client.as_channel()
725    }
726}
727
728impl ColorAdjustmentHandlerProxy {
729    /// Create a new Proxy for fuchsia.ui.brightness/ColorAdjustmentHandler.
730    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
731        let protocol_name =
732            <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
733        Self { client: fidl::client::Client::new(channel, protocol_name) }
734    }
735
736    /// Get a Stream of events from the remote end of the protocol.
737    ///
738    /// # Panics
739    ///
740    /// Panics if the event stream was already taken.
741    pub fn take_event_stream(&self) -> ColorAdjustmentHandlerEventStream {
742        ColorAdjustmentHandlerEventStream { event_receiver: self.client.take_event_receiver() }
743    }
744
745    /// Called when the color adjustment  has changed.
746    pub fn r#set_color_adjustment(
747        &self,
748        mut color_adjustment: &ColorAdjustmentTable,
749    ) -> Result<(), fidl::Error> {
750        ColorAdjustmentHandlerProxyInterface::r#set_color_adjustment(self, color_adjustment)
751    }
752}
753
754impl ColorAdjustmentHandlerProxyInterface for ColorAdjustmentHandlerProxy {
755    fn r#set_color_adjustment(
756        &self,
757        mut color_adjustment: &ColorAdjustmentTable,
758    ) -> Result<(), fidl::Error> {
759        self.client.send::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(
760            (color_adjustment,),
761            0x6277992fee8aea3d,
762            fidl::encoding::DynamicFlags::empty(),
763        )
764    }
765}
766
767pub struct ColorAdjustmentHandlerEventStream {
768    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
769}
770
771impl std::marker::Unpin for ColorAdjustmentHandlerEventStream {}
772
773impl futures::stream::FusedStream for ColorAdjustmentHandlerEventStream {
774    fn is_terminated(&self) -> bool {
775        self.event_receiver.is_terminated()
776    }
777}
778
779impl futures::Stream for ColorAdjustmentHandlerEventStream {
780    type Item = Result<ColorAdjustmentHandlerEvent, fidl::Error>;
781
782    fn poll_next(
783        mut self: std::pin::Pin<&mut Self>,
784        cx: &mut std::task::Context<'_>,
785    ) -> std::task::Poll<Option<Self::Item>> {
786        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
787            &mut self.event_receiver,
788            cx
789        )?) {
790            Some(buf) => std::task::Poll::Ready(Some(ColorAdjustmentHandlerEvent::decode(buf))),
791            None => std::task::Poll::Ready(None),
792        }
793    }
794}
795
796#[derive(Debug)]
797pub enum ColorAdjustmentHandlerEvent {}
798
799impl ColorAdjustmentHandlerEvent {
800    /// Decodes a message buffer as a [`ColorAdjustmentHandlerEvent`].
801    fn decode(
802        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
803    ) -> Result<ColorAdjustmentHandlerEvent, fidl::Error> {
804        let (bytes, _handles) = buf.split_mut();
805        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
806        debug_assert_eq!(tx_header.tx_id, 0);
807        match tx_header.ordinal {
808            _ => Err(fidl::Error::UnknownOrdinal {
809                ordinal: tx_header.ordinal,
810                protocol_name:
811                    <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
812            }),
813        }
814    }
815}
816
817/// A Stream of incoming requests for fuchsia.ui.brightness/ColorAdjustmentHandler.
818pub struct ColorAdjustmentHandlerRequestStream {
819    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
820    is_terminated: bool,
821}
822
823impl std::marker::Unpin for ColorAdjustmentHandlerRequestStream {}
824
825impl futures::stream::FusedStream for ColorAdjustmentHandlerRequestStream {
826    fn is_terminated(&self) -> bool {
827        self.is_terminated
828    }
829}
830
831impl fidl::endpoints::RequestStream for ColorAdjustmentHandlerRequestStream {
832    type Protocol = ColorAdjustmentHandlerMarker;
833    type ControlHandle = ColorAdjustmentHandlerControlHandle;
834
835    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
836        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
837    }
838
839    fn control_handle(&self) -> Self::ControlHandle {
840        ColorAdjustmentHandlerControlHandle { inner: self.inner.clone() }
841    }
842
843    fn into_inner(
844        self,
845    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
846    {
847        (self.inner, self.is_terminated)
848    }
849
850    fn from_inner(
851        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
852        is_terminated: bool,
853    ) -> Self {
854        Self { inner, is_terminated }
855    }
856}
857
858impl futures::Stream for ColorAdjustmentHandlerRequestStream {
859    type Item = Result<ColorAdjustmentHandlerRequest, fidl::Error>;
860
861    fn poll_next(
862        mut self: std::pin::Pin<&mut Self>,
863        cx: &mut std::task::Context<'_>,
864    ) -> std::task::Poll<Option<Self::Item>> {
865        let this = &mut *self;
866        if this.inner.check_shutdown(cx) {
867            this.is_terminated = true;
868            return std::task::Poll::Ready(None);
869        }
870        if this.is_terminated {
871            panic!("polled ColorAdjustmentHandlerRequestStream after completion");
872        }
873        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
874            |bytes, handles| {
875                match this.inner.channel().read_etc(cx, bytes, handles) {
876                    std::task::Poll::Ready(Ok(())) => {}
877                    std::task::Poll::Pending => return std::task::Poll::Pending,
878                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
879                        this.is_terminated = true;
880                        return std::task::Poll::Ready(None);
881                    }
882                    std::task::Poll::Ready(Err(e)) => {
883                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
884                            e.into(),
885                        ))))
886                    }
887                }
888
889                // A message has been received from the channel
890                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
891
892                std::task::Poll::Ready(Some(match header.ordinal {
893                0x6277992fee8aea3d => {
894                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
895                    let mut req = fidl::new_empty!(ColorAdjustmentHandlerSetColorAdjustmentRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
896                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
897                    let control_handle = ColorAdjustmentHandlerControlHandle {
898                        inner: this.inner.clone(),
899                    };
900                    Ok(ColorAdjustmentHandlerRequest::SetColorAdjustment {color_adjustment: req.color_adjustment,
901
902                        control_handle,
903                    })
904                }
905                _ => Err(fidl::Error::UnknownOrdinal {
906                    ordinal: header.ordinal,
907                    protocol_name: <ColorAdjustmentHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
908                }),
909            }))
910            },
911        )
912    }
913}
914
915/// Handler implemented by the owner of the presentation.
916/// The UI component that controls brightness and screen tint uses this protocol to request changes
917/// to the screen's color adjustment matrix.
918#[derive(Debug)]
919pub enum ColorAdjustmentHandlerRequest {
920    /// Called when the color adjustment  has changed.
921    SetColorAdjustment {
922        color_adjustment: ColorAdjustmentTable,
923        control_handle: ColorAdjustmentHandlerControlHandle,
924    },
925}
926
927impl ColorAdjustmentHandlerRequest {
928    #[allow(irrefutable_let_patterns)]
929    pub fn into_set_color_adjustment(
930        self,
931    ) -> Option<(ColorAdjustmentTable, ColorAdjustmentHandlerControlHandle)> {
932        if let ColorAdjustmentHandlerRequest::SetColorAdjustment {
933            color_adjustment,
934            control_handle,
935        } = self
936        {
937            Some((color_adjustment, control_handle))
938        } else {
939            None
940        }
941    }
942
943    /// Name of the method defined in FIDL
944    pub fn method_name(&self) -> &'static str {
945        match *self {
946            ColorAdjustmentHandlerRequest::SetColorAdjustment { .. } => "set_color_adjustment",
947        }
948    }
949}
950
951#[derive(Debug, Clone)]
952pub struct ColorAdjustmentHandlerControlHandle {
953    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
954}
955
956impl fidl::endpoints::ControlHandle for ColorAdjustmentHandlerControlHandle {
957    fn shutdown(&self) {
958        self.inner.shutdown()
959    }
960    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
961        self.inner.shutdown_with_epitaph(status)
962    }
963
964    fn is_closed(&self) -> bool {
965        self.inner.channel().is_closed()
966    }
967    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
968        self.inner.channel().on_closed()
969    }
970
971    #[cfg(target_os = "fuchsia")]
972    fn signal_peer(
973        &self,
974        clear_mask: zx::Signals,
975        set_mask: zx::Signals,
976    ) -> Result<(), zx_status::Status> {
977        use fidl::Peered;
978        self.inner.channel().signal_peer(clear_mask, set_mask)
979    }
980}
981
982impl ColorAdjustmentHandlerControlHandle {}
983
984#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
985pub struct ControlMarker;
986
987impl fidl::endpoints::ProtocolMarker for ControlMarker {
988    type Proxy = ControlProxy;
989    type RequestStream = ControlRequestStream;
990    #[cfg(target_os = "fuchsia")]
991    type SynchronousProxy = ControlSynchronousProxy;
992
993    const DEBUG_NAME: &'static str = "fuchsia.ui.brightness.Control";
994}
995impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
996pub type ControlGetMaxAbsoluteBrightnessResult = Result<f64, i32>;
997
998pub trait ControlProxyInterface: Send + Sync {
999    fn r#set_auto_brightness(&self) -> Result<(), fidl::Error>;
1000    type WatchAutoBrightnessResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
1001        + Send;
1002    fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut;
1003    fn r#set_manual_brightness(&self, value: f32) -> Result<(), fidl::Error>;
1004    fn r#set_manual_brightness_smooth(&self, value: f32, duration: i64) -> Result<(), fidl::Error>;
1005    type WatchCurrentBrightnessResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
1006        + Send;
1007    fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut;
1008    fn r#set_auto_brightness_adjustment(&self, adjustment: f32) -> Result<(), fidl::Error>;
1009    type WatchAutoBrightnessAdjustmentResponseFut: std::future::Future<Output = Result<f32, fidl::Error>>
1010        + Send;
1011    fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut;
1012    fn r#set_brightness_table(&self, table: &BrightnessTable) -> Result<(), fidl::Error>;
1013    type GetMaxAbsoluteBrightnessResponseFut: std::future::Future<Output = Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error>>
1014        + Send;
1015    fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut;
1016}
1017#[derive(Debug)]
1018#[cfg(target_os = "fuchsia")]
1019pub struct ControlSynchronousProxy {
1020    client: fidl::client::sync::Client,
1021}
1022
1023#[cfg(target_os = "fuchsia")]
1024impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
1025    type Proxy = ControlProxy;
1026    type Protocol = ControlMarker;
1027
1028    fn from_channel(inner: fidl::Channel) -> Self {
1029        Self::new(inner)
1030    }
1031
1032    fn into_channel(self) -> fidl::Channel {
1033        self.client.into_channel()
1034    }
1035
1036    fn as_channel(&self) -> &fidl::Channel {
1037        self.client.as_channel()
1038    }
1039}
1040
1041#[cfg(target_os = "fuchsia")]
1042impl ControlSynchronousProxy {
1043    pub fn new(channel: fidl::Channel) -> Self {
1044        let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1045        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1046    }
1047
1048    pub fn into_channel(self) -> fidl::Channel {
1049        self.client.into_channel()
1050    }
1051
1052    /// Waits until an event arrives and returns it. It is safe for other
1053    /// threads to make concurrent requests while waiting for an event.
1054    pub fn wait_for_event(
1055        &self,
1056        deadline: zx::MonotonicInstant,
1057    ) -> Result<ControlEvent, fidl::Error> {
1058        ControlEvent::decode(self.client.wait_for_event(deadline)?)
1059    }
1060
1061    /// Turns the auto-brightness mode on.
1062    /// SetManualBrightness will turn it off.
1063    pub fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
1064        self.client.send::<fidl::encoding::EmptyPayload>(
1065            (),
1066            0x46b623a7fa77a979,
1067            fidl::encoding::DynamicFlags::empty(),
1068        )
1069    }
1070
1071    /// Requests the current auto-brightness mode.
1072    /// This call implements the Hanging Get protocol.
1073    pub fn r#watch_auto_brightness(
1074        &self,
1075        ___deadline: zx::MonotonicInstant,
1076    ) -> Result<bool, fidl::Error> {
1077        let _response = self
1078            .client
1079            .send_query::<fidl::encoding::EmptyPayload, ControlWatchAutoBrightnessResponse>(
1080                (),
1081                0xd956a90c115186b,
1082                fidl::encoding::DynamicFlags::empty(),
1083                ___deadline,
1084            )?;
1085        Ok(_response.enabled)
1086    }
1087
1088    /// Turns auto-brightness mode off.
1089    /// Used by e.g. Settings to set manual brightness using a slider
1090    /// Value is in the range 0.0 to 1.0 representing min to max and
1091    /// will be clamped if out of range.
1092    pub fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
1093        self.client.send::<ControlSetManualBrightnessRequest>(
1094            (value,),
1095            0x1e333aa49771e1eb,
1096            fidl::encoding::DynamicFlags::empty(),
1097        )
1098    }
1099
1100    /// Set manual brightness specifying the duration over which the
1101    /// target brightness will be set.
1102    pub fn r#set_manual_brightness_smooth(
1103        &self,
1104        mut value: f32,
1105        mut duration: i64,
1106    ) -> Result<(), fidl::Error> {
1107        self.client.send::<ControlSetManualBrightnessSmoothRequest>(
1108            (value, duration),
1109            0x7b7d273c20a61d0c,
1110            fidl::encoding::DynamicFlags::empty(),
1111        )
1112    }
1113
1114    /// Gets the current brightness in the range 0.0 to 1.0.
1115    /// This result is valid for both manual and auto-brightness modes
1116    /// and is typically used to show the current brightness on a slider.
1117    /// This call implements the Hanging Get protocol.
1118    pub fn r#watch_current_brightness(
1119        &self,
1120        ___deadline: zx::MonotonicInstant,
1121    ) -> Result<f32, fidl::Error> {
1122        let _response = self
1123            .client
1124            .send_query::<fidl::encoding::EmptyPayload, ControlWatchCurrentBrightnessResponse>(
1125                (),
1126                0x2cc3011e2326d4d8,
1127                fidl::encoding::DynamicFlags::empty(),
1128                ___deadline,
1129            )?;
1130        Ok(_response.value)
1131    }
1132
1133    /// Sets the brightness adjustment.
1134    /// This will change the brightness curve by the factor of the adjustment.
1135    /// The adjustment is in the range of -1.0 to 1.0.
1136    pub fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1137        self.client.send::<ControlSetAutoBrightnessAdjustmentRequest>(
1138            (adjustment,),
1139            0x678ee26bc217d996,
1140            fidl::encoding::DynamicFlags::empty(),
1141        )
1142    }
1143
1144    /// Gets the current auto brightness adjustment.
1145    /// This call implements the Hanging Get protocol.
1146    pub fn r#watch_auto_brightness_adjustment(
1147        &self,
1148        ___deadline: zx::MonotonicInstant,
1149    ) -> Result<f32, fidl::Error> {
1150        let _response = self.client.send_query::<
1151            fidl::encoding::EmptyPayload,
1152            ControlWatchAutoBrightnessAdjustmentResponse,
1153        >(
1154            (),
1155            0x7c373aafe0058135,
1156            fidl::encoding::DynamicFlags::empty(),
1157            ___deadline,
1158        )?;
1159        Ok(_response.adjustment)
1160    }
1161
1162    /// Sets the brightness curve as a set of points.
1163    /// This will override the built-in brightness curve.
1164    /// The default brightness curve will be used if the table is empty.
1165    /// The connection will be closed if table errors are detected.
1166    pub fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
1167        self.client.send::<ControlSetBrightnessTableRequest>(
1168            (table,),
1169            0x11d419413129dcee,
1170            fidl::encoding::DynamicFlags::empty(),
1171        )
1172    }
1173
1174    /// Gets the maximum supported backlight brightness in nits, if known.
1175    pub fn r#get_max_absolute_brightness(
1176        &self,
1177        ___deadline: zx::MonotonicInstant,
1178    ) -> Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error> {
1179        let _response = self.client.send_query::<
1180            fidl::encoding::EmptyPayload,
1181            fidl::encoding::ResultType<ControlGetMaxAbsoluteBrightnessResponse, i32>,
1182        >(
1183            (),
1184            0x73055a8d6422caf8,
1185            fidl::encoding::DynamicFlags::empty(),
1186            ___deadline,
1187        )?;
1188        Ok(_response.map(|x| x.max_brightness))
1189    }
1190}
1191
1192#[derive(Debug, Clone)]
1193pub struct ControlProxy {
1194    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1195}
1196
1197impl fidl::endpoints::Proxy for ControlProxy {
1198    type Protocol = ControlMarker;
1199
1200    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1201        Self::new(inner)
1202    }
1203
1204    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1205        self.client.into_channel().map_err(|client| Self { client })
1206    }
1207
1208    fn as_channel(&self) -> &::fidl::AsyncChannel {
1209        self.client.as_channel()
1210    }
1211}
1212
1213impl ControlProxy {
1214    /// Create a new Proxy for fuchsia.ui.brightness/Control.
1215    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1216        let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1217        Self { client: fidl::client::Client::new(channel, protocol_name) }
1218    }
1219
1220    /// Get a Stream of events from the remote end of the protocol.
1221    ///
1222    /// # Panics
1223    ///
1224    /// Panics if the event stream was already taken.
1225    pub fn take_event_stream(&self) -> ControlEventStream {
1226        ControlEventStream { event_receiver: self.client.take_event_receiver() }
1227    }
1228
1229    /// Turns the auto-brightness mode on.
1230    /// SetManualBrightness will turn it off.
1231    pub fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
1232        ControlProxyInterface::r#set_auto_brightness(self)
1233    }
1234
1235    /// Requests the current auto-brightness mode.
1236    /// This call implements the Hanging Get protocol.
1237    pub fn r#watch_auto_brightness(
1238        &self,
1239    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
1240        ControlProxyInterface::r#watch_auto_brightness(self)
1241    }
1242
1243    /// Turns auto-brightness mode off.
1244    /// Used by e.g. Settings to set manual brightness using a slider
1245    /// Value is in the range 0.0 to 1.0 representing min to max and
1246    /// will be clamped if out of range.
1247    pub fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
1248        ControlProxyInterface::r#set_manual_brightness(self, value)
1249    }
1250
1251    /// Set manual brightness specifying the duration over which the
1252    /// target brightness will be set.
1253    pub fn r#set_manual_brightness_smooth(
1254        &self,
1255        mut value: f32,
1256        mut duration: i64,
1257    ) -> Result<(), fidl::Error> {
1258        ControlProxyInterface::r#set_manual_brightness_smooth(self, value, duration)
1259    }
1260
1261    /// Gets the current brightness in the range 0.0 to 1.0.
1262    /// This result is valid for both manual and auto-brightness modes
1263    /// and is typically used to show the current brightness on a slider.
1264    /// This call implements the Hanging Get protocol.
1265    pub fn r#watch_current_brightness(
1266        &self,
1267    ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1268        ControlProxyInterface::r#watch_current_brightness(self)
1269    }
1270
1271    /// Sets the brightness adjustment.
1272    /// This will change the brightness curve by the factor of the adjustment.
1273    /// The adjustment is in the range of -1.0 to 1.0.
1274    pub fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1275        ControlProxyInterface::r#set_auto_brightness_adjustment(self, adjustment)
1276    }
1277
1278    /// Gets the current auto brightness adjustment.
1279    /// This call implements the Hanging Get protocol.
1280    pub fn r#watch_auto_brightness_adjustment(
1281        &self,
1282    ) -> fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1283        ControlProxyInterface::r#watch_auto_brightness_adjustment(self)
1284    }
1285
1286    /// Sets the brightness curve as a set of points.
1287    /// This will override the built-in brightness curve.
1288    /// The default brightness curve will be used if the table is empty.
1289    /// The connection will be closed if table errors are detected.
1290    pub fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
1291        ControlProxyInterface::r#set_brightness_table(self, table)
1292    }
1293
1294    /// Gets the maximum supported backlight brightness in nits, if known.
1295    pub fn r#get_max_absolute_brightness(
1296        &self,
1297    ) -> fidl::client::QueryResponseFut<
1298        ControlGetMaxAbsoluteBrightnessResult,
1299        fidl::encoding::DefaultFuchsiaResourceDialect,
1300    > {
1301        ControlProxyInterface::r#get_max_absolute_brightness(self)
1302    }
1303}
1304
1305impl ControlProxyInterface for ControlProxy {
1306    fn r#set_auto_brightness(&self) -> Result<(), fidl::Error> {
1307        self.client.send::<fidl::encoding::EmptyPayload>(
1308            (),
1309            0x46b623a7fa77a979,
1310            fidl::encoding::DynamicFlags::empty(),
1311        )
1312    }
1313
1314    type WatchAutoBrightnessResponseFut =
1315        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
1316    fn r#watch_auto_brightness(&self) -> Self::WatchAutoBrightnessResponseFut {
1317        fn _decode(
1318            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1319        ) -> Result<bool, fidl::Error> {
1320            let _response = fidl::client::decode_transaction_body::<
1321                ControlWatchAutoBrightnessResponse,
1322                fidl::encoding::DefaultFuchsiaResourceDialect,
1323                0xd956a90c115186b,
1324            >(_buf?)?;
1325            Ok(_response.enabled)
1326        }
1327        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
1328            (),
1329            0xd956a90c115186b,
1330            fidl::encoding::DynamicFlags::empty(),
1331            _decode,
1332        )
1333    }
1334
1335    fn r#set_manual_brightness(&self, mut value: f32) -> Result<(), fidl::Error> {
1336        self.client.send::<ControlSetManualBrightnessRequest>(
1337            (value,),
1338            0x1e333aa49771e1eb,
1339            fidl::encoding::DynamicFlags::empty(),
1340        )
1341    }
1342
1343    fn r#set_manual_brightness_smooth(
1344        &self,
1345        mut value: f32,
1346        mut duration: i64,
1347    ) -> Result<(), fidl::Error> {
1348        self.client.send::<ControlSetManualBrightnessSmoothRequest>(
1349            (value, duration),
1350            0x7b7d273c20a61d0c,
1351            fidl::encoding::DynamicFlags::empty(),
1352        )
1353    }
1354
1355    type WatchCurrentBrightnessResponseFut =
1356        fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1357    fn r#watch_current_brightness(&self) -> Self::WatchCurrentBrightnessResponseFut {
1358        fn _decode(
1359            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1360        ) -> Result<f32, fidl::Error> {
1361            let _response = fidl::client::decode_transaction_body::<
1362                ControlWatchCurrentBrightnessResponse,
1363                fidl::encoding::DefaultFuchsiaResourceDialect,
1364                0x2cc3011e2326d4d8,
1365            >(_buf?)?;
1366            Ok(_response.value)
1367        }
1368        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
1369            (),
1370            0x2cc3011e2326d4d8,
1371            fidl::encoding::DynamicFlags::empty(),
1372            _decode,
1373        )
1374    }
1375
1376    fn r#set_auto_brightness_adjustment(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
1377        self.client.send::<ControlSetAutoBrightnessAdjustmentRequest>(
1378            (adjustment,),
1379            0x678ee26bc217d996,
1380            fidl::encoding::DynamicFlags::empty(),
1381        )
1382    }
1383
1384    type WatchAutoBrightnessAdjustmentResponseFut =
1385        fidl::client::QueryResponseFut<f32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1386    fn r#watch_auto_brightness_adjustment(&self) -> Self::WatchAutoBrightnessAdjustmentResponseFut {
1387        fn _decode(
1388            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1389        ) -> Result<f32, fidl::Error> {
1390            let _response = fidl::client::decode_transaction_body::<
1391                ControlWatchAutoBrightnessAdjustmentResponse,
1392                fidl::encoding::DefaultFuchsiaResourceDialect,
1393                0x7c373aafe0058135,
1394            >(_buf?)?;
1395            Ok(_response.adjustment)
1396        }
1397        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, f32>(
1398            (),
1399            0x7c373aafe0058135,
1400            fidl::encoding::DynamicFlags::empty(),
1401            _decode,
1402        )
1403    }
1404
1405    fn r#set_brightness_table(&self, mut table: &BrightnessTable) -> Result<(), fidl::Error> {
1406        self.client.send::<ControlSetBrightnessTableRequest>(
1407            (table,),
1408            0x11d419413129dcee,
1409            fidl::encoding::DynamicFlags::empty(),
1410        )
1411    }
1412
1413    type GetMaxAbsoluteBrightnessResponseFut = fidl::client::QueryResponseFut<
1414        ControlGetMaxAbsoluteBrightnessResult,
1415        fidl::encoding::DefaultFuchsiaResourceDialect,
1416    >;
1417    fn r#get_max_absolute_brightness(&self) -> Self::GetMaxAbsoluteBrightnessResponseFut {
1418        fn _decode(
1419            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1420        ) -> Result<ControlGetMaxAbsoluteBrightnessResult, fidl::Error> {
1421            let _response = fidl::client::decode_transaction_body::<
1422                fidl::encoding::ResultType<ControlGetMaxAbsoluteBrightnessResponse, i32>,
1423                fidl::encoding::DefaultFuchsiaResourceDialect,
1424                0x73055a8d6422caf8,
1425            >(_buf?)?;
1426            Ok(_response.map(|x| x.max_brightness))
1427        }
1428        self.client.send_query_and_decode::<
1429            fidl::encoding::EmptyPayload,
1430            ControlGetMaxAbsoluteBrightnessResult,
1431        >(
1432            (),
1433            0x73055a8d6422caf8,
1434            fidl::encoding::DynamicFlags::empty(),
1435            _decode,
1436        )
1437    }
1438}
1439
1440pub struct ControlEventStream {
1441    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1442}
1443
1444impl std::marker::Unpin for ControlEventStream {}
1445
1446impl futures::stream::FusedStream for ControlEventStream {
1447    fn is_terminated(&self) -> bool {
1448        self.event_receiver.is_terminated()
1449    }
1450}
1451
1452impl futures::Stream for ControlEventStream {
1453    type Item = Result<ControlEvent, fidl::Error>;
1454
1455    fn poll_next(
1456        mut self: std::pin::Pin<&mut Self>,
1457        cx: &mut std::task::Context<'_>,
1458    ) -> std::task::Poll<Option<Self::Item>> {
1459        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1460            &mut self.event_receiver,
1461            cx
1462        )?) {
1463            Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
1464            None => std::task::Poll::Ready(None),
1465        }
1466    }
1467}
1468
1469#[derive(Debug)]
1470pub enum ControlEvent {}
1471
1472impl ControlEvent {
1473    /// Decodes a message buffer as a [`ControlEvent`].
1474    fn decode(
1475        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1476    ) -> Result<ControlEvent, fidl::Error> {
1477        let (bytes, _handles) = buf.split_mut();
1478        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1479        debug_assert_eq!(tx_header.tx_id, 0);
1480        match tx_header.ordinal {
1481            _ => Err(fidl::Error::UnknownOrdinal {
1482                ordinal: tx_header.ordinal,
1483                protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1484            }),
1485        }
1486    }
1487}
1488
1489/// A Stream of incoming requests for fuchsia.ui.brightness/Control.
1490pub struct ControlRequestStream {
1491    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1492    is_terminated: bool,
1493}
1494
1495impl std::marker::Unpin for ControlRequestStream {}
1496
1497impl futures::stream::FusedStream for ControlRequestStream {
1498    fn is_terminated(&self) -> bool {
1499        self.is_terminated
1500    }
1501}
1502
1503impl fidl::endpoints::RequestStream for ControlRequestStream {
1504    type Protocol = ControlMarker;
1505    type ControlHandle = ControlControlHandle;
1506
1507    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1508        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1509    }
1510
1511    fn control_handle(&self) -> Self::ControlHandle {
1512        ControlControlHandle { inner: self.inner.clone() }
1513    }
1514
1515    fn into_inner(
1516        self,
1517    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1518    {
1519        (self.inner, self.is_terminated)
1520    }
1521
1522    fn from_inner(
1523        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1524        is_terminated: bool,
1525    ) -> Self {
1526        Self { inner, is_terminated }
1527    }
1528}
1529
1530impl futures::Stream for ControlRequestStream {
1531    type Item = Result<ControlRequest, fidl::Error>;
1532
1533    fn poll_next(
1534        mut self: std::pin::Pin<&mut Self>,
1535        cx: &mut std::task::Context<'_>,
1536    ) -> std::task::Poll<Option<Self::Item>> {
1537        let this = &mut *self;
1538        if this.inner.check_shutdown(cx) {
1539            this.is_terminated = true;
1540            return std::task::Poll::Ready(None);
1541        }
1542        if this.is_terminated {
1543            panic!("polled ControlRequestStream after completion");
1544        }
1545        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1546            |bytes, handles| {
1547                match this.inner.channel().read_etc(cx, bytes, handles) {
1548                    std::task::Poll::Ready(Ok(())) => {}
1549                    std::task::Poll::Pending => return std::task::Poll::Pending,
1550                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1551                        this.is_terminated = true;
1552                        return std::task::Poll::Ready(None);
1553                    }
1554                    std::task::Poll::Ready(Err(e)) => {
1555                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1556                            e.into(),
1557                        ))))
1558                    }
1559                }
1560
1561                // A message has been received from the channel
1562                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1563
1564                std::task::Poll::Ready(Some(match header.ordinal {
1565                    0x46b623a7fa77a979 => {
1566                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1567                        let mut req = fidl::new_empty!(
1568                            fidl::encoding::EmptyPayload,
1569                            fidl::encoding::DefaultFuchsiaResourceDialect
1570                        );
1571                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1572                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1573                        Ok(ControlRequest::SetAutoBrightness { control_handle })
1574                    }
1575                    0xd956a90c115186b => {
1576                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1577                        let mut req = fidl::new_empty!(
1578                            fidl::encoding::EmptyPayload,
1579                            fidl::encoding::DefaultFuchsiaResourceDialect
1580                        );
1581                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1582                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1583                        Ok(ControlRequest::WatchAutoBrightness {
1584                            responder: ControlWatchAutoBrightnessResponder {
1585                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1586                                tx_id: header.tx_id,
1587                            },
1588                        })
1589                    }
1590                    0x1e333aa49771e1eb => {
1591                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1592                        let mut req = fidl::new_empty!(
1593                            ControlSetManualBrightnessRequest,
1594                            fidl::encoding::DefaultFuchsiaResourceDialect
1595                        );
1596                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetManualBrightnessRequest>(&header, _body_bytes, handles, &mut req)?;
1597                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1598                        Ok(ControlRequest::SetManualBrightness { value: req.value, control_handle })
1599                    }
1600                    0x7b7d273c20a61d0c => {
1601                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1602                        let mut req = fidl::new_empty!(
1603                            ControlSetManualBrightnessSmoothRequest,
1604                            fidl::encoding::DefaultFuchsiaResourceDialect
1605                        );
1606                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetManualBrightnessSmoothRequest>(&header, _body_bytes, handles, &mut req)?;
1607                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1608                        Ok(ControlRequest::SetManualBrightnessSmooth {
1609                            value: req.value,
1610                            duration: req.duration,
1611
1612                            control_handle,
1613                        })
1614                    }
1615                    0x2cc3011e2326d4d8 => {
1616                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1617                        let mut req = fidl::new_empty!(
1618                            fidl::encoding::EmptyPayload,
1619                            fidl::encoding::DefaultFuchsiaResourceDialect
1620                        );
1621                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1622                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1623                        Ok(ControlRequest::WatchCurrentBrightness {
1624                            responder: ControlWatchCurrentBrightnessResponder {
1625                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1626                                tx_id: header.tx_id,
1627                            },
1628                        })
1629                    }
1630                    0x678ee26bc217d996 => {
1631                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1632                        let mut req = fidl::new_empty!(
1633                            ControlSetAutoBrightnessAdjustmentRequest,
1634                            fidl::encoding::DefaultFuchsiaResourceDialect
1635                        );
1636                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetAutoBrightnessAdjustmentRequest>(&header, _body_bytes, handles, &mut req)?;
1637                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1638                        Ok(ControlRequest::SetAutoBrightnessAdjustment {
1639                            adjustment: req.adjustment,
1640
1641                            control_handle,
1642                        })
1643                    }
1644                    0x7c373aafe0058135 => {
1645                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1646                        let mut req = fidl::new_empty!(
1647                            fidl::encoding::EmptyPayload,
1648                            fidl::encoding::DefaultFuchsiaResourceDialect
1649                        );
1650                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1651                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1652                        Ok(ControlRequest::WatchAutoBrightnessAdjustment {
1653                            responder: ControlWatchAutoBrightnessAdjustmentResponder {
1654                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1655                                tx_id: header.tx_id,
1656                            },
1657                        })
1658                    }
1659                    0x11d419413129dcee => {
1660                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1661                        let mut req = fidl::new_empty!(
1662                            ControlSetBrightnessTableRequest,
1663                            fidl::encoding::DefaultFuchsiaResourceDialect
1664                        );
1665                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetBrightnessTableRequest>(&header, _body_bytes, handles, &mut req)?;
1666                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1667                        Ok(ControlRequest::SetBrightnessTable { table: req.table, control_handle })
1668                    }
1669                    0x73055a8d6422caf8 => {
1670                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1671                        let mut req = fidl::new_empty!(
1672                            fidl::encoding::EmptyPayload,
1673                            fidl::encoding::DefaultFuchsiaResourceDialect
1674                        );
1675                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1676                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1677                        Ok(ControlRequest::GetMaxAbsoluteBrightness {
1678                            responder: ControlGetMaxAbsoluteBrightnessResponder {
1679                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1680                                tx_id: header.tx_id,
1681                            },
1682                        })
1683                    }
1684                    _ => Err(fidl::Error::UnknownOrdinal {
1685                        ordinal: header.ordinal,
1686                        protocol_name:
1687                            <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1688                    }),
1689                }))
1690            },
1691        )
1692    }
1693}
1694
1695/// Control provides an interface to manage the brightness component.
1696#[derive(Debug)]
1697pub enum ControlRequest {
1698    /// Turns the auto-brightness mode on.
1699    /// SetManualBrightness will turn it off.
1700    SetAutoBrightness { control_handle: ControlControlHandle },
1701    /// Requests the current auto-brightness mode.
1702    /// This call implements the Hanging Get protocol.
1703    WatchAutoBrightness { responder: ControlWatchAutoBrightnessResponder },
1704    /// Turns auto-brightness mode off.
1705    /// Used by e.g. Settings to set manual brightness using a slider
1706    /// Value is in the range 0.0 to 1.0 representing min to max and
1707    /// will be clamped if out of range.
1708    SetManualBrightness { value: f32, control_handle: ControlControlHandle },
1709    /// Set manual brightness specifying the duration over which the
1710    /// target brightness will be set.
1711    SetManualBrightnessSmooth { value: f32, duration: i64, control_handle: ControlControlHandle },
1712    /// Gets the current brightness in the range 0.0 to 1.0.
1713    /// This result is valid for both manual and auto-brightness modes
1714    /// and is typically used to show the current brightness on a slider.
1715    /// This call implements the Hanging Get protocol.
1716    WatchCurrentBrightness { responder: ControlWatchCurrentBrightnessResponder },
1717    /// Sets the brightness adjustment.
1718    /// This will change the brightness curve by the factor of the adjustment.
1719    /// The adjustment is in the range of -1.0 to 1.0.
1720    SetAutoBrightnessAdjustment { adjustment: f32, control_handle: ControlControlHandle },
1721    /// Gets the current auto brightness adjustment.
1722    /// This call implements the Hanging Get protocol.
1723    WatchAutoBrightnessAdjustment { responder: ControlWatchAutoBrightnessAdjustmentResponder },
1724    /// Sets the brightness curve as a set of points.
1725    /// This will override the built-in brightness curve.
1726    /// The default brightness curve will be used if the table is empty.
1727    /// The connection will be closed if table errors are detected.
1728    SetBrightnessTable { table: BrightnessTable, control_handle: ControlControlHandle },
1729    /// Gets the maximum supported backlight brightness in nits, if known.
1730    GetMaxAbsoluteBrightness { responder: ControlGetMaxAbsoluteBrightnessResponder },
1731}
1732
1733impl ControlRequest {
1734    #[allow(irrefutable_let_patterns)]
1735    pub fn into_set_auto_brightness(self) -> Option<(ControlControlHandle)> {
1736        if let ControlRequest::SetAutoBrightness { control_handle } = self {
1737            Some((control_handle))
1738        } else {
1739            None
1740        }
1741    }
1742
1743    #[allow(irrefutable_let_patterns)]
1744    pub fn into_watch_auto_brightness(self) -> Option<(ControlWatchAutoBrightnessResponder)> {
1745        if let ControlRequest::WatchAutoBrightness { responder } = self {
1746            Some((responder))
1747        } else {
1748            None
1749        }
1750    }
1751
1752    #[allow(irrefutable_let_patterns)]
1753    pub fn into_set_manual_brightness(self) -> Option<(f32, ControlControlHandle)> {
1754        if let ControlRequest::SetManualBrightness { value, control_handle } = self {
1755            Some((value, control_handle))
1756        } else {
1757            None
1758        }
1759    }
1760
1761    #[allow(irrefutable_let_patterns)]
1762    pub fn into_set_manual_brightness_smooth(self) -> Option<(f32, i64, ControlControlHandle)> {
1763        if let ControlRequest::SetManualBrightnessSmooth { value, duration, control_handle } = self
1764        {
1765            Some((value, duration, control_handle))
1766        } else {
1767            None
1768        }
1769    }
1770
1771    #[allow(irrefutable_let_patterns)]
1772    pub fn into_watch_current_brightness(self) -> Option<(ControlWatchCurrentBrightnessResponder)> {
1773        if let ControlRequest::WatchCurrentBrightness { responder } = self {
1774            Some((responder))
1775        } else {
1776            None
1777        }
1778    }
1779
1780    #[allow(irrefutable_let_patterns)]
1781    pub fn into_set_auto_brightness_adjustment(self) -> Option<(f32, ControlControlHandle)> {
1782        if let ControlRequest::SetAutoBrightnessAdjustment { adjustment, control_handle } = self {
1783            Some((adjustment, control_handle))
1784        } else {
1785            None
1786        }
1787    }
1788
1789    #[allow(irrefutable_let_patterns)]
1790    pub fn into_watch_auto_brightness_adjustment(
1791        self,
1792    ) -> Option<(ControlWatchAutoBrightnessAdjustmentResponder)> {
1793        if let ControlRequest::WatchAutoBrightnessAdjustment { responder } = self {
1794            Some((responder))
1795        } else {
1796            None
1797        }
1798    }
1799
1800    #[allow(irrefutable_let_patterns)]
1801    pub fn into_set_brightness_table(self) -> Option<(BrightnessTable, ControlControlHandle)> {
1802        if let ControlRequest::SetBrightnessTable { table, control_handle } = self {
1803            Some((table, control_handle))
1804        } else {
1805            None
1806        }
1807    }
1808
1809    #[allow(irrefutable_let_patterns)]
1810    pub fn into_get_max_absolute_brightness(
1811        self,
1812    ) -> Option<(ControlGetMaxAbsoluteBrightnessResponder)> {
1813        if let ControlRequest::GetMaxAbsoluteBrightness { responder } = self {
1814            Some((responder))
1815        } else {
1816            None
1817        }
1818    }
1819
1820    /// Name of the method defined in FIDL
1821    pub fn method_name(&self) -> &'static str {
1822        match *self {
1823            ControlRequest::SetAutoBrightness { .. } => "set_auto_brightness",
1824            ControlRequest::WatchAutoBrightness { .. } => "watch_auto_brightness",
1825            ControlRequest::SetManualBrightness { .. } => "set_manual_brightness",
1826            ControlRequest::SetManualBrightnessSmooth { .. } => "set_manual_brightness_smooth",
1827            ControlRequest::WatchCurrentBrightness { .. } => "watch_current_brightness",
1828            ControlRequest::SetAutoBrightnessAdjustment { .. } => "set_auto_brightness_adjustment",
1829            ControlRequest::WatchAutoBrightnessAdjustment { .. } => {
1830                "watch_auto_brightness_adjustment"
1831            }
1832            ControlRequest::SetBrightnessTable { .. } => "set_brightness_table",
1833            ControlRequest::GetMaxAbsoluteBrightness { .. } => "get_max_absolute_brightness",
1834        }
1835    }
1836}
1837
1838#[derive(Debug, Clone)]
1839pub struct ControlControlHandle {
1840    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1841}
1842
1843impl fidl::endpoints::ControlHandle for ControlControlHandle {
1844    fn shutdown(&self) {
1845        self.inner.shutdown()
1846    }
1847    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1848        self.inner.shutdown_with_epitaph(status)
1849    }
1850
1851    fn is_closed(&self) -> bool {
1852        self.inner.channel().is_closed()
1853    }
1854    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1855        self.inner.channel().on_closed()
1856    }
1857
1858    #[cfg(target_os = "fuchsia")]
1859    fn signal_peer(
1860        &self,
1861        clear_mask: zx::Signals,
1862        set_mask: zx::Signals,
1863    ) -> Result<(), zx_status::Status> {
1864        use fidl::Peered;
1865        self.inner.channel().signal_peer(clear_mask, set_mask)
1866    }
1867}
1868
1869impl ControlControlHandle {}
1870
1871#[must_use = "FIDL methods require a response to be sent"]
1872#[derive(Debug)]
1873pub struct ControlWatchAutoBrightnessResponder {
1874    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1875    tx_id: u32,
1876}
1877
1878/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1879/// if the responder is dropped without sending a response, so that the client
1880/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1881impl std::ops::Drop for ControlWatchAutoBrightnessResponder {
1882    fn drop(&mut self) {
1883        self.control_handle.shutdown();
1884        // Safety: drops once, never accessed again
1885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1886    }
1887}
1888
1889impl fidl::endpoints::Responder for ControlWatchAutoBrightnessResponder {
1890    type ControlHandle = ControlControlHandle;
1891
1892    fn control_handle(&self) -> &ControlControlHandle {
1893        &self.control_handle
1894    }
1895
1896    fn drop_without_shutdown(mut self) {
1897        // Safety: drops once, never accessed again due to mem::forget
1898        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1899        // Prevent Drop from running (which would shut down the channel)
1900        std::mem::forget(self);
1901    }
1902}
1903
1904impl ControlWatchAutoBrightnessResponder {
1905    /// Sends a response to the FIDL transaction.
1906    ///
1907    /// Sets the channel to shutdown if an error occurs.
1908    pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
1909        let _result = self.send_raw(enabled);
1910        if _result.is_err() {
1911            self.control_handle.shutdown();
1912        }
1913        self.drop_without_shutdown();
1914        _result
1915    }
1916
1917    /// Similar to "send" but does not shutdown the channel if an error occurs.
1918    pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
1919        let _result = self.send_raw(enabled);
1920        self.drop_without_shutdown();
1921        _result
1922    }
1923
1924    fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
1925        self.control_handle.inner.send::<ControlWatchAutoBrightnessResponse>(
1926            (enabled,),
1927            self.tx_id,
1928            0xd956a90c115186b,
1929            fidl::encoding::DynamicFlags::empty(),
1930        )
1931    }
1932}
1933
1934#[must_use = "FIDL methods require a response to be sent"]
1935#[derive(Debug)]
1936pub struct ControlWatchCurrentBrightnessResponder {
1937    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1938    tx_id: u32,
1939}
1940
1941/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1942/// if the responder is dropped without sending a response, so that the client
1943/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1944impl std::ops::Drop for ControlWatchCurrentBrightnessResponder {
1945    fn drop(&mut self) {
1946        self.control_handle.shutdown();
1947        // Safety: drops once, never accessed again
1948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1949    }
1950}
1951
1952impl fidl::endpoints::Responder for ControlWatchCurrentBrightnessResponder {
1953    type ControlHandle = ControlControlHandle;
1954
1955    fn control_handle(&self) -> &ControlControlHandle {
1956        &self.control_handle
1957    }
1958
1959    fn drop_without_shutdown(mut self) {
1960        // Safety: drops once, never accessed again due to mem::forget
1961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1962        // Prevent Drop from running (which would shut down the channel)
1963        std::mem::forget(self);
1964    }
1965}
1966
1967impl ControlWatchCurrentBrightnessResponder {
1968    /// Sends a response to the FIDL transaction.
1969    ///
1970    /// Sets the channel to shutdown if an error occurs.
1971    pub fn send(self, mut value: f32) -> Result<(), fidl::Error> {
1972        let _result = self.send_raw(value);
1973        if _result.is_err() {
1974            self.control_handle.shutdown();
1975        }
1976        self.drop_without_shutdown();
1977        _result
1978    }
1979
1980    /// Similar to "send" but does not shutdown the channel if an error occurs.
1981    pub fn send_no_shutdown_on_err(self, mut value: f32) -> Result<(), fidl::Error> {
1982        let _result = self.send_raw(value);
1983        self.drop_without_shutdown();
1984        _result
1985    }
1986
1987    fn send_raw(&self, mut value: f32) -> Result<(), fidl::Error> {
1988        self.control_handle.inner.send::<ControlWatchCurrentBrightnessResponse>(
1989            (value,),
1990            self.tx_id,
1991            0x2cc3011e2326d4d8,
1992            fidl::encoding::DynamicFlags::empty(),
1993        )
1994    }
1995}
1996
1997#[must_use = "FIDL methods require a response to be sent"]
1998#[derive(Debug)]
1999pub struct ControlWatchAutoBrightnessAdjustmentResponder {
2000    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2001    tx_id: u32,
2002}
2003
2004/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2005/// if the responder is dropped without sending a response, so that the client
2006/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2007impl std::ops::Drop for ControlWatchAutoBrightnessAdjustmentResponder {
2008    fn drop(&mut self) {
2009        self.control_handle.shutdown();
2010        // Safety: drops once, never accessed again
2011        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2012    }
2013}
2014
2015impl fidl::endpoints::Responder for ControlWatchAutoBrightnessAdjustmentResponder {
2016    type ControlHandle = ControlControlHandle;
2017
2018    fn control_handle(&self) -> &ControlControlHandle {
2019        &self.control_handle
2020    }
2021
2022    fn drop_without_shutdown(mut self) {
2023        // Safety: drops once, never accessed again due to mem::forget
2024        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2025        // Prevent Drop from running (which would shut down the channel)
2026        std::mem::forget(self);
2027    }
2028}
2029
2030impl ControlWatchAutoBrightnessAdjustmentResponder {
2031    /// Sends a response to the FIDL transaction.
2032    ///
2033    /// Sets the channel to shutdown if an error occurs.
2034    pub fn send(self, mut adjustment: f32) -> Result<(), fidl::Error> {
2035        let _result = self.send_raw(adjustment);
2036        if _result.is_err() {
2037            self.control_handle.shutdown();
2038        }
2039        self.drop_without_shutdown();
2040        _result
2041    }
2042
2043    /// Similar to "send" but does not shutdown the channel if an error occurs.
2044    pub fn send_no_shutdown_on_err(self, mut adjustment: f32) -> Result<(), fidl::Error> {
2045        let _result = self.send_raw(adjustment);
2046        self.drop_without_shutdown();
2047        _result
2048    }
2049
2050    fn send_raw(&self, mut adjustment: f32) -> Result<(), fidl::Error> {
2051        self.control_handle.inner.send::<ControlWatchAutoBrightnessAdjustmentResponse>(
2052            (adjustment,),
2053            self.tx_id,
2054            0x7c373aafe0058135,
2055            fidl::encoding::DynamicFlags::empty(),
2056        )
2057    }
2058}
2059
2060#[must_use = "FIDL methods require a response to be sent"]
2061#[derive(Debug)]
2062pub struct ControlGetMaxAbsoluteBrightnessResponder {
2063    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2064    tx_id: u32,
2065}
2066
2067/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2068/// if the responder is dropped without sending a response, so that the client
2069/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2070impl std::ops::Drop for ControlGetMaxAbsoluteBrightnessResponder {
2071    fn drop(&mut self) {
2072        self.control_handle.shutdown();
2073        // Safety: drops once, never accessed again
2074        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2075    }
2076}
2077
2078impl fidl::endpoints::Responder for ControlGetMaxAbsoluteBrightnessResponder {
2079    type ControlHandle = ControlControlHandle;
2080
2081    fn control_handle(&self) -> &ControlControlHandle {
2082        &self.control_handle
2083    }
2084
2085    fn drop_without_shutdown(mut self) {
2086        // Safety: drops once, never accessed again due to mem::forget
2087        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2088        // Prevent Drop from running (which would shut down the channel)
2089        std::mem::forget(self);
2090    }
2091}
2092
2093impl ControlGetMaxAbsoluteBrightnessResponder {
2094    /// Sends a response to the FIDL transaction.
2095    ///
2096    /// Sets the channel to shutdown if an error occurs.
2097    pub fn send(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
2098        let _result = self.send_raw(result);
2099        if _result.is_err() {
2100            self.control_handle.shutdown();
2101        }
2102        self.drop_without_shutdown();
2103        _result
2104    }
2105
2106    /// Similar to "send" but does not shutdown the channel if an error occurs.
2107    pub fn send_no_shutdown_on_err(self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
2108        let _result = self.send_raw(result);
2109        self.drop_without_shutdown();
2110        _result
2111    }
2112
2113    fn send_raw(&self, mut result: Result<f64, i32>) -> Result<(), fidl::Error> {
2114        self.control_handle.inner.send::<fidl::encoding::ResultType<
2115            ControlGetMaxAbsoluteBrightnessResponse,
2116            i32,
2117        >>(
2118            result.map(|max_brightness| (max_brightness,)),
2119            self.tx_id,
2120            0x73055a8d6422caf8,
2121            fidl::encoding::DynamicFlags::empty(),
2122        )
2123    }
2124}
2125
2126mod internal {
2127    use super::*;
2128
2129    impl fidl::encoding::ValueTypeMarker for BrightnessPoint {
2130        type Borrowed<'a> = &'a Self;
2131        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2132            value
2133        }
2134    }
2135
2136    unsafe impl fidl::encoding::TypeMarker for BrightnessPoint {
2137        type Owned = Self;
2138
2139        #[inline(always)]
2140        fn inline_align(_context: fidl::encoding::Context) -> usize {
2141            4
2142        }
2143
2144        #[inline(always)]
2145        fn inline_size(_context: fidl::encoding::Context) -> usize {
2146            8
2147        }
2148    }
2149
2150    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BrightnessPoint, D>
2151        for &BrightnessPoint
2152    {
2153        #[inline]
2154        unsafe fn encode(
2155            self,
2156            encoder: &mut fidl::encoding::Encoder<'_, D>,
2157            offset: usize,
2158            _depth: fidl::encoding::Depth,
2159        ) -> fidl::Result<()> {
2160            encoder.debug_check_bounds::<BrightnessPoint>(offset);
2161            // Delegate to tuple encoding.
2162            fidl::encoding::Encode::<BrightnessPoint, D>::encode(
2163                (
2164                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.ambient_lux),
2165                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.display_nits),
2166                ),
2167                encoder,
2168                offset,
2169                _depth,
2170            )
2171        }
2172    }
2173    unsafe impl<
2174            D: fidl::encoding::ResourceDialect,
2175            T0: fidl::encoding::Encode<f32, D>,
2176            T1: fidl::encoding::Encode<f32, D>,
2177        > fidl::encoding::Encode<BrightnessPoint, D> for (T0, T1)
2178    {
2179        #[inline]
2180        unsafe fn encode(
2181            self,
2182            encoder: &mut fidl::encoding::Encoder<'_, D>,
2183            offset: usize,
2184            depth: fidl::encoding::Depth,
2185        ) -> fidl::Result<()> {
2186            encoder.debug_check_bounds::<BrightnessPoint>(offset);
2187            // Zero out padding regions. There's no need to apply masks
2188            // because the unmasked parts will be overwritten by fields.
2189            // Write the fields.
2190            self.0.encode(encoder, offset + 0, depth)?;
2191            self.1.encode(encoder, offset + 4, depth)?;
2192            Ok(())
2193        }
2194    }
2195
2196    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BrightnessPoint {
2197        #[inline(always)]
2198        fn new_empty() -> Self {
2199            Self { ambient_lux: fidl::new_empty!(f32, D), display_nits: fidl::new_empty!(f32, D) }
2200        }
2201
2202        #[inline]
2203        unsafe fn decode(
2204            &mut self,
2205            decoder: &mut fidl::encoding::Decoder<'_, D>,
2206            offset: usize,
2207            _depth: fidl::encoding::Depth,
2208        ) -> fidl::Result<()> {
2209            decoder.debug_check_bounds::<Self>(offset);
2210            // Verify that padding bytes are zero.
2211            fidl::decode!(f32, D, &mut self.ambient_lux, decoder, offset + 0, _depth)?;
2212            fidl::decode!(f32, D, &mut self.display_nits, decoder, offset + 4, _depth)?;
2213            Ok(())
2214        }
2215    }
2216
2217    impl fidl::encoding::ValueTypeMarker for BrightnessTable {
2218        type Borrowed<'a> = &'a Self;
2219        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2220            value
2221        }
2222    }
2223
2224    unsafe impl fidl::encoding::TypeMarker for BrightnessTable {
2225        type Owned = Self;
2226
2227        #[inline(always)]
2228        fn inline_align(_context: fidl::encoding::Context) -> usize {
2229            8
2230        }
2231
2232        #[inline(always)]
2233        fn inline_size(_context: fidl::encoding::Context) -> usize {
2234            16
2235        }
2236    }
2237
2238    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BrightnessTable, D>
2239        for &BrightnessTable
2240    {
2241        #[inline]
2242        unsafe fn encode(
2243            self,
2244            encoder: &mut fidl::encoding::Encoder<'_, D>,
2245            offset: usize,
2246            _depth: fidl::encoding::Depth,
2247        ) -> fidl::Result<()> {
2248            encoder.debug_check_bounds::<BrightnessTable>(offset);
2249            // Delegate to tuple encoding.
2250            fidl::encoding::Encode::<BrightnessTable, D>::encode(
2251                (
2252                    <fidl::encoding::Vector<BrightnessPoint, 50> as fidl::encoding::ValueTypeMarker>::borrow(&self.points),
2253                ),
2254                encoder, offset, _depth
2255            )
2256        }
2257    }
2258    unsafe impl<
2259            D: fidl::encoding::ResourceDialect,
2260            T0: fidl::encoding::Encode<fidl::encoding::Vector<BrightnessPoint, 50>, D>,
2261        > fidl::encoding::Encode<BrightnessTable, D> for (T0,)
2262    {
2263        #[inline]
2264        unsafe fn encode(
2265            self,
2266            encoder: &mut fidl::encoding::Encoder<'_, D>,
2267            offset: usize,
2268            depth: fidl::encoding::Depth,
2269        ) -> fidl::Result<()> {
2270            encoder.debug_check_bounds::<BrightnessTable>(offset);
2271            // Zero out padding regions. There's no need to apply masks
2272            // because the unmasked parts will be overwritten by fields.
2273            // Write the fields.
2274            self.0.encode(encoder, offset + 0, depth)?;
2275            Ok(())
2276        }
2277    }
2278
2279    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BrightnessTable {
2280        #[inline(always)]
2281        fn new_empty() -> Self {
2282            Self { points: fidl::new_empty!(fidl::encoding::Vector<BrightnessPoint, 50>, D) }
2283        }
2284
2285        #[inline]
2286        unsafe fn decode(
2287            &mut self,
2288            decoder: &mut fidl::encoding::Decoder<'_, D>,
2289            offset: usize,
2290            _depth: fidl::encoding::Depth,
2291        ) -> fidl::Result<()> {
2292            decoder.debug_check_bounds::<Self>(offset);
2293            // Verify that padding bytes are zero.
2294            fidl::decode!(fidl::encoding::Vector<BrightnessPoint, 50>, D, &mut self.points, decoder, offset + 0, _depth)?;
2295            Ok(())
2296        }
2297    }
2298
2299    impl fidl::encoding::ValueTypeMarker for ColorAdjustmentHandlerSetColorAdjustmentRequest {
2300        type Borrowed<'a> = &'a Self;
2301        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2302            value
2303        }
2304    }
2305
2306    unsafe impl fidl::encoding::TypeMarker for ColorAdjustmentHandlerSetColorAdjustmentRequest {
2307        type Owned = Self;
2308
2309        #[inline(always)]
2310        fn inline_align(_context: fidl::encoding::Context) -> usize {
2311            8
2312        }
2313
2314        #[inline(always)]
2315        fn inline_size(_context: fidl::encoding::Context) -> usize {
2316            16
2317        }
2318    }
2319
2320    unsafe impl<D: fidl::encoding::ResourceDialect>
2321        fidl::encoding::Encode<ColorAdjustmentHandlerSetColorAdjustmentRequest, D>
2322        for &ColorAdjustmentHandlerSetColorAdjustmentRequest
2323    {
2324        #[inline]
2325        unsafe fn encode(
2326            self,
2327            encoder: &mut fidl::encoding::Encoder<'_, D>,
2328            offset: usize,
2329            _depth: fidl::encoding::Depth,
2330        ) -> fidl::Result<()> {
2331            encoder.debug_check_bounds::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(offset);
2332            // Delegate to tuple encoding.
2333            fidl::encoding::Encode::<ColorAdjustmentHandlerSetColorAdjustmentRequest, D>::encode(
2334                (<ColorAdjustmentTable as fidl::encoding::ValueTypeMarker>::borrow(
2335                    &self.color_adjustment,
2336                ),),
2337                encoder,
2338                offset,
2339                _depth,
2340            )
2341        }
2342    }
2343    unsafe impl<
2344            D: fidl::encoding::ResourceDialect,
2345            T0: fidl::encoding::Encode<ColorAdjustmentTable, D>,
2346        > fidl::encoding::Encode<ColorAdjustmentHandlerSetColorAdjustmentRequest, D> for (T0,)
2347    {
2348        #[inline]
2349        unsafe fn encode(
2350            self,
2351            encoder: &mut fidl::encoding::Encoder<'_, D>,
2352            offset: usize,
2353            depth: fidl::encoding::Depth,
2354        ) -> fidl::Result<()> {
2355            encoder.debug_check_bounds::<ColorAdjustmentHandlerSetColorAdjustmentRequest>(offset);
2356            // Zero out padding regions. There's no need to apply masks
2357            // because the unmasked parts will be overwritten by fields.
2358            // Write the fields.
2359            self.0.encode(encoder, offset + 0, depth)?;
2360            Ok(())
2361        }
2362    }
2363
2364    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2365        for ColorAdjustmentHandlerSetColorAdjustmentRequest
2366    {
2367        #[inline(always)]
2368        fn new_empty() -> Self {
2369            Self { color_adjustment: fidl::new_empty!(ColorAdjustmentTable, D) }
2370        }
2371
2372        #[inline]
2373        unsafe fn decode(
2374            &mut self,
2375            decoder: &mut fidl::encoding::Decoder<'_, D>,
2376            offset: usize,
2377            _depth: fidl::encoding::Depth,
2378        ) -> fidl::Result<()> {
2379            decoder.debug_check_bounds::<Self>(offset);
2380            // Verify that padding bytes are zero.
2381            fidl::decode!(
2382                ColorAdjustmentTable,
2383                D,
2384                &mut self.color_adjustment,
2385                decoder,
2386                offset + 0,
2387                _depth
2388            )?;
2389            Ok(())
2390        }
2391    }
2392
2393    impl fidl::encoding::ValueTypeMarker for ColorAdjustmentSetDiscreteColorAdjustmentRequest {
2394        type Borrowed<'a> = &'a Self;
2395        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2396            value
2397        }
2398    }
2399
2400    unsafe impl fidl::encoding::TypeMarker for ColorAdjustmentSetDiscreteColorAdjustmentRequest {
2401        type Owned = Self;
2402
2403        #[inline(always)]
2404        fn inline_align(_context: fidl::encoding::Context) -> usize {
2405            8
2406        }
2407
2408        #[inline(always)]
2409        fn inline_size(_context: fidl::encoding::Context) -> usize {
2410            16
2411        }
2412    }
2413
2414    unsafe impl<D: fidl::encoding::ResourceDialect>
2415        fidl::encoding::Encode<ColorAdjustmentSetDiscreteColorAdjustmentRequest, D>
2416        for &ColorAdjustmentSetDiscreteColorAdjustmentRequest
2417    {
2418        #[inline]
2419        unsafe fn encode(
2420            self,
2421            encoder: &mut fidl::encoding::Encoder<'_, D>,
2422            offset: usize,
2423            _depth: fidl::encoding::Depth,
2424        ) -> fidl::Result<()> {
2425            encoder.debug_check_bounds::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(offset);
2426            // Delegate to tuple encoding.
2427            fidl::encoding::Encode::<ColorAdjustmentSetDiscreteColorAdjustmentRequest, D>::encode(
2428                (<ColorAdjustmentTable as fidl::encoding::ValueTypeMarker>::borrow(
2429                    &self.color_adjustment,
2430                ),),
2431                encoder,
2432                offset,
2433                _depth,
2434            )
2435        }
2436    }
2437    unsafe impl<
2438            D: fidl::encoding::ResourceDialect,
2439            T0: fidl::encoding::Encode<ColorAdjustmentTable, D>,
2440        > fidl::encoding::Encode<ColorAdjustmentSetDiscreteColorAdjustmentRequest, D> for (T0,)
2441    {
2442        #[inline]
2443        unsafe fn encode(
2444            self,
2445            encoder: &mut fidl::encoding::Encoder<'_, D>,
2446            offset: usize,
2447            depth: fidl::encoding::Depth,
2448        ) -> fidl::Result<()> {
2449            encoder.debug_check_bounds::<ColorAdjustmentSetDiscreteColorAdjustmentRequest>(offset);
2450            // Zero out padding regions. There's no need to apply masks
2451            // because the unmasked parts will be overwritten by fields.
2452            // Write the fields.
2453            self.0.encode(encoder, offset + 0, depth)?;
2454            Ok(())
2455        }
2456    }
2457
2458    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2459        for ColorAdjustmentSetDiscreteColorAdjustmentRequest
2460    {
2461        #[inline(always)]
2462        fn new_empty() -> Self {
2463            Self { color_adjustment: fidl::new_empty!(ColorAdjustmentTable, D) }
2464        }
2465
2466        #[inline]
2467        unsafe fn decode(
2468            &mut self,
2469            decoder: &mut fidl::encoding::Decoder<'_, D>,
2470            offset: usize,
2471            _depth: fidl::encoding::Depth,
2472        ) -> fidl::Result<()> {
2473            decoder.debug_check_bounds::<Self>(offset);
2474            // Verify that padding bytes are zero.
2475            fidl::decode!(
2476                ColorAdjustmentTable,
2477                D,
2478                &mut self.color_adjustment,
2479                decoder,
2480                offset + 0,
2481                _depth
2482            )?;
2483            Ok(())
2484        }
2485    }
2486
2487    impl fidl::encoding::ValueTypeMarker for ControlSetAutoBrightnessAdjustmentRequest {
2488        type Borrowed<'a> = &'a Self;
2489        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2490            value
2491        }
2492    }
2493
2494    unsafe impl fidl::encoding::TypeMarker for ControlSetAutoBrightnessAdjustmentRequest {
2495        type Owned = Self;
2496
2497        #[inline(always)]
2498        fn inline_align(_context: fidl::encoding::Context) -> usize {
2499            4
2500        }
2501
2502        #[inline(always)]
2503        fn inline_size(_context: fidl::encoding::Context) -> usize {
2504            4
2505        }
2506    }
2507
2508    unsafe impl<D: fidl::encoding::ResourceDialect>
2509        fidl::encoding::Encode<ControlSetAutoBrightnessAdjustmentRequest, D>
2510        for &ControlSetAutoBrightnessAdjustmentRequest
2511    {
2512        #[inline]
2513        unsafe fn encode(
2514            self,
2515            encoder: &mut fidl::encoding::Encoder<'_, D>,
2516            offset: usize,
2517            _depth: fidl::encoding::Depth,
2518        ) -> fidl::Result<()> {
2519            encoder.debug_check_bounds::<ControlSetAutoBrightnessAdjustmentRequest>(offset);
2520            // Delegate to tuple encoding.
2521            fidl::encoding::Encode::<ControlSetAutoBrightnessAdjustmentRequest, D>::encode(
2522                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.adjustment),),
2523                encoder,
2524                offset,
2525                _depth,
2526            )
2527        }
2528    }
2529    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
2530        fidl::encoding::Encode<ControlSetAutoBrightnessAdjustmentRequest, D> for (T0,)
2531    {
2532        #[inline]
2533        unsafe fn encode(
2534            self,
2535            encoder: &mut fidl::encoding::Encoder<'_, D>,
2536            offset: usize,
2537            depth: fidl::encoding::Depth,
2538        ) -> fidl::Result<()> {
2539            encoder.debug_check_bounds::<ControlSetAutoBrightnessAdjustmentRequest>(offset);
2540            // Zero out padding regions. There's no need to apply masks
2541            // because the unmasked parts will be overwritten by fields.
2542            // Write the fields.
2543            self.0.encode(encoder, offset + 0, depth)?;
2544            Ok(())
2545        }
2546    }
2547
2548    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2549        for ControlSetAutoBrightnessAdjustmentRequest
2550    {
2551        #[inline(always)]
2552        fn new_empty() -> Self {
2553            Self { adjustment: fidl::new_empty!(f32, D) }
2554        }
2555
2556        #[inline]
2557        unsafe fn decode(
2558            &mut self,
2559            decoder: &mut fidl::encoding::Decoder<'_, D>,
2560            offset: usize,
2561            _depth: fidl::encoding::Depth,
2562        ) -> fidl::Result<()> {
2563            decoder.debug_check_bounds::<Self>(offset);
2564            // Verify that padding bytes are zero.
2565            fidl::decode!(f32, D, &mut self.adjustment, decoder, offset + 0, _depth)?;
2566            Ok(())
2567        }
2568    }
2569
2570    impl fidl::encoding::ValueTypeMarker for ControlSetBrightnessTableRequest {
2571        type Borrowed<'a> = &'a Self;
2572        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2573            value
2574        }
2575    }
2576
2577    unsafe impl fidl::encoding::TypeMarker for ControlSetBrightnessTableRequest {
2578        type Owned = Self;
2579
2580        #[inline(always)]
2581        fn inline_align(_context: fidl::encoding::Context) -> usize {
2582            8
2583        }
2584
2585        #[inline(always)]
2586        fn inline_size(_context: fidl::encoding::Context) -> usize {
2587            16
2588        }
2589    }
2590
2591    unsafe impl<D: fidl::encoding::ResourceDialect>
2592        fidl::encoding::Encode<ControlSetBrightnessTableRequest, D>
2593        for &ControlSetBrightnessTableRequest
2594    {
2595        #[inline]
2596        unsafe fn encode(
2597            self,
2598            encoder: &mut fidl::encoding::Encoder<'_, D>,
2599            offset: usize,
2600            _depth: fidl::encoding::Depth,
2601        ) -> fidl::Result<()> {
2602            encoder.debug_check_bounds::<ControlSetBrightnessTableRequest>(offset);
2603            // Delegate to tuple encoding.
2604            fidl::encoding::Encode::<ControlSetBrightnessTableRequest, D>::encode(
2605                (<BrightnessTable as fidl::encoding::ValueTypeMarker>::borrow(&self.table),),
2606                encoder,
2607                offset,
2608                _depth,
2609            )
2610        }
2611    }
2612    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BrightnessTable, D>>
2613        fidl::encoding::Encode<ControlSetBrightnessTableRequest, D> for (T0,)
2614    {
2615        #[inline]
2616        unsafe fn encode(
2617            self,
2618            encoder: &mut fidl::encoding::Encoder<'_, D>,
2619            offset: usize,
2620            depth: fidl::encoding::Depth,
2621        ) -> fidl::Result<()> {
2622            encoder.debug_check_bounds::<ControlSetBrightnessTableRequest>(offset);
2623            // Zero out padding regions. There's no need to apply masks
2624            // because the unmasked parts will be overwritten by fields.
2625            // Write the fields.
2626            self.0.encode(encoder, offset + 0, depth)?;
2627            Ok(())
2628        }
2629    }
2630
2631    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2632        for ControlSetBrightnessTableRequest
2633    {
2634        #[inline(always)]
2635        fn new_empty() -> Self {
2636            Self { table: fidl::new_empty!(BrightnessTable, D) }
2637        }
2638
2639        #[inline]
2640        unsafe fn decode(
2641            &mut self,
2642            decoder: &mut fidl::encoding::Decoder<'_, D>,
2643            offset: usize,
2644            _depth: fidl::encoding::Depth,
2645        ) -> fidl::Result<()> {
2646            decoder.debug_check_bounds::<Self>(offset);
2647            // Verify that padding bytes are zero.
2648            fidl::decode!(BrightnessTable, D, &mut self.table, decoder, offset + 0, _depth)?;
2649            Ok(())
2650        }
2651    }
2652
2653    impl fidl::encoding::ValueTypeMarker for ControlSetManualBrightnessRequest {
2654        type Borrowed<'a> = &'a Self;
2655        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2656            value
2657        }
2658    }
2659
2660    unsafe impl fidl::encoding::TypeMarker for ControlSetManualBrightnessRequest {
2661        type Owned = Self;
2662
2663        #[inline(always)]
2664        fn inline_align(_context: fidl::encoding::Context) -> usize {
2665            4
2666        }
2667
2668        #[inline(always)]
2669        fn inline_size(_context: fidl::encoding::Context) -> usize {
2670            4
2671        }
2672    }
2673
2674    unsafe impl<D: fidl::encoding::ResourceDialect>
2675        fidl::encoding::Encode<ControlSetManualBrightnessRequest, D>
2676        for &ControlSetManualBrightnessRequest
2677    {
2678        #[inline]
2679        unsafe fn encode(
2680            self,
2681            encoder: &mut fidl::encoding::Encoder<'_, D>,
2682            offset: usize,
2683            _depth: fidl::encoding::Depth,
2684        ) -> fidl::Result<()> {
2685            encoder.debug_check_bounds::<ControlSetManualBrightnessRequest>(offset);
2686            // Delegate to tuple encoding.
2687            fidl::encoding::Encode::<ControlSetManualBrightnessRequest, D>::encode(
2688                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
2689                encoder,
2690                offset,
2691                _depth,
2692            )
2693        }
2694    }
2695    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
2696        fidl::encoding::Encode<ControlSetManualBrightnessRequest, D> for (T0,)
2697    {
2698        #[inline]
2699        unsafe fn encode(
2700            self,
2701            encoder: &mut fidl::encoding::Encoder<'_, D>,
2702            offset: usize,
2703            depth: fidl::encoding::Depth,
2704        ) -> fidl::Result<()> {
2705            encoder.debug_check_bounds::<ControlSetManualBrightnessRequest>(offset);
2706            // Zero out padding regions. There's no need to apply masks
2707            // because the unmasked parts will be overwritten by fields.
2708            // Write the fields.
2709            self.0.encode(encoder, offset + 0, depth)?;
2710            Ok(())
2711        }
2712    }
2713
2714    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2715        for ControlSetManualBrightnessRequest
2716    {
2717        #[inline(always)]
2718        fn new_empty() -> Self {
2719            Self { value: fidl::new_empty!(f32, D) }
2720        }
2721
2722        #[inline]
2723        unsafe fn decode(
2724            &mut self,
2725            decoder: &mut fidl::encoding::Decoder<'_, D>,
2726            offset: usize,
2727            _depth: fidl::encoding::Depth,
2728        ) -> fidl::Result<()> {
2729            decoder.debug_check_bounds::<Self>(offset);
2730            // Verify that padding bytes are zero.
2731            fidl::decode!(f32, D, &mut self.value, decoder, offset + 0, _depth)?;
2732            Ok(())
2733        }
2734    }
2735
2736    impl fidl::encoding::ValueTypeMarker for ControlSetManualBrightnessSmoothRequest {
2737        type Borrowed<'a> = &'a Self;
2738        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2739            value
2740        }
2741    }
2742
2743    unsafe impl fidl::encoding::TypeMarker for ControlSetManualBrightnessSmoothRequest {
2744        type Owned = Self;
2745
2746        #[inline(always)]
2747        fn inline_align(_context: fidl::encoding::Context) -> usize {
2748            8
2749        }
2750
2751        #[inline(always)]
2752        fn inline_size(_context: fidl::encoding::Context) -> usize {
2753            16
2754        }
2755    }
2756
2757    unsafe impl<D: fidl::encoding::ResourceDialect>
2758        fidl::encoding::Encode<ControlSetManualBrightnessSmoothRequest, D>
2759        for &ControlSetManualBrightnessSmoothRequest
2760    {
2761        #[inline]
2762        unsafe fn encode(
2763            self,
2764            encoder: &mut fidl::encoding::Encoder<'_, D>,
2765            offset: usize,
2766            _depth: fidl::encoding::Depth,
2767        ) -> fidl::Result<()> {
2768            encoder.debug_check_bounds::<ControlSetManualBrightnessSmoothRequest>(offset);
2769            // Delegate to tuple encoding.
2770            fidl::encoding::Encode::<ControlSetManualBrightnessSmoothRequest, D>::encode(
2771                (
2772                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
2773                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.duration),
2774                ),
2775                encoder,
2776                offset,
2777                _depth,
2778            )
2779        }
2780    }
2781    unsafe impl<
2782            D: fidl::encoding::ResourceDialect,
2783            T0: fidl::encoding::Encode<f32, D>,
2784            T1: fidl::encoding::Encode<i64, D>,
2785        > fidl::encoding::Encode<ControlSetManualBrightnessSmoothRequest, D> for (T0, T1)
2786    {
2787        #[inline]
2788        unsafe fn encode(
2789            self,
2790            encoder: &mut fidl::encoding::Encoder<'_, D>,
2791            offset: usize,
2792            depth: fidl::encoding::Depth,
2793        ) -> fidl::Result<()> {
2794            encoder.debug_check_bounds::<ControlSetManualBrightnessSmoothRequest>(offset);
2795            // Zero out padding regions. There's no need to apply masks
2796            // because the unmasked parts will be overwritten by fields.
2797            unsafe {
2798                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2799                (ptr as *mut u64).write_unaligned(0);
2800            }
2801            // Write the fields.
2802            self.0.encode(encoder, offset + 0, depth)?;
2803            self.1.encode(encoder, offset + 8, depth)?;
2804            Ok(())
2805        }
2806    }
2807
2808    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2809        for ControlSetManualBrightnessSmoothRequest
2810    {
2811        #[inline(always)]
2812        fn new_empty() -> Self {
2813            Self { value: fidl::new_empty!(f32, D), duration: fidl::new_empty!(i64, D) }
2814        }
2815
2816        #[inline]
2817        unsafe fn decode(
2818            &mut self,
2819            decoder: &mut fidl::encoding::Decoder<'_, D>,
2820            offset: usize,
2821            _depth: fidl::encoding::Depth,
2822        ) -> fidl::Result<()> {
2823            decoder.debug_check_bounds::<Self>(offset);
2824            // Verify that padding bytes are zero.
2825            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2826            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2827            let mask = 0xffffffff00000000u64;
2828            let maskedval = padval & mask;
2829            if maskedval != 0 {
2830                return Err(fidl::Error::NonZeroPadding {
2831                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2832                });
2833            }
2834            fidl::decode!(f32, D, &mut self.value, decoder, offset + 0, _depth)?;
2835            fidl::decode!(i64, D, &mut self.duration, decoder, offset + 8, _depth)?;
2836            Ok(())
2837        }
2838    }
2839
2840    impl fidl::encoding::ValueTypeMarker for ControlWatchAutoBrightnessAdjustmentResponse {
2841        type Borrowed<'a> = &'a Self;
2842        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2843            value
2844        }
2845    }
2846
2847    unsafe impl fidl::encoding::TypeMarker for ControlWatchAutoBrightnessAdjustmentResponse {
2848        type Owned = Self;
2849
2850        #[inline(always)]
2851        fn inline_align(_context: fidl::encoding::Context) -> usize {
2852            4
2853        }
2854
2855        #[inline(always)]
2856        fn inline_size(_context: fidl::encoding::Context) -> usize {
2857            4
2858        }
2859    }
2860
2861    unsafe impl<D: fidl::encoding::ResourceDialect>
2862        fidl::encoding::Encode<ControlWatchAutoBrightnessAdjustmentResponse, D>
2863        for &ControlWatchAutoBrightnessAdjustmentResponse
2864    {
2865        #[inline]
2866        unsafe fn encode(
2867            self,
2868            encoder: &mut fidl::encoding::Encoder<'_, D>,
2869            offset: usize,
2870            _depth: fidl::encoding::Depth,
2871        ) -> fidl::Result<()> {
2872            encoder.debug_check_bounds::<ControlWatchAutoBrightnessAdjustmentResponse>(offset);
2873            // Delegate to tuple encoding.
2874            fidl::encoding::Encode::<ControlWatchAutoBrightnessAdjustmentResponse, D>::encode(
2875                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.adjustment),),
2876                encoder,
2877                offset,
2878                _depth,
2879            )
2880        }
2881    }
2882    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
2883        fidl::encoding::Encode<ControlWatchAutoBrightnessAdjustmentResponse, D> for (T0,)
2884    {
2885        #[inline]
2886        unsafe fn encode(
2887            self,
2888            encoder: &mut fidl::encoding::Encoder<'_, D>,
2889            offset: usize,
2890            depth: fidl::encoding::Depth,
2891        ) -> fidl::Result<()> {
2892            encoder.debug_check_bounds::<ControlWatchAutoBrightnessAdjustmentResponse>(offset);
2893            // Zero out padding regions. There's no need to apply masks
2894            // because the unmasked parts will be overwritten by fields.
2895            // Write the fields.
2896            self.0.encode(encoder, offset + 0, depth)?;
2897            Ok(())
2898        }
2899    }
2900
2901    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2902        for ControlWatchAutoBrightnessAdjustmentResponse
2903    {
2904        #[inline(always)]
2905        fn new_empty() -> Self {
2906            Self { adjustment: fidl::new_empty!(f32, D) }
2907        }
2908
2909        #[inline]
2910        unsafe fn decode(
2911            &mut self,
2912            decoder: &mut fidl::encoding::Decoder<'_, D>,
2913            offset: usize,
2914            _depth: fidl::encoding::Depth,
2915        ) -> fidl::Result<()> {
2916            decoder.debug_check_bounds::<Self>(offset);
2917            // Verify that padding bytes are zero.
2918            fidl::decode!(f32, D, &mut self.adjustment, decoder, offset + 0, _depth)?;
2919            Ok(())
2920        }
2921    }
2922
2923    impl fidl::encoding::ValueTypeMarker for ControlWatchAutoBrightnessResponse {
2924        type Borrowed<'a> = &'a Self;
2925        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2926            value
2927        }
2928    }
2929
2930    unsafe impl fidl::encoding::TypeMarker for ControlWatchAutoBrightnessResponse {
2931        type Owned = Self;
2932
2933        #[inline(always)]
2934        fn inline_align(_context: fidl::encoding::Context) -> usize {
2935            1
2936        }
2937
2938        #[inline(always)]
2939        fn inline_size(_context: fidl::encoding::Context) -> usize {
2940            1
2941        }
2942    }
2943
2944    unsafe impl<D: fidl::encoding::ResourceDialect>
2945        fidl::encoding::Encode<ControlWatchAutoBrightnessResponse, D>
2946        for &ControlWatchAutoBrightnessResponse
2947    {
2948        #[inline]
2949        unsafe fn encode(
2950            self,
2951            encoder: &mut fidl::encoding::Encoder<'_, D>,
2952            offset: usize,
2953            _depth: fidl::encoding::Depth,
2954        ) -> fidl::Result<()> {
2955            encoder.debug_check_bounds::<ControlWatchAutoBrightnessResponse>(offset);
2956            // Delegate to tuple encoding.
2957            fidl::encoding::Encode::<ControlWatchAutoBrightnessResponse, D>::encode(
2958                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
2959                encoder,
2960                offset,
2961                _depth,
2962            )
2963        }
2964    }
2965    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2966        fidl::encoding::Encode<ControlWatchAutoBrightnessResponse, D> for (T0,)
2967    {
2968        #[inline]
2969        unsafe fn encode(
2970            self,
2971            encoder: &mut fidl::encoding::Encoder<'_, D>,
2972            offset: usize,
2973            depth: fidl::encoding::Depth,
2974        ) -> fidl::Result<()> {
2975            encoder.debug_check_bounds::<ControlWatchAutoBrightnessResponse>(offset);
2976            // Zero out padding regions. There's no need to apply masks
2977            // because the unmasked parts will be overwritten by fields.
2978            // Write the fields.
2979            self.0.encode(encoder, offset + 0, depth)?;
2980            Ok(())
2981        }
2982    }
2983
2984    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2985        for ControlWatchAutoBrightnessResponse
2986    {
2987        #[inline(always)]
2988        fn new_empty() -> Self {
2989            Self { enabled: fidl::new_empty!(bool, D) }
2990        }
2991
2992        #[inline]
2993        unsafe fn decode(
2994            &mut self,
2995            decoder: &mut fidl::encoding::Decoder<'_, D>,
2996            offset: usize,
2997            _depth: fidl::encoding::Depth,
2998        ) -> fidl::Result<()> {
2999            decoder.debug_check_bounds::<Self>(offset);
3000            // Verify that padding bytes are zero.
3001            fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
3002            Ok(())
3003        }
3004    }
3005
3006    impl fidl::encoding::ValueTypeMarker for ControlWatchCurrentBrightnessResponse {
3007        type Borrowed<'a> = &'a Self;
3008        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3009            value
3010        }
3011    }
3012
3013    unsafe impl fidl::encoding::TypeMarker for ControlWatchCurrentBrightnessResponse {
3014        type Owned = Self;
3015
3016        #[inline(always)]
3017        fn inline_align(_context: fidl::encoding::Context) -> usize {
3018            4
3019        }
3020
3021        #[inline(always)]
3022        fn inline_size(_context: fidl::encoding::Context) -> usize {
3023            4
3024        }
3025    }
3026
3027    unsafe impl<D: fidl::encoding::ResourceDialect>
3028        fidl::encoding::Encode<ControlWatchCurrentBrightnessResponse, D>
3029        for &ControlWatchCurrentBrightnessResponse
3030    {
3031        #[inline]
3032        unsafe fn encode(
3033            self,
3034            encoder: &mut fidl::encoding::Encoder<'_, D>,
3035            offset: usize,
3036            _depth: fidl::encoding::Depth,
3037        ) -> fidl::Result<()> {
3038            encoder.debug_check_bounds::<ControlWatchCurrentBrightnessResponse>(offset);
3039            // Delegate to tuple encoding.
3040            fidl::encoding::Encode::<ControlWatchCurrentBrightnessResponse, D>::encode(
3041                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
3042                encoder,
3043                offset,
3044                _depth,
3045            )
3046        }
3047    }
3048    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
3049        fidl::encoding::Encode<ControlWatchCurrentBrightnessResponse, D> for (T0,)
3050    {
3051        #[inline]
3052        unsafe fn encode(
3053            self,
3054            encoder: &mut fidl::encoding::Encoder<'_, D>,
3055            offset: usize,
3056            depth: fidl::encoding::Depth,
3057        ) -> fidl::Result<()> {
3058            encoder.debug_check_bounds::<ControlWatchCurrentBrightnessResponse>(offset);
3059            // Zero out padding regions. There's no need to apply masks
3060            // because the unmasked parts will be overwritten by fields.
3061            // Write the fields.
3062            self.0.encode(encoder, offset + 0, depth)?;
3063            Ok(())
3064        }
3065    }
3066
3067    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3068        for ControlWatchCurrentBrightnessResponse
3069    {
3070        #[inline(always)]
3071        fn new_empty() -> Self {
3072            Self { value: fidl::new_empty!(f32, D) }
3073        }
3074
3075        #[inline]
3076        unsafe fn decode(
3077            &mut self,
3078            decoder: &mut fidl::encoding::Decoder<'_, D>,
3079            offset: usize,
3080            _depth: fidl::encoding::Depth,
3081        ) -> fidl::Result<()> {
3082            decoder.debug_check_bounds::<Self>(offset);
3083            // Verify that padding bytes are zero.
3084            fidl::decode!(f32, D, &mut self.value, decoder, offset + 0, _depth)?;
3085            Ok(())
3086        }
3087    }
3088
3089    impl fidl::encoding::ValueTypeMarker for ControlGetMaxAbsoluteBrightnessResponse {
3090        type Borrowed<'a> = &'a Self;
3091        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3092            value
3093        }
3094    }
3095
3096    unsafe impl fidl::encoding::TypeMarker for ControlGetMaxAbsoluteBrightnessResponse {
3097        type Owned = Self;
3098
3099        #[inline(always)]
3100        fn inline_align(_context: fidl::encoding::Context) -> usize {
3101            8
3102        }
3103
3104        #[inline(always)]
3105        fn inline_size(_context: fidl::encoding::Context) -> usize {
3106            8
3107        }
3108    }
3109
3110    unsafe impl<D: fidl::encoding::ResourceDialect>
3111        fidl::encoding::Encode<ControlGetMaxAbsoluteBrightnessResponse, D>
3112        for &ControlGetMaxAbsoluteBrightnessResponse
3113    {
3114        #[inline]
3115        unsafe fn encode(
3116            self,
3117            encoder: &mut fidl::encoding::Encoder<'_, D>,
3118            offset: usize,
3119            _depth: fidl::encoding::Depth,
3120        ) -> fidl::Result<()> {
3121            encoder.debug_check_bounds::<ControlGetMaxAbsoluteBrightnessResponse>(offset);
3122            // Delegate to tuple encoding.
3123            fidl::encoding::Encode::<ControlGetMaxAbsoluteBrightnessResponse, D>::encode(
3124                (<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_brightness),),
3125                encoder,
3126                offset,
3127                _depth,
3128            )
3129        }
3130    }
3131    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
3132        fidl::encoding::Encode<ControlGetMaxAbsoluteBrightnessResponse, D> for (T0,)
3133    {
3134        #[inline]
3135        unsafe fn encode(
3136            self,
3137            encoder: &mut fidl::encoding::Encoder<'_, D>,
3138            offset: usize,
3139            depth: fidl::encoding::Depth,
3140        ) -> fidl::Result<()> {
3141            encoder.debug_check_bounds::<ControlGetMaxAbsoluteBrightnessResponse>(offset);
3142            // Zero out padding regions. There's no need to apply masks
3143            // because the unmasked parts will be overwritten by fields.
3144            // Write the fields.
3145            self.0.encode(encoder, offset + 0, depth)?;
3146            Ok(())
3147        }
3148    }
3149
3150    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3151        for ControlGetMaxAbsoluteBrightnessResponse
3152    {
3153        #[inline(always)]
3154        fn new_empty() -> Self {
3155            Self { max_brightness: fidl::new_empty!(f64, D) }
3156        }
3157
3158        #[inline]
3159        unsafe fn decode(
3160            &mut self,
3161            decoder: &mut fidl::encoding::Decoder<'_, D>,
3162            offset: usize,
3163            _depth: fidl::encoding::Depth,
3164        ) -> fidl::Result<()> {
3165            decoder.debug_check_bounds::<Self>(offset);
3166            // Verify that padding bytes are zero.
3167            fidl::decode!(f64, D, &mut self.max_brightness, decoder, offset + 0, _depth)?;
3168            Ok(())
3169        }
3170    }
3171
3172    impl ColorAdjustmentTable {
3173        #[inline(always)]
3174        fn max_ordinal_present(&self) -> u64 {
3175            if let Some(_) = self.matrix {
3176                return 1;
3177            }
3178            0
3179        }
3180    }
3181
3182    impl fidl::encoding::ValueTypeMarker for ColorAdjustmentTable {
3183        type Borrowed<'a> = &'a Self;
3184        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3185            value
3186        }
3187    }
3188
3189    unsafe impl fidl::encoding::TypeMarker for ColorAdjustmentTable {
3190        type Owned = Self;
3191
3192        #[inline(always)]
3193        fn inline_align(_context: fidl::encoding::Context) -> usize {
3194            8
3195        }
3196
3197        #[inline(always)]
3198        fn inline_size(_context: fidl::encoding::Context) -> usize {
3199            16
3200        }
3201    }
3202
3203    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ColorAdjustmentTable, D>
3204        for &ColorAdjustmentTable
3205    {
3206        unsafe fn encode(
3207            self,
3208            encoder: &mut fidl::encoding::Encoder<'_, D>,
3209            offset: usize,
3210            mut depth: fidl::encoding::Depth,
3211        ) -> fidl::Result<()> {
3212            encoder.debug_check_bounds::<ColorAdjustmentTable>(offset);
3213            // Vector header
3214            let max_ordinal: u64 = self.max_ordinal_present();
3215            encoder.write_num(max_ordinal, offset);
3216            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3217            // Calling encoder.out_of_line_offset(0) is not allowed.
3218            if max_ordinal == 0 {
3219                return Ok(());
3220            }
3221            depth.increment()?;
3222            let envelope_size = 8;
3223            let bytes_len = max_ordinal as usize * envelope_size;
3224            #[allow(unused_variables)]
3225            let offset = encoder.out_of_line_offset(bytes_len);
3226            let mut _prev_end_offset: usize = 0;
3227            if 1 > max_ordinal {
3228                return Ok(());
3229            }
3230
3231            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3232            // are envelope_size bytes.
3233            let cur_offset: usize = (1 - 1) * envelope_size;
3234
3235            // Zero reserved fields.
3236            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3237
3238            // Safety:
3239            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3240            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3241            //   envelope_size bytes, there is always sufficient room.
3242            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<f32, 9>, D>(
3243                self.matrix.as_ref().map(
3244                    <fidl::encoding::Array<f32, 9> as fidl::encoding::ValueTypeMarker>::borrow,
3245                ),
3246                encoder,
3247                offset + cur_offset,
3248                depth,
3249            )?;
3250
3251            _prev_end_offset = cur_offset + envelope_size;
3252
3253            Ok(())
3254        }
3255    }
3256
3257    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ColorAdjustmentTable {
3258        #[inline(always)]
3259        fn new_empty() -> Self {
3260            Self::default()
3261        }
3262
3263        unsafe fn decode(
3264            &mut self,
3265            decoder: &mut fidl::encoding::Decoder<'_, D>,
3266            offset: usize,
3267            mut depth: fidl::encoding::Depth,
3268        ) -> fidl::Result<()> {
3269            decoder.debug_check_bounds::<Self>(offset);
3270            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3271                None => return Err(fidl::Error::NotNullable),
3272                Some(len) => len,
3273            };
3274            // Calling decoder.out_of_line_offset(0) is not allowed.
3275            if len == 0 {
3276                return Ok(());
3277            };
3278            depth.increment()?;
3279            let envelope_size = 8;
3280            let bytes_len = len * envelope_size;
3281            let offset = decoder.out_of_line_offset(bytes_len)?;
3282            // Decode the envelope for each type.
3283            let mut _next_ordinal_to_read = 0;
3284            let mut next_offset = offset;
3285            let end_offset = offset + bytes_len;
3286            _next_ordinal_to_read += 1;
3287            if next_offset >= end_offset {
3288                return Ok(());
3289            }
3290
3291            // Decode unknown envelopes for gaps in ordinals.
3292            while _next_ordinal_to_read < 1 {
3293                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3294                _next_ordinal_to_read += 1;
3295                next_offset += envelope_size;
3296            }
3297
3298            let next_out_of_line = decoder.next_out_of_line();
3299            let handles_before = decoder.remaining_handles();
3300            if let Some((inlined, num_bytes, num_handles)) =
3301                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3302            {
3303                let member_inline_size =
3304                    <fidl::encoding::Array<f32, 9> as fidl::encoding::TypeMarker>::inline_size(
3305                        decoder.context,
3306                    );
3307                if inlined != (member_inline_size <= 4) {
3308                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3309                }
3310                let inner_offset;
3311                let mut inner_depth = depth.clone();
3312                if inlined {
3313                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3314                    inner_offset = next_offset;
3315                } else {
3316                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3317                    inner_depth.increment()?;
3318                }
3319                let val_ref = self
3320                    .matrix
3321                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<f32, 9>, D));
3322                fidl::decode!(fidl::encoding::Array<f32, 9>, D, val_ref, decoder, inner_offset, inner_depth)?;
3323                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3324                {
3325                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3326                }
3327                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3328                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3329                }
3330            }
3331
3332            next_offset += envelope_size;
3333
3334            // Decode the remaining unknown envelopes.
3335            while next_offset < end_offset {
3336                _next_ordinal_to_read += 1;
3337                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3338                next_offset += envelope_size;
3339            }
3340
3341            Ok(())
3342        }
3343    }
3344}