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