fidl_fuchsia_starnix_binder/
fidl_fuchsia_starnix_binder.rs

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