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