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