Skip to main content

fidl_fuchsia_component_internal/
fidl_fuchsia_component_internal.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_component_internal_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ChildInput {
16    pub child_name: String,
17    pub child_input: fidl::EventPair,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ChildInput {}
21
22/// A component's sandbox, which holds all of the capabilities that a component
23/// has access to, can provide to the system, and makes available to its
24/// children.
25#[derive(Debug, Default, PartialEq)]
26pub struct ComponentSandbox {
27    pub component_input: Option<fidl::EventPair>,
28    pub component_output: Option<fidl::EventPair>,
29    pub program_input: Option<fidl::EventPair>,
30    pub program_output: Option<fidl::EventPair>,
31    pub reserved: Option<fidl::EventPair>,
32    pub capability_sourced: Option<fidl::EventPair>,
33    pub declared_dictionaries: Option<fidl::EventPair>,
34    pub child_inputs: Option<Vec<ChildInput>>,
35    pub collection_inputs: Option<Vec<ChildInput>>,
36    #[doc(hidden)]
37    pub __source_breaking: fidl::marker::SourceBreaking,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ComponentSandbox {}
41
42#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
43pub struct ComponentSandboxRetrieverMarker;
44
45impl fidl::endpoints::ProtocolMarker for ComponentSandboxRetrieverMarker {
46    type Proxy = ComponentSandboxRetrieverProxy;
47    type RequestStream = ComponentSandboxRetrieverRequestStream;
48    #[cfg(target_os = "fuchsia")]
49    type SynchronousProxy = ComponentSandboxRetrieverSynchronousProxy;
50
51    const DEBUG_NAME: &'static str = "fuchsia.component.internal.ComponentSandboxRetriever";
52}
53impl fidl::endpoints::DiscoverableProtocolMarker for ComponentSandboxRetrieverMarker {}
54
55pub trait ComponentSandboxRetrieverProxyInterface: Send + Sync {
56    type GetMySandboxResponseFut: std::future::Future<Output = Result<ComponentSandbox, fidl::Error>>
57        + Send;
58    fn r#get_my_sandbox(&self) -> Self::GetMySandboxResponseFut;
59}
60#[derive(Debug)]
61#[cfg(target_os = "fuchsia")]
62pub struct ComponentSandboxRetrieverSynchronousProxy {
63    client: fidl::client::sync::Client,
64}
65
66#[cfg(target_os = "fuchsia")]
67impl fidl::endpoints::SynchronousProxy for ComponentSandboxRetrieverSynchronousProxy {
68    type Proxy = ComponentSandboxRetrieverProxy;
69    type Protocol = ComponentSandboxRetrieverMarker;
70
71    fn from_channel(inner: fidl::Channel) -> Self {
72        Self::new(inner)
73    }
74
75    fn into_channel(self) -> fidl::Channel {
76        self.client.into_channel()
77    }
78
79    fn as_channel(&self) -> &fidl::Channel {
80        self.client.as_channel()
81    }
82}
83
84#[cfg(target_os = "fuchsia")]
85impl ComponentSandboxRetrieverSynchronousProxy {
86    pub fn new(channel: fidl::Channel) -> Self {
87        Self { client: fidl::client::sync::Client::new(channel) }
88    }
89
90    pub fn into_channel(self) -> fidl::Channel {
91        self.client.into_channel()
92    }
93
94    /// Waits until an event arrives and returns it. It is safe for other
95    /// threads to make concurrent requests while waiting for an event.
96    pub fn wait_for_event(
97        &self,
98        deadline: zx::MonotonicInstant,
99    ) -> Result<ComponentSandboxRetrieverEvent, fidl::Error> {
100        ComponentSandboxRetrieverEvent::decode(
101            self.client.wait_for_event::<ComponentSandboxRetrieverMarker>(deadline)?,
102        )
103    }
104
105    pub fn r#get_my_sandbox(
106        &self,
107        ___deadline: zx::MonotonicInstant,
108    ) -> Result<ComponentSandbox, fidl::Error> {
109        let _response = self.client.send_query::<
110            fidl::encoding::EmptyPayload,
111            fidl::encoding::FlexibleType<ComponentSandbox>,
112            ComponentSandboxRetrieverMarker,
113        >(
114            (),
115            0x61ca075fb9860e84,
116            fidl::encoding::DynamicFlags::FLEXIBLE,
117            ___deadline,
118        )?
119        .into_result::<ComponentSandboxRetrieverMarker>("get_my_sandbox")?;
120        Ok(_response)
121    }
122}
123
124#[cfg(target_os = "fuchsia")]
125impl From<ComponentSandboxRetrieverSynchronousProxy> for zx::NullableHandle {
126    fn from(value: ComponentSandboxRetrieverSynchronousProxy) -> Self {
127        value.into_channel().into()
128    }
129}
130
131#[cfg(target_os = "fuchsia")]
132impl From<fidl::Channel> for ComponentSandboxRetrieverSynchronousProxy {
133    fn from(value: fidl::Channel) -> Self {
134        Self::new(value)
135    }
136}
137
138#[cfg(target_os = "fuchsia")]
139impl fidl::endpoints::FromClient for ComponentSandboxRetrieverSynchronousProxy {
140    type Protocol = ComponentSandboxRetrieverMarker;
141
142    fn from_client(value: fidl::endpoints::ClientEnd<ComponentSandboxRetrieverMarker>) -> Self {
143        Self::new(value.into_channel())
144    }
145}
146
147#[derive(Debug, Clone)]
148pub struct ComponentSandboxRetrieverProxy {
149    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
150}
151
152impl fidl::endpoints::Proxy for ComponentSandboxRetrieverProxy {
153    type Protocol = ComponentSandboxRetrieverMarker;
154
155    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
156        Self::new(inner)
157    }
158
159    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
160        self.client.into_channel().map_err(|client| Self { client })
161    }
162
163    fn as_channel(&self) -> &::fidl::AsyncChannel {
164        self.client.as_channel()
165    }
166}
167
168impl ComponentSandboxRetrieverProxy {
169    /// Create a new Proxy for fuchsia.component.internal/ComponentSandboxRetriever.
170    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
171        let protocol_name =
172            <ComponentSandboxRetrieverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
173        Self { client: fidl::client::Client::new(channel, protocol_name) }
174    }
175
176    /// Get a Stream of events from the remote end of the protocol.
177    ///
178    /// # Panics
179    ///
180    /// Panics if the event stream was already taken.
181    pub fn take_event_stream(&self) -> ComponentSandboxRetrieverEventStream {
182        ComponentSandboxRetrieverEventStream { event_receiver: self.client.take_event_receiver() }
183    }
184
185    pub fn r#get_my_sandbox(
186        &self,
187    ) -> fidl::client::QueryResponseFut<
188        ComponentSandbox,
189        fidl::encoding::DefaultFuchsiaResourceDialect,
190    > {
191        ComponentSandboxRetrieverProxyInterface::r#get_my_sandbox(self)
192    }
193}
194
195impl ComponentSandboxRetrieverProxyInterface for ComponentSandboxRetrieverProxy {
196    type GetMySandboxResponseFut = fidl::client::QueryResponseFut<
197        ComponentSandbox,
198        fidl::encoding::DefaultFuchsiaResourceDialect,
199    >;
200    fn r#get_my_sandbox(&self) -> Self::GetMySandboxResponseFut {
201        fn _decode(
202            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
203        ) -> Result<ComponentSandbox, fidl::Error> {
204            let _response = fidl::client::decode_transaction_body::<
205                fidl::encoding::FlexibleType<ComponentSandbox>,
206                fidl::encoding::DefaultFuchsiaResourceDialect,
207                0x61ca075fb9860e84,
208            >(_buf?)?
209            .into_result::<ComponentSandboxRetrieverMarker>("get_my_sandbox")?;
210            Ok(_response)
211        }
212        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ComponentSandbox>(
213            (),
214            0x61ca075fb9860e84,
215            fidl::encoding::DynamicFlags::FLEXIBLE,
216            _decode,
217        )
218    }
219}
220
221pub struct ComponentSandboxRetrieverEventStream {
222    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
223}
224
225impl std::marker::Unpin for ComponentSandboxRetrieverEventStream {}
226
227impl futures::stream::FusedStream for ComponentSandboxRetrieverEventStream {
228    fn is_terminated(&self) -> bool {
229        self.event_receiver.is_terminated()
230    }
231}
232
233impl futures::Stream for ComponentSandboxRetrieverEventStream {
234    type Item = Result<ComponentSandboxRetrieverEvent, fidl::Error>;
235
236    fn poll_next(
237        mut self: std::pin::Pin<&mut Self>,
238        cx: &mut std::task::Context<'_>,
239    ) -> std::task::Poll<Option<Self::Item>> {
240        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
241            &mut self.event_receiver,
242            cx
243        )?) {
244            Some(buf) => std::task::Poll::Ready(Some(ComponentSandboxRetrieverEvent::decode(buf))),
245            None => std::task::Poll::Ready(None),
246        }
247    }
248}
249
250#[derive(Debug)]
251pub enum ComponentSandboxRetrieverEvent {
252    #[non_exhaustive]
253    _UnknownEvent {
254        /// Ordinal of the event that was sent.
255        ordinal: u64,
256    },
257}
258
259impl ComponentSandboxRetrieverEvent {
260    /// Decodes a message buffer as a [`ComponentSandboxRetrieverEvent`].
261    fn decode(
262        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
263    ) -> Result<ComponentSandboxRetrieverEvent, fidl::Error> {
264        let (bytes, _handles) = buf.split_mut();
265        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
266        debug_assert_eq!(tx_header.tx_id, 0);
267        match tx_header.ordinal {
268            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
269                Ok(ComponentSandboxRetrieverEvent::_UnknownEvent { ordinal: tx_header.ordinal })
270            }
271            _ => Err(fidl::Error::UnknownOrdinal {
272                ordinal: tx_header.ordinal,
273                protocol_name:
274                    <ComponentSandboxRetrieverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
275            }),
276        }
277    }
278}
279
280/// A Stream of incoming requests for fuchsia.component.internal/ComponentSandboxRetriever.
281pub struct ComponentSandboxRetrieverRequestStream {
282    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
283    is_terminated: bool,
284}
285
286impl std::marker::Unpin for ComponentSandboxRetrieverRequestStream {}
287
288impl futures::stream::FusedStream for ComponentSandboxRetrieverRequestStream {
289    fn is_terminated(&self) -> bool {
290        self.is_terminated
291    }
292}
293
294impl fidl::endpoints::RequestStream for ComponentSandboxRetrieverRequestStream {
295    type Protocol = ComponentSandboxRetrieverMarker;
296    type ControlHandle = ComponentSandboxRetrieverControlHandle;
297
298    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
299        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
300    }
301
302    fn control_handle(&self) -> Self::ControlHandle {
303        ComponentSandboxRetrieverControlHandle { inner: self.inner.clone() }
304    }
305
306    fn into_inner(
307        self,
308    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
309    {
310        (self.inner, self.is_terminated)
311    }
312
313    fn from_inner(
314        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
315        is_terminated: bool,
316    ) -> Self {
317        Self { inner, is_terminated }
318    }
319}
320
321impl futures::Stream for ComponentSandboxRetrieverRequestStream {
322    type Item = Result<ComponentSandboxRetrieverRequest, fidl::Error>;
323
324    fn poll_next(
325        mut self: std::pin::Pin<&mut Self>,
326        cx: &mut std::task::Context<'_>,
327    ) -> std::task::Poll<Option<Self::Item>> {
328        let this = &mut *self;
329        if this.inner.check_shutdown(cx) {
330            this.is_terminated = true;
331            return std::task::Poll::Ready(None);
332        }
333        if this.is_terminated {
334            panic!("polled ComponentSandboxRetrieverRequestStream after completion");
335        }
336        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
337            |bytes, handles| {
338                match this.inner.channel().read_etc(cx, bytes, handles) {
339                    std::task::Poll::Ready(Ok(())) => {}
340                    std::task::Poll::Pending => return std::task::Poll::Pending,
341                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
342                        this.is_terminated = true;
343                        return std::task::Poll::Ready(None);
344                    }
345                    std::task::Poll::Ready(Err(e)) => {
346                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
347                            e.into(),
348                        ))));
349                    }
350                }
351
352                // A message has been received from the channel
353                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
354
355                std::task::Poll::Ready(Some(match header.ordinal {
356                0x61ca075fb9860e84 => {
357                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
358                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
359                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
360                    let control_handle = ComponentSandboxRetrieverControlHandle {
361                        inner: this.inner.clone(),
362                    };
363                    Ok(ComponentSandboxRetrieverRequest::GetMySandbox {
364                        responder: ComponentSandboxRetrieverGetMySandboxResponder {
365                            control_handle: std::mem::ManuallyDrop::new(control_handle),
366                            tx_id: header.tx_id,
367                        },
368                    })
369                }
370                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
371                    Ok(ComponentSandboxRetrieverRequest::_UnknownMethod {
372                        ordinal: header.ordinal,
373                        control_handle: ComponentSandboxRetrieverControlHandle { inner: this.inner.clone() },
374                        method_type: fidl::MethodType::OneWay,
375                    })
376                }
377                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
378                    this.inner.send_framework_err(
379                        fidl::encoding::FrameworkErr::UnknownMethod,
380                        header.tx_id,
381                        header.ordinal,
382                        header.dynamic_flags(),
383                        (bytes, handles),
384                    )?;
385                    Ok(ComponentSandboxRetrieverRequest::_UnknownMethod {
386                        ordinal: header.ordinal,
387                        control_handle: ComponentSandboxRetrieverControlHandle { inner: this.inner.clone() },
388                        method_type: fidl::MethodType::TwoWay,
389                    })
390                }
391                _ => Err(fidl::Error::UnknownOrdinal {
392                    ordinal: header.ordinal,
393                    protocol_name: <ComponentSandboxRetrieverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
394                }),
395            }))
396            },
397        )
398    }
399}
400
401#[derive(Debug)]
402pub enum ComponentSandboxRetrieverRequest {
403    GetMySandbox {
404        responder: ComponentSandboxRetrieverGetMySandboxResponder,
405    },
406    /// An interaction was received which does not match any known method.
407    #[non_exhaustive]
408    _UnknownMethod {
409        /// Ordinal of the method that was called.
410        ordinal: u64,
411        control_handle: ComponentSandboxRetrieverControlHandle,
412        method_type: fidl::MethodType,
413    },
414}
415
416impl ComponentSandboxRetrieverRequest {
417    #[allow(irrefutable_let_patterns)]
418    pub fn into_get_my_sandbox(self) -> Option<(ComponentSandboxRetrieverGetMySandboxResponder)> {
419        if let ComponentSandboxRetrieverRequest::GetMySandbox { responder } = self {
420            Some((responder))
421        } else {
422            None
423        }
424    }
425
426    /// Name of the method defined in FIDL
427    pub fn method_name(&self) -> &'static str {
428        match *self {
429            ComponentSandboxRetrieverRequest::GetMySandbox { .. } => "get_my_sandbox",
430            ComponentSandboxRetrieverRequest::_UnknownMethod {
431                method_type: fidl::MethodType::OneWay,
432                ..
433            } => "unknown one-way method",
434            ComponentSandboxRetrieverRequest::_UnknownMethod {
435                method_type: fidl::MethodType::TwoWay,
436                ..
437            } => "unknown two-way method",
438        }
439    }
440}
441
442#[derive(Debug, Clone)]
443pub struct ComponentSandboxRetrieverControlHandle {
444    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
445}
446
447impl ComponentSandboxRetrieverControlHandle {
448    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
449        self.inner.shutdown_with_epitaph(status.into())
450    }
451}
452
453impl fidl::endpoints::ControlHandle for ComponentSandboxRetrieverControlHandle {
454    fn shutdown(&self) {
455        self.inner.shutdown()
456    }
457
458    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
459        self.inner.shutdown_with_epitaph(status)
460    }
461
462    fn is_closed(&self) -> bool {
463        self.inner.channel().is_closed()
464    }
465    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
466        self.inner.channel().on_closed()
467    }
468
469    #[cfg(target_os = "fuchsia")]
470    fn signal_peer(
471        &self,
472        clear_mask: zx::Signals,
473        set_mask: zx::Signals,
474    ) -> Result<(), zx_status::Status> {
475        use fidl::Peered;
476        self.inner.channel().signal_peer(clear_mask, set_mask)
477    }
478}
479
480impl ComponentSandboxRetrieverControlHandle {}
481
482#[must_use = "FIDL methods require a response to be sent"]
483#[derive(Debug)]
484pub struct ComponentSandboxRetrieverGetMySandboxResponder {
485    control_handle: std::mem::ManuallyDrop<ComponentSandboxRetrieverControlHandle>,
486    tx_id: u32,
487}
488
489/// Set the the channel to be shutdown (see [`ComponentSandboxRetrieverControlHandle::shutdown`])
490/// if the responder is dropped without sending a response, so that the client
491/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
492impl std::ops::Drop for ComponentSandboxRetrieverGetMySandboxResponder {
493    fn drop(&mut self) {
494        self.control_handle.shutdown();
495        // Safety: drops once, never accessed again
496        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
497    }
498}
499
500impl fidl::endpoints::Responder for ComponentSandboxRetrieverGetMySandboxResponder {
501    type ControlHandle = ComponentSandboxRetrieverControlHandle;
502
503    fn control_handle(&self) -> &ComponentSandboxRetrieverControlHandle {
504        &self.control_handle
505    }
506
507    fn drop_without_shutdown(mut self) {
508        // Safety: drops once, never accessed again due to mem::forget
509        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
510        // Prevent Drop from running (which would shut down the channel)
511        std::mem::forget(self);
512    }
513}
514
515impl ComponentSandboxRetrieverGetMySandboxResponder {
516    /// Sends a response to the FIDL transaction.
517    ///
518    /// Sets the channel to shutdown if an error occurs.
519    pub fn send(self, mut payload: ComponentSandbox) -> Result<(), fidl::Error> {
520        let _result = self.send_raw(payload);
521        if _result.is_err() {
522            self.control_handle.shutdown();
523        }
524        self.drop_without_shutdown();
525        _result
526    }
527
528    /// Similar to "send" but does not shutdown the channel if an error occurs.
529    pub fn send_no_shutdown_on_err(self, mut payload: ComponentSandbox) -> Result<(), fidl::Error> {
530        let _result = self.send_raw(payload);
531        self.drop_without_shutdown();
532        _result
533    }
534
535    fn send_raw(&self, mut payload: ComponentSandbox) -> Result<(), fidl::Error> {
536        self.control_handle.inner.send::<fidl::encoding::FlexibleType<ComponentSandbox>>(
537            fidl::encoding::Flexible::new(&mut payload),
538            self.tx_id,
539            0x61ca075fb9860e84,
540            fidl::encoding::DynamicFlags::FLEXIBLE,
541        )
542    }
543}
544
545mod internal {
546    use super::*;
547
548    impl fidl::encoding::ResourceTypeMarker for ChildInput {
549        type Borrowed<'a> = &'a mut Self;
550        fn take_or_borrow<'a>(
551            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
552        ) -> Self::Borrowed<'a> {
553            value
554        }
555    }
556
557    unsafe impl fidl::encoding::TypeMarker for ChildInput {
558        type Owned = Self;
559
560        #[inline(always)]
561        fn inline_align(_context: fidl::encoding::Context) -> usize {
562            8
563        }
564
565        #[inline(always)]
566        fn inline_size(_context: fidl::encoding::Context) -> usize {
567            24
568        }
569    }
570
571    unsafe impl fidl::encoding::Encode<ChildInput, fidl::encoding::DefaultFuchsiaResourceDialect>
572        for &mut ChildInput
573    {
574        #[inline]
575        unsafe fn encode(
576            self,
577            encoder: &mut fidl::encoding::Encoder<
578                '_,
579                fidl::encoding::DefaultFuchsiaResourceDialect,
580            >,
581            offset: usize,
582            _depth: fidl::encoding::Depth,
583        ) -> fidl::Result<()> {
584            encoder.debug_check_bounds::<ChildInput>(offset);
585            // Delegate to tuple encoding.
586            fidl::encoding::Encode::<ChildInput, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
587                (
588                    <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.child_name),
589                    <fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_input),
590                ),
591                encoder, offset, _depth
592            )
593        }
594    }
595    unsafe impl<
596        T0: fidl::encoding::Encode<
597                fidl::encoding::BoundedString<1024>,
598                fidl::encoding::DefaultFuchsiaResourceDialect,
599            >,
600        T1: fidl::encoding::Encode<
601                fidl::encoding::HandleType<
602                    fidl::EventPair,
603                    { fidl::ObjectType::EVENTPAIR.into_raw() },
604                    2147483648,
605                >,
606                fidl::encoding::DefaultFuchsiaResourceDialect,
607            >,
608    > fidl::encoding::Encode<ChildInput, fidl::encoding::DefaultFuchsiaResourceDialect>
609        for (T0, T1)
610    {
611        #[inline]
612        unsafe fn encode(
613            self,
614            encoder: &mut fidl::encoding::Encoder<
615                '_,
616                fidl::encoding::DefaultFuchsiaResourceDialect,
617            >,
618            offset: usize,
619            depth: fidl::encoding::Depth,
620        ) -> fidl::Result<()> {
621            encoder.debug_check_bounds::<ChildInput>(offset);
622            // Zero out padding regions. There's no need to apply masks
623            // because the unmasked parts will be overwritten by fields.
624            unsafe {
625                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
626                (ptr as *mut u64).write_unaligned(0);
627            }
628            // Write the fields.
629            self.0.encode(encoder, offset + 0, depth)?;
630            self.1.encode(encoder, offset + 16, depth)?;
631            Ok(())
632        }
633    }
634
635    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ChildInput {
636        #[inline(always)]
637        fn new_empty() -> Self {
638            Self {
639                child_name: fidl::new_empty!(
640                    fidl::encoding::BoundedString<1024>,
641                    fidl::encoding::DefaultFuchsiaResourceDialect
642                ),
643                child_input: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
644            }
645        }
646
647        #[inline]
648        unsafe fn decode(
649            &mut self,
650            decoder: &mut fidl::encoding::Decoder<
651                '_,
652                fidl::encoding::DefaultFuchsiaResourceDialect,
653            >,
654            offset: usize,
655            _depth: fidl::encoding::Depth,
656        ) -> fidl::Result<()> {
657            decoder.debug_check_bounds::<Self>(offset);
658            // Verify that padding bytes are zero.
659            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
660            let padval = unsafe { (ptr as *const u64).read_unaligned() };
661            let mask = 0xffffffff00000000u64;
662            let maskedval = padval & mask;
663            if maskedval != 0 {
664                return Err(fidl::Error::NonZeroPadding {
665                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
666                });
667            }
668            fidl::decode!(
669                fidl::encoding::BoundedString<1024>,
670                fidl::encoding::DefaultFuchsiaResourceDialect,
671                &mut self.child_name,
672                decoder,
673                offset + 0,
674                _depth
675            )?;
676            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.child_input, decoder, offset + 16, _depth)?;
677            Ok(())
678        }
679    }
680
681    impl ComponentSandbox {
682        #[inline(always)]
683        fn max_ordinal_present(&self) -> u64 {
684            if let Some(_) = self.collection_inputs {
685                return 9;
686            }
687            if let Some(_) = self.child_inputs {
688                return 8;
689            }
690            if let Some(_) = self.declared_dictionaries {
691                return 7;
692            }
693            if let Some(_) = self.capability_sourced {
694                return 6;
695            }
696            if let Some(_) = self.reserved {
697                return 5;
698            }
699            if let Some(_) = self.program_output {
700                return 4;
701            }
702            if let Some(_) = self.program_input {
703                return 3;
704            }
705            if let Some(_) = self.component_output {
706                return 2;
707            }
708            if let Some(_) = self.component_input {
709                return 1;
710            }
711            0
712        }
713    }
714
715    impl fidl::encoding::ResourceTypeMarker for ComponentSandbox {
716        type Borrowed<'a> = &'a mut Self;
717        fn take_or_borrow<'a>(
718            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
719        ) -> Self::Borrowed<'a> {
720            value
721        }
722    }
723
724    unsafe impl fidl::encoding::TypeMarker for ComponentSandbox {
725        type Owned = Self;
726
727        #[inline(always)]
728        fn inline_align(_context: fidl::encoding::Context) -> usize {
729            8
730        }
731
732        #[inline(always)]
733        fn inline_size(_context: fidl::encoding::Context) -> usize {
734            16
735        }
736    }
737
738    unsafe impl
739        fidl::encoding::Encode<ComponentSandbox, fidl::encoding::DefaultFuchsiaResourceDialect>
740        for &mut ComponentSandbox
741    {
742        unsafe fn encode(
743            self,
744            encoder: &mut fidl::encoding::Encoder<
745                '_,
746                fidl::encoding::DefaultFuchsiaResourceDialect,
747            >,
748            offset: usize,
749            mut depth: fidl::encoding::Depth,
750        ) -> fidl::Result<()> {
751            encoder.debug_check_bounds::<ComponentSandbox>(offset);
752            // Vector header
753            let max_ordinal: u64 = self.max_ordinal_present();
754            encoder.write_num(max_ordinal, offset);
755            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
756            // Calling encoder.out_of_line_offset(0) is not allowed.
757            if max_ordinal == 0 {
758                return Ok(());
759            }
760            depth.increment()?;
761            let envelope_size = 8;
762            let bytes_len = max_ordinal as usize * envelope_size;
763            #[allow(unused_variables)]
764            let offset = encoder.out_of_line_offset(bytes_len);
765            let mut _prev_end_offset: usize = 0;
766            if 1 > max_ordinal {
767                return Ok(());
768            }
769
770            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
771            // are envelope_size bytes.
772            let cur_offset: usize = (1 - 1) * envelope_size;
773
774            // Zero reserved fields.
775            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
776
777            // Safety:
778            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
779            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
780            //   envelope_size bytes, there is always sufficient room.
781            fidl::encoding::encode_in_envelope_optional::<
782                fidl::encoding::HandleType<
783                    fidl::EventPair,
784                    { fidl::ObjectType::EVENTPAIR.into_raw() },
785                    2147483648,
786                >,
787                fidl::encoding::DefaultFuchsiaResourceDialect,
788            >(
789                self.component_input.as_mut().map(
790                    <fidl::encoding::HandleType<
791                        fidl::EventPair,
792                        { fidl::ObjectType::EVENTPAIR.into_raw() },
793                        2147483648,
794                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
795                ),
796                encoder,
797                offset + cur_offset,
798                depth,
799            )?;
800
801            _prev_end_offset = cur_offset + envelope_size;
802            if 2 > max_ordinal {
803                return Ok(());
804            }
805
806            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
807            // are envelope_size bytes.
808            let cur_offset: usize = (2 - 1) * envelope_size;
809
810            // Zero reserved fields.
811            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
812
813            // Safety:
814            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
815            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
816            //   envelope_size bytes, there is always sufficient room.
817            fidl::encoding::encode_in_envelope_optional::<
818                fidl::encoding::HandleType<
819                    fidl::EventPair,
820                    { fidl::ObjectType::EVENTPAIR.into_raw() },
821                    2147483648,
822                >,
823                fidl::encoding::DefaultFuchsiaResourceDialect,
824            >(
825                self.component_output.as_mut().map(
826                    <fidl::encoding::HandleType<
827                        fidl::EventPair,
828                        { fidl::ObjectType::EVENTPAIR.into_raw() },
829                        2147483648,
830                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
831                ),
832                encoder,
833                offset + cur_offset,
834                depth,
835            )?;
836
837            _prev_end_offset = cur_offset + envelope_size;
838            if 3 > max_ordinal {
839                return Ok(());
840            }
841
842            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
843            // are envelope_size bytes.
844            let cur_offset: usize = (3 - 1) * envelope_size;
845
846            // Zero reserved fields.
847            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
848
849            // Safety:
850            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
851            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
852            //   envelope_size bytes, there is always sufficient room.
853            fidl::encoding::encode_in_envelope_optional::<
854                fidl::encoding::HandleType<
855                    fidl::EventPair,
856                    { fidl::ObjectType::EVENTPAIR.into_raw() },
857                    2147483648,
858                >,
859                fidl::encoding::DefaultFuchsiaResourceDialect,
860            >(
861                self.program_input.as_mut().map(
862                    <fidl::encoding::HandleType<
863                        fidl::EventPair,
864                        { fidl::ObjectType::EVENTPAIR.into_raw() },
865                        2147483648,
866                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
867                ),
868                encoder,
869                offset + cur_offset,
870                depth,
871            )?;
872
873            _prev_end_offset = cur_offset + envelope_size;
874            if 4 > max_ordinal {
875                return Ok(());
876            }
877
878            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
879            // are envelope_size bytes.
880            let cur_offset: usize = (4 - 1) * envelope_size;
881
882            // Zero reserved fields.
883            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
884
885            // Safety:
886            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
887            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
888            //   envelope_size bytes, there is always sufficient room.
889            fidl::encoding::encode_in_envelope_optional::<
890                fidl::encoding::HandleType<
891                    fidl::EventPair,
892                    { fidl::ObjectType::EVENTPAIR.into_raw() },
893                    2147483648,
894                >,
895                fidl::encoding::DefaultFuchsiaResourceDialect,
896            >(
897                self.program_output.as_mut().map(
898                    <fidl::encoding::HandleType<
899                        fidl::EventPair,
900                        { fidl::ObjectType::EVENTPAIR.into_raw() },
901                        2147483648,
902                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
903                ),
904                encoder,
905                offset + cur_offset,
906                depth,
907            )?;
908
909            _prev_end_offset = cur_offset + envelope_size;
910            if 5 > max_ordinal {
911                return Ok(());
912            }
913
914            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
915            // are envelope_size bytes.
916            let cur_offset: usize = (5 - 1) * envelope_size;
917
918            // Zero reserved fields.
919            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
920
921            // Safety:
922            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
923            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
924            //   envelope_size bytes, there is always sufficient room.
925            fidl::encoding::encode_in_envelope_optional::<
926                fidl::encoding::HandleType<
927                    fidl::EventPair,
928                    { fidl::ObjectType::EVENTPAIR.into_raw() },
929                    2147483648,
930                >,
931                fidl::encoding::DefaultFuchsiaResourceDialect,
932            >(
933                self.reserved.as_mut().map(
934                    <fidl::encoding::HandleType<
935                        fidl::EventPair,
936                        { fidl::ObjectType::EVENTPAIR.into_raw() },
937                        2147483648,
938                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
939                ),
940                encoder,
941                offset + cur_offset,
942                depth,
943            )?;
944
945            _prev_end_offset = cur_offset + envelope_size;
946            if 6 > max_ordinal {
947                return Ok(());
948            }
949
950            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
951            // are envelope_size bytes.
952            let cur_offset: usize = (6 - 1) * envelope_size;
953
954            // Zero reserved fields.
955            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
956
957            // Safety:
958            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
959            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
960            //   envelope_size bytes, there is always sufficient room.
961            fidl::encoding::encode_in_envelope_optional::<
962                fidl::encoding::HandleType<
963                    fidl::EventPair,
964                    { fidl::ObjectType::EVENTPAIR.into_raw() },
965                    2147483648,
966                >,
967                fidl::encoding::DefaultFuchsiaResourceDialect,
968            >(
969                self.capability_sourced.as_mut().map(
970                    <fidl::encoding::HandleType<
971                        fidl::EventPair,
972                        { fidl::ObjectType::EVENTPAIR.into_raw() },
973                        2147483648,
974                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
975                ),
976                encoder,
977                offset + cur_offset,
978                depth,
979            )?;
980
981            _prev_end_offset = cur_offset + envelope_size;
982            if 7 > max_ordinal {
983                return Ok(());
984            }
985
986            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
987            // are envelope_size bytes.
988            let cur_offset: usize = (7 - 1) * envelope_size;
989
990            // Zero reserved fields.
991            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
992
993            // Safety:
994            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
995            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
996            //   envelope_size bytes, there is always sufficient room.
997            fidl::encoding::encode_in_envelope_optional::<
998                fidl::encoding::HandleType<
999                    fidl::EventPair,
1000                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1001                    2147483648,
1002                >,
1003                fidl::encoding::DefaultFuchsiaResourceDialect,
1004            >(
1005                self.declared_dictionaries.as_mut().map(
1006                    <fidl::encoding::HandleType<
1007                        fidl::EventPair,
1008                        { fidl::ObjectType::EVENTPAIR.into_raw() },
1009                        2147483648,
1010                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1011                ),
1012                encoder,
1013                offset + cur_offset,
1014                depth,
1015            )?;
1016
1017            _prev_end_offset = cur_offset + envelope_size;
1018            if 8 > max_ordinal {
1019                return Ok(());
1020            }
1021
1022            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1023            // are envelope_size bytes.
1024            let cur_offset: usize = (8 - 1) * envelope_size;
1025
1026            // Zero reserved fields.
1027            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1028
1029            // Safety:
1030            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1031            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1032            //   envelope_size bytes, there is always sufficient room.
1033            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ChildInput>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1034            self.child_inputs.as_mut().map(<fidl::encoding::UnboundedVector<ChildInput> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1035            encoder, offset + cur_offset, depth
1036        )?;
1037
1038            _prev_end_offset = cur_offset + envelope_size;
1039            if 9 > max_ordinal {
1040                return Ok(());
1041            }
1042
1043            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1044            // are envelope_size bytes.
1045            let cur_offset: usize = (9 - 1) * envelope_size;
1046
1047            // Zero reserved fields.
1048            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1049
1050            // Safety:
1051            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1052            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1053            //   envelope_size bytes, there is always sufficient room.
1054            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ChildInput>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1055            self.collection_inputs.as_mut().map(<fidl::encoding::UnboundedVector<ChildInput> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1056            encoder, offset + cur_offset, depth
1057        )?;
1058
1059            _prev_end_offset = cur_offset + envelope_size;
1060
1061            Ok(())
1062        }
1063    }
1064
1065    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1066        for ComponentSandbox
1067    {
1068        #[inline(always)]
1069        fn new_empty() -> Self {
1070            Self::default()
1071        }
1072
1073        unsafe fn decode(
1074            &mut self,
1075            decoder: &mut fidl::encoding::Decoder<
1076                '_,
1077                fidl::encoding::DefaultFuchsiaResourceDialect,
1078            >,
1079            offset: usize,
1080            mut depth: fidl::encoding::Depth,
1081        ) -> fidl::Result<()> {
1082            decoder.debug_check_bounds::<Self>(offset);
1083            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1084                None => return Err(fidl::Error::NotNullable),
1085                Some(len) => len,
1086            };
1087            // Calling decoder.out_of_line_offset(0) is not allowed.
1088            if len == 0 {
1089                return Ok(());
1090            };
1091            depth.increment()?;
1092            let envelope_size = 8;
1093            let bytes_len = len * envelope_size;
1094            let offset = decoder.out_of_line_offset(bytes_len)?;
1095            // Decode the envelope for each type.
1096            let mut _next_ordinal_to_read = 0;
1097            let mut next_offset = offset;
1098            let end_offset = offset + bytes_len;
1099            _next_ordinal_to_read += 1;
1100            if next_offset >= end_offset {
1101                return Ok(());
1102            }
1103
1104            // Decode unknown envelopes for gaps in ordinals.
1105            while _next_ordinal_to_read < 1 {
1106                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1107                _next_ordinal_to_read += 1;
1108                next_offset += envelope_size;
1109            }
1110
1111            let next_out_of_line = decoder.next_out_of_line();
1112            let handles_before = decoder.remaining_handles();
1113            if let Some((inlined, num_bytes, num_handles)) =
1114                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1115            {
1116                let member_inline_size = <fidl::encoding::HandleType<
1117                    fidl::EventPair,
1118                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1119                    2147483648,
1120                > as fidl::encoding::TypeMarker>::inline_size(
1121                    decoder.context
1122                );
1123                if inlined != (member_inline_size <= 4) {
1124                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1125                }
1126                let inner_offset;
1127                let mut inner_depth = depth.clone();
1128                if inlined {
1129                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1130                    inner_offset = next_offset;
1131                } else {
1132                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1133                    inner_depth.increment()?;
1134                }
1135                let val_ref =
1136                self.component_input.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1137                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1138                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1139                {
1140                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1141                }
1142                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1143                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1144                }
1145            }
1146
1147            next_offset += envelope_size;
1148            _next_ordinal_to_read += 1;
1149            if next_offset >= end_offset {
1150                return Ok(());
1151            }
1152
1153            // Decode unknown envelopes for gaps in ordinals.
1154            while _next_ordinal_to_read < 2 {
1155                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1156                _next_ordinal_to_read += 1;
1157                next_offset += envelope_size;
1158            }
1159
1160            let next_out_of_line = decoder.next_out_of_line();
1161            let handles_before = decoder.remaining_handles();
1162            if let Some((inlined, num_bytes, num_handles)) =
1163                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1164            {
1165                let member_inline_size = <fidl::encoding::HandleType<
1166                    fidl::EventPair,
1167                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1168                    2147483648,
1169                > as fidl::encoding::TypeMarker>::inline_size(
1170                    decoder.context
1171                );
1172                if inlined != (member_inline_size <= 4) {
1173                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1174                }
1175                let inner_offset;
1176                let mut inner_depth = depth.clone();
1177                if inlined {
1178                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1179                    inner_offset = next_offset;
1180                } else {
1181                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1182                    inner_depth.increment()?;
1183                }
1184                let val_ref =
1185                self.component_output.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1186                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1187                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1188                {
1189                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1190                }
1191                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1192                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1193                }
1194            }
1195
1196            next_offset += envelope_size;
1197            _next_ordinal_to_read += 1;
1198            if next_offset >= end_offset {
1199                return Ok(());
1200            }
1201
1202            // Decode unknown envelopes for gaps in ordinals.
1203            while _next_ordinal_to_read < 3 {
1204                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1205                _next_ordinal_to_read += 1;
1206                next_offset += envelope_size;
1207            }
1208
1209            let next_out_of_line = decoder.next_out_of_line();
1210            let handles_before = decoder.remaining_handles();
1211            if let Some((inlined, num_bytes, num_handles)) =
1212                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1213            {
1214                let member_inline_size = <fidl::encoding::HandleType<
1215                    fidl::EventPair,
1216                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1217                    2147483648,
1218                > as fidl::encoding::TypeMarker>::inline_size(
1219                    decoder.context
1220                );
1221                if inlined != (member_inline_size <= 4) {
1222                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1223                }
1224                let inner_offset;
1225                let mut inner_depth = depth.clone();
1226                if inlined {
1227                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1228                    inner_offset = next_offset;
1229                } else {
1230                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1231                    inner_depth.increment()?;
1232                }
1233                let val_ref =
1234                self.program_input.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1235                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1236                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1237                {
1238                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1239                }
1240                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1241                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1242                }
1243            }
1244
1245            next_offset += envelope_size;
1246            _next_ordinal_to_read += 1;
1247            if next_offset >= end_offset {
1248                return Ok(());
1249            }
1250
1251            // Decode unknown envelopes for gaps in ordinals.
1252            while _next_ordinal_to_read < 4 {
1253                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1254                _next_ordinal_to_read += 1;
1255                next_offset += envelope_size;
1256            }
1257
1258            let next_out_of_line = decoder.next_out_of_line();
1259            let handles_before = decoder.remaining_handles();
1260            if let Some((inlined, num_bytes, num_handles)) =
1261                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1262            {
1263                let member_inline_size = <fidl::encoding::HandleType<
1264                    fidl::EventPair,
1265                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1266                    2147483648,
1267                > as fidl::encoding::TypeMarker>::inline_size(
1268                    decoder.context
1269                );
1270                if inlined != (member_inline_size <= 4) {
1271                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1272                }
1273                let inner_offset;
1274                let mut inner_depth = depth.clone();
1275                if inlined {
1276                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1277                    inner_offset = next_offset;
1278                } else {
1279                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1280                    inner_depth.increment()?;
1281                }
1282                let val_ref =
1283                self.program_output.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1284                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1285                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1286                {
1287                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1288                }
1289                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1290                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1291                }
1292            }
1293
1294            next_offset += envelope_size;
1295            _next_ordinal_to_read += 1;
1296            if next_offset >= end_offset {
1297                return Ok(());
1298            }
1299
1300            // Decode unknown envelopes for gaps in ordinals.
1301            while _next_ordinal_to_read < 5 {
1302                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1303                _next_ordinal_to_read += 1;
1304                next_offset += envelope_size;
1305            }
1306
1307            let next_out_of_line = decoder.next_out_of_line();
1308            let handles_before = decoder.remaining_handles();
1309            if let Some((inlined, num_bytes, num_handles)) =
1310                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1311            {
1312                let member_inline_size = <fidl::encoding::HandleType<
1313                    fidl::EventPair,
1314                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1315                    2147483648,
1316                > as fidl::encoding::TypeMarker>::inline_size(
1317                    decoder.context
1318                );
1319                if inlined != (member_inline_size <= 4) {
1320                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1321                }
1322                let inner_offset;
1323                let mut inner_depth = depth.clone();
1324                if inlined {
1325                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1326                    inner_offset = next_offset;
1327                } else {
1328                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1329                    inner_depth.increment()?;
1330                }
1331                let val_ref =
1332                self.reserved.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1333                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1334                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1335                {
1336                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1337                }
1338                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1339                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1340                }
1341            }
1342
1343            next_offset += envelope_size;
1344            _next_ordinal_to_read += 1;
1345            if next_offset >= end_offset {
1346                return Ok(());
1347            }
1348
1349            // Decode unknown envelopes for gaps in ordinals.
1350            while _next_ordinal_to_read < 6 {
1351                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1352                _next_ordinal_to_read += 1;
1353                next_offset += envelope_size;
1354            }
1355
1356            let next_out_of_line = decoder.next_out_of_line();
1357            let handles_before = decoder.remaining_handles();
1358            if let Some((inlined, num_bytes, num_handles)) =
1359                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1360            {
1361                let member_inline_size = <fidl::encoding::HandleType<
1362                    fidl::EventPair,
1363                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1364                    2147483648,
1365                > as fidl::encoding::TypeMarker>::inline_size(
1366                    decoder.context
1367                );
1368                if inlined != (member_inline_size <= 4) {
1369                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1370                }
1371                let inner_offset;
1372                let mut inner_depth = depth.clone();
1373                if inlined {
1374                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1375                    inner_offset = next_offset;
1376                } else {
1377                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1378                    inner_depth.increment()?;
1379                }
1380                let val_ref =
1381                self.capability_sourced.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1382                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1383                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1384                {
1385                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1386                }
1387                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1388                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1389                }
1390            }
1391
1392            next_offset += envelope_size;
1393            _next_ordinal_to_read += 1;
1394            if next_offset >= end_offset {
1395                return Ok(());
1396            }
1397
1398            // Decode unknown envelopes for gaps in ordinals.
1399            while _next_ordinal_to_read < 7 {
1400                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1401                _next_ordinal_to_read += 1;
1402                next_offset += envelope_size;
1403            }
1404
1405            let next_out_of_line = decoder.next_out_of_line();
1406            let handles_before = decoder.remaining_handles();
1407            if let Some((inlined, num_bytes, num_handles)) =
1408                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1409            {
1410                let member_inline_size = <fidl::encoding::HandleType<
1411                    fidl::EventPair,
1412                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1413                    2147483648,
1414                > as fidl::encoding::TypeMarker>::inline_size(
1415                    decoder.context
1416                );
1417                if inlined != (member_inline_size <= 4) {
1418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1419                }
1420                let inner_offset;
1421                let mut inner_depth = depth.clone();
1422                if inlined {
1423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1424                    inner_offset = next_offset;
1425                } else {
1426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1427                    inner_depth.increment()?;
1428                }
1429                let val_ref =
1430                self.declared_dictionaries.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1431                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1432                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1433                {
1434                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1435                }
1436                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1437                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1438                }
1439            }
1440
1441            next_offset += envelope_size;
1442            _next_ordinal_to_read += 1;
1443            if next_offset >= end_offset {
1444                return Ok(());
1445            }
1446
1447            // Decode unknown envelopes for gaps in ordinals.
1448            while _next_ordinal_to_read < 8 {
1449                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1450                _next_ordinal_to_read += 1;
1451                next_offset += envelope_size;
1452            }
1453
1454            let next_out_of_line = decoder.next_out_of_line();
1455            let handles_before = decoder.remaining_handles();
1456            if let Some((inlined, num_bytes, num_handles)) =
1457                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1458            {
1459                let member_inline_size = <fidl::encoding::UnboundedVector<ChildInput> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1460                if inlined != (member_inline_size <= 4) {
1461                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1462                }
1463                let inner_offset;
1464                let mut inner_depth = depth.clone();
1465                if inlined {
1466                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1467                    inner_offset = next_offset;
1468                } else {
1469                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1470                    inner_depth.increment()?;
1471                }
1472                let val_ref = self.child_inputs.get_or_insert_with(|| {
1473                    fidl::new_empty!(
1474                        fidl::encoding::UnboundedVector<ChildInput>,
1475                        fidl::encoding::DefaultFuchsiaResourceDialect
1476                    )
1477                });
1478                fidl::decode!(
1479                    fidl::encoding::UnboundedVector<ChildInput>,
1480                    fidl::encoding::DefaultFuchsiaResourceDialect,
1481                    val_ref,
1482                    decoder,
1483                    inner_offset,
1484                    inner_depth
1485                )?;
1486                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1487                {
1488                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1489                }
1490                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1491                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1492                }
1493            }
1494
1495            next_offset += envelope_size;
1496            _next_ordinal_to_read += 1;
1497            if next_offset >= end_offset {
1498                return Ok(());
1499            }
1500
1501            // Decode unknown envelopes for gaps in ordinals.
1502            while _next_ordinal_to_read < 9 {
1503                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1504                _next_ordinal_to_read += 1;
1505                next_offset += envelope_size;
1506            }
1507
1508            let next_out_of_line = decoder.next_out_of_line();
1509            let handles_before = decoder.remaining_handles();
1510            if let Some((inlined, num_bytes, num_handles)) =
1511                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1512            {
1513                let member_inline_size = <fidl::encoding::UnboundedVector<ChildInput> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1514                if inlined != (member_inline_size <= 4) {
1515                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1516                }
1517                let inner_offset;
1518                let mut inner_depth = depth.clone();
1519                if inlined {
1520                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1521                    inner_offset = next_offset;
1522                } else {
1523                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1524                    inner_depth.increment()?;
1525                }
1526                let val_ref = self.collection_inputs.get_or_insert_with(|| {
1527                    fidl::new_empty!(
1528                        fidl::encoding::UnboundedVector<ChildInput>,
1529                        fidl::encoding::DefaultFuchsiaResourceDialect
1530                    )
1531                });
1532                fidl::decode!(
1533                    fidl::encoding::UnboundedVector<ChildInput>,
1534                    fidl::encoding::DefaultFuchsiaResourceDialect,
1535                    val_ref,
1536                    decoder,
1537                    inner_offset,
1538                    inner_depth
1539                )?;
1540                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1541                {
1542                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1543                }
1544                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1545                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1546                }
1547            }
1548
1549            next_offset += envelope_size;
1550
1551            // Decode the remaining unknown envelopes.
1552            while next_offset < end_offset {
1553                _next_ordinal_to_read += 1;
1554                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1555                next_offset += envelope_size;
1556            }
1557
1558            Ok(())
1559        }
1560    }
1561}