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