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