Skip to main content

fidl_fuchsia_starnix_binder/
fidl_fuchsia_starnix_binder.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_starnix_binder__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct BinderIoctlRequest {
16    /// Thread ID for the thread calling the ioctl.
17    pub tid: u64,
18    /// The ioctl being called.
19    pub request: u32,
20    /// Optional argument for the ioctl.
21    pub arg: u64,
22    /// The VMO to return writes for this ioctl through.
23    pub vmo: fidl::Vmo,
24    /// The files being transfered by the ioctl.
25    pub files: Vec<FileHandle>,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BinderIoctlRequest {}
29
30#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct BinderSetVmoRequest {
32    pub vmo: fidl::Vmo,
33    pub mapped_address: u64,
34}
35
36impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BinderSetVmoRequest {}
37
38#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39pub struct ProcessAccessorWriteBytesRequest {
40    pub address: u64,
41    pub bytes: Vec<u8>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45    for ProcessAccessorWriteBytesRequest
46{
47}
48
49#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct ProcessAccessorWriteMemoryRequest {
51    pub address: u64,
52    pub content: fidl::Vmo,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
56    for ProcessAccessorWriteMemoryRequest
57{
58}
59
60#[derive(Debug, Default, PartialEq)]
61pub struct ContainerPowerControllerRegisterWakeWatcherRequest {
62    pub watcher: Option<fidl::EventPair>,
63    #[doc(hidden)]
64    pub __source_breaking: fidl::marker::SourceBreaking,
65}
66
67impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
68    for ContainerPowerControllerRegisterWakeWatcherRequest
69{
70}
71
72#[derive(Debug, Default, PartialEq)]
73pub struct ContainerPowerControllerWakeRequest {
74    /// (Optional): This represents a wake lease that the binder server has.
75    /// The container will ensure that this wake lease will be kept alive until
76    /// The container takes its wake lease.
77    pub power_baton: Option<fidl::NullableHandle>,
78    /// (Optional): This creates a wake lock associated with this event pair.
79    /// The container will not go back to sleep until the other end of this event pair has been
80    /// closed.
81    /// If this does not exist, then the container can sleep when it chooses after handling the
82    /// Wake call.
83    ///
84    /// The container will signal the pair of wake_lock with USER_0 when the lock has been created
85    /// in the kernel.
86    pub wake_lock: Option<fidl::EventPair>,
87    #[doc(hidden)]
88    pub __source_breaking: fidl::marker::SourceBreaking,
89}
90
91impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
92    for ContainerPowerControllerWakeRequest
93{
94}
95
96#[derive(Debug, Default, PartialEq)]
97pub struct DevBinderCloseRequest {
98    /// The Binder protocol opened previously.
99    pub binder: Option<fidl::endpoints::ClientEnd<BinderMarker>>,
100    #[doc(hidden)]
101    pub __source_breaking: fidl::marker::SourceBreaking,
102}
103
104impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DevBinderCloseRequest {}
105
106#[derive(Debug, Default, PartialEq)]
107pub struct DevBinderOpenRequest {
108    /// The path to the binder device in the starnix process.
109    /// Mandatory
110    pub path: Option<Vec<u8>>,
111    /// The service giving the binder driver access to the resources of the client process.
112    pub process_accessor: Option<fidl::endpoints::ClientEnd<ProcessAccessorMarker>>,
113    /// The handle to the process that will use the binder driver. It is
114    /// used by the driver to read the data sent to the driver.
115    /// Mandatory
116    pub process: Option<fidl::Process>,
117    /// The request to the Binder protocol implementation.
118    /// Mandatory
119    pub binder: Option<fidl::endpoints::ServerEnd<BinderMarker>>,
120    #[doc(hidden)]
121    pub __source_breaking: fidl::marker::SourceBreaking,
122}
123
124impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DevBinderOpenRequest {}
125
126/// The representation of an open file that can be transferred between the
127/// binder device driver and the client.
128#[derive(Debug, Default, PartialEq)]
129pub struct FileHandle {
130    /// The handle connecting to the file protocol. If not present, the file
131    /// should behave as it is was a null file: all read must succeed with empty
132    /// content and all write must succeed. See `fdio_fd_create_null()`.
133    pub handle: Option<fidl::NullableHandle>,
134    /// Optional. The flags associated with the opened file.
135    pub flags: Option<FileFlags>,
136    /// Optional. The file descriptor to help with translation between processes.
137    pub fd: Option<i32>,
138    /// Optional. An opaque bag of handles associated with the file.
139    ///
140    /// If this field is set, handle must not be set.
141    ///
142    /// In Fuchsia, there is an expectation that there is a 1:1 mapping between a file descriptor
143    /// and a handle. In general, we do not want to violate that rule. This field is intended to
144    /// used in very limited circumstances (compatibility with Linux and Binder), where we need to
145    /// violate rule.
146    ///
147    /// When this field is used, the composite_fd library will be used to create the file descriptor
148    /// in a Fuchsia component. Such file descriptors do not support regular operations and must be
149    /// handled using the composite_fd library.
150    pub bag: Option<Vec<fidl::NullableHandle>>,
151    #[doc(hidden)]
152    pub __source_breaking: fidl::marker::SourceBreaking,
153}
154
155impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FileHandle {}
156
157#[derive(Debug, Default, PartialEq)]
158pub struct FileRequest {
159    /// The list of file descriptor the client must close.
160    pub close_requests: Option<Vec<i32>>,
161    /// The list of file descriptor the client must duplicate and transfer to
162    /// the binder driver.
163    pub get_requests: Option<Vec<i32>>,
164    /// The list of open file the client must add to its fd table, returning
165    /// the new minted file descriptors.
166    pub add_requests: Option<Vec<FileHandle>>,
167    #[doc(hidden)]
168    pub __source_breaking: fidl::marker::SourceBreaking,
169}
170
171impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FileRequest {}
172
173#[derive(Debug, Default, PartialEq)]
174pub struct FileResponse {
175    /// The list of open file retriever for the `get_requests`.
176    pub get_responses: Option<Vec<FileHandle>>,
177    /// The list of file descriptors minted for the `add_requests`.
178    pub add_responses: Option<Vec<i32>>,
179    #[doc(hidden)]
180    pub __source_breaking: fidl::marker::SourceBreaking,
181}
182
183impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FileResponse {}
184
185#[derive(Debug, Default, PartialEq)]
186pub struct RemoteControllerStartRequest {
187    pub dev_binder: Option<fidl::endpoints::ClientEnd<DevBinderMarker>>,
188    pub lutex_controller: Option<fidl::endpoints::ClientEnd<LutexControllerMarker>>,
189    pub container_power_controller:
190        Option<fidl::endpoints::ClientEnd<ContainerPowerControllerMarker>>,
191    #[doc(hidden)]
192    pub __source_breaking: fidl::marker::SourceBreaking,
193}
194
195impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
196    for RemoteControllerStartRequest
197{
198}
199
200#[derive(Debug, Default, PartialEq)]
201pub struct UnixDomainSocketWriteRequest {
202    pub data: Option<Vec<u8>>,
203    pub handles: Option<Vec<fidl::NullableHandle>>,
204    #[doc(hidden)]
205    pub __source_breaking: fidl::marker::SourceBreaking,
206}
207
208impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
209    for UnixDomainSocketWriteRequest
210{
211}
212
213#[derive(Debug, Default, PartialEq)]
214pub struct UnixDomainSocketGetEventResponse {
215    pub event: Option<fidl::EventPair>,
216    #[doc(hidden)]
217    pub __source_breaking: fidl::marker::SourceBreaking,
218}
219
220impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
221    for UnixDomainSocketGetEventResponse
222{
223}
224
225#[derive(Debug, Default, PartialEq)]
226pub struct UnixDomainSocketReadResponse {
227    pub data: Option<Vec<u8>>,
228    pub data_original_length: Option<u64>,
229    pub handles: Option<Vec<fidl::NullableHandle>>,
230    #[doc(hidden)]
231    pub __source_breaking: fidl::marker::SourceBreaking,
232}
233
234impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
235    for UnixDomainSocketReadResponse
236{
237}
238
239#[derive(Debug, Default, PartialEq)]
240pub struct WaitBitsetRequest {
241    /// The vmo containing the shared address of the futex.
242    /// Mandatory
243    pub vmo: Option<fidl::Vmo>,
244    /// The offset in the vmo where the shared address of the futex is.
245    /// Mandatory
246    pub offset: Option<u64>,
247    /// The expected value of the futex.
248    /// Mandatory
249    pub value: Option<u32>,
250    /// The bit mask.
251    /// Optional. If not present, as mask with all bits present will be used.
252    pub mask: Option<u32>,
253    /// The deadline for the wait operation.
254    /// Optional. If not present, the operation can block indefinitely.
255    pub deadline: Option<i64>,
256    #[doc(hidden)]
257    pub __source_breaking: fidl::marker::SourceBreaking,
258}
259
260impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WaitBitsetRequest {}
261
262#[derive(Debug, Default, PartialEq)]
263pub struct WakeBitsetRequest {
264    /// The vmo containing the shared address of the futex.
265    /// Mandatory
266    pub vmo: Option<fidl::Vmo>,
267    /// The offset in the vmo where the shared address of the futex is.
268    /// Mandatory
269    pub offset: Option<u64>,
270    /// Maximum number of waiter to wake.
271    /// Mandatory
272    pub count: Option<u32>,
273    /// The bit mask.
274    /// Optional. If not present, as mask with all bits present will be used.
275    pub mask: Option<u32>,
276    #[doc(hidden)]
277    pub __source_breaking: fidl::marker::SourceBreaking,
278}
279
280impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WakeBitsetRequest {}
281
282#[derive(Debug, Default, PartialEq)]
283pub struct WakeResponse {
284    /// The number of waiters that were woken up.
285    pub count: Option<u64>,
286    #[doc(hidden)]
287    pub __source_breaking: fidl::marker::SourceBreaking,
288}
289
290impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WakeResponse {}
291
292#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
293pub struct BinderMarker;
294
295impl fidl::endpoints::ProtocolMarker for BinderMarker {
296    type Proxy = BinderProxy;
297    type RequestStream = BinderRequestStream;
298    #[cfg(target_os = "fuchsia")]
299    type SynchronousProxy = BinderSynchronousProxy;
300
301    const DEBUG_NAME: &'static str = "(anonymous) Binder";
302}
303pub type BinderIoctlResult = Result<Vec<IoctlWrite>, fidl_fuchsia_posix::Errno>;
304
305pub trait BinderProxyInterface: Send + Sync {
306    fn r#set_vmo(&self, vmo: fidl::Vmo, mapped_address: u64) -> Result<(), fidl::Error>;
307    type IoctlResponseFut: std::future::Future<Output = Result<BinderIoctlResult, fidl::Error>>
308        + Send;
309    fn r#ioctl(
310        &self,
311        tid: u64,
312        request: u32,
313        arg: u64,
314        vmo: fidl::Vmo,
315        files: Vec<FileHandle>,
316    ) -> Self::IoctlResponseFut;
317}
318#[derive(Debug)]
319#[cfg(target_os = "fuchsia")]
320pub struct BinderSynchronousProxy {
321    client: fidl::client::sync::Client,
322}
323
324#[cfg(target_os = "fuchsia")]
325impl fidl::endpoints::SynchronousProxy for BinderSynchronousProxy {
326    type Proxy = BinderProxy;
327    type Protocol = BinderMarker;
328
329    fn from_channel(inner: fidl::Channel) -> Self {
330        Self::new(inner)
331    }
332
333    fn into_channel(self) -> fidl::Channel {
334        self.client.into_channel()
335    }
336
337    fn as_channel(&self) -> &fidl::Channel {
338        self.client.as_channel()
339    }
340}
341
342#[cfg(target_os = "fuchsia")]
343impl BinderSynchronousProxy {
344    pub fn new(channel: fidl::Channel) -> Self {
345        Self { client: fidl::client::sync::Client::new(channel) }
346    }
347
348    pub fn into_channel(self) -> fidl::Channel {
349        self.client.into_channel()
350    }
351
352    /// Waits until an event arrives and returns it. It is safe for other
353    /// threads to make concurrent requests while waiting for an event.
354    pub fn wait_for_event(
355        &self,
356        deadline: zx::MonotonicInstant,
357    ) -> Result<BinderEvent, fidl::Error> {
358        BinderEvent::decode(self.client.wait_for_event::<BinderMarker>(deadline)?)
359    }
360
361    /// Set the VMO to used as a share resource between the driver and the
362    /// client. `mapped_address` is the address where the vmo is mapped in the
363    /// client address space.
364    pub fn r#set_vmo(
365        &self,
366        mut vmo: fidl::Vmo,
367        mut mapped_address: u64,
368    ) -> Result<(), fidl::Error> {
369        self.client.send::<BinderSetVmoRequest>(
370            (vmo, mapped_address),
371            0x43ee5d8f7d3acbf6,
372            fidl::encoding::DynamicFlags::FLEXIBLE,
373        )
374    }
375
376    /// Processes a Binder ioctl. This message returns writes for the calling thread
377    /// that must be processed to correctly handle the ioctl.
378    pub fn r#ioctl(
379        &self,
380        mut tid: u64,
381        mut request: u32,
382        mut arg: u64,
383        mut vmo: fidl::Vmo,
384        mut files: Vec<FileHandle>,
385        ___deadline: zx::MonotonicInstant,
386    ) -> Result<BinderIoctlResult, fidl::Error> {
387        let _response = self.client.send_query::<
388            BinderIoctlRequest,
389            fidl::encoding::FlexibleResultType<BinderIoctlResponse, fidl_fuchsia_posix::Errno>,
390            BinderMarker,
391        >(
392            (tid, request, arg, vmo, files.as_mut(),),
393            0x1032021e21310000,
394            fidl::encoding::DynamicFlags::FLEXIBLE,
395            ___deadline,
396        )?
397        .into_result::<BinderMarker>("ioctl")?;
398        Ok(_response.map(|x| x.ioctl_writes))
399    }
400}
401
402#[cfg(target_os = "fuchsia")]
403impl From<BinderSynchronousProxy> for zx::NullableHandle {
404    fn from(value: BinderSynchronousProxy) -> Self {
405        value.into_channel().into()
406    }
407}
408
409#[cfg(target_os = "fuchsia")]
410impl From<fidl::Channel> for BinderSynchronousProxy {
411    fn from(value: fidl::Channel) -> Self {
412        Self::new(value)
413    }
414}
415
416#[cfg(target_os = "fuchsia")]
417impl fidl::endpoints::FromClient for BinderSynchronousProxy {
418    type Protocol = BinderMarker;
419
420    fn from_client(value: fidl::endpoints::ClientEnd<BinderMarker>) -> Self {
421        Self::new(value.into_channel())
422    }
423}
424
425#[derive(Debug, Clone)]
426pub struct BinderProxy {
427    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
428}
429
430impl fidl::endpoints::Proxy for BinderProxy {
431    type Protocol = BinderMarker;
432
433    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
434        Self::new(inner)
435    }
436
437    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
438        self.client.into_channel().map_err(|client| Self { client })
439    }
440
441    fn as_channel(&self) -> &::fidl::AsyncChannel {
442        self.client.as_channel()
443    }
444}
445
446impl BinderProxy {
447    /// Create a new Proxy for fuchsia.starnix.binder/Binder.
448    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
449        let protocol_name = <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
450        Self { client: fidl::client::Client::new(channel, protocol_name) }
451    }
452
453    /// Get a Stream of events from the remote end of the protocol.
454    ///
455    /// # Panics
456    ///
457    /// Panics if the event stream was already taken.
458    pub fn take_event_stream(&self) -> BinderEventStream {
459        BinderEventStream { event_receiver: self.client.take_event_receiver() }
460    }
461
462    /// Set the VMO to used as a share resource between the driver and the
463    /// client. `mapped_address` is the address where the vmo is mapped in the
464    /// client address space.
465    pub fn r#set_vmo(
466        &self,
467        mut vmo: fidl::Vmo,
468        mut mapped_address: u64,
469    ) -> Result<(), fidl::Error> {
470        BinderProxyInterface::r#set_vmo(self, vmo, mapped_address)
471    }
472
473    /// Processes a Binder ioctl. This message returns writes for the calling thread
474    /// that must be processed to correctly handle the ioctl.
475    pub fn r#ioctl(
476        &self,
477        mut tid: u64,
478        mut request: u32,
479        mut arg: u64,
480        mut vmo: fidl::Vmo,
481        mut files: Vec<FileHandle>,
482    ) -> fidl::client::QueryResponseFut<
483        BinderIoctlResult,
484        fidl::encoding::DefaultFuchsiaResourceDialect,
485    > {
486        BinderProxyInterface::r#ioctl(self, tid, request, arg, vmo, files)
487    }
488}
489
490impl BinderProxyInterface for BinderProxy {
491    fn r#set_vmo(&self, mut vmo: fidl::Vmo, mut mapped_address: u64) -> Result<(), fidl::Error> {
492        self.client.send::<BinderSetVmoRequest>(
493            (vmo, mapped_address),
494            0x43ee5d8f7d3acbf6,
495            fidl::encoding::DynamicFlags::FLEXIBLE,
496        )
497    }
498
499    type IoctlResponseFut = fidl::client::QueryResponseFut<
500        BinderIoctlResult,
501        fidl::encoding::DefaultFuchsiaResourceDialect,
502    >;
503    fn r#ioctl(
504        &self,
505        mut tid: u64,
506        mut request: u32,
507        mut arg: u64,
508        mut vmo: fidl::Vmo,
509        mut files: Vec<FileHandle>,
510    ) -> Self::IoctlResponseFut {
511        fn _decode(
512            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
513        ) -> Result<BinderIoctlResult, fidl::Error> {
514            let _response = fidl::client::decode_transaction_body::<
515                fidl::encoding::FlexibleResultType<BinderIoctlResponse, fidl_fuchsia_posix::Errno>,
516                fidl::encoding::DefaultFuchsiaResourceDialect,
517                0x1032021e21310000,
518            >(_buf?)?
519            .into_result::<BinderMarker>("ioctl")?;
520            Ok(_response.map(|x| x.ioctl_writes))
521        }
522        self.client.send_query_and_decode::<BinderIoctlRequest, BinderIoctlResult>(
523            (tid, request, arg, vmo, files.as_mut()),
524            0x1032021e21310000,
525            fidl::encoding::DynamicFlags::FLEXIBLE,
526            _decode,
527        )
528    }
529}
530
531pub struct BinderEventStream {
532    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
533}
534
535impl std::marker::Unpin for BinderEventStream {}
536
537impl futures::stream::FusedStream for BinderEventStream {
538    fn is_terminated(&self) -> bool {
539        self.event_receiver.is_terminated()
540    }
541}
542
543impl futures::Stream for BinderEventStream {
544    type Item = Result<BinderEvent, fidl::Error>;
545
546    fn poll_next(
547        mut self: std::pin::Pin<&mut Self>,
548        cx: &mut std::task::Context<'_>,
549    ) -> std::task::Poll<Option<Self::Item>> {
550        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
551            &mut self.event_receiver,
552            cx
553        )?) {
554            Some(buf) => std::task::Poll::Ready(Some(BinderEvent::decode(buf))),
555            None => std::task::Poll::Ready(None),
556        }
557    }
558}
559
560#[derive(Debug)]
561pub enum BinderEvent {
562    #[non_exhaustive]
563    _UnknownEvent {
564        /// Ordinal of the event that was sent.
565        ordinal: u64,
566    },
567}
568
569impl BinderEvent {
570    /// Decodes a message buffer as a [`BinderEvent`].
571    fn decode(
572        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
573    ) -> Result<BinderEvent, fidl::Error> {
574        let (bytes, _handles) = buf.split_mut();
575        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
576        debug_assert_eq!(tx_header.tx_id, 0);
577        match tx_header.ordinal {
578            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
579                Ok(BinderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
580            }
581            _ => Err(fidl::Error::UnknownOrdinal {
582                ordinal: tx_header.ordinal,
583                protocol_name: <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
584            }),
585        }
586    }
587}
588
589/// A Stream of incoming requests for fuchsia.starnix.binder/Binder.
590pub struct BinderRequestStream {
591    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
592    is_terminated: bool,
593}
594
595impl std::marker::Unpin for BinderRequestStream {}
596
597impl futures::stream::FusedStream for BinderRequestStream {
598    fn is_terminated(&self) -> bool {
599        self.is_terminated
600    }
601}
602
603impl fidl::endpoints::RequestStream for BinderRequestStream {
604    type Protocol = BinderMarker;
605    type ControlHandle = BinderControlHandle;
606
607    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
608        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
609    }
610
611    fn control_handle(&self) -> Self::ControlHandle {
612        BinderControlHandle { inner: self.inner.clone() }
613    }
614
615    fn into_inner(
616        self,
617    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
618    {
619        (self.inner, self.is_terminated)
620    }
621
622    fn from_inner(
623        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
624        is_terminated: bool,
625    ) -> Self {
626        Self { inner, is_terminated }
627    }
628}
629
630impl futures::Stream for BinderRequestStream {
631    type Item = Result<BinderRequest, fidl::Error>;
632
633    fn poll_next(
634        mut self: std::pin::Pin<&mut Self>,
635        cx: &mut std::task::Context<'_>,
636    ) -> std::task::Poll<Option<Self::Item>> {
637        let this = &mut *self;
638        if this.inner.check_shutdown(cx) {
639            this.is_terminated = true;
640            return std::task::Poll::Ready(None);
641        }
642        if this.is_terminated {
643            panic!("polled BinderRequestStream after completion");
644        }
645        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
646            |bytes, handles| {
647                match this.inner.channel().read_etc(cx, bytes, handles) {
648                    std::task::Poll::Ready(Ok(())) => {}
649                    std::task::Poll::Pending => return std::task::Poll::Pending,
650                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
651                        this.is_terminated = true;
652                        return std::task::Poll::Ready(None);
653                    }
654                    std::task::Poll::Ready(Err(e)) => {
655                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
656                            e.into(),
657                        ))));
658                    }
659                }
660
661                // A message has been received from the channel
662                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
663
664                std::task::Poll::Ready(Some(match header.ordinal {
665                    0x43ee5d8f7d3acbf6 => {
666                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
667                        let mut req = fidl::new_empty!(
668                            BinderSetVmoRequest,
669                            fidl::encoding::DefaultFuchsiaResourceDialect
670                        );
671                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BinderSetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
672                        let control_handle = BinderControlHandle { inner: this.inner.clone() };
673                        Ok(BinderRequest::SetVmo {
674                            vmo: req.vmo,
675                            mapped_address: req.mapped_address,
676
677                            control_handle,
678                        })
679                    }
680                    0x1032021e21310000 => {
681                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
682                        let mut req = fidl::new_empty!(
683                            BinderIoctlRequest,
684                            fidl::encoding::DefaultFuchsiaResourceDialect
685                        );
686                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BinderIoctlRequest>(&header, _body_bytes, handles, &mut req)?;
687                        let control_handle = BinderControlHandle { inner: this.inner.clone() };
688                        Ok(BinderRequest::Ioctl {
689                            tid: req.tid,
690                            request: req.request,
691                            arg: req.arg,
692                            vmo: req.vmo,
693                            files: req.files,
694
695                            responder: BinderIoctlResponder {
696                                control_handle: std::mem::ManuallyDrop::new(control_handle),
697                                tx_id: header.tx_id,
698                            },
699                        })
700                    }
701                    _ if header.tx_id == 0
702                        && header
703                            .dynamic_flags()
704                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
705                    {
706                        Ok(BinderRequest::_UnknownMethod {
707                            ordinal: header.ordinal,
708                            control_handle: BinderControlHandle { inner: this.inner.clone() },
709                            method_type: fidl::MethodType::OneWay,
710                        })
711                    }
712                    _ if header
713                        .dynamic_flags()
714                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
715                    {
716                        this.inner.send_framework_err(
717                            fidl::encoding::FrameworkErr::UnknownMethod,
718                            header.tx_id,
719                            header.ordinal,
720                            header.dynamic_flags(),
721                            (bytes, handles),
722                        )?;
723                        Ok(BinderRequest::_UnknownMethod {
724                            ordinal: header.ordinal,
725                            control_handle: BinderControlHandle { inner: this.inner.clone() },
726                            method_type: fidl::MethodType::TwoWay,
727                        })
728                    }
729                    _ => Err(fidl::Error::UnknownOrdinal {
730                        ordinal: header.ordinal,
731                        protocol_name:
732                            <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
733                    }),
734                }))
735            },
736        )
737    }
738}
739
740/// An opened connection to a binder driver.
741#[derive(Debug)]
742pub enum BinderRequest {
743    /// Set the VMO to used as a share resource between the driver and the
744    /// client. `mapped_address` is the address where the vmo is mapped in the
745    /// client address space.
746    SetVmo { vmo: fidl::Vmo, mapped_address: u64, control_handle: BinderControlHandle },
747    /// Processes a Binder ioctl. This message returns writes for the calling thread
748    /// that must be processed to correctly handle the ioctl.
749    Ioctl {
750        tid: u64,
751        request: u32,
752        arg: u64,
753        vmo: fidl::Vmo,
754        files: Vec<FileHandle>,
755        responder: BinderIoctlResponder,
756    },
757    /// An interaction was received which does not match any known method.
758    #[non_exhaustive]
759    _UnknownMethod {
760        /// Ordinal of the method that was called.
761        ordinal: u64,
762        control_handle: BinderControlHandle,
763        method_type: fidl::MethodType,
764    },
765}
766
767impl BinderRequest {
768    #[allow(irrefutable_let_patterns)]
769    pub fn into_set_vmo(self) -> Option<(fidl::Vmo, u64, BinderControlHandle)> {
770        if let BinderRequest::SetVmo { vmo, mapped_address, control_handle } = self {
771            Some((vmo, mapped_address, control_handle))
772        } else {
773            None
774        }
775    }
776
777    #[allow(irrefutable_let_patterns)]
778    pub fn into_ioctl(
779        self,
780    ) -> Option<(u64, u32, u64, fidl::Vmo, Vec<FileHandle>, BinderIoctlResponder)> {
781        if let BinderRequest::Ioctl { tid, request, arg, vmo, files, responder } = self {
782            Some((tid, request, arg, vmo, files, responder))
783        } else {
784            None
785        }
786    }
787
788    /// Name of the method defined in FIDL
789    pub fn method_name(&self) -> &'static str {
790        match *self {
791            BinderRequest::SetVmo { .. } => "set_vmo",
792            BinderRequest::Ioctl { .. } => "ioctl",
793            BinderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
794                "unknown one-way method"
795            }
796            BinderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
797                "unknown two-way method"
798            }
799        }
800    }
801}
802
803#[derive(Debug, Clone)]
804pub struct BinderControlHandle {
805    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
806}
807
808impl fidl::endpoints::ControlHandle for BinderControlHandle {
809    fn shutdown(&self) {
810        self.inner.shutdown()
811    }
812
813    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
814        self.inner.shutdown_with_epitaph(status)
815    }
816
817    fn is_closed(&self) -> bool {
818        self.inner.channel().is_closed()
819    }
820    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
821        self.inner.channel().on_closed()
822    }
823
824    #[cfg(target_os = "fuchsia")]
825    fn signal_peer(
826        &self,
827        clear_mask: zx::Signals,
828        set_mask: zx::Signals,
829    ) -> Result<(), zx_status::Status> {
830        use fidl::Peered;
831        self.inner.channel().signal_peer(clear_mask, set_mask)
832    }
833}
834
835impl BinderControlHandle {}
836
837#[must_use = "FIDL methods require a response to be sent"]
838#[derive(Debug)]
839pub struct BinderIoctlResponder {
840    control_handle: std::mem::ManuallyDrop<BinderControlHandle>,
841    tx_id: u32,
842}
843
844/// Set the the channel to be shutdown (see [`BinderControlHandle::shutdown`])
845/// if the responder is dropped without sending a response, so that the client
846/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
847impl std::ops::Drop for BinderIoctlResponder {
848    fn drop(&mut self) {
849        self.control_handle.shutdown();
850        // Safety: drops once, never accessed again
851        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
852    }
853}
854
855impl fidl::endpoints::Responder for BinderIoctlResponder {
856    type ControlHandle = BinderControlHandle;
857
858    fn control_handle(&self) -> &BinderControlHandle {
859        &self.control_handle
860    }
861
862    fn drop_without_shutdown(mut self) {
863        // Safety: drops once, never accessed again due to mem::forget
864        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
865        // Prevent Drop from running (which would shut down the channel)
866        std::mem::forget(self);
867    }
868}
869
870impl BinderIoctlResponder {
871    /// Sends a response to the FIDL transaction.
872    ///
873    /// Sets the channel to shutdown if an error occurs.
874    pub fn send(
875        self,
876        mut result: Result<&[IoctlWrite], fidl_fuchsia_posix::Errno>,
877    ) -> Result<(), fidl::Error> {
878        let _result = self.send_raw(result);
879        if _result.is_err() {
880            self.control_handle.shutdown();
881        }
882        self.drop_without_shutdown();
883        _result
884    }
885
886    /// Similar to "send" but does not shutdown the channel if an error occurs.
887    pub fn send_no_shutdown_on_err(
888        self,
889        mut result: Result<&[IoctlWrite], fidl_fuchsia_posix::Errno>,
890    ) -> Result<(), fidl::Error> {
891        let _result = self.send_raw(result);
892        self.drop_without_shutdown();
893        _result
894    }
895
896    fn send_raw(
897        &self,
898        mut result: Result<&[IoctlWrite], fidl_fuchsia_posix::Errno>,
899    ) -> Result<(), fidl::Error> {
900        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
901            BinderIoctlResponse,
902            fidl_fuchsia_posix::Errno,
903        >>(
904            fidl::encoding::FlexibleResult::new(result.map(|ioctl_writes| (ioctl_writes,))),
905            self.tx_id,
906            0x1032021e21310000,
907            fidl::encoding::DynamicFlags::FLEXIBLE,
908        )
909    }
910}
911
912#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
913pub struct ContainerPowerControllerMarker;
914
915impl fidl::endpoints::ProtocolMarker for ContainerPowerControllerMarker {
916    type Proxy = ContainerPowerControllerProxy;
917    type RequestStream = ContainerPowerControllerRequestStream;
918    #[cfg(target_os = "fuchsia")]
919    type SynchronousProxy = ContainerPowerControllerSynchronousProxy;
920
921    const DEBUG_NAME: &'static str = "fuchsia.starnix.binder.ContainerPowerController";
922}
923impl fidl::endpoints::DiscoverableProtocolMarker for ContainerPowerControllerMarker {}
924
925pub trait ContainerPowerControllerProxyInterface: Send + Sync {
926    fn r#wake(&self, payload: ContainerPowerControllerWakeRequest) -> Result<(), fidl::Error>;
927    type RegisterWakeWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
928        + Send;
929    fn r#register_wake_watcher(
930        &self,
931        payload: ContainerPowerControllerRegisterWakeWatcherRequest,
932    ) -> Self::RegisterWakeWatcherResponseFut;
933}
934#[derive(Debug)]
935#[cfg(target_os = "fuchsia")]
936pub struct ContainerPowerControllerSynchronousProxy {
937    client: fidl::client::sync::Client,
938}
939
940#[cfg(target_os = "fuchsia")]
941impl fidl::endpoints::SynchronousProxy for ContainerPowerControllerSynchronousProxy {
942    type Proxy = ContainerPowerControllerProxy;
943    type Protocol = ContainerPowerControllerMarker;
944
945    fn from_channel(inner: fidl::Channel) -> Self {
946        Self::new(inner)
947    }
948
949    fn into_channel(self) -> fidl::Channel {
950        self.client.into_channel()
951    }
952
953    fn as_channel(&self) -> &fidl::Channel {
954        self.client.as_channel()
955    }
956}
957
958#[cfg(target_os = "fuchsia")]
959impl ContainerPowerControllerSynchronousProxy {
960    pub fn new(channel: fidl::Channel) -> Self {
961        Self { client: fidl::client::sync::Client::new(channel) }
962    }
963
964    pub fn into_channel(self) -> fidl::Channel {
965        self.client.into_channel()
966    }
967
968    /// Waits until an event arrives and returns it. It is safe for other
969    /// threads to make concurrent requests while waiting for an event.
970    pub fn wait_for_event(
971        &self,
972        deadline: zx::MonotonicInstant,
973    ) -> Result<ContainerPowerControllerEvent, fidl::Error> {
974        ContainerPowerControllerEvent::decode(
975            self.client.wait_for_event::<ContainerPowerControllerMarker>(deadline)?,
976        )
977    }
978
979    /// This requests that the container wakes up to service requests.
980    pub fn r#wake(
981        &self,
982        mut payload: ContainerPowerControllerWakeRequest,
983    ) -> Result<(), fidl::Error> {
984        self.client.send::<ContainerPowerControllerWakeRequest>(
985            &mut payload,
986            0x31dc1b2d1e00a094,
987            fidl::encoding::DynamicFlags::FLEXIBLE,
988        )
989    }
990
991    /// Registers an eventpair that will be signaled when the container is suspended or resumed.
992    /// The signals are ASLEEP(USER_1) and AWAKE(USER_0).
993    ///
994    /// The kernel returns AWAKE upon initial registration of the eventpair.
995    pub fn r#register_wake_watcher(
996        &self,
997        mut payload: ContainerPowerControllerRegisterWakeWatcherRequest,
998        ___deadline: zx::MonotonicInstant,
999    ) -> Result<(), fidl::Error> {
1000        let _response = self.client.send_query::<
1001            ContainerPowerControllerRegisterWakeWatcherRequest,
1002            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1003            ContainerPowerControllerMarker,
1004        >(
1005            &mut payload,
1006            0x5a08c36d7c9c5703,
1007            fidl::encoding::DynamicFlags::FLEXIBLE,
1008            ___deadline,
1009        )?
1010        .into_result::<ContainerPowerControllerMarker>("register_wake_watcher")?;
1011        Ok(_response)
1012    }
1013}
1014
1015#[cfg(target_os = "fuchsia")]
1016impl From<ContainerPowerControllerSynchronousProxy> for zx::NullableHandle {
1017    fn from(value: ContainerPowerControllerSynchronousProxy) -> Self {
1018        value.into_channel().into()
1019    }
1020}
1021
1022#[cfg(target_os = "fuchsia")]
1023impl From<fidl::Channel> for ContainerPowerControllerSynchronousProxy {
1024    fn from(value: fidl::Channel) -> Self {
1025        Self::new(value)
1026    }
1027}
1028
1029#[cfg(target_os = "fuchsia")]
1030impl fidl::endpoints::FromClient for ContainerPowerControllerSynchronousProxy {
1031    type Protocol = ContainerPowerControllerMarker;
1032
1033    fn from_client(value: fidl::endpoints::ClientEnd<ContainerPowerControllerMarker>) -> Self {
1034        Self::new(value.into_channel())
1035    }
1036}
1037
1038#[derive(Debug, Clone)]
1039pub struct ContainerPowerControllerProxy {
1040    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1041}
1042
1043impl fidl::endpoints::Proxy for ContainerPowerControllerProxy {
1044    type Protocol = ContainerPowerControllerMarker;
1045
1046    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1047        Self::new(inner)
1048    }
1049
1050    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1051        self.client.into_channel().map_err(|client| Self { client })
1052    }
1053
1054    fn as_channel(&self) -> &::fidl::AsyncChannel {
1055        self.client.as_channel()
1056    }
1057}
1058
1059impl ContainerPowerControllerProxy {
1060    /// Create a new Proxy for fuchsia.starnix.binder/ContainerPowerController.
1061    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1062        let protocol_name =
1063            <ContainerPowerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1064        Self { client: fidl::client::Client::new(channel, protocol_name) }
1065    }
1066
1067    /// Get a Stream of events from the remote end of the protocol.
1068    ///
1069    /// # Panics
1070    ///
1071    /// Panics if the event stream was already taken.
1072    pub fn take_event_stream(&self) -> ContainerPowerControllerEventStream {
1073        ContainerPowerControllerEventStream { event_receiver: self.client.take_event_receiver() }
1074    }
1075
1076    /// This requests that the container wakes up to service requests.
1077    pub fn r#wake(
1078        &self,
1079        mut payload: ContainerPowerControllerWakeRequest,
1080    ) -> Result<(), fidl::Error> {
1081        ContainerPowerControllerProxyInterface::r#wake(self, payload)
1082    }
1083
1084    /// Registers an eventpair that will be signaled when the container is suspended or resumed.
1085    /// The signals are ASLEEP(USER_1) and AWAKE(USER_0).
1086    ///
1087    /// The kernel returns AWAKE upon initial registration of the eventpair.
1088    pub fn r#register_wake_watcher(
1089        &self,
1090        mut payload: ContainerPowerControllerRegisterWakeWatcherRequest,
1091    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1092        ContainerPowerControllerProxyInterface::r#register_wake_watcher(self, payload)
1093    }
1094}
1095
1096impl ContainerPowerControllerProxyInterface for ContainerPowerControllerProxy {
1097    fn r#wake(&self, mut payload: ContainerPowerControllerWakeRequest) -> Result<(), fidl::Error> {
1098        self.client.send::<ContainerPowerControllerWakeRequest>(
1099            &mut payload,
1100            0x31dc1b2d1e00a094,
1101            fidl::encoding::DynamicFlags::FLEXIBLE,
1102        )
1103    }
1104
1105    type RegisterWakeWatcherResponseFut =
1106        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1107    fn r#register_wake_watcher(
1108        &self,
1109        mut payload: ContainerPowerControllerRegisterWakeWatcherRequest,
1110    ) -> Self::RegisterWakeWatcherResponseFut {
1111        fn _decode(
1112            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1113        ) -> Result<(), fidl::Error> {
1114            let _response = fidl::client::decode_transaction_body::<
1115                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1116                fidl::encoding::DefaultFuchsiaResourceDialect,
1117                0x5a08c36d7c9c5703,
1118            >(_buf?)?
1119            .into_result::<ContainerPowerControllerMarker>("register_wake_watcher")?;
1120            Ok(_response)
1121        }
1122        self.client.send_query_and_decode::<ContainerPowerControllerRegisterWakeWatcherRequest, ()>(
1123            &mut payload,
1124            0x5a08c36d7c9c5703,
1125            fidl::encoding::DynamicFlags::FLEXIBLE,
1126            _decode,
1127        )
1128    }
1129}
1130
1131pub struct ContainerPowerControllerEventStream {
1132    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1133}
1134
1135impl std::marker::Unpin for ContainerPowerControllerEventStream {}
1136
1137impl futures::stream::FusedStream for ContainerPowerControllerEventStream {
1138    fn is_terminated(&self) -> bool {
1139        self.event_receiver.is_terminated()
1140    }
1141}
1142
1143impl futures::Stream for ContainerPowerControllerEventStream {
1144    type Item = Result<ContainerPowerControllerEvent, fidl::Error>;
1145
1146    fn poll_next(
1147        mut self: std::pin::Pin<&mut Self>,
1148        cx: &mut std::task::Context<'_>,
1149    ) -> std::task::Poll<Option<Self::Item>> {
1150        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1151            &mut self.event_receiver,
1152            cx
1153        )?) {
1154            Some(buf) => std::task::Poll::Ready(Some(ContainerPowerControllerEvent::decode(buf))),
1155            None => std::task::Poll::Ready(None),
1156        }
1157    }
1158}
1159
1160#[derive(Debug)]
1161pub enum ContainerPowerControllerEvent {
1162    #[non_exhaustive]
1163    _UnknownEvent {
1164        /// Ordinal of the event that was sent.
1165        ordinal: u64,
1166    },
1167}
1168
1169impl ContainerPowerControllerEvent {
1170    /// Decodes a message buffer as a [`ContainerPowerControllerEvent`].
1171    fn decode(
1172        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1173    ) -> Result<ContainerPowerControllerEvent, fidl::Error> {
1174        let (bytes, _handles) = buf.split_mut();
1175        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1176        debug_assert_eq!(tx_header.tx_id, 0);
1177        match tx_header.ordinal {
1178            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1179                Ok(ContainerPowerControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1180            }
1181            _ => Err(fidl::Error::UnknownOrdinal {
1182                ordinal: tx_header.ordinal,
1183                protocol_name:
1184                    <ContainerPowerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1185            }),
1186        }
1187    }
1188}
1189
1190/// A Stream of incoming requests for fuchsia.starnix.binder/ContainerPowerController.
1191pub struct ContainerPowerControllerRequestStream {
1192    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1193    is_terminated: bool,
1194}
1195
1196impl std::marker::Unpin for ContainerPowerControllerRequestStream {}
1197
1198impl futures::stream::FusedStream for ContainerPowerControllerRequestStream {
1199    fn is_terminated(&self) -> bool {
1200        self.is_terminated
1201    }
1202}
1203
1204impl fidl::endpoints::RequestStream for ContainerPowerControllerRequestStream {
1205    type Protocol = ContainerPowerControllerMarker;
1206    type ControlHandle = ContainerPowerControllerControlHandle;
1207
1208    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1209        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1210    }
1211
1212    fn control_handle(&self) -> Self::ControlHandle {
1213        ContainerPowerControllerControlHandle { inner: self.inner.clone() }
1214    }
1215
1216    fn into_inner(
1217        self,
1218    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1219    {
1220        (self.inner, self.is_terminated)
1221    }
1222
1223    fn from_inner(
1224        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1225        is_terminated: bool,
1226    ) -> Self {
1227        Self { inner, is_terminated }
1228    }
1229}
1230
1231impl futures::Stream for ContainerPowerControllerRequestStream {
1232    type Item = Result<ContainerPowerControllerRequest, fidl::Error>;
1233
1234    fn poll_next(
1235        mut self: std::pin::Pin<&mut Self>,
1236        cx: &mut std::task::Context<'_>,
1237    ) -> std::task::Poll<Option<Self::Item>> {
1238        let this = &mut *self;
1239        if this.inner.check_shutdown(cx) {
1240            this.is_terminated = true;
1241            return std::task::Poll::Ready(None);
1242        }
1243        if this.is_terminated {
1244            panic!("polled ContainerPowerControllerRequestStream after completion");
1245        }
1246        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1247            |bytes, handles| {
1248                match this.inner.channel().read_etc(cx, bytes, handles) {
1249                    std::task::Poll::Ready(Ok(())) => {}
1250                    std::task::Poll::Pending => return std::task::Poll::Pending,
1251                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1252                        this.is_terminated = true;
1253                        return std::task::Poll::Ready(None);
1254                    }
1255                    std::task::Poll::Ready(Err(e)) => {
1256                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1257                            e.into(),
1258                        ))));
1259                    }
1260                }
1261
1262                // A message has been received from the channel
1263                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1264
1265                std::task::Poll::Ready(Some(match header.ordinal {
1266                0x31dc1b2d1e00a094 => {
1267                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1268                    let mut req = fidl::new_empty!(ContainerPowerControllerWakeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1269                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContainerPowerControllerWakeRequest>(&header, _body_bytes, handles, &mut req)?;
1270                    let control_handle = ContainerPowerControllerControlHandle {
1271                        inner: this.inner.clone(),
1272                    };
1273                    Ok(ContainerPowerControllerRequest::Wake {payload: req,
1274                        control_handle,
1275                    })
1276                }
1277                0x5a08c36d7c9c5703 => {
1278                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1279                    let mut req = fidl::new_empty!(ContainerPowerControllerRegisterWakeWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1280                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContainerPowerControllerRegisterWakeWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
1281                    let control_handle = ContainerPowerControllerControlHandle {
1282                        inner: this.inner.clone(),
1283                    };
1284                    Ok(ContainerPowerControllerRequest::RegisterWakeWatcher {payload: req,
1285                        responder: ContainerPowerControllerRegisterWakeWatcherResponder {
1286                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1287                            tx_id: header.tx_id,
1288                        },
1289                    })
1290                }
1291                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1292                    Ok(ContainerPowerControllerRequest::_UnknownMethod {
1293                        ordinal: header.ordinal,
1294                        control_handle: ContainerPowerControllerControlHandle { inner: this.inner.clone() },
1295                        method_type: fidl::MethodType::OneWay,
1296                    })
1297                }
1298                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1299                    this.inner.send_framework_err(
1300                        fidl::encoding::FrameworkErr::UnknownMethod,
1301                        header.tx_id,
1302                        header.ordinal,
1303                        header.dynamic_flags(),
1304                        (bytes, handles),
1305                    )?;
1306                    Ok(ContainerPowerControllerRequest::_UnknownMethod {
1307                        ordinal: header.ordinal,
1308                        control_handle: ContainerPowerControllerControlHandle { inner: this.inner.clone() },
1309                        method_type: fidl::MethodType::TwoWay,
1310                    })
1311                }
1312                _ => Err(fidl::Error::UnknownOrdinal {
1313                    ordinal: header.ordinal,
1314                    protocol_name: <ContainerPowerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1315                }),
1316            }))
1317            },
1318        )
1319    }
1320}
1321
1322/// Protocol that allows a binder server to request changes to the container's power state.
1323#[derive(Debug)]
1324pub enum ContainerPowerControllerRequest {
1325    /// This requests that the container wakes up to service requests.
1326    Wake {
1327        payload: ContainerPowerControllerWakeRequest,
1328        control_handle: ContainerPowerControllerControlHandle,
1329    },
1330    /// Registers an eventpair that will be signaled when the container is suspended or resumed.
1331    /// The signals are ASLEEP(USER_1) and AWAKE(USER_0).
1332    ///
1333    /// The kernel returns AWAKE upon initial registration of the eventpair.
1334    RegisterWakeWatcher {
1335        payload: ContainerPowerControllerRegisterWakeWatcherRequest,
1336        responder: ContainerPowerControllerRegisterWakeWatcherResponder,
1337    },
1338    /// An interaction was received which does not match any known method.
1339    #[non_exhaustive]
1340    _UnknownMethod {
1341        /// Ordinal of the method that was called.
1342        ordinal: u64,
1343        control_handle: ContainerPowerControllerControlHandle,
1344        method_type: fidl::MethodType,
1345    },
1346}
1347
1348impl ContainerPowerControllerRequest {
1349    #[allow(irrefutable_let_patterns)]
1350    pub fn into_wake(
1351        self,
1352    ) -> Option<(ContainerPowerControllerWakeRequest, ContainerPowerControllerControlHandle)> {
1353        if let ContainerPowerControllerRequest::Wake { payload, control_handle } = self {
1354            Some((payload, control_handle))
1355        } else {
1356            None
1357        }
1358    }
1359
1360    #[allow(irrefutable_let_patterns)]
1361    pub fn into_register_wake_watcher(
1362        self,
1363    ) -> Option<(
1364        ContainerPowerControllerRegisterWakeWatcherRequest,
1365        ContainerPowerControllerRegisterWakeWatcherResponder,
1366    )> {
1367        if let ContainerPowerControllerRequest::RegisterWakeWatcher { payload, responder } = self {
1368            Some((payload, responder))
1369        } else {
1370            None
1371        }
1372    }
1373
1374    /// Name of the method defined in FIDL
1375    pub fn method_name(&self) -> &'static str {
1376        match *self {
1377            ContainerPowerControllerRequest::Wake { .. } => "wake",
1378            ContainerPowerControllerRequest::RegisterWakeWatcher { .. } => "register_wake_watcher",
1379            ContainerPowerControllerRequest::_UnknownMethod {
1380                method_type: fidl::MethodType::OneWay,
1381                ..
1382            } => "unknown one-way method",
1383            ContainerPowerControllerRequest::_UnknownMethod {
1384                method_type: fidl::MethodType::TwoWay,
1385                ..
1386            } => "unknown two-way method",
1387        }
1388    }
1389}
1390
1391#[derive(Debug, Clone)]
1392pub struct ContainerPowerControllerControlHandle {
1393    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1394}
1395
1396impl fidl::endpoints::ControlHandle for ContainerPowerControllerControlHandle {
1397    fn shutdown(&self) {
1398        self.inner.shutdown()
1399    }
1400
1401    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1402        self.inner.shutdown_with_epitaph(status)
1403    }
1404
1405    fn is_closed(&self) -> bool {
1406        self.inner.channel().is_closed()
1407    }
1408    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1409        self.inner.channel().on_closed()
1410    }
1411
1412    #[cfg(target_os = "fuchsia")]
1413    fn signal_peer(
1414        &self,
1415        clear_mask: zx::Signals,
1416        set_mask: zx::Signals,
1417    ) -> Result<(), zx_status::Status> {
1418        use fidl::Peered;
1419        self.inner.channel().signal_peer(clear_mask, set_mask)
1420    }
1421}
1422
1423impl ContainerPowerControllerControlHandle {}
1424
1425#[must_use = "FIDL methods require a response to be sent"]
1426#[derive(Debug)]
1427pub struct ContainerPowerControllerRegisterWakeWatcherResponder {
1428    control_handle: std::mem::ManuallyDrop<ContainerPowerControllerControlHandle>,
1429    tx_id: u32,
1430}
1431
1432/// Set the the channel to be shutdown (see [`ContainerPowerControllerControlHandle::shutdown`])
1433/// if the responder is dropped without sending a response, so that the client
1434/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1435impl std::ops::Drop for ContainerPowerControllerRegisterWakeWatcherResponder {
1436    fn drop(&mut self) {
1437        self.control_handle.shutdown();
1438        // Safety: drops once, never accessed again
1439        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1440    }
1441}
1442
1443impl fidl::endpoints::Responder for ContainerPowerControllerRegisterWakeWatcherResponder {
1444    type ControlHandle = ContainerPowerControllerControlHandle;
1445
1446    fn control_handle(&self) -> &ContainerPowerControllerControlHandle {
1447        &self.control_handle
1448    }
1449
1450    fn drop_without_shutdown(mut self) {
1451        // Safety: drops once, never accessed again due to mem::forget
1452        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1453        // Prevent Drop from running (which would shut down the channel)
1454        std::mem::forget(self);
1455    }
1456}
1457
1458impl ContainerPowerControllerRegisterWakeWatcherResponder {
1459    /// Sends a response to the FIDL transaction.
1460    ///
1461    /// Sets the channel to shutdown if an error occurs.
1462    pub fn send(self) -> Result<(), fidl::Error> {
1463        let _result = self.send_raw();
1464        if _result.is_err() {
1465            self.control_handle.shutdown();
1466        }
1467        self.drop_without_shutdown();
1468        _result
1469    }
1470
1471    /// Similar to "send" but does not shutdown the channel if an error occurs.
1472    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1473        let _result = self.send_raw();
1474        self.drop_without_shutdown();
1475        _result
1476    }
1477
1478    fn send_raw(&self) -> Result<(), fidl::Error> {
1479        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1480            fidl::encoding::Flexible::new(()),
1481            self.tx_id,
1482            0x5a08c36d7c9c5703,
1483            fidl::encoding::DynamicFlags::FLEXIBLE,
1484        )
1485    }
1486}
1487
1488#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1489pub struct DevBinderMarker;
1490
1491impl fidl::endpoints::ProtocolMarker for DevBinderMarker {
1492    type Proxy = DevBinderProxy;
1493    type RequestStream = DevBinderRequestStream;
1494    #[cfg(target_os = "fuchsia")]
1495    type SynchronousProxy = DevBinderSynchronousProxy;
1496
1497    const DEBUG_NAME: &'static str = "fuchsia.starnix.binder.DevBinder";
1498}
1499impl fidl::endpoints::DiscoverableProtocolMarker for DevBinderMarker {}
1500
1501pub trait DevBinderProxyInterface: Send + Sync {
1502    fn r#open(&self, payload: DevBinderOpenRequest) -> Result<(), fidl::Error>;
1503    fn r#close(&self, payload: DevBinderCloseRequest) -> Result<(), fidl::Error>;
1504}
1505#[derive(Debug)]
1506#[cfg(target_os = "fuchsia")]
1507pub struct DevBinderSynchronousProxy {
1508    client: fidl::client::sync::Client,
1509}
1510
1511#[cfg(target_os = "fuchsia")]
1512impl fidl::endpoints::SynchronousProxy for DevBinderSynchronousProxy {
1513    type Proxy = DevBinderProxy;
1514    type Protocol = DevBinderMarker;
1515
1516    fn from_channel(inner: fidl::Channel) -> Self {
1517        Self::new(inner)
1518    }
1519
1520    fn into_channel(self) -> fidl::Channel {
1521        self.client.into_channel()
1522    }
1523
1524    fn as_channel(&self) -> &fidl::Channel {
1525        self.client.as_channel()
1526    }
1527}
1528
1529#[cfg(target_os = "fuchsia")]
1530impl DevBinderSynchronousProxy {
1531    pub fn new(channel: fidl::Channel) -> Self {
1532        Self { client: fidl::client::sync::Client::new(channel) }
1533    }
1534
1535    pub fn into_channel(self) -> fidl::Channel {
1536        self.client.into_channel()
1537    }
1538
1539    /// Waits until an event arrives and returns it. It is safe for other
1540    /// threads to make concurrent requests while waiting for an event.
1541    pub fn wait_for_event(
1542        &self,
1543        deadline: zx::MonotonicInstant,
1544    ) -> Result<DevBinderEvent, fidl::Error> {
1545        DevBinderEvent::decode(self.client.wait_for_event::<DevBinderMarker>(deadline)?)
1546    }
1547
1548    /// Open the binder device node.
1549    pub fn r#open(&self, mut payload: DevBinderOpenRequest) -> Result<(), fidl::Error> {
1550        self.client.send::<DevBinderOpenRequest>(
1551            &mut payload,
1552            0x250f5ee034977685,
1553            fidl::encoding::DynamicFlags::FLEXIBLE,
1554        )
1555    }
1556
1557    /// Close the binder device node, previously opened with `Open`. The handle
1558    /// is passed back to the service so that it can identify the device being
1559    /// closed.
1560    pub fn r#close(&self, mut payload: DevBinderCloseRequest) -> Result<(), fidl::Error> {
1561        self.client.send::<DevBinderCloseRequest>(
1562            &mut payload,
1563            0x50b39ce5c9bae3b1,
1564            fidl::encoding::DynamicFlags::FLEXIBLE,
1565        )
1566    }
1567}
1568
1569#[cfg(target_os = "fuchsia")]
1570impl From<DevBinderSynchronousProxy> for zx::NullableHandle {
1571    fn from(value: DevBinderSynchronousProxy) -> Self {
1572        value.into_channel().into()
1573    }
1574}
1575
1576#[cfg(target_os = "fuchsia")]
1577impl From<fidl::Channel> for DevBinderSynchronousProxy {
1578    fn from(value: fidl::Channel) -> Self {
1579        Self::new(value)
1580    }
1581}
1582
1583#[cfg(target_os = "fuchsia")]
1584impl fidl::endpoints::FromClient for DevBinderSynchronousProxy {
1585    type Protocol = DevBinderMarker;
1586
1587    fn from_client(value: fidl::endpoints::ClientEnd<DevBinderMarker>) -> Self {
1588        Self::new(value.into_channel())
1589    }
1590}
1591
1592#[derive(Debug, Clone)]
1593pub struct DevBinderProxy {
1594    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1595}
1596
1597impl fidl::endpoints::Proxy for DevBinderProxy {
1598    type Protocol = DevBinderMarker;
1599
1600    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1601        Self::new(inner)
1602    }
1603
1604    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1605        self.client.into_channel().map_err(|client| Self { client })
1606    }
1607
1608    fn as_channel(&self) -> &::fidl::AsyncChannel {
1609        self.client.as_channel()
1610    }
1611}
1612
1613impl DevBinderProxy {
1614    /// Create a new Proxy for fuchsia.starnix.binder/DevBinder.
1615    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1616        let protocol_name = <DevBinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1617        Self { client: fidl::client::Client::new(channel, protocol_name) }
1618    }
1619
1620    /// Get a Stream of events from the remote end of the protocol.
1621    ///
1622    /// # Panics
1623    ///
1624    /// Panics if the event stream was already taken.
1625    pub fn take_event_stream(&self) -> DevBinderEventStream {
1626        DevBinderEventStream { event_receiver: self.client.take_event_receiver() }
1627    }
1628
1629    /// Open the binder device node.
1630    pub fn r#open(&self, mut payload: DevBinderOpenRequest) -> Result<(), fidl::Error> {
1631        DevBinderProxyInterface::r#open(self, payload)
1632    }
1633
1634    /// Close the binder device node, previously opened with `Open`. The handle
1635    /// is passed back to the service so that it can identify the device being
1636    /// closed.
1637    pub fn r#close(&self, mut payload: DevBinderCloseRequest) -> Result<(), fidl::Error> {
1638        DevBinderProxyInterface::r#close(self, payload)
1639    }
1640}
1641
1642impl DevBinderProxyInterface for DevBinderProxy {
1643    fn r#open(&self, mut payload: DevBinderOpenRequest) -> Result<(), fidl::Error> {
1644        self.client.send::<DevBinderOpenRequest>(
1645            &mut payload,
1646            0x250f5ee034977685,
1647            fidl::encoding::DynamicFlags::FLEXIBLE,
1648        )
1649    }
1650
1651    fn r#close(&self, mut payload: DevBinderCloseRequest) -> Result<(), fidl::Error> {
1652        self.client.send::<DevBinderCloseRequest>(
1653            &mut payload,
1654            0x50b39ce5c9bae3b1,
1655            fidl::encoding::DynamicFlags::FLEXIBLE,
1656        )
1657    }
1658}
1659
1660pub struct DevBinderEventStream {
1661    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1662}
1663
1664impl std::marker::Unpin for DevBinderEventStream {}
1665
1666impl futures::stream::FusedStream for DevBinderEventStream {
1667    fn is_terminated(&self) -> bool {
1668        self.event_receiver.is_terminated()
1669    }
1670}
1671
1672impl futures::Stream for DevBinderEventStream {
1673    type Item = Result<DevBinderEvent, fidl::Error>;
1674
1675    fn poll_next(
1676        mut self: std::pin::Pin<&mut Self>,
1677        cx: &mut std::task::Context<'_>,
1678    ) -> std::task::Poll<Option<Self::Item>> {
1679        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1680            &mut self.event_receiver,
1681            cx
1682        )?) {
1683            Some(buf) => std::task::Poll::Ready(Some(DevBinderEvent::decode(buf))),
1684            None => std::task::Poll::Ready(None),
1685        }
1686    }
1687}
1688
1689#[derive(Debug)]
1690pub enum DevBinderEvent {
1691    #[non_exhaustive]
1692    _UnknownEvent {
1693        /// Ordinal of the event that was sent.
1694        ordinal: u64,
1695    },
1696}
1697
1698impl DevBinderEvent {
1699    /// Decodes a message buffer as a [`DevBinderEvent`].
1700    fn decode(
1701        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1702    ) -> Result<DevBinderEvent, fidl::Error> {
1703        let (bytes, _handles) = buf.split_mut();
1704        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1705        debug_assert_eq!(tx_header.tx_id, 0);
1706        match tx_header.ordinal {
1707            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1708                Ok(DevBinderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1709            }
1710            _ => Err(fidl::Error::UnknownOrdinal {
1711                ordinal: tx_header.ordinal,
1712                protocol_name: <DevBinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1713            }),
1714        }
1715    }
1716}
1717
1718/// A Stream of incoming requests for fuchsia.starnix.binder/DevBinder.
1719pub struct DevBinderRequestStream {
1720    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1721    is_terminated: bool,
1722}
1723
1724impl std::marker::Unpin for DevBinderRequestStream {}
1725
1726impl futures::stream::FusedStream for DevBinderRequestStream {
1727    fn is_terminated(&self) -> bool {
1728        self.is_terminated
1729    }
1730}
1731
1732impl fidl::endpoints::RequestStream for DevBinderRequestStream {
1733    type Protocol = DevBinderMarker;
1734    type ControlHandle = DevBinderControlHandle;
1735
1736    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1737        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1738    }
1739
1740    fn control_handle(&self) -> Self::ControlHandle {
1741        DevBinderControlHandle { inner: self.inner.clone() }
1742    }
1743
1744    fn into_inner(
1745        self,
1746    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1747    {
1748        (self.inner, self.is_terminated)
1749    }
1750
1751    fn from_inner(
1752        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1753        is_terminated: bool,
1754    ) -> Self {
1755        Self { inner, is_terminated }
1756    }
1757}
1758
1759impl futures::Stream for DevBinderRequestStream {
1760    type Item = Result<DevBinderRequest, fidl::Error>;
1761
1762    fn poll_next(
1763        mut self: std::pin::Pin<&mut Self>,
1764        cx: &mut std::task::Context<'_>,
1765    ) -> std::task::Poll<Option<Self::Item>> {
1766        let this = &mut *self;
1767        if this.inner.check_shutdown(cx) {
1768            this.is_terminated = true;
1769            return std::task::Poll::Ready(None);
1770        }
1771        if this.is_terminated {
1772            panic!("polled DevBinderRequestStream after completion");
1773        }
1774        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1775            |bytes, handles| {
1776                match this.inner.channel().read_etc(cx, bytes, handles) {
1777                    std::task::Poll::Ready(Ok(())) => {}
1778                    std::task::Poll::Pending => return std::task::Poll::Pending,
1779                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1780                        this.is_terminated = true;
1781                        return std::task::Poll::Ready(None);
1782                    }
1783                    std::task::Poll::Ready(Err(e)) => {
1784                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1785                            e.into(),
1786                        ))));
1787                    }
1788                }
1789
1790                // A message has been received from the channel
1791                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1792
1793                std::task::Poll::Ready(Some(match header.ordinal {
1794                    0x250f5ee034977685 => {
1795                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1796                        let mut req = fidl::new_empty!(
1797                            DevBinderOpenRequest,
1798                            fidl::encoding::DefaultFuchsiaResourceDialect
1799                        );
1800                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevBinderOpenRequest>(&header, _body_bytes, handles, &mut req)?;
1801                        let control_handle = DevBinderControlHandle { inner: this.inner.clone() };
1802                        Ok(DevBinderRequest::Open { payload: req, control_handle })
1803                    }
1804                    0x50b39ce5c9bae3b1 => {
1805                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1806                        let mut req = fidl::new_empty!(
1807                            DevBinderCloseRequest,
1808                            fidl::encoding::DefaultFuchsiaResourceDialect
1809                        );
1810                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevBinderCloseRequest>(&header, _body_bytes, handles, &mut req)?;
1811                        let control_handle = DevBinderControlHandle { inner: this.inner.clone() };
1812                        Ok(DevBinderRequest::Close { payload: req, control_handle })
1813                    }
1814                    _ if header.tx_id == 0
1815                        && header
1816                            .dynamic_flags()
1817                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1818                    {
1819                        Ok(DevBinderRequest::_UnknownMethod {
1820                            ordinal: header.ordinal,
1821                            control_handle: DevBinderControlHandle { inner: this.inner.clone() },
1822                            method_type: fidl::MethodType::OneWay,
1823                        })
1824                    }
1825                    _ if header
1826                        .dynamic_flags()
1827                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1828                    {
1829                        this.inner.send_framework_err(
1830                            fidl::encoding::FrameworkErr::UnknownMethod,
1831                            header.tx_id,
1832                            header.ordinal,
1833                            header.dynamic_flags(),
1834                            (bytes, handles),
1835                        )?;
1836                        Ok(DevBinderRequest::_UnknownMethod {
1837                            ordinal: header.ordinal,
1838                            control_handle: DevBinderControlHandle { inner: this.inner.clone() },
1839                            method_type: fidl::MethodType::TwoWay,
1840                        })
1841                    }
1842                    _ => Err(fidl::Error::UnknownOrdinal {
1843                        ordinal: header.ordinal,
1844                        protocol_name:
1845                            <DevBinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1846                    }),
1847                }))
1848            },
1849        )
1850    }
1851}
1852
1853/// Give access to the binder nodes.
1854#[derive(Debug)]
1855pub enum DevBinderRequest {
1856    /// Open the binder device node.
1857    Open { payload: DevBinderOpenRequest, control_handle: DevBinderControlHandle },
1858    /// Close the binder device node, previously opened with `Open`. The handle
1859    /// is passed back to the service so that it can identify the device being
1860    /// closed.
1861    Close { payload: DevBinderCloseRequest, control_handle: DevBinderControlHandle },
1862    /// An interaction was received which does not match any known method.
1863    #[non_exhaustive]
1864    _UnknownMethod {
1865        /// Ordinal of the method that was called.
1866        ordinal: u64,
1867        control_handle: DevBinderControlHandle,
1868        method_type: fidl::MethodType,
1869    },
1870}
1871
1872impl DevBinderRequest {
1873    #[allow(irrefutable_let_patterns)]
1874    pub fn into_open(self) -> Option<(DevBinderOpenRequest, DevBinderControlHandle)> {
1875        if let DevBinderRequest::Open { payload, control_handle } = self {
1876            Some((payload, control_handle))
1877        } else {
1878            None
1879        }
1880    }
1881
1882    #[allow(irrefutable_let_patterns)]
1883    pub fn into_close(self) -> Option<(DevBinderCloseRequest, DevBinderControlHandle)> {
1884        if let DevBinderRequest::Close { payload, control_handle } = self {
1885            Some((payload, control_handle))
1886        } else {
1887            None
1888        }
1889    }
1890
1891    /// Name of the method defined in FIDL
1892    pub fn method_name(&self) -> &'static str {
1893        match *self {
1894            DevBinderRequest::Open { .. } => "open",
1895            DevBinderRequest::Close { .. } => "close",
1896            DevBinderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1897                "unknown one-way method"
1898            }
1899            DevBinderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1900                "unknown two-way method"
1901            }
1902        }
1903    }
1904}
1905
1906#[derive(Debug, Clone)]
1907pub struct DevBinderControlHandle {
1908    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1909}
1910
1911impl fidl::endpoints::ControlHandle for DevBinderControlHandle {
1912    fn shutdown(&self) {
1913        self.inner.shutdown()
1914    }
1915
1916    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1917        self.inner.shutdown_with_epitaph(status)
1918    }
1919
1920    fn is_closed(&self) -> bool {
1921        self.inner.channel().is_closed()
1922    }
1923    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1924        self.inner.channel().on_closed()
1925    }
1926
1927    #[cfg(target_os = "fuchsia")]
1928    fn signal_peer(
1929        &self,
1930        clear_mask: zx::Signals,
1931        set_mask: zx::Signals,
1932    ) -> Result<(), zx_status::Status> {
1933        use fidl::Peered;
1934        self.inner.channel().signal_peer(clear_mask, set_mask)
1935    }
1936}
1937
1938impl DevBinderControlHandle {}
1939
1940#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1941pub struct LutexControllerMarker;
1942
1943impl fidl::endpoints::ProtocolMarker for LutexControllerMarker {
1944    type Proxy = LutexControllerProxy;
1945    type RequestStream = LutexControllerRequestStream;
1946    #[cfg(target_os = "fuchsia")]
1947    type SynchronousProxy = LutexControllerSynchronousProxy;
1948
1949    const DEBUG_NAME: &'static str = "fuchsia.starnix.binder.LutexController";
1950}
1951impl fidl::endpoints::DiscoverableProtocolMarker for LutexControllerMarker {}
1952pub type LutexControllerWaitBitsetResult = Result<(), fidl_fuchsia_posix::Errno>;
1953pub type LutexControllerWakeBitsetResult = Result<WakeResponse, fidl_fuchsia_posix::Errno>;
1954
1955pub trait LutexControllerProxyInterface: Send + Sync {
1956    type WaitBitsetResponseFut: std::future::Future<Output = Result<LutexControllerWaitBitsetResult, fidl::Error>>
1957        + Send;
1958    fn r#wait_bitset(&self, payload: WaitBitsetRequest) -> Self::WaitBitsetResponseFut;
1959    type WakeBitsetResponseFut: std::future::Future<Output = Result<LutexControllerWakeBitsetResult, fidl::Error>>
1960        + Send;
1961    fn r#wake_bitset(&self, payload: WakeBitsetRequest) -> Self::WakeBitsetResponseFut;
1962}
1963#[derive(Debug)]
1964#[cfg(target_os = "fuchsia")]
1965pub struct LutexControllerSynchronousProxy {
1966    client: fidl::client::sync::Client,
1967}
1968
1969#[cfg(target_os = "fuchsia")]
1970impl fidl::endpoints::SynchronousProxy for LutexControllerSynchronousProxy {
1971    type Proxy = LutexControllerProxy;
1972    type Protocol = LutexControllerMarker;
1973
1974    fn from_channel(inner: fidl::Channel) -> Self {
1975        Self::new(inner)
1976    }
1977
1978    fn into_channel(self) -> fidl::Channel {
1979        self.client.into_channel()
1980    }
1981
1982    fn as_channel(&self) -> &fidl::Channel {
1983        self.client.as_channel()
1984    }
1985}
1986
1987#[cfg(target_os = "fuchsia")]
1988impl LutexControllerSynchronousProxy {
1989    pub fn new(channel: fidl::Channel) -> Self {
1990        Self { client: fidl::client::sync::Client::new(channel) }
1991    }
1992
1993    pub fn into_channel(self) -> fidl::Channel {
1994        self.client.into_channel()
1995    }
1996
1997    /// Waits until an event arrives and returns it. It is safe for other
1998    /// threads to make concurrent requests while waiting for an event.
1999    pub fn wait_for_event(
2000        &self,
2001        deadline: zx::MonotonicInstant,
2002    ) -> Result<LutexControllerEvent, fidl::Error> {
2003        LutexControllerEvent::decode(self.client.wait_for_event::<LutexControllerMarker>(deadline)?)
2004    }
2005
2006    /// FUTEX_WAIT_BITSET command
2007    pub fn r#wait_bitset(
2008        &self,
2009        mut payload: WaitBitsetRequest,
2010        ___deadline: zx::MonotonicInstant,
2011    ) -> Result<LutexControllerWaitBitsetResult, fidl::Error> {
2012        let _response = self
2013            .client
2014            .send_query::<WaitBitsetRequest, fidl::encoding::FlexibleResultType<
2015                fidl::encoding::EmptyStruct,
2016                fidl_fuchsia_posix::Errno,
2017            >, LutexControllerMarker>(
2018                &mut payload,
2019                0x489feee6787d11b1,
2020                fidl::encoding::DynamicFlags::FLEXIBLE,
2021                ___deadline,
2022            )?
2023            .into_result::<LutexControllerMarker>("wait_bitset")?;
2024        Ok(_response.map(|x| x))
2025    }
2026
2027    /// FUTEX_WAKE_BITSET command
2028    pub fn r#wake_bitset(
2029        &self,
2030        mut payload: WakeBitsetRequest,
2031        ___deadline: zx::MonotonicInstant,
2032    ) -> Result<LutexControllerWakeBitsetResult, fidl::Error> {
2033        let _response = self.client.send_query::<
2034            WakeBitsetRequest,
2035            fidl::encoding::FlexibleResultType<WakeResponse, fidl_fuchsia_posix::Errno>,
2036            LutexControllerMarker,
2037        >(
2038            &mut payload,
2039            0x58309f6ebcb0d8eb,
2040            fidl::encoding::DynamicFlags::FLEXIBLE,
2041            ___deadline,
2042        )?
2043        .into_result::<LutexControllerMarker>("wake_bitset")?;
2044        Ok(_response.map(|x| x))
2045    }
2046}
2047
2048#[cfg(target_os = "fuchsia")]
2049impl From<LutexControllerSynchronousProxy> for zx::NullableHandle {
2050    fn from(value: LutexControllerSynchronousProxy) -> Self {
2051        value.into_channel().into()
2052    }
2053}
2054
2055#[cfg(target_os = "fuchsia")]
2056impl From<fidl::Channel> for LutexControllerSynchronousProxy {
2057    fn from(value: fidl::Channel) -> Self {
2058        Self::new(value)
2059    }
2060}
2061
2062#[cfg(target_os = "fuchsia")]
2063impl fidl::endpoints::FromClient for LutexControllerSynchronousProxy {
2064    type Protocol = LutexControllerMarker;
2065
2066    fn from_client(value: fidl::endpoints::ClientEnd<LutexControllerMarker>) -> Self {
2067        Self::new(value.into_channel())
2068    }
2069}
2070
2071#[derive(Debug, Clone)]
2072pub struct LutexControllerProxy {
2073    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2074}
2075
2076impl fidl::endpoints::Proxy for LutexControllerProxy {
2077    type Protocol = LutexControllerMarker;
2078
2079    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2080        Self::new(inner)
2081    }
2082
2083    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2084        self.client.into_channel().map_err(|client| Self { client })
2085    }
2086
2087    fn as_channel(&self) -> &::fidl::AsyncChannel {
2088        self.client.as_channel()
2089    }
2090}
2091
2092impl LutexControllerProxy {
2093    /// Create a new Proxy for fuchsia.starnix.binder/LutexController.
2094    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2095        let protocol_name = <LutexControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2096        Self { client: fidl::client::Client::new(channel, protocol_name) }
2097    }
2098
2099    /// Get a Stream of events from the remote end of the protocol.
2100    ///
2101    /// # Panics
2102    ///
2103    /// Panics if the event stream was already taken.
2104    pub fn take_event_stream(&self) -> LutexControllerEventStream {
2105        LutexControllerEventStream { event_receiver: self.client.take_event_receiver() }
2106    }
2107
2108    /// FUTEX_WAIT_BITSET command
2109    pub fn r#wait_bitset(
2110        &self,
2111        mut payload: WaitBitsetRequest,
2112    ) -> fidl::client::QueryResponseFut<
2113        LutexControllerWaitBitsetResult,
2114        fidl::encoding::DefaultFuchsiaResourceDialect,
2115    > {
2116        LutexControllerProxyInterface::r#wait_bitset(self, payload)
2117    }
2118
2119    /// FUTEX_WAKE_BITSET command
2120    pub fn r#wake_bitset(
2121        &self,
2122        mut payload: WakeBitsetRequest,
2123    ) -> fidl::client::QueryResponseFut<
2124        LutexControllerWakeBitsetResult,
2125        fidl::encoding::DefaultFuchsiaResourceDialect,
2126    > {
2127        LutexControllerProxyInterface::r#wake_bitset(self, payload)
2128    }
2129}
2130
2131impl LutexControllerProxyInterface for LutexControllerProxy {
2132    type WaitBitsetResponseFut = fidl::client::QueryResponseFut<
2133        LutexControllerWaitBitsetResult,
2134        fidl::encoding::DefaultFuchsiaResourceDialect,
2135    >;
2136    fn r#wait_bitset(&self, mut payload: WaitBitsetRequest) -> Self::WaitBitsetResponseFut {
2137        fn _decode(
2138            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2139        ) -> Result<LutexControllerWaitBitsetResult, fidl::Error> {
2140            let _response = fidl::client::decode_transaction_body::<
2141                fidl::encoding::FlexibleResultType<
2142                    fidl::encoding::EmptyStruct,
2143                    fidl_fuchsia_posix::Errno,
2144                >,
2145                fidl::encoding::DefaultFuchsiaResourceDialect,
2146                0x489feee6787d11b1,
2147            >(_buf?)?
2148            .into_result::<LutexControllerMarker>("wait_bitset")?;
2149            Ok(_response.map(|x| x))
2150        }
2151        self.client.send_query_and_decode::<WaitBitsetRequest, LutexControllerWaitBitsetResult>(
2152            &mut payload,
2153            0x489feee6787d11b1,
2154            fidl::encoding::DynamicFlags::FLEXIBLE,
2155            _decode,
2156        )
2157    }
2158
2159    type WakeBitsetResponseFut = fidl::client::QueryResponseFut<
2160        LutexControllerWakeBitsetResult,
2161        fidl::encoding::DefaultFuchsiaResourceDialect,
2162    >;
2163    fn r#wake_bitset(&self, mut payload: WakeBitsetRequest) -> Self::WakeBitsetResponseFut {
2164        fn _decode(
2165            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2166        ) -> Result<LutexControllerWakeBitsetResult, fidl::Error> {
2167            let _response = fidl::client::decode_transaction_body::<
2168                fidl::encoding::FlexibleResultType<WakeResponse, fidl_fuchsia_posix::Errno>,
2169                fidl::encoding::DefaultFuchsiaResourceDialect,
2170                0x58309f6ebcb0d8eb,
2171            >(_buf?)?
2172            .into_result::<LutexControllerMarker>("wake_bitset")?;
2173            Ok(_response.map(|x| x))
2174        }
2175        self.client.send_query_and_decode::<WakeBitsetRequest, LutexControllerWakeBitsetResult>(
2176            &mut payload,
2177            0x58309f6ebcb0d8eb,
2178            fidl::encoding::DynamicFlags::FLEXIBLE,
2179            _decode,
2180        )
2181    }
2182}
2183
2184pub struct LutexControllerEventStream {
2185    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2186}
2187
2188impl std::marker::Unpin for LutexControllerEventStream {}
2189
2190impl futures::stream::FusedStream for LutexControllerEventStream {
2191    fn is_terminated(&self) -> bool {
2192        self.event_receiver.is_terminated()
2193    }
2194}
2195
2196impl futures::Stream for LutexControllerEventStream {
2197    type Item = Result<LutexControllerEvent, fidl::Error>;
2198
2199    fn poll_next(
2200        mut self: std::pin::Pin<&mut Self>,
2201        cx: &mut std::task::Context<'_>,
2202    ) -> std::task::Poll<Option<Self::Item>> {
2203        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2204            &mut self.event_receiver,
2205            cx
2206        )?) {
2207            Some(buf) => std::task::Poll::Ready(Some(LutexControllerEvent::decode(buf))),
2208            None => std::task::Poll::Ready(None),
2209        }
2210    }
2211}
2212
2213#[derive(Debug)]
2214pub enum LutexControllerEvent {
2215    #[non_exhaustive]
2216    _UnknownEvent {
2217        /// Ordinal of the event that was sent.
2218        ordinal: u64,
2219    },
2220}
2221
2222impl LutexControllerEvent {
2223    /// Decodes a message buffer as a [`LutexControllerEvent`].
2224    fn decode(
2225        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2226    ) -> Result<LutexControllerEvent, fidl::Error> {
2227        let (bytes, _handles) = buf.split_mut();
2228        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2229        debug_assert_eq!(tx_header.tx_id, 0);
2230        match tx_header.ordinal {
2231            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2232                Ok(LutexControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2233            }
2234            _ => Err(fidl::Error::UnknownOrdinal {
2235                ordinal: tx_header.ordinal,
2236                protocol_name:
2237                    <LutexControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2238            }),
2239        }
2240    }
2241}
2242
2243/// A Stream of incoming requests for fuchsia.starnix.binder/LutexController.
2244pub struct LutexControllerRequestStream {
2245    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2246    is_terminated: bool,
2247}
2248
2249impl std::marker::Unpin for LutexControllerRequestStream {}
2250
2251impl futures::stream::FusedStream for LutexControllerRequestStream {
2252    fn is_terminated(&self) -> bool {
2253        self.is_terminated
2254    }
2255}
2256
2257impl fidl::endpoints::RequestStream for LutexControllerRequestStream {
2258    type Protocol = LutexControllerMarker;
2259    type ControlHandle = LutexControllerControlHandle;
2260
2261    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2262        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2263    }
2264
2265    fn control_handle(&self) -> Self::ControlHandle {
2266        LutexControllerControlHandle { inner: self.inner.clone() }
2267    }
2268
2269    fn into_inner(
2270        self,
2271    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2272    {
2273        (self.inner, self.is_terminated)
2274    }
2275
2276    fn from_inner(
2277        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2278        is_terminated: bool,
2279    ) -> Self {
2280        Self { inner, is_terminated }
2281    }
2282}
2283
2284impl futures::Stream for LutexControllerRequestStream {
2285    type Item = Result<LutexControllerRequest, fidl::Error>;
2286
2287    fn poll_next(
2288        mut self: std::pin::Pin<&mut Self>,
2289        cx: &mut std::task::Context<'_>,
2290    ) -> std::task::Poll<Option<Self::Item>> {
2291        let this = &mut *self;
2292        if this.inner.check_shutdown(cx) {
2293            this.is_terminated = true;
2294            return std::task::Poll::Ready(None);
2295        }
2296        if this.is_terminated {
2297            panic!("polled LutexControllerRequestStream after completion");
2298        }
2299        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2300            |bytes, handles| {
2301                match this.inner.channel().read_etc(cx, bytes, handles) {
2302                    std::task::Poll::Ready(Ok(())) => {}
2303                    std::task::Poll::Pending => return std::task::Poll::Pending,
2304                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2305                        this.is_terminated = true;
2306                        return std::task::Poll::Ready(None);
2307                    }
2308                    std::task::Poll::Ready(Err(e)) => {
2309                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2310                            e.into(),
2311                        ))));
2312                    }
2313                }
2314
2315                // A message has been received from the channel
2316                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2317
2318                std::task::Poll::Ready(Some(match header.ordinal {
2319                    0x489feee6787d11b1 => {
2320                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2321                        let mut req = fidl::new_empty!(
2322                            WaitBitsetRequest,
2323                            fidl::encoding::DefaultFuchsiaResourceDialect
2324                        );
2325                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WaitBitsetRequest>(&header, _body_bytes, handles, &mut req)?;
2326                        let control_handle =
2327                            LutexControllerControlHandle { inner: this.inner.clone() };
2328                        Ok(LutexControllerRequest::WaitBitset {
2329                            payload: req,
2330                            responder: LutexControllerWaitBitsetResponder {
2331                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2332                                tx_id: header.tx_id,
2333                            },
2334                        })
2335                    }
2336                    0x58309f6ebcb0d8eb => {
2337                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2338                        let mut req = fidl::new_empty!(
2339                            WakeBitsetRequest,
2340                            fidl::encoding::DefaultFuchsiaResourceDialect
2341                        );
2342                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WakeBitsetRequest>(&header, _body_bytes, handles, &mut req)?;
2343                        let control_handle =
2344                            LutexControllerControlHandle { inner: this.inner.clone() };
2345                        Ok(LutexControllerRequest::WakeBitset {
2346                            payload: req,
2347                            responder: LutexControllerWakeBitsetResponder {
2348                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2349                                tx_id: header.tx_id,
2350                            },
2351                        })
2352                    }
2353                    _ if header.tx_id == 0
2354                        && header
2355                            .dynamic_flags()
2356                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2357                    {
2358                        Ok(LutexControllerRequest::_UnknownMethod {
2359                            ordinal: header.ordinal,
2360                            control_handle: LutexControllerControlHandle {
2361                                inner: this.inner.clone(),
2362                            },
2363                            method_type: fidl::MethodType::OneWay,
2364                        })
2365                    }
2366                    _ if header
2367                        .dynamic_flags()
2368                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2369                    {
2370                        this.inner.send_framework_err(
2371                            fidl::encoding::FrameworkErr::UnknownMethod,
2372                            header.tx_id,
2373                            header.ordinal,
2374                            header.dynamic_flags(),
2375                            (bytes, handles),
2376                        )?;
2377                        Ok(LutexControllerRequest::_UnknownMethod {
2378                            ordinal: header.ordinal,
2379                            control_handle: LutexControllerControlHandle {
2380                                inner: this.inner.clone(),
2381                            },
2382                            method_type: fidl::MethodType::TwoWay,
2383                        })
2384                    }
2385                    _ => Err(fidl::Error::UnknownOrdinal {
2386                        ordinal: header.ordinal,
2387                        protocol_name:
2388                            <LutexControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2389                    }),
2390                }))
2391            },
2392        )
2393    }
2394}
2395
2396/// Protocol that allows a Fuchsia component to interact with the Linux futexes
2397/// of a process running inside starnix.
2398#[derive(Debug)]
2399pub enum LutexControllerRequest {
2400    /// FUTEX_WAIT_BITSET command
2401    WaitBitset { payload: WaitBitsetRequest, responder: LutexControllerWaitBitsetResponder },
2402    /// FUTEX_WAKE_BITSET command
2403    WakeBitset { payload: WakeBitsetRequest, responder: LutexControllerWakeBitsetResponder },
2404    /// An interaction was received which does not match any known method.
2405    #[non_exhaustive]
2406    _UnknownMethod {
2407        /// Ordinal of the method that was called.
2408        ordinal: u64,
2409        control_handle: LutexControllerControlHandle,
2410        method_type: fidl::MethodType,
2411    },
2412}
2413
2414impl LutexControllerRequest {
2415    #[allow(irrefutable_let_patterns)]
2416    pub fn into_wait_bitset(
2417        self,
2418    ) -> Option<(WaitBitsetRequest, LutexControllerWaitBitsetResponder)> {
2419        if let LutexControllerRequest::WaitBitset { payload, responder } = self {
2420            Some((payload, responder))
2421        } else {
2422            None
2423        }
2424    }
2425
2426    #[allow(irrefutable_let_patterns)]
2427    pub fn into_wake_bitset(
2428        self,
2429    ) -> Option<(WakeBitsetRequest, LutexControllerWakeBitsetResponder)> {
2430        if let LutexControllerRequest::WakeBitset { payload, responder } = self {
2431            Some((payload, responder))
2432        } else {
2433            None
2434        }
2435    }
2436
2437    /// Name of the method defined in FIDL
2438    pub fn method_name(&self) -> &'static str {
2439        match *self {
2440            LutexControllerRequest::WaitBitset { .. } => "wait_bitset",
2441            LutexControllerRequest::WakeBitset { .. } => "wake_bitset",
2442            LutexControllerRequest::_UnknownMethod {
2443                method_type: fidl::MethodType::OneWay,
2444                ..
2445            } => "unknown one-way method",
2446            LutexControllerRequest::_UnknownMethod {
2447                method_type: fidl::MethodType::TwoWay,
2448                ..
2449            } => "unknown two-way method",
2450        }
2451    }
2452}
2453
2454#[derive(Debug, Clone)]
2455pub struct LutexControllerControlHandle {
2456    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2457}
2458
2459impl fidl::endpoints::ControlHandle for LutexControllerControlHandle {
2460    fn shutdown(&self) {
2461        self.inner.shutdown()
2462    }
2463
2464    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2465        self.inner.shutdown_with_epitaph(status)
2466    }
2467
2468    fn is_closed(&self) -> bool {
2469        self.inner.channel().is_closed()
2470    }
2471    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2472        self.inner.channel().on_closed()
2473    }
2474
2475    #[cfg(target_os = "fuchsia")]
2476    fn signal_peer(
2477        &self,
2478        clear_mask: zx::Signals,
2479        set_mask: zx::Signals,
2480    ) -> Result<(), zx_status::Status> {
2481        use fidl::Peered;
2482        self.inner.channel().signal_peer(clear_mask, set_mask)
2483    }
2484}
2485
2486impl LutexControllerControlHandle {}
2487
2488#[must_use = "FIDL methods require a response to be sent"]
2489#[derive(Debug)]
2490pub struct LutexControllerWaitBitsetResponder {
2491    control_handle: std::mem::ManuallyDrop<LutexControllerControlHandle>,
2492    tx_id: u32,
2493}
2494
2495/// Set the the channel to be shutdown (see [`LutexControllerControlHandle::shutdown`])
2496/// if the responder is dropped without sending a response, so that the client
2497/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2498impl std::ops::Drop for LutexControllerWaitBitsetResponder {
2499    fn drop(&mut self) {
2500        self.control_handle.shutdown();
2501        // Safety: drops once, never accessed again
2502        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2503    }
2504}
2505
2506impl fidl::endpoints::Responder for LutexControllerWaitBitsetResponder {
2507    type ControlHandle = LutexControllerControlHandle;
2508
2509    fn control_handle(&self) -> &LutexControllerControlHandle {
2510        &self.control_handle
2511    }
2512
2513    fn drop_without_shutdown(mut self) {
2514        // Safety: drops once, never accessed again due to mem::forget
2515        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2516        // Prevent Drop from running (which would shut down the channel)
2517        std::mem::forget(self);
2518    }
2519}
2520
2521impl LutexControllerWaitBitsetResponder {
2522    /// Sends a response to the FIDL transaction.
2523    ///
2524    /// Sets the channel to shutdown if an error occurs.
2525    pub fn send(
2526        self,
2527        mut result: Result<(), fidl_fuchsia_posix::Errno>,
2528    ) -> Result<(), fidl::Error> {
2529        let _result = self.send_raw(result);
2530        if _result.is_err() {
2531            self.control_handle.shutdown();
2532        }
2533        self.drop_without_shutdown();
2534        _result
2535    }
2536
2537    /// Similar to "send" but does not shutdown the channel if an error occurs.
2538    pub fn send_no_shutdown_on_err(
2539        self,
2540        mut result: Result<(), fidl_fuchsia_posix::Errno>,
2541    ) -> Result<(), fidl::Error> {
2542        let _result = self.send_raw(result);
2543        self.drop_without_shutdown();
2544        _result
2545    }
2546
2547    fn send_raw(
2548        &self,
2549        mut result: Result<(), fidl_fuchsia_posix::Errno>,
2550    ) -> Result<(), fidl::Error> {
2551        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2552            fidl::encoding::EmptyStruct,
2553            fidl_fuchsia_posix::Errno,
2554        >>(
2555            fidl::encoding::FlexibleResult::new(result),
2556            self.tx_id,
2557            0x489feee6787d11b1,
2558            fidl::encoding::DynamicFlags::FLEXIBLE,
2559        )
2560    }
2561}
2562
2563#[must_use = "FIDL methods require a response to be sent"]
2564#[derive(Debug)]
2565pub struct LutexControllerWakeBitsetResponder {
2566    control_handle: std::mem::ManuallyDrop<LutexControllerControlHandle>,
2567    tx_id: u32,
2568}
2569
2570/// Set the the channel to be shutdown (see [`LutexControllerControlHandle::shutdown`])
2571/// if the responder is dropped without sending a response, so that the client
2572/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2573impl std::ops::Drop for LutexControllerWakeBitsetResponder {
2574    fn drop(&mut self) {
2575        self.control_handle.shutdown();
2576        // Safety: drops once, never accessed again
2577        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2578    }
2579}
2580
2581impl fidl::endpoints::Responder for LutexControllerWakeBitsetResponder {
2582    type ControlHandle = LutexControllerControlHandle;
2583
2584    fn control_handle(&self) -> &LutexControllerControlHandle {
2585        &self.control_handle
2586    }
2587
2588    fn drop_without_shutdown(mut self) {
2589        // Safety: drops once, never accessed again due to mem::forget
2590        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2591        // Prevent Drop from running (which would shut down the channel)
2592        std::mem::forget(self);
2593    }
2594}
2595
2596impl LutexControllerWakeBitsetResponder {
2597    /// Sends a response to the FIDL transaction.
2598    ///
2599    /// Sets the channel to shutdown if an error occurs.
2600    pub fn send(
2601        self,
2602        mut result: Result<WakeResponse, fidl_fuchsia_posix::Errno>,
2603    ) -> Result<(), fidl::Error> {
2604        let _result = self.send_raw(result);
2605        if _result.is_err() {
2606            self.control_handle.shutdown();
2607        }
2608        self.drop_without_shutdown();
2609        _result
2610    }
2611
2612    /// Similar to "send" but does not shutdown the channel if an error occurs.
2613    pub fn send_no_shutdown_on_err(
2614        self,
2615        mut result: Result<WakeResponse, fidl_fuchsia_posix::Errno>,
2616    ) -> Result<(), fidl::Error> {
2617        let _result = self.send_raw(result);
2618        self.drop_without_shutdown();
2619        _result
2620    }
2621
2622    fn send_raw(
2623        &self,
2624        mut result: Result<WakeResponse, fidl_fuchsia_posix::Errno>,
2625    ) -> Result<(), fidl::Error> {
2626        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2627            WakeResponse,
2628            fidl_fuchsia_posix::Errno,
2629        >>(
2630            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
2631            self.tx_id,
2632            0x58309f6ebcb0d8eb,
2633            fidl::encoding::DynamicFlags::FLEXIBLE,
2634        )
2635    }
2636}
2637
2638#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2639pub struct ProcessAccessorMarker;
2640
2641impl fidl::endpoints::ProtocolMarker for ProcessAccessorMarker {
2642    type Proxy = ProcessAccessorProxy;
2643    type RequestStream = ProcessAccessorRequestStream;
2644    #[cfg(target_os = "fuchsia")]
2645    type SynchronousProxy = ProcessAccessorSynchronousProxy;
2646
2647    const DEBUG_NAME: &'static str = "(anonymous) ProcessAccessor";
2648}
2649pub type ProcessAccessorWriteMemoryResult = Result<(), fidl_fuchsia_posix::Errno>;
2650pub type ProcessAccessorWriteBytesResult = Result<(), fidl_fuchsia_posix::Errno>;
2651pub type ProcessAccessorFileRequestResult = Result<FileResponse, fidl_fuchsia_posix::Errno>;
2652
2653pub trait ProcessAccessorProxyInterface: Send + Sync {
2654    type WriteMemoryResponseFut: std::future::Future<Output = Result<ProcessAccessorWriteMemoryResult, fidl::Error>>
2655        + Send;
2656    fn r#write_memory(&self, address: u64, content: fidl::Vmo) -> Self::WriteMemoryResponseFut;
2657    type WriteBytesResponseFut: std::future::Future<Output = Result<ProcessAccessorWriteBytesResult, fidl::Error>>
2658        + Send;
2659    fn r#write_bytes(&self, address: u64, bytes: &[u8]) -> Self::WriteBytesResponseFut;
2660    type FileRequestResponseFut: std::future::Future<Output = Result<ProcessAccessorFileRequestResult, fidl::Error>>
2661        + Send;
2662    fn r#file_request(&self, payload: FileRequest) -> Self::FileRequestResponseFut;
2663}
2664#[derive(Debug)]
2665#[cfg(target_os = "fuchsia")]
2666pub struct ProcessAccessorSynchronousProxy {
2667    client: fidl::client::sync::Client,
2668}
2669
2670#[cfg(target_os = "fuchsia")]
2671impl fidl::endpoints::SynchronousProxy for ProcessAccessorSynchronousProxy {
2672    type Proxy = ProcessAccessorProxy;
2673    type Protocol = ProcessAccessorMarker;
2674
2675    fn from_channel(inner: fidl::Channel) -> Self {
2676        Self::new(inner)
2677    }
2678
2679    fn into_channel(self) -> fidl::Channel {
2680        self.client.into_channel()
2681    }
2682
2683    fn as_channel(&self) -> &fidl::Channel {
2684        self.client.as_channel()
2685    }
2686}
2687
2688#[cfg(target_os = "fuchsia")]
2689impl ProcessAccessorSynchronousProxy {
2690    pub fn new(channel: fidl::Channel) -> Self {
2691        Self { client: fidl::client::sync::Client::new(channel) }
2692    }
2693
2694    pub fn into_channel(self) -> fidl::Channel {
2695        self.client.into_channel()
2696    }
2697
2698    /// Waits until an event arrives and returns it. It is safe for other
2699    /// threads to make concurrent requests while waiting for an event.
2700    pub fn wait_for_event(
2701        &self,
2702        deadline: zx::MonotonicInstant,
2703    ) -> Result<ProcessAccessorEvent, fidl::Error> {
2704        ProcessAccessorEvent::decode(self.client.wait_for_event::<ProcessAccessorMarker>(deadline)?)
2705    }
2706
2707    /// Writes the contents of `content` to `address` in the process memory,
2708    /// using the vmo content size to determine the number of bytes to write.
2709    pub fn r#write_memory(
2710        &self,
2711        mut address: u64,
2712        mut content: fidl::Vmo,
2713        ___deadline: zx::MonotonicInstant,
2714    ) -> Result<ProcessAccessorWriteMemoryResult, fidl::Error> {
2715        let _response = self
2716            .client
2717            .send_query::<ProcessAccessorWriteMemoryRequest, fidl::encoding::FlexibleResultType<
2718                fidl::encoding::EmptyStruct,
2719                fidl_fuchsia_posix::Errno,
2720            >, ProcessAccessorMarker>(
2721                (address, content),
2722                0x666cda7c6b6d4819,
2723                fidl::encoding::DynamicFlags::FLEXIBLE,
2724                ___deadline,
2725            )?
2726            .into_result::<ProcessAccessorMarker>("write_memory")?;
2727        Ok(_response.map(|x| x))
2728    }
2729
2730    /// Writes the contents of `bytes` to `address` in the process memory.
2731    /// `WriteBytes` is functionally equivalent to `WriteMemory`, but is
2732    /// optimized for small writes of less than `MAX_WRITE_BYTES`.
2733    pub fn r#write_bytes(
2734        &self,
2735        mut address: u64,
2736        mut bytes: &[u8],
2737        ___deadline: zx::MonotonicInstant,
2738    ) -> Result<ProcessAccessorWriteBytesResult, fidl::Error> {
2739        let _response = self
2740            .client
2741            .send_query::<ProcessAccessorWriteBytesRequest, fidl::encoding::FlexibleResultType<
2742                fidl::encoding::EmptyStruct,
2743                fidl_fuchsia_posix::Errno,
2744            >, ProcessAccessorMarker>(
2745                (address, bytes),
2746                0x6f94296329cb8d17,
2747                fidl::encoding::DynamicFlags::FLEXIBLE,
2748                ___deadline,
2749            )?
2750            .into_result::<ProcessAccessorMarker>("write_bytes")?;
2751        Ok(_response.map(|x| x))
2752    }
2753
2754    /// Execute the given `request` and returns the associated `response`. Any
2755    /// failure will interrupt further processing and fail this operation and
2756    /// the associated errno will be then returned.
2757    /// The implementator of this protocol should handle these requests as best
2758    /// it can so that a failure doesn't have visible side-effects.
2759    pub fn r#file_request(
2760        &self,
2761        mut payload: FileRequest,
2762        ___deadline: zx::MonotonicInstant,
2763    ) -> Result<ProcessAccessorFileRequestResult, fidl::Error> {
2764        let _response = self.client.send_query::<
2765            FileRequest,
2766            fidl::encoding::FlexibleResultType<FileResponse, fidl_fuchsia_posix::Errno>,
2767            ProcessAccessorMarker,
2768        >(
2769            &mut payload,
2770            0xd42103a37c3f0a,
2771            fidl::encoding::DynamicFlags::FLEXIBLE,
2772            ___deadline,
2773        )?
2774        .into_result::<ProcessAccessorMarker>("file_request")?;
2775        Ok(_response.map(|x| x))
2776    }
2777}
2778
2779#[cfg(target_os = "fuchsia")]
2780impl From<ProcessAccessorSynchronousProxy> for zx::NullableHandle {
2781    fn from(value: ProcessAccessorSynchronousProxy) -> Self {
2782        value.into_channel().into()
2783    }
2784}
2785
2786#[cfg(target_os = "fuchsia")]
2787impl From<fidl::Channel> for ProcessAccessorSynchronousProxy {
2788    fn from(value: fidl::Channel) -> Self {
2789        Self::new(value)
2790    }
2791}
2792
2793#[cfg(target_os = "fuchsia")]
2794impl fidl::endpoints::FromClient for ProcessAccessorSynchronousProxy {
2795    type Protocol = ProcessAccessorMarker;
2796
2797    fn from_client(value: fidl::endpoints::ClientEnd<ProcessAccessorMarker>) -> Self {
2798        Self::new(value.into_channel())
2799    }
2800}
2801
2802#[derive(Debug, Clone)]
2803pub struct ProcessAccessorProxy {
2804    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2805}
2806
2807impl fidl::endpoints::Proxy for ProcessAccessorProxy {
2808    type Protocol = ProcessAccessorMarker;
2809
2810    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2811        Self::new(inner)
2812    }
2813
2814    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2815        self.client.into_channel().map_err(|client| Self { client })
2816    }
2817
2818    fn as_channel(&self) -> &::fidl::AsyncChannel {
2819        self.client.as_channel()
2820    }
2821}
2822
2823impl ProcessAccessorProxy {
2824    /// Create a new Proxy for fuchsia.starnix.binder/ProcessAccessor.
2825    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2826        let protocol_name = <ProcessAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2827        Self { client: fidl::client::Client::new(channel, protocol_name) }
2828    }
2829
2830    /// Get a Stream of events from the remote end of the protocol.
2831    ///
2832    /// # Panics
2833    ///
2834    /// Panics if the event stream was already taken.
2835    pub fn take_event_stream(&self) -> ProcessAccessorEventStream {
2836        ProcessAccessorEventStream { event_receiver: self.client.take_event_receiver() }
2837    }
2838
2839    /// Writes the contents of `content` to `address` in the process memory,
2840    /// using the vmo content size to determine the number of bytes to write.
2841    pub fn r#write_memory(
2842        &self,
2843        mut address: u64,
2844        mut content: fidl::Vmo,
2845    ) -> fidl::client::QueryResponseFut<
2846        ProcessAccessorWriteMemoryResult,
2847        fidl::encoding::DefaultFuchsiaResourceDialect,
2848    > {
2849        ProcessAccessorProxyInterface::r#write_memory(self, address, content)
2850    }
2851
2852    /// Writes the contents of `bytes` to `address` in the process memory.
2853    /// `WriteBytes` is functionally equivalent to `WriteMemory`, but is
2854    /// optimized for small writes of less than `MAX_WRITE_BYTES`.
2855    pub fn r#write_bytes(
2856        &self,
2857        mut address: u64,
2858        mut bytes: &[u8],
2859    ) -> fidl::client::QueryResponseFut<
2860        ProcessAccessorWriteBytesResult,
2861        fidl::encoding::DefaultFuchsiaResourceDialect,
2862    > {
2863        ProcessAccessorProxyInterface::r#write_bytes(self, address, bytes)
2864    }
2865
2866    /// Execute the given `request` and returns the associated `response`. Any
2867    /// failure will interrupt further processing and fail this operation and
2868    /// the associated errno will be then returned.
2869    /// The implementator of this protocol should handle these requests as best
2870    /// it can so that a failure doesn't have visible side-effects.
2871    pub fn r#file_request(
2872        &self,
2873        mut payload: FileRequest,
2874    ) -> fidl::client::QueryResponseFut<
2875        ProcessAccessorFileRequestResult,
2876        fidl::encoding::DefaultFuchsiaResourceDialect,
2877    > {
2878        ProcessAccessorProxyInterface::r#file_request(self, payload)
2879    }
2880}
2881
2882impl ProcessAccessorProxyInterface for ProcessAccessorProxy {
2883    type WriteMemoryResponseFut = fidl::client::QueryResponseFut<
2884        ProcessAccessorWriteMemoryResult,
2885        fidl::encoding::DefaultFuchsiaResourceDialect,
2886    >;
2887    fn r#write_memory(
2888        &self,
2889        mut address: u64,
2890        mut content: fidl::Vmo,
2891    ) -> Self::WriteMemoryResponseFut {
2892        fn _decode(
2893            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2894        ) -> Result<ProcessAccessorWriteMemoryResult, fidl::Error> {
2895            let _response = fidl::client::decode_transaction_body::<
2896                fidl::encoding::FlexibleResultType<
2897                    fidl::encoding::EmptyStruct,
2898                    fidl_fuchsia_posix::Errno,
2899                >,
2900                fidl::encoding::DefaultFuchsiaResourceDialect,
2901                0x666cda7c6b6d4819,
2902            >(_buf?)?
2903            .into_result::<ProcessAccessorMarker>("write_memory")?;
2904            Ok(_response.map(|x| x))
2905        }
2906        self.client.send_query_and_decode::<
2907            ProcessAccessorWriteMemoryRequest,
2908            ProcessAccessorWriteMemoryResult,
2909        >(
2910            (address, content,),
2911            0x666cda7c6b6d4819,
2912            fidl::encoding::DynamicFlags::FLEXIBLE,
2913            _decode,
2914        )
2915    }
2916
2917    type WriteBytesResponseFut = fidl::client::QueryResponseFut<
2918        ProcessAccessorWriteBytesResult,
2919        fidl::encoding::DefaultFuchsiaResourceDialect,
2920    >;
2921    fn r#write_bytes(&self, mut address: u64, mut bytes: &[u8]) -> Self::WriteBytesResponseFut {
2922        fn _decode(
2923            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2924        ) -> Result<ProcessAccessorWriteBytesResult, fidl::Error> {
2925            let _response = fidl::client::decode_transaction_body::<
2926                fidl::encoding::FlexibleResultType<
2927                    fidl::encoding::EmptyStruct,
2928                    fidl_fuchsia_posix::Errno,
2929                >,
2930                fidl::encoding::DefaultFuchsiaResourceDialect,
2931                0x6f94296329cb8d17,
2932            >(_buf?)?
2933            .into_result::<ProcessAccessorMarker>("write_bytes")?;
2934            Ok(_response.map(|x| x))
2935        }
2936        self.client.send_query_and_decode::<
2937            ProcessAccessorWriteBytesRequest,
2938            ProcessAccessorWriteBytesResult,
2939        >(
2940            (address, bytes,),
2941            0x6f94296329cb8d17,
2942            fidl::encoding::DynamicFlags::FLEXIBLE,
2943            _decode,
2944        )
2945    }
2946
2947    type FileRequestResponseFut = fidl::client::QueryResponseFut<
2948        ProcessAccessorFileRequestResult,
2949        fidl::encoding::DefaultFuchsiaResourceDialect,
2950    >;
2951    fn r#file_request(&self, mut payload: FileRequest) -> Self::FileRequestResponseFut {
2952        fn _decode(
2953            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2954        ) -> Result<ProcessAccessorFileRequestResult, fidl::Error> {
2955            let _response = fidl::client::decode_transaction_body::<
2956                fidl::encoding::FlexibleResultType<FileResponse, fidl_fuchsia_posix::Errno>,
2957                fidl::encoding::DefaultFuchsiaResourceDialect,
2958                0xd42103a37c3f0a,
2959            >(_buf?)?
2960            .into_result::<ProcessAccessorMarker>("file_request")?;
2961            Ok(_response.map(|x| x))
2962        }
2963        self.client.send_query_and_decode::<FileRequest, ProcessAccessorFileRequestResult>(
2964            &mut payload,
2965            0xd42103a37c3f0a,
2966            fidl::encoding::DynamicFlags::FLEXIBLE,
2967            _decode,
2968        )
2969    }
2970}
2971
2972pub struct ProcessAccessorEventStream {
2973    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2974}
2975
2976impl std::marker::Unpin for ProcessAccessorEventStream {}
2977
2978impl futures::stream::FusedStream for ProcessAccessorEventStream {
2979    fn is_terminated(&self) -> bool {
2980        self.event_receiver.is_terminated()
2981    }
2982}
2983
2984impl futures::Stream for ProcessAccessorEventStream {
2985    type Item = Result<ProcessAccessorEvent, fidl::Error>;
2986
2987    fn poll_next(
2988        mut self: std::pin::Pin<&mut Self>,
2989        cx: &mut std::task::Context<'_>,
2990    ) -> std::task::Poll<Option<Self::Item>> {
2991        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2992            &mut self.event_receiver,
2993            cx
2994        )?) {
2995            Some(buf) => std::task::Poll::Ready(Some(ProcessAccessorEvent::decode(buf))),
2996            None => std::task::Poll::Ready(None),
2997        }
2998    }
2999}
3000
3001#[derive(Debug)]
3002pub enum ProcessAccessorEvent {
3003    #[non_exhaustive]
3004    _UnknownEvent {
3005        /// Ordinal of the event that was sent.
3006        ordinal: u64,
3007    },
3008}
3009
3010impl ProcessAccessorEvent {
3011    /// Decodes a message buffer as a [`ProcessAccessorEvent`].
3012    fn decode(
3013        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3014    ) -> Result<ProcessAccessorEvent, fidl::Error> {
3015        let (bytes, _handles) = buf.split_mut();
3016        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3017        debug_assert_eq!(tx_header.tx_id, 0);
3018        match tx_header.ordinal {
3019            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3020                Ok(ProcessAccessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3021            }
3022            _ => Err(fidl::Error::UnknownOrdinal {
3023                ordinal: tx_header.ordinal,
3024                protocol_name:
3025                    <ProcessAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3026            }),
3027        }
3028    }
3029}
3030
3031/// A Stream of incoming requests for fuchsia.starnix.binder/ProcessAccessor.
3032pub struct ProcessAccessorRequestStream {
3033    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3034    is_terminated: bool,
3035}
3036
3037impl std::marker::Unpin for ProcessAccessorRequestStream {}
3038
3039impl futures::stream::FusedStream for ProcessAccessorRequestStream {
3040    fn is_terminated(&self) -> bool {
3041        self.is_terminated
3042    }
3043}
3044
3045impl fidl::endpoints::RequestStream for ProcessAccessorRequestStream {
3046    type Protocol = ProcessAccessorMarker;
3047    type ControlHandle = ProcessAccessorControlHandle;
3048
3049    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3050        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3051    }
3052
3053    fn control_handle(&self) -> Self::ControlHandle {
3054        ProcessAccessorControlHandle { inner: self.inner.clone() }
3055    }
3056
3057    fn into_inner(
3058        self,
3059    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3060    {
3061        (self.inner, self.is_terminated)
3062    }
3063
3064    fn from_inner(
3065        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3066        is_terminated: bool,
3067    ) -> Self {
3068        Self { inner, is_terminated }
3069    }
3070}
3071
3072impl futures::Stream for ProcessAccessorRequestStream {
3073    type Item = Result<ProcessAccessorRequest, fidl::Error>;
3074
3075    fn poll_next(
3076        mut self: std::pin::Pin<&mut Self>,
3077        cx: &mut std::task::Context<'_>,
3078    ) -> std::task::Poll<Option<Self::Item>> {
3079        let this = &mut *self;
3080        if this.inner.check_shutdown(cx) {
3081            this.is_terminated = true;
3082            return std::task::Poll::Ready(None);
3083        }
3084        if this.is_terminated {
3085            panic!("polled ProcessAccessorRequestStream after completion");
3086        }
3087        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3088            |bytes, handles| {
3089                match this.inner.channel().read_etc(cx, bytes, handles) {
3090                    std::task::Poll::Ready(Ok(())) => {}
3091                    std::task::Poll::Pending => return std::task::Poll::Pending,
3092                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3093                        this.is_terminated = true;
3094                        return std::task::Poll::Ready(None);
3095                    }
3096                    std::task::Poll::Ready(Err(e)) => {
3097                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3098                            e.into(),
3099                        ))));
3100                    }
3101                }
3102
3103                // A message has been received from the channel
3104                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3105
3106                std::task::Poll::Ready(Some(match header.ordinal {
3107                    0x666cda7c6b6d4819 => {
3108                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3109                        let mut req = fidl::new_empty!(
3110                            ProcessAccessorWriteMemoryRequest,
3111                            fidl::encoding::DefaultFuchsiaResourceDialect
3112                        );
3113                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProcessAccessorWriteMemoryRequest>(&header, _body_bytes, handles, &mut req)?;
3114                        let control_handle =
3115                            ProcessAccessorControlHandle { inner: this.inner.clone() };
3116                        Ok(ProcessAccessorRequest::WriteMemory {
3117                            address: req.address,
3118                            content: req.content,
3119
3120                            responder: ProcessAccessorWriteMemoryResponder {
3121                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3122                                tx_id: header.tx_id,
3123                            },
3124                        })
3125                    }
3126                    0x6f94296329cb8d17 => {
3127                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3128                        let mut req = fidl::new_empty!(
3129                            ProcessAccessorWriteBytesRequest,
3130                            fidl::encoding::DefaultFuchsiaResourceDialect
3131                        );
3132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProcessAccessorWriteBytesRequest>(&header, _body_bytes, handles, &mut req)?;
3133                        let control_handle =
3134                            ProcessAccessorControlHandle { inner: this.inner.clone() };
3135                        Ok(ProcessAccessorRequest::WriteBytes {
3136                            address: req.address,
3137                            bytes: req.bytes,
3138
3139                            responder: ProcessAccessorWriteBytesResponder {
3140                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3141                                tx_id: header.tx_id,
3142                            },
3143                        })
3144                    }
3145                    0xd42103a37c3f0a => {
3146                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3147                        let mut req = fidl::new_empty!(
3148                            FileRequest,
3149                            fidl::encoding::DefaultFuchsiaResourceDialect
3150                        );
3151                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FileRequest>(&header, _body_bytes, handles, &mut req)?;
3152                        let control_handle =
3153                            ProcessAccessorControlHandle { inner: this.inner.clone() };
3154                        Ok(ProcessAccessorRequest::FileRequest {
3155                            payload: req,
3156                            responder: ProcessAccessorFileRequestResponder {
3157                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3158                                tx_id: header.tx_id,
3159                            },
3160                        })
3161                    }
3162                    _ if header.tx_id == 0
3163                        && header
3164                            .dynamic_flags()
3165                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3166                    {
3167                        Ok(ProcessAccessorRequest::_UnknownMethod {
3168                            ordinal: header.ordinal,
3169                            control_handle: ProcessAccessorControlHandle {
3170                                inner: this.inner.clone(),
3171                            },
3172                            method_type: fidl::MethodType::OneWay,
3173                        })
3174                    }
3175                    _ if header
3176                        .dynamic_flags()
3177                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3178                    {
3179                        this.inner.send_framework_err(
3180                            fidl::encoding::FrameworkErr::UnknownMethod,
3181                            header.tx_id,
3182                            header.ordinal,
3183                            header.dynamic_flags(),
3184                            (bytes, handles),
3185                        )?;
3186                        Ok(ProcessAccessorRequest::_UnknownMethod {
3187                            ordinal: header.ordinal,
3188                            control_handle: ProcessAccessorControlHandle {
3189                                inner: this.inner.clone(),
3190                            },
3191                            method_type: fidl::MethodType::TwoWay,
3192                        })
3193                    }
3194                    _ => Err(fidl::Error::UnknownOrdinal {
3195                        ordinal: header.ordinal,
3196                        protocol_name:
3197                            <ProcessAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3198                    }),
3199                }))
3200            },
3201        )
3202    }
3203}
3204
3205/// Protocol that gives the binder driver access to the client process'
3206/// resources.
3207#[derive(Debug)]
3208pub enum ProcessAccessorRequest {
3209    /// Writes the contents of `content` to `address` in the process memory,
3210    /// using the vmo content size to determine the number of bytes to write.
3211    WriteMemory { address: u64, content: fidl::Vmo, responder: ProcessAccessorWriteMemoryResponder },
3212    /// Writes the contents of `bytes` to `address` in the process memory.
3213    /// `WriteBytes` is functionally equivalent to `WriteMemory`, but is
3214    /// optimized for small writes of less than `MAX_WRITE_BYTES`.
3215    WriteBytes { address: u64, bytes: Vec<u8>, responder: ProcessAccessorWriteBytesResponder },
3216    /// Execute the given `request` and returns the associated `response`. Any
3217    /// failure will interrupt further processing and fail this operation and
3218    /// the associated errno will be then returned.
3219    /// The implementator of this protocol should handle these requests as best
3220    /// it can so that a failure doesn't have visible side-effects.
3221    FileRequest { payload: FileRequest, responder: ProcessAccessorFileRequestResponder },
3222    /// An interaction was received which does not match any known method.
3223    #[non_exhaustive]
3224    _UnknownMethod {
3225        /// Ordinal of the method that was called.
3226        ordinal: u64,
3227        control_handle: ProcessAccessorControlHandle,
3228        method_type: fidl::MethodType,
3229    },
3230}
3231
3232impl ProcessAccessorRequest {
3233    #[allow(irrefutable_let_patterns)]
3234    pub fn into_write_memory(
3235        self,
3236    ) -> Option<(u64, fidl::Vmo, ProcessAccessorWriteMemoryResponder)> {
3237        if let ProcessAccessorRequest::WriteMemory { address, content, responder } = self {
3238            Some((address, content, responder))
3239        } else {
3240            None
3241        }
3242    }
3243
3244    #[allow(irrefutable_let_patterns)]
3245    pub fn into_write_bytes(self) -> Option<(u64, Vec<u8>, ProcessAccessorWriteBytesResponder)> {
3246        if let ProcessAccessorRequest::WriteBytes { address, bytes, responder } = self {
3247            Some((address, bytes, responder))
3248        } else {
3249            None
3250        }
3251    }
3252
3253    #[allow(irrefutable_let_patterns)]
3254    pub fn into_file_request(self) -> Option<(FileRequest, ProcessAccessorFileRequestResponder)> {
3255        if let ProcessAccessorRequest::FileRequest { payload, responder } = self {
3256            Some((payload, responder))
3257        } else {
3258            None
3259        }
3260    }
3261
3262    /// Name of the method defined in FIDL
3263    pub fn method_name(&self) -> &'static str {
3264        match *self {
3265            ProcessAccessorRequest::WriteMemory { .. } => "write_memory",
3266            ProcessAccessorRequest::WriteBytes { .. } => "write_bytes",
3267            ProcessAccessorRequest::FileRequest { .. } => "file_request",
3268            ProcessAccessorRequest::_UnknownMethod {
3269                method_type: fidl::MethodType::OneWay,
3270                ..
3271            } => "unknown one-way method",
3272            ProcessAccessorRequest::_UnknownMethod {
3273                method_type: fidl::MethodType::TwoWay,
3274                ..
3275            } => "unknown two-way method",
3276        }
3277    }
3278}
3279
3280#[derive(Debug, Clone)]
3281pub struct ProcessAccessorControlHandle {
3282    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3283}
3284
3285impl fidl::endpoints::ControlHandle for ProcessAccessorControlHandle {
3286    fn shutdown(&self) {
3287        self.inner.shutdown()
3288    }
3289
3290    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3291        self.inner.shutdown_with_epitaph(status)
3292    }
3293
3294    fn is_closed(&self) -> bool {
3295        self.inner.channel().is_closed()
3296    }
3297    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3298        self.inner.channel().on_closed()
3299    }
3300
3301    #[cfg(target_os = "fuchsia")]
3302    fn signal_peer(
3303        &self,
3304        clear_mask: zx::Signals,
3305        set_mask: zx::Signals,
3306    ) -> Result<(), zx_status::Status> {
3307        use fidl::Peered;
3308        self.inner.channel().signal_peer(clear_mask, set_mask)
3309    }
3310}
3311
3312impl ProcessAccessorControlHandle {}
3313
3314#[must_use = "FIDL methods require a response to be sent"]
3315#[derive(Debug)]
3316pub struct ProcessAccessorWriteMemoryResponder {
3317    control_handle: std::mem::ManuallyDrop<ProcessAccessorControlHandle>,
3318    tx_id: u32,
3319}
3320
3321/// Set the the channel to be shutdown (see [`ProcessAccessorControlHandle::shutdown`])
3322/// if the responder is dropped without sending a response, so that the client
3323/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3324impl std::ops::Drop for ProcessAccessorWriteMemoryResponder {
3325    fn drop(&mut self) {
3326        self.control_handle.shutdown();
3327        // Safety: drops once, never accessed again
3328        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3329    }
3330}
3331
3332impl fidl::endpoints::Responder for ProcessAccessorWriteMemoryResponder {
3333    type ControlHandle = ProcessAccessorControlHandle;
3334
3335    fn control_handle(&self) -> &ProcessAccessorControlHandle {
3336        &self.control_handle
3337    }
3338
3339    fn drop_without_shutdown(mut self) {
3340        // Safety: drops once, never accessed again due to mem::forget
3341        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3342        // Prevent Drop from running (which would shut down the channel)
3343        std::mem::forget(self);
3344    }
3345}
3346
3347impl ProcessAccessorWriteMemoryResponder {
3348    /// Sends a response to the FIDL transaction.
3349    ///
3350    /// Sets the channel to shutdown if an error occurs.
3351    pub fn send(
3352        self,
3353        mut result: Result<(), fidl_fuchsia_posix::Errno>,
3354    ) -> Result<(), fidl::Error> {
3355        let _result = self.send_raw(result);
3356        if _result.is_err() {
3357            self.control_handle.shutdown();
3358        }
3359        self.drop_without_shutdown();
3360        _result
3361    }
3362
3363    /// Similar to "send" but does not shutdown the channel if an error occurs.
3364    pub fn send_no_shutdown_on_err(
3365        self,
3366        mut result: Result<(), fidl_fuchsia_posix::Errno>,
3367    ) -> Result<(), fidl::Error> {
3368        let _result = self.send_raw(result);
3369        self.drop_without_shutdown();
3370        _result
3371    }
3372
3373    fn send_raw(
3374        &self,
3375        mut result: Result<(), fidl_fuchsia_posix::Errno>,
3376    ) -> Result<(), fidl::Error> {
3377        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3378            fidl::encoding::EmptyStruct,
3379            fidl_fuchsia_posix::Errno,
3380        >>(
3381            fidl::encoding::FlexibleResult::new(result),
3382            self.tx_id,
3383            0x666cda7c6b6d4819,
3384            fidl::encoding::DynamicFlags::FLEXIBLE,
3385        )
3386    }
3387}
3388
3389#[must_use = "FIDL methods require a response to be sent"]
3390#[derive(Debug)]
3391pub struct ProcessAccessorWriteBytesResponder {
3392    control_handle: std::mem::ManuallyDrop<ProcessAccessorControlHandle>,
3393    tx_id: u32,
3394}
3395
3396/// Set the the channel to be shutdown (see [`ProcessAccessorControlHandle::shutdown`])
3397/// if the responder is dropped without sending a response, so that the client
3398/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3399impl std::ops::Drop for ProcessAccessorWriteBytesResponder {
3400    fn drop(&mut self) {
3401        self.control_handle.shutdown();
3402        // Safety: drops once, never accessed again
3403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3404    }
3405}
3406
3407impl fidl::endpoints::Responder for ProcessAccessorWriteBytesResponder {
3408    type ControlHandle = ProcessAccessorControlHandle;
3409
3410    fn control_handle(&self) -> &ProcessAccessorControlHandle {
3411        &self.control_handle
3412    }
3413
3414    fn drop_without_shutdown(mut self) {
3415        // Safety: drops once, never accessed again due to mem::forget
3416        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3417        // Prevent Drop from running (which would shut down the channel)
3418        std::mem::forget(self);
3419    }
3420}
3421
3422impl ProcessAccessorWriteBytesResponder {
3423    /// Sends a response to the FIDL transaction.
3424    ///
3425    /// Sets the channel to shutdown if an error occurs.
3426    pub fn send(
3427        self,
3428        mut result: Result<(), fidl_fuchsia_posix::Errno>,
3429    ) -> Result<(), fidl::Error> {
3430        let _result = self.send_raw(result);
3431        if _result.is_err() {
3432            self.control_handle.shutdown();
3433        }
3434        self.drop_without_shutdown();
3435        _result
3436    }
3437
3438    /// Similar to "send" but does not shutdown the channel if an error occurs.
3439    pub fn send_no_shutdown_on_err(
3440        self,
3441        mut result: Result<(), fidl_fuchsia_posix::Errno>,
3442    ) -> Result<(), fidl::Error> {
3443        let _result = self.send_raw(result);
3444        self.drop_without_shutdown();
3445        _result
3446    }
3447
3448    fn send_raw(
3449        &self,
3450        mut result: Result<(), fidl_fuchsia_posix::Errno>,
3451    ) -> Result<(), fidl::Error> {
3452        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3453            fidl::encoding::EmptyStruct,
3454            fidl_fuchsia_posix::Errno,
3455        >>(
3456            fidl::encoding::FlexibleResult::new(result),
3457            self.tx_id,
3458            0x6f94296329cb8d17,
3459            fidl::encoding::DynamicFlags::FLEXIBLE,
3460        )
3461    }
3462}
3463
3464#[must_use = "FIDL methods require a response to be sent"]
3465#[derive(Debug)]
3466pub struct ProcessAccessorFileRequestResponder {
3467    control_handle: std::mem::ManuallyDrop<ProcessAccessorControlHandle>,
3468    tx_id: u32,
3469}
3470
3471/// Set the the channel to be shutdown (see [`ProcessAccessorControlHandle::shutdown`])
3472/// if the responder is dropped without sending a response, so that the client
3473/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3474impl std::ops::Drop for ProcessAccessorFileRequestResponder {
3475    fn drop(&mut self) {
3476        self.control_handle.shutdown();
3477        // Safety: drops once, never accessed again
3478        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3479    }
3480}
3481
3482impl fidl::endpoints::Responder for ProcessAccessorFileRequestResponder {
3483    type ControlHandle = ProcessAccessorControlHandle;
3484
3485    fn control_handle(&self) -> &ProcessAccessorControlHandle {
3486        &self.control_handle
3487    }
3488
3489    fn drop_without_shutdown(mut self) {
3490        // Safety: drops once, never accessed again due to mem::forget
3491        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3492        // Prevent Drop from running (which would shut down the channel)
3493        std::mem::forget(self);
3494    }
3495}
3496
3497impl ProcessAccessorFileRequestResponder {
3498    /// Sends a response to the FIDL transaction.
3499    ///
3500    /// Sets the channel to shutdown if an error occurs.
3501    pub fn send(
3502        self,
3503        mut result: Result<FileResponse, fidl_fuchsia_posix::Errno>,
3504    ) -> Result<(), fidl::Error> {
3505        let _result = self.send_raw(result);
3506        if _result.is_err() {
3507            self.control_handle.shutdown();
3508        }
3509        self.drop_without_shutdown();
3510        _result
3511    }
3512
3513    /// Similar to "send" but does not shutdown the channel if an error occurs.
3514    pub fn send_no_shutdown_on_err(
3515        self,
3516        mut result: Result<FileResponse, fidl_fuchsia_posix::Errno>,
3517    ) -> Result<(), fidl::Error> {
3518        let _result = self.send_raw(result);
3519        self.drop_without_shutdown();
3520        _result
3521    }
3522
3523    fn send_raw(
3524        &self,
3525        mut result: Result<FileResponse, fidl_fuchsia_posix::Errno>,
3526    ) -> Result<(), fidl::Error> {
3527        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3528            FileResponse,
3529            fidl_fuchsia_posix::Errno,
3530        >>(
3531            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
3532            self.tx_id,
3533            0xd42103a37c3f0a,
3534            fidl::encoding::DynamicFlags::FLEXIBLE,
3535        )
3536    }
3537}
3538
3539#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3540pub struct RemoteControllerMarker;
3541
3542impl fidl::endpoints::ProtocolMarker for RemoteControllerMarker {
3543    type Proxy = RemoteControllerProxy;
3544    type RequestStream = RemoteControllerRequestStream;
3545    #[cfg(target_os = "fuchsia")]
3546    type SynchronousProxy = RemoteControllerSynchronousProxy;
3547
3548    const DEBUG_NAME: &'static str = "fuchsia.starnix.binder.RemoteController";
3549}
3550impl fidl::endpoints::DiscoverableProtocolMarker for RemoteControllerMarker {}
3551
3552pub trait RemoteControllerProxyInterface: Send + Sync {
3553    fn r#start(&self, payload: RemoteControllerStartRequest) -> Result<(), fidl::Error>;
3554}
3555#[derive(Debug)]
3556#[cfg(target_os = "fuchsia")]
3557pub struct RemoteControllerSynchronousProxy {
3558    client: fidl::client::sync::Client,
3559}
3560
3561#[cfg(target_os = "fuchsia")]
3562impl fidl::endpoints::SynchronousProxy for RemoteControllerSynchronousProxy {
3563    type Proxy = RemoteControllerProxy;
3564    type Protocol = RemoteControllerMarker;
3565
3566    fn from_channel(inner: fidl::Channel) -> Self {
3567        Self::new(inner)
3568    }
3569
3570    fn into_channel(self) -> fidl::Channel {
3571        self.client.into_channel()
3572    }
3573
3574    fn as_channel(&self) -> &fidl::Channel {
3575        self.client.as_channel()
3576    }
3577}
3578
3579#[cfg(target_os = "fuchsia")]
3580impl RemoteControllerSynchronousProxy {
3581    pub fn new(channel: fidl::Channel) -> Self {
3582        Self { client: fidl::client::sync::Client::new(channel) }
3583    }
3584
3585    pub fn into_channel(self) -> fidl::Channel {
3586        self.client.into_channel()
3587    }
3588
3589    /// Waits until an event arrives and returns it. It is safe for other
3590    /// threads to make concurrent requests while waiting for an event.
3591    pub fn wait_for_event(
3592        &self,
3593        deadline: zx::MonotonicInstant,
3594    ) -> Result<RemoteControllerEvent, fidl::Error> {
3595        RemoteControllerEvent::decode(
3596            self.client.wait_for_event::<RemoteControllerMarker>(deadline)?,
3597        )
3598    }
3599
3600    /// Called by the Starnix kernel when it requires the remote Fuchsia
3601    /// component to start servicing the binder protocol.
3602    pub fn r#start(&self, mut payload: RemoteControllerStartRequest) -> Result<(), fidl::Error> {
3603        self.client.send::<RemoteControllerStartRequest>(
3604            &mut payload,
3605            0x72ecbe863c65f4cf,
3606            fidl::encoding::DynamicFlags::FLEXIBLE,
3607        )
3608    }
3609}
3610
3611#[cfg(target_os = "fuchsia")]
3612impl From<RemoteControllerSynchronousProxy> for zx::NullableHandle {
3613    fn from(value: RemoteControllerSynchronousProxy) -> Self {
3614        value.into_channel().into()
3615    }
3616}
3617
3618#[cfg(target_os = "fuchsia")]
3619impl From<fidl::Channel> for RemoteControllerSynchronousProxy {
3620    fn from(value: fidl::Channel) -> Self {
3621        Self::new(value)
3622    }
3623}
3624
3625#[cfg(target_os = "fuchsia")]
3626impl fidl::endpoints::FromClient for RemoteControllerSynchronousProxy {
3627    type Protocol = RemoteControllerMarker;
3628
3629    fn from_client(value: fidl::endpoints::ClientEnd<RemoteControllerMarker>) -> Self {
3630        Self::new(value.into_channel())
3631    }
3632}
3633
3634#[derive(Debug, Clone)]
3635pub struct RemoteControllerProxy {
3636    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3637}
3638
3639impl fidl::endpoints::Proxy for RemoteControllerProxy {
3640    type Protocol = RemoteControllerMarker;
3641
3642    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3643        Self::new(inner)
3644    }
3645
3646    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3647        self.client.into_channel().map_err(|client| Self { client })
3648    }
3649
3650    fn as_channel(&self) -> &::fidl::AsyncChannel {
3651        self.client.as_channel()
3652    }
3653}
3654
3655impl RemoteControllerProxy {
3656    /// Create a new Proxy for fuchsia.starnix.binder/RemoteController.
3657    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3658        let protocol_name = <RemoteControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3659        Self { client: fidl::client::Client::new(channel, protocol_name) }
3660    }
3661
3662    /// Get a Stream of events from the remote end of the protocol.
3663    ///
3664    /// # Panics
3665    ///
3666    /// Panics if the event stream was already taken.
3667    pub fn take_event_stream(&self) -> RemoteControllerEventStream {
3668        RemoteControllerEventStream { event_receiver: self.client.take_event_receiver() }
3669    }
3670
3671    /// Called by the Starnix kernel when it requires the remote Fuchsia
3672    /// component to start servicing the binder protocol.
3673    pub fn r#start(&self, mut payload: RemoteControllerStartRequest) -> Result<(), fidl::Error> {
3674        RemoteControllerProxyInterface::r#start(self, payload)
3675    }
3676}
3677
3678impl RemoteControllerProxyInterface for RemoteControllerProxy {
3679    fn r#start(&self, mut payload: RemoteControllerStartRequest) -> Result<(), fidl::Error> {
3680        self.client.send::<RemoteControllerStartRequest>(
3681            &mut payload,
3682            0x72ecbe863c65f4cf,
3683            fidl::encoding::DynamicFlags::FLEXIBLE,
3684        )
3685    }
3686}
3687
3688pub struct RemoteControllerEventStream {
3689    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3690}
3691
3692impl std::marker::Unpin for RemoteControllerEventStream {}
3693
3694impl futures::stream::FusedStream for RemoteControllerEventStream {
3695    fn is_terminated(&self) -> bool {
3696        self.event_receiver.is_terminated()
3697    }
3698}
3699
3700impl futures::Stream for RemoteControllerEventStream {
3701    type Item = Result<RemoteControllerEvent, fidl::Error>;
3702
3703    fn poll_next(
3704        mut self: std::pin::Pin<&mut Self>,
3705        cx: &mut std::task::Context<'_>,
3706    ) -> std::task::Poll<Option<Self::Item>> {
3707        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3708            &mut self.event_receiver,
3709            cx
3710        )?) {
3711            Some(buf) => std::task::Poll::Ready(Some(RemoteControllerEvent::decode(buf))),
3712            None => std::task::Poll::Ready(None),
3713        }
3714    }
3715}
3716
3717#[derive(Debug)]
3718pub enum RemoteControllerEvent {
3719    #[non_exhaustive]
3720    _UnknownEvent {
3721        /// Ordinal of the event that was sent.
3722        ordinal: u64,
3723    },
3724}
3725
3726impl RemoteControllerEvent {
3727    /// Decodes a message buffer as a [`RemoteControllerEvent`].
3728    fn decode(
3729        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3730    ) -> Result<RemoteControllerEvent, fidl::Error> {
3731        let (bytes, _handles) = buf.split_mut();
3732        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3733        debug_assert_eq!(tx_header.tx_id, 0);
3734        match tx_header.ordinal {
3735            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3736                Ok(RemoteControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3737            }
3738            _ => Err(fidl::Error::UnknownOrdinal {
3739                ordinal: tx_header.ordinal,
3740                protocol_name:
3741                    <RemoteControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3742            }),
3743        }
3744    }
3745}
3746
3747/// A Stream of incoming requests for fuchsia.starnix.binder/RemoteController.
3748pub struct RemoteControllerRequestStream {
3749    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3750    is_terminated: bool,
3751}
3752
3753impl std::marker::Unpin for RemoteControllerRequestStream {}
3754
3755impl futures::stream::FusedStream for RemoteControllerRequestStream {
3756    fn is_terminated(&self) -> bool {
3757        self.is_terminated
3758    }
3759}
3760
3761impl fidl::endpoints::RequestStream for RemoteControllerRequestStream {
3762    type Protocol = RemoteControllerMarker;
3763    type ControlHandle = RemoteControllerControlHandle;
3764
3765    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3766        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3767    }
3768
3769    fn control_handle(&self) -> Self::ControlHandle {
3770        RemoteControllerControlHandle { inner: self.inner.clone() }
3771    }
3772
3773    fn into_inner(
3774        self,
3775    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3776    {
3777        (self.inner, self.is_terminated)
3778    }
3779
3780    fn from_inner(
3781        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3782        is_terminated: bool,
3783    ) -> Self {
3784        Self { inner, is_terminated }
3785    }
3786}
3787
3788impl futures::Stream for RemoteControllerRequestStream {
3789    type Item = Result<RemoteControllerRequest, fidl::Error>;
3790
3791    fn poll_next(
3792        mut self: std::pin::Pin<&mut Self>,
3793        cx: &mut std::task::Context<'_>,
3794    ) -> std::task::Poll<Option<Self::Item>> {
3795        let this = &mut *self;
3796        if this.inner.check_shutdown(cx) {
3797            this.is_terminated = true;
3798            return std::task::Poll::Ready(None);
3799        }
3800        if this.is_terminated {
3801            panic!("polled RemoteControllerRequestStream after completion");
3802        }
3803        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3804            |bytes, handles| {
3805                match this.inner.channel().read_etc(cx, bytes, handles) {
3806                    std::task::Poll::Ready(Ok(())) => {}
3807                    std::task::Poll::Pending => return std::task::Poll::Pending,
3808                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3809                        this.is_terminated = true;
3810                        return std::task::Poll::Ready(None);
3811                    }
3812                    std::task::Poll::Ready(Err(e)) => {
3813                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3814                            e.into(),
3815                        ))));
3816                    }
3817                }
3818
3819                // A message has been received from the channel
3820                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3821
3822                std::task::Poll::Ready(Some(match header.ordinal {
3823                    0x72ecbe863c65f4cf => {
3824                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3825                        let mut req = fidl::new_empty!(
3826                            RemoteControllerStartRequest,
3827                            fidl::encoding::DefaultFuchsiaResourceDialect
3828                        );
3829                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteControllerStartRequest>(&header, _body_bytes, handles, &mut req)?;
3830                        let control_handle =
3831                            RemoteControllerControlHandle { inner: this.inner.clone() };
3832                        Ok(RemoteControllerRequest::Start { payload: req, control_handle })
3833                    }
3834                    _ if header.tx_id == 0
3835                        && header
3836                            .dynamic_flags()
3837                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3838                    {
3839                        Ok(RemoteControllerRequest::_UnknownMethod {
3840                            ordinal: header.ordinal,
3841                            control_handle: RemoteControllerControlHandle {
3842                                inner: this.inner.clone(),
3843                            },
3844                            method_type: fidl::MethodType::OneWay,
3845                        })
3846                    }
3847                    _ if header
3848                        .dynamic_flags()
3849                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3850                    {
3851                        this.inner.send_framework_err(
3852                            fidl::encoding::FrameworkErr::UnknownMethod,
3853                            header.tx_id,
3854                            header.ordinal,
3855                            header.dynamic_flags(),
3856                            (bytes, handles),
3857                        )?;
3858                        Ok(RemoteControllerRequest::_UnknownMethod {
3859                            ordinal: header.ordinal,
3860                            control_handle: RemoteControllerControlHandle {
3861                                inner: this.inner.clone(),
3862                            },
3863                            method_type: fidl::MethodType::TwoWay,
3864                        })
3865                    }
3866                    _ => Err(fidl::Error::UnknownOrdinal {
3867                        ordinal: header.ordinal,
3868                        protocol_name:
3869                            <RemoteControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3870                    }),
3871                }))
3872            },
3873        )
3874    }
3875}
3876
3877/// Protocol that allows Starnix to control binder servers and clients in other
3878/// Fuchsia components.
3879#[derive(Debug)]
3880pub enum RemoteControllerRequest {
3881    /// Called by the Starnix kernel when it requires the remote Fuchsia
3882    /// component to start servicing the binder protocol.
3883    Start { payload: RemoteControllerStartRequest, control_handle: RemoteControllerControlHandle },
3884    /// An interaction was received which does not match any known method.
3885    #[non_exhaustive]
3886    _UnknownMethod {
3887        /// Ordinal of the method that was called.
3888        ordinal: u64,
3889        control_handle: RemoteControllerControlHandle,
3890        method_type: fidl::MethodType,
3891    },
3892}
3893
3894impl RemoteControllerRequest {
3895    #[allow(irrefutable_let_patterns)]
3896    pub fn into_start(
3897        self,
3898    ) -> Option<(RemoteControllerStartRequest, RemoteControllerControlHandle)> {
3899        if let RemoteControllerRequest::Start { payload, control_handle } = self {
3900            Some((payload, control_handle))
3901        } else {
3902            None
3903        }
3904    }
3905
3906    /// Name of the method defined in FIDL
3907    pub fn method_name(&self) -> &'static str {
3908        match *self {
3909            RemoteControllerRequest::Start { .. } => "start",
3910            RemoteControllerRequest::_UnknownMethod {
3911                method_type: fidl::MethodType::OneWay,
3912                ..
3913            } => "unknown one-way method",
3914            RemoteControllerRequest::_UnknownMethod {
3915                method_type: fidl::MethodType::TwoWay,
3916                ..
3917            } => "unknown two-way method",
3918        }
3919    }
3920}
3921
3922#[derive(Debug, Clone)]
3923pub struct RemoteControllerControlHandle {
3924    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3925}
3926
3927impl fidl::endpoints::ControlHandle for RemoteControllerControlHandle {
3928    fn shutdown(&self) {
3929        self.inner.shutdown()
3930    }
3931
3932    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3933        self.inner.shutdown_with_epitaph(status)
3934    }
3935
3936    fn is_closed(&self) -> bool {
3937        self.inner.channel().is_closed()
3938    }
3939    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3940        self.inner.channel().on_closed()
3941    }
3942
3943    #[cfg(target_os = "fuchsia")]
3944    fn signal_peer(
3945        &self,
3946        clear_mask: zx::Signals,
3947        set_mask: zx::Signals,
3948    ) -> Result<(), zx_status::Status> {
3949        use fidl::Peered;
3950        self.inner.channel().signal_peer(clear_mask, set_mask)
3951    }
3952}
3953
3954impl RemoteControllerControlHandle {}
3955
3956#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3957pub struct UnixDomainSocketMarker;
3958
3959impl fidl::endpoints::ProtocolMarker for UnixDomainSocketMarker {
3960    type Proxy = UnixDomainSocketProxy;
3961    type RequestStream = UnixDomainSocketRequestStream;
3962    #[cfg(target_os = "fuchsia")]
3963    type SynchronousProxy = UnixDomainSocketSynchronousProxy;
3964
3965    const DEBUG_NAME: &'static str = "fuchsia.starnix.binder.UnixDomainSocket";
3966}
3967impl fidl::endpoints::DiscoverableProtocolMarker for UnixDomainSocketMarker {}
3968pub type UnixDomainSocketGetEventResult = Result<UnixDomainSocketGetEventResponse, i32>;
3969pub type UnixDomainSocketReadResult = Result<UnixDomainSocketReadResponse, i32>;
3970pub type UnixDomainSocketWriteResult = Result<UnixDomainSocketWriteResponse, i32>;
3971
3972pub trait UnixDomainSocketProxyInterface: Send + Sync {
3973    fn r#clone(
3974        &self,
3975        request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
3976    ) -> Result<(), fidl::Error>;
3977    type CloseResponseFut: std::future::Future<
3978            Output = Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
3979        > + Send;
3980    fn r#close(&self) -> Self::CloseResponseFut;
3981    type QueryResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
3982    fn r#query(&self) -> Self::QueryResponseFut;
3983    type GetEventResponseFut: std::future::Future<Output = Result<UnixDomainSocketGetEventResult, fidl::Error>>
3984        + Send;
3985    fn r#get_event(&self, payload: &UnixDomainSocketGetEventRequest) -> Self::GetEventResponseFut;
3986    type ReadResponseFut: std::future::Future<Output = Result<UnixDomainSocketReadResult, fidl::Error>>
3987        + Send;
3988    fn r#read(&self, payload: &UnixDomainSocketReadRequest) -> Self::ReadResponseFut;
3989    type WriteResponseFut: std::future::Future<Output = Result<UnixDomainSocketWriteResult, fidl::Error>>
3990        + Send;
3991    fn r#write(&self, payload: UnixDomainSocketWriteRequest) -> Self::WriteResponseFut;
3992}
3993#[derive(Debug)]
3994#[cfg(target_os = "fuchsia")]
3995pub struct UnixDomainSocketSynchronousProxy {
3996    client: fidl::client::sync::Client,
3997}
3998
3999#[cfg(target_os = "fuchsia")]
4000impl fidl::endpoints::SynchronousProxy for UnixDomainSocketSynchronousProxy {
4001    type Proxy = UnixDomainSocketProxy;
4002    type Protocol = UnixDomainSocketMarker;
4003
4004    fn from_channel(inner: fidl::Channel) -> Self {
4005        Self::new(inner)
4006    }
4007
4008    fn into_channel(self) -> fidl::Channel {
4009        self.client.into_channel()
4010    }
4011
4012    fn as_channel(&self) -> &fidl::Channel {
4013        self.client.as_channel()
4014    }
4015}
4016
4017#[cfg(target_os = "fuchsia")]
4018impl UnixDomainSocketSynchronousProxy {
4019    pub fn new(channel: fidl::Channel) -> Self {
4020        Self { client: fidl::client::sync::Client::new(channel) }
4021    }
4022
4023    pub fn into_channel(self) -> fidl::Channel {
4024        self.client.into_channel()
4025    }
4026
4027    /// Waits until an event arrives and returns it. It is safe for other
4028    /// threads to make concurrent requests while waiting for an event.
4029    pub fn wait_for_event(
4030        &self,
4031        deadline: zx::MonotonicInstant,
4032    ) -> Result<UnixDomainSocketEvent, fidl::Error> {
4033        UnixDomainSocketEvent::decode(
4034            self.client.wait_for_event::<UnixDomainSocketMarker>(deadline)?,
4035        )
4036    }
4037
4038    pub fn r#clone(
4039        &self,
4040        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
4041    ) -> Result<(), fidl::Error> {
4042        self.client.send::<fidl_fuchsia_unknown::CloneableCloneRequest>(
4043            (request,),
4044            0x20d8a7aba2168a79,
4045            fidl::encoding::DynamicFlags::empty(),
4046        )
4047    }
4048
4049    /// Terminates the connection.
4050    ///
4051    /// After calling `Close`, the client must not send any other requests.
4052    ///
4053    /// Servers, after sending the status response, should close the connection
4054    /// regardless of status and without sending an epitaph.
4055    ///
4056    /// Closing the client end of the channel should be semantically equivalent
4057    /// to calling `Close` without knowing when the close has completed or its
4058    /// status.
4059    pub fn r#close(
4060        &self,
4061        ___deadline: zx::MonotonicInstant,
4062    ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
4063        let _response = self.client.send_query::<
4064            fidl::encoding::EmptyPayload,
4065            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4066            UnixDomainSocketMarker,
4067        >(
4068            (),
4069            0x5ac5d459ad7f657e,
4070            fidl::encoding::DynamicFlags::empty(),
4071            ___deadline,
4072        )?;
4073        Ok(_response.map(|x| x))
4074    }
4075
4076    pub fn r#query(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<u8>, fidl::Error> {
4077        let _response = self.client.send_query::<
4078            fidl::encoding::EmptyPayload,
4079            fidl_fuchsia_unknown::QueryableQueryResponse,
4080            UnixDomainSocketMarker,
4081        >(
4082            (),
4083            0x2658edee9decfc06,
4084            fidl::encoding::DynamicFlags::empty(),
4085            ___deadline,
4086        )?;
4087        Ok(_response.protocol)
4088    }
4089
4090    /// Returns an EventPair that will allow Starnix to wait on the socket. This event must use:
4091    /// - `fio.FileSignal.READABLE` to signal that a message is available.
4092    /// - `fio.FileSignal.WRITABLE` to signal that it can accept a new message.
4093    /// - `ZX_EVENTPAIR_PEER_CLOSED` to signal that it is closed.
4094    pub fn r#get_event(
4095        &self,
4096        mut payload: &UnixDomainSocketGetEventRequest,
4097        ___deadline: zx::MonotonicInstant,
4098    ) -> Result<UnixDomainSocketGetEventResult, fidl::Error> {
4099        let _response = self.client.send_query::<
4100            UnixDomainSocketGetEventRequest,
4101            fidl::encoding::FlexibleResultType<UnixDomainSocketGetEventResponse, i32>,
4102            UnixDomainSocketMarker,
4103        >(
4104            payload,
4105            0x4d79eb8f83961b41,
4106            fidl::encoding::DynamicFlags::FLEXIBLE,
4107            ___deadline,
4108        )?
4109        .into_result::<UnixDomainSocketMarker>("get_event")?;
4110        Ok(_response.map(|x| x))
4111    }
4112
4113    /// Read a message from the socket.
4114    pub fn r#read(
4115        &self,
4116        mut payload: &UnixDomainSocketReadRequest,
4117        ___deadline: zx::MonotonicInstant,
4118    ) -> Result<UnixDomainSocketReadResult, fidl::Error> {
4119        let _response = self.client.send_query::<
4120            UnixDomainSocketReadRequest,
4121            fidl::encoding::FlexibleResultType<UnixDomainSocketReadResponse, i32>,
4122            UnixDomainSocketMarker,
4123        >(
4124            payload,
4125            0x65ece02b0a73a069,
4126            fidl::encoding::DynamicFlags::FLEXIBLE,
4127            ___deadline,
4128        )?
4129        .into_result::<UnixDomainSocketMarker>("read")?;
4130        Ok(_response.map(|x| x))
4131    }
4132
4133    /// Write a message to the socket.
4134    pub fn r#write(
4135        &self,
4136        mut payload: UnixDomainSocketWriteRequest,
4137        ___deadline: zx::MonotonicInstant,
4138    ) -> Result<UnixDomainSocketWriteResult, fidl::Error> {
4139        let _response = self.client.send_query::<
4140            UnixDomainSocketWriteRequest,
4141            fidl::encoding::FlexibleResultType<UnixDomainSocketWriteResponse, i32>,
4142            UnixDomainSocketMarker,
4143        >(
4144            &mut payload,
4145            0x2339b58d4b835aee,
4146            fidl::encoding::DynamicFlags::FLEXIBLE,
4147            ___deadline,
4148        )?
4149        .into_result::<UnixDomainSocketMarker>("write")?;
4150        Ok(_response.map(|x| x))
4151    }
4152}
4153
4154#[cfg(target_os = "fuchsia")]
4155impl From<UnixDomainSocketSynchronousProxy> for zx::NullableHandle {
4156    fn from(value: UnixDomainSocketSynchronousProxy) -> Self {
4157        value.into_channel().into()
4158    }
4159}
4160
4161#[cfg(target_os = "fuchsia")]
4162impl From<fidl::Channel> for UnixDomainSocketSynchronousProxy {
4163    fn from(value: fidl::Channel) -> Self {
4164        Self::new(value)
4165    }
4166}
4167
4168#[cfg(target_os = "fuchsia")]
4169impl fidl::endpoints::FromClient for UnixDomainSocketSynchronousProxy {
4170    type Protocol = UnixDomainSocketMarker;
4171
4172    fn from_client(value: fidl::endpoints::ClientEnd<UnixDomainSocketMarker>) -> Self {
4173        Self::new(value.into_channel())
4174    }
4175}
4176
4177#[derive(Debug, Clone)]
4178pub struct UnixDomainSocketProxy {
4179    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4180}
4181
4182impl fidl::endpoints::Proxy for UnixDomainSocketProxy {
4183    type Protocol = UnixDomainSocketMarker;
4184
4185    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4186        Self::new(inner)
4187    }
4188
4189    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4190        self.client.into_channel().map_err(|client| Self { client })
4191    }
4192
4193    fn as_channel(&self) -> &::fidl::AsyncChannel {
4194        self.client.as_channel()
4195    }
4196}
4197
4198impl UnixDomainSocketProxy {
4199    /// Create a new Proxy for fuchsia.starnix.binder/UnixDomainSocket.
4200    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4201        let protocol_name = <UnixDomainSocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4202        Self { client: fidl::client::Client::new(channel, protocol_name) }
4203    }
4204
4205    /// Get a Stream of events from the remote end of the protocol.
4206    ///
4207    /// # Panics
4208    ///
4209    /// Panics if the event stream was already taken.
4210    pub fn take_event_stream(&self) -> UnixDomainSocketEventStream {
4211        UnixDomainSocketEventStream { event_receiver: self.client.take_event_receiver() }
4212    }
4213
4214    pub fn r#clone(
4215        &self,
4216        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
4217    ) -> Result<(), fidl::Error> {
4218        UnixDomainSocketProxyInterface::r#clone(self, request)
4219    }
4220
4221    /// Terminates the connection.
4222    ///
4223    /// After calling `Close`, the client must not send any other requests.
4224    ///
4225    /// Servers, after sending the status response, should close the connection
4226    /// regardless of status and without sending an epitaph.
4227    ///
4228    /// Closing the client end of the channel should be semantically equivalent
4229    /// to calling `Close` without knowing when the close has completed or its
4230    /// status.
4231    pub fn r#close(
4232        &self,
4233    ) -> fidl::client::QueryResponseFut<
4234        fidl_fuchsia_unknown::CloseableCloseResult,
4235        fidl::encoding::DefaultFuchsiaResourceDialect,
4236    > {
4237        UnixDomainSocketProxyInterface::r#close(self)
4238    }
4239
4240    pub fn r#query(
4241        &self,
4242    ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
4243    {
4244        UnixDomainSocketProxyInterface::r#query(self)
4245    }
4246
4247    /// Returns an EventPair that will allow Starnix to wait on the socket. This event must use:
4248    /// - `fio.FileSignal.READABLE` to signal that a message is available.
4249    /// - `fio.FileSignal.WRITABLE` to signal that it can accept a new message.
4250    /// - `ZX_EVENTPAIR_PEER_CLOSED` to signal that it is closed.
4251    pub fn r#get_event(
4252        &self,
4253        mut payload: &UnixDomainSocketGetEventRequest,
4254    ) -> fidl::client::QueryResponseFut<
4255        UnixDomainSocketGetEventResult,
4256        fidl::encoding::DefaultFuchsiaResourceDialect,
4257    > {
4258        UnixDomainSocketProxyInterface::r#get_event(self, payload)
4259    }
4260
4261    /// Read a message from the socket.
4262    pub fn r#read(
4263        &self,
4264        mut payload: &UnixDomainSocketReadRequest,
4265    ) -> fidl::client::QueryResponseFut<
4266        UnixDomainSocketReadResult,
4267        fidl::encoding::DefaultFuchsiaResourceDialect,
4268    > {
4269        UnixDomainSocketProxyInterface::r#read(self, payload)
4270    }
4271
4272    /// Write a message to the socket.
4273    pub fn r#write(
4274        &self,
4275        mut payload: UnixDomainSocketWriteRequest,
4276    ) -> fidl::client::QueryResponseFut<
4277        UnixDomainSocketWriteResult,
4278        fidl::encoding::DefaultFuchsiaResourceDialect,
4279    > {
4280        UnixDomainSocketProxyInterface::r#write(self, payload)
4281    }
4282}
4283
4284impl UnixDomainSocketProxyInterface for UnixDomainSocketProxy {
4285    fn r#clone(
4286        &self,
4287        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
4288    ) -> Result<(), fidl::Error> {
4289        self.client.send::<fidl_fuchsia_unknown::CloneableCloneRequest>(
4290            (request,),
4291            0x20d8a7aba2168a79,
4292            fidl::encoding::DynamicFlags::empty(),
4293        )
4294    }
4295
4296    type CloseResponseFut = fidl::client::QueryResponseFut<
4297        fidl_fuchsia_unknown::CloseableCloseResult,
4298        fidl::encoding::DefaultFuchsiaResourceDialect,
4299    >;
4300    fn r#close(&self) -> Self::CloseResponseFut {
4301        fn _decode(
4302            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4303        ) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
4304            let _response = fidl::client::decode_transaction_body::<
4305                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
4306                fidl::encoding::DefaultFuchsiaResourceDialect,
4307                0x5ac5d459ad7f657e,
4308            >(_buf?)?;
4309            Ok(_response.map(|x| x))
4310        }
4311        self.client.send_query_and_decode::<
4312            fidl::encoding::EmptyPayload,
4313            fidl_fuchsia_unknown::CloseableCloseResult,
4314        >(
4315            (),
4316            0x5ac5d459ad7f657e,
4317            fidl::encoding::DynamicFlags::empty(),
4318            _decode,
4319        )
4320    }
4321
4322    type QueryResponseFut =
4323        fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
4324    fn r#query(&self) -> Self::QueryResponseFut {
4325        fn _decode(
4326            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4327        ) -> Result<Vec<u8>, fidl::Error> {
4328            let _response = fidl::client::decode_transaction_body::<
4329                fidl_fuchsia_unknown::QueryableQueryResponse,
4330                fidl::encoding::DefaultFuchsiaResourceDialect,
4331                0x2658edee9decfc06,
4332            >(_buf?)?;
4333            Ok(_response.protocol)
4334        }
4335        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
4336            (),
4337            0x2658edee9decfc06,
4338            fidl::encoding::DynamicFlags::empty(),
4339            _decode,
4340        )
4341    }
4342
4343    type GetEventResponseFut = fidl::client::QueryResponseFut<
4344        UnixDomainSocketGetEventResult,
4345        fidl::encoding::DefaultFuchsiaResourceDialect,
4346    >;
4347    fn r#get_event(
4348        &self,
4349        mut payload: &UnixDomainSocketGetEventRequest,
4350    ) -> Self::GetEventResponseFut {
4351        fn _decode(
4352            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4353        ) -> Result<UnixDomainSocketGetEventResult, fidl::Error> {
4354            let _response = fidl::client::decode_transaction_body::<
4355                fidl::encoding::FlexibleResultType<UnixDomainSocketGetEventResponse, i32>,
4356                fidl::encoding::DefaultFuchsiaResourceDialect,
4357                0x4d79eb8f83961b41,
4358            >(_buf?)?
4359            .into_result::<UnixDomainSocketMarker>("get_event")?;
4360            Ok(_response.map(|x| x))
4361        }
4362        self.client.send_query_and_decode::<
4363            UnixDomainSocketGetEventRequest,
4364            UnixDomainSocketGetEventResult,
4365        >(
4366            payload,
4367            0x4d79eb8f83961b41,
4368            fidl::encoding::DynamicFlags::FLEXIBLE,
4369            _decode,
4370        )
4371    }
4372
4373    type ReadResponseFut = fidl::client::QueryResponseFut<
4374        UnixDomainSocketReadResult,
4375        fidl::encoding::DefaultFuchsiaResourceDialect,
4376    >;
4377    fn r#read(&self, mut payload: &UnixDomainSocketReadRequest) -> Self::ReadResponseFut {
4378        fn _decode(
4379            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4380        ) -> Result<UnixDomainSocketReadResult, fidl::Error> {
4381            let _response = fidl::client::decode_transaction_body::<
4382                fidl::encoding::FlexibleResultType<UnixDomainSocketReadResponse, i32>,
4383                fidl::encoding::DefaultFuchsiaResourceDialect,
4384                0x65ece02b0a73a069,
4385            >(_buf?)?
4386            .into_result::<UnixDomainSocketMarker>("read")?;
4387            Ok(_response.map(|x| x))
4388        }
4389        self.client
4390            .send_query_and_decode::<UnixDomainSocketReadRequest, UnixDomainSocketReadResult>(
4391                payload,
4392                0x65ece02b0a73a069,
4393                fidl::encoding::DynamicFlags::FLEXIBLE,
4394                _decode,
4395            )
4396    }
4397
4398    type WriteResponseFut = fidl::client::QueryResponseFut<
4399        UnixDomainSocketWriteResult,
4400        fidl::encoding::DefaultFuchsiaResourceDialect,
4401    >;
4402    fn r#write(&self, mut payload: UnixDomainSocketWriteRequest) -> Self::WriteResponseFut {
4403        fn _decode(
4404            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4405        ) -> Result<UnixDomainSocketWriteResult, fidl::Error> {
4406            let _response = fidl::client::decode_transaction_body::<
4407                fidl::encoding::FlexibleResultType<UnixDomainSocketWriteResponse, i32>,
4408                fidl::encoding::DefaultFuchsiaResourceDialect,
4409                0x2339b58d4b835aee,
4410            >(_buf?)?
4411            .into_result::<UnixDomainSocketMarker>("write")?;
4412            Ok(_response.map(|x| x))
4413        }
4414        self.client
4415            .send_query_and_decode::<UnixDomainSocketWriteRequest, UnixDomainSocketWriteResult>(
4416                &mut payload,
4417                0x2339b58d4b835aee,
4418                fidl::encoding::DynamicFlags::FLEXIBLE,
4419                _decode,
4420            )
4421    }
4422}
4423
4424pub struct UnixDomainSocketEventStream {
4425    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4426}
4427
4428impl std::marker::Unpin for UnixDomainSocketEventStream {}
4429
4430impl futures::stream::FusedStream for UnixDomainSocketEventStream {
4431    fn is_terminated(&self) -> bool {
4432        self.event_receiver.is_terminated()
4433    }
4434}
4435
4436impl futures::Stream for UnixDomainSocketEventStream {
4437    type Item = Result<UnixDomainSocketEvent, fidl::Error>;
4438
4439    fn poll_next(
4440        mut self: std::pin::Pin<&mut Self>,
4441        cx: &mut std::task::Context<'_>,
4442    ) -> std::task::Poll<Option<Self::Item>> {
4443        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4444            &mut self.event_receiver,
4445            cx
4446        )?) {
4447            Some(buf) => std::task::Poll::Ready(Some(UnixDomainSocketEvent::decode(buf))),
4448            None => std::task::Poll::Ready(None),
4449        }
4450    }
4451}
4452
4453#[derive(Debug)]
4454pub enum UnixDomainSocketEvent {
4455    #[non_exhaustive]
4456    _UnknownEvent {
4457        /// Ordinal of the event that was sent.
4458        ordinal: u64,
4459    },
4460}
4461
4462impl UnixDomainSocketEvent {
4463    /// Decodes a message buffer as a [`UnixDomainSocketEvent`].
4464    fn decode(
4465        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4466    ) -> Result<UnixDomainSocketEvent, fidl::Error> {
4467        let (bytes, _handles) = buf.split_mut();
4468        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4469        debug_assert_eq!(tx_header.tx_id, 0);
4470        match tx_header.ordinal {
4471            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4472                Ok(UnixDomainSocketEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4473            }
4474            _ => Err(fidl::Error::UnknownOrdinal {
4475                ordinal: tx_header.ordinal,
4476                protocol_name:
4477                    <UnixDomainSocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4478            }),
4479        }
4480    }
4481}
4482
4483/// A Stream of incoming requests for fuchsia.starnix.binder/UnixDomainSocket.
4484pub struct UnixDomainSocketRequestStream {
4485    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4486    is_terminated: bool,
4487}
4488
4489impl std::marker::Unpin for UnixDomainSocketRequestStream {}
4490
4491impl futures::stream::FusedStream for UnixDomainSocketRequestStream {
4492    fn is_terminated(&self) -> bool {
4493        self.is_terminated
4494    }
4495}
4496
4497impl fidl::endpoints::RequestStream for UnixDomainSocketRequestStream {
4498    type Protocol = UnixDomainSocketMarker;
4499    type ControlHandle = UnixDomainSocketControlHandle;
4500
4501    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4502        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4503    }
4504
4505    fn control_handle(&self) -> Self::ControlHandle {
4506        UnixDomainSocketControlHandle { inner: self.inner.clone() }
4507    }
4508
4509    fn into_inner(
4510        self,
4511    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4512    {
4513        (self.inner, self.is_terminated)
4514    }
4515
4516    fn from_inner(
4517        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4518        is_terminated: bool,
4519    ) -> Self {
4520        Self { inner, is_terminated }
4521    }
4522}
4523
4524impl futures::Stream for UnixDomainSocketRequestStream {
4525    type Item = Result<UnixDomainSocketRequest, fidl::Error>;
4526
4527    fn poll_next(
4528        mut self: std::pin::Pin<&mut Self>,
4529        cx: &mut std::task::Context<'_>,
4530    ) -> std::task::Poll<Option<Self::Item>> {
4531        let this = &mut *self;
4532        if this.inner.check_shutdown(cx) {
4533            this.is_terminated = true;
4534            return std::task::Poll::Ready(None);
4535        }
4536        if this.is_terminated {
4537            panic!("polled UnixDomainSocketRequestStream after completion");
4538        }
4539        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4540            |bytes, handles| {
4541                match this.inner.channel().read_etc(cx, bytes, handles) {
4542                    std::task::Poll::Ready(Ok(())) => {}
4543                    std::task::Poll::Pending => return std::task::Poll::Pending,
4544                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4545                        this.is_terminated = true;
4546                        return std::task::Poll::Ready(None);
4547                    }
4548                    std::task::Poll::Ready(Err(e)) => {
4549                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4550                            e.into(),
4551                        ))));
4552                    }
4553                }
4554
4555                // A message has been received from the channel
4556                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4557
4558                std::task::Poll::Ready(Some(match header.ordinal {
4559                    0x20d8a7aba2168a79 => {
4560                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4561                        let mut req = fidl::new_empty!(
4562                            fidl_fuchsia_unknown::CloneableCloneRequest,
4563                            fidl::encoding::DefaultFuchsiaResourceDialect
4564                        );
4565                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_unknown::CloneableCloneRequest>(&header, _body_bytes, handles, &mut req)?;
4566                        let control_handle =
4567                            UnixDomainSocketControlHandle { inner: this.inner.clone() };
4568                        Ok(UnixDomainSocketRequest::Clone { request: req.request, control_handle })
4569                    }
4570                    0x5ac5d459ad7f657e => {
4571                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4572                        let mut req = fidl::new_empty!(
4573                            fidl::encoding::EmptyPayload,
4574                            fidl::encoding::DefaultFuchsiaResourceDialect
4575                        );
4576                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4577                        let control_handle =
4578                            UnixDomainSocketControlHandle { inner: this.inner.clone() };
4579                        Ok(UnixDomainSocketRequest::Close {
4580                            responder: UnixDomainSocketCloseResponder {
4581                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4582                                tx_id: header.tx_id,
4583                            },
4584                        })
4585                    }
4586                    0x2658edee9decfc06 => {
4587                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4588                        let mut req = fidl::new_empty!(
4589                            fidl::encoding::EmptyPayload,
4590                            fidl::encoding::DefaultFuchsiaResourceDialect
4591                        );
4592                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4593                        let control_handle =
4594                            UnixDomainSocketControlHandle { inner: this.inner.clone() };
4595                        Ok(UnixDomainSocketRequest::Query {
4596                            responder: UnixDomainSocketQueryResponder {
4597                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4598                                tx_id: header.tx_id,
4599                            },
4600                        })
4601                    }
4602                    0x4d79eb8f83961b41 => {
4603                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4604                        let mut req = fidl::new_empty!(
4605                            UnixDomainSocketGetEventRequest,
4606                            fidl::encoding::DefaultFuchsiaResourceDialect
4607                        );
4608                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnixDomainSocketGetEventRequest>(&header, _body_bytes, handles, &mut req)?;
4609                        let control_handle =
4610                            UnixDomainSocketControlHandle { inner: this.inner.clone() };
4611                        Ok(UnixDomainSocketRequest::GetEvent {
4612                            payload: req,
4613                            responder: UnixDomainSocketGetEventResponder {
4614                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4615                                tx_id: header.tx_id,
4616                            },
4617                        })
4618                    }
4619                    0x65ece02b0a73a069 => {
4620                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4621                        let mut req = fidl::new_empty!(
4622                            UnixDomainSocketReadRequest,
4623                            fidl::encoding::DefaultFuchsiaResourceDialect
4624                        );
4625                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnixDomainSocketReadRequest>(&header, _body_bytes, handles, &mut req)?;
4626                        let control_handle =
4627                            UnixDomainSocketControlHandle { inner: this.inner.clone() };
4628                        Ok(UnixDomainSocketRequest::Read {
4629                            payload: req,
4630                            responder: UnixDomainSocketReadResponder {
4631                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4632                                tx_id: header.tx_id,
4633                            },
4634                        })
4635                    }
4636                    0x2339b58d4b835aee => {
4637                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4638                        let mut req = fidl::new_empty!(
4639                            UnixDomainSocketWriteRequest,
4640                            fidl::encoding::DefaultFuchsiaResourceDialect
4641                        );
4642                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UnixDomainSocketWriteRequest>(&header, _body_bytes, handles, &mut req)?;
4643                        let control_handle =
4644                            UnixDomainSocketControlHandle { inner: this.inner.clone() };
4645                        Ok(UnixDomainSocketRequest::Write {
4646                            payload: req,
4647                            responder: UnixDomainSocketWriteResponder {
4648                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4649                                tx_id: header.tx_id,
4650                            },
4651                        })
4652                    }
4653                    _ if header.tx_id == 0
4654                        && header
4655                            .dynamic_flags()
4656                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4657                    {
4658                        Ok(UnixDomainSocketRequest::_UnknownMethod {
4659                            ordinal: header.ordinal,
4660                            control_handle: UnixDomainSocketControlHandle {
4661                                inner: this.inner.clone(),
4662                            },
4663                            method_type: fidl::MethodType::OneWay,
4664                        })
4665                    }
4666                    _ if header
4667                        .dynamic_flags()
4668                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4669                    {
4670                        this.inner.send_framework_err(
4671                            fidl::encoding::FrameworkErr::UnknownMethod,
4672                            header.tx_id,
4673                            header.ordinal,
4674                            header.dynamic_flags(),
4675                            (bytes, handles),
4676                        )?;
4677                        Ok(UnixDomainSocketRequest::_UnknownMethod {
4678                            ordinal: header.ordinal,
4679                            control_handle: UnixDomainSocketControlHandle {
4680                                inner: this.inner.clone(),
4681                            },
4682                            method_type: fidl::MethodType::TwoWay,
4683                        })
4684                    }
4685                    _ => Err(fidl::Error::UnknownOrdinal {
4686                        ordinal: header.ordinal,
4687                        protocol_name:
4688                            <UnixDomainSocketMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4689                    }),
4690                }))
4691            },
4692        )
4693    }
4694}
4695
4696/// A Unix Domain Socket
4697///
4698/// This protocol is used to implement a unix domain socket in a Fuchsia
4699/// Component that will be able to communicate with a socket in Starnix. That
4700/// socket will be able to transmit file descriptors.
4701#[derive(Debug)]
4702pub enum UnixDomainSocketRequest {
4703    Clone {
4704        request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
4705        control_handle: UnixDomainSocketControlHandle,
4706    },
4707    /// Terminates the connection.
4708    ///
4709    /// After calling `Close`, the client must not send any other requests.
4710    ///
4711    /// Servers, after sending the status response, should close the connection
4712    /// regardless of status and without sending an epitaph.
4713    ///
4714    /// Closing the client end of the channel should be semantically equivalent
4715    /// to calling `Close` without knowing when the close has completed or its
4716    /// status.
4717    Close {
4718        responder: UnixDomainSocketCloseResponder,
4719    },
4720    Query {
4721        responder: UnixDomainSocketQueryResponder,
4722    },
4723    /// Returns an EventPair that will allow Starnix to wait on the socket. This event must use:
4724    /// - `fio.FileSignal.READABLE` to signal that a message is available.
4725    /// - `fio.FileSignal.WRITABLE` to signal that it can accept a new message.
4726    /// - `ZX_EVENTPAIR_PEER_CLOSED` to signal that it is closed.
4727    GetEvent {
4728        payload: UnixDomainSocketGetEventRequest,
4729        responder: UnixDomainSocketGetEventResponder,
4730    },
4731    /// Read a message from the socket.
4732    Read {
4733        payload: UnixDomainSocketReadRequest,
4734        responder: UnixDomainSocketReadResponder,
4735    },
4736    /// Write a message to the socket.
4737    Write {
4738        payload: UnixDomainSocketWriteRequest,
4739        responder: UnixDomainSocketWriteResponder,
4740    },
4741    /// An interaction was received which does not match any known method.
4742    #[non_exhaustive]
4743    _UnknownMethod {
4744        /// Ordinal of the method that was called.
4745        ordinal: u64,
4746        control_handle: UnixDomainSocketControlHandle,
4747        method_type: fidl::MethodType,
4748    },
4749}
4750
4751impl UnixDomainSocketRequest {
4752    #[allow(irrefutable_let_patterns)]
4753    pub fn into_clone(
4754        self,
4755    ) -> Option<(
4756        fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
4757        UnixDomainSocketControlHandle,
4758    )> {
4759        if let UnixDomainSocketRequest::Clone { request, control_handle } = self {
4760            Some((request, control_handle))
4761        } else {
4762            None
4763        }
4764    }
4765
4766    #[allow(irrefutable_let_patterns)]
4767    pub fn into_close(self) -> Option<(UnixDomainSocketCloseResponder)> {
4768        if let UnixDomainSocketRequest::Close { responder } = self {
4769            Some((responder))
4770        } else {
4771            None
4772        }
4773    }
4774
4775    #[allow(irrefutable_let_patterns)]
4776    pub fn into_query(self) -> Option<(UnixDomainSocketQueryResponder)> {
4777        if let UnixDomainSocketRequest::Query { responder } = self {
4778            Some((responder))
4779        } else {
4780            None
4781        }
4782    }
4783
4784    #[allow(irrefutable_let_patterns)]
4785    pub fn into_get_event(
4786        self,
4787    ) -> Option<(UnixDomainSocketGetEventRequest, UnixDomainSocketGetEventResponder)> {
4788        if let UnixDomainSocketRequest::GetEvent { payload, responder } = self {
4789            Some((payload, responder))
4790        } else {
4791            None
4792        }
4793    }
4794
4795    #[allow(irrefutable_let_patterns)]
4796    pub fn into_read(self) -> Option<(UnixDomainSocketReadRequest, UnixDomainSocketReadResponder)> {
4797        if let UnixDomainSocketRequest::Read { payload, responder } = self {
4798            Some((payload, responder))
4799        } else {
4800            None
4801        }
4802    }
4803
4804    #[allow(irrefutable_let_patterns)]
4805    pub fn into_write(
4806        self,
4807    ) -> Option<(UnixDomainSocketWriteRequest, UnixDomainSocketWriteResponder)> {
4808        if let UnixDomainSocketRequest::Write { payload, responder } = self {
4809            Some((payload, responder))
4810        } else {
4811            None
4812        }
4813    }
4814
4815    /// Name of the method defined in FIDL
4816    pub fn method_name(&self) -> &'static str {
4817        match *self {
4818            UnixDomainSocketRequest::Clone { .. } => "clone",
4819            UnixDomainSocketRequest::Close { .. } => "close",
4820            UnixDomainSocketRequest::Query { .. } => "query",
4821            UnixDomainSocketRequest::GetEvent { .. } => "get_event",
4822            UnixDomainSocketRequest::Read { .. } => "read",
4823            UnixDomainSocketRequest::Write { .. } => "write",
4824            UnixDomainSocketRequest::_UnknownMethod {
4825                method_type: fidl::MethodType::OneWay,
4826                ..
4827            } => "unknown one-way method",
4828            UnixDomainSocketRequest::_UnknownMethod {
4829                method_type: fidl::MethodType::TwoWay,
4830                ..
4831            } => "unknown two-way method",
4832        }
4833    }
4834}
4835
4836#[derive(Debug, Clone)]
4837pub struct UnixDomainSocketControlHandle {
4838    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4839}
4840
4841impl fidl::endpoints::ControlHandle for UnixDomainSocketControlHandle {
4842    fn shutdown(&self) {
4843        self.inner.shutdown()
4844    }
4845
4846    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4847        self.inner.shutdown_with_epitaph(status)
4848    }
4849
4850    fn is_closed(&self) -> bool {
4851        self.inner.channel().is_closed()
4852    }
4853    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4854        self.inner.channel().on_closed()
4855    }
4856
4857    #[cfg(target_os = "fuchsia")]
4858    fn signal_peer(
4859        &self,
4860        clear_mask: zx::Signals,
4861        set_mask: zx::Signals,
4862    ) -> Result<(), zx_status::Status> {
4863        use fidl::Peered;
4864        self.inner.channel().signal_peer(clear_mask, set_mask)
4865    }
4866}
4867
4868impl UnixDomainSocketControlHandle {}
4869
4870#[must_use = "FIDL methods require a response to be sent"]
4871#[derive(Debug)]
4872pub struct UnixDomainSocketCloseResponder {
4873    control_handle: std::mem::ManuallyDrop<UnixDomainSocketControlHandle>,
4874    tx_id: u32,
4875}
4876
4877/// Set the the channel to be shutdown (see [`UnixDomainSocketControlHandle::shutdown`])
4878/// if the responder is dropped without sending a response, so that the client
4879/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4880impl std::ops::Drop for UnixDomainSocketCloseResponder {
4881    fn drop(&mut self) {
4882        self.control_handle.shutdown();
4883        // Safety: drops once, never accessed again
4884        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4885    }
4886}
4887
4888impl fidl::endpoints::Responder for UnixDomainSocketCloseResponder {
4889    type ControlHandle = UnixDomainSocketControlHandle;
4890
4891    fn control_handle(&self) -> &UnixDomainSocketControlHandle {
4892        &self.control_handle
4893    }
4894
4895    fn drop_without_shutdown(mut self) {
4896        // Safety: drops once, never accessed again due to mem::forget
4897        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4898        // Prevent Drop from running (which would shut down the channel)
4899        std::mem::forget(self);
4900    }
4901}
4902
4903impl UnixDomainSocketCloseResponder {
4904    /// Sends a response to the FIDL transaction.
4905    ///
4906    /// Sets the channel to shutdown if an error occurs.
4907    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4908        let _result = self.send_raw(result);
4909        if _result.is_err() {
4910            self.control_handle.shutdown();
4911        }
4912        self.drop_without_shutdown();
4913        _result
4914    }
4915
4916    /// Similar to "send" but does not shutdown the channel if an error occurs.
4917    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4918        let _result = self.send_raw(result);
4919        self.drop_without_shutdown();
4920        _result
4921    }
4922
4923    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4924        self.control_handle
4925            .inner
4926            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4927                result,
4928                self.tx_id,
4929                0x5ac5d459ad7f657e,
4930                fidl::encoding::DynamicFlags::empty(),
4931            )
4932    }
4933}
4934
4935#[must_use = "FIDL methods require a response to be sent"]
4936#[derive(Debug)]
4937pub struct UnixDomainSocketQueryResponder {
4938    control_handle: std::mem::ManuallyDrop<UnixDomainSocketControlHandle>,
4939    tx_id: u32,
4940}
4941
4942/// Set the the channel to be shutdown (see [`UnixDomainSocketControlHandle::shutdown`])
4943/// if the responder is dropped without sending a response, so that the client
4944/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4945impl std::ops::Drop for UnixDomainSocketQueryResponder {
4946    fn drop(&mut self) {
4947        self.control_handle.shutdown();
4948        // Safety: drops once, never accessed again
4949        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4950    }
4951}
4952
4953impl fidl::endpoints::Responder for UnixDomainSocketQueryResponder {
4954    type ControlHandle = UnixDomainSocketControlHandle;
4955
4956    fn control_handle(&self) -> &UnixDomainSocketControlHandle {
4957        &self.control_handle
4958    }
4959
4960    fn drop_without_shutdown(mut self) {
4961        // Safety: drops once, never accessed again due to mem::forget
4962        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4963        // Prevent Drop from running (which would shut down the channel)
4964        std::mem::forget(self);
4965    }
4966}
4967
4968impl UnixDomainSocketQueryResponder {
4969    /// Sends a response to the FIDL transaction.
4970    ///
4971    /// Sets the channel to shutdown if an error occurs.
4972    pub fn send(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
4973        let _result = self.send_raw(protocol);
4974        if _result.is_err() {
4975            self.control_handle.shutdown();
4976        }
4977        self.drop_without_shutdown();
4978        _result
4979    }
4980
4981    /// Similar to "send" but does not shutdown the channel if an error occurs.
4982    pub fn send_no_shutdown_on_err(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
4983        let _result = self.send_raw(protocol);
4984        self.drop_without_shutdown();
4985        _result
4986    }
4987
4988    fn send_raw(&self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
4989        self.control_handle.inner.send::<fidl_fuchsia_unknown::QueryableQueryResponse>(
4990            (protocol,),
4991            self.tx_id,
4992            0x2658edee9decfc06,
4993            fidl::encoding::DynamicFlags::empty(),
4994        )
4995    }
4996}
4997
4998#[must_use = "FIDL methods require a response to be sent"]
4999#[derive(Debug)]
5000pub struct UnixDomainSocketGetEventResponder {
5001    control_handle: std::mem::ManuallyDrop<UnixDomainSocketControlHandle>,
5002    tx_id: u32,
5003}
5004
5005/// Set the the channel to be shutdown (see [`UnixDomainSocketControlHandle::shutdown`])
5006/// if the responder is dropped without sending a response, so that the client
5007/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5008impl std::ops::Drop for UnixDomainSocketGetEventResponder {
5009    fn drop(&mut self) {
5010        self.control_handle.shutdown();
5011        // Safety: drops once, never accessed again
5012        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5013    }
5014}
5015
5016impl fidl::endpoints::Responder for UnixDomainSocketGetEventResponder {
5017    type ControlHandle = UnixDomainSocketControlHandle;
5018
5019    fn control_handle(&self) -> &UnixDomainSocketControlHandle {
5020        &self.control_handle
5021    }
5022
5023    fn drop_without_shutdown(mut self) {
5024        // Safety: drops once, never accessed again due to mem::forget
5025        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5026        // Prevent Drop from running (which would shut down the channel)
5027        std::mem::forget(self);
5028    }
5029}
5030
5031impl UnixDomainSocketGetEventResponder {
5032    /// Sends a response to the FIDL transaction.
5033    ///
5034    /// Sets the channel to shutdown if an error occurs.
5035    pub fn send(
5036        self,
5037        mut result: Result<UnixDomainSocketGetEventResponse, i32>,
5038    ) -> Result<(), fidl::Error> {
5039        let _result = self.send_raw(result);
5040        if _result.is_err() {
5041            self.control_handle.shutdown();
5042        }
5043        self.drop_without_shutdown();
5044        _result
5045    }
5046
5047    /// Similar to "send" but does not shutdown the channel if an error occurs.
5048    pub fn send_no_shutdown_on_err(
5049        self,
5050        mut result: Result<UnixDomainSocketGetEventResponse, i32>,
5051    ) -> Result<(), fidl::Error> {
5052        let _result = self.send_raw(result);
5053        self.drop_without_shutdown();
5054        _result
5055    }
5056
5057    fn send_raw(
5058        &self,
5059        mut result: Result<UnixDomainSocketGetEventResponse, i32>,
5060    ) -> Result<(), fidl::Error> {
5061        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5062            UnixDomainSocketGetEventResponse,
5063            i32,
5064        >>(
5065            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
5066            self.tx_id,
5067            0x4d79eb8f83961b41,
5068            fidl::encoding::DynamicFlags::FLEXIBLE,
5069        )
5070    }
5071}
5072
5073#[must_use = "FIDL methods require a response to be sent"]
5074#[derive(Debug)]
5075pub struct UnixDomainSocketReadResponder {
5076    control_handle: std::mem::ManuallyDrop<UnixDomainSocketControlHandle>,
5077    tx_id: u32,
5078}
5079
5080/// Set the the channel to be shutdown (see [`UnixDomainSocketControlHandle::shutdown`])
5081/// if the responder is dropped without sending a response, so that the client
5082/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5083impl std::ops::Drop for UnixDomainSocketReadResponder {
5084    fn drop(&mut self) {
5085        self.control_handle.shutdown();
5086        // Safety: drops once, never accessed again
5087        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5088    }
5089}
5090
5091impl fidl::endpoints::Responder for UnixDomainSocketReadResponder {
5092    type ControlHandle = UnixDomainSocketControlHandle;
5093
5094    fn control_handle(&self) -> &UnixDomainSocketControlHandle {
5095        &self.control_handle
5096    }
5097
5098    fn drop_without_shutdown(mut self) {
5099        // Safety: drops once, never accessed again due to mem::forget
5100        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5101        // Prevent Drop from running (which would shut down the channel)
5102        std::mem::forget(self);
5103    }
5104}
5105
5106impl UnixDomainSocketReadResponder {
5107    /// Sends a response to the FIDL transaction.
5108    ///
5109    /// Sets the channel to shutdown if an error occurs.
5110    pub fn send(
5111        self,
5112        mut result: Result<UnixDomainSocketReadResponse, i32>,
5113    ) -> Result<(), fidl::Error> {
5114        let _result = self.send_raw(result);
5115        if _result.is_err() {
5116            self.control_handle.shutdown();
5117        }
5118        self.drop_without_shutdown();
5119        _result
5120    }
5121
5122    /// Similar to "send" but does not shutdown the channel if an error occurs.
5123    pub fn send_no_shutdown_on_err(
5124        self,
5125        mut result: Result<UnixDomainSocketReadResponse, i32>,
5126    ) -> Result<(), fidl::Error> {
5127        let _result = self.send_raw(result);
5128        self.drop_without_shutdown();
5129        _result
5130    }
5131
5132    fn send_raw(
5133        &self,
5134        mut result: Result<UnixDomainSocketReadResponse, i32>,
5135    ) -> Result<(), fidl::Error> {
5136        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5137            UnixDomainSocketReadResponse,
5138            i32,
5139        >>(
5140            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
5141            self.tx_id,
5142            0x65ece02b0a73a069,
5143            fidl::encoding::DynamicFlags::FLEXIBLE,
5144        )
5145    }
5146}
5147
5148#[must_use = "FIDL methods require a response to be sent"]
5149#[derive(Debug)]
5150pub struct UnixDomainSocketWriteResponder {
5151    control_handle: std::mem::ManuallyDrop<UnixDomainSocketControlHandle>,
5152    tx_id: u32,
5153}
5154
5155/// Set the the channel to be shutdown (see [`UnixDomainSocketControlHandle::shutdown`])
5156/// if the responder is dropped without sending a response, so that the client
5157/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5158impl std::ops::Drop for UnixDomainSocketWriteResponder {
5159    fn drop(&mut self) {
5160        self.control_handle.shutdown();
5161        // Safety: drops once, never accessed again
5162        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5163    }
5164}
5165
5166impl fidl::endpoints::Responder for UnixDomainSocketWriteResponder {
5167    type ControlHandle = UnixDomainSocketControlHandle;
5168
5169    fn control_handle(&self) -> &UnixDomainSocketControlHandle {
5170        &self.control_handle
5171    }
5172
5173    fn drop_without_shutdown(mut self) {
5174        // Safety: drops once, never accessed again due to mem::forget
5175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5176        // Prevent Drop from running (which would shut down the channel)
5177        std::mem::forget(self);
5178    }
5179}
5180
5181impl UnixDomainSocketWriteResponder {
5182    /// Sends a response to the FIDL transaction.
5183    ///
5184    /// Sets the channel to shutdown if an error occurs.
5185    pub fn send(
5186        self,
5187        mut result: Result<&UnixDomainSocketWriteResponse, i32>,
5188    ) -> Result<(), fidl::Error> {
5189        let _result = self.send_raw(result);
5190        if _result.is_err() {
5191            self.control_handle.shutdown();
5192        }
5193        self.drop_without_shutdown();
5194        _result
5195    }
5196
5197    /// Similar to "send" but does not shutdown the channel if an error occurs.
5198    pub fn send_no_shutdown_on_err(
5199        self,
5200        mut result: Result<&UnixDomainSocketWriteResponse, i32>,
5201    ) -> Result<(), fidl::Error> {
5202        let _result = self.send_raw(result);
5203        self.drop_without_shutdown();
5204        _result
5205    }
5206
5207    fn send_raw(
5208        &self,
5209        mut result: Result<&UnixDomainSocketWriteResponse, i32>,
5210    ) -> Result<(), fidl::Error> {
5211        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5212            UnixDomainSocketWriteResponse,
5213            i32,
5214        >>(
5215            fidl::encoding::FlexibleResult::new(result),
5216            self.tx_id,
5217            0x2339b58d4b835aee,
5218            fidl::encoding::DynamicFlags::FLEXIBLE,
5219        )
5220    }
5221}
5222
5223mod internal {
5224    use super::*;
5225
5226    impl fidl::encoding::ResourceTypeMarker for BinderIoctlRequest {
5227        type Borrowed<'a> = &'a mut Self;
5228        fn take_or_borrow<'a>(
5229            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5230        ) -> Self::Borrowed<'a> {
5231            value
5232        }
5233    }
5234
5235    unsafe impl fidl::encoding::TypeMarker for BinderIoctlRequest {
5236        type Owned = Self;
5237
5238        #[inline(always)]
5239        fn inline_align(_context: fidl::encoding::Context) -> usize {
5240            8
5241        }
5242
5243        #[inline(always)]
5244        fn inline_size(_context: fidl::encoding::Context) -> usize {
5245            48
5246        }
5247    }
5248
5249    unsafe impl
5250        fidl::encoding::Encode<BinderIoctlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5251        for &mut BinderIoctlRequest
5252    {
5253        #[inline]
5254        unsafe fn encode(
5255            self,
5256            encoder: &mut fidl::encoding::Encoder<
5257                '_,
5258                fidl::encoding::DefaultFuchsiaResourceDialect,
5259            >,
5260            offset: usize,
5261            _depth: fidl::encoding::Depth,
5262        ) -> fidl::Result<()> {
5263            encoder.debug_check_bounds::<BinderIoctlRequest>(offset);
5264            // Delegate to tuple encoding.
5265            fidl::encoding::Encode::<BinderIoctlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5266                (
5267                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.tid),
5268                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.request),
5269                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.arg),
5270                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmo),
5271                    <fidl::encoding::Vector<FileHandle, 16> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.files),
5272                ),
5273                encoder, offset, _depth
5274            )
5275        }
5276    }
5277    unsafe impl<
5278        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
5279        T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
5280        T2: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
5281        T3: fidl::encoding::Encode<
5282                fidl::encoding::HandleType<
5283                    fidl::Vmo,
5284                    { fidl::ObjectType::VMO.into_raw() },
5285                    2147483648,
5286                >,
5287                fidl::encoding::DefaultFuchsiaResourceDialect,
5288            >,
5289        T4: fidl::encoding::Encode<
5290                fidl::encoding::Vector<FileHandle, 16>,
5291                fidl::encoding::DefaultFuchsiaResourceDialect,
5292            >,
5293    > fidl::encoding::Encode<BinderIoctlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5294        for (T0, T1, T2, T3, T4)
5295    {
5296        #[inline]
5297        unsafe fn encode(
5298            self,
5299            encoder: &mut fidl::encoding::Encoder<
5300                '_,
5301                fidl::encoding::DefaultFuchsiaResourceDialect,
5302            >,
5303            offset: usize,
5304            depth: fidl::encoding::Depth,
5305        ) -> fidl::Result<()> {
5306            encoder.debug_check_bounds::<BinderIoctlRequest>(offset);
5307            // Zero out padding regions. There's no need to apply masks
5308            // because the unmasked parts will be overwritten by fields.
5309            unsafe {
5310                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5311                (ptr as *mut u64).write_unaligned(0);
5312            }
5313            unsafe {
5314                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
5315                (ptr as *mut u64).write_unaligned(0);
5316            }
5317            // Write the fields.
5318            self.0.encode(encoder, offset + 0, depth)?;
5319            self.1.encode(encoder, offset + 8, depth)?;
5320            self.2.encode(encoder, offset + 16, depth)?;
5321            self.3.encode(encoder, offset + 24, depth)?;
5322            self.4.encode(encoder, offset + 32, depth)?;
5323            Ok(())
5324        }
5325    }
5326
5327    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5328        for BinderIoctlRequest
5329    {
5330        #[inline(always)]
5331        fn new_empty() -> Self {
5332            Self {
5333                tid: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
5334                request: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
5335                arg: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
5336                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5337                files: fidl::new_empty!(fidl::encoding::Vector<FileHandle, 16>, fidl::encoding::DefaultFuchsiaResourceDialect),
5338            }
5339        }
5340
5341        #[inline]
5342        unsafe fn decode(
5343            &mut self,
5344            decoder: &mut fidl::encoding::Decoder<
5345                '_,
5346                fidl::encoding::DefaultFuchsiaResourceDialect,
5347            >,
5348            offset: usize,
5349            _depth: fidl::encoding::Depth,
5350        ) -> fidl::Result<()> {
5351            decoder.debug_check_bounds::<Self>(offset);
5352            // Verify that padding bytes are zero.
5353            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5354            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5355            let mask = 0xffffffff00000000u64;
5356            let maskedval = padval & mask;
5357            if maskedval != 0 {
5358                return Err(fidl::Error::NonZeroPadding {
5359                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5360                });
5361            }
5362            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
5363            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5364            let mask = 0xffffffff00000000u64;
5365            let maskedval = padval & mask;
5366            if maskedval != 0 {
5367                return Err(fidl::Error::NonZeroPadding {
5368                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
5369                });
5370            }
5371            fidl::decode!(
5372                u64,
5373                fidl::encoding::DefaultFuchsiaResourceDialect,
5374                &mut self.tid,
5375                decoder,
5376                offset + 0,
5377                _depth
5378            )?;
5379            fidl::decode!(
5380                u32,
5381                fidl::encoding::DefaultFuchsiaResourceDialect,
5382                &mut self.request,
5383                decoder,
5384                offset + 8,
5385                _depth
5386            )?;
5387            fidl::decode!(
5388                u64,
5389                fidl::encoding::DefaultFuchsiaResourceDialect,
5390                &mut self.arg,
5391                decoder,
5392                offset + 16,
5393                _depth
5394            )?;
5395            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 24, _depth)?;
5396            fidl::decode!(fidl::encoding::Vector<FileHandle, 16>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.files, decoder, offset + 32, _depth)?;
5397            Ok(())
5398        }
5399    }
5400
5401    impl fidl::encoding::ResourceTypeMarker for BinderSetVmoRequest {
5402        type Borrowed<'a> = &'a mut Self;
5403        fn take_or_borrow<'a>(
5404            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5405        ) -> Self::Borrowed<'a> {
5406            value
5407        }
5408    }
5409
5410    unsafe impl fidl::encoding::TypeMarker for BinderSetVmoRequest {
5411        type Owned = Self;
5412
5413        #[inline(always)]
5414        fn inline_align(_context: fidl::encoding::Context) -> usize {
5415            8
5416        }
5417
5418        #[inline(always)]
5419        fn inline_size(_context: fidl::encoding::Context) -> usize {
5420            16
5421        }
5422    }
5423
5424    unsafe impl
5425        fidl::encoding::Encode<BinderSetVmoRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5426        for &mut BinderSetVmoRequest
5427    {
5428        #[inline]
5429        unsafe fn encode(
5430            self,
5431            encoder: &mut fidl::encoding::Encoder<
5432                '_,
5433                fidl::encoding::DefaultFuchsiaResourceDialect,
5434            >,
5435            offset: usize,
5436            _depth: fidl::encoding::Depth,
5437        ) -> fidl::Result<()> {
5438            encoder.debug_check_bounds::<BinderSetVmoRequest>(offset);
5439            // Delegate to tuple encoding.
5440            fidl::encoding::Encode::<
5441                BinderSetVmoRequest,
5442                fidl::encoding::DefaultFuchsiaResourceDialect,
5443            >::encode(
5444                (
5445                    <fidl::encoding::HandleType<
5446                        fidl::Vmo,
5447                        { fidl::ObjectType::VMO.into_raw() },
5448                        2147483648,
5449                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5450                        &mut self.vmo
5451                    ),
5452                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.mapped_address),
5453                ),
5454                encoder,
5455                offset,
5456                _depth,
5457            )
5458        }
5459    }
5460    unsafe impl<
5461        T0: fidl::encoding::Encode<
5462                fidl::encoding::HandleType<
5463                    fidl::Vmo,
5464                    { fidl::ObjectType::VMO.into_raw() },
5465                    2147483648,
5466                >,
5467                fidl::encoding::DefaultFuchsiaResourceDialect,
5468            >,
5469        T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
5470    > fidl::encoding::Encode<BinderSetVmoRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5471        for (T0, T1)
5472    {
5473        #[inline]
5474        unsafe fn encode(
5475            self,
5476            encoder: &mut fidl::encoding::Encoder<
5477                '_,
5478                fidl::encoding::DefaultFuchsiaResourceDialect,
5479            >,
5480            offset: usize,
5481            depth: fidl::encoding::Depth,
5482        ) -> fidl::Result<()> {
5483            encoder.debug_check_bounds::<BinderSetVmoRequest>(offset);
5484            // Zero out padding regions. There's no need to apply masks
5485            // because the unmasked parts will be overwritten by fields.
5486            unsafe {
5487                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5488                (ptr as *mut u64).write_unaligned(0);
5489            }
5490            // Write the fields.
5491            self.0.encode(encoder, offset + 0, depth)?;
5492            self.1.encode(encoder, offset + 8, depth)?;
5493            Ok(())
5494        }
5495    }
5496
5497    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5498        for BinderSetVmoRequest
5499    {
5500        #[inline(always)]
5501        fn new_empty() -> Self {
5502            Self {
5503                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5504                mapped_address: fidl::new_empty!(
5505                    u64,
5506                    fidl::encoding::DefaultFuchsiaResourceDialect
5507                ),
5508            }
5509        }
5510
5511        #[inline]
5512        unsafe fn decode(
5513            &mut self,
5514            decoder: &mut fidl::encoding::Decoder<
5515                '_,
5516                fidl::encoding::DefaultFuchsiaResourceDialect,
5517            >,
5518            offset: usize,
5519            _depth: fidl::encoding::Depth,
5520        ) -> fidl::Result<()> {
5521            decoder.debug_check_bounds::<Self>(offset);
5522            // Verify that padding bytes are zero.
5523            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5524            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5525            let mask = 0xffffffff00000000u64;
5526            let maskedval = padval & mask;
5527            if maskedval != 0 {
5528                return Err(fidl::Error::NonZeroPadding {
5529                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5530                });
5531            }
5532            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
5533            fidl::decode!(
5534                u64,
5535                fidl::encoding::DefaultFuchsiaResourceDialect,
5536                &mut self.mapped_address,
5537                decoder,
5538                offset + 8,
5539                _depth
5540            )?;
5541            Ok(())
5542        }
5543    }
5544
5545    impl fidl::encoding::ResourceTypeMarker for ProcessAccessorWriteBytesRequest {
5546        type Borrowed<'a> = &'a mut Self;
5547        fn take_or_borrow<'a>(
5548            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5549        ) -> Self::Borrowed<'a> {
5550            value
5551        }
5552    }
5553
5554    unsafe impl fidl::encoding::TypeMarker for ProcessAccessorWriteBytesRequest {
5555        type Owned = Self;
5556
5557        #[inline(always)]
5558        fn inline_align(_context: fidl::encoding::Context) -> usize {
5559            8
5560        }
5561
5562        #[inline(always)]
5563        fn inline_size(_context: fidl::encoding::Context) -> usize {
5564            24
5565        }
5566    }
5567
5568    unsafe impl
5569        fidl::encoding::Encode<
5570            ProcessAccessorWriteBytesRequest,
5571            fidl::encoding::DefaultFuchsiaResourceDialect,
5572        > for &mut ProcessAccessorWriteBytesRequest
5573    {
5574        #[inline]
5575        unsafe fn encode(
5576            self,
5577            encoder: &mut fidl::encoding::Encoder<
5578                '_,
5579                fidl::encoding::DefaultFuchsiaResourceDialect,
5580            >,
5581            offset: usize,
5582            _depth: fidl::encoding::Depth,
5583        ) -> fidl::Result<()> {
5584            encoder.debug_check_bounds::<ProcessAccessorWriteBytesRequest>(offset);
5585            // Delegate to tuple encoding.
5586            fidl::encoding::Encode::<
5587                ProcessAccessorWriteBytesRequest,
5588                fidl::encoding::DefaultFuchsiaResourceDialect,
5589            >::encode(
5590                (
5591                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
5592                    <fidl::encoding::Vector<u8, 32768> as fidl::encoding::ValueTypeMarker>::borrow(
5593                        &self.bytes,
5594                    ),
5595                ),
5596                encoder,
5597                offset,
5598                _depth,
5599            )
5600        }
5601    }
5602    unsafe impl<
5603        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
5604        T1: fidl::encoding::Encode<
5605                fidl::encoding::Vector<u8, 32768>,
5606                fidl::encoding::DefaultFuchsiaResourceDialect,
5607            >,
5608    >
5609        fidl::encoding::Encode<
5610            ProcessAccessorWriteBytesRequest,
5611            fidl::encoding::DefaultFuchsiaResourceDialect,
5612        > for (T0, T1)
5613    {
5614        #[inline]
5615        unsafe fn encode(
5616            self,
5617            encoder: &mut fidl::encoding::Encoder<
5618                '_,
5619                fidl::encoding::DefaultFuchsiaResourceDialect,
5620            >,
5621            offset: usize,
5622            depth: fidl::encoding::Depth,
5623        ) -> fidl::Result<()> {
5624            encoder.debug_check_bounds::<ProcessAccessorWriteBytesRequest>(offset);
5625            // Zero out padding regions. There's no need to apply masks
5626            // because the unmasked parts will be overwritten by fields.
5627            // Write the fields.
5628            self.0.encode(encoder, offset + 0, depth)?;
5629            self.1.encode(encoder, offset + 8, depth)?;
5630            Ok(())
5631        }
5632    }
5633
5634    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5635        for ProcessAccessorWriteBytesRequest
5636    {
5637        #[inline(always)]
5638        fn new_empty() -> Self {
5639            Self {
5640                address: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
5641                bytes: fidl::new_empty!(fidl::encoding::Vector<u8, 32768>, fidl::encoding::DefaultFuchsiaResourceDialect),
5642            }
5643        }
5644
5645        #[inline]
5646        unsafe fn decode(
5647            &mut self,
5648            decoder: &mut fidl::encoding::Decoder<
5649                '_,
5650                fidl::encoding::DefaultFuchsiaResourceDialect,
5651            >,
5652            offset: usize,
5653            _depth: fidl::encoding::Depth,
5654        ) -> fidl::Result<()> {
5655            decoder.debug_check_bounds::<Self>(offset);
5656            // Verify that padding bytes are zero.
5657            fidl::decode!(
5658                u64,
5659                fidl::encoding::DefaultFuchsiaResourceDialect,
5660                &mut self.address,
5661                decoder,
5662                offset + 0,
5663                _depth
5664            )?;
5665            fidl::decode!(fidl::encoding::Vector<u8, 32768>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bytes, decoder, offset + 8, _depth)?;
5666            Ok(())
5667        }
5668    }
5669
5670    impl fidl::encoding::ResourceTypeMarker for ProcessAccessorWriteMemoryRequest {
5671        type Borrowed<'a> = &'a mut Self;
5672        fn take_or_borrow<'a>(
5673            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5674        ) -> Self::Borrowed<'a> {
5675            value
5676        }
5677    }
5678
5679    unsafe impl fidl::encoding::TypeMarker for ProcessAccessorWriteMemoryRequest {
5680        type Owned = Self;
5681
5682        #[inline(always)]
5683        fn inline_align(_context: fidl::encoding::Context) -> usize {
5684            8
5685        }
5686
5687        #[inline(always)]
5688        fn inline_size(_context: fidl::encoding::Context) -> usize {
5689            16
5690        }
5691    }
5692
5693    unsafe impl
5694        fidl::encoding::Encode<
5695            ProcessAccessorWriteMemoryRequest,
5696            fidl::encoding::DefaultFuchsiaResourceDialect,
5697        > for &mut ProcessAccessorWriteMemoryRequest
5698    {
5699        #[inline]
5700        unsafe fn encode(
5701            self,
5702            encoder: &mut fidl::encoding::Encoder<
5703                '_,
5704                fidl::encoding::DefaultFuchsiaResourceDialect,
5705            >,
5706            offset: usize,
5707            _depth: fidl::encoding::Depth,
5708        ) -> fidl::Result<()> {
5709            encoder.debug_check_bounds::<ProcessAccessorWriteMemoryRequest>(offset);
5710            // Delegate to tuple encoding.
5711            fidl::encoding::Encode::<
5712                ProcessAccessorWriteMemoryRequest,
5713                fidl::encoding::DefaultFuchsiaResourceDialect,
5714            >::encode(
5715                (
5716                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
5717                    <fidl::encoding::HandleType<
5718                        fidl::Vmo,
5719                        { fidl::ObjectType::VMO.into_raw() },
5720                        2147483648,
5721                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5722                        &mut self.content
5723                    ),
5724                ),
5725                encoder,
5726                offset,
5727                _depth,
5728            )
5729        }
5730    }
5731    unsafe impl<
5732        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
5733        T1: fidl::encoding::Encode<
5734                fidl::encoding::HandleType<
5735                    fidl::Vmo,
5736                    { fidl::ObjectType::VMO.into_raw() },
5737                    2147483648,
5738                >,
5739                fidl::encoding::DefaultFuchsiaResourceDialect,
5740            >,
5741    >
5742        fidl::encoding::Encode<
5743            ProcessAccessorWriteMemoryRequest,
5744            fidl::encoding::DefaultFuchsiaResourceDialect,
5745        > for (T0, T1)
5746    {
5747        #[inline]
5748        unsafe fn encode(
5749            self,
5750            encoder: &mut fidl::encoding::Encoder<
5751                '_,
5752                fidl::encoding::DefaultFuchsiaResourceDialect,
5753            >,
5754            offset: usize,
5755            depth: fidl::encoding::Depth,
5756        ) -> fidl::Result<()> {
5757            encoder.debug_check_bounds::<ProcessAccessorWriteMemoryRequest>(offset);
5758            // Zero out padding regions. There's no need to apply masks
5759            // because the unmasked parts will be overwritten by fields.
5760            unsafe {
5761                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5762                (ptr as *mut u64).write_unaligned(0);
5763            }
5764            // Write the fields.
5765            self.0.encode(encoder, offset + 0, depth)?;
5766            self.1.encode(encoder, offset + 8, depth)?;
5767            Ok(())
5768        }
5769    }
5770
5771    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5772        for ProcessAccessorWriteMemoryRequest
5773    {
5774        #[inline(always)]
5775        fn new_empty() -> Self {
5776            Self {
5777                address: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
5778                content: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5779            }
5780        }
5781
5782        #[inline]
5783        unsafe fn decode(
5784            &mut self,
5785            decoder: &mut fidl::encoding::Decoder<
5786                '_,
5787                fidl::encoding::DefaultFuchsiaResourceDialect,
5788            >,
5789            offset: usize,
5790            _depth: fidl::encoding::Depth,
5791        ) -> fidl::Result<()> {
5792            decoder.debug_check_bounds::<Self>(offset);
5793            // Verify that padding bytes are zero.
5794            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5795            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5796            let mask = 0xffffffff00000000u64;
5797            let maskedval = padval & mask;
5798            if maskedval != 0 {
5799                return Err(fidl::Error::NonZeroPadding {
5800                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5801                });
5802            }
5803            fidl::decode!(
5804                u64,
5805                fidl::encoding::DefaultFuchsiaResourceDialect,
5806                &mut self.address,
5807                decoder,
5808                offset + 0,
5809                _depth
5810            )?;
5811            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.content, decoder, offset + 8, _depth)?;
5812            Ok(())
5813        }
5814    }
5815
5816    impl ContainerPowerControllerRegisterWakeWatcherRequest {
5817        #[inline(always)]
5818        fn max_ordinal_present(&self) -> u64 {
5819            if let Some(_) = self.watcher {
5820                return 1;
5821            }
5822            0
5823        }
5824    }
5825
5826    impl fidl::encoding::ResourceTypeMarker for ContainerPowerControllerRegisterWakeWatcherRequest {
5827        type Borrowed<'a> = &'a mut Self;
5828        fn take_or_borrow<'a>(
5829            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5830        ) -> Self::Borrowed<'a> {
5831            value
5832        }
5833    }
5834
5835    unsafe impl fidl::encoding::TypeMarker for ContainerPowerControllerRegisterWakeWatcherRequest {
5836        type Owned = Self;
5837
5838        #[inline(always)]
5839        fn inline_align(_context: fidl::encoding::Context) -> usize {
5840            8
5841        }
5842
5843        #[inline(always)]
5844        fn inline_size(_context: fidl::encoding::Context) -> usize {
5845            16
5846        }
5847    }
5848
5849    unsafe impl
5850        fidl::encoding::Encode<
5851            ContainerPowerControllerRegisterWakeWatcherRequest,
5852            fidl::encoding::DefaultFuchsiaResourceDialect,
5853        > for &mut ContainerPowerControllerRegisterWakeWatcherRequest
5854    {
5855        unsafe fn encode(
5856            self,
5857            encoder: &mut fidl::encoding::Encoder<
5858                '_,
5859                fidl::encoding::DefaultFuchsiaResourceDialect,
5860            >,
5861            offset: usize,
5862            mut depth: fidl::encoding::Depth,
5863        ) -> fidl::Result<()> {
5864            encoder
5865                .debug_check_bounds::<ContainerPowerControllerRegisterWakeWatcherRequest>(offset);
5866            // Vector header
5867            let max_ordinal: u64 = self.max_ordinal_present();
5868            encoder.write_num(max_ordinal, offset);
5869            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5870            // Calling encoder.out_of_line_offset(0) is not allowed.
5871            if max_ordinal == 0 {
5872                return Ok(());
5873            }
5874            depth.increment()?;
5875            let envelope_size = 8;
5876            let bytes_len = max_ordinal as usize * envelope_size;
5877            #[allow(unused_variables)]
5878            let offset = encoder.out_of_line_offset(bytes_len);
5879            let mut _prev_end_offset: usize = 0;
5880            if 1 > max_ordinal {
5881                return Ok(());
5882            }
5883
5884            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5885            // are envelope_size bytes.
5886            let cur_offset: usize = (1 - 1) * envelope_size;
5887
5888            // Zero reserved fields.
5889            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5890
5891            // Safety:
5892            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5893            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5894            //   envelope_size bytes, there is always sufficient room.
5895            fidl::encoding::encode_in_envelope_optional::<
5896                fidl::encoding::HandleType<
5897                    fidl::EventPair,
5898                    { fidl::ObjectType::EVENTPAIR.into_raw() },
5899                    2147483648,
5900                >,
5901                fidl::encoding::DefaultFuchsiaResourceDialect,
5902            >(
5903                self.watcher.as_mut().map(
5904                    <fidl::encoding::HandleType<
5905                        fidl::EventPair,
5906                        { fidl::ObjectType::EVENTPAIR.into_raw() },
5907                        2147483648,
5908                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5909                ),
5910                encoder,
5911                offset + cur_offset,
5912                depth,
5913            )?;
5914
5915            _prev_end_offset = cur_offset + envelope_size;
5916
5917            Ok(())
5918        }
5919    }
5920
5921    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5922        for ContainerPowerControllerRegisterWakeWatcherRequest
5923    {
5924        #[inline(always)]
5925        fn new_empty() -> Self {
5926            Self::default()
5927        }
5928
5929        unsafe fn decode(
5930            &mut self,
5931            decoder: &mut fidl::encoding::Decoder<
5932                '_,
5933                fidl::encoding::DefaultFuchsiaResourceDialect,
5934            >,
5935            offset: usize,
5936            mut depth: fidl::encoding::Depth,
5937        ) -> fidl::Result<()> {
5938            decoder.debug_check_bounds::<Self>(offset);
5939            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5940                None => return Err(fidl::Error::NotNullable),
5941                Some(len) => len,
5942            };
5943            // Calling decoder.out_of_line_offset(0) is not allowed.
5944            if len == 0 {
5945                return Ok(());
5946            };
5947            depth.increment()?;
5948            let envelope_size = 8;
5949            let bytes_len = len * envelope_size;
5950            let offset = decoder.out_of_line_offset(bytes_len)?;
5951            // Decode the envelope for each type.
5952            let mut _next_ordinal_to_read = 0;
5953            let mut next_offset = offset;
5954            let end_offset = offset + bytes_len;
5955            _next_ordinal_to_read += 1;
5956            if next_offset >= end_offset {
5957                return Ok(());
5958            }
5959
5960            // Decode unknown envelopes for gaps in ordinals.
5961            while _next_ordinal_to_read < 1 {
5962                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5963                _next_ordinal_to_read += 1;
5964                next_offset += envelope_size;
5965            }
5966
5967            let next_out_of_line = decoder.next_out_of_line();
5968            let handles_before = decoder.remaining_handles();
5969            if let Some((inlined, num_bytes, num_handles)) =
5970                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5971            {
5972                let member_inline_size = <fidl::encoding::HandleType<
5973                    fidl::EventPair,
5974                    { fidl::ObjectType::EVENTPAIR.into_raw() },
5975                    2147483648,
5976                > as fidl::encoding::TypeMarker>::inline_size(
5977                    decoder.context
5978                );
5979                if inlined != (member_inline_size <= 4) {
5980                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5981                }
5982                let inner_offset;
5983                let mut inner_depth = depth.clone();
5984                if inlined {
5985                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5986                    inner_offset = next_offset;
5987                } else {
5988                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5989                    inner_depth.increment()?;
5990                }
5991                let val_ref =
5992                self.watcher.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
5993                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5994                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5995                {
5996                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5997                }
5998                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5999                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6000                }
6001            }
6002
6003            next_offset += envelope_size;
6004
6005            // Decode the remaining unknown envelopes.
6006            while next_offset < end_offset {
6007                _next_ordinal_to_read += 1;
6008                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6009                next_offset += envelope_size;
6010            }
6011
6012            Ok(())
6013        }
6014    }
6015
6016    impl ContainerPowerControllerWakeRequest {
6017        #[inline(always)]
6018        fn max_ordinal_present(&self) -> u64 {
6019            if let Some(_) = self.wake_lock {
6020                return 2;
6021            }
6022            if let Some(_) = self.power_baton {
6023                return 1;
6024            }
6025            0
6026        }
6027    }
6028
6029    impl fidl::encoding::ResourceTypeMarker for ContainerPowerControllerWakeRequest {
6030        type Borrowed<'a> = &'a mut Self;
6031        fn take_or_borrow<'a>(
6032            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6033        ) -> Self::Borrowed<'a> {
6034            value
6035        }
6036    }
6037
6038    unsafe impl fidl::encoding::TypeMarker for ContainerPowerControllerWakeRequest {
6039        type Owned = Self;
6040
6041        #[inline(always)]
6042        fn inline_align(_context: fidl::encoding::Context) -> usize {
6043            8
6044        }
6045
6046        #[inline(always)]
6047        fn inline_size(_context: fidl::encoding::Context) -> usize {
6048            16
6049        }
6050    }
6051
6052    unsafe impl
6053        fidl::encoding::Encode<
6054            ContainerPowerControllerWakeRequest,
6055            fidl::encoding::DefaultFuchsiaResourceDialect,
6056        > for &mut ContainerPowerControllerWakeRequest
6057    {
6058        unsafe fn encode(
6059            self,
6060            encoder: &mut fidl::encoding::Encoder<
6061                '_,
6062                fidl::encoding::DefaultFuchsiaResourceDialect,
6063            >,
6064            offset: usize,
6065            mut depth: fidl::encoding::Depth,
6066        ) -> fidl::Result<()> {
6067            encoder.debug_check_bounds::<ContainerPowerControllerWakeRequest>(offset);
6068            // Vector header
6069            let max_ordinal: u64 = self.max_ordinal_present();
6070            encoder.write_num(max_ordinal, offset);
6071            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6072            // Calling encoder.out_of_line_offset(0) is not allowed.
6073            if max_ordinal == 0 {
6074                return Ok(());
6075            }
6076            depth.increment()?;
6077            let envelope_size = 8;
6078            let bytes_len = max_ordinal as usize * envelope_size;
6079            #[allow(unused_variables)]
6080            let offset = encoder.out_of_line_offset(bytes_len);
6081            let mut _prev_end_offset: usize = 0;
6082            if 1 > max_ordinal {
6083                return Ok(());
6084            }
6085
6086            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6087            // are envelope_size bytes.
6088            let cur_offset: usize = (1 - 1) * envelope_size;
6089
6090            // Zero reserved fields.
6091            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6092
6093            // Safety:
6094            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6095            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6096            //   envelope_size bytes, there is always sufficient room.
6097            fidl::encoding::encode_in_envelope_optional::<
6098                fidl::encoding::HandleType<
6099                    fidl::NullableHandle,
6100                    { fidl::ObjectType::NONE.into_raw() },
6101                    2147483648,
6102                >,
6103                fidl::encoding::DefaultFuchsiaResourceDialect,
6104            >(
6105                self.power_baton.as_mut().map(
6106                    <fidl::encoding::HandleType<
6107                        fidl::NullableHandle,
6108                        { fidl::ObjectType::NONE.into_raw() },
6109                        2147483648,
6110                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6111                ),
6112                encoder,
6113                offset + cur_offset,
6114                depth,
6115            )?;
6116
6117            _prev_end_offset = cur_offset + envelope_size;
6118            if 2 > max_ordinal {
6119                return Ok(());
6120            }
6121
6122            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6123            // are envelope_size bytes.
6124            let cur_offset: usize = (2 - 1) * envelope_size;
6125
6126            // Zero reserved fields.
6127            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6128
6129            // Safety:
6130            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6131            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6132            //   envelope_size bytes, there is always sufficient room.
6133            fidl::encoding::encode_in_envelope_optional::<
6134                fidl::encoding::HandleType<
6135                    fidl::EventPair,
6136                    { fidl::ObjectType::EVENTPAIR.into_raw() },
6137                    2147483648,
6138                >,
6139                fidl::encoding::DefaultFuchsiaResourceDialect,
6140            >(
6141                self.wake_lock.as_mut().map(
6142                    <fidl::encoding::HandleType<
6143                        fidl::EventPair,
6144                        { fidl::ObjectType::EVENTPAIR.into_raw() },
6145                        2147483648,
6146                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6147                ),
6148                encoder,
6149                offset + cur_offset,
6150                depth,
6151            )?;
6152
6153            _prev_end_offset = cur_offset + envelope_size;
6154
6155            Ok(())
6156        }
6157    }
6158
6159    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6160        for ContainerPowerControllerWakeRequest
6161    {
6162        #[inline(always)]
6163        fn new_empty() -> Self {
6164            Self::default()
6165        }
6166
6167        unsafe fn decode(
6168            &mut self,
6169            decoder: &mut fidl::encoding::Decoder<
6170                '_,
6171                fidl::encoding::DefaultFuchsiaResourceDialect,
6172            >,
6173            offset: usize,
6174            mut depth: fidl::encoding::Depth,
6175        ) -> fidl::Result<()> {
6176            decoder.debug_check_bounds::<Self>(offset);
6177            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6178                None => return Err(fidl::Error::NotNullable),
6179                Some(len) => len,
6180            };
6181            // Calling decoder.out_of_line_offset(0) is not allowed.
6182            if len == 0 {
6183                return Ok(());
6184            };
6185            depth.increment()?;
6186            let envelope_size = 8;
6187            let bytes_len = len * envelope_size;
6188            let offset = decoder.out_of_line_offset(bytes_len)?;
6189            // Decode the envelope for each type.
6190            let mut _next_ordinal_to_read = 0;
6191            let mut next_offset = offset;
6192            let end_offset = offset + bytes_len;
6193            _next_ordinal_to_read += 1;
6194            if next_offset >= end_offset {
6195                return Ok(());
6196            }
6197
6198            // Decode unknown envelopes for gaps in ordinals.
6199            while _next_ordinal_to_read < 1 {
6200                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6201                _next_ordinal_to_read += 1;
6202                next_offset += envelope_size;
6203            }
6204
6205            let next_out_of_line = decoder.next_out_of_line();
6206            let handles_before = decoder.remaining_handles();
6207            if let Some((inlined, num_bytes, num_handles)) =
6208                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6209            {
6210                let member_inline_size = <fidl::encoding::HandleType<
6211                    fidl::NullableHandle,
6212                    { fidl::ObjectType::NONE.into_raw() },
6213                    2147483648,
6214                > as fidl::encoding::TypeMarker>::inline_size(
6215                    decoder.context
6216                );
6217                if inlined != (member_inline_size <= 4) {
6218                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6219                }
6220                let inner_offset;
6221                let mut inner_depth = depth.clone();
6222                if inlined {
6223                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6224                    inner_offset = next_offset;
6225                } else {
6226                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6227                    inner_depth.increment()?;
6228                }
6229                let val_ref =
6230                self.power_baton.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6231                fidl::decode!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6232                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6233                {
6234                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6235                }
6236                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6237                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6238                }
6239            }
6240
6241            next_offset += envelope_size;
6242            _next_ordinal_to_read += 1;
6243            if next_offset >= end_offset {
6244                return Ok(());
6245            }
6246
6247            // Decode unknown envelopes for gaps in ordinals.
6248            while _next_ordinal_to_read < 2 {
6249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6250                _next_ordinal_to_read += 1;
6251                next_offset += envelope_size;
6252            }
6253
6254            let next_out_of_line = decoder.next_out_of_line();
6255            let handles_before = decoder.remaining_handles();
6256            if let Some((inlined, num_bytes, num_handles)) =
6257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6258            {
6259                let member_inline_size = <fidl::encoding::HandleType<
6260                    fidl::EventPair,
6261                    { fidl::ObjectType::EVENTPAIR.into_raw() },
6262                    2147483648,
6263                > as fidl::encoding::TypeMarker>::inline_size(
6264                    decoder.context
6265                );
6266                if inlined != (member_inline_size <= 4) {
6267                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6268                }
6269                let inner_offset;
6270                let mut inner_depth = depth.clone();
6271                if inlined {
6272                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6273                    inner_offset = next_offset;
6274                } else {
6275                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6276                    inner_depth.increment()?;
6277                }
6278                let val_ref =
6279                self.wake_lock.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6280                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6281                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6282                {
6283                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6284                }
6285                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6286                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6287                }
6288            }
6289
6290            next_offset += envelope_size;
6291
6292            // Decode the remaining unknown envelopes.
6293            while next_offset < end_offset {
6294                _next_ordinal_to_read += 1;
6295                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6296                next_offset += envelope_size;
6297            }
6298
6299            Ok(())
6300        }
6301    }
6302
6303    impl DevBinderCloseRequest {
6304        #[inline(always)]
6305        fn max_ordinal_present(&self) -> u64 {
6306            if let Some(_) = self.binder {
6307                return 1;
6308            }
6309            0
6310        }
6311    }
6312
6313    impl fidl::encoding::ResourceTypeMarker for DevBinderCloseRequest {
6314        type Borrowed<'a> = &'a mut Self;
6315        fn take_or_borrow<'a>(
6316            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6317        ) -> Self::Borrowed<'a> {
6318            value
6319        }
6320    }
6321
6322    unsafe impl fidl::encoding::TypeMarker for DevBinderCloseRequest {
6323        type Owned = Self;
6324
6325        #[inline(always)]
6326        fn inline_align(_context: fidl::encoding::Context) -> usize {
6327            8
6328        }
6329
6330        #[inline(always)]
6331        fn inline_size(_context: fidl::encoding::Context) -> usize {
6332            16
6333        }
6334    }
6335
6336    unsafe impl
6337        fidl::encoding::Encode<DevBinderCloseRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6338        for &mut DevBinderCloseRequest
6339    {
6340        unsafe fn encode(
6341            self,
6342            encoder: &mut fidl::encoding::Encoder<
6343                '_,
6344                fidl::encoding::DefaultFuchsiaResourceDialect,
6345            >,
6346            offset: usize,
6347            mut depth: fidl::encoding::Depth,
6348        ) -> fidl::Result<()> {
6349            encoder.debug_check_bounds::<DevBinderCloseRequest>(offset);
6350            // Vector header
6351            let max_ordinal: u64 = self.max_ordinal_present();
6352            encoder.write_num(max_ordinal, offset);
6353            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6354            // Calling encoder.out_of_line_offset(0) is not allowed.
6355            if max_ordinal == 0 {
6356                return Ok(());
6357            }
6358            depth.increment()?;
6359            let envelope_size = 8;
6360            let bytes_len = max_ordinal as usize * envelope_size;
6361            #[allow(unused_variables)]
6362            let offset = encoder.out_of_line_offset(bytes_len);
6363            let mut _prev_end_offset: usize = 0;
6364            if 1 > max_ordinal {
6365                return Ok(());
6366            }
6367
6368            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6369            // are envelope_size bytes.
6370            let cur_offset: usize = (1 - 1) * envelope_size;
6371
6372            // Zero reserved fields.
6373            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6374
6375            // Safety:
6376            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6377            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6378            //   envelope_size bytes, there is always sufficient room.
6379            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BinderMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6380            self.binder.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BinderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6381            encoder, offset + cur_offset, depth
6382        )?;
6383
6384            _prev_end_offset = cur_offset + envelope_size;
6385
6386            Ok(())
6387        }
6388    }
6389
6390    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6391        for DevBinderCloseRequest
6392    {
6393        #[inline(always)]
6394        fn new_empty() -> Self {
6395            Self::default()
6396        }
6397
6398        unsafe fn decode(
6399            &mut self,
6400            decoder: &mut fidl::encoding::Decoder<
6401                '_,
6402                fidl::encoding::DefaultFuchsiaResourceDialect,
6403            >,
6404            offset: usize,
6405            mut depth: fidl::encoding::Depth,
6406        ) -> fidl::Result<()> {
6407            decoder.debug_check_bounds::<Self>(offset);
6408            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6409                None => return Err(fidl::Error::NotNullable),
6410                Some(len) => len,
6411            };
6412            // Calling decoder.out_of_line_offset(0) is not allowed.
6413            if len == 0 {
6414                return Ok(());
6415            };
6416            depth.increment()?;
6417            let envelope_size = 8;
6418            let bytes_len = len * envelope_size;
6419            let offset = decoder.out_of_line_offset(bytes_len)?;
6420            // Decode the envelope for each type.
6421            let mut _next_ordinal_to_read = 0;
6422            let mut next_offset = offset;
6423            let end_offset = offset + bytes_len;
6424            _next_ordinal_to_read += 1;
6425            if next_offset >= end_offset {
6426                return Ok(());
6427            }
6428
6429            // Decode unknown envelopes for gaps in ordinals.
6430            while _next_ordinal_to_read < 1 {
6431                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6432                _next_ordinal_to_read += 1;
6433                next_offset += envelope_size;
6434            }
6435
6436            let next_out_of_line = decoder.next_out_of_line();
6437            let handles_before = decoder.remaining_handles();
6438            if let Some((inlined, num_bytes, num_handles)) =
6439                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6440            {
6441                let member_inline_size = <fidl::encoding::Endpoint<
6442                    fidl::endpoints::ClientEnd<BinderMarker>,
6443                > as fidl::encoding::TypeMarker>::inline_size(
6444                    decoder.context
6445                );
6446                if inlined != (member_inline_size <= 4) {
6447                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6448                }
6449                let inner_offset;
6450                let mut inner_depth = depth.clone();
6451                if inlined {
6452                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6453                    inner_offset = next_offset;
6454                } else {
6455                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6456                    inner_depth.increment()?;
6457                }
6458                let val_ref = self.binder.get_or_insert_with(|| {
6459                    fidl::new_empty!(
6460                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BinderMarker>>,
6461                        fidl::encoding::DefaultFuchsiaResourceDialect
6462                    )
6463                });
6464                fidl::decode!(
6465                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BinderMarker>>,
6466                    fidl::encoding::DefaultFuchsiaResourceDialect,
6467                    val_ref,
6468                    decoder,
6469                    inner_offset,
6470                    inner_depth
6471                )?;
6472                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6473                {
6474                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6475                }
6476                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6477                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6478                }
6479            }
6480
6481            next_offset += envelope_size;
6482
6483            // Decode the remaining unknown envelopes.
6484            while next_offset < end_offset {
6485                _next_ordinal_to_read += 1;
6486                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6487                next_offset += envelope_size;
6488            }
6489
6490            Ok(())
6491        }
6492    }
6493
6494    impl DevBinderOpenRequest {
6495        #[inline(always)]
6496        fn max_ordinal_present(&self) -> u64 {
6497            if let Some(_) = self.binder {
6498                return 4;
6499            }
6500            if let Some(_) = self.process {
6501                return 3;
6502            }
6503            if let Some(_) = self.process_accessor {
6504                return 2;
6505            }
6506            if let Some(_) = self.path {
6507                return 1;
6508            }
6509            0
6510        }
6511    }
6512
6513    impl fidl::encoding::ResourceTypeMarker for DevBinderOpenRequest {
6514        type Borrowed<'a> = &'a mut Self;
6515        fn take_or_borrow<'a>(
6516            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6517        ) -> Self::Borrowed<'a> {
6518            value
6519        }
6520    }
6521
6522    unsafe impl fidl::encoding::TypeMarker for DevBinderOpenRequest {
6523        type Owned = Self;
6524
6525        #[inline(always)]
6526        fn inline_align(_context: fidl::encoding::Context) -> usize {
6527            8
6528        }
6529
6530        #[inline(always)]
6531        fn inline_size(_context: fidl::encoding::Context) -> usize {
6532            16
6533        }
6534    }
6535
6536    unsafe impl
6537        fidl::encoding::Encode<DevBinderOpenRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
6538        for &mut DevBinderOpenRequest
6539    {
6540        unsafe fn encode(
6541            self,
6542            encoder: &mut fidl::encoding::Encoder<
6543                '_,
6544                fidl::encoding::DefaultFuchsiaResourceDialect,
6545            >,
6546            offset: usize,
6547            mut depth: fidl::encoding::Depth,
6548        ) -> fidl::Result<()> {
6549            encoder.debug_check_bounds::<DevBinderOpenRequest>(offset);
6550            // Vector header
6551            let max_ordinal: u64 = self.max_ordinal_present();
6552            encoder.write_num(max_ordinal, offset);
6553            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6554            // Calling encoder.out_of_line_offset(0) is not allowed.
6555            if max_ordinal == 0 {
6556                return Ok(());
6557            }
6558            depth.increment()?;
6559            let envelope_size = 8;
6560            let bytes_len = max_ordinal as usize * envelope_size;
6561            #[allow(unused_variables)]
6562            let offset = encoder.out_of_line_offset(bytes_len);
6563            let mut _prev_end_offset: usize = 0;
6564            if 1 > max_ordinal {
6565                return Ok(());
6566            }
6567
6568            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6569            // are envelope_size bytes.
6570            let cur_offset: usize = (1 - 1) * envelope_size;
6571
6572            // Zero reserved fields.
6573            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6574
6575            // Safety:
6576            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6577            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6578            //   envelope_size bytes, there is always sufficient room.
6579            fidl::encoding::encode_in_envelope_optional::<
6580                fidl::encoding::Vector<u8, 4095>,
6581                fidl::encoding::DefaultFuchsiaResourceDialect,
6582            >(
6583                self.path.as_ref().map(
6584                    <fidl::encoding::Vector<u8, 4095> as fidl::encoding::ValueTypeMarker>::borrow,
6585                ),
6586                encoder,
6587                offset + cur_offset,
6588                depth,
6589            )?;
6590
6591            _prev_end_offset = cur_offset + envelope_size;
6592            if 2 > max_ordinal {
6593                return Ok(());
6594            }
6595
6596            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6597            // are envelope_size bytes.
6598            let cur_offset: usize = (2 - 1) * envelope_size;
6599
6600            // Zero reserved fields.
6601            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6602
6603            // Safety:
6604            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6605            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6606            //   envelope_size bytes, there is always sufficient room.
6607            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProcessAccessorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6608            self.process_accessor.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProcessAccessorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6609            encoder, offset + cur_offset, depth
6610        )?;
6611
6612            _prev_end_offset = cur_offset + envelope_size;
6613            if 3 > max_ordinal {
6614                return Ok(());
6615            }
6616
6617            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6618            // are envelope_size bytes.
6619            let cur_offset: usize = (3 - 1) * envelope_size;
6620
6621            // Zero reserved fields.
6622            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6623
6624            // Safety:
6625            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6626            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6627            //   envelope_size bytes, there is always sufficient room.
6628            fidl::encoding::encode_in_envelope_optional::<
6629                fidl::encoding::HandleType<
6630                    fidl::Process,
6631                    { fidl::ObjectType::PROCESS.into_raw() },
6632                    2147483648,
6633                >,
6634                fidl::encoding::DefaultFuchsiaResourceDialect,
6635            >(
6636                self.process.as_mut().map(
6637                    <fidl::encoding::HandleType<
6638                        fidl::Process,
6639                        { fidl::ObjectType::PROCESS.into_raw() },
6640                        2147483648,
6641                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
6642                ),
6643                encoder,
6644                offset + cur_offset,
6645                depth,
6646            )?;
6647
6648            _prev_end_offset = cur_offset + envelope_size;
6649            if 4 > max_ordinal {
6650                return Ok(());
6651            }
6652
6653            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6654            // are envelope_size bytes.
6655            let cur_offset: usize = (4 - 1) * envelope_size;
6656
6657            // Zero reserved fields.
6658            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6659
6660            // Safety:
6661            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6662            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6663            //   envelope_size bytes, there is always sufficient room.
6664            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BinderMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6665            self.binder.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BinderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6666            encoder, offset + cur_offset, depth
6667        )?;
6668
6669            _prev_end_offset = cur_offset + envelope_size;
6670
6671            Ok(())
6672        }
6673    }
6674
6675    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6676        for DevBinderOpenRequest
6677    {
6678        #[inline(always)]
6679        fn new_empty() -> Self {
6680            Self::default()
6681        }
6682
6683        unsafe fn decode(
6684            &mut self,
6685            decoder: &mut fidl::encoding::Decoder<
6686                '_,
6687                fidl::encoding::DefaultFuchsiaResourceDialect,
6688            >,
6689            offset: usize,
6690            mut depth: fidl::encoding::Depth,
6691        ) -> fidl::Result<()> {
6692            decoder.debug_check_bounds::<Self>(offset);
6693            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6694                None => return Err(fidl::Error::NotNullable),
6695                Some(len) => len,
6696            };
6697            // Calling decoder.out_of_line_offset(0) is not allowed.
6698            if len == 0 {
6699                return Ok(());
6700            };
6701            depth.increment()?;
6702            let envelope_size = 8;
6703            let bytes_len = len * envelope_size;
6704            let offset = decoder.out_of_line_offset(bytes_len)?;
6705            // Decode the envelope for each type.
6706            let mut _next_ordinal_to_read = 0;
6707            let mut next_offset = offset;
6708            let end_offset = offset + bytes_len;
6709            _next_ordinal_to_read += 1;
6710            if next_offset >= end_offset {
6711                return Ok(());
6712            }
6713
6714            // Decode unknown envelopes for gaps in ordinals.
6715            while _next_ordinal_to_read < 1 {
6716                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6717                _next_ordinal_to_read += 1;
6718                next_offset += envelope_size;
6719            }
6720
6721            let next_out_of_line = decoder.next_out_of_line();
6722            let handles_before = decoder.remaining_handles();
6723            if let Some((inlined, num_bytes, num_handles)) =
6724                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6725            {
6726                let member_inline_size =
6727                    <fidl::encoding::Vector<u8, 4095> as fidl::encoding::TypeMarker>::inline_size(
6728                        decoder.context,
6729                    );
6730                if inlined != (member_inline_size <= 4) {
6731                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6732                }
6733                let inner_offset;
6734                let mut inner_depth = depth.clone();
6735                if inlined {
6736                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6737                    inner_offset = next_offset;
6738                } else {
6739                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6740                    inner_depth.increment()?;
6741                }
6742                let val_ref =
6743                self.path.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 4095>, fidl::encoding::DefaultFuchsiaResourceDialect));
6744                fidl::decode!(fidl::encoding::Vector<u8, 4095>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6745                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6746                {
6747                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6748                }
6749                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6750                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6751                }
6752            }
6753
6754            next_offset += envelope_size;
6755            _next_ordinal_to_read += 1;
6756            if next_offset >= end_offset {
6757                return Ok(());
6758            }
6759
6760            // Decode unknown envelopes for gaps in ordinals.
6761            while _next_ordinal_to_read < 2 {
6762                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6763                _next_ordinal_to_read += 1;
6764                next_offset += envelope_size;
6765            }
6766
6767            let next_out_of_line = decoder.next_out_of_line();
6768            let handles_before = decoder.remaining_handles();
6769            if let Some((inlined, num_bytes, num_handles)) =
6770                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6771            {
6772                let member_inline_size = <fidl::encoding::Endpoint<
6773                    fidl::endpoints::ClientEnd<ProcessAccessorMarker>,
6774                > as fidl::encoding::TypeMarker>::inline_size(
6775                    decoder.context
6776                );
6777                if inlined != (member_inline_size <= 4) {
6778                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6779                }
6780                let inner_offset;
6781                let mut inner_depth = depth.clone();
6782                if inlined {
6783                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6784                    inner_offset = next_offset;
6785                } else {
6786                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6787                    inner_depth.increment()?;
6788                }
6789                let val_ref = self.process_accessor.get_or_insert_with(|| {
6790                    fidl::new_empty!(
6791                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProcessAccessorMarker>>,
6792                        fidl::encoding::DefaultFuchsiaResourceDialect
6793                    )
6794                });
6795                fidl::decode!(
6796                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProcessAccessorMarker>>,
6797                    fidl::encoding::DefaultFuchsiaResourceDialect,
6798                    val_ref,
6799                    decoder,
6800                    inner_offset,
6801                    inner_depth
6802                )?;
6803                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6804                {
6805                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6806                }
6807                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6808                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6809                }
6810            }
6811
6812            next_offset += envelope_size;
6813            _next_ordinal_to_read += 1;
6814            if next_offset >= end_offset {
6815                return Ok(());
6816            }
6817
6818            // Decode unknown envelopes for gaps in ordinals.
6819            while _next_ordinal_to_read < 3 {
6820                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6821                _next_ordinal_to_read += 1;
6822                next_offset += envelope_size;
6823            }
6824
6825            let next_out_of_line = decoder.next_out_of_line();
6826            let handles_before = decoder.remaining_handles();
6827            if let Some((inlined, num_bytes, num_handles)) =
6828                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6829            {
6830                let member_inline_size = <fidl::encoding::HandleType<
6831                    fidl::Process,
6832                    { fidl::ObjectType::PROCESS.into_raw() },
6833                    2147483648,
6834                > as fidl::encoding::TypeMarker>::inline_size(
6835                    decoder.context
6836                );
6837                if inlined != (member_inline_size <= 4) {
6838                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6839                }
6840                let inner_offset;
6841                let mut inner_depth = depth.clone();
6842                if inlined {
6843                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6844                    inner_offset = next_offset;
6845                } else {
6846                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6847                    inner_depth.increment()?;
6848                }
6849                let val_ref =
6850                self.process.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6851                fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6852                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6853                {
6854                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6855                }
6856                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6857                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6858                }
6859            }
6860
6861            next_offset += envelope_size;
6862            _next_ordinal_to_read += 1;
6863            if next_offset >= end_offset {
6864                return Ok(());
6865            }
6866
6867            // Decode unknown envelopes for gaps in ordinals.
6868            while _next_ordinal_to_read < 4 {
6869                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6870                _next_ordinal_to_read += 1;
6871                next_offset += envelope_size;
6872            }
6873
6874            let next_out_of_line = decoder.next_out_of_line();
6875            let handles_before = decoder.remaining_handles();
6876            if let Some((inlined, num_bytes, num_handles)) =
6877                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6878            {
6879                let member_inline_size = <fidl::encoding::Endpoint<
6880                    fidl::endpoints::ServerEnd<BinderMarker>,
6881                > as fidl::encoding::TypeMarker>::inline_size(
6882                    decoder.context
6883                );
6884                if inlined != (member_inline_size <= 4) {
6885                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6886                }
6887                let inner_offset;
6888                let mut inner_depth = depth.clone();
6889                if inlined {
6890                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6891                    inner_offset = next_offset;
6892                } else {
6893                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6894                    inner_depth.increment()?;
6895                }
6896                let val_ref = self.binder.get_or_insert_with(|| {
6897                    fidl::new_empty!(
6898                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BinderMarker>>,
6899                        fidl::encoding::DefaultFuchsiaResourceDialect
6900                    )
6901                });
6902                fidl::decode!(
6903                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BinderMarker>>,
6904                    fidl::encoding::DefaultFuchsiaResourceDialect,
6905                    val_ref,
6906                    decoder,
6907                    inner_offset,
6908                    inner_depth
6909                )?;
6910                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6911                {
6912                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6913                }
6914                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6915                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6916                }
6917            }
6918
6919            next_offset += envelope_size;
6920
6921            // Decode the remaining unknown envelopes.
6922            while next_offset < end_offset {
6923                _next_ordinal_to_read += 1;
6924                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6925                next_offset += envelope_size;
6926            }
6927
6928            Ok(())
6929        }
6930    }
6931
6932    impl FileHandle {
6933        #[inline(always)]
6934        fn max_ordinal_present(&self) -> u64 {
6935            if let Some(_) = self.bag {
6936                return 5;
6937            }
6938            if let Some(_) = self.fd {
6939                return 4;
6940            }
6941            if let Some(_) = self.flags {
6942                return 3;
6943            }
6944            if let Some(_) = self.handle {
6945                return 1;
6946            }
6947            0
6948        }
6949    }
6950
6951    impl fidl::encoding::ResourceTypeMarker for FileHandle {
6952        type Borrowed<'a> = &'a mut Self;
6953        fn take_or_borrow<'a>(
6954            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6955        ) -> Self::Borrowed<'a> {
6956            value
6957        }
6958    }
6959
6960    unsafe impl fidl::encoding::TypeMarker for FileHandle {
6961        type Owned = Self;
6962
6963        #[inline(always)]
6964        fn inline_align(_context: fidl::encoding::Context) -> usize {
6965            8
6966        }
6967
6968        #[inline(always)]
6969        fn inline_size(_context: fidl::encoding::Context) -> usize {
6970            16
6971        }
6972    }
6973
6974    unsafe impl fidl::encoding::Encode<FileHandle, fidl::encoding::DefaultFuchsiaResourceDialect>
6975        for &mut FileHandle
6976    {
6977        unsafe fn encode(
6978            self,
6979            encoder: &mut fidl::encoding::Encoder<
6980                '_,
6981                fidl::encoding::DefaultFuchsiaResourceDialect,
6982            >,
6983            offset: usize,
6984            mut depth: fidl::encoding::Depth,
6985        ) -> fidl::Result<()> {
6986            encoder.debug_check_bounds::<FileHandle>(offset);
6987            // Vector header
6988            let max_ordinal: u64 = self.max_ordinal_present();
6989            encoder.write_num(max_ordinal, offset);
6990            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6991            // Calling encoder.out_of_line_offset(0) is not allowed.
6992            if max_ordinal == 0 {
6993                return Ok(());
6994            }
6995            depth.increment()?;
6996            let envelope_size = 8;
6997            let bytes_len = max_ordinal as usize * envelope_size;
6998            #[allow(unused_variables)]
6999            let offset = encoder.out_of_line_offset(bytes_len);
7000            let mut _prev_end_offset: usize = 0;
7001            if 1 > max_ordinal {
7002                return Ok(());
7003            }
7004
7005            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7006            // are envelope_size bytes.
7007            let cur_offset: usize = (1 - 1) * envelope_size;
7008
7009            // Zero reserved fields.
7010            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7011
7012            // Safety:
7013            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7014            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7015            //   envelope_size bytes, there is always sufficient room.
7016            fidl::encoding::encode_in_envelope_optional::<
7017                fidl::encoding::HandleType<
7018                    fidl::NullableHandle,
7019                    { fidl::ObjectType::NONE.into_raw() },
7020                    2147483648,
7021                >,
7022                fidl::encoding::DefaultFuchsiaResourceDialect,
7023            >(
7024                self.handle.as_mut().map(
7025                    <fidl::encoding::HandleType<
7026                        fidl::NullableHandle,
7027                        { fidl::ObjectType::NONE.into_raw() },
7028                        2147483648,
7029                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7030                ),
7031                encoder,
7032                offset + cur_offset,
7033                depth,
7034            )?;
7035
7036            _prev_end_offset = cur_offset + envelope_size;
7037            if 3 > max_ordinal {
7038                return Ok(());
7039            }
7040
7041            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7042            // are envelope_size bytes.
7043            let cur_offset: usize = (3 - 1) * envelope_size;
7044
7045            // Zero reserved fields.
7046            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7047
7048            // Safety:
7049            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7050            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7051            //   envelope_size bytes, there is always sufficient room.
7052            fidl::encoding::encode_in_envelope_optional::<
7053                FileFlags,
7054                fidl::encoding::DefaultFuchsiaResourceDialect,
7055            >(
7056                self.flags.as_ref().map(<FileFlags as fidl::encoding::ValueTypeMarker>::borrow),
7057                encoder,
7058                offset + cur_offset,
7059                depth,
7060            )?;
7061
7062            _prev_end_offset = cur_offset + envelope_size;
7063            if 4 > max_ordinal {
7064                return Ok(());
7065            }
7066
7067            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7068            // are envelope_size bytes.
7069            let cur_offset: usize = (4 - 1) * envelope_size;
7070
7071            // Zero reserved fields.
7072            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7073
7074            // Safety:
7075            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7076            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7077            //   envelope_size bytes, there is always sufficient room.
7078            fidl::encoding::encode_in_envelope_optional::<
7079                i32,
7080                fidl::encoding::DefaultFuchsiaResourceDialect,
7081            >(
7082                self.fd.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
7083                encoder,
7084                offset + cur_offset,
7085                depth,
7086            )?;
7087
7088            _prev_end_offset = cur_offset + envelope_size;
7089            if 5 > max_ordinal {
7090                return Ok(());
7091            }
7092
7093            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7094            // are envelope_size bytes.
7095            let cur_offset: usize = (5 - 1) * envelope_size;
7096
7097            // Zero reserved fields.
7098            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7099
7100            // Safety:
7101            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7102            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7103            //   envelope_size bytes, there is always sufficient room.
7104            fidl::encoding::encode_in_envelope_optional::<
7105                fidl::encoding::Vector<
7106                    fidl::encoding::HandleType<
7107                        fidl::NullableHandle,
7108                        { fidl::ObjectType::NONE.into_raw() },
7109                        2147483648,
7110                    >,
7111                    4,
7112                >,
7113                fidl::encoding::DefaultFuchsiaResourceDialect,
7114            >(
7115                self.bag.as_mut().map(
7116                    <fidl::encoding::Vector<
7117                        fidl::encoding::HandleType<
7118                            fidl::NullableHandle,
7119                            { fidl::ObjectType::NONE.into_raw() },
7120                            2147483648,
7121                        >,
7122                        4,
7123                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7124                ),
7125                encoder,
7126                offset + cur_offset,
7127                depth,
7128            )?;
7129
7130            _prev_end_offset = cur_offset + envelope_size;
7131
7132            Ok(())
7133        }
7134    }
7135
7136    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FileHandle {
7137        #[inline(always)]
7138        fn new_empty() -> Self {
7139            Self::default()
7140        }
7141
7142        unsafe fn decode(
7143            &mut self,
7144            decoder: &mut fidl::encoding::Decoder<
7145                '_,
7146                fidl::encoding::DefaultFuchsiaResourceDialect,
7147            >,
7148            offset: usize,
7149            mut depth: fidl::encoding::Depth,
7150        ) -> fidl::Result<()> {
7151            decoder.debug_check_bounds::<Self>(offset);
7152            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7153                None => return Err(fidl::Error::NotNullable),
7154                Some(len) => len,
7155            };
7156            // Calling decoder.out_of_line_offset(0) is not allowed.
7157            if len == 0 {
7158                return Ok(());
7159            };
7160            depth.increment()?;
7161            let envelope_size = 8;
7162            let bytes_len = len * envelope_size;
7163            let offset = decoder.out_of_line_offset(bytes_len)?;
7164            // Decode the envelope for each type.
7165            let mut _next_ordinal_to_read = 0;
7166            let mut next_offset = offset;
7167            let end_offset = offset + bytes_len;
7168            _next_ordinal_to_read += 1;
7169            if next_offset >= end_offset {
7170                return Ok(());
7171            }
7172
7173            // Decode unknown envelopes for gaps in ordinals.
7174            while _next_ordinal_to_read < 1 {
7175                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7176                _next_ordinal_to_read += 1;
7177                next_offset += envelope_size;
7178            }
7179
7180            let next_out_of_line = decoder.next_out_of_line();
7181            let handles_before = decoder.remaining_handles();
7182            if let Some((inlined, num_bytes, num_handles)) =
7183                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7184            {
7185                let member_inline_size = <fidl::encoding::HandleType<
7186                    fidl::NullableHandle,
7187                    { fidl::ObjectType::NONE.into_raw() },
7188                    2147483648,
7189                > as fidl::encoding::TypeMarker>::inline_size(
7190                    decoder.context
7191                );
7192                if inlined != (member_inline_size <= 4) {
7193                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7194                }
7195                let inner_offset;
7196                let mut inner_depth = depth.clone();
7197                if inlined {
7198                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7199                    inner_offset = next_offset;
7200                } else {
7201                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7202                    inner_depth.increment()?;
7203                }
7204                let val_ref =
7205                self.handle.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
7206                fidl::decode!(fidl::encoding::HandleType<fidl::NullableHandle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7207                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7208                {
7209                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7210                }
7211                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7212                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7213                }
7214            }
7215
7216            next_offset += envelope_size;
7217            _next_ordinal_to_read += 1;
7218            if next_offset >= end_offset {
7219                return Ok(());
7220            }
7221
7222            // Decode unknown envelopes for gaps in ordinals.
7223            while _next_ordinal_to_read < 3 {
7224                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7225                _next_ordinal_to_read += 1;
7226                next_offset += envelope_size;
7227            }
7228
7229            let next_out_of_line = decoder.next_out_of_line();
7230            let handles_before = decoder.remaining_handles();
7231            if let Some((inlined, num_bytes, num_handles)) =
7232                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7233            {
7234                let member_inline_size =
7235                    <FileFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7236                if inlined != (member_inline_size <= 4) {
7237                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7238                }
7239                let inner_offset;
7240                let mut inner_depth = depth.clone();
7241                if inlined {
7242                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7243                    inner_offset = next_offset;
7244                } else {
7245                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7246                    inner_depth.increment()?;
7247                }
7248                let val_ref = self.flags.get_or_insert_with(|| {
7249                    fidl::new_empty!(FileFlags, fidl::encoding::DefaultFuchsiaResourceDialect)
7250                });
7251                fidl::decode!(
7252                    FileFlags,
7253                    fidl::encoding::DefaultFuchsiaResourceDialect,
7254                    val_ref,
7255                    decoder,
7256                    inner_offset,
7257                    inner_depth
7258                )?;
7259                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7260                {
7261                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7262                }
7263                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7264                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7265                }
7266            }
7267
7268            next_offset += envelope_size;
7269            _next_ordinal_to_read += 1;
7270            if next_offset >= end_offset {
7271                return Ok(());
7272            }
7273
7274            // Decode unknown envelopes for gaps in ordinals.
7275            while _next_ordinal_to_read < 4 {
7276                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7277                _next_ordinal_to_read += 1;
7278                next_offset += envelope_size;
7279            }
7280
7281            let next_out_of_line = decoder.next_out_of_line();
7282            let handles_before = decoder.remaining_handles();
7283            if let Some((inlined, num_bytes, num_handles)) =
7284                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7285            {
7286                let member_inline_size =
7287                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7288                if inlined != (member_inline_size <= 4) {
7289                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7290                }
7291                let inner_offset;
7292                let mut inner_depth = depth.clone();
7293                if inlined {
7294                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7295                    inner_offset = next_offset;
7296                } else {
7297                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7298                    inner_depth.increment()?;
7299                }
7300                let val_ref = self.fd.get_or_insert_with(|| {
7301                    fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect)
7302                });
7303                fidl::decode!(
7304                    i32,
7305                    fidl::encoding::DefaultFuchsiaResourceDialect,
7306                    val_ref,
7307                    decoder,
7308                    inner_offset,
7309                    inner_depth
7310                )?;
7311                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7312                {
7313                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7314                }
7315                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7316                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7317                }
7318            }
7319
7320            next_offset += envelope_size;
7321            _next_ordinal_to_read += 1;
7322            if next_offset >= end_offset {
7323                return Ok(());
7324            }
7325
7326            // Decode unknown envelopes for gaps in ordinals.
7327            while _next_ordinal_to_read < 5 {
7328                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7329                _next_ordinal_to_read += 1;
7330                next_offset += envelope_size;
7331            }
7332
7333            let next_out_of_line = decoder.next_out_of_line();
7334            let handles_before = decoder.remaining_handles();
7335            if let Some((inlined, num_bytes, num_handles)) =
7336                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7337            {
7338                let member_inline_size = <fidl::encoding::Vector<
7339                    fidl::encoding::HandleType<
7340                        fidl::NullableHandle,
7341                        { fidl::ObjectType::NONE.into_raw() },
7342                        2147483648,
7343                    >,
7344                    4,
7345                > as fidl::encoding::TypeMarker>::inline_size(
7346                    decoder.context
7347                );
7348                if inlined != (member_inline_size <= 4) {
7349                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7350                }
7351                let inner_offset;
7352                let mut inner_depth = depth.clone();
7353                if inlined {
7354                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7355                    inner_offset = next_offset;
7356                } else {
7357                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7358                    inner_depth.increment()?;
7359                }
7360                let val_ref = self.bag.get_or_insert_with(|| {
7361                    fidl::new_empty!(
7362                        fidl::encoding::Vector<
7363                            fidl::encoding::HandleType<
7364                                fidl::NullableHandle,
7365                                { fidl::ObjectType::NONE.into_raw() },
7366                                2147483648,
7367                            >,
7368                            4,
7369                        >,
7370                        fidl::encoding::DefaultFuchsiaResourceDialect
7371                    )
7372                });
7373                fidl::decode!(
7374                    fidl::encoding::Vector<
7375                        fidl::encoding::HandleType<
7376                            fidl::NullableHandle,
7377                            { fidl::ObjectType::NONE.into_raw() },
7378                            2147483648,
7379                        >,
7380                        4,
7381                    >,
7382                    fidl::encoding::DefaultFuchsiaResourceDialect,
7383                    val_ref,
7384                    decoder,
7385                    inner_offset,
7386                    inner_depth
7387                )?;
7388                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7389                {
7390                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7391                }
7392                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7393                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7394                }
7395            }
7396
7397            next_offset += envelope_size;
7398
7399            // Decode the remaining unknown envelopes.
7400            while next_offset < end_offset {
7401                _next_ordinal_to_read += 1;
7402                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7403                next_offset += envelope_size;
7404            }
7405
7406            Ok(())
7407        }
7408    }
7409
7410    impl FileRequest {
7411        #[inline(always)]
7412        fn max_ordinal_present(&self) -> u64 {
7413            if let Some(_) = self.add_requests {
7414                return 3;
7415            }
7416            if let Some(_) = self.get_requests {
7417                return 2;
7418            }
7419            if let Some(_) = self.close_requests {
7420                return 1;
7421            }
7422            0
7423        }
7424    }
7425
7426    impl fidl::encoding::ResourceTypeMarker for FileRequest {
7427        type Borrowed<'a> = &'a mut Self;
7428        fn take_or_borrow<'a>(
7429            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7430        ) -> Self::Borrowed<'a> {
7431            value
7432        }
7433    }
7434
7435    unsafe impl fidl::encoding::TypeMarker for FileRequest {
7436        type Owned = Self;
7437
7438        #[inline(always)]
7439        fn inline_align(_context: fidl::encoding::Context) -> usize {
7440            8
7441        }
7442
7443        #[inline(always)]
7444        fn inline_size(_context: fidl::encoding::Context) -> usize {
7445            16
7446        }
7447    }
7448
7449    unsafe impl fidl::encoding::Encode<FileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7450        for &mut FileRequest
7451    {
7452        unsafe fn encode(
7453            self,
7454            encoder: &mut fidl::encoding::Encoder<
7455                '_,
7456                fidl::encoding::DefaultFuchsiaResourceDialect,
7457            >,
7458            offset: usize,
7459            mut depth: fidl::encoding::Depth,
7460        ) -> fidl::Result<()> {
7461            encoder.debug_check_bounds::<FileRequest>(offset);
7462            // Vector header
7463            let max_ordinal: u64 = self.max_ordinal_present();
7464            encoder.write_num(max_ordinal, offset);
7465            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7466            // Calling encoder.out_of_line_offset(0) is not allowed.
7467            if max_ordinal == 0 {
7468                return Ok(());
7469            }
7470            depth.increment()?;
7471            let envelope_size = 8;
7472            let bytes_len = max_ordinal as usize * envelope_size;
7473            #[allow(unused_variables)]
7474            let offset = encoder.out_of_line_offset(bytes_len);
7475            let mut _prev_end_offset: usize = 0;
7476            if 1 > max_ordinal {
7477                return Ok(());
7478            }
7479
7480            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7481            // are envelope_size bytes.
7482            let cur_offset: usize = (1 - 1) * envelope_size;
7483
7484            // Zero reserved fields.
7485            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7486
7487            // Safety:
7488            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7489            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7490            //   envelope_size bytes, there is always sufficient room.
7491            fidl::encoding::encode_in_envelope_optional::<
7492                fidl::encoding::Vector<i32, 16>,
7493                fidl::encoding::DefaultFuchsiaResourceDialect,
7494            >(
7495                self.close_requests.as_ref().map(
7496                    <fidl::encoding::Vector<i32, 16> as fidl::encoding::ValueTypeMarker>::borrow,
7497                ),
7498                encoder,
7499                offset + cur_offset,
7500                depth,
7501            )?;
7502
7503            _prev_end_offset = cur_offset + envelope_size;
7504            if 2 > max_ordinal {
7505                return Ok(());
7506            }
7507
7508            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7509            // are envelope_size bytes.
7510            let cur_offset: usize = (2 - 1) * envelope_size;
7511
7512            // Zero reserved fields.
7513            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7514
7515            // Safety:
7516            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7517            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7518            //   envelope_size bytes, there is always sufficient room.
7519            fidl::encoding::encode_in_envelope_optional::<
7520                fidl::encoding::Vector<i32, 16>,
7521                fidl::encoding::DefaultFuchsiaResourceDialect,
7522            >(
7523                self.get_requests.as_ref().map(
7524                    <fidl::encoding::Vector<i32, 16> as fidl::encoding::ValueTypeMarker>::borrow,
7525                ),
7526                encoder,
7527                offset + cur_offset,
7528                depth,
7529            )?;
7530
7531            _prev_end_offset = cur_offset + envelope_size;
7532            if 3 > max_ordinal {
7533                return Ok(());
7534            }
7535
7536            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7537            // are envelope_size bytes.
7538            let cur_offset: usize = (3 - 1) * envelope_size;
7539
7540            // Zero reserved fields.
7541            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7542
7543            // Safety:
7544            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7545            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7546            //   envelope_size bytes, there is always sufficient room.
7547            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FileHandle, 16>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7548            self.add_requests.as_mut().map(<fidl::encoding::Vector<FileHandle, 16> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7549            encoder, offset + cur_offset, depth
7550        )?;
7551
7552            _prev_end_offset = cur_offset + envelope_size;
7553
7554            Ok(())
7555        }
7556    }
7557
7558    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FileRequest {
7559        #[inline(always)]
7560        fn new_empty() -> Self {
7561            Self::default()
7562        }
7563
7564        unsafe fn decode(
7565            &mut self,
7566            decoder: &mut fidl::encoding::Decoder<
7567                '_,
7568                fidl::encoding::DefaultFuchsiaResourceDialect,
7569            >,
7570            offset: usize,
7571            mut depth: fidl::encoding::Depth,
7572        ) -> fidl::Result<()> {
7573            decoder.debug_check_bounds::<Self>(offset);
7574            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7575                None => return Err(fidl::Error::NotNullable),
7576                Some(len) => len,
7577            };
7578            // Calling decoder.out_of_line_offset(0) is not allowed.
7579            if len == 0 {
7580                return Ok(());
7581            };
7582            depth.increment()?;
7583            let envelope_size = 8;
7584            let bytes_len = len * envelope_size;
7585            let offset = decoder.out_of_line_offset(bytes_len)?;
7586            // Decode the envelope for each type.
7587            let mut _next_ordinal_to_read = 0;
7588            let mut next_offset = offset;
7589            let end_offset = offset + bytes_len;
7590            _next_ordinal_to_read += 1;
7591            if next_offset >= end_offset {
7592                return Ok(());
7593            }
7594
7595            // Decode unknown envelopes for gaps in ordinals.
7596            while _next_ordinal_to_read < 1 {
7597                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7598                _next_ordinal_to_read += 1;
7599                next_offset += envelope_size;
7600            }
7601
7602            let next_out_of_line = decoder.next_out_of_line();
7603            let handles_before = decoder.remaining_handles();
7604            if let Some((inlined, num_bytes, num_handles)) =
7605                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7606            {
7607                let member_inline_size =
7608                    <fidl::encoding::Vector<i32, 16> as fidl::encoding::TypeMarker>::inline_size(
7609                        decoder.context,
7610                    );
7611                if inlined != (member_inline_size <= 4) {
7612                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7613                }
7614                let inner_offset;
7615                let mut inner_depth = depth.clone();
7616                if inlined {
7617                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7618                    inner_offset = next_offset;
7619                } else {
7620                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7621                    inner_depth.increment()?;
7622                }
7623                let val_ref =
7624                self.close_requests.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i32, 16>, fidl::encoding::DefaultFuchsiaResourceDialect));
7625                fidl::decode!(fidl::encoding::Vector<i32, 16>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7626                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7627                {
7628                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7629                }
7630                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7631                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7632                }
7633            }
7634
7635            next_offset += envelope_size;
7636            _next_ordinal_to_read += 1;
7637            if next_offset >= end_offset {
7638                return Ok(());
7639            }
7640
7641            // Decode unknown envelopes for gaps in ordinals.
7642            while _next_ordinal_to_read < 2 {
7643                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7644                _next_ordinal_to_read += 1;
7645                next_offset += envelope_size;
7646            }
7647
7648            let next_out_of_line = decoder.next_out_of_line();
7649            let handles_before = decoder.remaining_handles();
7650            if let Some((inlined, num_bytes, num_handles)) =
7651                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7652            {
7653                let member_inline_size =
7654                    <fidl::encoding::Vector<i32, 16> as fidl::encoding::TypeMarker>::inline_size(
7655                        decoder.context,
7656                    );
7657                if inlined != (member_inline_size <= 4) {
7658                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7659                }
7660                let inner_offset;
7661                let mut inner_depth = depth.clone();
7662                if inlined {
7663                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7664                    inner_offset = next_offset;
7665                } else {
7666                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7667                    inner_depth.increment()?;
7668                }
7669                let val_ref =
7670                self.get_requests.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i32, 16>, fidl::encoding::DefaultFuchsiaResourceDialect));
7671                fidl::decode!(fidl::encoding::Vector<i32, 16>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7672                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7673                {
7674                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7675                }
7676                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7677                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7678                }
7679            }
7680
7681            next_offset += envelope_size;
7682            _next_ordinal_to_read += 1;
7683            if next_offset >= end_offset {
7684                return Ok(());
7685            }
7686
7687            // Decode unknown envelopes for gaps in ordinals.
7688            while _next_ordinal_to_read < 3 {
7689                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7690                _next_ordinal_to_read += 1;
7691                next_offset += envelope_size;
7692            }
7693
7694            let next_out_of_line = decoder.next_out_of_line();
7695            let handles_before = decoder.remaining_handles();
7696            if let Some((inlined, num_bytes, num_handles)) =
7697                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7698            {
7699                let member_inline_size = <fidl::encoding::Vector<FileHandle, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7700                if inlined != (member_inline_size <= 4) {
7701                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7702                }
7703                let inner_offset;
7704                let mut inner_depth = depth.clone();
7705                if inlined {
7706                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7707                    inner_offset = next_offset;
7708                } else {
7709                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7710                    inner_depth.increment()?;
7711                }
7712                let val_ref =
7713                self.add_requests.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<FileHandle, 16>, fidl::encoding::DefaultFuchsiaResourceDialect));
7714                fidl::decode!(fidl::encoding::Vector<FileHandle, 16>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7715                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7716                {
7717                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7718                }
7719                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7720                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7721                }
7722            }
7723
7724            next_offset += envelope_size;
7725
7726            // Decode the remaining unknown envelopes.
7727            while next_offset < end_offset {
7728                _next_ordinal_to_read += 1;
7729                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7730                next_offset += envelope_size;
7731            }
7732
7733            Ok(())
7734        }
7735    }
7736
7737    impl FileResponse {
7738        #[inline(always)]
7739        fn max_ordinal_present(&self) -> u64 {
7740            if let Some(_) = self.add_responses {
7741                return 3;
7742            }
7743            if let Some(_) = self.get_responses {
7744                return 2;
7745            }
7746            0
7747        }
7748    }
7749
7750    impl fidl::encoding::ResourceTypeMarker for FileResponse {
7751        type Borrowed<'a> = &'a mut Self;
7752        fn take_or_borrow<'a>(
7753            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7754        ) -> Self::Borrowed<'a> {
7755            value
7756        }
7757    }
7758
7759    unsafe impl fidl::encoding::TypeMarker for FileResponse {
7760        type Owned = Self;
7761
7762        #[inline(always)]
7763        fn inline_align(_context: fidl::encoding::Context) -> usize {
7764            8
7765        }
7766
7767        #[inline(always)]
7768        fn inline_size(_context: fidl::encoding::Context) -> usize {
7769            16
7770        }
7771    }
7772
7773    unsafe impl fidl::encoding::Encode<FileResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
7774        for &mut FileResponse
7775    {
7776        unsafe fn encode(
7777            self,
7778            encoder: &mut fidl::encoding::Encoder<
7779                '_,
7780                fidl::encoding::DefaultFuchsiaResourceDialect,
7781            >,
7782            offset: usize,
7783            mut depth: fidl::encoding::Depth,
7784        ) -> fidl::Result<()> {
7785            encoder.debug_check_bounds::<FileResponse>(offset);
7786            // Vector header
7787            let max_ordinal: u64 = self.max_ordinal_present();
7788            encoder.write_num(max_ordinal, offset);
7789            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7790            // Calling encoder.out_of_line_offset(0) is not allowed.
7791            if max_ordinal == 0 {
7792                return Ok(());
7793            }
7794            depth.increment()?;
7795            let envelope_size = 8;
7796            let bytes_len = max_ordinal as usize * envelope_size;
7797            #[allow(unused_variables)]
7798            let offset = encoder.out_of_line_offset(bytes_len);
7799            let mut _prev_end_offset: usize = 0;
7800            if 2 > max_ordinal {
7801                return Ok(());
7802            }
7803
7804            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7805            // are envelope_size bytes.
7806            let cur_offset: usize = (2 - 1) * envelope_size;
7807
7808            // Zero reserved fields.
7809            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7810
7811            // Safety:
7812            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7813            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7814            //   envelope_size bytes, there is always sufficient room.
7815            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FileHandle, 16>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7816            self.get_responses.as_mut().map(<fidl::encoding::Vector<FileHandle, 16> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7817            encoder, offset + cur_offset, depth
7818        )?;
7819
7820            _prev_end_offset = cur_offset + envelope_size;
7821            if 3 > max_ordinal {
7822                return Ok(());
7823            }
7824
7825            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7826            // are envelope_size bytes.
7827            let cur_offset: usize = (3 - 1) * envelope_size;
7828
7829            // Zero reserved fields.
7830            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7831
7832            // Safety:
7833            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7834            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7835            //   envelope_size bytes, there is always sufficient room.
7836            fidl::encoding::encode_in_envelope_optional::<
7837                fidl::encoding::Vector<i32, 16>,
7838                fidl::encoding::DefaultFuchsiaResourceDialect,
7839            >(
7840                self.add_responses.as_ref().map(
7841                    <fidl::encoding::Vector<i32, 16> as fidl::encoding::ValueTypeMarker>::borrow,
7842                ),
7843                encoder,
7844                offset + cur_offset,
7845                depth,
7846            )?;
7847
7848            _prev_end_offset = cur_offset + envelope_size;
7849
7850            Ok(())
7851        }
7852    }
7853
7854    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FileResponse {
7855        #[inline(always)]
7856        fn new_empty() -> Self {
7857            Self::default()
7858        }
7859
7860        unsafe fn decode(
7861            &mut self,
7862            decoder: &mut fidl::encoding::Decoder<
7863                '_,
7864                fidl::encoding::DefaultFuchsiaResourceDialect,
7865            >,
7866            offset: usize,
7867            mut depth: fidl::encoding::Depth,
7868        ) -> fidl::Result<()> {
7869            decoder.debug_check_bounds::<Self>(offset);
7870            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7871                None => return Err(fidl::Error::NotNullable),
7872                Some(len) => len,
7873            };
7874            // Calling decoder.out_of_line_offset(0) is not allowed.
7875            if len == 0 {
7876                return Ok(());
7877            };
7878            depth.increment()?;
7879            let envelope_size = 8;
7880            let bytes_len = len * envelope_size;
7881            let offset = decoder.out_of_line_offset(bytes_len)?;
7882            // Decode the envelope for each type.
7883            let mut _next_ordinal_to_read = 0;
7884            let mut next_offset = offset;
7885            let end_offset = offset + bytes_len;
7886            _next_ordinal_to_read += 1;
7887            if next_offset >= end_offset {
7888                return Ok(());
7889            }
7890
7891            // Decode unknown envelopes for gaps in ordinals.
7892            while _next_ordinal_to_read < 2 {
7893                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7894                _next_ordinal_to_read += 1;
7895                next_offset += envelope_size;
7896            }
7897
7898            let next_out_of_line = decoder.next_out_of_line();
7899            let handles_before = decoder.remaining_handles();
7900            if let Some((inlined, num_bytes, num_handles)) =
7901                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7902            {
7903                let member_inline_size = <fidl::encoding::Vector<FileHandle, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7904                if inlined != (member_inline_size <= 4) {
7905                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7906                }
7907                let inner_offset;
7908                let mut inner_depth = depth.clone();
7909                if inlined {
7910                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7911                    inner_offset = next_offset;
7912                } else {
7913                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7914                    inner_depth.increment()?;
7915                }
7916                let val_ref =
7917                self.get_responses.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<FileHandle, 16>, fidl::encoding::DefaultFuchsiaResourceDialect));
7918                fidl::decode!(fidl::encoding::Vector<FileHandle, 16>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7919                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7920                {
7921                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7922                }
7923                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7924                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7925                }
7926            }
7927
7928            next_offset += envelope_size;
7929            _next_ordinal_to_read += 1;
7930            if next_offset >= end_offset {
7931                return Ok(());
7932            }
7933
7934            // Decode unknown envelopes for gaps in ordinals.
7935            while _next_ordinal_to_read < 3 {
7936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7937                _next_ordinal_to_read += 1;
7938                next_offset += envelope_size;
7939            }
7940
7941            let next_out_of_line = decoder.next_out_of_line();
7942            let handles_before = decoder.remaining_handles();
7943            if let Some((inlined, num_bytes, num_handles)) =
7944                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7945            {
7946                let member_inline_size =
7947                    <fidl::encoding::Vector<i32, 16> as fidl::encoding::TypeMarker>::inline_size(
7948                        decoder.context,
7949                    );
7950                if inlined != (member_inline_size <= 4) {
7951                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7952                }
7953                let inner_offset;
7954                let mut inner_depth = depth.clone();
7955                if inlined {
7956                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7957                    inner_offset = next_offset;
7958                } else {
7959                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7960                    inner_depth.increment()?;
7961                }
7962                let val_ref =
7963                self.add_responses.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i32, 16>, fidl::encoding::DefaultFuchsiaResourceDialect));
7964                fidl::decode!(fidl::encoding::Vector<i32, 16>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7965                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7966                {
7967                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7968                }
7969                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7970                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7971                }
7972            }
7973
7974            next_offset += envelope_size;
7975
7976            // Decode the remaining unknown envelopes.
7977            while next_offset < end_offset {
7978                _next_ordinal_to_read += 1;
7979                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7980                next_offset += envelope_size;
7981            }
7982
7983            Ok(())
7984        }
7985    }
7986
7987    impl RemoteControllerStartRequest {
7988        #[inline(always)]
7989        fn max_ordinal_present(&self) -> u64 {
7990            if let Some(_) = self.container_power_controller {
7991                return 3;
7992            }
7993            if let Some(_) = self.lutex_controller {
7994                return 2;
7995            }
7996            if let Some(_) = self.dev_binder {
7997                return 1;
7998            }
7999            0
8000        }
8001    }
8002
8003    impl fidl::encoding::ResourceTypeMarker for RemoteControllerStartRequest {
8004        type Borrowed<'a> = &'a mut Self;
8005        fn take_or_borrow<'a>(
8006            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8007        ) -> Self::Borrowed<'a> {
8008            value
8009        }
8010    }
8011
8012    unsafe impl fidl::encoding::TypeMarker for RemoteControllerStartRequest {
8013        type Owned = Self;
8014
8015        #[inline(always)]
8016        fn inline_align(_context: fidl::encoding::Context) -> usize {
8017            8
8018        }
8019
8020        #[inline(always)]
8021        fn inline_size(_context: fidl::encoding::Context) -> usize {
8022            16
8023        }
8024    }
8025
8026    unsafe impl
8027        fidl::encoding::Encode<
8028            RemoteControllerStartRequest,
8029            fidl::encoding::DefaultFuchsiaResourceDialect,
8030        > for &mut RemoteControllerStartRequest
8031    {
8032        unsafe fn encode(
8033            self,
8034            encoder: &mut fidl::encoding::Encoder<
8035                '_,
8036                fidl::encoding::DefaultFuchsiaResourceDialect,
8037            >,
8038            offset: usize,
8039            mut depth: fidl::encoding::Depth,
8040        ) -> fidl::Result<()> {
8041            encoder.debug_check_bounds::<RemoteControllerStartRequest>(offset);
8042            // Vector header
8043            let max_ordinal: u64 = self.max_ordinal_present();
8044            encoder.write_num(max_ordinal, offset);
8045            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8046            // Calling encoder.out_of_line_offset(0) is not allowed.
8047            if max_ordinal == 0 {
8048                return Ok(());
8049            }
8050            depth.increment()?;
8051            let envelope_size = 8;
8052            let bytes_len = max_ordinal as usize * envelope_size;
8053            #[allow(unused_variables)]
8054            let offset = encoder.out_of_line_offset(bytes_len);
8055            let mut _prev_end_offset: usize = 0;
8056            if 1 > max_ordinal {
8057                return Ok(());
8058            }
8059
8060            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8061            // are envelope_size bytes.
8062            let cur_offset: usize = (1 - 1) * envelope_size;
8063
8064            // Zero reserved fields.
8065            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8066
8067            // Safety:
8068            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8069            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8070            //   envelope_size bytes, there is always sufficient room.
8071            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevBinderMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8072            self.dev_binder.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevBinderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8073            encoder, offset + cur_offset, depth
8074        )?;
8075
8076            _prev_end_offset = cur_offset + envelope_size;
8077            if 2 > max_ordinal {
8078                return Ok(());
8079            }
8080
8081            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8082            // are envelope_size bytes.
8083            let cur_offset: usize = (2 - 1) * envelope_size;
8084
8085            // Zero reserved fields.
8086            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8087
8088            // Safety:
8089            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8090            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8091            //   envelope_size bytes, there is always sufficient room.
8092            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LutexControllerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8093            self.lutex_controller.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LutexControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8094            encoder, offset + cur_offset, depth
8095        )?;
8096
8097            _prev_end_offset = cur_offset + envelope_size;
8098            if 3 > max_ordinal {
8099                return Ok(());
8100            }
8101
8102            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8103            // are envelope_size bytes.
8104            let cur_offset: usize = (3 - 1) * envelope_size;
8105
8106            // Zero reserved fields.
8107            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8108
8109            // Safety:
8110            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8111            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8112            //   envelope_size bytes, there is always sufficient room.
8113            fidl::encoding::encode_in_envelope_optional::<
8114                fidl::encoding::Endpoint<
8115                    fidl::endpoints::ClientEnd<ContainerPowerControllerMarker>,
8116                >,
8117                fidl::encoding::DefaultFuchsiaResourceDialect,
8118            >(
8119                self.container_power_controller.as_mut().map(
8120                    <fidl::encoding::Endpoint<
8121                        fidl::endpoints::ClientEnd<ContainerPowerControllerMarker>,
8122                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
8123                ),
8124                encoder,
8125                offset + cur_offset,
8126                depth,
8127            )?;
8128
8129            _prev_end_offset = cur_offset + envelope_size;
8130
8131            Ok(())
8132        }
8133    }
8134
8135    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8136        for RemoteControllerStartRequest
8137    {
8138        #[inline(always)]
8139        fn new_empty() -> Self {
8140            Self::default()
8141        }
8142
8143        unsafe fn decode(
8144            &mut self,
8145            decoder: &mut fidl::encoding::Decoder<
8146                '_,
8147                fidl::encoding::DefaultFuchsiaResourceDialect,
8148            >,
8149            offset: usize,
8150            mut depth: fidl::encoding::Depth,
8151        ) -> fidl::Result<()> {
8152            decoder.debug_check_bounds::<Self>(offset);
8153            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8154                None => return Err(fidl::Error::NotNullable),
8155                Some(len) => len,
8156            };
8157            // Calling decoder.out_of_line_offset(0) is not allowed.
8158            if len == 0 {
8159                return Ok(());
8160            };
8161            depth.increment()?;
8162            let envelope_size = 8;
8163            let bytes_len = len * envelope_size;
8164            let offset = decoder.out_of_line_offset(bytes_len)?;
8165            // Decode the envelope for each type.
8166            let mut _next_ordinal_to_read = 0;
8167            let mut next_offset = offset;
8168            let end_offset = offset + bytes_len;
8169            _next_ordinal_to_read += 1;
8170            if next_offset >= end_offset {
8171                return Ok(());
8172            }
8173
8174            // Decode unknown envelopes for gaps in ordinals.
8175            while _next_ordinal_to_read < 1 {
8176                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8177                _next_ordinal_to_read += 1;
8178                next_offset += envelope_size;
8179            }
8180
8181            let next_out_of_line = decoder.next_out_of_line();
8182            let handles_before = decoder.remaining_handles();
8183            if let Some((inlined, num_bytes, num_handles)) =
8184                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8185            {
8186                let member_inline_size = <fidl::encoding::Endpoint<
8187                    fidl::endpoints::ClientEnd<DevBinderMarker>,
8188                > as fidl::encoding::TypeMarker>::inline_size(
8189                    decoder.context
8190                );
8191                if inlined != (member_inline_size <= 4) {
8192                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8193                }
8194                let inner_offset;
8195                let mut inner_depth = depth.clone();
8196                if inlined {
8197                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8198                    inner_offset = next_offset;
8199                } else {
8200                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8201                    inner_depth.increment()?;
8202                }
8203                let val_ref = self.dev_binder.get_or_insert_with(|| {
8204                    fidl::new_empty!(
8205                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevBinderMarker>>,
8206                        fidl::encoding::DefaultFuchsiaResourceDialect
8207                    )
8208                });
8209                fidl::decode!(
8210                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevBinderMarker>>,
8211                    fidl::encoding::DefaultFuchsiaResourceDialect,
8212                    val_ref,
8213                    decoder,
8214                    inner_offset,
8215                    inner_depth
8216                )?;
8217                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8218                {
8219                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8220                }
8221                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8222                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8223                }
8224            }
8225
8226            next_offset += envelope_size;
8227            _next_ordinal_to_read += 1;
8228            if next_offset >= end_offset {
8229                return Ok(());
8230            }
8231
8232            // Decode unknown envelopes for gaps in ordinals.
8233            while _next_ordinal_to_read < 2 {
8234                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8235                _next_ordinal_to_read += 1;
8236                next_offset += envelope_size;
8237            }
8238
8239            let next_out_of_line = decoder.next_out_of_line();
8240            let handles_before = decoder.remaining_handles();
8241            if let Some((inlined, num_bytes, num_handles)) =
8242                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8243            {
8244                let member_inline_size = <fidl::encoding::Endpoint<
8245                    fidl::endpoints::ClientEnd<LutexControllerMarker>,
8246                > as fidl::encoding::TypeMarker>::inline_size(
8247                    decoder.context
8248                );
8249                if inlined != (member_inline_size <= 4) {
8250                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8251                }
8252                let inner_offset;
8253                let mut inner_depth = depth.clone();
8254                if inlined {
8255                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8256                    inner_offset = next_offset;
8257                } else {
8258                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8259                    inner_depth.increment()?;
8260                }
8261                let val_ref = self.lutex_controller.get_or_insert_with(|| {
8262                    fidl::new_empty!(
8263                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LutexControllerMarker>>,
8264                        fidl::encoding::DefaultFuchsiaResourceDialect
8265                    )
8266                });
8267                fidl::decode!(
8268                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LutexControllerMarker>>,
8269                    fidl::encoding::DefaultFuchsiaResourceDialect,
8270                    val_ref,
8271                    decoder,
8272                    inner_offset,
8273                    inner_depth
8274                )?;
8275                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8276                {
8277                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8278                }
8279                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8280                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8281                }
8282            }
8283
8284            next_offset += envelope_size;
8285            _next_ordinal_to_read += 1;
8286            if next_offset >= end_offset {
8287                return Ok(());
8288            }
8289
8290            // Decode unknown envelopes for gaps in ordinals.
8291            while _next_ordinal_to_read < 3 {
8292                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8293                _next_ordinal_to_read += 1;
8294                next_offset += envelope_size;
8295            }
8296
8297            let next_out_of_line = decoder.next_out_of_line();
8298            let handles_before = decoder.remaining_handles();
8299            if let Some((inlined, num_bytes, num_handles)) =
8300                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8301            {
8302                let member_inline_size = <fidl::encoding::Endpoint<
8303                    fidl::endpoints::ClientEnd<ContainerPowerControllerMarker>,
8304                > as fidl::encoding::TypeMarker>::inline_size(
8305                    decoder.context
8306                );
8307                if inlined != (member_inline_size <= 4) {
8308                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8309                }
8310                let inner_offset;
8311                let mut inner_depth = depth.clone();
8312                if inlined {
8313                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8314                    inner_offset = next_offset;
8315                } else {
8316                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8317                    inner_depth.increment()?;
8318                }
8319                let val_ref = self.container_power_controller.get_or_insert_with(|| {
8320                    fidl::new_empty!(
8321                        fidl::encoding::Endpoint<
8322                            fidl::endpoints::ClientEnd<ContainerPowerControllerMarker>,
8323                        >,
8324                        fidl::encoding::DefaultFuchsiaResourceDialect
8325                    )
8326                });
8327                fidl::decode!(
8328                    fidl::encoding::Endpoint<
8329                        fidl::endpoints::ClientEnd<ContainerPowerControllerMarker>,
8330                    >,
8331                    fidl::encoding::DefaultFuchsiaResourceDialect,
8332                    val_ref,
8333                    decoder,
8334                    inner_offset,
8335                    inner_depth
8336                )?;
8337                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8338                {
8339                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8340                }
8341                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8342                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8343                }
8344            }
8345
8346            next_offset += envelope_size;
8347
8348            // Decode the remaining unknown envelopes.
8349            while next_offset < end_offset {
8350                _next_ordinal_to_read += 1;
8351                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8352                next_offset += envelope_size;
8353            }
8354
8355            Ok(())
8356        }
8357    }
8358
8359    impl UnixDomainSocketWriteRequest {
8360        #[inline(always)]
8361        fn max_ordinal_present(&self) -> u64 {
8362            if let Some(_) = self.handles {
8363                return 2;
8364            }
8365            if let Some(_) = self.data {
8366                return 1;
8367            }
8368            0
8369        }
8370    }
8371
8372    impl fidl::encoding::ResourceTypeMarker for UnixDomainSocketWriteRequest {
8373        type Borrowed<'a> = &'a mut Self;
8374        fn take_or_borrow<'a>(
8375            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8376        ) -> Self::Borrowed<'a> {
8377            value
8378        }
8379    }
8380
8381    unsafe impl fidl::encoding::TypeMarker for UnixDomainSocketWriteRequest {
8382        type Owned = Self;
8383
8384        #[inline(always)]
8385        fn inline_align(_context: fidl::encoding::Context) -> usize {
8386            8
8387        }
8388
8389        #[inline(always)]
8390        fn inline_size(_context: fidl::encoding::Context) -> usize {
8391            16
8392        }
8393    }
8394
8395    unsafe impl
8396        fidl::encoding::Encode<
8397            UnixDomainSocketWriteRequest,
8398            fidl::encoding::DefaultFuchsiaResourceDialect,
8399        > for &mut UnixDomainSocketWriteRequest
8400    {
8401        unsafe fn encode(
8402            self,
8403            encoder: &mut fidl::encoding::Encoder<
8404                '_,
8405                fidl::encoding::DefaultFuchsiaResourceDialect,
8406            >,
8407            offset: usize,
8408            mut depth: fidl::encoding::Depth,
8409        ) -> fidl::Result<()> {
8410            encoder.debug_check_bounds::<UnixDomainSocketWriteRequest>(offset);
8411            // Vector header
8412            let max_ordinal: u64 = self.max_ordinal_present();
8413            encoder.write_num(max_ordinal, offset);
8414            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8415            // Calling encoder.out_of_line_offset(0) is not allowed.
8416            if max_ordinal == 0 {
8417                return Ok(());
8418            }
8419            depth.increment()?;
8420            let envelope_size = 8;
8421            let bytes_len = max_ordinal as usize * envelope_size;
8422            #[allow(unused_variables)]
8423            let offset = encoder.out_of_line_offset(bytes_len);
8424            let mut _prev_end_offset: usize = 0;
8425            if 1 > max_ordinal {
8426                return Ok(());
8427            }
8428
8429            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8430            // are envelope_size bytes.
8431            let cur_offset: usize = (1 - 1) * envelope_size;
8432
8433            // Zero reserved fields.
8434            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8435
8436            // Safety:
8437            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8438            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8439            //   envelope_size bytes, there is always sufficient room.
8440            fidl::encoding::encode_in_envelope_optional::<
8441                fidl::encoding::Vector<u8, 8192>,
8442                fidl::encoding::DefaultFuchsiaResourceDialect,
8443            >(
8444                self.data.as_ref().map(
8445                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow,
8446                ),
8447                encoder,
8448                offset + cur_offset,
8449                depth,
8450            )?;
8451
8452            _prev_end_offset = cur_offset + envelope_size;
8453            if 2 > max_ordinal {
8454                return Ok(());
8455            }
8456
8457            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8458            // are envelope_size bytes.
8459            let cur_offset: usize = (2 - 1) * envelope_size;
8460
8461            // Zero reserved fields.
8462            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8463
8464            // Safety:
8465            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8466            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8467            //   envelope_size bytes, there is always sufficient room.
8468            fidl::encoding::encode_in_envelope_optional::<
8469                fidl::encoding::Vector<
8470                    fidl::encoding::HandleType<
8471                        fidl::NullableHandle,
8472                        { fidl::ObjectType::NONE.into_raw() },
8473                        2147483648,
8474                    >,
8475                    4,
8476                >,
8477                fidl::encoding::DefaultFuchsiaResourceDialect,
8478            >(
8479                self.handles.as_mut().map(
8480                    <fidl::encoding::Vector<
8481                        fidl::encoding::HandleType<
8482                            fidl::NullableHandle,
8483                            { fidl::ObjectType::NONE.into_raw() },
8484                            2147483648,
8485                        >,
8486                        4,
8487                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
8488                ),
8489                encoder,
8490                offset + cur_offset,
8491                depth,
8492            )?;
8493
8494            _prev_end_offset = cur_offset + envelope_size;
8495
8496            Ok(())
8497        }
8498    }
8499
8500    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8501        for UnixDomainSocketWriteRequest
8502    {
8503        #[inline(always)]
8504        fn new_empty() -> Self {
8505            Self::default()
8506        }
8507
8508        unsafe fn decode(
8509            &mut self,
8510            decoder: &mut fidl::encoding::Decoder<
8511                '_,
8512                fidl::encoding::DefaultFuchsiaResourceDialect,
8513            >,
8514            offset: usize,
8515            mut depth: fidl::encoding::Depth,
8516        ) -> fidl::Result<()> {
8517            decoder.debug_check_bounds::<Self>(offset);
8518            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8519                None => return Err(fidl::Error::NotNullable),
8520                Some(len) => len,
8521            };
8522            // Calling decoder.out_of_line_offset(0) is not allowed.
8523            if len == 0 {
8524                return Ok(());
8525            };
8526            depth.increment()?;
8527            let envelope_size = 8;
8528            let bytes_len = len * envelope_size;
8529            let offset = decoder.out_of_line_offset(bytes_len)?;
8530            // Decode the envelope for each type.
8531            let mut _next_ordinal_to_read = 0;
8532            let mut next_offset = offset;
8533            let end_offset = offset + bytes_len;
8534            _next_ordinal_to_read += 1;
8535            if next_offset >= end_offset {
8536                return Ok(());
8537            }
8538
8539            // Decode unknown envelopes for gaps in ordinals.
8540            while _next_ordinal_to_read < 1 {
8541                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8542                _next_ordinal_to_read += 1;
8543                next_offset += envelope_size;
8544            }
8545
8546            let next_out_of_line = decoder.next_out_of_line();
8547            let handles_before = decoder.remaining_handles();
8548            if let Some((inlined, num_bytes, num_handles)) =
8549                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8550            {
8551                let member_inline_size =
8552                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
8553                        decoder.context,
8554                    );
8555                if inlined != (member_inline_size <= 4) {
8556                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8557                }
8558                let inner_offset;
8559                let mut inner_depth = depth.clone();
8560                if inlined {
8561                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8562                    inner_offset = next_offset;
8563                } else {
8564                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8565                    inner_depth.increment()?;
8566                }
8567                let val_ref =
8568                self.data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect));
8569                fidl::decode!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8570                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8571                {
8572                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8573                }
8574                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8575                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8576                }
8577            }
8578
8579            next_offset += envelope_size;
8580            _next_ordinal_to_read += 1;
8581            if next_offset >= end_offset {
8582                return Ok(());
8583            }
8584
8585            // Decode unknown envelopes for gaps in ordinals.
8586            while _next_ordinal_to_read < 2 {
8587                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8588                _next_ordinal_to_read += 1;
8589                next_offset += envelope_size;
8590            }
8591
8592            let next_out_of_line = decoder.next_out_of_line();
8593            let handles_before = decoder.remaining_handles();
8594            if let Some((inlined, num_bytes, num_handles)) =
8595                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8596            {
8597                let member_inline_size = <fidl::encoding::Vector<
8598                    fidl::encoding::HandleType<
8599                        fidl::NullableHandle,
8600                        { fidl::ObjectType::NONE.into_raw() },
8601                        2147483648,
8602                    >,
8603                    4,
8604                > as fidl::encoding::TypeMarker>::inline_size(
8605                    decoder.context
8606                );
8607                if inlined != (member_inline_size <= 4) {
8608                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8609                }
8610                let inner_offset;
8611                let mut inner_depth = depth.clone();
8612                if inlined {
8613                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8614                    inner_offset = next_offset;
8615                } else {
8616                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8617                    inner_depth.increment()?;
8618                }
8619                let val_ref = self.handles.get_or_insert_with(|| {
8620                    fidl::new_empty!(
8621                        fidl::encoding::Vector<
8622                            fidl::encoding::HandleType<
8623                                fidl::NullableHandle,
8624                                { fidl::ObjectType::NONE.into_raw() },
8625                                2147483648,
8626                            >,
8627                            4,
8628                        >,
8629                        fidl::encoding::DefaultFuchsiaResourceDialect
8630                    )
8631                });
8632                fidl::decode!(
8633                    fidl::encoding::Vector<
8634                        fidl::encoding::HandleType<
8635                            fidl::NullableHandle,
8636                            { fidl::ObjectType::NONE.into_raw() },
8637                            2147483648,
8638                        >,
8639                        4,
8640                    >,
8641                    fidl::encoding::DefaultFuchsiaResourceDialect,
8642                    val_ref,
8643                    decoder,
8644                    inner_offset,
8645                    inner_depth
8646                )?;
8647                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8648                {
8649                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8650                }
8651                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8652                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8653                }
8654            }
8655
8656            next_offset += envelope_size;
8657
8658            // Decode the remaining unknown envelopes.
8659            while next_offset < end_offset {
8660                _next_ordinal_to_read += 1;
8661                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8662                next_offset += envelope_size;
8663            }
8664
8665            Ok(())
8666        }
8667    }
8668
8669    impl UnixDomainSocketGetEventResponse {
8670        #[inline(always)]
8671        fn max_ordinal_present(&self) -> u64 {
8672            if let Some(_) = self.event {
8673                return 1;
8674            }
8675            0
8676        }
8677    }
8678
8679    impl fidl::encoding::ResourceTypeMarker for UnixDomainSocketGetEventResponse {
8680        type Borrowed<'a> = &'a mut Self;
8681        fn take_or_borrow<'a>(
8682            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8683        ) -> Self::Borrowed<'a> {
8684            value
8685        }
8686    }
8687
8688    unsafe impl fidl::encoding::TypeMarker for UnixDomainSocketGetEventResponse {
8689        type Owned = Self;
8690
8691        #[inline(always)]
8692        fn inline_align(_context: fidl::encoding::Context) -> usize {
8693            8
8694        }
8695
8696        #[inline(always)]
8697        fn inline_size(_context: fidl::encoding::Context) -> usize {
8698            16
8699        }
8700    }
8701
8702    unsafe impl
8703        fidl::encoding::Encode<
8704            UnixDomainSocketGetEventResponse,
8705            fidl::encoding::DefaultFuchsiaResourceDialect,
8706        > for &mut UnixDomainSocketGetEventResponse
8707    {
8708        unsafe fn encode(
8709            self,
8710            encoder: &mut fidl::encoding::Encoder<
8711                '_,
8712                fidl::encoding::DefaultFuchsiaResourceDialect,
8713            >,
8714            offset: usize,
8715            mut depth: fidl::encoding::Depth,
8716        ) -> fidl::Result<()> {
8717            encoder.debug_check_bounds::<UnixDomainSocketGetEventResponse>(offset);
8718            // Vector header
8719            let max_ordinal: u64 = self.max_ordinal_present();
8720            encoder.write_num(max_ordinal, offset);
8721            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8722            // Calling encoder.out_of_line_offset(0) is not allowed.
8723            if max_ordinal == 0 {
8724                return Ok(());
8725            }
8726            depth.increment()?;
8727            let envelope_size = 8;
8728            let bytes_len = max_ordinal as usize * envelope_size;
8729            #[allow(unused_variables)]
8730            let offset = encoder.out_of_line_offset(bytes_len);
8731            let mut _prev_end_offset: usize = 0;
8732            if 1 > max_ordinal {
8733                return Ok(());
8734            }
8735
8736            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8737            // are envelope_size bytes.
8738            let cur_offset: usize = (1 - 1) * envelope_size;
8739
8740            // Zero reserved fields.
8741            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8742
8743            // Safety:
8744            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8745            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8746            //   envelope_size bytes, there is always sufficient room.
8747            fidl::encoding::encode_in_envelope_optional::<
8748                fidl::encoding::HandleType<
8749                    fidl::EventPair,
8750                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8751                    20482,
8752                >,
8753                fidl::encoding::DefaultFuchsiaResourceDialect,
8754            >(
8755                self.event.as_mut().map(
8756                    <fidl::encoding::HandleType<
8757                        fidl::EventPair,
8758                        { fidl::ObjectType::EVENTPAIR.into_raw() },
8759                        20482,
8760                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
8761                ),
8762                encoder,
8763                offset + cur_offset,
8764                depth,
8765            )?;
8766
8767            _prev_end_offset = cur_offset + envelope_size;
8768
8769            Ok(())
8770        }
8771    }
8772
8773    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8774        for UnixDomainSocketGetEventResponse
8775    {
8776        #[inline(always)]
8777        fn new_empty() -> Self {
8778            Self::default()
8779        }
8780
8781        unsafe fn decode(
8782            &mut self,
8783            decoder: &mut fidl::encoding::Decoder<
8784                '_,
8785                fidl::encoding::DefaultFuchsiaResourceDialect,
8786            >,
8787            offset: usize,
8788            mut depth: fidl::encoding::Depth,
8789        ) -> fidl::Result<()> {
8790            decoder.debug_check_bounds::<Self>(offset);
8791            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8792                None => return Err(fidl::Error::NotNullable),
8793                Some(len) => len,
8794            };
8795            // Calling decoder.out_of_line_offset(0) is not allowed.
8796            if len == 0 {
8797                return Ok(());
8798            };
8799            depth.increment()?;
8800            let envelope_size = 8;
8801            let bytes_len = len * envelope_size;
8802            let offset = decoder.out_of_line_offset(bytes_len)?;
8803            // Decode the envelope for each type.
8804            let mut _next_ordinal_to_read = 0;
8805            let mut next_offset = offset;
8806            let end_offset = offset + bytes_len;
8807            _next_ordinal_to_read += 1;
8808            if next_offset >= end_offset {
8809                return Ok(());
8810            }
8811
8812            // Decode unknown envelopes for gaps in ordinals.
8813            while _next_ordinal_to_read < 1 {
8814                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8815                _next_ordinal_to_read += 1;
8816                next_offset += envelope_size;
8817            }
8818
8819            let next_out_of_line = decoder.next_out_of_line();
8820            let handles_before = decoder.remaining_handles();
8821            if let Some((inlined, num_bytes, num_handles)) =
8822                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8823            {
8824                let member_inline_size = <fidl::encoding::HandleType<
8825                    fidl::EventPair,
8826                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8827                    20482,
8828                > as fidl::encoding::TypeMarker>::inline_size(
8829                    decoder.context
8830                );
8831                if inlined != (member_inline_size <= 4) {
8832                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8833                }
8834                let inner_offset;
8835                let mut inner_depth = depth.clone();
8836                if inlined {
8837                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8838                    inner_offset = next_offset;
8839                } else {
8840                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8841                    inner_depth.increment()?;
8842                }
8843                let val_ref =
8844                self.event.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 20482>, fidl::encoding::DefaultFuchsiaResourceDialect));
8845                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 20482>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8846                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8847                {
8848                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8849                }
8850                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8851                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8852                }
8853            }
8854
8855            next_offset += envelope_size;
8856
8857            // Decode the remaining unknown envelopes.
8858            while next_offset < end_offset {
8859                _next_ordinal_to_read += 1;
8860                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8861                next_offset += envelope_size;
8862            }
8863
8864            Ok(())
8865        }
8866    }
8867
8868    impl UnixDomainSocketReadResponse {
8869        #[inline(always)]
8870        fn max_ordinal_present(&self) -> u64 {
8871            if let Some(_) = self.handles {
8872                return 3;
8873            }
8874            if let Some(_) = self.data_original_length {
8875                return 2;
8876            }
8877            if let Some(_) = self.data {
8878                return 1;
8879            }
8880            0
8881        }
8882    }
8883
8884    impl fidl::encoding::ResourceTypeMarker for UnixDomainSocketReadResponse {
8885        type Borrowed<'a> = &'a mut Self;
8886        fn take_or_borrow<'a>(
8887            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8888        ) -> Self::Borrowed<'a> {
8889            value
8890        }
8891    }
8892
8893    unsafe impl fidl::encoding::TypeMarker for UnixDomainSocketReadResponse {
8894        type Owned = Self;
8895
8896        #[inline(always)]
8897        fn inline_align(_context: fidl::encoding::Context) -> usize {
8898            8
8899        }
8900
8901        #[inline(always)]
8902        fn inline_size(_context: fidl::encoding::Context) -> usize {
8903            16
8904        }
8905    }
8906
8907    unsafe impl
8908        fidl::encoding::Encode<
8909            UnixDomainSocketReadResponse,
8910            fidl::encoding::DefaultFuchsiaResourceDialect,
8911        > for &mut UnixDomainSocketReadResponse
8912    {
8913        unsafe fn encode(
8914            self,
8915            encoder: &mut fidl::encoding::Encoder<
8916                '_,
8917                fidl::encoding::DefaultFuchsiaResourceDialect,
8918            >,
8919            offset: usize,
8920            mut depth: fidl::encoding::Depth,
8921        ) -> fidl::Result<()> {
8922            encoder.debug_check_bounds::<UnixDomainSocketReadResponse>(offset);
8923            // Vector header
8924            let max_ordinal: u64 = self.max_ordinal_present();
8925            encoder.write_num(max_ordinal, offset);
8926            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8927            // Calling encoder.out_of_line_offset(0) is not allowed.
8928            if max_ordinal == 0 {
8929                return Ok(());
8930            }
8931            depth.increment()?;
8932            let envelope_size = 8;
8933            let bytes_len = max_ordinal as usize * envelope_size;
8934            #[allow(unused_variables)]
8935            let offset = encoder.out_of_line_offset(bytes_len);
8936            let mut _prev_end_offset: usize = 0;
8937            if 1 > max_ordinal {
8938                return Ok(());
8939            }
8940
8941            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8942            // are envelope_size bytes.
8943            let cur_offset: usize = (1 - 1) * envelope_size;
8944
8945            // Zero reserved fields.
8946            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8947
8948            // Safety:
8949            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8950            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8951            //   envelope_size bytes, there is always sufficient room.
8952            fidl::encoding::encode_in_envelope_optional::<
8953                fidl::encoding::Vector<u8, 8192>,
8954                fidl::encoding::DefaultFuchsiaResourceDialect,
8955            >(
8956                self.data.as_ref().map(
8957                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow,
8958                ),
8959                encoder,
8960                offset + cur_offset,
8961                depth,
8962            )?;
8963
8964            _prev_end_offset = cur_offset + envelope_size;
8965            if 2 > max_ordinal {
8966                return Ok(());
8967            }
8968
8969            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8970            // are envelope_size bytes.
8971            let cur_offset: usize = (2 - 1) * envelope_size;
8972
8973            // Zero reserved fields.
8974            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8975
8976            // Safety:
8977            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8978            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8979            //   envelope_size bytes, there is always sufficient room.
8980            fidl::encoding::encode_in_envelope_optional::<
8981                u64,
8982                fidl::encoding::DefaultFuchsiaResourceDialect,
8983            >(
8984                self.data_original_length
8985                    .as_ref()
8986                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
8987                encoder,
8988                offset + cur_offset,
8989                depth,
8990            )?;
8991
8992            _prev_end_offset = cur_offset + envelope_size;
8993            if 3 > max_ordinal {
8994                return Ok(());
8995            }
8996
8997            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8998            // are envelope_size bytes.
8999            let cur_offset: usize = (3 - 1) * envelope_size;
9000
9001            // Zero reserved fields.
9002            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9003
9004            // Safety:
9005            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9006            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9007            //   envelope_size bytes, there is always sufficient room.
9008            fidl::encoding::encode_in_envelope_optional::<
9009                fidl::encoding::Vector<
9010                    fidl::encoding::HandleType<
9011                        fidl::NullableHandle,
9012                        { fidl::ObjectType::NONE.into_raw() },
9013                        2147483648,
9014                    >,
9015                    4,
9016                >,
9017                fidl::encoding::DefaultFuchsiaResourceDialect,
9018            >(
9019                self.handles.as_mut().map(
9020                    <fidl::encoding::Vector<
9021                        fidl::encoding::HandleType<
9022                            fidl::NullableHandle,
9023                            { fidl::ObjectType::NONE.into_raw() },
9024                            2147483648,
9025                        >,
9026                        4,
9027                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
9028                ),
9029                encoder,
9030                offset + cur_offset,
9031                depth,
9032            )?;
9033
9034            _prev_end_offset = cur_offset + envelope_size;
9035
9036            Ok(())
9037        }
9038    }
9039
9040    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9041        for UnixDomainSocketReadResponse
9042    {
9043        #[inline(always)]
9044        fn new_empty() -> Self {
9045            Self::default()
9046        }
9047
9048        unsafe fn decode(
9049            &mut self,
9050            decoder: &mut fidl::encoding::Decoder<
9051                '_,
9052                fidl::encoding::DefaultFuchsiaResourceDialect,
9053            >,
9054            offset: usize,
9055            mut depth: fidl::encoding::Depth,
9056        ) -> fidl::Result<()> {
9057            decoder.debug_check_bounds::<Self>(offset);
9058            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9059                None => return Err(fidl::Error::NotNullable),
9060                Some(len) => len,
9061            };
9062            // Calling decoder.out_of_line_offset(0) is not allowed.
9063            if len == 0 {
9064                return Ok(());
9065            };
9066            depth.increment()?;
9067            let envelope_size = 8;
9068            let bytes_len = len * envelope_size;
9069            let offset = decoder.out_of_line_offset(bytes_len)?;
9070            // Decode the envelope for each type.
9071            let mut _next_ordinal_to_read = 0;
9072            let mut next_offset = offset;
9073            let end_offset = offset + bytes_len;
9074            _next_ordinal_to_read += 1;
9075            if next_offset >= end_offset {
9076                return Ok(());
9077            }
9078
9079            // Decode unknown envelopes for gaps in ordinals.
9080            while _next_ordinal_to_read < 1 {
9081                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9082                _next_ordinal_to_read += 1;
9083                next_offset += envelope_size;
9084            }
9085
9086            let next_out_of_line = decoder.next_out_of_line();
9087            let handles_before = decoder.remaining_handles();
9088            if let Some((inlined, num_bytes, num_handles)) =
9089                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9090            {
9091                let member_inline_size =
9092                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
9093                        decoder.context,
9094                    );
9095                if inlined != (member_inline_size <= 4) {
9096                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9097                }
9098                let inner_offset;
9099                let mut inner_depth = depth.clone();
9100                if inlined {
9101                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9102                    inner_offset = next_offset;
9103                } else {
9104                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9105                    inner_depth.increment()?;
9106                }
9107                let val_ref =
9108                self.data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect));
9109                fidl::decode!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
9110                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9111                {
9112                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9113                }
9114                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9115                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9116                }
9117            }
9118
9119            next_offset += envelope_size;
9120            _next_ordinal_to_read += 1;
9121            if next_offset >= end_offset {
9122                return Ok(());
9123            }
9124
9125            // Decode unknown envelopes for gaps in ordinals.
9126            while _next_ordinal_to_read < 2 {
9127                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9128                _next_ordinal_to_read += 1;
9129                next_offset += envelope_size;
9130            }
9131
9132            let next_out_of_line = decoder.next_out_of_line();
9133            let handles_before = decoder.remaining_handles();
9134            if let Some((inlined, num_bytes, num_handles)) =
9135                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9136            {
9137                let member_inline_size =
9138                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9139                if inlined != (member_inline_size <= 4) {
9140                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9141                }
9142                let inner_offset;
9143                let mut inner_depth = depth.clone();
9144                if inlined {
9145                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9146                    inner_offset = next_offset;
9147                } else {
9148                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9149                    inner_depth.increment()?;
9150                }
9151                let val_ref = self.data_original_length.get_or_insert_with(|| {
9152                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
9153                });
9154                fidl::decode!(
9155                    u64,
9156                    fidl::encoding::DefaultFuchsiaResourceDialect,
9157                    val_ref,
9158                    decoder,
9159                    inner_offset,
9160                    inner_depth
9161                )?;
9162                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9163                {
9164                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9165                }
9166                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9167                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9168                }
9169            }
9170
9171            next_offset += envelope_size;
9172            _next_ordinal_to_read += 1;
9173            if next_offset >= end_offset {
9174                return Ok(());
9175            }
9176
9177            // Decode unknown envelopes for gaps in ordinals.
9178            while _next_ordinal_to_read < 3 {
9179                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9180                _next_ordinal_to_read += 1;
9181                next_offset += envelope_size;
9182            }
9183
9184            let next_out_of_line = decoder.next_out_of_line();
9185            let handles_before = decoder.remaining_handles();
9186            if let Some((inlined, num_bytes, num_handles)) =
9187                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9188            {
9189                let member_inline_size = <fidl::encoding::Vector<
9190                    fidl::encoding::HandleType<
9191                        fidl::NullableHandle,
9192                        { fidl::ObjectType::NONE.into_raw() },
9193                        2147483648,
9194                    >,
9195                    4,
9196                > as fidl::encoding::TypeMarker>::inline_size(
9197                    decoder.context
9198                );
9199                if inlined != (member_inline_size <= 4) {
9200                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9201                }
9202                let inner_offset;
9203                let mut inner_depth = depth.clone();
9204                if inlined {
9205                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9206                    inner_offset = next_offset;
9207                } else {
9208                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9209                    inner_depth.increment()?;
9210                }
9211                let val_ref = self.handles.get_or_insert_with(|| {
9212                    fidl::new_empty!(
9213                        fidl::encoding::Vector<
9214                            fidl::encoding::HandleType<
9215                                fidl::NullableHandle,
9216                                { fidl::ObjectType::NONE.into_raw() },
9217                                2147483648,
9218                            >,
9219                            4,
9220                        >,
9221                        fidl::encoding::DefaultFuchsiaResourceDialect
9222                    )
9223                });
9224                fidl::decode!(
9225                    fidl::encoding::Vector<
9226                        fidl::encoding::HandleType<
9227                            fidl::NullableHandle,
9228                            { fidl::ObjectType::NONE.into_raw() },
9229                            2147483648,
9230                        >,
9231                        4,
9232                    >,
9233                    fidl::encoding::DefaultFuchsiaResourceDialect,
9234                    val_ref,
9235                    decoder,
9236                    inner_offset,
9237                    inner_depth
9238                )?;
9239                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9240                {
9241                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9242                }
9243                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9244                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9245                }
9246            }
9247
9248            next_offset += envelope_size;
9249
9250            // Decode the remaining unknown envelopes.
9251            while next_offset < end_offset {
9252                _next_ordinal_to_read += 1;
9253                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9254                next_offset += envelope_size;
9255            }
9256
9257            Ok(())
9258        }
9259    }
9260
9261    impl WaitBitsetRequest {
9262        #[inline(always)]
9263        fn max_ordinal_present(&self) -> u64 {
9264            if let Some(_) = self.deadline {
9265                return 5;
9266            }
9267            if let Some(_) = self.mask {
9268                return 4;
9269            }
9270            if let Some(_) = self.value {
9271                return 3;
9272            }
9273            if let Some(_) = self.offset {
9274                return 2;
9275            }
9276            if let Some(_) = self.vmo {
9277                return 1;
9278            }
9279            0
9280        }
9281    }
9282
9283    impl fidl::encoding::ResourceTypeMarker for WaitBitsetRequest {
9284        type Borrowed<'a> = &'a mut Self;
9285        fn take_or_borrow<'a>(
9286            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9287        ) -> Self::Borrowed<'a> {
9288            value
9289        }
9290    }
9291
9292    unsafe impl fidl::encoding::TypeMarker for WaitBitsetRequest {
9293        type Owned = Self;
9294
9295        #[inline(always)]
9296        fn inline_align(_context: fidl::encoding::Context) -> usize {
9297            8
9298        }
9299
9300        #[inline(always)]
9301        fn inline_size(_context: fidl::encoding::Context) -> usize {
9302            16
9303        }
9304    }
9305
9306    unsafe impl
9307        fidl::encoding::Encode<WaitBitsetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9308        for &mut WaitBitsetRequest
9309    {
9310        unsafe fn encode(
9311            self,
9312            encoder: &mut fidl::encoding::Encoder<
9313                '_,
9314                fidl::encoding::DefaultFuchsiaResourceDialect,
9315            >,
9316            offset: usize,
9317            mut depth: fidl::encoding::Depth,
9318        ) -> fidl::Result<()> {
9319            encoder.debug_check_bounds::<WaitBitsetRequest>(offset);
9320            // Vector header
9321            let max_ordinal: u64 = self.max_ordinal_present();
9322            encoder.write_num(max_ordinal, offset);
9323            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9324            // Calling encoder.out_of_line_offset(0) is not allowed.
9325            if max_ordinal == 0 {
9326                return Ok(());
9327            }
9328            depth.increment()?;
9329            let envelope_size = 8;
9330            let bytes_len = max_ordinal as usize * envelope_size;
9331            #[allow(unused_variables)]
9332            let offset = encoder.out_of_line_offset(bytes_len);
9333            let mut _prev_end_offset: usize = 0;
9334            if 1 > max_ordinal {
9335                return Ok(());
9336            }
9337
9338            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9339            // are envelope_size bytes.
9340            let cur_offset: usize = (1 - 1) * envelope_size;
9341
9342            // Zero reserved fields.
9343            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9344
9345            // Safety:
9346            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9347            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9348            //   envelope_size bytes, there is always sufficient room.
9349            fidl::encoding::encode_in_envelope_optional::<
9350                fidl::encoding::HandleType<
9351                    fidl::Vmo,
9352                    { fidl::ObjectType::VMO.into_raw() },
9353                    2147483648,
9354                >,
9355                fidl::encoding::DefaultFuchsiaResourceDialect,
9356            >(
9357                self.vmo.as_mut().map(
9358                    <fidl::encoding::HandleType<
9359                        fidl::Vmo,
9360                        { fidl::ObjectType::VMO.into_raw() },
9361                        2147483648,
9362                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
9363                ),
9364                encoder,
9365                offset + cur_offset,
9366                depth,
9367            )?;
9368
9369            _prev_end_offset = cur_offset + envelope_size;
9370            if 2 > max_ordinal {
9371                return Ok(());
9372            }
9373
9374            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9375            // are envelope_size bytes.
9376            let cur_offset: usize = (2 - 1) * envelope_size;
9377
9378            // Zero reserved fields.
9379            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9380
9381            // Safety:
9382            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9383            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9384            //   envelope_size bytes, there is always sufficient room.
9385            fidl::encoding::encode_in_envelope_optional::<
9386                u64,
9387                fidl::encoding::DefaultFuchsiaResourceDialect,
9388            >(
9389                self.offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
9390                encoder,
9391                offset + cur_offset,
9392                depth,
9393            )?;
9394
9395            _prev_end_offset = cur_offset + envelope_size;
9396            if 3 > max_ordinal {
9397                return Ok(());
9398            }
9399
9400            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9401            // are envelope_size bytes.
9402            let cur_offset: usize = (3 - 1) * envelope_size;
9403
9404            // Zero reserved fields.
9405            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9406
9407            // Safety:
9408            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9409            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9410            //   envelope_size bytes, there is always sufficient room.
9411            fidl::encoding::encode_in_envelope_optional::<
9412                u32,
9413                fidl::encoding::DefaultFuchsiaResourceDialect,
9414            >(
9415                self.value.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9416                encoder,
9417                offset + cur_offset,
9418                depth,
9419            )?;
9420
9421            _prev_end_offset = cur_offset + envelope_size;
9422            if 4 > max_ordinal {
9423                return Ok(());
9424            }
9425
9426            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9427            // are envelope_size bytes.
9428            let cur_offset: usize = (4 - 1) * envelope_size;
9429
9430            // Zero reserved fields.
9431            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9432
9433            // Safety:
9434            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9435            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9436            //   envelope_size bytes, there is always sufficient room.
9437            fidl::encoding::encode_in_envelope_optional::<
9438                u32,
9439                fidl::encoding::DefaultFuchsiaResourceDialect,
9440            >(
9441                self.mask.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9442                encoder,
9443                offset + cur_offset,
9444                depth,
9445            )?;
9446
9447            _prev_end_offset = cur_offset + envelope_size;
9448            if 5 > max_ordinal {
9449                return Ok(());
9450            }
9451
9452            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9453            // are envelope_size bytes.
9454            let cur_offset: usize = (5 - 1) * envelope_size;
9455
9456            // Zero reserved fields.
9457            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9458
9459            // Safety:
9460            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9461            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9462            //   envelope_size bytes, there is always sufficient room.
9463            fidl::encoding::encode_in_envelope_optional::<
9464                i64,
9465                fidl::encoding::DefaultFuchsiaResourceDialect,
9466            >(
9467                self.deadline.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
9468                encoder,
9469                offset + cur_offset,
9470                depth,
9471            )?;
9472
9473            _prev_end_offset = cur_offset + envelope_size;
9474
9475            Ok(())
9476        }
9477    }
9478
9479    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9480        for WaitBitsetRequest
9481    {
9482        #[inline(always)]
9483        fn new_empty() -> Self {
9484            Self::default()
9485        }
9486
9487        unsafe fn decode(
9488            &mut self,
9489            decoder: &mut fidl::encoding::Decoder<
9490                '_,
9491                fidl::encoding::DefaultFuchsiaResourceDialect,
9492            >,
9493            offset: usize,
9494            mut depth: fidl::encoding::Depth,
9495        ) -> fidl::Result<()> {
9496            decoder.debug_check_bounds::<Self>(offset);
9497            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9498                None => return Err(fidl::Error::NotNullable),
9499                Some(len) => len,
9500            };
9501            // Calling decoder.out_of_line_offset(0) is not allowed.
9502            if len == 0 {
9503                return Ok(());
9504            };
9505            depth.increment()?;
9506            let envelope_size = 8;
9507            let bytes_len = len * envelope_size;
9508            let offset = decoder.out_of_line_offset(bytes_len)?;
9509            // Decode the envelope for each type.
9510            let mut _next_ordinal_to_read = 0;
9511            let mut next_offset = offset;
9512            let end_offset = offset + bytes_len;
9513            _next_ordinal_to_read += 1;
9514            if next_offset >= end_offset {
9515                return Ok(());
9516            }
9517
9518            // Decode unknown envelopes for gaps in ordinals.
9519            while _next_ordinal_to_read < 1 {
9520                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9521                _next_ordinal_to_read += 1;
9522                next_offset += envelope_size;
9523            }
9524
9525            let next_out_of_line = decoder.next_out_of_line();
9526            let handles_before = decoder.remaining_handles();
9527            if let Some((inlined, num_bytes, num_handles)) =
9528                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9529            {
9530                let member_inline_size = <fidl::encoding::HandleType<
9531                    fidl::Vmo,
9532                    { fidl::ObjectType::VMO.into_raw() },
9533                    2147483648,
9534                > as fidl::encoding::TypeMarker>::inline_size(
9535                    decoder.context
9536                );
9537                if inlined != (member_inline_size <= 4) {
9538                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9539                }
9540                let inner_offset;
9541                let mut inner_depth = depth.clone();
9542                if inlined {
9543                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9544                    inner_offset = next_offset;
9545                } else {
9546                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9547                    inner_depth.increment()?;
9548                }
9549                let val_ref =
9550                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
9551                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
9552                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9553                {
9554                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9555                }
9556                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9557                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9558                }
9559            }
9560
9561            next_offset += envelope_size;
9562            _next_ordinal_to_read += 1;
9563            if next_offset >= end_offset {
9564                return Ok(());
9565            }
9566
9567            // Decode unknown envelopes for gaps in ordinals.
9568            while _next_ordinal_to_read < 2 {
9569                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9570                _next_ordinal_to_read += 1;
9571                next_offset += envelope_size;
9572            }
9573
9574            let next_out_of_line = decoder.next_out_of_line();
9575            let handles_before = decoder.remaining_handles();
9576            if let Some((inlined, num_bytes, num_handles)) =
9577                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9578            {
9579                let member_inline_size =
9580                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9581                if inlined != (member_inline_size <= 4) {
9582                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9583                }
9584                let inner_offset;
9585                let mut inner_depth = depth.clone();
9586                if inlined {
9587                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9588                    inner_offset = next_offset;
9589                } else {
9590                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9591                    inner_depth.increment()?;
9592                }
9593                let val_ref = self.offset.get_or_insert_with(|| {
9594                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
9595                });
9596                fidl::decode!(
9597                    u64,
9598                    fidl::encoding::DefaultFuchsiaResourceDialect,
9599                    val_ref,
9600                    decoder,
9601                    inner_offset,
9602                    inner_depth
9603                )?;
9604                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9605                {
9606                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9607                }
9608                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9609                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9610                }
9611            }
9612
9613            next_offset += envelope_size;
9614            _next_ordinal_to_read += 1;
9615            if next_offset >= end_offset {
9616                return Ok(());
9617            }
9618
9619            // Decode unknown envelopes for gaps in ordinals.
9620            while _next_ordinal_to_read < 3 {
9621                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9622                _next_ordinal_to_read += 1;
9623                next_offset += envelope_size;
9624            }
9625
9626            let next_out_of_line = decoder.next_out_of_line();
9627            let handles_before = decoder.remaining_handles();
9628            if let Some((inlined, num_bytes, num_handles)) =
9629                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9630            {
9631                let member_inline_size =
9632                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9633                if inlined != (member_inline_size <= 4) {
9634                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9635                }
9636                let inner_offset;
9637                let mut inner_depth = depth.clone();
9638                if inlined {
9639                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9640                    inner_offset = next_offset;
9641                } else {
9642                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9643                    inner_depth.increment()?;
9644                }
9645                let val_ref = self.value.get_or_insert_with(|| {
9646                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
9647                });
9648                fidl::decode!(
9649                    u32,
9650                    fidl::encoding::DefaultFuchsiaResourceDialect,
9651                    val_ref,
9652                    decoder,
9653                    inner_offset,
9654                    inner_depth
9655                )?;
9656                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9657                {
9658                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9659                }
9660                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9661                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9662                }
9663            }
9664
9665            next_offset += envelope_size;
9666            _next_ordinal_to_read += 1;
9667            if next_offset >= end_offset {
9668                return Ok(());
9669            }
9670
9671            // Decode unknown envelopes for gaps in ordinals.
9672            while _next_ordinal_to_read < 4 {
9673                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9674                _next_ordinal_to_read += 1;
9675                next_offset += envelope_size;
9676            }
9677
9678            let next_out_of_line = decoder.next_out_of_line();
9679            let handles_before = decoder.remaining_handles();
9680            if let Some((inlined, num_bytes, num_handles)) =
9681                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9682            {
9683                let member_inline_size =
9684                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9685                if inlined != (member_inline_size <= 4) {
9686                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9687                }
9688                let inner_offset;
9689                let mut inner_depth = depth.clone();
9690                if inlined {
9691                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9692                    inner_offset = next_offset;
9693                } else {
9694                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9695                    inner_depth.increment()?;
9696                }
9697                let val_ref = self.mask.get_or_insert_with(|| {
9698                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
9699                });
9700                fidl::decode!(
9701                    u32,
9702                    fidl::encoding::DefaultFuchsiaResourceDialect,
9703                    val_ref,
9704                    decoder,
9705                    inner_offset,
9706                    inner_depth
9707                )?;
9708                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9709                {
9710                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9711                }
9712                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9713                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9714                }
9715            }
9716
9717            next_offset += envelope_size;
9718            _next_ordinal_to_read += 1;
9719            if next_offset >= end_offset {
9720                return Ok(());
9721            }
9722
9723            // Decode unknown envelopes for gaps in ordinals.
9724            while _next_ordinal_to_read < 5 {
9725                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9726                _next_ordinal_to_read += 1;
9727                next_offset += envelope_size;
9728            }
9729
9730            let next_out_of_line = decoder.next_out_of_line();
9731            let handles_before = decoder.remaining_handles();
9732            if let Some((inlined, num_bytes, num_handles)) =
9733                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9734            {
9735                let member_inline_size =
9736                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9737                if inlined != (member_inline_size <= 4) {
9738                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9739                }
9740                let inner_offset;
9741                let mut inner_depth = depth.clone();
9742                if inlined {
9743                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9744                    inner_offset = next_offset;
9745                } else {
9746                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9747                    inner_depth.increment()?;
9748                }
9749                let val_ref = self.deadline.get_or_insert_with(|| {
9750                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
9751                });
9752                fidl::decode!(
9753                    i64,
9754                    fidl::encoding::DefaultFuchsiaResourceDialect,
9755                    val_ref,
9756                    decoder,
9757                    inner_offset,
9758                    inner_depth
9759                )?;
9760                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9761                {
9762                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9763                }
9764                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9765                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9766                }
9767            }
9768
9769            next_offset += envelope_size;
9770
9771            // Decode the remaining unknown envelopes.
9772            while next_offset < end_offset {
9773                _next_ordinal_to_read += 1;
9774                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9775                next_offset += envelope_size;
9776            }
9777
9778            Ok(())
9779        }
9780    }
9781
9782    impl WakeBitsetRequest {
9783        #[inline(always)]
9784        fn max_ordinal_present(&self) -> u64 {
9785            if let Some(_) = self.mask {
9786                return 4;
9787            }
9788            if let Some(_) = self.count {
9789                return 3;
9790            }
9791            if let Some(_) = self.offset {
9792                return 2;
9793            }
9794            if let Some(_) = self.vmo {
9795                return 1;
9796            }
9797            0
9798        }
9799    }
9800
9801    impl fidl::encoding::ResourceTypeMarker for WakeBitsetRequest {
9802        type Borrowed<'a> = &'a mut Self;
9803        fn take_or_borrow<'a>(
9804            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9805        ) -> Self::Borrowed<'a> {
9806            value
9807        }
9808    }
9809
9810    unsafe impl fidl::encoding::TypeMarker for WakeBitsetRequest {
9811        type Owned = Self;
9812
9813        #[inline(always)]
9814        fn inline_align(_context: fidl::encoding::Context) -> usize {
9815            8
9816        }
9817
9818        #[inline(always)]
9819        fn inline_size(_context: fidl::encoding::Context) -> usize {
9820            16
9821        }
9822    }
9823
9824    unsafe impl
9825        fidl::encoding::Encode<WakeBitsetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9826        for &mut WakeBitsetRequest
9827    {
9828        unsafe fn encode(
9829            self,
9830            encoder: &mut fidl::encoding::Encoder<
9831                '_,
9832                fidl::encoding::DefaultFuchsiaResourceDialect,
9833            >,
9834            offset: usize,
9835            mut depth: fidl::encoding::Depth,
9836        ) -> fidl::Result<()> {
9837            encoder.debug_check_bounds::<WakeBitsetRequest>(offset);
9838            // Vector header
9839            let max_ordinal: u64 = self.max_ordinal_present();
9840            encoder.write_num(max_ordinal, offset);
9841            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9842            // Calling encoder.out_of_line_offset(0) is not allowed.
9843            if max_ordinal == 0 {
9844                return Ok(());
9845            }
9846            depth.increment()?;
9847            let envelope_size = 8;
9848            let bytes_len = max_ordinal as usize * envelope_size;
9849            #[allow(unused_variables)]
9850            let offset = encoder.out_of_line_offset(bytes_len);
9851            let mut _prev_end_offset: usize = 0;
9852            if 1 > max_ordinal {
9853                return Ok(());
9854            }
9855
9856            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9857            // are envelope_size bytes.
9858            let cur_offset: usize = (1 - 1) * envelope_size;
9859
9860            // Zero reserved fields.
9861            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9862
9863            // Safety:
9864            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9865            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9866            //   envelope_size bytes, there is always sufficient room.
9867            fidl::encoding::encode_in_envelope_optional::<
9868                fidl::encoding::HandleType<
9869                    fidl::Vmo,
9870                    { fidl::ObjectType::VMO.into_raw() },
9871                    2147483648,
9872                >,
9873                fidl::encoding::DefaultFuchsiaResourceDialect,
9874            >(
9875                self.vmo.as_mut().map(
9876                    <fidl::encoding::HandleType<
9877                        fidl::Vmo,
9878                        { fidl::ObjectType::VMO.into_raw() },
9879                        2147483648,
9880                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
9881                ),
9882                encoder,
9883                offset + cur_offset,
9884                depth,
9885            )?;
9886
9887            _prev_end_offset = cur_offset + envelope_size;
9888            if 2 > max_ordinal {
9889                return Ok(());
9890            }
9891
9892            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9893            // are envelope_size bytes.
9894            let cur_offset: usize = (2 - 1) * envelope_size;
9895
9896            // Zero reserved fields.
9897            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9898
9899            // Safety:
9900            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9901            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9902            //   envelope_size bytes, there is always sufficient room.
9903            fidl::encoding::encode_in_envelope_optional::<
9904                u64,
9905                fidl::encoding::DefaultFuchsiaResourceDialect,
9906            >(
9907                self.offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
9908                encoder,
9909                offset + cur_offset,
9910                depth,
9911            )?;
9912
9913            _prev_end_offset = cur_offset + envelope_size;
9914            if 3 > max_ordinal {
9915                return Ok(());
9916            }
9917
9918            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9919            // are envelope_size bytes.
9920            let cur_offset: usize = (3 - 1) * envelope_size;
9921
9922            // Zero reserved fields.
9923            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9924
9925            // Safety:
9926            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9927            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9928            //   envelope_size bytes, there is always sufficient room.
9929            fidl::encoding::encode_in_envelope_optional::<
9930                u32,
9931                fidl::encoding::DefaultFuchsiaResourceDialect,
9932            >(
9933                self.count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9934                encoder,
9935                offset + cur_offset,
9936                depth,
9937            )?;
9938
9939            _prev_end_offset = cur_offset + envelope_size;
9940            if 4 > max_ordinal {
9941                return Ok(());
9942            }
9943
9944            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9945            // are envelope_size bytes.
9946            let cur_offset: usize = (4 - 1) * envelope_size;
9947
9948            // Zero reserved fields.
9949            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9950
9951            // Safety:
9952            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9953            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9954            //   envelope_size bytes, there is always sufficient room.
9955            fidl::encoding::encode_in_envelope_optional::<
9956                u32,
9957                fidl::encoding::DefaultFuchsiaResourceDialect,
9958            >(
9959                self.mask.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9960                encoder,
9961                offset + cur_offset,
9962                depth,
9963            )?;
9964
9965            _prev_end_offset = cur_offset + envelope_size;
9966
9967            Ok(())
9968        }
9969    }
9970
9971    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9972        for WakeBitsetRequest
9973    {
9974        #[inline(always)]
9975        fn new_empty() -> Self {
9976            Self::default()
9977        }
9978
9979        unsafe fn decode(
9980            &mut self,
9981            decoder: &mut fidl::encoding::Decoder<
9982                '_,
9983                fidl::encoding::DefaultFuchsiaResourceDialect,
9984            >,
9985            offset: usize,
9986            mut depth: fidl::encoding::Depth,
9987        ) -> fidl::Result<()> {
9988            decoder.debug_check_bounds::<Self>(offset);
9989            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9990                None => return Err(fidl::Error::NotNullable),
9991                Some(len) => len,
9992            };
9993            // Calling decoder.out_of_line_offset(0) is not allowed.
9994            if len == 0 {
9995                return Ok(());
9996            };
9997            depth.increment()?;
9998            let envelope_size = 8;
9999            let bytes_len = len * envelope_size;
10000            let offset = decoder.out_of_line_offset(bytes_len)?;
10001            // Decode the envelope for each type.
10002            let mut _next_ordinal_to_read = 0;
10003            let mut next_offset = offset;
10004            let end_offset = offset + bytes_len;
10005            _next_ordinal_to_read += 1;
10006            if next_offset >= end_offset {
10007                return Ok(());
10008            }
10009
10010            // Decode unknown envelopes for gaps in ordinals.
10011            while _next_ordinal_to_read < 1 {
10012                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10013                _next_ordinal_to_read += 1;
10014                next_offset += envelope_size;
10015            }
10016
10017            let next_out_of_line = decoder.next_out_of_line();
10018            let handles_before = decoder.remaining_handles();
10019            if let Some((inlined, num_bytes, num_handles)) =
10020                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10021            {
10022                let member_inline_size = <fidl::encoding::HandleType<
10023                    fidl::Vmo,
10024                    { fidl::ObjectType::VMO.into_raw() },
10025                    2147483648,
10026                > as fidl::encoding::TypeMarker>::inline_size(
10027                    decoder.context
10028                );
10029                if inlined != (member_inline_size <= 4) {
10030                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10031                }
10032                let inner_offset;
10033                let mut inner_depth = depth.clone();
10034                if inlined {
10035                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10036                    inner_offset = next_offset;
10037                } else {
10038                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10039                    inner_depth.increment()?;
10040                }
10041                let val_ref =
10042                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10043                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10044                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10045                {
10046                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10047                }
10048                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10049                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10050                }
10051            }
10052
10053            next_offset += envelope_size;
10054            _next_ordinal_to_read += 1;
10055            if next_offset >= end_offset {
10056                return Ok(());
10057            }
10058
10059            // Decode unknown envelopes for gaps in ordinals.
10060            while _next_ordinal_to_read < 2 {
10061                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10062                _next_ordinal_to_read += 1;
10063                next_offset += envelope_size;
10064            }
10065
10066            let next_out_of_line = decoder.next_out_of_line();
10067            let handles_before = decoder.remaining_handles();
10068            if let Some((inlined, num_bytes, num_handles)) =
10069                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10070            {
10071                let member_inline_size =
10072                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10073                if inlined != (member_inline_size <= 4) {
10074                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10075                }
10076                let inner_offset;
10077                let mut inner_depth = depth.clone();
10078                if inlined {
10079                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10080                    inner_offset = next_offset;
10081                } else {
10082                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10083                    inner_depth.increment()?;
10084                }
10085                let val_ref = self.offset.get_or_insert_with(|| {
10086                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
10087                });
10088                fidl::decode!(
10089                    u64,
10090                    fidl::encoding::DefaultFuchsiaResourceDialect,
10091                    val_ref,
10092                    decoder,
10093                    inner_offset,
10094                    inner_depth
10095                )?;
10096                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10097                {
10098                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10099                }
10100                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10101                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10102                }
10103            }
10104
10105            next_offset += envelope_size;
10106            _next_ordinal_to_read += 1;
10107            if next_offset >= end_offset {
10108                return Ok(());
10109            }
10110
10111            // Decode unknown envelopes for gaps in ordinals.
10112            while _next_ordinal_to_read < 3 {
10113                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10114                _next_ordinal_to_read += 1;
10115                next_offset += envelope_size;
10116            }
10117
10118            let next_out_of_line = decoder.next_out_of_line();
10119            let handles_before = decoder.remaining_handles();
10120            if let Some((inlined, num_bytes, num_handles)) =
10121                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10122            {
10123                let member_inline_size =
10124                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10125                if inlined != (member_inline_size <= 4) {
10126                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10127                }
10128                let inner_offset;
10129                let mut inner_depth = depth.clone();
10130                if inlined {
10131                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10132                    inner_offset = next_offset;
10133                } else {
10134                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10135                    inner_depth.increment()?;
10136                }
10137                let val_ref = self.count.get_or_insert_with(|| {
10138                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
10139                });
10140                fidl::decode!(
10141                    u32,
10142                    fidl::encoding::DefaultFuchsiaResourceDialect,
10143                    val_ref,
10144                    decoder,
10145                    inner_offset,
10146                    inner_depth
10147                )?;
10148                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10149                {
10150                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10151                }
10152                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10153                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10154                }
10155            }
10156
10157            next_offset += envelope_size;
10158            _next_ordinal_to_read += 1;
10159            if next_offset >= end_offset {
10160                return Ok(());
10161            }
10162
10163            // Decode unknown envelopes for gaps in ordinals.
10164            while _next_ordinal_to_read < 4 {
10165                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10166                _next_ordinal_to_read += 1;
10167                next_offset += envelope_size;
10168            }
10169
10170            let next_out_of_line = decoder.next_out_of_line();
10171            let handles_before = decoder.remaining_handles();
10172            if let Some((inlined, num_bytes, num_handles)) =
10173                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10174            {
10175                let member_inline_size =
10176                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10177                if inlined != (member_inline_size <= 4) {
10178                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10179                }
10180                let inner_offset;
10181                let mut inner_depth = depth.clone();
10182                if inlined {
10183                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10184                    inner_offset = next_offset;
10185                } else {
10186                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10187                    inner_depth.increment()?;
10188                }
10189                let val_ref = self.mask.get_or_insert_with(|| {
10190                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
10191                });
10192                fidl::decode!(
10193                    u32,
10194                    fidl::encoding::DefaultFuchsiaResourceDialect,
10195                    val_ref,
10196                    decoder,
10197                    inner_offset,
10198                    inner_depth
10199                )?;
10200                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10201                {
10202                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10203                }
10204                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10205                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10206                }
10207            }
10208
10209            next_offset += envelope_size;
10210
10211            // Decode the remaining unknown envelopes.
10212            while next_offset < end_offset {
10213                _next_ordinal_to_read += 1;
10214                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10215                next_offset += envelope_size;
10216            }
10217
10218            Ok(())
10219        }
10220    }
10221
10222    impl WakeResponse {
10223        #[inline(always)]
10224        fn max_ordinal_present(&self) -> u64 {
10225            if let Some(_) = self.count {
10226                return 1;
10227            }
10228            0
10229        }
10230    }
10231
10232    impl fidl::encoding::ResourceTypeMarker for WakeResponse {
10233        type Borrowed<'a> = &'a mut Self;
10234        fn take_or_borrow<'a>(
10235            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10236        ) -> Self::Borrowed<'a> {
10237            value
10238        }
10239    }
10240
10241    unsafe impl fidl::encoding::TypeMarker for WakeResponse {
10242        type Owned = Self;
10243
10244        #[inline(always)]
10245        fn inline_align(_context: fidl::encoding::Context) -> usize {
10246            8
10247        }
10248
10249        #[inline(always)]
10250        fn inline_size(_context: fidl::encoding::Context) -> usize {
10251            16
10252        }
10253    }
10254
10255    unsafe impl fidl::encoding::Encode<WakeResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
10256        for &mut WakeResponse
10257    {
10258        unsafe fn encode(
10259            self,
10260            encoder: &mut fidl::encoding::Encoder<
10261                '_,
10262                fidl::encoding::DefaultFuchsiaResourceDialect,
10263            >,
10264            offset: usize,
10265            mut depth: fidl::encoding::Depth,
10266        ) -> fidl::Result<()> {
10267            encoder.debug_check_bounds::<WakeResponse>(offset);
10268            // Vector header
10269            let max_ordinal: u64 = self.max_ordinal_present();
10270            encoder.write_num(max_ordinal, offset);
10271            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10272            // Calling encoder.out_of_line_offset(0) is not allowed.
10273            if max_ordinal == 0 {
10274                return Ok(());
10275            }
10276            depth.increment()?;
10277            let envelope_size = 8;
10278            let bytes_len = max_ordinal as usize * envelope_size;
10279            #[allow(unused_variables)]
10280            let offset = encoder.out_of_line_offset(bytes_len);
10281            let mut _prev_end_offset: usize = 0;
10282            if 1 > max_ordinal {
10283                return Ok(());
10284            }
10285
10286            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10287            // are envelope_size bytes.
10288            let cur_offset: usize = (1 - 1) * envelope_size;
10289
10290            // Zero reserved fields.
10291            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10292
10293            // Safety:
10294            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10295            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10296            //   envelope_size bytes, there is always sufficient room.
10297            fidl::encoding::encode_in_envelope_optional::<
10298                u64,
10299                fidl::encoding::DefaultFuchsiaResourceDialect,
10300            >(
10301                self.count.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
10302                encoder,
10303                offset + cur_offset,
10304                depth,
10305            )?;
10306
10307            _prev_end_offset = cur_offset + envelope_size;
10308
10309            Ok(())
10310        }
10311    }
10312
10313    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WakeResponse {
10314        #[inline(always)]
10315        fn new_empty() -> Self {
10316            Self::default()
10317        }
10318
10319        unsafe fn decode(
10320            &mut self,
10321            decoder: &mut fidl::encoding::Decoder<
10322                '_,
10323                fidl::encoding::DefaultFuchsiaResourceDialect,
10324            >,
10325            offset: usize,
10326            mut depth: fidl::encoding::Depth,
10327        ) -> fidl::Result<()> {
10328            decoder.debug_check_bounds::<Self>(offset);
10329            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10330                None => return Err(fidl::Error::NotNullable),
10331                Some(len) => len,
10332            };
10333            // Calling decoder.out_of_line_offset(0) is not allowed.
10334            if len == 0 {
10335                return Ok(());
10336            };
10337            depth.increment()?;
10338            let envelope_size = 8;
10339            let bytes_len = len * envelope_size;
10340            let offset = decoder.out_of_line_offset(bytes_len)?;
10341            // Decode the envelope for each type.
10342            let mut _next_ordinal_to_read = 0;
10343            let mut next_offset = offset;
10344            let end_offset = offset + bytes_len;
10345            _next_ordinal_to_read += 1;
10346            if next_offset >= end_offset {
10347                return Ok(());
10348            }
10349
10350            // Decode unknown envelopes for gaps in ordinals.
10351            while _next_ordinal_to_read < 1 {
10352                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10353                _next_ordinal_to_read += 1;
10354                next_offset += envelope_size;
10355            }
10356
10357            let next_out_of_line = decoder.next_out_of_line();
10358            let handles_before = decoder.remaining_handles();
10359            if let Some((inlined, num_bytes, num_handles)) =
10360                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10361            {
10362                let member_inline_size =
10363                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10364                if inlined != (member_inline_size <= 4) {
10365                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10366                }
10367                let inner_offset;
10368                let mut inner_depth = depth.clone();
10369                if inlined {
10370                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10371                    inner_offset = next_offset;
10372                } else {
10373                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10374                    inner_depth.increment()?;
10375                }
10376                let val_ref = self.count.get_or_insert_with(|| {
10377                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
10378                });
10379                fidl::decode!(
10380                    u64,
10381                    fidl::encoding::DefaultFuchsiaResourceDialect,
10382                    val_ref,
10383                    decoder,
10384                    inner_offset,
10385                    inner_depth
10386                )?;
10387                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10388                {
10389                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10390                }
10391                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10392                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10393                }
10394            }
10395
10396            next_offset += envelope_size;
10397
10398            // Decode the remaining unknown envelopes.
10399            while next_offset < end_offset {
10400                _next_ordinal_to_read += 1;
10401                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10402                next_offset += envelope_size;
10403            }
10404
10405            Ok(())
10406        }
10407    }
10408}