fidl_fuchsia_unknown/
fidl_fuchsia_unknown.rs

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