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