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