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::Handle {
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    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
364        self.inner.shutdown_with_epitaph(status)
365    }
366
367    fn is_closed(&self) -> bool {
368        self.inner.channel().is_closed()
369    }
370    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
371        self.inner.channel().on_closed()
372    }
373
374    #[cfg(target_os = "fuchsia")]
375    fn signal_peer(
376        &self,
377        clear_mask: zx::Signals,
378        set_mask: zx::Signals,
379    ) -> Result<(), zx_status::Status> {
380        use fidl::Peered;
381        self.inner.channel().signal_peer(clear_mask, set_mask)
382    }
383}
384
385impl CloneableControlHandle {}
386
387#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
388pub struct CloseableMarker;
389
390impl fidl::endpoints::ProtocolMarker for CloseableMarker {
391    type Proxy = CloseableProxy;
392    type RequestStream = CloseableRequestStream;
393    #[cfg(target_os = "fuchsia")]
394    type SynchronousProxy = CloseableSynchronousProxy;
395
396    const DEBUG_NAME: &'static str = "(anonymous) Closeable";
397}
398pub type CloseableCloseResult = Result<(), i32>;
399
400pub trait CloseableProxyInterface: Send + Sync {
401    type CloseResponseFut: std::future::Future<Output = Result<CloseableCloseResult, fidl::Error>>
402        + Send;
403    fn r#close(&self) -> Self::CloseResponseFut;
404}
405#[derive(Debug)]
406#[cfg(target_os = "fuchsia")]
407pub struct CloseableSynchronousProxy {
408    client: fidl::client::sync::Client,
409}
410
411#[cfg(target_os = "fuchsia")]
412impl fidl::endpoints::SynchronousProxy for CloseableSynchronousProxy {
413    type Proxy = CloseableProxy;
414    type Protocol = CloseableMarker;
415
416    fn from_channel(inner: fidl::Channel) -> Self {
417        Self::new(inner)
418    }
419
420    fn into_channel(self) -> fidl::Channel {
421        self.client.into_channel()
422    }
423
424    fn as_channel(&self) -> &fidl::Channel {
425        self.client.as_channel()
426    }
427}
428
429#[cfg(target_os = "fuchsia")]
430impl CloseableSynchronousProxy {
431    pub fn new(channel: fidl::Channel) -> Self {
432        let protocol_name = <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
433        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
434    }
435
436    pub fn into_channel(self) -> fidl::Channel {
437        self.client.into_channel()
438    }
439
440    /// Waits until an event arrives and returns it. It is safe for other
441    /// threads to make concurrent requests while waiting for an event.
442    pub fn wait_for_event(
443        &self,
444        deadline: zx::MonotonicInstant,
445    ) -> Result<CloseableEvent, fidl::Error> {
446        CloseableEvent::decode(self.client.wait_for_event(deadline)?)
447    }
448
449    /// Terminates the connection.
450    ///
451    /// After calling `Close`, the client must not send any other requests.
452    ///
453    /// Servers, after sending the status response, should close the connection
454    /// regardless of status and without sending an epitaph.
455    ///
456    /// Closing the client end of the channel should be semantically equivalent
457    /// to calling `Close` without knowing when the close has completed or its
458    /// status.
459    pub fn r#close(
460        &self,
461        ___deadline: zx::MonotonicInstant,
462    ) -> Result<CloseableCloseResult, fidl::Error> {
463        let _response = self.client.send_query::<
464            fidl::encoding::EmptyPayload,
465            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
466        >(
467            (),
468            0x5ac5d459ad7f657e,
469            fidl::encoding::DynamicFlags::empty(),
470            ___deadline,
471        )?;
472        Ok(_response.map(|x| x))
473    }
474}
475
476#[cfg(target_os = "fuchsia")]
477impl From<CloseableSynchronousProxy> for zx::Handle {
478    fn from(value: CloseableSynchronousProxy) -> Self {
479        value.into_channel().into()
480    }
481}
482
483#[cfg(target_os = "fuchsia")]
484impl From<fidl::Channel> for CloseableSynchronousProxy {
485    fn from(value: fidl::Channel) -> Self {
486        Self::new(value)
487    }
488}
489
490#[cfg(target_os = "fuchsia")]
491impl fidl::endpoints::FromClient for CloseableSynchronousProxy {
492    type Protocol = CloseableMarker;
493
494    fn from_client(value: fidl::endpoints::ClientEnd<CloseableMarker>) -> Self {
495        Self::new(value.into_channel())
496    }
497}
498
499#[derive(Debug, Clone)]
500pub struct CloseableProxy {
501    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
502}
503
504impl fidl::endpoints::Proxy for CloseableProxy {
505    type Protocol = CloseableMarker;
506
507    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
508        Self::new(inner)
509    }
510
511    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
512        self.client.into_channel().map_err(|client| Self { client })
513    }
514
515    fn as_channel(&self) -> &::fidl::AsyncChannel {
516        self.client.as_channel()
517    }
518}
519
520impl CloseableProxy {
521    /// Create a new Proxy for fuchsia.unknown/Closeable.
522    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
523        let protocol_name = <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
524        Self { client: fidl::client::Client::new(channel, protocol_name) }
525    }
526
527    /// Get a Stream of events from the remote end of the protocol.
528    ///
529    /// # Panics
530    ///
531    /// Panics if the event stream was already taken.
532    pub fn take_event_stream(&self) -> CloseableEventStream {
533        CloseableEventStream { event_receiver: self.client.take_event_receiver() }
534    }
535
536    /// Terminates the connection.
537    ///
538    /// After calling `Close`, the client must not send any other requests.
539    ///
540    /// Servers, after sending the status response, should close the connection
541    /// regardless of status and without sending an epitaph.
542    ///
543    /// Closing the client end of the channel should be semantically equivalent
544    /// to calling `Close` without knowing when the close has completed or its
545    /// status.
546    pub fn r#close(
547        &self,
548    ) -> fidl::client::QueryResponseFut<
549        CloseableCloseResult,
550        fidl::encoding::DefaultFuchsiaResourceDialect,
551    > {
552        CloseableProxyInterface::r#close(self)
553    }
554}
555
556impl CloseableProxyInterface for CloseableProxy {
557    type CloseResponseFut = fidl::client::QueryResponseFut<
558        CloseableCloseResult,
559        fidl::encoding::DefaultFuchsiaResourceDialect,
560    >;
561    fn r#close(&self) -> Self::CloseResponseFut {
562        fn _decode(
563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
564        ) -> Result<CloseableCloseResult, fidl::Error> {
565            let _response = fidl::client::decode_transaction_body::<
566                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
567                fidl::encoding::DefaultFuchsiaResourceDialect,
568                0x5ac5d459ad7f657e,
569            >(_buf?)?;
570            Ok(_response.map(|x| x))
571        }
572        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CloseableCloseResult>(
573            (),
574            0x5ac5d459ad7f657e,
575            fidl::encoding::DynamicFlags::empty(),
576            _decode,
577        )
578    }
579}
580
581pub struct CloseableEventStream {
582    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
583}
584
585impl std::marker::Unpin for CloseableEventStream {}
586
587impl futures::stream::FusedStream for CloseableEventStream {
588    fn is_terminated(&self) -> bool {
589        self.event_receiver.is_terminated()
590    }
591}
592
593impl futures::Stream for CloseableEventStream {
594    type Item = Result<CloseableEvent, fidl::Error>;
595
596    fn poll_next(
597        mut self: std::pin::Pin<&mut Self>,
598        cx: &mut std::task::Context<'_>,
599    ) -> std::task::Poll<Option<Self::Item>> {
600        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
601            &mut self.event_receiver,
602            cx
603        )?) {
604            Some(buf) => std::task::Poll::Ready(Some(CloseableEvent::decode(buf))),
605            None => std::task::Poll::Ready(None),
606        }
607    }
608}
609
610#[derive(Debug)]
611pub enum CloseableEvent {}
612
613impl CloseableEvent {
614    /// Decodes a message buffer as a [`CloseableEvent`].
615    fn decode(
616        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
617    ) -> Result<CloseableEvent, fidl::Error> {
618        let (bytes, _handles) = buf.split_mut();
619        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
620        debug_assert_eq!(tx_header.tx_id, 0);
621        match tx_header.ordinal {
622            _ => Err(fidl::Error::UnknownOrdinal {
623                ordinal: tx_header.ordinal,
624                protocol_name: <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
625            }),
626        }
627    }
628}
629
630/// A Stream of incoming requests for fuchsia.unknown/Closeable.
631pub struct CloseableRequestStream {
632    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
633    is_terminated: bool,
634}
635
636impl std::marker::Unpin for CloseableRequestStream {}
637
638impl futures::stream::FusedStream for CloseableRequestStream {
639    fn is_terminated(&self) -> bool {
640        self.is_terminated
641    }
642}
643
644impl fidl::endpoints::RequestStream for CloseableRequestStream {
645    type Protocol = CloseableMarker;
646    type ControlHandle = CloseableControlHandle;
647
648    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
649        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
650    }
651
652    fn control_handle(&self) -> Self::ControlHandle {
653        CloseableControlHandle { inner: self.inner.clone() }
654    }
655
656    fn into_inner(
657        self,
658    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
659    {
660        (self.inner, self.is_terminated)
661    }
662
663    fn from_inner(
664        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
665        is_terminated: bool,
666    ) -> Self {
667        Self { inner, is_terminated }
668    }
669}
670
671impl futures::Stream for CloseableRequestStream {
672    type Item = Result<CloseableRequest, fidl::Error>;
673
674    fn poll_next(
675        mut self: std::pin::Pin<&mut Self>,
676        cx: &mut std::task::Context<'_>,
677    ) -> std::task::Poll<Option<Self::Item>> {
678        let this = &mut *self;
679        if this.inner.check_shutdown(cx) {
680            this.is_terminated = true;
681            return std::task::Poll::Ready(None);
682        }
683        if this.is_terminated {
684            panic!("polled CloseableRequestStream after completion");
685        }
686        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
687            |bytes, handles| {
688                match this.inner.channel().read_etc(cx, bytes, handles) {
689                    std::task::Poll::Ready(Ok(())) => {}
690                    std::task::Poll::Pending => return std::task::Poll::Pending,
691                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
692                        this.is_terminated = true;
693                        return std::task::Poll::Ready(None);
694                    }
695                    std::task::Poll::Ready(Err(e)) => {
696                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
697                            e.into(),
698                        ))))
699                    }
700                }
701
702                // A message has been received from the channel
703                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
704
705                std::task::Poll::Ready(Some(match header.ordinal {
706                    0x5ac5d459ad7f657e => {
707                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
708                        let mut req = fidl::new_empty!(
709                            fidl::encoding::EmptyPayload,
710                            fidl::encoding::DefaultFuchsiaResourceDialect
711                        );
712                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
713                        let control_handle = CloseableControlHandle { inner: this.inner.clone() };
714                        Ok(CloseableRequest::Close {
715                            responder: CloseableCloseResponder {
716                                control_handle: std::mem::ManuallyDrop::new(control_handle),
717                                tx_id: header.tx_id,
718                            },
719                        })
720                    }
721                    _ => Err(fidl::Error::UnknownOrdinal {
722                        ordinal: header.ordinal,
723                        protocol_name:
724                            <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
725                    }),
726                }))
727            },
728        )
729    }
730}
731
732/// Provides a means of synchronously closing a connection.
733#[derive(Debug)]
734pub enum CloseableRequest {
735    /// Terminates the connection.
736    ///
737    /// After calling `Close`, the client must not send any other requests.
738    ///
739    /// Servers, after sending the status response, should close the connection
740    /// regardless of status and without sending an epitaph.
741    ///
742    /// Closing the client end of the channel should be semantically equivalent
743    /// to calling `Close` without knowing when the close has completed or its
744    /// status.
745    Close { responder: CloseableCloseResponder },
746}
747
748impl CloseableRequest {
749    #[allow(irrefutable_let_patterns)]
750    pub fn into_close(self) -> Option<(CloseableCloseResponder)> {
751        if let CloseableRequest::Close { responder } = self {
752            Some((responder))
753        } else {
754            None
755        }
756    }
757
758    /// Name of the method defined in FIDL
759    pub fn method_name(&self) -> &'static str {
760        match *self {
761            CloseableRequest::Close { .. } => "close",
762        }
763    }
764}
765
766#[derive(Debug, Clone)]
767pub struct CloseableControlHandle {
768    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
769}
770
771impl fidl::endpoints::ControlHandle for CloseableControlHandle {
772    fn shutdown(&self) {
773        self.inner.shutdown()
774    }
775    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
776        self.inner.shutdown_with_epitaph(status)
777    }
778
779    fn is_closed(&self) -> bool {
780        self.inner.channel().is_closed()
781    }
782    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
783        self.inner.channel().on_closed()
784    }
785
786    #[cfg(target_os = "fuchsia")]
787    fn signal_peer(
788        &self,
789        clear_mask: zx::Signals,
790        set_mask: zx::Signals,
791    ) -> Result<(), zx_status::Status> {
792        use fidl::Peered;
793        self.inner.channel().signal_peer(clear_mask, set_mask)
794    }
795}
796
797impl CloseableControlHandle {}
798
799#[must_use = "FIDL methods require a response to be sent"]
800#[derive(Debug)]
801pub struct CloseableCloseResponder {
802    control_handle: std::mem::ManuallyDrop<CloseableControlHandle>,
803    tx_id: u32,
804}
805
806/// Set the the channel to be shutdown (see [`CloseableControlHandle::shutdown`])
807/// if the responder is dropped without sending a response, so that the client
808/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
809impl std::ops::Drop for CloseableCloseResponder {
810    fn drop(&mut self) {
811        self.control_handle.shutdown();
812        // Safety: drops once, never accessed again
813        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
814    }
815}
816
817impl fidl::endpoints::Responder for CloseableCloseResponder {
818    type ControlHandle = CloseableControlHandle;
819
820    fn control_handle(&self) -> &CloseableControlHandle {
821        &self.control_handle
822    }
823
824    fn drop_without_shutdown(mut self) {
825        // Safety: drops once, never accessed again due to mem::forget
826        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
827        // Prevent Drop from running (which would shut down the channel)
828        std::mem::forget(self);
829    }
830}
831
832impl CloseableCloseResponder {
833    /// Sends a response to the FIDL transaction.
834    ///
835    /// Sets the channel to shutdown if an error occurs.
836    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
837        let _result = self.send_raw(result);
838        if _result.is_err() {
839            self.control_handle.shutdown();
840        }
841        self.drop_without_shutdown();
842        _result
843    }
844
845    /// Similar to "send" but does not shutdown the channel if an error occurs.
846    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
847        let _result = self.send_raw(result);
848        self.drop_without_shutdown();
849        _result
850    }
851
852    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
853        self.control_handle
854            .inner
855            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
856                result,
857                self.tx_id,
858                0x5ac5d459ad7f657e,
859                fidl::encoding::DynamicFlags::empty(),
860            )
861    }
862}
863
864#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
865pub struct QueryableMarker;
866
867impl fidl::endpoints::ProtocolMarker for QueryableMarker {
868    type Proxy = QueryableProxy;
869    type RequestStream = QueryableRequestStream;
870    #[cfg(target_os = "fuchsia")]
871    type SynchronousProxy = QueryableSynchronousProxy;
872
873    const DEBUG_NAME: &'static str = "(anonymous) Queryable";
874}
875
876pub trait QueryableProxyInterface: Send + Sync {
877    type QueryResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
878    fn r#query(&self) -> Self::QueryResponseFut;
879}
880#[derive(Debug)]
881#[cfg(target_os = "fuchsia")]
882pub struct QueryableSynchronousProxy {
883    client: fidl::client::sync::Client,
884}
885
886#[cfg(target_os = "fuchsia")]
887impl fidl::endpoints::SynchronousProxy for QueryableSynchronousProxy {
888    type Proxy = QueryableProxy;
889    type Protocol = QueryableMarker;
890
891    fn from_channel(inner: fidl::Channel) -> Self {
892        Self::new(inner)
893    }
894
895    fn into_channel(self) -> fidl::Channel {
896        self.client.into_channel()
897    }
898
899    fn as_channel(&self) -> &fidl::Channel {
900        self.client.as_channel()
901    }
902}
903
904#[cfg(target_os = "fuchsia")]
905impl QueryableSynchronousProxy {
906    pub fn new(channel: fidl::Channel) -> Self {
907        let protocol_name = <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
908        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
909    }
910
911    pub fn into_channel(self) -> fidl::Channel {
912        self.client.into_channel()
913    }
914
915    /// Waits until an event arrives and returns it. It is safe for other
916    /// threads to make concurrent requests while waiting for an event.
917    pub fn wait_for_event(
918        &self,
919        deadline: zx::MonotonicInstant,
920    ) -> Result<QueryableEvent, fidl::Error> {
921        QueryableEvent::decode(self.client.wait_for_event(deadline)?)
922    }
923
924    pub fn r#query(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<u8>, fidl::Error> {
925        let _response =
926            self.client.send_query::<fidl::encoding::EmptyPayload, QueryableQueryResponse>(
927                (),
928                0x2658edee9decfc06,
929                fidl::encoding::DynamicFlags::empty(),
930                ___deadline,
931            )?;
932        Ok(_response.protocol)
933    }
934}
935
936#[cfg(target_os = "fuchsia")]
937impl From<QueryableSynchronousProxy> for zx::Handle {
938    fn from(value: QueryableSynchronousProxy) -> Self {
939        value.into_channel().into()
940    }
941}
942
943#[cfg(target_os = "fuchsia")]
944impl From<fidl::Channel> for QueryableSynchronousProxy {
945    fn from(value: fidl::Channel) -> Self {
946        Self::new(value)
947    }
948}
949
950#[cfg(target_os = "fuchsia")]
951impl fidl::endpoints::FromClient for QueryableSynchronousProxy {
952    type Protocol = QueryableMarker;
953
954    fn from_client(value: fidl::endpoints::ClientEnd<QueryableMarker>) -> Self {
955        Self::new(value.into_channel())
956    }
957}
958
959#[derive(Debug, Clone)]
960pub struct QueryableProxy {
961    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
962}
963
964impl fidl::endpoints::Proxy for QueryableProxy {
965    type Protocol = QueryableMarker;
966
967    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
968        Self::new(inner)
969    }
970
971    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
972        self.client.into_channel().map_err(|client| Self { client })
973    }
974
975    fn as_channel(&self) -> &::fidl::AsyncChannel {
976        self.client.as_channel()
977    }
978}
979
980impl QueryableProxy {
981    /// Create a new Proxy for fuchsia.unknown/Queryable.
982    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
983        let protocol_name = <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
984        Self { client: fidl::client::Client::new(channel, protocol_name) }
985    }
986
987    /// Get a Stream of events from the remote end of the protocol.
988    ///
989    /// # Panics
990    ///
991    /// Panics if the event stream was already taken.
992    pub fn take_event_stream(&self) -> QueryableEventStream {
993        QueryableEventStream { event_receiver: self.client.take_event_receiver() }
994    }
995
996    pub fn r#query(
997        &self,
998    ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
999    {
1000        QueryableProxyInterface::r#query(self)
1001    }
1002}
1003
1004impl QueryableProxyInterface for QueryableProxy {
1005    type QueryResponseFut =
1006        fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1007    fn r#query(&self) -> Self::QueryResponseFut {
1008        fn _decode(
1009            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1010        ) -> Result<Vec<u8>, fidl::Error> {
1011            let _response = fidl::client::decode_transaction_body::<
1012                QueryableQueryResponse,
1013                fidl::encoding::DefaultFuchsiaResourceDialect,
1014                0x2658edee9decfc06,
1015            >(_buf?)?;
1016            Ok(_response.protocol)
1017        }
1018        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
1019            (),
1020            0x2658edee9decfc06,
1021            fidl::encoding::DynamicFlags::empty(),
1022            _decode,
1023        )
1024    }
1025}
1026
1027pub struct QueryableEventStream {
1028    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1029}
1030
1031impl std::marker::Unpin for QueryableEventStream {}
1032
1033impl futures::stream::FusedStream for QueryableEventStream {
1034    fn is_terminated(&self) -> bool {
1035        self.event_receiver.is_terminated()
1036    }
1037}
1038
1039impl futures::Stream for QueryableEventStream {
1040    type Item = Result<QueryableEvent, fidl::Error>;
1041
1042    fn poll_next(
1043        mut self: std::pin::Pin<&mut Self>,
1044        cx: &mut std::task::Context<'_>,
1045    ) -> std::task::Poll<Option<Self::Item>> {
1046        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1047            &mut self.event_receiver,
1048            cx
1049        )?) {
1050            Some(buf) => std::task::Poll::Ready(Some(QueryableEvent::decode(buf))),
1051            None => std::task::Poll::Ready(None),
1052        }
1053    }
1054}
1055
1056#[derive(Debug)]
1057pub enum QueryableEvent {}
1058
1059impl QueryableEvent {
1060    /// Decodes a message buffer as a [`QueryableEvent`].
1061    fn decode(
1062        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1063    ) -> Result<QueryableEvent, fidl::Error> {
1064        let (bytes, _handles) = buf.split_mut();
1065        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1066        debug_assert_eq!(tx_header.tx_id, 0);
1067        match tx_header.ordinal {
1068            _ => Err(fidl::Error::UnknownOrdinal {
1069                ordinal: tx_header.ordinal,
1070                protocol_name: <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1071            }),
1072        }
1073    }
1074}
1075
1076/// A Stream of incoming requests for fuchsia.unknown/Queryable.
1077pub struct QueryableRequestStream {
1078    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1079    is_terminated: bool,
1080}
1081
1082impl std::marker::Unpin for QueryableRequestStream {}
1083
1084impl futures::stream::FusedStream for QueryableRequestStream {
1085    fn is_terminated(&self) -> bool {
1086        self.is_terminated
1087    }
1088}
1089
1090impl fidl::endpoints::RequestStream for QueryableRequestStream {
1091    type Protocol = QueryableMarker;
1092    type ControlHandle = QueryableControlHandle;
1093
1094    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1095        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1096    }
1097
1098    fn control_handle(&self) -> Self::ControlHandle {
1099        QueryableControlHandle { inner: self.inner.clone() }
1100    }
1101
1102    fn into_inner(
1103        self,
1104    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1105    {
1106        (self.inner, self.is_terminated)
1107    }
1108
1109    fn from_inner(
1110        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1111        is_terminated: bool,
1112    ) -> Self {
1113        Self { inner, is_terminated }
1114    }
1115}
1116
1117impl futures::Stream for QueryableRequestStream {
1118    type Item = Result<QueryableRequest, fidl::Error>;
1119
1120    fn poll_next(
1121        mut self: std::pin::Pin<&mut Self>,
1122        cx: &mut std::task::Context<'_>,
1123    ) -> std::task::Poll<Option<Self::Item>> {
1124        let this = &mut *self;
1125        if this.inner.check_shutdown(cx) {
1126            this.is_terminated = true;
1127            return std::task::Poll::Ready(None);
1128        }
1129        if this.is_terminated {
1130            panic!("polled QueryableRequestStream after completion");
1131        }
1132        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1133            |bytes, handles| {
1134                match this.inner.channel().read_etc(cx, bytes, handles) {
1135                    std::task::Poll::Ready(Ok(())) => {}
1136                    std::task::Poll::Pending => return std::task::Poll::Pending,
1137                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1138                        this.is_terminated = true;
1139                        return std::task::Poll::Ready(None);
1140                    }
1141                    std::task::Poll::Ready(Err(e)) => {
1142                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1143                            e.into(),
1144                        ))))
1145                    }
1146                }
1147
1148                // A message has been received from the channel
1149                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1150
1151                std::task::Poll::Ready(Some(match header.ordinal {
1152                    0x2658edee9decfc06 => {
1153                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1154                        let mut req = fidl::new_empty!(
1155                            fidl::encoding::EmptyPayload,
1156                            fidl::encoding::DefaultFuchsiaResourceDialect
1157                        );
1158                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1159                        let control_handle = QueryableControlHandle { inner: this.inner.clone() };
1160                        Ok(QueryableRequest::Query {
1161                            responder: QueryableQueryResponder {
1162                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1163                                tx_id: header.tx_id,
1164                            },
1165                        })
1166                    }
1167                    _ => Err(fidl::Error::UnknownOrdinal {
1168                        ordinal: header.ordinal,
1169                        protocol_name:
1170                            <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1171                    }),
1172                }))
1173            },
1174        )
1175    }
1176}
1177
1178/// Provides a means of identifying a type-erased protocol.
1179#[derive(Debug)]
1180pub enum QueryableRequest {
1181    Query { responder: QueryableQueryResponder },
1182}
1183
1184impl QueryableRequest {
1185    #[allow(irrefutable_let_patterns)]
1186    pub fn into_query(self) -> Option<(QueryableQueryResponder)> {
1187        if let QueryableRequest::Query { responder } = self {
1188            Some((responder))
1189        } else {
1190            None
1191        }
1192    }
1193
1194    /// Name of the method defined in FIDL
1195    pub fn method_name(&self) -> &'static str {
1196        match *self {
1197            QueryableRequest::Query { .. } => "query",
1198        }
1199    }
1200}
1201
1202#[derive(Debug, Clone)]
1203pub struct QueryableControlHandle {
1204    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1205}
1206
1207impl fidl::endpoints::ControlHandle for QueryableControlHandle {
1208    fn shutdown(&self) {
1209        self.inner.shutdown()
1210    }
1211    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1212        self.inner.shutdown_with_epitaph(status)
1213    }
1214
1215    fn is_closed(&self) -> bool {
1216        self.inner.channel().is_closed()
1217    }
1218    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1219        self.inner.channel().on_closed()
1220    }
1221
1222    #[cfg(target_os = "fuchsia")]
1223    fn signal_peer(
1224        &self,
1225        clear_mask: zx::Signals,
1226        set_mask: zx::Signals,
1227    ) -> Result<(), zx_status::Status> {
1228        use fidl::Peered;
1229        self.inner.channel().signal_peer(clear_mask, set_mask)
1230    }
1231}
1232
1233impl QueryableControlHandle {}
1234
1235#[must_use = "FIDL methods require a response to be sent"]
1236#[derive(Debug)]
1237pub struct QueryableQueryResponder {
1238    control_handle: std::mem::ManuallyDrop<QueryableControlHandle>,
1239    tx_id: u32,
1240}
1241
1242/// Set the the channel to be shutdown (see [`QueryableControlHandle::shutdown`])
1243/// if the responder is dropped without sending a response, so that the client
1244/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1245impl std::ops::Drop for QueryableQueryResponder {
1246    fn drop(&mut self) {
1247        self.control_handle.shutdown();
1248        // Safety: drops once, never accessed again
1249        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1250    }
1251}
1252
1253impl fidl::endpoints::Responder for QueryableQueryResponder {
1254    type ControlHandle = QueryableControlHandle;
1255
1256    fn control_handle(&self) -> &QueryableControlHandle {
1257        &self.control_handle
1258    }
1259
1260    fn drop_without_shutdown(mut self) {
1261        // Safety: drops once, never accessed again due to mem::forget
1262        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1263        // Prevent Drop from running (which would shut down the channel)
1264        std::mem::forget(self);
1265    }
1266}
1267
1268impl QueryableQueryResponder {
1269    /// Sends a response to the FIDL transaction.
1270    ///
1271    /// Sets the channel to shutdown if an error occurs.
1272    pub fn send(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1273        let _result = self.send_raw(protocol);
1274        if _result.is_err() {
1275            self.control_handle.shutdown();
1276        }
1277        self.drop_without_shutdown();
1278        _result
1279    }
1280
1281    /// Similar to "send" but does not shutdown the channel if an error occurs.
1282    pub fn send_no_shutdown_on_err(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1283        let _result = self.send_raw(protocol);
1284        self.drop_without_shutdown();
1285        _result
1286    }
1287
1288    fn send_raw(&self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
1289        self.control_handle.inner.send::<QueryableQueryResponse>(
1290            (protocol,),
1291            self.tx_id,
1292            0x2658edee9decfc06,
1293            fidl::encoding::DynamicFlags::empty(),
1294        )
1295    }
1296}
1297
1298mod internal {
1299    use super::*;
1300
1301    impl fidl::encoding::ResourceTypeMarker for CloneableCloneRequest {
1302        type Borrowed<'a> = &'a mut Self;
1303        fn take_or_borrow<'a>(
1304            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1305        ) -> Self::Borrowed<'a> {
1306            value
1307        }
1308    }
1309
1310    unsafe impl fidl::encoding::TypeMarker for CloneableCloneRequest {
1311        type Owned = Self;
1312
1313        #[inline(always)]
1314        fn inline_align(_context: fidl::encoding::Context) -> usize {
1315            4
1316        }
1317
1318        #[inline(always)]
1319        fn inline_size(_context: fidl::encoding::Context) -> usize {
1320            4
1321        }
1322    }
1323
1324    unsafe impl
1325        fidl::encoding::Encode<CloneableCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1326        for &mut CloneableCloneRequest
1327    {
1328        #[inline]
1329        unsafe fn encode(
1330            self,
1331            encoder: &mut fidl::encoding::Encoder<
1332                '_,
1333                fidl::encoding::DefaultFuchsiaResourceDialect,
1334            >,
1335            offset: usize,
1336            _depth: fidl::encoding::Depth,
1337        ) -> fidl::Result<()> {
1338            encoder.debug_check_bounds::<CloneableCloneRequest>(offset);
1339            // Delegate to tuple encoding.
1340            fidl::encoding::Encode::<CloneableCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1341                (
1342                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1343                ),
1344                encoder, offset, _depth
1345            )
1346        }
1347    }
1348    unsafe impl<
1349            T0: fidl::encoding::Encode<
1350                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>>,
1351                fidl::encoding::DefaultFuchsiaResourceDialect,
1352            >,
1353        >
1354        fidl::encoding::Encode<CloneableCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
1355        for (T0,)
1356    {
1357        #[inline]
1358        unsafe fn encode(
1359            self,
1360            encoder: &mut fidl::encoding::Encoder<
1361                '_,
1362                fidl::encoding::DefaultFuchsiaResourceDialect,
1363            >,
1364            offset: usize,
1365            depth: fidl::encoding::Depth,
1366        ) -> fidl::Result<()> {
1367            encoder.debug_check_bounds::<CloneableCloneRequest>(offset);
1368            // Zero out padding regions. There's no need to apply masks
1369            // because the unmasked parts will be overwritten by fields.
1370            // Write the fields.
1371            self.0.encode(encoder, offset + 0, depth)?;
1372            Ok(())
1373        }
1374    }
1375
1376    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1377        for CloneableCloneRequest
1378    {
1379        #[inline(always)]
1380        fn new_empty() -> Self {
1381            Self {
1382                request: fidl::new_empty!(
1383                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>>,
1384                    fidl::encoding::DefaultFuchsiaResourceDialect
1385                ),
1386            }
1387        }
1388
1389        #[inline]
1390        unsafe fn decode(
1391            &mut self,
1392            decoder: &mut fidl::encoding::Decoder<
1393                '_,
1394                fidl::encoding::DefaultFuchsiaResourceDialect,
1395            >,
1396            offset: usize,
1397            _depth: fidl::encoding::Depth,
1398        ) -> fidl::Result<()> {
1399            decoder.debug_check_bounds::<Self>(offset);
1400            // Verify that padding bytes are zero.
1401            fidl::decode!(
1402                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>>,
1403                fidl::encoding::DefaultFuchsiaResourceDialect,
1404                &mut self.request,
1405                decoder,
1406                offset + 0,
1407                _depth
1408            )?;
1409            Ok(())
1410        }
1411    }
1412}