fidl_fuchsia_ui_display_color/
fidl_fuchsia_ui_display_color.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 _};
10pub use fidl_fuchsia_ui_display_color_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ConverterSetValuesRequest {
16    pub properties: ConversionProperties,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConverterSetValuesRequest {}
20
21#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
22pub struct ConverterMarker;
23
24impl fidl::endpoints::ProtocolMarker for ConverterMarker {
25    type Proxy = ConverterProxy;
26    type RequestStream = ConverterRequestStream;
27    #[cfg(target_os = "fuchsia")]
28    type SynchronousProxy = ConverterSynchronousProxy;
29
30    const DEBUG_NAME: &'static str = "fuchsia.ui.display.color.Converter";
31}
32impl fidl::endpoints::DiscoverableProtocolMarker for ConverterMarker {}
33
34pub trait ConverterProxyInterface: Send + Sync {
35    type SetValuesResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
36    fn r#set_values(&self, properties: &ConversionProperties) -> Self::SetValuesResponseFut;
37    type SetMinimumRgbResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
38    fn r#set_minimum_rgb(&self, minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut;
39}
40#[derive(Debug)]
41#[cfg(target_os = "fuchsia")]
42pub struct ConverterSynchronousProxy {
43    client: fidl::client::sync::Client,
44}
45
46#[cfg(target_os = "fuchsia")]
47impl fidl::endpoints::SynchronousProxy for ConverterSynchronousProxy {
48    type Proxy = ConverterProxy;
49    type Protocol = ConverterMarker;
50
51    fn from_channel(inner: fidl::Channel) -> Self {
52        Self::new(inner)
53    }
54
55    fn into_channel(self) -> fidl::Channel {
56        self.client.into_channel()
57    }
58
59    fn as_channel(&self) -> &fidl::Channel {
60        self.client.as_channel()
61    }
62}
63
64#[cfg(target_os = "fuchsia")]
65impl ConverterSynchronousProxy {
66    pub fn new(channel: fidl::Channel) -> Self {
67        let protocol_name = <ConverterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
68        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
69    }
70
71    pub fn into_channel(self) -> fidl::Channel {
72        self.client.into_channel()
73    }
74
75    /// Waits until an event arrives and returns it. It is safe for other
76    /// threads to make concurrent requests while waiting for an event.
77    pub fn wait_for_event(
78        &self,
79        deadline: zx::MonotonicInstant,
80    ) -> Result<ConverterEvent, fidl::Error> {
81        ConverterEvent::decode(self.client.wait_for_event(deadline)?)
82    }
83
84    /// Modifies the color of final display output of rendered content. The sole parameter is a
85    /// table of |ConversionProperties|, which contains the parameters required to apply the
86    /// color conversion formula to the display. Please see |ConversionProperties| defined
87    /// above for more information.
88    ///
89    /// All parameters in the properties table must be normal 32-bit floating point values.
90    /// If any of the values do not meet this specification, the new color conversion values
91    /// will not be applied and a value of ZX_ERR_INVALID_ARGS will be returned. Otherwise,
92    /// the return value will be ZX_OK: https://en.wikipedia.org/wiki/Normal_number_%28computing%29.
93    /// Once a value of ZX_OK has been returned to the client, the color conversion values are ready
94    /// to be used in future render calls, including screenshots.
95    ///
96    /// Values in |ConversionProperties| may also be left blank. The default values for each member,
97    /// if left blank, are as follows:
98    ///     coefficients =
99    ///             [1, 0, 0,
100    ///              0, 1, 0,
101    ///              0, 0, 1]  (i.e. the identity matrix)
102    ///     preoffsets = [0,0,0]
103    ///     postoffsets = [0,0,0]
104    /// Thus, ColorConversion can be reset by passing in an empty table to this function.
105    ///
106    /// Hardware that support color conversion generally accept a limited range of coefficient
107    /// values. Coefficients in the range of [-2, 2] inclusive will be accepted by most
108    /// hardware. The hardware driver will clamp values that are outside its acceptable range.
109    ///
110    /// `preoffsets`, `postoffsets`: Clients are encouraged to produce color conversion values that
111    /// do not depend on pre and post offsets since some hardware do not have support for that.
112    /// For cases where pre and post offset values need to be used, the range should be limited to
113    /// (-1, 1).
114    pub fn r#set_values(
115        &self,
116        mut properties: &ConversionProperties,
117        ___deadline: zx::MonotonicInstant,
118    ) -> Result<i32, fidl::Error> {
119        let _response =
120            self.client.send_query::<ConverterSetValuesRequest, ConverterSetValuesResponse>(
121                (properties,),
122                0x64131a672b34af8d,
123                fidl::encoding::DynamicFlags::empty(),
124                ___deadline,
125            )?;
126        Ok(_response.res)
127    }
128
129    /// Submits a minimum value that all channels of all pixels rendered to the display
130    /// are clamped to. This can be used to mitigate the apparent effects of backlight
131    /// bleeding on certain devices in low-light environments.
132    ///
133    /// The valid range for a minimum value is [0, 255] (inclusive).  For a new
134    /// minimum value M, each color channel's range will be limited to [M, 255].
135    ///
136    /// Callers should wait for the acknowledgement to return before submitting another
137    /// call to this function. The minimum_rgb clamping can be removed simply by submitting
138    /// a value of 0.
139    ///
140    /// Not all hardware supports this feature. So this function returns |true|
141    /// if successfully applied and |false| if unsupported.
142    pub fn r#set_minimum_rgb(
143        &self,
144        mut minimum_rgb: u8,
145        ___deadline: zx::MonotonicInstant,
146    ) -> Result<bool, fidl::Error> {
147        let _response = self
148            .client
149            .send_query::<ConverterSetMinimumRgbRequest, ConverterSetMinimumRgbResponse>(
150                (minimum_rgb,),
151                0x45dd02bf82f653d1,
152                fidl::encoding::DynamicFlags::empty(),
153                ___deadline,
154            )?;
155        Ok(_response.supported)
156    }
157}
158
159#[derive(Debug, Clone)]
160pub struct ConverterProxy {
161    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
162}
163
164impl fidl::endpoints::Proxy for ConverterProxy {
165    type Protocol = ConverterMarker;
166
167    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
168        Self::new(inner)
169    }
170
171    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
172        self.client.into_channel().map_err(|client| Self { client })
173    }
174
175    fn as_channel(&self) -> &::fidl::AsyncChannel {
176        self.client.as_channel()
177    }
178}
179
180impl ConverterProxy {
181    /// Create a new Proxy for fuchsia.ui.display.color/Converter.
182    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
183        let protocol_name = <ConverterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
184        Self { client: fidl::client::Client::new(channel, protocol_name) }
185    }
186
187    /// Get a Stream of events from the remote end of the protocol.
188    ///
189    /// # Panics
190    ///
191    /// Panics if the event stream was already taken.
192    pub fn take_event_stream(&self) -> ConverterEventStream {
193        ConverterEventStream { event_receiver: self.client.take_event_receiver() }
194    }
195
196    /// Modifies the color of final display output of rendered content. The sole parameter is a
197    /// table of |ConversionProperties|, which contains the parameters required to apply the
198    /// color conversion formula to the display. Please see |ConversionProperties| defined
199    /// above for more information.
200    ///
201    /// All parameters in the properties table must be normal 32-bit floating point values.
202    /// If any of the values do not meet this specification, the new color conversion values
203    /// will not be applied and a value of ZX_ERR_INVALID_ARGS will be returned. Otherwise,
204    /// the return value will be ZX_OK: https://en.wikipedia.org/wiki/Normal_number_%28computing%29.
205    /// Once a value of ZX_OK has been returned to the client, the color conversion values are ready
206    /// to be used in future render calls, including screenshots.
207    ///
208    /// Values in |ConversionProperties| may also be left blank. The default values for each member,
209    /// if left blank, are as follows:
210    ///     coefficients =
211    ///             [1, 0, 0,
212    ///              0, 1, 0,
213    ///              0, 0, 1]  (i.e. the identity matrix)
214    ///     preoffsets = [0,0,0]
215    ///     postoffsets = [0,0,0]
216    /// Thus, ColorConversion can be reset by passing in an empty table to this function.
217    ///
218    /// Hardware that support color conversion generally accept a limited range of coefficient
219    /// values. Coefficients in the range of [-2, 2] inclusive will be accepted by most
220    /// hardware. The hardware driver will clamp values that are outside its acceptable range.
221    ///
222    /// `preoffsets`, `postoffsets`: Clients are encouraged to produce color conversion values that
223    /// do not depend on pre and post offsets since some hardware do not have support for that.
224    /// For cases where pre and post offset values need to be used, the range should be limited to
225    /// (-1, 1).
226    pub fn r#set_values(
227        &self,
228        mut properties: &ConversionProperties,
229    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
230        ConverterProxyInterface::r#set_values(self, properties)
231    }
232
233    /// Submits a minimum value that all channels of all pixels rendered to the display
234    /// are clamped to. This can be used to mitigate the apparent effects of backlight
235    /// bleeding on certain devices in low-light environments.
236    ///
237    /// The valid range for a minimum value is [0, 255] (inclusive).  For a new
238    /// minimum value M, each color channel's range will be limited to [M, 255].
239    ///
240    /// Callers should wait for the acknowledgement to return before submitting another
241    /// call to this function. The minimum_rgb clamping can be removed simply by submitting
242    /// a value of 0.
243    ///
244    /// Not all hardware supports this feature. So this function returns |true|
245    /// if successfully applied and |false| if unsupported.
246    pub fn r#set_minimum_rgb(
247        &self,
248        mut minimum_rgb: u8,
249    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
250        ConverterProxyInterface::r#set_minimum_rgb(self, minimum_rgb)
251    }
252}
253
254impl ConverterProxyInterface for ConverterProxy {
255    type SetValuesResponseFut =
256        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
257    fn r#set_values(&self, mut properties: &ConversionProperties) -> Self::SetValuesResponseFut {
258        fn _decode(
259            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
260        ) -> Result<i32, fidl::Error> {
261            let _response = fidl::client::decode_transaction_body::<
262                ConverterSetValuesResponse,
263                fidl::encoding::DefaultFuchsiaResourceDialect,
264                0x64131a672b34af8d,
265            >(_buf?)?;
266            Ok(_response.res)
267        }
268        self.client.send_query_and_decode::<ConverterSetValuesRequest, i32>(
269            (properties,),
270            0x64131a672b34af8d,
271            fidl::encoding::DynamicFlags::empty(),
272            _decode,
273        )
274    }
275
276    type SetMinimumRgbResponseFut =
277        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
278    fn r#set_minimum_rgb(&self, mut minimum_rgb: u8) -> Self::SetMinimumRgbResponseFut {
279        fn _decode(
280            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
281        ) -> Result<bool, fidl::Error> {
282            let _response = fidl::client::decode_transaction_body::<
283                ConverterSetMinimumRgbResponse,
284                fidl::encoding::DefaultFuchsiaResourceDialect,
285                0x45dd02bf82f653d1,
286            >(_buf?)?;
287            Ok(_response.supported)
288        }
289        self.client.send_query_and_decode::<ConverterSetMinimumRgbRequest, bool>(
290            (minimum_rgb,),
291            0x45dd02bf82f653d1,
292            fidl::encoding::DynamicFlags::empty(),
293            _decode,
294        )
295    }
296}
297
298pub struct ConverterEventStream {
299    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
300}
301
302impl std::marker::Unpin for ConverterEventStream {}
303
304impl futures::stream::FusedStream for ConverterEventStream {
305    fn is_terminated(&self) -> bool {
306        self.event_receiver.is_terminated()
307    }
308}
309
310impl futures::Stream for ConverterEventStream {
311    type Item = Result<ConverterEvent, fidl::Error>;
312
313    fn poll_next(
314        mut self: std::pin::Pin<&mut Self>,
315        cx: &mut std::task::Context<'_>,
316    ) -> std::task::Poll<Option<Self::Item>> {
317        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
318            &mut self.event_receiver,
319            cx
320        )?) {
321            Some(buf) => std::task::Poll::Ready(Some(ConverterEvent::decode(buf))),
322            None => std::task::Poll::Ready(None),
323        }
324    }
325}
326
327#[derive(Debug)]
328pub enum ConverterEvent {}
329
330impl ConverterEvent {
331    /// Decodes a message buffer as a [`ConverterEvent`].
332    fn decode(
333        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
334    ) -> Result<ConverterEvent, fidl::Error> {
335        let (bytes, _handles) = buf.split_mut();
336        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
337        debug_assert_eq!(tx_header.tx_id, 0);
338        match tx_header.ordinal {
339            _ => Err(fidl::Error::UnknownOrdinal {
340                ordinal: tx_header.ordinal,
341                protocol_name: <ConverterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
342            }),
343        }
344    }
345}
346
347/// A Stream of incoming requests for fuchsia.ui.display.color/Converter.
348pub struct ConverterRequestStream {
349    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
350    is_terminated: bool,
351}
352
353impl std::marker::Unpin for ConverterRequestStream {}
354
355impl futures::stream::FusedStream for ConverterRequestStream {
356    fn is_terminated(&self) -> bool {
357        self.is_terminated
358    }
359}
360
361impl fidl::endpoints::RequestStream for ConverterRequestStream {
362    type Protocol = ConverterMarker;
363    type ControlHandle = ConverterControlHandle;
364
365    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
366        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
367    }
368
369    fn control_handle(&self) -> Self::ControlHandle {
370        ConverterControlHandle { inner: self.inner.clone() }
371    }
372
373    fn into_inner(
374        self,
375    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
376    {
377        (self.inner, self.is_terminated)
378    }
379
380    fn from_inner(
381        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
382        is_terminated: bool,
383    ) -> Self {
384        Self { inner, is_terminated }
385    }
386}
387
388impl futures::Stream for ConverterRequestStream {
389    type Item = Result<ConverterRequest, fidl::Error>;
390
391    fn poll_next(
392        mut self: std::pin::Pin<&mut Self>,
393        cx: &mut std::task::Context<'_>,
394    ) -> std::task::Poll<Option<Self::Item>> {
395        let this = &mut *self;
396        if this.inner.check_shutdown(cx) {
397            this.is_terminated = true;
398            return std::task::Poll::Ready(None);
399        }
400        if this.is_terminated {
401            panic!("polled ConverterRequestStream after completion");
402        }
403        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
404            |bytes, handles| {
405                match this.inner.channel().read_etc(cx, bytes, handles) {
406                    std::task::Poll::Ready(Ok(())) => {}
407                    std::task::Poll::Pending => return std::task::Poll::Pending,
408                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
409                        this.is_terminated = true;
410                        return std::task::Poll::Ready(None);
411                    }
412                    std::task::Poll::Ready(Err(e)) => {
413                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
414                            e.into(),
415                        ))))
416                    }
417                }
418
419                // A message has been received from the channel
420                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
421
422                std::task::Poll::Ready(Some(match header.ordinal {
423                    0x64131a672b34af8d => {
424                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
425                        let mut req = fidl::new_empty!(
426                            ConverterSetValuesRequest,
427                            fidl::encoding::DefaultFuchsiaResourceDialect
428                        );
429                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConverterSetValuesRequest>(&header, _body_bytes, handles, &mut req)?;
430                        let control_handle = ConverterControlHandle { inner: this.inner.clone() };
431                        Ok(ConverterRequest::SetValues {
432                            properties: req.properties,
433
434                            responder: ConverterSetValuesResponder {
435                                control_handle: std::mem::ManuallyDrop::new(control_handle),
436                                tx_id: header.tx_id,
437                            },
438                        })
439                    }
440                    0x45dd02bf82f653d1 => {
441                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
442                        let mut req = fidl::new_empty!(
443                            ConverterSetMinimumRgbRequest,
444                            fidl::encoding::DefaultFuchsiaResourceDialect
445                        );
446                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConverterSetMinimumRgbRequest>(&header, _body_bytes, handles, &mut req)?;
447                        let control_handle = ConverterControlHandle { inner: this.inner.clone() };
448                        Ok(ConverterRequest::SetMinimumRgb {
449                            minimum_rgb: req.minimum_rgb,
450
451                            responder: ConverterSetMinimumRgbResponder {
452                                control_handle: std::mem::ManuallyDrop::new(control_handle),
453                                tx_id: header.tx_id,
454                            },
455                        })
456                    }
457                    _ => Err(fidl::Error::UnknownOrdinal {
458                        ordinal: header.ordinal,
459                        protocol_name:
460                            <ConverterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
461                    }),
462                }))
463            },
464        )
465    }
466}
467
468#[derive(Debug)]
469pub enum ConverterRequest {
470    /// Modifies the color of final display output of rendered content. The sole parameter is a
471    /// table of |ConversionProperties|, which contains the parameters required to apply the
472    /// color conversion formula to the display. Please see |ConversionProperties| defined
473    /// above for more information.
474    ///
475    /// All parameters in the properties table must be normal 32-bit floating point values.
476    /// If any of the values do not meet this specification, the new color conversion values
477    /// will not be applied and a value of ZX_ERR_INVALID_ARGS will be returned. Otherwise,
478    /// the return value will be ZX_OK: https://en.wikipedia.org/wiki/Normal_number_%28computing%29.
479    /// Once a value of ZX_OK has been returned to the client, the color conversion values are ready
480    /// to be used in future render calls, including screenshots.
481    ///
482    /// Values in |ConversionProperties| may also be left blank. The default values for each member,
483    /// if left blank, are as follows:
484    ///     coefficients =
485    ///             [1, 0, 0,
486    ///              0, 1, 0,
487    ///              0, 0, 1]  (i.e. the identity matrix)
488    ///     preoffsets = [0,0,0]
489    ///     postoffsets = [0,0,0]
490    /// Thus, ColorConversion can be reset by passing in an empty table to this function.
491    ///
492    /// Hardware that support color conversion generally accept a limited range of coefficient
493    /// values. Coefficients in the range of [-2, 2] inclusive will be accepted by most
494    /// hardware. The hardware driver will clamp values that are outside its acceptable range.
495    ///
496    /// `preoffsets`, `postoffsets`: Clients are encouraged to produce color conversion values that
497    /// do not depend on pre and post offsets since some hardware do not have support for that.
498    /// For cases where pre and post offset values need to be used, the range should be limited to
499    /// (-1, 1).
500    SetValues { properties: ConversionProperties, responder: ConverterSetValuesResponder },
501    /// Submits a minimum value that all channels of all pixels rendered to the display
502    /// are clamped to. This can be used to mitigate the apparent effects of backlight
503    /// bleeding on certain devices in low-light environments.
504    ///
505    /// The valid range for a minimum value is [0, 255] (inclusive).  For a new
506    /// minimum value M, each color channel's range will be limited to [M, 255].
507    ///
508    /// Callers should wait for the acknowledgement to return before submitting another
509    /// call to this function. The minimum_rgb clamping can be removed simply by submitting
510    /// a value of 0.
511    ///
512    /// Not all hardware supports this feature. So this function returns |true|
513    /// if successfully applied and |false| if unsupported.
514    SetMinimumRgb { minimum_rgb: u8, responder: ConverterSetMinimumRgbResponder },
515}
516
517impl ConverterRequest {
518    #[allow(irrefutable_let_patterns)]
519    pub fn into_set_values(self) -> Option<(ConversionProperties, ConverterSetValuesResponder)> {
520        if let ConverterRequest::SetValues { properties, responder } = self {
521            Some((properties, responder))
522        } else {
523            None
524        }
525    }
526
527    #[allow(irrefutable_let_patterns)]
528    pub fn into_set_minimum_rgb(self) -> Option<(u8, ConverterSetMinimumRgbResponder)> {
529        if let ConverterRequest::SetMinimumRgb { minimum_rgb, responder } = self {
530            Some((minimum_rgb, responder))
531        } else {
532            None
533        }
534    }
535
536    /// Name of the method defined in FIDL
537    pub fn method_name(&self) -> &'static str {
538        match *self {
539            ConverterRequest::SetValues { .. } => "set_values",
540            ConverterRequest::SetMinimumRgb { .. } => "set_minimum_rgb",
541        }
542    }
543}
544
545#[derive(Debug, Clone)]
546pub struct ConverterControlHandle {
547    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
548}
549
550impl fidl::endpoints::ControlHandle for ConverterControlHandle {
551    fn shutdown(&self) {
552        self.inner.shutdown()
553    }
554    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
555        self.inner.shutdown_with_epitaph(status)
556    }
557
558    fn is_closed(&self) -> bool {
559        self.inner.channel().is_closed()
560    }
561    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
562        self.inner.channel().on_closed()
563    }
564
565    #[cfg(target_os = "fuchsia")]
566    fn signal_peer(
567        &self,
568        clear_mask: zx::Signals,
569        set_mask: zx::Signals,
570    ) -> Result<(), zx_status::Status> {
571        use fidl::Peered;
572        self.inner.channel().signal_peer(clear_mask, set_mask)
573    }
574}
575
576impl ConverterControlHandle {}
577
578#[must_use = "FIDL methods require a response to be sent"]
579#[derive(Debug)]
580pub struct ConverterSetValuesResponder {
581    control_handle: std::mem::ManuallyDrop<ConverterControlHandle>,
582    tx_id: u32,
583}
584
585/// Set the the channel to be shutdown (see [`ConverterControlHandle::shutdown`])
586/// if the responder is dropped without sending a response, so that the client
587/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
588impl std::ops::Drop for ConverterSetValuesResponder {
589    fn drop(&mut self) {
590        self.control_handle.shutdown();
591        // Safety: drops once, never accessed again
592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
593    }
594}
595
596impl fidl::endpoints::Responder for ConverterSetValuesResponder {
597    type ControlHandle = ConverterControlHandle;
598
599    fn control_handle(&self) -> &ConverterControlHandle {
600        &self.control_handle
601    }
602
603    fn drop_without_shutdown(mut self) {
604        // Safety: drops once, never accessed again due to mem::forget
605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
606        // Prevent Drop from running (which would shut down the channel)
607        std::mem::forget(self);
608    }
609}
610
611impl ConverterSetValuesResponder {
612    /// Sends a response to the FIDL transaction.
613    ///
614    /// Sets the channel to shutdown if an error occurs.
615    pub fn send(self, mut res: i32) -> Result<(), fidl::Error> {
616        let _result = self.send_raw(res);
617        if _result.is_err() {
618            self.control_handle.shutdown();
619        }
620        self.drop_without_shutdown();
621        _result
622    }
623
624    /// Similar to "send" but does not shutdown the channel if an error occurs.
625    pub fn send_no_shutdown_on_err(self, mut res: i32) -> Result<(), fidl::Error> {
626        let _result = self.send_raw(res);
627        self.drop_without_shutdown();
628        _result
629    }
630
631    fn send_raw(&self, mut res: i32) -> Result<(), fidl::Error> {
632        self.control_handle.inner.send::<ConverterSetValuesResponse>(
633            (res,),
634            self.tx_id,
635            0x64131a672b34af8d,
636            fidl::encoding::DynamicFlags::empty(),
637        )
638    }
639}
640
641#[must_use = "FIDL methods require a response to be sent"]
642#[derive(Debug)]
643pub struct ConverterSetMinimumRgbResponder {
644    control_handle: std::mem::ManuallyDrop<ConverterControlHandle>,
645    tx_id: u32,
646}
647
648/// Set the the channel to be shutdown (see [`ConverterControlHandle::shutdown`])
649/// if the responder is dropped without sending a response, so that the client
650/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
651impl std::ops::Drop for ConverterSetMinimumRgbResponder {
652    fn drop(&mut self) {
653        self.control_handle.shutdown();
654        // Safety: drops once, never accessed again
655        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
656    }
657}
658
659impl fidl::endpoints::Responder for ConverterSetMinimumRgbResponder {
660    type ControlHandle = ConverterControlHandle;
661
662    fn control_handle(&self) -> &ConverterControlHandle {
663        &self.control_handle
664    }
665
666    fn drop_without_shutdown(mut self) {
667        // Safety: drops once, never accessed again due to mem::forget
668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
669        // Prevent Drop from running (which would shut down the channel)
670        std::mem::forget(self);
671    }
672}
673
674impl ConverterSetMinimumRgbResponder {
675    /// Sends a response to the FIDL transaction.
676    ///
677    /// Sets the channel to shutdown if an error occurs.
678    pub fn send(self, mut supported: bool) -> Result<(), fidl::Error> {
679        let _result = self.send_raw(supported);
680        if _result.is_err() {
681            self.control_handle.shutdown();
682        }
683        self.drop_without_shutdown();
684        _result
685    }
686
687    /// Similar to "send" but does not shutdown the channel if an error occurs.
688    pub fn send_no_shutdown_on_err(self, mut supported: bool) -> Result<(), fidl::Error> {
689        let _result = self.send_raw(supported);
690        self.drop_without_shutdown();
691        _result
692    }
693
694    fn send_raw(&self, mut supported: bool) -> Result<(), fidl::Error> {
695        self.control_handle.inner.send::<ConverterSetMinimumRgbResponse>(
696            (supported,),
697            self.tx_id,
698            0x45dd02bf82f653d1,
699            fidl::encoding::DynamicFlags::empty(),
700        )
701    }
702}
703
704mod internal {
705    use super::*;
706
707    impl fidl::encoding::ResourceTypeMarker for ConverterSetValuesRequest {
708        type Borrowed<'a> = &'a mut Self;
709        fn take_or_borrow<'a>(
710            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
711        ) -> Self::Borrowed<'a> {
712            value
713        }
714    }
715
716    unsafe impl fidl::encoding::TypeMarker for ConverterSetValuesRequest {
717        type Owned = Self;
718
719        #[inline(always)]
720        fn inline_align(_context: fidl::encoding::Context) -> usize {
721            8
722        }
723
724        #[inline(always)]
725        fn inline_size(_context: fidl::encoding::Context) -> usize {
726            16
727        }
728    }
729
730    unsafe impl
731        fidl::encoding::Encode<
732            ConverterSetValuesRequest,
733            fidl::encoding::DefaultFuchsiaResourceDialect,
734        > for &mut ConverterSetValuesRequest
735    {
736        #[inline]
737        unsafe fn encode(
738            self,
739            encoder: &mut fidl::encoding::Encoder<
740                '_,
741                fidl::encoding::DefaultFuchsiaResourceDialect,
742            >,
743            offset: usize,
744            _depth: fidl::encoding::Depth,
745        ) -> fidl::Result<()> {
746            encoder.debug_check_bounds::<ConverterSetValuesRequest>(offset);
747            // Delegate to tuple encoding.
748            fidl::encoding::Encode::<
749                ConverterSetValuesRequest,
750                fidl::encoding::DefaultFuchsiaResourceDialect,
751            >::encode(
752                (<ConversionProperties as fidl::encoding::ValueTypeMarker>::borrow(
753                    &self.properties,
754                ),),
755                encoder,
756                offset,
757                _depth,
758            )
759        }
760    }
761    unsafe impl<
762            T0: fidl::encoding::Encode<
763                ConversionProperties,
764                fidl::encoding::DefaultFuchsiaResourceDialect,
765            >,
766        >
767        fidl::encoding::Encode<
768            ConverterSetValuesRequest,
769            fidl::encoding::DefaultFuchsiaResourceDialect,
770        > for (T0,)
771    {
772        #[inline]
773        unsafe fn encode(
774            self,
775            encoder: &mut fidl::encoding::Encoder<
776                '_,
777                fidl::encoding::DefaultFuchsiaResourceDialect,
778            >,
779            offset: usize,
780            depth: fidl::encoding::Depth,
781        ) -> fidl::Result<()> {
782            encoder.debug_check_bounds::<ConverterSetValuesRequest>(offset);
783            // Zero out padding regions. There's no need to apply masks
784            // because the unmasked parts will be overwritten by fields.
785            // Write the fields.
786            self.0.encode(encoder, offset + 0, depth)?;
787            Ok(())
788        }
789    }
790
791    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
792        for ConverterSetValuesRequest
793    {
794        #[inline(always)]
795        fn new_empty() -> Self {
796            Self {
797                properties: fidl::new_empty!(
798                    ConversionProperties,
799                    fidl::encoding::DefaultFuchsiaResourceDialect
800                ),
801            }
802        }
803
804        #[inline]
805        unsafe fn decode(
806            &mut self,
807            decoder: &mut fidl::encoding::Decoder<
808                '_,
809                fidl::encoding::DefaultFuchsiaResourceDialect,
810            >,
811            offset: usize,
812            _depth: fidl::encoding::Depth,
813        ) -> fidl::Result<()> {
814            decoder.debug_check_bounds::<Self>(offset);
815            // Verify that padding bytes are zero.
816            fidl::decode!(
817                ConversionProperties,
818                fidl::encoding::DefaultFuchsiaResourceDialect,
819                &mut self.properties,
820                decoder,
821                offset + 0,
822                _depth
823            )?;
824            Ok(())
825        }
826    }
827}