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