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