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