Skip to main content

fidl_fuchsia_accessibility/
fidl_fuchsia_accessibility.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_accessibility_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ColorTransformRegisterColorTransformHandlerRequest {
16    pub handler: fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for ColorTransformRegisterColorTransformHandlerRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct MagnifierRegisterHandlerRequest {
26    pub handler: fidl::endpoints::ClientEnd<MagnificationHandlerMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for MagnifierRegisterHandlerRequest
31{
32}
33
34#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
35pub struct ColorTransformMarker;
36
37impl fidl::endpoints::ProtocolMarker for ColorTransformMarker {
38    type Proxy = ColorTransformProxy;
39    type RequestStream = ColorTransformRequestStream;
40    #[cfg(target_os = "fuchsia")]
41    type SynchronousProxy = ColorTransformSynchronousProxy;
42
43    const DEBUG_NAME: &'static str = "fuchsia.accessibility.ColorTransform";
44}
45impl fidl::endpoints::DiscoverableProtocolMarker for ColorTransformMarker {}
46
47pub trait ColorTransformProxyInterface: Send + Sync {
48    fn r#register_color_transform_handler(
49        &self,
50        handler: fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>,
51    ) -> Result<(), fidl::Error>;
52}
53#[derive(Debug)]
54#[cfg(target_os = "fuchsia")]
55pub struct ColorTransformSynchronousProxy {
56    client: fidl::client::sync::Client,
57}
58
59#[cfg(target_os = "fuchsia")]
60impl fidl::endpoints::SynchronousProxy for ColorTransformSynchronousProxy {
61    type Proxy = ColorTransformProxy;
62    type Protocol = ColorTransformMarker;
63
64    fn from_channel(inner: fidl::Channel) -> Self {
65        Self::new(inner)
66    }
67
68    fn into_channel(self) -> fidl::Channel {
69        self.client.into_channel()
70    }
71
72    fn as_channel(&self) -> &fidl::Channel {
73        self.client.as_channel()
74    }
75}
76
77#[cfg(target_os = "fuchsia")]
78impl ColorTransformSynchronousProxy {
79    pub fn new(channel: fidl::Channel) -> Self {
80        Self { client: fidl::client::sync::Client::new(channel) }
81    }
82
83    pub fn into_channel(self) -> fidl::Channel {
84        self.client.into_channel()
85    }
86
87    /// Waits until an event arrives and returns it. It is safe for other
88    /// threads to make concurrent requests while waiting for an event.
89    pub fn wait_for_event(
90        &self,
91        deadline: zx::MonotonicInstant,
92    ) -> Result<ColorTransformEvent, fidl::Error> {
93        ColorTransformEvent::decode(self.client.wait_for_event::<ColorTransformMarker>(deadline)?)
94    }
95
96    /// Registers a handler for changes in the color transform configuration.
97    pub fn r#register_color_transform_handler(
98        &self,
99        mut handler: fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>,
100    ) -> Result<(), fidl::Error> {
101        self.client.send::<ColorTransformRegisterColorTransformHandlerRequest>(
102            (handler,),
103            0x49ff3b83fcb05b88,
104            fidl::encoding::DynamicFlags::empty(),
105        )
106    }
107}
108
109#[cfg(target_os = "fuchsia")]
110impl From<ColorTransformSynchronousProxy> for zx::NullableHandle {
111    fn from(value: ColorTransformSynchronousProxy) -> Self {
112        value.into_channel().into()
113    }
114}
115
116#[cfg(target_os = "fuchsia")]
117impl From<fidl::Channel> for ColorTransformSynchronousProxy {
118    fn from(value: fidl::Channel) -> Self {
119        Self::new(value)
120    }
121}
122
123#[cfg(target_os = "fuchsia")]
124impl fidl::endpoints::FromClient for ColorTransformSynchronousProxy {
125    type Protocol = ColorTransformMarker;
126
127    fn from_client(value: fidl::endpoints::ClientEnd<ColorTransformMarker>) -> Self {
128        Self::new(value.into_channel())
129    }
130}
131
132#[derive(Debug, Clone)]
133pub struct ColorTransformProxy {
134    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
135}
136
137impl fidl::endpoints::Proxy for ColorTransformProxy {
138    type Protocol = ColorTransformMarker;
139
140    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
141        Self::new(inner)
142    }
143
144    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
145        self.client.into_channel().map_err(|client| Self { client })
146    }
147
148    fn as_channel(&self) -> &::fidl::AsyncChannel {
149        self.client.as_channel()
150    }
151}
152
153impl ColorTransformProxy {
154    /// Create a new Proxy for fuchsia.accessibility/ColorTransform.
155    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
156        let protocol_name = <ColorTransformMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
157        Self { client: fidl::client::Client::new(channel, protocol_name) }
158    }
159
160    /// Get a Stream of events from the remote end of the protocol.
161    ///
162    /// # Panics
163    ///
164    /// Panics if the event stream was already taken.
165    pub fn take_event_stream(&self) -> ColorTransformEventStream {
166        ColorTransformEventStream { event_receiver: self.client.take_event_receiver() }
167    }
168
169    /// Registers a handler for changes in the color transform configuration.
170    pub fn r#register_color_transform_handler(
171        &self,
172        mut handler: fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>,
173    ) -> Result<(), fidl::Error> {
174        ColorTransformProxyInterface::r#register_color_transform_handler(self, handler)
175    }
176}
177
178impl ColorTransformProxyInterface for ColorTransformProxy {
179    fn r#register_color_transform_handler(
180        &self,
181        mut handler: fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>,
182    ) -> Result<(), fidl::Error> {
183        self.client.send::<ColorTransformRegisterColorTransformHandlerRequest>(
184            (handler,),
185            0x49ff3b83fcb05b88,
186            fidl::encoding::DynamicFlags::empty(),
187        )
188    }
189}
190
191pub struct ColorTransformEventStream {
192    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
193}
194
195impl std::marker::Unpin for ColorTransformEventStream {}
196
197impl futures::stream::FusedStream for ColorTransformEventStream {
198    fn is_terminated(&self) -> bool {
199        self.event_receiver.is_terminated()
200    }
201}
202
203impl futures::Stream for ColorTransformEventStream {
204    type Item = Result<ColorTransformEvent, fidl::Error>;
205
206    fn poll_next(
207        mut self: std::pin::Pin<&mut Self>,
208        cx: &mut std::task::Context<'_>,
209    ) -> std::task::Poll<Option<Self::Item>> {
210        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
211            &mut self.event_receiver,
212            cx
213        )?) {
214            Some(buf) => std::task::Poll::Ready(Some(ColorTransformEvent::decode(buf))),
215            None => std::task::Poll::Ready(None),
216        }
217    }
218}
219
220#[derive(Debug)]
221pub enum ColorTransformEvent {}
222
223impl ColorTransformEvent {
224    /// Decodes a message buffer as a [`ColorTransformEvent`].
225    fn decode(
226        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
227    ) -> Result<ColorTransformEvent, fidl::Error> {
228        let (bytes, _handles) = buf.split_mut();
229        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
230        debug_assert_eq!(tx_header.tx_id, 0);
231        match tx_header.ordinal {
232            _ => Err(fidl::Error::UnknownOrdinal {
233                ordinal: tx_header.ordinal,
234                protocol_name:
235                    <ColorTransformMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
236            }),
237        }
238    }
239}
240
241/// A Stream of incoming requests for fuchsia.accessibility/ColorTransform.
242pub struct ColorTransformRequestStream {
243    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
244    is_terminated: bool,
245}
246
247impl std::marker::Unpin for ColorTransformRequestStream {}
248
249impl futures::stream::FusedStream for ColorTransformRequestStream {
250    fn is_terminated(&self) -> bool {
251        self.is_terminated
252    }
253}
254
255impl fidl::endpoints::RequestStream for ColorTransformRequestStream {
256    type Protocol = ColorTransformMarker;
257    type ControlHandle = ColorTransformControlHandle;
258
259    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
260        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
261    }
262
263    fn control_handle(&self) -> Self::ControlHandle {
264        ColorTransformControlHandle { inner: self.inner.clone() }
265    }
266
267    fn into_inner(
268        self,
269    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
270    {
271        (self.inner, self.is_terminated)
272    }
273
274    fn from_inner(
275        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
276        is_terminated: bool,
277    ) -> Self {
278        Self { inner, is_terminated }
279    }
280}
281
282impl futures::Stream for ColorTransformRequestStream {
283    type Item = Result<ColorTransformRequest, fidl::Error>;
284
285    fn poll_next(
286        mut self: std::pin::Pin<&mut Self>,
287        cx: &mut std::task::Context<'_>,
288    ) -> std::task::Poll<Option<Self::Item>> {
289        let this = &mut *self;
290        if this.inner.check_shutdown(cx) {
291            this.is_terminated = true;
292            return std::task::Poll::Ready(None);
293        }
294        if this.is_terminated {
295            panic!("polled ColorTransformRequestStream after completion");
296        }
297        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
298            |bytes, handles| {
299                match this.inner.channel().read_etc(cx, bytes, handles) {
300                    std::task::Poll::Ready(Ok(())) => {}
301                    std::task::Poll::Pending => return std::task::Poll::Pending,
302                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
303                        this.is_terminated = true;
304                        return std::task::Poll::Ready(None);
305                    }
306                    std::task::Poll::Ready(Err(e)) => {
307                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
308                            e.into(),
309                        ))));
310                    }
311                }
312
313                // A message has been received from the channel
314                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
315
316                std::task::Poll::Ready(Some(match header.ordinal {
317                    0x49ff3b83fcb05b88 => {
318                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
319                        let mut req = fidl::new_empty!(
320                            ColorTransformRegisterColorTransformHandlerRequest,
321                            fidl::encoding::DefaultFuchsiaResourceDialect
322                        );
323                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorTransformRegisterColorTransformHandlerRequest>(&header, _body_bytes, handles, &mut req)?;
324                        let control_handle =
325                            ColorTransformControlHandle { inner: this.inner.clone() };
326                        Ok(ColorTransformRequest::RegisterColorTransformHandler {
327                            handler: req.handler,
328
329                            control_handle,
330                        })
331                    }
332                    _ => Err(fidl::Error::UnknownOrdinal {
333                        ordinal: header.ordinal,
334                        protocol_name:
335                            <ColorTransformMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
336                    }),
337                }))
338            },
339        )
340    }
341}
342
343/// Allows a presentation owner to register a handler for color transforms. This API is implemented
344/// by the Accessibility manager and called by Root Presenter.
345#[derive(Debug)]
346pub enum ColorTransformRequest {
347    /// Registers a handler for changes in the color transform configuration.
348    RegisterColorTransformHandler {
349        handler: fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>,
350        control_handle: ColorTransformControlHandle,
351    },
352}
353
354impl ColorTransformRequest {
355    #[allow(irrefutable_let_patterns)]
356    pub fn into_register_color_transform_handler(
357        self,
358    ) -> Option<(
359        fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>,
360        ColorTransformControlHandle,
361    )> {
362        if let ColorTransformRequest::RegisterColorTransformHandler { handler, control_handle } =
363            self
364        {
365            Some((handler, control_handle))
366        } else {
367            None
368        }
369    }
370
371    /// Name of the method defined in FIDL
372    pub fn method_name(&self) -> &'static str {
373        match *self {
374            ColorTransformRequest::RegisterColorTransformHandler { .. } => {
375                "register_color_transform_handler"
376            }
377        }
378    }
379}
380
381#[derive(Debug, Clone)]
382pub struct ColorTransformControlHandle {
383    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
384}
385
386impl ColorTransformControlHandle {
387    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
388        self.inner.shutdown_with_epitaph(status.into())
389    }
390}
391
392impl fidl::endpoints::ControlHandle for ColorTransformControlHandle {
393    fn shutdown(&self) {
394        self.inner.shutdown()
395    }
396
397    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
398        self.inner.shutdown_with_epitaph(status)
399    }
400
401    fn is_closed(&self) -> bool {
402        self.inner.channel().is_closed()
403    }
404    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
405        self.inner.channel().on_closed()
406    }
407
408    #[cfg(target_os = "fuchsia")]
409    fn signal_peer(
410        &self,
411        clear_mask: zx::Signals,
412        set_mask: zx::Signals,
413    ) -> Result<(), zx_status::Status> {
414        use fidl::Peered;
415        self.inner.channel().signal_peer(clear_mask, set_mask)
416    }
417}
418
419impl ColorTransformControlHandle {}
420
421#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
422pub struct ColorTransformHandlerMarker;
423
424impl fidl::endpoints::ProtocolMarker for ColorTransformHandlerMarker {
425    type Proxy = ColorTransformHandlerProxy;
426    type RequestStream = ColorTransformHandlerRequestStream;
427    #[cfg(target_os = "fuchsia")]
428    type SynchronousProxy = ColorTransformHandlerSynchronousProxy;
429
430    const DEBUG_NAME: &'static str = "(anonymous) ColorTransformHandler";
431}
432
433pub trait ColorTransformHandlerProxyInterface: Send + Sync {
434    type SetColorTransformConfigurationResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
435        + Send;
436    fn r#set_color_transform_configuration(
437        &self,
438        configuration: &ColorTransformConfiguration,
439    ) -> Self::SetColorTransformConfigurationResponseFut;
440}
441#[derive(Debug)]
442#[cfg(target_os = "fuchsia")]
443pub struct ColorTransformHandlerSynchronousProxy {
444    client: fidl::client::sync::Client,
445}
446
447#[cfg(target_os = "fuchsia")]
448impl fidl::endpoints::SynchronousProxy for ColorTransformHandlerSynchronousProxy {
449    type Proxy = ColorTransformHandlerProxy;
450    type Protocol = ColorTransformHandlerMarker;
451
452    fn from_channel(inner: fidl::Channel) -> Self {
453        Self::new(inner)
454    }
455
456    fn into_channel(self) -> fidl::Channel {
457        self.client.into_channel()
458    }
459
460    fn as_channel(&self) -> &fidl::Channel {
461        self.client.as_channel()
462    }
463}
464
465#[cfg(target_os = "fuchsia")]
466impl ColorTransformHandlerSynchronousProxy {
467    pub fn new(channel: fidl::Channel) -> Self {
468        Self { client: fidl::client::sync::Client::new(channel) }
469    }
470
471    pub fn into_channel(self) -> fidl::Channel {
472        self.client.into_channel()
473    }
474
475    /// Waits until an event arrives and returns it. It is safe for other
476    /// threads to make concurrent requests while waiting for an event.
477    pub fn wait_for_event(
478        &self,
479        deadline: zx::MonotonicInstant,
480    ) -> Result<ColorTransformHandlerEvent, fidl::Error> {
481        ColorTransformHandlerEvent::decode(
482            self.client.wait_for_event::<ColorTransformHandlerMarker>(deadline)?,
483        )
484    }
485
486    /// Called when the color transform configuration has changed.
487    pub fn r#set_color_transform_configuration(
488        &self,
489        mut configuration: &ColorTransformConfiguration,
490        ___deadline: zx::MonotonicInstant,
491    ) -> Result<(), fidl::Error> {
492        let _response = self.client.send_query::<
493            ColorTransformHandlerSetColorTransformConfigurationRequest,
494            fidl::encoding::EmptyPayload,
495            ColorTransformHandlerMarker,
496        >(
497            (configuration,),
498            0x747ad9d676318dc6,
499            fidl::encoding::DynamicFlags::empty(),
500            ___deadline,
501        )?;
502        Ok(_response)
503    }
504}
505
506#[cfg(target_os = "fuchsia")]
507impl From<ColorTransformHandlerSynchronousProxy> for zx::NullableHandle {
508    fn from(value: ColorTransformHandlerSynchronousProxy) -> Self {
509        value.into_channel().into()
510    }
511}
512
513#[cfg(target_os = "fuchsia")]
514impl From<fidl::Channel> for ColorTransformHandlerSynchronousProxy {
515    fn from(value: fidl::Channel) -> Self {
516        Self::new(value)
517    }
518}
519
520#[cfg(target_os = "fuchsia")]
521impl fidl::endpoints::FromClient for ColorTransformHandlerSynchronousProxy {
522    type Protocol = ColorTransformHandlerMarker;
523
524    fn from_client(value: fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>) -> Self {
525        Self::new(value.into_channel())
526    }
527}
528
529#[derive(Debug, Clone)]
530pub struct ColorTransformHandlerProxy {
531    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
532}
533
534impl fidl::endpoints::Proxy for ColorTransformHandlerProxy {
535    type Protocol = ColorTransformHandlerMarker;
536
537    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
538        Self::new(inner)
539    }
540
541    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
542        self.client.into_channel().map_err(|client| Self { client })
543    }
544
545    fn as_channel(&self) -> &::fidl::AsyncChannel {
546        self.client.as_channel()
547    }
548}
549
550impl ColorTransformHandlerProxy {
551    /// Create a new Proxy for fuchsia.accessibility/ColorTransformHandler.
552    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
553        let protocol_name =
554            <ColorTransformHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
555        Self { client: fidl::client::Client::new(channel, protocol_name) }
556    }
557
558    /// Get a Stream of events from the remote end of the protocol.
559    ///
560    /// # Panics
561    ///
562    /// Panics if the event stream was already taken.
563    pub fn take_event_stream(&self) -> ColorTransformHandlerEventStream {
564        ColorTransformHandlerEventStream { event_receiver: self.client.take_event_receiver() }
565    }
566
567    /// Called when the color transform configuration has changed.
568    pub fn r#set_color_transform_configuration(
569        &self,
570        mut configuration: &ColorTransformConfiguration,
571    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
572        ColorTransformHandlerProxyInterface::r#set_color_transform_configuration(
573            self,
574            configuration,
575        )
576    }
577}
578
579impl ColorTransformHandlerProxyInterface for ColorTransformHandlerProxy {
580    type SetColorTransformConfigurationResponseFut =
581        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
582    fn r#set_color_transform_configuration(
583        &self,
584        mut configuration: &ColorTransformConfiguration,
585    ) -> Self::SetColorTransformConfigurationResponseFut {
586        fn _decode(
587            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
588        ) -> Result<(), fidl::Error> {
589            let _response = fidl::client::decode_transaction_body::<
590                fidl::encoding::EmptyPayload,
591                fidl::encoding::DefaultFuchsiaResourceDialect,
592                0x747ad9d676318dc6,
593            >(_buf?)?;
594            Ok(_response)
595        }
596        self.client.send_query_and_decode::<
597            ColorTransformHandlerSetColorTransformConfigurationRequest,
598            (),
599        >(
600            (configuration,),
601            0x747ad9d676318dc6,
602            fidl::encoding::DynamicFlags::empty(),
603            _decode,
604        )
605    }
606}
607
608pub struct ColorTransformHandlerEventStream {
609    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
610}
611
612impl std::marker::Unpin for ColorTransformHandlerEventStream {}
613
614impl futures::stream::FusedStream for ColorTransformHandlerEventStream {
615    fn is_terminated(&self) -> bool {
616        self.event_receiver.is_terminated()
617    }
618}
619
620impl futures::Stream for ColorTransformHandlerEventStream {
621    type Item = Result<ColorTransformHandlerEvent, fidl::Error>;
622
623    fn poll_next(
624        mut self: std::pin::Pin<&mut Self>,
625        cx: &mut std::task::Context<'_>,
626    ) -> std::task::Poll<Option<Self::Item>> {
627        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
628            &mut self.event_receiver,
629            cx
630        )?) {
631            Some(buf) => std::task::Poll::Ready(Some(ColorTransformHandlerEvent::decode(buf))),
632            None => std::task::Poll::Ready(None),
633        }
634    }
635}
636
637#[derive(Debug)]
638pub enum ColorTransformHandlerEvent {}
639
640impl ColorTransformHandlerEvent {
641    /// Decodes a message buffer as a [`ColorTransformHandlerEvent`].
642    fn decode(
643        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
644    ) -> Result<ColorTransformHandlerEvent, fidl::Error> {
645        let (bytes, _handles) = buf.split_mut();
646        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
647        debug_assert_eq!(tx_header.tx_id, 0);
648        match tx_header.ordinal {
649            _ => Err(fidl::Error::UnknownOrdinal {
650                ordinal: tx_header.ordinal,
651                protocol_name:
652                    <ColorTransformHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
653            }),
654        }
655    }
656}
657
658/// A Stream of incoming requests for fuchsia.accessibility/ColorTransformHandler.
659pub struct ColorTransformHandlerRequestStream {
660    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
661    is_terminated: bool,
662}
663
664impl std::marker::Unpin for ColorTransformHandlerRequestStream {}
665
666impl futures::stream::FusedStream for ColorTransformHandlerRequestStream {
667    fn is_terminated(&self) -> bool {
668        self.is_terminated
669    }
670}
671
672impl fidl::endpoints::RequestStream for ColorTransformHandlerRequestStream {
673    type Protocol = ColorTransformHandlerMarker;
674    type ControlHandle = ColorTransformHandlerControlHandle;
675
676    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
677        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
678    }
679
680    fn control_handle(&self) -> Self::ControlHandle {
681        ColorTransformHandlerControlHandle { inner: self.inner.clone() }
682    }
683
684    fn into_inner(
685        self,
686    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
687    {
688        (self.inner, self.is_terminated)
689    }
690
691    fn from_inner(
692        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
693        is_terminated: bool,
694    ) -> Self {
695        Self { inner, is_terminated }
696    }
697}
698
699impl futures::Stream for ColorTransformHandlerRequestStream {
700    type Item = Result<ColorTransformHandlerRequest, fidl::Error>;
701
702    fn poll_next(
703        mut self: std::pin::Pin<&mut Self>,
704        cx: &mut std::task::Context<'_>,
705    ) -> std::task::Poll<Option<Self::Item>> {
706        let this = &mut *self;
707        if this.inner.check_shutdown(cx) {
708            this.is_terminated = true;
709            return std::task::Poll::Ready(None);
710        }
711        if this.is_terminated {
712            panic!("polled ColorTransformHandlerRequestStream after completion");
713        }
714        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
715            |bytes, handles| {
716                match this.inner.channel().read_etc(cx, bytes, handles) {
717                    std::task::Poll::Ready(Ok(())) => {}
718                    std::task::Poll::Pending => return std::task::Poll::Pending,
719                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
720                        this.is_terminated = true;
721                        return std::task::Poll::Ready(None);
722                    }
723                    std::task::Poll::Ready(Err(e)) => {
724                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
725                            e.into(),
726                        ))));
727                    }
728                }
729
730                // A message has been received from the channel
731                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
732
733                std::task::Poll::Ready(Some(match header.ordinal {
734                0x747ad9d676318dc6 => {
735                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
736                    let mut req = fidl::new_empty!(ColorTransformHandlerSetColorTransformConfigurationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
737                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ColorTransformHandlerSetColorTransformConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
738                    let control_handle = ColorTransformHandlerControlHandle {
739                        inner: this.inner.clone(),
740                    };
741                    Ok(ColorTransformHandlerRequest::SetColorTransformConfiguration {configuration: req.configuration,
742
743                        responder: ColorTransformHandlerSetColorTransformConfigurationResponder {
744                            control_handle: std::mem::ManuallyDrop::new(control_handle),
745                            tx_id: header.tx_id,
746                        },
747                    })
748                }
749                _ => Err(fidl::Error::UnknownOrdinal {
750                    ordinal: header.ordinal,
751                    protocol_name: <ColorTransformHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
752                }),
753            }))
754            },
755        )
756    }
757}
758
759/// Handler implemented by the owner of the presentation. Accessibility manager uses this protocol
760/// to make changes to the screen's color transform.
761#[derive(Debug)]
762pub enum ColorTransformHandlerRequest {
763    /// Called when the color transform configuration has changed.
764    SetColorTransformConfiguration {
765        configuration: ColorTransformConfiguration,
766        responder: ColorTransformHandlerSetColorTransformConfigurationResponder,
767    },
768}
769
770impl ColorTransformHandlerRequest {
771    #[allow(irrefutable_let_patterns)]
772    pub fn into_set_color_transform_configuration(
773        self,
774    ) -> Option<(
775        ColorTransformConfiguration,
776        ColorTransformHandlerSetColorTransformConfigurationResponder,
777    )> {
778        if let ColorTransformHandlerRequest::SetColorTransformConfiguration {
779            configuration,
780            responder,
781        } = self
782        {
783            Some((configuration, responder))
784        } else {
785            None
786        }
787    }
788
789    /// Name of the method defined in FIDL
790    pub fn method_name(&self) -> &'static str {
791        match *self {
792            ColorTransformHandlerRequest::SetColorTransformConfiguration { .. } => {
793                "set_color_transform_configuration"
794            }
795        }
796    }
797}
798
799#[derive(Debug, Clone)]
800pub struct ColorTransformHandlerControlHandle {
801    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
802}
803
804impl ColorTransformHandlerControlHandle {
805    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
806        self.inner.shutdown_with_epitaph(status.into())
807    }
808}
809
810impl fidl::endpoints::ControlHandle for ColorTransformHandlerControlHandle {
811    fn shutdown(&self) {
812        self.inner.shutdown()
813    }
814
815    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
816        self.inner.shutdown_with_epitaph(status)
817    }
818
819    fn is_closed(&self) -> bool {
820        self.inner.channel().is_closed()
821    }
822    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
823        self.inner.channel().on_closed()
824    }
825
826    #[cfg(target_os = "fuchsia")]
827    fn signal_peer(
828        &self,
829        clear_mask: zx::Signals,
830        set_mask: zx::Signals,
831    ) -> Result<(), zx_status::Status> {
832        use fidl::Peered;
833        self.inner.channel().signal_peer(clear_mask, set_mask)
834    }
835}
836
837impl ColorTransformHandlerControlHandle {}
838
839#[must_use = "FIDL methods require a response to be sent"]
840#[derive(Debug)]
841pub struct ColorTransformHandlerSetColorTransformConfigurationResponder {
842    control_handle: std::mem::ManuallyDrop<ColorTransformHandlerControlHandle>,
843    tx_id: u32,
844}
845
846/// Set the the channel to be shutdown (see [`ColorTransformHandlerControlHandle::shutdown`])
847/// if the responder is dropped without sending a response, so that the client
848/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
849impl std::ops::Drop for ColorTransformHandlerSetColorTransformConfigurationResponder {
850    fn drop(&mut self) {
851        self.control_handle.shutdown();
852        // Safety: drops once, never accessed again
853        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
854    }
855}
856
857impl fidl::endpoints::Responder for ColorTransformHandlerSetColorTransformConfigurationResponder {
858    type ControlHandle = ColorTransformHandlerControlHandle;
859
860    fn control_handle(&self) -> &ColorTransformHandlerControlHandle {
861        &self.control_handle
862    }
863
864    fn drop_without_shutdown(mut self) {
865        // Safety: drops once, never accessed again due to mem::forget
866        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
867        // Prevent Drop from running (which would shut down the channel)
868        std::mem::forget(self);
869    }
870}
871
872impl ColorTransformHandlerSetColorTransformConfigurationResponder {
873    /// Sends a response to the FIDL transaction.
874    ///
875    /// Sets the channel to shutdown if an error occurs.
876    pub fn send(self) -> Result<(), fidl::Error> {
877        let _result = self.send_raw();
878        if _result.is_err() {
879            self.control_handle.shutdown();
880        }
881        self.drop_without_shutdown();
882        _result
883    }
884
885    /// Similar to "send" but does not shutdown the channel if an error occurs.
886    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
887        let _result = self.send_raw();
888        self.drop_without_shutdown();
889        _result
890    }
891
892    fn send_raw(&self) -> Result<(), fidl::Error> {
893        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
894            (),
895            self.tx_id,
896            0x747ad9d676318dc6,
897            fidl::encoding::DynamicFlags::empty(),
898        )
899    }
900}
901
902#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
903pub struct MagnificationHandlerMarker;
904
905impl fidl::endpoints::ProtocolMarker for MagnificationHandlerMarker {
906    type Proxy = MagnificationHandlerProxy;
907    type RequestStream = MagnificationHandlerRequestStream;
908    #[cfg(target_os = "fuchsia")]
909    type SynchronousProxy = MagnificationHandlerSynchronousProxy;
910
911    const DEBUG_NAME: &'static str = "(anonymous) MagnificationHandler";
912}
913
914pub trait MagnificationHandlerProxyInterface: Send + Sync {
915    type SetClipSpaceTransformResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
916        + Send;
917    fn r#set_clip_space_transform(
918        &self,
919        x: f32,
920        y: f32,
921        scale: f32,
922    ) -> Self::SetClipSpaceTransformResponseFut;
923}
924#[derive(Debug)]
925#[cfg(target_os = "fuchsia")]
926pub struct MagnificationHandlerSynchronousProxy {
927    client: fidl::client::sync::Client,
928}
929
930#[cfg(target_os = "fuchsia")]
931impl fidl::endpoints::SynchronousProxy for MagnificationHandlerSynchronousProxy {
932    type Proxy = MagnificationHandlerProxy;
933    type Protocol = MagnificationHandlerMarker;
934
935    fn from_channel(inner: fidl::Channel) -> Self {
936        Self::new(inner)
937    }
938
939    fn into_channel(self) -> fidl::Channel {
940        self.client.into_channel()
941    }
942
943    fn as_channel(&self) -> &fidl::Channel {
944        self.client.as_channel()
945    }
946}
947
948#[cfg(target_os = "fuchsia")]
949impl MagnificationHandlerSynchronousProxy {
950    pub fn new(channel: fidl::Channel) -> Self {
951        Self { client: fidl::client::sync::Client::new(channel) }
952    }
953
954    pub fn into_channel(self) -> fidl::Channel {
955        self.client.into_channel()
956    }
957
958    /// Waits until an event arrives and returns it. It is safe for other
959    /// threads to make concurrent requests while waiting for an event.
960    pub fn wait_for_event(
961        &self,
962        deadline: zx::MonotonicInstant,
963    ) -> Result<MagnificationHandlerEvent, fidl::Error> {
964        MagnificationHandlerEvent::decode(
965            self.client.wait_for_event::<MagnificationHandlerMarker>(deadline)?,
966        )
967    }
968
969    /// Sets clip-space x-offset, y-offset, and scale for the presentation.
970    /// x and y are in Vulkan NDC and are applied after scaling, which occurs
971    /// about the center of the presentation. The callback indicates when the
972    /// update has been presented. The identity transform (0, 0, 1) is the
973    /// natural state.
974    pub fn r#set_clip_space_transform(
975        &self,
976        mut x: f32,
977        mut y: f32,
978        mut scale: f32,
979        ___deadline: zx::MonotonicInstant,
980    ) -> Result<(), fidl::Error> {
981        let _response = self.client.send_query::<
982            MagnificationHandlerSetClipSpaceTransformRequest,
983            fidl::encoding::EmptyPayload,
984            MagnificationHandlerMarker,
985        >(
986            (x, y, scale,),
987            0x71e54bab8b9f7357,
988            fidl::encoding::DynamicFlags::empty(),
989            ___deadline,
990        )?;
991        Ok(_response)
992    }
993}
994
995#[cfg(target_os = "fuchsia")]
996impl From<MagnificationHandlerSynchronousProxy> for zx::NullableHandle {
997    fn from(value: MagnificationHandlerSynchronousProxy) -> Self {
998        value.into_channel().into()
999    }
1000}
1001
1002#[cfg(target_os = "fuchsia")]
1003impl From<fidl::Channel> for MagnificationHandlerSynchronousProxy {
1004    fn from(value: fidl::Channel) -> Self {
1005        Self::new(value)
1006    }
1007}
1008
1009#[cfg(target_os = "fuchsia")]
1010impl fidl::endpoints::FromClient for MagnificationHandlerSynchronousProxy {
1011    type Protocol = MagnificationHandlerMarker;
1012
1013    fn from_client(value: fidl::endpoints::ClientEnd<MagnificationHandlerMarker>) -> Self {
1014        Self::new(value.into_channel())
1015    }
1016}
1017
1018#[derive(Debug, Clone)]
1019pub struct MagnificationHandlerProxy {
1020    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1021}
1022
1023impl fidl::endpoints::Proxy for MagnificationHandlerProxy {
1024    type Protocol = MagnificationHandlerMarker;
1025
1026    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1027        Self::new(inner)
1028    }
1029
1030    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1031        self.client.into_channel().map_err(|client| Self { client })
1032    }
1033
1034    fn as_channel(&self) -> &::fidl::AsyncChannel {
1035        self.client.as_channel()
1036    }
1037}
1038
1039impl MagnificationHandlerProxy {
1040    /// Create a new Proxy for fuchsia.accessibility/MagnificationHandler.
1041    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1042        let protocol_name =
1043            <MagnificationHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1044        Self { client: fidl::client::Client::new(channel, protocol_name) }
1045    }
1046
1047    /// Get a Stream of events from the remote end of the protocol.
1048    ///
1049    /// # Panics
1050    ///
1051    /// Panics if the event stream was already taken.
1052    pub fn take_event_stream(&self) -> MagnificationHandlerEventStream {
1053        MagnificationHandlerEventStream { event_receiver: self.client.take_event_receiver() }
1054    }
1055
1056    /// Sets clip-space x-offset, y-offset, and scale for the presentation.
1057    /// x and y are in Vulkan NDC and are applied after scaling, which occurs
1058    /// about the center of the presentation. The callback indicates when the
1059    /// update has been presented. The identity transform (0, 0, 1) is the
1060    /// natural state.
1061    pub fn r#set_clip_space_transform(
1062        &self,
1063        mut x: f32,
1064        mut y: f32,
1065        mut scale: f32,
1066    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1067        MagnificationHandlerProxyInterface::r#set_clip_space_transform(self, x, y, scale)
1068    }
1069}
1070
1071impl MagnificationHandlerProxyInterface for MagnificationHandlerProxy {
1072    type SetClipSpaceTransformResponseFut =
1073        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1074    fn r#set_clip_space_transform(
1075        &self,
1076        mut x: f32,
1077        mut y: f32,
1078        mut scale: f32,
1079    ) -> Self::SetClipSpaceTransformResponseFut {
1080        fn _decode(
1081            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1082        ) -> Result<(), fidl::Error> {
1083            let _response = fidl::client::decode_transaction_body::<
1084                fidl::encoding::EmptyPayload,
1085                fidl::encoding::DefaultFuchsiaResourceDialect,
1086                0x71e54bab8b9f7357,
1087            >(_buf?)?;
1088            Ok(_response)
1089        }
1090        self.client.send_query_and_decode::<MagnificationHandlerSetClipSpaceTransformRequest, ()>(
1091            (x, y, scale),
1092            0x71e54bab8b9f7357,
1093            fidl::encoding::DynamicFlags::empty(),
1094            _decode,
1095        )
1096    }
1097}
1098
1099pub struct MagnificationHandlerEventStream {
1100    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1101}
1102
1103impl std::marker::Unpin for MagnificationHandlerEventStream {}
1104
1105impl futures::stream::FusedStream for MagnificationHandlerEventStream {
1106    fn is_terminated(&self) -> bool {
1107        self.event_receiver.is_terminated()
1108    }
1109}
1110
1111impl futures::Stream for MagnificationHandlerEventStream {
1112    type Item = Result<MagnificationHandlerEvent, fidl::Error>;
1113
1114    fn poll_next(
1115        mut self: std::pin::Pin<&mut Self>,
1116        cx: &mut std::task::Context<'_>,
1117    ) -> std::task::Poll<Option<Self::Item>> {
1118        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1119            &mut self.event_receiver,
1120            cx
1121        )?) {
1122            Some(buf) => std::task::Poll::Ready(Some(MagnificationHandlerEvent::decode(buf))),
1123            None => std::task::Poll::Ready(None),
1124        }
1125    }
1126}
1127
1128#[derive(Debug)]
1129pub enum MagnificationHandlerEvent {}
1130
1131impl MagnificationHandlerEvent {
1132    /// Decodes a message buffer as a [`MagnificationHandlerEvent`].
1133    fn decode(
1134        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1135    ) -> Result<MagnificationHandlerEvent, fidl::Error> {
1136        let (bytes, _handles) = buf.split_mut();
1137        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1138        debug_assert_eq!(tx_header.tx_id, 0);
1139        match tx_header.ordinal {
1140            _ => Err(fidl::Error::UnknownOrdinal {
1141                ordinal: tx_header.ordinal,
1142                protocol_name:
1143                    <MagnificationHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1144            }),
1145        }
1146    }
1147}
1148
1149/// A Stream of incoming requests for fuchsia.accessibility/MagnificationHandler.
1150pub struct MagnificationHandlerRequestStream {
1151    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1152    is_terminated: bool,
1153}
1154
1155impl std::marker::Unpin for MagnificationHandlerRequestStream {}
1156
1157impl futures::stream::FusedStream for MagnificationHandlerRequestStream {
1158    fn is_terminated(&self) -> bool {
1159        self.is_terminated
1160    }
1161}
1162
1163impl fidl::endpoints::RequestStream for MagnificationHandlerRequestStream {
1164    type Protocol = MagnificationHandlerMarker;
1165    type ControlHandle = MagnificationHandlerControlHandle;
1166
1167    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1168        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1169    }
1170
1171    fn control_handle(&self) -> Self::ControlHandle {
1172        MagnificationHandlerControlHandle { inner: self.inner.clone() }
1173    }
1174
1175    fn into_inner(
1176        self,
1177    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1178    {
1179        (self.inner, self.is_terminated)
1180    }
1181
1182    fn from_inner(
1183        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1184        is_terminated: bool,
1185    ) -> Self {
1186        Self { inner, is_terminated }
1187    }
1188}
1189
1190impl futures::Stream for MagnificationHandlerRequestStream {
1191    type Item = Result<MagnificationHandlerRequest, fidl::Error>;
1192
1193    fn poll_next(
1194        mut self: std::pin::Pin<&mut Self>,
1195        cx: &mut std::task::Context<'_>,
1196    ) -> std::task::Poll<Option<Self::Item>> {
1197        let this = &mut *self;
1198        if this.inner.check_shutdown(cx) {
1199            this.is_terminated = true;
1200            return std::task::Poll::Ready(None);
1201        }
1202        if this.is_terminated {
1203            panic!("polled MagnificationHandlerRequestStream after completion");
1204        }
1205        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1206            |bytes, handles| {
1207                match this.inner.channel().read_etc(cx, bytes, handles) {
1208                    std::task::Poll::Ready(Ok(())) => {}
1209                    std::task::Poll::Pending => return std::task::Poll::Pending,
1210                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1211                        this.is_terminated = true;
1212                        return std::task::Poll::Ready(None);
1213                    }
1214                    std::task::Poll::Ready(Err(e)) => {
1215                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1216                            e.into(),
1217                        ))));
1218                    }
1219                }
1220
1221                // A message has been received from the channel
1222                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1223
1224                std::task::Poll::Ready(Some(match header.ordinal {
1225                0x71e54bab8b9f7357 => {
1226                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1227                    let mut req = fidl::new_empty!(MagnificationHandlerSetClipSpaceTransformRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1228                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MagnificationHandlerSetClipSpaceTransformRequest>(&header, _body_bytes, handles, &mut req)?;
1229                    let control_handle = MagnificationHandlerControlHandle {
1230                        inner: this.inner.clone(),
1231                    };
1232                    Ok(MagnificationHandlerRequest::SetClipSpaceTransform {x: req.x,
1233y: req.y,
1234scale: req.scale,
1235
1236                        responder: MagnificationHandlerSetClipSpaceTransformResponder {
1237                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1238                            tx_id: header.tx_id,
1239                        },
1240                    })
1241                }
1242                _ => Err(fidl::Error::UnknownOrdinal {
1243                    ordinal: header.ordinal,
1244                    protocol_name: <MagnificationHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1245                }),
1246            }))
1247            },
1248        )
1249    }
1250}
1251
1252/// Exposes a privileged magnifier API for camera control, typically on a
1253/// `fuchsia.ui.policy.Presentation`.
1254#[derive(Debug)]
1255pub enum MagnificationHandlerRequest {
1256    /// Sets clip-space x-offset, y-offset, and scale for the presentation.
1257    /// x and y are in Vulkan NDC and are applied after scaling, which occurs
1258    /// about the center of the presentation. The callback indicates when the
1259    /// update has been presented. The identity transform (0, 0, 1) is the
1260    /// natural state.
1261    SetClipSpaceTransform {
1262        x: f32,
1263        y: f32,
1264        scale: f32,
1265        responder: MagnificationHandlerSetClipSpaceTransformResponder,
1266    },
1267}
1268
1269impl MagnificationHandlerRequest {
1270    #[allow(irrefutable_let_patterns)]
1271    pub fn into_set_clip_space_transform(
1272        self,
1273    ) -> Option<(f32, f32, f32, MagnificationHandlerSetClipSpaceTransformResponder)> {
1274        if let MagnificationHandlerRequest::SetClipSpaceTransform { x, y, scale, responder } = self
1275        {
1276            Some((x, y, scale, responder))
1277        } else {
1278            None
1279        }
1280    }
1281
1282    /// Name of the method defined in FIDL
1283    pub fn method_name(&self) -> &'static str {
1284        match *self {
1285            MagnificationHandlerRequest::SetClipSpaceTransform { .. } => "set_clip_space_transform",
1286        }
1287    }
1288}
1289
1290#[derive(Debug, Clone)]
1291pub struct MagnificationHandlerControlHandle {
1292    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1293}
1294
1295impl MagnificationHandlerControlHandle {
1296    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1297        self.inner.shutdown_with_epitaph(status.into())
1298    }
1299}
1300
1301impl fidl::endpoints::ControlHandle for MagnificationHandlerControlHandle {
1302    fn shutdown(&self) {
1303        self.inner.shutdown()
1304    }
1305
1306    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1307        self.inner.shutdown_with_epitaph(status)
1308    }
1309
1310    fn is_closed(&self) -> bool {
1311        self.inner.channel().is_closed()
1312    }
1313    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1314        self.inner.channel().on_closed()
1315    }
1316
1317    #[cfg(target_os = "fuchsia")]
1318    fn signal_peer(
1319        &self,
1320        clear_mask: zx::Signals,
1321        set_mask: zx::Signals,
1322    ) -> Result<(), zx_status::Status> {
1323        use fidl::Peered;
1324        self.inner.channel().signal_peer(clear_mask, set_mask)
1325    }
1326}
1327
1328impl MagnificationHandlerControlHandle {}
1329
1330#[must_use = "FIDL methods require a response to be sent"]
1331#[derive(Debug)]
1332pub struct MagnificationHandlerSetClipSpaceTransformResponder {
1333    control_handle: std::mem::ManuallyDrop<MagnificationHandlerControlHandle>,
1334    tx_id: u32,
1335}
1336
1337/// Set the the channel to be shutdown (see [`MagnificationHandlerControlHandle::shutdown`])
1338/// if the responder is dropped without sending a response, so that the client
1339/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1340impl std::ops::Drop for MagnificationHandlerSetClipSpaceTransformResponder {
1341    fn drop(&mut self) {
1342        self.control_handle.shutdown();
1343        // Safety: drops once, never accessed again
1344        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1345    }
1346}
1347
1348impl fidl::endpoints::Responder for MagnificationHandlerSetClipSpaceTransformResponder {
1349    type ControlHandle = MagnificationHandlerControlHandle;
1350
1351    fn control_handle(&self) -> &MagnificationHandlerControlHandle {
1352        &self.control_handle
1353    }
1354
1355    fn drop_without_shutdown(mut self) {
1356        // Safety: drops once, never accessed again due to mem::forget
1357        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1358        // Prevent Drop from running (which would shut down the channel)
1359        std::mem::forget(self);
1360    }
1361}
1362
1363impl MagnificationHandlerSetClipSpaceTransformResponder {
1364    /// Sends a response to the FIDL transaction.
1365    ///
1366    /// Sets the channel to shutdown if an error occurs.
1367    pub fn send(self) -> Result<(), fidl::Error> {
1368        let _result = self.send_raw();
1369        if _result.is_err() {
1370            self.control_handle.shutdown();
1371        }
1372        self.drop_without_shutdown();
1373        _result
1374    }
1375
1376    /// Similar to "send" but does not shutdown the channel if an error occurs.
1377    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1378        let _result = self.send_raw();
1379        self.drop_without_shutdown();
1380        _result
1381    }
1382
1383    fn send_raw(&self) -> Result<(), fidl::Error> {
1384        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1385            (),
1386            self.tx_id,
1387            0x71e54bab8b9f7357,
1388            fidl::encoding::DynamicFlags::empty(),
1389        )
1390    }
1391}
1392
1393#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1394pub struct MagnifierMarker;
1395
1396impl fidl::endpoints::ProtocolMarker for MagnifierMarker {
1397    type Proxy = MagnifierProxy;
1398    type RequestStream = MagnifierRequestStream;
1399    #[cfg(target_os = "fuchsia")]
1400    type SynchronousProxy = MagnifierSynchronousProxy;
1401
1402    const DEBUG_NAME: &'static str = "fuchsia.accessibility.Magnifier";
1403}
1404impl fidl::endpoints::DiscoverableProtocolMarker for MagnifierMarker {}
1405
1406pub trait MagnifierProxyInterface: Send + Sync {
1407    fn r#register_handler(
1408        &self,
1409        handler: fidl::endpoints::ClientEnd<MagnificationHandlerMarker>,
1410    ) -> Result<(), fidl::Error>;
1411}
1412#[derive(Debug)]
1413#[cfg(target_os = "fuchsia")]
1414pub struct MagnifierSynchronousProxy {
1415    client: fidl::client::sync::Client,
1416}
1417
1418#[cfg(target_os = "fuchsia")]
1419impl fidl::endpoints::SynchronousProxy for MagnifierSynchronousProxy {
1420    type Proxy = MagnifierProxy;
1421    type Protocol = MagnifierMarker;
1422
1423    fn from_channel(inner: fidl::Channel) -> Self {
1424        Self::new(inner)
1425    }
1426
1427    fn into_channel(self) -> fidl::Channel {
1428        self.client.into_channel()
1429    }
1430
1431    fn as_channel(&self) -> &fidl::Channel {
1432        self.client.as_channel()
1433    }
1434}
1435
1436#[cfg(target_os = "fuchsia")]
1437impl MagnifierSynchronousProxy {
1438    pub fn new(channel: fidl::Channel) -> Self {
1439        Self { client: fidl::client::sync::Client::new(channel) }
1440    }
1441
1442    pub fn into_channel(self) -> fidl::Channel {
1443        self.client.into_channel()
1444    }
1445
1446    /// Waits until an event arrives and returns it. It is safe for other
1447    /// threads to make concurrent requests while waiting for an event.
1448    pub fn wait_for_event(
1449        &self,
1450        deadline: zx::MonotonicInstant,
1451    ) -> Result<MagnifierEvent, fidl::Error> {
1452        MagnifierEvent::decode(self.client.wait_for_event::<MagnifierMarker>(deadline)?)
1453    }
1454
1455    /// Registers the camera control to be used for applying magnification. If
1456    /// a previous handler had been registered, that handler is dropped.
1457    pub fn r#register_handler(
1458        &self,
1459        mut handler: fidl::endpoints::ClientEnd<MagnificationHandlerMarker>,
1460    ) -> Result<(), fidl::Error> {
1461        self.client.send::<MagnifierRegisterHandlerRequest>(
1462            (handler,),
1463            0x36559e34eb45d161,
1464            fidl::encoding::DynamicFlags::empty(),
1465        )
1466    }
1467}
1468
1469#[cfg(target_os = "fuchsia")]
1470impl From<MagnifierSynchronousProxy> for zx::NullableHandle {
1471    fn from(value: MagnifierSynchronousProxy) -> Self {
1472        value.into_channel().into()
1473    }
1474}
1475
1476#[cfg(target_os = "fuchsia")]
1477impl From<fidl::Channel> for MagnifierSynchronousProxy {
1478    fn from(value: fidl::Channel) -> Self {
1479        Self::new(value)
1480    }
1481}
1482
1483#[cfg(target_os = "fuchsia")]
1484impl fidl::endpoints::FromClient for MagnifierSynchronousProxy {
1485    type Protocol = MagnifierMarker;
1486
1487    fn from_client(value: fidl::endpoints::ClientEnd<MagnifierMarker>) -> Self {
1488        Self::new(value.into_channel())
1489    }
1490}
1491
1492#[derive(Debug, Clone)]
1493pub struct MagnifierProxy {
1494    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1495}
1496
1497impl fidl::endpoints::Proxy for MagnifierProxy {
1498    type Protocol = MagnifierMarker;
1499
1500    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1501        Self::new(inner)
1502    }
1503
1504    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1505        self.client.into_channel().map_err(|client| Self { client })
1506    }
1507
1508    fn as_channel(&self) -> &::fidl::AsyncChannel {
1509        self.client.as_channel()
1510    }
1511}
1512
1513impl MagnifierProxy {
1514    /// Create a new Proxy for fuchsia.accessibility/Magnifier.
1515    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1516        let protocol_name = <MagnifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1517        Self { client: fidl::client::Client::new(channel, protocol_name) }
1518    }
1519
1520    /// Get a Stream of events from the remote end of the protocol.
1521    ///
1522    /// # Panics
1523    ///
1524    /// Panics if the event stream was already taken.
1525    pub fn take_event_stream(&self) -> MagnifierEventStream {
1526        MagnifierEventStream { event_receiver: self.client.take_event_receiver() }
1527    }
1528
1529    /// Registers the camera control to be used for applying magnification. If
1530    /// a previous handler had been registered, that handler is dropped.
1531    pub fn r#register_handler(
1532        &self,
1533        mut handler: fidl::endpoints::ClientEnd<MagnificationHandlerMarker>,
1534    ) -> Result<(), fidl::Error> {
1535        MagnifierProxyInterface::r#register_handler(self, handler)
1536    }
1537}
1538
1539impl MagnifierProxyInterface for MagnifierProxy {
1540    fn r#register_handler(
1541        &self,
1542        mut handler: fidl::endpoints::ClientEnd<MagnificationHandlerMarker>,
1543    ) -> Result<(), fidl::Error> {
1544        self.client.send::<MagnifierRegisterHandlerRequest>(
1545            (handler,),
1546            0x36559e34eb45d161,
1547            fidl::encoding::DynamicFlags::empty(),
1548        )
1549    }
1550}
1551
1552pub struct MagnifierEventStream {
1553    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1554}
1555
1556impl std::marker::Unpin for MagnifierEventStream {}
1557
1558impl futures::stream::FusedStream for MagnifierEventStream {
1559    fn is_terminated(&self) -> bool {
1560        self.event_receiver.is_terminated()
1561    }
1562}
1563
1564impl futures::Stream for MagnifierEventStream {
1565    type Item = Result<MagnifierEvent, fidl::Error>;
1566
1567    fn poll_next(
1568        mut self: std::pin::Pin<&mut Self>,
1569        cx: &mut std::task::Context<'_>,
1570    ) -> std::task::Poll<Option<Self::Item>> {
1571        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1572            &mut self.event_receiver,
1573            cx
1574        )?) {
1575            Some(buf) => std::task::Poll::Ready(Some(MagnifierEvent::decode(buf))),
1576            None => std::task::Poll::Ready(None),
1577        }
1578    }
1579}
1580
1581#[derive(Debug)]
1582pub enum MagnifierEvent {}
1583
1584impl MagnifierEvent {
1585    /// Decodes a message buffer as a [`MagnifierEvent`].
1586    fn decode(
1587        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1588    ) -> Result<MagnifierEvent, fidl::Error> {
1589        let (bytes, _handles) = buf.split_mut();
1590        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1591        debug_assert_eq!(tx_header.tx_id, 0);
1592        match tx_header.ordinal {
1593            _ => Err(fidl::Error::UnknownOrdinal {
1594                ordinal: tx_header.ordinal,
1595                protocol_name: <MagnifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1596            }),
1597        }
1598    }
1599}
1600
1601/// A Stream of incoming requests for fuchsia.accessibility/Magnifier.
1602pub struct MagnifierRequestStream {
1603    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1604    is_terminated: bool,
1605}
1606
1607impl std::marker::Unpin for MagnifierRequestStream {}
1608
1609impl futures::stream::FusedStream for MagnifierRequestStream {
1610    fn is_terminated(&self) -> bool {
1611        self.is_terminated
1612    }
1613}
1614
1615impl fidl::endpoints::RequestStream for MagnifierRequestStream {
1616    type Protocol = MagnifierMarker;
1617    type ControlHandle = MagnifierControlHandle;
1618
1619    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1620        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1621    }
1622
1623    fn control_handle(&self) -> Self::ControlHandle {
1624        MagnifierControlHandle { inner: self.inner.clone() }
1625    }
1626
1627    fn into_inner(
1628        self,
1629    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1630    {
1631        (self.inner, self.is_terminated)
1632    }
1633
1634    fn from_inner(
1635        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1636        is_terminated: bool,
1637    ) -> Self {
1638        Self { inner, is_terminated }
1639    }
1640}
1641
1642impl futures::Stream for MagnifierRequestStream {
1643    type Item = Result<MagnifierRequest, fidl::Error>;
1644
1645    fn poll_next(
1646        mut self: std::pin::Pin<&mut Self>,
1647        cx: &mut std::task::Context<'_>,
1648    ) -> std::task::Poll<Option<Self::Item>> {
1649        let this = &mut *self;
1650        if this.inner.check_shutdown(cx) {
1651            this.is_terminated = true;
1652            return std::task::Poll::Ready(None);
1653        }
1654        if this.is_terminated {
1655            panic!("polled MagnifierRequestStream after completion");
1656        }
1657        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1658            |bytes, handles| {
1659                match this.inner.channel().read_etc(cx, bytes, handles) {
1660                    std::task::Poll::Ready(Ok(())) => {}
1661                    std::task::Poll::Pending => return std::task::Poll::Pending,
1662                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1663                        this.is_terminated = true;
1664                        return std::task::Poll::Ready(None);
1665                    }
1666                    std::task::Poll::Ready(Err(e)) => {
1667                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1668                            e.into(),
1669                        ))));
1670                    }
1671                }
1672
1673                // A message has been received from the channel
1674                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1675
1676                std::task::Poll::Ready(Some(match header.ordinal {
1677                    0x36559e34eb45d161 => {
1678                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1679                        let mut req = fidl::new_empty!(
1680                            MagnifierRegisterHandlerRequest,
1681                            fidl::encoding::DefaultFuchsiaResourceDialect
1682                        );
1683                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MagnifierRegisterHandlerRequest>(&header, _body_bytes, handles, &mut req)?;
1684                        let control_handle = MagnifierControlHandle { inner: this.inner.clone() };
1685                        Ok(MagnifierRequest::RegisterHandler {
1686                            handler: req.handler,
1687
1688                            control_handle,
1689                        })
1690                    }
1691                    _ => Err(fidl::Error::UnknownOrdinal {
1692                        ordinal: header.ordinal,
1693                        protocol_name:
1694                            <MagnifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1695                    }),
1696                }))
1697            },
1698        )
1699    }
1700}
1701
1702#[derive(Debug)]
1703pub enum MagnifierRequest {
1704    /// Registers the camera control to be used for applying magnification. If
1705    /// a previous handler had been registered, that handler is dropped.
1706    RegisterHandler {
1707        handler: fidl::endpoints::ClientEnd<MagnificationHandlerMarker>,
1708        control_handle: MagnifierControlHandle,
1709    },
1710}
1711
1712impl MagnifierRequest {
1713    #[allow(irrefutable_let_patterns)]
1714    pub fn into_register_handler(
1715        self,
1716    ) -> Option<(fidl::endpoints::ClientEnd<MagnificationHandlerMarker>, MagnifierControlHandle)>
1717    {
1718        if let MagnifierRequest::RegisterHandler { handler, control_handle } = self {
1719            Some((handler, control_handle))
1720        } else {
1721            None
1722        }
1723    }
1724
1725    /// Name of the method defined in FIDL
1726    pub fn method_name(&self) -> &'static str {
1727        match *self {
1728            MagnifierRequest::RegisterHandler { .. } => "register_handler",
1729        }
1730    }
1731}
1732
1733#[derive(Debug, Clone)]
1734pub struct MagnifierControlHandle {
1735    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1736}
1737
1738impl MagnifierControlHandle {
1739    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1740        self.inner.shutdown_with_epitaph(status.into())
1741    }
1742}
1743
1744impl fidl::endpoints::ControlHandle for MagnifierControlHandle {
1745    fn shutdown(&self) {
1746        self.inner.shutdown()
1747    }
1748
1749    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1750        self.inner.shutdown_with_epitaph(status)
1751    }
1752
1753    fn is_closed(&self) -> bool {
1754        self.inner.channel().is_closed()
1755    }
1756    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1757        self.inner.channel().on_closed()
1758    }
1759
1760    #[cfg(target_os = "fuchsia")]
1761    fn signal_peer(
1762        &self,
1763        clear_mask: zx::Signals,
1764        set_mask: zx::Signals,
1765    ) -> Result<(), zx_status::Status> {
1766        use fidl::Peered;
1767        self.inner.channel().signal_peer(clear_mask, set_mask)
1768    }
1769}
1770
1771impl MagnifierControlHandle {}
1772
1773mod internal {
1774    use super::*;
1775
1776    impl fidl::encoding::ResourceTypeMarker for ColorTransformRegisterColorTransformHandlerRequest {
1777        type Borrowed<'a> = &'a mut Self;
1778        fn take_or_borrow<'a>(
1779            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1780        ) -> Self::Borrowed<'a> {
1781            value
1782        }
1783    }
1784
1785    unsafe impl fidl::encoding::TypeMarker for ColorTransformRegisterColorTransformHandlerRequest {
1786        type Owned = Self;
1787
1788        #[inline(always)]
1789        fn inline_align(_context: fidl::encoding::Context) -> usize {
1790            4
1791        }
1792
1793        #[inline(always)]
1794        fn inline_size(_context: fidl::encoding::Context) -> usize {
1795            4
1796        }
1797    }
1798
1799    unsafe impl
1800        fidl::encoding::Encode<
1801            ColorTransformRegisterColorTransformHandlerRequest,
1802            fidl::encoding::DefaultFuchsiaResourceDialect,
1803        > for &mut ColorTransformRegisterColorTransformHandlerRequest
1804    {
1805        #[inline]
1806        unsafe fn encode(
1807            self,
1808            encoder: &mut fidl::encoding::Encoder<
1809                '_,
1810                fidl::encoding::DefaultFuchsiaResourceDialect,
1811            >,
1812            offset: usize,
1813            _depth: fidl::encoding::Depth,
1814        ) -> fidl::Result<()> {
1815            encoder
1816                .debug_check_bounds::<ColorTransformRegisterColorTransformHandlerRequest>(offset);
1817            // Delegate to tuple encoding.
1818            fidl::encoding::Encode::<
1819                ColorTransformRegisterColorTransformHandlerRequest,
1820                fidl::encoding::DefaultFuchsiaResourceDialect,
1821            >::encode(
1822                (
1823                    <fidl::encoding::Endpoint<
1824                        fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>,
1825                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1826                        &mut self.handler
1827                    ),
1828                ),
1829                encoder,
1830                offset,
1831                _depth,
1832            )
1833        }
1834    }
1835    unsafe impl<
1836        T0: fidl::encoding::Encode<
1837                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>>,
1838                fidl::encoding::DefaultFuchsiaResourceDialect,
1839            >,
1840    >
1841        fidl::encoding::Encode<
1842            ColorTransformRegisterColorTransformHandlerRequest,
1843            fidl::encoding::DefaultFuchsiaResourceDialect,
1844        > for (T0,)
1845    {
1846        #[inline]
1847        unsafe fn encode(
1848            self,
1849            encoder: &mut fidl::encoding::Encoder<
1850                '_,
1851                fidl::encoding::DefaultFuchsiaResourceDialect,
1852            >,
1853            offset: usize,
1854            depth: fidl::encoding::Depth,
1855        ) -> fidl::Result<()> {
1856            encoder
1857                .debug_check_bounds::<ColorTransformRegisterColorTransformHandlerRequest>(offset);
1858            // Zero out padding regions. There's no need to apply masks
1859            // because the unmasked parts will be overwritten by fields.
1860            // Write the fields.
1861            self.0.encode(encoder, offset + 0, depth)?;
1862            Ok(())
1863        }
1864    }
1865
1866    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1867        for ColorTransformRegisterColorTransformHandlerRequest
1868    {
1869        #[inline(always)]
1870        fn new_empty() -> Self {
1871            Self {
1872                handler: fidl::new_empty!(
1873                    fidl::encoding::Endpoint<
1874                        fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>,
1875                    >,
1876                    fidl::encoding::DefaultFuchsiaResourceDialect
1877                ),
1878            }
1879        }
1880
1881        #[inline]
1882        unsafe fn decode(
1883            &mut self,
1884            decoder: &mut fidl::encoding::Decoder<
1885                '_,
1886                fidl::encoding::DefaultFuchsiaResourceDialect,
1887            >,
1888            offset: usize,
1889            _depth: fidl::encoding::Depth,
1890        ) -> fidl::Result<()> {
1891            decoder.debug_check_bounds::<Self>(offset);
1892            // Verify that padding bytes are zero.
1893            fidl::decode!(
1894                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ColorTransformHandlerMarker>>,
1895                fidl::encoding::DefaultFuchsiaResourceDialect,
1896                &mut self.handler,
1897                decoder,
1898                offset + 0,
1899                _depth
1900            )?;
1901            Ok(())
1902        }
1903    }
1904
1905    impl fidl::encoding::ResourceTypeMarker for MagnifierRegisterHandlerRequest {
1906        type Borrowed<'a> = &'a mut Self;
1907        fn take_or_borrow<'a>(
1908            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1909        ) -> Self::Borrowed<'a> {
1910            value
1911        }
1912    }
1913
1914    unsafe impl fidl::encoding::TypeMarker for MagnifierRegisterHandlerRequest {
1915        type Owned = Self;
1916
1917        #[inline(always)]
1918        fn inline_align(_context: fidl::encoding::Context) -> usize {
1919            4
1920        }
1921
1922        #[inline(always)]
1923        fn inline_size(_context: fidl::encoding::Context) -> usize {
1924            4
1925        }
1926    }
1927
1928    unsafe impl
1929        fidl::encoding::Encode<
1930            MagnifierRegisterHandlerRequest,
1931            fidl::encoding::DefaultFuchsiaResourceDialect,
1932        > for &mut MagnifierRegisterHandlerRequest
1933    {
1934        #[inline]
1935        unsafe fn encode(
1936            self,
1937            encoder: &mut fidl::encoding::Encoder<
1938                '_,
1939                fidl::encoding::DefaultFuchsiaResourceDialect,
1940            >,
1941            offset: usize,
1942            _depth: fidl::encoding::Depth,
1943        ) -> fidl::Result<()> {
1944            encoder.debug_check_bounds::<MagnifierRegisterHandlerRequest>(offset);
1945            // Delegate to tuple encoding.
1946            fidl::encoding::Encode::<
1947                MagnifierRegisterHandlerRequest,
1948                fidl::encoding::DefaultFuchsiaResourceDialect,
1949            >::encode(
1950                (
1951                    <fidl::encoding::Endpoint<
1952                        fidl::endpoints::ClientEnd<MagnificationHandlerMarker>,
1953                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1954                        &mut self.handler
1955                    ),
1956                ),
1957                encoder,
1958                offset,
1959                _depth,
1960            )
1961        }
1962    }
1963    unsafe impl<
1964        T0: fidl::encoding::Encode<
1965                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MagnificationHandlerMarker>>,
1966                fidl::encoding::DefaultFuchsiaResourceDialect,
1967            >,
1968    >
1969        fidl::encoding::Encode<
1970            MagnifierRegisterHandlerRequest,
1971            fidl::encoding::DefaultFuchsiaResourceDialect,
1972        > for (T0,)
1973    {
1974        #[inline]
1975        unsafe fn encode(
1976            self,
1977            encoder: &mut fidl::encoding::Encoder<
1978                '_,
1979                fidl::encoding::DefaultFuchsiaResourceDialect,
1980            >,
1981            offset: usize,
1982            depth: fidl::encoding::Depth,
1983        ) -> fidl::Result<()> {
1984            encoder.debug_check_bounds::<MagnifierRegisterHandlerRequest>(offset);
1985            // Zero out padding regions. There's no need to apply masks
1986            // because the unmasked parts will be overwritten by fields.
1987            // Write the fields.
1988            self.0.encode(encoder, offset + 0, depth)?;
1989            Ok(())
1990        }
1991    }
1992
1993    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1994        for MagnifierRegisterHandlerRequest
1995    {
1996        #[inline(always)]
1997        fn new_empty() -> Self {
1998            Self {
1999                handler: fidl::new_empty!(
2000                    fidl::encoding::Endpoint<
2001                        fidl::endpoints::ClientEnd<MagnificationHandlerMarker>,
2002                    >,
2003                    fidl::encoding::DefaultFuchsiaResourceDialect
2004                ),
2005            }
2006        }
2007
2008        #[inline]
2009        unsafe fn decode(
2010            &mut self,
2011            decoder: &mut fidl::encoding::Decoder<
2012                '_,
2013                fidl::encoding::DefaultFuchsiaResourceDialect,
2014            >,
2015            offset: usize,
2016            _depth: fidl::encoding::Depth,
2017        ) -> fidl::Result<()> {
2018            decoder.debug_check_bounds::<Self>(offset);
2019            // Verify that padding bytes are zero.
2020            fidl::decode!(
2021                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MagnificationHandlerMarker>>,
2022                fidl::encoding::DefaultFuchsiaResourceDialect,
2023                &mut self.handler,
2024                decoder,
2025                offset + 0,
2026                _depth
2027            )?;
2028            Ok(())
2029        }
2030    }
2031}