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