fidl_fuchsia_unknown/
fidl_fuchsia_unknown.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_unknown__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct CloneableCloneRequest {
16    pub request: fidl::endpoints::ServerEnd<CloneableMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CloneableCloneRequest {}
20
21#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
22pub struct CloneableMarker;
23
24impl fidl::endpoints::ProtocolMarker for CloneableMarker {
25    type Proxy = CloneableProxy;
26    type RequestStream = CloneableRequestStream;
27    #[cfg(target_os = "fuchsia")]
28    type SynchronousProxy = CloneableSynchronousProxy;
29
30    const DEBUG_NAME: &'static str = "(anonymous) Cloneable";
31}
32
33pub trait CloneableProxyInterface: Send + Sync {
34    fn r#clone(
35        &self,
36        request: fidl::endpoints::ServerEnd<CloneableMarker>,
37    ) -> Result<(), fidl::Error>;
38}
39#[derive(Debug)]
40#[cfg(target_os = "fuchsia")]
41pub struct CloneableSynchronousProxy {
42    client: fidl::client::sync::Client,
43}
44
45#[cfg(target_os = "fuchsia")]
46impl fidl::endpoints::SynchronousProxy for CloneableSynchronousProxy {
47    type Proxy = CloneableProxy;
48    type Protocol = CloneableMarker;
49
50    fn from_channel(inner: fidl::Channel) -> Self {
51        Self::new(inner)
52    }
53
54    fn into_channel(self) -> fidl::Channel {
55        self.client.into_channel()
56    }
57
58    fn as_channel(&self) -> &fidl::Channel {
59        self.client.as_channel()
60    }
61}
62
63#[cfg(target_os = "fuchsia")]
64impl CloneableSynchronousProxy {
65    pub fn new(channel: fidl::Channel) -> Self {
66        let protocol_name = <CloneableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
67        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
68    }
69
70    pub fn into_channel(self) -> fidl::Channel {
71        self.client.into_channel()
72    }
73
74    /// Waits until an event arrives and returns it. It is safe for other
75    /// threads to make concurrent requests while waiting for an event.
76    pub fn wait_for_event(
77        &self,
78        deadline: zx::MonotonicInstant,
79    ) -> Result<CloneableEvent, fidl::Error> {
80        CloneableEvent::decode(self.client.wait_for_event(deadline)?)
81    }
82
83    pub fn r#clone(
84        &self,
85        mut request: fidl::endpoints::ServerEnd<CloneableMarker>,
86    ) -> Result<(), fidl::Error> {
87        self.client.send::<CloneableCloneRequest>(
88            (request,),
89            0x20d8a7aba2168a79,
90            fidl::encoding::DynamicFlags::empty(),
91        )
92    }
93}
94
95#[cfg(target_os = "fuchsia")]
96impl From<CloneableSynchronousProxy> for zx::NullableHandle {
97    fn from(value: CloneableSynchronousProxy) -> Self {
98        value.into_channel().into()
99    }
100}
101
102#[cfg(target_os = "fuchsia")]
103impl From<fidl::Channel> for CloneableSynchronousProxy {
104    fn from(value: fidl::Channel) -> Self {
105        Self::new(value)
106    }
107}
108
109#[cfg(target_os = "fuchsia")]
110impl fidl::endpoints::FromClient for CloneableSynchronousProxy {
111    type Protocol = CloneableMarker;
112
113    fn from_client(value: fidl::endpoints::ClientEnd<CloneableMarker>) -> Self {
114        Self::new(value.into_channel())
115    }
116}
117
118#[derive(Debug, Clone)]
119pub struct CloneableProxy {
120    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
121}
122
123impl fidl::endpoints::Proxy for CloneableProxy {
124    type Protocol = CloneableMarker;
125
126    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
127        Self::new(inner)
128    }
129
130    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
131        self.client.into_channel().map_err(|client| Self { client })
132    }
133
134    fn as_channel(&self) -> &::fidl::AsyncChannel {
135        self.client.as_channel()
136    }
137}
138
139impl CloneableProxy {
140    /// Create a new Proxy for fuchsia.unknown/Cloneable.
141    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
142        let protocol_name = <CloneableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
143        Self { client: fidl::client::Client::new(channel, protocol_name) }
144    }
145
146    /// Get a Stream of events from the remote end of the protocol.
147    ///
148    /// # Panics
149    ///
150    /// Panics if the event stream was already taken.
151    pub fn take_event_stream(&self) -> CloneableEventStream {
152        CloneableEventStream { event_receiver: self.client.take_event_receiver() }
153    }
154
155    pub fn r#clone(
156        &self,
157        mut request: fidl::endpoints::ServerEnd<CloneableMarker>,
158    ) -> Result<(), fidl::Error> {
159        CloneableProxyInterface::r#clone(self, request)
160    }
161}
162
163impl CloneableProxyInterface for CloneableProxy {
164    fn r#clone(
165        &self,
166        mut request: fidl::endpoints::ServerEnd<CloneableMarker>,
167    ) -> Result<(), fidl::Error> {
168        self.client.send::<CloneableCloneRequest>(
169            (request,),
170            0x20d8a7aba2168a79,
171            fidl::encoding::DynamicFlags::empty(),
172        )
173    }
174}
175
176pub struct CloneableEventStream {
177    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
178}
179
180impl std::marker::Unpin for CloneableEventStream {}
181
182impl futures::stream::FusedStream for CloneableEventStream {
183    fn is_terminated(&self) -> bool {
184        self.event_receiver.is_terminated()
185    }
186}
187
188impl futures::Stream for CloneableEventStream {
189    type Item = Result<CloneableEvent, fidl::Error>;
190
191    fn poll_next(
192        mut self: std::pin::Pin<&mut Self>,
193        cx: &mut std::task::Context<'_>,
194    ) -> std::task::Poll<Option<Self::Item>> {
195        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
196            &mut self.event_receiver,
197            cx
198        )?) {
199            Some(buf) => std::task::Poll::Ready(Some(CloneableEvent::decode(buf))),
200            None => std::task::Poll::Ready(None),
201        }
202    }
203}
204
205#[derive(Debug)]
206pub enum CloneableEvent {}
207
208impl CloneableEvent {
209    /// Decodes a message buffer as a [`CloneableEvent`].
210    fn decode(
211        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
212    ) -> Result<CloneableEvent, fidl::Error> {
213        let (bytes, _handles) = buf.split_mut();
214        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
215        debug_assert_eq!(tx_header.tx_id, 0);
216        match tx_header.ordinal {
217            _ => Err(fidl::Error::UnknownOrdinal {
218                ordinal: tx_header.ordinal,
219                protocol_name: <CloneableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
220            }),
221        }
222    }
223}
224
225/// A Stream of incoming requests for fuchsia.unknown/Cloneable.
226pub struct CloneableRequestStream {
227    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
228    is_terminated: bool,
229}
230
231impl std::marker::Unpin for CloneableRequestStream {}
232
233impl futures::stream::FusedStream for CloneableRequestStream {
234    fn is_terminated(&self) -> bool {
235        self.is_terminated
236    }
237}
238
239impl fidl::endpoints::RequestStream for CloneableRequestStream {
240    type Protocol = CloneableMarker;
241    type ControlHandle = CloneableControlHandle;
242
243    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
244        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
245    }
246
247    fn control_handle(&self) -> Self::ControlHandle {
248        CloneableControlHandle { inner: self.inner.clone() }
249    }
250
251    fn into_inner(
252        self,
253    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
254    {
255        (self.inner, self.is_terminated)
256    }
257
258    fn from_inner(
259        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
260        is_terminated: bool,
261    ) -> Self {
262        Self { inner, is_terminated }
263    }
264}
265
266impl futures::Stream for CloneableRequestStream {
267    type Item = Result<CloneableRequest, fidl::Error>;
268
269    fn poll_next(
270        mut self: std::pin::Pin<&mut Self>,
271        cx: &mut std::task::Context<'_>,
272    ) -> std::task::Poll<Option<Self::Item>> {
273        let this = &mut *self;
274        if this.inner.check_shutdown(cx) {
275            this.is_terminated = true;
276            return std::task::Poll::Ready(None);
277        }
278        if this.is_terminated {
279            panic!("polled CloneableRequestStream after completion");
280        }
281        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
282            |bytes, handles| {
283                match this.inner.channel().read_etc(cx, bytes, handles) {
284                    std::task::Poll::Ready(Ok(())) => {}
285                    std::task::Poll::Pending => return std::task::Poll::Pending,
286                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
287                        this.is_terminated = true;
288                        return std::task::Poll::Ready(None);
289                    }
290                    std::task::Poll::Ready(Err(e)) => {
291                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
292                            e.into(),
293                        ))));
294                    }
295                }
296
297                // A message has been received from the channel
298                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
299
300                std::task::Poll::Ready(Some(match header.ordinal {
301                    0x20d8a7aba2168a79 => {
302                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
303                        let mut req = fidl::new_empty!(
304                            CloneableCloneRequest,
305                            fidl::encoding::DefaultFuchsiaResourceDialect
306                        );
307                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CloneableCloneRequest>(&header, _body_bytes, handles, &mut req)?;
308                        let control_handle = CloneableControlHandle { inner: this.inner.clone() };
309                        Ok(CloneableRequest::Clone { request: req.request, control_handle })
310                    }
311                    _ => Err(fidl::Error::UnknownOrdinal {
312                        ordinal: header.ordinal,
313                        protocol_name:
314                            <CloneableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
315                    }),
316                }))
317            },
318        )
319    }
320}
321
322/// Provides a means of duplicating a connection.
323///
324/// See the composing protocol's documentation for a description of
325/// connection-scoped state, if any.
326#[derive(Debug)]
327pub enum CloneableRequest {
328    Clone {
329        request: fidl::endpoints::ServerEnd<CloneableMarker>,
330        control_handle: CloneableControlHandle,
331    },
332}
333
334impl CloneableRequest {
335    #[allow(irrefutable_let_patterns)]
336    pub fn into_clone(
337        self,
338    ) -> Option<(fidl::endpoints::ServerEnd<CloneableMarker>, CloneableControlHandle)> {
339        if let CloneableRequest::Clone { request, control_handle } = self {
340            Some((request, control_handle))
341        } else {
342            None
343        }
344    }
345
346    /// Name of the method defined in FIDL
347    pub fn method_name(&self) -> &'static str {
348        match *self {
349            CloneableRequest::Clone { .. } => "clone",
350        }
351    }
352}
353
354#[derive(Debug, Clone)]
355pub struct CloneableControlHandle {
356    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
357}
358
359impl fidl::endpoints::ControlHandle for CloneableControlHandle {
360    fn shutdown(&self) {
361        self.inner.shutdown()
362    }
363
364    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
365        self.inner.shutdown_with_epitaph(status)
366    }
367
368    fn is_closed(&self) -> bool {
369        self.inner.channel().is_closed()
370    }
371    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
372        self.inner.channel().on_closed()
373    }
374
375    #[cfg(target_os = "fuchsia")]
376    fn signal_peer(
377        &self,
378        clear_mask: zx::Signals,
379        set_mask: zx::Signals,
380    ) -> Result<(), zx_status::Status> {
381        use fidl::Peered;
382        self.inner.channel().signal_peer(clear_mask, set_mask)
383    }
384}
385
386impl CloneableControlHandle {}
387
388#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
389pub struct CloseableMarker;
390
391impl fidl::endpoints::ProtocolMarker for CloseableMarker {
392    type Proxy = CloseableProxy;
393    type RequestStream = CloseableRequestStream;
394    #[cfg(target_os = "fuchsia")]
395    type SynchronousProxy = CloseableSynchronousProxy;
396
397    const DEBUG_NAME: &'static str = "(anonymous) Closeable";
398}
399pub type CloseableCloseResult = Result<(), i32>;
400
401pub trait CloseableProxyInterface: Send + Sync {
402    type CloseResponseFut: std::future::Future<Output = Result<CloseableCloseResult, fidl::Error>>
403        + Send;
404    fn r#close(&self) -> Self::CloseResponseFut;
405}
406#[derive(Debug)]
407#[cfg(target_os = "fuchsia")]
408pub struct CloseableSynchronousProxy {
409    client: fidl::client::sync::Client,
410}
411
412#[cfg(target_os = "fuchsia")]
413impl fidl::endpoints::SynchronousProxy for CloseableSynchronousProxy {
414    type Proxy = CloseableProxy;
415    type Protocol = CloseableMarker;
416
417    fn from_channel(inner: fidl::Channel) -> Self {
418        Self::new(inner)
419    }
420
421    fn into_channel(self) -> fidl::Channel {
422        self.client.into_channel()
423    }
424
425    fn as_channel(&self) -> &fidl::Channel {
426        self.client.as_channel()
427    }
428}
429
430#[cfg(target_os = "fuchsia")]
431impl CloseableSynchronousProxy {
432    pub fn new(channel: fidl::Channel) -> Self {
433        let protocol_name = <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
434        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
435    }
436
437    pub fn into_channel(self) -> fidl::Channel {
438        self.client.into_channel()
439    }
440
441    /// Waits until an event arrives and returns it. It is safe for other
442    /// threads to make concurrent requests while waiting for an event.
443    pub fn wait_for_event(
444        &self,
445        deadline: zx::MonotonicInstant,
446    ) -> Result<CloseableEvent, fidl::Error> {
447        CloseableEvent::decode(self.client.wait_for_event(deadline)?)
448    }
449
450    /// Terminates the connection.
451    ///
452    /// After calling `Close`, the client must not send any other requests.
453    ///
454    /// Servers, after sending the status response, should close the connection
455    /// regardless of status and without sending an epitaph.
456    ///
457    /// Closing the client end of the channel should be semantically equivalent
458    /// to calling `Close` without knowing when the close has completed or its
459    /// status.
460    pub fn r#close(
461        &self,
462        ___deadline: zx::MonotonicInstant,
463    ) -> Result<CloseableCloseResult, fidl::Error> {
464        let _response = self.client.send_query::<
465            fidl::encoding::EmptyPayload,
466            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
467        >(
468            (),
469            0x5ac5d459ad7f657e,
470            fidl::encoding::DynamicFlags::empty(),
471            ___deadline,
472        )?;
473        Ok(_response.map(|x| x))
474    }
475}
476
477#[cfg(target_os = "fuchsia")]
478impl From<CloseableSynchronousProxy> for zx::NullableHandle {
479    fn from(value: CloseableSynchronousProxy) -> Self {
480        value.into_channel().into()
481    }
482}
483
484#[cfg(target_os = "fuchsia")]
485impl From<fidl::Channel> for CloseableSynchronousProxy {
486    fn from(value: fidl::Channel) -> Self {
487        Self::new(value)
488    }
489}
490
491#[cfg(target_os = "fuchsia")]
492impl fidl::endpoints::FromClient for CloseableSynchronousProxy {
493    type Protocol = CloseableMarker;
494
495    fn from_client(value: fidl::endpoints::ClientEnd<CloseableMarker>) -> Self {
496        Self::new(value.into_channel())
497    }
498}
499
500#[derive(Debug, Clone)]
501pub struct CloseableProxy {
502    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
503}
504
505impl fidl::endpoints::Proxy for CloseableProxy {
506    type Protocol = CloseableMarker;
507
508    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
509        Self::new(inner)
510    }
511
512    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
513        self.client.into_channel().map_err(|client| Self { client })
514    }
515
516    fn as_channel(&self) -> &::fidl::AsyncChannel {
517        self.client.as_channel()
518    }
519}
520
521impl CloseableProxy {
522    /// Create a new Proxy for fuchsia.unknown/Closeable.
523    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
524        let protocol_name = <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
525        Self { client: fidl::client::Client::new(channel, protocol_name) }
526    }
527
528    /// Get a Stream of events from the remote end of the protocol.
529    ///
530    /// # Panics
531    ///
532    /// Panics if the event stream was already taken.
533    pub fn take_event_stream(&self) -> CloseableEventStream {
534        CloseableEventStream { event_receiver: self.client.take_event_receiver() }
535    }
536
537    /// Terminates the connection.
538    ///
539    /// After calling `Close`, the client must not send any other requests.
540    ///
541    /// Servers, after sending the status response, should close the connection
542    /// regardless of status and without sending an epitaph.
543    ///
544    /// Closing the client end of the channel should be semantically equivalent
545    /// to calling `Close` without knowing when the close has completed or its
546    /// status.
547    pub fn r#close(
548        &self,
549    ) -> fidl::client::QueryResponseFut<
550        CloseableCloseResult,
551        fidl::encoding::DefaultFuchsiaResourceDialect,
552    > {
553        CloseableProxyInterface::r#close(self)
554    }
555}
556
557impl CloseableProxyInterface for CloseableProxy {
558    type CloseResponseFut = fidl::client::QueryResponseFut<
559        CloseableCloseResult,
560        fidl::encoding::DefaultFuchsiaResourceDialect,
561    >;
562    fn r#close(&self) -> Self::CloseResponseFut {
563        fn _decode(
564            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
565        ) -> Result<CloseableCloseResult, fidl::Error> {
566            let _response = fidl::client::decode_transaction_body::<
567                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
568                fidl::encoding::DefaultFuchsiaResourceDialect,
569                0x5ac5d459ad7f657e,
570            >(_buf?)?;
571            Ok(_response.map(|x| x))
572        }
573        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CloseableCloseResult>(
574            (),
575            0x5ac5d459ad7f657e,
576            fidl::encoding::DynamicFlags::empty(),
577            _decode,
578        )
579    }
580}
581
582pub struct CloseableEventStream {
583    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
584}
585
586impl std::marker::Unpin for CloseableEventStream {}
587
588impl futures::stream::FusedStream for CloseableEventStream {
589    fn is_terminated(&self) -> bool {
590        self.event_receiver.is_terminated()
591    }
592}
593
594impl futures::Stream for CloseableEventStream {
595    type Item = Result<CloseableEvent, fidl::Error>;
596
597    fn poll_next(
598        mut self: std::pin::Pin<&mut Self>,
599        cx: &mut std::task::Context<'_>,
600    ) -> std::task::Poll<Option<Self::Item>> {
601        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
602            &mut self.event_receiver,
603            cx
604        )?) {
605            Some(buf) => std::task::Poll::Ready(Some(CloseableEvent::decode(buf))),
606            None => std::task::Poll::Ready(None),
607        }
608    }
609}
610
611#[derive(Debug)]
612pub enum CloseableEvent {}
613
614impl CloseableEvent {
615    /// Decodes a message buffer as a [`CloseableEvent`].
616    fn decode(
617        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
618    ) -> Result<CloseableEvent, fidl::Error> {
619        let (bytes, _handles) = buf.split_mut();
620        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
621        debug_assert_eq!(tx_header.tx_id, 0);
622        match tx_header.ordinal {
623            _ => Err(fidl::Error::UnknownOrdinal {
624                ordinal: tx_header.ordinal,
625                protocol_name: <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
626            }),
627        }
628    }
629}
630
631/// A Stream of incoming requests for fuchsia.unknown/Closeable.
632pub struct CloseableRequestStream {
633    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
634    is_terminated: bool,
635}
636
637impl std::marker::Unpin for CloseableRequestStream {}
638
639impl futures::stream::FusedStream for CloseableRequestStream {
640    fn is_terminated(&self) -> bool {
641        self.is_terminated
642    }
643}
644
645impl fidl::endpoints::RequestStream for CloseableRequestStream {
646    type Protocol = CloseableMarker;
647    type ControlHandle = CloseableControlHandle;
648
649    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
650        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
651    }
652
653    fn control_handle(&self) -> Self::ControlHandle {
654        CloseableControlHandle { inner: self.inner.clone() }
655    }
656
657    fn into_inner(
658        self,
659    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
660    {
661        (self.inner, self.is_terminated)
662    }
663
664    fn from_inner(
665        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
666        is_terminated: bool,
667    ) -> Self {
668        Self { inner, is_terminated }
669    }
670}
671
672impl futures::Stream for CloseableRequestStream {
673    type Item = Result<CloseableRequest, fidl::Error>;
674
675    fn poll_next(
676        mut self: std::pin::Pin<&mut Self>,
677        cx: &mut std::task::Context<'_>,
678    ) -> std::task::Poll<Option<Self::Item>> {
679        let this = &mut *self;
680        if this.inner.check_shutdown(cx) {
681            this.is_terminated = true;
682            return std::task::Poll::Ready(None);
683        }
684        if this.is_terminated {
685            panic!("polled CloseableRequestStream after completion");
686        }
687        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
688            |bytes, handles| {
689                match this.inner.channel().read_etc(cx, bytes, handles) {
690                    std::task::Poll::Ready(Ok(())) => {}
691                    std::task::Poll::Pending => return std::task::Poll::Pending,
692                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
693                        this.is_terminated = true;
694                        return std::task::Poll::Ready(None);
695                    }
696                    std::task::Poll::Ready(Err(e)) => {
697                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
698                            e.into(),
699                        ))));
700                    }
701                }
702
703                // A message has been received from the channel
704                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
705
706                std::task::Poll::Ready(Some(match header.ordinal {
707                    0x5ac5d459ad7f657e => {
708                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
709                        let mut req = fidl::new_empty!(
710                            fidl::encoding::EmptyPayload,
711                            fidl::encoding::DefaultFuchsiaResourceDialect
712                        );
713                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
714                        let control_handle = CloseableControlHandle { inner: this.inner.clone() };
715                        Ok(CloseableRequest::Close {
716                            responder: CloseableCloseResponder {
717                                control_handle: std::mem::ManuallyDrop::new(control_handle),
718                                tx_id: header.tx_id,
719                            },
720                        })
721                    }
722                    _ => Err(fidl::Error::UnknownOrdinal {
723                        ordinal: header.ordinal,
724                        protocol_name:
725                            <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
726                    }),
727                }))
728            },
729        )
730    }
731}
732
733/// Provides a means of synchronously closing a connection.
734#[derive(Debug)]
735pub enum CloseableRequest {
736    /// Terminates the connection.
737    ///
738    /// After calling `Close`, the client must not send any other requests.
739    ///
740    /// Servers, after sending the status response, should close the connection
741    /// regardless of status and without sending an epitaph.
742    ///
743    /// Closing the client end of the channel should be semantically equivalent
744    /// to calling `Close` without knowing when the close has completed or its
745    /// status.
746    Close { responder: CloseableCloseResponder },
747}
748
749impl CloseableRequest {
750    #[allow(irrefutable_let_patterns)]
751    pub fn into_close(self) -> Option<(CloseableCloseResponder)> {
752        if let CloseableRequest::Close { responder } = self { Some((responder)) } else { None }
753    }
754
755    /// Name of the method defined in FIDL
756    pub fn method_name(&self) -> &'static str {
757        match *self {
758            CloseableRequest::Close { .. } => "close",
759        }
760    }
761}
762
763#[derive(Debug, Clone)]
764pub struct CloseableControlHandle {
765    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
766}
767
768impl fidl::endpoints::ControlHandle for CloseableControlHandle {
769    fn shutdown(&self) {
770        self.inner.shutdown()
771    }
772
773    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
774        self.inner.shutdown_with_epitaph(status)
775    }
776
777    fn is_closed(&self) -> bool {
778        self.inner.channel().is_closed()
779    }
780    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
781        self.inner.channel().on_closed()
782    }
783
784    #[cfg(target_os = "fuchsia")]
785    fn signal_peer(
786        &self,
787        clear_mask: zx::Signals,
788        set_mask: zx::Signals,
789    ) -> Result<(), zx_status::Status> {
790        use fidl::Peered;
791        self.inner.channel().signal_peer(clear_mask, set_mask)
792    }
793}
794
795impl CloseableControlHandle {}
796
797#[must_use = "FIDL methods require a response to be sent"]
798#[derive(Debug)]
799pub struct CloseableCloseResponder {
800    control_handle: std::mem::ManuallyDrop<CloseableControlHandle>,
801    tx_id: u32,
802}
803
804/// Set the the channel to be shutdown (see [`CloseableControlHandle::shutdown`])
805/// if the responder is dropped without sending a response, so that the client
806/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
807impl std::ops::Drop for CloseableCloseResponder {
808    fn drop(&mut self) {
809        self.control_handle.shutdown();
810        // Safety: drops once, never accessed again
811        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
812    }
813}
814
815impl fidl::endpoints::Responder for CloseableCloseResponder {
816    type ControlHandle = CloseableControlHandle;
817
818    fn control_handle(&self) -> &CloseableControlHandle {
819        &self.control_handle
820    }
821
822    fn drop_without_shutdown(mut self) {
823        // Safety: drops once, never accessed again due to mem::forget
824        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
825        // Prevent Drop from running (which would shut down the channel)
826        std::mem::forget(self);
827    }
828}
829
830impl CloseableCloseResponder {
831    /// Sends a response to the FIDL transaction.
832    ///
833    /// Sets the channel to shutdown if an error occurs.
834    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
835        let _result = self.send_raw(result);
836        if _result.is_err() {
837            self.control_handle.shutdown();
838        }
839        self.drop_without_shutdown();
840        _result
841    }
842
843    /// Similar to "send" but does not shutdown the channel if an error occurs.
844    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
845        let _result = self.send_raw(result);
846        self.drop_without_shutdown();
847        _result
848    }
849
850    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
851        self.control_handle
852            .inner
853            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
854                result,
855                self.tx_id,
856                0x5ac5d459ad7f657e,
857                fidl::encoding::DynamicFlags::empty(),
858            )
859    }
860}
861
862#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
863pub struct QueryableMarker;
864
865impl fidl::endpoints::ProtocolMarker for QueryableMarker {
866    type Proxy = QueryableProxy;
867    type RequestStream = QueryableRequestStream;
868    #[cfg(target_os = "fuchsia")]
869    type SynchronousProxy = QueryableSynchronousProxy;
870
871    const DEBUG_NAME: &'static str = "(anonymous) Queryable";
872}
873
874pub trait QueryableProxyInterface: Send + Sync {
875    type QueryResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
876    fn r#query(&self) -> Self::QueryResponseFut;
877}
878#[derive(Debug)]
879#[cfg(target_os = "fuchsia")]
880pub struct QueryableSynchronousProxy {
881    client: fidl::client::sync::Client,
882}
883
884#[cfg(target_os = "fuchsia")]
885impl fidl::endpoints::SynchronousProxy for QueryableSynchronousProxy {
886    type Proxy = QueryableProxy;
887    type Protocol = QueryableMarker;
888
889    fn from_channel(inner: fidl::Channel) -> Self {
890        Self::new(inner)
891    }
892
893    fn into_channel(self) -> fidl::Channel {
894        self.client.into_channel()
895    }
896
897    fn as_channel(&self) -> &fidl::Channel {
898        self.client.as_channel()
899    }
900}
901
902#[cfg(target_os = "fuchsia")]
903impl QueryableSynchronousProxy {
904    pub fn new(channel: fidl::Channel) -> Self {
905        let protocol_name = <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
906        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
907    }
908
909    pub fn into_channel(self) -> fidl::Channel {
910        self.client.into_channel()
911    }
912
913    /// Waits until an event arrives and returns it. It is safe for other
914    /// threads to make concurrent requests while waiting for an event.
915    pub fn wait_for_event(
916        &self,
917        deadline: zx::MonotonicInstant,
918    ) -> Result<QueryableEvent, fidl::Error> {
919        QueryableEvent::decode(self.client.wait_for_event(deadline)?)
920    }
921
922    pub fn r#query(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<u8>, fidl::Error> {
923        let _response =
924            self.client.send_query::<fidl::encoding::EmptyPayload, QueryableQueryResponse>(
925                (),
926                0x2658edee9decfc06,
927                fidl::encoding::DynamicFlags::empty(),
928                ___deadline,
929            )?;
930        Ok(_response.protocol)
931    }
932}
933
934#[cfg(target_os = "fuchsia")]
935impl From<QueryableSynchronousProxy> for zx::NullableHandle {
936    fn from(value: QueryableSynchronousProxy) -> Self {
937        value.into_channel().into()
938    }
939}
940
941#[cfg(target_os = "fuchsia")]
942impl From<fidl::Channel> for QueryableSynchronousProxy {
943    fn from(value: fidl::Channel) -> Self {
944        Self::new(value)
945    }
946}
947
948#[cfg(target_os = "fuchsia")]
949impl fidl::endpoints::FromClient for QueryableSynchronousProxy {
950    type Protocol = QueryableMarker;
951
952    fn from_client(value: fidl::endpoints::ClientEnd<QueryableMarker>) -> Self {
953        Self::new(value.into_channel())
954    }
955}
956
957#[derive(Debug, Clone)]
958pub struct QueryableProxy {
959    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
960}
961
962impl fidl::endpoints::Proxy for QueryableProxy {
963    type Protocol = QueryableMarker;
964
965    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
966        Self::new(inner)
967    }
968
969    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
970        self.client.into_channel().map_err(|client| Self { client })
971    }
972
973    fn as_channel(&self) -> &::fidl::AsyncChannel {
974        self.client.as_channel()
975    }
976}
977
978impl QueryableProxy {
979    /// Create a new Proxy for fuchsia.unknown/Queryable.
980    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
981        let protocol_name = <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
982        Self { client: fidl::client::Client::new(channel, protocol_name) }
983    }
984
985    /// Get a Stream of events from the remote end of the protocol.
986    ///
987    /// # Panics
988    ///
989    /// Panics if the event stream was already taken.
990    pub fn take_event_stream(&self) -> QueryableEventStream {
991        QueryableEventStream { event_receiver: self.client.take_event_receiver() }
992    }
993
994    pub fn r#query(
995        &self,
996    ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
997    {
998        QueryableProxyInterface::r#query(self)
999    }
1000}
1001
1002impl QueryableProxyInterface for QueryableProxy {
1003    type QueryResponseFut =
1004        fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1005    fn r#query(&self) -> Self::QueryResponseFut {
1006        fn _decode(
1007            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1008        ) -> Result<Vec<u8>, fidl::Error> {
1009            let _response = fidl::client::decode_transaction_body::<
1010                QueryableQueryResponse,
1011                fidl::encoding::DefaultFuchsiaResourceDialect,
1012                0x2658edee9decfc06,
1013            >(_buf?)?;
1014            Ok(_response.protocol)
1015        }
1016        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
1017            (),
1018            0x2658edee9decfc06,
1019            fidl::encoding::DynamicFlags::empty(),
1020            _decode,
1021        )
1022    }
1023}
1024
1025pub struct QueryableEventStream {
1026    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1027}
1028
1029impl std::marker::Unpin for QueryableEventStream {}
1030
1031impl futures::stream::FusedStream for QueryableEventStream {
1032    fn is_terminated(&self) -> bool {
1033        self.event_receiver.is_terminated()
1034    }
1035}
1036
1037impl futures::Stream for QueryableEventStream {
1038    type Item = Result<QueryableEvent, fidl::Error>;
1039
1040    fn poll_next(
1041        mut self: std::pin::Pin<&mut Self>,
1042        cx: &mut std::task::Context<'_>,
1043    ) -> std::task::Poll<Option<Self::Item>> {
1044        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1045            &mut self.event_receiver,
1046            cx
1047        )?) {
1048            Some(buf) => std::task::Poll::Ready(Some(QueryableEvent::decode(buf))),
1049            None => std::task::Poll::Ready(None),
1050        }
1051    }
1052}
1053
1054#[derive(Debug)]
1055pub enum QueryableEvent {}
1056
1057impl QueryableEvent {
1058    /// Decodes a message buffer as a [`QueryableEvent`].
1059    fn decode(
1060        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1061    ) -> Result<QueryableEvent, fidl::Error> {
1062        let (bytes, _handles) = buf.split_mut();
1063        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1064        debug_assert_eq!(tx_header.tx_id, 0);
1065        match tx_header.ordinal {
1066            _ => Err(fidl::Error::UnknownOrdinal {
1067                ordinal: tx_header.ordinal,
1068                protocol_name: <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1069            }),
1070        }
1071    }
1072}
1073
1074/// A Stream of incoming requests for fuchsia.unknown/Queryable.
1075pub struct QueryableRequestStream {
1076    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1077    is_terminated: bool,
1078}
1079
1080impl std::marker::Unpin for QueryableRequestStream {}
1081
1082impl futures::stream::FusedStream for QueryableRequestStream {
1083    fn is_terminated(&self) -> bool {
1084        self.is_terminated
1085    }
1086}
1087
1088impl fidl::endpoints::RequestStream for QueryableRequestStream {
1089    type Protocol = QueryableMarker;
1090    type ControlHandle = QueryableControlHandle;
1091
1092    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1093        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1094    }
1095
1096    fn control_handle(&self) -> Self::ControlHandle {
1097        QueryableControlHandle { inner: self.inner.clone() }
1098    }
1099
1100    fn into_inner(
1101        self,
1102    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1103    {
1104        (self.inner, self.is_terminated)
1105    }
1106
1107    fn from_inner(
1108        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1109        is_terminated: bool,
1110    ) -> Self {
1111        Self { inner, is_terminated }
1112    }
1113}
1114
1115impl futures::Stream for QueryableRequestStream {
1116    type Item = Result<QueryableRequest, fidl::Error>;
1117
1118    fn poll_next(
1119        mut self: std::pin::Pin<&mut Self>,
1120        cx: &mut std::task::Context<'_>,
1121    ) -> std::task::Poll<Option<Self::Item>> {
1122        let this = &mut *self;
1123        if this.inner.check_shutdown(cx) {
1124            this.is_terminated = true;
1125            return std::task::Poll::Ready(None);
1126        }
1127        if this.is_terminated {
1128            panic!("polled QueryableRequestStream after completion");
1129        }
1130        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1131            |bytes, handles| {
1132                match this.inner.channel().read_etc(cx, bytes, handles) {
1133                    std::task::Poll::Ready(Ok(())) => {}
1134                    std::task::Poll::Pending => return std::task::Poll::Pending,
1135                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1136                        this.is_terminated = true;
1137                        return std::task::Poll::Ready(None);
1138                    }
1139                    std::task::Poll::Ready(Err(e)) => {
1140                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1141                            e.into(),
1142                        ))));
1143                    }
1144                }
1145
1146                // A message has been received from the channel
1147                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1148
1149                std::task::Poll::Ready(Some(match header.ordinal {
1150                    0x2658edee9decfc06 => {
1151                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1152                        let mut req = fidl::new_empty!(
1153                            fidl::encoding::EmptyPayload,
1154                            fidl::encoding::DefaultFuchsiaResourceDialect
1155                        );
1156                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1157                        let control_handle = QueryableControlHandle { inner: this.inner.clone() };
1158                        Ok(QueryableRequest::Query {
1159                            responder: QueryableQueryResponder {
1160                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1161                                tx_id: header.tx_id,
1162                            },
1163                        })
1164                    }
1165                    _ => Err(fidl::Error::UnknownOrdinal {
1166                        ordinal: header.ordinal,
1167                        protocol_name:
1168                            <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1169                    }),
1170                }))
1171            },
1172        )
1173    }
1174}
1175
1176/// Provides a means of identifying a type-erased protocol.
1177#[derive(Debug)]
1178pub enum QueryableRequest {
1179    Query { responder: QueryableQueryResponder },
1180}
1181
1182impl QueryableRequest {
1183    #[allow(irrefutable_let_patterns)]
1184    pub fn into_query(self) -> Option<(QueryableQueryResponder)> {
1185        if let QueryableRequest::Query { responder } = self { Some((responder)) } else { None }
1186    }
1187
1188    /// Name of the method defined in FIDL
1189    pub fn method_name(&self) -> &'static str {
1190        match *self {
1191            QueryableRequest::Query { .. } => "query",
1192        }
1193    }
1194}
1195
1196#[derive(Debug, Clone)]
1197pub struct QueryableControlHandle {
1198    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1199}
1200
1201impl fidl::endpoints::ControlHandle for QueryableControlHandle {
1202    fn shutdown(&self) {
1203        self.inner.shutdown()
1204    }
1205
1206    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1207        self.inner.shutdown_with_epitaph(status)
1208    }
1209
1210    fn is_closed(&self) -> bool {
1211        self.inner.channel().is_closed()
1212    }
1213    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1214        self.inner.channel().on_closed()
1215    }
1216
1217    #[cfg(target_os = "fuchsia")]
1218    fn signal_peer(
1219        &self,
1220        clear_mask: zx::Signals,
1221        set_mask: zx::Signals,
1222    ) -> Result<(), zx_status::Status> {
1223        use fidl::Peered;
1224        self.inner.channel().signal_peer(clear_mask, set_mask)
1225    }
1226}
1227
1228impl QueryableControlHandle {}
1229
1230#[must_use = "FIDL methods require a response to be sent"]
1231#[derive(Debug)]
1232pub struct QueryableQueryResponder {
1233    control_handle: std::mem::ManuallyDrop<QueryableControlHandle>,
1234    tx_id: u32,
1235}
1236
1237/// Set the the channel to be shutdown (see [`QueryableControlHandle::shutdown`])
1238/// if the responder is dropped without sending a response, so that the client
1239/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1240impl std::ops::Drop for QueryableQueryResponder {
1241    fn drop(&mut self) {
1242        self.control_handle.shutdown();
1243        // Safety: drops once, never accessed again
1244        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1245    }
1246}
1247
1248impl fidl::endpoints::Responder for QueryableQueryResponder {
1249    type ControlHandle = QueryableControlHandle;
1250
1251    fn control_handle(&self) -> &QueryableControlHandle {
1252        &self.control_handle
1253    }
1254
1255    fn drop_without_shutdown(mut self) {
1256        // Safety: drops once, never accessed again due to mem::forget
1257        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1258        // Prevent Drop from running (which would shut down the channel)
1259        std::mem::forget(self);
1260    }
1261}
1262
1263impl QueryableQueryResponder {
1264    /// Sends a response to the FIDL transaction.
1265    ///
1266    /// Sets the channel to shutdown if an error occurs.
1267    pub fn send(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1268        let _result = self.send_raw(protocol);
1269        if _result.is_err() {
1270            self.control_handle.shutdown();
1271        }
1272        self.drop_without_shutdown();
1273        _result
1274    }
1275
1276    /// Similar to "send" but does not shutdown the channel if an error occurs.
1277    pub fn send_no_shutdown_on_err(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1278        let _result = self.send_raw(protocol);
1279        self.drop_without_shutdown();
1280        _result
1281    }
1282
1283    fn send_raw(&self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1284        self.control_handle.inner.send::<QueryableQueryResponse>(
1285            (protocol,),
1286            self.tx_id,
1287            0x2658edee9decfc06,
1288            fidl::encoding::DynamicFlags::empty(),
1289        )
1290    }
1291}
1292
1293mod internal {
1294    use super::*;
1295
1296    impl fidl::encoding::ResourceTypeMarker for CloneableCloneRequest {
1297        type Borrowed<'a> = &'a mut Self;
1298        fn take_or_borrow<'a>(
1299            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1300        ) -> Self::Borrowed<'a> {
1301            value
1302        }
1303    }
1304
1305    unsafe impl fidl::encoding::TypeMarker for CloneableCloneRequest {
1306        type Owned = Self;
1307
1308        #[inline(always)]
1309        fn inline_align(_context: fidl::encoding::Context) -> usize {
1310            4
1311        }
1312
1313        #[inline(always)]
1314        fn inline_size(_context: fidl::encoding::Context) -> usize {
1315            4
1316        }
1317    }
1318
1319    unsafe impl
1320        fidl::encoding::Encode<CloneableCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1321        for &mut CloneableCloneRequest
1322    {
1323        #[inline]
1324        unsafe fn encode(
1325            self,
1326            encoder: &mut fidl::encoding::Encoder<
1327                '_,
1328                fidl::encoding::DefaultFuchsiaResourceDialect,
1329            >,
1330            offset: usize,
1331            _depth: fidl::encoding::Depth,
1332        ) -> fidl::Result<()> {
1333            encoder.debug_check_bounds::<CloneableCloneRequest>(offset);
1334            // Delegate to tuple encoding.
1335            fidl::encoding::Encode::<CloneableCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1336                (
1337                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1338                ),
1339                encoder, offset, _depth
1340            )
1341        }
1342    }
1343    unsafe impl<
1344        T0: fidl::encoding::Encode<
1345                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>>,
1346                fidl::encoding::DefaultFuchsiaResourceDialect,
1347            >,
1348    >
1349        fidl::encoding::Encode<CloneableCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1350        for (T0,)
1351    {
1352        #[inline]
1353        unsafe fn encode(
1354            self,
1355            encoder: &mut fidl::encoding::Encoder<
1356                '_,
1357                fidl::encoding::DefaultFuchsiaResourceDialect,
1358            >,
1359            offset: usize,
1360            depth: fidl::encoding::Depth,
1361        ) -> fidl::Result<()> {
1362            encoder.debug_check_bounds::<CloneableCloneRequest>(offset);
1363            // Zero out padding regions. There's no need to apply masks
1364            // because the unmasked parts will be overwritten by fields.
1365            // Write the fields.
1366            self.0.encode(encoder, offset + 0, depth)?;
1367            Ok(())
1368        }
1369    }
1370
1371    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1372        for CloneableCloneRequest
1373    {
1374        #[inline(always)]
1375        fn new_empty() -> Self {
1376            Self {
1377                request: fidl::new_empty!(
1378                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>>,
1379                    fidl::encoding::DefaultFuchsiaResourceDialect
1380                ),
1381            }
1382        }
1383
1384        #[inline]
1385        unsafe fn decode(
1386            &mut self,
1387            decoder: &mut fidl::encoding::Decoder<
1388                '_,
1389                fidl::encoding::DefaultFuchsiaResourceDialect,
1390            >,
1391            offset: usize,
1392            _depth: fidl::encoding::Depth,
1393        ) -> fidl::Result<()> {
1394            decoder.debug_check_bounds::<Self>(offset);
1395            // Verify that padding bytes are zero.
1396            fidl::decode!(
1397                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>>,
1398                fidl::encoding::DefaultFuchsiaResourceDialect,
1399                &mut self.request,
1400                decoder,
1401                offset + 0,
1402                _depth
1403            )?;
1404            Ok(())
1405        }
1406    }
1407}