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