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 fidl::endpoints::ControlHandle for ColorTransformControlHandle {
387    fn shutdown(&self) {
388        self.inner.shutdown()
389    }
390
391    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
392        self.inner.shutdown_with_epitaph(status)
393    }
394
395    fn is_closed(&self) -> bool {
396        self.inner.channel().is_closed()
397    }
398    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
399        self.inner.channel().on_closed()
400    }
401
402    #[cfg(target_os = "fuchsia")]
403    fn signal_peer(
404        &self,
405        clear_mask: zx::Signals,
406        set_mask: zx::Signals,
407    ) -> Result<(), zx_status::Status> {
408        use fidl::Peered;
409        self.inner.channel().signal_peer(clear_mask, set_mask)
410    }
411}
412
413impl ColorTransformControlHandle {}
414
415#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
416pub struct ColorTransformHandlerMarker;
417
418impl fidl::endpoints::ProtocolMarker for ColorTransformHandlerMarker {
419    type Proxy = ColorTransformHandlerProxy;
420    type RequestStream = ColorTransformHandlerRequestStream;
421    #[cfg(target_os = "fuchsia")]
422    type SynchronousProxy = ColorTransformHandlerSynchronousProxy;
423
424    const DEBUG_NAME: &'static str = "(anonymous) ColorTransformHandler";
425}
426
427pub trait ColorTransformHandlerProxyInterface: Send + Sync {
428    type SetColorTransformConfigurationResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
429        + Send;
430    fn r#set_color_transform_configuration(
431        &self,
432        configuration: &ColorTransformConfiguration,
433    ) -> Self::SetColorTransformConfigurationResponseFut;
434}
435#[derive(Debug)]
436#[cfg(target_os = "fuchsia")]
437pub struct ColorTransformHandlerSynchronousProxy {
438    client: fidl::client::sync::Client,
439}
440
441#[cfg(target_os = "fuchsia")]
442impl fidl::endpoints::SynchronousProxy for ColorTransformHandlerSynchronousProxy {
443    type Proxy = ColorTransformHandlerProxy;
444    type Protocol = ColorTransformHandlerMarker;
445
446    fn from_channel(inner: fidl::Channel) -> Self {
447        Self::new(inner)
448    }
449
450    fn into_channel(self) -> fidl::Channel {
451        self.client.into_channel()
452    }
453
454    fn as_channel(&self) -> &fidl::Channel {
455        self.client.as_channel()
456    }
457}
458
459#[cfg(target_os = "fuchsia")]
460impl ColorTransformHandlerSynchronousProxy {
461    pub fn new(channel: fidl::Channel) -> Self {
462        Self { client: fidl::client::sync::Client::new(channel) }
463    }
464
465    pub fn into_channel(self) -> fidl::Channel {
466        self.client.into_channel()
467    }
468
469    /// Waits until an event arrives and returns it. It is safe for other
470    /// threads to make concurrent requests while waiting for an event.
471    pub fn wait_for_event(
472        &self,
473        deadline: zx::MonotonicInstant,
474    ) -> Result<ColorTransformHandlerEvent, fidl::Error> {
475        ColorTransformHandlerEvent::decode(
476            self.client.wait_for_event::<ColorTransformHandlerMarker>(deadline)?,
477        )
478    }
479
480    /// Called when the color transform configuration has changed.
481    pub fn r#set_color_transform_configuration(
482        &self,
483        mut configuration: &ColorTransformConfiguration,
484        ___deadline: zx::MonotonicInstant,
485    ) -> Result<(), fidl::Error> {
486        let _response = self.client.send_query::<
487            ColorTransformHandlerSetColorTransformConfigurationRequest,
488            fidl::encoding::EmptyPayload,
489            ColorTransformHandlerMarker,
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        Self { client: fidl::client::sync::Client::new(channel) }
940    }
941
942    pub fn into_channel(self) -> fidl::Channel {
943        self.client.into_channel()
944    }
945
946    /// Waits until an event arrives and returns it. It is safe for other
947    /// threads to make concurrent requests while waiting for an event.
948    pub fn wait_for_event(
949        &self,
950        deadline: zx::MonotonicInstant,
951    ) -> Result<MagnificationHandlerEvent, fidl::Error> {
952        MagnificationHandlerEvent::decode(
953            self.client.wait_for_event::<MagnificationHandlerMarker>(deadline)?,
954        )
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            MagnificationHandlerMarker,
973        >(
974            (x, y, scale,),
975            0x71e54bab8b9f7357,
976            fidl::encoding::DynamicFlags::empty(),
977            ___deadline,
978        )?;
979        Ok(_response)
980    }
981}
982
983#[cfg(target_os = "fuchsia")]
984impl From<MagnificationHandlerSynchronousProxy> for zx::NullableHandle {
985    fn from(value: MagnificationHandlerSynchronousProxy) -> Self {
986        value.into_channel().into()
987    }
988}
989
990#[cfg(target_os = "fuchsia")]
991impl From<fidl::Channel> for MagnificationHandlerSynchronousProxy {
992    fn from(value: fidl::Channel) -> Self {
993        Self::new(value)
994    }
995}
996
997#[cfg(target_os = "fuchsia")]
998impl fidl::endpoints::FromClient for MagnificationHandlerSynchronousProxy {
999    type Protocol = MagnificationHandlerMarker;
1000
1001    fn from_client(value: fidl::endpoints::ClientEnd<MagnificationHandlerMarker>) -> Self {
1002        Self::new(value.into_channel())
1003    }
1004}
1005
1006#[derive(Debug, Clone)]
1007pub struct MagnificationHandlerProxy {
1008    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1009}
1010
1011impl fidl::endpoints::Proxy for MagnificationHandlerProxy {
1012    type Protocol = MagnificationHandlerMarker;
1013
1014    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1015        Self::new(inner)
1016    }
1017
1018    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1019        self.client.into_channel().map_err(|client| Self { client })
1020    }
1021
1022    fn as_channel(&self) -> &::fidl::AsyncChannel {
1023        self.client.as_channel()
1024    }
1025}
1026
1027impl MagnificationHandlerProxy {
1028    /// Create a new Proxy for fuchsia.accessibility/MagnificationHandler.
1029    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1030        let protocol_name =
1031            <MagnificationHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1032        Self { client: fidl::client::Client::new(channel, protocol_name) }
1033    }
1034
1035    /// Get a Stream of events from the remote end of the protocol.
1036    ///
1037    /// # Panics
1038    ///
1039    /// Panics if the event stream was already taken.
1040    pub fn take_event_stream(&self) -> MagnificationHandlerEventStream {
1041        MagnificationHandlerEventStream { event_receiver: self.client.take_event_receiver() }
1042    }
1043
1044    /// Sets clip-space x-offset, y-offset, and scale for the presentation.
1045    /// x and y are in Vulkan NDC and are applied after scaling, which occurs
1046    /// about the center of the presentation. The callback indicates when the
1047    /// update has been presented. The identity transform (0, 0, 1) is the
1048    /// natural state.
1049    pub fn r#set_clip_space_transform(
1050        &self,
1051        mut x: f32,
1052        mut y: f32,
1053        mut scale: f32,
1054    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1055        MagnificationHandlerProxyInterface::r#set_clip_space_transform(self, x, y, scale)
1056    }
1057}
1058
1059impl MagnificationHandlerProxyInterface for MagnificationHandlerProxy {
1060    type SetClipSpaceTransformResponseFut =
1061        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1062    fn r#set_clip_space_transform(
1063        &self,
1064        mut x: f32,
1065        mut y: f32,
1066        mut scale: f32,
1067    ) -> Self::SetClipSpaceTransformResponseFut {
1068        fn _decode(
1069            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1070        ) -> Result<(), fidl::Error> {
1071            let _response = fidl::client::decode_transaction_body::<
1072                fidl::encoding::EmptyPayload,
1073                fidl::encoding::DefaultFuchsiaResourceDialect,
1074                0x71e54bab8b9f7357,
1075            >(_buf?)?;
1076            Ok(_response)
1077        }
1078        self.client.send_query_and_decode::<MagnificationHandlerSetClipSpaceTransformRequest, ()>(
1079            (x, y, scale),
1080            0x71e54bab8b9f7357,
1081            fidl::encoding::DynamicFlags::empty(),
1082            _decode,
1083        )
1084    }
1085}
1086
1087pub struct MagnificationHandlerEventStream {
1088    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1089}
1090
1091impl std::marker::Unpin for MagnificationHandlerEventStream {}
1092
1093impl futures::stream::FusedStream for MagnificationHandlerEventStream {
1094    fn is_terminated(&self) -> bool {
1095        self.event_receiver.is_terminated()
1096    }
1097}
1098
1099impl futures::Stream for MagnificationHandlerEventStream {
1100    type Item = Result<MagnificationHandlerEvent, fidl::Error>;
1101
1102    fn poll_next(
1103        mut self: std::pin::Pin<&mut Self>,
1104        cx: &mut std::task::Context<'_>,
1105    ) -> std::task::Poll<Option<Self::Item>> {
1106        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1107            &mut self.event_receiver,
1108            cx
1109        )?) {
1110            Some(buf) => std::task::Poll::Ready(Some(MagnificationHandlerEvent::decode(buf))),
1111            None => std::task::Poll::Ready(None),
1112        }
1113    }
1114}
1115
1116#[derive(Debug)]
1117pub enum MagnificationHandlerEvent {}
1118
1119impl MagnificationHandlerEvent {
1120    /// Decodes a message buffer as a [`MagnificationHandlerEvent`].
1121    fn decode(
1122        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1123    ) -> Result<MagnificationHandlerEvent, fidl::Error> {
1124        let (bytes, _handles) = buf.split_mut();
1125        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1126        debug_assert_eq!(tx_header.tx_id, 0);
1127        match tx_header.ordinal {
1128            _ => Err(fidl::Error::UnknownOrdinal {
1129                ordinal: tx_header.ordinal,
1130                protocol_name:
1131                    <MagnificationHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1132            }),
1133        }
1134    }
1135}
1136
1137/// A Stream of incoming requests for fuchsia.accessibility/MagnificationHandler.
1138pub struct MagnificationHandlerRequestStream {
1139    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1140    is_terminated: bool,
1141}
1142
1143impl std::marker::Unpin for MagnificationHandlerRequestStream {}
1144
1145impl futures::stream::FusedStream for MagnificationHandlerRequestStream {
1146    fn is_terminated(&self) -> bool {
1147        self.is_terminated
1148    }
1149}
1150
1151impl fidl::endpoints::RequestStream for MagnificationHandlerRequestStream {
1152    type Protocol = MagnificationHandlerMarker;
1153    type ControlHandle = MagnificationHandlerControlHandle;
1154
1155    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1156        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1157    }
1158
1159    fn control_handle(&self) -> Self::ControlHandle {
1160        MagnificationHandlerControlHandle { inner: self.inner.clone() }
1161    }
1162
1163    fn into_inner(
1164        self,
1165    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1166    {
1167        (self.inner, self.is_terminated)
1168    }
1169
1170    fn from_inner(
1171        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1172        is_terminated: bool,
1173    ) -> Self {
1174        Self { inner, is_terminated }
1175    }
1176}
1177
1178impl futures::Stream for MagnificationHandlerRequestStream {
1179    type Item = Result<MagnificationHandlerRequest, fidl::Error>;
1180
1181    fn poll_next(
1182        mut self: std::pin::Pin<&mut Self>,
1183        cx: &mut std::task::Context<'_>,
1184    ) -> std::task::Poll<Option<Self::Item>> {
1185        let this = &mut *self;
1186        if this.inner.check_shutdown(cx) {
1187            this.is_terminated = true;
1188            return std::task::Poll::Ready(None);
1189        }
1190        if this.is_terminated {
1191            panic!("polled MagnificationHandlerRequestStream after completion");
1192        }
1193        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1194            |bytes, handles| {
1195                match this.inner.channel().read_etc(cx, bytes, handles) {
1196                    std::task::Poll::Ready(Ok(())) => {}
1197                    std::task::Poll::Pending => return std::task::Poll::Pending,
1198                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1199                        this.is_terminated = true;
1200                        return std::task::Poll::Ready(None);
1201                    }
1202                    std::task::Poll::Ready(Err(e)) => {
1203                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1204                            e.into(),
1205                        ))));
1206                    }
1207                }
1208
1209                // A message has been received from the channel
1210                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1211
1212                std::task::Poll::Ready(Some(match header.ordinal {
1213                0x71e54bab8b9f7357 => {
1214                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1215                    let mut req = fidl::new_empty!(MagnificationHandlerSetClipSpaceTransformRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1216                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MagnificationHandlerSetClipSpaceTransformRequest>(&header, _body_bytes, handles, &mut req)?;
1217                    let control_handle = MagnificationHandlerControlHandle {
1218                        inner: this.inner.clone(),
1219                    };
1220                    Ok(MagnificationHandlerRequest::SetClipSpaceTransform {x: req.x,
1221y: req.y,
1222scale: req.scale,
1223
1224                        responder: MagnificationHandlerSetClipSpaceTransformResponder {
1225                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1226                            tx_id: header.tx_id,
1227                        },
1228                    })
1229                }
1230                _ => Err(fidl::Error::UnknownOrdinal {
1231                    ordinal: header.ordinal,
1232                    protocol_name: <MagnificationHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1233                }),
1234            }))
1235            },
1236        )
1237    }
1238}
1239
1240/// Exposes a privileged magnifier API for camera control, typically on a
1241/// `fuchsia.ui.policy.Presentation`.
1242#[derive(Debug)]
1243pub enum MagnificationHandlerRequest {
1244    /// Sets clip-space x-offset, y-offset, and scale for the presentation.
1245    /// x and y are in Vulkan NDC and are applied after scaling, which occurs
1246    /// about the center of the presentation. The callback indicates when the
1247    /// update has been presented. The identity transform (0, 0, 1) is the
1248    /// natural state.
1249    SetClipSpaceTransform {
1250        x: f32,
1251        y: f32,
1252        scale: f32,
1253        responder: MagnificationHandlerSetClipSpaceTransformResponder,
1254    },
1255}
1256
1257impl MagnificationHandlerRequest {
1258    #[allow(irrefutable_let_patterns)]
1259    pub fn into_set_clip_space_transform(
1260        self,
1261    ) -> Option<(f32, f32, f32, MagnificationHandlerSetClipSpaceTransformResponder)> {
1262        if let MagnificationHandlerRequest::SetClipSpaceTransform { x, y, scale, responder } = self
1263        {
1264            Some((x, y, scale, responder))
1265        } else {
1266            None
1267        }
1268    }
1269
1270    /// Name of the method defined in FIDL
1271    pub fn method_name(&self) -> &'static str {
1272        match *self {
1273            MagnificationHandlerRequest::SetClipSpaceTransform { .. } => "set_clip_space_transform",
1274        }
1275    }
1276}
1277
1278#[derive(Debug, Clone)]
1279pub struct MagnificationHandlerControlHandle {
1280    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1281}
1282
1283impl fidl::endpoints::ControlHandle for MagnificationHandlerControlHandle {
1284    fn shutdown(&self) {
1285        self.inner.shutdown()
1286    }
1287
1288    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1289        self.inner.shutdown_with_epitaph(status)
1290    }
1291
1292    fn is_closed(&self) -> bool {
1293        self.inner.channel().is_closed()
1294    }
1295    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1296        self.inner.channel().on_closed()
1297    }
1298
1299    #[cfg(target_os = "fuchsia")]
1300    fn signal_peer(
1301        &self,
1302        clear_mask: zx::Signals,
1303        set_mask: zx::Signals,
1304    ) -> Result<(), zx_status::Status> {
1305        use fidl::Peered;
1306        self.inner.channel().signal_peer(clear_mask, set_mask)
1307    }
1308}
1309
1310impl MagnificationHandlerControlHandle {}
1311
1312#[must_use = "FIDL methods require a response to be sent"]
1313#[derive(Debug)]
1314pub struct MagnificationHandlerSetClipSpaceTransformResponder {
1315    control_handle: std::mem::ManuallyDrop<MagnificationHandlerControlHandle>,
1316    tx_id: u32,
1317}
1318
1319/// Set the the channel to be shutdown (see [`MagnificationHandlerControlHandle::shutdown`])
1320/// if the responder is dropped without sending a response, so that the client
1321/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1322impl std::ops::Drop for MagnificationHandlerSetClipSpaceTransformResponder {
1323    fn drop(&mut self) {
1324        self.control_handle.shutdown();
1325        // Safety: drops once, never accessed again
1326        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1327    }
1328}
1329
1330impl fidl::endpoints::Responder for MagnificationHandlerSetClipSpaceTransformResponder {
1331    type ControlHandle = MagnificationHandlerControlHandle;
1332
1333    fn control_handle(&self) -> &MagnificationHandlerControlHandle {
1334        &self.control_handle
1335    }
1336
1337    fn drop_without_shutdown(mut self) {
1338        // Safety: drops once, never accessed again due to mem::forget
1339        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1340        // Prevent Drop from running (which would shut down the channel)
1341        std::mem::forget(self);
1342    }
1343}
1344
1345impl MagnificationHandlerSetClipSpaceTransformResponder {
1346    /// Sends a response to the FIDL transaction.
1347    ///
1348    /// Sets the channel to shutdown if an error occurs.
1349    pub fn send(self) -> Result<(), fidl::Error> {
1350        let _result = self.send_raw();
1351        if _result.is_err() {
1352            self.control_handle.shutdown();
1353        }
1354        self.drop_without_shutdown();
1355        _result
1356    }
1357
1358    /// Similar to "send" but does not shutdown the channel if an error occurs.
1359    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1360        let _result = self.send_raw();
1361        self.drop_without_shutdown();
1362        _result
1363    }
1364
1365    fn send_raw(&self) -> Result<(), fidl::Error> {
1366        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1367            (),
1368            self.tx_id,
1369            0x71e54bab8b9f7357,
1370            fidl::encoding::DynamicFlags::empty(),
1371        )
1372    }
1373}
1374
1375#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1376pub struct MagnifierMarker;
1377
1378impl fidl::endpoints::ProtocolMarker for MagnifierMarker {
1379    type Proxy = MagnifierProxy;
1380    type RequestStream = MagnifierRequestStream;
1381    #[cfg(target_os = "fuchsia")]
1382    type SynchronousProxy = MagnifierSynchronousProxy;
1383
1384    const DEBUG_NAME: &'static str = "fuchsia.accessibility.Magnifier";
1385}
1386impl fidl::endpoints::DiscoverableProtocolMarker for MagnifierMarker {}
1387
1388pub trait MagnifierProxyInterface: Send + Sync {
1389    fn r#register_handler(
1390        &self,
1391        handler: fidl::endpoints::ClientEnd<MagnificationHandlerMarker>,
1392    ) -> Result<(), fidl::Error>;
1393}
1394#[derive(Debug)]
1395#[cfg(target_os = "fuchsia")]
1396pub struct MagnifierSynchronousProxy {
1397    client: fidl::client::sync::Client,
1398}
1399
1400#[cfg(target_os = "fuchsia")]
1401impl fidl::endpoints::SynchronousProxy for MagnifierSynchronousProxy {
1402    type Proxy = MagnifierProxy;
1403    type Protocol = MagnifierMarker;
1404
1405    fn from_channel(inner: fidl::Channel) -> Self {
1406        Self::new(inner)
1407    }
1408
1409    fn into_channel(self) -> fidl::Channel {
1410        self.client.into_channel()
1411    }
1412
1413    fn as_channel(&self) -> &fidl::Channel {
1414        self.client.as_channel()
1415    }
1416}
1417
1418#[cfg(target_os = "fuchsia")]
1419impl MagnifierSynchronousProxy {
1420    pub fn new(channel: fidl::Channel) -> Self {
1421        Self { client: fidl::client::sync::Client::new(channel) }
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::<MagnifierMarker>(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}