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