Skip to main content

fidl_fuchsia_starnix_container/
fidl_fuchsia_starnix_container.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_container_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct ControllerSpawnConsoleRequest {
16    pub console_in: Option<fidl::Socket>,
17    pub console_out: Option<fidl::Socket>,
18    pub binary_path: Option<String>,
19    pub argv: Option<Vec<String>>,
20    pub environ: Option<Vec<String>>,
21    pub window_size: Option<ConsoleWindowSize>,
22    #[doc(hidden)]
23    pub __source_breaking: fidl::marker::SourceBreaking,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
27    for ControllerSpawnConsoleRequest
28{
29}
30
31#[derive(Debug, Default, PartialEq)]
32pub struct ControllerVsockConnectRequest {
33    pub port: Option<u32>,
34    pub bridge_socket: Option<fidl::Socket>,
35    #[doc(hidden)]
36    pub __source_breaking: fidl::marker::SourceBreaking,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40    for ControllerVsockConnectRequest
41{
42}
43
44#[derive(Debug, Default, PartialEq)]
45pub struct ControllerGetJobHandleResponse {
46    pub job: Option<fidl::Job>,
47    #[doc(hidden)]
48    pub __source_breaking: fidl::marker::SourceBreaking,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52    for ControllerGetJobHandleResponse
53{
54}
55
56#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
57pub struct ControllerMarker;
58
59impl fidl::endpoints::ProtocolMarker for ControllerMarker {
60    type Proxy = ControllerProxy;
61    type RequestStream = ControllerRequestStream;
62    #[cfg(target_os = "fuchsia")]
63    type SynchronousProxy = ControllerSynchronousProxy;
64
65    const DEBUG_NAME: &'static str = "fuchsia.starnix.container.Controller";
66}
67impl fidl::endpoints::DiscoverableProtocolMarker for ControllerMarker {}
68pub type ControllerSpawnConsoleResult = Result<u8, SpawnConsoleError>;
69pub type ControllerSendSignalResult = Result<(), SignalError>;
70pub type ControllerSetSyscallLogFilterResult = Result<(), SetSyscallLogFilterError>;
71
72pub trait ControllerProxyInterface: Send + Sync {
73    fn r#vsock_connect(&self, payload: ControllerVsockConnectRequest) -> Result<(), fidl::Error>;
74    type SpawnConsoleResponseFut: std::future::Future<Output = Result<ControllerSpawnConsoleResult, fidl::Error>>
75        + Send;
76    fn r#spawn_console(
77        &self,
78        payload: ControllerSpawnConsoleRequest,
79    ) -> Self::SpawnConsoleResponseFut;
80    type GetVmoReferencesResponseFut: std::future::Future<Output = Result<ControllerGetVmoReferencesResponse, fidl::Error>>
81        + Send;
82    fn r#get_vmo_references(
83        &self,
84        payload: &ControllerGetVmoReferencesRequest,
85    ) -> Self::GetVmoReferencesResponseFut;
86    type GetJobHandleResponseFut: std::future::Future<Output = Result<ControllerGetJobHandleResponse, fidl::Error>>
87        + Send;
88    fn r#get_job_handle(&self) -> Self::GetJobHandleResponseFut;
89    type SendSignalResponseFut: std::future::Future<Output = Result<ControllerSendSignalResult, fidl::Error>>
90        + Send;
91    fn r#send_signal(&self, payload: &ControllerSendSignalRequest) -> Self::SendSignalResponseFut;
92    type SetSyscallLogFilterResponseFut: std::future::Future<Output = Result<ControllerSetSyscallLogFilterResult, fidl::Error>>
93        + Send;
94    fn r#set_syscall_log_filter(
95        &self,
96        payload: &ControllerSetSyscallLogFilterRequest,
97    ) -> Self::SetSyscallLogFilterResponseFut;
98    type ClearSyscallLogFiltersResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
99        + Send;
100    fn r#clear_syscall_log_filters(&self) -> Self::ClearSyscallLogFiltersResponseFut;
101}
102#[derive(Debug)]
103#[cfg(target_os = "fuchsia")]
104pub struct ControllerSynchronousProxy {
105    client: fidl::client::sync::Client,
106}
107
108#[cfg(target_os = "fuchsia")]
109impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
110    type Proxy = ControllerProxy;
111    type Protocol = ControllerMarker;
112
113    fn from_channel(inner: fidl::Channel) -> Self {
114        Self::new(inner)
115    }
116
117    fn into_channel(self) -> fidl::Channel {
118        self.client.into_channel()
119    }
120
121    fn as_channel(&self) -> &fidl::Channel {
122        self.client.as_channel()
123    }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl ControllerSynchronousProxy {
128    pub fn new(channel: fidl::Channel) -> Self {
129        Self { client: fidl::client::sync::Client::new(channel) }
130    }
131
132    pub fn into_channel(self) -> fidl::Channel {
133        self.client.into_channel()
134    }
135
136    /// Waits until an event arrives and returns it. It is safe for other
137    /// threads to make concurrent requests while waiting for an event.
138    pub fn wait_for_event(
139        &self,
140        deadline: zx::MonotonicInstant,
141    ) -> Result<ControllerEvent, fidl::Error> {
142        ControllerEvent::decode(self.client.wait_for_event::<ControllerMarker>(deadline)?)
143    }
144
145    /// Connects `bridge_socket` to a vsocket at `port` in the container.
146    pub fn r#vsock_connect(
147        &self,
148        mut payload: ControllerVsockConnectRequest,
149    ) -> Result<(), fidl::Error> {
150        self.client.send::<ControllerVsockConnectRequest>(
151            &mut payload,
152            0x494a469a8943213b,
153            fidl::encoding::DynamicFlags::FLEXIBLE,
154        )
155    }
156
157    /// Spawn a console for debugging in the container. For testing, prefer launching Linux programs
158    /// as components with the `starnix_container` runner.
159    ///
160    /// Returns when the console exits.
161    pub fn r#spawn_console(
162        &self,
163        mut payload: ControllerSpawnConsoleRequest,
164        ___deadline: zx::MonotonicInstant,
165    ) -> Result<ControllerSpawnConsoleResult, fidl::Error> {
166        let _response =
167            self.client
168                .send_query::<ControllerSpawnConsoleRequest, fidl::encoding::FlexibleResultType<
169                    ControllerSpawnConsoleResponse,
170                    SpawnConsoleError,
171                >, ControllerMarker>(
172                    &mut payload,
173                    0x76eb46fdc63aa8b8,
174                    fidl::encoding::DynamicFlags::FLEXIBLE,
175                    ___deadline,
176                )?
177                .into_result::<ControllerMarker>("spawn_console")?;
178        Ok(_response.map(|x| x.exit_code))
179    }
180
181    /// Returns all processes that have open files that are backed by a vmo with koid.
182    pub fn r#get_vmo_references(
183        &self,
184        mut payload: &ControllerGetVmoReferencesRequest,
185        ___deadline: zx::MonotonicInstant,
186    ) -> Result<ControllerGetVmoReferencesResponse, fidl::Error> {
187        let _response = self.client.send_query::<
188            ControllerGetVmoReferencesRequest,
189            fidl::encoding::FlexibleType<ControllerGetVmoReferencesResponse>,
190            ControllerMarker,
191        >(
192            payload,
193            0x47a7f039bb97f173,
194            fidl::encoding::DynamicFlags::FLEXIBLE,
195            ___deadline,
196        )?
197        .into_result::<ControllerMarker>("get_vmo_references")?;
198        Ok(_response)
199    }
200
201    /// Returns the job handle of the container.
202    pub fn r#get_job_handle(
203        &self,
204        ___deadline: zx::MonotonicInstant,
205    ) -> Result<ControllerGetJobHandleResponse, fidl::Error> {
206        let _response = self.client.send_query::<
207            fidl::encoding::EmptyPayload,
208            fidl::encoding::FlexibleType<ControllerGetJobHandleResponse>,
209            ControllerMarker,
210        >(
211            (),
212            0x60a31a248576ffea,
213            fidl::encoding::DynamicFlags::FLEXIBLE,
214            ___deadline,
215        )?
216        .into_result::<ControllerMarker>("get_job_handle")?;
217        Ok(_response)
218    }
219
220    /// Sends the provided signal to the process with the given pid.
221    pub fn r#send_signal(
222        &self,
223        mut payload: &ControllerSendSignalRequest,
224        ___deadline: zx::MonotonicInstant,
225    ) -> Result<ControllerSendSignalResult, fidl::Error> {
226        let _response = self.client.send_query::<
227            ControllerSendSignalRequest,
228            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, SignalError>,
229            ControllerMarker,
230        >(
231            payload,
232            0x253b1a0d3b9639e3,
233            fidl::encoding::DynamicFlags::FLEXIBLE,
234            ___deadline,
235        )?
236        .into_result::<ControllerMarker>("send_signal")?;
237        Ok(_response.map(|x| x))
238    }
239
240    /// Sets a filter to log syscalls at INFO level for processes matching `process_name`.
241    pub fn r#set_syscall_log_filter(
242        &self,
243        mut payload: &ControllerSetSyscallLogFilterRequest,
244        ___deadline: zx::MonotonicInstant,
245    ) -> Result<ControllerSetSyscallLogFilterResult, fidl::Error> {
246        let _response = self
247            .client
248            .send_query::<ControllerSetSyscallLogFilterRequest, fidl::encoding::FlexibleResultType<
249                fidl::encoding::EmptyStruct,
250                SetSyscallLogFilterError,
251            >, ControllerMarker>(
252                payload,
253                0x2d2a49963abdee9b,
254                fidl::encoding::DynamicFlags::FLEXIBLE,
255                ___deadline,
256            )?
257            .into_result::<ControllerMarker>("set_syscall_log_filter")?;
258        Ok(_response.map(|x| x))
259    }
260
261    /// Clears all syscall log filters.
262    pub fn r#clear_syscall_log_filters(
263        &self,
264        ___deadline: zx::MonotonicInstant,
265    ) -> Result<(), fidl::Error> {
266        let _response = self.client.send_query::<
267            fidl::encoding::EmptyPayload,
268            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
269            ControllerMarker,
270        >(
271            (),
272            0xd3ee36073fdfdf0,
273            fidl::encoding::DynamicFlags::FLEXIBLE,
274            ___deadline,
275        )?
276        .into_result::<ControllerMarker>("clear_syscall_log_filters")?;
277        Ok(_response)
278    }
279}
280
281#[cfg(target_os = "fuchsia")]
282impl From<ControllerSynchronousProxy> for zx::NullableHandle {
283    fn from(value: ControllerSynchronousProxy) -> Self {
284        value.into_channel().into()
285    }
286}
287
288#[cfg(target_os = "fuchsia")]
289impl From<fidl::Channel> for ControllerSynchronousProxy {
290    fn from(value: fidl::Channel) -> Self {
291        Self::new(value)
292    }
293}
294
295#[cfg(target_os = "fuchsia")]
296impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
297    type Protocol = ControllerMarker;
298
299    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
300        Self::new(value.into_channel())
301    }
302}
303
304#[derive(Debug, Clone)]
305pub struct ControllerProxy {
306    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
307}
308
309impl fidl::endpoints::Proxy for ControllerProxy {
310    type Protocol = ControllerMarker;
311
312    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
313        Self::new(inner)
314    }
315
316    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
317        self.client.into_channel().map_err(|client| Self { client })
318    }
319
320    fn as_channel(&self) -> &::fidl::AsyncChannel {
321        self.client.as_channel()
322    }
323}
324
325impl ControllerProxy {
326    /// Create a new Proxy for fuchsia.starnix.container/Controller.
327    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
328        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
329        Self { client: fidl::client::Client::new(channel, protocol_name) }
330    }
331
332    /// Get a Stream of events from the remote end of the protocol.
333    ///
334    /// # Panics
335    ///
336    /// Panics if the event stream was already taken.
337    pub fn take_event_stream(&self) -> ControllerEventStream {
338        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
339    }
340
341    /// Connects `bridge_socket` to a vsocket at `port` in the container.
342    pub fn r#vsock_connect(
343        &self,
344        mut payload: ControllerVsockConnectRequest,
345    ) -> Result<(), fidl::Error> {
346        ControllerProxyInterface::r#vsock_connect(self, payload)
347    }
348
349    /// Spawn a console for debugging in the container. For testing, prefer launching Linux programs
350    /// as components with the `starnix_container` runner.
351    ///
352    /// Returns when the console exits.
353    pub fn r#spawn_console(
354        &self,
355        mut payload: ControllerSpawnConsoleRequest,
356    ) -> fidl::client::QueryResponseFut<
357        ControllerSpawnConsoleResult,
358        fidl::encoding::DefaultFuchsiaResourceDialect,
359    > {
360        ControllerProxyInterface::r#spawn_console(self, payload)
361    }
362
363    /// Returns all processes that have open files that are backed by a vmo with koid.
364    pub fn r#get_vmo_references(
365        &self,
366        mut payload: &ControllerGetVmoReferencesRequest,
367    ) -> fidl::client::QueryResponseFut<
368        ControllerGetVmoReferencesResponse,
369        fidl::encoding::DefaultFuchsiaResourceDialect,
370    > {
371        ControllerProxyInterface::r#get_vmo_references(self, payload)
372    }
373
374    /// Returns the job handle of the container.
375    pub fn r#get_job_handle(
376        &self,
377    ) -> fidl::client::QueryResponseFut<
378        ControllerGetJobHandleResponse,
379        fidl::encoding::DefaultFuchsiaResourceDialect,
380    > {
381        ControllerProxyInterface::r#get_job_handle(self)
382    }
383
384    /// Sends the provided signal to the process with the given pid.
385    pub fn r#send_signal(
386        &self,
387        mut payload: &ControllerSendSignalRequest,
388    ) -> fidl::client::QueryResponseFut<
389        ControllerSendSignalResult,
390        fidl::encoding::DefaultFuchsiaResourceDialect,
391    > {
392        ControllerProxyInterface::r#send_signal(self, payload)
393    }
394
395    /// Sets a filter to log syscalls at INFO level for processes matching `process_name`.
396    pub fn r#set_syscall_log_filter(
397        &self,
398        mut payload: &ControllerSetSyscallLogFilterRequest,
399    ) -> fidl::client::QueryResponseFut<
400        ControllerSetSyscallLogFilterResult,
401        fidl::encoding::DefaultFuchsiaResourceDialect,
402    > {
403        ControllerProxyInterface::r#set_syscall_log_filter(self, payload)
404    }
405
406    /// Clears all syscall log filters.
407    pub fn r#clear_syscall_log_filters(
408        &self,
409    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
410        ControllerProxyInterface::r#clear_syscall_log_filters(self)
411    }
412}
413
414impl ControllerProxyInterface for ControllerProxy {
415    fn r#vsock_connect(
416        &self,
417        mut payload: ControllerVsockConnectRequest,
418    ) -> Result<(), fidl::Error> {
419        self.client.send::<ControllerVsockConnectRequest>(
420            &mut payload,
421            0x494a469a8943213b,
422            fidl::encoding::DynamicFlags::FLEXIBLE,
423        )
424    }
425
426    type SpawnConsoleResponseFut = fidl::client::QueryResponseFut<
427        ControllerSpawnConsoleResult,
428        fidl::encoding::DefaultFuchsiaResourceDialect,
429    >;
430    fn r#spawn_console(
431        &self,
432        mut payload: ControllerSpawnConsoleRequest,
433    ) -> Self::SpawnConsoleResponseFut {
434        fn _decode(
435            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
436        ) -> Result<ControllerSpawnConsoleResult, fidl::Error> {
437            let _response = fidl::client::decode_transaction_body::<
438                fidl::encoding::FlexibleResultType<
439                    ControllerSpawnConsoleResponse,
440                    SpawnConsoleError,
441                >,
442                fidl::encoding::DefaultFuchsiaResourceDialect,
443                0x76eb46fdc63aa8b8,
444            >(_buf?)?
445            .into_result::<ControllerMarker>("spawn_console")?;
446            Ok(_response.map(|x| x.exit_code))
447        }
448        self.client
449            .send_query_and_decode::<ControllerSpawnConsoleRequest, ControllerSpawnConsoleResult>(
450                &mut payload,
451                0x76eb46fdc63aa8b8,
452                fidl::encoding::DynamicFlags::FLEXIBLE,
453                _decode,
454            )
455    }
456
457    type GetVmoReferencesResponseFut = fidl::client::QueryResponseFut<
458        ControllerGetVmoReferencesResponse,
459        fidl::encoding::DefaultFuchsiaResourceDialect,
460    >;
461    fn r#get_vmo_references(
462        &self,
463        mut payload: &ControllerGetVmoReferencesRequest,
464    ) -> Self::GetVmoReferencesResponseFut {
465        fn _decode(
466            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
467        ) -> Result<ControllerGetVmoReferencesResponse, fidl::Error> {
468            let _response = fidl::client::decode_transaction_body::<
469                fidl::encoding::FlexibleType<ControllerGetVmoReferencesResponse>,
470                fidl::encoding::DefaultFuchsiaResourceDialect,
471                0x47a7f039bb97f173,
472            >(_buf?)?
473            .into_result::<ControllerMarker>("get_vmo_references")?;
474            Ok(_response)
475        }
476        self.client.send_query_and_decode::<
477            ControllerGetVmoReferencesRequest,
478            ControllerGetVmoReferencesResponse,
479        >(
480            payload,
481            0x47a7f039bb97f173,
482            fidl::encoding::DynamicFlags::FLEXIBLE,
483            _decode,
484        )
485    }
486
487    type GetJobHandleResponseFut = fidl::client::QueryResponseFut<
488        ControllerGetJobHandleResponse,
489        fidl::encoding::DefaultFuchsiaResourceDialect,
490    >;
491    fn r#get_job_handle(&self) -> Self::GetJobHandleResponseFut {
492        fn _decode(
493            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
494        ) -> Result<ControllerGetJobHandleResponse, fidl::Error> {
495            let _response = fidl::client::decode_transaction_body::<
496                fidl::encoding::FlexibleType<ControllerGetJobHandleResponse>,
497                fidl::encoding::DefaultFuchsiaResourceDialect,
498                0x60a31a248576ffea,
499            >(_buf?)?
500            .into_result::<ControllerMarker>("get_job_handle")?;
501            Ok(_response)
502        }
503        self.client
504            .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerGetJobHandleResponse>(
505                (),
506                0x60a31a248576ffea,
507                fidl::encoding::DynamicFlags::FLEXIBLE,
508                _decode,
509            )
510    }
511
512    type SendSignalResponseFut = fidl::client::QueryResponseFut<
513        ControllerSendSignalResult,
514        fidl::encoding::DefaultFuchsiaResourceDialect,
515    >;
516    fn r#send_signal(
517        &self,
518        mut payload: &ControllerSendSignalRequest,
519    ) -> Self::SendSignalResponseFut {
520        fn _decode(
521            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
522        ) -> Result<ControllerSendSignalResult, fidl::Error> {
523            let _response = fidl::client::decode_transaction_body::<
524                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, SignalError>,
525                fidl::encoding::DefaultFuchsiaResourceDialect,
526                0x253b1a0d3b9639e3,
527            >(_buf?)?
528            .into_result::<ControllerMarker>("send_signal")?;
529            Ok(_response.map(|x| x))
530        }
531        self.client
532            .send_query_and_decode::<ControllerSendSignalRequest, ControllerSendSignalResult>(
533                payload,
534                0x253b1a0d3b9639e3,
535                fidl::encoding::DynamicFlags::FLEXIBLE,
536                _decode,
537            )
538    }
539
540    type SetSyscallLogFilterResponseFut = fidl::client::QueryResponseFut<
541        ControllerSetSyscallLogFilterResult,
542        fidl::encoding::DefaultFuchsiaResourceDialect,
543    >;
544    fn r#set_syscall_log_filter(
545        &self,
546        mut payload: &ControllerSetSyscallLogFilterRequest,
547    ) -> Self::SetSyscallLogFilterResponseFut {
548        fn _decode(
549            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
550        ) -> Result<ControllerSetSyscallLogFilterResult, fidl::Error> {
551            let _response = fidl::client::decode_transaction_body::<
552                fidl::encoding::FlexibleResultType<
553                    fidl::encoding::EmptyStruct,
554                    SetSyscallLogFilterError,
555                >,
556                fidl::encoding::DefaultFuchsiaResourceDialect,
557                0x2d2a49963abdee9b,
558            >(_buf?)?
559            .into_result::<ControllerMarker>("set_syscall_log_filter")?;
560            Ok(_response.map(|x| x))
561        }
562        self.client.send_query_and_decode::<
563            ControllerSetSyscallLogFilterRequest,
564            ControllerSetSyscallLogFilterResult,
565        >(
566            payload,
567            0x2d2a49963abdee9b,
568            fidl::encoding::DynamicFlags::FLEXIBLE,
569            _decode,
570        )
571    }
572
573    type ClearSyscallLogFiltersResponseFut =
574        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
575    fn r#clear_syscall_log_filters(&self) -> Self::ClearSyscallLogFiltersResponseFut {
576        fn _decode(
577            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
578        ) -> Result<(), fidl::Error> {
579            let _response = fidl::client::decode_transaction_body::<
580                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
581                fidl::encoding::DefaultFuchsiaResourceDialect,
582                0xd3ee36073fdfdf0,
583            >(_buf?)?
584            .into_result::<ControllerMarker>("clear_syscall_log_filters")?;
585            Ok(_response)
586        }
587        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
588            (),
589            0xd3ee36073fdfdf0,
590            fidl::encoding::DynamicFlags::FLEXIBLE,
591            _decode,
592        )
593    }
594}
595
596pub struct ControllerEventStream {
597    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
598}
599
600impl std::marker::Unpin for ControllerEventStream {}
601
602impl futures::stream::FusedStream for ControllerEventStream {
603    fn is_terminated(&self) -> bool {
604        self.event_receiver.is_terminated()
605    }
606}
607
608impl futures::Stream for ControllerEventStream {
609    type Item = Result<ControllerEvent, fidl::Error>;
610
611    fn poll_next(
612        mut self: std::pin::Pin<&mut Self>,
613        cx: &mut std::task::Context<'_>,
614    ) -> std::task::Poll<Option<Self::Item>> {
615        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
616            &mut self.event_receiver,
617            cx
618        )?) {
619            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
620            None => std::task::Poll::Ready(None),
621        }
622    }
623}
624
625#[derive(Debug)]
626pub enum ControllerEvent {
627    #[non_exhaustive]
628    _UnknownEvent {
629        /// Ordinal of the event that was sent.
630        ordinal: u64,
631    },
632}
633
634impl ControllerEvent {
635    /// Decodes a message buffer as a [`ControllerEvent`].
636    fn decode(
637        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
638    ) -> Result<ControllerEvent, fidl::Error> {
639        let (bytes, _handles) = buf.split_mut();
640        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
641        debug_assert_eq!(tx_header.tx_id, 0);
642        match tx_header.ordinal {
643            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
644                Ok(ControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
645            }
646            _ => Err(fidl::Error::UnknownOrdinal {
647                ordinal: tx_header.ordinal,
648                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
649            }),
650        }
651    }
652}
653
654/// A Stream of incoming requests for fuchsia.starnix.container/Controller.
655pub struct ControllerRequestStream {
656    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
657    is_terminated: bool,
658}
659
660impl std::marker::Unpin for ControllerRequestStream {}
661
662impl futures::stream::FusedStream for ControllerRequestStream {
663    fn is_terminated(&self) -> bool {
664        self.is_terminated
665    }
666}
667
668impl fidl::endpoints::RequestStream for ControllerRequestStream {
669    type Protocol = ControllerMarker;
670    type ControlHandle = ControllerControlHandle;
671
672    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
673        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
674    }
675
676    fn control_handle(&self) -> Self::ControlHandle {
677        ControllerControlHandle { inner: self.inner.clone() }
678    }
679
680    fn into_inner(
681        self,
682    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
683    {
684        (self.inner, self.is_terminated)
685    }
686
687    fn from_inner(
688        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
689        is_terminated: bool,
690    ) -> Self {
691        Self { inner, is_terminated }
692    }
693}
694
695impl futures::Stream for ControllerRequestStream {
696    type Item = Result<ControllerRequest, fidl::Error>;
697
698    fn poll_next(
699        mut self: std::pin::Pin<&mut Self>,
700        cx: &mut std::task::Context<'_>,
701    ) -> std::task::Poll<Option<Self::Item>> {
702        let this = &mut *self;
703        if this.inner.check_shutdown(cx) {
704            this.is_terminated = true;
705            return std::task::Poll::Ready(None);
706        }
707        if this.is_terminated {
708            panic!("polled ControllerRequestStream after completion");
709        }
710        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
711            |bytes, handles| {
712                match this.inner.channel().read_etc(cx, bytes, handles) {
713                    std::task::Poll::Ready(Ok(())) => {}
714                    std::task::Poll::Pending => return std::task::Poll::Pending,
715                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
716                        this.is_terminated = true;
717                        return std::task::Poll::Ready(None);
718                    }
719                    std::task::Poll::Ready(Err(e)) => {
720                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
721                            e.into(),
722                        ))));
723                    }
724                }
725
726                // A message has been received from the channel
727                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
728
729                std::task::Poll::Ready(Some(match header.ordinal {
730                    0x494a469a8943213b => {
731                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
732                        let mut req = fidl::new_empty!(
733                            ControllerVsockConnectRequest,
734                            fidl::encoding::DefaultFuchsiaResourceDialect
735                        );
736                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerVsockConnectRequest>(&header, _body_bytes, handles, &mut req)?;
737                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
738                        Ok(ControllerRequest::VsockConnect { payload: req, control_handle })
739                    }
740                    0x76eb46fdc63aa8b8 => {
741                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
742                        let mut req = fidl::new_empty!(
743                            ControllerSpawnConsoleRequest,
744                            fidl::encoding::DefaultFuchsiaResourceDialect
745                        );
746                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSpawnConsoleRequest>(&header, _body_bytes, handles, &mut req)?;
747                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
748                        Ok(ControllerRequest::SpawnConsole {
749                            payload: req,
750                            responder: ControllerSpawnConsoleResponder {
751                                control_handle: std::mem::ManuallyDrop::new(control_handle),
752                                tx_id: header.tx_id,
753                            },
754                        })
755                    }
756                    0x47a7f039bb97f173 => {
757                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
758                        let mut req = fidl::new_empty!(
759                            ControllerGetVmoReferencesRequest,
760                            fidl::encoding::DefaultFuchsiaResourceDialect
761                        );
762                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerGetVmoReferencesRequest>(&header, _body_bytes, handles, &mut req)?;
763                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
764                        Ok(ControllerRequest::GetVmoReferences {
765                            payload: req,
766                            responder: ControllerGetVmoReferencesResponder {
767                                control_handle: std::mem::ManuallyDrop::new(control_handle),
768                                tx_id: header.tx_id,
769                            },
770                        })
771                    }
772                    0x60a31a248576ffea => {
773                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
774                        let mut req = fidl::new_empty!(
775                            fidl::encoding::EmptyPayload,
776                            fidl::encoding::DefaultFuchsiaResourceDialect
777                        );
778                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
779                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
780                        Ok(ControllerRequest::GetJobHandle {
781                            responder: ControllerGetJobHandleResponder {
782                                control_handle: std::mem::ManuallyDrop::new(control_handle),
783                                tx_id: header.tx_id,
784                            },
785                        })
786                    }
787                    0x253b1a0d3b9639e3 => {
788                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
789                        let mut req = fidl::new_empty!(
790                            ControllerSendSignalRequest,
791                            fidl::encoding::DefaultFuchsiaResourceDialect
792                        );
793                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSendSignalRequest>(&header, _body_bytes, handles, &mut req)?;
794                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
795                        Ok(ControllerRequest::SendSignal {
796                            payload: req,
797                            responder: ControllerSendSignalResponder {
798                                control_handle: std::mem::ManuallyDrop::new(control_handle),
799                                tx_id: header.tx_id,
800                            },
801                        })
802                    }
803                    0x2d2a49963abdee9b => {
804                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
805                        let mut req = fidl::new_empty!(
806                            ControllerSetSyscallLogFilterRequest,
807                            fidl::encoding::DefaultFuchsiaResourceDialect
808                        );
809                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSetSyscallLogFilterRequest>(&header, _body_bytes, handles, &mut req)?;
810                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
811                        Ok(ControllerRequest::SetSyscallLogFilter {
812                            payload: req,
813                            responder: ControllerSetSyscallLogFilterResponder {
814                                control_handle: std::mem::ManuallyDrop::new(control_handle),
815                                tx_id: header.tx_id,
816                            },
817                        })
818                    }
819                    0xd3ee36073fdfdf0 => {
820                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
821                        let mut req = fidl::new_empty!(
822                            fidl::encoding::EmptyPayload,
823                            fidl::encoding::DefaultFuchsiaResourceDialect
824                        );
825                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
826                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
827                        Ok(ControllerRequest::ClearSyscallLogFilters {
828                            responder: ControllerClearSyscallLogFiltersResponder {
829                                control_handle: std::mem::ManuallyDrop::new(control_handle),
830                                tx_id: header.tx_id,
831                            },
832                        })
833                    }
834                    _ if header.tx_id == 0
835                        && header
836                            .dynamic_flags()
837                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
838                    {
839                        Ok(ControllerRequest::_UnknownMethod {
840                            ordinal: header.ordinal,
841                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
842                            method_type: fidl::MethodType::OneWay,
843                        })
844                    }
845                    _ if header
846                        .dynamic_flags()
847                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
848                    {
849                        this.inner.send_framework_err(
850                            fidl::encoding::FrameworkErr::UnknownMethod,
851                            header.tx_id,
852                            header.ordinal,
853                            header.dynamic_flags(),
854                            (bytes, handles),
855                        )?;
856                        Ok(ControllerRequest::_UnknownMethod {
857                            ordinal: header.ordinal,
858                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
859                            method_type: fidl::MethodType::TwoWay,
860                        })
861                    }
862                    _ => Err(fidl::Error::UnknownOrdinal {
863                        ordinal: header.ordinal,
864                        protocol_name:
865                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
866                    }),
867                }))
868            },
869        )
870    }
871}
872
873#[derive(Debug)]
874pub enum ControllerRequest {
875    /// Connects `bridge_socket` to a vsocket at `port` in the container.
876    VsockConnect { payload: ControllerVsockConnectRequest, control_handle: ControllerControlHandle },
877    /// Spawn a console for debugging in the container. For testing, prefer launching Linux programs
878    /// as components with the `starnix_container` runner.
879    ///
880    /// Returns when the console exits.
881    SpawnConsole {
882        payload: ControllerSpawnConsoleRequest,
883        responder: ControllerSpawnConsoleResponder,
884    },
885    /// Returns all processes that have open files that are backed by a vmo with koid.
886    GetVmoReferences {
887        payload: ControllerGetVmoReferencesRequest,
888        responder: ControllerGetVmoReferencesResponder,
889    },
890    /// Returns the job handle of the container.
891    GetJobHandle { responder: ControllerGetJobHandleResponder },
892    /// Sends the provided signal to the process with the given pid.
893    SendSignal { payload: ControllerSendSignalRequest, responder: ControllerSendSignalResponder },
894    /// Sets a filter to log syscalls at INFO level for processes matching `process_name`.
895    SetSyscallLogFilter {
896        payload: ControllerSetSyscallLogFilterRequest,
897        responder: ControllerSetSyscallLogFilterResponder,
898    },
899    /// Clears all syscall log filters.
900    ClearSyscallLogFilters { responder: ControllerClearSyscallLogFiltersResponder },
901    /// An interaction was received which does not match any known method.
902    #[non_exhaustive]
903    _UnknownMethod {
904        /// Ordinal of the method that was called.
905        ordinal: u64,
906        control_handle: ControllerControlHandle,
907        method_type: fidl::MethodType,
908    },
909}
910
911impl ControllerRequest {
912    #[allow(irrefutable_let_patterns)]
913    pub fn into_vsock_connect(
914        self,
915    ) -> Option<(ControllerVsockConnectRequest, ControllerControlHandle)> {
916        if let ControllerRequest::VsockConnect { payload, control_handle } = self {
917            Some((payload, control_handle))
918        } else {
919            None
920        }
921    }
922
923    #[allow(irrefutable_let_patterns)]
924    pub fn into_spawn_console(
925        self,
926    ) -> Option<(ControllerSpawnConsoleRequest, ControllerSpawnConsoleResponder)> {
927        if let ControllerRequest::SpawnConsole { payload, responder } = self {
928            Some((payload, responder))
929        } else {
930            None
931        }
932    }
933
934    #[allow(irrefutable_let_patterns)]
935    pub fn into_get_vmo_references(
936        self,
937    ) -> Option<(ControllerGetVmoReferencesRequest, ControllerGetVmoReferencesResponder)> {
938        if let ControllerRequest::GetVmoReferences { payload, responder } = self {
939            Some((payload, responder))
940        } else {
941            None
942        }
943    }
944
945    #[allow(irrefutable_let_patterns)]
946    pub fn into_get_job_handle(self) -> Option<(ControllerGetJobHandleResponder)> {
947        if let ControllerRequest::GetJobHandle { responder } = self {
948            Some((responder))
949        } else {
950            None
951        }
952    }
953
954    #[allow(irrefutable_let_patterns)]
955    pub fn into_send_signal(
956        self,
957    ) -> Option<(ControllerSendSignalRequest, ControllerSendSignalResponder)> {
958        if let ControllerRequest::SendSignal { payload, responder } = self {
959            Some((payload, responder))
960        } else {
961            None
962        }
963    }
964
965    #[allow(irrefutable_let_patterns)]
966    pub fn into_set_syscall_log_filter(
967        self,
968    ) -> Option<(ControllerSetSyscallLogFilterRequest, ControllerSetSyscallLogFilterResponder)>
969    {
970        if let ControllerRequest::SetSyscallLogFilter { payload, responder } = self {
971            Some((payload, responder))
972        } else {
973            None
974        }
975    }
976
977    #[allow(irrefutable_let_patterns)]
978    pub fn into_clear_syscall_log_filters(
979        self,
980    ) -> Option<(ControllerClearSyscallLogFiltersResponder)> {
981        if let ControllerRequest::ClearSyscallLogFilters { responder } = self {
982            Some((responder))
983        } else {
984            None
985        }
986    }
987
988    /// Name of the method defined in FIDL
989    pub fn method_name(&self) -> &'static str {
990        match *self {
991            ControllerRequest::VsockConnect { .. } => "vsock_connect",
992            ControllerRequest::SpawnConsole { .. } => "spawn_console",
993            ControllerRequest::GetVmoReferences { .. } => "get_vmo_references",
994            ControllerRequest::GetJobHandle { .. } => "get_job_handle",
995            ControllerRequest::SendSignal { .. } => "send_signal",
996            ControllerRequest::SetSyscallLogFilter { .. } => "set_syscall_log_filter",
997            ControllerRequest::ClearSyscallLogFilters { .. } => "clear_syscall_log_filters",
998            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
999                "unknown one-way method"
1000            }
1001            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1002                "unknown two-way method"
1003            }
1004        }
1005    }
1006}
1007
1008#[derive(Debug, Clone)]
1009pub struct ControllerControlHandle {
1010    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1011}
1012
1013impl ControllerControlHandle {
1014    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1015        self.inner.shutdown_with_epitaph(status.into())
1016    }
1017}
1018
1019impl fidl::endpoints::ControlHandle for ControllerControlHandle {
1020    fn shutdown(&self) {
1021        self.inner.shutdown()
1022    }
1023
1024    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1025        self.inner.shutdown_with_epitaph(status)
1026    }
1027
1028    fn is_closed(&self) -> bool {
1029        self.inner.channel().is_closed()
1030    }
1031    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1032        self.inner.channel().on_closed()
1033    }
1034
1035    #[cfg(target_os = "fuchsia")]
1036    fn signal_peer(
1037        &self,
1038        clear_mask: zx::Signals,
1039        set_mask: zx::Signals,
1040    ) -> Result<(), zx_status::Status> {
1041        use fidl::Peered;
1042        self.inner.channel().signal_peer(clear_mask, set_mask)
1043    }
1044}
1045
1046impl ControllerControlHandle {}
1047
1048#[must_use = "FIDL methods require a response to be sent"]
1049#[derive(Debug)]
1050pub struct ControllerSpawnConsoleResponder {
1051    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1052    tx_id: u32,
1053}
1054
1055/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1056/// if the responder is dropped without sending a response, so that the client
1057/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1058impl std::ops::Drop for ControllerSpawnConsoleResponder {
1059    fn drop(&mut self) {
1060        self.control_handle.shutdown();
1061        // Safety: drops once, never accessed again
1062        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1063    }
1064}
1065
1066impl fidl::endpoints::Responder for ControllerSpawnConsoleResponder {
1067    type ControlHandle = ControllerControlHandle;
1068
1069    fn control_handle(&self) -> &ControllerControlHandle {
1070        &self.control_handle
1071    }
1072
1073    fn drop_without_shutdown(mut self) {
1074        // Safety: drops once, never accessed again due to mem::forget
1075        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1076        // Prevent Drop from running (which would shut down the channel)
1077        std::mem::forget(self);
1078    }
1079}
1080
1081impl ControllerSpawnConsoleResponder {
1082    /// Sends a response to the FIDL transaction.
1083    ///
1084    /// Sets the channel to shutdown if an error occurs.
1085    pub fn send(self, mut result: Result<u8, SpawnConsoleError>) -> Result<(), fidl::Error> {
1086        let _result = self.send_raw(result);
1087        if _result.is_err() {
1088            self.control_handle.shutdown();
1089        }
1090        self.drop_without_shutdown();
1091        _result
1092    }
1093
1094    /// Similar to "send" but does not shutdown the channel if an error occurs.
1095    pub fn send_no_shutdown_on_err(
1096        self,
1097        mut result: Result<u8, SpawnConsoleError>,
1098    ) -> Result<(), fidl::Error> {
1099        let _result = self.send_raw(result);
1100        self.drop_without_shutdown();
1101        _result
1102    }
1103
1104    fn send_raw(&self, mut result: Result<u8, SpawnConsoleError>) -> Result<(), fidl::Error> {
1105        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1106            ControllerSpawnConsoleResponse,
1107            SpawnConsoleError,
1108        >>(
1109            fidl::encoding::FlexibleResult::new(result.map(|exit_code| (exit_code,))),
1110            self.tx_id,
1111            0x76eb46fdc63aa8b8,
1112            fidl::encoding::DynamicFlags::FLEXIBLE,
1113        )
1114    }
1115}
1116
1117#[must_use = "FIDL methods require a response to be sent"]
1118#[derive(Debug)]
1119pub struct ControllerGetVmoReferencesResponder {
1120    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1121    tx_id: u32,
1122}
1123
1124/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1125/// if the responder is dropped without sending a response, so that the client
1126/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1127impl std::ops::Drop for ControllerGetVmoReferencesResponder {
1128    fn drop(&mut self) {
1129        self.control_handle.shutdown();
1130        // Safety: drops once, never accessed again
1131        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1132    }
1133}
1134
1135impl fidl::endpoints::Responder for ControllerGetVmoReferencesResponder {
1136    type ControlHandle = ControllerControlHandle;
1137
1138    fn control_handle(&self) -> &ControllerControlHandle {
1139        &self.control_handle
1140    }
1141
1142    fn drop_without_shutdown(mut self) {
1143        // Safety: drops once, never accessed again due to mem::forget
1144        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1145        // Prevent Drop from running (which would shut down the channel)
1146        std::mem::forget(self);
1147    }
1148}
1149
1150impl ControllerGetVmoReferencesResponder {
1151    /// Sends a response to the FIDL transaction.
1152    ///
1153    /// Sets the channel to shutdown if an error occurs.
1154    pub fn send(self, mut payload: &ControllerGetVmoReferencesResponse) -> Result<(), fidl::Error> {
1155        let _result = self.send_raw(payload);
1156        if _result.is_err() {
1157            self.control_handle.shutdown();
1158        }
1159        self.drop_without_shutdown();
1160        _result
1161    }
1162
1163    /// Similar to "send" but does not shutdown the channel if an error occurs.
1164    pub fn send_no_shutdown_on_err(
1165        self,
1166        mut payload: &ControllerGetVmoReferencesResponse,
1167    ) -> Result<(), fidl::Error> {
1168        let _result = self.send_raw(payload);
1169        self.drop_without_shutdown();
1170        _result
1171    }
1172
1173    fn send_raw(
1174        &self,
1175        mut payload: &ControllerGetVmoReferencesResponse,
1176    ) -> Result<(), fidl::Error> {
1177        self.control_handle
1178            .inner
1179            .send::<fidl::encoding::FlexibleType<ControllerGetVmoReferencesResponse>>(
1180                fidl::encoding::Flexible::new(payload),
1181                self.tx_id,
1182                0x47a7f039bb97f173,
1183                fidl::encoding::DynamicFlags::FLEXIBLE,
1184            )
1185    }
1186}
1187
1188#[must_use = "FIDL methods require a response to be sent"]
1189#[derive(Debug)]
1190pub struct ControllerGetJobHandleResponder {
1191    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1192    tx_id: u32,
1193}
1194
1195/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1196/// if the responder is dropped without sending a response, so that the client
1197/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1198impl std::ops::Drop for ControllerGetJobHandleResponder {
1199    fn drop(&mut self) {
1200        self.control_handle.shutdown();
1201        // Safety: drops once, never accessed again
1202        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1203    }
1204}
1205
1206impl fidl::endpoints::Responder for ControllerGetJobHandleResponder {
1207    type ControlHandle = ControllerControlHandle;
1208
1209    fn control_handle(&self) -> &ControllerControlHandle {
1210        &self.control_handle
1211    }
1212
1213    fn drop_without_shutdown(mut self) {
1214        // Safety: drops once, never accessed again due to mem::forget
1215        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1216        // Prevent Drop from running (which would shut down the channel)
1217        std::mem::forget(self);
1218    }
1219}
1220
1221impl ControllerGetJobHandleResponder {
1222    /// Sends a response to the FIDL transaction.
1223    ///
1224    /// Sets the channel to shutdown if an error occurs.
1225    pub fn send(self, mut payload: ControllerGetJobHandleResponse) -> Result<(), fidl::Error> {
1226        let _result = self.send_raw(payload);
1227        if _result.is_err() {
1228            self.control_handle.shutdown();
1229        }
1230        self.drop_without_shutdown();
1231        _result
1232    }
1233
1234    /// Similar to "send" but does not shutdown the channel if an error occurs.
1235    pub fn send_no_shutdown_on_err(
1236        self,
1237        mut payload: ControllerGetJobHandleResponse,
1238    ) -> Result<(), fidl::Error> {
1239        let _result = self.send_raw(payload);
1240        self.drop_without_shutdown();
1241        _result
1242    }
1243
1244    fn send_raw(&self, mut payload: ControllerGetJobHandleResponse) -> Result<(), fidl::Error> {
1245        self.control_handle
1246            .inner
1247            .send::<fidl::encoding::FlexibleType<ControllerGetJobHandleResponse>>(
1248                fidl::encoding::Flexible::new(&mut payload),
1249                self.tx_id,
1250                0x60a31a248576ffea,
1251                fidl::encoding::DynamicFlags::FLEXIBLE,
1252            )
1253    }
1254}
1255
1256#[must_use = "FIDL methods require a response to be sent"]
1257#[derive(Debug)]
1258pub struct ControllerSendSignalResponder {
1259    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1260    tx_id: u32,
1261}
1262
1263/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1264/// if the responder is dropped without sending a response, so that the client
1265/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1266impl std::ops::Drop for ControllerSendSignalResponder {
1267    fn drop(&mut self) {
1268        self.control_handle.shutdown();
1269        // Safety: drops once, never accessed again
1270        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1271    }
1272}
1273
1274impl fidl::endpoints::Responder for ControllerSendSignalResponder {
1275    type ControlHandle = ControllerControlHandle;
1276
1277    fn control_handle(&self) -> &ControllerControlHandle {
1278        &self.control_handle
1279    }
1280
1281    fn drop_without_shutdown(mut self) {
1282        // Safety: drops once, never accessed again due to mem::forget
1283        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1284        // Prevent Drop from running (which would shut down the channel)
1285        std::mem::forget(self);
1286    }
1287}
1288
1289impl ControllerSendSignalResponder {
1290    /// Sends a response to the FIDL transaction.
1291    ///
1292    /// Sets the channel to shutdown if an error occurs.
1293    pub fn send(self, mut result: Result<(), SignalError>) -> Result<(), fidl::Error> {
1294        let _result = self.send_raw(result);
1295        if _result.is_err() {
1296            self.control_handle.shutdown();
1297        }
1298        self.drop_without_shutdown();
1299        _result
1300    }
1301
1302    /// Similar to "send" but does not shutdown the channel if an error occurs.
1303    pub fn send_no_shutdown_on_err(
1304        self,
1305        mut result: Result<(), SignalError>,
1306    ) -> Result<(), fidl::Error> {
1307        let _result = self.send_raw(result);
1308        self.drop_without_shutdown();
1309        _result
1310    }
1311
1312    fn send_raw(&self, mut result: Result<(), SignalError>) -> Result<(), fidl::Error> {
1313        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1314            fidl::encoding::EmptyStruct,
1315            SignalError,
1316        >>(
1317            fidl::encoding::FlexibleResult::new(result),
1318            self.tx_id,
1319            0x253b1a0d3b9639e3,
1320            fidl::encoding::DynamicFlags::FLEXIBLE,
1321        )
1322    }
1323}
1324
1325#[must_use = "FIDL methods require a response to be sent"]
1326#[derive(Debug)]
1327pub struct ControllerSetSyscallLogFilterResponder {
1328    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1329    tx_id: u32,
1330}
1331
1332/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1333/// if the responder is dropped without sending a response, so that the client
1334/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1335impl std::ops::Drop for ControllerSetSyscallLogFilterResponder {
1336    fn drop(&mut self) {
1337        self.control_handle.shutdown();
1338        // Safety: drops once, never accessed again
1339        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1340    }
1341}
1342
1343impl fidl::endpoints::Responder for ControllerSetSyscallLogFilterResponder {
1344    type ControlHandle = ControllerControlHandle;
1345
1346    fn control_handle(&self) -> &ControllerControlHandle {
1347        &self.control_handle
1348    }
1349
1350    fn drop_without_shutdown(mut self) {
1351        // Safety: drops once, never accessed again due to mem::forget
1352        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1353        // Prevent Drop from running (which would shut down the channel)
1354        std::mem::forget(self);
1355    }
1356}
1357
1358impl ControllerSetSyscallLogFilterResponder {
1359    /// Sends a response to the FIDL transaction.
1360    ///
1361    /// Sets the channel to shutdown if an error occurs.
1362    pub fn send(self, mut result: Result<(), SetSyscallLogFilterError>) -> Result<(), fidl::Error> {
1363        let _result = self.send_raw(result);
1364        if _result.is_err() {
1365            self.control_handle.shutdown();
1366        }
1367        self.drop_without_shutdown();
1368        _result
1369    }
1370
1371    /// Similar to "send" but does not shutdown the channel if an error occurs.
1372    pub fn send_no_shutdown_on_err(
1373        self,
1374        mut result: Result<(), SetSyscallLogFilterError>,
1375    ) -> Result<(), fidl::Error> {
1376        let _result = self.send_raw(result);
1377        self.drop_without_shutdown();
1378        _result
1379    }
1380
1381    fn send_raw(
1382        &self,
1383        mut result: Result<(), SetSyscallLogFilterError>,
1384    ) -> Result<(), fidl::Error> {
1385        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1386            fidl::encoding::EmptyStruct,
1387            SetSyscallLogFilterError,
1388        >>(
1389            fidl::encoding::FlexibleResult::new(result),
1390            self.tx_id,
1391            0x2d2a49963abdee9b,
1392            fidl::encoding::DynamicFlags::FLEXIBLE,
1393        )
1394    }
1395}
1396
1397#[must_use = "FIDL methods require a response to be sent"]
1398#[derive(Debug)]
1399pub struct ControllerClearSyscallLogFiltersResponder {
1400    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1401    tx_id: u32,
1402}
1403
1404/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1405/// if the responder is dropped without sending a response, so that the client
1406/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1407impl std::ops::Drop for ControllerClearSyscallLogFiltersResponder {
1408    fn drop(&mut self) {
1409        self.control_handle.shutdown();
1410        // Safety: drops once, never accessed again
1411        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1412    }
1413}
1414
1415impl fidl::endpoints::Responder for ControllerClearSyscallLogFiltersResponder {
1416    type ControlHandle = ControllerControlHandle;
1417
1418    fn control_handle(&self) -> &ControllerControlHandle {
1419        &self.control_handle
1420    }
1421
1422    fn drop_without_shutdown(mut self) {
1423        // Safety: drops once, never accessed again due to mem::forget
1424        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1425        // Prevent Drop from running (which would shut down the channel)
1426        std::mem::forget(self);
1427    }
1428}
1429
1430impl ControllerClearSyscallLogFiltersResponder {
1431    /// Sends a response to the FIDL transaction.
1432    ///
1433    /// Sets the channel to shutdown if an error occurs.
1434    pub fn send(self) -> Result<(), fidl::Error> {
1435        let _result = self.send_raw();
1436        if _result.is_err() {
1437            self.control_handle.shutdown();
1438        }
1439        self.drop_without_shutdown();
1440        _result
1441    }
1442
1443    /// Similar to "send" but does not shutdown the channel if an error occurs.
1444    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1445        let _result = self.send_raw();
1446        self.drop_without_shutdown();
1447        _result
1448    }
1449
1450    fn send_raw(&self) -> Result<(), fidl::Error> {
1451        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1452            fidl::encoding::Flexible::new(()),
1453            self.tx_id,
1454            0xd3ee36073fdfdf0,
1455            fidl::encoding::DynamicFlags::FLEXIBLE,
1456        )
1457    }
1458}
1459
1460#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1461pub struct InfoMarker;
1462
1463impl fidl::endpoints::ProtocolMarker for InfoMarker {
1464    type Proxy = InfoProxy;
1465    type RequestStream = InfoRequestStream;
1466    #[cfg(target_os = "fuchsia")]
1467    type SynchronousProxy = InfoSynchronousProxy;
1468
1469    const DEBUG_NAME: &'static str = "fuchsia.starnix.container.Info";
1470}
1471impl fidl::endpoints::DiscoverableProtocolMarker for InfoMarker {}
1472
1473pub trait InfoProxyInterface: Send + Sync {
1474    type GetJobKoidResponseFut: std::future::Future<Output = Result<InfoGetJobKoidResponse, fidl::Error>>
1475        + Send;
1476    fn r#get_job_koid(&self) -> Self::GetJobKoidResponseFut;
1477}
1478#[derive(Debug)]
1479#[cfg(target_os = "fuchsia")]
1480pub struct InfoSynchronousProxy {
1481    client: fidl::client::sync::Client,
1482}
1483
1484#[cfg(target_os = "fuchsia")]
1485impl fidl::endpoints::SynchronousProxy for InfoSynchronousProxy {
1486    type Proxy = InfoProxy;
1487    type Protocol = InfoMarker;
1488
1489    fn from_channel(inner: fidl::Channel) -> Self {
1490        Self::new(inner)
1491    }
1492
1493    fn into_channel(self) -> fidl::Channel {
1494        self.client.into_channel()
1495    }
1496
1497    fn as_channel(&self) -> &fidl::Channel {
1498        self.client.as_channel()
1499    }
1500}
1501
1502#[cfg(target_os = "fuchsia")]
1503impl InfoSynchronousProxy {
1504    pub fn new(channel: fidl::Channel) -> Self {
1505        Self { client: fidl::client::sync::Client::new(channel) }
1506    }
1507
1508    pub fn into_channel(self) -> fidl::Channel {
1509        self.client.into_channel()
1510    }
1511
1512    /// Waits until an event arrives and returns it. It is safe for other
1513    /// threads to make concurrent requests while waiting for an event.
1514    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<InfoEvent, fidl::Error> {
1515        InfoEvent::decode(self.client.wait_for_event::<InfoMarker>(deadline)?)
1516    }
1517
1518    /// Returns the Zircon job KOID of the container.
1519    pub fn r#get_job_koid(
1520        &self,
1521        ___deadline: zx::MonotonicInstant,
1522    ) -> Result<InfoGetJobKoidResponse, fidl::Error> {
1523        let _response = self.client.send_query::<
1524            fidl::encoding::EmptyPayload,
1525            fidl::encoding::FlexibleType<InfoGetJobKoidResponse>,
1526            InfoMarker,
1527        >(
1528            (),
1529            0x5b60b29800a9a977,
1530            fidl::encoding::DynamicFlags::FLEXIBLE,
1531            ___deadline,
1532        )?
1533        .into_result::<InfoMarker>("get_job_koid")?;
1534        Ok(_response)
1535    }
1536}
1537
1538#[cfg(target_os = "fuchsia")]
1539impl From<InfoSynchronousProxy> for zx::NullableHandle {
1540    fn from(value: InfoSynchronousProxy) -> Self {
1541        value.into_channel().into()
1542    }
1543}
1544
1545#[cfg(target_os = "fuchsia")]
1546impl From<fidl::Channel> for InfoSynchronousProxy {
1547    fn from(value: fidl::Channel) -> Self {
1548        Self::new(value)
1549    }
1550}
1551
1552#[cfg(target_os = "fuchsia")]
1553impl fidl::endpoints::FromClient for InfoSynchronousProxy {
1554    type Protocol = InfoMarker;
1555
1556    fn from_client(value: fidl::endpoints::ClientEnd<InfoMarker>) -> Self {
1557        Self::new(value.into_channel())
1558    }
1559}
1560
1561#[derive(Debug, Clone)]
1562pub struct InfoProxy {
1563    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1564}
1565
1566impl fidl::endpoints::Proxy for InfoProxy {
1567    type Protocol = InfoMarker;
1568
1569    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1570        Self::new(inner)
1571    }
1572
1573    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1574        self.client.into_channel().map_err(|client| Self { client })
1575    }
1576
1577    fn as_channel(&self) -> &::fidl::AsyncChannel {
1578        self.client.as_channel()
1579    }
1580}
1581
1582impl InfoProxy {
1583    /// Create a new Proxy for fuchsia.starnix.container/Info.
1584    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1585        let protocol_name = <InfoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1586        Self { client: fidl::client::Client::new(channel, protocol_name) }
1587    }
1588
1589    /// Get a Stream of events from the remote end of the protocol.
1590    ///
1591    /// # Panics
1592    ///
1593    /// Panics if the event stream was already taken.
1594    pub fn take_event_stream(&self) -> InfoEventStream {
1595        InfoEventStream { event_receiver: self.client.take_event_receiver() }
1596    }
1597
1598    /// Returns the Zircon job KOID of the container.
1599    pub fn r#get_job_koid(
1600        &self,
1601    ) -> fidl::client::QueryResponseFut<
1602        InfoGetJobKoidResponse,
1603        fidl::encoding::DefaultFuchsiaResourceDialect,
1604    > {
1605        InfoProxyInterface::r#get_job_koid(self)
1606    }
1607}
1608
1609impl InfoProxyInterface for InfoProxy {
1610    type GetJobKoidResponseFut = fidl::client::QueryResponseFut<
1611        InfoGetJobKoidResponse,
1612        fidl::encoding::DefaultFuchsiaResourceDialect,
1613    >;
1614    fn r#get_job_koid(&self) -> Self::GetJobKoidResponseFut {
1615        fn _decode(
1616            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1617        ) -> Result<InfoGetJobKoidResponse, fidl::Error> {
1618            let _response = fidl::client::decode_transaction_body::<
1619                fidl::encoding::FlexibleType<InfoGetJobKoidResponse>,
1620                fidl::encoding::DefaultFuchsiaResourceDialect,
1621                0x5b60b29800a9a977,
1622            >(_buf?)?
1623            .into_result::<InfoMarker>("get_job_koid")?;
1624            Ok(_response)
1625        }
1626        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InfoGetJobKoidResponse>(
1627            (),
1628            0x5b60b29800a9a977,
1629            fidl::encoding::DynamicFlags::FLEXIBLE,
1630            _decode,
1631        )
1632    }
1633}
1634
1635pub struct InfoEventStream {
1636    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1637}
1638
1639impl std::marker::Unpin for InfoEventStream {}
1640
1641impl futures::stream::FusedStream for InfoEventStream {
1642    fn is_terminated(&self) -> bool {
1643        self.event_receiver.is_terminated()
1644    }
1645}
1646
1647impl futures::Stream for InfoEventStream {
1648    type Item = Result<InfoEvent, fidl::Error>;
1649
1650    fn poll_next(
1651        mut self: std::pin::Pin<&mut Self>,
1652        cx: &mut std::task::Context<'_>,
1653    ) -> std::task::Poll<Option<Self::Item>> {
1654        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1655            &mut self.event_receiver,
1656            cx
1657        )?) {
1658            Some(buf) => std::task::Poll::Ready(Some(InfoEvent::decode(buf))),
1659            None => std::task::Poll::Ready(None),
1660        }
1661    }
1662}
1663
1664#[derive(Debug)]
1665pub enum InfoEvent {
1666    #[non_exhaustive]
1667    _UnknownEvent {
1668        /// Ordinal of the event that was sent.
1669        ordinal: u64,
1670    },
1671}
1672
1673impl InfoEvent {
1674    /// Decodes a message buffer as a [`InfoEvent`].
1675    fn decode(
1676        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1677    ) -> Result<InfoEvent, fidl::Error> {
1678        let (bytes, _handles) = buf.split_mut();
1679        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1680        debug_assert_eq!(tx_header.tx_id, 0);
1681        match tx_header.ordinal {
1682            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1683                Ok(InfoEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1684            }
1685            _ => Err(fidl::Error::UnknownOrdinal {
1686                ordinal: tx_header.ordinal,
1687                protocol_name: <InfoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1688            }),
1689        }
1690    }
1691}
1692
1693/// A Stream of incoming requests for fuchsia.starnix.container/Info.
1694pub struct InfoRequestStream {
1695    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1696    is_terminated: bool,
1697}
1698
1699impl std::marker::Unpin for InfoRequestStream {}
1700
1701impl futures::stream::FusedStream for InfoRequestStream {
1702    fn is_terminated(&self) -> bool {
1703        self.is_terminated
1704    }
1705}
1706
1707impl fidl::endpoints::RequestStream for InfoRequestStream {
1708    type Protocol = InfoMarker;
1709    type ControlHandle = InfoControlHandle;
1710
1711    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1712        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1713    }
1714
1715    fn control_handle(&self) -> Self::ControlHandle {
1716        InfoControlHandle { inner: self.inner.clone() }
1717    }
1718
1719    fn into_inner(
1720        self,
1721    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1722    {
1723        (self.inner, self.is_terminated)
1724    }
1725
1726    fn from_inner(
1727        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1728        is_terminated: bool,
1729    ) -> Self {
1730        Self { inner, is_terminated }
1731    }
1732}
1733
1734impl futures::Stream for InfoRequestStream {
1735    type Item = Result<InfoRequest, fidl::Error>;
1736
1737    fn poll_next(
1738        mut self: std::pin::Pin<&mut Self>,
1739        cx: &mut std::task::Context<'_>,
1740    ) -> std::task::Poll<Option<Self::Item>> {
1741        let this = &mut *self;
1742        if this.inner.check_shutdown(cx) {
1743            this.is_terminated = true;
1744            return std::task::Poll::Ready(None);
1745        }
1746        if this.is_terminated {
1747            panic!("polled InfoRequestStream after completion");
1748        }
1749        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1750            |bytes, handles| {
1751                match this.inner.channel().read_etc(cx, bytes, handles) {
1752                    std::task::Poll::Ready(Ok(())) => {}
1753                    std::task::Poll::Pending => return std::task::Poll::Pending,
1754                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1755                        this.is_terminated = true;
1756                        return std::task::Poll::Ready(None);
1757                    }
1758                    std::task::Poll::Ready(Err(e)) => {
1759                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1760                            e.into(),
1761                        ))));
1762                    }
1763                }
1764
1765                // A message has been received from the channel
1766                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1767
1768                std::task::Poll::Ready(Some(match header.ordinal {
1769                    0x5b60b29800a9a977 => {
1770                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1771                        let mut req = fidl::new_empty!(
1772                            fidl::encoding::EmptyPayload,
1773                            fidl::encoding::DefaultFuchsiaResourceDialect
1774                        );
1775                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1776                        let control_handle = InfoControlHandle { inner: this.inner.clone() };
1777                        Ok(InfoRequest::GetJobKoid {
1778                            responder: InfoGetJobKoidResponder {
1779                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1780                                tx_id: header.tx_id,
1781                            },
1782                        })
1783                    }
1784                    _ if header.tx_id == 0
1785                        && header
1786                            .dynamic_flags()
1787                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1788                    {
1789                        Ok(InfoRequest::_UnknownMethod {
1790                            ordinal: header.ordinal,
1791                            control_handle: InfoControlHandle { inner: this.inner.clone() },
1792                            method_type: fidl::MethodType::OneWay,
1793                        })
1794                    }
1795                    _ if header
1796                        .dynamic_flags()
1797                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1798                    {
1799                        this.inner.send_framework_err(
1800                            fidl::encoding::FrameworkErr::UnknownMethod,
1801                            header.tx_id,
1802                            header.ordinal,
1803                            header.dynamic_flags(),
1804                            (bytes, handles),
1805                        )?;
1806                        Ok(InfoRequest::_UnknownMethod {
1807                            ordinal: header.ordinal,
1808                            control_handle: InfoControlHandle { inner: this.inner.clone() },
1809                            method_type: fidl::MethodType::TwoWay,
1810                        })
1811                    }
1812                    _ => Err(fidl::Error::UnknownOrdinal {
1813                        ordinal: header.ordinal,
1814                        protocol_name: <InfoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1815                    }),
1816                }))
1817            },
1818        )
1819    }
1820}
1821
1822#[derive(Debug)]
1823pub enum InfoRequest {
1824    /// Returns the Zircon job KOID of the container.
1825    GetJobKoid { responder: InfoGetJobKoidResponder },
1826    /// An interaction was received which does not match any known method.
1827    #[non_exhaustive]
1828    _UnknownMethod {
1829        /// Ordinal of the method that was called.
1830        ordinal: u64,
1831        control_handle: InfoControlHandle,
1832        method_type: fidl::MethodType,
1833    },
1834}
1835
1836impl InfoRequest {
1837    #[allow(irrefutable_let_patterns)]
1838    pub fn into_get_job_koid(self) -> Option<(InfoGetJobKoidResponder)> {
1839        if let InfoRequest::GetJobKoid { responder } = self { Some((responder)) } else { None }
1840    }
1841
1842    /// Name of the method defined in FIDL
1843    pub fn method_name(&self) -> &'static str {
1844        match *self {
1845            InfoRequest::GetJobKoid { .. } => "get_job_koid",
1846            InfoRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1847                "unknown one-way method"
1848            }
1849            InfoRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1850                "unknown two-way method"
1851            }
1852        }
1853    }
1854}
1855
1856#[derive(Debug, Clone)]
1857pub struct InfoControlHandle {
1858    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1859}
1860
1861impl InfoControlHandle {
1862    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1863        self.inner.shutdown_with_epitaph(status.into())
1864    }
1865}
1866
1867impl fidl::endpoints::ControlHandle for InfoControlHandle {
1868    fn shutdown(&self) {
1869        self.inner.shutdown()
1870    }
1871
1872    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1873        self.inner.shutdown_with_epitaph(status)
1874    }
1875
1876    fn is_closed(&self) -> bool {
1877        self.inner.channel().is_closed()
1878    }
1879    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1880        self.inner.channel().on_closed()
1881    }
1882
1883    #[cfg(target_os = "fuchsia")]
1884    fn signal_peer(
1885        &self,
1886        clear_mask: zx::Signals,
1887        set_mask: zx::Signals,
1888    ) -> Result<(), zx_status::Status> {
1889        use fidl::Peered;
1890        self.inner.channel().signal_peer(clear_mask, set_mask)
1891    }
1892}
1893
1894impl InfoControlHandle {}
1895
1896#[must_use = "FIDL methods require a response to be sent"]
1897#[derive(Debug)]
1898pub struct InfoGetJobKoidResponder {
1899    control_handle: std::mem::ManuallyDrop<InfoControlHandle>,
1900    tx_id: u32,
1901}
1902
1903/// Set the the channel to be shutdown (see [`InfoControlHandle::shutdown`])
1904/// if the responder is dropped without sending a response, so that the client
1905/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1906impl std::ops::Drop for InfoGetJobKoidResponder {
1907    fn drop(&mut self) {
1908        self.control_handle.shutdown();
1909        // Safety: drops once, never accessed again
1910        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1911    }
1912}
1913
1914impl fidl::endpoints::Responder for InfoGetJobKoidResponder {
1915    type ControlHandle = InfoControlHandle;
1916
1917    fn control_handle(&self) -> &InfoControlHandle {
1918        &self.control_handle
1919    }
1920
1921    fn drop_without_shutdown(mut self) {
1922        // Safety: drops once, never accessed again due to mem::forget
1923        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1924        // Prevent Drop from running (which would shut down the channel)
1925        std::mem::forget(self);
1926    }
1927}
1928
1929impl InfoGetJobKoidResponder {
1930    /// Sends a response to the FIDL transaction.
1931    ///
1932    /// Sets the channel to shutdown if an error occurs.
1933    pub fn send(self, mut payload: &InfoGetJobKoidResponse) -> Result<(), fidl::Error> {
1934        let _result = self.send_raw(payload);
1935        if _result.is_err() {
1936            self.control_handle.shutdown();
1937        }
1938        self.drop_without_shutdown();
1939        _result
1940    }
1941
1942    /// Similar to "send" but does not shutdown the channel if an error occurs.
1943    pub fn send_no_shutdown_on_err(
1944        self,
1945        mut payload: &InfoGetJobKoidResponse,
1946    ) -> Result<(), fidl::Error> {
1947        let _result = self.send_raw(payload);
1948        self.drop_without_shutdown();
1949        _result
1950    }
1951
1952    fn send_raw(&self, mut payload: &InfoGetJobKoidResponse) -> Result<(), fidl::Error> {
1953        self.control_handle.inner.send::<fidl::encoding::FlexibleType<InfoGetJobKoidResponse>>(
1954            fidl::encoding::Flexible::new(payload),
1955            self.tx_id,
1956            0x5b60b29800a9a977,
1957            fidl::encoding::DynamicFlags::FLEXIBLE,
1958        )
1959    }
1960}
1961
1962mod internal {
1963    use super::*;
1964
1965    impl ControllerSpawnConsoleRequest {
1966        #[inline(always)]
1967        fn max_ordinal_present(&self) -> u64 {
1968            if let Some(_) = self.window_size {
1969                return 6;
1970            }
1971            if let Some(_) = self.environ {
1972                return 5;
1973            }
1974            if let Some(_) = self.argv {
1975                return 4;
1976            }
1977            if let Some(_) = self.binary_path {
1978                return 3;
1979            }
1980            if let Some(_) = self.console_out {
1981                return 2;
1982            }
1983            if let Some(_) = self.console_in {
1984                return 1;
1985            }
1986            0
1987        }
1988    }
1989
1990    impl fidl::encoding::ResourceTypeMarker for ControllerSpawnConsoleRequest {
1991        type Borrowed<'a> = &'a mut Self;
1992        fn take_or_borrow<'a>(
1993            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1994        ) -> Self::Borrowed<'a> {
1995            value
1996        }
1997    }
1998
1999    unsafe impl fidl::encoding::TypeMarker for ControllerSpawnConsoleRequest {
2000        type Owned = Self;
2001
2002        #[inline(always)]
2003        fn inline_align(_context: fidl::encoding::Context) -> usize {
2004            8
2005        }
2006
2007        #[inline(always)]
2008        fn inline_size(_context: fidl::encoding::Context) -> usize {
2009            16
2010        }
2011    }
2012
2013    unsafe impl
2014        fidl::encoding::Encode<
2015            ControllerSpawnConsoleRequest,
2016            fidl::encoding::DefaultFuchsiaResourceDialect,
2017        > for &mut ControllerSpawnConsoleRequest
2018    {
2019        unsafe fn encode(
2020            self,
2021            encoder: &mut fidl::encoding::Encoder<
2022                '_,
2023                fidl::encoding::DefaultFuchsiaResourceDialect,
2024            >,
2025            offset: usize,
2026            mut depth: fidl::encoding::Depth,
2027        ) -> fidl::Result<()> {
2028            encoder.debug_check_bounds::<ControllerSpawnConsoleRequest>(offset);
2029            // Vector header
2030            let max_ordinal: u64 = self.max_ordinal_present();
2031            encoder.write_num(max_ordinal, offset);
2032            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2033            // Calling encoder.out_of_line_offset(0) is not allowed.
2034            if max_ordinal == 0 {
2035                return Ok(());
2036            }
2037            depth.increment()?;
2038            let envelope_size = 8;
2039            let bytes_len = max_ordinal as usize * envelope_size;
2040            #[allow(unused_variables)]
2041            let offset = encoder.out_of_line_offset(bytes_len);
2042            let mut _prev_end_offset: usize = 0;
2043            if 1 > max_ordinal {
2044                return Ok(());
2045            }
2046
2047            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2048            // are envelope_size bytes.
2049            let cur_offset: usize = (1 - 1) * envelope_size;
2050
2051            // Zero reserved fields.
2052            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2053
2054            // Safety:
2055            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2056            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2057            //   envelope_size bytes, there is always sufficient room.
2058            fidl::encoding::encode_in_envelope_optional::<
2059                fidl::encoding::HandleType<
2060                    fidl::Socket,
2061                    { fidl::ObjectType::SOCKET.into_raw() },
2062                    2147483648,
2063                >,
2064                fidl::encoding::DefaultFuchsiaResourceDialect,
2065            >(
2066                self.console_in.as_mut().map(
2067                    <fidl::encoding::HandleType<
2068                        fidl::Socket,
2069                        { fidl::ObjectType::SOCKET.into_raw() },
2070                        2147483648,
2071                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2072                ),
2073                encoder,
2074                offset + cur_offset,
2075                depth,
2076            )?;
2077
2078            _prev_end_offset = cur_offset + envelope_size;
2079            if 2 > max_ordinal {
2080                return Ok(());
2081            }
2082
2083            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2084            // are envelope_size bytes.
2085            let cur_offset: usize = (2 - 1) * envelope_size;
2086
2087            // Zero reserved fields.
2088            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2089
2090            // Safety:
2091            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2092            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2093            //   envelope_size bytes, there is always sufficient room.
2094            fidl::encoding::encode_in_envelope_optional::<
2095                fidl::encoding::HandleType<
2096                    fidl::Socket,
2097                    { fidl::ObjectType::SOCKET.into_raw() },
2098                    2147483648,
2099                >,
2100                fidl::encoding::DefaultFuchsiaResourceDialect,
2101            >(
2102                self.console_out.as_mut().map(
2103                    <fidl::encoding::HandleType<
2104                        fidl::Socket,
2105                        { fidl::ObjectType::SOCKET.into_raw() },
2106                        2147483648,
2107                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2108                ),
2109                encoder,
2110                offset + cur_offset,
2111                depth,
2112            )?;
2113
2114            _prev_end_offset = cur_offset + envelope_size;
2115            if 3 > max_ordinal {
2116                return Ok(());
2117            }
2118
2119            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2120            // are envelope_size bytes.
2121            let cur_offset: usize = (3 - 1) * envelope_size;
2122
2123            // Zero reserved fields.
2124            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2125
2126            // Safety:
2127            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2128            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2129            //   envelope_size bytes, there is always sufficient room.
2130            fidl::encoding::encode_in_envelope_optional::<
2131                fidl::encoding::UnboundedString,
2132                fidl::encoding::DefaultFuchsiaResourceDialect,
2133            >(
2134                self.binary_path.as_ref().map(
2135                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
2136                ),
2137                encoder,
2138                offset + cur_offset,
2139                depth,
2140            )?;
2141
2142            _prev_end_offset = cur_offset + envelope_size;
2143            if 4 > max_ordinal {
2144                return Ok(());
2145            }
2146
2147            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2148            // are envelope_size bytes.
2149            let cur_offset: usize = (4 - 1) * envelope_size;
2150
2151            // Zero reserved fields.
2152            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2153
2154            // Safety:
2155            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2156            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2157            //   envelope_size bytes, there is always sufficient room.
2158            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2159            self.argv.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2160            encoder, offset + cur_offset, depth
2161        )?;
2162
2163            _prev_end_offset = cur_offset + envelope_size;
2164            if 5 > max_ordinal {
2165                return Ok(());
2166            }
2167
2168            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2169            // are envelope_size bytes.
2170            let cur_offset: usize = (5 - 1) * envelope_size;
2171
2172            // Zero reserved fields.
2173            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2174
2175            // Safety:
2176            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2177            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2178            //   envelope_size bytes, there is always sufficient room.
2179            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2180            self.environ.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2181            encoder, offset + cur_offset, depth
2182        )?;
2183
2184            _prev_end_offset = cur_offset + envelope_size;
2185            if 6 > max_ordinal {
2186                return Ok(());
2187            }
2188
2189            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2190            // are envelope_size bytes.
2191            let cur_offset: usize = (6 - 1) * envelope_size;
2192
2193            // Zero reserved fields.
2194            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2195
2196            // Safety:
2197            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2198            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2199            //   envelope_size bytes, there is always sufficient room.
2200            fidl::encoding::encode_in_envelope_optional::<
2201                ConsoleWindowSize,
2202                fidl::encoding::DefaultFuchsiaResourceDialect,
2203            >(
2204                self.window_size
2205                    .as_ref()
2206                    .map(<ConsoleWindowSize as fidl::encoding::ValueTypeMarker>::borrow),
2207                encoder,
2208                offset + cur_offset,
2209                depth,
2210            )?;
2211
2212            _prev_end_offset = cur_offset + envelope_size;
2213
2214            Ok(())
2215        }
2216    }
2217
2218    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2219        for ControllerSpawnConsoleRequest
2220    {
2221        #[inline(always)]
2222        fn new_empty() -> Self {
2223            Self::default()
2224        }
2225
2226        unsafe fn decode(
2227            &mut self,
2228            decoder: &mut fidl::encoding::Decoder<
2229                '_,
2230                fidl::encoding::DefaultFuchsiaResourceDialect,
2231            >,
2232            offset: usize,
2233            mut depth: fidl::encoding::Depth,
2234        ) -> fidl::Result<()> {
2235            decoder.debug_check_bounds::<Self>(offset);
2236            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2237                None => return Err(fidl::Error::NotNullable),
2238                Some(len) => len,
2239            };
2240            // Calling decoder.out_of_line_offset(0) is not allowed.
2241            if len == 0 {
2242                return Ok(());
2243            };
2244            depth.increment()?;
2245            let envelope_size = 8;
2246            let bytes_len = len * envelope_size;
2247            let offset = decoder.out_of_line_offset(bytes_len)?;
2248            // Decode the envelope for each type.
2249            let mut _next_ordinal_to_read = 0;
2250            let mut next_offset = offset;
2251            let end_offset = offset + bytes_len;
2252            _next_ordinal_to_read += 1;
2253            if next_offset >= end_offset {
2254                return Ok(());
2255            }
2256
2257            // Decode unknown envelopes for gaps in ordinals.
2258            while _next_ordinal_to_read < 1 {
2259                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2260                _next_ordinal_to_read += 1;
2261                next_offset += envelope_size;
2262            }
2263
2264            let next_out_of_line = decoder.next_out_of_line();
2265            let handles_before = decoder.remaining_handles();
2266            if let Some((inlined, num_bytes, num_handles)) =
2267                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2268            {
2269                let member_inline_size = <fidl::encoding::HandleType<
2270                    fidl::Socket,
2271                    { fidl::ObjectType::SOCKET.into_raw() },
2272                    2147483648,
2273                > as fidl::encoding::TypeMarker>::inline_size(
2274                    decoder.context
2275                );
2276                if inlined != (member_inline_size <= 4) {
2277                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2278                }
2279                let inner_offset;
2280                let mut inner_depth = depth.clone();
2281                if inlined {
2282                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2283                    inner_offset = next_offset;
2284                } else {
2285                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2286                    inner_depth.increment()?;
2287                }
2288                let val_ref =
2289                self.console_in.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2290                fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2291                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2292                {
2293                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2294                }
2295                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2296                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2297                }
2298            }
2299
2300            next_offset += envelope_size;
2301            _next_ordinal_to_read += 1;
2302            if next_offset >= end_offset {
2303                return Ok(());
2304            }
2305
2306            // Decode unknown envelopes for gaps in ordinals.
2307            while _next_ordinal_to_read < 2 {
2308                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2309                _next_ordinal_to_read += 1;
2310                next_offset += envelope_size;
2311            }
2312
2313            let next_out_of_line = decoder.next_out_of_line();
2314            let handles_before = decoder.remaining_handles();
2315            if let Some((inlined, num_bytes, num_handles)) =
2316                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2317            {
2318                let member_inline_size = <fidl::encoding::HandleType<
2319                    fidl::Socket,
2320                    { fidl::ObjectType::SOCKET.into_raw() },
2321                    2147483648,
2322                > as fidl::encoding::TypeMarker>::inline_size(
2323                    decoder.context
2324                );
2325                if inlined != (member_inline_size <= 4) {
2326                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2327                }
2328                let inner_offset;
2329                let mut inner_depth = depth.clone();
2330                if inlined {
2331                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2332                    inner_offset = next_offset;
2333                } else {
2334                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2335                    inner_depth.increment()?;
2336                }
2337                let val_ref =
2338                self.console_out.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2339                fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2340                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2341                {
2342                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2343                }
2344                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2345                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2346                }
2347            }
2348
2349            next_offset += envelope_size;
2350            _next_ordinal_to_read += 1;
2351            if next_offset >= end_offset {
2352                return Ok(());
2353            }
2354
2355            // Decode unknown envelopes for gaps in ordinals.
2356            while _next_ordinal_to_read < 3 {
2357                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2358                _next_ordinal_to_read += 1;
2359                next_offset += envelope_size;
2360            }
2361
2362            let next_out_of_line = decoder.next_out_of_line();
2363            let handles_before = decoder.remaining_handles();
2364            if let Some((inlined, num_bytes, num_handles)) =
2365                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2366            {
2367                let member_inline_size =
2368                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
2369                        decoder.context,
2370                    );
2371                if inlined != (member_inline_size <= 4) {
2372                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2373                }
2374                let inner_offset;
2375                let mut inner_depth = depth.clone();
2376                if inlined {
2377                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2378                    inner_offset = next_offset;
2379                } else {
2380                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2381                    inner_depth.increment()?;
2382                }
2383                let val_ref = self.binary_path.get_or_insert_with(|| {
2384                    fidl::new_empty!(
2385                        fidl::encoding::UnboundedString,
2386                        fidl::encoding::DefaultFuchsiaResourceDialect
2387                    )
2388                });
2389                fidl::decode!(
2390                    fidl::encoding::UnboundedString,
2391                    fidl::encoding::DefaultFuchsiaResourceDialect,
2392                    val_ref,
2393                    decoder,
2394                    inner_offset,
2395                    inner_depth
2396                )?;
2397                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2398                {
2399                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2400                }
2401                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2402                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2403                }
2404            }
2405
2406            next_offset += envelope_size;
2407            _next_ordinal_to_read += 1;
2408            if next_offset >= end_offset {
2409                return Ok(());
2410            }
2411
2412            // Decode unknown envelopes for gaps in ordinals.
2413            while _next_ordinal_to_read < 4 {
2414                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2415                _next_ordinal_to_read += 1;
2416                next_offset += envelope_size;
2417            }
2418
2419            let next_out_of_line = decoder.next_out_of_line();
2420            let handles_before = decoder.remaining_handles();
2421            if let Some((inlined, num_bytes, num_handles)) =
2422                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2423            {
2424                let member_inline_size = <fidl::encoding::UnboundedVector<
2425                    fidl::encoding::UnboundedString,
2426                > as fidl::encoding::TypeMarker>::inline_size(
2427                    decoder.context
2428                );
2429                if inlined != (member_inline_size <= 4) {
2430                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2431                }
2432                let inner_offset;
2433                let mut inner_depth = depth.clone();
2434                if inlined {
2435                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2436                    inner_offset = next_offset;
2437                } else {
2438                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2439                    inner_depth.increment()?;
2440                }
2441                let val_ref = self.argv.get_or_insert_with(|| {
2442                    fidl::new_empty!(
2443                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2444                        fidl::encoding::DefaultFuchsiaResourceDialect
2445                    )
2446                });
2447                fidl::decode!(
2448                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2449                    fidl::encoding::DefaultFuchsiaResourceDialect,
2450                    val_ref,
2451                    decoder,
2452                    inner_offset,
2453                    inner_depth
2454                )?;
2455                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2456                {
2457                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2458                }
2459                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2460                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2461                }
2462            }
2463
2464            next_offset += envelope_size;
2465            _next_ordinal_to_read += 1;
2466            if next_offset >= end_offset {
2467                return Ok(());
2468            }
2469
2470            // Decode unknown envelopes for gaps in ordinals.
2471            while _next_ordinal_to_read < 5 {
2472                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2473                _next_ordinal_to_read += 1;
2474                next_offset += envelope_size;
2475            }
2476
2477            let next_out_of_line = decoder.next_out_of_line();
2478            let handles_before = decoder.remaining_handles();
2479            if let Some((inlined, num_bytes, num_handles)) =
2480                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2481            {
2482                let member_inline_size = <fidl::encoding::UnboundedVector<
2483                    fidl::encoding::UnboundedString,
2484                > as fidl::encoding::TypeMarker>::inline_size(
2485                    decoder.context
2486                );
2487                if inlined != (member_inline_size <= 4) {
2488                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2489                }
2490                let inner_offset;
2491                let mut inner_depth = depth.clone();
2492                if inlined {
2493                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2494                    inner_offset = next_offset;
2495                } else {
2496                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2497                    inner_depth.increment()?;
2498                }
2499                let val_ref = self.environ.get_or_insert_with(|| {
2500                    fidl::new_empty!(
2501                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2502                        fidl::encoding::DefaultFuchsiaResourceDialect
2503                    )
2504                });
2505                fidl::decode!(
2506                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
2507                    fidl::encoding::DefaultFuchsiaResourceDialect,
2508                    val_ref,
2509                    decoder,
2510                    inner_offset,
2511                    inner_depth
2512                )?;
2513                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2514                {
2515                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2516                }
2517                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2518                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2519                }
2520            }
2521
2522            next_offset += envelope_size;
2523            _next_ordinal_to_read += 1;
2524            if next_offset >= end_offset {
2525                return Ok(());
2526            }
2527
2528            // Decode unknown envelopes for gaps in ordinals.
2529            while _next_ordinal_to_read < 6 {
2530                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2531                _next_ordinal_to_read += 1;
2532                next_offset += envelope_size;
2533            }
2534
2535            let next_out_of_line = decoder.next_out_of_line();
2536            let handles_before = decoder.remaining_handles();
2537            if let Some((inlined, num_bytes, num_handles)) =
2538                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2539            {
2540                let member_inline_size =
2541                    <ConsoleWindowSize as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2542                if inlined != (member_inline_size <= 4) {
2543                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2544                }
2545                let inner_offset;
2546                let mut inner_depth = depth.clone();
2547                if inlined {
2548                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2549                    inner_offset = next_offset;
2550                } else {
2551                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2552                    inner_depth.increment()?;
2553                }
2554                let val_ref = self.window_size.get_or_insert_with(|| {
2555                    fidl::new_empty!(
2556                        ConsoleWindowSize,
2557                        fidl::encoding::DefaultFuchsiaResourceDialect
2558                    )
2559                });
2560                fidl::decode!(
2561                    ConsoleWindowSize,
2562                    fidl::encoding::DefaultFuchsiaResourceDialect,
2563                    val_ref,
2564                    decoder,
2565                    inner_offset,
2566                    inner_depth
2567                )?;
2568                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2569                {
2570                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2571                }
2572                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2573                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2574                }
2575            }
2576
2577            next_offset += envelope_size;
2578
2579            // Decode the remaining unknown envelopes.
2580            while next_offset < end_offset {
2581                _next_ordinal_to_read += 1;
2582                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2583                next_offset += envelope_size;
2584            }
2585
2586            Ok(())
2587        }
2588    }
2589
2590    impl ControllerVsockConnectRequest {
2591        #[inline(always)]
2592        fn max_ordinal_present(&self) -> u64 {
2593            if let Some(_) = self.bridge_socket {
2594                return 2;
2595            }
2596            if let Some(_) = self.port {
2597                return 1;
2598            }
2599            0
2600        }
2601    }
2602
2603    impl fidl::encoding::ResourceTypeMarker for ControllerVsockConnectRequest {
2604        type Borrowed<'a> = &'a mut Self;
2605        fn take_or_borrow<'a>(
2606            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2607        ) -> Self::Borrowed<'a> {
2608            value
2609        }
2610    }
2611
2612    unsafe impl fidl::encoding::TypeMarker for ControllerVsockConnectRequest {
2613        type Owned = Self;
2614
2615        #[inline(always)]
2616        fn inline_align(_context: fidl::encoding::Context) -> usize {
2617            8
2618        }
2619
2620        #[inline(always)]
2621        fn inline_size(_context: fidl::encoding::Context) -> usize {
2622            16
2623        }
2624    }
2625
2626    unsafe impl
2627        fidl::encoding::Encode<
2628            ControllerVsockConnectRequest,
2629            fidl::encoding::DefaultFuchsiaResourceDialect,
2630        > for &mut ControllerVsockConnectRequest
2631    {
2632        unsafe fn encode(
2633            self,
2634            encoder: &mut fidl::encoding::Encoder<
2635                '_,
2636                fidl::encoding::DefaultFuchsiaResourceDialect,
2637            >,
2638            offset: usize,
2639            mut depth: fidl::encoding::Depth,
2640        ) -> fidl::Result<()> {
2641            encoder.debug_check_bounds::<ControllerVsockConnectRequest>(offset);
2642            // Vector header
2643            let max_ordinal: u64 = self.max_ordinal_present();
2644            encoder.write_num(max_ordinal, offset);
2645            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2646            // Calling encoder.out_of_line_offset(0) is not allowed.
2647            if max_ordinal == 0 {
2648                return Ok(());
2649            }
2650            depth.increment()?;
2651            let envelope_size = 8;
2652            let bytes_len = max_ordinal as usize * envelope_size;
2653            #[allow(unused_variables)]
2654            let offset = encoder.out_of_line_offset(bytes_len);
2655            let mut _prev_end_offset: usize = 0;
2656            if 1 > max_ordinal {
2657                return Ok(());
2658            }
2659
2660            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2661            // are envelope_size bytes.
2662            let cur_offset: usize = (1 - 1) * envelope_size;
2663
2664            // Zero reserved fields.
2665            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2666
2667            // Safety:
2668            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2669            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2670            //   envelope_size bytes, there is always sufficient room.
2671            fidl::encoding::encode_in_envelope_optional::<
2672                u32,
2673                fidl::encoding::DefaultFuchsiaResourceDialect,
2674            >(
2675                self.port.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2676                encoder,
2677                offset + cur_offset,
2678                depth,
2679            )?;
2680
2681            _prev_end_offset = cur_offset + envelope_size;
2682            if 2 > max_ordinal {
2683                return Ok(());
2684            }
2685
2686            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2687            // are envelope_size bytes.
2688            let cur_offset: usize = (2 - 1) * envelope_size;
2689
2690            // Zero reserved fields.
2691            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2692
2693            // Safety:
2694            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2695            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2696            //   envelope_size bytes, there is always sufficient room.
2697            fidl::encoding::encode_in_envelope_optional::<
2698                fidl::encoding::HandleType<
2699                    fidl::Socket,
2700                    { fidl::ObjectType::SOCKET.into_raw() },
2701                    2147483648,
2702                >,
2703                fidl::encoding::DefaultFuchsiaResourceDialect,
2704            >(
2705                self.bridge_socket.as_mut().map(
2706                    <fidl::encoding::HandleType<
2707                        fidl::Socket,
2708                        { fidl::ObjectType::SOCKET.into_raw() },
2709                        2147483648,
2710                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2711                ),
2712                encoder,
2713                offset + cur_offset,
2714                depth,
2715            )?;
2716
2717            _prev_end_offset = cur_offset + envelope_size;
2718
2719            Ok(())
2720        }
2721    }
2722
2723    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2724        for ControllerVsockConnectRequest
2725    {
2726        #[inline(always)]
2727        fn new_empty() -> Self {
2728            Self::default()
2729        }
2730
2731        unsafe fn decode(
2732            &mut self,
2733            decoder: &mut fidl::encoding::Decoder<
2734                '_,
2735                fidl::encoding::DefaultFuchsiaResourceDialect,
2736            >,
2737            offset: usize,
2738            mut depth: fidl::encoding::Depth,
2739        ) -> fidl::Result<()> {
2740            decoder.debug_check_bounds::<Self>(offset);
2741            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2742                None => return Err(fidl::Error::NotNullable),
2743                Some(len) => len,
2744            };
2745            // Calling decoder.out_of_line_offset(0) is not allowed.
2746            if len == 0 {
2747                return Ok(());
2748            };
2749            depth.increment()?;
2750            let envelope_size = 8;
2751            let bytes_len = len * envelope_size;
2752            let offset = decoder.out_of_line_offset(bytes_len)?;
2753            // Decode the envelope for each type.
2754            let mut _next_ordinal_to_read = 0;
2755            let mut next_offset = offset;
2756            let end_offset = offset + bytes_len;
2757            _next_ordinal_to_read += 1;
2758            if next_offset >= end_offset {
2759                return Ok(());
2760            }
2761
2762            // Decode unknown envelopes for gaps in ordinals.
2763            while _next_ordinal_to_read < 1 {
2764                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2765                _next_ordinal_to_read += 1;
2766                next_offset += envelope_size;
2767            }
2768
2769            let next_out_of_line = decoder.next_out_of_line();
2770            let handles_before = decoder.remaining_handles();
2771            if let Some((inlined, num_bytes, num_handles)) =
2772                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2773            {
2774                let member_inline_size =
2775                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2776                if inlined != (member_inline_size <= 4) {
2777                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2778                }
2779                let inner_offset;
2780                let mut inner_depth = depth.clone();
2781                if inlined {
2782                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2783                    inner_offset = next_offset;
2784                } else {
2785                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2786                    inner_depth.increment()?;
2787                }
2788                let val_ref = self.port.get_or_insert_with(|| {
2789                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2790                });
2791                fidl::decode!(
2792                    u32,
2793                    fidl::encoding::DefaultFuchsiaResourceDialect,
2794                    val_ref,
2795                    decoder,
2796                    inner_offset,
2797                    inner_depth
2798                )?;
2799                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2800                {
2801                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2802                }
2803                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2804                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2805                }
2806            }
2807
2808            next_offset += envelope_size;
2809            _next_ordinal_to_read += 1;
2810            if next_offset >= end_offset {
2811                return Ok(());
2812            }
2813
2814            // Decode unknown envelopes for gaps in ordinals.
2815            while _next_ordinal_to_read < 2 {
2816                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2817                _next_ordinal_to_read += 1;
2818                next_offset += envelope_size;
2819            }
2820
2821            let next_out_of_line = decoder.next_out_of_line();
2822            let handles_before = decoder.remaining_handles();
2823            if let Some((inlined, num_bytes, num_handles)) =
2824                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2825            {
2826                let member_inline_size = <fidl::encoding::HandleType<
2827                    fidl::Socket,
2828                    { fidl::ObjectType::SOCKET.into_raw() },
2829                    2147483648,
2830                > as fidl::encoding::TypeMarker>::inline_size(
2831                    decoder.context
2832                );
2833                if inlined != (member_inline_size <= 4) {
2834                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2835                }
2836                let inner_offset;
2837                let mut inner_depth = depth.clone();
2838                if inlined {
2839                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2840                    inner_offset = next_offset;
2841                } else {
2842                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2843                    inner_depth.increment()?;
2844                }
2845                let val_ref =
2846                self.bridge_socket.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2847                fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2848                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2849                {
2850                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2851                }
2852                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2853                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2854                }
2855            }
2856
2857            next_offset += envelope_size;
2858
2859            // Decode the remaining unknown envelopes.
2860            while next_offset < end_offset {
2861                _next_ordinal_to_read += 1;
2862                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2863                next_offset += envelope_size;
2864            }
2865
2866            Ok(())
2867        }
2868    }
2869
2870    impl ControllerGetJobHandleResponse {
2871        #[inline(always)]
2872        fn max_ordinal_present(&self) -> u64 {
2873            if let Some(_) = self.job {
2874                return 1;
2875            }
2876            0
2877        }
2878    }
2879
2880    impl fidl::encoding::ResourceTypeMarker for ControllerGetJobHandleResponse {
2881        type Borrowed<'a> = &'a mut Self;
2882        fn take_or_borrow<'a>(
2883            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2884        ) -> Self::Borrowed<'a> {
2885            value
2886        }
2887    }
2888
2889    unsafe impl fidl::encoding::TypeMarker for ControllerGetJobHandleResponse {
2890        type Owned = Self;
2891
2892        #[inline(always)]
2893        fn inline_align(_context: fidl::encoding::Context) -> usize {
2894            8
2895        }
2896
2897        #[inline(always)]
2898        fn inline_size(_context: fidl::encoding::Context) -> usize {
2899            16
2900        }
2901    }
2902
2903    unsafe impl
2904        fidl::encoding::Encode<
2905            ControllerGetJobHandleResponse,
2906            fidl::encoding::DefaultFuchsiaResourceDialect,
2907        > for &mut ControllerGetJobHandleResponse
2908    {
2909        unsafe fn encode(
2910            self,
2911            encoder: &mut fidl::encoding::Encoder<
2912                '_,
2913                fidl::encoding::DefaultFuchsiaResourceDialect,
2914            >,
2915            offset: usize,
2916            mut depth: fidl::encoding::Depth,
2917        ) -> fidl::Result<()> {
2918            encoder.debug_check_bounds::<ControllerGetJobHandleResponse>(offset);
2919            // Vector header
2920            let max_ordinal: u64 = self.max_ordinal_present();
2921            encoder.write_num(max_ordinal, offset);
2922            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2923            // Calling encoder.out_of_line_offset(0) is not allowed.
2924            if max_ordinal == 0 {
2925                return Ok(());
2926            }
2927            depth.increment()?;
2928            let envelope_size = 8;
2929            let bytes_len = max_ordinal as usize * envelope_size;
2930            #[allow(unused_variables)]
2931            let offset = encoder.out_of_line_offset(bytes_len);
2932            let mut _prev_end_offset: usize = 0;
2933            if 1 > max_ordinal {
2934                return Ok(());
2935            }
2936
2937            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2938            // are envelope_size bytes.
2939            let cur_offset: usize = (1 - 1) * envelope_size;
2940
2941            // Zero reserved fields.
2942            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2943
2944            // Safety:
2945            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2946            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2947            //   envelope_size bytes, there is always sufficient room.
2948            fidl::encoding::encode_in_envelope_optional::<
2949                fidl::encoding::HandleType<
2950                    fidl::Job,
2951                    { fidl::ObjectType::JOB.into_raw() },
2952                    2147483648,
2953                >,
2954                fidl::encoding::DefaultFuchsiaResourceDialect,
2955            >(
2956                self.job.as_mut().map(
2957                    <fidl::encoding::HandleType<
2958                        fidl::Job,
2959                        { fidl::ObjectType::JOB.into_raw() },
2960                        2147483648,
2961                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2962                ),
2963                encoder,
2964                offset + cur_offset,
2965                depth,
2966            )?;
2967
2968            _prev_end_offset = cur_offset + envelope_size;
2969
2970            Ok(())
2971        }
2972    }
2973
2974    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2975        for ControllerGetJobHandleResponse
2976    {
2977        #[inline(always)]
2978        fn new_empty() -> Self {
2979            Self::default()
2980        }
2981
2982        unsafe fn decode(
2983            &mut self,
2984            decoder: &mut fidl::encoding::Decoder<
2985                '_,
2986                fidl::encoding::DefaultFuchsiaResourceDialect,
2987            >,
2988            offset: usize,
2989            mut depth: fidl::encoding::Depth,
2990        ) -> fidl::Result<()> {
2991            decoder.debug_check_bounds::<Self>(offset);
2992            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2993                None => return Err(fidl::Error::NotNullable),
2994                Some(len) => len,
2995            };
2996            // Calling decoder.out_of_line_offset(0) is not allowed.
2997            if len == 0 {
2998                return Ok(());
2999            };
3000            depth.increment()?;
3001            let envelope_size = 8;
3002            let bytes_len = len * envelope_size;
3003            let offset = decoder.out_of_line_offset(bytes_len)?;
3004            // Decode the envelope for each type.
3005            let mut _next_ordinal_to_read = 0;
3006            let mut next_offset = offset;
3007            let end_offset = offset + bytes_len;
3008            _next_ordinal_to_read += 1;
3009            if next_offset >= end_offset {
3010                return Ok(());
3011            }
3012
3013            // Decode unknown envelopes for gaps in ordinals.
3014            while _next_ordinal_to_read < 1 {
3015                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3016                _next_ordinal_to_read += 1;
3017                next_offset += envelope_size;
3018            }
3019
3020            let next_out_of_line = decoder.next_out_of_line();
3021            let handles_before = decoder.remaining_handles();
3022            if let Some((inlined, num_bytes, num_handles)) =
3023                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3024            {
3025                let member_inline_size = <fidl::encoding::HandleType<
3026                    fidl::Job,
3027                    { fidl::ObjectType::JOB.into_raw() },
3028                    2147483648,
3029                > as fidl::encoding::TypeMarker>::inline_size(
3030                    decoder.context
3031                );
3032                if inlined != (member_inline_size <= 4) {
3033                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3034                }
3035                let inner_offset;
3036                let mut inner_depth = depth.clone();
3037                if inlined {
3038                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3039                    inner_offset = next_offset;
3040                } else {
3041                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3042                    inner_depth.increment()?;
3043                }
3044                let val_ref =
3045                self.job.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3046                fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3047                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3048                {
3049                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3050                }
3051                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3052                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3053                }
3054            }
3055
3056            next_offset += envelope_size;
3057
3058            // Decode the remaining unknown envelopes.
3059            while next_offset < end_offset {
3060                _next_ordinal_to_read += 1;
3061                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3062                next_offset += envelope_size;
3063            }
3064
3065            Ok(())
3066        }
3067    }
3068}