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