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