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 fidl::endpoints::ControlHandle for ComponentSandboxRetrieverControlHandle {
448    fn shutdown(&self) {
449        self.inner.shutdown()
450    }
451
452    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
453        self.inner.shutdown_with_epitaph(status)
454    }
455
456    fn is_closed(&self) -> bool {
457        self.inner.channel().is_closed()
458    }
459    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
460        self.inner.channel().on_closed()
461    }
462
463    #[cfg(target_os = "fuchsia")]
464    fn signal_peer(
465        &self,
466        clear_mask: zx::Signals,
467        set_mask: zx::Signals,
468    ) -> Result<(), zx_status::Status> {
469        use fidl::Peered;
470        self.inner.channel().signal_peer(clear_mask, set_mask)
471    }
472}
473
474impl ComponentSandboxRetrieverControlHandle {}
475
476#[must_use = "FIDL methods require a response to be sent"]
477#[derive(Debug)]
478pub struct ComponentSandboxRetrieverGetMySandboxResponder {
479    control_handle: std::mem::ManuallyDrop<ComponentSandboxRetrieverControlHandle>,
480    tx_id: u32,
481}
482
483/// Set the the channel to be shutdown (see [`ComponentSandboxRetrieverControlHandle::shutdown`])
484/// if the responder is dropped without sending a response, so that the client
485/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
486impl std::ops::Drop for ComponentSandboxRetrieverGetMySandboxResponder {
487    fn drop(&mut self) {
488        self.control_handle.shutdown();
489        // Safety: drops once, never accessed again
490        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
491    }
492}
493
494impl fidl::endpoints::Responder for ComponentSandboxRetrieverGetMySandboxResponder {
495    type ControlHandle = ComponentSandboxRetrieverControlHandle;
496
497    fn control_handle(&self) -> &ComponentSandboxRetrieverControlHandle {
498        &self.control_handle
499    }
500
501    fn drop_without_shutdown(mut self) {
502        // Safety: drops once, never accessed again due to mem::forget
503        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
504        // Prevent Drop from running (which would shut down the channel)
505        std::mem::forget(self);
506    }
507}
508
509impl ComponentSandboxRetrieverGetMySandboxResponder {
510    /// Sends a response to the FIDL transaction.
511    ///
512    /// Sets the channel to shutdown if an error occurs.
513    pub fn send(self, mut payload: ComponentSandbox) -> Result<(), fidl::Error> {
514        let _result = self.send_raw(payload);
515        if _result.is_err() {
516            self.control_handle.shutdown();
517        }
518        self.drop_without_shutdown();
519        _result
520    }
521
522    /// Similar to "send" but does not shutdown the channel if an error occurs.
523    pub fn send_no_shutdown_on_err(self, mut payload: ComponentSandbox) -> Result<(), fidl::Error> {
524        let _result = self.send_raw(payload);
525        self.drop_without_shutdown();
526        _result
527    }
528
529    fn send_raw(&self, mut payload: ComponentSandbox) -> Result<(), fidl::Error> {
530        self.control_handle.inner.send::<fidl::encoding::FlexibleType<ComponentSandbox>>(
531            fidl::encoding::Flexible::new(&mut payload),
532            self.tx_id,
533            0x61ca075fb9860e84,
534            fidl::encoding::DynamicFlags::FLEXIBLE,
535        )
536    }
537}
538
539mod internal {
540    use super::*;
541
542    impl fidl::encoding::ResourceTypeMarker for ChildInput {
543        type Borrowed<'a> = &'a mut Self;
544        fn take_or_borrow<'a>(
545            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
546        ) -> Self::Borrowed<'a> {
547            value
548        }
549    }
550
551    unsafe impl fidl::encoding::TypeMarker for ChildInput {
552        type Owned = Self;
553
554        #[inline(always)]
555        fn inline_align(_context: fidl::encoding::Context) -> usize {
556            8
557        }
558
559        #[inline(always)]
560        fn inline_size(_context: fidl::encoding::Context) -> usize {
561            24
562        }
563    }
564
565    unsafe impl fidl::encoding::Encode<ChildInput, fidl::encoding::DefaultFuchsiaResourceDialect>
566        for &mut ChildInput
567    {
568        #[inline]
569        unsafe fn encode(
570            self,
571            encoder: &mut fidl::encoding::Encoder<
572                '_,
573                fidl::encoding::DefaultFuchsiaResourceDialect,
574            >,
575            offset: usize,
576            _depth: fidl::encoding::Depth,
577        ) -> fidl::Result<()> {
578            encoder.debug_check_bounds::<ChildInput>(offset);
579            // Delegate to tuple encoding.
580            fidl::encoding::Encode::<ChildInput, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
581                (
582                    <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.child_name),
583                    <fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_input),
584                ),
585                encoder, offset, _depth
586            )
587        }
588    }
589    unsafe impl<
590        T0: fidl::encoding::Encode<
591                fidl::encoding::BoundedString<1024>,
592                fidl::encoding::DefaultFuchsiaResourceDialect,
593            >,
594        T1: fidl::encoding::Encode<
595                fidl::encoding::HandleType<
596                    fidl::EventPair,
597                    { fidl::ObjectType::EVENTPAIR.into_raw() },
598                    2147483648,
599                >,
600                fidl::encoding::DefaultFuchsiaResourceDialect,
601            >,
602    > fidl::encoding::Encode<ChildInput, fidl::encoding::DefaultFuchsiaResourceDialect>
603        for (T0, T1)
604    {
605        #[inline]
606        unsafe fn encode(
607            self,
608            encoder: &mut fidl::encoding::Encoder<
609                '_,
610                fidl::encoding::DefaultFuchsiaResourceDialect,
611            >,
612            offset: usize,
613            depth: fidl::encoding::Depth,
614        ) -> fidl::Result<()> {
615            encoder.debug_check_bounds::<ChildInput>(offset);
616            // Zero out padding regions. There's no need to apply masks
617            // because the unmasked parts will be overwritten by fields.
618            unsafe {
619                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
620                (ptr as *mut u64).write_unaligned(0);
621            }
622            // Write the fields.
623            self.0.encode(encoder, offset + 0, depth)?;
624            self.1.encode(encoder, offset + 16, depth)?;
625            Ok(())
626        }
627    }
628
629    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ChildInput {
630        #[inline(always)]
631        fn new_empty() -> Self {
632            Self {
633                child_name: fidl::new_empty!(
634                    fidl::encoding::BoundedString<1024>,
635                    fidl::encoding::DefaultFuchsiaResourceDialect
636                ),
637                child_input: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
638            }
639        }
640
641        #[inline]
642        unsafe fn decode(
643            &mut self,
644            decoder: &mut fidl::encoding::Decoder<
645                '_,
646                fidl::encoding::DefaultFuchsiaResourceDialect,
647            >,
648            offset: usize,
649            _depth: fidl::encoding::Depth,
650        ) -> fidl::Result<()> {
651            decoder.debug_check_bounds::<Self>(offset);
652            // Verify that padding bytes are zero.
653            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
654            let padval = unsafe { (ptr as *const u64).read_unaligned() };
655            let mask = 0xffffffff00000000u64;
656            let maskedval = padval & mask;
657            if maskedval != 0 {
658                return Err(fidl::Error::NonZeroPadding {
659                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
660                });
661            }
662            fidl::decode!(
663                fidl::encoding::BoundedString<1024>,
664                fidl::encoding::DefaultFuchsiaResourceDialect,
665                &mut self.child_name,
666                decoder,
667                offset + 0,
668                _depth
669            )?;
670            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.child_input, decoder, offset + 16, _depth)?;
671            Ok(())
672        }
673    }
674
675    impl ComponentSandbox {
676        #[inline(always)]
677        fn max_ordinal_present(&self) -> u64 {
678            if let Some(_) = self.collection_inputs {
679                return 9;
680            }
681            if let Some(_) = self.child_inputs {
682                return 8;
683            }
684            if let Some(_) = self.declared_dictionaries {
685                return 7;
686            }
687            if let Some(_) = self.capability_sourced {
688                return 6;
689            }
690            if let Some(_) = self.reserved {
691                return 5;
692            }
693            if let Some(_) = self.program_output {
694                return 4;
695            }
696            if let Some(_) = self.program_input {
697                return 3;
698            }
699            if let Some(_) = self.component_output {
700                return 2;
701            }
702            if let Some(_) = self.component_input {
703                return 1;
704            }
705            0
706        }
707    }
708
709    impl fidl::encoding::ResourceTypeMarker for ComponentSandbox {
710        type Borrowed<'a> = &'a mut Self;
711        fn take_or_borrow<'a>(
712            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
713        ) -> Self::Borrowed<'a> {
714            value
715        }
716    }
717
718    unsafe impl fidl::encoding::TypeMarker for ComponentSandbox {
719        type Owned = Self;
720
721        #[inline(always)]
722        fn inline_align(_context: fidl::encoding::Context) -> usize {
723            8
724        }
725
726        #[inline(always)]
727        fn inline_size(_context: fidl::encoding::Context) -> usize {
728            16
729        }
730    }
731
732    unsafe impl
733        fidl::encoding::Encode<ComponentSandbox, fidl::encoding::DefaultFuchsiaResourceDialect>
734        for &mut ComponentSandbox
735    {
736        unsafe fn encode(
737            self,
738            encoder: &mut fidl::encoding::Encoder<
739                '_,
740                fidl::encoding::DefaultFuchsiaResourceDialect,
741            >,
742            offset: usize,
743            mut depth: fidl::encoding::Depth,
744        ) -> fidl::Result<()> {
745            encoder.debug_check_bounds::<ComponentSandbox>(offset);
746            // Vector header
747            let max_ordinal: u64 = self.max_ordinal_present();
748            encoder.write_num(max_ordinal, offset);
749            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
750            // Calling encoder.out_of_line_offset(0) is not allowed.
751            if max_ordinal == 0 {
752                return Ok(());
753            }
754            depth.increment()?;
755            let envelope_size = 8;
756            let bytes_len = max_ordinal as usize * envelope_size;
757            #[allow(unused_variables)]
758            let offset = encoder.out_of_line_offset(bytes_len);
759            let mut _prev_end_offset: usize = 0;
760            if 1 > max_ordinal {
761                return Ok(());
762            }
763
764            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
765            // are envelope_size bytes.
766            let cur_offset: usize = (1 - 1) * envelope_size;
767
768            // Zero reserved fields.
769            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
770
771            // Safety:
772            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
773            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
774            //   envelope_size bytes, there is always sufficient room.
775            fidl::encoding::encode_in_envelope_optional::<
776                fidl::encoding::HandleType<
777                    fidl::EventPair,
778                    { fidl::ObjectType::EVENTPAIR.into_raw() },
779                    2147483648,
780                >,
781                fidl::encoding::DefaultFuchsiaResourceDialect,
782            >(
783                self.component_input.as_mut().map(
784                    <fidl::encoding::HandleType<
785                        fidl::EventPair,
786                        { fidl::ObjectType::EVENTPAIR.into_raw() },
787                        2147483648,
788                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
789                ),
790                encoder,
791                offset + cur_offset,
792                depth,
793            )?;
794
795            _prev_end_offset = cur_offset + envelope_size;
796            if 2 > max_ordinal {
797                return Ok(());
798            }
799
800            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
801            // are envelope_size bytes.
802            let cur_offset: usize = (2 - 1) * envelope_size;
803
804            // Zero reserved fields.
805            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
806
807            // Safety:
808            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
809            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
810            //   envelope_size bytes, there is always sufficient room.
811            fidl::encoding::encode_in_envelope_optional::<
812                fidl::encoding::HandleType<
813                    fidl::EventPair,
814                    { fidl::ObjectType::EVENTPAIR.into_raw() },
815                    2147483648,
816                >,
817                fidl::encoding::DefaultFuchsiaResourceDialect,
818            >(
819                self.component_output.as_mut().map(
820                    <fidl::encoding::HandleType<
821                        fidl::EventPair,
822                        { fidl::ObjectType::EVENTPAIR.into_raw() },
823                        2147483648,
824                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
825                ),
826                encoder,
827                offset + cur_offset,
828                depth,
829            )?;
830
831            _prev_end_offset = cur_offset + envelope_size;
832            if 3 > max_ordinal {
833                return Ok(());
834            }
835
836            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
837            // are envelope_size bytes.
838            let cur_offset: usize = (3 - 1) * envelope_size;
839
840            // Zero reserved fields.
841            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
842
843            // Safety:
844            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
845            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
846            //   envelope_size bytes, there is always sufficient room.
847            fidl::encoding::encode_in_envelope_optional::<
848                fidl::encoding::HandleType<
849                    fidl::EventPair,
850                    { fidl::ObjectType::EVENTPAIR.into_raw() },
851                    2147483648,
852                >,
853                fidl::encoding::DefaultFuchsiaResourceDialect,
854            >(
855                self.program_input.as_mut().map(
856                    <fidl::encoding::HandleType<
857                        fidl::EventPair,
858                        { fidl::ObjectType::EVENTPAIR.into_raw() },
859                        2147483648,
860                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
861                ),
862                encoder,
863                offset + cur_offset,
864                depth,
865            )?;
866
867            _prev_end_offset = cur_offset + envelope_size;
868            if 4 > max_ordinal {
869                return Ok(());
870            }
871
872            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
873            // are envelope_size bytes.
874            let cur_offset: usize = (4 - 1) * envelope_size;
875
876            // Zero reserved fields.
877            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
878
879            // Safety:
880            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
881            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
882            //   envelope_size bytes, there is always sufficient room.
883            fidl::encoding::encode_in_envelope_optional::<
884                fidl::encoding::HandleType<
885                    fidl::EventPair,
886                    { fidl::ObjectType::EVENTPAIR.into_raw() },
887                    2147483648,
888                >,
889                fidl::encoding::DefaultFuchsiaResourceDialect,
890            >(
891                self.program_output.as_mut().map(
892                    <fidl::encoding::HandleType<
893                        fidl::EventPair,
894                        { fidl::ObjectType::EVENTPAIR.into_raw() },
895                        2147483648,
896                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
897                ),
898                encoder,
899                offset + cur_offset,
900                depth,
901            )?;
902
903            _prev_end_offset = cur_offset + envelope_size;
904            if 5 > max_ordinal {
905                return Ok(());
906            }
907
908            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
909            // are envelope_size bytes.
910            let cur_offset: usize = (5 - 1) * envelope_size;
911
912            // Zero reserved fields.
913            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
914
915            // Safety:
916            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
917            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
918            //   envelope_size bytes, there is always sufficient room.
919            fidl::encoding::encode_in_envelope_optional::<
920                fidl::encoding::HandleType<
921                    fidl::EventPair,
922                    { fidl::ObjectType::EVENTPAIR.into_raw() },
923                    2147483648,
924                >,
925                fidl::encoding::DefaultFuchsiaResourceDialect,
926            >(
927                self.reserved.as_mut().map(
928                    <fidl::encoding::HandleType<
929                        fidl::EventPair,
930                        { fidl::ObjectType::EVENTPAIR.into_raw() },
931                        2147483648,
932                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
933                ),
934                encoder,
935                offset + cur_offset,
936                depth,
937            )?;
938
939            _prev_end_offset = cur_offset + envelope_size;
940            if 6 > max_ordinal {
941                return Ok(());
942            }
943
944            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
945            // are envelope_size bytes.
946            let cur_offset: usize = (6 - 1) * envelope_size;
947
948            // Zero reserved fields.
949            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
950
951            // Safety:
952            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
953            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
954            //   envelope_size bytes, there is always sufficient room.
955            fidl::encoding::encode_in_envelope_optional::<
956                fidl::encoding::HandleType<
957                    fidl::EventPair,
958                    { fidl::ObjectType::EVENTPAIR.into_raw() },
959                    2147483648,
960                >,
961                fidl::encoding::DefaultFuchsiaResourceDialect,
962            >(
963                self.capability_sourced.as_mut().map(
964                    <fidl::encoding::HandleType<
965                        fidl::EventPair,
966                        { fidl::ObjectType::EVENTPAIR.into_raw() },
967                        2147483648,
968                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
969                ),
970                encoder,
971                offset + cur_offset,
972                depth,
973            )?;
974
975            _prev_end_offset = cur_offset + envelope_size;
976            if 7 > max_ordinal {
977                return Ok(());
978            }
979
980            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
981            // are envelope_size bytes.
982            let cur_offset: usize = (7 - 1) * envelope_size;
983
984            // Zero reserved fields.
985            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
986
987            // Safety:
988            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
989            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
990            //   envelope_size bytes, there is always sufficient room.
991            fidl::encoding::encode_in_envelope_optional::<
992                fidl::encoding::HandleType<
993                    fidl::EventPair,
994                    { fidl::ObjectType::EVENTPAIR.into_raw() },
995                    2147483648,
996                >,
997                fidl::encoding::DefaultFuchsiaResourceDialect,
998            >(
999                self.declared_dictionaries.as_mut().map(
1000                    <fidl::encoding::HandleType<
1001                        fidl::EventPair,
1002                        { fidl::ObjectType::EVENTPAIR.into_raw() },
1003                        2147483648,
1004                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1005                ),
1006                encoder,
1007                offset + cur_offset,
1008                depth,
1009            )?;
1010
1011            _prev_end_offset = cur_offset + envelope_size;
1012            if 8 > max_ordinal {
1013                return Ok(());
1014            }
1015
1016            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1017            // are envelope_size bytes.
1018            let cur_offset: usize = (8 - 1) * envelope_size;
1019
1020            // Zero reserved fields.
1021            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1022
1023            // Safety:
1024            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1025            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1026            //   envelope_size bytes, there is always sufficient room.
1027            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ChildInput>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1028            self.child_inputs.as_mut().map(<fidl::encoding::UnboundedVector<ChildInput> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1029            encoder, offset + cur_offset, depth
1030        )?;
1031
1032            _prev_end_offset = cur_offset + envelope_size;
1033            if 9 > max_ordinal {
1034                return Ok(());
1035            }
1036
1037            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1038            // are envelope_size bytes.
1039            let cur_offset: usize = (9 - 1) * envelope_size;
1040
1041            // Zero reserved fields.
1042            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1043
1044            // Safety:
1045            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1046            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1047            //   envelope_size bytes, there is always sufficient room.
1048            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ChildInput>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1049            self.collection_inputs.as_mut().map(<fidl::encoding::UnboundedVector<ChildInput> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1050            encoder, offset + cur_offset, depth
1051        )?;
1052
1053            _prev_end_offset = cur_offset + envelope_size;
1054
1055            Ok(())
1056        }
1057    }
1058
1059    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1060        for ComponentSandbox
1061    {
1062        #[inline(always)]
1063        fn new_empty() -> Self {
1064            Self::default()
1065        }
1066
1067        unsafe fn decode(
1068            &mut self,
1069            decoder: &mut fidl::encoding::Decoder<
1070                '_,
1071                fidl::encoding::DefaultFuchsiaResourceDialect,
1072            >,
1073            offset: usize,
1074            mut depth: fidl::encoding::Depth,
1075        ) -> fidl::Result<()> {
1076            decoder.debug_check_bounds::<Self>(offset);
1077            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1078                None => return Err(fidl::Error::NotNullable),
1079                Some(len) => len,
1080            };
1081            // Calling decoder.out_of_line_offset(0) is not allowed.
1082            if len == 0 {
1083                return Ok(());
1084            };
1085            depth.increment()?;
1086            let envelope_size = 8;
1087            let bytes_len = len * envelope_size;
1088            let offset = decoder.out_of_line_offset(bytes_len)?;
1089            // Decode the envelope for each type.
1090            let mut _next_ordinal_to_read = 0;
1091            let mut next_offset = offset;
1092            let end_offset = offset + bytes_len;
1093            _next_ordinal_to_read += 1;
1094            if next_offset >= end_offset {
1095                return Ok(());
1096            }
1097
1098            // Decode unknown envelopes for gaps in ordinals.
1099            while _next_ordinal_to_read < 1 {
1100                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1101                _next_ordinal_to_read += 1;
1102                next_offset += envelope_size;
1103            }
1104
1105            let next_out_of_line = decoder.next_out_of_line();
1106            let handles_before = decoder.remaining_handles();
1107            if let Some((inlined, num_bytes, num_handles)) =
1108                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1109            {
1110                let member_inline_size = <fidl::encoding::HandleType<
1111                    fidl::EventPair,
1112                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1113                    2147483648,
1114                > as fidl::encoding::TypeMarker>::inline_size(
1115                    decoder.context
1116                );
1117                if inlined != (member_inline_size <= 4) {
1118                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1119                }
1120                let inner_offset;
1121                let mut inner_depth = depth.clone();
1122                if inlined {
1123                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1124                    inner_offset = next_offset;
1125                } else {
1126                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1127                    inner_depth.increment()?;
1128                }
1129                let val_ref =
1130                self.component_input.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1131                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1132                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1133                {
1134                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1135                }
1136                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1137                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1138                }
1139            }
1140
1141            next_offset += envelope_size;
1142            _next_ordinal_to_read += 1;
1143            if next_offset >= end_offset {
1144                return Ok(());
1145            }
1146
1147            // Decode unknown envelopes for gaps in ordinals.
1148            while _next_ordinal_to_read < 2 {
1149                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1150                _next_ordinal_to_read += 1;
1151                next_offset += envelope_size;
1152            }
1153
1154            let next_out_of_line = decoder.next_out_of_line();
1155            let handles_before = decoder.remaining_handles();
1156            if let Some((inlined, num_bytes, num_handles)) =
1157                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1158            {
1159                let member_inline_size = <fidl::encoding::HandleType<
1160                    fidl::EventPair,
1161                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1162                    2147483648,
1163                > as fidl::encoding::TypeMarker>::inline_size(
1164                    decoder.context
1165                );
1166                if inlined != (member_inline_size <= 4) {
1167                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1168                }
1169                let inner_offset;
1170                let mut inner_depth = depth.clone();
1171                if inlined {
1172                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1173                    inner_offset = next_offset;
1174                } else {
1175                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1176                    inner_depth.increment()?;
1177                }
1178                let val_ref =
1179                self.component_output.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1180                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1181                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1182                {
1183                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1184                }
1185                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1186                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1187                }
1188            }
1189
1190            next_offset += envelope_size;
1191            _next_ordinal_to_read += 1;
1192            if next_offset >= end_offset {
1193                return Ok(());
1194            }
1195
1196            // Decode unknown envelopes for gaps in ordinals.
1197            while _next_ordinal_to_read < 3 {
1198                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1199                _next_ordinal_to_read += 1;
1200                next_offset += envelope_size;
1201            }
1202
1203            let next_out_of_line = decoder.next_out_of_line();
1204            let handles_before = decoder.remaining_handles();
1205            if let Some((inlined, num_bytes, num_handles)) =
1206                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1207            {
1208                let member_inline_size = <fidl::encoding::HandleType<
1209                    fidl::EventPair,
1210                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1211                    2147483648,
1212                > as fidl::encoding::TypeMarker>::inline_size(
1213                    decoder.context
1214                );
1215                if inlined != (member_inline_size <= 4) {
1216                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1217                }
1218                let inner_offset;
1219                let mut inner_depth = depth.clone();
1220                if inlined {
1221                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1222                    inner_offset = next_offset;
1223                } else {
1224                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1225                    inner_depth.increment()?;
1226                }
1227                let val_ref =
1228                self.program_input.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1229                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1230                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1231                {
1232                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1233                }
1234                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1235                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1236                }
1237            }
1238
1239            next_offset += envelope_size;
1240            _next_ordinal_to_read += 1;
1241            if next_offset >= end_offset {
1242                return Ok(());
1243            }
1244
1245            // Decode unknown envelopes for gaps in ordinals.
1246            while _next_ordinal_to_read < 4 {
1247                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1248                _next_ordinal_to_read += 1;
1249                next_offset += envelope_size;
1250            }
1251
1252            let next_out_of_line = decoder.next_out_of_line();
1253            let handles_before = decoder.remaining_handles();
1254            if let Some((inlined, num_bytes, num_handles)) =
1255                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1256            {
1257                let member_inline_size = <fidl::encoding::HandleType<
1258                    fidl::EventPair,
1259                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1260                    2147483648,
1261                > as fidl::encoding::TypeMarker>::inline_size(
1262                    decoder.context
1263                );
1264                if inlined != (member_inline_size <= 4) {
1265                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1266                }
1267                let inner_offset;
1268                let mut inner_depth = depth.clone();
1269                if inlined {
1270                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1271                    inner_offset = next_offset;
1272                } else {
1273                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1274                    inner_depth.increment()?;
1275                }
1276                let val_ref =
1277                self.program_output.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1278                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1279                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1280                {
1281                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1282                }
1283                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1284                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1285                }
1286            }
1287
1288            next_offset += envelope_size;
1289            _next_ordinal_to_read += 1;
1290            if next_offset >= end_offset {
1291                return Ok(());
1292            }
1293
1294            // Decode unknown envelopes for gaps in ordinals.
1295            while _next_ordinal_to_read < 5 {
1296                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1297                _next_ordinal_to_read += 1;
1298                next_offset += envelope_size;
1299            }
1300
1301            let next_out_of_line = decoder.next_out_of_line();
1302            let handles_before = decoder.remaining_handles();
1303            if let Some((inlined, num_bytes, num_handles)) =
1304                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1305            {
1306                let member_inline_size = <fidl::encoding::HandleType<
1307                    fidl::EventPair,
1308                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1309                    2147483648,
1310                > as fidl::encoding::TypeMarker>::inline_size(
1311                    decoder.context
1312                );
1313                if inlined != (member_inline_size <= 4) {
1314                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1315                }
1316                let inner_offset;
1317                let mut inner_depth = depth.clone();
1318                if inlined {
1319                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1320                    inner_offset = next_offset;
1321                } else {
1322                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1323                    inner_depth.increment()?;
1324                }
1325                let val_ref =
1326                self.reserved.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1327                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1328                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1329                {
1330                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1331                }
1332                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1333                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1334                }
1335            }
1336
1337            next_offset += envelope_size;
1338            _next_ordinal_to_read += 1;
1339            if next_offset >= end_offset {
1340                return Ok(());
1341            }
1342
1343            // Decode unknown envelopes for gaps in ordinals.
1344            while _next_ordinal_to_read < 6 {
1345                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1346                _next_ordinal_to_read += 1;
1347                next_offset += envelope_size;
1348            }
1349
1350            let next_out_of_line = decoder.next_out_of_line();
1351            let handles_before = decoder.remaining_handles();
1352            if let Some((inlined, num_bytes, num_handles)) =
1353                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1354            {
1355                let member_inline_size = <fidl::encoding::HandleType<
1356                    fidl::EventPair,
1357                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1358                    2147483648,
1359                > as fidl::encoding::TypeMarker>::inline_size(
1360                    decoder.context
1361                );
1362                if inlined != (member_inline_size <= 4) {
1363                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1364                }
1365                let inner_offset;
1366                let mut inner_depth = depth.clone();
1367                if inlined {
1368                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1369                    inner_offset = next_offset;
1370                } else {
1371                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1372                    inner_depth.increment()?;
1373                }
1374                let val_ref =
1375                self.capability_sourced.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1376                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1377                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1378                {
1379                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1380                }
1381                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1382                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1383                }
1384            }
1385
1386            next_offset += envelope_size;
1387            _next_ordinal_to_read += 1;
1388            if next_offset >= end_offset {
1389                return Ok(());
1390            }
1391
1392            // Decode unknown envelopes for gaps in ordinals.
1393            while _next_ordinal_to_read < 7 {
1394                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1395                _next_ordinal_to_read += 1;
1396                next_offset += envelope_size;
1397            }
1398
1399            let next_out_of_line = decoder.next_out_of_line();
1400            let handles_before = decoder.remaining_handles();
1401            if let Some((inlined, num_bytes, num_handles)) =
1402                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1403            {
1404                let member_inline_size = <fidl::encoding::HandleType<
1405                    fidl::EventPair,
1406                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1407                    2147483648,
1408                > as fidl::encoding::TypeMarker>::inline_size(
1409                    decoder.context
1410                );
1411                if inlined != (member_inline_size <= 4) {
1412                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1413                }
1414                let inner_offset;
1415                let mut inner_depth = depth.clone();
1416                if inlined {
1417                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1418                    inner_offset = next_offset;
1419                } else {
1420                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1421                    inner_depth.increment()?;
1422                }
1423                let val_ref =
1424                self.declared_dictionaries.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1425                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1426                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1427                {
1428                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1429                }
1430                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1431                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1432                }
1433            }
1434
1435            next_offset += envelope_size;
1436            _next_ordinal_to_read += 1;
1437            if next_offset >= end_offset {
1438                return Ok(());
1439            }
1440
1441            // Decode unknown envelopes for gaps in ordinals.
1442            while _next_ordinal_to_read < 8 {
1443                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1444                _next_ordinal_to_read += 1;
1445                next_offset += envelope_size;
1446            }
1447
1448            let next_out_of_line = decoder.next_out_of_line();
1449            let handles_before = decoder.remaining_handles();
1450            if let Some((inlined, num_bytes, num_handles)) =
1451                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1452            {
1453                let member_inline_size = <fidl::encoding::UnboundedVector<ChildInput> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1454                if inlined != (member_inline_size <= 4) {
1455                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1456                }
1457                let inner_offset;
1458                let mut inner_depth = depth.clone();
1459                if inlined {
1460                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1461                    inner_offset = next_offset;
1462                } else {
1463                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1464                    inner_depth.increment()?;
1465                }
1466                let val_ref = self.child_inputs.get_or_insert_with(|| {
1467                    fidl::new_empty!(
1468                        fidl::encoding::UnboundedVector<ChildInput>,
1469                        fidl::encoding::DefaultFuchsiaResourceDialect
1470                    )
1471                });
1472                fidl::decode!(
1473                    fidl::encoding::UnboundedVector<ChildInput>,
1474                    fidl::encoding::DefaultFuchsiaResourceDialect,
1475                    val_ref,
1476                    decoder,
1477                    inner_offset,
1478                    inner_depth
1479                )?;
1480                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1481                {
1482                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1483                }
1484                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1485                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1486                }
1487            }
1488
1489            next_offset += envelope_size;
1490            _next_ordinal_to_read += 1;
1491            if next_offset >= end_offset {
1492                return Ok(());
1493            }
1494
1495            // Decode unknown envelopes for gaps in ordinals.
1496            while _next_ordinal_to_read < 9 {
1497                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1498                _next_ordinal_to_read += 1;
1499                next_offset += envelope_size;
1500            }
1501
1502            let next_out_of_line = decoder.next_out_of_line();
1503            let handles_before = decoder.remaining_handles();
1504            if let Some((inlined, num_bytes, num_handles)) =
1505                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1506            {
1507                let member_inline_size = <fidl::encoding::UnboundedVector<ChildInput> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1508                if inlined != (member_inline_size <= 4) {
1509                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1510                }
1511                let inner_offset;
1512                let mut inner_depth = depth.clone();
1513                if inlined {
1514                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1515                    inner_offset = next_offset;
1516                } else {
1517                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1518                    inner_depth.increment()?;
1519                }
1520                let val_ref = self.collection_inputs.get_or_insert_with(|| {
1521                    fidl::new_empty!(
1522                        fidl::encoding::UnboundedVector<ChildInput>,
1523                        fidl::encoding::DefaultFuchsiaResourceDialect
1524                    )
1525                });
1526                fidl::decode!(
1527                    fidl::encoding::UnboundedVector<ChildInput>,
1528                    fidl::encoding::DefaultFuchsiaResourceDialect,
1529                    val_ref,
1530                    decoder,
1531                    inner_offset,
1532                    inner_depth
1533                )?;
1534                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1535                {
1536                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1537                }
1538                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1539                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1540                }
1541            }
1542
1543            next_offset += envelope_size;
1544
1545            // Decode the remaining unknown envelopes.
1546            while next_offset < end_offset {
1547                _next_ordinal_to_read += 1;
1548                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1549                next_offset += envelope_size;
1550            }
1551
1552            Ok(())
1553        }
1554    }
1555}