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, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ControllerOpenExposedDirRequest {
16    pub exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for ControllerOpenExposedDirRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct ControllerStartRequest {
26    pub args: StartChildArgs,
27    pub execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerStartRequest {}
31
32#[derive(Debug, PartialEq)]
33pub struct ControllerGetExposedDictionaryResponse {
34    pub dictionary: fidl_fuchsia_component_sandbox::DictionaryRef,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
38    for ControllerGetExposedDictionaryResponse
39{
40}
41
42#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
43pub struct ControllerIsStartedResponse {
44    pub is_started: bool,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
48    for ControllerIsStartedResponse
49{
50}
51
52#[derive(Debug, PartialEq)]
53pub struct EventStreamGetNextResponse {
54    pub events: Vec<Event>,
55}
56
57impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
58    for EventStreamGetNextResponse
59{
60}
61
62#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
63pub struct IntrospectorGetMonikerRequest {
64    pub component_instance: fidl::Event,
65}
66
67impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
68    for IntrospectorGetMonikerRequest
69{
70}
71
72#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
73pub struct NamespaceCreateRequest {
74    pub entries: Vec<NamespaceInputEntry>,
75}
76
77impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceCreateRequest {}
78
79#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
80pub struct NamespaceInputEntry {
81    pub path: String,
82    pub dictionary: fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
83}
84
85impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceInputEntry {}
86
87#[derive(Debug, PartialEq)]
88pub struct NamespaceCreateResponse {
89    pub entries: Vec<NamespaceEntry>,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceCreateResponse {}
93
94#[derive(Debug, PartialEq)]
95pub struct RealmCreateChildRequest {
96    pub collection: fidl_fuchsia_component_decl::CollectionRef,
97    pub decl: fidl_fuchsia_component_decl::Child,
98    pub args: CreateChildArgs,
99}
100
101impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmCreateChildRequest {}
102
103#[derive(Debug, PartialEq)]
104pub struct RealmGetChildOutputDictionaryRequest {
105    pub child: fidl_fuchsia_component_decl::ChildRef,
106}
107
108impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
109    for RealmGetChildOutputDictionaryRequest
110{
111}
112
113#[derive(Debug, PartialEq)]
114pub struct RealmListChildrenRequest {
115    pub collection: fidl_fuchsia_component_decl::CollectionRef,
116    pub iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
117}
118
119impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmListChildrenRequest {}
120
121#[derive(Debug, PartialEq)]
122pub struct RealmOpenControllerRequest {
123    pub child: fidl_fuchsia_component_decl::ChildRef,
124    pub controller: fidl::endpoints::ServerEnd<ControllerMarker>,
125}
126
127impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
128    for RealmOpenControllerRequest
129{
130}
131
132#[derive(Debug, PartialEq)]
133pub struct RealmOpenExposedDirRequest {
134    pub child: fidl_fuchsia_component_decl::ChildRef,
135    pub exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
136}
137
138impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
139    for RealmOpenExposedDirRequest
140{
141}
142
143#[derive(Debug, PartialEq)]
144pub struct RealmGetChildOutputDictionaryResponse {
145    pub dictionary: fidl_fuchsia_component_sandbox::DictionaryRef,
146}
147
148impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
149    for RealmGetChildOutputDictionaryResponse
150{
151}
152
153#[derive(Debug, PartialEq)]
154pub struct RealmGetResolvedInfoResponse {
155    pub resolved_info: fidl_fuchsia_component_resolution::Component,
156}
157
158impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
159    for RealmGetResolvedInfoResponse
160{
161}
162
163#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
164pub struct StorageAdminListStorageInRealmRequest {
165    pub relative_moniker: String,
166    pub iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
167}
168
169impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
170    for StorageAdminListStorageInRealmRequest
171{
172}
173
174#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
175pub struct StorageAdminOpenComponentStorageByIdRequest {
176    pub id: String,
177    pub object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
178}
179
180impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
181    for StorageAdminOpenComponentStorageByIdRequest
182{
183}
184
185#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
186pub struct StorageAdminOpenStorageRequest {
187    pub relative_moniker: String,
188    pub object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
189}
190
191impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
192    for StorageAdminOpenStorageRequest
193{
194}
195
196/// Payload for CapabilityRequested events
197#[derive(Debug, Default, PartialEq)]
198pub struct CapabilityRequestedPayload {
199    /// The name of the capability.
200    pub name: Option<String>,
201    /// A handle to the server end of the channel to host
202    /// capability.
203    pub capability: Option<fidl::Channel>,
204    #[doc(hidden)]
205    pub __source_breaking: fidl::marker::SourceBreaking,
206}
207
208impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
209    for CapabilityRequestedPayload
210{
211}
212
213#[derive(Debug, Default, PartialEq)]
214pub struct CreateChildArgs {
215    /// The numbered handles to pass to the component instance.
216    ///
217    /// If the runner for the component does not support the numbered handles it is
218    /// expected to close the handles.
219    pub numbered_handles: Option<Vec<fidl_fuchsia_process::HandleInfo>>,
220    /// Dynamic offers that will target the component instance.
221    ///
222    /// Including `OfferDecl`s in this vector will cause additional capabilities
223    /// to be offered to the newly created child, beyond the `OfferDecl`s in the
224    /// parent's `ComponentDecl` that target the collection.
225    ///
226    /// Any kind of offer (e.g., protocol, directory) can be used as a dynamic
227    /// offer. Any source that would be valid for a static offer is also valid
228    /// for a dynamic offer. Additionally, unlike static offers, dynamic offers
229    /// can use a "sibling" dynamic child component as a source by setting the
230    /// source to a `ChildRef` that sets the `collection` field.
231    ///
232    /// Dynamic offers always target the newly created child component. As a
233    /// result, `OfferDecl`s in `dynamic_offers` must not set the `target`
234    /// field, as its value is implied.
235    ///
236    /// If either the source (that is, the component named in the `source` field
237    /// of the `OfferDecl`) or the target of a dynamic offer is destroyed, the
238    /// offer itself is destroyed simultaneously.
239    ///
240    /// In order to set this field to a non-empty value, the collection in which
241    /// the child component is being created must specify
242    /// `ComponentDecl.allowed_offers = STATIC_AND_DYNAMIC`.
243    pub dynamic_offers: Option<Vec<fidl_fuchsia_component_decl::Offer>>,
244    /// The controller for this component, which may be used to influence the
245    /// component's lifecycle.
246    pub controller: Option<fidl::endpoints::ServerEnd<ControllerMarker>>,
247    /// A dictionary that contains extra capabilities for the component instance.
248    pub dictionary: Option<fidl_fuchsia_component_sandbox::DictionaryRef>,
249    #[doc(hidden)]
250    pub __source_breaking: fidl::marker::SourceBreaking,
251}
252
253impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateChildArgs {}
254
255/// Payload for DebugStarted events.
256#[derive(Debug, Default, PartialEq)]
257pub struct DebugStartedPayload {
258    /// The directory served by the runner to present runtime and runner-specific information
259    /// about the component. The other side is sent to the runner in ComponentStartInfo.
260    /// For example, it can be queried to know whether the component is an ELF component and
261    /// supports the break_on_start protocol below.
262    pub runtime_dir: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
263    /// An eventpair that can be used by debuggers to defer the launch of the component,
264    /// e.g., ELF debuggers can setup the exception channel on the job while holding
265    /// the eventpair, then drop the eventpair to notify the runner that processes could
266    /// be created. The other side is sent to the runner in ComponentStartInfo.
267    pub break_on_start: Option<fidl::EventPair>,
268    #[doc(hidden)]
269    pub __source_breaking: fidl::marker::SourceBreaking,
270}
271
272impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DebugStartedPayload {}
273
274/// Contains all information about a single event
275#[derive(Debug, Default, PartialEq)]
276pub struct Event {
277    /// Information about the component for which this event was generated.
278    pub header: Option<EventHeader>,
279    /// Optional payload for some event types
280    pub payload: Option<EventPayload>,
281    #[doc(hidden)]
282    pub __source_breaking: fidl::marker::SourceBreaking,
283}
284
285impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Event {}
286
287/// A single component namespace entry, which describes a namespace mount point
288/// (`path`) and the directory backing it (`directory`). This type is usually
289/// composed inside a vector.  See `ComponentStartInfo.ns` for more details.
290#[derive(Debug, Default, PartialEq)]
291pub struct NamespaceEntry {
292    /// The mount point for the directory, including a
293    /// leading slash. For example: "/pkg", "/svc", or "/config/data".
294    pub path: Option<String>,
295    /// The directory mounted at the above `path`.
296    pub directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
297    #[doc(hidden)]
298    pub __source_breaking: fidl::marker::SourceBreaking,
299}
300
301impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceEntry {}
302
303#[derive(Debug, Default, PartialEq)]
304pub struct StartChildArgs {
305    /// The numbered handles to pass to the component instance.
306    ///
307    /// If the runner for the component does not support the numbered handles it
308    /// is expected to close the handles.
309    ///
310    /// If set, the values given here will override the handles given in
311    /// CreateChildArgs.
312    pub numbered_handles: Option<Vec<fidl_fuchsia_process::HandleInfo>>,
313    /// The namespace generated by component manager will be extended to include
314    /// any namespace entries listed here before being given to the component's
315    /// runner.
316    ///
317    /// If there are any conflicting entries, an error will occur when starting
318    /// the component.
319    pub namespace_entries: Option<Vec<NamespaceEntry>>,
320    /// A dictionary that contains extra capabilities for the component instance.
321    pub dictionary: Option<fidl_fuchsia_component_sandbox::DictionaryRef>,
322    #[doc(hidden)]
323    pub __source_breaking: fidl::marker::SourceBreaking,
324}
325
326impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StartChildArgs {}
327
328/// Encapsulates additional data/protocols for some event types.
329#[derive(Debug)]
330pub enum EventPayload {
331    /// Payload for CapabilityRequested events
332    CapabilityRequested(CapabilityRequestedPayload),
333    /// Payload for Purged events.
334    Purged(PurgedPayload),
335    /// Payload for Discovered events.
336    Discovered(DiscoveredPayload),
337    /// Payload for Destroyed events.
338    Destroyed(DestroyedPayload),
339    /// Payload for Resolved events
340    Resolved(ResolvedPayload),
341    /// Payload for Started events
342    Started(StartedPayload),
343    /// Payload for Stopped events
344    Stopped(StoppedPayload),
345    /// Payload for DebugStarted events
346    DebugStarted(DebugStartedPayload),
347    /// Payload for Unresolved events
348    Unresolved(UnresolvedPayload),
349    #[doc(hidden)]
350    __SourceBreaking { unknown_ordinal: u64 },
351}
352
353/// Pattern that matches an unknown `EventPayload` member.
354#[macro_export]
355macro_rules! EventPayloadUnknown {
356    () => {
357        _
358    };
359}
360
361// Custom PartialEq so that unknown variants are not equal to themselves.
362impl PartialEq for EventPayload {
363    fn eq(&self, other: &Self) -> bool {
364        match (self, other) {
365            (Self::CapabilityRequested(x), Self::CapabilityRequested(y)) => *x == *y,
366            (Self::Purged(x), Self::Purged(y)) => *x == *y,
367            (Self::Discovered(x), Self::Discovered(y)) => *x == *y,
368            (Self::Destroyed(x), Self::Destroyed(y)) => *x == *y,
369            (Self::Resolved(x), Self::Resolved(y)) => *x == *y,
370            (Self::Started(x), Self::Started(y)) => *x == *y,
371            (Self::Stopped(x), Self::Stopped(y)) => *x == *y,
372            (Self::DebugStarted(x), Self::DebugStarted(y)) => *x == *y,
373            (Self::Unresolved(x), Self::Unresolved(y)) => *x == *y,
374            _ => false,
375        }
376    }
377}
378
379impl EventPayload {
380    #[inline]
381    pub fn ordinal(&self) -> u64 {
382        match *self {
383            Self::CapabilityRequested(_) => 1,
384            Self::Purged(_) => 2,
385            Self::Discovered(_) => 4,
386            Self::Destroyed(_) => 5,
387            Self::Resolved(_) => 6,
388            Self::Started(_) => 7,
389            Self::Stopped(_) => 8,
390            Self::DebugStarted(_) => 9,
391            Self::Unresolved(_) => 10,
392            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
393        }
394    }
395
396    #[inline]
397    pub fn unknown_variant_for_testing() -> Self {
398        Self::__SourceBreaking { unknown_ordinal: 0 }
399    }
400
401    #[inline]
402    pub fn is_unknown(&self) -> bool {
403        match self {
404            Self::__SourceBreaking { .. } => true,
405            _ => false,
406        }
407    }
408}
409
410impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EventPayload {}
411
412#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
413pub struct BinderMarker;
414
415impl fidl::endpoints::ProtocolMarker for BinderMarker {
416    type Proxy = BinderProxy;
417    type RequestStream = BinderRequestStream;
418    #[cfg(target_os = "fuchsia")]
419    type SynchronousProxy = BinderSynchronousProxy;
420
421    const DEBUG_NAME: &'static str = "fuchsia.component.Binder";
422}
423impl fidl::endpoints::DiscoverableProtocolMarker for BinderMarker {}
424
425pub trait BinderProxyInterface: Send + Sync {}
426#[derive(Debug)]
427#[cfg(target_os = "fuchsia")]
428pub struct BinderSynchronousProxy {
429    client: fidl::client::sync::Client,
430}
431
432#[cfg(target_os = "fuchsia")]
433impl fidl::endpoints::SynchronousProxy for BinderSynchronousProxy {
434    type Proxy = BinderProxy;
435    type Protocol = BinderMarker;
436
437    fn from_channel(inner: fidl::Channel) -> Self {
438        Self::new(inner)
439    }
440
441    fn into_channel(self) -> fidl::Channel {
442        self.client.into_channel()
443    }
444
445    fn as_channel(&self) -> &fidl::Channel {
446        self.client.as_channel()
447    }
448}
449
450#[cfg(target_os = "fuchsia")]
451impl BinderSynchronousProxy {
452    pub fn new(channel: fidl::Channel) -> Self {
453        let protocol_name = <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
454        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
455    }
456
457    pub fn into_channel(self) -> fidl::Channel {
458        self.client.into_channel()
459    }
460
461    /// Waits until an event arrives and returns it. It is safe for other
462    /// threads to make concurrent requests while waiting for an event.
463    pub fn wait_for_event(
464        &self,
465        deadline: zx::MonotonicInstant,
466    ) -> Result<BinderEvent, fidl::Error> {
467        BinderEvent::decode(self.client.wait_for_event(deadline)?)
468    }
469}
470
471#[cfg(target_os = "fuchsia")]
472impl From<BinderSynchronousProxy> for zx::NullableHandle {
473    fn from(value: BinderSynchronousProxy) -> Self {
474        value.into_channel().into()
475    }
476}
477
478#[cfg(target_os = "fuchsia")]
479impl From<fidl::Channel> for BinderSynchronousProxy {
480    fn from(value: fidl::Channel) -> Self {
481        Self::new(value)
482    }
483}
484
485#[cfg(target_os = "fuchsia")]
486impl fidl::endpoints::FromClient for BinderSynchronousProxy {
487    type Protocol = BinderMarker;
488
489    fn from_client(value: fidl::endpoints::ClientEnd<BinderMarker>) -> Self {
490        Self::new(value.into_channel())
491    }
492}
493
494#[derive(Debug, Clone)]
495pub struct BinderProxy {
496    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
497}
498
499impl fidl::endpoints::Proxy for BinderProxy {
500    type Protocol = BinderMarker;
501
502    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
503        Self::new(inner)
504    }
505
506    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
507        self.client.into_channel().map_err(|client| Self { client })
508    }
509
510    fn as_channel(&self) -> &::fidl::AsyncChannel {
511        self.client.as_channel()
512    }
513}
514
515impl BinderProxy {
516    /// Create a new Proxy for fuchsia.component/Binder.
517    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
518        let protocol_name = <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
519        Self { client: fidl::client::Client::new(channel, protocol_name) }
520    }
521
522    /// Get a Stream of events from the remote end of the protocol.
523    ///
524    /// # Panics
525    ///
526    /// Panics if the event stream was already taken.
527    pub fn take_event_stream(&self) -> BinderEventStream {
528        BinderEventStream { event_receiver: self.client.take_event_receiver() }
529    }
530}
531
532impl BinderProxyInterface for BinderProxy {}
533
534pub struct BinderEventStream {
535    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
536}
537
538impl std::marker::Unpin for BinderEventStream {}
539
540impl futures::stream::FusedStream for BinderEventStream {
541    fn is_terminated(&self) -> bool {
542        self.event_receiver.is_terminated()
543    }
544}
545
546impl futures::Stream for BinderEventStream {
547    type Item = Result<BinderEvent, fidl::Error>;
548
549    fn poll_next(
550        mut self: std::pin::Pin<&mut Self>,
551        cx: &mut std::task::Context<'_>,
552    ) -> std::task::Poll<Option<Self::Item>> {
553        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
554            &mut self.event_receiver,
555            cx
556        )?) {
557            Some(buf) => std::task::Poll::Ready(Some(BinderEvent::decode(buf))),
558            None => std::task::Poll::Ready(None),
559        }
560    }
561}
562
563#[derive(Debug)]
564pub enum BinderEvent {}
565
566impl BinderEvent {
567    /// Decodes a message buffer as a [`BinderEvent`].
568    fn decode(
569        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
570    ) -> Result<BinderEvent, fidl::Error> {
571        let (bytes, _handles) = buf.split_mut();
572        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
573        debug_assert_eq!(tx_header.tx_id, 0);
574        match tx_header.ordinal {
575            _ => Err(fidl::Error::UnknownOrdinal {
576                ordinal: tx_header.ordinal,
577                protocol_name: <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
578            }),
579        }
580    }
581}
582
583/// A Stream of incoming requests for fuchsia.component/Binder.
584pub struct BinderRequestStream {
585    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
586    is_terminated: bool,
587}
588
589impl std::marker::Unpin for BinderRequestStream {}
590
591impl futures::stream::FusedStream for BinderRequestStream {
592    fn is_terminated(&self) -> bool {
593        self.is_terminated
594    }
595}
596
597impl fidl::endpoints::RequestStream for BinderRequestStream {
598    type Protocol = BinderMarker;
599    type ControlHandle = BinderControlHandle;
600
601    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
602        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
603    }
604
605    fn control_handle(&self) -> Self::ControlHandle {
606        BinderControlHandle { inner: self.inner.clone() }
607    }
608
609    fn into_inner(
610        self,
611    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
612    {
613        (self.inner, self.is_terminated)
614    }
615
616    fn from_inner(
617        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
618        is_terminated: bool,
619    ) -> Self {
620        Self { inner, is_terminated }
621    }
622}
623
624impl futures::Stream for BinderRequestStream {
625    type Item = Result<BinderRequest, fidl::Error>;
626
627    fn poll_next(
628        mut self: std::pin::Pin<&mut Self>,
629        cx: &mut std::task::Context<'_>,
630    ) -> std::task::Poll<Option<Self::Item>> {
631        let this = &mut *self;
632        if this.inner.check_shutdown(cx) {
633            this.is_terminated = true;
634            return std::task::Poll::Ready(None);
635        }
636        if this.is_terminated {
637            panic!("polled BinderRequestStream after completion");
638        }
639        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
640            |bytes, handles| {
641                match this.inner.channel().read_etc(cx, bytes, handles) {
642                    std::task::Poll::Ready(Ok(())) => {}
643                    std::task::Poll::Pending => return std::task::Poll::Pending,
644                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
645                        this.is_terminated = true;
646                        return std::task::Poll::Ready(None);
647                    }
648                    std::task::Poll::Ready(Err(e)) => {
649                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
650                            e.into(),
651                        ))));
652                    }
653                }
654
655                // A message has been received from the channel
656                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
657
658                std::task::Poll::Ready(Some(match header.ordinal {
659                    _ => Err(fidl::Error::UnknownOrdinal {
660                        ordinal: header.ordinal,
661                        protocol_name:
662                            <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
663                    }),
664                }))
665            },
666        )
667    }
668}
669
670/// A framework-provided protocol that allows components that use it to bind to
671/// the component that exposes it. The act of connecting to this protocol will
672/// trigger the bind. Thus, this protocol contains no methods. For more details
673/// on binding, see
674/// https://fuchsia.dev/fuchsia-src/concepts/components/v2/lifecycle#binding.
675///
676/// When a component connects to protocol, the component exposing this capability
677/// will be started if it's not already running. Upon a failure to start, the
678/// component framework will close the server end of the channel with a
679/// zx.Status epitaph.
680#[derive(Debug)]
681pub enum BinderRequest {}
682
683impl BinderRequest {
684    /// Name of the method defined in FIDL
685    pub fn method_name(&self) -> &'static str {
686        match *self {}
687    }
688}
689
690#[derive(Debug, Clone)]
691pub struct BinderControlHandle {
692    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
693}
694
695impl fidl::endpoints::ControlHandle for BinderControlHandle {
696    fn shutdown(&self) {
697        self.inner.shutdown()
698    }
699
700    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
701        self.inner.shutdown_with_epitaph(status)
702    }
703
704    fn is_closed(&self) -> bool {
705        self.inner.channel().is_closed()
706    }
707    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
708        self.inner.channel().on_closed()
709    }
710
711    #[cfg(target_os = "fuchsia")]
712    fn signal_peer(
713        &self,
714        clear_mask: zx::Signals,
715        set_mask: zx::Signals,
716    ) -> Result<(), zx_status::Status> {
717        use fidl::Peered;
718        self.inner.channel().signal_peer(clear_mask, set_mask)
719    }
720}
721
722impl BinderControlHandle {}
723
724#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
725pub struct ChildIteratorMarker;
726
727impl fidl::endpoints::ProtocolMarker for ChildIteratorMarker {
728    type Proxy = ChildIteratorProxy;
729    type RequestStream = ChildIteratorRequestStream;
730    #[cfg(target_os = "fuchsia")]
731    type SynchronousProxy = ChildIteratorSynchronousProxy;
732
733    const DEBUG_NAME: &'static str = "(anonymous) ChildIterator";
734}
735
736pub trait ChildIteratorProxyInterface: Send + Sync {
737    type NextResponseFut: std::future::Future<
738            Output = Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error>,
739        > + Send;
740    fn r#next(&self) -> Self::NextResponseFut;
741}
742#[derive(Debug)]
743#[cfg(target_os = "fuchsia")]
744pub struct ChildIteratorSynchronousProxy {
745    client: fidl::client::sync::Client,
746}
747
748#[cfg(target_os = "fuchsia")]
749impl fidl::endpoints::SynchronousProxy for ChildIteratorSynchronousProxy {
750    type Proxy = ChildIteratorProxy;
751    type Protocol = ChildIteratorMarker;
752
753    fn from_channel(inner: fidl::Channel) -> Self {
754        Self::new(inner)
755    }
756
757    fn into_channel(self) -> fidl::Channel {
758        self.client.into_channel()
759    }
760
761    fn as_channel(&self) -> &fidl::Channel {
762        self.client.as_channel()
763    }
764}
765
766#[cfg(target_os = "fuchsia")]
767impl ChildIteratorSynchronousProxy {
768    pub fn new(channel: fidl::Channel) -> Self {
769        let protocol_name = <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
770        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
771    }
772
773    pub fn into_channel(self) -> fidl::Channel {
774        self.client.into_channel()
775    }
776
777    /// Waits until an event arrives and returns it. It is safe for other
778    /// threads to make concurrent requests while waiting for an event.
779    pub fn wait_for_event(
780        &self,
781        deadline: zx::MonotonicInstant,
782    ) -> Result<ChildIteratorEvent, fidl::Error> {
783        ChildIteratorEvent::decode(self.client.wait_for_event(deadline)?)
784    }
785
786    /// Advance the iterator and return the next batch of children.
787    ///
788    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
789    /// no more children.
790    pub fn r#next(
791        &self,
792        ___deadline: zx::MonotonicInstant,
793    ) -> Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error> {
794        let _response =
795            self.client.send_query::<fidl::encoding::EmptyPayload, ChildIteratorNextResponse>(
796                (),
797                0x40e4c3882b050d08,
798                fidl::encoding::DynamicFlags::empty(),
799                ___deadline,
800            )?;
801        Ok(_response.children)
802    }
803}
804
805#[cfg(target_os = "fuchsia")]
806impl From<ChildIteratorSynchronousProxy> for zx::NullableHandle {
807    fn from(value: ChildIteratorSynchronousProxy) -> Self {
808        value.into_channel().into()
809    }
810}
811
812#[cfg(target_os = "fuchsia")]
813impl From<fidl::Channel> for ChildIteratorSynchronousProxy {
814    fn from(value: fidl::Channel) -> Self {
815        Self::new(value)
816    }
817}
818
819#[cfg(target_os = "fuchsia")]
820impl fidl::endpoints::FromClient for ChildIteratorSynchronousProxy {
821    type Protocol = ChildIteratorMarker;
822
823    fn from_client(value: fidl::endpoints::ClientEnd<ChildIteratorMarker>) -> Self {
824        Self::new(value.into_channel())
825    }
826}
827
828#[derive(Debug, Clone)]
829pub struct ChildIteratorProxy {
830    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
831}
832
833impl fidl::endpoints::Proxy for ChildIteratorProxy {
834    type Protocol = ChildIteratorMarker;
835
836    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
837        Self::new(inner)
838    }
839
840    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
841        self.client.into_channel().map_err(|client| Self { client })
842    }
843
844    fn as_channel(&self) -> &::fidl::AsyncChannel {
845        self.client.as_channel()
846    }
847}
848
849impl ChildIteratorProxy {
850    /// Create a new Proxy for fuchsia.component/ChildIterator.
851    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
852        let protocol_name = <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
853        Self { client: fidl::client::Client::new(channel, protocol_name) }
854    }
855
856    /// Get a Stream of events from the remote end of the protocol.
857    ///
858    /// # Panics
859    ///
860    /// Panics if the event stream was already taken.
861    pub fn take_event_stream(&self) -> ChildIteratorEventStream {
862        ChildIteratorEventStream { event_receiver: self.client.take_event_receiver() }
863    }
864
865    /// Advance the iterator and return the next batch of children.
866    ///
867    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
868    /// no more children.
869    pub fn r#next(
870        &self,
871    ) -> fidl::client::QueryResponseFut<
872        Vec<fidl_fuchsia_component_decl::ChildRef>,
873        fidl::encoding::DefaultFuchsiaResourceDialect,
874    > {
875        ChildIteratorProxyInterface::r#next(self)
876    }
877}
878
879impl ChildIteratorProxyInterface for ChildIteratorProxy {
880    type NextResponseFut = fidl::client::QueryResponseFut<
881        Vec<fidl_fuchsia_component_decl::ChildRef>,
882        fidl::encoding::DefaultFuchsiaResourceDialect,
883    >;
884    fn r#next(&self) -> Self::NextResponseFut {
885        fn _decode(
886            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
887        ) -> Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error> {
888            let _response = fidl::client::decode_transaction_body::<
889                ChildIteratorNextResponse,
890                fidl::encoding::DefaultFuchsiaResourceDialect,
891                0x40e4c3882b050d08,
892            >(_buf?)?;
893            Ok(_response.children)
894        }
895        self.client.send_query_and_decode::<
896            fidl::encoding::EmptyPayload,
897            Vec<fidl_fuchsia_component_decl::ChildRef>,
898        >(
899            (),
900            0x40e4c3882b050d08,
901            fidl::encoding::DynamicFlags::empty(),
902            _decode,
903        )
904    }
905}
906
907pub struct ChildIteratorEventStream {
908    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
909}
910
911impl std::marker::Unpin for ChildIteratorEventStream {}
912
913impl futures::stream::FusedStream for ChildIteratorEventStream {
914    fn is_terminated(&self) -> bool {
915        self.event_receiver.is_terminated()
916    }
917}
918
919impl futures::Stream for ChildIteratorEventStream {
920    type Item = Result<ChildIteratorEvent, fidl::Error>;
921
922    fn poll_next(
923        mut self: std::pin::Pin<&mut Self>,
924        cx: &mut std::task::Context<'_>,
925    ) -> std::task::Poll<Option<Self::Item>> {
926        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
927            &mut self.event_receiver,
928            cx
929        )?) {
930            Some(buf) => std::task::Poll::Ready(Some(ChildIteratorEvent::decode(buf))),
931            None => std::task::Poll::Ready(None),
932        }
933    }
934}
935
936#[derive(Debug)]
937pub enum ChildIteratorEvent {}
938
939impl ChildIteratorEvent {
940    /// Decodes a message buffer as a [`ChildIteratorEvent`].
941    fn decode(
942        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
943    ) -> Result<ChildIteratorEvent, fidl::Error> {
944        let (bytes, _handles) = buf.split_mut();
945        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
946        debug_assert_eq!(tx_header.tx_id, 0);
947        match tx_header.ordinal {
948            _ => Err(fidl::Error::UnknownOrdinal {
949                ordinal: tx_header.ordinal,
950                protocol_name: <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
951            }),
952        }
953    }
954}
955
956/// A Stream of incoming requests for fuchsia.component/ChildIterator.
957pub struct ChildIteratorRequestStream {
958    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
959    is_terminated: bool,
960}
961
962impl std::marker::Unpin for ChildIteratorRequestStream {}
963
964impl futures::stream::FusedStream for ChildIteratorRequestStream {
965    fn is_terminated(&self) -> bool {
966        self.is_terminated
967    }
968}
969
970impl fidl::endpoints::RequestStream for ChildIteratorRequestStream {
971    type Protocol = ChildIteratorMarker;
972    type ControlHandle = ChildIteratorControlHandle;
973
974    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
975        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
976    }
977
978    fn control_handle(&self) -> Self::ControlHandle {
979        ChildIteratorControlHandle { inner: self.inner.clone() }
980    }
981
982    fn into_inner(
983        self,
984    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
985    {
986        (self.inner, self.is_terminated)
987    }
988
989    fn from_inner(
990        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
991        is_terminated: bool,
992    ) -> Self {
993        Self { inner, is_terminated }
994    }
995}
996
997impl futures::Stream for ChildIteratorRequestStream {
998    type Item = Result<ChildIteratorRequest, fidl::Error>;
999
1000    fn poll_next(
1001        mut self: std::pin::Pin<&mut Self>,
1002        cx: &mut std::task::Context<'_>,
1003    ) -> std::task::Poll<Option<Self::Item>> {
1004        let this = &mut *self;
1005        if this.inner.check_shutdown(cx) {
1006            this.is_terminated = true;
1007            return std::task::Poll::Ready(None);
1008        }
1009        if this.is_terminated {
1010            panic!("polled ChildIteratorRequestStream after completion");
1011        }
1012        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1013            |bytes, handles| {
1014                match this.inner.channel().read_etc(cx, bytes, handles) {
1015                    std::task::Poll::Ready(Ok(())) => {}
1016                    std::task::Poll::Pending => return std::task::Poll::Pending,
1017                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1018                        this.is_terminated = true;
1019                        return std::task::Poll::Ready(None);
1020                    }
1021                    std::task::Poll::Ready(Err(e)) => {
1022                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1023                            e.into(),
1024                        ))));
1025                    }
1026                }
1027
1028                // A message has been received from the channel
1029                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1030
1031                std::task::Poll::Ready(Some(match header.ordinal {
1032                    0x40e4c3882b050d08 => {
1033                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1034                        let mut req = fidl::new_empty!(
1035                            fidl::encoding::EmptyPayload,
1036                            fidl::encoding::DefaultFuchsiaResourceDialect
1037                        );
1038                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1039                        let control_handle =
1040                            ChildIteratorControlHandle { inner: this.inner.clone() };
1041                        Ok(ChildIteratorRequest::Next {
1042                            responder: ChildIteratorNextResponder {
1043                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1044                                tx_id: header.tx_id,
1045                            },
1046                        })
1047                    }
1048                    _ => Err(fidl::Error::UnknownOrdinal {
1049                        ordinal: header.ordinal,
1050                        protocol_name:
1051                            <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1052                    }),
1053                }))
1054            },
1055        )
1056    }
1057}
1058
1059/// A protocol to iterate over the list of children in a realm.
1060#[derive(Debug)]
1061pub enum ChildIteratorRequest {
1062    /// Advance the iterator and return the next batch of children.
1063    ///
1064    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
1065    /// no more children.
1066    Next { responder: ChildIteratorNextResponder },
1067}
1068
1069impl ChildIteratorRequest {
1070    #[allow(irrefutable_let_patterns)]
1071    pub fn into_next(self) -> Option<(ChildIteratorNextResponder)> {
1072        if let ChildIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
1073    }
1074
1075    /// Name of the method defined in FIDL
1076    pub fn method_name(&self) -> &'static str {
1077        match *self {
1078            ChildIteratorRequest::Next { .. } => "next",
1079        }
1080    }
1081}
1082
1083#[derive(Debug, Clone)]
1084pub struct ChildIteratorControlHandle {
1085    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1086}
1087
1088impl fidl::endpoints::ControlHandle for ChildIteratorControlHandle {
1089    fn shutdown(&self) {
1090        self.inner.shutdown()
1091    }
1092
1093    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1094        self.inner.shutdown_with_epitaph(status)
1095    }
1096
1097    fn is_closed(&self) -> bool {
1098        self.inner.channel().is_closed()
1099    }
1100    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1101        self.inner.channel().on_closed()
1102    }
1103
1104    #[cfg(target_os = "fuchsia")]
1105    fn signal_peer(
1106        &self,
1107        clear_mask: zx::Signals,
1108        set_mask: zx::Signals,
1109    ) -> Result<(), zx_status::Status> {
1110        use fidl::Peered;
1111        self.inner.channel().signal_peer(clear_mask, set_mask)
1112    }
1113}
1114
1115impl ChildIteratorControlHandle {}
1116
1117#[must_use = "FIDL methods require a response to be sent"]
1118#[derive(Debug)]
1119pub struct ChildIteratorNextResponder {
1120    control_handle: std::mem::ManuallyDrop<ChildIteratorControlHandle>,
1121    tx_id: u32,
1122}
1123
1124/// Set the the channel to be shutdown (see [`ChildIteratorControlHandle::shutdown`])
1125/// if the responder is dropped without sending a response, so that the client
1126/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1127impl std::ops::Drop for ChildIteratorNextResponder {
1128    fn drop(&mut self) {
1129        self.control_handle.shutdown();
1130        // Safety: drops once, never accessed again
1131        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1132    }
1133}
1134
1135impl fidl::endpoints::Responder for ChildIteratorNextResponder {
1136    type ControlHandle = ChildIteratorControlHandle;
1137
1138    fn control_handle(&self) -> &ChildIteratorControlHandle {
1139        &self.control_handle
1140    }
1141
1142    fn drop_without_shutdown(mut self) {
1143        // Safety: drops once, never accessed again due to mem::forget
1144        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1145        // Prevent Drop from running (which would shut down the channel)
1146        std::mem::forget(self);
1147    }
1148}
1149
1150impl ChildIteratorNextResponder {
1151    /// Sends a response to the FIDL transaction.
1152    ///
1153    /// Sets the channel to shutdown if an error occurs.
1154    pub fn send(
1155        self,
1156        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1157    ) -> Result<(), fidl::Error> {
1158        let _result = self.send_raw(children);
1159        if _result.is_err() {
1160            self.control_handle.shutdown();
1161        }
1162        self.drop_without_shutdown();
1163        _result
1164    }
1165
1166    /// Similar to "send" but does not shutdown the channel if an error occurs.
1167    pub fn send_no_shutdown_on_err(
1168        self,
1169        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1170    ) -> Result<(), fidl::Error> {
1171        let _result = self.send_raw(children);
1172        self.drop_without_shutdown();
1173        _result
1174    }
1175
1176    fn send_raw(
1177        &self,
1178        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1179    ) -> Result<(), fidl::Error> {
1180        self.control_handle.inner.send::<ChildIteratorNextResponse>(
1181            (children,),
1182            self.tx_id,
1183            0x40e4c3882b050d08,
1184            fidl::encoding::DynamicFlags::empty(),
1185        )
1186    }
1187}
1188
1189#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1190pub struct ControllerMarker;
1191
1192impl fidl::endpoints::ProtocolMarker for ControllerMarker {
1193    type Proxy = ControllerProxy;
1194    type RequestStream = ControllerRequestStream;
1195    #[cfg(target_os = "fuchsia")]
1196    type SynchronousProxy = ControllerSynchronousProxy;
1197
1198    const DEBUG_NAME: &'static str = "(anonymous) Controller";
1199}
1200pub type ControllerStartResult = Result<(), Error>;
1201pub type ControllerIsStartedResult = Result<bool, Error>;
1202pub type ControllerOpenExposedDirResult = Result<(), Error>;
1203pub type ControllerGetExposedDictionaryResult =
1204    Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>;
1205pub type ControllerDestroyResult = Result<(), Error>;
1206
1207pub trait ControllerProxyInterface: Send + Sync {
1208    type StartResponseFut: std::future::Future<Output = Result<ControllerStartResult, fidl::Error>>
1209        + Send;
1210    fn r#start(
1211        &self,
1212        args: StartChildArgs,
1213        execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1214    ) -> Self::StartResponseFut;
1215    type IsStartedResponseFut: std::future::Future<Output = Result<ControllerIsStartedResult, fidl::Error>>
1216        + Send;
1217    fn r#is_started(&self) -> Self::IsStartedResponseFut;
1218    type OpenExposedDirResponseFut: std::future::Future<Output = Result<ControllerOpenExposedDirResult, fidl::Error>>
1219        + Send;
1220    fn r#open_exposed_dir(
1221        &self,
1222        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1223    ) -> Self::OpenExposedDirResponseFut;
1224    type GetExposedDictionaryResponseFut: std::future::Future<Output = Result<ControllerGetExposedDictionaryResult, fidl::Error>>
1225        + Send;
1226    fn r#get_exposed_dictionary(&self) -> Self::GetExposedDictionaryResponseFut;
1227    type DestroyResponseFut: std::future::Future<Output = Result<ControllerDestroyResult, fidl::Error>>
1228        + Send;
1229    fn r#destroy(&self) -> Self::DestroyResponseFut;
1230}
1231#[derive(Debug)]
1232#[cfg(target_os = "fuchsia")]
1233pub struct ControllerSynchronousProxy {
1234    client: fidl::client::sync::Client,
1235}
1236
1237#[cfg(target_os = "fuchsia")]
1238impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
1239    type Proxy = ControllerProxy;
1240    type Protocol = ControllerMarker;
1241
1242    fn from_channel(inner: fidl::Channel) -> Self {
1243        Self::new(inner)
1244    }
1245
1246    fn into_channel(self) -> fidl::Channel {
1247        self.client.into_channel()
1248    }
1249
1250    fn as_channel(&self) -> &fidl::Channel {
1251        self.client.as_channel()
1252    }
1253}
1254
1255#[cfg(target_os = "fuchsia")]
1256impl ControllerSynchronousProxy {
1257    pub fn new(channel: fidl::Channel) -> Self {
1258        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1259        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1260    }
1261
1262    pub fn into_channel(self) -> fidl::Channel {
1263        self.client.into_channel()
1264    }
1265
1266    /// Waits until an event arrives and returns it. It is safe for other
1267    /// threads to make concurrent requests while waiting for an event.
1268    pub fn wait_for_event(
1269        &self,
1270        deadline: zx::MonotonicInstant,
1271    ) -> Result<ControllerEvent, fidl::Error> {
1272        ControllerEvent::decode(self.client.wait_for_event(deadline)?)
1273    }
1274
1275    /// Start the component, optionally providing additional handles to be given
1276    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
1277    /// currently running.
1278    pub fn r#start(
1279        &self,
1280        mut args: StartChildArgs,
1281        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1282        ___deadline: zx::MonotonicInstant,
1283    ) -> Result<ControllerStartResult, fidl::Error> {
1284        let _response = self.client.send_query::<
1285            ControllerStartRequest,
1286            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1287        >(
1288            (&mut args, execution_controller,),
1289            0x68878076b8d2eac5,
1290            fidl::encoding::DynamicFlags::FLEXIBLE,
1291            ___deadline,
1292        )?
1293        .into_result::<ControllerMarker>("start")?;
1294        Ok(_response.map(|x| x))
1295    }
1296
1297    /// Returns true if this instance is currently running.
1298    pub fn r#is_started(
1299        &self,
1300        ___deadline: zx::MonotonicInstant,
1301    ) -> Result<ControllerIsStartedResult, fidl::Error> {
1302        let _response = self.client.send_query::<
1303            fidl::encoding::EmptyPayload,
1304            fidl::encoding::FlexibleResultType<ControllerIsStartedResponse, Error>,
1305        >(
1306            (),
1307            0x2155e6e1db2083c3,
1308            fidl::encoding::DynamicFlags::FLEXIBLE,
1309            ___deadline,
1310        )?
1311        .into_result::<ControllerMarker>("is_started")?;
1312        Ok(_response.map(|x| x.is_started))
1313    }
1314
1315    /// Opens the exposed directory of the controlled component, through which
1316    /// capabilities the component exposed via `ComponentDecl.exposes` are
1317    /// available, on success.
1318    ///
1319    /// Binding to the exposed directory requires that the component be
1320    /// resolved, but it will not be started until/unless some capability is
1321    /// requested that requires it to be.
1322    ///
1323    /// If this component is destroyed, any outstanding connections to
1324    /// `exposed_dir` will be closed.
1325    ///
1326    /// Errors:
1327    /// - `INSTANCE_CANNOT_RESOLVE`: This component failed to resolve.
1328    pub fn r#open_exposed_dir(
1329        &self,
1330        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1331        ___deadline: zx::MonotonicInstant,
1332    ) -> Result<ControllerOpenExposedDirResult, fidl::Error> {
1333        let _response = self.client.send_query::<
1334            ControllerOpenExposedDirRequest,
1335            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1336        >(
1337            (exposed_dir,),
1338            0x253cabb9a840ed94,
1339            fidl::encoding::DynamicFlags::empty(),
1340            ___deadline,
1341        )?;
1342        Ok(_response.map(|x| x))
1343    }
1344
1345    /// Returns the dictionary containing the component's exposed capabilities.
1346    pub fn r#get_exposed_dictionary(
1347        &self,
1348        ___deadline: zx::MonotonicInstant,
1349    ) -> Result<ControllerGetExposedDictionaryResult, fidl::Error> {
1350        let _response = self.client.send_query::<
1351            fidl::encoding::EmptyPayload,
1352            fidl::encoding::FlexibleResultType<ControllerGetExposedDictionaryResponse, Error>,
1353        >(
1354            (),
1355            0x7e48373e5eda1f9b,
1356            fidl::encoding::DynamicFlags::FLEXIBLE,
1357            ___deadline,
1358        )?
1359        .into_result::<ControllerMarker>("get_exposed_dictionary")?;
1360        Ok(_response.map(|x| x.dictionary))
1361    }
1362
1363    /// Destroys this component. When this method returns, the component is
1364    /// either destroyed or in the case of an error no destruction happened.
1365    ///
1366    /// Errors:
1367    ///
1368    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1369    /// Currently, this can happen if the component is a static child of its
1370    /// parent.
1371    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1372    ///   manager's logs will contain more detail.
1373    pub fn r#destroy(
1374        &self,
1375        ___deadline: zx::MonotonicInstant,
1376    ) -> Result<ControllerDestroyResult, fidl::Error> {
1377        let _response = self.client.send_query::<
1378            fidl::encoding::EmptyPayload,
1379            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1380        >(
1381            (),
1382            0x74529fa68b5c1741,
1383            fidl::encoding::DynamicFlags::FLEXIBLE,
1384            ___deadline,
1385        )?
1386        .into_result::<ControllerMarker>("destroy")?;
1387        Ok(_response.map(|x| x))
1388    }
1389}
1390
1391#[cfg(target_os = "fuchsia")]
1392impl From<ControllerSynchronousProxy> for zx::NullableHandle {
1393    fn from(value: ControllerSynchronousProxy) -> Self {
1394        value.into_channel().into()
1395    }
1396}
1397
1398#[cfg(target_os = "fuchsia")]
1399impl From<fidl::Channel> for ControllerSynchronousProxy {
1400    fn from(value: fidl::Channel) -> Self {
1401        Self::new(value)
1402    }
1403}
1404
1405#[cfg(target_os = "fuchsia")]
1406impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
1407    type Protocol = ControllerMarker;
1408
1409    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
1410        Self::new(value.into_channel())
1411    }
1412}
1413
1414#[derive(Debug, Clone)]
1415pub struct ControllerProxy {
1416    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1417}
1418
1419impl fidl::endpoints::Proxy for ControllerProxy {
1420    type Protocol = ControllerMarker;
1421
1422    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1423        Self::new(inner)
1424    }
1425
1426    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1427        self.client.into_channel().map_err(|client| Self { client })
1428    }
1429
1430    fn as_channel(&self) -> &::fidl::AsyncChannel {
1431        self.client.as_channel()
1432    }
1433}
1434
1435impl ControllerProxy {
1436    /// Create a new Proxy for fuchsia.component/Controller.
1437    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1438        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1439        Self { client: fidl::client::Client::new(channel, protocol_name) }
1440    }
1441
1442    /// Get a Stream of events from the remote end of the protocol.
1443    ///
1444    /// # Panics
1445    ///
1446    /// Panics if the event stream was already taken.
1447    pub fn take_event_stream(&self) -> ControllerEventStream {
1448        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
1449    }
1450
1451    /// Start the component, optionally providing additional handles to be given
1452    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
1453    /// currently running.
1454    pub fn r#start(
1455        &self,
1456        mut args: StartChildArgs,
1457        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1458    ) -> fidl::client::QueryResponseFut<
1459        ControllerStartResult,
1460        fidl::encoding::DefaultFuchsiaResourceDialect,
1461    > {
1462        ControllerProxyInterface::r#start(self, args, execution_controller)
1463    }
1464
1465    /// Returns true if this instance is currently running.
1466    pub fn r#is_started(
1467        &self,
1468    ) -> fidl::client::QueryResponseFut<
1469        ControllerIsStartedResult,
1470        fidl::encoding::DefaultFuchsiaResourceDialect,
1471    > {
1472        ControllerProxyInterface::r#is_started(self)
1473    }
1474
1475    /// Opens the exposed directory of the controlled component, through which
1476    /// capabilities the component exposed via `ComponentDecl.exposes` are
1477    /// available, on success.
1478    ///
1479    /// Binding to the exposed directory requires that the component be
1480    /// resolved, but it will not be started until/unless some capability is
1481    /// requested that requires it to be.
1482    ///
1483    /// If this component is destroyed, any outstanding connections to
1484    /// `exposed_dir` will be closed.
1485    ///
1486    /// Errors:
1487    /// - `INSTANCE_CANNOT_RESOLVE`: This component failed to resolve.
1488    pub fn r#open_exposed_dir(
1489        &self,
1490        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1491    ) -> fidl::client::QueryResponseFut<
1492        ControllerOpenExposedDirResult,
1493        fidl::encoding::DefaultFuchsiaResourceDialect,
1494    > {
1495        ControllerProxyInterface::r#open_exposed_dir(self, exposed_dir)
1496    }
1497
1498    /// Returns the dictionary containing the component's exposed capabilities.
1499    pub fn r#get_exposed_dictionary(
1500        &self,
1501    ) -> fidl::client::QueryResponseFut<
1502        ControllerGetExposedDictionaryResult,
1503        fidl::encoding::DefaultFuchsiaResourceDialect,
1504    > {
1505        ControllerProxyInterface::r#get_exposed_dictionary(self)
1506    }
1507
1508    /// Destroys this component. When this method returns, the component is
1509    /// either destroyed or in the case of an error no destruction happened.
1510    ///
1511    /// Errors:
1512    ///
1513    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1514    /// Currently, this can happen if the component is a static child of its
1515    /// parent.
1516    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1517    ///   manager's logs will contain more detail.
1518    pub fn r#destroy(
1519        &self,
1520    ) -> fidl::client::QueryResponseFut<
1521        ControllerDestroyResult,
1522        fidl::encoding::DefaultFuchsiaResourceDialect,
1523    > {
1524        ControllerProxyInterface::r#destroy(self)
1525    }
1526}
1527
1528impl ControllerProxyInterface for ControllerProxy {
1529    type StartResponseFut = fidl::client::QueryResponseFut<
1530        ControllerStartResult,
1531        fidl::encoding::DefaultFuchsiaResourceDialect,
1532    >;
1533    fn r#start(
1534        &self,
1535        mut args: StartChildArgs,
1536        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1537    ) -> Self::StartResponseFut {
1538        fn _decode(
1539            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1540        ) -> Result<ControllerStartResult, fidl::Error> {
1541            let _response = fidl::client::decode_transaction_body::<
1542                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1543                fidl::encoding::DefaultFuchsiaResourceDialect,
1544                0x68878076b8d2eac5,
1545            >(_buf?)?
1546            .into_result::<ControllerMarker>("start")?;
1547            Ok(_response.map(|x| x))
1548        }
1549        self.client.send_query_and_decode::<ControllerStartRequest, ControllerStartResult>(
1550            (&mut args, execution_controller),
1551            0x68878076b8d2eac5,
1552            fidl::encoding::DynamicFlags::FLEXIBLE,
1553            _decode,
1554        )
1555    }
1556
1557    type IsStartedResponseFut = fidl::client::QueryResponseFut<
1558        ControllerIsStartedResult,
1559        fidl::encoding::DefaultFuchsiaResourceDialect,
1560    >;
1561    fn r#is_started(&self) -> Self::IsStartedResponseFut {
1562        fn _decode(
1563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1564        ) -> Result<ControllerIsStartedResult, fidl::Error> {
1565            let _response = fidl::client::decode_transaction_body::<
1566                fidl::encoding::FlexibleResultType<ControllerIsStartedResponse, Error>,
1567                fidl::encoding::DefaultFuchsiaResourceDialect,
1568                0x2155e6e1db2083c3,
1569            >(_buf?)?
1570            .into_result::<ControllerMarker>("is_started")?;
1571            Ok(_response.map(|x| x.is_started))
1572        }
1573        self.client
1574            .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerIsStartedResult>(
1575                (),
1576                0x2155e6e1db2083c3,
1577                fidl::encoding::DynamicFlags::FLEXIBLE,
1578                _decode,
1579            )
1580    }
1581
1582    type OpenExposedDirResponseFut = fidl::client::QueryResponseFut<
1583        ControllerOpenExposedDirResult,
1584        fidl::encoding::DefaultFuchsiaResourceDialect,
1585    >;
1586    fn r#open_exposed_dir(
1587        &self,
1588        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1589    ) -> Self::OpenExposedDirResponseFut {
1590        fn _decode(
1591            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1592        ) -> Result<ControllerOpenExposedDirResult, fidl::Error> {
1593            let _response = fidl::client::decode_transaction_body::<
1594                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1595                fidl::encoding::DefaultFuchsiaResourceDialect,
1596                0x253cabb9a840ed94,
1597            >(_buf?)?;
1598            Ok(_response.map(|x| x))
1599        }
1600        self.client.send_query_and_decode::<
1601            ControllerOpenExposedDirRequest,
1602            ControllerOpenExposedDirResult,
1603        >(
1604            (exposed_dir,),
1605            0x253cabb9a840ed94,
1606            fidl::encoding::DynamicFlags::empty(),
1607            _decode,
1608        )
1609    }
1610
1611    type GetExposedDictionaryResponseFut = fidl::client::QueryResponseFut<
1612        ControllerGetExposedDictionaryResult,
1613        fidl::encoding::DefaultFuchsiaResourceDialect,
1614    >;
1615    fn r#get_exposed_dictionary(&self) -> Self::GetExposedDictionaryResponseFut {
1616        fn _decode(
1617            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1618        ) -> Result<ControllerGetExposedDictionaryResult, fidl::Error> {
1619            let _response = fidl::client::decode_transaction_body::<
1620                fidl::encoding::FlexibleResultType<ControllerGetExposedDictionaryResponse, Error>,
1621                fidl::encoding::DefaultFuchsiaResourceDialect,
1622                0x7e48373e5eda1f9b,
1623            >(_buf?)?
1624            .into_result::<ControllerMarker>("get_exposed_dictionary")?;
1625            Ok(_response.map(|x| x.dictionary))
1626        }
1627        self.client.send_query_and_decode::<
1628            fidl::encoding::EmptyPayload,
1629            ControllerGetExposedDictionaryResult,
1630        >(
1631            (),
1632            0x7e48373e5eda1f9b,
1633            fidl::encoding::DynamicFlags::FLEXIBLE,
1634            _decode,
1635        )
1636    }
1637
1638    type DestroyResponseFut = fidl::client::QueryResponseFut<
1639        ControllerDestroyResult,
1640        fidl::encoding::DefaultFuchsiaResourceDialect,
1641    >;
1642    fn r#destroy(&self) -> Self::DestroyResponseFut {
1643        fn _decode(
1644            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1645        ) -> Result<ControllerDestroyResult, fidl::Error> {
1646            let _response = fidl::client::decode_transaction_body::<
1647                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1648                fidl::encoding::DefaultFuchsiaResourceDialect,
1649                0x74529fa68b5c1741,
1650            >(_buf?)?
1651            .into_result::<ControllerMarker>("destroy")?;
1652            Ok(_response.map(|x| x))
1653        }
1654        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerDestroyResult>(
1655            (),
1656            0x74529fa68b5c1741,
1657            fidl::encoding::DynamicFlags::FLEXIBLE,
1658            _decode,
1659        )
1660    }
1661}
1662
1663pub struct ControllerEventStream {
1664    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1665}
1666
1667impl std::marker::Unpin for ControllerEventStream {}
1668
1669impl futures::stream::FusedStream for ControllerEventStream {
1670    fn is_terminated(&self) -> bool {
1671        self.event_receiver.is_terminated()
1672    }
1673}
1674
1675impl futures::Stream for ControllerEventStream {
1676    type Item = Result<ControllerEvent, fidl::Error>;
1677
1678    fn poll_next(
1679        mut self: std::pin::Pin<&mut Self>,
1680        cx: &mut std::task::Context<'_>,
1681    ) -> std::task::Poll<Option<Self::Item>> {
1682        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1683            &mut self.event_receiver,
1684            cx
1685        )?) {
1686            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
1687            None => std::task::Poll::Ready(None),
1688        }
1689    }
1690}
1691
1692#[derive(Debug)]
1693pub enum ControllerEvent {
1694    #[non_exhaustive]
1695    _UnknownEvent {
1696        /// Ordinal of the event that was sent.
1697        ordinal: u64,
1698    },
1699}
1700
1701impl ControllerEvent {
1702    /// Decodes a message buffer as a [`ControllerEvent`].
1703    fn decode(
1704        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1705    ) -> Result<ControllerEvent, fidl::Error> {
1706        let (bytes, _handles) = buf.split_mut();
1707        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1708        debug_assert_eq!(tx_header.tx_id, 0);
1709        match tx_header.ordinal {
1710            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1711                Ok(ControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1712            }
1713            _ => Err(fidl::Error::UnknownOrdinal {
1714                ordinal: tx_header.ordinal,
1715                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1716            }),
1717        }
1718    }
1719}
1720
1721/// A Stream of incoming requests for fuchsia.component/Controller.
1722pub struct ControllerRequestStream {
1723    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1724    is_terminated: bool,
1725}
1726
1727impl std::marker::Unpin for ControllerRequestStream {}
1728
1729impl futures::stream::FusedStream for ControllerRequestStream {
1730    fn is_terminated(&self) -> bool {
1731        self.is_terminated
1732    }
1733}
1734
1735impl fidl::endpoints::RequestStream for ControllerRequestStream {
1736    type Protocol = ControllerMarker;
1737    type ControlHandle = ControllerControlHandle;
1738
1739    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1740        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1741    }
1742
1743    fn control_handle(&self) -> Self::ControlHandle {
1744        ControllerControlHandle { inner: self.inner.clone() }
1745    }
1746
1747    fn into_inner(
1748        self,
1749    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1750    {
1751        (self.inner, self.is_terminated)
1752    }
1753
1754    fn from_inner(
1755        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1756        is_terminated: bool,
1757    ) -> Self {
1758        Self { inner, is_terminated }
1759    }
1760}
1761
1762impl futures::Stream for ControllerRequestStream {
1763    type Item = Result<ControllerRequest, fidl::Error>;
1764
1765    fn poll_next(
1766        mut self: std::pin::Pin<&mut Self>,
1767        cx: &mut std::task::Context<'_>,
1768    ) -> std::task::Poll<Option<Self::Item>> {
1769        let this = &mut *self;
1770        if this.inner.check_shutdown(cx) {
1771            this.is_terminated = true;
1772            return std::task::Poll::Ready(None);
1773        }
1774        if this.is_terminated {
1775            panic!("polled ControllerRequestStream after completion");
1776        }
1777        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1778            |bytes, handles| {
1779                match this.inner.channel().read_etc(cx, bytes, handles) {
1780                    std::task::Poll::Ready(Ok(())) => {}
1781                    std::task::Poll::Pending => return std::task::Poll::Pending,
1782                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1783                        this.is_terminated = true;
1784                        return std::task::Poll::Ready(None);
1785                    }
1786                    std::task::Poll::Ready(Err(e)) => {
1787                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1788                            e.into(),
1789                        ))));
1790                    }
1791                }
1792
1793                // A message has been received from the channel
1794                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1795
1796                std::task::Poll::Ready(Some(match header.ordinal {
1797                    0x68878076b8d2eac5 => {
1798                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1799                        let mut req = fidl::new_empty!(
1800                            ControllerStartRequest,
1801                            fidl::encoding::DefaultFuchsiaResourceDialect
1802                        );
1803                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerStartRequest>(&header, _body_bytes, handles, &mut req)?;
1804                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1805                        Ok(ControllerRequest::Start {
1806                            args: req.args,
1807                            execution_controller: req.execution_controller,
1808
1809                            responder: ControllerStartResponder {
1810                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1811                                tx_id: header.tx_id,
1812                            },
1813                        })
1814                    }
1815                    0x2155e6e1db2083c3 => {
1816                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1817                        let mut req = fidl::new_empty!(
1818                            fidl::encoding::EmptyPayload,
1819                            fidl::encoding::DefaultFuchsiaResourceDialect
1820                        );
1821                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1822                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1823                        Ok(ControllerRequest::IsStarted {
1824                            responder: ControllerIsStartedResponder {
1825                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1826                                tx_id: header.tx_id,
1827                            },
1828                        })
1829                    }
1830                    0x253cabb9a840ed94 => {
1831                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1832                        let mut req = fidl::new_empty!(
1833                            ControllerOpenExposedDirRequest,
1834                            fidl::encoding::DefaultFuchsiaResourceDialect
1835                        );
1836                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerOpenExposedDirRequest>(&header, _body_bytes, handles, &mut req)?;
1837                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1838                        Ok(ControllerRequest::OpenExposedDir {
1839                            exposed_dir: req.exposed_dir,
1840
1841                            responder: ControllerOpenExposedDirResponder {
1842                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1843                                tx_id: header.tx_id,
1844                            },
1845                        })
1846                    }
1847                    0x7e48373e5eda1f9b => {
1848                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1849                        let mut req = fidl::new_empty!(
1850                            fidl::encoding::EmptyPayload,
1851                            fidl::encoding::DefaultFuchsiaResourceDialect
1852                        );
1853                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1854                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1855                        Ok(ControllerRequest::GetExposedDictionary {
1856                            responder: ControllerGetExposedDictionaryResponder {
1857                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1858                                tx_id: header.tx_id,
1859                            },
1860                        })
1861                    }
1862                    0x74529fa68b5c1741 => {
1863                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1864                        let mut req = fidl::new_empty!(
1865                            fidl::encoding::EmptyPayload,
1866                            fidl::encoding::DefaultFuchsiaResourceDialect
1867                        );
1868                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1869                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1870                        Ok(ControllerRequest::Destroy {
1871                            responder: ControllerDestroyResponder {
1872                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1873                                tx_id: header.tx_id,
1874                            },
1875                        })
1876                    }
1877                    _ if header.tx_id == 0
1878                        && header
1879                            .dynamic_flags()
1880                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1881                    {
1882                        Ok(ControllerRequest::_UnknownMethod {
1883                            ordinal: header.ordinal,
1884                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
1885                            method_type: fidl::MethodType::OneWay,
1886                        })
1887                    }
1888                    _ if header
1889                        .dynamic_flags()
1890                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1891                    {
1892                        this.inner.send_framework_err(
1893                            fidl::encoding::FrameworkErr::UnknownMethod,
1894                            header.tx_id,
1895                            header.ordinal,
1896                            header.dynamic_flags(),
1897                            (bytes, handles),
1898                        )?;
1899                        Ok(ControllerRequest::_UnknownMethod {
1900                            ordinal: header.ordinal,
1901                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
1902                            method_type: fidl::MethodType::TwoWay,
1903                        })
1904                    }
1905                    _ => Err(fidl::Error::UnknownOrdinal {
1906                        ordinal: header.ordinal,
1907                        protocol_name:
1908                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1909                    }),
1910                }))
1911            },
1912        )
1913    }
1914}
1915
1916/// A protocol used to operate on a component.
1917///
1918/// One may get access to a `Controller` when creating a component with the
1919/// `Realm.CreateChild` method. You may also obtain a `Controller` for an
1920/// existing child component with the `Realm.OpenController` method.
1921#[derive(Debug)]
1922pub enum ControllerRequest {
1923    /// Start the component, optionally providing additional handles to be given
1924    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
1925    /// currently running.
1926    Start {
1927        args: StartChildArgs,
1928        execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1929        responder: ControllerStartResponder,
1930    },
1931    /// Returns true if this instance is currently running.
1932    IsStarted { responder: ControllerIsStartedResponder },
1933    /// Opens the exposed directory of the controlled component, through which
1934    /// capabilities the component exposed via `ComponentDecl.exposes` are
1935    /// available, on success.
1936    ///
1937    /// Binding to the exposed directory requires that the component be
1938    /// resolved, but it will not be started until/unless some capability is
1939    /// requested that requires it to be.
1940    ///
1941    /// If this component is destroyed, any outstanding connections to
1942    /// `exposed_dir` will be closed.
1943    ///
1944    /// Errors:
1945    /// - `INSTANCE_CANNOT_RESOLVE`: This component failed to resolve.
1946    OpenExposedDir {
1947        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1948        responder: ControllerOpenExposedDirResponder,
1949    },
1950    /// Returns the dictionary containing the component's exposed capabilities.
1951    GetExposedDictionary { responder: ControllerGetExposedDictionaryResponder },
1952    /// Destroys this component. When this method returns, the component is
1953    /// either destroyed or in the case of an error no destruction happened.
1954    ///
1955    /// Errors:
1956    ///
1957    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1958    /// Currently, this can happen if the component is a static child of its
1959    /// parent.
1960    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1961    ///   manager's logs will contain more detail.
1962    Destroy { responder: ControllerDestroyResponder },
1963    /// An interaction was received which does not match any known method.
1964    #[non_exhaustive]
1965    _UnknownMethod {
1966        /// Ordinal of the method that was called.
1967        ordinal: u64,
1968        control_handle: ControllerControlHandle,
1969        method_type: fidl::MethodType,
1970    },
1971}
1972
1973impl ControllerRequest {
1974    #[allow(irrefutable_let_patterns)]
1975    pub fn into_start(
1976        self,
1977    ) -> Option<(
1978        StartChildArgs,
1979        fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1980        ControllerStartResponder,
1981    )> {
1982        if let ControllerRequest::Start { args, execution_controller, responder } = self {
1983            Some((args, execution_controller, responder))
1984        } else {
1985            None
1986        }
1987    }
1988
1989    #[allow(irrefutable_let_patterns)]
1990    pub fn into_is_started(self) -> Option<(ControllerIsStartedResponder)> {
1991        if let ControllerRequest::IsStarted { responder } = self { Some((responder)) } else { None }
1992    }
1993
1994    #[allow(irrefutable_let_patterns)]
1995    pub fn into_open_exposed_dir(
1996        self,
1997    ) -> Option<(
1998        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1999        ControllerOpenExposedDirResponder,
2000    )> {
2001        if let ControllerRequest::OpenExposedDir { exposed_dir, responder } = self {
2002            Some((exposed_dir, responder))
2003        } else {
2004            None
2005        }
2006    }
2007
2008    #[allow(irrefutable_let_patterns)]
2009    pub fn into_get_exposed_dictionary(self) -> Option<(ControllerGetExposedDictionaryResponder)> {
2010        if let ControllerRequest::GetExposedDictionary { responder } = self {
2011            Some((responder))
2012        } else {
2013            None
2014        }
2015    }
2016
2017    #[allow(irrefutable_let_patterns)]
2018    pub fn into_destroy(self) -> Option<(ControllerDestroyResponder)> {
2019        if let ControllerRequest::Destroy { responder } = self { Some((responder)) } else { None }
2020    }
2021
2022    /// Name of the method defined in FIDL
2023    pub fn method_name(&self) -> &'static str {
2024        match *self {
2025            ControllerRequest::Start { .. } => "start",
2026            ControllerRequest::IsStarted { .. } => "is_started",
2027            ControllerRequest::OpenExposedDir { .. } => "open_exposed_dir",
2028            ControllerRequest::GetExposedDictionary { .. } => "get_exposed_dictionary",
2029            ControllerRequest::Destroy { .. } => "destroy",
2030            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2031                "unknown one-way method"
2032            }
2033            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2034                "unknown two-way method"
2035            }
2036        }
2037    }
2038}
2039
2040#[derive(Debug, Clone)]
2041pub struct ControllerControlHandle {
2042    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2043}
2044
2045impl fidl::endpoints::ControlHandle for ControllerControlHandle {
2046    fn shutdown(&self) {
2047        self.inner.shutdown()
2048    }
2049
2050    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2051        self.inner.shutdown_with_epitaph(status)
2052    }
2053
2054    fn is_closed(&self) -> bool {
2055        self.inner.channel().is_closed()
2056    }
2057    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2058        self.inner.channel().on_closed()
2059    }
2060
2061    #[cfg(target_os = "fuchsia")]
2062    fn signal_peer(
2063        &self,
2064        clear_mask: zx::Signals,
2065        set_mask: zx::Signals,
2066    ) -> Result<(), zx_status::Status> {
2067        use fidl::Peered;
2068        self.inner.channel().signal_peer(clear_mask, set_mask)
2069    }
2070}
2071
2072impl ControllerControlHandle {}
2073
2074#[must_use = "FIDL methods require a response to be sent"]
2075#[derive(Debug)]
2076pub struct ControllerStartResponder {
2077    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2078    tx_id: u32,
2079}
2080
2081/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2082/// if the responder is dropped without sending a response, so that the client
2083/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2084impl std::ops::Drop for ControllerStartResponder {
2085    fn drop(&mut self) {
2086        self.control_handle.shutdown();
2087        // Safety: drops once, never accessed again
2088        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2089    }
2090}
2091
2092impl fidl::endpoints::Responder for ControllerStartResponder {
2093    type ControlHandle = ControllerControlHandle;
2094
2095    fn control_handle(&self) -> &ControllerControlHandle {
2096        &self.control_handle
2097    }
2098
2099    fn drop_without_shutdown(mut self) {
2100        // Safety: drops once, never accessed again due to mem::forget
2101        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2102        // Prevent Drop from running (which would shut down the channel)
2103        std::mem::forget(self);
2104    }
2105}
2106
2107impl ControllerStartResponder {
2108    /// Sends a response to the FIDL transaction.
2109    ///
2110    /// Sets the channel to shutdown if an error occurs.
2111    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2112        let _result = self.send_raw(result);
2113        if _result.is_err() {
2114            self.control_handle.shutdown();
2115        }
2116        self.drop_without_shutdown();
2117        _result
2118    }
2119
2120    /// Similar to "send" but does not shutdown the channel if an error occurs.
2121    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2122        let _result = self.send_raw(result);
2123        self.drop_without_shutdown();
2124        _result
2125    }
2126
2127    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2128        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2129            fidl::encoding::EmptyStruct,
2130            Error,
2131        >>(
2132            fidl::encoding::FlexibleResult::new(result),
2133            self.tx_id,
2134            0x68878076b8d2eac5,
2135            fidl::encoding::DynamicFlags::FLEXIBLE,
2136        )
2137    }
2138}
2139
2140#[must_use = "FIDL methods require a response to be sent"]
2141#[derive(Debug)]
2142pub struct ControllerIsStartedResponder {
2143    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2144    tx_id: u32,
2145}
2146
2147/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2148/// if the responder is dropped without sending a response, so that the client
2149/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2150impl std::ops::Drop for ControllerIsStartedResponder {
2151    fn drop(&mut self) {
2152        self.control_handle.shutdown();
2153        // Safety: drops once, never accessed again
2154        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2155    }
2156}
2157
2158impl fidl::endpoints::Responder for ControllerIsStartedResponder {
2159    type ControlHandle = ControllerControlHandle;
2160
2161    fn control_handle(&self) -> &ControllerControlHandle {
2162        &self.control_handle
2163    }
2164
2165    fn drop_without_shutdown(mut self) {
2166        // Safety: drops once, never accessed again due to mem::forget
2167        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2168        // Prevent Drop from running (which would shut down the channel)
2169        std::mem::forget(self);
2170    }
2171}
2172
2173impl ControllerIsStartedResponder {
2174    /// Sends a response to the FIDL transaction.
2175    ///
2176    /// Sets the channel to shutdown if an error occurs.
2177    pub fn send(self, mut result: Result<bool, Error>) -> Result<(), fidl::Error> {
2178        let _result = self.send_raw(result);
2179        if _result.is_err() {
2180            self.control_handle.shutdown();
2181        }
2182        self.drop_without_shutdown();
2183        _result
2184    }
2185
2186    /// Similar to "send" but does not shutdown the channel if an error occurs.
2187    pub fn send_no_shutdown_on_err(
2188        self,
2189        mut result: Result<bool, Error>,
2190    ) -> 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<bool, Error>) -> Result<(), fidl::Error> {
2197        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2198            ControllerIsStartedResponse,
2199            Error,
2200        >>(
2201            fidl::encoding::FlexibleResult::new(result.map(|is_started| (is_started,))),
2202            self.tx_id,
2203            0x2155e6e1db2083c3,
2204            fidl::encoding::DynamicFlags::FLEXIBLE,
2205        )
2206    }
2207}
2208
2209#[must_use = "FIDL methods require a response to be sent"]
2210#[derive(Debug)]
2211pub struct ControllerOpenExposedDirResponder {
2212    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2213    tx_id: u32,
2214}
2215
2216/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2217/// if the responder is dropped without sending a response, so that the client
2218/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2219impl std::ops::Drop for ControllerOpenExposedDirResponder {
2220    fn drop(&mut self) {
2221        self.control_handle.shutdown();
2222        // Safety: drops once, never accessed again
2223        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2224    }
2225}
2226
2227impl fidl::endpoints::Responder for ControllerOpenExposedDirResponder {
2228    type ControlHandle = ControllerControlHandle;
2229
2230    fn control_handle(&self) -> &ControllerControlHandle {
2231        &self.control_handle
2232    }
2233
2234    fn drop_without_shutdown(mut self) {
2235        // Safety: drops once, never accessed again due to mem::forget
2236        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2237        // Prevent Drop from running (which would shut down the channel)
2238        std::mem::forget(self);
2239    }
2240}
2241
2242impl ControllerOpenExposedDirResponder {
2243    /// Sends a response to the FIDL transaction.
2244    ///
2245    /// Sets the channel to shutdown if an error occurs.
2246    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2247        let _result = self.send_raw(result);
2248        if _result.is_err() {
2249            self.control_handle.shutdown();
2250        }
2251        self.drop_without_shutdown();
2252        _result
2253    }
2254
2255    /// Similar to "send" but does not shutdown the channel if an error occurs.
2256    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2257        let _result = self.send_raw(result);
2258        self.drop_without_shutdown();
2259        _result
2260    }
2261
2262    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2263        self.control_handle
2264            .inner
2265            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2266                result,
2267                self.tx_id,
2268                0x253cabb9a840ed94,
2269                fidl::encoding::DynamicFlags::empty(),
2270            )
2271    }
2272}
2273
2274#[must_use = "FIDL methods require a response to be sent"]
2275#[derive(Debug)]
2276pub struct ControllerGetExposedDictionaryResponder {
2277    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2278    tx_id: u32,
2279}
2280
2281/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2282/// if the responder is dropped without sending a response, so that the client
2283/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2284impl std::ops::Drop for ControllerGetExposedDictionaryResponder {
2285    fn drop(&mut self) {
2286        self.control_handle.shutdown();
2287        // Safety: drops once, never accessed again
2288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2289    }
2290}
2291
2292impl fidl::endpoints::Responder for ControllerGetExposedDictionaryResponder {
2293    type ControlHandle = ControllerControlHandle;
2294
2295    fn control_handle(&self) -> &ControllerControlHandle {
2296        &self.control_handle
2297    }
2298
2299    fn drop_without_shutdown(mut self) {
2300        // Safety: drops once, never accessed again due to mem::forget
2301        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2302        // Prevent Drop from running (which would shut down the channel)
2303        std::mem::forget(self);
2304    }
2305}
2306
2307impl ControllerGetExposedDictionaryResponder {
2308    /// Sends a response to the FIDL transaction.
2309    ///
2310    /// Sets the channel to shutdown if an error occurs.
2311    pub fn send(
2312        self,
2313        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2314    ) -> Result<(), fidl::Error> {
2315        let _result = self.send_raw(result);
2316        if _result.is_err() {
2317            self.control_handle.shutdown();
2318        }
2319        self.drop_without_shutdown();
2320        _result
2321    }
2322
2323    /// Similar to "send" but does not shutdown the channel if an error occurs.
2324    pub fn send_no_shutdown_on_err(
2325        self,
2326        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2327    ) -> Result<(), fidl::Error> {
2328        let _result = self.send_raw(result);
2329        self.drop_without_shutdown();
2330        _result
2331    }
2332
2333    fn send_raw(
2334        &self,
2335        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2336    ) -> Result<(), fidl::Error> {
2337        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2338            ControllerGetExposedDictionaryResponse,
2339            Error,
2340        >>(
2341            fidl::encoding::FlexibleResult::new(
2342                result.as_mut().map_err(|e| *e).map(|dictionary| (dictionary,)),
2343            ),
2344            self.tx_id,
2345            0x7e48373e5eda1f9b,
2346            fidl::encoding::DynamicFlags::FLEXIBLE,
2347        )
2348    }
2349}
2350
2351#[must_use = "FIDL methods require a response to be sent"]
2352#[derive(Debug)]
2353pub struct ControllerDestroyResponder {
2354    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2355    tx_id: u32,
2356}
2357
2358/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2359/// if the responder is dropped without sending a response, so that the client
2360/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2361impl std::ops::Drop for ControllerDestroyResponder {
2362    fn drop(&mut self) {
2363        self.control_handle.shutdown();
2364        // Safety: drops once, never accessed again
2365        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2366    }
2367}
2368
2369impl fidl::endpoints::Responder for ControllerDestroyResponder {
2370    type ControlHandle = ControllerControlHandle;
2371
2372    fn control_handle(&self) -> &ControllerControlHandle {
2373        &self.control_handle
2374    }
2375
2376    fn drop_without_shutdown(mut self) {
2377        // Safety: drops once, never accessed again due to mem::forget
2378        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2379        // Prevent Drop from running (which would shut down the channel)
2380        std::mem::forget(self);
2381    }
2382}
2383
2384impl ControllerDestroyResponder {
2385    /// Sends a response to the FIDL transaction.
2386    ///
2387    /// Sets the channel to shutdown if an error occurs.
2388    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2389        let _result = self.send_raw(result);
2390        if _result.is_err() {
2391            self.control_handle.shutdown();
2392        }
2393        self.drop_without_shutdown();
2394        _result
2395    }
2396
2397    /// Similar to "send" but does not shutdown the channel if an error occurs.
2398    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2399        let _result = self.send_raw(result);
2400        self.drop_without_shutdown();
2401        _result
2402    }
2403
2404    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2405        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2406            fidl::encoding::EmptyStruct,
2407            Error,
2408        >>(
2409            fidl::encoding::FlexibleResult::new(result),
2410            self.tx_id,
2411            0x74529fa68b5c1741,
2412            fidl::encoding::DynamicFlags::FLEXIBLE,
2413        )
2414    }
2415}
2416
2417#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2418pub struct EventStreamMarker;
2419
2420impl fidl::endpoints::ProtocolMarker for EventStreamMarker {
2421    type Proxy = EventStreamProxy;
2422    type RequestStream = EventStreamRequestStream;
2423    #[cfg(target_os = "fuchsia")]
2424    type SynchronousProxy = EventStreamSynchronousProxy;
2425
2426    const DEBUG_NAME: &'static str = "fuchsia.component.EventStream";
2427}
2428impl fidl::endpoints::DiscoverableProtocolMarker for EventStreamMarker {}
2429
2430pub trait EventStreamProxyInterface: Send + Sync {
2431    type GetNextResponseFut: std::future::Future<Output = Result<Vec<Event>, fidl::Error>> + Send;
2432    fn r#get_next(&self) -> Self::GetNextResponseFut;
2433    type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2434    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
2435}
2436#[derive(Debug)]
2437#[cfg(target_os = "fuchsia")]
2438pub struct EventStreamSynchronousProxy {
2439    client: fidl::client::sync::Client,
2440}
2441
2442#[cfg(target_os = "fuchsia")]
2443impl fidl::endpoints::SynchronousProxy for EventStreamSynchronousProxy {
2444    type Proxy = EventStreamProxy;
2445    type Protocol = EventStreamMarker;
2446
2447    fn from_channel(inner: fidl::Channel) -> Self {
2448        Self::new(inner)
2449    }
2450
2451    fn into_channel(self) -> fidl::Channel {
2452        self.client.into_channel()
2453    }
2454
2455    fn as_channel(&self) -> &fidl::Channel {
2456        self.client.as_channel()
2457    }
2458}
2459
2460#[cfg(target_os = "fuchsia")]
2461impl EventStreamSynchronousProxy {
2462    pub fn new(channel: fidl::Channel) -> Self {
2463        let protocol_name = <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2464        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2465    }
2466
2467    pub fn into_channel(self) -> fidl::Channel {
2468        self.client.into_channel()
2469    }
2470
2471    /// Waits until an event arrives and returns it. It is safe for other
2472    /// threads to make concurrent requests while waiting for an event.
2473    pub fn wait_for_event(
2474        &self,
2475        deadline: zx::MonotonicInstant,
2476    ) -> Result<EventStreamEvent, fidl::Error> {
2477        EventStreamEvent::decode(self.client.wait_for_event(deadline)?)
2478    }
2479
2480    pub fn r#get_next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Event>, fidl::Error> {
2481        let _response =
2482            self.client.send_query::<fidl::encoding::EmptyPayload, EventStreamGetNextResponse>(
2483                (),
2484                0x3f24c9495978eb86,
2485                fidl::encoding::DynamicFlags::empty(),
2486                ___deadline,
2487            )?;
2488        Ok(_response.events)
2489    }
2490
2491    /// Returns immediately. Used to indicate that the FIDL connection
2492    /// completed. This is needed for non-static streams to verify
2493    /// that subscribe has completed before components are started.
2494    pub fn r#wait_for_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
2495        let _response =
2496            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
2497                (),
2498                0x31331f9578d2e682,
2499                fidl::encoding::DynamicFlags::empty(),
2500                ___deadline,
2501            )?;
2502        Ok(_response)
2503    }
2504}
2505
2506#[cfg(target_os = "fuchsia")]
2507impl From<EventStreamSynchronousProxy> for zx::NullableHandle {
2508    fn from(value: EventStreamSynchronousProxy) -> Self {
2509        value.into_channel().into()
2510    }
2511}
2512
2513#[cfg(target_os = "fuchsia")]
2514impl From<fidl::Channel> for EventStreamSynchronousProxy {
2515    fn from(value: fidl::Channel) -> Self {
2516        Self::new(value)
2517    }
2518}
2519
2520#[cfg(target_os = "fuchsia")]
2521impl fidl::endpoints::FromClient for EventStreamSynchronousProxy {
2522    type Protocol = EventStreamMarker;
2523
2524    fn from_client(value: fidl::endpoints::ClientEnd<EventStreamMarker>) -> Self {
2525        Self::new(value.into_channel())
2526    }
2527}
2528
2529#[derive(Debug, Clone)]
2530pub struct EventStreamProxy {
2531    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2532}
2533
2534impl fidl::endpoints::Proxy for EventStreamProxy {
2535    type Protocol = EventStreamMarker;
2536
2537    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2538        Self::new(inner)
2539    }
2540
2541    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2542        self.client.into_channel().map_err(|client| Self { client })
2543    }
2544
2545    fn as_channel(&self) -> &::fidl::AsyncChannel {
2546        self.client.as_channel()
2547    }
2548}
2549
2550impl EventStreamProxy {
2551    /// Create a new Proxy for fuchsia.component/EventStream.
2552    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2553        let protocol_name = <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2554        Self { client: fidl::client::Client::new(channel, protocol_name) }
2555    }
2556
2557    /// Get a Stream of events from the remote end of the protocol.
2558    ///
2559    /// # Panics
2560    ///
2561    /// Panics if the event stream was already taken.
2562    pub fn take_event_stream(&self) -> EventStreamEventStream {
2563        EventStreamEventStream { event_receiver: self.client.take_event_receiver() }
2564    }
2565
2566    pub fn r#get_next(
2567        &self,
2568    ) -> fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>
2569    {
2570        EventStreamProxyInterface::r#get_next(self)
2571    }
2572
2573    /// Returns immediately. Used to indicate that the FIDL connection
2574    /// completed. This is needed for non-static streams to verify
2575    /// that subscribe has completed before components are started.
2576    pub fn r#wait_for_ready(
2577        &self,
2578    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2579        EventStreamProxyInterface::r#wait_for_ready(self)
2580    }
2581}
2582
2583impl EventStreamProxyInterface for EventStreamProxy {
2584    type GetNextResponseFut =
2585        fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2586    fn r#get_next(&self) -> Self::GetNextResponseFut {
2587        fn _decode(
2588            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2589        ) -> Result<Vec<Event>, fidl::Error> {
2590            let _response = fidl::client::decode_transaction_body::<
2591                EventStreamGetNextResponse,
2592                fidl::encoding::DefaultFuchsiaResourceDialect,
2593                0x3f24c9495978eb86,
2594            >(_buf?)?;
2595            Ok(_response.events)
2596        }
2597        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Event>>(
2598            (),
2599            0x3f24c9495978eb86,
2600            fidl::encoding::DynamicFlags::empty(),
2601            _decode,
2602        )
2603    }
2604
2605    type WaitForReadyResponseFut =
2606        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2607    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
2608        fn _decode(
2609            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2610        ) -> Result<(), fidl::Error> {
2611            let _response = fidl::client::decode_transaction_body::<
2612                fidl::encoding::EmptyPayload,
2613                fidl::encoding::DefaultFuchsiaResourceDialect,
2614                0x31331f9578d2e682,
2615            >(_buf?)?;
2616            Ok(_response)
2617        }
2618        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2619            (),
2620            0x31331f9578d2e682,
2621            fidl::encoding::DynamicFlags::empty(),
2622            _decode,
2623        )
2624    }
2625}
2626
2627pub struct EventStreamEventStream {
2628    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2629}
2630
2631impl std::marker::Unpin for EventStreamEventStream {}
2632
2633impl futures::stream::FusedStream for EventStreamEventStream {
2634    fn is_terminated(&self) -> bool {
2635        self.event_receiver.is_terminated()
2636    }
2637}
2638
2639impl futures::Stream for EventStreamEventStream {
2640    type Item = Result<EventStreamEvent, fidl::Error>;
2641
2642    fn poll_next(
2643        mut self: std::pin::Pin<&mut Self>,
2644        cx: &mut std::task::Context<'_>,
2645    ) -> std::task::Poll<Option<Self::Item>> {
2646        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2647            &mut self.event_receiver,
2648            cx
2649        )?) {
2650            Some(buf) => std::task::Poll::Ready(Some(EventStreamEvent::decode(buf))),
2651            None => std::task::Poll::Ready(None),
2652        }
2653    }
2654}
2655
2656#[derive(Debug)]
2657pub enum EventStreamEvent {}
2658
2659impl EventStreamEvent {
2660    /// Decodes a message buffer as a [`EventStreamEvent`].
2661    fn decode(
2662        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2663    ) -> Result<EventStreamEvent, fidl::Error> {
2664        let (bytes, _handles) = buf.split_mut();
2665        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2666        debug_assert_eq!(tx_header.tx_id, 0);
2667        match tx_header.ordinal {
2668            _ => Err(fidl::Error::UnknownOrdinal {
2669                ordinal: tx_header.ordinal,
2670                protocol_name: <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2671            }),
2672        }
2673    }
2674}
2675
2676/// A Stream of incoming requests for fuchsia.component/EventStream.
2677pub struct EventStreamRequestStream {
2678    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2679    is_terminated: bool,
2680}
2681
2682impl std::marker::Unpin for EventStreamRequestStream {}
2683
2684impl futures::stream::FusedStream for EventStreamRequestStream {
2685    fn is_terminated(&self) -> bool {
2686        self.is_terminated
2687    }
2688}
2689
2690impl fidl::endpoints::RequestStream for EventStreamRequestStream {
2691    type Protocol = EventStreamMarker;
2692    type ControlHandle = EventStreamControlHandle;
2693
2694    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2695        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2696    }
2697
2698    fn control_handle(&self) -> Self::ControlHandle {
2699        EventStreamControlHandle { inner: self.inner.clone() }
2700    }
2701
2702    fn into_inner(
2703        self,
2704    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2705    {
2706        (self.inner, self.is_terminated)
2707    }
2708
2709    fn from_inner(
2710        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2711        is_terminated: bool,
2712    ) -> Self {
2713        Self { inner, is_terminated }
2714    }
2715}
2716
2717impl futures::Stream for EventStreamRequestStream {
2718    type Item = Result<EventStreamRequest, fidl::Error>;
2719
2720    fn poll_next(
2721        mut self: std::pin::Pin<&mut Self>,
2722        cx: &mut std::task::Context<'_>,
2723    ) -> std::task::Poll<Option<Self::Item>> {
2724        let this = &mut *self;
2725        if this.inner.check_shutdown(cx) {
2726            this.is_terminated = true;
2727            return std::task::Poll::Ready(None);
2728        }
2729        if this.is_terminated {
2730            panic!("polled EventStreamRequestStream after completion");
2731        }
2732        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2733            |bytes, handles| {
2734                match this.inner.channel().read_etc(cx, bytes, handles) {
2735                    std::task::Poll::Ready(Ok(())) => {}
2736                    std::task::Poll::Pending => return std::task::Poll::Pending,
2737                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2738                        this.is_terminated = true;
2739                        return std::task::Poll::Ready(None);
2740                    }
2741                    std::task::Poll::Ready(Err(e)) => {
2742                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2743                            e.into(),
2744                        ))));
2745                    }
2746                }
2747
2748                // A message has been received from the channel
2749                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2750
2751                std::task::Poll::Ready(Some(match header.ordinal {
2752                    0x3f24c9495978eb86 => {
2753                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2754                        let mut req = fidl::new_empty!(
2755                            fidl::encoding::EmptyPayload,
2756                            fidl::encoding::DefaultFuchsiaResourceDialect
2757                        );
2758                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2759                        let control_handle = EventStreamControlHandle { inner: this.inner.clone() };
2760                        Ok(EventStreamRequest::GetNext {
2761                            responder: EventStreamGetNextResponder {
2762                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2763                                tx_id: header.tx_id,
2764                            },
2765                        })
2766                    }
2767                    0x31331f9578d2e682 => {
2768                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2769                        let mut req = fidl::new_empty!(
2770                            fidl::encoding::EmptyPayload,
2771                            fidl::encoding::DefaultFuchsiaResourceDialect
2772                        );
2773                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2774                        let control_handle = EventStreamControlHandle { inner: this.inner.clone() };
2775                        Ok(EventStreamRequest::WaitForReady {
2776                            responder: EventStreamWaitForReadyResponder {
2777                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2778                                tx_id: header.tx_id,
2779                            },
2780                        })
2781                    }
2782                    _ => Err(fidl::Error::UnknownOrdinal {
2783                        ordinal: header.ordinal,
2784                        protocol_name:
2785                            <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2786                    }),
2787                }))
2788            },
2789        )
2790    }
2791}
2792
2793/// Listener for events on the component hierarchy.
2794/// Can't be used outside of the platform.
2795#[derive(Debug)]
2796pub enum EventStreamRequest {
2797    GetNext {
2798        responder: EventStreamGetNextResponder,
2799    },
2800    /// Returns immediately. Used to indicate that the FIDL connection
2801    /// completed. This is needed for non-static streams to verify
2802    /// that subscribe has completed before components are started.
2803    WaitForReady {
2804        responder: EventStreamWaitForReadyResponder,
2805    },
2806}
2807
2808impl EventStreamRequest {
2809    #[allow(irrefutable_let_patterns)]
2810    pub fn into_get_next(self) -> Option<(EventStreamGetNextResponder)> {
2811        if let EventStreamRequest::GetNext { responder } = self { Some((responder)) } else { None }
2812    }
2813
2814    #[allow(irrefutable_let_patterns)]
2815    pub fn into_wait_for_ready(self) -> Option<(EventStreamWaitForReadyResponder)> {
2816        if let EventStreamRequest::WaitForReady { responder } = self {
2817            Some((responder))
2818        } else {
2819            None
2820        }
2821    }
2822
2823    /// Name of the method defined in FIDL
2824    pub fn method_name(&self) -> &'static str {
2825        match *self {
2826            EventStreamRequest::GetNext { .. } => "get_next",
2827            EventStreamRequest::WaitForReady { .. } => "wait_for_ready",
2828        }
2829    }
2830}
2831
2832#[derive(Debug, Clone)]
2833pub struct EventStreamControlHandle {
2834    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2835}
2836
2837impl fidl::endpoints::ControlHandle for EventStreamControlHandle {
2838    fn shutdown(&self) {
2839        self.inner.shutdown()
2840    }
2841
2842    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2843        self.inner.shutdown_with_epitaph(status)
2844    }
2845
2846    fn is_closed(&self) -> bool {
2847        self.inner.channel().is_closed()
2848    }
2849    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2850        self.inner.channel().on_closed()
2851    }
2852
2853    #[cfg(target_os = "fuchsia")]
2854    fn signal_peer(
2855        &self,
2856        clear_mask: zx::Signals,
2857        set_mask: zx::Signals,
2858    ) -> Result<(), zx_status::Status> {
2859        use fidl::Peered;
2860        self.inner.channel().signal_peer(clear_mask, set_mask)
2861    }
2862}
2863
2864impl EventStreamControlHandle {}
2865
2866#[must_use = "FIDL methods require a response to be sent"]
2867#[derive(Debug)]
2868pub struct EventStreamGetNextResponder {
2869    control_handle: std::mem::ManuallyDrop<EventStreamControlHandle>,
2870    tx_id: u32,
2871}
2872
2873/// Set the the channel to be shutdown (see [`EventStreamControlHandle::shutdown`])
2874/// if the responder is dropped without sending a response, so that the client
2875/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2876impl std::ops::Drop for EventStreamGetNextResponder {
2877    fn drop(&mut self) {
2878        self.control_handle.shutdown();
2879        // Safety: drops once, never accessed again
2880        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2881    }
2882}
2883
2884impl fidl::endpoints::Responder for EventStreamGetNextResponder {
2885    type ControlHandle = EventStreamControlHandle;
2886
2887    fn control_handle(&self) -> &EventStreamControlHandle {
2888        &self.control_handle
2889    }
2890
2891    fn drop_without_shutdown(mut self) {
2892        // Safety: drops once, never accessed again due to mem::forget
2893        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2894        // Prevent Drop from running (which would shut down the channel)
2895        std::mem::forget(self);
2896    }
2897}
2898
2899impl EventStreamGetNextResponder {
2900    /// Sends a response to the FIDL transaction.
2901    ///
2902    /// Sets the channel to shutdown if an error occurs.
2903    pub fn send(self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
2904        let _result = self.send_raw(events);
2905        if _result.is_err() {
2906            self.control_handle.shutdown();
2907        }
2908        self.drop_without_shutdown();
2909        _result
2910    }
2911
2912    /// Similar to "send" but does not shutdown the channel if an error occurs.
2913    pub fn send_no_shutdown_on_err(self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
2914        let _result = self.send_raw(events);
2915        self.drop_without_shutdown();
2916        _result
2917    }
2918
2919    fn send_raw(&self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
2920        self.control_handle.inner.send::<EventStreamGetNextResponse>(
2921            (events.as_mut(),),
2922            self.tx_id,
2923            0x3f24c9495978eb86,
2924            fidl::encoding::DynamicFlags::empty(),
2925        )
2926    }
2927}
2928
2929#[must_use = "FIDL methods require a response to be sent"]
2930#[derive(Debug)]
2931pub struct EventStreamWaitForReadyResponder {
2932    control_handle: std::mem::ManuallyDrop<EventStreamControlHandle>,
2933    tx_id: u32,
2934}
2935
2936/// Set the the channel to be shutdown (see [`EventStreamControlHandle::shutdown`])
2937/// if the responder is dropped without sending a response, so that the client
2938/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2939impl std::ops::Drop for EventStreamWaitForReadyResponder {
2940    fn drop(&mut self) {
2941        self.control_handle.shutdown();
2942        // Safety: drops once, never accessed again
2943        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2944    }
2945}
2946
2947impl fidl::endpoints::Responder for EventStreamWaitForReadyResponder {
2948    type ControlHandle = EventStreamControlHandle;
2949
2950    fn control_handle(&self) -> &EventStreamControlHandle {
2951        &self.control_handle
2952    }
2953
2954    fn drop_without_shutdown(mut self) {
2955        // Safety: drops once, never accessed again due to mem::forget
2956        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2957        // Prevent Drop from running (which would shut down the channel)
2958        std::mem::forget(self);
2959    }
2960}
2961
2962impl EventStreamWaitForReadyResponder {
2963    /// Sends a response to the FIDL transaction.
2964    ///
2965    /// Sets the channel to shutdown if an error occurs.
2966    pub fn send(self) -> Result<(), fidl::Error> {
2967        let _result = self.send_raw();
2968        if _result.is_err() {
2969            self.control_handle.shutdown();
2970        }
2971        self.drop_without_shutdown();
2972        _result
2973    }
2974
2975    /// Similar to "send" but does not shutdown the channel if an error occurs.
2976    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2977        let _result = self.send_raw();
2978        self.drop_without_shutdown();
2979        _result
2980    }
2981
2982    fn send_raw(&self) -> Result<(), fidl::Error> {
2983        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2984            (),
2985            self.tx_id,
2986            0x31331f9578d2e682,
2987            fidl::encoding::DynamicFlags::empty(),
2988        )
2989    }
2990}
2991
2992#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2993pub struct ExecutionControllerMarker;
2994
2995impl fidl::endpoints::ProtocolMarker for ExecutionControllerMarker {
2996    type Proxy = ExecutionControllerProxy;
2997    type RequestStream = ExecutionControllerRequestStream;
2998    #[cfg(target_os = "fuchsia")]
2999    type SynchronousProxy = ExecutionControllerSynchronousProxy;
3000
3001    const DEBUG_NAME: &'static str = "(anonymous) ExecutionController";
3002}
3003
3004pub trait ExecutionControllerProxyInterface: Send + Sync {
3005    fn r#stop(&self) -> Result<(), fidl::Error>;
3006}
3007#[derive(Debug)]
3008#[cfg(target_os = "fuchsia")]
3009pub struct ExecutionControllerSynchronousProxy {
3010    client: fidl::client::sync::Client,
3011}
3012
3013#[cfg(target_os = "fuchsia")]
3014impl fidl::endpoints::SynchronousProxy for ExecutionControllerSynchronousProxy {
3015    type Proxy = ExecutionControllerProxy;
3016    type Protocol = ExecutionControllerMarker;
3017
3018    fn from_channel(inner: fidl::Channel) -> Self {
3019        Self::new(inner)
3020    }
3021
3022    fn into_channel(self) -> fidl::Channel {
3023        self.client.into_channel()
3024    }
3025
3026    fn as_channel(&self) -> &fidl::Channel {
3027        self.client.as_channel()
3028    }
3029}
3030
3031#[cfg(target_os = "fuchsia")]
3032impl ExecutionControllerSynchronousProxy {
3033    pub fn new(channel: fidl::Channel) -> Self {
3034        let protocol_name =
3035            <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3036        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3037    }
3038
3039    pub fn into_channel(self) -> fidl::Channel {
3040        self.client.into_channel()
3041    }
3042
3043    /// Waits until an event arrives and returns it. It is safe for other
3044    /// threads to make concurrent requests while waiting for an event.
3045    pub fn wait_for_event(
3046        &self,
3047        deadline: zx::MonotonicInstant,
3048    ) -> Result<ExecutionControllerEvent, fidl::Error> {
3049        ExecutionControllerEvent::decode(self.client.wait_for_event(deadline)?)
3050    }
3051
3052    /// Initiates a stop action on this component. Once complete, OnStop will be
3053    /// called with the stopped payload and this channel is closed.
3054    ///
3055    /// Note that a component may stop running on its own at any time, so it is
3056    /// possible for `OnStop` to be received before `Stop` is called.
3057    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3058        self.client.send::<fidl::encoding::EmptyPayload>(
3059            (),
3060            0x56d23cec21036117,
3061            fidl::encoding::DynamicFlags::FLEXIBLE,
3062        )
3063    }
3064}
3065
3066#[cfg(target_os = "fuchsia")]
3067impl From<ExecutionControllerSynchronousProxy> for zx::NullableHandle {
3068    fn from(value: ExecutionControllerSynchronousProxy) -> Self {
3069        value.into_channel().into()
3070    }
3071}
3072
3073#[cfg(target_os = "fuchsia")]
3074impl From<fidl::Channel> for ExecutionControllerSynchronousProxy {
3075    fn from(value: fidl::Channel) -> Self {
3076        Self::new(value)
3077    }
3078}
3079
3080#[cfg(target_os = "fuchsia")]
3081impl fidl::endpoints::FromClient for ExecutionControllerSynchronousProxy {
3082    type Protocol = ExecutionControllerMarker;
3083
3084    fn from_client(value: fidl::endpoints::ClientEnd<ExecutionControllerMarker>) -> Self {
3085        Self::new(value.into_channel())
3086    }
3087}
3088
3089#[derive(Debug, Clone)]
3090pub struct ExecutionControllerProxy {
3091    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3092}
3093
3094impl fidl::endpoints::Proxy for ExecutionControllerProxy {
3095    type Protocol = ExecutionControllerMarker;
3096
3097    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3098        Self::new(inner)
3099    }
3100
3101    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3102        self.client.into_channel().map_err(|client| Self { client })
3103    }
3104
3105    fn as_channel(&self) -> &::fidl::AsyncChannel {
3106        self.client.as_channel()
3107    }
3108}
3109
3110impl ExecutionControllerProxy {
3111    /// Create a new Proxy for fuchsia.component/ExecutionController.
3112    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3113        let protocol_name =
3114            <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3115        Self { client: fidl::client::Client::new(channel, protocol_name) }
3116    }
3117
3118    /// Get a Stream of events from the remote end of the protocol.
3119    ///
3120    /// # Panics
3121    ///
3122    /// Panics if the event stream was already taken.
3123    pub fn take_event_stream(&self) -> ExecutionControllerEventStream {
3124        ExecutionControllerEventStream { event_receiver: self.client.take_event_receiver() }
3125    }
3126
3127    /// Initiates a stop action on this component. Once complete, OnStop will be
3128    /// called with the stopped payload and this channel is closed.
3129    ///
3130    /// Note that a component may stop running on its own at any time, so it is
3131    /// possible for `OnStop` to be received before `Stop` is called.
3132    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3133        ExecutionControllerProxyInterface::r#stop(self)
3134    }
3135}
3136
3137impl ExecutionControllerProxyInterface for ExecutionControllerProxy {
3138    fn r#stop(&self) -> Result<(), fidl::Error> {
3139        self.client.send::<fidl::encoding::EmptyPayload>(
3140            (),
3141            0x56d23cec21036117,
3142            fidl::encoding::DynamicFlags::FLEXIBLE,
3143        )
3144    }
3145}
3146
3147pub struct ExecutionControllerEventStream {
3148    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3149}
3150
3151impl std::marker::Unpin for ExecutionControllerEventStream {}
3152
3153impl futures::stream::FusedStream for ExecutionControllerEventStream {
3154    fn is_terminated(&self) -> bool {
3155        self.event_receiver.is_terminated()
3156    }
3157}
3158
3159impl futures::Stream for ExecutionControllerEventStream {
3160    type Item = Result<ExecutionControllerEvent, fidl::Error>;
3161
3162    fn poll_next(
3163        mut self: std::pin::Pin<&mut Self>,
3164        cx: &mut std::task::Context<'_>,
3165    ) -> std::task::Poll<Option<Self::Item>> {
3166        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3167            &mut self.event_receiver,
3168            cx
3169        )?) {
3170            Some(buf) => std::task::Poll::Ready(Some(ExecutionControllerEvent::decode(buf))),
3171            None => std::task::Poll::Ready(None),
3172        }
3173    }
3174}
3175
3176#[derive(Debug)]
3177pub enum ExecutionControllerEvent {
3178    OnStop {
3179        stopped_payload: StoppedPayload,
3180    },
3181    #[non_exhaustive]
3182    _UnknownEvent {
3183        /// Ordinal of the event that was sent.
3184        ordinal: u64,
3185    },
3186}
3187
3188impl ExecutionControllerEvent {
3189    #[allow(irrefutable_let_patterns)]
3190    pub fn into_on_stop(self) -> Option<StoppedPayload> {
3191        if let ExecutionControllerEvent::OnStop { stopped_payload } = self {
3192            Some((stopped_payload))
3193        } else {
3194            None
3195        }
3196    }
3197
3198    /// Decodes a message buffer as a [`ExecutionControllerEvent`].
3199    fn decode(
3200        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3201    ) -> Result<ExecutionControllerEvent, fidl::Error> {
3202        let (bytes, _handles) = buf.split_mut();
3203        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3204        debug_assert_eq!(tx_header.tx_id, 0);
3205        match tx_header.ordinal {
3206            0x62d5018e2174f57f => {
3207                let mut out = fidl::new_empty!(
3208                    ExecutionControllerOnStopRequest,
3209                    fidl::encoding::DefaultFuchsiaResourceDialect
3210                );
3211                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ExecutionControllerOnStopRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3212                Ok((ExecutionControllerEvent::OnStop { stopped_payload: out.stopped_payload }))
3213            }
3214            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3215                Ok(ExecutionControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3216            }
3217            _ => Err(fidl::Error::UnknownOrdinal {
3218                ordinal: tx_header.ordinal,
3219                protocol_name:
3220                    <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3221            }),
3222        }
3223    }
3224}
3225
3226/// A Stream of incoming requests for fuchsia.component/ExecutionController.
3227pub struct ExecutionControllerRequestStream {
3228    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3229    is_terminated: bool,
3230}
3231
3232impl std::marker::Unpin for ExecutionControllerRequestStream {}
3233
3234impl futures::stream::FusedStream for ExecutionControllerRequestStream {
3235    fn is_terminated(&self) -> bool {
3236        self.is_terminated
3237    }
3238}
3239
3240impl fidl::endpoints::RequestStream for ExecutionControllerRequestStream {
3241    type Protocol = ExecutionControllerMarker;
3242    type ControlHandle = ExecutionControllerControlHandle;
3243
3244    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3245        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3246    }
3247
3248    fn control_handle(&self) -> Self::ControlHandle {
3249        ExecutionControllerControlHandle { inner: self.inner.clone() }
3250    }
3251
3252    fn into_inner(
3253        self,
3254    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3255    {
3256        (self.inner, self.is_terminated)
3257    }
3258
3259    fn from_inner(
3260        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3261        is_terminated: bool,
3262    ) -> Self {
3263        Self { inner, is_terminated }
3264    }
3265}
3266
3267impl futures::Stream for ExecutionControllerRequestStream {
3268    type Item = Result<ExecutionControllerRequest, fidl::Error>;
3269
3270    fn poll_next(
3271        mut self: std::pin::Pin<&mut Self>,
3272        cx: &mut std::task::Context<'_>,
3273    ) -> std::task::Poll<Option<Self::Item>> {
3274        let this = &mut *self;
3275        if this.inner.check_shutdown(cx) {
3276            this.is_terminated = true;
3277            return std::task::Poll::Ready(None);
3278        }
3279        if this.is_terminated {
3280            panic!("polled ExecutionControllerRequestStream after completion");
3281        }
3282        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3283            |bytes, handles| {
3284                match this.inner.channel().read_etc(cx, bytes, handles) {
3285                    std::task::Poll::Ready(Ok(())) => {}
3286                    std::task::Poll::Pending => return std::task::Poll::Pending,
3287                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3288                        this.is_terminated = true;
3289                        return std::task::Poll::Ready(None);
3290                    }
3291                    std::task::Poll::Ready(Err(e)) => {
3292                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3293                            e.into(),
3294                        ))));
3295                    }
3296                }
3297
3298                // A message has been received from the channel
3299                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3300
3301                std::task::Poll::Ready(Some(match header.ordinal {
3302                0x56d23cec21036117 => {
3303                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3304                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3305                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3306                    let control_handle = ExecutionControllerControlHandle {
3307                        inner: this.inner.clone(),
3308                    };
3309                    Ok(ExecutionControllerRequest::Stop {
3310                        control_handle,
3311                    })
3312                }
3313                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3314                    Ok(ExecutionControllerRequest::_UnknownMethod {
3315                        ordinal: header.ordinal,
3316                        control_handle: ExecutionControllerControlHandle { inner: this.inner.clone() },
3317                        method_type: fidl::MethodType::OneWay,
3318                    })
3319                }
3320                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3321                    this.inner.send_framework_err(
3322                        fidl::encoding::FrameworkErr::UnknownMethod,
3323                        header.tx_id,
3324                        header.ordinal,
3325                        header.dynamic_flags(),
3326                        (bytes, handles),
3327                    )?;
3328                    Ok(ExecutionControllerRequest::_UnknownMethod {
3329                        ordinal: header.ordinal,
3330                        control_handle: ExecutionControllerControlHandle { inner: this.inner.clone() },
3331                        method_type: fidl::MethodType::TwoWay,
3332                    })
3333                }
3334                _ => Err(fidl::Error::UnknownOrdinal {
3335                    ordinal: header.ordinal,
3336                    protocol_name: <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3337                }),
3338            }))
3339            },
3340        )
3341    }
3342}
3343
3344#[derive(Debug)]
3345pub enum ExecutionControllerRequest {
3346    /// Initiates a stop action on this component. Once complete, OnStop will be
3347    /// called with the stopped payload and this channel is closed.
3348    ///
3349    /// Note that a component may stop running on its own at any time, so it is
3350    /// possible for `OnStop` to be received before `Stop` is called.
3351    Stop { control_handle: ExecutionControllerControlHandle },
3352    /// An interaction was received which does not match any known method.
3353    #[non_exhaustive]
3354    _UnknownMethod {
3355        /// Ordinal of the method that was called.
3356        ordinal: u64,
3357        control_handle: ExecutionControllerControlHandle,
3358        method_type: fidl::MethodType,
3359    },
3360}
3361
3362impl ExecutionControllerRequest {
3363    #[allow(irrefutable_let_patterns)]
3364    pub fn into_stop(self) -> Option<(ExecutionControllerControlHandle)> {
3365        if let ExecutionControllerRequest::Stop { control_handle } = self {
3366            Some((control_handle))
3367        } else {
3368            None
3369        }
3370    }
3371
3372    /// Name of the method defined in FIDL
3373    pub fn method_name(&self) -> &'static str {
3374        match *self {
3375            ExecutionControllerRequest::Stop { .. } => "stop",
3376            ExecutionControllerRequest::_UnknownMethod {
3377                method_type: fidl::MethodType::OneWay,
3378                ..
3379            } => "unknown one-way method",
3380            ExecutionControllerRequest::_UnknownMethod {
3381                method_type: fidl::MethodType::TwoWay,
3382                ..
3383            } => "unknown two-way method",
3384        }
3385    }
3386}
3387
3388#[derive(Debug, Clone)]
3389pub struct ExecutionControllerControlHandle {
3390    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3391}
3392
3393impl fidl::endpoints::ControlHandle for ExecutionControllerControlHandle {
3394    fn shutdown(&self) {
3395        self.inner.shutdown()
3396    }
3397
3398    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3399        self.inner.shutdown_with_epitaph(status)
3400    }
3401
3402    fn is_closed(&self) -> bool {
3403        self.inner.channel().is_closed()
3404    }
3405    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3406        self.inner.channel().on_closed()
3407    }
3408
3409    #[cfg(target_os = "fuchsia")]
3410    fn signal_peer(
3411        &self,
3412        clear_mask: zx::Signals,
3413        set_mask: zx::Signals,
3414    ) -> Result<(), zx_status::Status> {
3415        use fidl::Peered;
3416        self.inner.channel().signal_peer(clear_mask, set_mask)
3417    }
3418}
3419
3420impl ExecutionControllerControlHandle {
3421    pub fn send_on_stop(&self, mut stopped_payload: &StoppedPayload) -> Result<(), fidl::Error> {
3422        self.inner.send::<ExecutionControllerOnStopRequest>(
3423            (stopped_payload,),
3424            0,
3425            0x62d5018e2174f57f,
3426            fidl::encoding::DynamicFlags::FLEXIBLE,
3427        )
3428    }
3429}
3430
3431#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3432pub struct IntrospectorMarker;
3433
3434impl fidl::endpoints::ProtocolMarker for IntrospectorMarker {
3435    type Proxy = IntrospectorProxy;
3436    type RequestStream = IntrospectorRequestStream;
3437    #[cfg(target_os = "fuchsia")]
3438    type SynchronousProxy = IntrospectorSynchronousProxy;
3439
3440    const DEBUG_NAME: &'static str = "fuchsia.component.Introspector";
3441}
3442impl fidl::endpoints::DiscoverableProtocolMarker for IntrospectorMarker {}
3443pub type IntrospectorGetMonikerResult = Result<String, Error>;
3444
3445pub trait IntrospectorProxyInterface: Send + Sync {
3446    type GetMonikerResponseFut: std::future::Future<Output = Result<IntrospectorGetMonikerResult, fidl::Error>>
3447        + Send;
3448    fn r#get_moniker(&self, component_instance: fidl::Event) -> Self::GetMonikerResponseFut;
3449}
3450#[derive(Debug)]
3451#[cfg(target_os = "fuchsia")]
3452pub struct IntrospectorSynchronousProxy {
3453    client: fidl::client::sync::Client,
3454}
3455
3456#[cfg(target_os = "fuchsia")]
3457impl fidl::endpoints::SynchronousProxy for IntrospectorSynchronousProxy {
3458    type Proxy = IntrospectorProxy;
3459    type Protocol = IntrospectorMarker;
3460
3461    fn from_channel(inner: fidl::Channel) -> Self {
3462        Self::new(inner)
3463    }
3464
3465    fn into_channel(self) -> fidl::Channel {
3466        self.client.into_channel()
3467    }
3468
3469    fn as_channel(&self) -> &fidl::Channel {
3470        self.client.as_channel()
3471    }
3472}
3473
3474#[cfg(target_os = "fuchsia")]
3475impl IntrospectorSynchronousProxy {
3476    pub fn new(channel: fidl::Channel) -> Self {
3477        let protocol_name = <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3478        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3479    }
3480
3481    pub fn into_channel(self) -> fidl::Channel {
3482        self.client.into_channel()
3483    }
3484
3485    /// Waits until an event arrives and returns it. It is safe for other
3486    /// threads to make concurrent requests while waiting for an event.
3487    pub fn wait_for_event(
3488        &self,
3489        deadline: zx::MonotonicInstant,
3490    ) -> Result<IntrospectorEvent, fidl::Error> {
3491        IntrospectorEvent::decode(self.client.wait_for_event(deadline)?)
3492    }
3493
3494    /// Obtains the moniker relative to this realm of the component
3495    /// corresponding to the provided token. Runners may obtain the token via
3496    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3497    ///
3498    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3499    /// does not correspond to a component under this realm.
3500    pub fn r#get_moniker(
3501        &self,
3502        mut component_instance: fidl::Event,
3503        ___deadline: zx::MonotonicInstant,
3504    ) -> Result<IntrospectorGetMonikerResult, fidl::Error> {
3505        let _response = self.client.send_query::<
3506            IntrospectorGetMonikerRequest,
3507            fidl::encoding::FlexibleResultType<IntrospectorGetMonikerResponse, Error>,
3508        >(
3509            (component_instance,),
3510            0x2f980ceb37bf458,
3511            fidl::encoding::DynamicFlags::FLEXIBLE,
3512            ___deadline,
3513        )?
3514        .into_result::<IntrospectorMarker>("get_moniker")?;
3515        Ok(_response.map(|x| x.moniker))
3516    }
3517}
3518
3519#[cfg(target_os = "fuchsia")]
3520impl From<IntrospectorSynchronousProxy> for zx::NullableHandle {
3521    fn from(value: IntrospectorSynchronousProxy) -> Self {
3522        value.into_channel().into()
3523    }
3524}
3525
3526#[cfg(target_os = "fuchsia")]
3527impl From<fidl::Channel> for IntrospectorSynchronousProxy {
3528    fn from(value: fidl::Channel) -> Self {
3529        Self::new(value)
3530    }
3531}
3532
3533#[cfg(target_os = "fuchsia")]
3534impl fidl::endpoints::FromClient for IntrospectorSynchronousProxy {
3535    type Protocol = IntrospectorMarker;
3536
3537    fn from_client(value: fidl::endpoints::ClientEnd<IntrospectorMarker>) -> Self {
3538        Self::new(value.into_channel())
3539    }
3540}
3541
3542#[derive(Debug, Clone)]
3543pub struct IntrospectorProxy {
3544    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3545}
3546
3547impl fidl::endpoints::Proxy for IntrospectorProxy {
3548    type Protocol = IntrospectorMarker;
3549
3550    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3551        Self::new(inner)
3552    }
3553
3554    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3555        self.client.into_channel().map_err(|client| Self { client })
3556    }
3557
3558    fn as_channel(&self) -> &::fidl::AsyncChannel {
3559        self.client.as_channel()
3560    }
3561}
3562
3563impl IntrospectorProxy {
3564    /// Create a new Proxy for fuchsia.component/Introspector.
3565    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3566        let protocol_name = <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3567        Self { client: fidl::client::Client::new(channel, protocol_name) }
3568    }
3569
3570    /// Get a Stream of events from the remote end of the protocol.
3571    ///
3572    /// # Panics
3573    ///
3574    /// Panics if the event stream was already taken.
3575    pub fn take_event_stream(&self) -> IntrospectorEventStream {
3576        IntrospectorEventStream { event_receiver: self.client.take_event_receiver() }
3577    }
3578
3579    /// Obtains the moniker relative to this realm of the component
3580    /// corresponding to the provided token. Runners may obtain the token via
3581    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3582    ///
3583    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3584    /// does not correspond to a component under this realm.
3585    pub fn r#get_moniker(
3586        &self,
3587        mut component_instance: fidl::Event,
3588    ) -> fidl::client::QueryResponseFut<
3589        IntrospectorGetMonikerResult,
3590        fidl::encoding::DefaultFuchsiaResourceDialect,
3591    > {
3592        IntrospectorProxyInterface::r#get_moniker(self, component_instance)
3593    }
3594}
3595
3596impl IntrospectorProxyInterface for IntrospectorProxy {
3597    type GetMonikerResponseFut = fidl::client::QueryResponseFut<
3598        IntrospectorGetMonikerResult,
3599        fidl::encoding::DefaultFuchsiaResourceDialect,
3600    >;
3601    fn r#get_moniker(&self, mut component_instance: fidl::Event) -> Self::GetMonikerResponseFut {
3602        fn _decode(
3603            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3604        ) -> Result<IntrospectorGetMonikerResult, fidl::Error> {
3605            let _response = fidl::client::decode_transaction_body::<
3606                fidl::encoding::FlexibleResultType<IntrospectorGetMonikerResponse, Error>,
3607                fidl::encoding::DefaultFuchsiaResourceDialect,
3608                0x2f980ceb37bf458,
3609            >(_buf?)?
3610            .into_result::<IntrospectorMarker>("get_moniker")?;
3611            Ok(_response.map(|x| x.moniker))
3612        }
3613        self.client
3614            .send_query_and_decode::<IntrospectorGetMonikerRequest, IntrospectorGetMonikerResult>(
3615                (component_instance,),
3616                0x2f980ceb37bf458,
3617                fidl::encoding::DynamicFlags::FLEXIBLE,
3618                _decode,
3619            )
3620    }
3621}
3622
3623pub struct IntrospectorEventStream {
3624    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3625}
3626
3627impl std::marker::Unpin for IntrospectorEventStream {}
3628
3629impl futures::stream::FusedStream for IntrospectorEventStream {
3630    fn is_terminated(&self) -> bool {
3631        self.event_receiver.is_terminated()
3632    }
3633}
3634
3635impl futures::Stream for IntrospectorEventStream {
3636    type Item = Result<IntrospectorEvent, fidl::Error>;
3637
3638    fn poll_next(
3639        mut self: std::pin::Pin<&mut Self>,
3640        cx: &mut std::task::Context<'_>,
3641    ) -> std::task::Poll<Option<Self::Item>> {
3642        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3643            &mut self.event_receiver,
3644            cx
3645        )?) {
3646            Some(buf) => std::task::Poll::Ready(Some(IntrospectorEvent::decode(buf))),
3647            None => std::task::Poll::Ready(None),
3648        }
3649    }
3650}
3651
3652#[derive(Debug)]
3653pub enum IntrospectorEvent {
3654    #[non_exhaustive]
3655    _UnknownEvent {
3656        /// Ordinal of the event that was sent.
3657        ordinal: u64,
3658    },
3659}
3660
3661impl IntrospectorEvent {
3662    /// Decodes a message buffer as a [`IntrospectorEvent`].
3663    fn decode(
3664        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3665    ) -> Result<IntrospectorEvent, fidl::Error> {
3666        let (bytes, _handles) = buf.split_mut();
3667        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3668        debug_assert_eq!(tx_header.tx_id, 0);
3669        match tx_header.ordinal {
3670            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3671                Ok(IntrospectorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3672            }
3673            _ => Err(fidl::Error::UnknownOrdinal {
3674                ordinal: tx_header.ordinal,
3675                protocol_name: <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3676            }),
3677        }
3678    }
3679}
3680
3681/// A Stream of incoming requests for fuchsia.component/Introspector.
3682pub struct IntrospectorRequestStream {
3683    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3684    is_terminated: bool,
3685}
3686
3687impl std::marker::Unpin for IntrospectorRequestStream {}
3688
3689impl futures::stream::FusedStream for IntrospectorRequestStream {
3690    fn is_terminated(&self) -> bool {
3691        self.is_terminated
3692    }
3693}
3694
3695impl fidl::endpoints::RequestStream for IntrospectorRequestStream {
3696    type Protocol = IntrospectorMarker;
3697    type ControlHandle = IntrospectorControlHandle;
3698
3699    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3700        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3701    }
3702
3703    fn control_handle(&self) -> Self::ControlHandle {
3704        IntrospectorControlHandle { inner: self.inner.clone() }
3705    }
3706
3707    fn into_inner(
3708        self,
3709    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3710    {
3711        (self.inner, self.is_terminated)
3712    }
3713
3714    fn from_inner(
3715        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3716        is_terminated: bool,
3717    ) -> Self {
3718        Self { inner, is_terminated }
3719    }
3720}
3721
3722impl futures::Stream for IntrospectorRequestStream {
3723    type Item = Result<IntrospectorRequest, fidl::Error>;
3724
3725    fn poll_next(
3726        mut self: std::pin::Pin<&mut Self>,
3727        cx: &mut std::task::Context<'_>,
3728    ) -> std::task::Poll<Option<Self::Item>> {
3729        let this = &mut *self;
3730        if this.inner.check_shutdown(cx) {
3731            this.is_terminated = true;
3732            return std::task::Poll::Ready(None);
3733        }
3734        if this.is_terminated {
3735            panic!("polled IntrospectorRequestStream after completion");
3736        }
3737        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3738            |bytes, handles| {
3739                match this.inner.channel().read_etc(cx, bytes, handles) {
3740                    std::task::Poll::Ready(Ok(())) => {}
3741                    std::task::Poll::Pending => return std::task::Poll::Pending,
3742                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3743                        this.is_terminated = true;
3744                        return std::task::Poll::Ready(None);
3745                    }
3746                    std::task::Poll::Ready(Err(e)) => {
3747                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3748                            e.into(),
3749                        ))));
3750                    }
3751                }
3752
3753                // A message has been received from the channel
3754                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3755
3756                std::task::Poll::Ready(Some(match header.ordinal {
3757                    0x2f980ceb37bf458 => {
3758                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3759                        let mut req = fidl::new_empty!(
3760                            IntrospectorGetMonikerRequest,
3761                            fidl::encoding::DefaultFuchsiaResourceDialect
3762                        );
3763                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IntrospectorGetMonikerRequest>(&header, _body_bytes, handles, &mut req)?;
3764                        let control_handle =
3765                            IntrospectorControlHandle { inner: this.inner.clone() };
3766                        Ok(IntrospectorRequest::GetMoniker {
3767                            component_instance: req.component_instance,
3768
3769                            responder: IntrospectorGetMonikerResponder {
3770                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3771                                tx_id: header.tx_id,
3772                            },
3773                        })
3774                    }
3775                    _ if header.tx_id == 0
3776                        && header
3777                            .dynamic_flags()
3778                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3779                    {
3780                        Ok(IntrospectorRequest::_UnknownMethod {
3781                            ordinal: header.ordinal,
3782                            control_handle: IntrospectorControlHandle { inner: this.inner.clone() },
3783                            method_type: fidl::MethodType::OneWay,
3784                        })
3785                    }
3786                    _ if header
3787                        .dynamic_flags()
3788                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3789                    {
3790                        this.inner.send_framework_err(
3791                            fidl::encoding::FrameworkErr::UnknownMethod,
3792                            header.tx_id,
3793                            header.ordinal,
3794                            header.dynamic_flags(),
3795                            (bytes, handles),
3796                        )?;
3797                        Ok(IntrospectorRequest::_UnknownMethod {
3798                            ordinal: header.ordinal,
3799                            control_handle: IntrospectorControlHandle { inner: this.inner.clone() },
3800                            method_type: fidl::MethodType::TwoWay,
3801                        })
3802                    }
3803                    _ => Err(fidl::Error::UnknownOrdinal {
3804                        ordinal: header.ordinal,
3805                        protocol_name:
3806                            <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3807                    }),
3808                }))
3809            },
3810        )
3811    }
3812}
3813
3814/// A protocol used by a component instance to obtain information about
3815/// components in its own realm.
3816///
3817/// This protocol only supports getting the moniker at the moment but could
3818/// expand to other privileged information such as the URL of a component.
3819///
3820/// The component framework provides this capability to components that use
3821/// `fuchsia.component.Introspector` from framework.
3822#[derive(Debug)]
3823pub enum IntrospectorRequest {
3824    /// Obtains the moniker relative to this realm of the component
3825    /// corresponding to the provided token. Runners may obtain the token via
3826    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3827    ///
3828    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3829    /// does not correspond to a component under this realm.
3830    GetMoniker { component_instance: fidl::Event, responder: IntrospectorGetMonikerResponder },
3831    /// An interaction was received which does not match any known method.
3832    #[non_exhaustive]
3833    _UnknownMethod {
3834        /// Ordinal of the method that was called.
3835        ordinal: u64,
3836        control_handle: IntrospectorControlHandle,
3837        method_type: fidl::MethodType,
3838    },
3839}
3840
3841impl IntrospectorRequest {
3842    #[allow(irrefutable_let_patterns)]
3843    pub fn into_get_moniker(self) -> Option<(fidl::Event, IntrospectorGetMonikerResponder)> {
3844        if let IntrospectorRequest::GetMoniker { component_instance, responder } = self {
3845            Some((component_instance, responder))
3846        } else {
3847            None
3848        }
3849    }
3850
3851    /// Name of the method defined in FIDL
3852    pub fn method_name(&self) -> &'static str {
3853        match *self {
3854            IntrospectorRequest::GetMoniker { .. } => "get_moniker",
3855            IntrospectorRequest::_UnknownMethod {
3856                method_type: fidl::MethodType::OneWay, ..
3857            } => "unknown one-way method",
3858            IntrospectorRequest::_UnknownMethod {
3859                method_type: fidl::MethodType::TwoWay, ..
3860            } => "unknown two-way method",
3861        }
3862    }
3863}
3864
3865#[derive(Debug, Clone)]
3866pub struct IntrospectorControlHandle {
3867    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3868}
3869
3870impl fidl::endpoints::ControlHandle for IntrospectorControlHandle {
3871    fn shutdown(&self) {
3872        self.inner.shutdown()
3873    }
3874
3875    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3876        self.inner.shutdown_with_epitaph(status)
3877    }
3878
3879    fn is_closed(&self) -> bool {
3880        self.inner.channel().is_closed()
3881    }
3882    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3883        self.inner.channel().on_closed()
3884    }
3885
3886    #[cfg(target_os = "fuchsia")]
3887    fn signal_peer(
3888        &self,
3889        clear_mask: zx::Signals,
3890        set_mask: zx::Signals,
3891    ) -> Result<(), zx_status::Status> {
3892        use fidl::Peered;
3893        self.inner.channel().signal_peer(clear_mask, set_mask)
3894    }
3895}
3896
3897impl IntrospectorControlHandle {}
3898
3899#[must_use = "FIDL methods require a response to be sent"]
3900#[derive(Debug)]
3901pub struct IntrospectorGetMonikerResponder {
3902    control_handle: std::mem::ManuallyDrop<IntrospectorControlHandle>,
3903    tx_id: u32,
3904}
3905
3906/// Set the the channel to be shutdown (see [`IntrospectorControlHandle::shutdown`])
3907/// if the responder is dropped without sending a response, so that the client
3908/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3909impl std::ops::Drop for IntrospectorGetMonikerResponder {
3910    fn drop(&mut self) {
3911        self.control_handle.shutdown();
3912        // Safety: drops once, never accessed again
3913        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3914    }
3915}
3916
3917impl fidl::endpoints::Responder for IntrospectorGetMonikerResponder {
3918    type ControlHandle = IntrospectorControlHandle;
3919
3920    fn control_handle(&self) -> &IntrospectorControlHandle {
3921        &self.control_handle
3922    }
3923
3924    fn drop_without_shutdown(mut self) {
3925        // Safety: drops once, never accessed again due to mem::forget
3926        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3927        // Prevent Drop from running (which would shut down the channel)
3928        std::mem::forget(self);
3929    }
3930}
3931
3932impl IntrospectorGetMonikerResponder {
3933    /// Sends a response to the FIDL transaction.
3934    ///
3935    /// Sets the channel to shutdown if an error occurs.
3936    pub fn send(self, mut result: Result<&str, Error>) -> Result<(), fidl::Error> {
3937        let _result = self.send_raw(result);
3938        if _result.is_err() {
3939            self.control_handle.shutdown();
3940        }
3941        self.drop_without_shutdown();
3942        _result
3943    }
3944
3945    /// Similar to "send" but does not shutdown the channel if an error occurs.
3946    pub fn send_no_shutdown_on_err(
3947        self,
3948        mut result: Result<&str, Error>,
3949    ) -> Result<(), fidl::Error> {
3950        let _result = self.send_raw(result);
3951        self.drop_without_shutdown();
3952        _result
3953    }
3954
3955    fn send_raw(&self, mut result: Result<&str, Error>) -> Result<(), fidl::Error> {
3956        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3957            IntrospectorGetMonikerResponse,
3958            Error,
3959        >>(
3960            fidl::encoding::FlexibleResult::new(result.map(|moniker| (moniker,))),
3961            self.tx_id,
3962            0x2f980ceb37bf458,
3963            fidl::encoding::DynamicFlags::FLEXIBLE,
3964        )
3965    }
3966}
3967
3968#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3969pub struct NamespaceMarker;
3970
3971impl fidl::endpoints::ProtocolMarker for NamespaceMarker {
3972    type Proxy = NamespaceProxy;
3973    type RequestStream = NamespaceRequestStream;
3974    #[cfg(target_os = "fuchsia")]
3975    type SynchronousProxy = NamespaceSynchronousProxy;
3976
3977    const DEBUG_NAME: &'static str = "fuchsia.component.Namespace";
3978}
3979impl fidl::endpoints::DiscoverableProtocolMarker for NamespaceMarker {}
3980pub type NamespaceCreateResult = Result<Vec<NamespaceEntry>, NamespaceError>;
3981
3982pub trait NamespaceProxyInterface: Send + Sync {
3983    type CreateResponseFut: std::future::Future<Output = Result<NamespaceCreateResult, fidl::Error>>
3984        + Send;
3985    fn r#create(&self, entries: Vec<NamespaceInputEntry>) -> Self::CreateResponseFut;
3986}
3987#[derive(Debug)]
3988#[cfg(target_os = "fuchsia")]
3989pub struct NamespaceSynchronousProxy {
3990    client: fidl::client::sync::Client,
3991}
3992
3993#[cfg(target_os = "fuchsia")]
3994impl fidl::endpoints::SynchronousProxy for NamespaceSynchronousProxy {
3995    type Proxy = NamespaceProxy;
3996    type Protocol = NamespaceMarker;
3997
3998    fn from_channel(inner: fidl::Channel) -> Self {
3999        Self::new(inner)
4000    }
4001
4002    fn into_channel(self) -> fidl::Channel {
4003        self.client.into_channel()
4004    }
4005
4006    fn as_channel(&self) -> &fidl::Channel {
4007        self.client.as_channel()
4008    }
4009}
4010
4011#[cfg(target_os = "fuchsia")]
4012impl NamespaceSynchronousProxy {
4013    pub fn new(channel: fidl::Channel) -> Self {
4014        let protocol_name = <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4015        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4016    }
4017
4018    pub fn into_channel(self) -> fidl::Channel {
4019        self.client.into_channel()
4020    }
4021
4022    /// Waits until an event arrives and returns it. It is safe for other
4023    /// threads to make concurrent requests while waiting for an event.
4024    pub fn wait_for_event(
4025        &self,
4026        deadline: zx::MonotonicInstant,
4027    ) -> Result<NamespaceEvent, fidl::Error> {
4028        NamespaceEvent::decode(self.client.wait_for_event(deadline)?)
4029    }
4030
4031    pub fn r#create(
4032        &self,
4033        mut entries: Vec<NamespaceInputEntry>,
4034        ___deadline: zx::MonotonicInstant,
4035    ) -> Result<NamespaceCreateResult, fidl::Error> {
4036        let _response = self.client.send_query::<
4037            NamespaceCreateRequest,
4038            fidl::encoding::FlexibleResultType<NamespaceCreateResponse, NamespaceError>,
4039        >(
4040            (entries.as_mut(),),
4041            0x4329fe12b2a790f9,
4042            fidl::encoding::DynamicFlags::FLEXIBLE,
4043            ___deadline,
4044        )?
4045        .into_result::<NamespaceMarker>("create")?;
4046        Ok(_response.map(|x| x.entries))
4047    }
4048}
4049
4050#[cfg(target_os = "fuchsia")]
4051impl From<NamespaceSynchronousProxy> for zx::NullableHandle {
4052    fn from(value: NamespaceSynchronousProxy) -> Self {
4053        value.into_channel().into()
4054    }
4055}
4056
4057#[cfg(target_os = "fuchsia")]
4058impl From<fidl::Channel> for NamespaceSynchronousProxy {
4059    fn from(value: fidl::Channel) -> Self {
4060        Self::new(value)
4061    }
4062}
4063
4064#[cfg(target_os = "fuchsia")]
4065impl fidl::endpoints::FromClient for NamespaceSynchronousProxy {
4066    type Protocol = NamespaceMarker;
4067
4068    fn from_client(value: fidl::endpoints::ClientEnd<NamespaceMarker>) -> Self {
4069        Self::new(value.into_channel())
4070    }
4071}
4072
4073#[derive(Debug, Clone)]
4074pub struct NamespaceProxy {
4075    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4076}
4077
4078impl fidl::endpoints::Proxy for NamespaceProxy {
4079    type Protocol = NamespaceMarker;
4080
4081    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4082        Self::new(inner)
4083    }
4084
4085    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4086        self.client.into_channel().map_err(|client| Self { client })
4087    }
4088
4089    fn as_channel(&self) -> &::fidl::AsyncChannel {
4090        self.client.as_channel()
4091    }
4092}
4093
4094impl NamespaceProxy {
4095    /// Create a new Proxy for fuchsia.component/Namespace.
4096    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4097        let protocol_name = <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4098        Self { client: fidl::client::Client::new(channel, protocol_name) }
4099    }
4100
4101    /// Get a Stream of events from the remote end of the protocol.
4102    ///
4103    /// # Panics
4104    ///
4105    /// Panics if the event stream was already taken.
4106    pub fn take_event_stream(&self) -> NamespaceEventStream {
4107        NamespaceEventStream { event_receiver: self.client.take_event_receiver() }
4108    }
4109
4110    pub fn r#create(
4111        &self,
4112        mut entries: Vec<NamespaceInputEntry>,
4113    ) -> fidl::client::QueryResponseFut<
4114        NamespaceCreateResult,
4115        fidl::encoding::DefaultFuchsiaResourceDialect,
4116    > {
4117        NamespaceProxyInterface::r#create(self, entries)
4118    }
4119}
4120
4121impl NamespaceProxyInterface for NamespaceProxy {
4122    type CreateResponseFut = fidl::client::QueryResponseFut<
4123        NamespaceCreateResult,
4124        fidl::encoding::DefaultFuchsiaResourceDialect,
4125    >;
4126    fn r#create(&self, mut entries: Vec<NamespaceInputEntry>) -> Self::CreateResponseFut {
4127        fn _decode(
4128            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4129        ) -> Result<NamespaceCreateResult, fidl::Error> {
4130            let _response = fidl::client::decode_transaction_body::<
4131                fidl::encoding::FlexibleResultType<NamespaceCreateResponse, NamespaceError>,
4132                fidl::encoding::DefaultFuchsiaResourceDialect,
4133                0x4329fe12b2a790f9,
4134            >(_buf?)?
4135            .into_result::<NamespaceMarker>("create")?;
4136            Ok(_response.map(|x| x.entries))
4137        }
4138        self.client.send_query_and_decode::<NamespaceCreateRequest, NamespaceCreateResult>(
4139            (entries.as_mut(),),
4140            0x4329fe12b2a790f9,
4141            fidl::encoding::DynamicFlags::FLEXIBLE,
4142            _decode,
4143        )
4144    }
4145}
4146
4147pub struct NamespaceEventStream {
4148    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4149}
4150
4151impl std::marker::Unpin for NamespaceEventStream {}
4152
4153impl futures::stream::FusedStream for NamespaceEventStream {
4154    fn is_terminated(&self) -> bool {
4155        self.event_receiver.is_terminated()
4156    }
4157}
4158
4159impl futures::Stream for NamespaceEventStream {
4160    type Item = Result<NamespaceEvent, fidl::Error>;
4161
4162    fn poll_next(
4163        mut self: std::pin::Pin<&mut Self>,
4164        cx: &mut std::task::Context<'_>,
4165    ) -> std::task::Poll<Option<Self::Item>> {
4166        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4167            &mut self.event_receiver,
4168            cx
4169        )?) {
4170            Some(buf) => std::task::Poll::Ready(Some(NamespaceEvent::decode(buf))),
4171            None => std::task::Poll::Ready(None),
4172        }
4173    }
4174}
4175
4176#[derive(Debug)]
4177pub enum NamespaceEvent {
4178    #[non_exhaustive]
4179    _UnknownEvent {
4180        /// Ordinal of the event that was sent.
4181        ordinal: u64,
4182    },
4183}
4184
4185impl NamespaceEvent {
4186    /// Decodes a message buffer as a [`NamespaceEvent`].
4187    fn decode(
4188        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4189    ) -> Result<NamespaceEvent, fidl::Error> {
4190        let (bytes, _handles) = buf.split_mut();
4191        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4192        debug_assert_eq!(tx_header.tx_id, 0);
4193        match tx_header.ordinal {
4194            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4195                Ok(NamespaceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4196            }
4197            _ => Err(fidl::Error::UnknownOrdinal {
4198                ordinal: tx_header.ordinal,
4199                protocol_name: <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4200            }),
4201        }
4202    }
4203}
4204
4205/// A Stream of incoming requests for fuchsia.component/Namespace.
4206pub struct NamespaceRequestStream {
4207    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4208    is_terminated: bool,
4209}
4210
4211impl std::marker::Unpin for NamespaceRequestStream {}
4212
4213impl futures::stream::FusedStream for NamespaceRequestStream {
4214    fn is_terminated(&self) -> bool {
4215        self.is_terminated
4216    }
4217}
4218
4219impl fidl::endpoints::RequestStream for NamespaceRequestStream {
4220    type Protocol = NamespaceMarker;
4221    type ControlHandle = NamespaceControlHandle;
4222
4223    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4224        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4225    }
4226
4227    fn control_handle(&self) -> Self::ControlHandle {
4228        NamespaceControlHandle { inner: self.inner.clone() }
4229    }
4230
4231    fn into_inner(
4232        self,
4233    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4234    {
4235        (self.inner, self.is_terminated)
4236    }
4237
4238    fn from_inner(
4239        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4240        is_terminated: bool,
4241    ) -> Self {
4242        Self { inner, is_terminated }
4243    }
4244}
4245
4246impl futures::Stream for NamespaceRequestStream {
4247    type Item = Result<NamespaceRequest, fidl::Error>;
4248
4249    fn poll_next(
4250        mut self: std::pin::Pin<&mut Self>,
4251        cx: &mut std::task::Context<'_>,
4252    ) -> std::task::Poll<Option<Self::Item>> {
4253        let this = &mut *self;
4254        if this.inner.check_shutdown(cx) {
4255            this.is_terminated = true;
4256            return std::task::Poll::Ready(None);
4257        }
4258        if this.is_terminated {
4259            panic!("polled NamespaceRequestStream after completion");
4260        }
4261        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4262            |bytes, handles| {
4263                match this.inner.channel().read_etc(cx, bytes, handles) {
4264                    std::task::Poll::Ready(Ok(())) => {}
4265                    std::task::Poll::Pending => return std::task::Poll::Pending,
4266                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4267                        this.is_terminated = true;
4268                        return std::task::Poll::Ready(None);
4269                    }
4270                    std::task::Poll::Ready(Err(e)) => {
4271                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4272                            e.into(),
4273                        ))));
4274                    }
4275                }
4276
4277                // A message has been received from the channel
4278                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4279
4280                std::task::Poll::Ready(Some(match header.ordinal {
4281                    0x4329fe12b2a790f9 => {
4282                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4283                        let mut req = fidl::new_empty!(
4284                            NamespaceCreateRequest,
4285                            fidl::encoding::DefaultFuchsiaResourceDialect
4286                        );
4287                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NamespaceCreateRequest>(&header, _body_bytes, handles, &mut req)?;
4288                        let control_handle = NamespaceControlHandle { inner: this.inner.clone() };
4289                        Ok(NamespaceRequest::Create {
4290                            entries: req.entries,
4291
4292                            responder: NamespaceCreateResponder {
4293                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4294                                tx_id: header.tx_id,
4295                            },
4296                        })
4297                    }
4298                    _ if header.tx_id == 0
4299                        && header
4300                            .dynamic_flags()
4301                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4302                    {
4303                        Ok(NamespaceRequest::_UnknownMethod {
4304                            ordinal: header.ordinal,
4305                            control_handle: NamespaceControlHandle { inner: this.inner.clone() },
4306                            method_type: fidl::MethodType::OneWay,
4307                        })
4308                    }
4309                    _ if header
4310                        .dynamic_flags()
4311                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4312                    {
4313                        this.inner.send_framework_err(
4314                            fidl::encoding::FrameworkErr::UnknownMethod,
4315                            header.tx_id,
4316                            header.ordinal,
4317                            header.dynamic_flags(),
4318                            (bytes, handles),
4319                        )?;
4320                        Ok(NamespaceRequest::_UnknownMethod {
4321                            ordinal: header.ordinal,
4322                            control_handle: NamespaceControlHandle { inner: this.inner.clone() },
4323                            method_type: fidl::MethodType::TwoWay,
4324                        })
4325                    }
4326                    _ => Err(fidl::Error::UnknownOrdinal {
4327                        ordinal: header.ordinal,
4328                        protocol_name:
4329                            <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4330                    }),
4331                }))
4332            },
4333        )
4334    }
4335}
4336
4337/// Protocol for performing namespace operations.
4338#[derive(Debug)]
4339pub enum NamespaceRequest {
4340    Create {
4341        entries: Vec<NamespaceInputEntry>,
4342        responder: NamespaceCreateResponder,
4343    },
4344    /// An interaction was received which does not match any known method.
4345    #[non_exhaustive]
4346    _UnknownMethod {
4347        /// Ordinal of the method that was called.
4348        ordinal: u64,
4349        control_handle: NamespaceControlHandle,
4350        method_type: fidl::MethodType,
4351    },
4352}
4353
4354impl NamespaceRequest {
4355    #[allow(irrefutable_let_patterns)]
4356    pub fn into_create(self) -> Option<(Vec<NamespaceInputEntry>, NamespaceCreateResponder)> {
4357        if let NamespaceRequest::Create { entries, responder } = self {
4358            Some((entries, responder))
4359        } else {
4360            None
4361        }
4362    }
4363
4364    /// Name of the method defined in FIDL
4365    pub fn method_name(&self) -> &'static str {
4366        match *self {
4367            NamespaceRequest::Create { .. } => "create",
4368            NamespaceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4369                "unknown one-way method"
4370            }
4371            NamespaceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4372                "unknown two-way method"
4373            }
4374        }
4375    }
4376}
4377
4378#[derive(Debug, Clone)]
4379pub struct NamespaceControlHandle {
4380    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4381}
4382
4383impl fidl::endpoints::ControlHandle for NamespaceControlHandle {
4384    fn shutdown(&self) {
4385        self.inner.shutdown()
4386    }
4387
4388    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4389        self.inner.shutdown_with_epitaph(status)
4390    }
4391
4392    fn is_closed(&self) -> bool {
4393        self.inner.channel().is_closed()
4394    }
4395    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4396        self.inner.channel().on_closed()
4397    }
4398
4399    #[cfg(target_os = "fuchsia")]
4400    fn signal_peer(
4401        &self,
4402        clear_mask: zx::Signals,
4403        set_mask: zx::Signals,
4404    ) -> Result<(), zx_status::Status> {
4405        use fidl::Peered;
4406        self.inner.channel().signal_peer(clear_mask, set_mask)
4407    }
4408}
4409
4410impl NamespaceControlHandle {}
4411
4412#[must_use = "FIDL methods require a response to be sent"]
4413#[derive(Debug)]
4414pub struct NamespaceCreateResponder {
4415    control_handle: std::mem::ManuallyDrop<NamespaceControlHandle>,
4416    tx_id: u32,
4417}
4418
4419/// Set the the channel to be shutdown (see [`NamespaceControlHandle::shutdown`])
4420/// if the responder is dropped without sending a response, so that the client
4421/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4422impl std::ops::Drop for NamespaceCreateResponder {
4423    fn drop(&mut self) {
4424        self.control_handle.shutdown();
4425        // Safety: drops once, never accessed again
4426        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4427    }
4428}
4429
4430impl fidl::endpoints::Responder for NamespaceCreateResponder {
4431    type ControlHandle = NamespaceControlHandle;
4432
4433    fn control_handle(&self) -> &NamespaceControlHandle {
4434        &self.control_handle
4435    }
4436
4437    fn drop_without_shutdown(mut self) {
4438        // Safety: drops once, never accessed again due to mem::forget
4439        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4440        // Prevent Drop from running (which would shut down the channel)
4441        std::mem::forget(self);
4442    }
4443}
4444
4445impl NamespaceCreateResponder {
4446    /// Sends a response to the FIDL transaction.
4447    ///
4448    /// Sets the channel to shutdown if an error occurs.
4449    pub fn send(
4450        self,
4451        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4452    ) -> Result<(), fidl::Error> {
4453        let _result = self.send_raw(result);
4454        if _result.is_err() {
4455            self.control_handle.shutdown();
4456        }
4457        self.drop_without_shutdown();
4458        _result
4459    }
4460
4461    /// Similar to "send" but does not shutdown the channel if an error occurs.
4462    pub fn send_no_shutdown_on_err(
4463        self,
4464        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4465    ) -> Result<(), fidl::Error> {
4466        let _result = self.send_raw(result);
4467        self.drop_without_shutdown();
4468        _result
4469    }
4470
4471    fn send_raw(
4472        &self,
4473        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4474    ) -> Result<(), fidl::Error> {
4475        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4476            NamespaceCreateResponse,
4477            NamespaceError,
4478        >>(
4479            fidl::encoding::FlexibleResult::new(
4480                result.as_mut().map_err(|e| *e).map(|entries| (entries.as_mut_slice(),)),
4481            ),
4482            self.tx_id,
4483            0x4329fe12b2a790f9,
4484            fidl::encoding::DynamicFlags::FLEXIBLE,
4485        )
4486    }
4487}
4488
4489#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4490pub struct RealmMarker;
4491
4492impl fidl::endpoints::ProtocolMarker for RealmMarker {
4493    type Proxy = RealmProxy;
4494    type RequestStream = RealmRequestStream;
4495    #[cfg(target_os = "fuchsia")]
4496    type SynchronousProxy = RealmSynchronousProxy;
4497
4498    const DEBUG_NAME: &'static str = "fuchsia.component.Realm";
4499}
4500impl fidl::endpoints::DiscoverableProtocolMarker for RealmMarker {}
4501pub type RealmOpenControllerResult = Result<(), Error>;
4502pub type RealmOpenExposedDirResult = Result<(), Error>;
4503pub type RealmCreateChildResult = Result<(), Error>;
4504pub type RealmDestroyChildResult = Result<(), Error>;
4505pub type RealmListChildrenResult = Result<(), Error>;
4506pub type RealmGetResolvedInfoResult = Result<fidl_fuchsia_component_resolution::Component, Error>;
4507pub type RealmGetChildOutputDictionaryResult =
4508    Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>;
4509
4510pub trait RealmProxyInterface: Send + Sync {
4511    type OpenControllerResponseFut: std::future::Future<Output = Result<RealmOpenControllerResult, fidl::Error>>
4512        + Send;
4513    fn r#open_controller(
4514        &self,
4515        child: &fidl_fuchsia_component_decl::ChildRef,
4516        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
4517    ) -> Self::OpenControllerResponseFut;
4518    type OpenExposedDirResponseFut: std::future::Future<Output = Result<RealmOpenExposedDirResult, fidl::Error>>
4519        + Send;
4520    fn r#open_exposed_dir(
4521        &self,
4522        child: &fidl_fuchsia_component_decl::ChildRef,
4523        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4524    ) -> Self::OpenExposedDirResponseFut;
4525    type CreateChildResponseFut: std::future::Future<Output = Result<RealmCreateChildResult, fidl::Error>>
4526        + Send;
4527    fn r#create_child(
4528        &self,
4529        collection: &fidl_fuchsia_component_decl::CollectionRef,
4530        decl: &fidl_fuchsia_component_decl::Child,
4531        args: CreateChildArgs,
4532    ) -> Self::CreateChildResponseFut;
4533    type DestroyChildResponseFut: std::future::Future<Output = Result<RealmDestroyChildResult, fidl::Error>>
4534        + Send;
4535    fn r#destroy_child(
4536        &self,
4537        child: &fidl_fuchsia_component_decl::ChildRef,
4538    ) -> Self::DestroyChildResponseFut;
4539    type ListChildrenResponseFut: std::future::Future<Output = Result<RealmListChildrenResult, fidl::Error>>
4540        + Send;
4541    fn r#list_children(
4542        &self,
4543        collection: &fidl_fuchsia_component_decl::CollectionRef,
4544        iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
4545    ) -> Self::ListChildrenResponseFut;
4546    type GetResolvedInfoResponseFut: std::future::Future<Output = Result<RealmGetResolvedInfoResult, fidl::Error>>
4547        + Send;
4548    fn r#get_resolved_info(&self) -> Self::GetResolvedInfoResponseFut;
4549    type GetChildOutputDictionaryResponseFut: std::future::Future<Output = Result<RealmGetChildOutputDictionaryResult, fidl::Error>>
4550        + Send;
4551    fn r#get_child_output_dictionary(
4552        &self,
4553        child: &fidl_fuchsia_component_decl::ChildRef,
4554    ) -> Self::GetChildOutputDictionaryResponseFut;
4555}
4556#[derive(Debug)]
4557#[cfg(target_os = "fuchsia")]
4558pub struct RealmSynchronousProxy {
4559    client: fidl::client::sync::Client,
4560}
4561
4562#[cfg(target_os = "fuchsia")]
4563impl fidl::endpoints::SynchronousProxy for RealmSynchronousProxy {
4564    type Proxy = RealmProxy;
4565    type Protocol = RealmMarker;
4566
4567    fn from_channel(inner: fidl::Channel) -> Self {
4568        Self::new(inner)
4569    }
4570
4571    fn into_channel(self) -> fidl::Channel {
4572        self.client.into_channel()
4573    }
4574
4575    fn as_channel(&self) -> &fidl::Channel {
4576        self.client.as_channel()
4577    }
4578}
4579
4580#[cfg(target_os = "fuchsia")]
4581impl RealmSynchronousProxy {
4582    pub fn new(channel: fidl::Channel) -> Self {
4583        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4584        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4585    }
4586
4587    pub fn into_channel(self) -> fidl::Channel {
4588        self.client.into_channel()
4589    }
4590
4591    /// Waits until an event arrives and returns it. It is safe for other
4592    /// threads to make concurrent requests while waiting for an event.
4593    pub fn wait_for_event(
4594        &self,
4595        deadline: zx::MonotonicInstant,
4596    ) -> Result<RealmEvent, fidl::Error> {
4597        RealmEvent::decode(self.client.wait_for_event(deadline)?)
4598    }
4599
4600    /// Operate on a child component. See documentation for [`Controller`].
4601    ///
4602    /// Errors:
4603    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
4604    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4605    /// - `INSTANCE_DIED`: This realm no longer exists.
4606    pub fn r#open_controller(
4607        &self,
4608        mut child: &fidl_fuchsia_component_decl::ChildRef,
4609        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
4610        ___deadline: zx::MonotonicInstant,
4611    ) -> Result<RealmOpenControllerResult, fidl::Error> {
4612        let _response = self.client.send_query::<
4613            RealmOpenControllerRequest,
4614            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4615        >(
4616            (child, controller,),
4617            0x7150b7898d1b1180,
4618            fidl::encoding::DynamicFlags::empty(),
4619            ___deadline,
4620        )?;
4621        Ok(_response.map(|x| x))
4622    }
4623
4624    /// Opens the exposed directory of a child component. When this function
4625    /// successfully returns, `exposed_dir` is bound to a directory that
4626    /// contains the capabilities which the child exposed to its realm via
4627    /// `ComponentDecl.exposes` (specified via "expose" declarations in the
4628    /// component's manifest). The child component will not start as a result of
4629    /// this call.
4630    ///
4631    /// `exposed_dir` is open as long as `child` exists.
4632    ///
4633    /// Errors:
4634    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
4635    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4636    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
4637    /// - `INSTANCE_DIED`: This realm no longer exists.
4638    pub fn r#open_exposed_dir(
4639        &self,
4640        mut child: &fidl_fuchsia_component_decl::ChildRef,
4641        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4642        ___deadline: zx::MonotonicInstant,
4643    ) -> Result<RealmOpenExposedDirResult, fidl::Error> {
4644        let _response = self.client.send_query::<
4645            RealmOpenExposedDirRequest,
4646            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4647        >(
4648            (child, exposed_dir,),
4649            0x7f993235ca59f92c,
4650            fidl::encoding::DynamicFlags::empty(),
4651            ___deadline,
4652        )?;
4653        Ok(_response.map(|x| x))
4654    }
4655
4656    /// Creates a child component instance dynamically. When this function
4657    /// returns successfully, the instance exists, but it may not be running.
4658    ///
4659    /// The environment of the child instance is determined by the environment
4660    /// of the collection. `decl` must not set `environment`.
4661    ///
4662    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
4663    /// [CreateChild] will start the component and return once the component is
4664    /// started. Otherwise, [CreateChild] will return immediately after creating
4665    /// the component and will not start or resolve it.
4666    ///
4667    /// Errors:
4668    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
4669    ///   is not a valid declaration.
4670    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4671    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
4672    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
4673    ///   in a `SingleRun` collection.
4674    /// - `NO_SPACE`: Could not allocate storage for the new instance.
4675    /// - `INSTANCE_DIED`: This realm no longer exists.
4676    pub fn r#create_child(
4677        &self,
4678        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4679        mut decl: &fidl_fuchsia_component_decl::Child,
4680        mut args: CreateChildArgs,
4681        ___deadline: zx::MonotonicInstant,
4682    ) -> Result<RealmCreateChildResult, fidl::Error> {
4683        let _response = self.client.send_query::<
4684            RealmCreateChildRequest,
4685            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4686        >(
4687            (collection, decl, &mut args,),
4688            0x43e48ce8483d7560,
4689            fidl::encoding::DynamicFlags::empty(),
4690            ___deadline,
4691        )?;
4692        Ok(_response.map(|x| x))
4693    }
4694
4695    /// Destroys a dynamically-created component instance. When this function
4696    /// returns, the instance is destroyed and has stopped running.  However,
4697    /// cleanup of the component's resources (such as its isolated storage) may
4698    /// happen in the background after this function returns.
4699    ///
4700    /// Errors:
4701    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
4702    ///   to a dynamic instance.
4703    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4704    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4705    /// - `INSTANCE_DIED`: This realm no longer exists.
4706    pub fn r#destroy_child(
4707        &self,
4708        mut child: &fidl_fuchsia_component_decl::ChildRef,
4709        ___deadline: zx::MonotonicInstant,
4710    ) -> Result<RealmDestroyChildResult, fidl::Error> {
4711        let _response = self.client.send_query::<
4712            RealmDestroyChildRequest,
4713            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4714        >(
4715            (child,),
4716            0x71d8caf8850c9222,
4717            fidl::encoding::DynamicFlags::empty(),
4718            ___deadline,
4719        )?;
4720        Ok(_response.map(|x| x))
4721    }
4722
4723    /// Returns an iterator that lists all instances in a collection.
4724    ///
4725    /// NOTE: The results are not guaranteed to be consistent. Instances may be
4726    /// created or destroyed while the iterator is live, but those changes
4727    /// won't be observed by the iterator after this method returns.
4728    ///
4729    /// Errors:
4730    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
4731    /// does not have `ZX_RIGHT_WAIT`.
4732    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4733    /// - `INSTANCE_DIED`: This realm no longer exists.
4734    /// - If `iter` does not have standard channel rights, this function may
4735    ///   return `ACCESS_DENIED` or component manager may close `iter`.
4736    pub fn r#list_children(
4737        &self,
4738        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4739        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
4740        ___deadline: zx::MonotonicInstant,
4741    ) -> Result<RealmListChildrenResult, fidl::Error> {
4742        let _response = self.client.send_query::<
4743            RealmListChildrenRequest,
4744            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4745        >(
4746            (collection, iter,),
4747            0x6888a76683efc0a1,
4748            fidl::encoding::DynamicFlags::empty(),
4749            ___deadline,
4750        )?;
4751        Ok(_response.map(|x| x))
4752    }
4753
4754    /// Returns the set of information that was given to the component framework
4755    /// by this component's resolver.
4756    pub fn r#get_resolved_info(
4757        &self,
4758        ___deadline: zx::MonotonicInstant,
4759    ) -> Result<RealmGetResolvedInfoResult, fidl::Error> {
4760        let _response = self.client.send_query::<
4761            fidl::encoding::EmptyPayload,
4762            fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>,
4763        >(
4764            (),
4765            0x734f744cb7d210a2,
4766            fidl::encoding::DynamicFlags::empty(),
4767            ___deadline,
4768        )?;
4769        Ok(_response.map(|x| x.resolved_info))
4770    }
4771
4772    pub fn r#get_child_output_dictionary(
4773        &self,
4774        mut child: &fidl_fuchsia_component_decl::ChildRef,
4775        ___deadline: zx::MonotonicInstant,
4776    ) -> Result<RealmGetChildOutputDictionaryResult, fidl::Error> {
4777        let _response = self.client.send_query::<
4778            RealmGetChildOutputDictionaryRequest,
4779            fidl::encoding::ResultType<RealmGetChildOutputDictionaryResponse, Error>,
4780        >(
4781            (child,),
4782            0x4259d08d261d5610,
4783            fidl::encoding::DynamicFlags::empty(),
4784            ___deadline,
4785        )?;
4786        Ok(_response.map(|x| x.dictionary))
4787    }
4788}
4789
4790#[cfg(target_os = "fuchsia")]
4791impl From<RealmSynchronousProxy> for zx::NullableHandle {
4792    fn from(value: RealmSynchronousProxy) -> Self {
4793        value.into_channel().into()
4794    }
4795}
4796
4797#[cfg(target_os = "fuchsia")]
4798impl From<fidl::Channel> for RealmSynchronousProxy {
4799    fn from(value: fidl::Channel) -> Self {
4800        Self::new(value)
4801    }
4802}
4803
4804#[cfg(target_os = "fuchsia")]
4805impl fidl::endpoints::FromClient for RealmSynchronousProxy {
4806    type Protocol = RealmMarker;
4807
4808    fn from_client(value: fidl::endpoints::ClientEnd<RealmMarker>) -> Self {
4809        Self::new(value.into_channel())
4810    }
4811}
4812
4813#[derive(Debug, Clone)]
4814pub struct RealmProxy {
4815    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4816}
4817
4818impl fidl::endpoints::Proxy for RealmProxy {
4819    type Protocol = RealmMarker;
4820
4821    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4822        Self::new(inner)
4823    }
4824
4825    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4826        self.client.into_channel().map_err(|client| Self { client })
4827    }
4828
4829    fn as_channel(&self) -> &::fidl::AsyncChannel {
4830        self.client.as_channel()
4831    }
4832}
4833
4834impl RealmProxy {
4835    /// Create a new Proxy for fuchsia.component/Realm.
4836    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4837        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4838        Self { client: fidl::client::Client::new(channel, protocol_name) }
4839    }
4840
4841    /// Get a Stream of events from the remote end of the protocol.
4842    ///
4843    /// # Panics
4844    ///
4845    /// Panics if the event stream was already taken.
4846    pub fn take_event_stream(&self) -> RealmEventStream {
4847        RealmEventStream { event_receiver: self.client.take_event_receiver() }
4848    }
4849
4850    /// Operate on a child component. See documentation for [`Controller`].
4851    ///
4852    /// Errors:
4853    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
4854    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4855    /// - `INSTANCE_DIED`: This realm no longer exists.
4856    pub fn r#open_controller(
4857        &self,
4858        mut child: &fidl_fuchsia_component_decl::ChildRef,
4859        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
4860    ) -> fidl::client::QueryResponseFut<
4861        RealmOpenControllerResult,
4862        fidl::encoding::DefaultFuchsiaResourceDialect,
4863    > {
4864        RealmProxyInterface::r#open_controller(self, child, controller)
4865    }
4866
4867    /// Opens the exposed directory of a child component. When this function
4868    /// successfully returns, `exposed_dir` is bound to a directory that
4869    /// contains the capabilities which the child exposed to its realm via
4870    /// `ComponentDecl.exposes` (specified via "expose" declarations in the
4871    /// component's manifest). The child component will not start as a result of
4872    /// this call.
4873    ///
4874    /// `exposed_dir` is open as long as `child` exists.
4875    ///
4876    /// Errors:
4877    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
4878    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4879    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
4880    /// - `INSTANCE_DIED`: This realm no longer exists.
4881    pub fn r#open_exposed_dir(
4882        &self,
4883        mut child: &fidl_fuchsia_component_decl::ChildRef,
4884        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4885    ) -> fidl::client::QueryResponseFut<
4886        RealmOpenExposedDirResult,
4887        fidl::encoding::DefaultFuchsiaResourceDialect,
4888    > {
4889        RealmProxyInterface::r#open_exposed_dir(self, child, exposed_dir)
4890    }
4891
4892    /// Creates a child component instance dynamically. When this function
4893    /// returns successfully, the instance exists, but it may not be running.
4894    ///
4895    /// The environment of the child instance is determined by the environment
4896    /// of the collection. `decl` must not set `environment`.
4897    ///
4898    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
4899    /// [CreateChild] will start the component and return once the component is
4900    /// started. Otherwise, [CreateChild] will return immediately after creating
4901    /// the component and will not start or resolve it.
4902    ///
4903    /// Errors:
4904    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
4905    ///   is not a valid declaration.
4906    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4907    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
4908    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
4909    ///   in a `SingleRun` collection.
4910    /// - `NO_SPACE`: Could not allocate storage for the new instance.
4911    /// - `INSTANCE_DIED`: This realm no longer exists.
4912    pub fn r#create_child(
4913        &self,
4914        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4915        mut decl: &fidl_fuchsia_component_decl::Child,
4916        mut args: CreateChildArgs,
4917    ) -> fidl::client::QueryResponseFut<
4918        RealmCreateChildResult,
4919        fidl::encoding::DefaultFuchsiaResourceDialect,
4920    > {
4921        RealmProxyInterface::r#create_child(self, collection, decl, args)
4922    }
4923
4924    /// Destroys a dynamically-created component instance. When this function
4925    /// returns, the instance is destroyed and has stopped running.  However,
4926    /// cleanup of the component's resources (such as its isolated storage) may
4927    /// happen in the background after this function returns.
4928    ///
4929    /// Errors:
4930    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
4931    ///   to a dynamic instance.
4932    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4933    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4934    /// - `INSTANCE_DIED`: This realm no longer exists.
4935    pub fn r#destroy_child(
4936        &self,
4937        mut child: &fidl_fuchsia_component_decl::ChildRef,
4938    ) -> fidl::client::QueryResponseFut<
4939        RealmDestroyChildResult,
4940        fidl::encoding::DefaultFuchsiaResourceDialect,
4941    > {
4942        RealmProxyInterface::r#destroy_child(self, child)
4943    }
4944
4945    /// Returns an iterator that lists all instances in a collection.
4946    ///
4947    /// NOTE: The results are not guaranteed to be consistent. Instances may be
4948    /// created or destroyed while the iterator is live, but those changes
4949    /// won't be observed by the iterator after this method returns.
4950    ///
4951    /// Errors:
4952    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
4953    /// does not have `ZX_RIGHT_WAIT`.
4954    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4955    /// - `INSTANCE_DIED`: This realm no longer exists.
4956    /// - If `iter` does not have standard channel rights, this function may
4957    ///   return `ACCESS_DENIED` or component manager may close `iter`.
4958    pub fn r#list_children(
4959        &self,
4960        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4961        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
4962    ) -> fidl::client::QueryResponseFut<
4963        RealmListChildrenResult,
4964        fidl::encoding::DefaultFuchsiaResourceDialect,
4965    > {
4966        RealmProxyInterface::r#list_children(self, collection, iter)
4967    }
4968
4969    /// Returns the set of information that was given to the component framework
4970    /// by this component's resolver.
4971    pub fn r#get_resolved_info(
4972        &self,
4973    ) -> fidl::client::QueryResponseFut<
4974        RealmGetResolvedInfoResult,
4975        fidl::encoding::DefaultFuchsiaResourceDialect,
4976    > {
4977        RealmProxyInterface::r#get_resolved_info(self)
4978    }
4979
4980    pub fn r#get_child_output_dictionary(
4981        &self,
4982        mut child: &fidl_fuchsia_component_decl::ChildRef,
4983    ) -> fidl::client::QueryResponseFut<
4984        RealmGetChildOutputDictionaryResult,
4985        fidl::encoding::DefaultFuchsiaResourceDialect,
4986    > {
4987        RealmProxyInterface::r#get_child_output_dictionary(self, child)
4988    }
4989}
4990
4991impl RealmProxyInterface for RealmProxy {
4992    type OpenControllerResponseFut = fidl::client::QueryResponseFut<
4993        RealmOpenControllerResult,
4994        fidl::encoding::DefaultFuchsiaResourceDialect,
4995    >;
4996    fn r#open_controller(
4997        &self,
4998        mut child: &fidl_fuchsia_component_decl::ChildRef,
4999        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5000    ) -> Self::OpenControllerResponseFut {
5001        fn _decode(
5002            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5003        ) -> Result<RealmOpenControllerResult, fidl::Error> {
5004            let _response = fidl::client::decode_transaction_body::<
5005                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5006                fidl::encoding::DefaultFuchsiaResourceDialect,
5007                0x7150b7898d1b1180,
5008            >(_buf?)?;
5009            Ok(_response.map(|x| x))
5010        }
5011        self.client.send_query_and_decode::<RealmOpenControllerRequest, RealmOpenControllerResult>(
5012            (child, controller),
5013            0x7150b7898d1b1180,
5014            fidl::encoding::DynamicFlags::empty(),
5015            _decode,
5016        )
5017    }
5018
5019    type OpenExposedDirResponseFut = fidl::client::QueryResponseFut<
5020        RealmOpenExposedDirResult,
5021        fidl::encoding::DefaultFuchsiaResourceDialect,
5022    >;
5023    fn r#open_exposed_dir(
5024        &self,
5025        mut child: &fidl_fuchsia_component_decl::ChildRef,
5026        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5027    ) -> Self::OpenExposedDirResponseFut {
5028        fn _decode(
5029            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5030        ) -> Result<RealmOpenExposedDirResult, fidl::Error> {
5031            let _response = fidl::client::decode_transaction_body::<
5032                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5033                fidl::encoding::DefaultFuchsiaResourceDialect,
5034                0x7f993235ca59f92c,
5035            >(_buf?)?;
5036            Ok(_response.map(|x| x))
5037        }
5038        self.client.send_query_and_decode::<RealmOpenExposedDirRequest, RealmOpenExposedDirResult>(
5039            (child, exposed_dir),
5040            0x7f993235ca59f92c,
5041            fidl::encoding::DynamicFlags::empty(),
5042            _decode,
5043        )
5044    }
5045
5046    type CreateChildResponseFut = fidl::client::QueryResponseFut<
5047        RealmCreateChildResult,
5048        fidl::encoding::DefaultFuchsiaResourceDialect,
5049    >;
5050    fn r#create_child(
5051        &self,
5052        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5053        mut decl: &fidl_fuchsia_component_decl::Child,
5054        mut args: CreateChildArgs,
5055    ) -> Self::CreateChildResponseFut {
5056        fn _decode(
5057            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5058        ) -> Result<RealmCreateChildResult, fidl::Error> {
5059            let _response = fidl::client::decode_transaction_body::<
5060                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5061                fidl::encoding::DefaultFuchsiaResourceDialect,
5062                0x43e48ce8483d7560,
5063            >(_buf?)?;
5064            Ok(_response.map(|x| x))
5065        }
5066        self.client.send_query_and_decode::<RealmCreateChildRequest, RealmCreateChildResult>(
5067            (collection, decl, &mut args),
5068            0x43e48ce8483d7560,
5069            fidl::encoding::DynamicFlags::empty(),
5070            _decode,
5071        )
5072    }
5073
5074    type DestroyChildResponseFut = fidl::client::QueryResponseFut<
5075        RealmDestroyChildResult,
5076        fidl::encoding::DefaultFuchsiaResourceDialect,
5077    >;
5078    fn r#destroy_child(
5079        &self,
5080        mut child: &fidl_fuchsia_component_decl::ChildRef,
5081    ) -> Self::DestroyChildResponseFut {
5082        fn _decode(
5083            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5084        ) -> Result<RealmDestroyChildResult, fidl::Error> {
5085            let _response = fidl::client::decode_transaction_body::<
5086                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5087                fidl::encoding::DefaultFuchsiaResourceDialect,
5088                0x71d8caf8850c9222,
5089            >(_buf?)?;
5090            Ok(_response.map(|x| x))
5091        }
5092        self.client.send_query_and_decode::<RealmDestroyChildRequest, RealmDestroyChildResult>(
5093            (child,),
5094            0x71d8caf8850c9222,
5095            fidl::encoding::DynamicFlags::empty(),
5096            _decode,
5097        )
5098    }
5099
5100    type ListChildrenResponseFut = fidl::client::QueryResponseFut<
5101        RealmListChildrenResult,
5102        fidl::encoding::DefaultFuchsiaResourceDialect,
5103    >;
5104    fn r#list_children(
5105        &self,
5106        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5107        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5108    ) -> Self::ListChildrenResponseFut {
5109        fn _decode(
5110            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5111        ) -> Result<RealmListChildrenResult, fidl::Error> {
5112            let _response = fidl::client::decode_transaction_body::<
5113                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5114                fidl::encoding::DefaultFuchsiaResourceDialect,
5115                0x6888a76683efc0a1,
5116            >(_buf?)?;
5117            Ok(_response.map(|x| x))
5118        }
5119        self.client.send_query_and_decode::<RealmListChildrenRequest, RealmListChildrenResult>(
5120            (collection, iter),
5121            0x6888a76683efc0a1,
5122            fidl::encoding::DynamicFlags::empty(),
5123            _decode,
5124        )
5125    }
5126
5127    type GetResolvedInfoResponseFut = fidl::client::QueryResponseFut<
5128        RealmGetResolvedInfoResult,
5129        fidl::encoding::DefaultFuchsiaResourceDialect,
5130    >;
5131    fn r#get_resolved_info(&self) -> Self::GetResolvedInfoResponseFut {
5132        fn _decode(
5133            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5134        ) -> Result<RealmGetResolvedInfoResult, fidl::Error> {
5135            let _response = fidl::client::decode_transaction_body::<
5136                fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>,
5137                fidl::encoding::DefaultFuchsiaResourceDialect,
5138                0x734f744cb7d210a2,
5139            >(_buf?)?;
5140            Ok(_response.map(|x| x.resolved_info))
5141        }
5142        self.client
5143            .send_query_and_decode::<fidl::encoding::EmptyPayload, RealmGetResolvedInfoResult>(
5144                (),
5145                0x734f744cb7d210a2,
5146                fidl::encoding::DynamicFlags::empty(),
5147                _decode,
5148            )
5149    }
5150
5151    type GetChildOutputDictionaryResponseFut = fidl::client::QueryResponseFut<
5152        RealmGetChildOutputDictionaryResult,
5153        fidl::encoding::DefaultFuchsiaResourceDialect,
5154    >;
5155    fn r#get_child_output_dictionary(
5156        &self,
5157        mut child: &fidl_fuchsia_component_decl::ChildRef,
5158    ) -> Self::GetChildOutputDictionaryResponseFut {
5159        fn _decode(
5160            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5161        ) -> Result<RealmGetChildOutputDictionaryResult, fidl::Error> {
5162            let _response = fidl::client::decode_transaction_body::<
5163                fidl::encoding::ResultType<RealmGetChildOutputDictionaryResponse, Error>,
5164                fidl::encoding::DefaultFuchsiaResourceDialect,
5165                0x4259d08d261d5610,
5166            >(_buf?)?;
5167            Ok(_response.map(|x| x.dictionary))
5168        }
5169        self.client.send_query_and_decode::<
5170            RealmGetChildOutputDictionaryRequest,
5171            RealmGetChildOutputDictionaryResult,
5172        >(
5173            (child,),
5174            0x4259d08d261d5610,
5175            fidl::encoding::DynamicFlags::empty(),
5176            _decode,
5177        )
5178    }
5179}
5180
5181pub struct RealmEventStream {
5182    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5183}
5184
5185impl std::marker::Unpin for RealmEventStream {}
5186
5187impl futures::stream::FusedStream for RealmEventStream {
5188    fn is_terminated(&self) -> bool {
5189        self.event_receiver.is_terminated()
5190    }
5191}
5192
5193impl futures::Stream for RealmEventStream {
5194    type Item = Result<RealmEvent, fidl::Error>;
5195
5196    fn poll_next(
5197        mut self: std::pin::Pin<&mut Self>,
5198        cx: &mut std::task::Context<'_>,
5199    ) -> std::task::Poll<Option<Self::Item>> {
5200        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5201            &mut self.event_receiver,
5202            cx
5203        )?) {
5204            Some(buf) => std::task::Poll::Ready(Some(RealmEvent::decode(buf))),
5205            None => std::task::Poll::Ready(None),
5206        }
5207    }
5208}
5209
5210#[derive(Debug)]
5211pub enum RealmEvent {}
5212
5213impl RealmEvent {
5214    /// Decodes a message buffer as a [`RealmEvent`].
5215    fn decode(
5216        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5217    ) -> Result<RealmEvent, fidl::Error> {
5218        let (bytes, _handles) = buf.split_mut();
5219        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5220        debug_assert_eq!(tx_header.tx_id, 0);
5221        match tx_header.ordinal {
5222            _ => Err(fidl::Error::UnknownOrdinal {
5223                ordinal: tx_header.ordinal,
5224                protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5225            }),
5226        }
5227    }
5228}
5229
5230/// A Stream of incoming requests for fuchsia.component/Realm.
5231pub struct RealmRequestStream {
5232    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5233    is_terminated: bool,
5234}
5235
5236impl std::marker::Unpin for RealmRequestStream {}
5237
5238impl futures::stream::FusedStream for RealmRequestStream {
5239    fn is_terminated(&self) -> bool {
5240        self.is_terminated
5241    }
5242}
5243
5244impl fidl::endpoints::RequestStream for RealmRequestStream {
5245    type Protocol = RealmMarker;
5246    type ControlHandle = RealmControlHandle;
5247
5248    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5249        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5250    }
5251
5252    fn control_handle(&self) -> Self::ControlHandle {
5253        RealmControlHandle { inner: self.inner.clone() }
5254    }
5255
5256    fn into_inner(
5257        self,
5258    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5259    {
5260        (self.inner, self.is_terminated)
5261    }
5262
5263    fn from_inner(
5264        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5265        is_terminated: bool,
5266    ) -> Self {
5267        Self { inner, is_terminated }
5268    }
5269}
5270
5271impl futures::Stream for RealmRequestStream {
5272    type Item = Result<RealmRequest, fidl::Error>;
5273
5274    fn poll_next(
5275        mut self: std::pin::Pin<&mut Self>,
5276        cx: &mut std::task::Context<'_>,
5277    ) -> std::task::Poll<Option<Self::Item>> {
5278        let this = &mut *self;
5279        if this.inner.check_shutdown(cx) {
5280            this.is_terminated = true;
5281            return std::task::Poll::Ready(None);
5282        }
5283        if this.is_terminated {
5284            panic!("polled RealmRequestStream after completion");
5285        }
5286        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5287            |bytes, handles| {
5288                match this.inner.channel().read_etc(cx, bytes, handles) {
5289                    std::task::Poll::Ready(Ok(())) => {}
5290                    std::task::Poll::Pending => return std::task::Poll::Pending,
5291                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5292                        this.is_terminated = true;
5293                        return std::task::Poll::Ready(None);
5294                    }
5295                    std::task::Poll::Ready(Err(e)) => {
5296                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5297                            e.into(),
5298                        ))));
5299                    }
5300                }
5301
5302                // A message has been received from the channel
5303                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5304
5305                std::task::Poll::Ready(Some(match header.ordinal {
5306                    0x7150b7898d1b1180 => {
5307                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5308                        let mut req = fidl::new_empty!(
5309                            RealmOpenControllerRequest,
5310                            fidl::encoding::DefaultFuchsiaResourceDialect
5311                        );
5312                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmOpenControllerRequest>(&header, _body_bytes, handles, &mut req)?;
5313                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5314                        Ok(RealmRequest::OpenController {
5315                            child: req.child,
5316                            controller: req.controller,
5317
5318                            responder: RealmOpenControllerResponder {
5319                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5320                                tx_id: header.tx_id,
5321                            },
5322                        })
5323                    }
5324                    0x7f993235ca59f92c => {
5325                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5326                        let mut req = fidl::new_empty!(
5327                            RealmOpenExposedDirRequest,
5328                            fidl::encoding::DefaultFuchsiaResourceDialect
5329                        );
5330                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmOpenExposedDirRequest>(&header, _body_bytes, handles, &mut req)?;
5331                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5332                        Ok(RealmRequest::OpenExposedDir {
5333                            child: req.child,
5334                            exposed_dir: req.exposed_dir,
5335
5336                            responder: RealmOpenExposedDirResponder {
5337                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5338                                tx_id: header.tx_id,
5339                            },
5340                        })
5341                    }
5342                    0x43e48ce8483d7560 => {
5343                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5344                        let mut req = fidl::new_empty!(
5345                            RealmCreateChildRequest,
5346                            fidl::encoding::DefaultFuchsiaResourceDialect
5347                        );
5348                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmCreateChildRequest>(&header, _body_bytes, handles, &mut req)?;
5349                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5350                        Ok(RealmRequest::CreateChild {
5351                            collection: req.collection,
5352                            decl: req.decl,
5353                            args: req.args,
5354
5355                            responder: RealmCreateChildResponder {
5356                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5357                                tx_id: header.tx_id,
5358                            },
5359                        })
5360                    }
5361                    0x71d8caf8850c9222 => {
5362                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5363                        let mut req = fidl::new_empty!(
5364                            RealmDestroyChildRequest,
5365                            fidl::encoding::DefaultFuchsiaResourceDialect
5366                        );
5367                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmDestroyChildRequest>(&header, _body_bytes, handles, &mut req)?;
5368                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5369                        Ok(RealmRequest::DestroyChild {
5370                            child: req.child,
5371
5372                            responder: RealmDestroyChildResponder {
5373                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5374                                tx_id: header.tx_id,
5375                            },
5376                        })
5377                    }
5378                    0x6888a76683efc0a1 => {
5379                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5380                        let mut req = fidl::new_empty!(
5381                            RealmListChildrenRequest,
5382                            fidl::encoding::DefaultFuchsiaResourceDialect
5383                        );
5384                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmListChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
5385                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5386                        Ok(RealmRequest::ListChildren {
5387                            collection: req.collection,
5388                            iter: req.iter,
5389
5390                            responder: RealmListChildrenResponder {
5391                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5392                                tx_id: header.tx_id,
5393                            },
5394                        })
5395                    }
5396                    0x734f744cb7d210a2 => {
5397                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5398                        let mut req = fidl::new_empty!(
5399                            fidl::encoding::EmptyPayload,
5400                            fidl::encoding::DefaultFuchsiaResourceDialect
5401                        );
5402                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5403                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5404                        Ok(RealmRequest::GetResolvedInfo {
5405                            responder: RealmGetResolvedInfoResponder {
5406                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5407                                tx_id: header.tx_id,
5408                            },
5409                        })
5410                    }
5411                    0x4259d08d261d5610 => {
5412                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5413                        let mut req = fidl::new_empty!(
5414                            RealmGetChildOutputDictionaryRequest,
5415                            fidl::encoding::DefaultFuchsiaResourceDialect
5416                        );
5417                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmGetChildOutputDictionaryRequest>(&header, _body_bytes, handles, &mut req)?;
5418                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5419                        Ok(RealmRequest::GetChildOutputDictionary {
5420                            child: req.child,
5421
5422                            responder: RealmGetChildOutputDictionaryResponder {
5423                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5424                                tx_id: header.tx_id,
5425                            },
5426                        })
5427                    }
5428                    _ => Err(fidl::Error::UnknownOrdinal {
5429                        ordinal: header.ordinal,
5430                        protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5431                    }),
5432                }))
5433            },
5434        )
5435    }
5436}
5437
5438/// A protocol used by a component instance to manage its own realm, such as for
5439/// binding to its children.
5440///
5441/// Requests to this protocol are processed in the order they are received.
5442/// Clients that wish to send requests in parallel should open multiple
5443/// connections.
5444///
5445/// The component framework provides this service to components that use
5446/// `fuchsia.component.Realm`.
5447#[derive(Debug)]
5448pub enum RealmRequest {
5449    /// Operate on a child component. See documentation for [`Controller`].
5450    ///
5451    /// Errors:
5452    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5453    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5454    /// - `INSTANCE_DIED`: This realm no longer exists.
5455    OpenController {
5456        child: fidl_fuchsia_component_decl::ChildRef,
5457        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5458        responder: RealmOpenControllerResponder,
5459    },
5460    /// Opens the exposed directory of a child component. When this function
5461    /// successfully returns, `exposed_dir` is bound to a directory that
5462    /// contains the capabilities which the child exposed to its realm via
5463    /// `ComponentDecl.exposes` (specified via "expose" declarations in the
5464    /// component's manifest). The child component will not start as a result of
5465    /// this call.
5466    ///
5467    /// `exposed_dir` is open as long as `child` exists.
5468    ///
5469    /// Errors:
5470    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5471    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5472    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
5473    /// - `INSTANCE_DIED`: This realm no longer exists.
5474    OpenExposedDir {
5475        child: fidl_fuchsia_component_decl::ChildRef,
5476        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5477        responder: RealmOpenExposedDirResponder,
5478    },
5479    /// Creates a child component instance dynamically. When this function
5480    /// returns successfully, the instance exists, but it may not be running.
5481    ///
5482    /// The environment of the child instance is determined by the environment
5483    /// of the collection. `decl` must not set `environment`.
5484    ///
5485    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
5486    /// [CreateChild] will start the component and return once the component is
5487    /// started. Otherwise, [CreateChild] will return immediately after creating
5488    /// the component and will not start or resolve it.
5489    ///
5490    /// Errors:
5491    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
5492    ///   is not a valid declaration.
5493    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5494    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
5495    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
5496    ///   in a `SingleRun` collection.
5497    /// - `NO_SPACE`: Could not allocate storage for the new instance.
5498    /// - `INSTANCE_DIED`: This realm no longer exists.
5499    CreateChild {
5500        collection: fidl_fuchsia_component_decl::CollectionRef,
5501        decl: fidl_fuchsia_component_decl::Child,
5502        args: CreateChildArgs,
5503        responder: RealmCreateChildResponder,
5504    },
5505    /// Destroys a dynamically-created component instance. When this function
5506    /// returns, the instance is destroyed and has stopped running.  However,
5507    /// cleanup of the component's resources (such as its isolated storage) may
5508    /// happen in the background after this function returns.
5509    ///
5510    /// Errors:
5511    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
5512    ///   to a dynamic instance.
5513    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5514    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5515    /// - `INSTANCE_DIED`: This realm no longer exists.
5516    DestroyChild {
5517        child: fidl_fuchsia_component_decl::ChildRef,
5518        responder: RealmDestroyChildResponder,
5519    },
5520    /// Returns an iterator that lists all instances in a collection.
5521    ///
5522    /// NOTE: The results are not guaranteed to be consistent. Instances may be
5523    /// created or destroyed while the iterator is live, but those changes
5524    /// won't be observed by the iterator after this method returns.
5525    ///
5526    /// Errors:
5527    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
5528    /// does not have `ZX_RIGHT_WAIT`.
5529    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5530    /// - `INSTANCE_DIED`: This realm no longer exists.
5531    /// - If `iter` does not have standard channel rights, this function may
5532    ///   return `ACCESS_DENIED` or component manager may close `iter`.
5533    ListChildren {
5534        collection: fidl_fuchsia_component_decl::CollectionRef,
5535        iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5536        responder: RealmListChildrenResponder,
5537    },
5538    /// Returns the set of information that was given to the component framework
5539    /// by this component's resolver.
5540    GetResolvedInfo { responder: RealmGetResolvedInfoResponder },
5541    GetChildOutputDictionary {
5542        child: fidl_fuchsia_component_decl::ChildRef,
5543        responder: RealmGetChildOutputDictionaryResponder,
5544    },
5545}
5546
5547impl RealmRequest {
5548    #[allow(irrefutable_let_patterns)]
5549    pub fn into_open_controller(
5550        self,
5551    ) -> Option<(
5552        fidl_fuchsia_component_decl::ChildRef,
5553        fidl::endpoints::ServerEnd<ControllerMarker>,
5554        RealmOpenControllerResponder,
5555    )> {
5556        if let RealmRequest::OpenController { child, controller, responder } = self {
5557            Some((child, controller, responder))
5558        } else {
5559            None
5560        }
5561    }
5562
5563    #[allow(irrefutable_let_patterns)]
5564    pub fn into_open_exposed_dir(
5565        self,
5566    ) -> Option<(
5567        fidl_fuchsia_component_decl::ChildRef,
5568        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5569        RealmOpenExposedDirResponder,
5570    )> {
5571        if let RealmRequest::OpenExposedDir { child, exposed_dir, responder } = self {
5572            Some((child, exposed_dir, responder))
5573        } else {
5574            None
5575        }
5576    }
5577
5578    #[allow(irrefutable_let_patterns)]
5579    pub fn into_create_child(
5580        self,
5581    ) -> Option<(
5582        fidl_fuchsia_component_decl::CollectionRef,
5583        fidl_fuchsia_component_decl::Child,
5584        CreateChildArgs,
5585        RealmCreateChildResponder,
5586    )> {
5587        if let RealmRequest::CreateChild { collection, decl, args, responder } = self {
5588            Some((collection, decl, args, responder))
5589        } else {
5590            None
5591        }
5592    }
5593
5594    #[allow(irrefutable_let_patterns)]
5595    pub fn into_destroy_child(
5596        self,
5597    ) -> Option<(fidl_fuchsia_component_decl::ChildRef, RealmDestroyChildResponder)> {
5598        if let RealmRequest::DestroyChild { child, responder } = self {
5599            Some((child, responder))
5600        } else {
5601            None
5602        }
5603    }
5604
5605    #[allow(irrefutable_let_patterns)]
5606    pub fn into_list_children(
5607        self,
5608    ) -> Option<(
5609        fidl_fuchsia_component_decl::CollectionRef,
5610        fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5611        RealmListChildrenResponder,
5612    )> {
5613        if let RealmRequest::ListChildren { collection, iter, responder } = self {
5614            Some((collection, iter, responder))
5615        } else {
5616            None
5617        }
5618    }
5619
5620    #[allow(irrefutable_let_patterns)]
5621    pub fn into_get_resolved_info(self) -> Option<(RealmGetResolvedInfoResponder)> {
5622        if let RealmRequest::GetResolvedInfo { responder } = self {
5623            Some((responder))
5624        } else {
5625            None
5626        }
5627    }
5628
5629    #[allow(irrefutable_let_patterns)]
5630    pub fn into_get_child_output_dictionary(
5631        self,
5632    ) -> Option<(fidl_fuchsia_component_decl::ChildRef, RealmGetChildOutputDictionaryResponder)>
5633    {
5634        if let RealmRequest::GetChildOutputDictionary { child, responder } = self {
5635            Some((child, responder))
5636        } else {
5637            None
5638        }
5639    }
5640
5641    /// Name of the method defined in FIDL
5642    pub fn method_name(&self) -> &'static str {
5643        match *self {
5644            RealmRequest::OpenController { .. } => "open_controller",
5645            RealmRequest::OpenExposedDir { .. } => "open_exposed_dir",
5646            RealmRequest::CreateChild { .. } => "create_child",
5647            RealmRequest::DestroyChild { .. } => "destroy_child",
5648            RealmRequest::ListChildren { .. } => "list_children",
5649            RealmRequest::GetResolvedInfo { .. } => "get_resolved_info",
5650            RealmRequest::GetChildOutputDictionary { .. } => "get_child_output_dictionary",
5651        }
5652    }
5653}
5654
5655#[derive(Debug, Clone)]
5656pub struct RealmControlHandle {
5657    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5658}
5659
5660impl fidl::endpoints::ControlHandle for RealmControlHandle {
5661    fn shutdown(&self) {
5662        self.inner.shutdown()
5663    }
5664
5665    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5666        self.inner.shutdown_with_epitaph(status)
5667    }
5668
5669    fn is_closed(&self) -> bool {
5670        self.inner.channel().is_closed()
5671    }
5672    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5673        self.inner.channel().on_closed()
5674    }
5675
5676    #[cfg(target_os = "fuchsia")]
5677    fn signal_peer(
5678        &self,
5679        clear_mask: zx::Signals,
5680        set_mask: zx::Signals,
5681    ) -> Result<(), zx_status::Status> {
5682        use fidl::Peered;
5683        self.inner.channel().signal_peer(clear_mask, set_mask)
5684    }
5685}
5686
5687impl RealmControlHandle {}
5688
5689#[must_use = "FIDL methods require a response to be sent"]
5690#[derive(Debug)]
5691pub struct RealmOpenControllerResponder {
5692    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5693    tx_id: u32,
5694}
5695
5696/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5697/// if the responder is dropped without sending a response, so that the client
5698/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5699impl std::ops::Drop for RealmOpenControllerResponder {
5700    fn drop(&mut self) {
5701        self.control_handle.shutdown();
5702        // Safety: drops once, never accessed again
5703        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5704    }
5705}
5706
5707impl fidl::endpoints::Responder for RealmOpenControllerResponder {
5708    type ControlHandle = RealmControlHandle;
5709
5710    fn control_handle(&self) -> &RealmControlHandle {
5711        &self.control_handle
5712    }
5713
5714    fn drop_without_shutdown(mut self) {
5715        // Safety: drops once, never accessed again due to mem::forget
5716        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5717        // Prevent Drop from running (which would shut down the channel)
5718        std::mem::forget(self);
5719    }
5720}
5721
5722impl RealmOpenControllerResponder {
5723    /// Sends a response to the FIDL transaction.
5724    ///
5725    /// Sets the channel to shutdown if an error occurs.
5726    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5727        let _result = self.send_raw(result);
5728        if _result.is_err() {
5729            self.control_handle.shutdown();
5730        }
5731        self.drop_without_shutdown();
5732        _result
5733    }
5734
5735    /// Similar to "send" but does not shutdown the channel if an error occurs.
5736    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5737        let _result = self.send_raw(result);
5738        self.drop_without_shutdown();
5739        _result
5740    }
5741
5742    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5743        self.control_handle
5744            .inner
5745            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5746                result,
5747                self.tx_id,
5748                0x7150b7898d1b1180,
5749                fidl::encoding::DynamicFlags::empty(),
5750            )
5751    }
5752}
5753
5754#[must_use = "FIDL methods require a response to be sent"]
5755#[derive(Debug)]
5756pub struct RealmOpenExposedDirResponder {
5757    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5758    tx_id: u32,
5759}
5760
5761/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5762/// if the responder is dropped without sending a response, so that the client
5763/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5764impl std::ops::Drop for RealmOpenExposedDirResponder {
5765    fn drop(&mut self) {
5766        self.control_handle.shutdown();
5767        // Safety: drops once, never accessed again
5768        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5769    }
5770}
5771
5772impl fidl::endpoints::Responder for RealmOpenExposedDirResponder {
5773    type ControlHandle = RealmControlHandle;
5774
5775    fn control_handle(&self) -> &RealmControlHandle {
5776        &self.control_handle
5777    }
5778
5779    fn drop_without_shutdown(mut self) {
5780        // Safety: drops once, never accessed again due to mem::forget
5781        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5782        // Prevent Drop from running (which would shut down the channel)
5783        std::mem::forget(self);
5784    }
5785}
5786
5787impl RealmOpenExposedDirResponder {
5788    /// Sends a response to the FIDL transaction.
5789    ///
5790    /// Sets the channel to shutdown if an error occurs.
5791    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5792        let _result = self.send_raw(result);
5793        if _result.is_err() {
5794            self.control_handle.shutdown();
5795        }
5796        self.drop_without_shutdown();
5797        _result
5798    }
5799
5800    /// Similar to "send" but does not shutdown the channel if an error occurs.
5801    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5802        let _result = self.send_raw(result);
5803        self.drop_without_shutdown();
5804        _result
5805    }
5806
5807    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5808        self.control_handle
5809            .inner
5810            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5811                result,
5812                self.tx_id,
5813                0x7f993235ca59f92c,
5814                fidl::encoding::DynamicFlags::empty(),
5815            )
5816    }
5817}
5818
5819#[must_use = "FIDL methods require a response to be sent"]
5820#[derive(Debug)]
5821pub struct RealmCreateChildResponder {
5822    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5823    tx_id: u32,
5824}
5825
5826/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5827/// if the responder is dropped without sending a response, so that the client
5828/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5829impl std::ops::Drop for RealmCreateChildResponder {
5830    fn drop(&mut self) {
5831        self.control_handle.shutdown();
5832        // Safety: drops once, never accessed again
5833        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5834    }
5835}
5836
5837impl fidl::endpoints::Responder for RealmCreateChildResponder {
5838    type ControlHandle = RealmControlHandle;
5839
5840    fn control_handle(&self) -> &RealmControlHandle {
5841        &self.control_handle
5842    }
5843
5844    fn drop_without_shutdown(mut self) {
5845        // Safety: drops once, never accessed again due to mem::forget
5846        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5847        // Prevent Drop from running (which would shut down the channel)
5848        std::mem::forget(self);
5849    }
5850}
5851
5852impl RealmCreateChildResponder {
5853    /// Sends a response to the FIDL transaction.
5854    ///
5855    /// Sets the channel to shutdown if an error occurs.
5856    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5857        let _result = self.send_raw(result);
5858        if _result.is_err() {
5859            self.control_handle.shutdown();
5860        }
5861        self.drop_without_shutdown();
5862        _result
5863    }
5864
5865    /// Similar to "send" but does not shutdown the channel if an error occurs.
5866    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5867        let _result = self.send_raw(result);
5868        self.drop_without_shutdown();
5869        _result
5870    }
5871
5872    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5873        self.control_handle
5874            .inner
5875            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5876                result,
5877                self.tx_id,
5878                0x43e48ce8483d7560,
5879                fidl::encoding::DynamicFlags::empty(),
5880            )
5881    }
5882}
5883
5884#[must_use = "FIDL methods require a response to be sent"]
5885#[derive(Debug)]
5886pub struct RealmDestroyChildResponder {
5887    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5888    tx_id: u32,
5889}
5890
5891/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5892/// if the responder is dropped without sending a response, so that the client
5893/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5894impl std::ops::Drop for RealmDestroyChildResponder {
5895    fn drop(&mut self) {
5896        self.control_handle.shutdown();
5897        // Safety: drops once, never accessed again
5898        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5899    }
5900}
5901
5902impl fidl::endpoints::Responder for RealmDestroyChildResponder {
5903    type ControlHandle = RealmControlHandle;
5904
5905    fn control_handle(&self) -> &RealmControlHandle {
5906        &self.control_handle
5907    }
5908
5909    fn drop_without_shutdown(mut self) {
5910        // Safety: drops once, never accessed again due to mem::forget
5911        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5912        // Prevent Drop from running (which would shut down the channel)
5913        std::mem::forget(self);
5914    }
5915}
5916
5917impl RealmDestroyChildResponder {
5918    /// Sends a response to the FIDL transaction.
5919    ///
5920    /// Sets the channel to shutdown if an error occurs.
5921    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5922        let _result = self.send_raw(result);
5923        if _result.is_err() {
5924            self.control_handle.shutdown();
5925        }
5926        self.drop_without_shutdown();
5927        _result
5928    }
5929
5930    /// Similar to "send" but does not shutdown the channel if an error occurs.
5931    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5932        let _result = self.send_raw(result);
5933        self.drop_without_shutdown();
5934        _result
5935    }
5936
5937    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5938        self.control_handle
5939            .inner
5940            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5941                result,
5942                self.tx_id,
5943                0x71d8caf8850c9222,
5944                fidl::encoding::DynamicFlags::empty(),
5945            )
5946    }
5947}
5948
5949#[must_use = "FIDL methods require a response to be sent"]
5950#[derive(Debug)]
5951pub struct RealmListChildrenResponder {
5952    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5953    tx_id: u32,
5954}
5955
5956/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5957/// if the responder is dropped without sending a response, so that the client
5958/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5959impl std::ops::Drop for RealmListChildrenResponder {
5960    fn drop(&mut self) {
5961        self.control_handle.shutdown();
5962        // Safety: drops once, never accessed again
5963        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5964    }
5965}
5966
5967impl fidl::endpoints::Responder for RealmListChildrenResponder {
5968    type ControlHandle = RealmControlHandle;
5969
5970    fn control_handle(&self) -> &RealmControlHandle {
5971        &self.control_handle
5972    }
5973
5974    fn drop_without_shutdown(mut self) {
5975        // Safety: drops once, never accessed again due to mem::forget
5976        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5977        // Prevent Drop from running (which would shut down the channel)
5978        std::mem::forget(self);
5979    }
5980}
5981
5982impl RealmListChildrenResponder {
5983    /// Sends a response to the FIDL transaction.
5984    ///
5985    /// Sets the channel to shutdown if an error occurs.
5986    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5987        let _result = self.send_raw(result);
5988        if _result.is_err() {
5989            self.control_handle.shutdown();
5990        }
5991        self.drop_without_shutdown();
5992        _result
5993    }
5994
5995    /// Similar to "send" but does not shutdown the channel if an error occurs.
5996    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5997        let _result = self.send_raw(result);
5998        self.drop_without_shutdown();
5999        _result
6000    }
6001
6002    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6003        self.control_handle
6004            .inner
6005            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6006                result,
6007                self.tx_id,
6008                0x6888a76683efc0a1,
6009                fidl::encoding::DynamicFlags::empty(),
6010            )
6011    }
6012}
6013
6014#[must_use = "FIDL methods require a response to be sent"]
6015#[derive(Debug)]
6016pub struct RealmGetResolvedInfoResponder {
6017    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6018    tx_id: u32,
6019}
6020
6021/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6022/// if the responder is dropped without sending a response, so that the client
6023/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6024impl std::ops::Drop for RealmGetResolvedInfoResponder {
6025    fn drop(&mut self) {
6026        self.control_handle.shutdown();
6027        // Safety: drops once, never accessed again
6028        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6029    }
6030}
6031
6032impl fidl::endpoints::Responder for RealmGetResolvedInfoResponder {
6033    type ControlHandle = RealmControlHandle;
6034
6035    fn control_handle(&self) -> &RealmControlHandle {
6036        &self.control_handle
6037    }
6038
6039    fn drop_without_shutdown(mut self) {
6040        // Safety: drops once, never accessed again due to mem::forget
6041        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6042        // Prevent Drop from running (which would shut down the channel)
6043        std::mem::forget(self);
6044    }
6045}
6046
6047impl RealmGetResolvedInfoResponder {
6048    /// Sends a response to the FIDL transaction.
6049    ///
6050    /// Sets the channel to shutdown if an error occurs.
6051    pub fn send(
6052        self,
6053        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
6054    ) -> Result<(), fidl::Error> {
6055        let _result = self.send_raw(result);
6056        if _result.is_err() {
6057            self.control_handle.shutdown();
6058        }
6059        self.drop_without_shutdown();
6060        _result
6061    }
6062
6063    /// Similar to "send" but does not shutdown the channel if an error occurs.
6064    pub fn send_no_shutdown_on_err(
6065        self,
6066        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
6067    ) -> Result<(), fidl::Error> {
6068        let _result = self.send_raw(result);
6069        self.drop_without_shutdown();
6070        _result
6071    }
6072
6073    fn send_raw(
6074        &self,
6075        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
6076    ) -> Result<(), fidl::Error> {
6077        self.control_handle
6078            .inner
6079            .send::<fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>>(
6080                result.as_mut().map_err(|e| *e).map(|resolved_info| (resolved_info,)),
6081                self.tx_id,
6082                0x734f744cb7d210a2,
6083                fidl::encoding::DynamicFlags::empty(),
6084            )
6085    }
6086}
6087
6088#[must_use = "FIDL methods require a response to be sent"]
6089#[derive(Debug)]
6090pub struct RealmGetChildOutputDictionaryResponder {
6091    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6092    tx_id: u32,
6093}
6094
6095/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6096/// if the responder is dropped without sending a response, so that the client
6097/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6098impl std::ops::Drop for RealmGetChildOutputDictionaryResponder {
6099    fn drop(&mut self) {
6100        self.control_handle.shutdown();
6101        // Safety: drops once, never accessed again
6102        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6103    }
6104}
6105
6106impl fidl::endpoints::Responder for RealmGetChildOutputDictionaryResponder {
6107    type ControlHandle = RealmControlHandle;
6108
6109    fn control_handle(&self) -> &RealmControlHandle {
6110        &self.control_handle
6111    }
6112
6113    fn drop_without_shutdown(mut self) {
6114        // Safety: drops once, never accessed again due to mem::forget
6115        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6116        // Prevent Drop from running (which would shut down the channel)
6117        std::mem::forget(self);
6118    }
6119}
6120
6121impl RealmGetChildOutputDictionaryResponder {
6122    /// Sends a response to the FIDL transaction.
6123    ///
6124    /// Sets the channel to shutdown if an error occurs.
6125    pub fn send(
6126        self,
6127        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
6128    ) -> Result<(), fidl::Error> {
6129        let _result = self.send_raw(result);
6130        if _result.is_err() {
6131            self.control_handle.shutdown();
6132        }
6133        self.drop_without_shutdown();
6134        _result
6135    }
6136
6137    /// Similar to "send" but does not shutdown the channel if an error occurs.
6138    pub fn send_no_shutdown_on_err(
6139        self,
6140        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
6141    ) -> Result<(), fidl::Error> {
6142        let _result = self.send_raw(result);
6143        self.drop_without_shutdown();
6144        _result
6145    }
6146
6147    fn send_raw(
6148        &self,
6149        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
6150    ) -> Result<(), fidl::Error> {
6151        self.control_handle.inner.send::<fidl::encoding::ResultType<
6152            RealmGetChildOutputDictionaryResponse,
6153            Error,
6154        >>(
6155            result.as_mut().map_err(|e| *e).map(|dictionary| (dictionary,)),
6156            self.tx_id,
6157            0x4259d08d261d5610,
6158            fidl::encoding::DynamicFlags::empty(),
6159        )
6160    }
6161}
6162
6163#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6164pub struct StorageAdminMarker;
6165
6166impl fidl::endpoints::ProtocolMarker for StorageAdminMarker {
6167    type Proxy = StorageAdminProxy;
6168    type RequestStream = StorageAdminRequestStream;
6169    #[cfg(target_os = "fuchsia")]
6170    type SynchronousProxy = StorageAdminSynchronousProxy;
6171
6172    const DEBUG_NAME: &'static str = "fuchsia.component.StorageAdmin";
6173}
6174impl fidl::endpoints::DiscoverableProtocolMarker for StorageAdminMarker {}
6175pub type StorageAdminOpenStorageResult = Result<(), Error>;
6176pub type StorageAdminListStorageInRealmResult = Result<(), Error>;
6177pub type StorageAdminOpenComponentStorageByIdResult = Result<(), Error>;
6178pub type StorageAdminDeleteComponentStorageResult = Result<(), Error>;
6179pub type StorageAdminGetStatusResult = Result<StorageStatus, StatusError>;
6180pub type StorageAdminDeleteAllStorageContentsResult = Result<(), DeletionError>;
6181
6182pub trait StorageAdminProxyInterface: Send + Sync {
6183    type OpenStorageResponseFut: std::future::Future<Output = Result<StorageAdminOpenStorageResult, fidl::Error>>
6184        + Send;
6185    fn r#open_storage(
6186        &self,
6187        relative_moniker: &str,
6188        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6189    ) -> Self::OpenStorageResponseFut;
6190    type ListStorageInRealmResponseFut: std::future::Future<Output = Result<StorageAdminListStorageInRealmResult, fidl::Error>>
6191        + Send;
6192    fn r#list_storage_in_realm(
6193        &self,
6194        relative_moniker: &str,
6195        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6196    ) -> Self::ListStorageInRealmResponseFut;
6197    type OpenComponentStorageByIdResponseFut: std::future::Future<
6198            Output = Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error>,
6199        > + Send;
6200    fn r#open_component_storage_by_id(
6201        &self,
6202        id: &str,
6203        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6204    ) -> Self::OpenComponentStorageByIdResponseFut;
6205    type DeleteComponentStorageResponseFut: std::future::Future<Output = Result<StorageAdminDeleteComponentStorageResult, fidl::Error>>
6206        + Send;
6207    fn r#delete_component_storage(
6208        &self,
6209        relative_moniker: &str,
6210    ) -> Self::DeleteComponentStorageResponseFut;
6211    type GetStatusResponseFut: std::future::Future<Output = Result<StorageAdminGetStatusResult, fidl::Error>>
6212        + Send;
6213    fn r#get_status(&self) -> Self::GetStatusResponseFut;
6214    type DeleteAllStorageContentsResponseFut: std::future::Future<
6215            Output = Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error>,
6216        > + Send;
6217    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut;
6218}
6219#[derive(Debug)]
6220#[cfg(target_os = "fuchsia")]
6221pub struct StorageAdminSynchronousProxy {
6222    client: fidl::client::sync::Client,
6223}
6224
6225#[cfg(target_os = "fuchsia")]
6226impl fidl::endpoints::SynchronousProxy for StorageAdminSynchronousProxy {
6227    type Proxy = StorageAdminProxy;
6228    type Protocol = StorageAdminMarker;
6229
6230    fn from_channel(inner: fidl::Channel) -> Self {
6231        Self::new(inner)
6232    }
6233
6234    fn into_channel(self) -> fidl::Channel {
6235        self.client.into_channel()
6236    }
6237
6238    fn as_channel(&self) -> &fidl::Channel {
6239        self.client.as_channel()
6240    }
6241}
6242
6243#[cfg(target_os = "fuchsia")]
6244impl StorageAdminSynchronousProxy {
6245    pub fn new(channel: fidl::Channel) -> Self {
6246        let protocol_name = <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6247        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6248    }
6249
6250    pub fn into_channel(self) -> fidl::Channel {
6251        self.client.into_channel()
6252    }
6253
6254    /// Waits until an event arrives and returns it. It is safe for other
6255    /// threads to make concurrent requests while waiting for an event.
6256    pub fn wait_for_event(
6257        &self,
6258        deadline: zx::MonotonicInstant,
6259    ) -> Result<StorageAdminEvent, fidl::Error> {
6260        StorageAdminEvent::decode(self.client.wait_for_event(deadline)?)
6261    }
6262
6263    /// Opens the isolated directory for the given component. The provided
6264    /// moniker is relative to the component that declares the storage
6265    /// capability. Creates the backing sub-directory for this storage if it
6266    /// hasn't yet been created.
6267    pub fn r#open_storage(
6268        &self,
6269        mut relative_moniker: &str,
6270        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6271        ___deadline: zx::MonotonicInstant,
6272    ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
6273        let _response = self.client.send_query::<
6274            StorageAdminOpenStorageRequest,
6275            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6276        >(
6277            (relative_moniker, object,),
6278            0x6ceaa5904cfe4377,
6279            fidl::encoding::DynamicFlags::empty(),
6280            ___deadline,
6281        )?;
6282        Ok(_response.map(|x| x))
6283    }
6284
6285    /// Lists the descendant components under the specified realm that use the
6286    /// storage capability. The provided moniker is relative to the component
6287    /// that declares the storage capability.
6288    ///
6289    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
6290    /// if |relative_moniker| is malformed.
6291    pub fn r#list_storage_in_realm(
6292        &self,
6293        mut relative_moniker: &str,
6294        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6295        ___deadline: zx::MonotonicInstant,
6296    ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
6297        let _response = self.client.send_query::<
6298            StorageAdminListStorageInRealmRequest,
6299            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6300        >(
6301            (relative_moniker, iterator,),
6302            0x764f6d1f083e8bfb,
6303            fidl::encoding::DynamicFlags::empty(),
6304            ___deadline,
6305        )?;
6306        Ok(_response.map(|x| x))
6307    }
6308
6309    /// Opens the isolated directory for the given storage ID. Creates the
6310    /// backing sub-directory for this storage if it hasn't yet been created.
6311    pub fn r#open_component_storage_by_id(
6312        &self,
6313        mut id: &str,
6314        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6315        ___deadline: zx::MonotonicInstant,
6316    ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
6317        let _response = self.client.send_query::<
6318            StorageAdminOpenComponentStorageByIdRequest,
6319            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6320        >(
6321            (id, object,),
6322            0x4802102cc55d5df1,
6323            fidl::encoding::DynamicFlags::empty(),
6324            ___deadline,
6325        )?;
6326        Ok(_response.map(|x| x))
6327    }
6328
6329    /// Deletes the contents of the storage for this component. Preserves the
6330    /// component's subdirectory itself within the storage backing directory.
6331    /// The provided moniker is relative to the component that declares the
6332    /// storage capability.
6333    pub fn r#delete_component_storage(
6334        &self,
6335        mut relative_moniker: &str,
6336        ___deadline: zx::MonotonicInstant,
6337    ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
6338        let _response = self.client.send_query::<
6339            StorageAdminDeleteComponentStorageRequest,
6340            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6341        >(
6342            (relative_moniker,),
6343            0x1677c1cdfcdbf45a,
6344            fidl::encoding::DynamicFlags::empty(),
6345            ___deadline,
6346        )?;
6347        Ok(_response.map(|x| x))
6348    }
6349
6350    /// Get the current status of the storage.
6351    pub fn r#get_status(
6352        &self,
6353        ___deadline: zx::MonotonicInstant,
6354    ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
6355        let _response = self.client.send_query::<
6356            fidl::encoding::EmptyPayload,
6357            fidl::encoding::ResultType<StorageStatus, StatusError>,
6358        >(
6359            (),
6360            0x7729e325a6c526c8,
6361            fidl::encoding::DynamicFlags::empty(),
6362            ___deadline,
6363        )?;
6364        Ok(_response.map(|x| x))
6365    }
6366
6367    /// Deletes the contents of all the storage. Storage directories are
6368    /// retained so any components using storage will be able to continue using
6369    /// it to create new files and directories.
6370    ///
6371    /// Returns Error::INTERNAL only if no storage at all could be cleared.
6372    /// Returns successfully even if some errors happen during the deletion
6373    /// progress.
6374    pub fn r#delete_all_storage_contents(
6375        &self,
6376        ___deadline: zx::MonotonicInstant,
6377    ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
6378        let _response = self.client.send_query::<
6379            fidl::encoding::EmptyPayload,
6380            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
6381        >(
6382            (),
6383            0x2ee980b4b2d24adb,
6384            fidl::encoding::DynamicFlags::empty(),
6385            ___deadline,
6386        )?;
6387        Ok(_response.map(|x| x))
6388    }
6389}
6390
6391#[cfg(target_os = "fuchsia")]
6392impl From<StorageAdminSynchronousProxy> for zx::NullableHandle {
6393    fn from(value: StorageAdminSynchronousProxy) -> Self {
6394        value.into_channel().into()
6395    }
6396}
6397
6398#[cfg(target_os = "fuchsia")]
6399impl From<fidl::Channel> for StorageAdminSynchronousProxy {
6400    fn from(value: fidl::Channel) -> Self {
6401        Self::new(value)
6402    }
6403}
6404
6405#[cfg(target_os = "fuchsia")]
6406impl fidl::endpoints::FromClient for StorageAdminSynchronousProxy {
6407    type Protocol = StorageAdminMarker;
6408
6409    fn from_client(value: fidl::endpoints::ClientEnd<StorageAdminMarker>) -> Self {
6410        Self::new(value.into_channel())
6411    }
6412}
6413
6414#[derive(Debug, Clone)]
6415pub struct StorageAdminProxy {
6416    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6417}
6418
6419impl fidl::endpoints::Proxy for StorageAdminProxy {
6420    type Protocol = StorageAdminMarker;
6421
6422    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6423        Self::new(inner)
6424    }
6425
6426    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6427        self.client.into_channel().map_err(|client| Self { client })
6428    }
6429
6430    fn as_channel(&self) -> &::fidl::AsyncChannel {
6431        self.client.as_channel()
6432    }
6433}
6434
6435impl StorageAdminProxy {
6436    /// Create a new Proxy for fuchsia.component/StorageAdmin.
6437    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6438        let protocol_name = <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6439        Self { client: fidl::client::Client::new(channel, protocol_name) }
6440    }
6441
6442    /// Get a Stream of events from the remote end of the protocol.
6443    ///
6444    /// # Panics
6445    ///
6446    /// Panics if the event stream was already taken.
6447    pub fn take_event_stream(&self) -> StorageAdminEventStream {
6448        StorageAdminEventStream { event_receiver: self.client.take_event_receiver() }
6449    }
6450
6451    /// Opens the isolated directory for the given component. The provided
6452    /// moniker is relative to the component that declares the storage
6453    /// capability. Creates the backing sub-directory for this storage if it
6454    /// hasn't yet been created.
6455    pub fn r#open_storage(
6456        &self,
6457        mut relative_moniker: &str,
6458        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6459    ) -> fidl::client::QueryResponseFut<
6460        StorageAdminOpenStorageResult,
6461        fidl::encoding::DefaultFuchsiaResourceDialect,
6462    > {
6463        StorageAdminProxyInterface::r#open_storage(self, relative_moniker, object)
6464    }
6465
6466    /// Lists the descendant components under the specified realm that use the
6467    /// storage capability. The provided moniker is relative to the component
6468    /// that declares the storage capability.
6469    ///
6470    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
6471    /// if |relative_moniker| is malformed.
6472    pub fn r#list_storage_in_realm(
6473        &self,
6474        mut relative_moniker: &str,
6475        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6476    ) -> fidl::client::QueryResponseFut<
6477        StorageAdminListStorageInRealmResult,
6478        fidl::encoding::DefaultFuchsiaResourceDialect,
6479    > {
6480        StorageAdminProxyInterface::r#list_storage_in_realm(self, relative_moniker, iterator)
6481    }
6482
6483    /// Opens the isolated directory for the given storage ID. Creates the
6484    /// backing sub-directory for this storage if it hasn't yet been created.
6485    pub fn r#open_component_storage_by_id(
6486        &self,
6487        mut id: &str,
6488        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6489    ) -> fidl::client::QueryResponseFut<
6490        StorageAdminOpenComponentStorageByIdResult,
6491        fidl::encoding::DefaultFuchsiaResourceDialect,
6492    > {
6493        StorageAdminProxyInterface::r#open_component_storage_by_id(self, id, object)
6494    }
6495
6496    /// Deletes the contents of the storage for this component. Preserves the
6497    /// component's subdirectory itself within the storage backing directory.
6498    /// The provided moniker is relative to the component that declares the
6499    /// storage capability.
6500    pub fn r#delete_component_storage(
6501        &self,
6502        mut relative_moniker: &str,
6503    ) -> fidl::client::QueryResponseFut<
6504        StorageAdminDeleteComponentStorageResult,
6505        fidl::encoding::DefaultFuchsiaResourceDialect,
6506    > {
6507        StorageAdminProxyInterface::r#delete_component_storage(self, relative_moniker)
6508    }
6509
6510    /// Get the current status of the storage.
6511    pub fn r#get_status(
6512        &self,
6513    ) -> fidl::client::QueryResponseFut<
6514        StorageAdminGetStatusResult,
6515        fidl::encoding::DefaultFuchsiaResourceDialect,
6516    > {
6517        StorageAdminProxyInterface::r#get_status(self)
6518    }
6519
6520    /// Deletes the contents of all the storage. Storage directories are
6521    /// retained so any components using storage will be able to continue using
6522    /// it to create new files and directories.
6523    ///
6524    /// Returns Error::INTERNAL only if no storage at all could be cleared.
6525    /// Returns successfully even if some errors happen during the deletion
6526    /// progress.
6527    pub fn r#delete_all_storage_contents(
6528        &self,
6529    ) -> fidl::client::QueryResponseFut<
6530        StorageAdminDeleteAllStorageContentsResult,
6531        fidl::encoding::DefaultFuchsiaResourceDialect,
6532    > {
6533        StorageAdminProxyInterface::r#delete_all_storage_contents(self)
6534    }
6535}
6536
6537impl StorageAdminProxyInterface for StorageAdminProxy {
6538    type OpenStorageResponseFut = fidl::client::QueryResponseFut<
6539        StorageAdminOpenStorageResult,
6540        fidl::encoding::DefaultFuchsiaResourceDialect,
6541    >;
6542    fn r#open_storage(
6543        &self,
6544        mut relative_moniker: &str,
6545        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6546    ) -> Self::OpenStorageResponseFut {
6547        fn _decode(
6548            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6549        ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
6550            let _response = fidl::client::decode_transaction_body::<
6551                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6552                fidl::encoding::DefaultFuchsiaResourceDialect,
6553                0x6ceaa5904cfe4377,
6554            >(_buf?)?;
6555            Ok(_response.map(|x| x))
6556        }
6557        self.client
6558            .send_query_and_decode::<StorageAdminOpenStorageRequest, StorageAdminOpenStorageResult>(
6559                (relative_moniker, object),
6560                0x6ceaa5904cfe4377,
6561                fidl::encoding::DynamicFlags::empty(),
6562                _decode,
6563            )
6564    }
6565
6566    type ListStorageInRealmResponseFut = fidl::client::QueryResponseFut<
6567        StorageAdminListStorageInRealmResult,
6568        fidl::encoding::DefaultFuchsiaResourceDialect,
6569    >;
6570    fn r#list_storage_in_realm(
6571        &self,
6572        mut relative_moniker: &str,
6573        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6574    ) -> Self::ListStorageInRealmResponseFut {
6575        fn _decode(
6576            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6577        ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
6578            let _response = fidl::client::decode_transaction_body::<
6579                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6580                fidl::encoding::DefaultFuchsiaResourceDialect,
6581                0x764f6d1f083e8bfb,
6582            >(_buf?)?;
6583            Ok(_response.map(|x| x))
6584        }
6585        self.client.send_query_and_decode::<
6586            StorageAdminListStorageInRealmRequest,
6587            StorageAdminListStorageInRealmResult,
6588        >(
6589            (relative_moniker, iterator,),
6590            0x764f6d1f083e8bfb,
6591            fidl::encoding::DynamicFlags::empty(),
6592            _decode,
6593        )
6594    }
6595
6596    type OpenComponentStorageByIdResponseFut = fidl::client::QueryResponseFut<
6597        StorageAdminOpenComponentStorageByIdResult,
6598        fidl::encoding::DefaultFuchsiaResourceDialect,
6599    >;
6600    fn r#open_component_storage_by_id(
6601        &self,
6602        mut id: &str,
6603        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6604    ) -> Self::OpenComponentStorageByIdResponseFut {
6605        fn _decode(
6606            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6607        ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
6608            let _response = fidl::client::decode_transaction_body::<
6609                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6610                fidl::encoding::DefaultFuchsiaResourceDialect,
6611                0x4802102cc55d5df1,
6612            >(_buf?)?;
6613            Ok(_response.map(|x| x))
6614        }
6615        self.client.send_query_and_decode::<
6616            StorageAdminOpenComponentStorageByIdRequest,
6617            StorageAdminOpenComponentStorageByIdResult,
6618        >(
6619            (id, object,),
6620            0x4802102cc55d5df1,
6621            fidl::encoding::DynamicFlags::empty(),
6622            _decode,
6623        )
6624    }
6625
6626    type DeleteComponentStorageResponseFut = fidl::client::QueryResponseFut<
6627        StorageAdminDeleteComponentStorageResult,
6628        fidl::encoding::DefaultFuchsiaResourceDialect,
6629    >;
6630    fn r#delete_component_storage(
6631        &self,
6632        mut relative_moniker: &str,
6633    ) -> Self::DeleteComponentStorageResponseFut {
6634        fn _decode(
6635            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6636        ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
6637            let _response = fidl::client::decode_transaction_body::<
6638                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6639                fidl::encoding::DefaultFuchsiaResourceDialect,
6640                0x1677c1cdfcdbf45a,
6641            >(_buf?)?;
6642            Ok(_response.map(|x| x))
6643        }
6644        self.client.send_query_and_decode::<
6645            StorageAdminDeleteComponentStorageRequest,
6646            StorageAdminDeleteComponentStorageResult,
6647        >(
6648            (relative_moniker,),
6649            0x1677c1cdfcdbf45a,
6650            fidl::encoding::DynamicFlags::empty(),
6651            _decode,
6652        )
6653    }
6654
6655    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6656        StorageAdminGetStatusResult,
6657        fidl::encoding::DefaultFuchsiaResourceDialect,
6658    >;
6659    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6660        fn _decode(
6661            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6662        ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
6663            let _response = fidl::client::decode_transaction_body::<
6664                fidl::encoding::ResultType<StorageStatus, StatusError>,
6665                fidl::encoding::DefaultFuchsiaResourceDialect,
6666                0x7729e325a6c526c8,
6667            >(_buf?)?;
6668            Ok(_response.map(|x| x))
6669        }
6670        self.client
6671            .send_query_and_decode::<fidl::encoding::EmptyPayload, StorageAdminGetStatusResult>(
6672                (),
6673                0x7729e325a6c526c8,
6674                fidl::encoding::DynamicFlags::empty(),
6675                _decode,
6676            )
6677    }
6678
6679    type DeleteAllStorageContentsResponseFut = fidl::client::QueryResponseFut<
6680        StorageAdminDeleteAllStorageContentsResult,
6681        fidl::encoding::DefaultFuchsiaResourceDialect,
6682    >;
6683    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut {
6684        fn _decode(
6685            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6686        ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
6687            let _response = fidl::client::decode_transaction_body::<
6688                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
6689                fidl::encoding::DefaultFuchsiaResourceDialect,
6690                0x2ee980b4b2d24adb,
6691            >(_buf?)?;
6692            Ok(_response.map(|x| x))
6693        }
6694        self.client.send_query_and_decode::<
6695            fidl::encoding::EmptyPayload,
6696            StorageAdminDeleteAllStorageContentsResult,
6697        >(
6698            (),
6699            0x2ee980b4b2d24adb,
6700            fidl::encoding::DynamicFlags::empty(),
6701            _decode,
6702        )
6703    }
6704}
6705
6706pub struct StorageAdminEventStream {
6707    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6708}
6709
6710impl std::marker::Unpin for StorageAdminEventStream {}
6711
6712impl futures::stream::FusedStream for StorageAdminEventStream {
6713    fn is_terminated(&self) -> bool {
6714        self.event_receiver.is_terminated()
6715    }
6716}
6717
6718impl futures::Stream for StorageAdminEventStream {
6719    type Item = Result<StorageAdminEvent, fidl::Error>;
6720
6721    fn poll_next(
6722        mut self: std::pin::Pin<&mut Self>,
6723        cx: &mut std::task::Context<'_>,
6724    ) -> std::task::Poll<Option<Self::Item>> {
6725        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6726            &mut self.event_receiver,
6727            cx
6728        )?) {
6729            Some(buf) => std::task::Poll::Ready(Some(StorageAdminEvent::decode(buf))),
6730            None => std::task::Poll::Ready(None),
6731        }
6732    }
6733}
6734
6735#[derive(Debug)]
6736pub enum StorageAdminEvent {}
6737
6738impl StorageAdminEvent {
6739    /// Decodes a message buffer as a [`StorageAdminEvent`].
6740    fn decode(
6741        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6742    ) -> Result<StorageAdminEvent, fidl::Error> {
6743        let (bytes, _handles) = buf.split_mut();
6744        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6745        debug_assert_eq!(tx_header.tx_id, 0);
6746        match tx_header.ordinal {
6747            _ => Err(fidl::Error::UnknownOrdinal {
6748                ordinal: tx_header.ordinal,
6749                protocol_name: <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6750            }),
6751        }
6752    }
6753}
6754
6755/// A Stream of incoming requests for fuchsia.component/StorageAdmin.
6756pub struct StorageAdminRequestStream {
6757    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6758    is_terminated: bool,
6759}
6760
6761impl std::marker::Unpin for StorageAdminRequestStream {}
6762
6763impl futures::stream::FusedStream for StorageAdminRequestStream {
6764    fn is_terminated(&self) -> bool {
6765        self.is_terminated
6766    }
6767}
6768
6769impl fidl::endpoints::RequestStream for StorageAdminRequestStream {
6770    type Protocol = StorageAdminMarker;
6771    type ControlHandle = StorageAdminControlHandle;
6772
6773    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6774        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6775    }
6776
6777    fn control_handle(&self) -> Self::ControlHandle {
6778        StorageAdminControlHandle { inner: self.inner.clone() }
6779    }
6780
6781    fn into_inner(
6782        self,
6783    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6784    {
6785        (self.inner, self.is_terminated)
6786    }
6787
6788    fn from_inner(
6789        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6790        is_terminated: bool,
6791    ) -> Self {
6792        Self { inner, is_terminated }
6793    }
6794}
6795
6796impl futures::Stream for StorageAdminRequestStream {
6797    type Item = Result<StorageAdminRequest, fidl::Error>;
6798
6799    fn poll_next(
6800        mut self: std::pin::Pin<&mut Self>,
6801        cx: &mut std::task::Context<'_>,
6802    ) -> std::task::Poll<Option<Self::Item>> {
6803        let this = &mut *self;
6804        if this.inner.check_shutdown(cx) {
6805            this.is_terminated = true;
6806            return std::task::Poll::Ready(None);
6807        }
6808        if this.is_terminated {
6809            panic!("polled StorageAdminRequestStream after completion");
6810        }
6811        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6812            |bytes, handles| {
6813                match this.inner.channel().read_etc(cx, bytes, handles) {
6814                    std::task::Poll::Ready(Ok(())) => {}
6815                    std::task::Poll::Pending => return std::task::Poll::Pending,
6816                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6817                        this.is_terminated = true;
6818                        return std::task::Poll::Ready(None);
6819                    }
6820                    std::task::Poll::Ready(Err(e)) => {
6821                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6822                            e.into(),
6823                        ))));
6824                    }
6825                }
6826
6827                // A message has been received from the channel
6828                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6829
6830                std::task::Poll::Ready(Some(match header.ordinal {
6831                    0x6ceaa5904cfe4377 => {
6832                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6833                        let mut req = fidl::new_empty!(
6834                            StorageAdminOpenStorageRequest,
6835                            fidl::encoding::DefaultFuchsiaResourceDialect
6836                        );
6837                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenStorageRequest>(&header, _body_bytes, handles, &mut req)?;
6838                        let control_handle =
6839                            StorageAdminControlHandle { inner: this.inner.clone() };
6840                        Ok(StorageAdminRequest::OpenStorage {
6841                            relative_moniker: req.relative_moniker,
6842                            object: req.object,
6843
6844                            responder: StorageAdminOpenStorageResponder {
6845                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6846                                tx_id: header.tx_id,
6847                            },
6848                        })
6849                    }
6850                    0x764f6d1f083e8bfb => {
6851                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6852                        let mut req = fidl::new_empty!(
6853                            StorageAdminListStorageInRealmRequest,
6854                            fidl::encoding::DefaultFuchsiaResourceDialect
6855                        );
6856                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminListStorageInRealmRequest>(&header, _body_bytes, handles, &mut req)?;
6857                        let control_handle =
6858                            StorageAdminControlHandle { inner: this.inner.clone() };
6859                        Ok(StorageAdminRequest::ListStorageInRealm {
6860                            relative_moniker: req.relative_moniker,
6861                            iterator: req.iterator,
6862
6863                            responder: StorageAdminListStorageInRealmResponder {
6864                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6865                                tx_id: header.tx_id,
6866                            },
6867                        })
6868                    }
6869                    0x4802102cc55d5df1 => {
6870                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6871                        let mut req = fidl::new_empty!(
6872                            StorageAdminOpenComponentStorageByIdRequest,
6873                            fidl::encoding::DefaultFuchsiaResourceDialect
6874                        );
6875                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenComponentStorageByIdRequest>(&header, _body_bytes, handles, &mut req)?;
6876                        let control_handle =
6877                            StorageAdminControlHandle { inner: this.inner.clone() };
6878                        Ok(StorageAdminRequest::OpenComponentStorageById {
6879                            id: req.id,
6880                            object: req.object,
6881
6882                            responder: StorageAdminOpenComponentStorageByIdResponder {
6883                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6884                                tx_id: header.tx_id,
6885                            },
6886                        })
6887                    }
6888                    0x1677c1cdfcdbf45a => {
6889                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6890                        let mut req = fidl::new_empty!(
6891                            StorageAdminDeleteComponentStorageRequest,
6892                            fidl::encoding::DefaultFuchsiaResourceDialect
6893                        );
6894                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminDeleteComponentStorageRequest>(&header, _body_bytes, handles, &mut req)?;
6895                        let control_handle =
6896                            StorageAdminControlHandle { inner: this.inner.clone() };
6897                        Ok(StorageAdminRequest::DeleteComponentStorage {
6898                            relative_moniker: req.relative_moniker,
6899
6900                            responder: StorageAdminDeleteComponentStorageResponder {
6901                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6902                                tx_id: header.tx_id,
6903                            },
6904                        })
6905                    }
6906                    0x7729e325a6c526c8 => {
6907                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6908                        let mut req = fidl::new_empty!(
6909                            fidl::encoding::EmptyPayload,
6910                            fidl::encoding::DefaultFuchsiaResourceDialect
6911                        );
6912                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6913                        let control_handle =
6914                            StorageAdminControlHandle { inner: this.inner.clone() };
6915                        Ok(StorageAdminRequest::GetStatus {
6916                            responder: StorageAdminGetStatusResponder {
6917                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6918                                tx_id: header.tx_id,
6919                            },
6920                        })
6921                    }
6922                    0x2ee980b4b2d24adb => {
6923                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6924                        let mut req = fidl::new_empty!(
6925                            fidl::encoding::EmptyPayload,
6926                            fidl::encoding::DefaultFuchsiaResourceDialect
6927                        );
6928                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6929                        let control_handle =
6930                            StorageAdminControlHandle { inner: this.inner.clone() };
6931                        Ok(StorageAdminRequest::DeleteAllStorageContents {
6932                            responder: StorageAdminDeleteAllStorageContentsResponder {
6933                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6934                                tx_id: header.tx_id,
6935                            },
6936                        })
6937                    }
6938                    _ => Err(fidl::Error::UnknownOrdinal {
6939                        ordinal: header.ordinal,
6940                        protocol_name:
6941                            <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6942                    }),
6943                }))
6944            },
6945        )
6946    }
6947}
6948
6949#[derive(Debug)]
6950pub enum StorageAdminRequest {
6951    /// Opens the isolated directory for the given component. The provided
6952    /// moniker is relative to the component that declares the storage
6953    /// capability. Creates the backing sub-directory for this storage if it
6954    /// hasn't yet been created.
6955    OpenStorage {
6956        relative_moniker: String,
6957        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6958        responder: StorageAdminOpenStorageResponder,
6959    },
6960    /// Lists the descendant components under the specified realm that use the
6961    /// storage capability. The provided moniker is relative to the component
6962    /// that declares the storage capability.
6963    ///
6964    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
6965    /// if |relative_moniker| is malformed.
6966    ListStorageInRealm {
6967        relative_moniker: String,
6968        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6969        responder: StorageAdminListStorageInRealmResponder,
6970    },
6971    /// Opens the isolated directory for the given storage ID. Creates the
6972    /// backing sub-directory for this storage if it hasn't yet been created.
6973    OpenComponentStorageById {
6974        id: String,
6975        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6976        responder: StorageAdminOpenComponentStorageByIdResponder,
6977    },
6978    /// Deletes the contents of the storage for this component. Preserves the
6979    /// component's subdirectory itself within the storage backing directory.
6980    /// The provided moniker is relative to the component that declares the
6981    /// storage capability.
6982    DeleteComponentStorage {
6983        relative_moniker: String,
6984        responder: StorageAdminDeleteComponentStorageResponder,
6985    },
6986    /// Get the current status of the storage.
6987    GetStatus { responder: StorageAdminGetStatusResponder },
6988    /// Deletes the contents of all the storage. Storage directories are
6989    /// retained so any components using storage will be able to continue using
6990    /// it to create new files and directories.
6991    ///
6992    /// Returns Error::INTERNAL only if no storage at all could be cleared.
6993    /// Returns successfully even if some errors happen during the deletion
6994    /// progress.
6995    DeleteAllStorageContents { responder: StorageAdminDeleteAllStorageContentsResponder },
6996}
6997
6998impl StorageAdminRequest {
6999    #[allow(irrefutable_let_patterns)]
7000    pub fn into_open_storage(
7001        self,
7002    ) -> Option<(
7003        String,
7004        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7005        StorageAdminOpenStorageResponder,
7006    )> {
7007        if let StorageAdminRequest::OpenStorage { relative_moniker, object, responder } = self {
7008            Some((relative_moniker, object, responder))
7009        } else {
7010            None
7011        }
7012    }
7013
7014    #[allow(irrefutable_let_patterns)]
7015    pub fn into_list_storage_in_realm(
7016        self,
7017    ) -> Option<(
7018        String,
7019        fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7020        StorageAdminListStorageInRealmResponder,
7021    )> {
7022        if let StorageAdminRequest::ListStorageInRealm { relative_moniker, iterator, responder } =
7023            self
7024        {
7025            Some((relative_moniker, iterator, responder))
7026        } else {
7027            None
7028        }
7029    }
7030
7031    #[allow(irrefutable_let_patterns)]
7032    pub fn into_open_component_storage_by_id(
7033        self,
7034    ) -> Option<(
7035        String,
7036        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7037        StorageAdminOpenComponentStorageByIdResponder,
7038    )> {
7039        if let StorageAdminRequest::OpenComponentStorageById { id, object, responder } = self {
7040            Some((id, object, responder))
7041        } else {
7042            None
7043        }
7044    }
7045
7046    #[allow(irrefutable_let_patterns)]
7047    pub fn into_delete_component_storage(
7048        self,
7049    ) -> Option<(String, StorageAdminDeleteComponentStorageResponder)> {
7050        if let StorageAdminRequest::DeleteComponentStorage { relative_moniker, responder } = self {
7051            Some((relative_moniker, responder))
7052        } else {
7053            None
7054        }
7055    }
7056
7057    #[allow(irrefutable_let_patterns)]
7058    pub fn into_get_status(self) -> Option<(StorageAdminGetStatusResponder)> {
7059        if let StorageAdminRequest::GetStatus { responder } = self {
7060            Some((responder))
7061        } else {
7062            None
7063        }
7064    }
7065
7066    #[allow(irrefutable_let_patterns)]
7067    pub fn into_delete_all_storage_contents(
7068        self,
7069    ) -> Option<(StorageAdminDeleteAllStorageContentsResponder)> {
7070        if let StorageAdminRequest::DeleteAllStorageContents { responder } = self {
7071            Some((responder))
7072        } else {
7073            None
7074        }
7075    }
7076
7077    /// Name of the method defined in FIDL
7078    pub fn method_name(&self) -> &'static str {
7079        match *self {
7080            StorageAdminRequest::OpenStorage { .. } => "open_storage",
7081            StorageAdminRequest::ListStorageInRealm { .. } => "list_storage_in_realm",
7082            StorageAdminRequest::OpenComponentStorageById { .. } => "open_component_storage_by_id",
7083            StorageAdminRequest::DeleteComponentStorage { .. } => "delete_component_storage",
7084            StorageAdminRequest::GetStatus { .. } => "get_status",
7085            StorageAdminRequest::DeleteAllStorageContents { .. } => "delete_all_storage_contents",
7086        }
7087    }
7088}
7089
7090#[derive(Debug, Clone)]
7091pub struct StorageAdminControlHandle {
7092    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7093}
7094
7095impl fidl::endpoints::ControlHandle for StorageAdminControlHandle {
7096    fn shutdown(&self) {
7097        self.inner.shutdown()
7098    }
7099
7100    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7101        self.inner.shutdown_with_epitaph(status)
7102    }
7103
7104    fn is_closed(&self) -> bool {
7105        self.inner.channel().is_closed()
7106    }
7107    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7108        self.inner.channel().on_closed()
7109    }
7110
7111    #[cfg(target_os = "fuchsia")]
7112    fn signal_peer(
7113        &self,
7114        clear_mask: zx::Signals,
7115        set_mask: zx::Signals,
7116    ) -> Result<(), zx_status::Status> {
7117        use fidl::Peered;
7118        self.inner.channel().signal_peer(clear_mask, set_mask)
7119    }
7120}
7121
7122impl StorageAdminControlHandle {}
7123
7124#[must_use = "FIDL methods require a response to be sent"]
7125#[derive(Debug)]
7126pub struct StorageAdminOpenStorageResponder {
7127    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7128    tx_id: u32,
7129}
7130
7131/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7132/// if the responder is dropped without sending a response, so that the client
7133/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7134impl std::ops::Drop for StorageAdminOpenStorageResponder {
7135    fn drop(&mut self) {
7136        self.control_handle.shutdown();
7137        // Safety: drops once, never accessed again
7138        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7139    }
7140}
7141
7142impl fidl::endpoints::Responder for StorageAdminOpenStorageResponder {
7143    type ControlHandle = StorageAdminControlHandle;
7144
7145    fn control_handle(&self) -> &StorageAdminControlHandle {
7146        &self.control_handle
7147    }
7148
7149    fn drop_without_shutdown(mut self) {
7150        // Safety: drops once, never accessed again due to mem::forget
7151        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7152        // Prevent Drop from running (which would shut down the channel)
7153        std::mem::forget(self);
7154    }
7155}
7156
7157impl StorageAdminOpenStorageResponder {
7158    /// Sends a response to the FIDL transaction.
7159    ///
7160    /// Sets the channel to shutdown if an error occurs.
7161    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7162        let _result = self.send_raw(result);
7163        if _result.is_err() {
7164            self.control_handle.shutdown();
7165        }
7166        self.drop_without_shutdown();
7167        _result
7168    }
7169
7170    /// Similar to "send" but does not shutdown the channel if an error occurs.
7171    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7172        let _result = self.send_raw(result);
7173        self.drop_without_shutdown();
7174        _result
7175    }
7176
7177    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7178        self.control_handle
7179            .inner
7180            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7181                result,
7182                self.tx_id,
7183                0x6ceaa5904cfe4377,
7184                fidl::encoding::DynamicFlags::empty(),
7185            )
7186    }
7187}
7188
7189#[must_use = "FIDL methods require a response to be sent"]
7190#[derive(Debug)]
7191pub struct StorageAdminListStorageInRealmResponder {
7192    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7193    tx_id: u32,
7194}
7195
7196/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7197/// if the responder is dropped without sending a response, so that the client
7198/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7199impl std::ops::Drop for StorageAdminListStorageInRealmResponder {
7200    fn drop(&mut self) {
7201        self.control_handle.shutdown();
7202        // Safety: drops once, never accessed again
7203        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7204    }
7205}
7206
7207impl fidl::endpoints::Responder for StorageAdminListStorageInRealmResponder {
7208    type ControlHandle = StorageAdminControlHandle;
7209
7210    fn control_handle(&self) -> &StorageAdminControlHandle {
7211        &self.control_handle
7212    }
7213
7214    fn drop_without_shutdown(mut self) {
7215        // Safety: drops once, never accessed again due to mem::forget
7216        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7217        // Prevent Drop from running (which would shut down the channel)
7218        std::mem::forget(self);
7219    }
7220}
7221
7222impl StorageAdminListStorageInRealmResponder {
7223    /// Sends a response to the FIDL transaction.
7224    ///
7225    /// Sets the channel to shutdown if an error occurs.
7226    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7227        let _result = self.send_raw(result);
7228        if _result.is_err() {
7229            self.control_handle.shutdown();
7230        }
7231        self.drop_without_shutdown();
7232        _result
7233    }
7234
7235    /// Similar to "send" but does not shutdown the channel if an error occurs.
7236    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7237        let _result = self.send_raw(result);
7238        self.drop_without_shutdown();
7239        _result
7240    }
7241
7242    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7243        self.control_handle
7244            .inner
7245            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7246                result,
7247                self.tx_id,
7248                0x764f6d1f083e8bfb,
7249                fidl::encoding::DynamicFlags::empty(),
7250            )
7251    }
7252}
7253
7254#[must_use = "FIDL methods require a response to be sent"]
7255#[derive(Debug)]
7256pub struct StorageAdminOpenComponentStorageByIdResponder {
7257    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7258    tx_id: u32,
7259}
7260
7261/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7262/// if the responder is dropped without sending a response, so that the client
7263/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7264impl std::ops::Drop for StorageAdminOpenComponentStorageByIdResponder {
7265    fn drop(&mut self) {
7266        self.control_handle.shutdown();
7267        // Safety: drops once, never accessed again
7268        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7269    }
7270}
7271
7272impl fidl::endpoints::Responder for StorageAdminOpenComponentStorageByIdResponder {
7273    type ControlHandle = StorageAdminControlHandle;
7274
7275    fn control_handle(&self) -> &StorageAdminControlHandle {
7276        &self.control_handle
7277    }
7278
7279    fn drop_without_shutdown(mut self) {
7280        // Safety: drops once, never accessed again due to mem::forget
7281        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7282        // Prevent Drop from running (which would shut down the channel)
7283        std::mem::forget(self);
7284    }
7285}
7286
7287impl StorageAdminOpenComponentStorageByIdResponder {
7288    /// Sends a response to the FIDL transaction.
7289    ///
7290    /// Sets the channel to shutdown if an error occurs.
7291    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7292        let _result = self.send_raw(result);
7293        if _result.is_err() {
7294            self.control_handle.shutdown();
7295        }
7296        self.drop_without_shutdown();
7297        _result
7298    }
7299
7300    /// Similar to "send" but does not shutdown the channel if an error occurs.
7301    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7302        let _result = self.send_raw(result);
7303        self.drop_without_shutdown();
7304        _result
7305    }
7306
7307    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7308        self.control_handle
7309            .inner
7310            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7311                result,
7312                self.tx_id,
7313                0x4802102cc55d5df1,
7314                fidl::encoding::DynamicFlags::empty(),
7315            )
7316    }
7317}
7318
7319#[must_use = "FIDL methods require a response to be sent"]
7320#[derive(Debug)]
7321pub struct StorageAdminDeleteComponentStorageResponder {
7322    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7323    tx_id: u32,
7324}
7325
7326/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7327/// if the responder is dropped without sending a response, so that the client
7328/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7329impl std::ops::Drop for StorageAdminDeleteComponentStorageResponder {
7330    fn drop(&mut self) {
7331        self.control_handle.shutdown();
7332        // Safety: drops once, never accessed again
7333        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7334    }
7335}
7336
7337impl fidl::endpoints::Responder for StorageAdminDeleteComponentStorageResponder {
7338    type ControlHandle = StorageAdminControlHandle;
7339
7340    fn control_handle(&self) -> &StorageAdminControlHandle {
7341        &self.control_handle
7342    }
7343
7344    fn drop_without_shutdown(mut self) {
7345        // Safety: drops once, never accessed again due to mem::forget
7346        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7347        // Prevent Drop from running (which would shut down the channel)
7348        std::mem::forget(self);
7349    }
7350}
7351
7352impl StorageAdminDeleteComponentStorageResponder {
7353    /// Sends a response to the FIDL transaction.
7354    ///
7355    /// Sets the channel to shutdown if an error occurs.
7356    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7357        let _result = self.send_raw(result);
7358        if _result.is_err() {
7359            self.control_handle.shutdown();
7360        }
7361        self.drop_without_shutdown();
7362        _result
7363    }
7364
7365    /// Similar to "send" but does not shutdown the channel if an error occurs.
7366    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7367        let _result = self.send_raw(result);
7368        self.drop_without_shutdown();
7369        _result
7370    }
7371
7372    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7373        self.control_handle
7374            .inner
7375            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7376                result,
7377                self.tx_id,
7378                0x1677c1cdfcdbf45a,
7379                fidl::encoding::DynamicFlags::empty(),
7380            )
7381    }
7382}
7383
7384#[must_use = "FIDL methods require a response to be sent"]
7385#[derive(Debug)]
7386pub struct StorageAdminGetStatusResponder {
7387    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7388    tx_id: u32,
7389}
7390
7391/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7392/// if the responder is dropped without sending a response, so that the client
7393/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7394impl std::ops::Drop for StorageAdminGetStatusResponder {
7395    fn drop(&mut self) {
7396        self.control_handle.shutdown();
7397        // Safety: drops once, never accessed again
7398        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7399    }
7400}
7401
7402impl fidl::endpoints::Responder for StorageAdminGetStatusResponder {
7403    type ControlHandle = StorageAdminControlHandle;
7404
7405    fn control_handle(&self) -> &StorageAdminControlHandle {
7406        &self.control_handle
7407    }
7408
7409    fn drop_without_shutdown(mut self) {
7410        // Safety: drops once, never accessed again due to mem::forget
7411        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7412        // Prevent Drop from running (which would shut down the channel)
7413        std::mem::forget(self);
7414    }
7415}
7416
7417impl StorageAdminGetStatusResponder {
7418    /// Sends a response to the FIDL transaction.
7419    ///
7420    /// Sets the channel to shutdown if an error occurs.
7421    pub fn send(self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
7422        let _result = self.send_raw(result);
7423        if _result.is_err() {
7424            self.control_handle.shutdown();
7425        }
7426        self.drop_without_shutdown();
7427        _result
7428    }
7429
7430    /// Similar to "send" but does not shutdown the channel if an error occurs.
7431    pub fn send_no_shutdown_on_err(
7432        self,
7433        mut result: Result<&StorageStatus, StatusError>,
7434    ) -> Result<(), fidl::Error> {
7435        let _result = self.send_raw(result);
7436        self.drop_without_shutdown();
7437        _result
7438    }
7439
7440    fn send_raw(&self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
7441        self.control_handle.inner.send::<fidl::encoding::ResultType<StorageStatus, StatusError>>(
7442            result,
7443            self.tx_id,
7444            0x7729e325a6c526c8,
7445            fidl::encoding::DynamicFlags::empty(),
7446        )
7447    }
7448}
7449
7450#[must_use = "FIDL methods require a response to be sent"]
7451#[derive(Debug)]
7452pub struct StorageAdminDeleteAllStorageContentsResponder {
7453    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7454    tx_id: u32,
7455}
7456
7457/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7458/// if the responder is dropped without sending a response, so that the client
7459/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7460impl std::ops::Drop for StorageAdminDeleteAllStorageContentsResponder {
7461    fn drop(&mut self) {
7462        self.control_handle.shutdown();
7463        // Safety: drops once, never accessed again
7464        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7465    }
7466}
7467
7468impl fidl::endpoints::Responder for StorageAdminDeleteAllStorageContentsResponder {
7469    type ControlHandle = StorageAdminControlHandle;
7470
7471    fn control_handle(&self) -> &StorageAdminControlHandle {
7472        &self.control_handle
7473    }
7474
7475    fn drop_without_shutdown(mut self) {
7476        // Safety: drops once, never accessed again due to mem::forget
7477        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7478        // Prevent Drop from running (which would shut down the channel)
7479        std::mem::forget(self);
7480    }
7481}
7482
7483impl StorageAdminDeleteAllStorageContentsResponder {
7484    /// Sends a response to the FIDL transaction.
7485    ///
7486    /// Sets the channel to shutdown if an error occurs.
7487    pub fn send(self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
7488        let _result = self.send_raw(result);
7489        if _result.is_err() {
7490            self.control_handle.shutdown();
7491        }
7492        self.drop_without_shutdown();
7493        _result
7494    }
7495
7496    /// Similar to "send" but does not shutdown the channel if an error occurs.
7497    pub fn send_no_shutdown_on_err(
7498        self,
7499        mut result: Result<(), DeletionError>,
7500    ) -> Result<(), fidl::Error> {
7501        let _result = self.send_raw(result);
7502        self.drop_without_shutdown();
7503        _result
7504    }
7505
7506    fn send_raw(&self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
7507        self.control_handle.inner.send::<fidl::encoding::ResultType<
7508            fidl::encoding::EmptyStruct,
7509            DeletionError,
7510        >>(
7511            result,
7512            self.tx_id,
7513            0x2ee980b4b2d24adb,
7514            fidl::encoding::DynamicFlags::empty(),
7515        )
7516    }
7517}
7518
7519#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7520pub struct StorageIteratorMarker;
7521
7522impl fidl::endpoints::ProtocolMarker for StorageIteratorMarker {
7523    type Proxy = StorageIteratorProxy;
7524    type RequestStream = StorageIteratorRequestStream;
7525    #[cfg(target_os = "fuchsia")]
7526    type SynchronousProxy = StorageIteratorSynchronousProxy;
7527
7528    const DEBUG_NAME: &'static str = "(anonymous) StorageIterator";
7529}
7530
7531pub trait StorageIteratorProxyInterface: Send + Sync {
7532    type NextResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
7533    fn r#next(&self) -> Self::NextResponseFut;
7534}
7535#[derive(Debug)]
7536#[cfg(target_os = "fuchsia")]
7537pub struct StorageIteratorSynchronousProxy {
7538    client: fidl::client::sync::Client,
7539}
7540
7541#[cfg(target_os = "fuchsia")]
7542impl fidl::endpoints::SynchronousProxy for StorageIteratorSynchronousProxy {
7543    type Proxy = StorageIteratorProxy;
7544    type Protocol = StorageIteratorMarker;
7545
7546    fn from_channel(inner: fidl::Channel) -> Self {
7547        Self::new(inner)
7548    }
7549
7550    fn into_channel(self) -> fidl::Channel {
7551        self.client.into_channel()
7552    }
7553
7554    fn as_channel(&self) -> &fidl::Channel {
7555        self.client.as_channel()
7556    }
7557}
7558
7559#[cfg(target_os = "fuchsia")]
7560impl StorageIteratorSynchronousProxy {
7561    pub fn new(channel: fidl::Channel) -> Self {
7562        let protocol_name = <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7563        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7564    }
7565
7566    pub fn into_channel(self) -> fidl::Channel {
7567        self.client.into_channel()
7568    }
7569
7570    /// Waits until an event arrives and returns it. It is safe for other
7571    /// threads to make concurrent requests while waiting for an event.
7572    pub fn wait_for_event(
7573        &self,
7574        deadline: zx::MonotonicInstant,
7575    ) -> Result<StorageIteratorEvent, fidl::Error> {
7576        StorageIteratorEvent::decode(self.client.wait_for_event(deadline)?)
7577    }
7578
7579    /// Retrieve the next set of components using the storage capability. The
7580    /// returned monikers are relative to the component that declares the
7581    /// storage capability. Returns an empty vector after all components have
7582    /// been returned.
7583    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<String>, fidl::Error> {
7584        let _response =
7585            self.client.send_query::<fidl::encoding::EmptyPayload, StorageIteratorNextResponse>(
7586                (),
7587                0x7a6b21f15fd01b72,
7588                fidl::encoding::DynamicFlags::empty(),
7589                ___deadline,
7590            )?;
7591        Ok(_response.relative_monikers)
7592    }
7593}
7594
7595#[cfg(target_os = "fuchsia")]
7596impl From<StorageIteratorSynchronousProxy> for zx::NullableHandle {
7597    fn from(value: StorageIteratorSynchronousProxy) -> Self {
7598        value.into_channel().into()
7599    }
7600}
7601
7602#[cfg(target_os = "fuchsia")]
7603impl From<fidl::Channel> for StorageIteratorSynchronousProxy {
7604    fn from(value: fidl::Channel) -> Self {
7605        Self::new(value)
7606    }
7607}
7608
7609#[cfg(target_os = "fuchsia")]
7610impl fidl::endpoints::FromClient for StorageIteratorSynchronousProxy {
7611    type Protocol = StorageIteratorMarker;
7612
7613    fn from_client(value: fidl::endpoints::ClientEnd<StorageIteratorMarker>) -> Self {
7614        Self::new(value.into_channel())
7615    }
7616}
7617
7618#[derive(Debug, Clone)]
7619pub struct StorageIteratorProxy {
7620    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7621}
7622
7623impl fidl::endpoints::Proxy for StorageIteratorProxy {
7624    type Protocol = StorageIteratorMarker;
7625
7626    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7627        Self::new(inner)
7628    }
7629
7630    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7631        self.client.into_channel().map_err(|client| Self { client })
7632    }
7633
7634    fn as_channel(&self) -> &::fidl::AsyncChannel {
7635        self.client.as_channel()
7636    }
7637}
7638
7639impl StorageIteratorProxy {
7640    /// Create a new Proxy for fuchsia.component/StorageIterator.
7641    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7642        let protocol_name = <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7643        Self { client: fidl::client::Client::new(channel, protocol_name) }
7644    }
7645
7646    /// Get a Stream of events from the remote end of the protocol.
7647    ///
7648    /// # Panics
7649    ///
7650    /// Panics if the event stream was already taken.
7651    pub fn take_event_stream(&self) -> StorageIteratorEventStream {
7652        StorageIteratorEventStream { event_receiver: self.client.take_event_receiver() }
7653    }
7654
7655    /// Retrieve the next set of components using the storage capability. The
7656    /// returned monikers are relative to the component that declares the
7657    /// storage capability. Returns an empty vector after all components have
7658    /// been returned.
7659    pub fn r#next(
7660        &self,
7661    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
7662    {
7663        StorageIteratorProxyInterface::r#next(self)
7664    }
7665}
7666
7667impl StorageIteratorProxyInterface for StorageIteratorProxy {
7668    type NextResponseFut =
7669        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
7670    fn r#next(&self) -> Self::NextResponseFut {
7671        fn _decode(
7672            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7673        ) -> Result<Vec<String>, fidl::Error> {
7674            let _response = fidl::client::decode_transaction_body::<
7675                StorageIteratorNextResponse,
7676                fidl::encoding::DefaultFuchsiaResourceDialect,
7677                0x7a6b21f15fd01b72,
7678            >(_buf?)?;
7679            Ok(_response.relative_monikers)
7680        }
7681        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
7682            (),
7683            0x7a6b21f15fd01b72,
7684            fidl::encoding::DynamicFlags::empty(),
7685            _decode,
7686        )
7687    }
7688}
7689
7690pub struct StorageIteratorEventStream {
7691    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7692}
7693
7694impl std::marker::Unpin for StorageIteratorEventStream {}
7695
7696impl futures::stream::FusedStream for StorageIteratorEventStream {
7697    fn is_terminated(&self) -> bool {
7698        self.event_receiver.is_terminated()
7699    }
7700}
7701
7702impl futures::Stream for StorageIteratorEventStream {
7703    type Item = Result<StorageIteratorEvent, fidl::Error>;
7704
7705    fn poll_next(
7706        mut self: std::pin::Pin<&mut Self>,
7707        cx: &mut std::task::Context<'_>,
7708    ) -> std::task::Poll<Option<Self::Item>> {
7709        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7710            &mut self.event_receiver,
7711            cx
7712        )?) {
7713            Some(buf) => std::task::Poll::Ready(Some(StorageIteratorEvent::decode(buf))),
7714            None => std::task::Poll::Ready(None),
7715        }
7716    }
7717}
7718
7719#[derive(Debug)]
7720pub enum StorageIteratorEvent {}
7721
7722impl StorageIteratorEvent {
7723    /// Decodes a message buffer as a [`StorageIteratorEvent`].
7724    fn decode(
7725        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7726    ) -> Result<StorageIteratorEvent, fidl::Error> {
7727        let (bytes, _handles) = buf.split_mut();
7728        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7729        debug_assert_eq!(tx_header.tx_id, 0);
7730        match tx_header.ordinal {
7731            _ => Err(fidl::Error::UnknownOrdinal {
7732                ordinal: tx_header.ordinal,
7733                protocol_name:
7734                    <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7735            }),
7736        }
7737    }
7738}
7739
7740/// A Stream of incoming requests for fuchsia.component/StorageIterator.
7741pub struct StorageIteratorRequestStream {
7742    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7743    is_terminated: bool,
7744}
7745
7746impl std::marker::Unpin for StorageIteratorRequestStream {}
7747
7748impl futures::stream::FusedStream for StorageIteratorRequestStream {
7749    fn is_terminated(&self) -> bool {
7750        self.is_terminated
7751    }
7752}
7753
7754impl fidl::endpoints::RequestStream for StorageIteratorRequestStream {
7755    type Protocol = StorageIteratorMarker;
7756    type ControlHandle = StorageIteratorControlHandle;
7757
7758    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7759        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7760    }
7761
7762    fn control_handle(&self) -> Self::ControlHandle {
7763        StorageIteratorControlHandle { inner: self.inner.clone() }
7764    }
7765
7766    fn into_inner(
7767        self,
7768    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7769    {
7770        (self.inner, self.is_terminated)
7771    }
7772
7773    fn from_inner(
7774        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7775        is_terminated: bool,
7776    ) -> Self {
7777        Self { inner, is_terminated }
7778    }
7779}
7780
7781impl futures::Stream for StorageIteratorRequestStream {
7782    type Item = Result<StorageIteratorRequest, fidl::Error>;
7783
7784    fn poll_next(
7785        mut self: std::pin::Pin<&mut Self>,
7786        cx: &mut std::task::Context<'_>,
7787    ) -> std::task::Poll<Option<Self::Item>> {
7788        let this = &mut *self;
7789        if this.inner.check_shutdown(cx) {
7790            this.is_terminated = true;
7791            return std::task::Poll::Ready(None);
7792        }
7793        if this.is_terminated {
7794            panic!("polled StorageIteratorRequestStream after completion");
7795        }
7796        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7797            |bytes, handles| {
7798                match this.inner.channel().read_etc(cx, bytes, handles) {
7799                    std::task::Poll::Ready(Ok(())) => {}
7800                    std::task::Poll::Pending => return std::task::Poll::Pending,
7801                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7802                        this.is_terminated = true;
7803                        return std::task::Poll::Ready(None);
7804                    }
7805                    std::task::Poll::Ready(Err(e)) => {
7806                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7807                            e.into(),
7808                        ))));
7809                    }
7810                }
7811
7812                // A message has been received from the channel
7813                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7814
7815                std::task::Poll::Ready(Some(match header.ordinal {
7816                    0x7a6b21f15fd01b72 => {
7817                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7818                        let mut req = fidl::new_empty!(
7819                            fidl::encoding::EmptyPayload,
7820                            fidl::encoding::DefaultFuchsiaResourceDialect
7821                        );
7822                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7823                        let control_handle =
7824                            StorageIteratorControlHandle { inner: this.inner.clone() };
7825                        Ok(StorageIteratorRequest::Next {
7826                            responder: StorageIteratorNextResponder {
7827                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7828                                tx_id: header.tx_id,
7829                            },
7830                        })
7831                    }
7832                    _ => Err(fidl::Error::UnknownOrdinal {
7833                        ordinal: header.ordinal,
7834                        protocol_name:
7835                            <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7836                    }),
7837                }))
7838            },
7839        )
7840    }
7841}
7842
7843/// An iterator protocol for returning a set of components using a storage
7844/// capability. See |StorageAdmin.ListStorageInRealm| for more information.
7845#[derive(Debug)]
7846pub enum StorageIteratorRequest {
7847    /// Retrieve the next set of components using the storage capability. The
7848    /// returned monikers are relative to the component that declares the
7849    /// storage capability. Returns an empty vector after all components have
7850    /// been returned.
7851    Next { responder: StorageIteratorNextResponder },
7852}
7853
7854impl StorageIteratorRequest {
7855    #[allow(irrefutable_let_patterns)]
7856    pub fn into_next(self) -> Option<(StorageIteratorNextResponder)> {
7857        if let StorageIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
7858    }
7859
7860    /// Name of the method defined in FIDL
7861    pub fn method_name(&self) -> &'static str {
7862        match *self {
7863            StorageIteratorRequest::Next { .. } => "next",
7864        }
7865    }
7866}
7867
7868#[derive(Debug, Clone)]
7869pub struct StorageIteratorControlHandle {
7870    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7871}
7872
7873impl fidl::endpoints::ControlHandle for StorageIteratorControlHandle {
7874    fn shutdown(&self) {
7875        self.inner.shutdown()
7876    }
7877
7878    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7879        self.inner.shutdown_with_epitaph(status)
7880    }
7881
7882    fn is_closed(&self) -> bool {
7883        self.inner.channel().is_closed()
7884    }
7885    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7886        self.inner.channel().on_closed()
7887    }
7888
7889    #[cfg(target_os = "fuchsia")]
7890    fn signal_peer(
7891        &self,
7892        clear_mask: zx::Signals,
7893        set_mask: zx::Signals,
7894    ) -> Result<(), zx_status::Status> {
7895        use fidl::Peered;
7896        self.inner.channel().signal_peer(clear_mask, set_mask)
7897    }
7898}
7899
7900impl StorageIteratorControlHandle {}
7901
7902#[must_use = "FIDL methods require a response to be sent"]
7903#[derive(Debug)]
7904pub struct StorageIteratorNextResponder {
7905    control_handle: std::mem::ManuallyDrop<StorageIteratorControlHandle>,
7906    tx_id: u32,
7907}
7908
7909/// Set the the channel to be shutdown (see [`StorageIteratorControlHandle::shutdown`])
7910/// if the responder is dropped without sending a response, so that the client
7911/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7912impl std::ops::Drop for StorageIteratorNextResponder {
7913    fn drop(&mut self) {
7914        self.control_handle.shutdown();
7915        // Safety: drops once, never accessed again
7916        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7917    }
7918}
7919
7920impl fidl::endpoints::Responder for StorageIteratorNextResponder {
7921    type ControlHandle = StorageIteratorControlHandle;
7922
7923    fn control_handle(&self) -> &StorageIteratorControlHandle {
7924        &self.control_handle
7925    }
7926
7927    fn drop_without_shutdown(mut self) {
7928        // Safety: drops once, never accessed again due to mem::forget
7929        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7930        // Prevent Drop from running (which would shut down the channel)
7931        std::mem::forget(self);
7932    }
7933}
7934
7935impl StorageIteratorNextResponder {
7936    /// Sends a response to the FIDL transaction.
7937    ///
7938    /// Sets the channel to shutdown if an error occurs.
7939    pub fn send(self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
7940        let _result = self.send_raw(relative_monikers);
7941        if _result.is_err() {
7942            self.control_handle.shutdown();
7943        }
7944        self.drop_without_shutdown();
7945        _result
7946    }
7947
7948    /// Similar to "send" but does not shutdown the channel if an error occurs.
7949    pub fn send_no_shutdown_on_err(
7950        self,
7951        mut relative_monikers: &[String],
7952    ) -> Result<(), fidl::Error> {
7953        let _result = self.send_raw(relative_monikers);
7954        self.drop_without_shutdown();
7955        _result
7956    }
7957
7958    fn send_raw(&self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
7959        self.control_handle.inner.send::<StorageIteratorNextResponse>(
7960            (relative_monikers,),
7961            self.tx_id,
7962            0x7a6b21f15fd01b72,
7963            fidl::encoding::DynamicFlags::empty(),
7964        )
7965    }
7966}
7967
7968mod internal {
7969    use super::*;
7970
7971    impl fidl::encoding::ResourceTypeMarker for ControllerOpenExposedDirRequest {
7972        type Borrowed<'a> = &'a mut Self;
7973        fn take_or_borrow<'a>(
7974            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7975        ) -> Self::Borrowed<'a> {
7976            value
7977        }
7978    }
7979
7980    unsafe impl fidl::encoding::TypeMarker for ControllerOpenExposedDirRequest {
7981        type Owned = Self;
7982
7983        #[inline(always)]
7984        fn inline_align(_context: fidl::encoding::Context) -> usize {
7985            4
7986        }
7987
7988        #[inline(always)]
7989        fn inline_size(_context: fidl::encoding::Context) -> usize {
7990            4
7991        }
7992    }
7993
7994    unsafe impl
7995        fidl::encoding::Encode<
7996            ControllerOpenExposedDirRequest,
7997            fidl::encoding::DefaultFuchsiaResourceDialect,
7998        > for &mut ControllerOpenExposedDirRequest
7999    {
8000        #[inline]
8001        unsafe fn encode(
8002            self,
8003            encoder: &mut fidl::encoding::Encoder<
8004                '_,
8005                fidl::encoding::DefaultFuchsiaResourceDialect,
8006            >,
8007            offset: usize,
8008            _depth: fidl::encoding::Depth,
8009        ) -> fidl::Result<()> {
8010            encoder.debug_check_bounds::<ControllerOpenExposedDirRequest>(offset);
8011            // Delegate to tuple encoding.
8012            fidl::encoding::Encode::<
8013                ControllerOpenExposedDirRequest,
8014                fidl::encoding::DefaultFuchsiaResourceDialect,
8015            >::encode(
8016                (<fidl::encoding::Endpoint<
8017                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8018                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8019                    &mut self.exposed_dir
8020                ),),
8021                encoder,
8022                offset,
8023                _depth,
8024            )
8025        }
8026    }
8027    unsafe impl<
8028        T0: fidl::encoding::Encode<
8029                fidl::encoding::Endpoint<
8030                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8031                >,
8032                fidl::encoding::DefaultFuchsiaResourceDialect,
8033            >,
8034    >
8035        fidl::encoding::Encode<
8036            ControllerOpenExposedDirRequest,
8037            fidl::encoding::DefaultFuchsiaResourceDialect,
8038        > for (T0,)
8039    {
8040        #[inline]
8041        unsafe fn encode(
8042            self,
8043            encoder: &mut fidl::encoding::Encoder<
8044                '_,
8045                fidl::encoding::DefaultFuchsiaResourceDialect,
8046            >,
8047            offset: usize,
8048            depth: fidl::encoding::Depth,
8049        ) -> fidl::Result<()> {
8050            encoder.debug_check_bounds::<ControllerOpenExposedDirRequest>(offset);
8051            // Zero out padding regions. There's no need to apply masks
8052            // because the unmasked parts will be overwritten by fields.
8053            // Write the fields.
8054            self.0.encode(encoder, offset + 0, depth)?;
8055            Ok(())
8056        }
8057    }
8058
8059    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8060        for ControllerOpenExposedDirRequest
8061    {
8062        #[inline(always)]
8063        fn new_empty() -> Self {
8064            Self {
8065                exposed_dir: fidl::new_empty!(
8066                    fidl::encoding::Endpoint<
8067                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8068                    >,
8069                    fidl::encoding::DefaultFuchsiaResourceDialect
8070                ),
8071            }
8072        }
8073
8074        #[inline]
8075        unsafe fn decode(
8076            &mut self,
8077            decoder: &mut fidl::encoding::Decoder<
8078                '_,
8079                fidl::encoding::DefaultFuchsiaResourceDialect,
8080            >,
8081            offset: usize,
8082            _depth: fidl::encoding::Depth,
8083        ) -> fidl::Result<()> {
8084            decoder.debug_check_bounds::<Self>(offset);
8085            // Verify that padding bytes are zero.
8086            fidl::decode!(
8087                fidl::encoding::Endpoint<
8088                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8089                >,
8090                fidl::encoding::DefaultFuchsiaResourceDialect,
8091                &mut self.exposed_dir,
8092                decoder,
8093                offset + 0,
8094                _depth
8095            )?;
8096            Ok(())
8097        }
8098    }
8099
8100    impl fidl::encoding::ResourceTypeMarker for ControllerStartRequest {
8101        type Borrowed<'a> = &'a mut Self;
8102        fn take_or_borrow<'a>(
8103            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8104        ) -> Self::Borrowed<'a> {
8105            value
8106        }
8107    }
8108
8109    unsafe impl fidl::encoding::TypeMarker for ControllerStartRequest {
8110        type Owned = Self;
8111
8112        #[inline(always)]
8113        fn inline_align(_context: fidl::encoding::Context) -> usize {
8114            8
8115        }
8116
8117        #[inline(always)]
8118        fn inline_size(_context: fidl::encoding::Context) -> usize {
8119            24
8120        }
8121    }
8122
8123    unsafe impl
8124        fidl::encoding::Encode<
8125            ControllerStartRequest,
8126            fidl::encoding::DefaultFuchsiaResourceDialect,
8127        > for &mut ControllerStartRequest
8128    {
8129        #[inline]
8130        unsafe fn encode(
8131            self,
8132            encoder: &mut fidl::encoding::Encoder<
8133                '_,
8134                fidl::encoding::DefaultFuchsiaResourceDialect,
8135            >,
8136            offset: usize,
8137            _depth: fidl::encoding::Depth,
8138        ) -> fidl::Result<()> {
8139            encoder.debug_check_bounds::<ControllerStartRequest>(offset);
8140            // Delegate to tuple encoding.
8141            fidl::encoding::Encode::<ControllerStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8142                (
8143                    <StartChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
8144                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.execution_controller),
8145                ),
8146                encoder, offset, _depth
8147            )
8148        }
8149    }
8150    unsafe impl<
8151        T0: fidl::encoding::Encode<StartChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
8152        T1: fidl::encoding::Encode<
8153                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
8154                fidl::encoding::DefaultFuchsiaResourceDialect,
8155            >,
8156    >
8157        fidl::encoding::Encode<
8158            ControllerStartRequest,
8159            fidl::encoding::DefaultFuchsiaResourceDialect,
8160        > for (T0, T1)
8161    {
8162        #[inline]
8163        unsafe fn encode(
8164            self,
8165            encoder: &mut fidl::encoding::Encoder<
8166                '_,
8167                fidl::encoding::DefaultFuchsiaResourceDialect,
8168            >,
8169            offset: usize,
8170            depth: fidl::encoding::Depth,
8171        ) -> fidl::Result<()> {
8172            encoder.debug_check_bounds::<ControllerStartRequest>(offset);
8173            // Zero out padding regions. There's no need to apply masks
8174            // because the unmasked parts will be overwritten by fields.
8175            unsafe {
8176                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8177                (ptr as *mut u64).write_unaligned(0);
8178            }
8179            // Write the fields.
8180            self.0.encode(encoder, offset + 0, depth)?;
8181            self.1.encode(encoder, offset + 16, depth)?;
8182            Ok(())
8183        }
8184    }
8185
8186    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8187        for ControllerStartRequest
8188    {
8189        #[inline(always)]
8190        fn new_empty() -> Self {
8191            Self {
8192                args: fidl::new_empty!(
8193                    StartChildArgs,
8194                    fidl::encoding::DefaultFuchsiaResourceDialect
8195                ),
8196                execution_controller: fidl::new_empty!(
8197                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
8198                    fidl::encoding::DefaultFuchsiaResourceDialect
8199                ),
8200            }
8201        }
8202
8203        #[inline]
8204        unsafe fn decode(
8205            &mut self,
8206            decoder: &mut fidl::encoding::Decoder<
8207                '_,
8208                fidl::encoding::DefaultFuchsiaResourceDialect,
8209            >,
8210            offset: usize,
8211            _depth: fidl::encoding::Depth,
8212        ) -> fidl::Result<()> {
8213            decoder.debug_check_bounds::<Self>(offset);
8214            // Verify that padding bytes are zero.
8215            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8216            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8217            let mask = 0xffffffff00000000u64;
8218            let maskedval = padval & mask;
8219            if maskedval != 0 {
8220                return Err(fidl::Error::NonZeroPadding {
8221                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8222                });
8223            }
8224            fidl::decode!(
8225                StartChildArgs,
8226                fidl::encoding::DefaultFuchsiaResourceDialect,
8227                &mut self.args,
8228                decoder,
8229                offset + 0,
8230                _depth
8231            )?;
8232            fidl::decode!(
8233                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
8234                fidl::encoding::DefaultFuchsiaResourceDialect,
8235                &mut self.execution_controller,
8236                decoder,
8237                offset + 16,
8238                _depth
8239            )?;
8240            Ok(())
8241        }
8242    }
8243
8244    impl fidl::encoding::ResourceTypeMarker for ControllerGetExposedDictionaryResponse {
8245        type Borrowed<'a> = &'a mut Self;
8246        fn take_or_borrow<'a>(
8247            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8248        ) -> Self::Borrowed<'a> {
8249            value
8250        }
8251    }
8252
8253    unsafe impl fidl::encoding::TypeMarker for ControllerGetExposedDictionaryResponse {
8254        type Owned = Self;
8255
8256        #[inline(always)]
8257        fn inline_align(_context: fidl::encoding::Context) -> usize {
8258            4
8259        }
8260
8261        #[inline(always)]
8262        fn inline_size(_context: fidl::encoding::Context) -> usize {
8263            4
8264        }
8265    }
8266
8267    unsafe impl
8268        fidl::encoding::Encode<
8269            ControllerGetExposedDictionaryResponse,
8270            fidl::encoding::DefaultFuchsiaResourceDialect,
8271        > for &mut ControllerGetExposedDictionaryResponse
8272    {
8273        #[inline]
8274        unsafe fn encode(
8275            self,
8276            encoder: &mut fidl::encoding::Encoder<
8277                '_,
8278                fidl::encoding::DefaultFuchsiaResourceDialect,
8279            >,
8280            offset: usize,
8281            _depth: fidl::encoding::Depth,
8282        ) -> fidl::Result<()> {
8283            encoder.debug_check_bounds::<ControllerGetExposedDictionaryResponse>(offset);
8284            // Delegate to tuple encoding.
8285            fidl::encoding::Encode::<ControllerGetExposedDictionaryResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8286                (
8287                    <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
8288                ),
8289                encoder, offset, _depth
8290            )
8291        }
8292    }
8293    unsafe impl<
8294        T0: fidl::encoding::Encode<
8295                fidl_fuchsia_component_sandbox::DictionaryRef,
8296                fidl::encoding::DefaultFuchsiaResourceDialect,
8297            >,
8298    >
8299        fidl::encoding::Encode<
8300            ControllerGetExposedDictionaryResponse,
8301            fidl::encoding::DefaultFuchsiaResourceDialect,
8302        > for (T0,)
8303    {
8304        #[inline]
8305        unsafe fn encode(
8306            self,
8307            encoder: &mut fidl::encoding::Encoder<
8308                '_,
8309                fidl::encoding::DefaultFuchsiaResourceDialect,
8310            >,
8311            offset: usize,
8312            depth: fidl::encoding::Depth,
8313        ) -> fidl::Result<()> {
8314            encoder.debug_check_bounds::<ControllerGetExposedDictionaryResponse>(offset);
8315            // Zero out padding regions. There's no need to apply masks
8316            // because the unmasked parts will be overwritten by fields.
8317            // Write the fields.
8318            self.0.encode(encoder, offset + 0, depth)?;
8319            Ok(())
8320        }
8321    }
8322
8323    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8324        for ControllerGetExposedDictionaryResponse
8325    {
8326        #[inline(always)]
8327        fn new_empty() -> Self {
8328            Self {
8329                dictionary: fidl::new_empty!(
8330                    fidl_fuchsia_component_sandbox::DictionaryRef,
8331                    fidl::encoding::DefaultFuchsiaResourceDialect
8332                ),
8333            }
8334        }
8335
8336        #[inline]
8337        unsafe fn decode(
8338            &mut self,
8339            decoder: &mut fidl::encoding::Decoder<
8340                '_,
8341                fidl::encoding::DefaultFuchsiaResourceDialect,
8342            >,
8343            offset: usize,
8344            _depth: fidl::encoding::Depth,
8345        ) -> fidl::Result<()> {
8346            decoder.debug_check_bounds::<Self>(offset);
8347            // Verify that padding bytes are zero.
8348            fidl::decode!(
8349                fidl_fuchsia_component_sandbox::DictionaryRef,
8350                fidl::encoding::DefaultFuchsiaResourceDialect,
8351                &mut self.dictionary,
8352                decoder,
8353                offset + 0,
8354                _depth
8355            )?;
8356            Ok(())
8357        }
8358    }
8359
8360    impl fidl::encoding::ResourceTypeMarker for ControllerIsStartedResponse {
8361        type Borrowed<'a> = &'a mut Self;
8362        fn take_or_borrow<'a>(
8363            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8364        ) -> Self::Borrowed<'a> {
8365            value
8366        }
8367    }
8368
8369    unsafe impl fidl::encoding::TypeMarker for ControllerIsStartedResponse {
8370        type Owned = Self;
8371
8372        #[inline(always)]
8373        fn inline_align(_context: fidl::encoding::Context) -> usize {
8374            1
8375        }
8376
8377        #[inline(always)]
8378        fn inline_size(_context: fidl::encoding::Context) -> usize {
8379            1
8380        }
8381    }
8382
8383    unsafe impl
8384        fidl::encoding::Encode<
8385            ControllerIsStartedResponse,
8386            fidl::encoding::DefaultFuchsiaResourceDialect,
8387        > for &mut ControllerIsStartedResponse
8388    {
8389        #[inline]
8390        unsafe fn encode(
8391            self,
8392            encoder: &mut fidl::encoding::Encoder<
8393                '_,
8394                fidl::encoding::DefaultFuchsiaResourceDialect,
8395            >,
8396            offset: usize,
8397            _depth: fidl::encoding::Depth,
8398        ) -> fidl::Result<()> {
8399            encoder.debug_check_bounds::<ControllerIsStartedResponse>(offset);
8400            // Delegate to tuple encoding.
8401            fidl::encoding::Encode::<
8402                ControllerIsStartedResponse,
8403                fidl::encoding::DefaultFuchsiaResourceDialect,
8404            >::encode(
8405                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_started),),
8406                encoder,
8407                offset,
8408                _depth,
8409            )
8410        }
8411    }
8412    unsafe impl<T0: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>>
8413        fidl::encoding::Encode<
8414            ControllerIsStartedResponse,
8415            fidl::encoding::DefaultFuchsiaResourceDialect,
8416        > for (T0,)
8417    {
8418        #[inline]
8419        unsafe fn encode(
8420            self,
8421            encoder: &mut fidl::encoding::Encoder<
8422                '_,
8423                fidl::encoding::DefaultFuchsiaResourceDialect,
8424            >,
8425            offset: usize,
8426            depth: fidl::encoding::Depth,
8427        ) -> fidl::Result<()> {
8428            encoder.debug_check_bounds::<ControllerIsStartedResponse>(offset);
8429            // Zero out padding regions. There's no need to apply masks
8430            // because the unmasked parts will be overwritten by fields.
8431            // Write the fields.
8432            self.0.encode(encoder, offset + 0, depth)?;
8433            Ok(())
8434        }
8435    }
8436
8437    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8438        for ControllerIsStartedResponse
8439    {
8440        #[inline(always)]
8441        fn new_empty() -> Self {
8442            Self {
8443                is_started: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
8444            }
8445        }
8446
8447        #[inline]
8448        unsafe fn decode(
8449            &mut self,
8450            decoder: &mut fidl::encoding::Decoder<
8451                '_,
8452                fidl::encoding::DefaultFuchsiaResourceDialect,
8453            >,
8454            offset: usize,
8455            _depth: fidl::encoding::Depth,
8456        ) -> fidl::Result<()> {
8457            decoder.debug_check_bounds::<Self>(offset);
8458            // Verify that padding bytes are zero.
8459            fidl::decode!(
8460                bool,
8461                fidl::encoding::DefaultFuchsiaResourceDialect,
8462                &mut self.is_started,
8463                decoder,
8464                offset + 0,
8465                _depth
8466            )?;
8467            Ok(())
8468        }
8469    }
8470
8471    impl fidl::encoding::ResourceTypeMarker for EventStreamGetNextResponse {
8472        type Borrowed<'a> = &'a mut Self;
8473        fn take_or_borrow<'a>(
8474            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8475        ) -> Self::Borrowed<'a> {
8476            value
8477        }
8478    }
8479
8480    unsafe impl fidl::encoding::TypeMarker for EventStreamGetNextResponse {
8481        type Owned = Self;
8482
8483        #[inline(always)]
8484        fn inline_align(_context: fidl::encoding::Context) -> usize {
8485            8
8486        }
8487
8488        #[inline(always)]
8489        fn inline_size(_context: fidl::encoding::Context) -> usize {
8490            16
8491        }
8492    }
8493
8494    unsafe impl
8495        fidl::encoding::Encode<
8496            EventStreamGetNextResponse,
8497            fidl::encoding::DefaultFuchsiaResourceDialect,
8498        > for &mut EventStreamGetNextResponse
8499    {
8500        #[inline]
8501        unsafe fn encode(
8502            self,
8503            encoder: &mut fidl::encoding::Encoder<
8504                '_,
8505                fidl::encoding::DefaultFuchsiaResourceDialect,
8506            >,
8507            offset: usize,
8508            _depth: fidl::encoding::Depth,
8509        ) -> fidl::Result<()> {
8510            encoder.debug_check_bounds::<EventStreamGetNextResponse>(offset);
8511            // Delegate to tuple encoding.
8512            fidl::encoding::Encode::<EventStreamGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8513                (
8514                    <fidl::encoding::UnboundedVector<Event> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.events),
8515                ),
8516                encoder, offset, _depth
8517            )
8518        }
8519    }
8520    unsafe impl<
8521        T0: fidl::encoding::Encode<
8522                fidl::encoding::UnboundedVector<Event>,
8523                fidl::encoding::DefaultFuchsiaResourceDialect,
8524            >,
8525    >
8526        fidl::encoding::Encode<
8527            EventStreamGetNextResponse,
8528            fidl::encoding::DefaultFuchsiaResourceDialect,
8529        > for (T0,)
8530    {
8531        #[inline]
8532        unsafe fn encode(
8533            self,
8534            encoder: &mut fidl::encoding::Encoder<
8535                '_,
8536                fidl::encoding::DefaultFuchsiaResourceDialect,
8537            >,
8538            offset: usize,
8539            depth: fidl::encoding::Depth,
8540        ) -> fidl::Result<()> {
8541            encoder.debug_check_bounds::<EventStreamGetNextResponse>(offset);
8542            // Zero out padding regions. There's no need to apply masks
8543            // because the unmasked parts will be overwritten by fields.
8544            // Write the fields.
8545            self.0.encode(encoder, offset + 0, depth)?;
8546            Ok(())
8547        }
8548    }
8549
8550    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8551        for EventStreamGetNextResponse
8552    {
8553        #[inline(always)]
8554        fn new_empty() -> Self {
8555            Self {
8556                events: fidl::new_empty!(
8557                    fidl::encoding::UnboundedVector<Event>,
8558                    fidl::encoding::DefaultFuchsiaResourceDialect
8559                ),
8560            }
8561        }
8562
8563        #[inline]
8564        unsafe fn decode(
8565            &mut self,
8566            decoder: &mut fidl::encoding::Decoder<
8567                '_,
8568                fidl::encoding::DefaultFuchsiaResourceDialect,
8569            >,
8570            offset: usize,
8571            _depth: fidl::encoding::Depth,
8572        ) -> fidl::Result<()> {
8573            decoder.debug_check_bounds::<Self>(offset);
8574            // Verify that padding bytes are zero.
8575            fidl::decode!(
8576                fidl::encoding::UnboundedVector<Event>,
8577                fidl::encoding::DefaultFuchsiaResourceDialect,
8578                &mut self.events,
8579                decoder,
8580                offset + 0,
8581                _depth
8582            )?;
8583            Ok(())
8584        }
8585    }
8586
8587    impl fidl::encoding::ResourceTypeMarker for IntrospectorGetMonikerRequest {
8588        type Borrowed<'a> = &'a mut Self;
8589        fn take_or_borrow<'a>(
8590            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8591        ) -> Self::Borrowed<'a> {
8592            value
8593        }
8594    }
8595
8596    unsafe impl fidl::encoding::TypeMarker for IntrospectorGetMonikerRequest {
8597        type Owned = Self;
8598
8599        #[inline(always)]
8600        fn inline_align(_context: fidl::encoding::Context) -> usize {
8601            4
8602        }
8603
8604        #[inline(always)]
8605        fn inline_size(_context: fidl::encoding::Context) -> usize {
8606            4
8607        }
8608    }
8609
8610    unsafe impl
8611        fidl::encoding::Encode<
8612            IntrospectorGetMonikerRequest,
8613            fidl::encoding::DefaultFuchsiaResourceDialect,
8614        > for &mut IntrospectorGetMonikerRequest
8615    {
8616        #[inline]
8617        unsafe fn encode(
8618            self,
8619            encoder: &mut fidl::encoding::Encoder<
8620                '_,
8621                fidl::encoding::DefaultFuchsiaResourceDialect,
8622            >,
8623            offset: usize,
8624            _depth: fidl::encoding::Depth,
8625        ) -> fidl::Result<()> {
8626            encoder.debug_check_bounds::<IntrospectorGetMonikerRequest>(offset);
8627            // Delegate to tuple encoding.
8628            fidl::encoding::Encode::<
8629                IntrospectorGetMonikerRequest,
8630                fidl::encoding::DefaultFuchsiaResourceDialect,
8631            >::encode(
8632                (<fidl::encoding::HandleType<
8633                    fidl::Event,
8634                    { fidl::ObjectType::EVENT.into_raw() },
8635                    2147483648,
8636                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8637                    &mut self.component_instance,
8638                ),),
8639                encoder,
8640                offset,
8641                _depth,
8642            )
8643        }
8644    }
8645    unsafe impl<
8646        T0: fidl::encoding::Encode<
8647                fidl::encoding::HandleType<
8648                    fidl::Event,
8649                    { fidl::ObjectType::EVENT.into_raw() },
8650                    2147483648,
8651                >,
8652                fidl::encoding::DefaultFuchsiaResourceDialect,
8653            >,
8654    >
8655        fidl::encoding::Encode<
8656            IntrospectorGetMonikerRequest,
8657            fidl::encoding::DefaultFuchsiaResourceDialect,
8658        > for (T0,)
8659    {
8660        #[inline]
8661        unsafe fn encode(
8662            self,
8663            encoder: &mut fidl::encoding::Encoder<
8664                '_,
8665                fidl::encoding::DefaultFuchsiaResourceDialect,
8666            >,
8667            offset: usize,
8668            depth: fidl::encoding::Depth,
8669        ) -> fidl::Result<()> {
8670            encoder.debug_check_bounds::<IntrospectorGetMonikerRequest>(offset);
8671            // Zero out padding regions. There's no need to apply masks
8672            // because the unmasked parts will be overwritten by fields.
8673            // Write the fields.
8674            self.0.encode(encoder, offset + 0, depth)?;
8675            Ok(())
8676        }
8677    }
8678
8679    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8680        for IntrospectorGetMonikerRequest
8681    {
8682        #[inline(always)]
8683        fn new_empty() -> Self {
8684            Self {
8685                component_instance: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8686            }
8687        }
8688
8689        #[inline]
8690        unsafe fn decode(
8691            &mut self,
8692            decoder: &mut fidl::encoding::Decoder<
8693                '_,
8694                fidl::encoding::DefaultFuchsiaResourceDialect,
8695            >,
8696            offset: usize,
8697            _depth: fidl::encoding::Depth,
8698        ) -> fidl::Result<()> {
8699            decoder.debug_check_bounds::<Self>(offset);
8700            // Verify that padding bytes are zero.
8701            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.component_instance, decoder, offset + 0, _depth)?;
8702            Ok(())
8703        }
8704    }
8705
8706    impl fidl::encoding::ResourceTypeMarker for NamespaceCreateRequest {
8707        type Borrowed<'a> = &'a mut Self;
8708        fn take_or_borrow<'a>(
8709            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8710        ) -> Self::Borrowed<'a> {
8711            value
8712        }
8713    }
8714
8715    unsafe impl fidl::encoding::TypeMarker for NamespaceCreateRequest {
8716        type Owned = Self;
8717
8718        #[inline(always)]
8719        fn inline_align(_context: fidl::encoding::Context) -> usize {
8720            8
8721        }
8722
8723        #[inline(always)]
8724        fn inline_size(_context: fidl::encoding::Context) -> usize {
8725            16
8726        }
8727    }
8728
8729    unsafe impl
8730        fidl::encoding::Encode<
8731            NamespaceCreateRequest,
8732            fidl::encoding::DefaultFuchsiaResourceDialect,
8733        > for &mut NamespaceCreateRequest
8734    {
8735        #[inline]
8736        unsafe fn encode(
8737            self,
8738            encoder: &mut fidl::encoding::Encoder<
8739                '_,
8740                fidl::encoding::DefaultFuchsiaResourceDialect,
8741            >,
8742            offset: usize,
8743            _depth: fidl::encoding::Depth,
8744        ) -> fidl::Result<()> {
8745            encoder.debug_check_bounds::<NamespaceCreateRequest>(offset);
8746            // Delegate to tuple encoding.
8747            fidl::encoding::Encode::<NamespaceCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8748                (
8749                    <fidl::encoding::UnboundedVector<NamespaceInputEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
8750                ),
8751                encoder, offset, _depth
8752            )
8753        }
8754    }
8755    unsafe impl<
8756        T0: fidl::encoding::Encode<
8757                fidl::encoding::UnboundedVector<NamespaceInputEntry>,
8758                fidl::encoding::DefaultFuchsiaResourceDialect,
8759            >,
8760    >
8761        fidl::encoding::Encode<
8762            NamespaceCreateRequest,
8763            fidl::encoding::DefaultFuchsiaResourceDialect,
8764        > for (T0,)
8765    {
8766        #[inline]
8767        unsafe fn encode(
8768            self,
8769            encoder: &mut fidl::encoding::Encoder<
8770                '_,
8771                fidl::encoding::DefaultFuchsiaResourceDialect,
8772            >,
8773            offset: usize,
8774            depth: fidl::encoding::Depth,
8775        ) -> fidl::Result<()> {
8776            encoder.debug_check_bounds::<NamespaceCreateRequest>(offset);
8777            // Zero out padding regions. There's no need to apply masks
8778            // because the unmasked parts will be overwritten by fields.
8779            // Write the fields.
8780            self.0.encode(encoder, offset + 0, depth)?;
8781            Ok(())
8782        }
8783    }
8784
8785    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8786        for NamespaceCreateRequest
8787    {
8788        #[inline(always)]
8789        fn new_empty() -> Self {
8790            Self {
8791                entries: fidl::new_empty!(
8792                    fidl::encoding::UnboundedVector<NamespaceInputEntry>,
8793                    fidl::encoding::DefaultFuchsiaResourceDialect
8794                ),
8795            }
8796        }
8797
8798        #[inline]
8799        unsafe fn decode(
8800            &mut self,
8801            decoder: &mut fidl::encoding::Decoder<
8802                '_,
8803                fidl::encoding::DefaultFuchsiaResourceDialect,
8804            >,
8805            offset: usize,
8806            _depth: fidl::encoding::Depth,
8807        ) -> fidl::Result<()> {
8808            decoder.debug_check_bounds::<Self>(offset);
8809            // Verify that padding bytes are zero.
8810            fidl::decode!(
8811                fidl::encoding::UnboundedVector<NamespaceInputEntry>,
8812                fidl::encoding::DefaultFuchsiaResourceDialect,
8813                &mut self.entries,
8814                decoder,
8815                offset + 0,
8816                _depth
8817            )?;
8818            Ok(())
8819        }
8820    }
8821
8822    impl fidl::encoding::ResourceTypeMarker for NamespaceInputEntry {
8823        type Borrowed<'a> = &'a mut Self;
8824        fn take_or_borrow<'a>(
8825            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8826        ) -> Self::Borrowed<'a> {
8827            value
8828        }
8829    }
8830
8831    unsafe impl fidl::encoding::TypeMarker for NamespaceInputEntry {
8832        type Owned = Self;
8833
8834        #[inline(always)]
8835        fn inline_align(_context: fidl::encoding::Context) -> usize {
8836            8
8837        }
8838
8839        #[inline(always)]
8840        fn inline_size(_context: fidl::encoding::Context) -> usize {
8841            24
8842        }
8843    }
8844
8845    unsafe impl
8846        fidl::encoding::Encode<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
8847        for &mut NamespaceInputEntry
8848    {
8849        #[inline]
8850        unsafe fn encode(
8851            self,
8852            encoder: &mut fidl::encoding::Encoder<
8853                '_,
8854                fidl::encoding::DefaultFuchsiaResourceDialect,
8855            >,
8856            offset: usize,
8857            _depth: fidl::encoding::Depth,
8858        ) -> fidl::Result<()> {
8859            encoder.debug_check_bounds::<NamespaceInputEntry>(offset);
8860            // Delegate to tuple encoding.
8861            fidl::encoding::Encode::<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8862                (
8863                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
8864                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
8865                ),
8866                encoder, offset, _depth
8867            )
8868        }
8869    }
8870    unsafe impl<
8871        T0: fidl::encoding::Encode<
8872                fidl::encoding::BoundedString<4095>,
8873                fidl::encoding::DefaultFuchsiaResourceDialect,
8874            >,
8875        T1: fidl::encoding::Encode<
8876                fidl::encoding::Endpoint<
8877                    fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
8878                >,
8879                fidl::encoding::DefaultFuchsiaResourceDialect,
8880            >,
8881    > fidl::encoding::Encode<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
8882        for (T0, T1)
8883    {
8884        #[inline]
8885        unsafe fn encode(
8886            self,
8887            encoder: &mut fidl::encoding::Encoder<
8888                '_,
8889                fidl::encoding::DefaultFuchsiaResourceDialect,
8890            >,
8891            offset: usize,
8892            depth: fidl::encoding::Depth,
8893        ) -> fidl::Result<()> {
8894            encoder.debug_check_bounds::<NamespaceInputEntry>(offset);
8895            // Zero out padding regions. There's no need to apply masks
8896            // because the unmasked parts will be overwritten by fields.
8897            unsafe {
8898                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8899                (ptr as *mut u64).write_unaligned(0);
8900            }
8901            // Write the fields.
8902            self.0.encode(encoder, offset + 0, depth)?;
8903            self.1.encode(encoder, offset + 16, depth)?;
8904            Ok(())
8905        }
8906    }
8907
8908    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8909        for NamespaceInputEntry
8910    {
8911        #[inline(always)]
8912        fn new_empty() -> Self {
8913            Self {
8914                path: fidl::new_empty!(
8915                    fidl::encoding::BoundedString<4095>,
8916                    fidl::encoding::DefaultFuchsiaResourceDialect
8917                ),
8918                dictionary: fidl::new_empty!(
8919                    fidl::encoding::Endpoint<
8920                        fidl::endpoints::ClientEnd<
8921                            fidl_fuchsia_component_sandbox::DictionaryMarker,
8922                        >,
8923                    >,
8924                    fidl::encoding::DefaultFuchsiaResourceDialect
8925                ),
8926            }
8927        }
8928
8929        #[inline]
8930        unsafe fn decode(
8931            &mut self,
8932            decoder: &mut fidl::encoding::Decoder<
8933                '_,
8934                fidl::encoding::DefaultFuchsiaResourceDialect,
8935            >,
8936            offset: usize,
8937            _depth: fidl::encoding::Depth,
8938        ) -> fidl::Result<()> {
8939            decoder.debug_check_bounds::<Self>(offset);
8940            // Verify that padding bytes are zero.
8941            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8942            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8943            let mask = 0xffffffff00000000u64;
8944            let maskedval = padval & mask;
8945            if maskedval != 0 {
8946                return Err(fidl::Error::NonZeroPadding {
8947                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8948                });
8949            }
8950            fidl::decode!(
8951                fidl::encoding::BoundedString<4095>,
8952                fidl::encoding::DefaultFuchsiaResourceDialect,
8953                &mut self.path,
8954                decoder,
8955                offset + 0,
8956                _depth
8957            )?;
8958            fidl::decode!(
8959                fidl::encoding::Endpoint<
8960                    fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
8961                >,
8962                fidl::encoding::DefaultFuchsiaResourceDialect,
8963                &mut self.dictionary,
8964                decoder,
8965                offset + 16,
8966                _depth
8967            )?;
8968            Ok(())
8969        }
8970    }
8971
8972    impl fidl::encoding::ResourceTypeMarker for NamespaceCreateResponse {
8973        type Borrowed<'a> = &'a mut Self;
8974        fn take_or_borrow<'a>(
8975            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8976        ) -> Self::Borrowed<'a> {
8977            value
8978        }
8979    }
8980
8981    unsafe impl fidl::encoding::TypeMarker for NamespaceCreateResponse {
8982        type Owned = Self;
8983
8984        #[inline(always)]
8985        fn inline_align(_context: fidl::encoding::Context) -> usize {
8986            8
8987        }
8988
8989        #[inline(always)]
8990        fn inline_size(_context: fidl::encoding::Context) -> usize {
8991            16
8992        }
8993    }
8994
8995    unsafe impl
8996        fidl::encoding::Encode<
8997            NamespaceCreateResponse,
8998            fidl::encoding::DefaultFuchsiaResourceDialect,
8999        > for &mut NamespaceCreateResponse
9000    {
9001        #[inline]
9002        unsafe fn encode(
9003            self,
9004            encoder: &mut fidl::encoding::Encoder<
9005                '_,
9006                fidl::encoding::DefaultFuchsiaResourceDialect,
9007            >,
9008            offset: usize,
9009            _depth: fidl::encoding::Depth,
9010        ) -> fidl::Result<()> {
9011            encoder.debug_check_bounds::<NamespaceCreateResponse>(offset);
9012            // Delegate to tuple encoding.
9013            fidl::encoding::Encode::<NamespaceCreateResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9014                (
9015                    <fidl::encoding::UnboundedVector<NamespaceEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
9016                ),
9017                encoder, offset, _depth
9018            )
9019        }
9020    }
9021    unsafe impl<
9022        T0: fidl::encoding::Encode<
9023                fidl::encoding::UnboundedVector<NamespaceEntry>,
9024                fidl::encoding::DefaultFuchsiaResourceDialect,
9025            >,
9026    >
9027        fidl::encoding::Encode<
9028            NamespaceCreateResponse,
9029            fidl::encoding::DefaultFuchsiaResourceDialect,
9030        > for (T0,)
9031    {
9032        #[inline]
9033        unsafe fn encode(
9034            self,
9035            encoder: &mut fidl::encoding::Encoder<
9036                '_,
9037                fidl::encoding::DefaultFuchsiaResourceDialect,
9038            >,
9039            offset: usize,
9040            depth: fidl::encoding::Depth,
9041        ) -> fidl::Result<()> {
9042            encoder.debug_check_bounds::<NamespaceCreateResponse>(offset);
9043            // Zero out padding regions. There's no need to apply masks
9044            // because the unmasked parts will be overwritten by fields.
9045            // Write the fields.
9046            self.0.encode(encoder, offset + 0, depth)?;
9047            Ok(())
9048        }
9049    }
9050
9051    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9052        for NamespaceCreateResponse
9053    {
9054        #[inline(always)]
9055        fn new_empty() -> Self {
9056            Self {
9057                entries: fidl::new_empty!(
9058                    fidl::encoding::UnboundedVector<NamespaceEntry>,
9059                    fidl::encoding::DefaultFuchsiaResourceDialect
9060                ),
9061            }
9062        }
9063
9064        #[inline]
9065        unsafe fn decode(
9066            &mut self,
9067            decoder: &mut fidl::encoding::Decoder<
9068                '_,
9069                fidl::encoding::DefaultFuchsiaResourceDialect,
9070            >,
9071            offset: usize,
9072            _depth: fidl::encoding::Depth,
9073        ) -> fidl::Result<()> {
9074            decoder.debug_check_bounds::<Self>(offset);
9075            // Verify that padding bytes are zero.
9076            fidl::decode!(
9077                fidl::encoding::UnboundedVector<NamespaceEntry>,
9078                fidl::encoding::DefaultFuchsiaResourceDialect,
9079                &mut self.entries,
9080                decoder,
9081                offset + 0,
9082                _depth
9083            )?;
9084            Ok(())
9085        }
9086    }
9087
9088    impl fidl::encoding::ResourceTypeMarker for RealmCreateChildRequest {
9089        type Borrowed<'a> = &'a mut Self;
9090        fn take_or_borrow<'a>(
9091            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9092        ) -> Self::Borrowed<'a> {
9093            value
9094        }
9095    }
9096
9097    unsafe impl fidl::encoding::TypeMarker for RealmCreateChildRequest {
9098        type Owned = Self;
9099
9100        #[inline(always)]
9101        fn inline_align(_context: fidl::encoding::Context) -> usize {
9102            8
9103        }
9104
9105        #[inline(always)]
9106        fn inline_size(_context: fidl::encoding::Context) -> usize {
9107            48
9108        }
9109    }
9110
9111    unsafe impl
9112        fidl::encoding::Encode<
9113            RealmCreateChildRequest,
9114            fidl::encoding::DefaultFuchsiaResourceDialect,
9115        > for &mut RealmCreateChildRequest
9116    {
9117        #[inline]
9118        unsafe fn encode(
9119            self,
9120            encoder: &mut fidl::encoding::Encoder<
9121                '_,
9122                fidl::encoding::DefaultFuchsiaResourceDialect,
9123            >,
9124            offset: usize,
9125            _depth: fidl::encoding::Depth,
9126        ) -> fidl::Result<()> {
9127            encoder.debug_check_bounds::<RealmCreateChildRequest>(offset);
9128            // Delegate to tuple encoding.
9129            fidl::encoding::Encode::<RealmCreateChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9130                (
9131                    <fidl_fuchsia_component_decl::CollectionRef as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
9132                    <fidl_fuchsia_component_decl::Child as fidl::encoding::ValueTypeMarker>::borrow(&self.decl),
9133                    <CreateChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
9134                ),
9135                encoder, offset, _depth
9136            )
9137        }
9138    }
9139    unsafe impl<
9140        T0: fidl::encoding::Encode<
9141                fidl_fuchsia_component_decl::CollectionRef,
9142                fidl::encoding::DefaultFuchsiaResourceDialect,
9143            >,
9144        T1: fidl::encoding::Encode<
9145                fidl_fuchsia_component_decl::Child,
9146                fidl::encoding::DefaultFuchsiaResourceDialect,
9147            >,
9148        T2: fidl::encoding::Encode<CreateChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
9149    >
9150        fidl::encoding::Encode<
9151            RealmCreateChildRequest,
9152            fidl::encoding::DefaultFuchsiaResourceDialect,
9153        > for (T0, T1, T2)
9154    {
9155        #[inline]
9156        unsafe fn encode(
9157            self,
9158            encoder: &mut fidl::encoding::Encoder<
9159                '_,
9160                fidl::encoding::DefaultFuchsiaResourceDialect,
9161            >,
9162            offset: usize,
9163            depth: fidl::encoding::Depth,
9164        ) -> fidl::Result<()> {
9165            encoder.debug_check_bounds::<RealmCreateChildRequest>(offset);
9166            // Zero out padding regions. There's no need to apply masks
9167            // because the unmasked parts will be overwritten by fields.
9168            // Write the fields.
9169            self.0.encode(encoder, offset + 0, depth)?;
9170            self.1.encode(encoder, offset + 16, depth)?;
9171            self.2.encode(encoder, offset + 32, depth)?;
9172            Ok(())
9173        }
9174    }
9175
9176    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9177        for RealmCreateChildRequest
9178    {
9179        #[inline(always)]
9180        fn new_empty() -> Self {
9181            Self {
9182                collection: fidl::new_empty!(
9183                    fidl_fuchsia_component_decl::CollectionRef,
9184                    fidl::encoding::DefaultFuchsiaResourceDialect
9185                ),
9186                decl: fidl::new_empty!(
9187                    fidl_fuchsia_component_decl::Child,
9188                    fidl::encoding::DefaultFuchsiaResourceDialect
9189                ),
9190                args: fidl::new_empty!(
9191                    CreateChildArgs,
9192                    fidl::encoding::DefaultFuchsiaResourceDialect
9193                ),
9194            }
9195        }
9196
9197        #[inline]
9198        unsafe fn decode(
9199            &mut self,
9200            decoder: &mut fidl::encoding::Decoder<
9201                '_,
9202                fidl::encoding::DefaultFuchsiaResourceDialect,
9203            >,
9204            offset: usize,
9205            _depth: fidl::encoding::Depth,
9206        ) -> fidl::Result<()> {
9207            decoder.debug_check_bounds::<Self>(offset);
9208            // Verify that padding bytes are zero.
9209            fidl::decode!(
9210                fidl_fuchsia_component_decl::CollectionRef,
9211                fidl::encoding::DefaultFuchsiaResourceDialect,
9212                &mut self.collection,
9213                decoder,
9214                offset + 0,
9215                _depth
9216            )?;
9217            fidl::decode!(
9218                fidl_fuchsia_component_decl::Child,
9219                fidl::encoding::DefaultFuchsiaResourceDialect,
9220                &mut self.decl,
9221                decoder,
9222                offset + 16,
9223                _depth
9224            )?;
9225            fidl::decode!(
9226                CreateChildArgs,
9227                fidl::encoding::DefaultFuchsiaResourceDialect,
9228                &mut self.args,
9229                decoder,
9230                offset + 32,
9231                _depth
9232            )?;
9233            Ok(())
9234        }
9235    }
9236
9237    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryRequest {
9238        type Borrowed<'a> = &'a mut Self;
9239        fn take_or_borrow<'a>(
9240            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9241        ) -> Self::Borrowed<'a> {
9242            value
9243        }
9244    }
9245
9246    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryRequest {
9247        type Owned = Self;
9248
9249        #[inline(always)]
9250        fn inline_align(_context: fidl::encoding::Context) -> usize {
9251            8
9252        }
9253
9254        #[inline(always)]
9255        fn inline_size(_context: fidl::encoding::Context) -> usize {
9256            32
9257        }
9258    }
9259
9260    unsafe impl
9261        fidl::encoding::Encode<
9262            RealmGetChildOutputDictionaryRequest,
9263            fidl::encoding::DefaultFuchsiaResourceDialect,
9264        > for &mut RealmGetChildOutputDictionaryRequest
9265    {
9266        #[inline]
9267        unsafe fn encode(
9268            self,
9269            encoder: &mut fidl::encoding::Encoder<
9270                '_,
9271                fidl::encoding::DefaultFuchsiaResourceDialect,
9272            >,
9273            offset: usize,
9274            _depth: fidl::encoding::Depth,
9275        ) -> fidl::Result<()> {
9276            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryRequest>(offset);
9277            // Delegate to tuple encoding.
9278            fidl::encoding::Encode::<RealmGetChildOutputDictionaryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9279                (
9280                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
9281                ),
9282                encoder, offset, _depth
9283            )
9284        }
9285    }
9286    unsafe impl<
9287        T0: fidl::encoding::Encode<
9288                fidl_fuchsia_component_decl::ChildRef,
9289                fidl::encoding::DefaultFuchsiaResourceDialect,
9290            >,
9291    >
9292        fidl::encoding::Encode<
9293            RealmGetChildOutputDictionaryRequest,
9294            fidl::encoding::DefaultFuchsiaResourceDialect,
9295        > for (T0,)
9296    {
9297        #[inline]
9298        unsafe fn encode(
9299            self,
9300            encoder: &mut fidl::encoding::Encoder<
9301                '_,
9302                fidl::encoding::DefaultFuchsiaResourceDialect,
9303            >,
9304            offset: usize,
9305            depth: fidl::encoding::Depth,
9306        ) -> fidl::Result<()> {
9307            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryRequest>(offset);
9308            // Zero out padding regions. There's no need to apply masks
9309            // because the unmasked parts will be overwritten by fields.
9310            // Write the fields.
9311            self.0.encode(encoder, offset + 0, depth)?;
9312            Ok(())
9313        }
9314    }
9315
9316    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9317        for RealmGetChildOutputDictionaryRequest
9318    {
9319        #[inline(always)]
9320        fn new_empty() -> Self {
9321            Self {
9322                child: fidl::new_empty!(
9323                    fidl_fuchsia_component_decl::ChildRef,
9324                    fidl::encoding::DefaultFuchsiaResourceDialect
9325                ),
9326            }
9327        }
9328
9329        #[inline]
9330        unsafe fn decode(
9331            &mut self,
9332            decoder: &mut fidl::encoding::Decoder<
9333                '_,
9334                fidl::encoding::DefaultFuchsiaResourceDialect,
9335            >,
9336            offset: usize,
9337            _depth: fidl::encoding::Depth,
9338        ) -> fidl::Result<()> {
9339            decoder.debug_check_bounds::<Self>(offset);
9340            // Verify that padding bytes are zero.
9341            fidl::decode!(
9342                fidl_fuchsia_component_decl::ChildRef,
9343                fidl::encoding::DefaultFuchsiaResourceDialect,
9344                &mut self.child,
9345                decoder,
9346                offset + 0,
9347                _depth
9348            )?;
9349            Ok(())
9350        }
9351    }
9352
9353    impl fidl::encoding::ResourceTypeMarker for RealmListChildrenRequest {
9354        type Borrowed<'a> = &'a mut Self;
9355        fn take_or_borrow<'a>(
9356            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9357        ) -> Self::Borrowed<'a> {
9358            value
9359        }
9360    }
9361
9362    unsafe impl fidl::encoding::TypeMarker for RealmListChildrenRequest {
9363        type Owned = Self;
9364
9365        #[inline(always)]
9366        fn inline_align(_context: fidl::encoding::Context) -> usize {
9367            8
9368        }
9369
9370        #[inline(always)]
9371        fn inline_size(_context: fidl::encoding::Context) -> usize {
9372            24
9373        }
9374    }
9375
9376    unsafe impl
9377        fidl::encoding::Encode<
9378            RealmListChildrenRequest,
9379            fidl::encoding::DefaultFuchsiaResourceDialect,
9380        > for &mut RealmListChildrenRequest
9381    {
9382        #[inline]
9383        unsafe fn encode(
9384            self,
9385            encoder: &mut fidl::encoding::Encoder<
9386                '_,
9387                fidl::encoding::DefaultFuchsiaResourceDialect,
9388            >,
9389            offset: usize,
9390            _depth: fidl::encoding::Depth,
9391        ) -> fidl::Result<()> {
9392            encoder.debug_check_bounds::<RealmListChildrenRequest>(offset);
9393            // Delegate to tuple encoding.
9394            fidl::encoding::Encode::<RealmListChildrenRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9395                (
9396                    <fidl_fuchsia_component_decl::CollectionRef as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
9397                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iter),
9398                ),
9399                encoder, offset, _depth
9400            )
9401        }
9402    }
9403    unsafe impl<
9404        T0: fidl::encoding::Encode<
9405                fidl_fuchsia_component_decl::CollectionRef,
9406                fidl::encoding::DefaultFuchsiaResourceDialect,
9407            >,
9408        T1: fidl::encoding::Encode<
9409                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
9410                fidl::encoding::DefaultFuchsiaResourceDialect,
9411            >,
9412    >
9413        fidl::encoding::Encode<
9414            RealmListChildrenRequest,
9415            fidl::encoding::DefaultFuchsiaResourceDialect,
9416        > for (T0, T1)
9417    {
9418        #[inline]
9419        unsafe fn encode(
9420            self,
9421            encoder: &mut fidl::encoding::Encoder<
9422                '_,
9423                fidl::encoding::DefaultFuchsiaResourceDialect,
9424            >,
9425            offset: usize,
9426            depth: fidl::encoding::Depth,
9427        ) -> fidl::Result<()> {
9428            encoder.debug_check_bounds::<RealmListChildrenRequest>(offset);
9429            // Zero out padding regions. There's no need to apply masks
9430            // because the unmasked parts will be overwritten by fields.
9431            unsafe {
9432                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9433                (ptr as *mut u64).write_unaligned(0);
9434            }
9435            // Write the fields.
9436            self.0.encode(encoder, offset + 0, depth)?;
9437            self.1.encode(encoder, offset + 16, depth)?;
9438            Ok(())
9439        }
9440    }
9441
9442    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9443        for RealmListChildrenRequest
9444    {
9445        #[inline(always)]
9446        fn new_empty() -> Self {
9447            Self {
9448                collection: fidl::new_empty!(
9449                    fidl_fuchsia_component_decl::CollectionRef,
9450                    fidl::encoding::DefaultFuchsiaResourceDialect
9451                ),
9452                iter: fidl::new_empty!(
9453                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
9454                    fidl::encoding::DefaultFuchsiaResourceDialect
9455                ),
9456            }
9457        }
9458
9459        #[inline]
9460        unsafe fn decode(
9461            &mut self,
9462            decoder: &mut fidl::encoding::Decoder<
9463                '_,
9464                fidl::encoding::DefaultFuchsiaResourceDialect,
9465            >,
9466            offset: usize,
9467            _depth: fidl::encoding::Depth,
9468        ) -> fidl::Result<()> {
9469            decoder.debug_check_bounds::<Self>(offset);
9470            // Verify that padding bytes are zero.
9471            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9472            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9473            let mask = 0xffffffff00000000u64;
9474            let maskedval = padval & mask;
9475            if maskedval != 0 {
9476                return Err(fidl::Error::NonZeroPadding {
9477                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9478                });
9479            }
9480            fidl::decode!(
9481                fidl_fuchsia_component_decl::CollectionRef,
9482                fidl::encoding::DefaultFuchsiaResourceDialect,
9483                &mut self.collection,
9484                decoder,
9485                offset + 0,
9486                _depth
9487            )?;
9488            fidl::decode!(
9489                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
9490                fidl::encoding::DefaultFuchsiaResourceDialect,
9491                &mut self.iter,
9492                decoder,
9493                offset + 16,
9494                _depth
9495            )?;
9496            Ok(())
9497        }
9498    }
9499
9500    impl fidl::encoding::ResourceTypeMarker for RealmOpenControllerRequest {
9501        type Borrowed<'a> = &'a mut Self;
9502        fn take_or_borrow<'a>(
9503            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9504        ) -> Self::Borrowed<'a> {
9505            value
9506        }
9507    }
9508
9509    unsafe impl fidl::encoding::TypeMarker for RealmOpenControllerRequest {
9510        type Owned = Self;
9511
9512        #[inline(always)]
9513        fn inline_align(_context: fidl::encoding::Context) -> usize {
9514            8
9515        }
9516
9517        #[inline(always)]
9518        fn inline_size(_context: fidl::encoding::Context) -> usize {
9519            40
9520        }
9521    }
9522
9523    unsafe impl
9524        fidl::encoding::Encode<
9525            RealmOpenControllerRequest,
9526            fidl::encoding::DefaultFuchsiaResourceDialect,
9527        > for &mut RealmOpenControllerRequest
9528    {
9529        #[inline]
9530        unsafe fn encode(
9531            self,
9532            encoder: &mut fidl::encoding::Encoder<
9533                '_,
9534                fidl::encoding::DefaultFuchsiaResourceDialect,
9535            >,
9536            offset: usize,
9537            _depth: fidl::encoding::Depth,
9538        ) -> fidl::Result<()> {
9539            encoder.debug_check_bounds::<RealmOpenControllerRequest>(offset);
9540            // Delegate to tuple encoding.
9541            fidl::encoding::Encode::<RealmOpenControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9542                (
9543                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
9544                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
9545                ),
9546                encoder, offset, _depth
9547            )
9548        }
9549    }
9550    unsafe impl<
9551        T0: fidl::encoding::Encode<
9552                fidl_fuchsia_component_decl::ChildRef,
9553                fidl::encoding::DefaultFuchsiaResourceDialect,
9554            >,
9555        T1: fidl::encoding::Encode<
9556                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
9557                fidl::encoding::DefaultFuchsiaResourceDialect,
9558            >,
9559    >
9560        fidl::encoding::Encode<
9561            RealmOpenControllerRequest,
9562            fidl::encoding::DefaultFuchsiaResourceDialect,
9563        > for (T0, T1)
9564    {
9565        #[inline]
9566        unsafe fn encode(
9567            self,
9568            encoder: &mut fidl::encoding::Encoder<
9569                '_,
9570                fidl::encoding::DefaultFuchsiaResourceDialect,
9571            >,
9572            offset: usize,
9573            depth: fidl::encoding::Depth,
9574        ) -> fidl::Result<()> {
9575            encoder.debug_check_bounds::<RealmOpenControllerRequest>(offset);
9576            // Zero out padding regions. There's no need to apply masks
9577            // because the unmasked parts will be overwritten by fields.
9578            unsafe {
9579                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9580                (ptr as *mut u64).write_unaligned(0);
9581            }
9582            // Write the fields.
9583            self.0.encode(encoder, offset + 0, depth)?;
9584            self.1.encode(encoder, offset + 32, depth)?;
9585            Ok(())
9586        }
9587    }
9588
9589    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9590        for RealmOpenControllerRequest
9591    {
9592        #[inline(always)]
9593        fn new_empty() -> Self {
9594            Self {
9595                child: fidl::new_empty!(
9596                    fidl_fuchsia_component_decl::ChildRef,
9597                    fidl::encoding::DefaultFuchsiaResourceDialect
9598                ),
9599                controller: fidl::new_empty!(
9600                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
9601                    fidl::encoding::DefaultFuchsiaResourceDialect
9602                ),
9603            }
9604        }
9605
9606        #[inline]
9607        unsafe fn decode(
9608            &mut self,
9609            decoder: &mut fidl::encoding::Decoder<
9610                '_,
9611                fidl::encoding::DefaultFuchsiaResourceDialect,
9612            >,
9613            offset: usize,
9614            _depth: fidl::encoding::Depth,
9615        ) -> fidl::Result<()> {
9616            decoder.debug_check_bounds::<Self>(offset);
9617            // Verify that padding bytes are zero.
9618            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9619            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9620            let mask = 0xffffffff00000000u64;
9621            let maskedval = padval & mask;
9622            if maskedval != 0 {
9623                return Err(fidl::Error::NonZeroPadding {
9624                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9625                });
9626            }
9627            fidl::decode!(
9628                fidl_fuchsia_component_decl::ChildRef,
9629                fidl::encoding::DefaultFuchsiaResourceDialect,
9630                &mut self.child,
9631                decoder,
9632                offset + 0,
9633                _depth
9634            )?;
9635            fidl::decode!(
9636                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
9637                fidl::encoding::DefaultFuchsiaResourceDialect,
9638                &mut self.controller,
9639                decoder,
9640                offset + 32,
9641                _depth
9642            )?;
9643            Ok(())
9644        }
9645    }
9646
9647    impl fidl::encoding::ResourceTypeMarker for RealmOpenExposedDirRequest {
9648        type Borrowed<'a> = &'a mut Self;
9649        fn take_or_borrow<'a>(
9650            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9651        ) -> Self::Borrowed<'a> {
9652            value
9653        }
9654    }
9655
9656    unsafe impl fidl::encoding::TypeMarker for RealmOpenExposedDirRequest {
9657        type Owned = Self;
9658
9659        #[inline(always)]
9660        fn inline_align(_context: fidl::encoding::Context) -> usize {
9661            8
9662        }
9663
9664        #[inline(always)]
9665        fn inline_size(_context: fidl::encoding::Context) -> usize {
9666            40
9667        }
9668    }
9669
9670    unsafe impl
9671        fidl::encoding::Encode<
9672            RealmOpenExposedDirRequest,
9673            fidl::encoding::DefaultFuchsiaResourceDialect,
9674        > for &mut RealmOpenExposedDirRequest
9675    {
9676        #[inline]
9677        unsafe fn encode(
9678            self,
9679            encoder: &mut fidl::encoding::Encoder<
9680                '_,
9681                fidl::encoding::DefaultFuchsiaResourceDialect,
9682            >,
9683            offset: usize,
9684            _depth: fidl::encoding::Depth,
9685        ) -> fidl::Result<()> {
9686            encoder.debug_check_bounds::<RealmOpenExposedDirRequest>(offset);
9687            // Delegate to tuple encoding.
9688            fidl::encoding::Encode::<RealmOpenExposedDirRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9689                (
9690                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
9691                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.exposed_dir),
9692                ),
9693                encoder, offset, _depth
9694            )
9695        }
9696    }
9697    unsafe impl<
9698        T0: fidl::encoding::Encode<
9699                fidl_fuchsia_component_decl::ChildRef,
9700                fidl::encoding::DefaultFuchsiaResourceDialect,
9701            >,
9702        T1: fidl::encoding::Encode<
9703                fidl::encoding::Endpoint<
9704                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9705                >,
9706                fidl::encoding::DefaultFuchsiaResourceDialect,
9707            >,
9708    >
9709        fidl::encoding::Encode<
9710            RealmOpenExposedDirRequest,
9711            fidl::encoding::DefaultFuchsiaResourceDialect,
9712        > for (T0, T1)
9713    {
9714        #[inline]
9715        unsafe fn encode(
9716            self,
9717            encoder: &mut fidl::encoding::Encoder<
9718                '_,
9719                fidl::encoding::DefaultFuchsiaResourceDialect,
9720            >,
9721            offset: usize,
9722            depth: fidl::encoding::Depth,
9723        ) -> fidl::Result<()> {
9724            encoder.debug_check_bounds::<RealmOpenExposedDirRequest>(offset);
9725            // Zero out padding regions. There's no need to apply masks
9726            // because the unmasked parts will be overwritten by fields.
9727            unsafe {
9728                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9729                (ptr as *mut u64).write_unaligned(0);
9730            }
9731            // Write the fields.
9732            self.0.encode(encoder, offset + 0, depth)?;
9733            self.1.encode(encoder, offset + 32, depth)?;
9734            Ok(())
9735        }
9736    }
9737
9738    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9739        for RealmOpenExposedDirRequest
9740    {
9741        #[inline(always)]
9742        fn new_empty() -> Self {
9743            Self {
9744                child: fidl::new_empty!(
9745                    fidl_fuchsia_component_decl::ChildRef,
9746                    fidl::encoding::DefaultFuchsiaResourceDialect
9747                ),
9748                exposed_dir: fidl::new_empty!(
9749                    fidl::encoding::Endpoint<
9750                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9751                    >,
9752                    fidl::encoding::DefaultFuchsiaResourceDialect
9753                ),
9754            }
9755        }
9756
9757        #[inline]
9758        unsafe fn decode(
9759            &mut self,
9760            decoder: &mut fidl::encoding::Decoder<
9761                '_,
9762                fidl::encoding::DefaultFuchsiaResourceDialect,
9763            >,
9764            offset: usize,
9765            _depth: fidl::encoding::Depth,
9766        ) -> fidl::Result<()> {
9767            decoder.debug_check_bounds::<Self>(offset);
9768            // Verify that padding bytes are zero.
9769            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9770            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9771            let mask = 0xffffffff00000000u64;
9772            let maskedval = padval & mask;
9773            if maskedval != 0 {
9774                return Err(fidl::Error::NonZeroPadding {
9775                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9776                });
9777            }
9778            fidl::decode!(
9779                fidl_fuchsia_component_decl::ChildRef,
9780                fidl::encoding::DefaultFuchsiaResourceDialect,
9781                &mut self.child,
9782                decoder,
9783                offset + 0,
9784                _depth
9785            )?;
9786            fidl::decode!(
9787                fidl::encoding::Endpoint<
9788                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9789                >,
9790                fidl::encoding::DefaultFuchsiaResourceDialect,
9791                &mut self.exposed_dir,
9792                decoder,
9793                offset + 32,
9794                _depth
9795            )?;
9796            Ok(())
9797        }
9798    }
9799
9800    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryResponse {
9801        type Borrowed<'a> = &'a mut Self;
9802        fn take_or_borrow<'a>(
9803            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9804        ) -> Self::Borrowed<'a> {
9805            value
9806        }
9807    }
9808
9809    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryResponse {
9810        type Owned = Self;
9811
9812        #[inline(always)]
9813        fn inline_align(_context: fidl::encoding::Context) -> usize {
9814            4
9815        }
9816
9817        #[inline(always)]
9818        fn inline_size(_context: fidl::encoding::Context) -> usize {
9819            4
9820        }
9821    }
9822
9823    unsafe impl
9824        fidl::encoding::Encode<
9825            RealmGetChildOutputDictionaryResponse,
9826            fidl::encoding::DefaultFuchsiaResourceDialect,
9827        > for &mut RealmGetChildOutputDictionaryResponse
9828    {
9829        #[inline]
9830        unsafe fn encode(
9831            self,
9832            encoder: &mut fidl::encoding::Encoder<
9833                '_,
9834                fidl::encoding::DefaultFuchsiaResourceDialect,
9835            >,
9836            offset: usize,
9837            _depth: fidl::encoding::Depth,
9838        ) -> fidl::Result<()> {
9839            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryResponse>(offset);
9840            // Delegate to tuple encoding.
9841            fidl::encoding::Encode::<RealmGetChildOutputDictionaryResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9842                (
9843                    <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
9844                ),
9845                encoder, offset, _depth
9846            )
9847        }
9848    }
9849    unsafe impl<
9850        T0: fidl::encoding::Encode<
9851                fidl_fuchsia_component_sandbox::DictionaryRef,
9852                fidl::encoding::DefaultFuchsiaResourceDialect,
9853            >,
9854    >
9855        fidl::encoding::Encode<
9856            RealmGetChildOutputDictionaryResponse,
9857            fidl::encoding::DefaultFuchsiaResourceDialect,
9858        > for (T0,)
9859    {
9860        #[inline]
9861        unsafe fn encode(
9862            self,
9863            encoder: &mut fidl::encoding::Encoder<
9864                '_,
9865                fidl::encoding::DefaultFuchsiaResourceDialect,
9866            >,
9867            offset: usize,
9868            depth: fidl::encoding::Depth,
9869        ) -> fidl::Result<()> {
9870            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryResponse>(offset);
9871            // Zero out padding regions. There's no need to apply masks
9872            // because the unmasked parts will be overwritten by fields.
9873            // Write the fields.
9874            self.0.encode(encoder, offset + 0, depth)?;
9875            Ok(())
9876        }
9877    }
9878
9879    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9880        for RealmGetChildOutputDictionaryResponse
9881    {
9882        #[inline(always)]
9883        fn new_empty() -> Self {
9884            Self {
9885                dictionary: fidl::new_empty!(
9886                    fidl_fuchsia_component_sandbox::DictionaryRef,
9887                    fidl::encoding::DefaultFuchsiaResourceDialect
9888                ),
9889            }
9890        }
9891
9892        #[inline]
9893        unsafe fn decode(
9894            &mut self,
9895            decoder: &mut fidl::encoding::Decoder<
9896                '_,
9897                fidl::encoding::DefaultFuchsiaResourceDialect,
9898            >,
9899            offset: usize,
9900            _depth: fidl::encoding::Depth,
9901        ) -> fidl::Result<()> {
9902            decoder.debug_check_bounds::<Self>(offset);
9903            // Verify that padding bytes are zero.
9904            fidl::decode!(
9905                fidl_fuchsia_component_sandbox::DictionaryRef,
9906                fidl::encoding::DefaultFuchsiaResourceDialect,
9907                &mut self.dictionary,
9908                decoder,
9909                offset + 0,
9910                _depth
9911            )?;
9912            Ok(())
9913        }
9914    }
9915
9916    impl fidl::encoding::ResourceTypeMarker for RealmGetResolvedInfoResponse {
9917        type Borrowed<'a> = &'a mut Self;
9918        fn take_or_borrow<'a>(
9919            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9920        ) -> Self::Borrowed<'a> {
9921            value
9922        }
9923    }
9924
9925    unsafe impl fidl::encoding::TypeMarker for RealmGetResolvedInfoResponse {
9926        type Owned = Self;
9927
9928        #[inline(always)]
9929        fn inline_align(_context: fidl::encoding::Context) -> usize {
9930            8
9931        }
9932
9933        #[inline(always)]
9934        fn inline_size(_context: fidl::encoding::Context) -> usize {
9935            16
9936        }
9937    }
9938
9939    unsafe impl
9940        fidl::encoding::Encode<
9941            RealmGetResolvedInfoResponse,
9942            fidl::encoding::DefaultFuchsiaResourceDialect,
9943        > for &mut RealmGetResolvedInfoResponse
9944    {
9945        #[inline]
9946        unsafe fn encode(
9947            self,
9948            encoder: &mut fidl::encoding::Encoder<
9949                '_,
9950                fidl::encoding::DefaultFuchsiaResourceDialect,
9951            >,
9952            offset: usize,
9953            _depth: fidl::encoding::Depth,
9954        ) -> fidl::Result<()> {
9955            encoder.debug_check_bounds::<RealmGetResolvedInfoResponse>(offset);
9956            // Delegate to tuple encoding.
9957            fidl::encoding::Encode::<RealmGetResolvedInfoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9958                (
9959                    <fidl_fuchsia_component_resolution::Component as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.resolved_info),
9960                ),
9961                encoder, offset, _depth
9962            )
9963        }
9964    }
9965    unsafe impl<
9966        T0: fidl::encoding::Encode<
9967                fidl_fuchsia_component_resolution::Component,
9968                fidl::encoding::DefaultFuchsiaResourceDialect,
9969            >,
9970    >
9971        fidl::encoding::Encode<
9972            RealmGetResolvedInfoResponse,
9973            fidl::encoding::DefaultFuchsiaResourceDialect,
9974        > for (T0,)
9975    {
9976        #[inline]
9977        unsafe fn encode(
9978            self,
9979            encoder: &mut fidl::encoding::Encoder<
9980                '_,
9981                fidl::encoding::DefaultFuchsiaResourceDialect,
9982            >,
9983            offset: usize,
9984            depth: fidl::encoding::Depth,
9985        ) -> fidl::Result<()> {
9986            encoder.debug_check_bounds::<RealmGetResolvedInfoResponse>(offset);
9987            // Zero out padding regions. There's no need to apply masks
9988            // because the unmasked parts will be overwritten by fields.
9989            // Write the fields.
9990            self.0.encode(encoder, offset + 0, depth)?;
9991            Ok(())
9992        }
9993    }
9994
9995    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9996        for RealmGetResolvedInfoResponse
9997    {
9998        #[inline(always)]
9999        fn new_empty() -> Self {
10000            Self {
10001                resolved_info: fidl::new_empty!(
10002                    fidl_fuchsia_component_resolution::Component,
10003                    fidl::encoding::DefaultFuchsiaResourceDialect
10004                ),
10005            }
10006        }
10007
10008        #[inline]
10009        unsafe fn decode(
10010            &mut self,
10011            decoder: &mut fidl::encoding::Decoder<
10012                '_,
10013                fidl::encoding::DefaultFuchsiaResourceDialect,
10014            >,
10015            offset: usize,
10016            _depth: fidl::encoding::Depth,
10017        ) -> fidl::Result<()> {
10018            decoder.debug_check_bounds::<Self>(offset);
10019            // Verify that padding bytes are zero.
10020            fidl::decode!(
10021                fidl_fuchsia_component_resolution::Component,
10022                fidl::encoding::DefaultFuchsiaResourceDialect,
10023                &mut self.resolved_info,
10024                decoder,
10025                offset + 0,
10026                _depth
10027            )?;
10028            Ok(())
10029        }
10030    }
10031
10032    impl fidl::encoding::ResourceTypeMarker for StorageAdminListStorageInRealmRequest {
10033        type Borrowed<'a> = &'a mut Self;
10034        fn take_or_borrow<'a>(
10035            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10036        ) -> Self::Borrowed<'a> {
10037            value
10038        }
10039    }
10040
10041    unsafe impl fidl::encoding::TypeMarker for StorageAdminListStorageInRealmRequest {
10042        type Owned = Self;
10043
10044        #[inline(always)]
10045        fn inline_align(_context: fidl::encoding::Context) -> usize {
10046            8
10047        }
10048
10049        #[inline(always)]
10050        fn inline_size(_context: fidl::encoding::Context) -> usize {
10051            24
10052        }
10053    }
10054
10055    unsafe impl
10056        fidl::encoding::Encode<
10057            StorageAdminListStorageInRealmRequest,
10058            fidl::encoding::DefaultFuchsiaResourceDialect,
10059        > for &mut StorageAdminListStorageInRealmRequest
10060    {
10061        #[inline]
10062        unsafe fn encode(
10063            self,
10064            encoder: &mut fidl::encoding::Encoder<
10065                '_,
10066                fidl::encoding::DefaultFuchsiaResourceDialect,
10067            >,
10068            offset: usize,
10069            _depth: fidl::encoding::Depth,
10070        ) -> fidl::Result<()> {
10071            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
10072            // Delegate to tuple encoding.
10073            fidl::encoding::Encode::<StorageAdminListStorageInRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10074                (
10075                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
10076                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
10077                ),
10078                encoder, offset, _depth
10079            )
10080        }
10081    }
10082    unsafe impl<
10083        T0: fidl::encoding::Encode<
10084                fidl::encoding::BoundedString<4096>,
10085                fidl::encoding::DefaultFuchsiaResourceDialect,
10086            >,
10087        T1: fidl::encoding::Encode<
10088                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
10089                fidl::encoding::DefaultFuchsiaResourceDialect,
10090            >,
10091    >
10092        fidl::encoding::Encode<
10093            StorageAdminListStorageInRealmRequest,
10094            fidl::encoding::DefaultFuchsiaResourceDialect,
10095        > for (T0, T1)
10096    {
10097        #[inline]
10098        unsafe fn encode(
10099            self,
10100            encoder: &mut fidl::encoding::Encoder<
10101                '_,
10102                fidl::encoding::DefaultFuchsiaResourceDialect,
10103            >,
10104            offset: usize,
10105            depth: fidl::encoding::Depth,
10106        ) -> fidl::Result<()> {
10107            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
10108            // Zero out padding regions. There's no need to apply masks
10109            // because the unmasked parts will be overwritten by fields.
10110            unsafe {
10111                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10112                (ptr as *mut u64).write_unaligned(0);
10113            }
10114            // Write the fields.
10115            self.0.encode(encoder, offset + 0, depth)?;
10116            self.1.encode(encoder, offset + 16, depth)?;
10117            Ok(())
10118        }
10119    }
10120
10121    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10122        for StorageAdminListStorageInRealmRequest
10123    {
10124        #[inline(always)]
10125        fn new_empty() -> Self {
10126            Self {
10127                relative_moniker: fidl::new_empty!(
10128                    fidl::encoding::BoundedString<4096>,
10129                    fidl::encoding::DefaultFuchsiaResourceDialect
10130                ),
10131                iterator: fidl::new_empty!(
10132                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
10133                    fidl::encoding::DefaultFuchsiaResourceDialect
10134                ),
10135            }
10136        }
10137
10138        #[inline]
10139        unsafe fn decode(
10140            &mut self,
10141            decoder: &mut fidl::encoding::Decoder<
10142                '_,
10143                fidl::encoding::DefaultFuchsiaResourceDialect,
10144            >,
10145            offset: usize,
10146            _depth: fidl::encoding::Depth,
10147        ) -> fidl::Result<()> {
10148            decoder.debug_check_bounds::<Self>(offset);
10149            // Verify that padding bytes are zero.
10150            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10151            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10152            let mask = 0xffffffff00000000u64;
10153            let maskedval = padval & mask;
10154            if maskedval != 0 {
10155                return Err(fidl::Error::NonZeroPadding {
10156                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10157                });
10158            }
10159            fidl::decode!(
10160                fidl::encoding::BoundedString<4096>,
10161                fidl::encoding::DefaultFuchsiaResourceDialect,
10162                &mut self.relative_moniker,
10163                decoder,
10164                offset + 0,
10165                _depth
10166            )?;
10167            fidl::decode!(
10168                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
10169                fidl::encoding::DefaultFuchsiaResourceDialect,
10170                &mut self.iterator,
10171                decoder,
10172                offset + 16,
10173                _depth
10174            )?;
10175            Ok(())
10176        }
10177    }
10178
10179    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenComponentStorageByIdRequest {
10180        type Borrowed<'a> = &'a mut Self;
10181        fn take_or_borrow<'a>(
10182            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10183        ) -> Self::Borrowed<'a> {
10184            value
10185        }
10186    }
10187
10188    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenComponentStorageByIdRequest {
10189        type Owned = Self;
10190
10191        #[inline(always)]
10192        fn inline_align(_context: fidl::encoding::Context) -> usize {
10193            8
10194        }
10195
10196        #[inline(always)]
10197        fn inline_size(_context: fidl::encoding::Context) -> usize {
10198            24
10199        }
10200    }
10201
10202    unsafe impl
10203        fidl::encoding::Encode<
10204            StorageAdminOpenComponentStorageByIdRequest,
10205            fidl::encoding::DefaultFuchsiaResourceDialect,
10206        > for &mut StorageAdminOpenComponentStorageByIdRequest
10207    {
10208        #[inline]
10209        unsafe fn encode(
10210            self,
10211            encoder: &mut fidl::encoding::Encoder<
10212                '_,
10213                fidl::encoding::DefaultFuchsiaResourceDialect,
10214            >,
10215            offset: usize,
10216            _depth: fidl::encoding::Depth,
10217        ) -> fidl::Result<()> {
10218            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
10219            // Delegate to tuple encoding.
10220            fidl::encoding::Encode::<
10221                StorageAdminOpenComponentStorageByIdRequest,
10222                fidl::encoding::DefaultFuchsiaResourceDialect,
10223            >::encode(
10224                (
10225                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
10226                        &self.id,
10227                    ),
10228                    <fidl::encoding::Endpoint<
10229                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
10230                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10231                        &mut self.object
10232                    ),
10233                ),
10234                encoder,
10235                offset,
10236                _depth,
10237            )
10238        }
10239    }
10240    unsafe impl<
10241        T0: fidl::encoding::Encode<
10242                fidl::encoding::BoundedString<64>,
10243                fidl::encoding::DefaultFuchsiaResourceDialect,
10244            >,
10245        T1: fidl::encoding::Encode<
10246                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
10247                fidl::encoding::DefaultFuchsiaResourceDialect,
10248            >,
10249    >
10250        fidl::encoding::Encode<
10251            StorageAdminOpenComponentStorageByIdRequest,
10252            fidl::encoding::DefaultFuchsiaResourceDialect,
10253        > for (T0, T1)
10254    {
10255        #[inline]
10256        unsafe fn encode(
10257            self,
10258            encoder: &mut fidl::encoding::Encoder<
10259                '_,
10260                fidl::encoding::DefaultFuchsiaResourceDialect,
10261            >,
10262            offset: usize,
10263            depth: fidl::encoding::Depth,
10264        ) -> fidl::Result<()> {
10265            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
10266            // Zero out padding regions. There's no need to apply masks
10267            // because the unmasked parts will be overwritten by fields.
10268            unsafe {
10269                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10270                (ptr as *mut u64).write_unaligned(0);
10271            }
10272            // Write the fields.
10273            self.0.encode(encoder, offset + 0, depth)?;
10274            self.1.encode(encoder, offset + 16, depth)?;
10275            Ok(())
10276        }
10277    }
10278
10279    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10280        for StorageAdminOpenComponentStorageByIdRequest
10281    {
10282        #[inline(always)]
10283        fn new_empty() -> Self {
10284            Self {
10285                id: fidl::new_empty!(
10286                    fidl::encoding::BoundedString<64>,
10287                    fidl::encoding::DefaultFuchsiaResourceDialect
10288                ),
10289                object: fidl::new_empty!(
10290                    fidl::encoding::Endpoint<
10291                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
10292                    >,
10293                    fidl::encoding::DefaultFuchsiaResourceDialect
10294                ),
10295            }
10296        }
10297
10298        #[inline]
10299        unsafe fn decode(
10300            &mut self,
10301            decoder: &mut fidl::encoding::Decoder<
10302                '_,
10303                fidl::encoding::DefaultFuchsiaResourceDialect,
10304            >,
10305            offset: usize,
10306            _depth: fidl::encoding::Depth,
10307        ) -> fidl::Result<()> {
10308            decoder.debug_check_bounds::<Self>(offset);
10309            // Verify that padding bytes are zero.
10310            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10311            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10312            let mask = 0xffffffff00000000u64;
10313            let maskedval = padval & mask;
10314            if maskedval != 0 {
10315                return Err(fidl::Error::NonZeroPadding {
10316                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10317                });
10318            }
10319            fidl::decode!(
10320                fidl::encoding::BoundedString<64>,
10321                fidl::encoding::DefaultFuchsiaResourceDialect,
10322                &mut self.id,
10323                decoder,
10324                offset + 0,
10325                _depth
10326            )?;
10327            fidl::decode!(
10328                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
10329                fidl::encoding::DefaultFuchsiaResourceDialect,
10330                &mut self.object,
10331                decoder,
10332                offset + 16,
10333                _depth
10334            )?;
10335            Ok(())
10336        }
10337    }
10338
10339    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenStorageRequest {
10340        type Borrowed<'a> = &'a mut Self;
10341        fn take_or_borrow<'a>(
10342            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10343        ) -> Self::Borrowed<'a> {
10344            value
10345        }
10346    }
10347
10348    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenStorageRequest {
10349        type Owned = Self;
10350
10351        #[inline(always)]
10352        fn inline_align(_context: fidl::encoding::Context) -> usize {
10353            8
10354        }
10355
10356        #[inline(always)]
10357        fn inline_size(_context: fidl::encoding::Context) -> usize {
10358            24
10359        }
10360    }
10361
10362    unsafe impl
10363        fidl::encoding::Encode<
10364            StorageAdminOpenStorageRequest,
10365            fidl::encoding::DefaultFuchsiaResourceDialect,
10366        > for &mut StorageAdminOpenStorageRequest
10367    {
10368        #[inline]
10369        unsafe fn encode(
10370            self,
10371            encoder: &mut fidl::encoding::Encoder<
10372                '_,
10373                fidl::encoding::DefaultFuchsiaResourceDialect,
10374            >,
10375            offset: usize,
10376            _depth: fidl::encoding::Depth,
10377        ) -> fidl::Result<()> {
10378            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
10379            // Delegate to tuple encoding.
10380            fidl::encoding::Encode::<StorageAdminOpenStorageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10381                (
10382                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
10383                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.object),
10384                ),
10385                encoder, offset, _depth
10386            )
10387        }
10388    }
10389    unsafe impl<
10390        T0: fidl::encoding::Encode<
10391                fidl::encoding::BoundedString<4096>,
10392                fidl::encoding::DefaultFuchsiaResourceDialect,
10393            >,
10394        T1: fidl::encoding::Encode<
10395                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
10396                fidl::encoding::DefaultFuchsiaResourceDialect,
10397            >,
10398    >
10399        fidl::encoding::Encode<
10400            StorageAdminOpenStorageRequest,
10401            fidl::encoding::DefaultFuchsiaResourceDialect,
10402        > for (T0, T1)
10403    {
10404        #[inline]
10405        unsafe fn encode(
10406            self,
10407            encoder: &mut fidl::encoding::Encoder<
10408                '_,
10409                fidl::encoding::DefaultFuchsiaResourceDialect,
10410            >,
10411            offset: usize,
10412            depth: fidl::encoding::Depth,
10413        ) -> fidl::Result<()> {
10414            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
10415            // Zero out padding regions. There's no need to apply masks
10416            // because the unmasked parts will be overwritten by fields.
10417            unsafe {
10418                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10419                (ptr as *mut u64).write_unaligned(0);
10420            }
10421            // Write the fields.
10422            self.0.encode(encoder, offset + 0, depth)?;
10423            self.1.encode(encoder, offset + 16, depth)?;
10424            Ok(())
10425        }
10426    }
10427
10428    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10429        for StorageAdminOpenStorageRequest
10430    {
10431        #[inline(always)]
10432        fn new_empty() -> Self {
10433            Self {
10434                relative_moniker: fidl::new_empty!(
10435                    fidl::encoding::BoundedString<4096>,
10436                    fidl::encoding::DefaultFuchsiaResourceDialect
10437                ),
10438                object: fidl::new_empty!(
10439                    fidl::encoding::Endpoint<
10440                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
10441                    >,
10442                    fidl::encoding::DefaultFuchsiaResourceDialect
10443                ),
10444            }
10445        }
10446
10447        #[inline]
10448        unsafe fn decode(
10449            &mut self,
10450            decoder: &mut fidl::encoding::Decoder<
10451                '_,
10452                fidl::encoding::DefaultFuchsiaResourceDialect,
10453            >,
10454            offset: usize,
10455            _depth: fidl::encoding::Depth,
10456        ) -> fidl::Result<()> {
10457            decoder.debug_check_bounds::<Self>(offset);
10458            // Verify that padding bytes are zero.
10459            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10460            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10461            let mask = 0xffffffff00000000u64;
10462            let maskedval = padval & mask;
10463            if maskedval != 0 {
10464                return Err(fidl::Error::NonZeroPadding {
10465                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10466                });
10467            }
10468            fidl::decode!(
10469                fidl::encoding::BoundedString<4096>,
10470                fidl::encoding::DefaultFuchsiaResourceDialect,
10471                &mut self.relative_moniker,
10472                decoder,
10473                offset + 0,
10474                _depth
10475            )?;
10476            fidl::decode!(
10477                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
10478                fidl::encoding::DefaultFuchsiaResourceDialect,
10479                &mut self.object,
10480                decoder,
10481                offset + 16,
10482                _depth
10483            )?;
10484            Ok(())
10485        }
10486    }
10487
10488    impl CapabilityRequestedPayload {
10489        #[inline(always)]
10490        fn max_ordinal_present(&self) -> u64 {
10491            if let Some(_) = self.capability {
10492                return 2;
10493            }
10494            if let Some(_) = self.name {
10495                return 1;
10496            }
10497            0
10498        }
10499    }
10500
10501    impl fidl::encoding::ResourceTypeMarker for CapabilityRequestedPayload {
10502        type Borrowed<'a> = &'a mut Self;
10503        fn take_or_borrow<'a>(
10504            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10505        ) -> Self::Borrowed<'a> {
10506            value
10507        }
10508    }
10509
10510    unsafe impl fidl::encoding::TypeMarker for CapabilityRequestedPayload {
10511        type Owned = Self;
10512
10513        #[inline(always)]
10514        fn inline_align(_context: fidl::encoding::Context) -> usize {
10515            8
10516        }
10517
10518        #[inline(always)]
10519        fn inline_size(_context: fidl::encoding::Context) -> usize {
10520            16
10521        }
10522    }
10523
10524    unsafe impl
10525        fidl::encoding::Encode<
10526            CapabilityRequestedPayload,
10527            fidl::encoding::DefaultFuchsiaResourceDialect,
10528        > for &mut CapabilityRequestedPayload
10529    {
10530        unsafe fn encode(
10531            self,
10532            encoder: &mut fidl::encoding::Encoder<
10533                '_,
10534                fidl::encoding::DefaultFuchsiaResourceDialect,
10535            >,
10536            offset: usize,
10537            mut depth: fidl::encoding::Depth,
10538        ) -> fidl::Result<()> {
10539            encoder.debug_check_bounds::<CapabilityRequestedPayload>(offset);
10540            // Vector header
10541            let max_ordinal: u64 = self.max_ordinal_present();
10542            encoder.write_num(max_ordinal, offset);
10543            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10544            // Calling encoder.out_of_line_offset(0) is not allowed.
10545            if max_ordinal == 0 {
10546                return Ok(());
10547            }
10548            depth.increment()?;
10549            let envelope_size = 8;
10550            let bytes_len = max_ordinal as usize * envelope_size;
10551            #[allow(unused_variables)]
10552            let offset = encoder.out_of_line_offset(bytes_len);
10553            let mut _prev_end_offset: usize = 0;
10554            if 1 > max_ordinal {
10555                return Ok(());
10556            }
10557
10558            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10559            // are envelope_size bytes.
10560            let cur_offset: usize = (1 - 1) * envelope_size;
10561
10562            // Zero reserved fields.
10563            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10564
10565            // Safety:
10566            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10567            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10568            //   envelope_size bytes, there is always sufficient room.
10569            fidl::encoding::encode_in_envelope_optional::<
10570                fidl::encoding::BoundedString<255>,
10571                fidl::encoding::DefaultFuchsiaResourceDialect,
10572            >(
10573                self.name.as_ref().map(
10574                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
10575                ),
10576                encoder,
10577                offset + cur_offset,
10578                depth,
10579            )?;
10580
10581            _prev_end_offset = cur_offset + envelope_size;
10582            if 2 > max_ordinal {
10583                return Ok(());
10584            }
10585
10586            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10587            // are envelope_size bytes.
10588            let cur_offset: usize = (2 - 1) * envelope_size;
10589
10590            // Zero reserved fields.
10591            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10592
10593            // Safety:
10594            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10595            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10596            //   envelope_size bytes, there is always sufficient room.
10597            fidl::encoding::encode_in_envelope_optional::<
10598                fidl::encoding::HandleType<
10599                    fidl::Channel,
10600                    { fidl::ObjectType::CHANNEL.into_raw() },
10601                    2147483648,
10602                >,
10603                fidl::encoding::DefaultFuchsiaResourceDialect,
10604            >(
10605                self.capability.as_mut().map(
10606                    <fidl::encoding::HandleType<
10607                        fidl::Channel,
10608                        { fidl::ObjectType::CHANNEL.into_raw() },
10609                        2147483648,
10610                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10611                ),
10612                encoder,
10613                offset + cur_offset,
10614                depth,
10615            )?;
10616
10617            _prev_end_offset = cur_offset + envelope_size;
10618
10619            Ok(())
10620        }
10621    }
10622
10623    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10624        for CapabilityRequestedPayload
10625    {
10626        #[inline(always)]
10627        fn new_empty() -> Self {
10628            Self::default()
10629        }
10630
10631        unsafe fn decode(
10632            &mut self,
10633            decoder: &mut fidl::encoding::Decoder<
10634                '_,
10635                fidl::encoding::DefaultFuchsiaResourceDialect,
10636            >,
10637            offset: usize,
10638            mut depth: fidl::encoding::Depth,
10639        ) -> fidl::Result<()> {
10640            decoder.debug_check_bounds::<Self>(offset);
10641            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10642                None => return Err(fidl::Error::NotNullable),
10643                Some(len) => len,
10644            };
10645            // Calling decoder.out_of_line_offset(0) is not allowed.
10646            if len == 0 {
10647                return Ok(());
10648            };
10649            depth.increment()?;
10650            let envelope_size = 8;
10651            let bytes_len = len * envelope_size;
10652            let offset = decoder.out_of_line_offset(bytes_len)?;
10653            // Decode the envelope for each type.
10654            let mut _next_ordinal_to_read = 0;
10655            let mut next_offset = offset;
10656            let end_offset = offset + bytes_len;
10657            _next_ordinal_to_read += 1;
10658            if next_offset >= end_offset {
10659                return Ok(());
10660            }
10661
10662            // Decode unknown envelopes for gaps in ordinals.
10663            while _next_ordinal_to_read < 1 {
10664                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10665                _next_ordinal_to_read += 1;
10666                next_offset += envelope_size;
10667            }
10668
10669            let next_out_of_line = decoder.next_out_of_line();
10670            let handles_before = decoder.remaining_handles();
10671            if let Some((inlined, num_bytes, num_handles)) =
10672                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10673            {
10674                let member_inline_size =
10675                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
10676                        decoder.context,
10677                    );
10678                if inlined != (member_inline_size <= 4) {
10679                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10680                }
10681                let inner_offset;
10682                let mut inner_depth = depth.clone();
10683                if inlined {
10684                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10685                    inner_offset = next_offset;
10686                } else {
10687                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10688                    inner_depth.increment()?;
10689                }
10690                let val_ref = self.name.get_or_insert_with(|| {
10691                    fidl::new_empty!(
10692                        fidl::encoding::BoundedString<255>,
10693                        fidl::encoding::DefaultFuchsiaResourceDialect
10694                    )
10695                });
10696                fidl::decode!(
10697                    fidl::encoding::BoundedString<255>,
10698                    fidl::encoding::DefaultFuchsiaResourceDialect,
10699                    val_ref,
10700                    decoder,
10701                    inner_offset,
10702                    inner_depth
10703                )?;
10704                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10705                {
10706                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10707                }
10708                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10709                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10710                }
10711            }
10712
10713            next_offset += envelope_size;
10714            _next_ordinal_to_read += 1;
10715            if next_offset >= end_offset {
10716                return Ok(());
10717            }
10718
10719            // Decode unknown envelopes for gaps in ordinals.
10720            while _next_ordinal_to_read < 2 {
10721                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10722                _next_ordinal_to_read += 1;
10723                next_offset += envelope_size;
10724            }
10725
10726            let next_out_of_line = decoder.next_out_of_line();
10727            let handles_before = decoder.remaining_handles();
10728            if let Some((inlined, num_bytes, num_handles)) =
10729                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10730            {
10731                let member_inline_size = <fidl::encoding::HandleType<
10732                    fidl::Channel,
10733                    { fidl::ObjectType::CHANNEL.into_raw() },
10734                    2147483648,
10735                > as fidl::encoding::TypeMarker>::inline_size(
10736                    decoder.context
10737                );
10738                if inlined != (member_inline_size <= 4) {
10739                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10740                }
10741                let inner_offset;
10742                let mut inner_depth = depth.clone();
10743                if inlined {
10744                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10745                    inner_offset = next_offset;
10746                } else {
10747                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10748                    inner_depth.increment()?;
10749                }
10750                let val_ref =
10751                self.capability.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10752                fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10753                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10754                {
10755                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10756                }
10757                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10758                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10759                }
10760            }
10761
10762            next_offset += envelope_size;
10763
10764            // Decode the remaining unknown envelopes.
10765            while next_offset < end_offset {
10766                _next_ordinal_to_read += 1;
10767                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10768                next_offset += envelope_size;
10769            }
10770
10771            Ok(())
10772        }
10773    }
10774
10775    impl CreateChildArgs {
10776        #[inline(always)]
10777        fn max_ordinal_present(&self) -> u64 {
10778            if let Some(_) = self.dictionary {
10779                return 4;
10780            }
10781            if let Some(_) = self.controller {
10782                return 3;
10783            }
10784            if let Some(_) = self.dynamic_offers {
10785                return 2;
10786            }
10787            if let Some(_) = self.numbered_handles {
10788                return 1;
10789            }
10790            0
10791        }
10792    }
10793
10794    impl fidl::encoding::ResourceTypeMarker for CreateChildArgs {
10795        type Borrowed<'a> = &'a mut Self;
10796        fn take_or_borrow<'a>(
10797            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10798        ) -> Self::Borrowed<'a> {
10799            value
10800        }
10801    }
10802
10803    unsafe impl fidl::encoding::TypeMarker for CreateChildArgs {
10804        type Owned = Self;
10805
10806        #[inline(always)]
10807        fn inline_align(_context: fidl::encoding::Context) -> usize {
10808            8
10809        }
10810
10811        #[inline(always)]
10812        fn inline_size(_context: fidl::encoding::Context) -> usize {
10813            16
10814        }
10815    }
10816
10817    unsafe impl
10818        fidl::encoding::Encode<CreateChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
10819        for &mut CreateChildArgs
10820    {
10821        unsafe fn encode(
10822            self,
10823            encoder: &mut fidl::encoding::Encoder<
10824                '_,
10825                fidl::encoding::DefaultFuchsiaResourceDialect,
10826            >,
10827            offset: usize,
10828            mut depth: fidl::encoding::Depth,
10829        ) -> fidl::Result<()> {
10830            encoder.debug_check_bounds::<CreateChildArgs>(offset);
10831            // Vector header
10832            let max_ordinal: u64 = self.max_ordinal_present();
10833            encoder.write_num(max_ordinal, offset);
10834            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10835            // Calling encoder.out_of_line_offset(0) is not allowed.
10836            if max_ordinal == 0 {
10837                return Ok(());
10838            }
10839            depth.increment()?;
10840            let envelope_size = 8;
10841            let bytes_len = max_ordinal as usize * envelope_size;
10842            #[allow(unused_variables)]
10843            let offset = encoder.out_of_line_offset(bytes_len);
10844            let mut _prev_end_offset: usize = 0;
10845            if 1 > max_ordinal {
10846                return Ok(());
10847            }
10848
10849            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10850            // are envelope_size bytes.
10851            let cur_offset: usize = (1 - 1) * envelope_size;
10852
10853            // Zero reserved fields.
10854            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10855
10856            // Safety:
10857            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10858            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10859            //   envelope_size bytes, there is always sufficient room.
10860            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10861            self.numbered_handles.as_mut().map(<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10862            encoder, offset + cur_offset, depth
10863        )?;
10864
10865            _prev_end_offset = cur_offset + envelope_size;
10866            if 2 > max_ordinal {
10867                return Ok(());
10868            }
10869
10870            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10871            // are envelope_size bytes.
10872            let cur_offset: usize = (2 - 1) * envelope_size;
10873
10874            // Zero reserved fields.
10875            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10876
10877            // Safety:
10878            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10879            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10880            //   envelope_size bytes, there is always sufficient room.
10881            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10882            self.dynamic_offers.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128> as fidl::encoding::ValueTypeMarker>::borrow),
10883            encoder, offset + cur_offset, depth
10884        )?;
10885
10886            _prev_end_offset = cur_offset + envelope_size;
10887            if 3 > max_ordinal {
10888                return Ok(());
10889            }
10890
10891            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10892            // are envelope_size bytes.
10893            let cur_offset: usize = (3 - 1) * envelope_size;
10894
10895            // Zero reserved fields.
10896            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10897
10898            // Safety:
10899            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10900            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10901            //   envelope_size bytes, there is always sufficient room.
10902            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10903            self.controller.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10904            encoder, offset + cur_offset, depth
10905        )?;
10906
10907            _prev_end_offset = cur_offset + envelope_size;
10908            if 4 > max_ordinal {
10909                return Ok(());
10910            }
10911
10912            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10913            // are envelope_size bytes.
10914            let cur_offset: usize = (4 - 1) * envelope_size;
10915
10916            // Zero reserved fields.
10917            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10918
10919            // Safety:
10920            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10921            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10922            //   envelope_size bytes, there is always sufficient room.
10923            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
10924            self.dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10925            encoder, offset + cur_offset, depth
10926        )?;
10927
10928            _prev_end_offset = cur_offset + envelope_size;
10929
10930            Ok(())
10931        }
10932    }
10933
10934    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10935        for CreateChildArgs
10936    {
10937        #[inline(always)]
10938        fn new_empty() -> Self {
10939            Self::default()
10940        }
10941
10942        unsafe fn decode(
10943            &mut self,
10944            decoder: &mut fidl::encoding::Decoder<
10945                '_,
10946                fidl::encoding::DefaultFuchsiaResourceDialect,
10947            >,
10948            offset: usize,
10949            mut depth: fidl::encoding::Depth,
10950        ) -> fidl::Result<()> {
10951            decoder.debug_check_bounds::<Self>(offset);
10952            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10953                None => return Err(fidl::Error::NotNullable),
10954                Some(len) => len,
10955            };
10956            // Calling decoder.out_of_line_offset(0) is not allowed.
10957            if len == 0 {
10958                return Ok(());
10959            };
10960            depth.increment()?;
10961            let envelope_size = 8;
10962            let bytes_len = len * envelope_size;
10963            let offset = decoder.out_of_line_offset(bytes_len)?;
10964            // Decode the envelope for each type.
10965            let mut _next_ordinal_to_read = 0;
10966            let mut next_offset = offset;
10967            let end_offset = offset + bytes_len;
10968            _next_ordinal_to_read += 1;
10969            if next_offset >= end_offset {
10970                return Ok(());
10971            }
10972
10973            // Decode unknown envelopes for gaps in ordinals.
10974            while _next_ordinal_to_read < 1 {
10975                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10976                _next_ordinal_to_read += 1;
10977                next_offset += envelope_size;
10978            }
10979
10980            let next_out_of_line = decoder.next_out_of_line();
10981            let handles_before = decoder.remaining_handles();
10982            if let Some((inlined, num_bytes, num_handles)) =
10983                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10984            {
10985                let member_inline_size = <fidl::encoding::Vector<
10986                    fidl_fuchsia_process::HandleInfo,
10987                    128,
10988                > as fidl::encoding::TypeMarker>::inline_size(
10989                    decoder.context
10990                );
10991                if inlined != (member_inline_size <= 4) {
10992                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10993                }
10994                let inner_offset;
10995                let mut inner_depth = depth.clone();
10996                if inlined {
10997                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10998                    inner_offset = next_offset;
10999                } else {
11000                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11001                    inner_depth.increment()?;
11002                }
11003                let val_ref =
11004                self.numbered_handles.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
11005                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11006                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11007                {
11008                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11009                }
11010                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11011                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11012                }
11013            }
11014
11015            next_offset += envelope_size;
11016            _next_ordinal_to_read += 1;
11017            if next_offset >= end_offset {
11018                return Ok(());
11019            }
11020
11021            // Decode unknown envelopes for gaps in ordinals.
11022            while _next_ordinal_to_read < 2 {
11023                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11024                _next_ordinal_to_read += 1;
11025                next_offset += envelope_size;
11026            }
11027
11028            let next_out_of_line = decoder.next_out_of_line();
11029            let handles_before = decoder.remaining_handles();
11030            if let Some((inlined, num_bytes, num_handles)) =
11031                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11032            {
11033                let member_inline_size = <fidl::encoding::Vector<
11034                    fidl_fuchsia_component_decl::Offer,
11035                    128,
11036                > as fidl::encoding::TypeMarker>::inline_size(
11037                    decoder.context
11038                );
11039                if inlined != (member_inline_size <= 4) {
11040                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11041                }
11042                let inner_offset;
11043                let mut inner_depth = depth.clone();
11044                if inlined {
11045                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11046                    inner_offset = next_offset;
11047                } else {
11048                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11049                    inner_depth.increment()?;
11050                }
11051                let val_ref =
11052                self.dynamic_offers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
11053                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11054                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11055                {
11056                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11057                }
11058                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11059                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11060                }
11061            }
11062
11063            next_offset += envelope_size;
11064            _next_ordinal_to_read += 1;
11065            if next_offset >= end_offset {
11066                return Ok(());
11067            }
11068
11069            // Decode unknown envelopes for gaps in ordinals.
11070            while _next_ordinal_to_read < 3 {
11071                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11072                _next_ordinal_to_read += 1;
11073                next_offset += envelope_size;
11074            }
11075
11076            let next_out_of_line = decoder.next_out_of_line();
11077            let handles_before = decoder.remaining_handles();
11078            if let Some((inlined, num_bytes, num_handles)) =
11079                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11080            {
11081                let member_inline_size = <fidl::encoding::Endpoint<
11082                    fidl::endpoints::ServerEnd<ControllerMarker>,
11083                > as fidl::encoding::TypeMarker>::inline_size(
11084                    decoder.context
11085                );
11086                if inlined != (member_inline_size <= 4) {
11087                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11088                }
11089                let inner_offset;
11090                let mut inner_depth = depth.clone();
11091                if inlined {
11092                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11093                    inner_offset = next_offset;
11094                } else {
11095                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11096                    inner_depth.increment()?;
11097                }
11098                let val_ref = self.controller.get_or_insert_with(|| {
11099                    fidl::new_empty!(
11100                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
11101                        fidl::encoding::DefaultFuchsiaResourceDialect
11102                    )
11103                });
11104                fidl::decode!(
11105                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
11106                    fidl::encoding::DefaultFuchsiaResourceDialect,
11107                    val_ref,
11108                    decoder,
11109                    inner_offset,
11110                    inner_depth
11111                )?;
11112                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11113                {
11114                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11115                }
11116                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11117                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11118                }
11119            }
11120
11121            next_offset += envelope_size;
11122            _next_ordinal_to_read += 1;
11123            if next_offset >= end_offset {
11124                return Ok(());
11125            }
11126
11127            // Decode unknown envelopes for gaps in ordinals.
11128            while _next_ordinal_to_read < 4 {
11129                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11130                _next_ordinal_to_read += 1;
11131                next_offset += envelope_size;
11132            }
11133
11134            let next_out_of_line = decoder.next_out_of_line();
11135            let handles_before = decoder.remaining_handles();
11136            if let Some((inlined, num_bytes, num_handles)) =
11137                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11138            {
11139                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11140                if inlined != (member_inline_size <= 4) {
11141                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11142                }
11143                let inner_offset;
11144                let mut inner_depth = depth.clone();
11145                if inlined {
11146                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11147                    inner_offset = next_offset;
11148                } else {
11149                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11150                    inner_depth.increment()?;
11151                }
11152                let val_ref = self.dictionary.get_or_insert_with(|| {
11153                    fidl::new_empty!(
11154                        fidl_fuchsia_component_sandbox::DictionaryRef,
11155                        fidl::encoding::DefaultFuchsiaResourceDialect
11156                    )
11157                });
11158                fidl::decode!(
11159                    fidl_fuchsia_component_sandbox::DictionaryRef,
11160                    fidl::encoding::DefaultFuchsiaResourceDialect,
11161                    val_ref,
11162                    decoder,
11163                    inner_offset,
11164                    inner_depth
11165                )?;
11166                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11167                {
11168                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11169                }
11170                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11171                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11172                }
11173            }
11174
11175            next_offset += envelope_size;
11176
11177            // Decode the remaining unknown envelopes.
11178            while next_offset < end_offset {
11179                _next_ordinal_to_read += 1;
11180                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11181                next_offset += envelope_size;
11182            }
11183
11184            Ok(())
11185        }
11186    }
11187
11188    impl DebugStartedPayload {
11189        #[inline(always)]
11190        fn max_ordinal_present(&self) -> u64 {
11191            if let Some(_) = self.break_on_start {
11192                return 2;
11193            }
11194            if let Some(_) = self.runtime_dir {
11195                return 1;
11196            }
11197            0
11198        }
11199    }
11200
11201    impl fidl::encoding::ResourceTypeMarker for DebugStartedPayload {
11202        type Borrowed<'a> = &'a mut Self;
11203        fn take_or_borrow<'a>(
11204            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11205        ) -> Self::Borrowed<'a> {
11206            value
11207        }
11208    }
11209
11210    unsafe impl fidl::encoding::TypeMarker for DebugStartedPayload {
11211        type Owned = Self;
11212
11213        #[inline(always)]
11214        fn inline_align(_context: fidl::encoding::Context) -> usize {
11215            8
11216        }
11217
11218        #[inline(always)]
11219        fn inline_size(_context: fidl::encoding::Context) -> usize {
11220            16
11221        }
11222    }
11223
11224    unsafe impl
11225        fidl::encoding::Encode<DebugStartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>
11226        for &mut DebugStartedPayload
11227    {
11228        unsafe fn encode(
11229            self,
11230            encoder: &mut fidl::encoding::Encoder<
11231                '_,
11232                fidl::encoding::DefaultFuchsiaResourceDialect,
11233            >,
11234            offset: usize,
11235            mut depth: fidl::encoding::Depth,
11236        ) -> fidl::Result<()> {
11237            encoder.debug_check_bounds::<DebugStartedPayload>(offset);
11238            // Vector header
11239            let max_ordinal: u64 = self.max_ordinal_present();
11240            encoder.write_num(max_ordinal, offset);
11241            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11242            // Calling encoder.out_of_line_offset(0) is not allowed.
11243            if max_ordinal == 0 {
11244                return Ok(());
11245            }
11246            depth.increment()?;
11247            let envelope_size = 8;
11248            let bytes_len = max_ordinal as usize * envelope_size;
11249            #[allow(unused_variables)]
11250            let offset = encoder.out_of_line_offset(bytes_len);
11251            let mut _prev_end_offset: usize = 0;
11252            if 1 > max_ordinal {
11253                return Ok(());
11254            }
11255
11256            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11257            // are envelope_size bytes.
11258            let cur_offset: usize = (1 - 1) * envelope_size;
11259
11260            // Zero reserved fields.
11261            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11262
11263            // Safety:
11264            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11265            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11266            //   envelope_size bytes, there is always sufficient room.
11267            fidl::encoding::encode_in_envelope_optional::<
11268                fidl::encoding::Endpoint<
11269                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11270                >,
11271                fidl::encoding::DefaultFuchsiaResourceDialect,
11272            >(
11273                self.runtime_dir.as_mut().map(
11274                    <fidl::encoding::Endpoint<
11275                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11276                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11277                ),
11278                encoder,
11279                offset + cur_offset,
11280                depth,
11281            )?;
11282
11283            _prev_end_offset = cur_offset + envelope_size;
11284            if 2 > max_ordinal {
11285                return Ok(());
11286            }
11287
11288            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11289            // are envelope_size bytes.
11290            let cur_offset: usize = (2 - 1) * envelope_size;
11291
11292            // Zero reserved fields.
11293            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11294
11295            // Safety:
11296            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11297            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11298            //   envelope_size bytes, there is always sufficient room.
11299            fidl::encoding::encode_in_envelope_optional::<
11300                fidl::encoding::HandleType<
11301                    fidl::EventPair,
11302                    { fidl::ObjectType::EVENTPAIR.into_raw() },
11303                    2147483648,
11304                >,
11305                fidl::encoding::DefaultFuchsiaResourceDialect,
11306            >(
11307                self.break_on_start.as_mut().map(
11308                    <fidl::encoding::HandleType<
11309                        fidl::EventPair,
11310                        { fidl::ObjectType::EVENTPAIR.into_raw() },
11311                        2147483648,
11312                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11313                ),
11314                encoder,
11315                offset + cur_offset,
11316                depth,
11317            )?;
11318
11319            _prev_end_offset = cur_offset + envelope_size;
11320
11321            Ok(())
11322        }
11323    }
11324
11325    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11326        for DebugStartedPayload
11327    {
11328        #[inline(always)]
11329        fn new_empty() -> Self {
11330            Self::default()
11331        }
11332
11333        unsafe fn decode(
11334            &mut self,
11335            decoder: &mut fidl::encoding::Decoder<
11336                '_,
11337                fidl::encoding::DefaultFuchsiaResourceDialect,
11338            >,
11339            offset: usize,
11340            mut depth: fidl::encoding::Depth,
11341        ) -> fidl::Result<()> {
11342            decoder.debug_check_bounds::<Self>(offset);
11343            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11344                None => return Err(fidl::Error::NotNullable),
11345                Some(len) => len,
11346            };
11347            // Calling decoder.out_of_line_offset(0) is not allowed.
11348            if len == 0 {
11349                return Ok(());
11350            };
11351            depth.increment()?;
11352            let envelope_size = 8;
11353            let bytes_len = len * envelope_size;
11354            let offset = decoder.out_of_line_offset(bytes_len)?;
11355            // Decode the envelope for each type.
11356            let mut _next_ordinal_to_read = 0;
11357            let mut next_offset = offset;
11358            let end_offset = offset + bytes_len;
11359            _next_ordinal_to_read += 1;
11360            if next_offset >= end_offset {
11361                return Ok(());
11362            }
11363
11364            // Decode unknown envelopes for gaps in ordinals.
11365            while _next_ordinal_to_read < 1 {
11366                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11367                _next_ordinal_to_read += 1;
11368                next_offset += envelope_size;
11369            }
11370
11371            let next_out_of_line = decoder.next_out_of_line();
11372            let handles_before = decoder.remaining_handles();
11373            if let Some((inlined, num_bytes, num_handles)) =
11374                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11375            {
11376                let member_inline_size = <fidl::encoding::Endpoint<
11377                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11378                > as fidl::encoding::TypeMarker>::inline_size(
11379                    decoder.context
11380                );
11381                if inlined != (member_inline_size <= 4) {
11382                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11383                }
11384                let inner_offset;
11385                let mut inner_depth = depth.clone();
11386                if inlined {
11387                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11388                    inner_offset = next_offset;
11389                } else {
11390                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11391                    inner_depth.increment()?;
11392                }
11393                let val_ref = self.runtime_dir.get_or_insert_with(|| {
11394                    fidl::new_empty!(
11395                        fidl::encoding::Endpoint<
11396                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11397                        >,
11398                        fidl::encoding::DefaultFuchsiaResourceDialect
11399                    )
11400                });
11401                fidl::decode!(
11402                    fidl::encoding::Endpoint<
11403                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11404                    >,
11405                    fidl::encoding::DefaultFuchsiaResourceDialect,
11406                    val_ref,
11407                    decoder,
11408                    inner_offset,
11409                    inner_depth
11410                )?;
11411                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11412                {
11413                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11414                }
11415                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11416                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11417                }
11418            }
11419
11420            next_offset += envelope_size;
11421            _next_ordinal_to_read += 1;
11422            if next_offset >= end_offset {
11423                return Ok(());
11424            }
11425
11426            // Decode unknown envelopes for gaps in ordinals.
11427            while _next_ordinal_to_read < 2 {
11428                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11429                _next_ordinal_to_read += 1;
11430                next_offset += envelope_size;
11431            }
11432
11433            let next_out_of_line = decoder.next_out_of_line();
11434            let handles_before = decoder.remaining_handles();
11435            if let Some((inlined, num_bytes, num_handles)) =
11436                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11437            {
11438                let member_inline_size = <fidl::encoding::HandleType<
11439                    fidl::EventPair,
11440                    { fidl::ObjectType::EVENTPAIR.into_raw() },
11441                    2147483648,
11442                > as fidl::encoding::TypeMarker>::inline_size(
11443                    decoder.context
11444                );
11445                if inlined != (member_inline_size <= 4) {
11446                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11447                }
11448                let inner_offset;
11449                let mut inner_depth = depth.clone();
11450                if inlined {
11451                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11452                    inner_offset = next_offset;
11453                } else {
11454                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11455                    inner_depth.increment()?;
11456                }
11457                let val_ref =
11458                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));
11459                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11460                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11461                {
11462                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11463                }
11464                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11465                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11466                }
11467            }
11468
11469            next_offset += envelope_size;
11470
11471            // Decode the remaining unknown envelopes.
11472            while next_offset < end_offset {
11473                _next_ordinal_to_read += 1;
11474                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11475                next_offset += envelope_size;
11476            }
11477
11478            Ok(())
11479        }
11480    }
11481
11482    impl Event {
11483        #[inline(always)]
11484        fn max_ordinal_present(&self) -> u64 {
11485            if let Some(_) = self.payload {
11486                return 2;
11487            }
11488            if let Some(_) = self.header {
11489                return 1;
11490            }
11491            0
11492        }
11493    }
11494
11495    impl fidl::encoding::ResourceTypeMarker for Event {
11496        type Borrowed<'a> = &'a mut Self;
11497        fn take_or_borrow<'a>(
11498            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11499        ) -> Self::Borrowed<'a> {
11500            value
11501        }
11502    }
11503
11504    unsafe impl fidl::encoding::TypeMarker for Event {
11505        type Owned = Self;
11506
11507        #[inline(always)]
11508        fn inline_align(_context: fidl::encoding::Context) -> usize {
11509            8
11510        }
11511
11512        #[inline(always)]
11513        fn inline_size(_context: fidl::encoding::Context) -> usize {
11514            16
11515        }
11516    }
11517
11518    unsafe impl fidl::encoding::Encode<Event, fidl::encoding::DefaultFuchsiaResourceDialect>
11519        for &mut Event
11520    {
11521        unsafe fn encode(
11522            self,
11523            encoder: &mut fidl::encoding::Encoder<
11524                '_,
11525                fidl::encoding::DefaultFuchsiaResourceDialect,
11526            >,
11527            offset: usize,
11528            mut depth: fidl::encoding::Depth,
11529        ) -> fidl::Result<()> {
11530            encoder.debug_check_bounds::<Event>(offset);
11531            // Vector header
11532            let max_ordinal: u64 = self.max_ordinal_present();
11533            encoder.write_num(max_ordinal, offset);
11534            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11535            // Calling encoder.out_of_line_offset(0) is not allowed.
11536            if max_ordinal == 0 {
11537                return Ok(());
11538            }
11539            depth.increment()?;
11540            let envelope_size = 8;
11541            let bytes_len = max_ordinal as usize * envelope_size;
11542            #[allow(unused_variables)]
11543            let offset = encoder.out_of_line_offset(bytes_len);
11544            let mut _prev_end_offset: usize = 0;
11545            if 1 > max_ordinal {
11546                return Ok(());
11547            }
11548
11549            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11550            // are envelope_size bytes.
11551            let cur_offset: usize = (1 - 1) * envelope_size;
11552
11553            // Zero reserved fields.
11554            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11555
11556            // Safety:
11557            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11558            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11559            //   envelope_size bytes, there is always sufficient room.
11560            fidl::encoding::encode_in_envelope_optional::<
11561                EventHeader,
11562                fidl::encoding::DefaultFuchsiaResourceDialect,
11563            >(
11564                self.header.as_ref().map(<EventHeader as fidl::encoding::ValueTypeMarker>::borrow),
11565                encoder,
11566                offset + cur_offset,
11567                depth,
11568            )?;
11569
11570            _prev_end_offset = cur_offset + envelope_size;
11571            if 2 > max_ordinal {
11572                return Ok(());
11573            }
11574
11575            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11576            // are envelope_size bytes.
11577            let cur_offset: usize = (2 - 1) * envelope_size;
11578
11579            // Zero reserved fields.
11580            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11581
11582            // Safety:
11583            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11584            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11585            //   envelope_size bytes, there is always sufficient room.
11586            fidl::encoding::encode_in_envelope_optional::<
11587                EventPayload,
11588                fidl::encoding::DefaultFuchsiaResourceDialect,
11589            >(
11590                self.payload
11591                    .as_mut()
11592                    .map(<EventPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11593                encoder,
11594                offset + cur_offset,
11595                depth,
11596            )?;
11597
11598            _prev_end_offset = cur_offset + envelope_size;
11599
11600            Ok(())
11601        }
11602    }
11603
11604    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Event {
11605        #[inline(always)]
11606        fn new_empty() -> Self {
11607            Self::default()
11608        }
11609
11610        unsafe fn decode(
11611            &mut self,
11612            decoder: &mut fidl::encoding::Decoder<
11613                '_,
11614                fidl::encoding::DefaultFuchsiaResourceDialect,
11615            >,
11616            offset: usize,
11617            mut depth: fidl::encoding::Depth,
11618        ) -> fidl::Result<()> {
11619            decoder.debug_check_bounds::<Self>(offset);
11620            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11621                None => return Err(fidl::Error::NotNullable),
11622                Some(len) => len,
11623            };
11624            // Calling decoder.out_of_line_offset(0) is not allowed.
11625            if len == 0 {
11626                return Ok(());
11627            };
11628            depth.increment()?;
11629            let envelope_size = 8;
11630            let bytes_len = len * envelope_size;
11631            let offset = decoder.out_of_line_offset(bytes_len)?;
11632            // Decode the envelope for each type.
11633            let mut _next_ordinal_to_read = 0;
11634            let mut next_offset = offset;
11635            let end_offset = offset + bytes_len;
11636            _next_ordinal_to_read += 1;
11637            if next_offset >= end_offset {
11638                return Ok(());
11639            }
11640
11641            // Decode unknown envelopes for gaps in ordinals.
11642            while _next_ordinal_to_read < 1 {
11643                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11644                _next_ordinal_to_read += 1;
11645                next_offset += envelope_size;
11646            }
11647
11648            let next_out_of_line = decoder.next_out_of_line();
11649            let handles_before = decoder.remaining_handles();
11650            if let Some((inlined, num_bytes, num_handles)) =
11651                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11652            {
11653                let member_inline_size =
11654                    <EventHeader as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11655                if inlined != (member_inline_size <= 4) {
11656                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11657                }
11658                let inner_offset;
11659                let mut inner_depth = depth.clone();
11660                if inlined {
11661                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11662                    inner_offset = next_offset;
11663                } else {
11664                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11665                    inner_depth.increment()?;
11666                }
11667                let val_ref = self.header.get_or_insert_with(|| {
11668                    fidl::new_empty!(EventHeader, fidl::encoding::DefaultFuchsiaResourceDialect)
11669                });
11670                fidl::decode!(
11671                    EventHeader,
11672                    fidl::encoding::DefaultFuchsiaResourceDialect,
11673                    val_ref,
11674                    decoder,
11675                    inner_offset,
11676                    inner_depth
11677                )?;
11678                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11679                {
11680                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11681                }
11682                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11683                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11684                }
11685            }
11686
11687            next_offset += envelope_size;
11688            _next_ordinal_to_read += 1;
11689            if next_offset >= end_offset {
11690                return Ok(());
11691            }
11692
11693            // Decode unknown envelopes for gaps in ordinals.
11694            while _next_ordinal_to_read < 2 {
11695                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11696                _next_ordinal_to_read += 1;
11697                next_offset += envelope_size;
11698            }
11699
11700            let next_out_of_line = decoder.next_out_of_line();
11701            let handles_before = decoder.remaining_handles();
11702            if let Some((inlined, num_bytes, num_handles)) =
11703                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11704            {
11705                let member_inline_size =
11706                    <EventPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11707                if inlined != (member_inline_size <= 4) {
11708                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11709                }
11710                let inner_offset;
11711                let mut inner_depth = depth.clone();
11712                if inlined {
11713                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11714                    inner_offset = next_offset;
11715                } else {
11716                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11717                    inner_depth.increment()?;
11718                }
11719                let val_ref = self.payload.get_or_insert_with(|| {
11720                    fidl::new_empty!(EventPayload, fidl::encoding::DefaultFuchsiaResourceDialect)
11721                });
11722                fidl::decode!(
11723                    EventPayload,
11724                    fidl::encoding::DefaultFuchsiaResourceDialect,
11725                    val_ref,
11726                    decoder,
11727                    inner_offset,
11728                    inner_depth
11729                )?;
11730                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11731                {
11732                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11733                }
11734                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11735                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11736                }
11737            }
11738
11739            next_offset += envelope_size;
11740
11741            // Decode the remaining unknown envelopes.
11742            while next_offset < end_offset {
11743                _next_ordinal_to_read += 1;
11744                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11745                next_offset += envelope_size;
11746            }
11747
11748            Ok(())
11749        }
11750    }
11751
11752    impl NamespaceEntry {
11753        #[inline(always)]
11754        fn max_ordinal_present(&self) -> u64 {
11755            if let Some(_) = self.directory {
11756                return 2;
11757            }
11758            if let Some(_) = self.path {
11759                return 1;
11760            }
11761            0
11762        }
11763    }
11764
11765    impl fidl::encoding::ResourceTypeMarker for NamespaceEntry {
11766        type Borrowed<'a> = &'a mut Self;
11767        fn take_or_borrow<'a>(
11768            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11769        ) -> Self::Borrowed<'a> {
11770            value
11771        }
11772    }
11773
11774    unsafe impl fidl::encoding::TypeMarker for NamespaceEntry {
11775        type Owned = Self;
11776
11777        #[inline(always)]
11778        fn inline_align(_context: fidl::encoding::Context) -> usize {
11779            8
11780        }
11781
11782        #[inline(always)]
11783        fn inline_size(_context: fidl::encoding::Context) -> usize {
11784            16
11785        }
11786    }
11787
11788    unsafe impl
11789        fidl::encoding::Encode<NamespaceEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
11790        for &mut NamespaceEntry
11791    {
11792        unsafe fn encode(
11793            self,
11794            encoder: &mut fidl::encoding::Encoder<
11795                '_,
11796                fidl::encoding::DefaultFuchsiaResourceDialect,
11797            >,
11798            offset: usize,
11799            mut depth: fidl::encoding::Depth,
11800        ) -> fidl::Result<()> {
11801            encoder.debug_check_bounds::<NamespaceEntry>(offset);
11802            // Vector header
11803            let max_ordinal: u64 = self.max_ordinal_present();
11804            encoder.write_num(max_ordinal, offset);
11805            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11806            // Calling encoder.out_of_line_offset(0) is not allowed.
11807            if max_ordinal == 0 {
11808                return Ok(());
11809            }
11810            depth.increment()?;
11811            let envelope_size = 8;
11812            let bytes_len = max_ordinal as usize * envelope_size;
11813            #[allow(unused_variables)]
11814            let offset = encoder.out_of_line_offset(bytes_len);
11815            let mut _prev_end_offset: usize = 0;
11816            if 1 > max_ordinal {
11817                return Ok(());
11818            }
11819
11820            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11821            // are envelope_size bytes.
11822            let cur_offset: usize = (1 - 1) * envelope_size;
11823
11824            // Zero reserved fields.
11825            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11826
11827            // Safety:
11828            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11829            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11830            //   envelope_size bytes, there is always sufficient room.
11831            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4095>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11832            self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
11833            encoder, offset + cur_offset, depth
11834        )?;
11835
11836            _prev_end_offset = cur_offset + envelope_size;
11837            if 2 > max_ordinal {
11838                return Ok(());
11839            }
11840
11841            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11842            // are envelope_size bytes.
11843            let cur_offset: usize = (2 - 1) * envelope_size;
11844
11845            // Zero reserved fields.
11846            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11847
11848            // Safety:
11849            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11850            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11851            //   envelope_size bytes, there is always sufficient room.
11852            fidl::encoding::encode_in_envelope_optional::<
11853                fidl::encoding::Endpoint<
11854                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11855                >,
11856                fidl::encoding::DefaultFuchsiaResourceDialect,
11857            >(
11858                self.directory.as_mut().map(
11859                    <fidl::encoding::Endpoint<
11860                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11861                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11862                ),
11863                encoder,
11864                offset + cur_offset,
11865                depth,
11866            )?;
11867
11868            _prev_end_offset = cur_offset + envelope_size;
11869
11870            Ok(())
11871        }
11872    }
11873
11874    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11875        for NamespaceEntry
11876    {
11877        #[inline(always)]
11878        fn new_empty() -> Self {
11879            Self::default()
11880        }
11881
11882        unsafe fn decode(
11883            &mut self,
11884            decoder: &mut fidl::encoding::Decoder<
11885                '_,
11886                fidl::encoding::DefaultFuchsiaResourceDialect,
11887            >,
11888            offset: usize,
11889            mut depth: fidl::encoding::Depth,
11890        ) -> fidl::Result<()> {
11891            decoder.debug_check_bounds::<Self>(offset);
11892            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11893                None => return Err(fidl::Error::NotNullable),
11894                Some(len) => len,
11895            };
11896            // Calling decoder.out_of_line_offset(0) is not allowed.
11897            if len == 0 {
11898                return Ok(());
11899            };
11900            depth.increment()?;
11901            let envelope_size = 8;
11902            let bytes_len = len * envelope_size;
11903            let offset = decoder.out_of_line_offset(bytes_len)?;
11904            // Decode the envelope for each type.
11905            let mut _next_ordinal_to_read = 0;
11906            let mut next_offset = offset;
11907            let end_offset = offset + bytes_len;
11908            _next_ordinal_to_read += 1;
11909            if next_offset >= end_offset {
11910                return Ok(());
11911            }
11912
11913            // Decode unknown envelopes for gaps in ordinals.
11914            while _next_ordinal_to_read < 1 {
11915                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11916                _next_ordinal_to_read += 1;
11917                next_offset += envelope_size;
11918            }
11919
11920            let next_out_of_line = decoder.next_out_of_line();
11921            let handles_before = decoder.remaining_handles();
11922            if let Some((inlined, num_bytes, num_handles)) =
11923                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11924            {
11925                let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11926                if inlined != (member_inline_size <= 4) {
11927                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11928                }
11929                let inner_offset;
11930                let mut inner_depth = depth.clone();
11931                if inlined {
11932                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11933                    inner_offset = next_offset;
11934                } else {
11935                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11936                    inner_depth.increment()?;
11937                }
11938                let val_ref = self.path.get_or_insert_with(|| {
11939                    fidl::new_empty!(
11940                        fidl::encoding::BoundedString<4095>,
11941                        fidl::encoding::DefaultFuchsiaResourceDialect
11942                    )
11943                });
11944                fidl::decode!(
11945                    fidl::encoding::BoundedString<4095>,
11946                    fidl::encoding::DefaultFuchsiaResourceDialect,
11947                    val_ref,
11948                    decoder,
11949                    inner_offset,
11950                    inner_depth
11951                )?;
11952                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11953                {
11954                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11955                }
11956                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11957                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11958                }
11959            }
11960
11961            next_offset += envelope_size;
11962            _next_ordinal_to_read += 1;
11963            if next_offset >= end_offset {
11964                return Ok(());
11965            }
11966
11967            // Decode unknown envelopes for gaps in ordinals.
11968            while _next_ordinal_to_read < 2 {
11969                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11970                _next_ordinal_to_read += 1;
11971                next_offset += envelope_size;
11972            }
11973
11974            let next_out_of_line = decoder.next_out_of_line();
11975            let handles_before = decoder.remaining_handles();
11976            if let Some((inlined, num_bytes, num_handles)) =
11977                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11978            {
11979                let member_inline_size = <fidl::encoding::Endpoint<
11980                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11981                > as fidl::encoding::TypeMarker>::inline_size(
11982                    decoder.context
11983                );
11984                if inlined != (member_inline_size <= 4) {
11985                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11986                }
11987                let inner_offset;
11988                let mut inner_depth = depth.clone();
11989                if inlined {
11990                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11991                    inner_offset = next_offset;
11992                } else {
11993                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11994                    inner_depth.increment()?;
11995                }
11996                let val_ref = self.directory.get_or_insert_with(|| {
11997                    fidl::new_empty!(
11998                        fidl::encoding::Endpoint<
11999                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12000                        >,
12001                        fidl::encoding::DefaultFuchsiaResourceDialect
12002                    )
12003                });
12004                fidl::decode!(
12005                    fidl::encoding::Endpoint<
12006                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12007                    >,
12008                    fidl::encoding::DefaultFuchsiaResourceDialect,
12009                    val_ref,
12010                    decoder,
12011                    inner_offset,
12012                    inner_depth
12013                )?;
12014                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12015                {
12016                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12017                }
12018                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12019                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12020                }
12021            }
12022
12023            next_offset += envelope_size;
12024
12025            // Decode the remaining unknown envelopes.
12026            while next_offset < end_offset {
12027                _next_ordinal_to_read += 1;
12028                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12029                next_offset += envelope_size;
12030            }
12031
12032            Ok(())
12033        }
12034    }
12035
12036    impl StartChildArgs {
12037        #[inline(always)]
12038        fn max_ordinal_present(&self) -> u64 {
12039            if let Some(_) = self.dictionary {
12040                return 3;
12041            }
12042            if let Some(_) = self.namespace_entries {
12043                return 2;
12044            }
12045            if let Some(_) = self.numbered_handles {
12046                return 1;
12047            }
12048            0
12049        }
12050    }
12051
12052    impl fidl::encoding::ResourceTypeMarker for StartChildArgs {
12053        type Borrowed<'a> = &'a mut Self;
12054        fn take_or_borrow<'a>(
12055            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12056        ) -> Self::Borrowed<'a> {
12057            value
12058        }
12059    }
12060
12061    unsafe impl fidl::encoding::TypeMarker for StartChildArgs {
12062        type Owned = Self;
12063
12064        #[inline(always)]
12065        fn inline_align(_context: fidl::encoding::Context) -> usize {
12066            8
12067        }
12068
12069        #[inline(always)]
12070        fn inline_size(_context: fidl::encoding::Context) -> usize {
12071            16
12072        }
12073    }
12074
12075    unsafe impl
12076        fidl::encoding::Encode<StartChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
12077        for &mut StartChildArgs
12078    {
12079        unsafe fn encode(
12080            self,
12081            encoder: &mut fidl::encoding::Encoder<
12082                '_,
12083                fidl::encoding::DefaultFuchsiaResourceDialect,
12084            >,
12085            offset: usize,
12086            mut depth: fidl::encoding::Depth,
12087        ) -> fidl::Result<()> {
12088            encoder.debug_check_bounds::<StartChildArgs>(offset);
12089            // Vector header
12090            let max_ordinal: u64 = self.max_ordinal_present();
12091            encoder.write_num(max_ordinal, offset);
12092            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12093            // Calling encoder.out_of_line_offset(0) is not allowed.
12094            if max_ordinal == 0 {
12095                return Ok(());
12096            }
12097            depth.increment()?;
12098            let envelope_size = 8;
12099            let bytes_len = max_ordinal as usize * envelope_size;
12100            #[allow(unused_variables)]
12101            let offset = encoder.out_of_line_offset(bytes_len);
12102            let mut _prev_end_offset: usize = 0;
12103            if 1 > max_ordinal {
12104                return Ok(());
12105            }
12106
12107            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12108            // are envelope_size bytes.
12109            let cur_offset: usize = (1 - 1) * envelope_size;
12110
12111            // Zero reserved fields.
12112            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12113
12114            // Safety:
12115            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12116            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12117            //   envelope_size bytes, there is always sufficient room.
12118            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12119            self.numbered_handles.as_mut().map(<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12120            encoder, offset + cur_offset, depth
12121        )?;
12122
12123            _prev_end_offset = cur_offset + envelope_size;
12124            if 2 > max_ordinal {
12125                return Ok(());
12126            }
12127
12128            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12129            // are envelope_size bytes.
12130            let cur_offset: usize = (2 - 1) * envelope_size;
12131
12132            // Zero reserved fields.
12133            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12134
12135            // Safety:
12136            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12137            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12138            //   envelope_size bytes, there is always sufficient room.
12139            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12140            self.namespace_entries.as_mut().map(<fidl::encoding::Vector<NamespaceEntry, 32> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12141            encoder, offset + cur_offset, depth
12142        )?;
12143
12144            _prev_end_offset = cur_offset + envelope_size;
12145            if 3 > max_ordinal {
12146                return Ok(());
12147            }
12148
12149            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12150            // are envelope_size bytes.
12151            let cur_offset: usize = (3 - 1) * envelope_size;
12152
12153            // Zero reserved fields.
12154            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12155
12156            // Safety:
12157            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12158            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12159            //   envelope_size bytes, there is always sufficient room.
12160            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
12161            self.dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12162            encoder, offset + cur_offset, depth
12163        )?;
12164
12165            _prev_end_offset = cur_offset + envelope_size;
12166
12167            Ok(())
12168        }
12169    }
12170
12171    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12172        for StartChildArgs
12173    {
12174        #[inline(always)]
12175        fn new_empty() -> Self {
12176            Self::default()
12177        }
12178
12179        unsafe fn decode(
12180            &mut self,
12181            decoder: &mut fidl::encoding::Decoder<
12182                '_,
12183                fidl::encoding::DefaultFuchsiaResourceDialect,
12184            >,
12185            offset: usize,
12186            mut depth: fidl::encoding::Depth,
12187        ) -> fidl::Result<()> {
12188            decoder.debug_check_bounds::<Self>(offset);
12189            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12190                None => return Err(fidl::Error::NotNullable),
12191                Some(len) => len,
12192            };
12193            // Calling decoder.out_of_line_offset(0) is not allowed.
12194            if len == 0 {
12195                return Ok(());
12196            };
12197            depth.increment()?;
12198            let envelope_size = 8;
12199            let bytes_len = len * envelope_size;
12200            let offset = decoder.out_of_line_offset(bytes_len)?;
12201            // Decode the envelope for each type.
12202            let mut _next_ordinal_to_read = 0;
12203            let mut next_offset = offset;
12204            let end_offset = offset + bytes_len;
12205            _next_ordinal_to_read += 1;
12206            if next_offset >= end_offset {
12207                return Ok(());
12208            }
12209
12210            // Decode unknown envelopes for gaps in ordinals.
12211            while _next_ordinal_to_read < 1 {
12212                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12213                _next_ordinal_to_read += 1;
12214                next_offset += envelope_size;
12215            }
12216
12217            let next_out_of_line = decoder.next_out_of_line();
12218            let handles_before = decoder.remaining_handles();
12219            if let Some((inlined, num_bytes, num_handles)) =
12220                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12221            {
12222                let member_inline_size = <fidl::encoding::Vector<
12223                    fidl_fuchsia_process::HandleInfo,
12224                    128,
12225                > as fidl::encoding::TypeMarker>::inline_size(
12226                    decoder.context
12227                );
12228                if inlined != (member_inline_size <= 4) {
12229                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12230                }
12231                let inner_offset;
12232                let mut inner_depth = depth.clone();
12233                if inlined {
12234                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12235                    inner_offset = next_offset;
12236                } else {
12237                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12238                    inner_depth.increment()?;
12239                }
12240                let val_ref =
12241                self.numbered_handles.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
12242                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12243                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12244                {
12245                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12246                }
12247                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12248                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12249                }
12250            }
12251
12252            next_offset += envelope_size;
12253            _next_ordinal_to_read += 1;
12254            if next_offset >= end_offset {
12255                return Ok(());
12256            }
12257
12258            // Decode unknown envelopes for gaps in ordinals.
12259            while _next_ordinal_to_read < 2 {
12260                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12261                _next_ordinal_to_read += 1;
12262                next_offset += envelope_size;
12263            }
12264
12265            let next_out_of_line = decoder.next_out_of_line();
12266            let handles_before = decoder.remaining_handles();
12267            if let Some((inlined, num_bytes, num_handles)) =
12268                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12269            {
12270                let member_inline_size = <fidl::encoding::Vector<NamespaceEntry, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12271                if inlined != (member_inline_size <= 4) {
12272                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12273                }
12274                let inner_offset;
12275                let mut inner_depth = depth.clone();
12276                if inlined {
12277                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12278                    inner_offset = next_offset;
12279                } else {
12280                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12281                    inner_depth.increment()?;
12282                }
12283                let val_ref =
12284                self.namespace_entries.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
12285                fidl::decode!(fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12286                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12287                {
12288                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12289                }
12290                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12291                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12292                }
12293            }
12294
12295            next_offset += envelope_size;
12296            _next_ordinal_to_read += 1;
12297            if next_offset >= end_offset {
12298                return Ok(());
12299            }
12300
12301            // Decode unknown envelopes for gaps in ordinals.
12302            while _next_ordinal_to_read < 3 {
12303                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12304                _next_ordinal_to_read += 1;
12305                next_offset += envelope_size;
12306            }
12307
12308            let next_out_of_line = decoder.next_out_of_line();
12309            let handles_before = decoder.remaining_handles();
12310            if let Some((inlined, num_bytes, num_handles)) =
12311                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12312            {
12313                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12314                if inlined != (member_inline_size <= 4) {
12315                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12316                }
12317                let inner_offset;
12318                let mut inner_depth = depth.clone();
12319                if inlined {
12320                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12321                    inner_offset = next_offset;
12322                } else {
12323                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12324                    inner_depth.increment()?;
12325                }
12326                let val_ref = self.dictionary.get_or_insert_with(|| {
12327                    fidl::new_empty!(
12328                        fidl_fuchsia_component_sandbox::DictionaryRef,
12329                        fidl::encoding::DefaultFuchsiaResourceDialect
12330                    )
12331                });
12332                fidl::decode!(
12333                    fidl_fuchsia_component_sandbox::DictionaryRef,
12334                    fidl::encoding::DefaultFuchsiaResourceDialect,
12335                    val_ref,
12336                    decoder,
12337                    inner_offset,
12338                    inner_depth
12339                )?;
12340                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12341                {
12342                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12343                }
12344                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12345                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12346                }
12347            }
12348
12349            next_offset += envelope_size;
12350
12351            // Decode the remaining unknown envelopes.
12352            while next_offset < end_offset {
12353                _next_ordinal_to_read += 1;
12354                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12355                next_offset += envelope_size;
12356            }
12357
12358            Ok(())
12359        }
12360    }
12361
12362    impl fidl::encoding::ResourceTypeMarker for EventPayload {
12363        type Borrowed<'a> = &'a mut Self;
12364        fn take_or_borrow<'a>(
12365            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12366        ) -> Self::Borrowed<'a> {
12367            value
12368        }
12369    }
12370
12371    unsafe impl fidl::encoding::TypeMarker for EventPayload {
12372        type Owned = Self;
12373
12374        #[inline(always)]
12375        fn inline_align(_context: fidl::encoding::Context) -> usize {
12376            8
12377        }
12378
12379        #[inline(always)]
12380        fn inline_size(_context: fidl::encoding::Context) -> usize {
12381            16
12382        }
12383    }
12384
12385    unsafe impl fidl::encoding::Encode<EventPayload, fidl::encoding::DefaultFuchsiaResourceDialect>
12386        for &mut EventPayload
12387    {
12388        #[inline]
12389        unsafe fn encode(
12390            self,
12391            encoder: &mut fidl::encoding::Encoder<
12392                '_,
12393                fidl::encoding::DefaultFuchsiaResourceDialect,
12394            >,
12395            offset: usize,
12396            _depth: fidl::encoding::Depth,
12397        ) -> fidl::Result<()> {
12398            encoder.debug_check_bounds::<EventPayload>(offset);
12399            encoder.write_num::<u64>(self.ordinal(), offset);
12400            match self {
12401            EventPayload::CapabilityRequested(ref mut val) => {
12402                fidl::encoding::encode_in_envelope::<CapabilityRequestedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12403                    <CapabilityRequestedPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
12404                    encoder, offset + 8, _depth
12405                )
12406            }
12407            EventPayload::Purged(ref val) => {
12408                fidl::encoding::encode_in_envelope::<PurgedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12409                    <PurgedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12410                    encoder, offset + 8, _depth
12411                )
12412            }
12413            EventPayload::Discovered(ref val) => {
12414                fidl::encoding::encode_in_envelope::<DiscoveredPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12415                    <DiscoveredPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12416                    encoder, offset + 8, _depth
12417                )
12418            }
12419            EventPayload::Destroyed(ref val) => {
12420                fidl::encoding::encode_in_envelope::<DestroyedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12421                    <DestroyedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12422                    encoder, offset + 8, _depth
12423                )
12424            }
12425            EventPayload::Resolved(ref val) => {
12426                fidl::encoding::encode_in_envelope::<ResolvedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12427                    <ResolvedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12428                    encoder, offset + 8, _depth
12429                )
12430            }
12431            EventPayload::Started(ref val) => {
12432                fidl::encoding::encode_in_envelope::<StartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12433                    <StartedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12434                    encoder, offset + 8, _depth
12435                )
12436            }
12437            EventPayload::Stopped(ref val) => {
12438                fidl::encoding::encode_in_envelope::<StoppedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12439                    <StoppedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12440                    encoder, offset + 8, _depth
12441                )
12442            }
12443            EventPayload::DebugStarted(ref mut val) => {
12444                fidl::encoding::encode_in_envelope::<DebugStartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12445                    <DebugStartedPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
12446                    encoder, offset + 8, _depth
12447                )
12448            }
12449            EventPayload::Unresolved(ref val) => {
12450                fidl::encoding::encode_in_envelope::<UnresolvedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12451                    <UnresolvedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12452                    encoder, offset + 8, _depth
12453                )
12454            }
12455            EventPayload::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
12456        }
12457        }
12458    }
12459
12460    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for EventPayload {
12461        #[inline(always)]
12462        fn new_empty() -> Self {
12463            Self::__SourceBreaking { unknown_ordinal: 0 }
12464        }
12465
12466        #[inline]
12467        unsafe fn decode(
12468            &mut self,
12469            decoder: &mut fidl::encoding::Decoder<
12470                '_,
12471                fidl::encoding::DefaultFuchsiaResourceDialect,
12472            >,
12473            offset: usize,
12474            mut depth: fidl::encoding::Depth,
12475        ) -> fidl::Result<()> {
12476            decoder.debug_check_bounds::<Self>(offset);
12477            #[allow(unused_variables)]
12478            let next_out_of_line = decoder.next_out_of_line();
12479            let handles_before = decoder.remaining_handles();
12480            let (ordinal, inlined, num_bytes, num_handles) =
12481                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
12482
12483            let member_inline_size = match ordinal {
12484                1 => <CapabilityRequestedPayload as fidl::encoding::TypeMarker>::inline_size(
12485                    decoder.context,
12486                ),
12487                2 => <PurgedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12488                4 => {
12489                    <DiscoveredPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context)
12490                }
12491                5 => <DestroyedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12492                6 => <ResolvedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12493                7 => <StartedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12494                8 => <StoppedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12495                9 => <DebugStartedPayload as fidl::encoding::TypeMarker>::inline_size(
12496                    decoder.context,
12497                ),
12498                10 => {
12499                    <UnresolvedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context)
12500                }
12501                0 => return Err(fidl::Error::UnknownUnionTag),
12502                _ => num_bytes as usize,
12503            };
12504
12505            if inlined != (member_inline_size <= 4) {
12506                return Err(fidl::Error::InvalidInlineBitInEnvelope);
12507            }
12508            let _inner_offset;
12509            if inlined {
12510                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
12511                _inner_offset = offset + 8;
12512            } else {
12513                depth.increment()?;
12514                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12515            }
12516            match ordinal {
12517                1 => {
12518                    #[allow(irrefutable_let_patterns)]
12519                    if let EventPayload::CapabilityRequested(_) = self {
12520                        // Do nothing, read the value into the object
12521                    } else {
12522                        // Initialize `self` to the right variant
12523                        *self = EventPayload::CapabilityRequested(fidl::new_empty!(
12524                            CapabilityRequestedPayload,
12525                            fidl::encoding::DefaultFuchsiaResourceDialect
12526                        ));
12527                    }
12528                    #[allow(irrefutable_let_patterns)]
12529                    if let EventPayload::CapabilityRequested(ref mut val) = self {
12530                        fidl::decode!(
12531                            CapabilityRequestedPayload,
12532                            fidl::encoding::DefaultFuchsiaResourceDialect,
12533                            val,
12534                            decoder,
12535                            _inner_offset,
12536                            depth
12537                        )?;
12538                    } else {
12539                        unreachable!()
12540                    }
12541                }
12542                2 => {
12543                    #[allow(irrefutable_let_patterns)]
12544                    if let EventPayload::Purged(_) = self {
12545                        // Do nothing, read the value into the object
12546                    } else {
12547                        // Initialize `self` to the right variant
12548                        *self = EventPayload::Purged(fidl::new_empty!(
12549                            PurgedPayload,
12550                            fidl::encoding::DefaultFuchsiaResourceDialect
12551                        ));
12552                    }
12553                    #[allow(irrefutable_let_patterns)]
12554                    if let EventPayload::Purged(ref mut val) = self {
12555                        fidl::decode!(
12556                            PurgedPayload,
12557                            fidl::encoding::DefaultFuchsiaResourceDialect,
12558                            val,
12559                            decoder,
12560                            _inner_offset,
12561                            depth
12562                        )?;
12563                    } else {
12564                        unreachable!()
12565                    }
12566                }
12567                4 => {
12568                    #[allow(irrefutable_let_patterns)]
12569                    if let EventPayload::Discovered(_) = self {
12570                        // Do nothing, read the value into the object
12571                    } else {
12572                        // Initialize `self` to the right variant
12573                        *self = EventPayload::Discovered(fidl::new_empty!(
12574                            DiscoveredPayload,
12575                            fidl::encoding::DefaultFuchsiaResourceDialect
12576                        ));
12577                    }
12578                    #[allow(irrefutable_let_patterns)]
12579                    if let EventPayload::Discovered(ref mut val) = self {
12580                        fidl::decode!(
12581                            DiscoveredPayload,
12582                            fidl::encoding::DefaultFuchsiaResourceDialect,
12583                            val,
12584                            decoder,
12585                            _inner_offset,
12586                            depth
12587                        )?;
12588                    } else {
12589                        unreachable!()
12590                    }
12591                }
12592                5 => {
12593                    #[allow(irrefutable_let_patterns)]
12594                    if let EventPayload::Destroyed(_) = self {
12595                        // Do nothing, read the value into the object
12596                    } else {
12597                        // Initialize `self` to the right variant
12598                        *self = EventPayload::Destroyed(fidl::new_empty!(
12599                            DestroyedPayload,
12600                            fidl::encoding::DefaultFuchsiaResourceDialect
12601                        ));
12602                    }
12603                    #[allow(irrefutable_let_patterns)]
12604                    if let EventPayload::Destroyed(ref mut val) = self {
12605                        fidl::decode!(
12606                            DestroyedPayload,
12607                            fidl::encoding::DefaultFuchsiaResourceDialect,
12608                            val,
12609                            decoder,
12610                            _inner_offset,
12611                            depth
12612                        )?;
12613                    } else {
12614                        unreachable!()
12615                    }
12616                }
12617                6 => {
12618                    #[allow(irrefutable_let_patterns)]
12619                    if let EventPayload::Resolved(_) = self {
12620                        // Do nothing, read the value into the object
12621                    } else {
12622                        // Initialize `self` to the right variant
12623                        *self = EventPayload::Resolved(fidl::new_empty!(
12624                            ResolvedPayload,
12625                            fidl::encoding::DefaultFuchsiaResourceDialect
12626                        ));
12627                    }
12628                    #[allow(irrefutable_let_patterns)]
12629                    if let EventPayload::Resolved(ref mut val) = self {
12630                        fidl::decode!(
12631                            ResolvedPayload,
12632                            fidl::encoding::DefaultFuchsiaResourceDialect,
12633                            val,
12634                            decoder,
12635                            _inner_offset,
12636                            depth
12637                        )?;
12638                    } else {
12639                        unreachable!()
12640                    }
12641                }
12642                7 => {
12643                    #[allow(irrefutable_let_patterns)]
12644                    if let EventPayload::Started(_) = self {
12645                        // Do nothing, read the value into the object
12646                    } else {
12647                        // Initialize `self` to the right variant
12648                        *self = EventPayload::Started(fidl::new_empty!(
12649                            StartedPayload,
12650                            fidl::encoding::DefaultFuchsiaResourceDialect
12651                        ));
12652                    }
12653                    #[allow(irrefutable_let_patterns)]
12654                    if let EventPayload::Started(ref mut val) = self {
12655                        fidl::decode!(
12656                            StartedPayload,
12657                            fidl::encoding::DefaultFuchsiaResourceDialect,
12658                            val,
12659                            decoder,
12660                            _inner_offset,
12661                            depth
12662                        )?;
12663                    } else {
12664                        unreachable!()
12665                    }
12666                }
12667                8 => {
12668                    #[allow(irrefutable_let_patterns)]
12669                    if let EventPayload::Stopped(_) = self {
12670                        // Do nothing, read the value into the object
12671                    } else {
12672                        // Initialize `self` to the right variant
12673                        *self = EventPayload::Stopped(fidl::new_empty!(
12674                            StoppedPayload,
12675                            fidl::encoding::DefaultFuchsiaResourceDialect
12676                        ));
12677                    }
12678                    #[allow(irrefutable_let_patterns)]
12679                    if let EventPayload::Stopped(ref mut val) = self {
12680                        fidl::decode!(
12681                            StoppedPayload,
12682                            fidl::encoding::DefaultFuchsiaResourceDialect,
12683                            val,
12684                            decoder,
12685                            _inner_offset,
12686                            depth
12687                        )?;
12688                    } else {
12689                        unreachable!()
12690                    }
12691                }
12692                9 => {
12693                    #[allow(irrefutable_let_patterns)]
12694                    if let EventPayload::DebugStarted(_) = self {
12695                        // Do nothing, read the value into the object
12696                    } else {
12697                        // Initialize `self` to the right variant
12698                        *self = EventPayload::DebugStarted(fidl::new_empty!(
12699                            DebugStartedPayload,
12700                            fidl::encoding::DefaultFuchsiaResourceDialect
12701                        ));
12702                    }
12703                    #[allow(irrefutable_let_patterns)]
12704                    if let EventPayload::DebugStarted(ref mut val) = self {
12705                        fidl::decode!(
12706                            DebugStartedPayload,
12707                            fidl::encoding::DefaultFuchsiaResourceDialect,
12708                            val,
12709                            decoder,
12710                            _inner_offset,
12711                            depth
12712                        )?;
12713                    } else {
12714                        unreachable!()
12715                    }
12716                }
12717                10 => {
12718                    #[allow(irrefutable_let_patterns)]
12719                    if let EventPayload::Unresolved(_) = self {
12720                        // Do nothing, read the value into the object
12721                    } else {
12722                        // Initialize `self` to the right variant
12723                        *self = EventPayload::Unresolved(fidl::new_empty!(
12724                            UnresolvedPayload,
12725                            fidl::encoding::DefaultFuchsiaResourceDialect
12726                        ));
12727                    }
12728                    #[allow(irrefutable_let_patterns)]
12729                    if let EventPayload::Unresolved(ref mut val) = self {
12730                        fidl::decode!(
12731                            UnresolvedPayload,
12732                            fidl::encoding::DefaultFuchsiaResourceDialect,
12733                            val,
12734                            decoder,
12735                            _inner_offset,
12736                            depth
12737                        )?;
12738                    } else {
12739                        unreachable!()
12740                    }
12741                }
12742                #[allow(deprecated)]
12743                ordinal => {
12744                    for _ in 0..num_handles {
12745                        decoder.drop_next_handle()?;
12746                    }
12747                    *self = EventPayload::__SourceBreaking { unknown_ordinal: ordinal };
12748                }
12749            }
12750            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
12751                return Err(fidl::Error::InvalidNumBytesInEnvelope);
12752            }
12753            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12754                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12755            }
12756            Ok(())
12757        }
12758    }
12759}