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 ControllerGetOutputDictionaryResponse {
44    pub dictionary: fidl::EventPair,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
48    for ControllerGetOutputDictionaryResponse
49{
50}
51
52#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
53pub struct ControllerIsStartedResponse {
54    pub is_started: bool,
55}
56
57impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
58    for ControllerIsStartedResponse
59{
60}
61
62#[derive(Debug, PartialEq)]
63pub struct EventStreamGetNextResponse {
64    pub events: Vec<Event>,
65}
66
67impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
68    for EventStreamGetNextResponse
69{
70}
71
72#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
73pub struct IntrospectorGetMonikerRequest {
74    pub component_instance: fidl::Event,
75}
76
77impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
78    for IntrospectorGetMonikerRequest
79{
80}
81
82#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83pub struct NamespaceCreate2Request {
84    pub entries: Vec<NamespaceInputEntry2>,
85}
86
87impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceCreate2Request {}
88
89#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
90pub struct NamespaceCreateRequest {
91    pub entries: Vec<NamespaceInputEntry>,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceCreateRequest {}
95
96#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97pub struct NamespaceInputEntry {
98    pub path: String,
99    pub dictionary: fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceInputEntry {}
103
104#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct NamespaceInputEntry2 {
106    /// The path at which the entry will exist in the namespace.
107    pub path: String,
108    /// A capability (created using fuchsia.component.runtime.Capabilities) to
109    /// install in the namespace. Currently only dictionaries are supported.
110    pub capability: fidl::EventPair,
111}
112
113impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceInputEntry2 {}
114
115#[derive(Debug, PartialEq)]
116pub struct NamespaceCreate2Response {
117    pub entries: Vec<NamespaceEntry>,
118}
119
120impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceCreate2Response {}
121
122#[derive(Debug, PartialEq)]
123pub struct NamespaceCreateResponse {
124    pub entries: Vec<NamespaceEntry>,
125}
126
127impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceCreateResponse {}
128
129#[derive(Debug, PartialEq)]
130pub struct RealmCreateChildRequest {
131    pub collection: fidl_fuchsia_component_decl::CollectionRef,
132    pub decl: fidl_fuchsia_component_decl::Child,
133    pub args: CreateChildArgs,
134}
135
136impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmCreateChildRequest {}
137
138#[derive(Debug, PartialEq)]
139pub struct RealmGetChildOutputDictionaryDeprecatedRequest {
140    pub child: fidl_fuchsia_component_decl::ChildRef,
141}
142
143impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
144    for RealmGetChildOutputDictionaryDeprecatedRequest
145{
146}
147
148#[derive(Debug, PartialEq)]
149pub struct RealmGetChildOutputDictionaryRequest {
150    pub child: fidl_fuchsia_component_decl::ChildRef,
151}
152
153impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
154    for RealmGetChildOutputDictionaryRequest
155{
156}
157
158#[derive(Debug, PartialEq)]
159pub struct RealmListChildrenRequest {
160    pub collection: fidl_fuchsia_component_decl::CollectionRef,
161    pub iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
162}
163
164impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmListChildrenRequest {}
165
166#[derive(Debug, PartialEq)]
167pub struct RealmOpenControllerRequest {
168    pub child: fidl_fuchsia_component_decl::ChildRef,
169    pub controller: fidl::endpoints::ServerEnd<ControllerMarker>,
170}
171
172impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
173    for RealmOpenControllerRequest
174{
175}
176
177#[derive(Debug, PartialEq)]
178pub struct RealmOpenExposedDirRequest {
179    pub child: fidl_fuchsia_component_decl::ChildRef,
180    pub exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
181}
182
183impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
184    for RealmOpenExposedDirRequest
185{
186}
187
188#[derive(Debug, PartialEq)]
189pub struct RealmGetChildOutputDictionaryDeprecatedResponse {
190    pub dictionary: fidl_fuchsia_component_sandbox::DictionaryRef,
191}
192
193impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
194    for RealmGetChildOutputDictionaryDeprecatedResponse
195{
196}
197
198#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
199pub struct RealmGetChildOutputDictionaryResponse {
200    pub dictionary: fidl::EventPair,
201}
202
203impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
204    for RealmGetChildOutputDictionaryResponse
205{
206}
207
208#[derive(Debug, PartialEq)]
209pub struct RealmGetResolvedInfoResponse {
210    pub resolved_info: fidl_fuchsia_component_resolution::Component,
211}
212
213impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
214    for RealmGetResolvedInfoResponse
215{
216}
217
218#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
219pub struct StorageAdminListStorageInRealmRequest {
220    pub relative_moniker: String,
221    pub iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
222}
223
224impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
225    for StorageAdminListStorageInRealmRequest
226{
227}
228
229#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
230pub struct StorageAdminOpenComponentStorageByIdRequest {
231    pub id: String,
232    pub object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
233}
234
235impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
236    for StorageAdminOpenComponentStorageByIdRequest
237{
238}
239
240#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
241pub struct StorageAdminOpenStorageRequest {
242    pub relative_moniker: String,
243    pub object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
244}
245
246impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
247    for StorageAdminOpenStorageRequest
248{
249}
250
251/// Payload for CapabilityRequested events
252#[derive(Debug, Default, PartialEq)]
253pub struct CapabilityRequestedPayload {
254    /// The name of the capability.
255    pub name: Option<String>,
256    /// A handle to the server end of the channel to host
257    /// capability.
258    pub capability: Option<fidl::Channel>,
259    #[doc(hidden)]
260    pub __source_breaking: fidl::marker::SourceBreaking,
261}
262
263impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
264    for CapabilityRequestedPayload
265{
266}
267
268#[derive(Debug, Default, PartialEq)]
269pub struct CreateChildArgs {
270    /// The numbered handles to pass to the component instance.
271    ///
272    /// If the runner for the component does not support the numbered handles it is
273    /// expected to close the handles.
274    pub numbered_handles: Option<Vec<fidl_fuchsia_process::HandleInfo>>,
275    /// Dynamic offers that will target the component instance.
276    ///
277    /// Including `OfferDecl`s in this vector will cause additional capabilities
278    /// to be offered to the newly created child, beyond the `OfferDecl`s in the
279    /// parent's `ComponentDecl` that target the collection.
280    ///
281    /// Any kind of offer (e.g., protocol, directory) can be used as a dynamic
282    /// offer. Any source that would be valid for a static offer is also valid
283    /// for a dynamic offer. Additionally, unlike static offers, dynamic offers
284    /// can use a "sibling" dynamic child component as a source by setting the
285    /// source to a `ChildRef` that sets the `collection` field.
286    ///
287    /// Dynamic offers always target the newly created child component. As a
288    /// result, `OfferDecl`s in `dynamic_offers` must not set the `target`
289    /// field, as its value is implied.
290    ///
291    /// If either the source (that is, the component named in the `source` field
292    /// of the `OfferDecl`) or the target of a dynamic offer is destroyed, the
293    /// offer itself is destroyed simultaneously.
294    ///
295    /// In order to set this field to a non-empty value, the collection in which
296    /// the child component is being created must specify
297    /// `ComponentDecl.allowed_offers = STATIC_AND_DYNAMIC`.
298    pub dynamic_offers: Option<Vec<fidl_fuchsia_component_decl::Offer>>,
299    /// The controller for this component, which may be used to influence the
300    /// component's lifecycle.
301    pub controller: Option<fidl::endpoints::ServerEnd<ControllerMarker>>,
302    /// A dictionary that contains extra capabilities for the component instance.
303    /// This field should be considered deprecated in favor of
304    /// `additional_inputs`. If both are set, an `INVALID_ARGUMENTS` error will
305    /// be returned.
306    pub dictionary: Option<fidl_fuchsia_component_sandbox::DictionaryRef>,
307    /// A handle to a dictionary created using
308    /// fuchsia.component.runtime.Capabilities that contains additional
309    /// capabilities that should be added to the inputs of the created child.
310    pub additional_inputs: Option<fidl::EventPair>,
311    #[doc(hidden)]
312    pub __source_breaking: fidl::marker::SourceBreaking,
313}
314
315impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateChildArgs {}
316
317/// Payload for DebugStarted events.
318#[derive(Debug, Default, PartialEq)]
319pub struct DebugStartedPayload {
320    /// The directory served by the runner to present runtime and runner-specific information
321    /// about the component. The other side is sent to the runner in ComponentStartInfo.
322    /// For example, it can be queried to know whether the component is an ELF component and
323    /// supports the break_on_start protocol below.
324    pub runtime_dir: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
325    /// An eventpair that can be used by debuggers to defer the launch of the component,
326    /// e.g., ELF debuggers can setup the exception channel on the job while holding
327    /// the eventpair, then drop the eventpair to notify the runner that processes could
328    /// be created. The other side is sent to the runner in ComponentStartInfo.
329    pub break_on_start: Option<fidl::EventPair>,
330    #[doc(hidden)]
331    pub __source_breaking: fidl::marker::SourceBreaking,
332}
333
334impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DebugStartedPayload {}
335
336/// Contains all information about a single event
337#[derive(Debug, Default, PartialEq)]
338pub struct Event {
339    /// Information about the component for which this event was generated.
340    pub header: Option<EventHeader>,
341    /// Optional payload for some event types
342    pub payload: Option<EventPayload>,
343    #[doc(hidden)]
344    pub __source_breaking: fidl::marker::SourceBreaking,
345}
346
347impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Event {}
348
349/// A single component namespace entry, which describes a namespace mount point
350/// (`path`) and the directory backing it (`directory`). This type is usually
351/// composed inside a vector.  See `ComponentStartInfo.ns` for more details.
352#[derive(Debug, Default, PartialEq)]
353pub struct NamespaceEntry {
354    /// The mount point for the directory, including a
355    /// leading slash. For example: "/pkg", "/svc", or "/config/data".
356    pub path: Option<String>,
357    /// The directory mounted at the above `path`.
358    pub directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
359    #[doc(hidden)]
360    pub __source_breaking: fidl::marker::SourceBreaking,
361}
362
363impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceEntry {}
364
365#[derive(Debug, Default, PartialEq)]
366pub struct StartChildArgs {
367    /// The numbered handles to pass to the component instance.
368    ///
369    /// If the runner for the component does not support the numbered handles it
370    /// is expected to close the handles.
371    ///
372    /// If set, the values given here will override the handles given in
373    /// CreateChildArgs.
374    pub numbered_handles: Option<Vec<fidl_fuchsia_process::HandleInfo>>,
375    /// The namespace generated by component manager will be extended to include
376    /// any namespace entries listed here before being given to the component's
377    /// runner.
378    ///
379    /// If there are any conflicting entries, an error will occur when starting
380    /// the component.
381    pub namespace_entries: Option<Vec<NamespaceEntry>>,
382    /// A dictionary that contains extra capabilities for the component instance.
383    /// This field should be considered deprecated in favor of
384    /// `additional_inputs`. If both are set, an `INVALID_ARGUMENTS` error will
385    /// be returned.
386    pub dictionary: Option<fidl_fuchsia_component_sandbox::DictionaryRef>,
387    /// A handle to a dictionary created using
388    /// fuchsia.component.runtime.Capabilities that contains additional
389    /// capabilities that should be added to the inputs of the started program.
390    pub additional_inputs: Option<fidl::EventPair>,
391    #[doc(hidden)]
392    pub __source_breaking: fidl::marker::SourceBreaking,
393}
394
395impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StartChildArgs {}
396
397/// Encapsulates additional data/protocols for some event types.
398#[derive(Debug)]
399pub enum EventPayload {
400    /// Payload for CapabilityRequested events
401    CapabilityRequested(CapabilityRequestedPayload),
402    /// Payload for Purged events.
403    Purged(PurgedPayload),
404    /// Payload for Discovered events.
405    Discovered(DiscoveredPayload),
406    /// Payload for Destroyed events.
407    Destroyed(DestroyedPayload),
408    /// Payload for Resolved events
409    Resolved(ResolvedPayload),
410    /// Payload for Started events
411    Started(StartedPayload),
412    /// Payload for Stopped events
413    Stopped(StoppedPayload),
414    /// Payload for DebugStarted events
415    DebugStarted(DebugStartedPayload),
416    /// Payload for Unresolved events
417    Unresolved(UnresolvedPayload),
418    #[doc(hidden)]
419    __SourceBreaking { unknown_ordinal: u64 },
420}
421
422/// Pattern that matches an unknown `EventPayload` member.
423#[macro_export]
424macro_rules! EventPayloadUnknown {
425    () => {
426        _
427    };
428}
429
430// Custom PartialEq so that unknown variants are not equal to themselves.
431impl PartialEq for EventPayload {
432    fn eq(&self, other: &Self) -> bool {
433        match (self, other) {
434            (Self::CapabilityRequested(x), Self::CapabilityRequested(y)) => *x == *y,
435            (Self::Purged(x), Self::Purged(y)) => *x == *y,
436            (Self::Discovered(x), Self::Discovered(y)) => *x == *y,
437            (Self::Destroyed(x), Self::Destroyed(y)) => *x == *y,
438            (Self::Resolved(x), Self::Resolved(y)) => *x == *y,
439            (Self::Started(x), Self::Started(y)) => *x == *y,
440            (Self::Stopped(x), Self::Stopped(y)) => *x == *y,
441            (Self::DebugStarted(x), Self::DebugStarted(y)) => *x == *y,
442            (Self::Unresolved(x), Self::Unresolved(y)) => *x == *y,
443            _ => false,
444        }
445    }
446}
447
448impl EventPayload {
449    #[inline]
450    pub fn ordinal(&self) -> u64 {
451        match *self {
452            Self::CapabilityRequested(_) => 1,
453            Self::Purged(_) => 2,
454            Self::Discovered(_) => 4,
455            Self::Destroyed(_) => 5,
456            Self::Resolved(_) => 6,
457            Self::Started(_) => 7,
458            Self::Stopped(_) => 8,
459            Self::DebugStarted(_) => 9,
460            Self::Unresolved(_) => 10,
461            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
462        }
463    }
464
465    #[inline]
466    pub fn unknown_variant_for_testing() -> Self {
467        Self::__SourceBreaking { unknown_ordinal: 0 }
468    }
469
470    #[inline]
471    pub fn is_unknown(&self) -> bool {
472        match self {
473            Self::__SourceBreaking { .. } => true,
474            _ => false,
475        }
476    }
477}
478
479impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EventPayload {}
480
481#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
482pub struct BinderMarker;
483
484impl fidl::endpoints::ProtocolMarker for BinderMarker {
485    type Proxy = BinderProxy;
486    type RequestStream = BinderRequestStream;
487    #[cfg(target_os = "fuchsia")]
488    type SynchronousProxy = BinderSynchronousProxy;
489
490    const DEBUG_NAME: &'static str = "fuchsia.component.Binder";
491}
492impl fidl::endpoints::DiscoverableProtocolMarker for BinderMarker {}
493
494pub trait BinderProxyInterface: Send + Sync {}
495#[derive(Debug)]
496#[cfg(target_os = "fuchsia")]
497pub struct BinderSynchronousProxy {
498    client: fidl::client::sync::Client,
499}
500
501#[cfg(target_os = "fuchsia")]
502impl fidl::endpoints::SynchronousProxy for BinderSynchronousProxy {
503    type Proxy = BinderProxy;
504    type Protocol = BinderMarker;
505
506    fn from_channel(inner: fidl::Channel) -> Self {
507        Self::new(inner)
508    }
509
510    fn into_channel(self) -> fidl::Channel {
511        self.client.into_channel()
512    }
513
514    fn as_channel(&self) -> &fidl::Channel {
515        self.client.as_channel()
516    }
517}
518
519#[cfg(target_os = "fuchsia")]
520impl BinderSynchronousProxy {
521    pub fn new(channel: fidl::Channel) -> Self {
522        let protocol_name = <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
523        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
524    }
525
526    pub fn into_channel(self) -> fidl::Channel {
527        self.client.into_channel()
528    }
529
530    /// Waits until an event arrives and returns it. It is safe for other
531    /// threads to make concurrent requests while waiting for an event.
532    pub fn wait_for_event(
533        &self,
534        deadline: zx::MonotonicInstant,
535    ) -> Result<BinderEvent, fidl::Error> {
536        BinderEvent::decode(self.client.wait_for_event(deadline)?)
537    }
538}
539
540#[cfg(target_os = "fuchsia")]
541impl From<BinderSynchronousProxy> for zx::NullableHandle {
542    fn from(value: BinderSynchronousProxy) -> Self {
543        value.into_channel().into()
544    }
545}
546
547#[cfg(target_os = "fuchsia")]
548impl From<fidl::Channel> for BinderSynchronousProxy {
549    fn from(value: fidl::Channel) -> Self {
550        Self::new(value)
551    }
552}
553
554#[cfg(target_os = "fuchsia")]
555impl fidl::endpoints::FromClient for BinderSynchronousProxy {
556    type Protocol = BinderMarker;
557
558    fn from_client(value: fidl::endpoints::ClientEnd<BinderMarker>) -> Self {
559        Self::new(value.into_channel())
560    }
561}
562
563#[derive(Debug, Clone)]
564pub struct BinderProxy {
565    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
566}
567
568impl fidl::endpoints::Proxy for BinderProxy {
569    type Protocol = BinderMarker;
570
571    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
572        Self::new(inner)
573    }
574
575    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
576        self.client.into_channel().map_err(|client| Self { client })
577    }
578
579    fn as_channel(&self) -> &::fidl::AsyncChannel {
580        self.client.as_channel()
581    }
582}
583
584impl BinderProxy {
585    /// Create a new Proxy for fuchsia.component/Binder.
586    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
587        let protocol_name = <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
588        Self { client: fidl::client::Client::new(channel, protocol_name) }
589    }
590
591    /// Get a Stream of events from the remote end of the protocol.
592    ///
593    /// # Panics
594    ///
595    /// Panics if the event stream was already taken.
596    pub fn take_event_stream(&self) -> BinderEventStream {
597        BinderEventStream { event_receiver: self.client.take_event_receiver() }
598    }
599}
600
601impl BinderProxyInterface for BinderProxy {}
602
603pub struct BinderEventStream {
604    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
605}
606
607impl std::marker::Unpin for BinderEventStream {}
608
609impl futures::stream::FusedStream for BinderEventStream {
610    fn is_terminated(&self) -> bool {
611        self.event_receiver.is_terminated()
612    }
613}
614
615impl futures::Stream for BinderEventStream {
616    type Item = Result<BinderEvent, fidl::Error>;
617
618    fn poll_next(
619        mut self: std::pin::Pin<&mut Self>,
620        cx: &mut std::task::Context<'_>,
621    ) -> std::task::Poll<Option<Self::Item>> {
622        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
623            &mut self.event_receiver,
624            cx
625        )?) {
626            Some(buf) => std::task::Poll::Ready(Some(BinderEvent::decode(buf))),
627            None => std::task::Poll::Ready(None),
628        }
629    }
630}
631
632#[derive(Debug)]
633pub enum BinderEvent {}
634
635impl BinderEvent {
636    /// Decodes a message buffer as a [`BinderEvent`].
637    fn decode(
638        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
639    ) -> Result<BinderEvent, fidl::Error> {
640        let (bytes, _handles) = buf.split_mut();
641        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
642        debug_assert_eq!(tx_header.tx_id, 0);
643        match tx_header.ordinal {
644            _ => Err(fidl::Error::UnknownOrdinal {
645                ordinal: tx_header.ordinal,
646                protocol_name: <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
647            }),
648        }
649    }
650}
651
652/// A Stream of incoming requests for fuchsia.component/Binder.
653pub struct BinderRequestStream {
654    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
655    is_terminated: bool,
656}
657
658impl std::marker::Unpin for BinderRequestStream {}
659
660impl futures::stream::FusedStream for BinderRequestStream {
661    fn is_terminated(&self) -> bool {
662        self.is_terminated
663    }
664}
665
666impl fidl::endpoints::RequestStream for BinderRequestStream {
667    type Protocol = BinderMarker;
668    type ControlHandle = BinderControlHandle;
669
670    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
671        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
672    }
673
674    fn control_handle(&self) -> Self::ControlHandle {
675        BinderControlHandle { inner: self.inner.clone() }
676    }
677
678    fn into_inner(
679        self,
680    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
681    {
682        (self.inner, self.is_terminated)
683    }
684
685    fn from_inner(
686        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
687        is_terminated: bool,
688    ) -> Self {
689        Self { inner, is_terminated }
690    }
691}
692
693impl futures::Stream for BinderRequestStream {
694    type Item = Result<BinderRequest, fidl::Error>;
695
696    fn poll_next(
697        mut self: std::pin::Pin<&mut Self>,
698        cx: &mut std::task::Context<'_>,
699    ) -> std::task::Poll<Option<Self::Item>> {
700        let this = &mut *self;
701        if this.inner.check_shutdown(cx) {
702            this.is_terminated = true;
703            return std::task::Poll::Ready(None);
704        }
705        if this.is_terminated {
706            panic!("polled BinderRequestStream after completion");
707        }
708        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
709            |bytes, handles| {
710                match this.inner.channel().read_etc(cx, bytes, handles) {
711                    std::task::Poll::Ready(Ok(())) => {}
712                    std::task::Poll::Pending => return std::task::Poll::Pending,
713                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
714                        this.is_terminated = true;
715                        return std::task::Poll::Ready(None);
716                    }
717                    std::task::Poll::Ready(Err(e)) => {
718                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
719                            e.into(),
720                        ))));
721                    }
722                }
723
724                // A message has been received from the channel
725                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
726
727                std::task::Poll::Ready(Some(match header.ordinal {
728                    _ => Err(fidl::Error::UnknownOrdinal {
729                        ordinal: header.ordinal,
730                        protocol_name:
731                            <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
732                    }),
733                }))
734            },
735        )
736    }
737}
738
739/// A framework-provided protocol that allows components that use it to bind to
740/// the component that exposes it. The act of connecting to this protocol will
741/// trigger the bind. Thus, this protocol contains no methods. For more details
742/// on binding, see
743/// https://fuchsia.dev/fuchsia-src/concepts/components/v2/lifecycle#binding.
744///
745/// When a component connects to protocol, the component exposing this capability
746/// will be started if it's not already running. Upon a failure to start, the
747/// component framework will close the server end of the channel with a
748/// zx.Status epitaph.
749#[derive(Debug)]
750pub enum BinderRequest {}
751
752impl BinderRequest {
753    /// Name of the method defined in FIDL
754    pub fn method_name(&self) -> &'static str {
755        match *self {}
756    }
757}
758
759#[derive(Debug, Clone)]
760pub struct BinderControlHandle {
761    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
762}
763
764impl fidl::endpoints::ControlHandle for BinderControlHandle {
765    fn shutdown(&self) {
766        self.inner.shutdown()
767    }
768
769    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
770        self.inner.shutdown_with_epitaph(status)
771    }
772
773    fn is_closed(&self) -> bool {
774        self.inner.channel().is_closed()
775    }
776    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
777        self.inner.channel().on_closed()
778    }
779
780    #[cfg(target_os = "fuchsia")]
781    fn signal_peer(
782        &self,
783        clear_mask: zx::Signals,
784        set_mask: zx::Signals,
785    ) -> Result<(), zx_status::Status> {
786        use fidl::Peered;
787        self.inner.channel().signal_peer(clear_mask, set_mask)
788    }
789}
790
791impl BinderControlHandle {}
792
793#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
794pub struct ChildIteratorMarker;
795
796impl fidl::endpoints::ProtocolMarker for ChildIteratorMarker {
797    type Proxy = ChildIteratorProxy;
798    type RequestStream = ChildIteratorRequestStream;
799    #[cfg(target_os = "fuchsia")]
800    type SynchronousProxy = ChildIteratorSynchronousProxy;
801
802    const DEBUG_NAME: &'static str = "(anonymous) ChildIterator";
803}
804
805pub trait ChildIteratorProxyInterface: Send + Sync {
806    type NextResponseFut: std::future::Future<
807            Output = Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error>,
808        > + Send;
809    fn r#next(&self) -> Self::NextResponseFut;
810}
811#[derive(Debug)]
812#[cfg(target_os = "fuchsia")]
813pub struct ChildIteratorSynchronousProxy {
814    client: fidl::client::sync::Client,
815}
816
817#[cfg(target_os = "fuchsia")]
818impl fidl::endpoints::SynchronousProxy for ChildIteratorSynchronousProxy {
819    type Proxy = ChildIteratorProxy;
820    type Protocol = ChildIteratorMarker;
821
822    fn from_channel(inner: fidl::Channel) -> Self {
823        Self::new(inner)
824    }
825
826    fn into_channel(self) -> fidl::Channel {
827        self.client.into_channel()
828    }
829
830    fn as_channel(&self) -> &fidl::Channel {
831        self.client.as_channel()
832    }
833}
834
835#[cfg(target_os = "fuchsia")]
836impl ChildIteratorSynchronousProxy {
837    pub fn new(channel: fidl::Channel) -> Self {
838        let protocol_name = <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
839        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
840    }
841
842    pub fn into_channel(self) -> fidl::Channel {
843        self.client.into_channel()
844    }
845
846    /// Waits until an event arrives and returns it. It is safe for other
847    /// threads to make concurrent requests while waiting for an event.
848    pub fn wait_for_event(
849        &self,
850        deadline: zx::MonotonicInstant,
851    ) -> Result<ChildIteratorEvent, fidl::Error> {
852        ChildIteratorEvent::decode(self.client.wait_for_event(deadline)?)
853    }
854
855    /// Advance the iterator and return the next batch of children.
856    ///
857    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
858    /// no more children.
859    pub fn r#next(
860        &self,
861        ___deadline: zx::MonotonicInstant,
862    ) -> Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error> {
863        let _response =
864            self.client.send_query::<fidl::encoding::EmptyPayload, ChildIteratorNextResponse>(
865                (),
866                0x40e4c3882b050d08,
867                fidl::encoding::DynamicFlags::empty(),
868                ___deadline,
869            )?;
870        Ok(_response.children)
871    }
872}
873
874#[cfg(target_os = "fuchsia")]
875impl From<ChildIteratorSynchronousProxy> for zx::NullableHandle {
876    fn from(value: ChildIteratorSynchronousProxy) -> Self {
877        value.into_channel().into()
878    }
879}
880
881#[cfg(target_os = "fuchsia")]
882impl From<fidl::Channel> for ChildIteratorSynchronousProxy {
883    fn from(value: fidl::Channel) -> Self {
884        Self::new(value)
885    }
886}
887
888#[cfg(target_os = "fuchsia")]
889impl fidl::endpoints::FromClient for ChildIteratorSynchronousProxy {
890    type Protocol = ChildIteratorMarker;
891
892    fn from_client(value: fidl::endpoints::ClientEnd<ChildIteratorMarker>) -> Self {
893        Self::new(value.into_channel())
894    }
895}
896
897#[derive(Debug, Clone)]
898pub struct ChildIteratorProxy {
899    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
900}
901
902impl fidl::endpoints::Proxy for ChildIteratorProxy {
903    type Protocol = ChildIteratorMarker;
904
905    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
906        Self::new(inner)
907    }
908
909    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
910        self.client.into_channel().map_err(|client| Self { client })
911    }
912
913    fn as_channel(&self) -> &::fidl::AsyncChannel {
914        self.client.as_channel()
915    }
916}
917
918impl ChildIteratorProxy {
919    /// Create a new Proxy for fuchsia.component/ChildIterator.
920    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
921        let protocol_name = <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
922        Self { client: fidl::client::Client::new(channel, protocol_name) }
923    }
924
925    /// Get a Stream of events from the remote end of the protocol.
926    ///
927    /// # Panics
928    ///
929    /// Panics if the event stream was already taken.
930    pub fn take_event_stream(&self) -> ChildIteratorEventStream {
931        ChildIteratorEventStream { event_receiver: self.client.take_event_receiver() }
932    }
933
934    /// Advance the iterator and return the next batch of children.
935    ///
936    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
937    /// no more children.
938    pub fn r#next(
939        &self,
940    ) -> fidl::client::QueryResponseFut<
941        Vec<fidl_fuchsia_component_decl::ChildRef>,
942        fidl::encoding::DefaultFuchsiaResourceDialect,
943    > {
944        ChildIteratorProxyInterface::r#next(self)
945    }
946}
947
948impl ChildIteratorProxyInterface for ChildIteratorProxy {
949    type NextResponseFut = fidl::client::QueryResponseFut<
950        Vec<fidl_fuchsia_component_decl::ChildRef>,
951        fidl::encoding::DefaultFuchsiaResourceDialect,
952    >;
953    fn r#next(&self) -> Self::NextResponseFut {
954        fn _decode(
955            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
956        ) -> Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error> {
957            let _response = fidl::client::decode_transaction_body::<
958                ChildIteratorNextResponse,
959                fidl::encoding::DefaultFuchsiaResourceDialect,
960                0x40e4c3882b050d08,
961            >(_buf?)?;
962            Ok(_response.children)
963        }
964        self.client.send_query_and_decode::<
965            fidl::encoding::EmptyPayload,
966            Vec<fidl_fuchsia_component_decl::ChildRef>,
967        >(
968            (),
969            0x40e4c3882b050d08,
970            fidl::encoding::DynamicFlags::empty(),
971            _decode,
972        )
973    }
974}
975
976pub struct ChildIteratorEventStream {
977    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
978}
979
980impl std::marker::Unpin for ChildIteratorEventStream {}
981
982impl futures::stream::FusedStream for ChildIteratorEventStream {
983    fn is_terminated(&self) -> bool {
984        self.event_receiver.is_terminated()
985    }
986}
987
988impl futures::Stream for ChildIteratorEventStream {
989    type Item = Result<ChildIteratorEvent, fidl::Error>;
990
991    fn poll_next(
992        mut self: std::pin::Pin<&mut Self>,
993        cx: &mut std::task::Context<'_>,
994    ) -> std::task::Poll<Option<Self::Item>> {
995        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
996            &mut self.event_receiver,
997            cx
998        )?) {
999            Some(buf) => std::task::Poll::Ready(Some(ChildIteratorEvent::decode(buf))),
1000            None => std::task::Poll::Ready(None),
1001        }
1002    }
1003}
1004
1005#[derive(Debug)]
1006pub enum ChildIteratorEvent {}
1007
1008impl ChildIteratorEvent {
1009    /// Decodes a message buffer as a [`ChildIteratorEvent`].
1010    fn decode(
1011        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1012    ) -> Result<ChildIteratorEvent, fidl::Error> {
1013        let (bytes, _handles) = buf.split_mut();
1014        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1015        debug_assert_eq!(tx_header.tx_id, 0);
1016        match tx_header.ordinal {
1017            _ => Err(fidl::Error::UnknownOrdinal {
1018                ordinal: tx_header.ordinal,
1019                protocol_name: <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1020            }),
1021        }
1022    }
1023}
1024
1025/// A Stream of incoming requests for fuchsia.component/ChildIterator.
1026pub struct ChildIteratorRequestStream {
1027    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1028    is_terminated: bool,
1029}
1030
1031impl std::marker::Unpin for ChildIteratorRequestStream {}
1032
1033impl futures::stream::FusedStream for ChildIteratorRequestStream {
1034    fn is_terminated(&self) -> bool {
1035        self.is_terminated
1036    }
1037}
1038
1039impl fidl::endpoints::RequestStream for ChildIteratorRequestStream {
1040    type Protocol = ChildIteratorMarker;
1041    type ControlHandle = ChildIteratorControlHandle;
1042
1043    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1044        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1045    }
1046
1047    fn control_handle(&self) -> Self::ControlHandle {
1048        ChildIteratorControlHandle { inner: self.inner.clone() }
1049    }
1050
1051    fn into_inner(
1052        self,
1053    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1054    {
1055        (self.inner, self.is_terminated)
1056    }
1057
1058    fn from_inner(
1059        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1060        is_terminated: bool,
1061    ) -> Self {
1062        Self { inner, is_terminated }
1063    }
1064}
1065
1066impl futures::Stream for ChildIteratorRequestStream {
1067    type Item = Result<ChildIteratorRequest, fidl::Error>;
1068
1069    fn poll_next(
1070        mut self: std::pin::Pin<&mut Self>,
1071        cx: &mut std::task::Context<'_>,
1072    ) -> std::task::Poll<Option<Self::Item>> {
1073        let this = &mut *self;
1074        if this.inner.check_shutdown(cx) {
1075            this.is_terminated = true;
1076            return std::task::Poll::Ready(None);
1077        }
1078        if this.is_terminated {
1079            panic!("polled ChildIteratorRequestStream after completion");
1080        }
1081        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1082            |bytes, handles| {
1083                match this.inner.channel().read_etc(cx, bytes, handles) {
1084                    std::task::Poll::Ready(Ok(())) => {}
1085                    std::task::Poll::Pending => return std::task::Poll::Pending,
1086                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1087                        this.is_terminated = true;
1088                        return std::task::Poll::Ready(None);
1089                    }
1090                    std::task::Poll::Ready(Err(e)) => {
1091                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1092                            e.into(),
1093                        ))));
1094                    }
1095                }
1096
1097                // A message has been received from the channel
1098                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1099
1100                std::task::Poll::Ready(Some(match header.ordinal {
1101                    0x40e4c3882b050d08 => {
1102                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1103                        let mut req = fidl::new_empty!(
1104                            fidl::encoding::EmptyPayload,
1105                            fidl::encoding::DefaultFuchsiaResourceDialect
1106                        );
1107                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1108                        let control_handle =
1109                            ChildIteratorControlHandle { inner: this.inner.clone() };
1110                        Ok(ChildIteratorRequest::Next {
1111                            responder: ChildIteratorNextResponder {
1112                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1113                                tx_id: header.tx_id,
1114                            },
1115                        })
1116                    }
1117                    _ => Err(fidl::Error::UnknownOrdinal {
1118                        ordinal: header.ordinal,
1119                        protocol_name:
1120                            <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1121                    }),
1122                }))
1123            },
1124        )
1125    }
1126}
1127
1128/// A protocol to iterate over the list of children in a realm.
1129#[derive(Debug)]
1130pub enum ChildIteratorRequest {
1131    /// Advance the iterator and return the next batch of children.
1132    ///
1133    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
1134    /// no more children.
1135    Next { responder: ChildIteratorNextResponder },
1136}
1137
1138impl ChildIteratorRequest {
1139    #[allow(irrefutable_let_patterns)]
1140    pub fn into_next(self) -> Option<(ChildIteratorNextResponder)> {
1141        if let ChildIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
1142    }
1143
1144    /// Name of the method defined in FIDL
1145    pub fn method_name(&self) -> &'static str {
1146        match *self {
1147            ChildIteratorRequest::Next { .. } => "next",
1148        }
1149    }
1150}
1151
1152#[derive(Debug, Clone)]
1153pub struct ChildIteratorControlHandle {
1154    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1155}
1156
1157impl fidl::endpoints::ControlHandle for ChildIteratorControlHandle {
1158    fn shutdown(&self) {
1159        self.inner.shutdown()
1160    }
1161
1162    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1163        self.inner.shutdown_with_epitaph(status)
1164    }
1165
1166    fn is_closed(&self) -> bool {
1167        self.inner.channel().is_closed()
1168    }
1169    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1170        self.inner.channel().on_closed()
1171    }
1172
1173    #[cfg(target_os = "fuchsia")]
1174    fn signal_peer(
1175        &self,
1176        clear_mask: zx::Signals,
1177        set_mask: zx::Signals,
1178    ) -> Result<(), zx_status::Status> {
1179        use fidl::Peered;
1180        self.inner.channel().signal_peer(clear_mask, set_mask)
1181    }
1182}
1183
1184impl ChildIteratorControlHandle {}
1185
1186#[must_use = "FIDL methods require a response to be sent"]
1187#[derive(Debug)]
1188pub struct ChildIteratorNextResponder {
1189    control_handle: std::mem::ManuallyDrop<ChildIteratorControlHandle>,
1190    tx_id: u32,
1191}
1192
1193/// Set the the channel to be shutdown (see [`ChildIteratorControlHandle::shutdown`])
1194/// if the responder is dropped without sending a response, so that the client
1195/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1196impl std::ops::Drop for ChildIteratorNextResponder {
1197    fn drop(&mut self) {
1198        self.control_handle.shutdown();
1199        // Safety: drops once, never accessed again
1200        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1201    }
1202}
1203
1204impl fidl::endpoints::Responder for ChildIteratorNextResponder {
1205    type ControlHandle = ChildIteratorControlHandle;
1206
1207    fn control_handle(&self) -> &ChildIteratorControlHandle {
1208        &self.control_handle
1209    }
1210
1211    fn drop_without_shutdown(mut self) {
1212        // Safety: drops once, never accessed again due to mem::forget
1213        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1214        // Prevent Drop from running (which would shut down the channel)
1215        std::mem::forget(self);
1216    }
1217}
1218
1219impl ChildIteratorNextResponder {
1220    /// Sends a response to the FIDL transaction.
1221    ///
1222    /// Sets the channel to shutdown if an error occurs.
1223    pub fn send(
1224        self,
1225        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1226    ) -> Result<(), fidl::Error> {
1227        let _result = self.send_raw(children);
1228        if _result.is_err() {
1229            self.control_handle.shutdown();
1230        }
1231        self.drop_without_shutdown();
1232        _result
1233    }
1234
1235    /// Similar to "send" but does not shutdown the channel if an error occurs.
1236    pub fn send_no_shutdown_on_err(
1237        self,
1238        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1239    ) -> Result<(), fidl::Error> {
1240        let _result = self.send_raw(children);
1241        self.drop_without_shutdown();
1242        _result
1243    }
1244
1245    fn send_raw(
1246        &self,
1247        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1248    ) -> Result<(), fidl::Error> {
1249        self.control_handle.inner.send::<ChildIteratorNextResponse>(
1250            (children,),
1251            self.tx_id,
1252            0x40e4c3882b050d08,
1253            fidl::encoding::DynamicFlags::empty(),
1254        )
1255    }
1256}
1257
1258#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1259pub struct ControllerMarker;
1260
1261impl fidl::endpoints::ProtocolMarker for ControllerMarker {
1262    type Proxy = ControllerProxy;
1263    type RequestStream = ControllerRequestStream;
1264    #[cfg(target_os = "fuchsia")]
1265    type SynchronousProxy = ControllerSynchronousProxy;
1266
1267    const DEBUG_NAME: &'static str = "(anonymous) Controller";
1268}
1269pub type ControllerStartResult = Result<(), Error>;
1270pub type ControllerIsStartedResult = Result<bool, Error>;
1271pub type ControllerOpenExposedDirResult = Result<(), Error>;
1272pub type ControllerGetExposedDictionaryResult =
1273    Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>;
1274pub type ControllerGetOutputDictionaryResult = Result<fidl::EventPair, Error>;
1275pub type ControllerDestroyResult = Result<(), Error>;
1276
1277pub trait ControllerProxyInterface: Send + Sync {
1278    type StartResponseFut: std::future::Future<Output = Result<ControllerStartResult, fidl::Error>>
1279        + Send;
1280    fn r#start(
1281        &self,
1282        args: StartChildArgs,
1283        execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1284    ) -> Self::StartResponseFut;
1285    type IsStartedResponseFut: std::future::Future<Output = Result<ControllerIsStartedResult, fidl::Error>>
1286        + Send;
1287    fn r#is_started(&self) -> Self::IsStartedResponseFut;
1288    type OpenExposedDirResponseFut: std::future::Future<Output = Result<ControllerOpenExposedDirResult, fidl::Error>>
1289        + Send;
1290    fn r#open_exposed_dir(
1291        &self,
1292        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1293    ) -> Self::OpenExposedDirResponseFut;
1294    type GetExposedDictionaryResponseFut: std::future::Future<Output = Result<ControllerGetExposedDictionaryResult, fidl::Error>>
1295        + Send;
1296    fn r#get_exposed_dictionary(&self) -> Self::GetExposedDictionaryResponseFut;
1297    type GetOutputDictionaryResponseFut: std::future::Future<Output = Result<ControllerGetOutputDictionaryResult, fidl::Error>>
1298        + Send;
1299    fn r#get_output_dictionary(&self) -> Self::GetOutputDictionaryResponseFut;
1300    type DestroyResponseFut: std::future::Future<Output = Result<ControllerDestroyResult, fidl::Error>>
1301        + Send;
1302    fn r#destroy(&self) -> Self::DestroyResponseFut;
1303}
1304#[derive(Debug)]
1305#[cfg(target_os = "fuchsia")]
1306pub struct ControllerSynchronousProxy {
1307    client: fidl::client::sync::Client,
1308}
1309
1310#[cfg(target_os = "fuchsia")]
1311impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
1312    type Proxy = ControllerProxy;
1313    type Protocol = ControllerMarker;
1314
1315    fn from_channel(inner: fidl::Channel) -> Self {
1316        Self::new(inner)
1317    }
1318
1319    fn into_channel(self) -> fidl::Channel {
1320        self.client.into_channel()
1321    }
1322
1323    fn as_channel(&self) -> &fidl::Channel {
1324        self.client.as_channel()
1325    }
1326}
1327
1328#[cfg(target_os = "fuchsia")]
1329impl ControllerSynchronousProxy {
1330    pub fn new(channel: fidl::Channel) -> Self {
1331        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1332        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1333    }
1334
1335    pub fn into_channel(self) -> fidl::Channel {
1336        self.client.into_channel()
1337    }
1338
1339    /// Waits until an event arrives and returns it. It is safe for other
1340    /// threads to make concurrent requests while waiting for an event.
1341    pub fn wait_for_event(
1342        &self,
1343        deadline: zx::MonotonicInstant,
1344    ) -> Result<ControllerEvent, fidl::Error> {
1345        ControllerEvent::decode(self.client.wait_for_event(deadline)?)
1346    }
1347
1348    /// Start the component, optionally providing additional handles to be given
1349    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
1350    /// currently running.
1351    pub fn r#start(
1352        &self,
1353        mut args: StartChildArgs,
1354        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1355        ___deadline: zx::MonotonicInstant,
1356    ) -> Result<ControllerStartResult, fidl::Error> {
1357        let _response = self.client.send_query::<
1358            ControllerStartRequest,
1359            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1360        >(
1361            (&mut args, execution_controller,),
1362            0x68878076b8d2eac5,
1363            fidl::encoding::DynamicFlags::FLEXIBLE,
1364            ___deadline,
1365        )?
1366        .into_result::<ControllerMarker>("start")?;
1367        Ok(_response.map(|x| x))
1368    }
1369
1370    /// Returns true if this instance is currently running.
1371    pub fn r#is_started(
1372        &self,
1373        ___deadline: zx::MonotonicInstant,
1374    ) -> Result<ControllerIsStartedResult, fidl::Error> {
1375        let _response = self.client.send_query::<
1376            fidl::encoding::EmptyPayload,
1377            fidl::encoding::FlexibleResultType<ControllerIsStartedResponse, Error>,
1378        >(
1379            (),
1380            0x2155e6e1db2083c3,
1381            fidl::encoding::DynamicFlags::FLEXIBLE,
1382            ___deadline,
1383        )?
1384        .into_result::<ControllerMarker>("is_started")?;
1385        Ok(_response.map(|x| x.is_started))
1386    }
1387
1388    /// Opens the exposed directory of the controlled component, through which
1389    /// capabilities the component exposed via `ComponentDecl.exposes` are
1390    /// available, on success.
1391    ///
1392    /// Binding to the exposed directory requires that the component be
1393    /// resolved, but it will not be started until/unless some capability is
1394    /// requested that requires it to be.
1395    ///
1396    /// If this component is destroyed, any outstanding connections to
1397    /// `exposed_dir` will be closed.
1398    ///
1399    /// Errors:
1400    /// - `INSTANCE_CANNOT_RESOLVE`: This component failed to resolve.
1401    pub fn r#open_exposed_dir(
1402        &self,
1403        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1404        ___deadline: zx::MonotonicInstant,
1405    ) -> Result<ControllerOpenExposedDirResult, fidl::Error> {
1406        let _response = self.client.send_query::<
1407            ControllerOpenExposedDirRequest,
1408            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1409        >(
1410            (exposed_dir,),
1411            0x253cabb9a840ed94,
1412            fidl::encoding::DynamicFlags::empty(),
1413            ___deadline,
1414        )?;
1415        Ok(_response.map(|x| x))
1416    }
1417
1418    /// Returns the dictionary containing the component's exposed capabilities.
1419    pub fn r#get_exposed_dictionary(
1420        &self,
1421        ___deadline: zx::MonotonicInstant,
1422    ) -> Result<ControllerGetExposedDictionaryResult, fidl::Error> {
1423        let _response = self.client.send_query::<
1424            fidl::encoding::EmptyPayload,
1425            fidl::encoding::FlexibleResultType<ControllerGetExposedDictionaryResponse, Error>,
1426        >(
1427            (),
1428            0x7e48373e5eda1f9b,
1429            fidl::encoding::DynamicFlags::FLEXIBLE,
1430            ___deadline,
1431        )?
1432        .into_result::<ControllerMarker>("get_exposed_dictionary")?;
1433        Ok(_response.map(|x| x.dictionary))
1434    }
1435
1436    /// Returns a reference to the component's output dictionary, which may be
1437    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
1438    pub fn r#get_output_dictionary(
1439        &self,
1440        ___deadline: zx::MonotonicInstant,
1441    ) -> Result<ControllerGetOutputDictionaryResult, fidl::Error> {
1442        let _response = self.client.send_query::<
1443            fidl::encoding::EmptyPayload,
1444            fidl::encoding::FlexibleResultType<ControllerGetOutputDictionaryResponse, Error>,
1445        >(
1446            (),
1447            0x3a0c4696620ad221,
1448            fidl::encoding::DynamicFlags::FLEXIBLE,
1449            ___deadline,
1450        )?
1451        .into_result::<ControllerMarker>("get_output_dictionary")?;
1452        Ok(_response.map(|x| x.dictionary))
1453    }
1454
1455    /// Destroys this component. When this method returns, the component is
1456    /// either destroyed or in the case of an error no destruction happened.
1457    ///
1458    /// Errors:
1459    ///
1460    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1461    /// Currently, this can happen if the component is a static child of its
1462    /// parent.
1463    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1464    ///   manager's logs will contain more detail.
1465    pub fn r#destroy(
1466        &self,
1467        ___deadline: zx::MonotonicInstant,
1468    ) -> Result<ControllerDestroyResult, fidl::Error> {
1469        let _response = self.client.send_query::<
1470            fidl::encoding::EmptyPayload,
1471            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1472        >(
1473            (),
1474            0x74529fa68b5c1741,
1475            fidl::encoding::DynamicFlags::FLEXIBLE,
1476            ___deadline,
1477        )?
1478        .into_result::<ControllerMarker>("destroy")?;
1479        Ok(_response.map(|x| x))
1480    }
1481}
1482
1483#[cfg(target_os = "fuchsia")]
1484impl From<ControllerSynchronousProxy> for zx::NullableHandle {
1485    fn from(value: ControllerSynchronousProxy) -> Self {
1486        value.into_channel().into()
1487    }
1488}
1489
1490#[cfg(target_os = "fuchsia")]
1491impl From<fidl::Channel> for ControllerSynchronousProxy {
1492    fn from(value: fidl::Channel) -> Self {
1493        Self::new(value)
1494    }
1495}
1496
1497#[cfg(target_os = "fuchsia")]
1498impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
1499    type Protocol = ControllerMarker;
1500
1501    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
1502        Self::new(value.into_channel())
1503    }
1504}
1505
1506#[derive(Debug, Clone)]
1507pub struct ControllerProxy {
1508    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1509}
1510
1511impl fidl::endpoints::Proxy for ControllerProxy {
1512    type Protocol = ControllerMarker;
1513
1514    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1515        Self::new(inner)
1516    }
1517
1518    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1519        self.client.into_channel().map_err(|client| Self { client })
1520    }
1521
1522    fn as_channel(&self) -> &::fidl::AsyncChannel {
1523        self.client.as_channel()
1524    }
1525}
1526
1527impl ControllerProxy {
1528    /// Create a new Proxy for fuchsia.component/Controller.
1529    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1530        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1531        Self { client: fidl::client::Client::new(channel, protocol_name) }
1532    }
1533
1534    /// Get a Stream of events from the remote end of the protocol.
1535    ///
1536    /// # Panics
1537    ///
1538    /// Panics if the event stream was already taken.
1539    pub fn take_event_stream(&self) -> ControllerEventStream {
1540        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
1541    }
1542
1543    /// Start the component, optionally providing additional handles to be given
1544    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
1545    /// currently running.
1546    pub fn r#start(
1547        &self,
1548        mut args: StartChildArgs,
1549        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1550    ) -> fidl::client::QueryResponseFut<
1551        ControllerStartResult,
1552        fidl::encoding::DefaultFuchsiaResourceDialect,
1553    > {
1554        ControllerProxyInterface::r#start(self, args, execution_controller)
1555    }
1556
1557    /// Returns true if this instance is currently running.
1558    pub fn r#is_started(
1559        &self,
1560    ) -> fidl::client::QueryResponseFut<
1561        ControllerIsStartedResult,
1562        fidl::encoding::DefaultFuchsiaResourceDialect,
1563    > {
1564        ControllerProxyInterface::r#is_started(self)
1565    }
1566
1567    /// Opens the exposed directory of the controlled component, through which
1568    /// capabilities the component exposed via `ComponentDecl.exposes` are
1569    /// available, on success.
1570    ///
1571    /// Binding to the exposed directory requires that the component be
1572    /// resolved, but it will not be started until/unless some capability is
1573    /// requested that requires it to be.
1574    ///
1575    /// If this component is destroyed, any outstanding connections to
1576    /// `exposed_dir` will be closed.
1577    ///
1578    /// Errors:
1579    /// - `INSTANCE_CANNOT_RESOLVE`: This component failed to resolve.
1580    pub fn r#open_exposed_dir(
1581        &self,
1582        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1583    ) -> fidl::client::QueryResponseFut<
1584        ControllerOpenExposedDirResult,
1585        fidl::encoding::DefaultFuchsiaResourceDialect,
1586    > {
1587        ControllerProxyInterface::r#open_exposed_dir(self, exposed_dir)
1588    }
1589
1590    /// Returns the dictionary containing the component's exposed capabilities.
1591    pub fn r#get_exposed_dictionary(
1592        &self,
1593    ) -> fidl::client::QueryResponseFut<
1594        ControllerGetExposedDictionaryResult,
1595        fidl::encoding::DefaultFuchsiaResourceDialect,
1596    > {
1597        ControllerProxyInterface::r#get_exposed_dictionary(self)
1598    }
1599
1600    /// Returns a reference to the component's output dictionary, which may be
1601    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
1602    pub fn r#get_output_dictionary(
1603        &self,
1604    ) -> fidl::client::QueryResponseFut<
1605        ControllerGetOutputDictionaryResult,
1606        fidl::encoding::DefaultFuchsiaResourceDialect,
1607    > {
1608        ControllerProxyInterface::r#get_output_dictionary(self)
1609    }
1610
1611    /// Destroys this component. When this method returns, the component is
1612    /// either destroyed or in the case of an error no destruction happened.
1613    ///
1614    /// Errors:
1615    ///
1616    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1617    /// Currently, this can happen if the component is a static child of its
1618    /// parent.
1619    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1620    ///   manager's logs will contain more detail.
1621    pub fn r#destroy(
1622        &self,
1623    ) -> fidl::client::QueryResponseFut<
1624        ControllerDestroyResult,
1625        fidl::encoding::DefaultFuchsiaResourceDialect,
1626    > {
1627        ControllerProxyInterface::r#destroy(self)
1628    }
1629}
1630
1631impl ControllerProxyInterface for ControllerProxy {
1632    type StartResponseFut = fidl::client::QueryResponseFut<
1633        ControllerStartResult,
1634        fidl::encoding::DefaultFuchsiaResourceDialect,
1635    >;
1636    fn r#start(
1637        &self,
1638        mut args: StartChildArgs,
1639        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1640    ) -> Self::StartResponseFut {
1641        fn _decode(
1642            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1643        ) -> Result<ControllerStartResult, fidl::Error> {
1644            let _response = fidl::client::decode_transaction_body::<
1645                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1646                fidl::encoding::DefaultFuchsiaResourceDialect,
1647                0x68878076b8d2eac5,
1648            >(_buf?)?
1649            .into_result::<ControllerMarker>("start")?;
1650            Ok(_response.map(|x| x))
1651        }
1652        self.client.send_query_and_decode::<ControllerStartRequest, ControllerStartResult>(
1653            (&mut args, execution_controller),
1654            0x68878076b8d2eac5,
1655            fidl::encoding::DynamicFlags::FLEXIBLE,
1656            _decode,
1657        )
1658    }
1659
1660    type IsStartedResponseFut = fidl::client::QueryResponseFut<
1661        ControllerIsStartedResult,
1662        fidl::encoding::DefaultFuchsiaResourceDialect,
1663    >;
1664    fn r#is_started(&self) -> Self::IsStartedResponseFut {
1665        fn _decode(
1666            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1667        ) -> Result<ControllerIsStartedResult, fidl::Error> {
1668            let _response = fidl::client::decode_transaction_body::<
1669                fidl::encoding::FlexibleResultType<ControllerIsStartedResponse, Error>,
1670                fidl::encoding::DefaultFuchsiaResourceDialect,
1671                0x2155e6e1db2083c3,
1672            >(_buf?)?
1673            .into_result::<ControllerMarker>("is_started")?;
1674            Ok(_response.map(|x| x.is_started))
1675        }
1676        self.client
1677            .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerIsStartedResult>(
1678                (),
1679                0x2155e6e1db2083c3,
1680                fidl::encoding::DynamicFlags::FLEXIBLE,
1681                _decode,
1682            )
1683    }
1684
1685    type OpenExposedDirResponseFut = fidl::client::QueryResponseFut<
1686        ControllerOpenExposedDirResult,
1687        fidl::encoding::DefaultFuchsiaResourceDialect,
1688    >;
1689    fn r#open_exposed_dir(
1690        &self,
1691        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1692    ) -> Self::OpenExposedDirResponseFut {
1693        fn _decode(
1694            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1695        ) -> Result<ControllerOpenExposedDirResult, fidl::Error> {
1696            let _response = fidl::client::decode_transaction_body::<
1697                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1698                fidl::encoding::DefaultFuchsiaResourceDialect,
1699                0x253cabb9a840ed94,
1700            >(_buf?)?;
1701            Ok(_response.map(|x| x))
1702        }
1703        self.client.send_query_and_decode::<
1704            ControllerOpenExposedDirRequest,
1705            ControllerOpenExposedDirResult,
1706        >(
1707            (exposed_dir,),
1708            0x253cabb9a840ed94,
1709            fidl::encoding::DynamicFlags::empty(),
1710            _decode,
1711        )
1712    }
1713
1714    type GetExposedDictionaryResponseFut = fidl::client::QueryResponseFut<
1715        ControllerGetExposedDictionaryResult,
1716        fidl::encoding::DefaultFuchsiaResourceDialect,
1717    >;
1718    fn r#get_exposed_dictionary(&self) -> Self::GetExposedDictionaryResponseFut {
1719        fn _decode(
1720            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1721        ) -> Result<ControllerGetExposedDictionaryResult, fidl::Error> {
1722            let _response = fidl::client::decode_transaction_body::<
1723                fidl::encoding::FlexibleResultType<ControllerGetExposedDictionaryResponse, Error>,
1724                fidl::encoding::DefaultFuchsiaResourceDialect,
1725                0x7e48373e5eda1f9b,
1726            >(_buf?)?
1727            .into_result::<ControllerMarker>("get_exposed_dictionary")?;
1728            Ok(_response.map(|x| x.dictionary))
1729        }
1730        self.client.send_query_and_decode::<
1731            fidl::encoding::EmptyPayload,
1732            ControllerGetExposedDictionaryResult,
1733        >(
1734            (),
1735            0x7e48373e5eda1f9b,
1736            fidl::encoding::DynamicFlags::FLEXIBLE,
1737            _decode,
1738        )
1739    }
1740
1741    type GetOutputDictionaryResponseFut = fidl::client::QueryResponseFut<
1742        ControllerGetOutputDictionaryResult,
1743        fidl::encoding::DefaultFuchsiaResourceDialect,
1744    >;
1745    fn r#get_output_dictionary(&self) -> Self::GetOutputDictionaryResponseFut {
1746        fn _decode(
1747            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1748        ) -> Result<ControllerGetOutputDictionaryResult, fidl::Error> {
1749            let _response = fidl::client::decode_transaction_body::<
1750                fidl::encoding::FlexibleResultType<ControllerGetOutputDictionaryResponse, Error>,
1751                fidl::encoding::DefaultFuchsiaResourceDialect,
1752                0x3a0c4696620ad221,
1753            >(_buf?)?
1754            .into_result::<ControllerMarker>("get_output_dictionary")?;
1755            Ok(_response.map(|x| x.dictionary))
1756        }
1757        self.client.send_query_and_decode::<
1758            fidl::encoding::EmptyPayload,
1759            ControllerGetOutputDictionaryResult,
1760        >(
1761            (),
1762            0x3a0c4696620ad221,
1763            fidl::encoding::DynamicFlags::FLEXIBLE,
1764            _decode,
1765        )
1766    }
1767
1768    type DestroyResponseFut = fidl::client::QueryResponseFut<
1769        ControllerDestroyResult,
1770        fidl::encoding::DefaultFuchsiaResourceDialect,
1771    >;
1772    fn r#destroy(&self) -> Self::DestroyResponseFut {
1773        fn _decode(
1774            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1775        ) -> Result<ControllerDestroyResult, fidl::Error> {
1776            let _response = fidl::client::decode_transaction_body::<
1777                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1778                fidl::encoding::DefaultFuchsiaResourceDialect,
1779                0x74529fa68b5c1741,
1780            >(_buf?)?
1781            .into_result::<ControllerMarker>("destroy")?;
1782            Ok(_response.map(|x| x))
1783        }
1784        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerDestroyResult>(
1785            (),
1786            0x74529fa68b5c1741,
1787            fidl::encoding::DynamicFlags::FLEXIBLE,
1788            _decode,
1789        )
1790    }
1791}
1792
1793pub struct ControllerEventStream {
1794    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1795}
1796
1797impl std::marker::Unpin for ControllerEventStream {}
1798
1799impl futures::stream::FusedStream for ControllerEventStream {
1800    fn is_terminated(&self) -> bool {
1801        self.event_receiver.is_terminated()
1802    }
1803}
1804
1805impl futures::Stream for ControllerEventStream {
1806    type Item = Result<ControllerEvent, fidl::Error>;
1807
1808    fn poll_next(
1809        mut self: std::pin::Pin<&mut Self>,
1810        cx: &mut std::task::Context<'_>,
1811    ) -> std::task::Poll<Option<Self::Item>> {
1812        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1813            &mut self.event_receiver,
1814            cx
1815        )?) {
1816            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
1817            None => std::task::Poll::Ready(None),
1818        }
1819    }
1820}
1821
1822#[derive(Debug)]
1823pub enum ControllerEvent {
1824    #[non_exhaustive]
1825    _UnknownEvent {
1826        /// Ordinal of the event that was sent.
1827        ordinal: u64,
1828    },
1829}
1830
1831impl ControllerEvent {
1832    /// Decodes a message buffer as a [`ControllerEvent`].
1833    fn decode(
1834        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1835    ) -> Result<ControllerEvent, fidl::Error> {
1836        let (bytes, _handles) = buf.split_mut();
1837        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1838        debug_assert_eq!(tx_header.tx_id, 0);
1839        match tx_header.ordinal {
1840            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1841                Ok(ControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1842            }
1843            _ => Err(fidl::Error::UnknownOrdinal {
1844                ordinal: tx_header.ordinal,
1845                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1846            }),
1847        }
1848    }
1849}
1850
1851/// A Stream of incoming requests for fuchsia.component/Controller.
1852pub struct ControllerRequestStream {
1853    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1854    is_terminated: bool,
1855}
1856
1857impl std::marker::Unpin for ControllerRequestStream {}
1858
1859impl futures::stream::FusedStream for ControllerRequestStream {
1860    fn is_terminated(&self) -> bool {
1861        self.is_terminated
1862    }
1863}
1864
1865impl fidl::endpoints::RequestStream for ControllerRequestStream {
1866    type Protocol = ControllerMarker;
1867    type ControlHandle = ControllerControlHandle;
1868
1869    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1870        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1871    }
1872
1873    fn control_handle(&self) -> Self::ControlHandle {
1874        ControllerControlHandle { inner: self.inner.clone() }
1875    }
1876
1877    fn into_inner(
1878        self,
1879    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1880    {
1881        (self.inner, self.is_terminated)
1882    }
1883
1884    fn from_inner(
1885        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1886        is_terminated: bool,
1887    ) -> Self {
1888        Self { inner, is_terminated }
1889    }
1890}
1891
1892impl futures::Stream for ControllerRequestStream {
1893    type Item = Result<ControllerRequest, fidl::Error>;
1894
1895    fn poll_next(
1896        mut self: std::pin::Pin<&mut Self>,
1897        cx: &mut std::task::Context<'_>,
1898    ) -> std::task::Poll<Option<Self::Item>> {
1899        let this = &mut *self;
1900        if this.inner.check_shutdown(cx) {
1901            this.is_terminated = true;
1902            return std::task::Poll::Ready(None);
1903        }
1904        if this.is_terminated {
1905            panic!("polled ControllerRequestStream after completion");
1906        }
1907        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1908            |bytes, handles| {
1909                match this.inner.channel().read_etc(cx, bytes, handles) {
1910                    std::task::Poll::Ready(Ok(())) => {}
1911                    std::task::Poll::Pending => return std::task::Poll::Pending,
1912                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1913                        this.is_terminated = true;
1914                        return std::task::Poll::Ready(None);
1915                    }
1916                    std::task::Poll::Ready(Err(e)) => {
1917                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1918                            e.into(),
1919                        ))));
1920                    }
1921                }
1922
1923                // A message has been received from the channel
1924                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1925
1926                std::task::Poll::Ready(Some(match header.ordinal {
1927                    0x68878076b8d2eac5 => {
1928                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1929                        let mut req = fidl::new_empty!(
1930                            ControllerStartRequest,
1931                            fidl::encoding::DefaultFuchsiaResourceDialect
1932                        );
1933                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerStartRequest>(&header, _body_bytes, handles, &mut req)?;
1934                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1935                        Ok(ControllerRequest::Start {
1936                            args: req.args,
1937                            execution_controller: req.execution_controller,
1938
1939                            responder: ControllerStartResponder {
1940                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1941                                tx_id: header.tx_id,
1942                            },
1943                        })
1944                    }
1945                    0x2155e6e1db2083c3 => {
1946                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1947                        let mut req = fidl::new_empty!(
1948                            fidl::encoding::EmptyPayload,
1949                            fidl::encoding::DefaultFuchsiaResourceDialect
1950                        );
1951                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1952                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1953                        Ok(ControllerRequest::IsStarted {
1954                            responder: ControllerIsStartedResponder {
1955                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1956                                tx_id: header.tx_id,
1957                            },
1958                        })
1959                    }
1960                    0x253cabb9a840ed94 => {
1961                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1962                        let mut req = fidl::new_empty!(
1963                            ControllerOpenExposedDirRequest,
1964                            fidl::encoding::DefaultFuchsiaResourceDialect
1965                        );
1966                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerOpenExposedDirRequest>(&header, _body_bytes, handles, &mut req)?;
1967                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1968                        Ok(ControllerRequest::OpenExposedDir {
1969                            exposed_dir: req.exposed_dir,
1970
1971                            responder: ControllerOpenExposedDirResponder {
1972                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1973                                tx_id: header.tx_id,
1974                            },
1975                        })
1976                    }
1977                    0x7e48373e5eda1f9b => {
1978                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1979                        let mut req = fidl::new_empty!(
1980                            fidl::encoding::EmptyPayload,
1981                            fidl::encoding::DefaultFuchsiaResourceDialect
1982                        );
1983                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1984                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1985                        Ok(ControllerRequest::GetExposedDictionary {
1986                            responder: ControllerGetExposedDictionaryResponder {
1987                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1988                                tx_id: header.tx_id,
1989                            },
1990                        })
1991                    }
1992                    0x3a0c4696620ad221 => {
1993                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1994                        let mut req = fidl::new_empty!(
1995                            fidl::encoding::EmptyPayload,
1996                            fidl::encoding::DefaultFuchsiaResourceDialect
1997                        );
1998                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1999                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
2000                        Ok(ControllerRequest::GetOutputDictionary {
2001                            responder: ControllerGetOutputDictionaryResponder {
2002                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2003                                tx_id: header.tx_id,
2004                            },
2005                        })
2006                    }
2007                    0x74529fa68b5c1741 => {
2008                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2009                        let mut req = fidl::new_empty!(
2010                            fidl::encoding::EmptyPayload,
2011                            fidl::encoding::DefaultFuchsiaResourceDialect
2012                        );
2013                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2014                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
2015                        Ok(ControllerRequest::Destroy {
2016                            responder: ControllerDestroyResponder {
2017                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2018                                tx_id: header.tx_id,
2019                            },
2020                        })
2021                    }
2022                    _ if header.tx_id == 0
2023                        && header
2024                            .dynamic_flags()
2025                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2026                    {
2027                        Ok(ControllerRequest::_UnknownMethod {
2028                            ordinal: header.ordinal,
2029                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
2030                            method_type: fidl::MethodType::OneWay,
2031                        })
2032                    }
2033                    _ if header
2034                        .dynamic_flags()
2035                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2036                    {
2037                        this.inner.send_framework_err(
2038                            fidl::encoding::FrameworkErr::UnknownMethod,
2039                            header.tx_id,
2040                            header.ordinal,
2041                            header.dynamic_flags(),
2042                            (bytes, handles),
2043                        )?;
2044                        Ok(ControllerRequest::_UnknownMethod {
2045                            ordinal: header.ordinal,
2046                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
2047                            method_type: fidl::MethodType::TwoWay,
2048                        })
2049                    }
2050                    _ => Err(fidl::Error::UnknownOrdinal {
2051                        ordinal: header.ordinal,
2052                        protocol_name:
2053                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2054                    }),
2055                }))
2056            },
2057        )
2058    }
2059}
2060
2061/// A protocol used to operate on a component.
2062///
2063/// One may get access to a `Controller` when creating a component with the
2064/// `Realm.CreateChild` method. You may also obtain a `Controller` for an
2065/// existing child component with the `Realm.OpenController` method.
2066#[derive(Debug)]
2067pub enum ControllerRequest {
2068    /// Start the component, optionally providing additional handles to be given
2069    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
2070    /// currently running.
2071    Start {
2072        args: StartChildArgs,
2073        execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
2074        responder: ControllerStartResponder,
2075    },
2076    /// Returns true if this instance is currently running.
2077    IsStarted { responder: ControllerIsStartedResponder },
2078    /// Opens the exposed directory of the controlled component, through which
2079    /// capabilities the component exposed via `ComponentDecl.exposes` are
2080    /// available, on success.
2081    ///
2082    /// Binding to the exposed directory requires that the component be
2083    /// resolved, but it will not be started until/unless some capability is
2084    /// requested that requires it to be.
2085    ///
2086    /// If this component is destroyed, any outstanding connections to
2087    /// `exposed_dir` will be closed.
2088    ///
2089    /// Errors:
2090    /// - `INSTANCE_CANNOT_RESOLVE`: This component failed to resolve.
2091    OpenExposedDir {
2092        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2093        responder: ControllerOpenExposedDirResponder,
2094    },
2095    /// Returns the dictionary containing the component's exposed capabilities.
2096    GetExposedDictionary { responder: ControllerGetExposedDictionaryResponder },
2097    /// Returns a reference to the component's output dictionary, which may be
2098    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
2099    GetOutputDictionary { responder: ControllerGetOutputDictionaryResponder },
2100    /// Destroys this component. When this method returns, the component is
2101    /// either destroyed or in the case of an error no destruction happened.
2102    ///
2103    /// Errors:
2104    ///
2105    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
2106    /// Currently, this can happen if the component is a static child of its
2107    /// parent.
2108    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
2109    ///   manager's logs will contain more detail.
2110    Destroy { responder: ControllerDestroyResponder },
2111    /// An interaction was received which does not match any known method.
2112    #[non_exhaustive]
2113    _UnknownMethod {
2114        /// Ordinal of the method that was called.
2115        ordinal: u64,
2116        control_handle: ControllerControlHandle,
2117        method_type: fidl::MethodType,
2118    },
2119}
2120
2121impl ControllerRequest {
2122    #[allow(irrefutable_let_patterns)]
2123    pub fn into_start(
2124        self,
2125    ) -> Option<(
2126        StartChildArgs,
2127        fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
2128        ControllerStartResponder,
2129    )> {
2130        if let ControllerRequest::Start { args, execution_controller, responder } = self {
2131            Some((args, execution_controller, responder))
2132        } else {
2133            None
2134        }
2135    }
2136
2137    #[allow(irrefutable_let_patterns)]
2138    pub fn into_is_started(self) -> Option<(ControllerIsStartedResponder)> {
2139        if let ControllerRequest::IsStarted { responder } = self { Some((responder)) } else { None }
2140    }
2141
2142    #[allow(irrefutable_let_patterns)]
2143    pub fn into_open_exposed_dir(
2144        self,
2145    ) -> Option<(
2146        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2147        ControllerOpenExposedDirResponder,
2148    )> {
2149        if let ControllerRequest::OpenExposedDir { exposed_dir, responder } = self {
2150            Some((exposed_dir, responder))
2151        } else {
2152            None
2153        }
2154    }
2155
2156    #[allow(irrefutable_let_patterns)]
2157    pub fn into_get_exposed_dictionary(self) -> Option<(ControllerGetExposedDictionaryResponder)> {
2158        if let ControllerRequest::GetExposedDictionary { responder } = self {
2159            Some((responder))
2160        } else {
2161            None
2162        }
2163    }
2164
2165    #[allow(irrefutable_let_patterns)]
2166    pub fn into_get_output_dictionary(self) -> Option<(ControllerGetOutputDictionaryResponder)> {
2167        if let ControllerRequest::GetOutputDictionary { responder } = self {
2168            Some((responder))
2169        } else {
2170            None
2171        }
2172    }
2173
2174    #[allow(irrefutable_let_patterns)]
2175    pub fn into_destroy(self) -> Option<(ControllerDestroyResponder)> {
2176        if let ControllerRequest::Destroy { responder } = self { Some((responder)) } else { None }
2177    }
2178
2179    /// Name of the method defined in FIDL
2180    pub fn method_name(&self) -> &'static str {
2181        match *self {
2182            ControllerRequest::Start { .. } => "start",
2183            ControllerRequest::IsStarted { .. } => "is_started",
2184            ControllerRequest::OpenExposedDir { .. } => "open_exposed_dir",
2185            ControllerRequest::GetExposedDictionary { .. } => "get_exposed_dictionary",
2186            ControllerRequest::GetOutputDictionary { .. } => "get_output_dictionary",
2187            ControllerRequest::Destroy { .. } => "destroy",
2188            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2189                "unknown one-way method"
2190            }
2191            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2192                "unknown two-way method"
2193            }
2194        }
2195    }
2196}
2197
2198#[derive(Debug, Clone)]
2199pub struct ControllerControlHandle {
2200    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2201}
2202
2203impl fidl::endpoints::ControlHandle for ControllerControlHandle {
2204    fn shutdown(&self) {
2205        self.inner.shutdown()
2206    }
2207
2208    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2209        self.inner.shutdown_with_epitaph(status)
2210    }
2211
2212    fn is_closed(&self) -> bool {
2213        self.inner.channel().is_closed()
2214    }
2215    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2216        self.inner.channel().on_closed()
2217    }
2218
2219    #[cfg(target_os = "fuchsia")]
2220    fn signal_peer(
2221        &self,
2222        clear_mask: zx::Signals,
2223        set_mask: zx::Signals,
2224    ) -> Result<(), zx_status::Status> {
2225        use fidl::Peered;
2226        self.inner.channel().signal_peer(clear_mask, set_mask)
2227    }
2228}
2229
2230impl ControllerControlHandle {}
2231
2232#[must_use = "FIDL methods require a response to be sent"]
2233#[derive(Debug)]
2234pub struct ControllerStartResponder {
2235    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2236    tx_id: u32,
2237}
2238
2239/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2240/// if the responder is dropped without sending a response, so that the client
2241/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2242impl std::ops::Drop for ControllerStartResponder {
2243    fn drop(&mut self) {
2244        self.control_handle.shutdown();
2245        // Safety: drops once, never accessed again
2246        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2247    }
2248}
2249
2250impl fidl::endpoints::Responder for ControllerStartResponder {
2251    type ControlHandle = ControllerControlHandle;
2252
2253    fn control_handle(&self) -> &ControllerControlHandle {
2254        &self.control_handle
2255    }
2256
2257    fn drop_without_shutdown(mut self) {
2258        // Safety: drops once, never accessed again due to mem::forget
2259        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2260        // Prevent Drop from running (which would shut down the channel)
2261        std::mem::forget(self);
2262    }
2263}
2264
2265impl ControllerStartResponder {
2266    /// Sends a response to the FIDL transaction.
2267    ///
2268    /// Sets the channel to shutdown if an error occurs.
2269    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2270        let _result = self.send_raw(result);
2271        if _result.is_err() {
2272            self.control_handle.shutdown();
2273        }
2274        self.drop_without_shutdown();
2275        _result
2276    }
2277
2278    /// Similar to "send" but does not shutdown the channel if an error occurs.
2279    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2280        let _result = self.send_raw(result);
2281        self.drop_without_shutdown();
2282        _result
2283    }
2284
2285    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2286        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2287            fidl::encoding::EmptyStruct,
2288            Error,
2289        >>(
2290            fidl::encoding::FlexibleResult::new(result),
2291            self.tx_id,
2292            0x68878076b8d2eac5,
2293            fidl::encoding::DynamicFlags::FLEXIBLE,
2294        )
2295    }
2296}
2297
2298#[must_use = "FIDL methods require a response to be sent"]
2299#[derive(Debug)]
2300pub struct ControllerIsStartedResponder {
2301    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2302    tx_id: u32,
2303}
2304
2305/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2306/// if the responder is dropped without sending a response, so that the client
2307/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2308impl std::ops::Drop for ControllerIsStartedResponder {
2309    fn drop(&mut self) {
2310        self.control_handle.shutdown();
2311        // Safety: drops once, never accessed again
2312        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2313    }
2314}
2315
2316impl fidl::endpoints::Responder for ControllerIsStartedResponder {
2317    type ControlHandle = ControllerControlHandle;
2318
2319    fn control_handle(&self) -> &ControllerControlHandle {
2320        &self.control_handle
2321    }
2322
2323    fn drop_without_shutdown(mut self) {
2324        // Safety: drops once, never accessed again due to mem::forget
2325        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2326        // Prevent Drop from running (which would shut down the channel)
2327        std::mem::forget(self);
2328    }
2329}
2330
2331impl ControllerIsStartedResponder {
2332    /// Sends a response to the FIDL transaction.
2333    ///
2334    /// Sets the channel to shutdown if an error occurs.
2335    pub fn send(self, mut result: Result<bool, Error>) -> Result<(), fidl::Error> {
2336        let _result = self.send_raw(result);
2337        if _result.is_err() {
2338            self.control_handle.shutdown();
2339        }
2340        self.drop_without_shutdown();
2341        _result
2342    }
2343
2344    /// Similar to "send" but does not shutdown the channel if an error occurs.
2345    pub fn send_no_shutdown_on_err(
2346        self,
2347        mut result: Result<bool, Error>,
2348    ) -> Result<(), fidl::Error> {
2349        let _result = self.send_raw(result);
2350        self.drop_without_shutdown();
2351        _result
2352    }
2353
2354    fn send_raw(&self, mut result: Result<bool, Error>) -> Result<(), fidl::Error> {
2355        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2356            ControllerIsStartedResponse,
2357            Error,
2358        >>(
2359            fidl::encoding::FlexibleResult::new(result.map(|is_started| (is_started,))),
2360            self.tx_id,
2361            0x2155e6e1db2083c3,
2362            fidl::encoding::DynamicFlags::FLEXIBLE,
2363        )
2364    }
2365}
2366
2367#[must_use = "FIDL methods require a response to be sent"]
2368#[derive(Debug)]
2369pub struct ControllerOpenExposedDirResponder {
2370    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2371    tx_id: u32,
2372}
2373
2374/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2375/// if the responder is dropped without sending a response, so that the client
2376/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2377impl std::ops::Drop for ControllerOpenExposedDirResponder {
2378    fn drop(&mut self) {
2379        self.control_handle.shutdown();
2380        // Safety: drops once, never accessed again
2381        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2382    }
2383}
2384
2385impl fidl::endpoints::Responder for ControllerOpenExposedDirResponder {
2386    type ControlHandle = ControllerControlHandle;
2387
2388    fn control_handle(&self) -> &ControllerControlHandle {
2389        &self.control_handle
2390    }
2391
2392    fn drop_without_shutdown(mut self) {
2393        // Safety: drops once, never accessed again due to mem::forget
2394        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2395        // Prevent Drop from running (which would shut down the channel)
2396        std::mem::forget(self);
2397    }
2398}
2399
2400impl ControllerOpenExposedDirResponder {
2401    /// Sends a response to the FIDL transaction.
2402    ///
2403    /// Sets the channel to shutdown if an error occurs.
2404    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2405        let _result = self.send_raw(result);
2406        if _result.is_err() {
2407            self.control_handle.shutdown();
2408        }
2409        self.drop_without_shutdown();
2410        _result
2411    }
2412
2413    /// Similar to "send" but does not shutdown the channel if an error occurs.
2414    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2415        let _result = self.send_raw(result);
2416        self.drop_without_shutdown();
2417        _result
2418    }
2419
2420    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2421        self.control_handle
2422            .inner
2423            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2424                result,
2425                self.tx_id,
2426                0x253cabb9a840ed94,
2427                fidl::encoding::DynamicFlags::empty(),
2428            )
2429    }
2430}
2431
2432#[must_use = "FIDL methods require a response to be sent"]
2433#[derive(Debug)]
2434pub struct ControllerGetExposedDictionaryResponder {
2435    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2436    tx_id: u32,
2437}
2438
2439/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2440/// if the responder is dropped without sending a response, so that the client
2441/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2442impl std::ops::Drop for ControllerGetExposedDictionaryResponder {
2443    fn drop(&mut self) {
2444        self.control_handle.shutdown();
2445        // Safety: drops once, never accessed again
2446        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2447    }
2448}
2449
2450impl fidl::endpoints::Responder for ControllerGetExposedDictionaryResponder {
2451    type ControlHandle = ControllerControlHandle;
2452
2453    fn control_handle(&self) -> &ControllerControlHandle {
2454        &self.control_handle
2455    }
2456
2457    fn drop_without_shutdown(mut self) {
2458        // Safety: drops once, never accessed again due to mem::forget
2459        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2460        // Prevent Drop from running (which would shut down the channel)
2461        std::mem::forget(self);
2462    }
2463}
2464
2465impl ControllerGetExposedDictionaryResponder {
2466    /// Sends a response to the FIDL transaction.
2467    ///
2468    /// Sets the channel to shutdown if an error occurs.
2469    pub fn send(
2470        self,
2471        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2472    ) -> Result<(), fidl::Error> {
2473        let _result = self.send_raw(result);
2474        if _result.is_err() {
2475            self.control_handle.shutdown();
2476        }
2477        self.drop_without_shutdown();
2478        _result
2479    }
2480
2481    /// Similar to "send" but does not shutdown the channel if an error occurs.
2482    pub fn send_no_shutdown_on_err(
2483        self,
2484        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2485    ) -> Result<(), fidl::Error> {
2486        let _result = self.send_raw(result);
2487        self.drop_without_shutdown();
2488        _result
2489    }
2490
2491    fn send_raw(
2492        &self,
2493        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2494    ) -> Result<(), fidl::Error> {
2495        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2496            ControllerGetExposedDictionaryResponse,
2497            Error,
2498        >>(
2499            fidl::encoding::FlexibleResult::new(
2500                result.as_mut().map_err(|e| *e).map(|dictionary| (dictionary,)),
2501            ),
2502            self.tx_id,
2503            0x7e48373e5eda1f9b,
2504            fidl::encoding::DynamicFlags::FLEXIBLE,
2505        )
2506    }
2507}
2508
2509#[must_use = "FIDL methods require a response to be sent"]
2510#[derive(Debug)]
2511pub struct ControllerGetOutputDictionaryResponder {
2512    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2513    tx_id: u32,
2514}
2515
2516/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2517/// if the responder is dropped without sending a response, so that the client
2518/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2519impl std::ops::Drop for ControllerGetOutputDictionaryResponder {
2520    fn drop(&mut self) {
2521        self.control_handle.shutdown();
2522        // Safety: drops once, never accessed again
2523        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2524    }
2525}
2526
2527impl fidl::endpoints::Responder for ControllerGetOutputDictionaryResponder {
2528    type ControlHandle = ControllerControlHandle;
2529
2530    fn control_handle(&self) -> &ControllerControlHandle {
2531        &self.control_handle
2532    }
2533
2534    fn drop_without_shutdown(mut self) {
2535        // Safety: drops once, never accessed again due to mem::forget
2536        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2537        // Prevent Drop from running (which would shut down the channel)
2538        std::mem::forget(self);
2539    }
2540}
2541
2542impl ControllerGetOutputDictionaryResponder {
2543    /// Sends a response to the FIDL transaction.
2544    ///
2545    /// Sets the channel to shutdown if an error occurs.
2546    pub fn send(self, mut result: Result<fidl::EventPair, Error>) -> Result<(), fidl::Error> {
2547        let _result = self.send_raw(result);
2548        if _result.is_err() {
2549            self.control_handle.shutdown();
2550        }
2551        self.drop_without_shutdown();
2552        _result
2553    }
2554
2555    /// Similar to "send" but does not shutdown the channel if an error occurs.
2556    pub fn send_no_shutdown_on_err(
2557        self,
2558        mut result: Result<fidl::EventPair, Error>,
2559    ) -> Result<(), fidl::Error> {
2560        let _result = self.send_raw(result);
2561        self.drop_without_shutdown();
2562        _result
2563    }
2564
2565    fn send_raw(&self, mut result: Result<fidl::EventPair, Error>) -> Result<(), fidl::Error> {
2566        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2567            ControllerGetOutputDictionaryResponse,
2568            Error,
2569        >>(
2570            fidl::encoding::FlexibleResult::new(result.map(|dictionary| (dictionary,))),
2571            self.tx_id,
2572            0x3a0c4696620ad221,
2573            fidl::encoding::DynamicFlags::FLEXIBLE,
2574        )
2575    }
2576}
2577
2578#[must_use = "FIDL methods require a response to be sent"]
2579#[derive(Debug)]
2580pub struct ControllerDestroyResponder {
2581    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2582    tx_id: u32,
2583}
2584
2585/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2586/// if the responder is dropped without sending a response, so that the client
2587/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2588impl std::ops::Drop for ControllerDestroyResponder {
2589    fn drop(&mut self) {
2590        self.control_handle.shutdown();
2591        // Safety: drops once, never accessed again
2592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2593    }
2594}
2595
2596impl fidl::endpoints::Responder for ControllerDestroyResponder {
2597    type ControlHandle = ControllerControlHandle;
2598
2599    fn control_handle(&self) -> &ControllerControlHandle {
2600        &self.control_handle
2601    }
2602
2603    fn drop_without_shutdown(mut self) {
2604        // Safety: drops once, never accessed again due to mem::forget
2605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2606        // Prevent Drop from running (which would shut down the channel)
2607        std::mem::forget(self);
2608    }
2609}
2610
2611impl ControllerDestroyResponder {
2612    /// Sends a response to the FIDL transaction.
2613    ///
2614    /// Sets the channel to shutdown if an error occurs.
2615    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2616        let _result = self.send_raw(result);
2617        if _result.is_err() {
2618            self.control_handle.shutdown();
2619        }
2620        self.drop_without_shutdown();
2621        _result
2622    }
2623
2624    /// Similar to "send" but does not shutdown the channel if an error occurs.
2625    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2626        let _result = self.send_raw(result);
2627        self.drop_without_shutdown();
2628        _result
2629    }
2630
2631    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2632        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2633            fidl::encoding::EmptyStruct,
2634            Error,
2635        >>(
2636            fidl::encoding::FlexibleResult::new(result),
2637            self.tx_id,
2638            0x74529fa68b5c1741,
2639            fidl::encoding::DynamicFlags::FLEXIBLE,
2640        )
2641    }
2642}
2643
2644#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2645pub struct EventStreamMarker;
2646
2647impl fidl::endpoints::ProtocolMarker for EventStreamMarker {
2648    type Proxy = EventStreamProxy;
2649    type RequestStream = EventStreamRequestStream;
2650    #[cfg(target_os = "fuchsia")]
2651    type SynchronousProxy = EventStreamSynchronousProxy;
2652
2653    const DEBUG_NAME: &'static str = "fuchsia.component.EventStream";
2654}
2655impl fidl::endpoints::DiscoverableProtocolMarker for EventStreamMarker {}
2656
2657pub trait EventStreamProxyInterface: Send + Sync {
2658    type GetNextResponseFut: std::future::Future<Output = Result<Vec<Event>, fidl::Error>> + Send;
2659    fn r#get_next(&self) -> Self::GetNextResponseFut;
2660    type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2661    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
2662}
2663#[derive(Debug)]
2664#[cfg(target_os = "fuchsia")]
2665pub struct EventStreamSynchronousProxy {
2666    client: fidl::client::sync::Client,
2667}
2668
2669#[cfg(target_os = "fuchsia")]
2670impl fidl::endpoints::SynchronousProxy for EventStreamSynchronousProxy {
2671    type Proxy = EventStreamProxy;
2672    type Protocol = EventStreamMarker;
2673
2674    fn from_channel(inner: fidl::Channel) -> Self {
2675        Self::new(inner)
2676    }
2677
2678    fn into_channel(self) -> fidl::Channel {
2679        self.client.into_channel()
2680    }
2681
2682    fn as_channel(&self) -> &fidl::Channel {
2683        self.client.as_channel()
2684    }
2685}
2686
2687#[cfg(target_os = "fuchsia")]
2688impl EventStreamSynchronousProxy {
2689    pub fn new(channel: fidl::Channel) -> Self {
2690        let protocol_name = <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2691        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2692    }
2693
2694    pub fn into_channel(self) -> fidl::Channel {
2695        self.client.into_channel()
2696    }
2697
2698    /// Waits until an event arrives and returns it. It is safe for other
2699    /// threads to make concurrent requests while waiting for an event.
2700    pub fn wait_for_event(
2701        &self,
2702        deadline: zx::MonotonicInstant,
2703    ) -> Result<EventStreamEvent, fidl::Error> {
2704        EventStreamEvent::decode(self.client.wait_for_event(deadline)?)
2705    }
2706
2707    pub fn r#get_next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Event>, fidl::Error> {
2708        let _response =
2709            self.client.send_query::<fidl::encoding::EmptyPayload, EventStreamGetNextResponse>(
2710                (),
2711                0x3f24c9495978eb86,
2712                fidl::encoding::DynamicFlags::empty(),
2713                ___deadline,
2714            )?;
2715        Ok(_response.events)
2716    }
2717
2718    /// Returns immediately. Used to indicate that the FIDL connection
2719    /// completed. This is needed for non-static streams to verify
2720    /// that subscribe has completed before components are started.
2721    pub fn r#wait_for_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
2722        let _response =
2723            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
2724                (),
2725                0x31331f9578d2e682,
2726                fidl::encoding::DynamicFlags::empty(),
2727                ___deadline,
2728            )?;
2729        Ok(_response)
2730    }
2731}
2732
2733#[cfg(target_os = "fuchsia")]
2734impl From<EventStreamSynchronousProxy> for zx::NullableHandle {
2735    fn from(value: EventStreamSynchronousProxy) -> Self {
2736        value.into_channel().into()
2737    }
2738}
2739
2740#[cfg(target_os = "fuchsia")]
2741impl From<fidl::Channel> for EventStreamSynchronousProxy {
2742    fn from(value: fidl::Channel) -> Self {
2743        Self::new(value)
2744    }
2745}
2746
2747#[cfg(target_os = "fuchsia")]
2748impl fidl::endpoints::FromClient for EventStreamSynchronousProxy {
2749    type Protocol = EventStreamMarker;
2750
2751    fn from_client(value: fidl::endpoints::ClientEnd<EventStreamMarker>) -> Self {
2752        Self::new(value.into_channel())
2753    }
2754}
2755
2756#[derive(Debug, Clone)]
2757pub struct EventStreamProxy {
2758    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2759}
2760
2761impl fidl::endpoints::Proxy for EventStreamProxy {
2762    type Protocol = EventStreamMarker;
2763
2764    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2765        Self::new(inner)
2766    }
2767
2768    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2769        self.client.into_channel().map_err(|client| Self { client })
2770    }
2771
2772    fn as_channel(&self) -> &::fidl::AsyncChannel {
2773        self.client.as_channel()
2774    }
2775}
2776
2777impl EventStreamProxy {
2778    /// Create a new Proxy for fuchsia.component/EventStream.
2779    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2780        let protocol_name = <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2781        Self { client: fidl::client::Client::new(channel, protocol_name) }
2782    }
2783
2784    /// Get a Stream of events from the remote end of the protocol.
2785    ///
2786    /// # Panics
2787    ///
2788    /// Panics if the event stream was already taken.
2789    pub fn take_event_stream(&self) -> EventStreamEventStream {
2790        EventStreamEventStream { event_receiver: self.client.take_event_receiver() }
2791    }
2792
2793    pub fn r#get_next(
2794        &self,
2795    ) -> fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>
2796    {
2797        EventStreamProxyInterface::r#get_next(self)
2798    }
2799
2800    /// Returns immediately. Used to indicate that the FIDL connection
2801    /// completed. This is needed for non-static streams to verify
2802    /// that subscribe has completed before components are started.
2803    pub fn r#wait_for_ready(
2804        &self,
2805    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2806        EventStreamProxyInterface::r#wait_for_ready(self)
2807    }
2808}
2809
2810impl EventStreamProxyInterface for EventStreamProxy {
2811    type GetNextResponseFut =
2812        fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2813    fn r#get_next(&self) -> Self::GetNextResponseFut {
2814        fn _decode(
2815            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2816        ) -> Result<Vec<Event>, fidl::Error> {
2817            let _response = fidl::client::decode_transaction_body::<
2818                EventStreamGetNextResponse,
2819                fidl::encoding::DefaultFuchsiaResourceDialect,
2820                0x3f24c9495978eb86,
2821            >(_buf?)?;
2822            Ok(_response.events)
2823        }
2824        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Event>>(
2825            (),
2826            0x3f24c9495978eb86,
2827            fidl::encoding::DynamicFlags::empty(),
2828            _decode,
2829        )
2830    }
2831
2832    type WaitForReadyResponseFut =
2833        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2834    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
2835        fn _decode(
2836            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2837        ) -> Result<(), fidl::Error> {
2838            let _response = fidl::client::decode_transaction_body::<
2839                fidl::encoding::EmptyPayload,
2840                fidl::encoding::DefaultFuchsiaResourceDialect,
2841                0x31331f9578d2e682,
2842            >(_buf?)?;
2843            Ok(_response)
2844        }
2845        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2846            (),
2847            0x31331f9578d2e682,
2848            fidl::encoding::DynamicFlags::empty(),
2849            _decode,
2850        )
2851    }
2852}
2853
2854pub struct EventStreamEventStream {
2855    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2856}
2857
2858impl std::marker::Unpin for EventStreamEventStream {}
2859
2860impl futures::stream::FusedStream for EventStreamEventStream {
2861    fn is_terminated(&self) -> bool {
2862        self.event_receiver.is_terminated()
2863    }
2864}
2865
2866impl futures::Stream for EventStreamEventStream {
2867    type Item = Result<EventStreamEvent, fidl::Error>;
2868
2869    fn poll_next(
2870        mut self: std::pin::Pin<&mut Self>,
2871        cx: &mut std::task::Context<'_>,
2872    ) -> std::task::Poll<Option<Self::Item>> {
2873        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2874            &mut self.event_receiver,
2875            cx
2876        )?) {
2877            Some(buf) => std::task::Poll::Ready(Some(EventStreamEvent::decode(buf))),
2878            None => std::task::Poll::Ready(None),
2879        }
2880    }
2881}
2882
2883#[derive(Debug)]
2884pub enum EventStreamEvent {}
2885
2886impl EventStreamEvent {
2887    /// Decodes a message buffer as a [`EventStreamEvent`].
2888    fn decode(
2889        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2890    ) -> Result<EventStreamEvent, fidl::Error> {
2891        let (bytes, _handles) = buf.split_mut();
2892        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2893        debug_assert_eq!(tx_header.tx_id, 0);
2894        match tx_header.ordinal {
2895            _ => Err(fidl::Error::UnknownOrdinal {
2896                ordinal: tx_header.ordinal,
2897                protocol_name: <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2898            }),
2899        }
2900    }
2901}
2902
2903/// A Stream of incoming requests for fuchsia.component/EventStream.
2904pub struct EventStreamRequestStream {
2905    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2906    is_terminated: bool,
2907}
2908
2909impl std::marker::Unpin for EventStreamRequestStream {}
2910
2911impl futures::stream::FusedStream for EventStreamRequestStream {
2912    fn is_terminated(&self) -> bool {
2913        self.is_terminated
2914    }
2915}
2916
2917impl fidl::endpoints::RequestStream for EventStreamRequestStream {
2918    type Protocol = EventStreamMarker;
2919    type ControlHandle = EventStreamControlHandle;
2920
2921    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2922        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2923    }
2924
2925    fn control_handle(&self) -> Self::ControlHandle {
2926        EventStreamControlHandle { inner: self.inner.clone() }
2927    }
2928
2929    fn into_inner(
2930        self,
2931    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2932    {
2933        (self.inner, self.is_terminated)
2934    }
2935
2936    fn from_inner(
2937        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2938        is_terminated: bool,
2939    ) -> Self {
2940        Self { inner, is_terminated }
2941    }
2942}
2943
2944impl futures::Stream for EventStreamRequestStream {
2945    type Item = Result<EventStreamRequest, fidl::Error>;
2946
2947    fn poll_next(
2948        mut self: std::pin::Pin<&mut Self>,
2949        cx: &mut std::task::Context<'_>,
2950    ) -> std::task::Poll<Option<Self::Item>> {
2951        let this = &mut *self;
2952        if this.inner.check_shutdown(cx) {
2953            this.is_terminated = true;
2954            return std::task::Poll::Ready(None);
2955        }
2956        if this.is_terminated {
2957            panic!("polled EventStreamRequestStream after completion");
2958        }
2959        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2960            |bytes, handles| {
2961                match this.inner.channel().read_etc(cx, bytes, handles) {
2962                    std::task::Poll::Ready(Ok(())) => {}
2963                    std::task::Poll::Pending => return std::task::Poll::Pending,
2964                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2965                        this.is_terminated = true;
2966                        return std::task::Poll::Ready(None);
2967                    }
2968                    std::task::Poll::Ready(Err(e)) => {
2969                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2970                            e.into(),
2971                        ))));
2972                    }
2973                }
2974
2975                // A message has been received from the channel
2976                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2977
2978                std::task::Poll::Ready(Some(match header.ordinal {
2979                    0x3f24c9495978eb86 => {
2980                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2981                        let mut req = fidl::new_empty!(
2982                            fidl::encoding::EmptyPayload,
2983                            fidl::encoding::DefaultFuchsiaResourceDialect
2984                        );
2985                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2986                        let control_handle = EventStreamControlHandle { inner: this.inner.clone() };
2987                        Ok(EventStreamRequest::GetNext {
2988                            responder: EventStreamGetNextResponder {
2989                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2990                                tx_id: header.tx_id,
2991                            },
2992                        })
2993                    }
2994                    0x31331f9578d2e682 => {
2995                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2996                        let mut req = fidl::new_empty!(
2997                            fidl::encoding::EmptyPayload,
2998                            fidl::encoding::DefaultFuchsiaResourceDialect
2999                        );
3000                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3001                        let control_handle = EventStreamControlHandle { inner: this.inner.clone() };
3002                        Ok(EventStreamRequest::WaitForReady {
3003                            responder: EventStreamWaitForReadyResponder {
3004                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3005                                tx_id: header.tx_id,
3006                            },
3007                        })
3008                    }
3009                    _ => Err(fidl::Error::UnknownOrdinal {
3010                        ordinal: header.ordinal,
3011                        protocol_name:
3012                            <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3013                    }),
3014                }))
3015            },
3016        )
3017    }
3018}
3019
3020/// Listener for events on the component hierarchy.
3021/// Can't be used outside of the platform.
3022#[derive(Debug)]
3023pub enum EventStreamRequest {
3024    GetNext {
3025        responder: EventStreamGetNextResponder,
3026    },
3027    /// Returns immediately. Used to indicate that the FIDL connection
3028    /// completed. This is needed for non-static streams to verify
3029    /// that subscribe has completed before components are started.
3030    WaitForReady {
3031        responder: EventStreamWaitForReadyResponder,
3032    },
3033}
3034
3035impl EventStreamRequest {
3036    #[allow(irrefutable_let_patterns)]
3037    pub fn into_get_next(self) -> Option<(EventStreamGetNextResponder)> {
3038        if let EventStreamRequest::GetNext { responder } = self { Some((responder)) } else { None }
3039    }
3040
3041    #[allow(irrefutable_let_patterns)]
3042    pub fn into_wait_for_ready(self) -> Option<(EventStreamWaitForReadyResponder)> {
3043        if let EventStreamRequest::WaitForReady { responder } = self {
3044            Some((responder))
3045        } else {
3046            None
3047        }
3048    }
3049
3050    /// Name of the method defined in FIDL
3051    pub fn method_name(&self) -> &'static str {
3052        match *self {
3053            EventStreamRequest::GetNext { .. } => "get_next",
3054            EventStreamRequest::WaitForReady { .. } => "wait_for_ready",
3055        }
3056    }
3057}
3058
3059#[derive(Debug, Clone)]
3060pub struct EventStreamControlHandle {
3061    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3062}
3063
3064impl fidl::endpoints::ControlHandle for EventStreamControlHandle {
3065    fn shutdown(&self) {
3066        self.inner.shutdown()
3067    }
3068
3069    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3070        self.inner.shutdown_with_epitaph(status)
3071    }
3072
3073    fn is_closed(&self) -> bool {
3074        self.inner.channel().is_closed()
3075    }
3076    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3077        self.inner.channel().on_closed()
3078    }
3079
3080    #[cfg(target_os = "fuchsia")]
3081    fn signal_peer(
3082        &self,
3083        clear_mask: zx::Signals,
3084        set_mask: zx::Signals,
3085    ) -> Result<(), zx_status::Status> {
3086        use fidl::Peered;
3087        self.inner.channel().signal_peer(clear_mask, set_mask)
3088    }
3089}
3090
3091impl EventStreamControlHandle {}
3092
3093#[must_use = "FIDL methods require a response to be sent"]
3094#[derive(Debug)]
3095pub struct EventStreamGetNextResponder {
3096    control_handle: std::mem::ManuallyDrop<EventStreamControlHandle>,
3097    tx_id: u32,
3098}
3099
3100/// Set the the channel to be shutdown (see [`EventStreamControlHandle::shutdown`])
3101/// if the responder is dropped without sending a response, so that the client
3102/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3103impl std::ops::Drop for EventStreamGetNextResponder {
3104    fn drop(&mut self) {
3105        self.control_handle.shutdown();
3106        // Safety: drops once, never accessed again
3107        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3108    }
3109}
3110
3111impl fidl::endpoints::Responder for EventStreamGetNextResponder {
3112    type ControlHandle = EventStreamControlHandle;
3113
3114    fn control_handle(&self) -> &EventStreamControlHandle {
3115        &self.control_handle
3116    }
3117
3118    fn drop_without_shutdown(mut self) {
3119        // Safety: drops once, never accessed again due to mem::forget
3120        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3121        // Prevent Drop from running (which would shut down the channel)
3122        std::mem::forget(self);
3123    }
3124}
3125
3126impl EventStreamGetNextResponder {
3127    /// Sends a response to the FIDL transaction.
3128    ///
3129    /// Sets the channel to shutdown if an error occurs.
3130    pub fn send(self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
3131        let _result = self.send_raw(events);
3132        if _result.is_err() {
3133            self.control_handle.shutdown();
3134        }
3135        self.drop_without_shutdown();
3136        _result
3137    }
3138
3139    /// Similar to "send" but does not shutdown the channel if an error occurs.
3140    pub fn send_no_shutdown_on_err(self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
3141        let _result = self.send_raw(events);
3142        self.drop_without_shutdown();
3143        _result
3144    }
3145
3146    fn send_raw(&self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
3147        self.control_handle.inner.send::<EventStreamGetNextResponse>(
3148            (events.as_mut(),),
3149            self.tx_id,
3150            0x3f24c9495978eb86,
3151            fidl::encoding::DynamicFlags::empty(),
3152        )
3153    }
3154}
3155
3156#[must_use = "FIDL methods require a response to be sent"]
3157#[derive(Debug)]
3158pub struct EventStreamWaitForReadyResponder {
3159    control_handle: std::mem::ManuallyDrop<EventStreamControlHandle>,
3160    tx_id: u32,
3161}
3162
3163/// Set the the channel to be shutdown (see [`EventStreamControlHandle::shutdown`])
3164/// if the responder is dropped without sending a response, so that the client
3165/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3166impl std::ops::Drop for EventStreamWaitForReadyResponder {
3167    fn drop(&mut self) {
3168        self.control_handle.shutdown();
3169        // Safety: drops once, never accessed again
3170        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3171    }
3172}
3173
3174impl fidl::endpoints::Responder for EventStreamWaitForReadyResponder {
3175    type ControlHandle = EventStreamControlHandle;
3176
3177    fn control_handle(&self) -> &EventStreamControlHandle {
3178        &self.control_handle
3179    }
3180
3181    fn drop_without_shutdown(mut self) {
3182        // Safety: drops once, never accessed again due to mem::forget
3183        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3184        // Prevent Drop from running (which would shut down the channel)
3185        std::mem::forget(self);
3186    }
3187}
3188
3189impl EventStreamWaitForReadyResponder {
3190    /// Sends a response to the FIDL transaction.
3191    ///
3192    /// Sets the channel to shutdown if an error occurs.
3193    pub fn send(self) -> Result<(), fidl::Error> {
3194        let _result = self.send_raw();
3195        if _result.is_err() {
3196            self.control_handle.shutdown();
3197        }
3198        self.drop_without_shutdown();
3199        _result
3200    }
3201
3202    /// Similar to "send" but does not shutdown the channel if an error occurs.
3203    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3204        let _result = self.send_raw();
3205        self.drop_without_shutdown();
3206        _result
3207    }
3208
3209    fn send_raw(&self) -> Result<(), fidl::Error> {
3210        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3211            (),
3212            self.tx_id,
3213            0x31331f9578d2e682,
3214            fidl::encoding::DynamicFlags::empty(),
3215        )
3216    }
3217}
3218
3219#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3220pub struct ExecutionControllerMarker;
3221
3222impl fidl::endpoints::ProtocolMarker for ExecutionControllerMarker {
3223    type Proxy = ExecutionControllerProxy;
3224    type RequestStream = ExecutionControllerRequestStream;
3225    #[cfg(target_os = "fuchsia")]
3226    type SynchronousProxy = ExecutionControllerSynchronousProxy;
3227
3228    const DEBUG_NAME: &'static str = "(anonymous) ExecutionController";
3229}
3230
3231pub trait ExecutionControllerProxyInterface: Send + Sync {
3232    fn r#stop(&self) -> Result<(), fidl::Error>;
3233}
3234#[derive(Debug)]
3235#[cfg(target_os = "fuchsia")]
3236pub struct ExecutionControllerSynchronousProxy {
3237    client: fidl::client::sync::Client,
3238}
3239
3240#[cfg(target_os = "fuchsia")]
3241impl fidl::endpoints::SynchronousProxy for ExecutionControllerSynchronousProxy {
3242    type Proxy = ExecutionControllerProxy;
3243    type Protocol = ExecutionControllerMarker;
3244
3245    fn from_channel(inner: fidl::Channel) -> Self {
3246        Self::new(inner)
3247    }
3248
3249    fn into_channel(self) -> fidl::Channel {
3250        self.client.into_channel()
3251    }
3252
3253    fn as_channel(&self) -> &fidl::Channel {
3254        self.client.as_channel()
3255    }
3256}
3257
3258#[cfg(target_os = "fuchsia")]
3259impl ExecutionControllerSynchronousProxy {
3260    pub fn new(channel: fidl::Channel) -> Self {
3261        let protocol_name =
3262            <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3263        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3264    }
3265
3266    pub fn into_channel(self) -> fidl::Channel {
3267        self.client.into_channel()
3268    }
3269
3270    /// Waits until an event arrives and returns it. It is safe for other
3271    /// threads to make concurrent requests while waiting for an event.
3272    pub fn wait_for_event(
3273        &self,
3274        deadline: zx::MonotonicInstant,
3275    ) -> Result<ExecutionControllerEvent, fidl::Error> {
3276        ExecutionControllerEvent::decode(self.client.wait_for_event(deadline)?)
3277    }
3278
3279    /// Initiates a stop action on this component. Once complete, OnStop will be
3280    /// called with the stopped payload and this channel is closed.
3281    ///
3282    /// Note that a component may stop running on its own at any time, so it is
3283    /// possible for `OnStop` to be received before `Stop` is called.
3284    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3285        self.client.send::<fidl::encoding::EmptyPayload>(
3286            (),
3287            0x56d23cec21036117,
3288            fidl::encoding::DynamicFlags::FLEXIBLE,
3289        )
3290    }
3291}
3292
3293#[cfg(target_os = "fuchsia")]
3294impl From<ExecutionControllerSynchronousProxy> for zx::NullableHandle {
3295    fn from(value: ExecutionControllerSynchronousProxy) -> Self {
3296        value.into_channel().into()
3297    }
3298}
3299
3300#[cfg(target_os = "fuchsia")]
3301impl From<fidl::Channel> for ExecutionControllerSynchronousProxy {
3302    fn from(value: fidl::Channel) -> Self {
3303        Self::new(value)
3304    }
3305}
3306
3307#[cfg(target_os = "fuchsia")]
3308impl fidl::endpoints::FromClient for ExecutionControllerSynchronousProxy {
3309    type Protocol = ExecutionControllerMarker;
3310
3311    fn from_client(value: fidl::endpoints::ClientEnd<ExecutionControllerMarker>) -> Self {
3312        Self::new(value.into_channel())
3313    }
3314}
3315
3316#[derive(Debug, Clone)]
3317pub struct ExecutionControllerProxy {
3318    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3319}
3320
3321impl fidl::endpoints::Proxy for ExecutionControllerProxy {
3322    type Protocol = ExecutionControllerMarker;
3323
3324    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3325        Self::new(inner)
3326    }
3327
3328    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3329        self.client.into_channel().map_err(|client| Self { client })
3330    }
3331
3332    fn as_channel(&self) -> &::fidl::AsyncChannel {
3333        self.client.as_channel()
3334    }
3335}
3336
3337impl ExecutionControllerProxy {
3338    /// Create a new Proxy for fuchsia.component/ExecutionController.
3339    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3340        let protocol_name =
3341            <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3342        Self { client: fidl::client::Client::new(channel, protocol_name) }
3343    }
3344
3345    /// Get a Stream of events from the remote end of the protocol.
3346    ///
3347    /// # Panics
3348    ///
3349    /// Panics if the event stream was already taken.
3350    pub fn take_event_stream(&self) -> ExecutionControllerEventStream {
3351        ExecutionControllerEventStream { event_receiver: self.client.take_event_receiver() }
3352    }
3353
3354    /// Initiates a stop action on this component. Once complete, OnStop will be
3355    /// called with the stopped payload and this channel is closed.
3356    ///
3357    /// Note that a component may stop running on its own at any time, so it is
3358    /// possible for `OnStop` to be received before `Stop` is called.
3359    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3360        ExecutionControllerProxyInterface::r#stop(self)
3361    }
3362}
3363
3364impl ExecutionControllerProxyInterface for ExecutionControllerProxy {
3365    fn r#stop(&self) -> Result<(), fidl::Error> {
3366        self.client.send::<fidl::encoding::EmptyPayload>(
3367            (),
3368            0x56d23cec21036117,
3369            fidl::encoding::DynamicFlags::FLEXIBLE,
3370        )
3371    }
3372}
3373
3374pub struct ExecutionControllerEventStream {
3375    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3376}
3377
3378impl std::marker::Unpin for ExecutionControllerEventStream {}
3379
3380impl futures::stream::FusedStream for ExecutionControllerEventStream {
3381    fn is_terminated(&self) -> bool {
3382        self.event_receiver.is_terminated()
3383    }
3384}
3385
3386impl futures::Stream for ExecutionControllerEventStream {
3387    type Item = Result<ExecutionControllerEvent, fidl::Error>;
3388
3389    fn poll_next(
3390        mut self: std::pin::Pin<&mut Self>,
3391        cx: &mut std::task::Context<'_>,
3392    ) -> std::task::Poll<Option<Self::Item>> {
3393        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3394            &mut self.event_receiver,
3395            cx
3396        )?) {
3397            Some(buf) => std::task::Poll::Ready(Some(ExecutionControllerEvent::decode(buf))),
3398            None => std::task::Poll::Ready(None),
3399        }
3400    }
3401}
3402
3403#[derive(Debug)]
3404pub enum ExecutionControllerEvent {
3405    OnStop {
3406        stopped_payload: StoppedPayload,
3407    },
3408    #[non_exhaustive]
3409    _UnknownEvent {
3410        /// Ordinal of the event that was sent.
3411        ordinal: u64,
3412    },
3413}
3414
3415impl ExecutionControllerEvent {
3416    #[allow(irrefutable_let_patterns)]
3417    pub fn into_on_stop(self) -> Option<StoppedPayload> {
3418        if let ExecutionControllerEvent::OnStop { stopped_payload } = self {
3419            Some((stopped_payload))
3420        } else {
3421            None
3422        }
3423    }
3424
3425    /// Decodes a message buffer as a [`ExecutionControllerEvent`].
3426    fn decode(
3427        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3428    ) -> Result<ExecutionControllerEvent, fidl::Error> {
3429        let (bytes, _handles) = buf.split_mut();
3430        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3431        debug_assert_eq!(tx_header.tx_id, 0);
3432        match tx_header.ordinal {
3433            0x62d5018e2174f57f => {
3434                let mut out = fidl::new_empty!(
3435                    ExecutionControllerOnStopRequest,
3436                    fidl::encoding::DefaultFuchsiaResourceDialect
3437                );
3438                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ExecutionControllerOnStopRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3439                Ok((ExecutionControllerEvent::OnStop { stopped_payload: out.stopped_payload }))
3440            }
3441            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3442                Ok(ExecutionControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3443            }
3444            _ => Err(fidl::Error::UnknownOrdinal {
3445                ordinal: tx_header.ordinal,
3446                protocol_name:
3447                    <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3448            }),
3449        }
3450    }
3451}
3452
3453/// A Stream of incoming requests for fuchsia.component/ExecutionController.
3454pub struct ExecutionControllerRequestStream {
3455    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3456    is_terminated: bool,
3457}
3458
3459impl std::marker::Unpin for ExecutionControllerRequestStream {}
3460
3461impl futures::stream::FusedStream for ExecutionControllerRequestStream {
3462    fn is_terminated(&self) -> bool {
3463        self.is_terminated
3464    }
3465}
3466
3467impl fidl::endpoints::RequestStream for ExecutionControllerRequestStream {
3468    type Protocol = ExecutionControllerMarker;
3469    type ControlHandle = ExecutionControllerControlHandle;
3470
3471    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3472        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3473    }
3474
3475    fn control_handle(&self) -> Self::ControlHandle {
3476        ExecutionControllerControlHandle { inner: self.inner.clone() }
3477    }
3478
3479    fn into_inner(
3480        self,
3481    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3482    {
3483        (self.inner, self.is_terminated)
3484    }
3485
3486    fn from_inner(
3487        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3488        is_terminated: bool,
3489    ) -> Self {
3490        Self { inner, is_terminated }
3491    }
3492}
3493
3494impl futures::Stream for ExecutionControllerRequestStream {
3495    type Item = Result<ExecutionControllerRequest, fidl::Error>;
3496
3497    fn poll_next(
3498        mut self: std::pin::Pin<&mut Self>,
3499        cx: &mut std::task::Context<'_>,
3500    ) -> std::task::Poll<Option<Self::Item>> {
3501        let this = &mut *self;
3502        if this.inner.check_shutdown(cx) {
3503            this.is_terminated = true;
3504            return std::task::Poll::Ready(None);
3505        }
3506        if this.is_terminated {
3507            panic!("polled ExecutionControllerRequestStream after completion");
3508        }
3509        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3510            |bytes, handles| {
3511                match this.inner.channel().read_etc(cx, bytes, handles) {
3512                    std::task::Poll::Ready(Ok(())) => {}
3513                    std::task::Poll::Pending => return std::task::Poll::Pending,
3514                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3515                        this.is_terminated = true;
3516                        return std::task::Poll::Ready(None);
3517                    }
3518                    std::task::Poll::Ready(Err(e)) => {
3519                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3520                            e.into(),
3521                        ))));
3522                    }
3523                }
3524
3525                // A message has been received from the channel
3526                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3527
3528                std::task::Poll::Ready(Some(match header.ordinal {
3529                0x56d23cec21036117 => {
3530                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3531                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3532                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3533                    let control_handle = ExecutionControllerControlHandle {
3534                        inner: this.inner.clone(),
3535                    };
3536                    Ok(ExecutionControllerRequest::Stop {
3537                        control_handle,
3538                    })
3539                }
3540                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3541                    Ok(ExecutionControllerRequest::_UnknownMethod {
3542                        ordinal: header.ordinal,
3543                        control_handle: ExecutionControllerControlHandle { inner: this.inner.clone() },
3544                        method_type: fidl::MethodType::OneWay,
3545                    })
3546                }
3547                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3548                    this.inner.send_framework_err(
3549                        fidl::encoding::FrameworkErr::UnknownMethod,
3550                        header.tx_id,
3551                        header.ordinal,
3552                        header.dynamic_flags(),
3553                        (bytes, handles),
3554                    )?;
3555                    Ok(ExecutionControllerRequest::_UnknownMethod {
3556                        ordinal: header.ordinal,
3557                        control_handle: ExecutionControllerControlHandle { inner: this.inner.clone() },
3558                        method_type: fidl::MethodType::TwoWay,
3559                    })
3560                }
3561                _ => Err(fidl::Error::UnknownOrdinal {
3562                    ordinal: header.ordinal,
3563                    protocol_name: <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3564                }),
3565            }))
3566            },
3567        )
3568    }
3569}
3570
3571#[derive(Debug)]
3572pub enum ExecutionControllerRequest {
3573    /// Initiates a stop action on this component. Once complete, OnStop will be
3574    /// called with the stopped payload and this channel is closed.
3575    ///
3576    /// Note that a component may stop running on its own at any time, so it is
3577    /// possible for `OnStop` to be received before `Stop` is called.
3578    Stop { control_handle: ExecutionControllerControlHandle },
3579    /// An interaction was received which does not match any known method.
3580    #[non_exhaustive]
3581    _UnknownMethod {
3582        /// Ordinal of the method that was called.
3583        ordinal: u64,
3584        control_handle: ExecutionControllerControlHandle,
3585        method_type: fidl::MethodType,
3586    },
3587}
3588
3589impl ExecutionControllerRequest {
3590    #[allow(irrefutable_let_patterns)]
3591    pub fn into_stop(self) -> Option<(ExecutionControllerControlHandle)> {
3592        if let ExecutionControllerRequest::Stop { control_handle } = self {
3593            Some((control_handle))
3594        } else {
3595            None
3596        }
3597    }
3598
3599    /// Name of the method defined in FIDL
3600    pub fn method_name(&self) -> &'static str {
3601        match *self {
3602            ExecutionControllerRequest::Stop { .. } => "stop",
3603            ExecutionControllerRequest::_UnknownMethod {
3604                method_type: fidl::MethodType::OneWay,
3605                ..
3606            } => "unknown one-way method",
3607            ExecutionControllerRequest::_UnknownMethod {
3608                method_type: fidl::MethodType::TwoWay,
3609                ..
3610            } => "unknown two-way method",
3611        }
3612    }
3613}
3614
3615#[derive(Debug, Clone)]
3616pub struct ExecutionControllerControlHandle {
3617    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3618}
3619
3620impl fidl::endpoints::ControlHandle for ExecutionControllerControlHandle {
3621    fn shutdown(&self) {
3622        self.inner.shutdown()
3623    }
3624
3625    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3626        self.inner.shutdown_with_epitaph(status)
3627    }
3628
3629    fn is_closed(&self) -> bool {
3630        self.inner.channel().is_closed()
3631    }
3632    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3633        self.inner.channel().on_closed()
3634    }
3635
3636    #[cfg(target_os = "fuchsia")]
3637    fn signal_peer(
3638        &self,
3639        clear_mask: zx::Signals,
3640        set_mask: zx::Signals,
3641    ) -> Result<(), zx_status::Status> {
3642        use fidl::Peered;
3643        self.inner.channel().signal_peer(clear_mask, set_mask)
3644    }
3645}
3646
3647impl ExecutionControllerControlHandle {
3648    pub fn send_on_stop(&self, mut stopped_payload: &StoppedPayload) -> Result<(), fidl::Error> {
3649        self.inner.send::<ExecutionControllerOnStopRequest>(
3650            (stopped_payload,),
3651            0,
3652            0x62d5018e2174f57f,
3653            fidl::encoding::DynamicFlags::FLEXIBLE,
3654        )
3655    }
3656}
3657
3658#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3659pub struct IntrospectorMarker;
3660
3661impl fidl::endpoints::ProtocolMarker for IntrospectorMarker {
3662    type Proxy = IntrospectorProxy;
3663    type RequestStream = IntrospectorRequestStream;
3664    #[cfg(target_os = "fuchsia")]
3665    type SynchronousProxy = IntrospectorSynchronousProxy;
3666
3667    const DEBUG_NAME: &'static str = "fuchsia.component.Introspector";
3668}
3669impl fidl::endpoints::DiscoverableProtocolMarker for IntrospectorMarker {}
3670pub type IntrospectorGetMonikerResult = Result<String, Error>;
3671
3672pub trait IntrospectorProxyInterface: Send + Sync {
3673    type GetMonikerResponseFut: std::future::Future<Output = Result<IntrospectorGetMonikerResult, fidl::Error>>
3674        + Send;
3675    fn r#get_moniker(&self, component_instance: fidl::Event) -> Self::GetMonikerResponseFut;
3676}
3677#[derive(Debug)]
3678#[cfg(target_os = "fuchsia")]
3679pub struct IntrospectorSynchronousProxy {
3680    client: fidl::client::sync::Client,
3681}
3682
3683#[cfg(target_os = "fuchsia")]
3684impl fidl::endpoints::SynchronousProxy for IntrospectorSynchronousProxy {
3685    type Proxy = IntrospectorProxy;
3686    type Protocol = IntrospectorMarker;
3687
3688    fn from_channel(inner: fidl::Channel) -> Self {
3689        Self::new(inner)
3690    }
3691
3692    fn into_channel(self) -> fidl::Channel {
3693        self.client.into_channel()
3694    }
3695
3696    fn as_channel(&self) -> &fidl::Channel {
3697        self.client.as_channel()
3698    }
3699}
3700
3701#[cfg(target_os = "fuchsia")]
3702impl IntrospectorSynchronousProxy {
3703    pub fn new(channel: fidl::Channel) -> Self {
3704        let protocol_name = <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3705        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3706    }
3707
3708    pub fn into_channel(self) -> fidl::Channel {
3709        self.client.into_channel()
3710    }
3711
3712    /// Waits until an event arrives and returns it. It is safe for other
3713    /// threads to make concurrent requests while waiting for an event.
3714    pub fn wait_for_event(
3715        &self,
3716        deadline: zx::MonotonicInstant,
3717    ) -> Result<IntrospectorEvent, fidl::Error> {
3718        IntrospectorEvent::decode(self.client.wait_for_event(deadline)?)
3719    }
3720
3721    /// Obtains the moniker relative to this realm of the component
3722    /// corresponding to the provided token. Runners may obtain the token via
3723    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3724    ///
3725    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3726    /// does not correspond to a component under this realm.
3727    pub fn r#get_moniker(
3728        &self,
3729        mut component_instance: fidl::Event,
3730        ___deadline: zx::MonotonicInstant,
3731    ) -> Result<IntrospectorGetMonikerResult, fidl::Error> {
3732        let _response = self.client.send_query::<
3733            IntrospectorGetMonikerRequest,
3734            fidl::encoding::FlexibleResultType<IntrospectorGetMonikerResponse, Error>,
3735        >(
3736            (component_instance,),
3737            0x2f980ceb37bf458,
3738            fidl::encoding::DynamicFlags::FLEXIBLE,
3739            ___deadline,
3740        )?
3741        .into_result::<IntrospectorMarker>("get_moniker")?;
3742        Ok(_response.map(|x| x.moniker))
3743    }
3744}
3745
3746#[cfg(target_os = "fuchsia")]
3747impl From<IntrospectorSynchronousProxy> for zx::NullableHandle {
3748    fn from(value: IntrospectorSynchronousProxy) -> Self {
3749        value.into_channel().into()
3750    }
3751}
3752
3753#[cfg(target_os = "fuchsia")]
3754impl From<fidl::Channel> for IntrospectorSynchronousProxy {
3755    fn from(value: fidl::Channel) -> Self {
3756        Self::new(value)
3757    }
3758}
3759
3760#[cfg(target_os = "fuchsia")]
3761impl fidl::endpoints::FromClient for IntrospectorSynchronousProxy {
3762    type Protocol = IntrospectorMarker;
3763
3764    fn from_client(value: fidl::endpoints::ClientEnd<IntrospectorMarker>) -> Self {
3765        Self::new(value.into_channel())
3766    }
3767}
3768
3769#[derive(Debug, Clone)]
3770pub struct IntrospectorProxy {
3771    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3772}
3773
3774impl fidl::endpoints::Proxy for IntrospectorProxy {
3775    type Protocol = IntrospectorMarker;
3776
3777    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3778        Self::new(inner)
3779    }
3780
3781    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3782        self.client.into_channel().map_err(|client| Self { client })
3783    }
3784
3785    fn as_channel(&self) -> &::fidl::AsyncChannel {
3786        self.client.as_channel()
3787    }
3788}
3789
3790impl IntrospectorProxy {
3791    /// Create a new Proxy for fuchsia.component/Introspector.
3792    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3793        let protocol_name = <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3794        Self { client: fidl::client::Client::new(channel, protocol_name) }
3795    }
3796
3797    /// Get a Stream of events from the remote end of the protocol.
3798    ///
3799    /// # Panics
3800    ///
3801    /// Panics if the event stream was already taken.
3802    pub fn take_event_stream(&self) -> IntrospectorEventStream {
3803        IntrospectorEventStream { event_receiver: self.client.take_event_receiver() }
3804    }
3805
3806    /// Obtains the moniker relative to this realm of the component
3807    /// corresponding to the provided token. Runners may obtain the token via
3808    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3809    ///
3810    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3811    /// does not correspond to a component under this realm.
3812    pub fn r#get_moniker(
3813        &self,
3814        mut component_instance: fidl::Event,
3815    ) -> fidl::client::QueryResponseFut<
3816        IntrospectorGetMonikerResult,
3817        fidl::encoding::DefaultFuchsiaResourceDialect,
3818    > {
3819        IntrospectorProxyInterface::r#get_moniker(self, component_instance)
3820    }
3821}
3822
3823impl IntrospectorProxyInterface for IntrospectorProxy {
3824    type GetMonikerResponseFut = fidl::client::QueryResponseFut<
3825        IntrospectorGetMonikerResult,
3826        fidl::encoding::DefaultFuchsiaResourceDialect,
3827    >;
3828    fn r#get_moniker(&self, mut component_instance: fidl::Event) -> Self::GetMonikerResponseFut {
3829        fn _decode(
3830            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3831        ) -> Result<IntrospectorGetMonikerResult, fidl::Error> {
3832            let _response = fidl::client::decode_transaction_body::<
3833                fidl::encoding::FlexibleResultType<IntrospectorGetMonikerResponse, Error>,
3834                fidl::encoding::DefaultFuchsiaResourceDialect,
3835                0x2f980ceb37bf458,
3836            >(_buf?)?
3837            .into_result::<IntrospectorMarker>("get_moniker")?;
3838            Ok(_response.map(|x| x.moniker))
3839        }
3840        self.client
3841            .send_query_and_decode::<IntrospectorGetMonikerRequest, IntrospectorGetMonikerResult>(
3842                (component_instance,),
3843                0x2f980ceb37bf458,
3844                fidl::encoding::DynamicFlags::FLEXIBLE,
3845                _decode,
3846            )
3847    }
3848}
3849
3850pub struct IntrospectorEventStream {
3851    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3852}
3853
3854impl std::marker::Unpin for IntrospectorEventStream {}
3855
3856impl futures::stream::FusedStream for IntrospectorEventStream {
3857    fn is_terminated(&self) -> bool {
3858        self.event_receiver.is_terminated()
3859    }
3860}
3861
3862impl futures::Stream for IntrospectorEventStream {
3863    type Item = Result<IntrospectorEvent, fidl::Error>;
3864
3865    fn poll_next(
3866        mut self: std::pin::Pin<&mut Self>,
3867        cx: &mut std::task::Context<'_>,
3868    ) -> std::task::Poll<Option<Self::Item>> {
3869        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3870            &mut self.event_receiver,
3871            cx
3872        )?) {
3873            Some(buf) => std::task::Poll::Ready(Some(IntrospectorEvent::decode(buf))),
3874            None => std::task::Poll::Ready(None),
3875        }
3876    }
3877}
3878
3879#[derive(Debug)]
3880pub enum IntrospectorEvent {
3881    #[non_exhaustive]
3882    _UnknownEvent {
3883        /// Ordinal of the event that was sent.
3884        ordinal: u64,
3885    },
3886}
3887
3888impl IntrospectorEvent {
3889    /// Decodes a message buffer as a [`IntrospectorEvent`].
3890    fn decode(
3891        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3892    ) -> Result<IntrospectorEvent, fidl::Error> {
3893        let (bytes, _handles) = buf.split_mut();
3894        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3895        debug_assert_eq!(tx_header.tx_id, 0);
3896        match tx_header.ordinal {
3897            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3898                Ok(IntrospectorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3899            }
3900            _ => Err(fidl::Error::UnknownOrdinal {
3901                ordinal: tx_header.ordinal,
3902                protocol_name: <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3903            }),
3904        }
3905    }
3906}
3907
3908/// A Stream of incoming requests for fuchsia.component/Introspector.
3909pub struct IntrospectorRequestStream {
3910    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3911    is_terminated: bool,
3912}
3913
3914impl std::marker::Unpin for IntrospectorRequestStream {}
3915
3916impl futures::stream::FusedStream for IntrospectorRequestStream {
3917    fn is_terminated(&self) -> bool {
3918        self.is_terminated
3919    }
3920}
3921
3922impl fidl::endpoints::RequestStream for IntrospectorRequestStream {
3923    type Protocol = IntrospectorMarker;
3924    type ControlHandle = IntrospectorControlHandle;
3925
3926    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3927        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3928    }
3929
3930    fn control_handle(&self) -> Self::ControlHandle {
3931        IntrospectorControlHandle { inner: self.inner.clone() }
3932    }
3933
3934    fn into_inner(
3935        self,
3936    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3937    {
3938        (self.inner, self.is_terminated)
3939    }
3940
3941    fn from_inner(
3942        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3943        is_terminated: bool,
3944    ) -> Self {
3945        Self { inner, is_terminated }
3946    }
3947}
3948
3949impl futures::Stream for IntrospectorRequestStream {
3950    type Item = Result<IntrospectorRequest, fidl::Error>;
3951
3952    fn poll_next(
3953        mut self: std::pin::Pin<&mut Self>,
3954        cx: &mut std::task::Context<'_>,
3955    ) -> std::task::Poll<Option<Self::Item>> {
3956        let this = &mut *self;
3957        if this.inner.check_shutdown(cx) {
3958            this.is_terminated = true;
3959            return std::task::Poll::Ready(None);
3960        }
3961        if this.is_terminated {
3962            panic!("polled IntrospectorRequestStream after completion");
3963        }
3964        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3965            |bytes, handles| {
3966                match this.inner.channel().read_etc(cx, bytes, handles) {
3967                    std::task::Poll::Ready(Ok(())) => {}
3968                    std::task::Poll::Pending => return std::task::Poll::Pending,
3969                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3970                        this.is_terminated = true;
3971                        return std::task::Poll::Ready(None);
3972                    }
3973                    std::task::Poll::Ready(Err(e)) => {
3974                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3975                            e.into(),
3976                        ))));
3977                    }
3978                }
3979
3980                // A message has been received from the channel
3981                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3982
3983                std::task::Poll::Ready(Some(match header.ordinal {
3984                    0x2f980ceb37bf458 => {
3985                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3986                        let mut req = fidl::new_empty!(
3987                            IntrospectorGetMonikerRequest,
3988                            fidl::encoding::DefaultFuchsiaResourceDialect
3989                        );
3990                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IntrospectorGetMonikerRequest>(&header, _body_bytes, handles, &mut req)?;
3991                        let control_handle =
3992                            IntrospectorControlHandle { inner: this.inner.clone() };
3993                        Ok(IntrospectorRequest::GetMoniker {
3994                            component_instance: req.component_instance,
3995
3996                            responder: IntrospectorGetMonikerResponder {
3997                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3998                                tx_id: header.tx_id,
3999                            },
4000                        })
4001                    }
4002                    _ if header.tx_id == 0
4003                        && header
4004                            .dynamic_flags()
4005                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4006                    {
4007                        Ok(IntrospectorRequest::_UnknownMethod {
4008                            ordinal: header.ordinal,
4009                            control_handle: IntrospectorControlHandle { inner: this.inner.clone() },
4010                            method_type: fidl::MethodType::OneWay,
4011                        })
4012                    }
4013                    _ if header
4014                        .dynamic_flags()
4015                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4016                    {
4017                        this.inner.send_framework_err(
4018                            fidl::encoding::FrameworkErr::UnknownMethod,
4019                            header.tx_id,
4020                            header.ordinal,
4021                            header.dynamic_flags(),
4022                            (bytes, handles),
4023                        )?;
4024                        Ok(IntrospectorRequest::_UnknownMethod {
4025                            ordinal: header.ordinal,
4026                            control_handle: IntrospectorControlHandle { inner: this.inner.clone() },
4027                            method_type: fidl::MethodType::TwoWay,
4028                        })
4029                    }
4030                    _ => Err(fidl::Error::UnknownOrdinal {
4031                        ordinal: header.ordinal,
4032                        protocol_name:
4033                            <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4034                    }),
4035                }))
4036            },
4037        )
4038    }
4039}
4040
4041/// A protocol used by a component instance to obtain information about
4042/// components in its own realm.
4043///
4044/// This protocol only supports getting the moniker at the moment but could
4045/// expand to other privileged information such as the URL of a component.
4046///
4047/// The component framework provides this capability to components that use
4048/// `fuchsia.component.Introspector` from framework.
4049#[derive(Debug)]
4050pub enum IntrospectorRequest {
4051    /// Obtains the moniker relative to this realm of the component
4052    /// corresponding to the provided token. Runners may obtain the token via
4053    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
4054    ///
4055    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
4056    /// does not correspond to a component under this realm.
4057    GetMoniker { component_instance: fidl::Event, responder: IntrospectorGetMonikerResponder },
4058    /// An interaction was received which does not match any known method.
4059    #[non_exhaustive]
4060    _UnknownMethod {
4061        /// Ordinal of the method that was called.
4062        ordinal: u64,
4063        control_handle: IntrospectorControlHandle,
4064        method_type: fidl::MethodType,
4065    },
4066}
4067
4068impl IntrospectorRequest {
4069    #[allow(irrefutable_let_patterns)]
4070    pub fn into_get_moniker(self) -> Option<(fidl::Event, IntrospectorGetMonikerResponder)> {
4071        if let IntrospectorRequest::GetMoniker { component_instance, responder } = self {
4072            Some((component_instance, responder))
4073        } else {
4074            None
4075        }
4076    }
4077
4078    /// Name of the method defined in FIDL
4079    pub fn method_name(&self) -> &'static str {
4080        match *self {
4081            IntrospectorRequest::GetMoniker { .. } => "get_moniker",
4082            IntrospectorRequest::_UnknownMethod {
4083                method_type: fidl::MethodType::OneWay, ..
4084            } => "unknown one-way method",
4085            IntrospectorRequest::_UnknownMethod {
4086                method_type: fidl::MethodType::TwoWay, ..
4087            } => "unknown two-way method",
4088        }
4089    }
4090}
4091
4092#[derive(Debug, Clone)]
4093pub struct IntrospectorControlHandle {
4094    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4095}
4096
4097impl fidl::endpoints::ControlHandle for IntrospectorControlHandle {
4098    fn shutdown(&self) {
4099        self.inner.shutdown()
4100    }
4101
4102    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4103        self.inner.shutdown_with_epitaph(status)
4104    }
4105
4106    fn is_closed(&self) -> bool {
4107        self.inner.channel().is_closed()
4108    }
4109    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4110        self.inner.channel().on_closed()
4111    }
4112
4113    #[cfg(target_os = "fuchsia")]
4114    fn signal_peer(
4115        &self,
4116        clear_mask: zx::Signals,
4117        set_mask: zx::Signals,
4118    ) -> Result<(), zx_status::Status> {
4119        use fidl::Peered;
4120        self.inner.channel().signal_peer(clear_mask, set_mask)
4121    }
4122}
4123
4124impl IntrospectorControlHandle {}
4125
4126#[must_use = "FIDL methods require a response to be sent"]
4127#[derive(Debug)]
4128pub struct IntrospectorGetMonikerResponder {
4129    control_handle: std::mem::ManuallyDrop<IntrospectorControlHandle>,
4130    tx_id: u32,
4131}
4132
4133/// Set the the channel to be shutdown (see [`IntrospectorControlHandle::shutdown`])
4134/// if the responder is dropped without sending a response, so that the client
4135/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4136impl std::ops::Drop for IntrospectorGetMonikerResponder {
4137    fn drop(&mut self) {
4138        self.control_handle.shutdown();
4139        // Safety: drops once, never accessed again
4140        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4141    }
4142}
4143
4144impl fidl::endpoints::Responder for IntrospectorGetMonikerResponder {
4145    type ControlHandle = IntrospectorControlHandle;
4146
4147    fn control_handle(&self) -> &IntrospectorControlHandle {
4148        &self.control_handle
4149    }
4150
4151    fn drop_without_shutdown(mut self) {
4152        // Safety: drops once, never accessed again due to mem::forget
4153        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4154        // Prevent Drop from running (which would shut down the channel)
4155        std::mem::forget(self);
4156    }
4157}
4158
4159impl IntrospectorGetMonikerResponder {
4160    /// Sends a response to the FIDL transaction.
4161    ///
4162    /// Sets the channel to shutdown if an error occurs.
4163    pub fn send(self, mut result: Result<&str, Error>) -> Result<(), fidl::Error> {
4164        let _result = self.send_raw(result);
4165        if _result.is_err() {
4166            self.control_handle.shutdown();
4167        }
4168        self.drop_without_shutdown();
4169        _result
4170    }
4171
4172    /// Similar to "send" but does not shutdown the channel if an error occurs.
4173    pub fn send_no_shutdown_on_err(
4174        self,
4175        mut result: Result<&str, Error>,
4176    ) -> Result<(), fidl::Error> {
4177        let _result = self.send_raw(result);
4178        self.drop_without_shutdown();
4179        _result
4180    }
4181
4182    fn send_raw(&self, mut result: Result<&str, Error>) -> Result<(), fidl::Error> {
4183        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4184            IntrospectorGetMonikerResponse,
4185            Error,
4186        >>(
4187            fidl::encoding::FlexibleResult::new(result.map(|moniker| (moniker,))),
4188            self.tx_id,
4189            0x2f980ceb37bf458,
4190            fidl::encoding::DynamicFlags::FLEXIBLE,
4191        )
4192    }
4193}
4194
4195#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4196pub struct NamespaceMarker;
4197
4198impl fidl::endpoints::ProtocolMarker for NamespaceMarker {
4199    type Proxy = NamespaceProxy;
4200    type RequestStream = NamespaceRequestStream;
4201    #[cfg(target_os = "fuchsia")]
4202    type SynchronousProxy = NamespaceSynchronousProxy;
4203
4204    const DEBUG_NAME: &'static str = "fuchsia.component.Namespace";
4205}
4206impl fidl::endpoints::DiscoverableProtocolMarker for NamespaceMarker {}
4207pub type NamespaceCreateResult = Result<Vec<NamespaceEntry>, NamespaceError>;
4208pub type NamespaceCreate2Result = Result<Vec<NamespaceEntry>, NamespaceError>;
4209
4210pub trait NamespaceProxyInterface: Send + Sync {
4211    type CreateResponseFut: std::future::Future<Output = Result<NamespaceCreateResult, fidl::Error>>
4212        + Send;
4213    fn r#create(&self, entries: Vec<NamespaceInputEntry>) -> Self::CreateResponseFut;
4214    type Create2ResponseFut: std::future::Future<Output = Result<NamespaceCreate2Result, fidl::Error>>
4215        + Send;
4216    fn r#create2(&self, entries: Vec<NamespaceInputEntry2>) -> Self::Create2ResponseFut;
4217}
4218#[derive(Debug)]
4219#[cfg(target_os = "fuchsia")]
4220pub struct NamespaceSynchronousProxy {
4221    client: fidl::client::sync::Client,
4222}
4223
4224#[cfg(target_os = "fuchsia")]
4225impl fidl::endpoints::SynchronousProxy for NamespaceSynchronousProxy {
4226    type Proxy = NamespaceProxy;
4227    type Protocol = NamespaceMarker;
4228
4229    fn from_channel(inner: fidl::Channel) -> Self {
4230        Self::new(inner)
4231    }
4232
4233    fn into_channel(self) -> fidl::Channel {
4234        self.client.into_channel()
4235    }
4236
4237    fn as_channel(&self) -> &fidl::Channel {
4238        self.client.as_channel()
4239    }
4240}
4241
4242#[cfg(target_os = "fuchsia")]
4243impl NamespaceSynchronousProxy {
4244    pub fn new(channel: fidl::Channel) -> Self {
4245        let protocol_name = <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4246        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4247    }
4248
4249    pub fn into_channel(self) -> fidl::Channel {
4250        self.client.into_channel()
4251    }
4252
4253    /// Waits until an event arrives and returns it. It is safe for other
4254    /// threads to make concurrent requests while waiting for an event.
4255    pub fn wait_for_event(
4256        &self,
4257        deadline: zx::MonotonicInstant,
4258    ) -> Result<NamespaceEvent, fidl::Error> {
4259        NamespaceEvent::decode(self.client.wait_for_event(deadline)?)
4260    }
4261
4262    pub fn r#create(
4263        &self,
4264        mut entries: Vec<NamespaceInputEntry>,
4265        ___deadline: zx::MonotonicInstant,
4266    ) -> Result<NamespaceCreateResult, fidl::Error> {
4267        let _response = self.client.send_query::<
4268            NamespaceCreateRequest,
4269            fidl::encoding::FlexibleResultType<NamespaceCreateResponse, NamespaceError>,
4270        >(
4271            (entries.as_mut(),),
4272            0x4329fe12b2a790f9,
4273            fidl::encoding::DynamicFlags::FLEXIBLE,
4274            ___deadline,
4275        )?
4276        .into_result::<NamespaceMarker>("create")?;
4277        Ok(_response.map(|x| x.entries))
4278    }
4279
4280    pub fn r#create2(
4281        &self,
4282        mut entries: Vec<NamespaceInputEntry2>,
4283        ___deadline: zx::MonotonicInstant,
4284    ) -> Result<NamespaceCreate2Result, fidl::Error> {
4285        let _response = self.client.send_query::<
4286            NamespaceCreate2Request,
4287            fidl::encoding::FlexibleResultType<NamespaceCreate2Response, NamespaceError>,
4288        >(
4289            (entries.as_mut(),),
4290            0x665aa4bb3773b351,
4291            fidl::encoding::DynamicFlags::FLEXIBLE,
4292            ___deadline,
4293        )?
4294        .into_result::<NamespaceMarker>("create2")?;
4295        Ok(_response.map(|x| x.entries))
4296    }
4297}
4298
4299#[cfg(target_os = "fuchsia")]
4300impl From<NamespaceSynchronousProxy> for zx::NullableHandle {
4301    fn from(value: NamespaceSynchronousProxy) -> Self {
4302        value.into_channel().into()
4303    }
4304}
4305
4306#[cfg(target_os = "fuchsia")]
4307impl From<fidl::Channel> for NamespaceSynchronousProxy {
4308    fn from(value: fidl::Channel) -> Self {
4309        Self::new(value)
4310    }
4311}
4312
4313#[cfg(target_os = "fuchsia")]
4314impl fidl::endpoints::FromClient for NamespaceSynchronousProxy {
4315    type Protocol = NamespaceMarker;
4316
4317    fn from_client(value: fidl::endpoints::ClientEnd<NamespaceMarker>) -> Self {
4318        Self::new(value.into_channel())
4319    }
4320}
4321
4322#[derive(Debug, Clone)]
4323pub struct NamespaceProxy {
4324    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4325}
4326
4327impl fidl::endpoints::Proxy for NamespaceProxy {
4328    type Protocol = NamespaceMarker;
4329
4330    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4331        Self::new(inner)
4332    }
4333
4334    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4335        self.client.into_channel().map_err(|client| Self { client })
4336    }
4337
4338    fn as_channel(&self) -> &::fidl::AsyncChannel {
4339        self.client.as_channel()
4340    }
4341}
4342
4343impl NamespaceProxy {
4344    /// Create a new Proxy for fuchsia.component/Namespace.
4345    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4346        let protocol_name = <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4347        Self { client: fidl::client::Client::new(channel, protocol_name) }
4348    }
4349
4350    /// Get a Stream of events from the remote end of the protocol.
4351    ///
4352    /// # Panics
4353    ///
4354    /// Panics if the event stream was already taken.
4355    pub fn take_event_stream(&self) -> NamespaceEventStream {
4356        NamespaceEventStream { event_receiver: self.client.take_event_receiver() }
4357    }
4358
4359    pub fn r#create(
4360        &self,
4361        mut entries: Vec<NamespaceInputEntry>,
4362    ) -> fidl::client::QueryResponseFut<
4363        NamespaceCreateResult,
4364        fidl::encoding::DefaultFuchsiaResourceDialect,
4365    > {
4366        NamespaceProxyInterface::r#create(self, entries)
4367    }
4368
4369    pub fn r#create2(
4370        &self,
4371        mut entries: Vec<NamespaceInputEntry2>,
4372    ) -> fidl::client::QueryResponseFut<
4373        NamespaceCreate2Result,
4374        fidl::encoding::DefaultFuchsiaResourceDialect,
4375    > {
4376        NamespaceProxyInterface::r#create2(self, entries)
4377    }
4378}
4379
4380impl NamespaceProxyInterface for NamespaceProxy {
4381    type CreateResponseFut = fidl::client::QueryResponseFut<
4382        NamespaceCreateResult,
4383        fidl::encoding::DefaultFuchsiaResourceDialect,
4384    >;
4385    fn r#create(&self, mut entries: Vec<NamespaceInputEntry>) -> Self::CreateResponseFut {
4386        fn _decode(
4387            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4388        ) -> Result<NamespaceCreateResult, fidl::Error> {
4389            let _response = fidl::client::decode_transaction_body::<
4390                fidl::encoding::FlexibleResultType<NamespaceCreateResponse, NamespaceError>,
4391                fidl::encoding::DefaultFuchsiaResourceDialect,
4392                0x4329fe12b2a790f9,
4393            >(_buf?)?
4394            .into_result::<NamespaceMarker>("create")?;
4395            Ok(_response.map(|x| x.entries))
4396        }
4397        self.client.send_query_and_decode::<NamespaceCreateRequest, NamespaceCreateResult>(
4398            (entries.as_mut(),),
4399            0x4329fe12b2a790f9,
4400            fidl::encoding::DynamicFlags::FLEXIBLE,
4401            _decode,
4402        )
4403    }
4404
4405    type Create2ResponseFut = fidl::client::QueryResponseFut<
4406        NamespaceCreate2Result,
4407        fidl::encoding::DefaultFuchsiaResourceDialect,
4408    >;
4409    fn r#create2(&self, mut entries: Vec<NamespaceInputEntry2>) -> Self::Create2ResponseFut {
4410        fn _decode(
4411            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4412        ) -> Result<NamespaceCreate2Result, fidl::Error> {
4413            let _response = fidl::client::decode_transaction_body::<
4414                fidl::encoding::FlexibleResultType<NamespaceCreate2Response, NamespaceError>,
4415                fidl::encoding::DefaultFuchsiaResourceDialect,
4416                0x665aa4bb3773b351,
4417            >(_buf?)?
4418            .into_result::<NamespaceMarker>("create2")?;
4419            Ok(_response.map(|x| x.entries))
4420        }
4421        self.client.send_query_and_decode::<NamespaceCreate2Request, NamespaceCreate2Result>(
4422            (entries.as_mut(),),
4423            0x665aa4bb3773b351,
4424            fidl::encoding::DynamicFlags::FLEXIBLE,
4425            _decode,
4426        )
4427    }
4428}
4429
4430pub struct NamespaceEventStream {
4431    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4432}
4433
4434impl std::marker::Unpin for NamespaceEventStream {}
4435
4436impl futures::stream::FusedStream for NamespaceEventStream {
4437    fn is_terminated(&self) -> bool {
4438        self.event_receiver.is_terminated()
4439    }
4440}
4441
4442impl futures::Stream for NamespaceEventStream {
4443    type Item = Result<NamespaceEvent, fidl::Error>;
4444
4445    fn poll_next(
4446        mut self: std::pin::Pin<&mut Self>,
4447        cx: &mut std::task::Context<'_>,
4448    ) -> std::task::Poll<Option<Self::Item>> {
4449        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4450            &mut self.event_receiver,
4451            cx
4452        )?) {
4453            Some(buf) => std::task::Poll::Ready(Some(NamespaceEvent::decode(buf))),
4454            None => std::task::Poll::Ready(None),
4455        }
4456    }
4457}
4458
4459#[derive(Debug)]
4460pub enum NamespaceEvent {
4461    #[non_exhaustive]
4462    _UnknownEvent {
4463        /// Ordinal of the event that was sent.
4464        ordinal: u64,
4465    },
4466}
4467
4468impl NamespaceEvent {
4469    /// Decodes a message buffer as a [`NamespaceEvent`].
4470    fn decode(
4471        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4472    ) -> Result<NamespaceEvent, fidl::Error> {
4473        let (bytes, _handles) = buf.split_mut();
4474        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4475        debug_assert_eq!(tx_header.tx_id, 0);
4476        match tx_header.ordinal {
4477            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4478                Ok(NamespaceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4479            }
4480            _ => Err(fidl::Error::UnknownOrdinal {
4481                ordinal: tx_header.ordinal,
4482                protocol_name: <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4483            }),
4484        }
4485    }
4486}
4487
4488/// A Stream of incoming requests for fuchsia.component/Namespace.
4489pub struct NamespaceRequestStream {
4490    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4491    is_terminated: bool,
4492}
4493
4494impl std::marker::Unpin for NamespaceRequestStream {}
4495
4496impl futures::stream::FusedStream for NamespaceRequestStream {
4497    fn is_terminated(&self) -> bool {
4498        self.is_terminated
4499    }
4500}
4501
4502impl fidl::endpoints::RequestStream for NamespaceRequestStream {
4503    type Protocol = NamespaceMarker;
4504    type ControlHandle = NamespaceControlHandle;
4505
4506    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4507        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4508    }
4509
4510    fn control_handle(&self) -> Self::ControlHandle {
4511        NamespaceControlHandle { inner: self.inner.clone() }
4512    }
4513
4514    fn into_inner(
4515        self,
4516    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4517    {
4518        (self.inner, self.is_terminated)
4519    }
4520
4521    fn from_inner(
4522        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4523        is_terminated: bool,
4524    ) -> Self {
4525        Self { inner, is_terminated }
4526    }
4527}
4528
4529impl futures::Stream for NamespaceRequestStream {
4530    type Item = Result<NamespaceRequest, fidl::Error>;
4531
4532    fn poll_next(
4533        mut self: std::pin::Pin<&mut Self>,
4534        cx: &mut std::task::Context<'_>,
4535    ) -> std::task::Poll<Option<Self::Item>> {
4536        let this = &mut *self;
4537        if this.inner.check_shutdown(cx) {
4538            this.is_terminated = true;
4539            return std::task::Poll::Ready(None);
4540        }
4541        if this.is_terminated {
4542            panic!("polled NamespaceRequestStream after completion");
4543        }
4544        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4545            |bytes, handles| {
4546                match this.inner.channel().read_etc(cx, bytes, handles) {
4547                    std::task::Poll::Ready(Ok(())) => {}
4548                    std::task::Poll::Pending => return std::task::Poll::Pending,
4549                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4550                        this.is_terminated = true;
4551                        return std::task::Poll::Ready(None);
4552                    }
4553                    std::task::Poll::Ready(Err(e)) => {
4554                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4555                            e.into(),
4556                        ))));
4557                    }
4558                }
4559
4560                // A message has been received from the channel
4561                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4562
4563                std::task::Poll::Ready(Some(match header.ordinal {
4564                    0x4329fe12b2a790f9 => {
4565                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4566                        let mut req = fidl::new_empty!(
4567                            NamespaceCreateRequest,
4568                            fidl::encoding::DefaultFuchsiaResourceDialect
4569                        );
4570                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NamespaceCreateRequest>(&header, _body_bytes, handles, &mut req)?;
4571                        let control_handle = NamespaceControlHandle { inner: this.inner.clone() };
4572                        Ok(NamespaceRequest::Create {
4573                            entries: req.entries,
4574
4575                            responder: NamespaceCreateResponder {
4576                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4577                                tx_id: header.tx_id,
4578                            },
4579                        })
4580                    }
4581                    0x665aa4bb3773b351 => {
4582                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4583                        let mut req = fidl::new_empty!(
4584                            NamespaceCreate2Request,
4585                            fidl::encoding::DefaultFuchsiaResourceDialect
4586                        );
4587                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NamespaceCreate2Request>(&header, _body_bytes, handles, &mut req)?;
4588                        let control_handle = NamespaceControlHandle { inner: this.inner.clone() };
4589                        Ok(NamespaceRequest::Create2 {
4590                            entries: req.entries,
4591
4592                            responder: NamespaceCreate2Responder {
4593                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4594                                tx_id: header.tx_id,
4595                            },
4596                        })
4597                    }
4598                    _ if header.tx_id == 0
4599                        && header
4600                            .dynamic_flags()
4601                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4602                    {
4603                        Ok(NamespaceRequest::_UnknownMethod {
4604                            ordinal: header.ordinal,
4605                            control_handle: NamespaceControlHandle { inner: this.inner.clone() },
4606                            method_type: fidl::MethodType::OneWay,
4607                        })
4608                    }
4609                    _ if header
4610                        .dynamic_flags()
4611                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4612                    {
4613                        this.inner.send_framework_err(
4614                            fidl::encoding::FrameworkErr::UnknownMethod,
4615                            header.tx_id,
4616                            header.ordinal,
4617                            header.dynamic_flags(),
4618                            (bytes, handles),
4619                        )?;
4620                        Ok(NamespaceRequest::_UnknownMethod {
4621                            ordinal: header.ordinal,
4622                            control_handle: NamespaceControlHandle { inner: this.inner.clone() },
4623                            method_type: fidl::MethodType::TwoWay,
4624                        })
4625                    }
4626                    _ => Err(fidl::Error::UnknownOrdinal {
4627                        ordinal: header.ordinal,
4628                        protocol_name:
4629                            <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4630                    }),
4631                }))
4632            },
4633        )
4634    }
4635}
4636
4637/// Protocol for performing namespace operations.
4638#[derive(Debug)]
4639pub enum NamespaceRequest {
4640    Create {
4641        entries: Vec<NamespaceInputEntry>,
4642        responder: NamespaceCreateResponder,
4643    },
4644    Create2 {
4645        entries: Vec<NamespaceInputEntry2>,
4646        responder: NamespaceCreate2Responder,
4647    },
4648    /// An interaction was received which does not match any known method.
4649    #[non_exhaustive]
4650    _UnknownMethod {
4651        /// Ordinal of the method that was called.
4652        ordinal: u64,
4653        control_handle: NamespaceControlHandle,
4654        method_type: fidl::MethodType,
4655    },
4656}
4657
4658impl NamespaceRequest {
4659    #[allow(irrefutable_let_patterns)]
4660    pub fn into_create(self) -> Option<(Vec<NamespaceInputEntry>, NamespaceCreateResponder)> {
4661        if let NamespaceRequest::Create { entries, responder } = self {
4662            Some((entries, responder))
4663        } else {
4664            None
4665        }
4666    }
4667
4668    #[allow(irrefutable_let_patterns)]
4669    pub fn into_create2(self) -> Option<(Vec<NamespaceInputEntry2>, NamespaceCreate2Responder)> {
4670        if let NamespaceRequest::Create2 { entries, responder } = self {
4671            Some((entries, responder))
4672        } else {
4673            None
4674        }
4675    }
4676
4677    /// Name of the method defined in FIDL
4678    pub fn method_name(&self) -> &'static str {
4679        match *self {
4680            NamespaceRequest::Create { .. } => "create",
4681            NamespaceRequest::Create2 { .. } => "create2",
4682            NamespaceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4683                "unknown one-way method"
4684            }
4685            NamespaceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4686                "unknown two-way method"
4687            }
4688        }
4689    }
4690}
4691
4692#[derive(Debug, Clone)]
4693pub struct NamespaceControlHandle {
4694    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4695}
4696
4697impl fidl::endpoints::ControlHandle for NamespaceControlHandle {
4698    fn shutdown(&self) {
4699        self.inner.shutdown()
4700    }
4701
4702    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4703        self.inner.shutdown_with_epitaph(status)
4704    }
4705
4706    fn is_closed(&self) -> bool {
4707        self.inner.channel().is_closed()
4708    }
4709    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4710        self.inner.channel().on_closed()
4711    }
4712
4713    #[cfg(target_os = "fuchsia")]
4714    fn signal_peer(
4715        &self,
4716        clear_mask: zx::Signals,
4717        set_mask: zx::Signals,
4718    ) -> Result<(), zx_status::Status> {
4719        use fidl::Peered;
4720        self.inner.channel().signal_peer(clear_mask, set_mask)
4721    }
4722}
4723
4724impl NamespaceControlHandle {}
4725
4726#[must_use = "FIDL methods require a response to be sent"]
4727#[derive(Debug)]
4728pub struct NamespaceCreateResponder {
4729    control_handle: std::mem::ManuallyDrop<NamespaceControlHandle>,
4730    tx_id: u32,
4731}
4732
4733/// Set the the channel to be shutdown (see [`NamespaceControlHandle::shutdown`])
4734/// if the responder is dropped without sending a response, so that the client
4735/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4736impl std::ops::Drop for NamespaceCreateResponder {
4737    fn drop(&mut self) {
4738        self.control_handle.shutdown();
4739        // Safety: drops once, never accessed again
4740        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4741    }
4742}
4743
4744impl fidl::endpoints::Responder for NamespaceCreateResponder {
4745    type ControlHandle = NamespaceControlHandle;
4746
4747    fn control_handle(&self) -> &NamespaceControlHandle {
4748        &self.control_handle
4749    }
4750
4751    fn drop_without_shutdown(mut self) {
4752        // Safety: drops once, never accessed again due to mem::forget
4753        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4754        // Prevent Drop from running (which would shut down the channel)
4755        std::mem::forget(self);
4756    }
4757}
4758
4759impl NamespaceCreateResponder {
4760    /// Sends a response to the FIDL transaction.
4761    ///
4762    /// Sets the channel to shutdown if an error occurs.
4763    pub fn send(
4764        self,
4765        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4766    ) -> Result<(), fidl::Error> {
4767        let _result = self.send_raw(result);
4768        if _result.is_err() {
4769            self.control_handle.shutdown();
4770        }
4771        self.drop_without_shutdown();
4772        _result
4773    }
4774
4775    /// Similar to "send" but does not shutdown the channel if an error occurs.
4776    pub fn send_no_shutdown_on_err(
4777        self,
4778        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4779    ) -> Result<(), fidl::Error> {
4780        let _result = self.send_raw(result);
4781        self.drop_without_shutdown();
4782        _result
4783    }
4784
4785    fn send_raw(
4786        &self,
4787        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4788    ) -> Result<(), fidl::Error> {
4789        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4790            NamespaceCreateResponse,
4791            NamespaceError,
4792        >>(
4793            fidl::encoding::FlexibleResult::new(
4794                result.as_mut().map_err(|e| *e).map(|entries| (entries.as_mut_slice(),)),
4795            ),
4796            self.tx_id,
4797            0x4329fe12b2a790f9,
4798            fidl::encoding::DynamicFlags::FLEXIBLE,
4799        )
4800    }
4801}
4802
4803#[must_use = "FIDL methods require a response to be sent"]
4804#[derive(Debug)]
4805pub struct NamespaceCreate2Responder {
4806    control_handle: std::mem::ManuallyDrop<NamespaceControlHandle>,
4807    tx_id: u32,
4808}
4809
4810/// Set the the channel to be shutdown (see [`NamespaceControlHandle::shutdown`])
4811/// if the responder is dropped without sending a response, so that the client
4812/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4813impl std::ops::Drop for NamespaceCreate2Responder {
4814    fn drop(&mut self) {
4815        self.control_handle.shutdown();
4816        // Safety: drops once, never accessed again
4817        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4818    }
4819}
4820
4821impl fidl::endpoints::Responder for NamespaceCreate2Responder {
4822    type ControlHandle = NamespaceControlHandle;
4823
4824    fn control_handle(&self) -> &NamespaceControlHandle {
4825        &self.control_handle
4826    }
4827
4828    fn drop_without_shutdown(mut self) {
4829        // Safety: drops once, never accessed again due to mem::forget
4830        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4831        // Prevent Drop from running (which would shut down the channel)
4832        std::mem::forget(self);
4833    }
4834}
4835
4836impl NamespaceCreate2Responder {
4837    /// Sends a response to the FIDL transaction.
4838    ///
4839    /// Sets the channel to shutdown if an error occurs.
4840    pub fn send(
4841        self,
4842        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4843    ) -> Result<(), fidl::Error> {
4844        let _result = self.send_raw(result);
4845        if _result.is_err() {
4846            self.control_handle.shutdown();
4847        }
4848        self.drop_without_shutdown();
4849        _result
4850    }
4851
4852    /// Similar to "send" but does not shutdown the channel if an error occurs.
4853    pub fn send_no_shutdown_on_err(
4854        self,
4855        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4856    ) -> Result<(), fidl::Error> {
4857        let _result = self.send_raw(result);
4858        self.drop_without_shutdown();
4859        _result
4860    }
4861
4862    fn send_raw(
4863        &self,
4864        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4865    ) -> Result<(), fidl::Error> {
4866        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4867            NamespaceCreate2Response,
4868            NamespaceError,
4869        >>(
4870            fidl::encoding::FlexibleResult::new(
4871                result.as_mut().map_err(|e| *e).map(|entries| (entries.as_mut_slice(),)),
4872            ),
4873            self.tx_id,
4874            0x665aa4bb3773b351,
4875            fidl::encoding::DynamicFlags::FLEXIBLE,
4876        )
4877    }
4878}
4879
4880#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4881pub struct RealmMarker;
4882
4883impl fidl::endpoints::ProtocolMarker for RealmMarker {
4884    type Proxy = RealmProxy;
4885    type RequestStream = RealmRequestStream;
4886    #[cfg(target_os = "fuchsia")]
4887    type SynchronousProxy = RealmSynchronousProxy;
4888
4889    const DEBUG_NAME: &'static str = "fuchsia.component.Realm";
4890}
4891impl fidl::endpoints::DiscoverableProtocolMarker for RealmMarker {}
4892pub type RealmOpenControllerResult = Result<(), Error>;
4893pub type RealmOpenExposedDirResult = Result<(), Error>;
4894pub type RealmCreateChildResult = Result<(), Error>;
4895pub type RealmDestroyChildResult = Result<(), Error>;
4896pub type RealmListChildrenResult = Result<(), Error>;
4897pub type RealmGetResolvedInfoResult = Result<fidl_fuchsia_component_resolution::Component, Error>;
4898pub type RealmGetChildOutputDictionaryDeprecatedResult =
4899    Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>;
4900pub type RealmGetChildOutputDictionaryResult = Result<fidl::EventPair, Error>;
4901
4902pub trait RealmProxyInterface: Send + Sync {
4903    type OpenControllerResponseFut: std::future::Future<Output = Result<RealmOpenControllerResult, fidl::Error>>
4904        + Send;
4905    fn r#open_controller(
4906        &self,
4907        child: &fidl_fuchsia_component_decl::ChildRef,
4908        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
4909    ) -> Self::OpenControllerResponseFut;
4910    type OpenExposedDirResponseFut: std::future::Future<Output = Result<RealmOpenExposedDirResult, fidl::Error>>
4911        + Send;
4912    fn r#open_exposed_dir(
4913        &self,
4914        child: &fidl_fuchsia_component_decl::ChildRef,
4915        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4916    ) -> Self::OpenExposedDirResponseFut;
4917    type CreateChildResponseFut: std::future::Future<Output = Result<RealmCreateChildResult, fidl::Error>>
4918        + Send;
4919    fn r#create_child(
4920        &self,
4921        collection: &fidl_fuchsia_component_decl::CollectionRef,
4922        decl: &fidl_fuchsia_component_decl::Child,
4923        args: CreateChildArgs,
4924    ) -> Self::CreateChildResponseFut;
4925    type DestroyChildResponseFut: std::future::Future<Output = Result<RealmDestroyChildResult, fidl::Error>>
4926        + Send;
4927    fn r#destroy_child(
4928        &self,
4929        child: &fidl_fuchsia_component_decl::ChildRef,
4930    ) -> Self::DestroyChildResponseFut;
4931    type ListChildrenResponseFut: std::future::Future<Output = Result<RealmListChildrenResult, fidl::Error>>
4932        + Send;
4933    fn r#list_children(
4934        &self,
4935        collection: &fidl_fuchsia_component_decl::CollectionRef,
4936        iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
4937    ) -> Self::ListChildrenResponseFut;
4938    type GetResolvedInfoResponseFut: std::future::Future<Output = Result<RealmGetResolvedInfoResult, fidl::Error>>
4939        + Send;
4940    fn r#get_resolved_info(&self) -> Self::GetResolvedInfoResponseFut;
4941    type GetChildOutputDictionaryDeprecatedResponseFut: std::future::Future<
4942            Output = Result<RealmGetChildOutputDictionaryDeprecatedResult, fidl::Error>,
4943        > + Send;
4944    fn r#get_child_output_dictionary_deprecated(
4945        &self,
4946        child: &fidl_fuchsia_component_decl::ChildRef,
4947    ) -> Self::GetChildOutputDictionaryDeprecatedResponseFut;
4948    type GetChildOutputDictionaryResponseFut: std::future::Future<Output = Result<RealmGetChildOutputDictionaryResult, fidl::Error>>
4949        + Send;
4950    fn r#get_child_output_dictionary(
4951        &self,
4952        child: &fidl_fuchsia_component_decl::ChildRef,
4953    ) -> Self::GetChildOutputDictionaryResponseFut;
4954}
4955#[derive(Debug)]
4956#[cfg(target_os = "fuchsia")]
4957pub struct RealmSynchronousProxy {
4958    client: fidl::client::sync::Client,
4959}
4960
4961#[cfg(target_os = "fuchsia")]
4962impl fidl::endpoints::SynchronousProxy for RealmSynchronousProxy {
4963    type Proxy = RealmProxy;
4964    type Protocol = RealmMarker;
4965
4966    fn from_channel(inner: fidl::Channel) -> Self {
4967        Self::new(inner)
4968    }
4969
4970    fn into_channel(self) -> fidl::Channel {
4971        self.client.into_channel()
4972    }
4973
4974    fn as_channel(&self) -> &fidl::Channel {
4975        self.client.as_channel()
4976    }
4977}
4978
4979#[cfg(target_os = "fuchsia")]
4980impl RealmSynchronousProxy {
4981    pub fn new(channel: fidl::Channel) -> Self {
4982        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4983        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4984    }
4985
4986    pub fn into_channel(self) -> fidl::Channel {
4987        self.client.into_channel()
4988    }
4989
4990    /// Waits until an event arrives and returns it. It is safe for other
4991    /// threads to make concurrent requests while waiting for an event.
4992    pub fn wait_for_event(
4993        &self,
4994        deadline: zx::MonotonicInstant,
4995    ) -> Result<RealmEvent, fidl::Error> {
4996        RealmEvent::decode(self.client.wait_for_event(deadline)?)
4997    }
4998
4999    /// Operate on a child component. See documentation for [`Controller`].
5000    ///
5001    /// Errors:
5002    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5003    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5004    /// - `INSTANCE_DIED`: This realm no longer exists.
5005    pub fn r#open_controller(
5006        &self,
5007        mut child: &fidl_fuchsia_component_decl::ChildRef,
5008        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5009        ___deadline: zx::MonotonicInstant,
5010    ) -> Result<RealmOpenControllerResult, fidl::Error> {
5011        let _response = self.client.send_query::<
5012            RealmOpenControllerRequest,
5013            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5014        >(
5015            (child, controller,),
5016            0x7150b7898d1b1180,
5017            fidl::encoding::DynamicFlags::empty(),
5018            ___deadline,
5019        )?;
5020        Ok(_response.map(|x| x))
5021    }
5022
5023    /// Opens the exposed directory of a child component. When this function
5024    /// successfully returns, `exposed_dir` is bound to a directory that
5025    /// contains the capabilities which the child exposed to its realm via
5026    /// `ComponentDecl.exposes` (specified via "expose" declarations in the
5027    /// component's manifest). The child component will not start as a result of
5028    /// this call.
5029    ///
5030    /// `exposed_dir` is open as long as `child` exists.
5031    ///
5032    /// Errors:
5033    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5034    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5035    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
5036    /// - `INSTANCE_DIED`: This realm no longer exists.
5037    pub fn r#open_exposed_dir(
5038        &self,
5039        mut child: &fidl_fuchsia_component_decl::ChildRef,
5040        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5041        ___deadline: zx::MonotonicInstant,
5042    ) -> Result<RealmOpenExposedDirResult, fidl::Error> {
5043        let _response = self.client.send_query::<
5044            RealmOpenExposedDirRequest,
5045            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5046        >(
5047            (child, exposed_dir,),
5048            0x7f993235ca59f92c,
5049            fidl::encoding::DynamicFlags::empty(),
5050            ___deadline,
5051        )?;
5052        Ok(_response.map(|x| x))
5053    }
5054
5055    /// Creates a child component instance dynamically. When this function
5056    /// returns successfully, the instance exists, but it may not be running.
5057    ///
5058    /// The environment of the child instance is determined by the environment
5059    /// of the collection. `decl` must not set `environment`.
5060    ///
5061    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
5062    /// [CreateChild] will start the component and return once the component is
5063    /// started. Otherwise, [CreateChild] will return immediately after creating
5064    /// the component and will not start or resolve it.
5065    ///
5066    /// Errors:
5067    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
5068    ///   is not a valid declaration.
5069    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5070    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
5071    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
5072    ///   in a `SingleRun` collection.
5073    /// - `NO_SPACE`: Could not allocate storage for the new instance.
5074    /// - `INSTANCE_DIED`: This realm no longer exists.
5075    pub fn r#create_child(
5076        &self,
5077        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5078        mut decl: &fidl_fuchsia_component_decl::Child,
5079        mut args: CreateChildArgs,
5080        ___deadline: zx::MonotonicInstant,
5081    ) -> Result<RealmCreateChildResult, fidl::Error> {
5082        let _response = self.client.send_query::<
5083            RealmCreateChildRequest,
5084            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5085        >(
5086            (collection, decl, &mut args,),
5087            0x43e48ce8483d7560,
5088            fidl::encoding::DynamicFlags::empty(),
5089            ___deadline,
5090        )?;
5091        Ok(_response.map(|x| x))
5092    }
5093
5094    /// Destroys a dynamically-created component instance. When this function
5095    /// returns, the instance is destroyed and has stopped running.  However,
5096    /// cleanup of the component's resources (such as its isolated storage) may
5097    /// happen in the background after this function returns.
5098    ///
5099    /// Errors:
5100    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
5101    ///   to a dynamic instance.
5102    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5103    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5104    /// - `INSTANCE_DIED`: This realm no longer exists.
5105    pub fn r#destroy_child(
5106        &self,
5107        mut child: &fidl_fuchsia_component_decl::ChildRef,
5108        ___deadline: zx::MonotonicInstant,
5109    ) -> Result<RealmDestroyChildResult, fidl::Error> {
5110        let _response = self.client.send_query::<
5111            RealmDestroyChildRequest,
5112            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5113        >(
5114            (child,),
5115            0x71d8caf8850c9222,
5116            fidl::encoding::DynamicFlags::empty(),
5117            ___deadline,
5118        )?;
5119        Ok(_response.map(|x| x))
5120    }
5121
5122    /// Returns an iterator that lists all instances in a collection.
5123    ///
5124    /// NOTE: The results are not guaranteed to be consistent. Instances may be
5125    /// created or destroyed while the iterator is live, but those changes
5126    /// won't be observed by the iterator after this method returns.
5127    ///
5128    /// Errors:
5129    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
5130    /// does not have `ZX_RIGHT_WAIT`.
5131    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5132    /// - `INSTANCE_DIED`: This realm no longer exists.
5133    /// - If `iter` does not have standard channel rights, this function may
5134    ///   return `ACCESS_DENIED` or component manager may close `iter`.
5135    pub fn r#list_children(
5136        &self,
5137        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5138        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5139        ___deadline: zx::MonotonicInstant,
5140    ) -> Result<RealmListChildrenResult, fidl::Error> {
5141        let _response = self.client.send_query::<
5142            RealmListChildrenRequest,
5143            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5144        >(
5145            (collection, iter,),
5146            0x6888a76683efc0a1,
5147            fidl::encoding::DynamicFlags::empty(),
5148            ___deadline,
5149        )?;
5150        Ok(_response.map(|x| x))
5151    }
5152
5153    /// Returns the set of information that was given to the component framework
5154    /// by this component's resolver.
5155    pub fn r#get_resolved_info(
5156        &self,
5157        ___deadline: zx::MonotonicInstant,
5158    ) -> Result<RealmGetResolvedInfoResult, fidl::Error> {
5159        let _response = self.client.send_query::<
5160            fidl::encoding::EmptyPayload,
5161            fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>,
5162        >(
5163            (),
5164            0x734f744cb7d210a2,
5165            fidl::encoding::DynamicFlags::empty(),
5166            ___deadline,
5167        )?;
5168        Ok(_response.map(|x| x.resolved_info))
5169    }
5170
5171    pub fn r#get_child_output_dictionary_deprecated(
5172        &self,
5173        mut child: &fidl_fuchsia_component_decl::ChildRef,
5174        ___deadline: zx::MonotonicInstant,
5175    ) -> Result<RealmGetChildOutputDictionaryDeprecatedResult, fidl::Error> {
5176        let _response = self.client.send_query::<
5177            RealmGetChildOutputDictionaryDeprecatedRequest,
5178            fidl::encoding::ResultType<RealmGetChildOutputDictionaryDeprecatedResponse, Error>,
5179        >(
5180            (child,),
5181            0x39245b02aba94364,
5182            fidl::encoding::DynamicFlags::empty(),
5183            ___deadline,
5184        )?;
5185        Ok(_response.map(|x| x.dictionary))
5186    }
5187
5188    /// Returns a reference to a child's output dictionary, which may be
5189    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
5190    pub fn r#get_child_output_dictionary(
5191        &self,
5192        mut child: &fidl_fuchsia_component_decl::ChildRef,
5193        ___deadline: zx::MonotonicInstant,
5194    ) -> Result<RealmGetChildOutputDictionaryResult, fidl::Error> {
5195        let _response = self.client.send_query::<
5196            RealmGetChildOutputDictionaryRequest,
5197            fidl::encoding::ResultType<RealmGetChildOutputDictionaryResponse, Error>,
5198        >(
5199            (child,),
5200            0x4259d08d261d5610,
5201            fidl::encoding::DynamicFlags::empty(),
5202            ___deadline,
5203        )?;
5204        Ok(_response.map(|x| x.dictionary))
5205    }
5206}
5207
5208#[cfg(target_os = "fuchsia")]
5209impl From<RealmSynchronousProxy> for zx::NullableHandle {
5210    fn from(value: RealmSynchronousProxy) -> Self {
5211        value.into_channel().into()
5212    }
5213}
5214
5215#[cfg(target_os = "fuchsia")]
5216impl From<fidl::Channel> for RealmSynchronousProxy {
5217    fn from(value: fidl::Channel) -> Self {
5218        Self::new(value)
5219    }
5220}
5221
5222#[cfg(target_os = "fuchsia")]
5223impl fidl::endpoints::FromClient for RealmSynchronousProxy {
5224    type Protocol = RealmMarker;
5225
5226    fn from_client(value: fidl::endpoints::ClientEnd<RealmMarker>) -> Self {
5227        Self::new(value.into_channel())
5228    }
5229}
5230
5231#[derive(Debug, Clone)]
5232pub struct RealmProxy {
5233    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5234}
5235
5236impl fidl::endpoints::Proxy for RealmProxy {
5237    type Protocol = RealmMarker;
5238
5239    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5240        Self::new(inner)
5241    }
5242
5243    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5244        self.client.into_channel().map_err(|client| Self { client })
5245    }
5246
5247    fn as_channel(&self) -> &::fidl::AsyncChannel {
5248        self.client.as_channel()
5249    }
5250}
5251
5252impl RealmProxy {
5253    /// Create a new Proxy for fuchsia.component/Realm.
5254    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5255        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5256        Self { client: fidl::client::Client::new(channel, protocol_name) }
5257    }
5258
5259    /// Get a Stream of events from the remote end of the protocol.
5260    ///
5261    /// # Panics
5262    ///
5263    /// Panics if the event stream was already taken.
5264    pub fn take_event_stream(&self) -> RealmEventStream {
5265        RealmEventStream { event_receiver: self.client.take_event_receiver() }
5266    }
5267
5268    /// Operate on a child component. See documentation for [`Controller`].
5269    ///
5270    /// Errors:
5271    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5272    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5273    /// - `INSTANCE_DIED`: This realm no longer exists.
5274    pub fn r#open_controller(
5275        &self,
5276        mut child: &fidl_fuchsia_component_decl::ChildRef,
5277        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5278    ) -> fidl::client::QueryResponseFut<
5279        RealmOpenControllerResult,
5280        fidl::encoding::DefaultFuchsiaResourceDialect,
5281    > {
5282        RealmProxyInterface::r#open_controller(self, child, controller)
5283    }
5284
5285    /// Opens the exposed directory of a child component. When this function
5286    /// successfully returns, `exposed_dir` is bound to a directory that
5287    /// contains the capabilities which the child exposed to its realm via
5288    /// `ComponentDecl.exposes` (specified via "expose" declarations in the
5289    /// component's manifest). The child component will not start as a result of
5290    /// this call.
5291    ///
5292    /// `exposed_dir` is open as long as `child` exists.
5293    ///
5294    /// Errors:
5295    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5296    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5297    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
5298    /// - `INSTANCE_DIED`: This realm no longer exists.
5299    pub fn r#open_exposed_dir(
5300        &self,
5301        mut child: &fidl_fuchsia_component_decl::ChildRef,
5302        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5303    ) -> fidl::client::QueryResponseFut<
5304        RealmOpenExposedDirResult,
5305        fidl::encoding::DefaultFuchsiaResourceDialect,
5306    > {
5307        RealmProxyInterface::r#open_exposed_dir(self, child, exposed_dir)
5308    }
5309
5310    /// Creates a child component instance dynamically. When this function
5311    /// returns successfully, the instance exists, but it may not be running.
5312    ///
5313    /// The environment of the child instance is determined by the environment
5314    /// of the collection. `decl` must not set `environment`.
5315    ///
5316    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
5317    /// [CreateChild] will start the component and return once the component is
5318    /// started. Otherwise, [CreateChild] will return immediately after creating
5319    /// the component and will not start or resolve it.
5320    ///
5321    /// Errors:
5322    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
5323    ///   is not a valid declaration.
5324    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5325    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
5326    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
5327    ///   in a `SingleRun` collection.
5328    /// - `NO_SPACE`: Could not allocate storage for the new instance.
5329    /// - `INSTANCE_DIED`: This realm no longer exists.
5330    pub fn r#create_child(
5331        &self,
5332        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5333        mut decl: &fidl_fuchsia_component_decl::Child,
5334        mut args: CreateChildArgs,
5335    ) -> fidl::client::QueryResponseFut<
5336        RealmCreateChildResult,
5337        fidl::encoding::DefaultFuchsiaResourceDialect,
5338    > {
5339        RealmProxyInterface::r#create_child(self, collection, decl, args)
5340    }
5341
5342    /// Destroys a dynamically-created component instance. When this function
5343    /// returns, the instance is destroyed and has stopped running.  However,
5344    /// cleanup of the component's resources (such as its isolated storage) may
5345    /// happen in the background after this function returns.
5346    ///
5347    /// Errors:
5348    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
5349    ///   to a dynamic instance.
5350    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5351    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5352    /// - `INSTANCE_DIED`: This realm no longer exists.
5353    pub fn r#destroy_child(
5354        &self,
5355        mut child: &fidl_fuchsia_component_decl::ChildRef,
5356    ) -> fidl::client::QueryResponseFut<
5357        RealmDestroyChildResult,
5358        fidl::encoding::DefaultFuchsiaResourceDialect,
5359    > {
5360        RealmProxyInterface::r#destroy_child(self, child)
5361    }
5362
5363    /// Returns an iterator that lists all instances in a collection.
5364    ///
5365    /// NOTE: The results are not guaranteed to be consistent. Instances may be
5366    /// created or destroyed while the iterator is live, but those changes
5367    /// won't be observed by the iterator after this method returns.
5368    ///
5369    /// Errors:
5370    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
5371    /// does not have `ZX_RIGHT_WAIT`.
5372    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5373    /// - `INSTANCE_DIED`: This realm no longer exists.
5374    /// - If `iter` does not have standard channel rights, this function may
5375    ///   return `ACCESS_DENIED` or component manager may close `iter`.
5376    pub fn r#list_children(
5377        &self,
5378        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5379        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5380    ) -> fidl::client::QueryResponseFut<
5381        RealmListChildrenResult,
5382        fidl::encoding::DefaultFuchsiaResourceDialect,
5383    > {
5384        RealmProxyInterface::r#list_children(self, collection, iter)
5385    }
5386
5387    /// Returns the set of information that was given to the component framework
5388    /// by this component's resolver.
5389    pub fn r#get_resolved_info(
5390        &self,
5391    ) -> fidl::client::QueryResponseFut<
5392        RealmGetResolvedInfoResult,
5393        fidl::encoding::DefaultFuchsiaResourceDialect,
5394    > {
5395        RealmProxyInterface::r#get_resolved_info(self)
5396    }
5397
5398    pub fn r#get_child_output_dictionary_deprecated(
5399        &self,
5400        mut child: &fidl_fuchsia_component_decl::ChildRef,
5401    ) -> fidl::client::QueryResponseFut<
5402        RealmGetChildOutputDictionaryDeprecatedResult,
5403        fidl::encoding::DefaultFuchsiaResourceDialect,
5404    > {
5405        RealmProxyInterface::r#get_child_output_dictionary_deprecated(self, child)
5406    }
5407
5408    /// Returns a reference to a child's output dictionary, which may be
5409    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
5410    pub fn r#get_child_output_dictionary(
5411        &self,
5412        mut child: &fidl_fuchsia_component_decl::ChildRef,
5413    ) -> fidl::client::QueryResponseFut<
5414        RealmGetChildOutputDictionaryResult,
5415        fidl::encoding::DefaultFuchsiaResourceDialect,
5416    > {
5417        RealmProxyInterface::r#get_child_output_dictionary(self, child)
5418    }
5419}
5420
5421impl RealmProxyInterface for RealmProxy {
5422    type OpenControllerResponseFut = fidl::client::QueryResponseFut<
5423        RealmOpenControllerResult,
5424        fidl::encoding::DefaultFuchsiaResourceDialect,
5425    >;
5426    fn r#open_controller(
5427        &self,
5428        mut child: &fidl_fuchsia_component_decl::ChildRef,
5429        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5430    ) -> Self::OpenControllerResponseFut {
5431        fn _decode(
5432            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5433        ) -> Result<RealmOpenControllerResult, fidl::Error> {
5434            let _response = fidl::client::decode_transaction_body::<
5435                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5436                fidl::encoding::DefaultFuchsiaResourceDialect,
5437                0x7150b7898d1b1180,
5438            >(_buf?)?;
5439            Ok(_response.map(|x| x))
5440        }
5441        self.client.send_query_and_decode::<RealmOpenControllerRequest, RealmOpenControllerResult>(
5442            (child, controller),
5443            0x7150b7898d1b1180,
5444            fidl::encoding::DynamicFlags::empty(),
5445            _decode,
5446        )
5447    }
5448
5449    type OpenExposedDirResponseFut = fidl::client::QueryResponseFut<
5450        RealmOpenExposedDirResult,
5451        fidl::encoding::DefaultFuchsiaResourceDialect,
5452    >;
5453    fn r#open_exposed_dir(
5454        &self,
5455        mut child: &fidl_fuchsia_component_decl::ChildRef,
5456        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5457    ) -> Self::OpenExposedDirResponseFut {
5458        fn _decode(
5459            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5460        ) -> Result<RealmOpenExposedDirResult, fidl::Error> {
5461            let _response = fidl::client::decode_transaction_body::<
5462                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5463                fidl::encoding::DefaultFuchsiaResourceDialect,
5464                0x7f993235ca59f92c,
5465            >(_buf?)?;
5466            Ok(_response.map(|x| x))
5467        }
5468        self.client.send_query_and_decode::<RealmOpenExposedDirRequest, RealmOpenExposedDirResult>(
5469            (child, exposed_dir),
5470            0x7f993235ca59f92c,
5471            fidl::encoding::DynamicFlags::empty(),
5472            _decode,
5473        )
5474    }
5475
5476    type CreateChildResponseFut = fidl::client::QueryResponseFut<
5477        RealmCreateChildResult,
5478        fidl::encoding::DefaultFuchsiaResourceDialect,
5479    >;
5480    fn r#create_child(
5481        &self,
5482        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5483        mut decl: &fidl_fuchsia_component_decl::Child,
5484        mut args: CreateChildArgs,
5485    ) -> Self::CreateChildResponseFut {
5486        fn _decode(
5487            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5488        ) -> Result<RealmCreateChildResult, fidl::Error> {
5489            let _response = fidl::client::decode_transaction_body::<
5490                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5491                fidl::encoding::DefaultFuchsiaResourceDialect,
5492                0x43e48ce8483d7560,
5493            >(_buf?)?;
5494            Ok(_response.map(|x| x))
5495        }
5496        self.client.send_query_and_decode::<RealmCreateChildRequest, RealmCreateChildResult>(
5497            (collection, decl, &mut args),
5498            0x43e48ce8483d7560,
5499            fidl::encoding::DynamicFlags::empty(),
5500            _decode,
5501        )
5502    }
5503
5504    type DestroyChildResponseFut = fidl::client::QueryResponseFut<
5505        RealmDestroyChildResult,
5506        fidl::encoding::DefaultFuchsiaResourceDialect,
5507    >;
5508    fn r#destroy_child(
5509        &self,
5510        mut child: &fidl_fuchsia_component_decl::ChildRef,
5511    ) -> Self::DestroyChildResponseFut {
5512        fn _decode(
5513            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5514        ) -> Result<RealmDestroyChildResult, fidl::Error> {
5515            let _response = fidl::client::decode_transaction_body::<
5516                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5517                fidl::encoding::DefaultFuchsiaResourceDialect,
5518                0x71d8caf8850c9222,
5519            >(_buf?)?;
5520            Ok(_response.map(|x| x))
5521        }
5522        self.client.send_query_and_decode::<RealmDestroyChildRequest, RealmDestroyChildResult>(
5523            (child,),
5524            0x71d8caf8850c9222,
5525            fidl::encoding::DynamicFlags::empty(),
5526            _decode,
5527        )
5528    }
5529
5530    type ListChildrenResponseFut = fidl::client::QueryResponseFut<
5531        RealmListChildrenResult,
5532        fidl::encoding::DefaultFuchsiaResourceDialect,
5533    >;
5534    fn r#list_children(
5535        &self,
5536        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5537        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5538    ) -> Self::ListChildrenResponseFut {
5539        fn _decode(
5540            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5541        ) -> Result<RealmListChildrenResult, fidl::Error> {
5542            let _response = fidl::client::decode_transaction_body::<
5543                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5544                fidl::encoding::DefaultFuchsiaResourceDialect,
5545                0x6888a76683efc0a1,
5546            >(_buf?)?;
5547            Ok(_response.map(|x| x))
5548        }
5549        self.client.send_query_and_decode::<RealmListChildrenRequest, RealmListChildrenResult>(
5550            (collection, iter),
5551            0x6888a76683efc0a1,
5552            fidl::encoding::DynamicFlags::empty(),
5553            _decode,
5554        )
5555    }
5556
5557    type GetResolvedInfoResponseFut = fidl::client::QueryResponseFut<
5558        RealmGetResolvedInfoResult,
5559        fidl::encoding::DefaultFuchsiaResourceDialect,
5560    >;
5561    fn r#get_resolved_info(&self) -> Self::GetResolvedInfoResponseFut {
5562        fn _decode(
5563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5564        ) -> Result<RealmGetResolvedInfoResult, fidl::Error> {
5565            let _response = fidl::client::decode_transaction_body::<
5566                fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>,
5567                fidl::encoding::DefaultFuchsiaResourceDialect,
5568                0x734f744cb7d210a2,
5569            >(_buf?)?;
5570            Ok(_response.map(|x| x.resolved_info))
5571        }
5572        self.client
5573            .send_query_and_decode::<fidl::encoding::EmptyPayload, RealmGetResolvedInfoResult>(
5574                (),
5575                0x734f744cb7d210a2,
5576                fidl::encoding::DynamicFlags::empty(),
5577                _decode,
5578            )
5579    }
5580
5581    type GetChildOutputDictionaryDeprecatedResponseFut = fidl::client::QueryResponseFut<
5582        RealmGetChildOutputDictionaryDeprecatedResult,
5583        fidl::encoding::DefaultFuchsiaResourceDialect,
5584    >;
5585    fn r#get_child_output_dictionary_deprecated(
5586        &self,
5587        mut child: &fidl_fuchsia_component_decl::ChildRef,
5588    ) -> Self::GetChildOutputDictionaryDeprecatedResponseFut {
5589        fn _decode(
5590            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5591        ) -> Result<RealmGetChildOutputDictionaryDeprecatedResult, fidl::Error> {
5592            let _response = fidl::client::decode_transaction_body::<
5593                fidl::encoding::ResultType<RealmGetChildOutputDictionaryDeprecatedResponse, Error>,
5594                fidl::encoding::DefaultFuchsiaResourceDialect,
5595                0x39245b02aba94364,
5596            >(_buf?)?;
5597            Ok(_response.map(|x| x.dictionary))
5598        }
5599        self.client.send_query_and_decode::<
5600            RealmGetChildOutputDictionaryDeprecatedRequest,
5601            RealmGetChildOutputDictionaryDeprecatedResult,
5602        >(
5603            (child,),
5604            0x39245b02aba94364,
5605            fidl::encoding::DynamicFlags::empty(),
5606            _decode,
5607        )
5608    }
5609
5610    type GetChildOutputDictionaryResponseFut = fidl::client::QueryResponseFut<
5611        RealmGetChildOutputDictionaryResult,
5612        fidl::encoding::DefaultFuchsiaResourceDialect,
5613    >;
5614    fn r#get_child_output_dictionary(
5615        &self,
5616        mut child: &fidl_fuchsia_component_decl::ChildRef,
5617    ) -> Self::GetChildOutputDictionaryResponseFut {
5618        fn _decode(
5619            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5620        ) -> Result<RealmGetChildOutputDictionaryResult, fidl::Error> {
5621            let _response = fidl::client::decode_transaction_body::<
5622                fidl::encoding::ResultType<RealmGetChildOutputDictionaryResponse, Error>,
5623                fidl::encoding::DefaultFuchsiaResourceDialect,
5624                0x4259d08d261d5610,
5625            >(_buf?)?;
5626            Ok(_response.map(|x| x.dictionary))
5627        }
5628        self.client.send_query_and_decode::<
5629            RealmGetChildOutputDictionaryRequest,
5630            RealmGetChildOutputDictionaryResult,
5631        >(
5632            (child,),
5633            0x4259d08d261d5610,
5634            fidl::encoding::DynamicFlags::empty(),
5635            _decode,
5636        )
5637    }
5638}
5639
5640pub struct RealmEventStream {
5641    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5642}
5643
5644impl std::marker::Unpin for RealmEventStream {}
5645
5646impl futures::stream::FusedStream for RealmEventStream {
5647    fn is_terminated(&self) -> bool {
5648        self.event_receiver.is_terminated()
5649    }
5650}
5651
5652impl futures::Stream for RealmEventStream {
5653    type Item = Result<RealmEvent, fidl::Error>;
5654
5655    fn poll_next(
5656        mut self: std::pin::Pin<&mut Self>,
5657        cx: &mut std::task::Context<'_>,
5658    ) -> std::task::Poll<Option<Self::Item>> {
5659        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5660            &mut self.event_receiver,
5661            cx
5662        )?) {
5663            Some(buf) => std::task::Poll::Ready(Some(RealmEvent::decode(buf))),
5664            None => std::task::Poll::Ready(None),
5665        }
5666    }
5667}
5668
5669#[derive(Debug)]
5670pub enum RealmEvent {}
5671
5672impl RealmEvent {
5673    /// Decodes a message buffer as a [`RealmEvent`].
5674    fn decode(
5675        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5676    ) -> Result<RealmEvent, fidl::Error> {
5677        let (bytes, _handles) = buf.split_mut();
5678        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5679        debug_assert_eq!(tx_header.tx_id, 0);
5680        match tx_header.ordinal {
5681            _ => Err(fidl::Error::UnknownOrdinal {
5682                ordinal: tx_header.ordinal,
5683                protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5684            }),
5685        }
5686    }
5687}
5688
5689/// A Stream of incoming requests for fuchsia.component/Realm.
5690pub struct RealmRequestStream {
5691    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5692    is_terminated: bool,
5693}
5694
5695impl std::marker::Unpin for RealmRequestStream {}
5696
5697impl futures::stream::FusedStream for RealmRequestStream {
5698    fn is_terminated(&self) -> bool {
5699        self.is_terminated
5700    }
5701}
5702
5703impl fidl::endpoints::RequestStream for RealmRequestStream {
5704    type Protocol = RealmMarker;
5705    type ControlHandle = RealmControlHandle;
5706
5707    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5708        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5709    }
5710
5711    fn control_handle(&self) -> Self::ControlHandle {
5712        RealmControlHandle { inner: self.inner.clone() }
5713    }
5714
5715    fn into_inner(
5716        self,
5717    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5718    {
5719        (self.inner, self.is_terminated)
5720    }
5721
5722    fn from_inner(
5723        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5724        is_terminated: bool,
5725    ) -> Self {
5726        Self { inner, is_terminated }
5727    }
5728}
5729
5730impl futures::Stream for RealmRequestStream {
5731    type Item = Result<RealmRequest, fidl::Error>;
5732
5733    fn poll_next(
5734        mut self: std::pin::Pin<&mut Self>,
5735        cx: &mut std::task::Context<'_>,
5736    ) -> std::task::Poll<Option<Self::Item>> {
5737        let this = &mut *self;
5738        if this.inner.check_shutdown(cx) {
5739            this.is_terminated = true;
5740            return std::task::Poll::Ready(None);
5741        }
5742        if this.is_terminated {
5743            panic!("polled RealmRequestStream after completion");
5744        }
5745        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5746            |bytes, handles| {
5747                match this.inner.channel().read_etc(cx, bytes, handles) {
5748                    std::task::Poll::Ready(Ok(())) => {}
5749                    std::task::Poll::Pending => return std::task::Poll::Pending,
5750                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5751                        this.is_terminated = true;
5752                        return std::task::Poll::Ready(None);
5753                    }
5754                    std::task::Poll::Ready(Err(e)) => {
5755                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5756                            e.into(),
5757                        ))));
5758                    }
5759                }
5760
5761                // A message has been received from the channel
5762                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5763
5764                std::task::Poll::Ready(Some(match header.ordinal {
5765                    0x7150b7898d1b1180 => {
5766                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5767                        let mut req = fidl::new_empty!(
5768                            RealmOpenControllerRequest,
5769                            fidl::encoding::DefaultFuchsiaResourceDialect
5770                        );
5771                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmOpenControllerRequest>(&header, _body_bytes, handles, &mut req)?;
5772                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5773                        Ok(RealmRequest::OpenController {
5774                            child: req.child,
5775                            controller: req.controller,
5776
5777                            responder: RealmOpenControllerResponder {
5778                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5779                                tx_id: header.tx_id,
5780                            },
5781                        })
5782                    }
5783                    0x7f993235ca59f92c => {
5784                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5785                        let mut req = fidl::new_empty!(
5786                            RealmOpenExposedDirRequest,
5787                            fidl::encoding::DefaultFuchsiaResourceDialect
5788                        );
5789                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmOpenExposedDirRequest>(&header, _body_bytes, handles, &mut req)?;
5790                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5791                        Ok(RealmRequest::OpenExposedDir {
5792                            child: req.child,
5793                            exposed_dir: req.exposed_dir,
5794
5795                            responder: RealmOpenExposedDirResponder {
5796                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5797                                tx_id: header.tx_id,
5798                            },
5799                        })
5800                    }
5801                    0x43e48ce8483d7560 => {
5802                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5803                        let mut req = fidl::new_empty!(
5804                            RealmCreateChildRequest,
5805                            fidl::encoding::DefaultFuchsiaResourceDialect
5806                        );
5807                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmCreateChildRequest>(&header, _body_bytes, handles, &mut req)?;
5808                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5809                        Ok(RealmRequest::CreateChild {
5810                            collection: req.collection,
5811                            decl: req.decl,
5812                            args: req.args,
5813
5814                            responder: RealmCreateChildResponder {
5815                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5816                                tx_id: header.tx_id,
5817                            },
5818                        })
5819                    }
5820                    0x71d8caf8850c9222 => {
5821                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5822                        let mut req = fidl::new_empty!(
5823                            RealmDestroyChildRequest,
5824                            fidl::encoding::DefaultFuchsiaResourceDialect
5825                        );
5826                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmDestroyChildRequest>(&header, _body_bytes, handles, &mut req)?;
5827                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5828                        Ok(RealmRequest::DestroyChild {
5829                            child: req.child,
5830
5831                            responder: RealmDestroyChildResponder {
5832                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5833                                tx_id: header.tx_id,
5834                            },
5835                        })
5836                    }
5837                    0x6888a76683efc0a1 => {
5838                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5839                        let mut req = fidl::new_empty!(
5840                            RealmListChildrenRequest,
5841                            fidl::encoding::DefaultFuchsiaResourceDialect
5842                        );
5843                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmListChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
5844                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5845                        Ok(RealmRequest::ListChildren {
5846                            collection: req.collection,
5847                            iter: req.iter,
5848
5849                            responder: RealmListChildrenResponder {
5850                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5851                                tx_id: header.tx_id,
5852                            },
5853                        })
5854                    }
5855                    0x734f744cb7d210a2 => {
5856                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5857                        let mut req = fidl::new_empty!(
5858                            fidl::encoding::EmptyPayload,
5859                            fidl::encoding::DefaultFuchsiaResourceDialect
5860                        );
5861                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5862                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5863                        Ok(RealmRequest::GetResolvedInfo {
5864                            responder: RealmGetResolvedInfoResponder {
5865                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5866                                tx_id: header.tx_id,
5867                            },
5868                        })
5869                    }
5870                    0x39245b02aba94364 => {
5871                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5872                        let mut req = fidl::new_empty!(
5873                            RealmGetChildOutputDictionaryDeprecatedRequest,
5874                            fidl::encoding::DefaultFuchsiaResourceDialect
5875                        );
5876                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmGetChildOutputDictionaryDeprecatedRequest>(&header, _body_bytes, handles, &mut req)?;
5877                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5878                        Ok(RealmRequest::GetChildOutputDictionaryDeprecated {
5879                            child: req.child,
5880
5881                            responder: RealmGetChildOutputDictionaryDeprecatedResponder {
5882                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5883                                tx_id: header.tx_id,
5884                            },
5885                        })
5886                    }
5887                    0x4259d08d261d5610 => {
5888                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5889                        let mut req = fidl::new_empty!(
5890                            RealmGetChildOutputDictionaryRequest,
5891                            fidl::encoding::DefaultFuchsiaResourceDialect
5892                        );
5893                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmGetChildOutputDictionaryRequest>(&header, _body_bytes, handles, &mut req)?;
5894                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5895                        Ok(RealmRequest::GetChildOutputDictionary {
5896                            child: req.child,
5897
5898                            responder: RealmGetChildOutputDictionaryResponder {
5899                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5900                                tx_id: header.tx_id,
5901                            },
5902                        })
5903                    }
5904                    _ => Err(fidl::Error::UnknownOrdinal {
5905                        ordinal: header.ordinal,
5906                        protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5907                    }),
5908                }))
5909            },
5910        )
5911    }
5912}
5913
5914/// A protocol used by a component instance to manage its own realm, such as for
5915/// binding to its children.
5916///
5917/// Requests to this protocol are processed in the order they are received.
5918/// Clients that wish to send requests in parallel should open multiple
5919/// connections.
5920///
5921/// The component framework provides this service to components that use
5922/// `fuchsia.component.Realm`.
5923#[derive(Debug)]
5924pub enum RealmRequest {
5925    /// Operate on a child component. See documentation for [`Controller`].
5926    ///
5927    /// Errors:
5928    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5929    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5930    /// - `INSTANCE_DIED`: This realm no longer exists.
5931    OpenController {
5932        child: fidl_fuchsia_component_decl::ChildRef,
5933        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5934        responder: RealmOpenControllerResponder,
5935    },
5936    /// Opens the exposed directory of a child component. When this function
5937    /// successfully returns, `exposed_dir` is bound to a directory that
5938    /// contains the capabilities which the child exposed to its realm via
5939    /// `ComponentDecl.exposes` (specified via "expose" declarations in the
5940    /// component's manifest). The child component will not start as a result of
5941    /// this call.
5942    ///
5943    /// `exposed_dir` is open as long as `child` exists.
5944    ///
5945    /// Errors:
5946    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5947    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5948    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
5949    /// - `INSTANCE_DIED`: This realm no longer exists.
5950    OpenExposedDir {
5951        child: fidl_fuchsia_component_decl::ChildRef,
5952        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5953        responder: RealmOpenExposedDirResponder,
5954    },
5955    /// Creates a child component instance dynamically. When this function
5956    /// returns successfully, the instance exists, but it may not be running.
5957    ///
5958    /// The environment of the child instance is determined by the environment
5959    /// of the collection. `decl` must not set `environment`.
5960    ///
5961    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
5962    /// [CreateChild] will start the component and return once the component is
5963    /// started. Otherwise, [CreateChild] will return immediately after creating
5964    /// the component and will not start or resolve it.
5965    ///
5966    /// Errors:
5967    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
5968    ///   is not a valid declaration.
5969    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5970    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
5971    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
5972    ///   in a `SingleRun` collection.
5973    /// - `NO_SPACE`: Could not allocate storage for the new instance.
5974    /// - `INSTANCE_DIED`: This realm no longer exists.
5975    CreateChild {
5976        collection: fidl_fuchsia_component_decl::CollectionRef,
5977        decl: fidl_fuchsia_component_decl::Child,
5978        args: CreateChildArgs,
5979        responder: RealmCreateChildResponder,
5980    },
5981    /// Destroys a dynamically-created component instance. When this function
5982    /// returns, the instance is destroyed and has stopped running.  However,
5983    /// cleanup of the component's resources (such as its isolated storage) may
5984    /// happen in the background after this function returns.
5985    ///
5986    /// Errors:
5987    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
5988    ///   to a dynamic instance.
5989    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5990    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5991    /// - `INSTANCE_DIED`: This realm no longer exists.
5992    DestroyChild {
5993        child: fidl_fuchsia_component_decl::ChildRef,
5994        responder: RealmDestroyChildResponder,
5995    },
5996    /// Returns an iterator that lists all instances in a collection.
5997    ///
5998    /// NOTE: The results are not guaranteed to be consistent. Instances may be
5999    /// created or destroyed while the iterator is live, but those changes
6000    /// won't be observed by the iterator after this method returns.
6001    ///
6002    /// Errors:
6003    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
6004    /// does not have `ZX_RIGHT_WAIT`.
6005    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
6006    /// - `INSTANCE_DIED`: This realm no longer exists.
6007    /// - If `iter` does not have standard channel rights, this function may
6008    ///   return `ACCESS_DENIED` or component manager may close `iter`.
6009    ListChildren {
6010        collection: fidl_fuchsia_component_decl::CollectionRef,
6011        iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
6012        responder: RealmListChildrenResponder,
6013    },
6014    /// Returns the set of information that was given to the component framework
6015    /// by this component's resolver.
6016    GetResolvedInfo { responder: RealmGetResolvedInfoResponder },
6017    GetChildOutputDictionaryDeprecated {
6018        child: fidl_fuchsia_component_decl::ChildRef,
6019        responder: RealmGetChildOutputDictionaryDeprecatedResponder,
6020    },
6021    /// Returns a reference to a child's output dictionary, which may be
6022    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
6023    GetChildOutputDictionary {
6024        child: fidl_fuchsia_component_decl::ChildRef,
6025        responder: RealmGetChildOutputDictionaryResponder,
6026    },
6027}
6028
6029impl RealmRequest {
6030    #[allow(irrefutable_let_patterns)]
6031    pub fn into_open_controller(
6032        self,
6033    ) -> Option<(
6034        fidl_fuchsia_component_decl::ChildRef,
6035        fidl::endpoints::ServerEnd<ControllerMarker>,
6036        RealmOpenControllerResponder,
6037    )> {
6038        if let RealmRequest::OpenController { child, controller, responder } = self {
6039            Some((child, controller, responder))
6040        } else {
6041            None
6042        }
6043    }
6044
6045    #[allow(irrefutable_let_patterns)]
6046    pub fn into_open_exposed_dir(
6047        self,
6048    ) -> Option<(
6049        fidl_fuchsia_component_decl::ChildRef,
6050        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6051        RealmOpenExposedDirResponder,
6052    )> {
6053        if let RealmRequest::OpenExposedDir { child, exposed_dir, responder } = self {
6054            Some((child, exposed_dir, responder))
6055        } else {
6056            None
6057        }
6058    }
6059
6060    #[allow(irrefutable_let_patterns)]
6061    pub fn into_create_child(
6062        self,
6063    ) -> Option<(
6064        fidl_fuchsia_component_decl::CollectionRef,
6065        fidl_fuchsia_component_decl::Child,
6066        CreateChildArgs,
6067        RealmCreateChildResponder,
6068    )> {
6069        if let RealmRequest::CreateChild { collection, decl, args, responder } = self {
6070            Some((collection, decl, args, responder))
6071        } else {
6072            None
6073        }
6074    }
6075
6076    #[allow(irrefutable_let_patterns)]
6077    pub fn into_destroy_child(
6078        self,
6079    ) -> Option<(fidl_fuchsia_component_decl::ChildRef, RealmDestroyChildResponder)> {
6080        if let RealmRequest::DestroyChild { child, responder } = self {
6081            Some((child, responder))
6082        } else {
6083            None
6084        }
6085    }
6086
6087    #[allow(irrefutable_let_patterns)]
6088    pub fn into_list_children(
6089        self,
6090    ) -> Option<(
6091        fidl_fuchsia_component_decl::CollectionRef,
6092        fidl::endpoints::ServerEnd<ChildIteratorMarker>,
6093        RealmListChildrenResponder,
6094    )> {
6095        if let RealmRequest::ListChildren { collection, iter, responder } = self {
6096            Some((collection, iter, responder))
6097        } else {
6098            None
6099        }
6100    }
6101
6102    #[allow(irrefutable_let_patterns)]
6103    pub fn into_get_resolved_info(self) -> Option<(RealmGetResolvedInfoResponder)> {
6104        if let RealmRequest::GetResolvedInfo { responder } = self {
6105            Some((responder))
6106        } else {
6107            None
6108        }
6109    }
6110
6111    #[allow(irrefutable_let_patterns)]
6112    pub fn into_get_child_output_dictionary_deprecated(
6113        self,
6114    ) -> Option<(
6115        fidl_fuchsia_component_decl::ChildRef,
6116        RealmGetChildOutputDictionaryDeprecatedResponder,
6117    )> {
6118        if let RealmRequest::GetChildOutputDictionaryDeprecated { child, responder } = self {
6119            Some((child, responder))
6120        } else {
6121            None
6122        }
6123    }
6124
6125    #[allow(irrefutable_let_patterns)]
6126    pub fn into_get_child_output_dictionary(
6127        self,
6128    ) -> Option<(fidl_fuchsia_component_decl::ChildRef, RealmGetChildOutputDictionaryResponder)>
6129    {
6130        if let RealmRequest::GetChildOutputDictionary { child, responder } = self {
6131            Some((child, responder))
6132        } else {
6133            None
6134        }
6135    }
6136
6137    /// Name of the method defined in FIDL
6138    pub fn method_name(&self) -> &'static str {
6139        match *self {
6140            RealmRequest::OpenController { .. } => "open_controller",
6141            RealmRequest::OpenExposedDir { .. } => "open_exposed_dir",
6142            RealmRequest::CreateChild { .. } => "create_child",
6143            RealmRequest::DestroyChild { .. } => "destroy_child",
6144            RealmRequest::ListChildren { .. } => "list_children",
6145            RealmRequest::GetResolvedInfo { .. } => "get_resolved_info",
6146            RealmRequest::GetChildOutputDictionaryDeprecated { .. } => {
6147                "get_child_output_dictionary_deprecated"
6148            }
6149            RealmRequest::GetChildOutputDictionary { .. } => "get_child_output_dictionary",
6150        }
6151    }
6152}
6153
6154#[derive(Debug, Clone)]
6155pub struct RealmControlHandle {
6156    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6157}
6158
6159impl fidl::endpoints::ControlHandle for RealmControlHandle {
6160    fn shutdown(&self) {
6161        self.inner.shutdown()
6162    }
6163
6164    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6165        self.inner.shutdown_with_epitaph(status)
6166    }
6167
6168    fn is_closed(&self) -> bool {
6169        self.inner.channel().is_closed()
6170    }
6171    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6172        self.inner.channel().on_closed()
6173    }
6174
6175    #[cfg(target_os = "fuchsia")]
6176    fn signal_peer(
6177        &self,
6178        clear_mask: zx::Signals,
6179        set_mask: zx::Signals,
6180    ) -> Result<(), zx_status::Status> {
6181        use fidl::Peered;
6182        self.inner.channel().signal_peer(clear_mask, set_mask)
6183    }
6184}
6185
6186impl RealmControlHandle {}
6187
6188#[must_use = "FIDL methods require a response to be sent"]
6189#[derive(Debug)]
6190pub struct RealmOpenControllerResponder {
6191    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6192    tx_id: u32,
6193}
6194
6195/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6196/// if the responder is dropped without sending a response, so that the client
6197/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6198impl std::ops::Drop for RealmOpenControllerResponder {
6199    fn drop(&mut self) {
6200        self.control_handle.shutdown();
6201        // Safety: drops once, never accessed again
6202        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6203    }
6204}
6205
6206impl fidl::endpoints::Responder for RealmOpenControllerResponder {
6207    type ControlHandle = RealmControlHandle;
6208
6209    fn control_handle(&self) -> &RealmControlHandle {
6210        &self.control_handle
6211    }
6212
6213    fn drop_without_shutdown(mut self) {
6214        // Safety: drops once, never accessed again due to mem::forget
6215        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6216        // Prevent Drop from running (which would shut down the channel)
6217        std::mem::forget(self);
6218    }
6219}
6220
6221impl RealmOpenControllerResponder {
6222    /// Sends a response to the FIDL transaction.
6223    ///
6224    /// Sets the channel to shutdown if an error occurs.
6225    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6226        let _result = self.send_raw(result);
6227        if _result.is_err() {
6228            self.control_handle.shutdown();
6229        }
6230        self.drop_without_shutdown();
6231        _result
6232    }
6233
6234    /// Similar to "send" but does not shutdown the channel if an error occurs.
6235    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6236        let _result = self.send_raw(result);
6237        self.drop_without_shutdown();
6238        _result
6239    }
6240
6241    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6242        self.control_handle
6243            .inner
6244            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6245                result,
6246                self.tx_id,
6247                0x7150b7898d1b1180,
6248                fidl::encoding::DynamicFlags::empty(),
6249            )
6250    }
6251}
6252
6253#[must_use = "FIDL methods require a response to be sent"]
6254#[derive(Debug)]
6255pub struct RealmOpenExposedDirResponder {
6256    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6257    tx_id: u32,
6258}
6259
6260/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6261/// if the responder is dropped without sending a response, so that the client
6262/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6263impl std::ops::Drop for RealmOpenExposedDirResponder {
6264    fn drop(&mut self) {
6265        self.control_handle.shutdown();
6266        // Safety: drops once, never accessed again
6267        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6268    }
6269}
6270
6271impl fidl::endpoints::Responder for RealmOpenExposedDirResponder {
6272    type ControlHandle = RealmControlHandle;
6273
6274    fn control_handle(&self) -> &RealmControlHandle {
6275        &self.control_handle
6276    }
6277
6278    fn drop_without_shutdown(mut self) {
6279        // Safety: drops once, never accessed again due to mem::forget
6280        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6281        // Prevent Drop from running (which would shut down the channel)
6282        std::mem::forget(self);
6283    }
6284}
6285
6286impl RealmOpenExposedDirResponder {
6287    /// Sends a response to the FIDL transaction.
6288    ///
6289    /// Sets the channel to shutdown if an error occurs.
6290    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6291        let _result = self.send_raw(result);
6292        if _result.is_err() {
6293            self.control_handle.shutdown();
6294        }
6295        self.drop_without_shutdown();
6296        _result
6297    }
6298
6299    /// Similar to "send" but does not shutdown the channel if an error occurs.
6300    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6301        let _result = self.send_raw(result);
6302        self.drop_without_shutdown();
6303        _result
6304    }
6305
6306    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6307        self.control_handle
6308            .inner
6309            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6310                result,
6311                self.tx_id,
6312                0x7f993235ca59f92c,
6313                fidl::encoding::DynamicFlags::empty(),
6314            )
6315    }
6316}
6317
6318#[must_use = "FIDL methods require a response to be sent"]
6319#[derive(Debug)]
6320pub struct RealmCreateChildResponder {
6321    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6322    tx_id: u32,
6323}
6324
6325/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6326/// if the responder is dropped without sending a response, so that the client
6327/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6328impl std::ops::Drop for RealmCreateChildResponder {
6329    fn drop(&mut self) {
6330        self.control_handle.shutdown();
6331        // Safety: drops once, never accessed again
6332        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6333    }
6334}
6335
6336impl fidl::endpoints::Responder for RealmCreateChildResponder {
6337    type ControlHandle = RealmControlHandle;
6338
6339    fn control_handle(&self) -> &RealmControlHandle {
6340        &self.control_handle
6341    }
6342
6343    fn drop_without_shutdown(mut self) {
6344        // Safety: drops once, never accessed again due to mem::forget
6345        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6346        // Prevent Drop from running (which would shut down the channel)
6347        std::mem::forget(self);
6348    }
6349}
6350
6351impl RealmCreateChildResponder {
6352    /// Sends a response to the FIDL transaction.
6353    ///
6354    /// Sets the channel to shutdown if an error occurs.
6355    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6356        let _result = self.send_raw(result);
6357        if _result.is_err() {
6358            self.control_handle.shutdown();
6359        }
6360        self.drop_without_shutdown();
6361        _result
6362    }
6363
6364    /// Similar to "send" but does not shutdown the channel if an error occurs.
6365    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6366        let _result = self.send_raw(result);
6367        self.drop_without_shutdown();
6368        _result
6369    }
6370
6371    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6372        self.control_handle
6373            .inner
6374            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6375                result,
6376                self.tx_id,
6377                0x43e48ce8483d7560,
6378                fidl::encoding::DynamicFlags::empty(),
6379            )
6380    }
6381}
6382
6383#[must_use = "FIDL methods require a response to be sent"]
6384#[derive(Debug)]
6385pub struct RealmDestroyChildResponder {
6386    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6387    tx_id: u32,
6388}
6389
6390/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6391/// if the responder is dropped without sending a response, so that the client
6392/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6393impl std::ops::Drop for RealmDestroyChildResponder {
6394    fn drop(&mut self) {
6395        self.control_handle.shutdown();
6396        // Safety: drops once, never accessed again
6397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6398    }
6399}
6400
6401impl fidl::endpoints::Responder for RealmDestroyChildResponder {
6402    type ControlHandle = RealmControlHandle;
6403
6404    fn control_handle(&self) -> &RealmControlHandle {
6405        &self.control_handle
6406    }
6407
6408    fn drop_without_shutdown(mut self) {
6409        // Safety: drops once, never accessed again due to mem::forget
6410        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6411        // Prevent Drop from running (which would shut down the channel)
6412        std::mem::forget(self);
6413    }
6414}
6415
6416impl RealmDestroyChildResponder {
6417    /// Sends a response to the FIDL transaction.
6418    ///
6419    /// Sets the channel to shutdown if an error occurs.
6420    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6421        let _result = self.send_raw(result);
6422        if _result.is_err() {
6423            self.control_handle.shutdown();
6424        }
6425        self.drop_without_shutdown();
6426        _result
6427    }
6428
6429    /// Similar to "send" but does not shutdown the channel if an error occurs.
6430    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6431        let _result = self.send_raw(result);
6432        self.drop_without_shutdown();
6433        _result
6434    }
6435
6436    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6437        self.control_handle
6438            .inner
6439            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6440                result,
6441                self.tx_id,
6442                0x71d8caf8850c9222,
6443                fidl::encoding::DynamicFlags::empty(),
6444            )
6445    }
6446}
6447
6448#[must_use = "FIDL methods require a response to be sent"]
6449#[derive(Debug)]
6450pub struct RealmListChildrenResponder {
6451    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6452    tx_id: u32,
6453}
6454
6455/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6456/// if the responder is dropped without sending a response, so that the client
6457/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6458impl std::ops::Drop for RealmListChildrenResponder {
6459    fn drop(&mut self) {
6460        self.control_handle.shutdown();
6461        // Safety: drops once, never accessed again
6462        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6463    }
6464}
6465
6466impl fidl::endpoints::Responder for RealmListChildrenResponder {
6467    type ControlHandle = RealmControlHandle;
6468
6469    fn control_handle(&self) -> &RealmControlHandle {
6470        &self.control_handle
6471    }
6472
6473    fn drop_without_shutdown(mut self) {
6474        // Safety: drops once, never accessed again due to mem::forget
6475        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6476        // Prevent Drop from running (which would shut down the channel)
6477        std::mem::forget(self);
6478    }
6479}
6480
6481impl RealmListChildrenResponder {
6482    /// Sends a response to the FIDL transaction.
6483    ///
6484    /// Sets the channel to shutdown if an error occurs.
6485    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6486        let _result = self.send_raw(result);
6487        if _result.is_err() {
6488            self.control_handle.shutdown();
6489        }
6490        self.drop_without_shutdown();
6491        _result
6492    }
6493
6494    /// Similar to "send" but does not shutdown the channel if an error occurs.
6495    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6496        let _result = self.send_raw(result);
6497        self.drop_without_shutdown();
6498        _result
6499    }
6500
6501    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6502        self.control_handle
6503            .inner
6504            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6505                result,
6506                self.tx_id,
6507                0x6888a76683efc0a1,
6508                fidl::encoding::DynamicFlags::empty(),
6509            )
6510    }
6511}
6512
6513#[must_use = "FIDL methods require a response to be sent"]
6514#[derive(Debug)]
6515pub struct RealmGetResolvedInfoResponder {
6516    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6517    tx_id: u32,
6518}
6519
6520/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6521/// if the responder is dropped without sending a response, so that the client
6522/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6523impl std::ops::Drop for RealmGetResolvedInfoResponder {
6524    fn drop(&mut self) {
6525        self.control_handle.shutdown();
6526        // Safety: drops once, never accessed again
6527        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6528    }
6529}
6530
6531impl fidl::endpoints::Responder for RealmGetResolvedInfoResponder {
6532    type ControlHandle = RealmControlHandle;
6533
6534    fn control_handle(&self) -> &RealmControlHandle {
6535        &self.control_handle
6536    }
6537
6538    fn drop_without_shutdown(mut self) {
6539        // Safety: drops once, never accessed again due to mem::forget
6540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6541        // Prevent Drop from running (which would shut down the channel)
6542        std::mem::forget(self);
6543    }
6544}
6545
6546impl RealmGetResolvedInfoResponder {
6547    /// Sends a response to the FIDL transaction.
6548    ///
6549    /// Sets the channel to shutdown if an error occurs.
6550    pub fn send(
6551        self,
6552        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
6553    ) -> Result<(), fidl::Error> {
6554        let _result = self.send_raw(result);
6555        if _result.is_err() {
6556            self.control_handle.shutdown();
6557        }
6558        self.drop_without_shutdown();
6559        _result
6560    }
6561
6562    /// Similar to "send" but does not shutdown the channel if an error occurs.
6563    pub fn send_no_shutdown_on_err(
6564        self,
6565        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
6566    ) -> Result<(), fidl::Error> {
6567        let _result = self.send_raw(result);
6568        self.drop_without_shutdown();
6569        _result
6570    }
6571
6572    fn send_raw(
6573        &self,
6574        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
6575    ) -> Result<(), fidl::Error> {
6576        self.control_handle
6577            .inner
6578            .send::<fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>>(
6579                result.as_mut().map_err(|e| *e).map(|resolved_info| (resolved_info,)),
6580                self.tx_id,
6581                0x734f744cb7d210a2,
6582                fidl::encoding::DynamicFlags::empty(),
6583            )
6584    }
6585}
6586
6587#[must_use = "FIDL methods require a response to be sent"]
6588#[derive(Debug)]
6589pub struct RealmGetChildOutputDictionaryDeprecatedResponder {
6590    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6591    tx_id: u32,
6592}
6593
6594/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6595/// if the responder is dropped without sending a response, so that the client
6596/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6597impl std::ops::Drop for RealmGetChildOutputDictionaryDeprecatedResponder {
6598    fn drop(&mut self) {
6599        self.control_handle.shutdown();
6600        // Safety: drops once, never accessed again
6601        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6602    }
6603}
6604
6605impl fidl::endpoints::Responder for RealmGetChildOutputDictionaryDeprecatedResponder {
6606    type ControlHandle = RealmControlHandle;
6607
6608    fn control_handle(&self) -> &RealmControlHandle {
6609        &self.control_handle
6610    }
6611
6612    fn drop_without_shutdown(mut self) {
6613        // Safety: drops once, never accessed again due to mem::forget
6614        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6615        // Prevent Drop from running (which would shut down the channel)
6616        std::mem::forget(self);
6617    }
6618}
6619
6620impl RealmGetChildOutputDictionaryDeprecatedResponder {
6621    /// Sends a response to the FIDL transaction.
6622    ///
6623    /// Sets the channel to shutdown if an error occurs.
6624    pub fn send(
6625        self,
6626        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
6627    ) -> Result<(), fidl::Error> {
6628        let _result = self.send_raw(result);
6629        if _result.is_err() {
6630            self.control_handle.shutdown();
6631        }
6632        self.drop_without_shutdown();
6633        _result
6634    }
6635
6636    /// Similar to "send" but does not shutdown the channel if an error occurs.
6637    pub fn send_no_shutdown_on_err(
6638        self,
6639        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
6640    ) -> Result<(), fidl::Error> {
6641        let _result = self.send_raw(result);
6642        self.drop_without_shutdown();
6643        _result
6644    }
6645
6646    fn send_raw(
6647        &self,
6648        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
6649    ) -> Result<(), fidl::Error> {
6650        self.control_handle.inner.send::<fidl::encoding::ResultType<
6651            RealmGetChildOutputDictionaryDeprecatedResponse,
6652            Error,
6653        >>(
6654            result.as_mut().map_err(|e| *e).map(|dictionary| (dictionary,)),
6655            self.tx_id,
6656            0x39245b02aba94364,
6657            fidl::encoding::DynamicFlags::empty(),
6658        )
6659    }
6660}
6661
6662#[must_use = "FIDL methods require a response to be sent"]
6663#[derive(Debug)]
6664pub struct RealmGetChildOutputDictionaryResponder {
6665    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6666    tx_id: u32,
6667}
6668
6669/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6670/// if the responder is dropped without sending a response, so that the client
6671/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6672impl std::ops::Drop for RealmGetChildOutputDictionaryResponder {
6673    fn drop(&mut self) {
6674        self.control_handle.shutdown();
6675        // Safety: drops once, never accessed again
6676        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6677    }
6678}
6679
6680impl fidl::endpoints::Responder for RealmGetChildOutputDictionaryResponder {
6681    type ControlHandle = RealmControlHandle;
6682
6683    fn control_handle(&self) -> &RealmControlHandle {
6684        &self.control_handle
6685    }
6686
6687    fn drop_without_shutdown(mut self) {
6688        // Safety: drops once, never accessed again due to mem::forget
6689        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6690        // Prevent Drop from running (which would shut down the channel)
6691        std::mem::forget(self);
6692    }
6693}
6694
6695impl RealmGetChildOutputDictionaryResponder {
6696    /// Sends a response to the FIDL transaction.
6697    ///
6698    /// Sets the channel to shutdown if an error occurs.
6699    pub fn send(self, mut result: Result<fidl::EventPair, Error>) -> Result<(), fidl::Error> {
6700        let _result = self.send_raw(result);
6701        if _result.is_err() {
6702            self.control_handle.shutdown();
6703        }
6704        self.drop_without_shutdown();
6705        _result
6706    }
6707
6708    /// Similar to "send" but does not shutdown the channel if an error occurs.
6709    pub fn send_no_shutdown_on_err(
6710        self,
6711        mut result: Result<fidl::EventPair, Error>,
6712    ) -> Result<(), fidl::Error> {
6713        let _result = self.send_raw(result);
6714        self.drop_without_shutdown();
6715        _result
6716    }
6717
6718    fn send_raw(&self, mut result: Result<fidl::EventPair, Error>) -> Result<(), fidl::Error> {
6719        self.control_handle.inner.send::<fidl::encoding::ResultType<
6720            RealmGetChildOutputDictionaryResponse,
6721            Error,
6722        >>(
6723            result.map(|dictionary| (dictionary,)),
6724            self.tx_id,
6725            0x4259d08d261d5610,
6726            fidl::encoding::DynamicFlags::empty(),
6727        )
6728    }
6729}
6730
6731#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6732pub struct StorageAdminMarker;
6733
6734impl fidl::endpoints::ProtocolMarker for StorageAdminMarker {
6735    type Proxy = StorageAdminProxy;
6736    type RequestStream = StorageAdminRequestStream;
6737    #[cfg(target_os = "fuchsia")]
6738    type SynchronousProxy = StorageAdminSynchronousProxy;
6739
6740    const DEBUG_NAME: &'static str = "fuchsia.component.StorageAdmin";
6741}
6742impl fidl::endpoints::DiscoverableProtocolMarker for StorageAdminMarker {}
6743pub type StorageAdminOpenStorageResult = Result<(), Error>;
6744pub type StorageAdminListStorageInRealmResult = Result<(), Error>;
6745pub type StorageAdminOpenComponentStorageByIdResult = Result<(), Error>;
6746pub type StorageAdminDeleteComponentStorageResult = Result<(), Error>;
6747pub type StorageAdminGetStatusResult = Result<StorageStatus, StatusError>;
6748pub type StorageAdminDeleteAllStorageContentsResult = Result<(), DeletionError>;
6749
6750pub trait StorageAdminProxyInterface: Send + Sync {
6751    type OpenStorageResponseFut: std::future::Future<Output = Result<StorageAdminOpenStorageResult, fidl::Error>>
6752        + Send;
6753    fn r#open_storage(
6754        &self,
6755        relative_moniker: &str,
6756        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6757    ) -> Self::OpenStorageResponseFut;
6758    type ListStorageInRealmResponseFut: std::future::Future<Output = Result<StorageAdminListStorageInRealmResult, fidl::Error>>
6759        + Send;
6760    fn r#list_storage_in_realm(
6761        &self,
6762        relative_moniker: &str,
6763        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6764    ) -> Self::ListStorageInRealmResponseFut;
6765    type OpenComponentStorageByIdResponseFut: std::future::Future<
6766            Output = Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error>,
6767        > + Send;
6768    fn r#open_component_storage_by_id(
6769        &self,
6770        id: &str,
6771        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6772    ) -> Self::OpenComponentStorageByIdResponseFut;
6773    type DeleteComponentStorageResponseFut: std::future::Future<Output = Result<StorageAdminDeleteComponentStorageResult, fidl::Error>>
6774        + Send;
6775    fn r#delete_component_storage(
6776        &self,
6777        relative_moniker: &str,
6778    ) -> Self::DeleteComponentStorageResponseFut;
6779    type GetStatusResponseFut: std::future::Future<Output = Result<StorageAdminGetStatusResult, fidl::Error>>
6780        + Send;
6781    fn r#get_status(&self) -> Self::GetStatusResponseFut;
6782    type DeleteAllStorageContentsResponseFut: std::future::Future<
6783            Output = Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error>,
6784        > + Send;
6785    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut;
6786}
6787#[derive(Debug)]
6788#[cfg(target_os = "fuchsia")]
6789pub struct StorageAdminSynchronousProxy {
6790    client: fidl::client::sync::Client,
6791}
6792
6793#[cfg(target_os = "fuchsia")]
6794impl fidl::endpoints::SynchronousProxy for StorageAdminSynchronousProxy {
6795    type Proxy = StorageAdminProxy;
6796    type Protocol = StorageAdminMarker;
6797
6798    fn from_channel(inner: fidl::Channel) -> Self {
6799        Self::new(inner)
6800    }
6801
6802    fn into_channel(self) -> fidl::Channel {
6803        self.client.into_channel()
6804    }
6805
6806    fn as_channel(&self) -> &fidl::Channel {
6807        self.client.as_channel()
6808    }
6809}
6810
6811#[cfg(target_os = "fuchsia")]
6812impl StorageAdminSynchronousProxy {
6813    pub fn new(channel: fidl::Channel) -> Self {
6814        let protocol_name = <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6815        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6816    }
6817
6818    pub fn into_channel(self) -> fidl::Channel {
6819        self.client.into_channel()
6820    }
6821
6822    /// Waits until an event arrives and returns it. It is safe for other
6823    /// threads to make concurrent requests while waiting for an event.
6824    pub fn wait_for_event(
6825        &self,
6826        deadline: zx::MonotonicInstant,
6827    ) -> Result<StorageAdminEvent, fidl::Error> {
6828        StorageAdminEvent::decode(self.client.wait_for_event(deadline)?)
6829    }
6830
6831    /// Opens the isolated directory for the given component. The provided
6832    /// moniker is relative to the component that declares the storage
6833    /// capability. Creates the backing sub-directory for this storage if it
6834    /// hasn't yet been created.
6835    pub fn r#open_storage(
6836        &self,
6837        mut relative_moniker: &str,
6838        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6839        ___deadline: zx::MonotonicInstant,
6840    ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
6841        let _response = self.client.send_query::<
6842            StorageAdminOpenStorageRequest,
6843            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6844        >(
6845            (relative_moniker, object,),
6846            0x6ceaa5904cfe4377,
6847            fidl::encoding::DynamicFlags::empty(),
6848            ___deadline,
6849        )?;
6850        Ok(_response.map(|x| x))
6851    }
6852
6853    /// Lists the descendant components under the specified realm that use the
6854    /// storage capability. The provided moniker is relative to the component
6855    /// that declares the storage capability.
6856    ///
6857    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
6858    /// if |relative_moniker| is malformed.
6859    pub fn r#list_storage_in_realm(
6860        &self,
6861        mut relative_moniker: &str,
6862        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6863        ___deadline: zx::MonotonicInstant,
6864    ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
6865        let _response = self.client.send_query::<
6866            StorageAdminListStorageInRealmRequest,
6867            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6868        >(
6869            (relative_moniker, iterator,),
6870            0x764f6d1f083e8bfb,
6871            fidl::encoding::DynamicFlags::empty(),
6872            ___deadline,
6873        )?;
6874        Ok(_response.map(|x| x))
6875    }
6876
6877    /// Opens the isolated directory for the given storage ID. Creates the
6878    /// backing sub-directory for this storage if it hasn't yet been created.
6879    pub fn r#open_component_storage_by_id(
6880        &self,
6881        mut id: &str,
6882        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6883        ___deadline: zx::MonotonicInstant,
6884    ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
6885        let _response = self.client.send_query::<
6886            StorageAdminOpenComponentStorageByIdRequest,
6887            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6888        >(
6889            (id, object,),
6890            0x4802102cc55d5df1,
6891            fidl::encoding::DynamicFlags::empty(),
6892            ___deadline,
6893        )?;
6894        Ok(_response.map(|x| x))
6895    }
6896
6897    /// Deletes the contents of the storage for this component. Preserves the
6898    /// component's subdirectory itself within the storage backing directory.
6899    /// The provided moniker is relative to the component that declares the
6900    /// storage capability.
6901    pub fn r#delete_component_storage(
6902        &self,
6903        mut relative_moniker: &str,
6904        ___deadline: zx::MonotonicInstant,
6905    ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
6906        let _response = self.client.send_query::<
6907            StorageAdminDeleteComponentStorageRequest,
6908            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6909        >(
6910            (relative_moniker,),
6911            0x1677c1cdfcdbf45a,
6912            fidl::encoding::DynamicFlags::empty(),
6913            ___deadline,
6914        )?;
6915        Ok(_response.map(|x| x))
6916    }
6917
6918    /// Get the current status of the storage.
6919    pub fn r#get_status(
6920        &self,
6921        ___deadline: zx::MonotonicInstant,
6922    ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
6923        let _response = self.client.send_query::<
6924            fidl::encoding::EmptyPayload,
6925            fidl::encoding::ResultType<StorageStatus, StatusError>,
6926        >(
6927            (),
6928            0x7729e325a6c526c8,
6929            fidl::encoding::DynamicFlags::empty(),
6930            ___deadline,
6931        )?;
6932        Ok(_response.map(|x| x))
6933    }
6934
6935    /// Deletes the contents of all the storage. Storage directories are
6936    /// retained so any components using storage will be able to continue using
6937    /// it to create new files and directories.
6938    ///
6939    /// Returns Error::INTERNAL only if no storage at all could be cleared.
6940    /// Returns successfully even if some errors happen during the deletion
6941    /// progress.
6942    pub fn r#delete_all_storage_contents(
6943        &self,
6944        ___deadline: zx::MonotonicInstant,
6945    ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
6946        let _response = self.client.send_query::<
6947            fidl::encoding::EmptyPayload,
6948            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
6949        >(
6950            (),
6951            0x2ee980b4b2d24adb,
6952            fidl::encoding::DynamicFlags::empty(),
6953            ___deadline,
6954        )?;
6955        Ok(_response.map(|x| x))
6956    }
6957}
6958
6959#[cfg(target_os = "fuchsia")]
6960impl From<StorageAdminSynchronousProxy> for zx::NullableHandle {
6961    fn from(value: StorageAdminSynchronousProxy) -> Self {
6962        value.into_channel().into()
6963    }
6964}
6965
6966#[cfg(target_os = "fuchsia")]
6967impl From<fidl::Channel> for StorageAdminSynchronousProxy {
6968    fn from(value: fidl::Channel) -> Self {
6969        Self::new(value)
6970    }
6971}
6972
6973#[cfg(target_os = "fuchsia")]
6974impl fidl::endpoints::FromClient for StorageAdminSynchronousProxy {
6975    type Protocol = StorageAdminMarker;
6976
6977    fn from_client(value: fidl::endpoints::ClientEnd<StorageAdminMarker>) -> Self {
6978        Self::new(value.into_channel())
6979    }
6980}
6981
6982#[derive(Debug, Clone)]
6983pub struct StorageAdminProxy {
6984    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6985}
6986
6987impl fidl::endpoints::Proxy for StorageAdminProxy {
6988    type Protocol = StorageAdminMarker;
6989
6990    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6991        Self::new(inner)
6992    }
6993
6994    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6995        self.client.into_channel().map_err(|client| Self { client })
6996    }
6997
6998    fn as_channel(&self) -> &::fidl::AsyncChannel {
6999        self.client.as_channel()
7000    }
7001}
7002
7003impl StorageAdminProxy {
7004    /// Create a new Proxy for fuchsia.component/StorageAdmin.
7005    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7006        let protocol_name = <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7007        Self { client: fidl::client::Client::new(channel, protocol_name) }
7008    }
7009
7010    /// Get a Stream of events from the remote end of the protocol.
7011    ///
7012    /// # Panics
7013    ///
7014    /// Panics if the event stream was already taken.
7015    pub fn take_event_stream(&self) -> StorageAdminEventStream {
7016        StorageAdminEventStream { event_receiver: self.client.take_event_receiver() }
7017    }
7018
7019    /// Opens the isolated directory for the given component. The provided
7020    /// moniker is relative to the component that declares the storage
7021    /// capability. Creates the backing sub-directory for this storage if it
7022    /// hasn't yet been created.
7023    pub fn r#open_storage(
7024        &self,
7025        mut relative_moniker: &str,
7026        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7027    ) -> fidl::client::QueryResponseFut<
7028        StorageAdminOpenStorageResult,
7029        fidl::encoding::DefaultFuchsiaResourceDialect,
7030    > {
7031        StorageAdminProxyInterface::r#open_storage(self, relative_moniker, object)
7032    }
7033
7034    /// Lists the descendant components under the specified realm that use the
7035    /// storage capability. The provided moniker is relative to the component
7036    /// that declares the storage capability.
7037    ///
7038    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
7039    /// if |relative_moniker| is malformed.
7040    pub fn r#list_storage_in_realm(
7041        &self,
7042        mut relative_moniker: &str,
7043        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7044    ) -> fidl::client::QueryResponseFut<
7045        StorageAdminListStorageInRealmResult,
7046        fidl::encoding::DefaultFuchsiaResourceDialect,
7047    > {
7048        StorageAdminProxyInterface::r#list_storage_in_realm(self, relative_moniker, iterator)
7049    }
7050
7051    /// Opens the isolated directory for the given storage ID. Creates the
7052    /// backing sub-directory for this storage if it hasn't yet been created.
7053    pub fn r#open_component_storage_by_id(
7054        &self,
7055        mut id: &str,
7056        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7057    ) -> fidl::client::QueryResponseFut<
7058        StorageAdminOpenComponentStorageByIdResult,
7059        fidl::encoding::DefaultFuchsiaResourceDialect,
7060    > {
7061        StorageAdminProxyInterface::r#open_component_storage_by_id(self, id, object)
7062    }
7063
7064    /// Deletes the contents of the storage for this component. Preserves the
7065    /// component's subdirectory itself within the storage backing directory.
7066    /// The provided moniker is relative to the component that declares the
7067    /// storage capability.
7068    pub fn r#delete_component_storage(
7069        &self,
7070        mut relative_moniker: &str,
7071    ) -> fidl::client::QueryResponseFut<
7072        StorageAdminDeleteComponentStorageResult,
7073        fidl::encoding::DefaultFuchsiaResourceDialect,
7074    > {
7075        StorageAdminProxyInterface::r#delete_component_storage(self, relative_moniker)
7076    }
7077
7078    /// Get the current status of the storage.
7079    pub fn r#get_status(
7080        &self,
7081    ) -> fidl::client::QueryResponseFut<
7082        StorageAdminGetStatusResult,
7083        fidl::encoding::DefaultFuchsiaResourceDialect,
7084    > {
7085        StorageAdminProxyInterface::r#get_status(self)
7086    }
7087
7088    /// Deletes the contents of all the storage. Storage directories are
7089    /// retained so any components using storage will be able to continue using
7090    /// it to create new files and directories.
7091    ///
7092    /// Returns Error::INTERNAL only if no storage at all could be cleared.
7093    /// Returns successfully even if some errors happen during the deletion
7094    /// progress.
7095    pub fn r#delete_all_storage_contents(
7096        &self,
7097    ) -> fidl::client::QueryResponseFut<
7098        StorageAdminDeleteAllStorageContentsResult,
7099        fidl::encoding::DefaultFuchsiaResourceDialect,
7100    > {
7101        StorageAdminProxyInterface::r#delete_all_storage_contents(self)
7102    }
7103}
7104
7105impl StorageAdminProxyInterface for StorageAdminProxy {
7106    type OpenStorageResponseFut = fidl::client::QueryResponseFut<
7107        StorageAdminOpenStorageResult,
7108        fidl::encoding::DefaultFuchsiaResourceDialect,
7109    >;
7110    fn r#open_storage(
7111        &self,
7112        mut relative_moniker: &str,
7113        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7114    ) -> Self::OpenStorageResponseFut {
7115        fn _decode(
7116            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7117        ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
7118            let _response = fidl::client::decode_transaction_body::<
7119                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7120                fidl::encoding::DefaultFuchsiaResourceDialect,
7121                0x6ceaa5904cfe4377,
7122            >(_buf?)?;
7123            Ok(_response.map(|x| x))
7124        }
7125        self.client
7126            .send_query_and_decode::<StorageAdminOpenStorageRequest, StorageAdminOpenStorageResult>(
7127                (relative_moniker, object),
7128                0x6ceaa5904cfe4377,
7129                fidl::encoding::DynamicFlags::empty(),
7130                _decode,
7131            )
7132    }
7133
7134    type ListStorageInRealmResponseFut = fidl::client::QueryResponseFut<
7135        StorageAdminListStorageInRealmResult,
7136        fidl::encoding::DefaultFuchsiaResourceDialect,
7137    >;
7138    fn r#list_storage_in_realm(
7139        &self,
7140        mut relative_moniker: &str,
7141        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7142    ) -> Self::ListStorageInRealmResponseFut {
7143        fn _decode(
7144            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7145        ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
7146            let _response = fidl::client::decode_transaction_body::<
7147                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7148                fidl::encoding::DefaultFuchsiaResourceDialect,
7149                0x764f6d1f083e8bfb,
7150            >(_buf?)?;
7151            Ok(_response.map(|x| x))
7152        }
7153        self.client.send_query_and_decode::<
7154            StorageAdminListStorageInRealmRequest,
7155            StorageAdminListStorageInRealmResult,
7156        >(
7157            (relative_moniker, iterator,),
7158            0x764f6d1f083e8bfb,
7159            fidl::encoding::DynamicFlags::empty(),
7160            _decode,
7161        )
7162    }
7163
7164    type OpenComponentStorageByIdResponseFut = fidl::client::QueryResponseFut<
7165        StorageAdminOpenComponentStorageByIdResult,
7166        fidl::encoding::DefaultFuchsiaResourceDialect,
7167    >;
7168    fn r#open_component_storage_by_id(
7169        &self,
7170        mut id: &str,
7171        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7172    ) -> Self::OpenComponentStorageByIdResponseFut {
7173        fn _decode(
7174            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7175        ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
7176            let _response = fidl::client::decode_transaction_body::<
7177                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7178                fidl::encoding::DefaultFuchsiaResourceDialect,
7179                0x4802102cc55d5df1,
7180            >(_buf?)?;
7181            Ok(_response.map(|x| x))
7182        }
7183        self.client.send_query_and_decode::<
7184            StorageAdminOpenComponentStorageByIdRequest,
7185            StorageAdminOpenComponentStorageByIdResult,
7186        >(
7187            (id, object,),
7188            0x4802102cc55d5df1,
7189            fidl::encoding::DynamicFlags::empty(),
7190            _decode,
7191        )
7192    }
7193
7194    type DeleteComponentStorageResponseFut = fidl::client::QueryResponseFut<
7195        StorageAdminDeleteComponentStorageResult,
7196        fidl::encoding::DefaultFuchsiaResourceDialect,
7197    >;
7198    fn r#delete_component_storage(
7199        &self,
7200        mut relative_moniker: &str,
7201    ) -> Self::DeleteComponentStorageResponseFut {
7202        fn _decode(
7203            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7204        ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
7205            let _response = fidl::client::decode_transaction_body::<
7206                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7207                fidl::encoding::DefaultFuchsiaResourceDialect,
7208                0x1677c1cdfcdbf45a,
7209            >(_buf?)?;
7210            Ok(_response.map(|x| x))
7211        }
7212        self.client.send_query_and_decode::<
7213            StorageAdminDeleteComponentStorageRequest,
7214            StorageAdminDeleteComponentStorageResult,
7215        >(
7216            (relative_moniker,),
7217            0x1677c1cdfcdbf45a,
7218            fidl::encoding::DynamicFlags::empty(),
7219            _decode,
7220        )
7221    }
7222
7223    type GetStatusResponseFut = fidl::client::QueryResponseFut<
7224        StorageAdminGetStatusResult,
7225        fidl::encoding::DefaultFuchsiaResourceDialect,
7226    >;
7227    fn r#get_status(&self) -> Self::GetStatusResponseFut {
7228        fn _decode(
7229            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7230        ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
7231            let _response = fidl::client::decode_transaction_body::<
7232                fidl::encoding::ResultType<StorageStatus, StatusError>,
7233                fidl::encoding::DefaultFuchsiaResourceDialect,
7234                0x7729e325a6c526c8,
7235            >(_buf?)?;
7236            Ok(_response.map(|x| x))
7237        }
7238        self.client
7239            .send_query_and_decode::<fidl::encoding::EmptyPayload, StorageAdminGetStatusResult>(
7240                (),
7241                0x7729e325a6c526c8,
7242                fidl::encoding::DynamicFlags::empty(),
7243                _decode,
7244            )
7245    }
7246
7247    type DeleteAllStorageContentsResponseFut = fidl::client::QueryResponseFut<
7248        StorageAdminDeleteAllStorageContentsResult,
7249        fidl::encoding::DefaultFuchsiaResourceDialect,
7250    >;
7251    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut {
7252        fn _decode(
7253            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7254        ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
7255            let _response = fidl::client::decode_transaction_body::<
7256                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
7257                fidl::encoding::DefaultFuchsiaResourceDialect,
7258                0x2ee980b4b2d24adb,
7259            >(_buf?)?;
7260            Ok(_response.map(|x| x))
7261        }
7262        self.client.send_query_and_decode::<
7263            fidl::encoding::EmptyPayload,
7264            StorageAdminDeleteAllStorageContentsResult,
7265        >(
7266            (),
7267            0x2ee980b4b2d24adb,
7268            fidl::encoding::DynamicFlags::empty(),
7269            _decode,
7270        )
7271    }
7272}
7273
7274pub struct StorageAdminEventStream {
7275    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7276}
7277
7278impl std::marker::Unpin for StorageAdminEventStream {}
7279
7280impl futures::stream::FusedStream for StorageAdminEventStream {
7281    fn is_terminated(&self) -> bool {
7282        self.event_receiver.is_terminated()
7283    }
7284}
7285
7286impl futures::Stream for StorageAdminEventStream {
7287    type Item = Result<StorageAdminEvent, fidl::Error>;
7288
7289    fn poll_next(
7290        mut self: std::pin::Pin<&mut Self>,
7291        cx: &mut std::task::Context<'_>,
7292    ) -> std::task::Poll<Option<Self::Item>> {
7293        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7294            &mut self.event_receiver,
7295            cx
7296        )?) {
7297            Some(buf) => std::task::Poll::Ready(Some(StorageAdminEvent::decode(buf))),
7298            None => std::task::Poll::Ready(None),
7299        }
7300    }
7301}
7302
7303#[derive(Debug)]
7304pub enum StorageAdminEvent {}
7305
7306impl StorageAdminEvent {
7307    /// Decodes a message buffer as a [`StorageAdminEvent`].
7308    fn decode(
7309        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7310    ) -> Result<StorageAdminEvent, fidl::Error> {
7311        let (bytes, _handles) = buf.split_mut();
7312        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7313        debug_assert_eq!(tx_header.tx_id, 0);
7314        match tx_header.ordinal {
7315            _ => Err(fidl::Error::UnknownOrdinal {
7316                ordinal: tx_header.ordinal,
7317                protocol_name: <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7318            }),
7319        }
7320    }
7321}
7322
7323/// A Stream of incoming requests for fuchsia.component/StorageAdmin.
7324pub struct StorageAdminRequestStream {
7325    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7326    is_terminated: bool,
7327}
7328
7329impl std::marker::Unpin for StorageAdminRequestStream {}
7330
7331impl futures::stream::FusedStream for StorageAdminRequestStream {
7332    fn is_terminated(&self) -> bool {
7333        self.is_terminated
7334    }
7335}
7336
7337impl fidl::endpoints::RequestStream for StorageAdminRequestStream {
7338    type Protocol = StorageAdminMarker;
7339    type ControlHandle = StorageAdminControlHandle;
7340
7341    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7342        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7343    }
7344
7345    fn control_handle(&self) -> Self::ControlHandle {
7346        StorageAdminControlHandle { inner: self.inner.clone() }
7347    }
7348
7349    fn into_inner(
7350        self,
7351    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7352    {
7353        (self.inner, self.is_terminated)
7354    }
7355
7356    fn from_inner(
7357        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7358        is_terminated: bool,
7359    ) -> Self {
7360        Self { inner, is_terminated }
7361    }
7362}
7363
7364impl futures::Stream for StorageAdminRequestStream {
7365    type Item = Result<StorageAdminRequest, fidl::Error>;
7366
7367    fn poll_next(
7368        mut self: std::pin::Pin<&mut Self>,
7369        cx: &mut std::task::Context<'_>,
7370    ) -> std::task::Poll<Option<Self::Item>> {
7371        let this = &mut *self;
7372        if this.inner.check_shutdown(cx) {
7373            this.is_terminated = true;
7374            return std::task::Poll::Ready(None);
7375        }
7376        if this.is_terminated {
7377            panic!("polled StorageAdminRequestStream after completion");
7378        }
7379        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7380            |bytes, handles| {
7381                match this.inner.channel().read_etc(cx, bytes, handles) {
7382                    std::task::Poll::Ready(Ok(())) => {}
7383                    std::task::Poll::Pending => return std::task::Poll::Pending,
7384                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7385                        this.is_terminated = true;
7386                        return std::task::Poll::Ready(None);
7387                    }
7388                    std::task::Poll::Ready(Err(e)) => {
7389                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7390                            e.into(),
7391                        ))));
7392                    }
7393                }
7394
7395                // A message has been received from the channel
7396                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7397
7398                std::task::Poll::Ready(Some(match header.ordinal {
7399                    0x6ceaa5904cfe4377 => {
7400                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7401                        let mut req = fidl::new_empty!(
7402                            StorageAdminOpenStorageRequest,
7403                            fidl::encoding::DefaultFuchsiaResourceDialect
7404                        );
7405                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenStorageRequest>(&header, _body_bytes, handles, &mut req)?;
7406                        let control_handle =
7407                            StorageAdminControlHandle { inner: this.inner.clone() };
7408                        Ok(StorageAdminRequest::OpenStorage {
7409                            relative_moniker: req.relative_moniker,
7410                            object: req.object,
7411
7412                            responder: StorageAdminOpenStorageResponder {
7413                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7414                                tx_id: header.tx_id,
7415                            },
7416                        })
7417                    }
7418                    0x764f6d1f083e8bfb => {
7419                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7420                        let mut req = fidl::new_empty!(
7421                            StorageAdminListStorageInRealmRequest,
7422                            fidl::encoding::DefaultFuchsiaResourceDialect
7423                        );
7424                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminListStorageInRealmRequest>(&header, _body_bytes, handles, &mut req)?;
7425                        let control_handle =
7426                            StorageAdminControlHandle { inner: this.inner.clone() };
7427                        Ok(StorageAdminRequest::ListStorageInRealm {
7428                            relative_moniker: req.relative_moniker,
7429                            iterator: req.iterator,
7430
7431                            responder: StorageAdminListStorageInRealmResponder {
7432                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7433                                tx_id: header.tx_id,
7434                            },
7435                        })
7436                    }
7437                    0x4802102cc55d5df1 => {
7438                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7439                        let mut req = fidl::new_empty!(
7440                            StorageAdminOpenComponentStorageByIdRequest,
7441                            fidl::encoding::DefaultFuchsiaResourceDialect
7442                        );
7443                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenComponentStorageByIdRequest>(&header, _body_bytes, handles, &mut req)?;
7444                        let control_handle =
7445                            StorageAdminControlHandle { inner: this.inner.clone() };
7446                        Ok(StorageAdminRequest::OpenComponentStorageById {
7447                            id: req.id,
7448                            object: req.object,
7449
7450                            responder: StorageAdminOpenComponentStorageByIdResponder {
7451                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7452                                tx_id: header.tx_id,
7453                            },
7454                        })
7455                    }
7456                    0x1677c1cdfcdbf45a => {
7457                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7458                        let mut req = fidl::new_empty!(
7459                            StorageAdminDeleteComponentStorageRequest,
7460                            fidl::encoding::DefaultFuchsiaResourceDialect
7461                        );
7462                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminDeleteComponentStorageRequest>(&header, _body_bytes, handles, &mut req)?;
7463                        let control_handle =
7464                            StorageAdminControlHandle { inner: this.inner.clone() };
7465                        Ok(StorageAdminRequest::DeleteComponentStorage {
7466                            relative_moniker: req.relative_moniker,
7467
7468                            responder: StorageAdminDeleteComponentStorageResponder {
7469                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7470                                tx_id: header.tx_id,
7471                            },
7472                        })
7473                    }
7474                    0x7729e325a6c526c8 => {
7475                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7476                        let mut req = fidl::new_empty!(
7477                            fidl::encoding::EmptyPayload,
7478                            fidl::encoding::DefaultFuchsiaResourceDialect
7479                        );
7480                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7481                        let control_handle =
7482                            StorageAdminControlHandle { inner: this.inner.clone() };
7483                        Ok(StorageAdminRequest::GetStatus {
7484                            responder: StorageAdminGetStatusResponder {
7485                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7486                                tx_id: header.tx_id,
7487                            },
7488                        })
7489                    }
7490                    0x2ee980b4b2d24adb => {
7491                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7492                        let mut req = fidl::new_empty!(
7493                            fidl::encoding::EmptyPayload,
7494                            fidl::encoding::DefaultFuchsiaResourceDialect
7495                        );
7496                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7497                        let control_handle =
7498                            StorageAdminControlHandle { inner: this.inner.clone() };
7499                        Ok(StorageAdminRequest::DeleteAllStorageContents {
7500                            responder: StorageAdminDeleteAllStorageContentsResponder {
7501                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7502                                tx_id: header.tx_id,
7503                            },
7504                        })
7505                    }
7506                    _ => Err(fidl::Error::UnknownOrdinal {
7507                        ordinal: header.ordinal,
7508                        protocol_name:
7509                            <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7510                    }),
7511                }))
7512            },
7513        )
7514    }
7515}
7516
7517#[derive(Debug)]
7518pub enum StorageAdminRequest {
7519    /// Opens the isolated directory for the given component. The provided
7520    /// moniker is relative to the component that declares the storage
7521    /// capability. Creates the backing sub-directory for this storage if it
7522    /// hasn't yet been created.
7523    OpenStorage {
7524        relative_moniker: String,
7525        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7526        responder: StorageAdminOpenStorageResponder,
7527    },
7528    /// Lists the descendant components under the specified realm that use the
7529    /// storage capability. The provided moniker is relative to the component
7530    /// that declares the storage capability.
7531    ///
7532    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
7533    /// if |relative_moniker| is malformed.
7534    ListStorageInRealm {
7535        relative_moniker: String,
7536        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7537        responder: StorageAdminListStorageInRealmResponder,
7538    },
7539    /// Opens the isolated directory for the given storage ID. Creates the
7540    /// backing sub-directory for this storage if it hasn't yet been created.
7541    OpenComponentStorageById {
7542        id: String,
7543        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7544        responder: StorageAdminOpenComponentStorageByIdResponder,
7545    },
7546    /// Deletes the contents of the storage for this component. Preserves the
7547    /// component's subdirectory itself within the storage backing directory.
7548    /// The provided moniker is relative to the component that declares the
7549    /// storage capability.
7550    DeleteComponentStorage {
7551        relative_moniker: String,
7552        responder: StorageAdminDeleteComponentStorageResponder,
7553    },
7554    /// Get the current status of the storage.
7555    GetStatus { responder: StorageAdminGetStatusResponder },
7556    /// Deletes the contents of all the storage. Storage directories are
7557    /// retained so any components using storage will be able to continue using
7558    /// it to create new files and directories.
7559    ///
7560    /// Returns Error::INTERNAL only if no storage at all could be cleared.
7561    /// Returns successfully even if some errors happen during the deletion
7562    /// progress.
7563    DeleteAllStorageContents { responder: StorageAdminDeleteAllStorageContentsResponder },
7564}
7565
7566impl StorageAdminRequest {
7567    #[allow(irrefutable_let_patterns)]
7568    pub fn into_open_storage(
7569        self,
7570    ) -> Option<(
7571        String,
7572        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7573        StorageAdminOpenStorageResponder,
7574    )> {
7575        if let StorageAdminRequest::OpenStorage { relative_moniker, object, responder } = self {
7576            Some((relative_moniker, object, responder))
7577        } else {
7578            None
7579        }
7580    }
7581
7582    #[allow(irrefutable_let_patterns)]
7583    pub fn into_list_storage_in_realm(
7584        self,
7585    ) -> Option<(
7586        String,
7587        fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7588        StorageAdminListStorageInRealmResponder,
7589    )> {
7590        if let StorageAdminRequest::ListStorageInRealm { relative_moniker, iterator, responder } =
7591            self
7592        {
7593            Some((relative_moniker, iterator, responder))
7594        } else {
7595            None
7596        }
7597    }
7598
7599    #[allow(irrefutable_let_patterns)]
7600    pub fn into_open_component_storage_by_id(
7601        self,
7602    ) -> Option<(
7603        String,
7604        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7605        StorageAdminOpenComponentStorageByIdResponder,
7606    )> {
7607        if let StorageAdminRequest::OpenComponentStorageById { id, object, responder } = self {
7608            Some((id, object, responder))
7609        } else {
7610            None
7611        }
7612    }
7613
7614    #[allow(irrefutable_let_patterns)]
7615    pub fn into_delete_component_storage(
7616        self,
7617    ) -> Option<(String, StorageAdminDeleteComponentStorageResponder)> {
7618        if let StorageAdminRequest::DeleteComponentStorage { relative_moniker, responder } = self {
7619            Some((relative_moniker, responder))
7620        } else {
7621            None
7622        }
7623    }
7624
7625    #[allow(irrefutable_let_patterns)]
7626    pub fn into_get_status(self) -> Option<(StorageAdminGetStatusResponder)> {
7627        if let StorageAdminRequest::GetStatus { responder } = self {
7628            Some((responder))
7629        } else {
7630            None
7631        }
7632    }
7633
7634    #[allow(irrefutable_let_patterns)]
7635    pub fn into_delete_all_storage_contents(
7636        self,
7637    ) -> Option<(StorageAdminDeleteAllStorageContentsResponder)> {
7638        if let StorageAdminRequest::DeleteAllStorageContents { responder } = self {
7639            Some((responder))
7640        } else {
7641            None
7642        }
7643    }
7644
7645    /// Name of the method defined in FIDL
7646    pub fn method_name(&self) -> &'static str {
7647        match *self {
7648            StorageAdminRequest::OpenStorage { .. } => "open_storage",
7649            StorageAdminRequest::ListStorageInRealm { .. } => "list_storage_in_realm",
7650            StorageAdminRequest::OpenComponentStorageById { .. } => "open_component_storage_by_id",
7651            StorageAdminRequest::DeleteComponentStorage { .. } => "delete_component_storage",
7652            StorageAdminRequest::GetStatus { .. } => "get_status",
7653            StorageAdminRequest::DeleteAllStorageContents { .. } => "delete_all_storage_contents",
7654        }
7655    }
7656}
7657
7658#[derive(Debug, Clone)]
7659pub struct StorageAdminControlHandle {
7660    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7661}
7662
7663impl fidl::endpoints::ControlHandle for StorageAdminControlHandle {
7664    fn shutdown(&self) {
7665        self.inner.shutdown()
7666    }
7667
7668    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7669        self.inner.shutdown_with_epitaph(status)
7670    }
7671
7672    fn is_closed(&self) -> bool {
7673        self.inner.channel().is_closed()
7674    }
7675    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7676        self.inner.channel().on_closed()
7677    }
7678
7679    #[cfg(target_os = "fuchsia")]
7680    fn signal_peer(
7681        &self,
7682        clear_mask: zx::Signals,
7683        set_mask: zx::Signals,
7684    ) -> Result<(), zx_status::Status> {
7685        use fidl::Peered;
7686        self.inner.channel().signal_peer(clear_mask, set_mask)
7687    }
7688}
7689
7690impl StorageAdminControlHandle {}
7691
7692#[must_use = "FIDL methods require a response to be sent"]
7693#[derive(Debug)]
7694pub struct StorageAdminOpenStorageResponder {
7695    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7696    tx_id: u32,
7697}
7698
7699/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7700/// if the responder is dropped without sending a response, so that the client
7701/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7702impl std::ops::Drop for StorageAdminOpenStorageResponder {
7703    fn drop(&mut self) {
7704        self.control_handle.shutdown();
7705        // Safety: drops once, never accessed again
7706        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7707    }
7708}
7709
7710impl fidl::endpoints::Responder for StorageAdminOpenStorageResponder {
7711    type ControlHandle = StorageAdminControlHandle;
7712
7713    fn control_handle(&self) -> &StorageAdminControlHandle {
7714        &self.control_handle
7715    }
7716
7717    fn drop_without_shutdown(mut self) {
7718        // Safety: drops once, never accessed again due to mem::forget
7719        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7720        // Prevent Drop from running (which would shut down the channel)
7721        std::mem::forget(self);
7722    }
7723}
7724
7725impl StorageAdminOpenStorageResponder {
7726    /// Sends a response to the FIDL transaction.
7727    ///
7728    /// Sets the channel to shutdown if an error occurs.
7729    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7730        let _result = self.send_raw(result);
7731        if _result.is_err() {
7732            self.control_handle.shutdown();
7733        }
7734        self.drop_without_shutdown();
7735        _result
7736    }
7737
7738    /// Similar to "send" but does not shutdown the channel if an error occurs.
7739    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7740        let _result = self.send_raw(result);
7741        self.drop_without_shutdown();
7742        _result
7743    }
7744
7745    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7746        self.control_handle
7747            .inner
7748            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7749                result,
7750                self.tx_id,
7751                0x6ceaa5904cfe4377,
7752                fidl::encoding::DynamicFlags::empty(),
7753            )
7754    }
7755}
7756
7757#[must_use = "FIDL methods require a response to be sent"]
7758#[derive(Debug)]
7759pub struct StorageAdminListStorageInRealmResponder {
7760    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7761    tx_id: u32,
7762}
7763
7764/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7765/// if the responder is dropped without sending a response, so that the client
7766/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7767impl std::ops::Drop for StorageAdminListStorageInRealmResponder {
7768    fn drop(&mut self) {
7769        self.control_handle.shutdown();
7770        // Safety: drops once, never accessed again
7771        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7772    }
7773}
7774
7775impl fidl::endpoints::Responder for StorageAdminListStorageInRealmResponder {
7776    type ControlHandle = StorageAdminControlHandle;
7777
7778    fn control_handle(&self) -> &StorageAdminControlHandle {
7779        &self.control_handle
7780    }
7781
7782    fn drop_without_shutdown(mut self) {
7783        // Safety: drops once, never accessed again due to mem::forget
7784        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7785        // Prevent Drop from running (which would shut down the channel)
7786        std::mem::forget(self);
7787    }
7788}
7789
7790impl StorageAdminListStorageInRealmResponder {
7791    /// Sends a response to the FIDL transaction.
7792    ///
7793    /// Sets the channel to shutdown if an error occurs.
7794    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7795        let _result = self.send_raw(result);
7796        if _result.is_err() {
7797            self.control_handle.shutdown();
7798        }
7799        self.drop_without_shutdown();
7800        _result
7801    }
7802
7803    /// Similar to "send" but does not shutdown the channel if an error occurs.
7804    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7805        let _result = self.send_raw(result);
7806        self.drop_without_shutdown();
7807        _result
7808    }
7809
7810    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7811        self.control_handle
7812            .inner
7813            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7814                result,
7815                self.tx_id,
7816                0x764f6d1f083e8bfb,
7817                fidl::encoding::DynamicFlags::empty(),
7818            )
7819    }
7820}
7821
7822#[must_use = "FIDL methods require a response to be sent"]
7823#[derive(Debug)]
7824pub struct StorageAdminOpenComponentStorageByIdResponder {
7825    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7826    tx_id: u32,
7827}
7828
7829/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7830/// if the responder is dropped without sending a response, so that the client
7831/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7832impl std::ops::Drop for StorageAdminOpenComponentStorageByIdResponder {
7833    fn drop(&mut self) {
7834        self.control_handle.shutdown();
7835        // Safety: drops once, never accessed again
7836        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7837    }
7838}
7839
7840impl fidl::endpoints::Responder for StorageAdminOpenComponentStorageByIdResponder {
7841    type ControlHandle = StorageAdminControlHandle;
7842
7843    fn control_handle(&self) -> &StorageAdminControlHandle {
7844        &self.control_handle
7845    }
7846
7847    fn drop_without_shutdown(mut self) {
7848        // Safety: drops once, never accessed again due to mem::forget
7849        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7850        // Prevent Drop from running (which would shut down the channel)
7851        std::mem::forget(self);
7852    }
7853}
7854
7855impl StorageAdminOpenComponentStorageByIdResponder {
7856    /// Sends a response to the FIDL transaction.
7857    ///
7858    /// Sets the channel to shutdown if an error occurs.
7859    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7860        let _result = self.send_raw(result);
7861        if _result.is_err() {
7862            self.control_handle.shutdown();
7863        }
7864        self.drop_without_shutdown();
7865        _result
7866    }
7867
7868    /// Similar to "send" but does not shutdown the channel if an error occurs.
7869    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7870        let _result = self.send_raw(result);
7871        self.drop_without_shutdown();
7872        _result
7873    }
7874
7875    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7876        self.control_handle
7877            .inner
7878            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7879                result,
7880                self.tx_id,
7881                0x4802102cc55d5df1,
7882                fidl::encoding::DynamicFlags::empty(),
7883            )
7884    }
7885}
7886
7887#[must_use = "FIDL methods require a response to be sent"]
7888#[derive(Debug)]
7889pub struct StorageAdminDeleteComponentStorageResponder {
7890    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7891    tx_id: u32,
7892}
7893
7894/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7895/// if the responder is dropped without sending a response, so that the client
7896/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7897impl std::ops::Drop for StorageAdminDeleteComponentStorageResponder {
7898    fn drop(&mut self) {
7899        self.control_handle.shutdown();
7900        // Safety: drops once, never accessed again
7901        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7902    }
7903}
7904
7905impl fidl::endpoints::Responder for StorageAdminDeleteComponentStorageResponder {
7906    type ControlHandle = StorageAdminControlHandle;
7907
7908    fn control_handle(&self) -> &StorageAdminControlHandle {
7909        &self.control_handle
7910    }
7911
7912    fn drop_without_shutdown(mut self) {
7913        // Safety: drops once, never accessed again due to mem::forget
7914        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7915        // Prevent Drop from running (which would shut down the channel)
7916        std::mem::forget(self);
7917    }
7918}
7919
7920impl StorageAdminDeleteComponentStorageResponder {
7921    /// Sends a response to the FIDL transaction.
7922    ///
7923    /// Sets the channel to shutdown if an error occurs.
7924    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7925        let _result = self.send_raw(result);
7926        if _result.is_err() {
7927            self.control_handle.shutdown();
7928        }
7929        self.drop_without_shutdown();
7930        _result
7931    }
7932
7933    /// Similar to "send" but does not shutdown the channel if an error occurs.
7934    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7935        let _result = self.send_raw(result);
7936        self.drop_without_shutdown();
7937        _result
7938    }
7939
7940    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7941        self.control_handle
7942            .inner
7943            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7944                result,
7945                self.tx_id,
7946                0x1677c1cdfcdbf45a,
7947                fidl::encoding::DynamicFlags::empty(),
7948            )
7949    }
7950}
7951
7952#[must_use = "FIDL methods require a response to be sent"]
7953#[derive(Debug)]
7954pub struct StorageAdminGetStatusResponder {
7955    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7956    tx_id: u32,
7957}
7958
7959/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7960/// if the responder is dropped without sending a response, so that the client
7961/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7962impl std::ops::Drop for StorageAdminGetStatusResponder {
7963    fn drop(&mut self) {
7964        self.control_handle.shutdown();
7965        // Safety: drops once, never accessed again
7966        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7967    }
7968}
7969
7970impl fidl::endpoints::Responder for StorageAdminGetStatusResponder {
7971    type ControlHandle = StorageAdminControlHandle;
7972
7973    fn control_handle(&self) -> &StorageAdminControlHandle {
7974        &self.control_handle
7975    }
7976
7977    fn drop_without_shutdown(mut self) {
7978        // Safety: drops once, never accessed again due to mem::forget
7979        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7980        // Prevent Drop from running (which would shut down the channel)
7981        std::mem::forget(self);
7982    }
7983}
7984
7985impl StorageAdminGetStatusResponder {
7986    /// Sends a response to the FIDL transaction.
7987    ///
7988    /// Sets the channel to shutdown if an error occurs.
7989    pub fn send(self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
7990        let _result = self.send_raw(result);
7991        if _result.is_err() {
7992            self.control_handle.shutdown();
7993        }
7994        self.drop_without_shutdown();
7995        _result
7996    }
7997
7998    /// Similar to "send" but does not shutdown the channel if an error occurs.
7999    pub fn send_no_shutdown_on_err(
8000        self,
8001        mut result: Result<&StorageStatus, StatusError>,
8002    ) -> Result<(), fidl::Error> {
8003        let _result = self.send_raw(result);
8004        self.drop_without_shutdown();
8005        _result
8006    }
8007
8008    fn send_raw(&self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
8009        self.control_handle.inner.send::<fidl::encoding::ResultType<StorageStatus, StatusError>>(
8010            result,
8011            self.tx_id,
8012            0x7729e325a6c526c8,
8013            fidl::encoding::DynamicFlags::empty(),
8014        )
8015    }
8016}
8017
8018#[must_use = "FIDL methods require a response to be sent"]
8019#[derive(Debug)]
8020pub struct StorageAdminDeleteAllStorageContentsResponder {
8021    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
8022    tx_id: u32,
8023}
8024
8025/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
8026/// if the responder is dropped without sending a response, so that the client
8027/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8028impl std::ops::Drop for StorageAdminDeleteAllStorageContentsResponder {
8029    fn drop(&mut self) {
8030        self.control_handle.shutdown();
8031        // Safety: drops once, never accessed again
8032        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8033    }
8034}
8035
8036impl fidl::endpoints::Responder for StorageAdminDeleteAllStorageContentsResponder {
8037    type ControlHandle = StorageAdminControlHandle;
8038
8039    fn control_handle(&self) -> &StorageAdminControlHandle {
8040        &self.control_handle
8041    }
8042
8043    fn drop_without_shutdown(mut self) {
8044        // Safety: drops once, never accessed again due to mem::forget
8045        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8046        // Prevent Drop from running (which would shut down the channel)
8047        std::mem::forget(self);
8048    }
8049}
8050
8051impl StorageAdminDeleteAllStorageContentsResponder {
8052    /// Sends a response to the FIDL transaction.
8053    ///
8054    /// Sets the channel to shutdown if an error occurs.
8055    pub fn send(self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
8056        let _result = self.send_raw(result);
8057        if _result.is_err() {
8058            self.control_handle.shutdown();
8059        }
8060        self.drop_without_shutdown();
8061        _result
8062    }
8063
8064    /// Similar to "send" but does not shutdown the channel if an error occurs.
8065    pub fn send_no_shutdown_on_err(
8066        self,
8067        mut result: Result<(), DeletionError>,
8068    ) -> Result<(), fidl::Error> {
8069        let _result = self.send_raw(result);
8070        self.drop_without_shutdown();
8071        _result
8072    }
8073
8074    fn send_raw(&self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
8075        self.control_handle.inner.send::<fidl::encoding::ResultType<
8076            fidl::encoding::EmptyStruct,
8077            DeletionError,
8078        >>(
8079            result,
8080            self.tx_id,
8081            0x2ee980b4b2d24adb,
8082            fidl::encoding::DynamicFlags::empty(),
8083        )
8084    }
8085}
8086
8087#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8088pub struct StorageIteratorMarker;
8089
8090impl fidl::endpoints::ProtocolMarker for StorageIteratorMarker {
8091    type Proxy = StorageIteratorProxy;
8092    type RequestStream = StorageIteratorRequestStream;
8093    #[cfg(target_os = "fuchsia")]
8094    type SynchronousProxy = StorageIteratorSynchronousProxy;
8095
8096    const DEBUG_NAME: &'static str = "(anonymous) StorageIterator";
8097}
8098
8099pub trait StorageIteratorProxyInterface: Send + Sync {
8100    type NextResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
8101    fn r#next(&self) -> Self::NextResponseFut;
8102}
8103#[derive(Debug)]
8104#[cfg(target_os = "fuchsia")]
8105pub struct StorageIteratorSynchronousProxy {
8106    client: fidl::client::sync::Client,
8107}
8108
8109#[cfg(target_os = "fuchsia")]
8110impl fidl::endpoints::SynchronousProxy for StorageIteratorSynchronousProxy {
8111    type Proxy = StorageIteratorProxy;
8112    type Protocol = StorageIteratorMarker;
8113
8114    fn from_channel(inner: fidl::Channel) -> Self {
8115        Self::new(inner)
8116    }
8117
8118    fn into_channel(self) -> fidl::Channel {
8119        self.client.into_channel()
8120    }
8121
8122    fn as_channel(&self) -> &fidl::Channel {
8123        self.client.as_channel()
8124    }
8125}
8126
8127#[cfg(target_os = "fuchsia")]
8128impl StorageIteratorSynchronousProxy {
8129    pub fn new(channel: fidl::Channel) -> Self {
8130        let protocol_name = <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8131        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8132    }
8133
8134    pub fn into_channel(self) -> fidl::Channel {
8135        self.client.into_channel()
8136    }
8137
8138    /// Waits until an event arrives and returns it. It is safe for other
8139    /// threads to make concurrent requests while waiting for an event.
8140    pub fn wait_for_event(
8141        &self,
8142        deadline: zx::MonotonicInstant,
8143    ) -> Result<StorageIteratorEvent, fidl::Error> {
8144        StorageIteratorEvent::decode(self.client.wait_for_event(deadline)?)
8145    }
8146
8147    /// Retrieve the next set of components using the storage capability. The
8148    /// returned monikers are relative to the component that declares the
8149    /// storage capability. Returns an empty vector after all components have
8150    /// been returned.
8151    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<String>, fidl::Error> {
8152        let _response =
8153            self.client.send_query::<fidl::encoding::EmptyPayload, StorageIteratorNextResponse>(
8154                (),
8155                0x7a6b21f15fd01b72,
8156                fidl::encoding::DynamicFlags::empty(),
8157                ___deadline,
8158            )?;
8159        Ok(_response.relative_monikers)
8160    }
8161}
8162
8163#[cfg(target_os = "fuchsia")]
8164impl From<StorageIteratorSynchronousProxy> for zx::NullableHandle {
8165    fn from(value: StorageIteratorSynchronousProxy) -> Self {
8166        value.into_channel().into()
8167    }
8168}
8169
8170#[cfg(target_os = "fuchsia")]
8171impl From<fidl::Channel> for StorageIteratorSynchronousProxy {
8172    fn from(value: fidl::Channel) -> Self {
8173        Self::new(value)
8174    }
8175}
8176
8177#[cfg(target_os = "fuchsia")]
8178impl fidl::endpoints::FromClient for StorageIteratorSynchronousProxy {
8179    type Protocol = StorageIteratorMarker;
8180
8181    fn from_client(value: fidl::endpoints::ClientEnd<StorageIteratorMarker>) -> Self {
8182        Self::new(value.into_channel())
8183    }
8184}
8185
8186#[derive(Debug, Clone)]
8187pub struct StorageIteratorProxy {
8188    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8189}
8190
8191impl fidl::endpoints::Proxy for StorageIteratorProxy {
8192    type Protocol = StorageIteratorMarker;
8193
8194    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8195        Self::new(inner)
8196    }
8197
8198    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8199        self.client.into_channel().map_err(|client| Self { client })
8200    }
8201
8202    fn as_channel(&self) -> &::fidl::AsyncChannel {
8203        self.client.as_channel()
8204    }
8205}
8206
8207impl StorageIteratorProxy {
8208    /// Create a new Proxy for fuchsia.component/StorageIterator.
8209    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8210        let protocol_name = <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8211        Self { client: fidl::client::Client::new(channel, protocol_name) }
8212    }
8213
8214    /// Get a Stream of events from the remote end of the protocol.
8215    ///
8216    /// # Panics
8217    ///
8218    /// Panics if the event stream was already taken.
8219    pub fn take_event_stream(&self) -> StorageIteratorEventStream {
8220        StorageIteratorEventStream { event_receiver: self.client.take_event_receiver() }
8221    }
8222
8223    /// Retrieve the next set of components using the storage capability. The
8224    /// returned monikers are relative to the component that declares the
8225    /// storage capability. Returns an empty vector after all components have
8226    /// been returned.
8227    pub fn r#next(
8228        &self,
8229    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
8230    {
8231        StorageIteratorProxyInterface::r#next(self)
8232    }
8233}
8234
8235impl StorageIteratorProxyInterface for StorageIteratorProxy {
8236    type NextResponseFut =
8237        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
8238    fn r#next(&self) -> Self::NextResponseFut {
8239        fn _decode(
8240            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8241        ) -> Result<Vec<String>, fidl::Error> {
8242            let _response = fidl::client::decode_transaction_body::<
8243                StorageIteratorNextResponse,
8244                fidl::encoding::DefaultFuchsiaResourceDialect,
8245                0x7a6b21f15fd01b72,
8246            >(_buf?)?;
8247            Ok(_response.relative_monikers)
8248        }
8249        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
8250            (),
8251            0x7a6b21f15fd01b72,
8252            fidl::encoding::DynamicFlags::empty(),
8253            _decode,
8254        )
8255    }
8256}
8257
8258pub struct StorageIteratorEventStream {
8259    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8260}
8261
8262impl std::marker::Unpin for StorageIteratorEventStream {}
8263
8264impl futures::stream::FusedStream for StorageIteratorEventStream {
8265    fn is_terminated(&self) -> bool {
8266        self.event_receiver.is_terminated()
8267    }
8268}
8269
8270impl futures::Stream for StorageIteratorEventStream {
8271    type Item = Result<StorageIteratorEvent, fidl::Error>;
8272
8273    fn poll_next(
8274        mut self: std::pin::Pin<&mut Self>,
8275        cx: &mut std::task::Context<'_>,
8276    ) -> std::task::Poll<Option<Self::Item>> {
8277        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8278            &mut self.event_receiver,
8279            cx
8280        )?) {
8281            Some(buf) => std::task::Poll::Ready(Some(StorageIteratorEvent::decode(buf))),
8282            None => std::task::Poll::Ready(None),
8283        }
8284    }
8285}
8286
8287#[derive(Debug)]
8288pub enum StorageIteratorEvent {}
8289
8290impl StorageIteratorEvent {
8291    /// Decodes a message buffer as a [`StorageIteratorEvent`].
8292    fn decode(
8293        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8294    ) -> Result<StorageIteratorEvent, fidl::Error> {
8295        let (bytes, _handles) = buf.split_mut();
8296        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8297        debug_assert_eq!(tx_header.tx_id, 0);
8298        match tx_header.ordinal {
8299            _ => Err(fidl::Error::UnknownOrdinal {
8300                ordinal: tx_header.ordinal,
8301                protocol_name:
8302                    <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8303            }),
8304        }
8305    }
8306}
8307
8308/// A Stream of incoming requests for fuchsia.component/StorageIterator.
8309pub struct StorageIteratorRequestStream {
8310    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8311    is_terminated: bool,
8312}
8313
8314impl std::marker::Unpin for StorageIteratorRequestStream {}
8315
8316impl futures::stream::FusedStream for StorageIteratorRequestStream {
8317    fn is_terminated(&self) -> bool {
8318        self.is_terminated
8319    }
8320}
8321
8322impl fidl::endpoints::RequestStream for StorageIteratorRequestStream {
8323    type Protocol = StorageIteratorMarker;
8324    type ControlHandle = StorageIteratorControlHandle;
8325
8326    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8327        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8328    }
8329
8330    fn control_handle(&self) -> Self::ControlHandle {
8331        StorageIteratorControlHandle { inner: self.inner.clone() }
8332    }
8333
8334    fn into_inner(
8335        self,
8336    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8337    {
8338        (self.inner, self.is_terminated)
8339    }
8340
8341    fn from_inner(
8342        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8343        is_terminated: bool,
8344    ) -> Self {
8345        Self { inner, is_terminated }
8346    }
8347}
8348
8349impl futures::Stream for StorageIteratorRequestStream {
8350    type Item = Result<StorageIteratorRequest, fidl::Error>;
8351
8352    fn poll_next(
8353        mut self: std::pin::Pin<&mut Self>,
8354        cx: &mut std::task::Context<'_>,
8355    ) -> std::task::Poll<Option<Self::Item>> {
8356        let this = &mut *self;
8357        if this.inner.check_shutdown(cx) {
8358            this.is_terminated = true;
8359            return std::task::Poll::Ready(None);
8360        }
8361        if this.is_terminated {
8362            panic!("polled StorageIteratorRequestStream after completion");
8363        }
8364        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8365            |bytes, handles| {
8366                match this.inner.channel().read_etc(cx, bytes, handles) {
8367                    std::task::Poll::Ready(Ok(())) => {}
8368                    std::task::Poll::Pending => return std::task::Poll::Pending,
8369                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8370                        this.is_terminated = true;
8371                        return std::task::Poll::Ready(None);
8372                    }
8373                    std::task::Poll::Ready(Err(e)) => {
8374                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8375                            e.into(),
8376                        ))));
8377                    }
8378                }
8379
8380                // A message has been received from the channel
8381                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8382
8383                std::task::Poll::Ready(Some(match header.ordinal {
8384                    0x7a6b21f15fd01b72 => {
8385                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8386                        let mut req = fidl::new_empty!(
8387                            fidl::encoding::EmptyPayload,
8388                            fidl::encoding::DefaultFuchsiaResourceDialect
8389                        );
8390                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8391                        let control_handle =
8392                            StorageIteratorControlHandle { inner: this.inner.clone() };
8393                        Ok(StorageIteratorRequest::Next {
8394                            responder: StorageIteratorNextResponder {
8395                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8396                                tx_id: header.tx_id,
8397                            },
8398                        })
8399                    }
8400                    _ => Err(fidl::Error::UnknownOrdinal {
8401                        ordinal: header.ordinal,
8402                        protocol_name:
8403                            <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8404                    }),
8405                }))
8406            },
8407        )
8408    }
8409}
8410
8411/// An iterator protocol for returning a set of components using a storage
8412/// capability. See |StorageAdmin.ListStorageInRealm| for more information.
8413#[derive(Debug)]
8414pub enum StorageIteratorRequest {
8415    /// Retrieve the next set of components using the storage capability. The
8416    /// returned monikers are relative to the component that declares the
8417    /// storage capability. Returns an empty vector after all components have
8418    /// been returned.
8419    Next { responder: StorageIteratorNextResponder },
8420}
8421
8422impl StorageIteratorRequest {
8423    #[allow(irrefutable_let_patterns)]
8424    pub fn into_next(self) -> Option<(StorageIteratorNextResponder)> {
8425        if let StorageIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
8426    }
8427
8428    /// Name of the method defined in FIDL
8429    pub fn method_name(&self) -> &'static str {
8430        match *self {
8431            StorageIteratorRequest::Next { .. } => "next",
8432        }
8433    }
8434}
8435
8436#[derive(Debug, Clone)]
8437pub struct StorageIteratorControlHandle {
8438    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8439}
8440
8441impl fidl::endpoints::ControlHandle for StorageIteratorControlHandle {
8442    fn shutdown(&self) {
8443        self.inner.shutdown()
8444    }
8445
8446    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8447        self.inner.shutdown_with_epitaph(status)
8448    }
8449
8450    fn is_closed(&self) -> bool {
8451        self.inner.channel().is_closed()
8452    }
8453    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8454        self.inner.channel().on_closed()
8455    }
8456
8457    #[cfg(target_os = "fuchsia")]
8458    fn signal_peer(
8459        &self,
8460        clear_mask: zx::Signals,
8461        set_mask: zx::Signals,
8462    ) -> Result<(), zx_status::Status> {
8463        use fidl::Peered;
8464        self.inner.channel().signal_peer(clear_mask, set_mask)
8465    }
8466}
8467
8468impl StorageIteratorControlHandle {}
8469
8470#[must_use = "FIDL methods require a response to be sent"]
8471#[derive(Debug)]
8472pub struct StorageIteratorNextResponder {
8473    control_handle: std::mem::ManuallyDrop<StorageIteratorControlHandle>,
8474    tx_id: u32,
8475}
8476
8477/// Set the the channel to be shutdown (see [`StorageIteratorControlHandle::shutdown`])
8478/// if the responder is dropped without sending a response, so that the client
8479/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8480impl std::ops::Drop for StorageIteratorNextResponder {
8481    fn drop(&mut self) {
8482        self.control_handle.shutdown();
8483        // Safety: drops once, never accessed again
8484        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8485    }
8486}
8487
8488impl fidl::endpoints::Responder for StorageIteratorNextResponder {
8489    type ControlHandle = StorageIteratorControlHandle;
8490
8491    fn control_handle(&self) -> &StorageIteratorControlHandle {
8492        &self.control_handle
8493    }
8494
8495    fn drop_without_shutdown(mut self) {
8496        // Safety: drops once, never accessed again due to mem::forget
8497        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8498        // Prevent Drop from running (which would shut down the channel)
8499        std::mem::forget(self);
8500    }
8501}
8502
8503impl StorageIteratorNextResponder {
8504    /// Sends a response to the FIDL transaction.
8505    ///
8506    /// Sets the channel to shutdown if an error occurs.
8507    pub fn send(self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
8508        let _result = self.send_raw(relative_monikers);
8509        if _result.is_err() {
8510            self.control_handle.shutdown();
8511        }
8512        self.drop_without_shutdown();
8513        _result
8514    }
8515
8516    /// Similar to "send" but does not shutdown the channel if an error occurs.
8517    pub fn send_no_shutdown_on_err(
8518        self,
8519        mut relative_monikers: &[String],
8520    ) -> Result<(), fidl::Error> {
8521        let _result = self.send_raw(relative_monikers);
8522        self.drop_without_shutdown();
8523        _result
8524    }
8525
8526    fn send_raw(&self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
8527        self.control_handle.inner.send::<StorageIteratorNextResponse>(
8528            (relative_monikers,),
8529            self.tx_id,
8530            0x7a6b21f15fd01b72,
8531            fidl::encoding::DynamicFlags::empty(),
8532        )
8533    }
8534}
8535
8536mod internal {
8537    use super::*;
8538
8539    impl fidl::encoding::ResourceTypeMarker for ControllerOpenExposedDirRequest {
8540        type Borrowed<'a> = &'a mut Self;
8541        fn take_or_borrow<'a>(
8542            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8543        ) -> Self::Borrowed<'a> {
8544            value
8545        }
8546    }
8547
8548    unsafe impl fidl::encoding::TypeMarker for ControllerOpenExposedDirRequest {
8549        type Owned = Self;
8550
8551        #[inline(always)]
8552        fn inline_align(_context: fidl::encoding::Context) -> usize {
8553            4
8554        }
8555
8556        #[inline(always)]
8557        fn inline_size(_context: fidl::encoding::Context) -> usize {
8558            4
8559        }
8560    }
8561
8562    unsafe impl
8563        fidl::encoding::Encode<
8564            ControllerOpenExposedDirRequest,
8565            fidl::encoding::DefaultFuchsiaResourceDialect,
8566        > for &mut ControllerOpenExposedDirRequest
8567    {
8568        #[inline]
8569        unsafe fn encode(
8570            self,
8571            encoder: &mut fidl::encoding::Encoder<
8572                '_,
8573                fidl::encoding::DefaultFuchsiaResourceDialect,
8574            >,
8575            offset: usize,
8576            _depth: fidl::encoding::Depth,
8577        ) -> fidl::Result<()> {
8578            encoder.debug_check_bounds::<ControllerOpenExposedDirRequest>(offset);
8579            // Delegate to tuple encoding.
8580            fidl::encoding::Encode::<
8581                ControllerOpenExposedDirRequest,
8582                fidl::encoding::DefaultFuchsiaResourceDialect,
8583            >::encode(
8584                (<fidl::encoding::Endpoint<
8585                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8586                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8587                    &mut self.exposed_dir
8588                ),),
8589                encoder,
8590                offset,
8591                _depth,
8592            )
8593        }
8594    }
8595    unsafe impl<
8596        T0: fidl::encoding::Encode<
8597                fidl::encoding::Endpoint<
8598                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8599                >,
8600                fidl::encoding::DefaultFuchsiaResourceDialect,
8601            >,
8602    >
8603        fidl::encoding::Encode<
8604            ControllerOpenExposedDirRequest,
8605            fidl::encoding::DefaultFuchsiaResourceDialect,
8606        > for (T0,)
8607    {
8608        #[inline]
8609        unsafe fn encode(
8610            self,
8611            encoder: &mut fidl::encoding::Encoder<
8612                '_,
8613                fidl::encoding::DefaultFuchsiaResourceDialect,
8614            >,
8615            offset: usize,
8616            depth: fidl::encoding::Depth,
8617        ) -> fidl::Result<()> {
8618            encoder.debug_check_bounds::<ControllerOpenExposedDirRequest>(offset);
8619            // Zero out padding regions. There's no need to apply masks
8620            // because the unmasked parts will be overwritten by fields.
8621            // Write the fields.
8622            self.0.encode(encoder, offset + 0, depth)?;
8623            Ok(())
8624        }
8625    }
8626
8627    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8628        for ControllerOpenExposedDirRequest
8629    {
8630        #[inline(always)]
8631        fn new_empty() -> Self {
8632            Self {
8633                exposed_dir: fidl::new_empty!(
8634                    fidl::encoding::Endpoint<
8635                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8636                    >,
8637                    fidl::encoding::DefaultFuchsiaResourceDialect
8638                ),
8639            }
8640        }
8641
8642        #[inline]
8643        unsafe fn decode(
8644            &mut self,
8645            decoder: &mut fidl::encoding::Decoder<
8646                '_,
8647                fidl::encoding::DefaultFuchsiaResourceDialect,
8648            >,
8649            offset: usize,
8650            _depth: fidl::encoding::Depth,
8651        ) -> fidl::Result<()> {
8652            decoder.debug_check_bounds::<Self>(offset);
8653            // Verify that padding bytes are zero.
8654            fidl::decode!(
8655                fidl::encoding::Endpoint<
8656                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8657                >,
8658                fidl::encoding::DefaultFuchsiaResourceDialect,
8659                &mut self.exposed_dir,
8660                decoder,
8661                offset + 0,
8662                _depth
8663            )?;
8664            Ok(())
8665        }
8666    }
8667
8668    impl fidl::encoding::ResourceTypeMarker for ControllerStartRequest {
8669        type Borrowed<'a> = &'a mut Self;
8670        fn take_or_borrow<'a>(
8671            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8672        ) -> Self::Borrowed<'a> {
8673            value
8674        }
8675    }
8676
8677    unsafe impl fidl::encoding::TypeMarker for ControllerStartRequest {
8678        type Owned = Self;
8679
8680        #[inline(always)]
8681        fn inline_align(_context: fidl::encoding::Context) -> usize {
8682            8
8683        }
8684
8685        #[inline(always)]
8686        fn inline_size(_context: fidl::encoding::Context) -> usize {
8687            24
8688        }
8689    }
8690
8691    unsafe impl
8692        fidl::encoding::Encode<
8693            ControllerStartRequest,
8694            fidl::encoding::DefaultFuchsiaResourceDialect,
8695        > for &mut ControllerStartRequest
8696    {
8697        #[inline]
8698        unsafe fn encode(
8699            self,
8700            encoder: &mut fidl::encoding::Encoder<
8701                '_,
8702                fidl::encoding::DefaultFuchsiaResourceDialect,
8703            >,
8704            offset: usize,
8705            _depth: fidl::encoding::Depth,
8706        ) -> fidl::Result<()> {
8707            encoder.debug_check_bounds::<ControllerStartRequest>(offset);
8708            // Delegate to tuple encoding.
8709            fidl::encoding::Encode::<ControllerStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8710                (
8711                    <StartChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
8712                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.execution_controller),
8713                ),
8714                encoder, offset, _depth
8715            )
8716        }
8717    }
8718    unsafe impl<
8719        T0: fidl::encoding::Encode<StartChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
8720        T1: fidl::encoding::Encode<
8721                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
8722                fidl::encoding::DefaultFuchsiaResourceDialect,
8723            >,
8724    >
8725        fidl::encoding::Encode<
8726            ControllerStartRequest,
8727            fidl::encoding::DefaultFuchsiaResourceDialect,
8728        > for (T0, T1)
8729    {
8730        #[inline]
8731        unsafe fn encode(
8732            self,
8733            encoder: &mut fidl::encoding::Encoder<
8734                '_,
8735                fidl::encoding::DefaultFuchsiaResourceDialect,
8736            >,
8737            offset: usize,
8738            depth: fidl::encoding::Depth,
8739        ) -> fidl::Result<()> {
8740            encoder.debug_check_bounds::<ControllerStartRequest>(offset);
8741            // Zero out padding regions. There's no need to apply masks
8742            // because the unmasked parts will be overwritten by fields.
8743            unsafe {
8744                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8745                (ptr as *mut u64).write_unaligned(0);
8746            }
8747            // Write the fields.
8748            self.0.encode(encoder, offset + 0, depth)?;
8749            self.1.encode(encoder, offset + 16, depth)?;
8750            Ok(())
8751        }
8752    }
8753
8754    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8755        for ControllerStartRequest
8756    {
8757        #[inline(always)]
8758        fn new_empty() -> Self {
8759            Self {
8760                args: fidl::new_empty!(
8761                    StartChildArgs,
8762                    fidl::encoding::DefaultFuchsiaResourceDialect
8763                ),
8764                execution_controller: fidl::new_empty!(
8765                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
8766                    fidl::encoding::DefaultFuchsiaResourceDialect
8767                ),
8768            }
8769        }
8770
8771        #[inline]
8772        unsafe fn decode(
8773            &mut self,
8774            decoder: &mut fidl::encoding::Decoder<
8775                '_,
8776                fidl::encoding::DefaultFuchsiaResourceDialect,
8777            >,
8778            offset: usize,
8779            _depth: fidl::encoding::Depth,
8780        ) -> fidl::Result<()> {
8781            decoder.debug_check_bounds::<Self>(offset);
8782            // Verify that padding bytes are zero.
8783            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8784            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8785            let mask = 0xffffffff00000000u64;
8786            let maskedval = padval & mask;
8787            if maskedval != 0 {
8788                return Err(fidl::Error::NonZeroPadding {
8789                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8790                });
8791            }
8792            fidl::decode!(
8793                StartChildArgs,
8794                fidl::encoding::DefaultFuchsiaResourceDialect,
8795                &mut self.args,
8796                decoder,
8797                offset + 0,
8798                _depth
8799            )?;
8800            fidl::decode!(
8801                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
8802                fidl::encoding::DefaultFuchsiaResourceDialect,
8803                &mut self.execution_controller,
8804                decoder,
8805                offset + 16,
8806                _depth
8807            )?;
8808            Ok(())
8809        }
8810    }
8811
8812    impl fidl::encoding::ResourceTypeMarker for ControllerGetExposedDictionaryResponse {
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 ControllerGetExposedDictionaryResponse {
8822        type Owned = Self;
8823
8824        #[inline(always)]
8825        fn inline_align(_context: fidl::encoding::Context) -> usize {
8826            4
8827        }
8828
8829        #[inline(always)]
8830        fn inline_size(_context: fidl::encoding::Context) -> usize {
8831            4
8832        }
8833    }
8834
8835    unsafe impl
8836        fidl::encoding::Encode<
8837            ControllerGetExposedDictionaryResponse,
8838            fidl::encoding::DefaultFuchsiaResourceDialect,
8839        > for &mut ControllerGetExposedDictionaryResponse
8840    {
8841        #[inline]
8842        unsafe fn encode(
8843            self,
8844            encoder: &mut fidl::encoding::Encoder<
8845                '_,
8846                fidl::encoding::DefaultFuchsiaResourceDialect,
8847            >,
8848            offset: usize,
8849            _depth: fidl::encoding::Depth,
8850        ) -> fidl::Result<()> {
8851            encoder.debug_check_bounds::<ControllerGetExposedDictionaryResponse>(offset);
8852            // Delegate to tuple encoding.
8853            fidl::encoding::Encode::<ControllerGetExposedDictionaryResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8854                (
8855                    <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
8856                ),
8857                encoder, offset, _depth
8858            )
8859        }
8860    }
8861    unsafe impl<
8862        T0: fidl::encoding::Encode<
8863                fidl_fuchsia_component_sandbox::DictionaryRef,
8864                fidl::encoding::DefaultFuchsiaResourceDialect,
8865            >,
8866    >
8867        fidl::encoding::Encode<
8868            ControllerGetExposedDictionaryResponse,
8869            fidl::encoding::DefaultFuchsiaResourceDialect,
8870        > for (T0,)
8871    {
8872        #[inline]
8873        unsafe fn encode(
8874            self,
8875            encoder: &mut fidl::encoding::Encoder<
8876                '_,
8877                fidl::encoding::DefaultFuchsiaResourceDialect,
8878            >,
8879            offset: usize,
8880            depth: fidl::encoding::Depth,
8881        ) -> fidl::Result<()> {
8882            encoder.debug_check_bounds::<ControllerGetExposedDictionaryResponse>(offset);
8883            // Zero out padding regions. There's no need to apply masks
8884            // because the unmasked parts will be overwritten by fields.
8885            // Write the fields.
8886            self.0.encode(encoder, offset + 0, depth)?;
8887            Ok(())
8888        }
8889    }
8890
8891    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8892        for ControllerGetExposedDictionaryResponse
8893    {
8894        #[inline(always)]
8895        fn new_empty() -> Self {
8896            Self {
8897                dictionary: fidl::new_empty!(
8898                    fidl_fuchsia_component_sandbox::DictionaryRef,
8899                    fidl::encoding::DefaultFuchsiaResourceDialect
8900                ),
8901            }
8902        }
8903
8904        #[inline]
8905        unsafe fn decode(
8906            &mut self,
8907            decoder: &mut fidl::encoding::Decoder<
8908                '_,
8909                fidl::encoding::DefaultFuchsiaResourceDialect,
8910            >,
8911            offset: usize,
8912            _depth: fidl::encoding::Depth,
8913        ) -> fidl::Result<()> {
8914            decoder.debug_check_bounds::<Self>(offset);
8915            // Verify that padding bytes are zero.
8916            fidl::decode!(
8917                fidl_fuchsia_component_sandbox::DictionaryRef,
8918                fidl::encoding::DefaultFuchsiaResourceDialect,
8919                &mut self.dictionary,
8920                decoder,
8921                offset + 0,
8922                _depth
8923            )?;
8924            Ok(())
8925        }
8926    }
8927
8928    impl fidl::encoding::ResourceTypeMarker for ControllerGetOutputDictionaryResponse {
8929        type Borrowed<'a> = &'a mut Self;
8930        fn take_or_borrow<'a>(
8931            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8932        ) -> Self::Borrowed<'a> {
8933            value
8934        }
8935    }
8936
8937    unsafe impl fidl::encoding::TypeMarker for ControllerGetOutputDictionaryResponse {
8938        type Owned = Self;
8939
8940        #[inline(always)]
8941        fn inline_align(_context: fidl::encoding::Context) -> usize {
8942            4
8943        }
8944
8945        #[inline(always)]
8946        fn inline_size(_context: fidl::encoding::Context) -> usize {
8947            4
8948        }
8949    }
8950
8951    unsafe impl
8952        fidl::encoding::Encode<
8953            ControllerGetOutputDictionaryResponse,
8954            fidl::encoding::DefaultFuchsiaResourceDialect,
8955        > for &mut ControllerGetOutputDictionaryResponse
8956    {
8957        #[inline]
8958        unsafe fn encode(
8959            self,
8960            encoder: &mut fidl::encoding::Encoder<
8961                '_,
8962                fidl::encoding::DefaultFuchsiaResourceDialect,
8963            >,
8964            offset: usize,
8965            _depth: fidl::encoding::Depth,
8966        ) -> fidl::Result<()> {
8967            encoder.debug_check_bounds::<ControllerGetOutputDictionaryResponse>(offset);
8968            // Delegate to tuple encoding.
8969            fidl::encoding::Encode::<
8970                ControllerGetOutputDictionaryResponse,
8971                fidl::encoding::DefaultFuchsiaResourceDialect,
8972            >::encode(
8973                (<fidl::encoding::HandleType<
8974                    fidl::EventPair,
8975                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8976                    2147483648,
8977                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8978                    &mut self.dictionary
8979                ),),
8980                encoder,
8981                offset,
8982                _depth,
8983            )
8984        }
8985    }
8986    unsafe impl<
8987        T0: fidl::encoding::Encode<
8988                fidl::encoding::HandleType<
8989                    fidl::EventPair,
8990                    { fidl::ObjectType::EVENTPAIR.into_raw() },
8991                    2147483648,
8992                >,
8993                fidl::encoding::DefaultFuchsiaResourceDialect,
8994            >,
8995    >
8996        fidl::encoding::Encode<
8997            ControllerGetOutputDictionaryResponse,
8998            fidl::encoding::DefaultFuchsiaResourceDialect,
8999        > for (T0,)
9000    {
9001        #[inline]
9002        unsafe fn encode(
9003            self,
9004            encoder: &mut fidl::encoding::Encoder<
9005                '_,
9006                fidl::encoding::DefaultFuchsiaResourceDialect,
9007            >,
9008            offset: usize,
9009            depth: fidl::encoding::Depth,
9010        ) -> fidl::Result<()> {
9011            encoder.debug_check_bounds::<ControllerGetOutputDictionaryResponse>(offset);
9012            // Zero out padding regions. There's no need to apply masks
9013            // because the unmasked parts will be overwritten by fields.
9014            // Write the fields.
9015            self.0.encode(encoder, offset + 0, depth)?;
9016            Ok(())
9017        }
9018    }
9019
9020    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9021        for ControllerGetOutputDictionaryResponse
9022    {
9023        #[inline(always)]
9024        fn new_empty() -> Self {
9025            Self {
9026                dictionary: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9027            }
9028        }
9029
9030        #[inline]
9031        unsafe fn decode(
9032            &mut self,
9033            decoder: &mut fidl::encoding::Decoder<
9034                '_,
9035                fidl::encoding::DefaultFuchsiaResourceDialect,
9036            >,
9037            offset: usize,
9038            _depth: fidl::encoding::Depth,
9039        ) -> fidl::Result<()> {
9040            decoder.debug_check_bounds::<Self>(offset);
9041            // Verify that padding bytes are zero.
9042            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.dictionary, decoder, offset + 0, _depth)?;
9043            Ok(())
9044        }
9045    }
9046
9047    impl fidl::encoding::ResourceTypeMarker for ControllerIsStartedResponse {
9048        type Borrowed<'a> = &'a mut Self;
9049        fn take_or_borrow<'a>(
9050            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9051        ) -> Self::Borrowed<'a> {
9052            value
9053        }
9054    }
9055
9056    unsafe impl fidl::encoding::TypeMarker for ControllerIsStartedResponse {
9057        type Owned = Self;
9058
9059        #[inline(always)]
9060        fn inline_align(_context: fidl::encoding::Context) -> usize {
9061            1
9062        }
9063
9064        #[inline(always)]
9065        fn inline_size(_context: fidl::encoding::Context) -> usize {
9066            1
9067        }
9068    }
9069
9070    unsafe impl
9071        fidl::encoding::Encode<
9072            ControllerIsStartedResponse,
9073            fidl::encoding::DefaultFuchsiaResourceDialect,
9074        > for &mut ControllerIsStartedResponse
9075    {
9076        #[inline]
9077        unsafe fn encode(
9078            self,
9079            encoder: &mut fidl::encoding::Encoder<
9080                '_,
9081                fidl::encoding::DefaultFuchsiaResourceDialect,
9082            >,
9083            offset: usize,
9084            _depth: fidl::encoding::Depth,
9085        ) -> fidl::Result<()> {
9086            encoder.debug_check_bounds::<ControllerIsStartedResponse>(offset);
9087            // Delegate to tuple encoding.
9088            fidl::encoding::Encode::<
9089                ControllerIsStartedResponse,
9090                fidl::encoding::DefaultFuchsiaResourceDialect,
9091            >::encode(
9092                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_started),),
9093                encoder,
9094                offset,
9095                _depth,
9096            )
9097        }
9098    }
9099    unsafe impl<T0: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>>
9100        fidl::encoding::Encode<
9101            ControllerIsStartedResponse,
9102            fidl::encoding::DefaultFuchsiaResourceDialect,
9103        > for (T0,)
9104    {
9105        #[inline]
9106        unsafe fn encode(
9107            self,
9108            encoder: &mut fidl::encoding::Encoder<
9109                '_,
9110                fidl::encoding::DefaultFuchsiaResourceDialect,
9111            >,
9112            offset: usize,
9113            depth: fidl::encoding::Depth,
9114        ) -> fidl::Result<()> {
9115            encoder.debug_check_bounds::<ControllerIsStartedResponse>(offset);
9116            // Zero out padding regions. There's no need to apply masks
9117            // because the unmasked parts will be overwritten by fields.
9118            // Write the fields.
9119            self.0.encode(encoder, offset + 0, depth)?;
9120            Ok(())
9121        }
9122    }
9123
9124    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9125        for ControllerIsStartedResponse
9126    {
9127        #[inline(always)]
9128        fn new_empty() -> Self {
9129            Self {
9130                is_started: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
9131            }
9132        }
9133
9134        #[inline]
9135        unsafe fn decode(
9136            &mut self,
9137            decoder: &mut fidl::encoding::Decoder<
9138                '_,
9139                fidl::encoding::DefaultFuchsiaResourceDialect,
9140            >,
9141            offset: usize,
9142            _depth: fidl::encoding::Depth,
9143        ) -> fidl::Result<()> {
9144            decoder.debug_check_bounds::<Self>(offset);
9145            // Verify that padding bytes are zero.
9146            fidl::decode!(
9147                bool,
9148                fidl::encoding::DefaultFuchsiaResourceDialect,
9149                &mut self.is_started,
9150                decoder,
9151                offset + 0,
9152                _depth
9153            )?;
9154            Ok(())
9155        }
9156    }
9157
9158    impl fidl::encoding::ResourceTypeMarker for EventStreamGetNextResponse {
9159        type Borrowed<'a> = &'a mut Self;
9160        fn take_or_borrow<'a>(
9161            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9162        ) -> Self::Borrowed<'a> {
9163            value
9164        }
9165    }
9166
9167    unsafe impl fidl::encoding::TypeMarker for EventStreamGetNextResponse {
9168        type Owned = Self;
9169
9170        #[inline(always)]
9171        fn inline_align(_context: fidl::encoding::Context) -> usize {
9172            8
9173        }
9174
9175        #[inline(always)]
9176        fn inline_size(_context: fidl::encoding::Context) -> usize {
9177            16
9178        }
9179    }
9180
9181    unsafe impl
9182        fidl::encoding::Encode<
9183            EventStreamGetNextResponse,
9184            fidl::encoding::DefaultFuchsiaResourceDialect,
9185        > for &mut EventStreamGetNextResponse
9186    {
9187        #[inline]
9188        unsafe fn encode(
9189            self,
9190            encoder: &mut fidl::encoding::Encoder<
9191                '_,
9192                fidl::encoding::DefaultFuchsiaResourceDialect,
9193            >,
9194            offset: usize,
9195            _depth: fidl::encoding::Depth,
9196        ) -> fidl::Result<()> {
9197            encoder.debug_check_bounds::<EventStreamGetNextResponse>(offset);
9198            // Delegate to tuple encoding.
9199            fidl::encoding::Encode::<EventStreamGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9200                (
9201                    <fidl::encoding::UnboundedVector<Event> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.events),
9202                ),
9203                encoder, offset, _depth
9204            )
9205        }
9206    }
9207    unsafe impl<
9208        T0: fidl::encoding::Encode<
9209                fidl::encoding::UnboundedVector<Event>,
9210                fidl::encoding::DefaultFuchsiaResourceDialect,
9211            >,
9212    >
9213        fidl::encoding::Encode<
9214            EventStreamGetNextResponse,
9215            fidl::encoding::DefaultFuchsiaResourceDialect,
9216        > for (T0,)
9217    {
9218        #[inline]
9219        unsafe fn encode(
9220            self,
9221            encoder: &mut fidl::encoding::Encoder<
9222                '_,
9223                fidl::encoding::DefaultFuchsiaResourceDialect,
9224            >,
9225            offset: usize,
9226            depth: fidl::encoding::Depth,
9227        ) -> fidl::Result<()> {
9228            encoder.debug_check_bounds::<EventStreamGetNextResponse>(offset);
9229            // Zero out padding regions. There's no need to apply masks
9230            // because the unmasked parts will be overwritten by fields.
9231            // Write the fields.
9232            self.0.encode(encoder, offset + 0, depth)?;
9233            Ok(())
9234        }
9235    }
9236
9237    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9238        for EventStreamGetNextResponse
9239    {
9240        #[inline(always)]
9241        fn new_empty() -> Self {
9242            Self {
9243                events: fidl::new_empty!(
9244                    fidl::encoding::UnboundedVector<Event>,
9245                    fidl::encoding::DefaultFuchsiaResourceDialect
9246                ),
9247            }
9248        }
9249
9250        #[inline]
9251        unsafe fn decode(
9252            &mut self,
9253            decoder: &mut fidl::encoding::Decoder<
9254                '_,
9255                fidl::encoding::DefaultFuchsiaResourceDialect,
9256            >,
9257            offset: usize,
9258            _depth: fidl::encoding::Depth,
9259        ) -> fidl::Result<()> {
9260            decoder.debug_check_bounds::<Self>(offset);
9261            // Verify that padding bytes are zero.
9262            fidl::decode!(
9263                fidl::encoding::UnboundedVector<Event>,
9264                fidl::encoding::DefaultFuchsiaResourceDialect,
9265                &mut self.events,
9266                decoder,
9267                offset + 0,
9268                _depth
9269            )?;
9270            Ok(())
9271        }
9272    }
9273
9274    impl fidl::encoding::ResourceTypeMarker for IntrospectorGetMonikerRequest {
9275        type Borrowed<'a> = &'a mut Self;
9276        fn take_or_borrow<'a>(
9277            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9278        ) -> Self::Borrowed<'a> {
9279            value
9280        }
9281    }
9282
9283    unsafe impl fidl::encoding::TypeMarker for IntrospectorGetMonikerRequest {
9284        type Owned = Self;
9285
9286        #[inline(always)]
9287        fn inline_align(_context: fidl::encoding::Context) -> usize {
9288            4
9289        }
9290
9291        #[inline(always)]
9292        fn inline_size(_context: fidl::encoding::Context) -> usize {
9293            4
9294        }
9295    }
9296
9297    unsafe impl
9298        fidl::encoding::Encode<
9299            IntrospectorGetMonikerRequest,
9300            fidl::encoding::DefaultFuchsiaResourceDialect,
9301        > for &mut IntrospectorGetMonikerRequest
9302    {
9303        #[inline]
9304        unsafe fn encode(
9305            self,
9306            encoder: &mut fidl::encoding::Encoder<
9307                '_,
9308                fidl::encoding::DefaultFuchsiaResourceDialect,
9309            >,
9310            offset: usize,
9311            _depth: fidl::encoding::Depth,
9312        ) -> fidl::Result<()> {
9313            encoder.debug_check_bounds::<IntrospectorGetMonikerRequest>(offset);
9314            // Delegate to tuple encoding.
9315            fidl::encoding::Encode::<
9316                IntrospectorGetMonikerRequest,
9317                fidl::encoding::DefaultFuchsiaResourceDialect,
9318            >::encode(
9319                (<fidl::encoding::HandleType<
9320                    fidl::Event,
9321                    { fidl::ObjectType::EVENT.into_raw() },
9322                    2147483648,
9323                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9324                    &mut self.component_instance,
9325                ),),
9326                encoder,
9327                offset,
9328                _depth,
9329            )
9330        }
9331    }
9332    unsafe impl<
9333        T0: fidl::encoding::Encode<
9334                fidl::encoding::HandleType<
9335                    fidl::Event,
9336                    { fidl::ObjectType::EVENT.into_raw() },
9337                    2147483648,
9338                >,
9339                fidl::encoding::DefaultFuchsiaResourceDialect,
9340            >,
9341    >
9342        fidl::encoding::Encode<
9343            IntrospectorGetMonikerRequest,
9344            fidl::encoding::DefaultFuchsiaResourceDialect,
9345        > for (T0,)
9346    {
9347        #[inline]
9348        unsafe fn encode(
9349            self,
9350            encoder: &mut fidl::encoding::Encoder<
9351                '_,
9352                fidl::encoding::DefaultFuchsiaResourceDialect,
9353            >,
9354            offset: usize,
9355            depth: fidl::encoding::Depth,
9356        ) -> fidl::Result<()> {
9357            encoder.debug_check_bounds::<IntrospectorGetMonikerRequest>(offset);
9358            // Zero out padding regions. There's no need to apply masks
9359            // because the unmasked parts will be overwritten by fields.
9360            // Write the fields.
9361            self.0.encode(encoder, offset + 0, depth)?;
9362            Ok(())
9363        }
9364    }
9365
9366    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9367        for IntrospectorGetMonikerRequest
9368    {
9369        #[inline(always)]
9370        fn new_empty() -> Self {
9371            Self {
9372                component_instance: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9373            }
9374        }
9375
9376        #[inline]
9377        unsafe fn decode(
9378            &mut self,
9379            decoder: &mut fidl::encoding::Decoder<
9380                '_,
9381                fidl::encoding::DefaultFuchsiaResourceDialect,
9382            >,
9383            offset: usize,
9384            _depth: fidl::encoding::Depth,
9385        ) -> fidl::Result<()> {
9386            decoder.debug_check_bounds::<Self>(offset);
9387            // Verify that padding bytes are zero.
9388            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.component_instance, decoder, offset + 0, _depth)?;
9389            Ok(())
9390        }
9391    }
9392
9393    impl fidl::encoding::ResourceTypeMarker for NamespaceCreate2Request {
9394        type Borrowed<'a> = &'a mut Self;
9395        fn take_or_borrow<'a>(
9396            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9397        ) -> Self::Borrowed<'a> {
9398            value
9399        }
9400    }
9401
9402    unsafe impl fidl::encoding::TypeMarker for NamespaceCreate2Request {
9403        type Owned = Self;
9404
9405        #[inline(always)]
9406        fn inline_align(_context: fidl::encoding::Context) -> usize {
9407            8
9408        }
9409
9410        #[inline(always)]
9411        fn inline_size(_context: fidl::encoding::Context) -> usize {
9412            16
9413        }
9414    }
9415
9416    unsafe impl
9417        fidl::encoding::Encode<
9418            NamespaceCreate2Request,
9419            fidl::encoding::DefaultFuchsiaResourceDialect,
9420        > for &mut NamespaceCreate2Request
9421    {
9422        #[inline]
9423        unsafe fn encode(
9424            self,
9425            encoder: &mut fidl::encoding::Encoder<
9426                '_,
9427                fidl::encoding::DefaultFuchsiaResourceDialect,
9428            >,
9429            offset: usize,
9430            _depth: fidl::encoding::Depth,
9431        ) -> fidl::Result<()> {
9432            encoder.debug_check_bounds::<NamespaceCreate2Request>(offset);
9433            // Delegate to tuple encoding.
9434            fidl::encoding::Encode::<NamespaceCreate2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9435                (
9436                    <fidl::encoding::UnboundedVector<NamespaceInputEntry2> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
9437                ),
9438                encoder, offset, _depth
9439            )
9440        }
9441    }
9442    unsafe impl<
9443        T0: fidl::encoding::Encode<
9444                fidl::encoding::UnboundedVector<NamespaceInputEntry2>,
9445                fidl::encoding::DefaultFuchsiaResourceDialect,
9446            >,
9447    >
9448        fidl::encoding::Encode<
9449            NamespaceCreate2Request,
9450            fidl::encoding::DefaultFuchsiaResourceDialect,
9451        > for (T0,)
9452    {
9453        #[inline]
9454        unsafe fn encode(
9455            self,
9456            encoder: &mut fidl::encoding::Encoder<
9457                '_,
9458                fidl::encoding::DefaultFuchsiaResourceDialect,
9459            >,
9460            offset: usize,
9461            depth: fidl::encoding::Depth,
9462        ) -> fidl::Result<()> {
9463            encoder.debug_check_bounds::<NamespaceCreate2Request>(offset);
9464            // Zero out padding regions. There's no need to apply masks
9465            // because the unmasked parts will be overwritten by fields.
9466            // Write the fields.
9467            self.0.encode(encoder, offset + 0, depth)?;
9468            Ok(())
9469        }
9470    }
9471
9472    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9473        for NamespaceCreate2Request
9474    {
9475        #[inline(always)]
9476        fn new_empty() -> Self {
9477            Self {
9478                entries: fidl::new_empty!(
9479                    fidl::encoding::UnboundedVector<NamespaceInputEntry2>,
9480                    fidl::encoding::DefaultFuchsiaResourceDialect
9481                ),
9482            }
9483        }
9484
9485        #[inline]
9486        unsafe fn decode(
9487            &mut self,
9488            decoder: &mut fidl::encoding::Decoder<
9489                '_,
9490                fidl::encoding::DefaultFuchsiaResourceDialect,
9491            >,
9492            offset: usize,
9493            _depth: fidl::encoding::Depth,
9494        ) -> fidl::Result<()> {
9495            decoder.debug_check_bounds::<Self>(offset);
9496            // Verify that padding bytes are zero.
9497            fidl::decode!(
9498                fidl::encoding::UnboundedVector<NamespaceInputEntry2>,
9499                fidl::encoding::DefaultFuchsiaResourceDialect,
9500                &mut self.entries,
9501                decoder,
9502                offset + 0,
9503                _depth
9504            )?;
9505            Ok(())
9506        }
9507    }
9508
9509    impl fidl::encoding::ResourceTypeMarker for NamespaceCreateRequest {
9510        type Borrowed<'a> = &'a mut Self;
9511        fn take_or_borrow<'a>(
9512            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9513        ) -> Self::Borrowed<'a> {
9514            value
9515        }
9516    }
9517
9518    unsafe impl fidl::encoding::TypeMarker for NamespaceCreateRequest {
9519        type Owned = Self;
9520
9521        #[inline(always)]
9522        fn inline_align(_context: fidl::encoding::Context) -> usize {
9523            8
9524        }
9525
9526        #[inline(always)]
9527        fn inline_size(_context: fidl::encoding::Context) -> usize {
9528            16
9529        }
9530    }
9531
9532    unsafe impl
9533        fidl::encoding::Encode<
9534            NamespaceCreateRequest,
9535            fidl::encoding::DefaultFuchsiaResourceDialect,
9536        > for &mut NamespaceCreateRequest
9537    {
9538        #[inline]
9539        unsafe fn encode(
9540            self,
9541            encoder: &mut fidl::encoding::Encoder<
9542                '_,
9543                fidl::encoding::DefaultFuchsiaResourceDialect,
9544            >,
9545            offset: usize,
9546            _depth: fidl::encoding::Depth,
9547        ) -> fidl::Result<()> {
9548            encoder.debug_check_bounds::<NamespaceCreateRequest>(offset);
9549            // Delegate to tuple encoding.
9550            fidl::encoding::Encode::<NamespaceCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9551                (
9552                    <fidl::encoding::UnboundedVector<NamespaceInputEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
9553                ),
9554                encoder, offset, _depth
9555            )
9556        }
9557    }
9558    unsafe impl<
9559        T0: fidl::encoding::Encode<
9560                fidl::encoding::UnboundedVector<NamespaceInputEntry>,
9561                fidl::encoding::DefaultFuchsiaResourceDialect,
9562            >,
9563    >
9564        fidl::encoding::Encode<
9565            NamespaceCreateRequest,
9566            fidl::encoding::DefaultFuchsiaResourceDialect,
9567        > for (T0,)
9568    {
9569        #[inline]
9570        unsafe fn encode(
9571            self,
9572            encoder: &mut fidl::encoding::Encoder<
9573                '_,
9574                fidl::encoding::DefaultFuchsiaResourceDialect,
9575            >,
9576            offset: usize,
9577            depth: fidl::encoding::Depth,
9578        ) -> fidl::Result<()> {
9579            encoder.debug_check_bounds::<NamespaceCreateRequest>(offset);
9580            // Zero out padding regions. There's no need to apply masks
9581            // because the unmasked parts will be overwritten by fields.
9582            // Write the fields.
9583            self.0.encode(encoder, offset + 0, depth)?;
9584            Ok(())
9585        }
9586    }
9587
9588    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9589        for NamespaceCreateRequest
9590    {
9591        #[inline(always)]
9592        fn new_empty() -> Self {
9593            Self {
9594                entries: fidl::new_empty!(
9595                    fidl::encoding::UnboundedVector<NamespaceInputEntry>,
9596                    fidl::encoding::DefaultFuchsiaResourceDialect
9597                ),
9598            }
9599        }
9600
9601        #[inline]
9602        unsafe fn decode(
9603            &mut self,
9604            decoder: &mut fidl::encoding::Decoder<
9605                '_,
9606                fidl::encoding::DefaultFuchsiaResourceDialect,
9607            >,
9608            offset: usize,
9609            _depth: fidl::encoding::Depth,
9610        ) -> fidl::Result<()> {
9611            decoder.debug_check_bounds::<Self>(offset);
9612            // Verify that padding bytes are zero.
9613            fidl::decode!(
9614                fidl::encoding::UnboundedVector<NamespaceInputEntry>,
9615                fidl::encoding::DefaultFuchsiaResourceDialect,
9616                &mut self.entries,
9617                decoder,
9618                offset + 0,
9619                _depth
9620            )?;
9621            Ok(())
9622        }
9623    }
9624
9625    impl fidl::encoding::ResourceTypeMarker for NamespaceInputEntry {
9626        type Borrowed<'a> = &'a mut Self;
9627        fn take_or_borrow<'a>(
9628            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9629        ) -> Self::Borrowed<'a> {
9630            value
9631        }
9632    }
9633
9634    unsafe impl fidl::encoding::TypeMarker for NamespaceInputEntry {
9635        type Owned = Self;
9636
9637        #[inline(always)]
9638        fn inline_align(_context: fidl::encoding::Context) -> usize {
9639            8
9640        }
9641
9642        #[inline(always)]
9643        fn inline_size(_context: fidl::encoding::Context) -> usize {
9644            24
9645        }
9646    }
9647
9648    unsafe impl
9649        fidl::encoding::Encode<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
9650        for &mut NamespaceInputEntry
9651    {
9652        #[inline]
9653        unsafe fn encode(
9654            self,
9655            encoder: &mut fidl::encoding::Encoder<
9656                '_,
9657                fidl::encoding::DefaultFuchsiaResourceDialect,
9658            >,
9659            offset: usize,
9660            _depth: fidl::encoding::Depth,
9661        ) -> fidl::Result<()> {
9662            encoder.debug_check_bounds::<NamespaceInputEntry>(offset);
9663            // Delegate to tuple encoding.
9664            fidl::encoding::Encode::<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9665                (
9666                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
9667                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
9668                ),
9669                encoder, offset, _depth
9670            )
9671        }
9672    }
9673    unsafe impl<
9674        T0: fidl::encoding::Encode<
9675                fidl::encoding::BoundedString<4095>,
9676                fidl::encoding::DefaultFuchsiaResourceDialect,
9677            >,
9678        T1: fidl::encoding::Encode<
9679                fidl::encoding::Endpoint<
9680                    fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
9681                >,
9682                fidl::encoding::DefaultFuchsiaResourceDialect,
9683            >,
9684    > fidl::encoding::Encode<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
9685        for (T0, T1)
9686    {
9687        #[inline]
9688        unsafe fn encode(
9689            self,
9690            encoder: &mut fidl::encoding::Encoder<
9691                '_,
9692                fidl::encoding::DefaultFuchsiaResourceDialect,
9693            >,
9694            offset: usize,
9695            depth: fidl::encoding::Depth,
9696        ) -> fidl::Result<()> {
9697            encoder.debug_check_bounds::<NamespaceInputEntry>(offset);
9698            // Zero out padding regions. There's no need to apply masks
9699            // because the unmasked parts will be overwritten by fields.
9700            unsafe {
9701                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9702                (ptr as *mut u64).write_unaligned(0);
9703            }
9704            // Write the fields.
9705            self.0.encode(encoder, offset + 0, depth)?;
9706            self.1.encode(encoder, offset + 16, depth)?;
9707            Ok(())
9708        }
9709    }
9710
9711    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9712        for NamespaceInputEntry
9713    {
9714        #[inline(always)]
9715        fn new_empty() -> Self {
9716            Self {
9717                path: fidl::new_empty!(
9718                    fidl::encoding::BoundedString<4095>,
9719                    fidl::encoding::DefaultFuchsiaResourceDialect
9720                ),
9721                dictionary: fidl::new_empty!(
9722                    fidl::encoding::Endpoint<
9723                        fidl::endpoints::ClientEnd<
9724                            fidl_fuchsia_component_sandbox::DictionaryMarker,
9725                        >,
9726                    >,
9727                    fidl::encoding::DefaultFuchsiaResourceDialect
9728                ),
9729            }
9730        }
9731
9732        #[inline]
9733        unsafe fn decode(
9734            &mut self,
9735            decoder: &mut fidl::encoding::Decoder<
9736                '_,
9737                fidl::encoding::DefaultFuchsiaResourceDialect,
9738            >,
9739            offset: usize,
9740            _depth: fidl::encoding::Depth,
9741        ) -> fidl::Result<()> {
9742            decoder.debug_check_bounds::<Self>(offset);
9743            // Verify that padding bytes are zero.
9744            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9745            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9746            let mask = 0xffffffff00000000u64;
9747            let maskedval = padval & mask;
9748            if maskedval != 0 {
9749                return Err(fidl::Error::NonZeroPadding {
9750                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9751                });
9752            }
9753            fidl::decode!(
9754                fidl::encoding::BoundedString<4095>,
9755                fidl::encoding::DefaultFuchsiaResourceDialect,
9756                &mut self.path,
9757                decoder,
9758                offset + 0,
9759                _depth
9760            )?;
9761            fidl::decode!(
9762                fidl::encoding::Endpoint<
9763                    fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
9764                >,
9765                fidl::encoding::DefaultFuchsiaResourceDialect,
9766                &mut self.dictionary,
9767                decoder,
9768                offset + 16,
9769                _depth
9770            )?;
9771            Ok(())
9772        }
9773    }
9774
9775    impl fidl::encoding::ResourceTypeMarker for NamespaceInputEntry2 {
9776        type Borrowed<'a> = &'a mut Self;
9777        fn take_or_borrow<'a>(
9778            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9779        ) -> Self::Borrowed<'a> {
9780            value
9781        }
9782    }
9783
9784    unsafe impl fidl::encoding::TypeMarker for NamespaceInputEntry2 {
9785        type Owned = Self;
9786
9787        #[inline(always)]
9788        fn inline_align(_context: fidl::encoding::Context) -> usize {
9789            8
9790        }
9791
9792        #[inline(always)]
9793        fn inline_size(_context: fidl::encoding::Context) -> usize {
9794            24
9795        }
9796    }
9797
9798    unsafe impl
9799        fidl::encoding::Encode<NamespaceInputEntry2, fidl::encoding::DefaultFuchsiaResourceDialect>
9800        for &mut NamespaceInputEntry2
9801    {
9802        #[inline]
9803        unsafe fn encode(
9804            self,
9805            encoder: &mut fidl::encoding::Encoder<
9806                '_,
9807                fidl::encoding::DefaultFuchsiaResourceDialect,
9808            >,
9809            offset: usize,
9810            _depth: fidl::encoding::Depth,
9811        ) -> fidl::Result<()> {
9812            encoder.debug_check_bounds::<NamespaceInputEntry2>(offset);
9813            // Delegate to tuple encoding.
9814            fidl::encoding::Encode::<NamespaceInputEntry2, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9815                (
9816                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
9817                    <fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.capability),
9818                ),
9819                encoder, offset, _depth
9820            )
9821        }
9822    }
9823    unsafe impl<
9824        T0: fidl::encoding::Encode<
9825                fidl::encoding::BoundedString<4095>,
9826                fidl::encoding::DefaultFuchsiaResourceDialect,
9827            >,
9828        T1: fidl::encoding::Encode<
9829                fidl::encoding::HandleType<
9830                    fidl::EventPair,
9831                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9832                    2147483648,
9833                >,
9834                fidl::encoding::DefaultFuchsiaResourceDialect,
9835            >,
9836    >
9837        fidl::encoding::Encode<NamespaceInputEntry2, fidl::encoding::DefaultFuchsiaResourceDialect>
9838        for (T0, T1)
9839    {
9840        #[inline]
9841        unsafe fn encode(
9842            self,
9843            encoder: &mut fidl::encoding::Encoder<
9844                '_,
9845                fidl::encoding::DefaultFuchsiaResourceDialect,
9846            >,
9847            offset: usize,
9848            depth: fidl::encoding::Depth,
9849        ) -> fidl::Result<()> {
9850            encoder.debug_check_bounds::<NamespaceInputEntry2>(offset);
9851            // Zero out padding regions. There's no need to apply masks
9852            // because the unmasked parts will be overwritten by fields.
9853            unsafe {
9854                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9855                (ptr as *mut u64).write_unaligned(0);
9856            }
9857            // Write the fields.
9858            self.0.encode(encoder, offset + 0, depth)?;
9859            self.1.encode(encoder, offset + 16, depth)?;
9860            Ok(())
9861        }
9862    }
9863
9864    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9865        for NamespaceInputEntry2
9866    {
9867        #[inline(always)]
9868        fn new_empty() -> Self {
9869            Self {
9870                path: fidl::new_empty!(
9871                    fidl::encoding::BoundedString<4095>,
9872                    fidl::encoding::DefaultFuchsiaResourceDialect
9873                ),
9874                capability: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9875            }
9876        }
9877
9878        #[inline]
9879        unsafe fn decode(
9880            &mut self,
9881            decoder: &mut fidl::encoding::Decoder<
9882                '_,
9883                fidl::encoding::DefaultFuchsiaResourceDialect,
9884            >,
9885            offset: usize,
9886            _depth: fidl::encoding::Depth,
9887        ) -> fidl::Result<()> {
9888            decoder.debug_check_bounds::<Self>(offset);
9889            // Verify that padding bytes are zero.
9890            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9891            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9892            let mask = 0xffffffff00000000u64;
9893            let maskedval = padval & mask;
9894            if maskedval != 0 {
9895                return Err(fidl::Error::NonZeroPadding {
9896                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9897                });
9898            }
9899            fidl::decode!(
9900                fidl::encoding::BoundedString<4095>,
9901                fidl::encoding::DefaultFuchsiaResourceDialect,
9902                &mut self.path,
9903                decoder,
9904                offset + 0,
9905                _depth
9906            )?;
9907            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.capability, decoder, offset + 16, _depth)?;
9908            Ok(())
9909        }
9910    }
9911
9912    impl fidl::encoding::ResourceTypeMarker for NamespaceCreate2Response {
9913        type Borrowed<'a> = &'a mut Self;
9914        fn take_or_borrow<'a>(
9915            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9916        ) -> Self::Borrowed<'a> {
9917            value
9918        }
9919    }
9920
9921    unsafe impl fidl::encoding::TypeMarker for NamespaceCreate2Response {
9922        type Owned = Self;
9923
9924        #[inline(always)]
9925        fn inline_align(_context: fidl::encoding::Context) -> usize {
9926            8
9927        }
9928
9929        #[inline(always)]
9930        fn inline_size(_context: fidl::encoding::Context) -> usize {
9931            16
9932        }
9933    }
9934
9935    unsafe impl
9936        fidl::encoding::Encode<
9937            NamespaceCreate2Response,
9938            fidl::encoding::DefaultFuchsiaResourceDialect,
9939        > for &mut NamespaceCreate2Response
9940    {
9941        #[inline]
9942        unsafe fn encode(
9943            self,
9944            encoder: &mut fidl::encoding::Encoder<
9945                '_,
9946                fidl::encoding::DefaultFuchsiaResourceDialect,
9947            >,
9948            offset: usize,
9949            _depth: fidl::encoding::Depth,
9950        ) -> fidl::Result<()> {
9951            encoder.debug_check_bounds::<NamespaceCreate2Response>(offset);
9952            // Delegate to tuple encoding.
9953            fidl::encoding::Encode::<NamespaceCreate2Response, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9954                (
9955                    <fidl::encoding::UnboundedVector<NamespaceEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
9956                ),
9957                encoder, offset, _depth
9958            )
9959        }
9960    }
9961    unsafe impl<
9962        T0: fidl::encoding::Encode<
9963                fidl::encoding::UnboundedVector<NamespaceEntry>,
9964                fidl::encoding::DefaultFuchsiaResourceDialect,
9965            >,
9966    >
9967        fidl::encoding::Encode<
9968            NamespaceCreate2Response,
9969            fidl::encoding::DefaultFuchsiaResourceDialect,
9970        > for (T0,)
9971    {
9972        #[inline]
9973        unsafe fn encode(
9974            self,
9975            encoder: &mut fidl::encoding::Encoder<
9976                '_,
9977                fidl::encoding::DefaultFuchsiaResourceDialect,
9978            >,
9979            offset: usize,
9980            depth: fidl::encoding::Depth,
9981        ) -> fidl::Result<()> {
9982            encoder.debug_check_bounds::<NamespaceCreate2Response>(offset);
9983            // Zero out padding regions. There's no need to apply masks
9984            // because the unmasked parts will be overwritten by fields.
9985            // Write the fields.
9986            self.0.encode(encoder, offset + 0, depth)?;
9987            Ok(())
9988        }
9989    }
9990
9991    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9992        for NamespaceCreate2Response
9993    {
9994        #[inline(always)]
9995        fn new_empty() -> Self {
9996            Self {
9997                entries: fidl::new_empty!(
9998                    fidl::encoding::UnboundedVector<NamespaceEntry>,
9999                    fidl::encoding::DefaultFuchsiaResourceDialect
10000                ),
10001            }
10002        }
10003
10004        #[inline]
10005        unsafe fn decode(
10006            &mut self,
10007            decoder: &mut fidl::encoding::Decoder<
10008                '_,
10009                fidl::encoding::DefaultFuchsiaResourceDialect,
10010            >,
10011            offset: usize,
10012            _depth: fidl::encoding::Depth,
10013        ) -> fidl::Result<()> {
10014            decoder.debug_check_bounds::<Self>(offset);
10015            // Verify that padding bytes are zero.
10016            fidl::decode!(
10017                fidl::encoding::UnboundedVector<NamespaceEntry>,
10018                fidl::encoding::DefaultFuchsiaResourceDialect,
10019                &mut self.entries,
10020                decoder,
10021                offset + 0,
10022                _depth
10023            )?;
10024            Ok(())
10025        }
10026    }
10027
10028    impl fidl::encoding::ResourceTypeMarker for NamespaceCreateResponse {
10029        type Borrowed<'a> = &'a mut Self;
10030        fn take_or_borrow<'a>(
10031            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10032        ) -> Self::Borrowed<'a> {
10033            value
10034        }
10035    }
10036
10037    unsafe impl fidl::encoding::TypeMarker for NamespaceCreateResponse {
10038        type Owned = Self;
10039
10040        #[inline(always)]
10041        fn inline_align(_context: fidl::encoding::Context) -> usize {
10042            8
10043        }
10044
10045        #[inline(always)]
10046        fn inline_size(_context: fidl::encoding::Context) -> usize {
10047            16
10048        }
10049    }
10050
10051    unsafe impl
10052        fidl::encoding::Encode<
10053            NamespaceCreateResponse,
10054            fidl::encoding::DefaultFuchsiaResourceDialect,
10055        > for &mut NamespaceCreateResponse
10056    {
10057        #[inline]
10058        unsafe fn encode(
10059            self,
10060            encoder: &mut fidl::encoding::Encoder<
10061                '_,
10062                fidl::encoding::DefaultFuchsiaResourceDialect,
10063            >,
10064            offset: usize,
10065            _depth: fidl::encoding::Depth,
10066        ) -> fidl::Result<()> {
10067            encoder.debug_check_bounds::<NamespaceCreateResponse>(offset);
10068            // Delegate to tuple encoding.
10069            fidl::encoding::Encode::<NamespaceCreateResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10070                (
10071                    <fidl::encoding::UnboundedVector<NamespaceEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
10072                ),
10073                encoder, offset, _depth
10074            )
10075        }
10076    }
10077    unsafe impl<
10078        T0: fidl::encoding::Encode<
10079                fidl::encoding::UnboundedVector<NamespaceEntry>,
10080                fidl::encoding::DefaultFuchsiaResourceDialect,
10081            >,
10082    >
10083        fidl::encoding::Encode<
10084            NamespaceCreateResponse,
10085            fidl::encoding::DefaultFuchsiaResourceDialect,
10086        > for (T0,)
10087    {
10088        #[inline]
10089        unsafe fn encode(
10090            self,
10091            encoder: &mut fidl::encoding::Encoder<
10092                '_,
10093                fidl::encoding::DefaultFuchsiaResourceDialect,
10094            >,
10095            offset: usize,
10096            depth: fidl::encoding::Depth,
10097        ) -> fidl::Result<()> {
10098            encoder.debug_check_bounds::<NamespaceCreateResponse>(offset);
10099            // Zero out padding regions. There's no need to apply masks
10100            // because the unmasked parts will be overwritten by fields.
10101            // Write the fields.
10102            self.0.encode(encoder, offset + 0, depth)?;
10103            Ok(())
10104        }
10105    }
10106
10107    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10108        for NamespaceCreateResponse
10109    {
10110        #[inline(always)]
10111        fn new_empty() -> Self {
10112            Self {
10113                entries: fidl::new_empty!(
10114                    fidl::encoding::UnboundedVector<NamespaceEntry>,
10115                    fidl::encoding::DefaultFuchsiaResourceDialect
10116                ),
10117            }
10118        }
10119
10120        #[inline]
10121        unsafe fn decode(
10122            &mut self,
10123            decoder: &mut fidl::encoding::Decoder<
10124                '_,
10125                fidl::encoding::DefaultFuchsiaResourceDialect,
10126            >,
10127            offset: usize,
10128            _depth: fidl::encoding::Depth,
10129        ) -> fidl::Result<()> {
10130            decoder.debug_check_bounds::<Self>(offset);
10131            // Verify that padding bytes are zero.
10132            fidl::decode!(
10133                fidl::encoding::UnboundedVector<NamespaceEntry>,
10134                fidl::encoding::DefaultFuchsiaResourceDialect,
10135                &mut self.entries,
10136                decoder,
10137                offset + 0,
10138                _depth
10139            )?;
10140            Ok(())
10141        }
10142    }
10143
10144    impl fidl::encoding::ResourceTypeMarker for RealmCreateChildRequest {
10145        type Borrowed<'a> = &'a mut Self;
10146        fn take_or_borrow<'a>(
10147            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10148        ) -> Self::Borrowed<'a> {
10149            value
10150        }
10151    }
10152
10153    unsafe impl fidl::encoding::TypeMarker for RealmCreateChildRequest {
10154        type Owned = Self;
10155
10156        #[inline(always)]
10157        fn inline_align(_context: fidl::encoding::Context) -> usize {
10158            8
10159        }
10160
10161        #[inline(always)]
10162        fn inline_size(_context: fidl::encoding::Context) -> usize {
10163            48
10164        }
10165    }
10166
10167    unsafe impl
10168        fidl::encoding::Encode<
10169            RealmCreateChildRequest,
10170            fidl::encoding::DefaultFuchsiaResourceDialect,
10171        > for &mut RealmCreateChildRequest
10172    {
10173        #[inline]
10174        unsafe fn encode(
10175            self,
10176            encoder: &mut fidl::encoding::Encoder<
10177                '_,
10178                fidl::encoding::DefaultFuchsiaResourceDialect,
10179            >,
10180            offset: usize,
10181            _depth: fidl::encoding::Depth,
10182        ) -> fidl::Result<()> {
10183            encoder.debug_check_bounds::<RealmCreateChildRequest>(offset);
10184            // Delegate to tuple encoding.
10185            fidl::encoding::Encode::<RealmCreateChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10186                (
10187                    <fidl_fuchsia_component_decl::CollectionRef as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
10188                    <fidl_fuchsia_component_decl::Child as fidl::encoding::ValueTypeMarker>::borrow(&self.decl),
10189                    <CreateChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
10190                ),
10191                encoder, offset, _depth
10192            )
10193        }
10194    }
10195    unsafe impl<
10196        T0: fidl::encoding::Encode<
10197                fidl_fuchsia_component_decl::CollectionRef,
10198                fidl::encoding::DefaultFuchsiaResourceDialect,
10199            >,
10200        T1: fidl::encoding::Encode<
10201                fidl_fuchsia_component_decl::Child,
10202                fidl::encoding::DefaultFuchsiaResourceDialect,
10203            >,
10204        T2: fidl::encoding::Encode<CreateChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10205    >
10206        fidl::encoding::Encode<
10207            RealmCreateChildRequest,
10208            fidl::encoding::DefaultFuchsiaResourceDialect,
10209        > for (T0, T1, T2)
10210    {
10211        #[inline]
10212        unsafe fn encode(
10213            self,
10214            encoder: &mut fidl::encoding::Encoder<
10215                '_,
10216                fidl::encoding::DefaultFuchsiaResourceDialect,
10217            >,
10218            offset: usize,
10219            depth: fidl::encoding::Depth,
10220        ) -> fidl::Result<()> {
10221            encoder.debug_check_bounds::<RealmCreateChildRequest>(offset);
10222            // Zero out padding regions. There's no need to apply masks
10223            // because the unmasked parts will be overwritten by fields.
10224            // Write the fields.
10225            self.0.encode(encoder, offset + 0, depth)?;
10226            self.1.encode(encoder, offset + 16, depth)?;
10227            self.2.encode(encoder, offset + 32, depth)?;
10228            Ok(())
10229        }
10230    }
10231
10232    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10233        for RealmCreateChildRequest
10234    {
10235        #[inline(always)]
10236        fn new_empty() -> Self {
10237            Self {
10238                collection: fidl::new_empty!(
10239                    fidl_fuchsia_component_decl::CollectionRef,
10240                    fidl::encoding::DefaultFuchsiaResourceDialect
10241                ),
10242                decl: fidl::new_empty!(
10243                    fidl_fuchsia_component_decl::Child,
10244                    fidl::encoding::DefaultFuchsiaResourceDialect
10245                ),
10246                args: fidl::new_empty!(
10247                    CreateChildArgs,
10248                    fidl::encoding::DefaultFuchsiaResourceDialect
10249                ),
10250            }
10251        }
10252
10253        #[inline]
10254        unsafe fn decode(
10255            &mut self,
10256            decoder: &mut fidl::encoding::Decoder<
10257                '_,
10258                fidl::encoding::DefaultFuchsiaResourceDialect,
10259            >,
10260            offset: usize,
10261            _depth: fidl::encoding::Depth,
10262        ) -> fidl::Result<()> {
10263            decoder.debug_check_bounds::<Self>(offset);
10264            // Verify that padding bytes are zero.
10265            fidl::decode!(
10266                fidl_fuchsia_component_decl::CollectionRef,
10267                fidl::encoding::DefaultFuchsiaResourceDialect,
10268                &mut self.collection,
10269                decoder,
10270                offset + 0,
10271                _depth
10272            )?;
10273            fidl::decode!(
10274                fidl_fuchsia_component_decl::Child,
10275                fidl::encoding::DefaultFuchsiaResourceDialect,
10276                &mut self.decl,
10277                decoder,
10278                offset + 16,
10279                _depth
10280            )?;
10281            fidl::decode!(
10282                CreateChildArgs,
10283                fidl::encoding::DefaultFuchsiaResourceDialect,
10284                &mut self.args,
10285                decoder,
10286                offset + 32,
10287                _depth
10288            )?;
10289            Ok(())
10290        }
10291    }
10292
10293    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryDeprecatedRequest {
10294        type Borrowed<'a> = &'a mut Self;
10295        fn take_or_borrow<'a>(
10296            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10297        ) -> Self::Borrowed<'a> {
10298            value
10299        }
10300    }
10301
10302    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryDeprecatedRequest {
10303        type Owned = Self;
10304
10305        #[inline(always)]
10306        fn inline_align(_context: fidl::encoding::Context) -> usize {
10307            8
10308        }
10309
10310        #[inline(always)]
10311        fn inline_size(_context: fidl::encoding::Context) -> usize {
10312            32
10313        }
10314    }
10315
10316    unsafe impl
10317        fidl::encoding::Encode<
10318            RealmGetChildOutputDictionaryDeprecatedRequest,
10319            fidl::encoding::DefaultFuchsiaResourceDialect,
10320        > for &mut RealmGetChildOutputDictionaryDeprecatedRequest
10321    {
10322        #[inline]
10323        unsafe fn encode(
10324            self,
10325            encoder: &mut fidl::encoding::Encoder<
10326                '_,
10327                fidl::encoding::DefaultFuchsiaResourceDialect,
10328            >,
10329            offset: usize,
10330            _depth: fidl::encoding::Depth,
10331        ) -> fidl::Result<()> {
10332            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryDeprecatedRequest>(offset);
10333            // Delegate to tuple encoding.
10334            fidl::encoding::Encode::<RealmGetChildOutputDictionaryDeprecatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10335                (
10336                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
10337                ),
10338                encoder, offset, _depth
10339            )
10340        }
10341    }
10342    unsafe impl<
10343        T0: fidl::encoding::Encode<
10344                fidl_fuchsia_component_decl::ChildRef,
10345                fidl::encoding::DefaultFuchsiaResourceDialect,
10346            >,
10347    >
10348        fidl::encoding::Encode<
10349            RealmGetChildOutputDictionaryDeprecatedRequest,
10350            fidl::encoding::DefaultFuchsiaResourceDialect,
10351        > for (T0,)
10352    {
10353        #[inline]
10354        unsafe fn encode(
10355            self,
10356            encoder: &mut fidl::encoding::Encoder<
10357                '_,
10358                fidl::encoding::DefaultFuchsiaResourceDialect,
10359            >,
10360            offset: usize,
10361            depth: fidl::encoding::Depth,
10362        ) -> fidl::Result<()> {
10363            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryDeprecatedRequest>(offset);
10364            // Zero out padding regions. There's no need to apply masks
10365            // because the unmasked parts will be overwritten by fields.
10366            // Write the fields.
10367            self.0.encode(encoder, offset + 0, depth)?;
10368            Ok(())
10369        }
10370    }
10371
10372    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10373        for RealmGetChildOutputDictionaryDeprecatedRequest
10374    {
10375        #[inline(always)]
10376        fn new_empty() -> Self {
10377            Self {
10378                child: fidl::new_empty!(
10379                    fidl_fuchsia_component_decl::ChildRef,
10380                    fidl::encoding::DefaultFuchsiaResourceDialect
10381                ),
10382            }
10383        }
10384
10385        #[inline]
10386        unsafe fn decode(
10387            &mut self,
10388            decoder: &mut fidl::encoding::Decoder<
10389                '_,
10390                fidl::encoding::DefaultFuchsiaResourceDialect,
10391            >,
10392            offset: usize,
10393            _depth: fidl::encoding::Depth,
10394        ) -> fidl::Result<()> {
10395            decoder.debug_check_bounds::<Self>(offset);
10396            // Verify that padding bytes are zero.
10397            fidl::decode!(
10398                fidl_fuchsia_component_decl::ChildRef,
10399                fidl::encoding::DefaultFuchsiaResourceDialect,
10400                &mut self.child,
10401                decoder,
10402                offset + 0,
10403                _depth
10404            )?;
10405            Ok(())
10406        }
10407    }
10408
10409    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryRequest {
10410        type Borrowed<'a> = &'a mut Self;
10411        fn take_or_borrow<'a>(
10412            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10413        ) -> Self::Borrowed<'a> {
10414            value
10415        }
10416    }
10417
10418    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryRequest {
10419        type Owned = Self;
10420
10421        #[inline(always)]
10422        fn inline_align(_context: fidl::encoding::Context) -> usize {
10423            8
10424        }
10425
10426        #[inline(always)]
10427        fn inline_size(_context: fidl::encoding::Context) -> usize {
10428            32
10429        }
10430    }
10431
10432    unsafe impl
10433        fidl::encoding::Encode<
10434            RealmGetChildOutputDictionaryRequest,
10435            fidl::encoding::DefaultFuchsiaResourceDialect,
10436        > for &mut RealmGetChildOutputDictionaryRequest
10437    {
10438        #[inline]
10439        unsafe fn encode(
10440            self,
10441            encoder: &mut fidl::encoding::Encoder<
10442                '_,
10443                fidl::encoding::DefaultFuchsiaResourceDialect,
10444            >,
10445            offset: usize,
10446            _depth: fidl::encoding::Depth,
10447        ) -> fidl::Result<()> {
10448            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryRequest>(offset);
10449            // Delegate to tuple encoding.
10450            fidl::encoding::Encode::<RealmGetChildOutputDictionaryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10451                (
10452                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
10453                ),
10454                encoder, offset, _depth
10455            )
10456        }
10457    }
10458    unsafe impl<
10459        T0: fidl::encoding::Encode<
10460                fidl_fuchsia_component_decl::ChildRef,
10461                fidl::encoding::DefaultFuchsiaResourceDialect,
10462            >,
10463    >
10464        fidl::encoding::Encode<
10465            RealmGetChildOutputDictionaryRequest,
10466            fidl::encoding::DefaultFuchsiaResourceDialect,
10467        > for (T0,)
10468    {
10469        #[inline]
10470        unsafe fn encode(
10471            self,
10472            encoder: &mut fidl::encoding::Encoder<
10473                '_,
10474                fidl::encoding::DefaultFuchsiaResourceDialect,
10475            >,
10476            offset: usize,
10477            depth: fidl::encoding::Depth,
10478        ) -> fidl::Result<()> {
10479            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryRequest>(offset);
10480            // Zero out padding regions. There's no need to apply masks
10481            // because the unmasked parts will be overwritten by fields.
10482            // Write the fields.
10483            self.0.encode(encoder, offset + 0, depth)?;
10484            Ok(())
10485        }
10486    }
10487
10488    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10489        for RealmGetChildOutputDictionaryRequest
10490    {
10491        #[inline(always)]
10492        fn new_empty() -> Self {
10493            Self {
10494                child: fidl::new_empty!(
10495                    fidl_fuchsia_component_decl::ChildRef,
10496                    fidl::encoding::DefaultFuchsiaResourceDialect
10497                ),
10498            }
10499        }
10500
10501        #[inline]
10502        unsafe fn decode(
10503            &mut self,
10504            decoder: &mut fidl::encoding::Decoder<
10505                '_,
10506                fidl::encoding::DefaultFuchsiaResourceDialect,
10507            >,
10508            offset: usize,
10509            _depth: fidl::encoding::Depth,
10510        ) -> fidl::Result<()> {
10511            decoder.debug_check_bounds::<Self>(offset);
10512            // Verify that padding bytes are zero.
10513            fidl::decode!(
10514                fidl_fuchsia_component_decl::ChildRef,
10515                fidl::encoding::DefaultFuchsiaResourceDialect,
10516                &mut self.child,
10517                decoder,
10518                offset + 0,
10519                _depth
10520            )?;
10521            Ok(())
10522        }
10523    }
10524
10525    impl fidl::encoding::ResourceTypeMarker for RealmListChildrenRequest {
10526        type Borrowed<'a> = &'a mut Self;
10527        fn take_or_borrow<'a>(
10528            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10529        ) -> Self::Borrowed<'a> {
10530            value
10531        }
10532    }
10533
10534    unsafe impl fidl::encoding::TypeMarker for RealmListChildrenRequest {
10535        type Owned = Self;
10536
10537        #[inline(always)]
10538        fn inline_align(_context: fidl::encoding::Context) -> usize {
10539            8
10540        }
10541
10542        #[inline(always)]
10543        fn inline_size(_context: fidl::encoding::Context) -> usize {
10544            24
10545        }
10546    }
10547
10548    unsafe impl
10549        fidl::encoding::Encode<
10550            RealmListChildrenRequest,
10551            fidl::encoding::DefaultFuchsiaResourceDialect,
10552        > for &mut RealmListChildrenRequest
10553    {
10554        #[inline]
10555        unsafe fn encode(
10556            self,
10557            encoder: &mut fidl::encoding::Encoder<
10558                '_,
10559                fidl::encoding::DefaultFuchsiaResourceDialect,
10560            >,
10561            offset: usize,
10562            _depth: fidl::encoding::Depth,
10563        ) -> fidl::Result<()> {
10564            encoder.debug_check_bounds::<RealmListChildrenRequest>(offset);
10565            // Delegate to tuple encoding.
10566            fidl::encoding::Encode::<RealmListChildrenRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10567                (
10568                    <fidl_fuchsia_component_decl::CollectionRef as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
10569                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iter),
10570                ),
10571                encoder, offset, _depth
10572            )
10573        }
10574    }
10575    unsafe impl<
10576        T0: fidl::encoding::Encode<
10577                fidl_fuchsia_component_decl::CollectionRef,
10578                fidl::encoding::DefaultFuchsiaResourceDialect,
10579            >,
10580        T1: fidl::encoding::Encode<
10581                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
10582                fidl::encoding::DefaultFuchsiaResourceDialect,
10583            >,
10584    >
10585        fidl::encoding::Encode<
10586            RealmListChildrenRequest,
10587            fidl::encoding::DefaultFuchsiaResourceDialect,
10588        > for (T0, T1)
10589    {
10590        #[inline]
10591        unsafe fn encode(
10592            self,
10593            encoder: &mut fidl::encoding::Encoder<
10594                '_,
10595                fidl::encoding::DefaultFuchsiaResourceDialect,
10596            >,
10597            offset: usize,
10598            depth: fidl::encoding::Depth,
10599        ) -> fidl::Result<()> {
10600            encoder.debug_check_bounds::<RealmListChildrenRequest>(offset);
10601            // Zero out padding regions. There's no need to apply masks
10602            // because the unmasked parts will be overwritten by fields.
10603            unsafe {
10604                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10605                (ptr as *mut u64).write_unaligned(0);
10606            }
10607            // Write the fields.
10608            self.0.encode(encoder, offset + 0, depth)?;
10609            self.1.encode(encoder, offset + 16, depth)?;
10610            Ok(())
10611        }
10612    }
10613
10614    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10615        for RealmListChildrenRequest
10616    {
10617        #[inline(always)]
10618        fn new_empty() -> Self {
10619            Self {
10620                collection: fidl::new_empty!(
10621                    fidl_fuchsia_component_decl::CollectionRef,
10622                    fidl::encoding::DefaultFuchsiaResourceDialect
10623                ),
10624                iter: fidl::new_empty!(
10625                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
10626                    fidl::encoding::DefaultFuchsiaResourceDialect
10627                ),
10628            }
10629        }
10630
10631        #[inline]
10632        unsafe fn decode(
10633            &mut self,
10634            decoder: &mut fidl::encoding::Decoder<
10635                '_,
10636                fidl::encoding::DefaultFuchsiaResourceDialect,
10637            >,
10638            offset: usize,
10639            _depth: fidl::encoding::Depth,
10640        ) -> fidl::Result<()> {
10641            decoder.debug_check_bounds::<Self>(offset);
10642            // Verify that padding bytes are zero.
10643            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10644            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10645            let mask = 0xffffffff00000000u64;
10646            let maskedval = padval & mask;
10647            if maskedval != 0 {
10648                return Err(fidl::Error::NonZeroPadding {
10649                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10650                });
10651            }
10652            fidl::decode!(
10653                fidl_fuchsia_component_decl::CollectionRef,
10654                fidl::encoding::DefaultFuchsiaResourceDialect,
10655                &mut self.collection,
10656                decoder,
10657                offset + 0,
10658                _depth
10659            )?;
10660            fidl::decode!(
10661                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
10662                fidl::encoding::DefaultFuchsiaResourceDialect,
10663                &mut self.iter,
10664                decoder,
10665                offset + 16,
10666                _depth
10667            )?;
10668            Ok(())
10669        }
10670    }
10671
10672    impl fidl::encoding::ResourceTypeMarker for RealmOpenControllerRequest {
10673        type Borrowed<'a> = &'a mut Self;
10674        fn take_or_borrow<'a>(
10675            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10676        ) -> Self::Borrowed<'a> {
10677            value
10678        }
10679    }
10680
10681    unsafe impl fidl::encoding::TypeMarker for RealmOpenControllerRequest {
10682        type Owned = Self;
10683
10684        #[inline(always)]
10685        fn inline_align(_context: fidl::encoding::Context) -> usize {
10686            8
10687        }
10688
10689        #[inline(always)]
10690        fn inline_size(_context: fidl::encoding::Context) -> usize {
10691            40
10692        }
10693    }
10694
10695    unsafe impl
10696        fidl::encoding::Encode<
10697            RealmOpenControllerRequest,
10698            fidl::encoding::DefaultFuchsiaResourceDialect,
10699        > for &mut RealmOpenControllerRequest
10700    {
10701        #[inline]
10702        unsafe fn encode(
10703            self,
10704            encoder: &mut fidl::encoding::Encoder<
10705                '_,
10706                fidl::encoding::DefaultFuchsiaResourceDialect,
10707            >,
10708            offset: usize,
10709            _depth: fidl::encoding::Depth,
10710        ) -> fidl::Result<()> {
10711            encoder.debug_check_bounds::<RealmOpenControllerRequest>(offset);
10712            // Delegate to tuple encoding.
10713            fidl::encoding::Encode::<RealmOpenControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10714                (
10715                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
10716                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
10717                ),
10718                encoder, offset, _depth
10719            )
10720        }
10721    }
10722    unsafe impl<
10723        T0: fidl::encoding::Encode<
10724                fidl_fuchsia_component_decl::ChildRef,
10725                fidl::encoding::DefaultFuchsiaResourceDialect,
10726            >,
10727        T1: fidl::encoding::Encode<
10728                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10729                fidl::encoding::DefaultFuchsiaResourceDialect,
10730            >,
10731    >
10732        fidl::encoding::Encode<
10733            RealmOpenControllerRequest,
10734            fidl::encoding::DefaultFuchsiaResourceDialect,
10735        > for (T0, T1)
10736    {
10737        #[inline]
10738        unsafe fn encode(
10739            self,
10740            encoder: &mut fidl::encoding::Encoder<
10741                '_,
10742                fidl::encoding::DefaultFuchsiaResourceDialect,
10743            >,
10744            offset: usize,
10745            depth: fidl::encoding::Depth,
10746        ) -> fidl::Result<()> {
10747            encoder.debug_check_bounds::<RealmOpenControllerRequest>(offset);
10748            // Zero out padding regions. There's no need to apply masks
10749            // because the unmasked parts will be overwritten by fields.
10750            unsafe {
10751                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10752                (ptr as *mut u64).write_unaligned(0);
10753            }
10754            // Write the fields.
10755            self.0.encode(encoder, offset + 0, depth)?;
10756            self.1.encode(encoder, offset + 32, depth)?;
10757            Ok(())
10758        }
10759    }
10760
10761    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10762        for RealmOpenControllerRequest
10763    {
10764        #[inline(always)]
10765        fn new_empty() -> Self {
10766            Self {
10767                child: fidl::new_empty!(
10768                    fidl_fuchsia_component_decl::ChildRef,
10769                    fidl::encoding::DefaultFuchsiaResourceDialect
10770                ),
10771                controller: fidl::new_empty!(
10772                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10773                    fidl::encoding::DefaultFuchsiaResourceDialect
10774                ),
10775            }
10776        }
10777
10778        #[inline]
10779        unsafe fn decode(
10780            &mut self,
10781            decoder: &mut fidl::encoding::Decoder<
10782                '_,
10783                fidl::encoding::DefaultFuchsiaResourceDialect,
10784            >,
10785            offset: usize,
10786            _depth: fidl::encoding::Depth,
10787        ) -> fidl::Result<()> {
10788            decoder.debug_check_bounds::<Self>(offset);
10789            // Verify that padding bytes are zero.
10790            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10791            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10792            let mask = 0xffffffff00000000u64;
10793            let maskedval = padval & mask;
10794            if maskedval != 0 {
10795                return Err(fidl::Error::NonZeroPadding {
10796                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10797                });
10798            }
10799            fidl::decode!(
10800                fidl_fuchsia_component_decl::ChildRef,
10801                fidl::encoding::DefaultFuchsiaResourceDialect,
10802                &mut self.child,
10803                decoder,
10804                offset + 0,
10805                _depth
10806            )?;
10807            fidl::decode!(
10808                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10809                fidl::encoding::DefaultFuchsiaResourceDialect,
10810                &mut self.controller,
10811                decoder,
10812                offset + 32,
10813                _depth
10814            )?;
10815            Ok(())
10816        }
10817    }
10818
10819    impl fidl::encoding::ResourceTypeMarker for RealmOpenExposedDirRequest {
10820        type Borrowed<'a> = &'a mut Self;
10821        fn take_or_borrow<'a>(
10822            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10823        ) -> Self::Borrowed<'a> {
10824            value
10825        }
10826    }
10827
10828    unsafe impl fidl::encoding::TypeMarker for RealmOpenExposedDirRequest {
10829        type Owned = Self;
10830
10831        #[inline(always)]
10832        fn inline_align(_context: fidl::encoding::Context) -> usize {
10833            8
10834        }
10835
10836        #[inline(always)]
10837        fn inline_size(_context: fidl::encoding::Context) -> usize {
10838            40
10839        }
10840    }
10841
10842    unsafe impl
10843        fidl::encoding::Encode<
10844            RealmOpenExposedDirRequest,
10845            fidl::encoding::DefaultFuchsiaResourceDialect,
10846        > for &mut RealmOpenExposedDirRequest
10847    {
10848        #[inline]
10849        unsafe fn encode(
10850            self,
10851            encoder: &mut fidl::encoding::Encoder<
10852                '_,
10853                fidl::encoding::DefaultFuchsiaResourceDialect,
10854            >,
10855            offset: usize,
10856            _depth: fidl::encoding::Depth,
10857        ) -> fidl::Result<()> {
10858            encoder.debug_check_bounds::<RealmOpenExposedDirRequest>(offset);
10859            // Delegate to tuple encoding.
10860            fidl::encoding::Encode::<RealmOpenExposedDirRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10861                (
10862                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
10863                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.exposed_dir),
10864                ),
10865                encoder, offset, _depth
10866            )
10867        }
10868    }
10869    unsafe impl<
10870        T0: fidl::encoding::Encode<
10871                fidl_fuchsia_component_decl::ChildRef,
10872                fidl::encoding::DefaultFuchsiaResourceDialect,
10873            >,
10874        T1: fidl::encoding::Encode<
10875                fidl::encoding::Endpoint<
10876                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10877                >,
10878                fidl::encoding::DefaultFuchsiaResourceDialect,
10879            >,
10880    >
10881        fidl::encoding::Encode<
10882            RealmOpenExposedDirRequest,
10883            fidl::encoding::DefaultFuchsiaResourceDialect,
10884        > for (T0, T1)
10885    {
10886        #[inline]
10887        unsafe fn encode(
10888            self,
10889            encoder: &mut fidl::encoding::Encoder<
10890                '_,
10891                fidl::encoding::DefaultFuchsiaResourceDialect,
10892            >,
10893            offset: usize,
10894            depth: fidl::encoding::Depth,
10895        ) -> fidl::Result<()> {
10896            encoder.debug_check_bounds::<RealmOpenExposedDirRequest>(offset);
10897            // Zero out padding regions. There's no need to apply masks
10898            // because the unmasked parts will be overwritten by fields.
10899            unsafe {
10900                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10901                (ptr as *mut u64).write_unaligned(0);
10902            }
10903            // Write the fields.
10904            self.0.encode(encoder, offset + 0, depth)?;
10905            self.1.encode(encoder, offset + 32, depth)?;
10906            Ok(())
10907        }
10908    }
10909
10910    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10911        for RealmOpenExposedDirRequest
10912    {
10913        #[inline(always)]
10914        fn new_empty() -> Self {
10915            Self {
10916                child: fidl::new_empty!(
10917                    fidl_fuchsia_component_decl::ChildRef,
10918                    fidl::encoding::DefaultFuchsiaResourceDialect
10919                ),
10920                exposed_dir: fidl::new_empty!(
10921                    fidl::encoding::Endpoint<
10922                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10923                    >,
10924                    fidl::encoding::DefaultFuchsiaResourceDialect
10925                ),
10926            }
10927        }
10928
10929        #[inline]
10930        unsafe fn decode(
10931            &mut self,
10932            decoder: &mut fidl::encoding::Decoder<
10933                '_,
10934                fidl::encoding::DefaultFuchsiaResourceDialect,
10935            >,
10936            offset: usize,
10937            _depth: fidl::encoding::Depth,
10938        ) -> fidl::Result<()> {
10939            decoder.debug_check_bounds::<Self>(offset);
10940            // Verify that padding bytes are zero.
10941            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10942            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10943            let mask = 0xffffffff00000000u64;
10944            let maskedval = padval & mask;
10945            if maskedval != 0 {
10946                return Err(fidl::Error::NonZeroPadding {
10947                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10948                });
10949            }
10950            fidl::decode!(
10951                fidl_fuchsia_component_decl::ChildRef,
10952                fidl::encoding::DefaultFuchsiaResourceDialect,
10953                &mut self.child,
10954                decoder,
10955                offset + 0,
10956                _depth
10957            )?;
10958            fidl::decode!(
10959                fidl::encoding::Endpoint<
10960                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10961                >,
10962                fidl::encoding::DefaultFuchsiaResourceDialect,
10963                &mut self.exposed_dir,
10964                decoder,
10965                offset + 32,
10966                _depth
10967            )?;
10968            Ok(())
10969        }
10970    }
10971
10972    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryDeprecatedResponse {
10973        type Borrowed<'a> = &'a mut Self;
10974        fn take_or_borrow<'a>(
10975            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10976        ) -> Self::Borrowed<'a> {
10977            value
10978        }
10979    }
10980
10981    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryDeprecatedResponse {
10982        type Owned = Self;
10983
10984        #[inline(always)]
10985        fn inline_align(_context: fidl::encoding::Context) -> usize {
10986            4
10987        }
10988
10989        #[inline(always)]
10990        fn inline_size(_context: fidl::encoding::Context) -> usize {
10991            4
10992        }
10993    }
10994
10995    unsafe impl
10996        fidl::encoding::Encode<
10997            RealmGetChildOutputDictionaryDeprecatedResponse,
10998            fidl::encoding::DefaultFuchsiaResourceDialect,
10999        > for &mut RealmGetChildOutputDictionaryDeprecatedResponse
11000    {
11001        #[inline]
11002        unsafe fn encode(
11003            self,
11004            encoder: &mut fidl::encoding::Encoder<
11005                '_,
11006                fidl::encoding::DefaultFuchsiaResourceDialect,
11007            >,
11008            offset: usize,
11009            _depth: fidl::encoding::Depth,
11010        ) -> fidl::Result<()> {
11011            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryDeprecatedResponse>(offset);
11012            // Delegate to tuple encoding.
11013            fidl::encoding::Encode::<RealmGetChildOutputDictionaryDeprecatedResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11014                (
11015                    <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
11016                ),
11017                encoder, offset, _depth
11018            )
11019        }
11020    }
11021    unsafe impl<
11022        T0: fidl::encoding::Encode<
11023                fidl_fuchsia_component_sandbox::DictionaryRef,
11024                fidl::encoding::DefaultFuchsiaResourceDialect,
11025            >,
11026    >
11027        fidl::encoding::Encode<
11028            RealmGetChildOutputDictionaryDeprecatedResponse,
11029            fidl::encoding::DefaultFuchsiaResourceDialect,
11030        > for (T0,)
11031    {
11032        #[inline]
11033        unsafe fn encode(
11034            self,
11035            encoder: &mut fidl::encoding::Encoder<
11036                '_,
11037                fidl::encoding::DefaultFuchsiaResourceDialect,
11038            >,
11039            offset: usize,
11040            depth: fidl::encoding::Depth,
11041        ) -> fidl::Result<()> {
11042            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryDeprecatedResponse>(offset);
11043            // Zero out padding regions. There's no need to apply masks
11044            // because the unmasked parts will be overwritten by fields.
11045            // Write the fields.
11046            self.0.encode(encoder, offset + 0, depth)?;
11047            Ok(())
11048        }
11049    }
11050
11051    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11052        for RealmGetChildOutputDictionaryDeprecatedResponse
11053    {
11054        #[inline(always)]
11055        fn new_empty() -> Self {
11056            Self {
11057                dictionary: fidl::new_empty!(
11058                    fidl_fuchsia_component_sandbox::DictionaryRef,
11059                    fidl::encoding::DefaultFuchsiaResourceDialect
11060                ),
11061            }
11062        }
11063
11064        #[inline]
11065        unsafe fn decode(
11066            &mut self,
11067            decoder: &mut fidl::encoding::Decoder<
11068                '_,
11069                fidl::encoding::DefaultFuchsiaResourceDialect,
11070            >,
11071            offset: usize,
11072            _depth: fidl::encoding::Depth,
11073        ) -> fidl::Result<()> {
11074            decoder.debug_check_bounds::<Self>(offset);
11075            // Verify that padding bytes are zero.
11076            fidl::decode!(
11077                fidl_fuchsia_component_sandbox::DictionaryRef,
11078                fidl::encoding::DefaultFuchsiaResourceDialect,
11079                &mut self.dictionary,
11080                decoder,
11081                offset + 0,
11082                _depth
11083            )?;
11084            Ok(())
11085        }
11086    }
11087
11088    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryResponse {
11089        type Borrowed<'a> = &'a mut Self;
11090        fn take_or_borrow<'a>(
11091            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11092        ) -> Self::Borrowed<'a> {
11093            value
11094        }
11095    }
11096
11097    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryResponse {
11098        type Owned = Self;
11099
11100        #[inline(always)]
11101        fn inline_align(_context: fidl::encoding::Context) -> usize {
11102            4
11103        }
11104
11105        #[inline(always)]
11106        fn inline_size(_context: fidl::encoding::Context) -> usize {
11107            4
11108        }
11109    }
11110
11111    unsafe impl
11112        fidl::encoding::Encode<
11113            RealmGetChildOutputDictionaryResponse,
11114            fidl::encoding::DefaultFuchsiaResourceDialect,
11115        > for &mut RealmGetChildOutputDictionaryResponse
11116    {
11117        #[inline]
11118        unsafe fn encode(
11119            self,
11120            encoder: &mut fidl::encoding::Encoder<
11121                '_,
11122                fidl::encoding::DefaultFuchsiaResourceDialect,
11123            >,
11124            offset: usize,
11125            _depth: fidl::encoding::Depth,
11126        ) -> fidl::Result<()> {
11127            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryResponse>(offset);
11128            // Delegate to tuple encoding.
11129            fidl::encoding::Encode::<
11130                RealmGetChildOutputDictionaryResponse,
11131                fidl::encoding::DefaultFuchsiaResourceDialect,
11132            >::encode(
11133                (<fidl::encoding::HandleType<
11134                    fidl::EventPair,
11135                    { fidl::ObjectType::EVENTPAIR.into_raw() },
11136                    2147483648,
11137                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11138                    &mut self.dictionary
11139                ),),
11140                encoder,
11141                offset,
11142                _depth,
11143            )
11144        }
11145    }
11146    unsafe impl<
11147        T0: fidl::encoding::Encode<
11148                fidl::encoding::HandleType<
11149                    fidl::EventPair,
11150                    { fidl::ObjectType::EVENTPAIR.into_raw() },
11151                    2147483648,
11152                >,
11153                fidl::encoding::DefaultFuchsiaResourceDialect,
11154            >,
11155    >
11156        fidl::encoding::Encode<
11157            RealmGetChildOutputDictionaryResponse,
11158            fidl::encoding::DefaultFuchsiaResourceDialect,
11159        > for (T0,)
11160    {
11161        #[inline]
11162        unsafe fn encode(
11163            self,
11164            encoder: &mut fidl::encoding::Encoder<
11165                '_,
11166                fidl::encoding::DefaultFuchsiaResourceDialect,
11167            >,
11168            offset: usize,
11169            depth: fidl::encoding::Depth,
11170        ) -> fidl::Result<()> {
11171            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryResponse>(offset);
11172            // Zero out padding regions. There's no need to apply masks
11173            // because the unmasked parts will be overwritten by fields.
11174            // Write the fields.
11175            self.0.encode(encoder, offset + 0, depth)?;
11176            Ok(())
11177        }
11178    }
11179
11180    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11181        for RealmGetChildOutputDictionaryResponse
11182    {
11183        #[inline(always)]
11184        fn new_empty() -> Self {
11185            Self {
11186                dictionary: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11187            }
11188        }
11189
11190        #[inline]
11191        unsafe fn decode(
11192            &mut self,
11193            decoder: &mut fidl::encoding::Decoder<
11194                '_,
11195                fidl::encoding::DefaultFuchsiaResourceDialect,
11196            >,
11197            offset: usize,
11198            _depth: fidl::encoding::Depth,
11199        ) -> fidl::Result<()> {
11200            decoder.debug_check_bounds::<Self>(offset);
11201            // Verify that padding bytes are zero.
11202            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.dictionary, decoder, offset + 0, _depth)?;
11203            Ok(())
11204        }
11205    }
11206
11207    impl fidl::encoding::ResourceTypeMarker for RealmGetResolvedInfoResponse {
11208        type Borrowed<'a> = &'a mut Self;
11209        fn take_or_borrow<'a>(
11210            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11211        ) -> Self::Borrowed<'a> {
11212            value
11213        }
11214    }
11215
11216    unsafe impl fidl::encoding::TypeMarker for RealmGetResolvedInfoResponse {
11217        type Owned = Self;
11218
11219        #[inline(always)]
11220        fn inline_align(_context: fidl::encoding::Context) -> usize {
11221            8
11222        }
11223
11224        #[inline(always)]
11225        fn inline_size(_context: fidl::encoding::Context) -> usize {
11226            16
11227        }
11228    }
11229
11230    unsafe impl
11231        fidl::encoding::Encode<
11232            RealmGetResolvedInfoResponse,
11233            fidl::encoding::DefaultFuchsiaResourceDialect,
11234        > for &mut RealmGetResolvedInfoResponse
11235    {
11236        #[inline]
11237        unsafe fn encode(
11238            self,
11239            encoder: &mut fidl::encoding::Encoder<
11240                '_,
11241                fidl::encoding::DefaultFuchsiaResourceDialect,
11242            >,
11243            offset: usize,
11244            _depth: fidl::encoding::Depth,
11245        ) -> fidl::Result<()> {
11246            encoder.debug_check_bounds::<RealmGetResolvedInfoResponse>(offset);
11247            // Delegate to tuple encoding.
11248            fidl::encoding::Encode::<RealmGetResolvedInfoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11249                (
11250                    <fidl_fuchsia_component_resolution::Component as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.resolved_info),
11251                ),
11252                encoder, offset, _depth
11253            )
11254        }
11255    }
11256    unsafe impl<
11257        T0: fidl::encoding::Encode<
11258                fidl_fuchsia_component_resolution::Component,
11259                fidl::encoding::DefaultFuchsiaResourceDialect,
11260            >,
11261    >
11262        fidl::encoding::Encode<
11263            RealmGetResolvedInfoResponse,
11264            fidl::encoding::DefaultFuchsiaResourceDialect,
11265        > for (T0,)
11266    {
11267        #[inline]
11268        unsafe fn encode(
11269            self,
11270            encoder: &mut fidl::encoding::Encoder<
11271                '_,
11272                fidl::encoding::DefaultFuchsiaResourceDialect,
11273            >,
11274            offset: usize,
11275            depth: fidl::encoding::Depth,
11276        ) -> fidl::Result<()> {
11277            encoder.debug_check_bounds::<RealmGetResolvedInfoResponse>(offset);
11278            // Zero out padding regions. There's no need to apply masks
11279            // because the unmasked parts will be overwritten by fields.
11280            // Write the fields.
11281            self.0.encode(encoder, offset + 0, depth)?;
11282            Ok(())
11283        }
11284    }
11285
11286    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11287        for RealmGetResolvedInfoResponse
11288    {
11289        #[inline(always)]
11290        fn new_empty() -> Self {
11291            Self {
11292                resolved_info: fidl::new_empty!(
11293                    fidl_fuchsia_component_resolution::Component,
11294                    fidl::encoding::DefaultFuchsiaResourceDialect
11295                ),
11296            }
11297        }
11298
11299        #[inline]
11300        unsafe fn decode(
11301            &mut self,
11302            decoder: &mut fidl::encoding::Decoder<
11303                '_,
11304                fidl::encoding::DefaultFuchsiaResourceDialect,
11305            >,
11306            offset: usize,
11307            _depth: fidl::encoding::Depth,
11308        ) -> fidl::Result<()> {
11309            decoder.debug_check_bounds::<Self>(offset);
11310            // Verify that padding bytes are zero.
11311            fidl::decode!(
11312                fidl_fuchsia_component_resolution::Component,
11313                fidl::encoding::DefaultFuchsiaResourceDialect,
11314                &mut self.resolved_info,
11315                decoder,
11316                offset + 0,
11317                _depth
11318            )?;
11319            Ok(())
11320        }
11321    }
11322
11323    impl fidl::encoding::ResourceTypeMarker for StorageAdminListStorageInRealmRequest {
11324        type Borrowed<'a> = &'a mut Self;
11325        fn take_or_borrow<'a>(
11326            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11327        ) -> Self::Borrowed<'a> {
11328            value
11329        }
11330    }
11331
11332    unsafe impl fidl::encoding::TypeMarker for StorageAdminListStorageInRealmRequest {
11333        type Owned = Self;
11334
11335        #[inline(always)]
11336        fn inline_align(_context: fidl::encoding::Context) -> usize {
11337            8
11338        }
11339
11340        #[inline(always)]
11341        fn inline_size(_context: fidl::encoding::Context) -> usize {
11342            24
11343        }
11344    }
11345
11346    unsafe impl
11347        fidl::encoding::Encode<
11348            StorageAdminListStorageInRealmRequest,
11349            fidl::encoding::DefaultFuchsiaResourceDialect,
11350        > for &mut StorageAdminListStorageInRealmRequest
11351    {
11352        #[inline]
11353        unsafe fn encode(
11354            self,
11355            encoder: &mut fidl::encoding::Encoder<
11356                '_,
11357                fidl::encoding::DefaultFuchsiaResourceDialect,
11358            >,
11359            offset: usize,
11360            _depth: fidl::encoding::Depth,
11361        ) -> fidl::Result<()> {
11362            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
11363            // Delegate to tuple encoding.
11364            fidl::encoding::Encode::<StorageAdminListStorageInRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11365                (
11366                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
11367                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
11368                ),
11369                encoder, offset, _depth
11370            )
11371        }
11372    }
11373    unsafe impl<
11374        T0: fidl::encoding::Encode<
11375                fidl::encoding::BoundedString<4096>,
11376                fidl::encoding::DefaultFuchsiaResourceDialect,
11377            >,
11378        T1: fidl::encoding::Encode<
11379                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
11380                fidl::encoding::DefaultFuchsiaResourceDialect,
11381            >,
11382    >
11383        fidl::encoding::Encode<
11384            StorageAdminListStorageInRealmRequest,
11385            fidl::encoding::DefaultFuchsiaResourceDialect,
11386        > for (T0, T1)
11387    {
11388        #[inline]
11389        unsafe fn encode(
11390            self,
11391            encoder: &mut fidl::encoding::Encoder<
11392                '_,
11393                fidl::encoding::DefaultFuchsiaResourceDialect,
11394            >,
11395            offset: usize,
11396            depth: fidl::encoding::Depth,
11397        ) -> fidl::Result<()> {
11398            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
11399            // Zero out padding regions. There's no need to apply masks
11400            // because the unmasked parts will be overwritten by fields.
11401            unsafe {
11402                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11403                (ptr as *mut u64).write_unaligned(0);
11404            }
11405            // Write the fields.
11406            self.0.encode(encoder, offset + 0, depth)?;
11407            self.1.encode(encoder, offset + 16, depth)?;
11408            Ok(())
11409        }
11410    }
11411
11412    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11413        for StorageAdminListStorageInRealmRequest
11414    {
11415        #[inline(always)]
11416        fn new_empty() -> Self {
11417            Self {
11418                relative_moniker: fidl::new_empty!(
11419                    fidl::encoding::BoundedString<4096>,
11420                    fidl::encoding::DefaultFuchsiaResourceDialect
11421                ),
11422                iterator: fidl::new_empty!(
11423                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
11424                    fidl::encoding::DefaultFuchsiaResourceDialect
11425                ),
11426            }
11427        }
11428
11429        #[inline]
11430        unsafe fn decode(
11431            &mut self,
11432            decoder: &mut fidl::encoding::Decoder<
11433                '_,
11434                fidl::encoding::DefaultFuchsiaResourceDialect,
11435            >,
11436            offset: usize,
11437            _depth: fidl::encoding::Depth,
11438        ) -> fidl::Result<()> {
11439            decoder.debug_check_bounds::<Self>(offset);
11440            // Verify that padding bytes are zero.
11441            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11442            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11443            let mask = 0xffffffff00000000u64;
11444            let maskedval = padval & mask;
11445            if maskedval != 0 {
11446                return Err(fidl::Error::NonZeroPadding {
11447                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11448                });
11449            }
11450            fidl::decode!(
11451                fidl::encoding::BoundedString<4096>,
11452                fidl::encoding::DefaultFuchsiaResourceDialect,
11453                &mut self.relative_moniker,
11454                decoder,
11455                offset + 0,
11456                _depth
11457            )?;
11458            fidl::decode!(
11459                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
11460                fidl::encoding::DefaultFuchsiaResourceDialect,
11461                &mut self.iterator,
11462                decoder,
11463                offset + 16,
11464                _depth
11465            )?;
11466            Ok(())
11467        }
11468    }
11469
11470    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenComponentStorageByIdRequest {
11471        type Borrowed<'a> = &'a mut Self;
11472        fn take_or_borrow<'a>(
11473            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11474        ) -> Self::Borrowed<'a> {
11475            value
11476        }
11477    }
11478
11479    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenComponentStorageByIdRequest {
11480        type Owned = Self;
11481
11482        #[inline(always)]
11483        fn inline_align(_context: fidl::encoding::Context) -> usize {
11484            8
11485        }
11486
11487        #[inline(always)]
11488        fn inline_size(_context: fidl::encoding::Context) -> usize {
11489            24
11490        }
11491    }
11492
11493    unsafe impl
11494        fidl::encoding::Encode<
11495            StorageAdminOpenComponentStorageByIdRequest,
11496            fidl::encoding::DefaultFuchsiaResourceDialect,
11497        > for &mut StorageAdminOpenComponentStorageByIdRequest
11498    {
11499        #[inline]
11500        unsafe fn encode(
11501            self,
11502            encoder: &mut fidl::encoding::Encoder<
11503                '_,
11504                fidl::encoding::DefaultFuchsiaResourceDialect,
11505            >,
11506            offset: usize,
11507            _depth: fidl::encoding::Depth,
11508        ) -> fidl::Result<()> {
11509            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
11510            // Delegate to tuple encoding.
11511            fidl::encoding::Encode::<
11512                StorageAdminOpenComponentStorageByIdRequest,
11513                fidl::encoding::DefaultFuchsiaResourceDialect,
11514            >::encode(
11515                (
11516                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
11517                        &self.id,
11518                    ),
11519                    <fidl::encoding::Endpoint<
11520                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
11521                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11522                        &mut self.object
11523                    ),
11524                ),
11525                encoder,
11526                offset,
11527                _depth,
11528            )
11529        }
11530    }
11531    unsafe impl<
11532        T0: fidl::encoding::Encode<
11533                fidl::encoding::BoundedString<64>,
11534                fidl::encoding::DefaultFuchsiaResourceDialect,
11535            >,
11536        T1: fidl::encoding::Encode<
11537                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11538                fidl::encoding::DefaultFuchsiaResourceDialect,
11539            >,
11540    >
11541        fidl::encoding::Encode<
11542            StorageAdminOpenComponentStorageByIdRequest,
11543            fidl::encoding::DefaultFuchsiaResourceDialect,
11544        > for (T0, T1)
11545    {
11546        #[inline]
11547        unsafe fn encode(
11548            self,
11549            encoder: &mut fidl::encoding::Encoder<
11550                '_,
11551                fidl::encoding::DefaultFuchsiaResourceDialect,
11552            >,
11553            offset: usize,
11554            depth: fidl::encoding::Depth,
11555        ) -> fidl::Result<()> {
11556            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
11557            // Zero out padding regions. There's no need to apply masks
11558            // because the unmasked parts will be overwritten by fields.
11559            unsafe {
11560                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11561                (ptr as *mut u64).write_unaligned(0);
11562            }
11563            // Write the fields.
11564            self.0.encode(encoder, offset + 0, depth)?;
11565            self.1.encode(encoder, offset + 16, depth)?;
11566            Ok(())
11567        }
11568    }
11569
11570    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11571        for StorageAdminOpenComponentStorageByIdRequest
11572    {
11573        #[inline(always)]
11574        fn new_empty() -> Self {
11575            Self {
11576                id: fidl::new_empty!(
11577                    fidl::encoding::BoundedString<64>,
11578                    fidl::encoding::DefaultFuchsiaResourceDialect
11579                ),
11580                object: fidl::new_empty!(
11581                    fidl::encoding::Endpoint<
11582                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
11583                    >,
11584                    fidl::encoding::DefaultFuchsiaResourceDialect
11585                ),
11586            }
11587        }
11588
11589        #[inline]
11590        unsafe fn decode(
11591            &mut self,
11592            decoder: &mut fidl::encoding::Decoder<
11593                '_,
11594                fidl::encoding::DefaultFuchsiaResourceDialect,
11595            >,
11596            offset: usize,
11597            _depth: fidl::encoding::Depth,
11598        ) -> fidl::Result<()> {
11599            decoder.debug_check_bounds::<Self>(offset);
11600            // Verify that padding bytes are zero.
11601            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11602            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11603            let mask = 0xffffffff00000000u64;
11604            let maskedval = padval & mask;
11605            if maskedval != 0 {
11606                return Err(fidl::Error::NonZeroPadding {
11607                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11608                });
11609            }
11610            fidl::decode!(
11611                fidl::encoding::BoundedString<64>,
11612                fidl::encoding::DefaultFuchsiaResourceDialect,
11613                &mut self.id,
11614                decoder,
11615                offset + 0,
11616                _depth
11617            )?;
11618            fidl::decode!(
11619                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11620                fidl::encoding::DefaultFuchsiaResourceDialect,
11621                &mut self.object,
11622                decoder,
11623                offset + 16,
11624                _depth
11625            )?;
11626            Ok(())
11627        }
11628    }
11629
11630    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenStorageRequest {
11631        type Borrowed<'a> = &'a mut Self;
11632        fn take_or_borrow<'a>(
11633            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11634        ) -> Self::Borrowed<'a> {
11635            value
11636        }
11637    }
11638
11639    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenStorageRequest {
11640        type Owned = Self;
11641
11642        #[inline(always)]
11643        fn inline_align(_context: fidl::encoding::Context) -> usize {
11644            8
11645        }
11646
11647        #[inline(always)]
11648        fn inline_size(_context: fidl::encoding::Context) -> usize {
11649            24
11650        }
11651    }
11652
11653    unsafe impl
11654        fidl::encoding::Encode<
11655            StorageAdminOpenStorageRequest,
11656            fidl::encoding::DefaultFuchsiaResourceDialect,
11657        > for &mut StorageAdminOpenStorageRequest
11658    {
11659        #[inline]
11660        unsafe fn encode(
11661            self,
11662            encoder: &mut fidl::encoding::Encoder<
11663                '_,
11664                fidl::encoding::DefaultFuchsiaResourceDialect,
11665            >,
11666            offset: usize,
11667            _depth: fidl::encoding::Depth,
11668        ) -> fidl::Result<()> {
11669            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
11670            // Delegate to tuple encoding.
11671            fidl::encoding::Encode::<StorageAdminOpenStorageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11672                (
11673                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
11674                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.object),
11675                ),
11676                encoder, offset, _depth
11677            )
11678        }
11679    }
11680    unsafe impl<
11681        T0: fidl::encoding::Encode<
11682                fidl::encoding::BoundedString<4096>,
11683                fidl::encoding::DefaultFuchsiaResourceDialect,
11684            >,
11685        T1: fidl::encoding::Encode<
11686                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11687                fidl::encoding::DefaultFuchsiaResourceDialect,
11688            >,
11689    >
11690        fidl::encoding::Encode<
11691            StorageAdminOpenStorageRequest,
11692            fidl::encoding::DefaultFuchsiaResourceDialect,
11693        > for (T0, T1)
11694    {
11695        #[inline]
11696        unsafe fn encode(
11697            self,
11698            encoder: &mut fidl::encoding::Encoder<
11699                '_,
11700                fidl::encoding::DefaultFuchsiaResourceDialect,
11701            >,
11702            offset: usize,
11703            depth: fidl::encoding::Depth,
11704        ) -> fidl::Result<()> {
11705            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
11706            // Zero out padding regions. There's no need to apply masks
11707            // because the unmasked parts will be overwritten by fields.
11708            unsafe {
11709                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11710                (ptr as *mut u64).write_unaligned(0);
11711            }
11712            // Write the fields.
11713            self.0.encode(encoder, offset + 0, depth)?;
11714            self.1.encode(encoder, offset + 16, depth)?;
11715            Ok(())
11716        }
11717    }
11718
11719    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11720        for StorageAdminOpenStorageRequest
11721    {
11722        #[inline(always)]
11723        fn new_empty() -> Self {
11724            Self {
11725                relative_moniker: fidl::new_empty!(
11726                    fidl::encoding::BoundedString<4096>,
11727                    fidl::encoding::DefaultFuchsiaResourceDialect
11728                ),
11729                object: fidl::new_empty!(
11730                    fidl::encoding::Endpoint<
11731                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
11732                    >,
11733                    fidl::encoding::DefaultFuchsiaResourceDialect
11734                ),
11735            }
11736        }
11737
11738        #[inline]
11739        unsafe fn decode(
11740            &mut self,
11741            decoder: &mut fidl::encoding::Decoder<
11742                '_,
11743                fidl::encoding::DefaultFuchsiaResourceDialect,
11744            >,
11745            offset: usize,
11746            _depth: fidl::encoding::Depth,
11747        ) -> fidl::Result<()> {
11748            decoder.debug_check_bounds::<Self>(offset);
11749            // Verify that padding bytes are zero.
11750            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11751            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11752            let mask = 0xffffffff00000000u64;
11753            let maskedval = padval & mask;
11754            if maskedval != 0 {
11755                return Err(fidl::Error::NonZeroPadding {
11756                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11757                });
11758            }
11759            fidl::decode!(
11760                fidl::encoding::BoundedString<4096>,
11761                fidl::encoding::DefaultFuchsiaResourceDialect,
11762                &mut self.relative_moniker,
11763                decoder,
11764                offset + 0,
11765                _depth
11766            )?;
11767            fidl::decode!(
11768                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11769                fidl::encoding::DefaultFuchsiaResourceDialect,
11770                &mut self.object,
11771                decoder,
11772                offset + 16,
11773                _depth
11774            )?;
11775            Ok(())
11776        }
11777    }
11778
11779    impl CapabilityRequestedPayload {
11780        #[inline(always)]
11781        fn max_ordinal_present(&self) -> u64 {
11782            if let Some(_) = self.capability {
11783                return 2;
11784            }
11785            if let Some(_) = self.name {
11786                return 1;
11787            }
11788            0
11789        }
11790    }
11791
11792    impl fidl::encoding::ResourceTypeMarker for CapabilityRequestedPayload {
11793        type Borrowed<'a> = &'a mut Self;
11794        fn take_or_borrow<'a>(
11795            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11796        ) -> Self::Borrowed<'a> {
11797            value
11798        }
11799    }
11800
11801    unsafe impl fidl::encoding::TypeMarker for CapabilityRequestedPayload {
11802        type Owned = Self;
11803
11804        #[inline(always)]
11805        fn inline_align(_context: fidl::encoding::Context) -> usize {
11806            8
11807        }
11808
11809        #[inline(always)]
11810        fn inline_size(_context: fidl::encoding::Context) -> usize {
11811            16
11812        }
11813    }
11814
11815    unsafe impl
11816        fidl::encoding::Encode<
11817            CapabilityRequestedPayload,
11818            fidl::encoding::DefaultFuchsiaResourceDialect,
11819        > for &mut CapabilityRequestedPayload
11820    {
11821        unsafe fn encode(
11822            self,
11823            encoder: &mut fidl::encoding::Encoder<
11824                '_,
11825                fidl::encoding::DefaultFuchsiaResourceDialect,
11826            >,
11827            offset: usize,
11828            mut depth: fidl::encoding::Depth,
11829        ) -> fidl::Result<()> {
11830            encoder.debug_check_bounds::<CapabilityRequestedPayload>(offset);
11831            // Vector header
11832            let max_ordinal: u64 = self.max_ordinal_present();
11833            encoder.write_num(max_ordinal, offset);
11834            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11835            // Calling encoder.out_of_line_offset(0) is not allowed.
11836            if max_ordinal == 0 {
11837                return Ok(());
11838            }
11839            depth.increment()?;
11840            let envelope_size = 8;
11841            let bytes_len = max_ordinal as usize * envelope_size;
11842            #[allow(unused_variables)]
11843            let offset = encoder.out_of_line_offset(bytes_len);
11844            let mut _prev_end_offset: usize = 0;
11845            if 1 > max_ordinal {
11846                return Ok(());
11847            }
11848
11849            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11850            // are envelope_size bytes.
11851            let cur_offset: usize = (1 - 1) * envelope_size;
11852
11853            // Zero reserved fields.
11854            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11855
11856            // Safety:
11857            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11858            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11859            //   envelope_size bytes, there is always sufficient room.
11860            fidl::encoding::encode_in_envelope_optional::<
11861                fidl::encoding::BoundedString<255>,
11862                fidl::encoding::DefaultFuchsiaResourceDialect,
11863            >(
11864                self.name.as_ref().map(
11865                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
11866                ),
11867                encoder,
11868                offset + cur_offset,
11869                depth,
11870            )?;
11871
11872            _prev_end_offset = cur_offset + envelope_size;
11873            if 2 > max_ordinal {
11874                return Ok(());
11875            }
11876
11877            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11878            // are envelope_size bytes.
11879            let cur_offset: usize = (2 - 1) * envelope_size;
11880
11881            // Zero reserved fields.
11882            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11883
11884            // Safety:
11885            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11886            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11887            //   envelope_size bytes, there is always sufficient room.
11888            fidl::encoding::encode_in_envelope_optional::<
11889                fidl::encoding::HandleType<
11890                    fidl::Channel,
11891                    { fidl::ObjectType::CHANNEL.into_raw() },
11892                    2147483648,
11893                >,
11894                fidl::encoding::DefaultFuchsiaResourceDialect,
11895            >(
11896                self.capability.as_mut().map(
11897                    <fidl::encoding::HandleType<
11898                        fidl::Channel,
11899                        { fidl::ObjectType::CHANNEL.into_raw() },
11900                        2147483648,
11901                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11902                ),
11903                encoder,
11904                offset + cur_offset,
11905                depth,
11906            )?;
11907
11908            _prev_end_offset = cur_offset + envelope_size;
11909
11910            Ok(())
11911        }
11912    }
11913
11914    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11915        for CapabilityRequestedPayload
11916    {
11917        #[inline(always)]
11918        fn new_empty() -> Self {
11919            Self::default()
11920        }
11921
11922        unsafe fn decode(
11923            &mut self,
11924            decoder: &mut fidl::encoding::Decoder<
11925                '_,
11926                fidl::encoding::DefaultFuchsiaResourceDialect,
11927            >,
11928            offset: usize,
11929            mut depth: fidl::encoding::Depth,
11930        ) -> fidl::Result<()> {
11931            decoder.debug_check_bounds::<Self>(offset);
11932            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11933                None => return Err(fidl::Error::NotNullable),
11934                Some(len) => len,
11935            };
11936            // Calling decoder.out_of_line_offset(0) is not allowed.
11937            if len == 0 {
11938                return Ok(());
11939            };
11940            depth.increment()?;
11941            let envelope_size = 8;
11942            let bytes_len = len * envelope_size;
11943            let offset = decoder.out_of_line_offset(bytes_len)?;
11944            // Decode the envelope for each type.
11945            let mut _next_ordinal_to_read = 0;
11946            let mut next_offset = offset;
11947            let end_offset = offset + bytes_len;
11948            _next_ordinal_to_read += 1;
11949            if next_offset >= end_offset {
11950                return Ok(());
11951            }
11952
11953            // Decode unknown envelopes for gaps in ordinals.
11954            while _next_ordinal_to_read < 1 {
11955                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11956                _next_ordinal_to_read += 1;
11957                next_offset += envelope_size;
11958            }
11959
11960            let next_out_of_line = decoder.next_out_of_line();
11961            let handles_before = decoder.remaining_handles();
11962            if let Some((inlined, num_bytes, num_handles)) =
11963                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11964            {
11965                let member_inline_size =
11966                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
11967                        decoder.context,
11968                    );
11969                if inlined != (member_inline_size <= 4) {
11970                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11971                }
11972                let inner_offset;
11973                let mut inner_depth = depth.clone();
11974                if inlined {
11975                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11976                    inner_offset = next_offset;
11977                } else {
11978                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11979                    inner_depth.increment()?;
11980                }
11981                let val_ref = self.name.get_or_insert_with(|| {
11982                    fidl::new_empty!(
11983                        fidl::encoding::BoundedString<255>,
11984                        fidl::encoding::DefaultFuchsiaResourceDialect
11985                    )
11986                });
11987                fidl::decode!(
11988                    fidl::encoding::BoundedString<255>,
11989                    fidl::encoding::DefaultFuchsiaResourceDialect,
11990                    val_ref,
11991                    decoder,
11992                    inner_offset,
11993                    inner_depth
11994                )?;
11995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11996                {
11997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11998                }
11999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12001                }
12002            }
12003
12004            next_offset += envelope_size;
12005            _next_ordinal_to_read += 1;
12006            if next_offset >= end_offset {
12007                return Ok(());
12008            }
12009
12010            // Decode unknown envelopes for gaps in ordinals.
12011            while _next_ordinal_to_read < 2 {
12012                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12013                _next_ordinal_to_read += 1;
12014                next_offset += envelope_size;
12015            }
12016
12017            let next_out_of_line = decoder.next_out_of_line();
12018            let handles_before = decoder.remaining_handles();
12019            if let Some((inlined, num_bytes, num_handles)) =
12020                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12021            {
12022                let member_inline_size = <fidl::encoding::HandleType<
12023                    fidl::Channel,
12024                    { fidl::ObjectType::CHANNEL.into_raw() },
12025                    2147483648,
12026                > as fidl::encoding::TypeMarker>::inline_size(
12027                    decoder.context
12028                );
12029                if inlined != (member_inline_size <= 4) {
12030                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12031                }
12032                let inner_offset;
12033                let mut inner_depth = depth.clone();
12034                if inlined {
12035                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12036                    inner_offset = next_offset;
12037                } else {
12038                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12039                    inner_depth.increment()?;
12040                }
12041                let val_ref =
12042                self.capability.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
12043                fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12044                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12045                {
12046                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12047                }
12048                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12049                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12050                }
12051            }
12052
12053            next_offset += envelope_size;
12054
12055            // Decode the remaining unknown envelopes.
12056            while next_offset < end_offset {
12057                _next_ordinal_to_read += 1;
12058                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12059                next_offset += envelope_size;
12060            }
12061
12062            Ok(())
12063        }
12064    }
12065
12066    impl CreateChildArgs {
12067        #[inline(always)]
12068        fn max_ordinal_present(&self) -> u64 {
12069            if let Some(_) = self.additional_inputs {
12070                return 5;
12071            }
12072            if let Some(_) = self.dictionary {
12073                return 4;
12074            }
12075            if let Some(_) = self.controller {
12076                return 3;
12077            }
12078            if let Some(_) = self.dynamic_offers {
12079                return 2;
12080            }
12081            if let Some(_) = self.numbered_handles {
12082                return 1;
12083            }
12084            0
12085        }
12086    }
12087
12088    impl fidl::encoding::ResourceTypeMarker for CreateChildArgs {
12089        type Borrowed<'a> = &'a mut Self;
12090        fn take_or_borrow<'a>(
12091            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12092        ) -> Self::Borrowed<'a> {
12093            value
12094        }
12095    }
12096
12097    unsafe impl fidl::encoding::TypeMarker for CreateChildArgs {
12098        type Owned = Self;
12099
12100        #[inline(always)]
12101        fn inline_align(_context: fidl::encoding::Context) -> usize {
12102            8
12103        }
12104
12105        #[inline(always)]
12106        fn inline_size(_context: fidl::encoding::Context) -> usize {
12107            16
12108        }
12109    }
12110
12111    unsafe impl
12112        fidl::encoding::Encode<CreateChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
12113        for &mut CreateChildArgs
12114    {
12115        unsafe fn encode(
12116            self,
12117            encoder: &mut fidl::encoding::Encoder<
12118                '_,
12119                fidl::encoding::DefaultFuchsiaResourceDialect,
12120            >,
12121            offset: usize,
12122            mut depth: fidl::encoding::Depth,
12123        ) -> fidl::Result<()> {
12124            encoder.debug_check_bounds::<CreateChildArgs>(offset);
12125            // Vector header
12126            let max_ordinal: u64 = self.max_ordinal_present();
12127            encoder.write_num(max_ordinal, offset);
12128            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12129            // Calling encoder.out_of_line_offset(0) is not allowed.
12130            if max_ordinal == 0 {
12131                return Ok(());
12132            }
12133            depth.increment()?;
12134            let envelope_size = 8;
12135            let bytes_len = max_ordinal as usize * envelope_size;
12136            #[allow(unused_variables)]
12137            let offset = encoder.out_of_line_offset(bytes_len);
12138            let mut _prev_end_offset: usize = 0;
12139            if 1 > max_ordinal {
12140                return Ok(());
12141            }
12142
12143            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12144            // are envelope_size bytes.
12145            let cur_offset: usize = (1 - 1) * envelope_size;
12146
12147            // Zero reserved fields.
12148            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12149
12150            // Safety:
12151            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12152            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12153            //   envelope_size bytes, there is always sufficient room.
12154            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12155            self.numbered_handles.as_mut().map(<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12156            encoder, offset + cur_offset, depth
12157        )?;
12158
12159            _prev_end_offset = cur_offset + envelope_size;
12160            if 2 > max_ordinal {
12161                return Ok(());
12162            }
12163
12164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12165            // are envelope_size bytes.
12166            let cur_offset: usize = (2 - 1) * envelope_size;
12167
12168            // Zero reserved fields.
12169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12170
12171            // Safety:
12172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12174            //   envelope_size bytes, there is always sufficient room.
12175            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12176            self.dynamic_offers.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128> as fidl::encoding::ValueTypeMarker>::borrow),
12177            encoder, offset + cur_offset, depth
12178        )?;
12179
12180            _prev_end_offset = cur_offset + envelope_size;
12181            if 3 > max_ordinal {
12182                return Ok(());
12183            }
12184
12185            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12186            // are envelope_size bytes.
12187            let cur_offset: usize = (3 - 1) * envelope_size;
12188
12189            // Zero reserved fields.
12190            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12191
12192            // Safety:
12193            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12194            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12195            //   envelope_size bytes, there is always sufficient room.
12196            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12197            self.controller.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12198            encoder, offset + cur_offset, depth
12199        )?;
12200
12201            _prev_end_offset = cur_offset + envelope_size;
12202            if 4 > max_ordinal {
12203                return Ok(());
12204            }
12205
12206            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12207            // are envelope_size bytes.
12208            let cur_offset: usize = (4 - 1) * envelope_size;
12209
12210            // Zero reserved fields.
12211            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12212
12213            // Safety:
12214            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12215            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12216            //   envelope_size bytes, there is always sufficient room.
12217            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
12218            self.dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12219            encoder, offset + cur_offset, depth
12220        )?;
12221
12222            _prev_end_offset = cur_offset + envelope_size;
12223            if 5 > max_ordinal {
12224                return Ok(());
12225            }
12226
12227            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12228            // are envelope_size bytes.
12229            let cur_offset: usize = (5 - 1) * envelope_size;
12230
12231            // Zero reserved fields.
12232            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12233
12234            // Safety:
12235            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12236            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12237            //   envelope_size bytes, there is always sufficient room.
12238            fidl::encoding::encode_in_envelope_optional::<
12239                fidl::encoding::HandleType<
12240                    fidl::EventPair,
12241                    { fidl::ObjectType::EVENTPAIR.into_raw() },
12242                    2147483648,
12243                >,
12244                fidl::encoding::DefaultFuchsiaResourceDialect,
12245            >(
12246                self.additional_inputs.as_mut().map(
12247                    <fidl::encoding::HandleType<
12248                        fidl::EventPair,
12249                        { fidl::ObjectType::EVENTPAIR.into_raw() },
12250                        2147483648,
12251                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12252                ),
12253                encoder,
12254                offset + cur_offset,
12255                depth,
12256            )?;
12257
12258            _prev_end_offset = cur_offset + envelope_size;
12259
12260            Ok(())
12261        }
12262    }
12263
12264    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12265        for CreateChildArgs
12266    {
12267        #[inline(always)]
12268        fn new_empty() -> Self {
12269            Self::default()
12270        }
12271
12272        unsafe fn decode(
12273            &mut self,
12274            decoder: &mut fidl::encoding::Decoder<
12275                '_,
12276                fidl::encoding::DefaultFuchsiaResourceDialect,
12277            >,
12278            offset: usize,
12279            mut depth: fidl::encoding::Depth,
12280        ) -> fidl::Result<()> {
12281            decoder.debug_check_bounds::<Self>(offset);
12282            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12283                None => return Err(fidl::Error::NotNullable),
12284                Some(len) => len,
12285            };
12286            // Calling decoder.out_of_line_offset(0) is not allowed.
12287            if len == 0 {
12288                return Ok(());
12289            };
12290            depth.increment()?;
12291            let envelope_size = 8;
12292            let bytes_len = len * envelope_size;
12293            let offset = decoder.out_of_line_offset(bytes_len)?;
12294            // Decode the envelope for each type.
12295            let mut _next_ordinal_to_read = 0;
12296            let mut next_offset = offset;
12297            let end_offset = offset + bytes_len;
12298            _next_ordinal_to_read += 1;
12299            if next_offset >= end_offset {
12300                return Ok(());
12301            }
12302
12303            // Decode unknown envelopes for gaps in ordinals.
12304            while _next_ordinal_to_read < 1 {
12305                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12306                _next_ordinal_to_read += 1;
12307                next_offset += envelope_size;
12308            }
12309
12310            let next_out_of_line = decoder.next_out_of_line();
12311            let handles_before = decoder.remaining_handles();
12312            if let Some((inlined, num_bytes, num_handles)) =
12313                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12314            {
12315                let member_inline_size = <fidl::encoding::Vector<
12316                    fidl_fuchsia_process::HandleInfo,
12317                    128,
12318                > as fidl::encoding::TypeMarker>::inline_size(
12319                    decoder.context
12320                );
12321                if inlined != (member_inline_size <= 4) {
12322                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12323                }
12324                let inner_offset;
12325                let mut inner_depth = depth.clone();
12326                if inlined {
12327                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12328                    inner_offset = next_offset;
12329                } else {
12330                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12331                    inner_depth.increment()?;
12332                }
12333                let val_ref =
12334                self.numbered_handles.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
12335                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12336                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12337                {
12338                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12339                }
12340                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12341                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12342                }
12343            }
12344
12345            next_offset += envelope_size;
12346            _next_ordinal_to_read += 1;
12347            if next_offset >= end_offset {
12348                return Ok(());
12349            }
12350
12351            // Decode unknown envelopes for gaps in ordinals.
12352            while _next_ordinal_to_read < 2 {
12353                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12354                _next_ordinal_to_read += 1;
12355                next_offset += envelope_size;
12356            }
12357
12358            let next_out_of_line = decoder.next_out_of_line();
12359            let handles_before = decoder.remaining_handles();
12360            if let Some((inlined, num_bytes, num_handles)) =
12361                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12362            {
12363                let member_inline_size = <fidl::encoding::Vector<
12364                    fidl_fuchsia_component_decl::Offer,
12365                    128,
12366                > as fidl::encoding::TypeMarker>::inline_size(
12367                    decoder.context
12368                );
12369                if inlined != (member_inline_size <= 4) {
12370                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12371                }
12372                let inner_offset;
12373                let mut inner_depth = depth.clone();
12374                if inlined {
12375                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12376                    inner_offset = next_offset;
12377                } else {
12378                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12379                    inner_depth.increment()?;
12380                }
12381                let val_ref =
12382                self.dynamic_offers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
12383                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12384                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12385                {
12386                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12387                }
12388                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12389                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12390                }
12391            }
12392
12393            next_offset += envelope_size;
12394            _next_ordinal_to_read += 1;
12395            if next_offset >= end_offset {
12396                return Ok(());
12397            }
12398
12399            // Decode unknown envelopes for gaps in ordinals.
12400            while _next_ordinal_to_read < 3 {
12401                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12402                _next_ordinal_to_read += 1;
12403                next_offset += envelope_size;
12404            }
12405
12406            let next_out_of_line = decoder.next_out_of_line();
12407            let handles_before = decoder.remaining_handles();
12408            if let Some((inlined, num_bytes, num_handles)) =
12409                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12410            {
12411                let member_inline_size = <fidl::encoding::Endpoint<
12412                    fidl::endpoints::ServerEnd<ControllerMarker>,
12413                > as fidl::encoding::TypeMarker>::inline_size(
12414                    decoder.context
12415                );
12416                if inlined != (member_inline_size <= 4) {
12417                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12418                }
12419                let inner_offset;
12420                let mut inner_depth = depth.clone();
12421                if inlined {
12422                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12423                    inner_offset = next_offset;
12424                } else {
12425                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12426                    inner_depth.increment()?;
12427                }
12428                let val_ref = self.controller.get_or_insert_with(|| {
12429                    fidl::new_empty!(
12430                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
12431                        fidl::encoding::DefaultFuchsiaResourceDialect
12432                    )
12433                });
12434                fidl::decode!(
12435                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
12436                    fidl::encoding::DefaultFuchsiaResourceDialect,
12437                    val_ref,
12438                    decoder,
12439                    inner_offset,
12440                    inner_depth
12441                )?;
12442                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12443                {
12444                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12445                }
12446                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12447                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12448                }
12449            }
12450
12451            next_offset += envelope_size;
12452            _next_ordinal_to_read += 1;
12453            if next_offset >= end_offset {
12454                return Ok(());
12455            }
12456
12457            // Decode unknown envelopes for gaps in ordinals.
12458            while _next_ordinal_to_read < 4 {
12459                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12460                _next_ordinal_to_read += 1;
12461                next_offset += envelope_size;
12462            }
12463
12464            let next_out_of_line = decoder.next_out_of_line();
12465            let handles_before = decoder.remaining_handles();
12466            if let Some((inlined, num_bytes, num_handles)) =
12467                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12468            {
12469                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12470                if inlined != (member_inline_size <= 4) {
12471                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12472                }
12473                let inner_offset;
12474                let mut inner_depth = depth.clone();
12475                if inlined {
12476                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12477                    inner_offset = next_offset;
12478                } else {
12479                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12480                    inner_depth.increment()?;
12481                }
12482                let val_ref = self.dictionary.get_or_insert_with(|| {
12483                    fidl::new_empty!(
12484                        fidl_fuchsia_component_sandbox::DictionaryRef,
12485                        fidl::encoding::DefaultFuchsiaResourceDialect
12486                    )
12487                });
12488                fidl::decode!(
12489                    fidl_fuchsia_component_sandbox::DictionaryRef,
12490                    fidl::encoding::DefaultFuchsiaResourceDialect,
12491                    val_ref,
12492                    decoder,
12493                    inner_offset,
12494                    inner_depth
12495                )?;
12496                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12497                {
12498                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12499                }
12500                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12501                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12502                }
12503            }
12504
12505            next_offset += envelope_size;
12506            _next_ordinal_to_read += 1;
12507            if next_offset >= end_offset {
12508                return Ok(());
12509            }
12510
12511            // Decode unknown envelopes for gaps in ordinals.
12512            while _next_ordinal_to_read < 5 {
12513                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12514                _next_ordinal_to_read += 1;
12515                next_offset += envelope_size;
12516            }
12517
12518            let next_out_of_line = decoder.next_out_of_line();
12519            let handles_before = decoder.remaining_handles();
12520            if let Some((inlined, num_bytes, num_handles)) =
12521                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12522            {
12523                let member_inline_size = <fidl::encoding::HandleType<
12524                    fidl::EventPair,
12525                    { fidl::ObjectType::EVENTPAIR.into_raw() },
12526                    2147483648,
12527                > as fidl::encoding::TypeMarker>::inline_size(
12528                    decoder.context
12529                );
12530                if inlined != (member_inline_size <= 4) {
12531                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12532                }
12533                let inner_offset;
12534                let mut inner_depth = depth.clone();
12535                if inlined {
12536                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12537                    inner_offset = next_offset;
12538                } else {
12539                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12540                    inner_depth.increment()?;
12541                }
12542                let val_ref =
12543                self.additional_inputs.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
12544                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12545                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12546                {
12547                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12548                }
12549                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12550                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12551                }
12552            }
12553
12554            next_offset += envelope_size;
12555
12556            // Decode the remaining unknown envelopes.
12557            while next_offset < end_offset {
12558                _next_ordinal_to_read += 1;
12559                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12560                next_offset += envelope_size;
12561            }
12562
12563            Ok(())
12564        }
12565    }
12566
12567    impl DebugStartedPayload {
12568        #[inline(always)]
12569        fn max_ordinal_present(&self) -> u64 {
12570            if let Some(_) = self.break_on_start {
12571                return 2;
12572            }
12573            if let Some(_) = self.runtime_dir {
12574                return 1;
12575            }
12576            0
12577        }
12578    }
12579
12580    impl fidl::encoding::ResourceTypeMarker for DebugStartedPayload {
12581        type Borrowed<'a> = &'a mut Self;
12582        fn take_or_borrow<'a>(
12583            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12584        ) -> Self::Borrowed<'a> {
12585            value
12586        }
12587    }
12588
12589    unsafe impl fidl::encoding::TypeMarker for DebugStartedPayload {
12590        type Owned = Self;
12591
12592        #[inline(always)]
12593        fn inline_align(_context: fidl::encoding::Context) -> usize {
12594            8
12595        }
12596
12597        #[inline(always)]
12598        fn inline_size(_context: fidl::encoding::Context) -> usize {
12599            16
12600        }
12601    }
12602
12603    unsafe impl
12604        fidl::encoding::Encode<DebugStartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>
12605        for &mut DebugStartedPayload
12606    {
12607        unsafe fn encode(
12608            self,
12609            encoder: &mut fidl::encoding::Encoder<
12610                '_,
12611                fidl::encoding::DefaultFuchsiaResourceDialect,
12612            >,
12613            offset: usize,
12614            mut depth: fidl::encoding::Depth,
12615        ) -> fidl::Result<()> {
12616            encoder.debug_check_bounds::<DebugStartedPayload>(offset);
12617            // Vector header
12618            let max_ordinal: u64 = self.max_ordinal_present();
12619            encoder.write_num(max_ordinal, offset);
12620            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12621            // Calling encoder.out_of_line_offset(0) is not allowed.
12622            if max_ordinal == 0 {
12623                return Ok(());
12624            }
12625            depth.increment()?;
12626            let envelope_size = 8;
12627            let bytes_len = max_ordinal as usize * envelope_size;
12628            #[allow(unused_variables)]
12629            let offset = encoder.out_of_line_offset(bytes_len);
12630            let mut _prev_end_offset: usize = 0;
12631            if 1 > max_ordinal {
12632                return Ok(());
12633            }
12634
12635            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12636            // are envelope_size bytes.
12637            let cur_offset: usize = (1 - 1) * envelope_size;
12638
12639            // Zero reserved fields.
12640            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12641
12642            // Safety:
12643            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12644            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12645            //   envelope_size bytes, there is always sufficient room.
12646            fidl::encoding::encode_in_envelope_optional::<
12647                fidl::encoding::Endpoint<
12648                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12649                >,
12650                fidl::encoding::DefaultFuchsiaResourceDialect,
12651            >(
12652                self.runtime_dir.as_mut().map(
12653                    <fidl::encoding::Endpoint<
12654                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12655                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12656                ),
12657                encoder,
12658                offset + cur_offset,
12659                depth,
12660            )?;
12661
12662            _prev_end_offset = cur_offset + envelope_size;
12663            if 2 > max_ordinal {
12664                return Ok(());
12665            }
12666
12667            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12668            // are envelope_size bytes.
12669            let cur_offset: usize = (2 - 1) * envelope_size;
12670
12671            // Zero reserved fields.
12672            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12673
12674            // Safety:
12675            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12676            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12677            //   envelope_size bytes, there is always sufficient room.
12678            fidl::encoding::encode_in_envelope_optional::<
12679                fidl::encoding::HandleType<
12680                    fidl::EventPair,
12681                    { fidl::ObjectType::EVENTPAIR.into_raw() },
12682                    2147483648,
12683                >,
12684                fidl::encoding::DefaultFuchsiaResourceDialect,
12685            >(
12686                self.break_on_start.as_mut().map(
12687                    <fidl::encoding::HandleType<
12688                        fidl::EventPair,
12689                        { fidl::ObjectType::EVENTPAIR.into_raw() },
12690                        2147483648,
12691                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12692                ),
12693                encoder,
12694                offset + cur_offset,
12695                depth,
12696            )?;
12697
12698            _prev_end_offset = cur_offset + envelope_size;
12699
12700            Ok(())
12701        }
12702    }
12703
12704    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12705        for DebugStartedPayload
12706    {
12707        #[inline(always)]
12708        fn new_empty() -> Self {
12709            Self::default()
12710        }
12711
12712        unsafe fn decode(
12713            &mut self,
12714            decoder: &mut fidl::encoding::Decoder<
12715                '_,
12716                fidl::encoding::DefaultFuchsiaResourceDialect,
12717            >,
12718            offset: usize,
12719            mut depth: fidl::encoding::Depth,
12720        ) -> fidl::Result<()> {
12721            decoder.debug_check_bounds::<Self>(offset);
12722            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12723                None => return Err(fidl::Error::NotNullable),
12724                Some(len) => len,
12725            };
12726            // Calling decoder.out_of_line_offset(0) is not allowed.
12727            if len == 0 {
12728                return Ok(());
12729            };
12730            depth.increment()?;
12731            let envelope_size = 8;
12732            let bytes_len = len * envelope_size;
12733            let offset = decoder.out_of_line_offset(bytes_len)?;
12734            // Decode the envelope for each type.
12735            let mut _next_ordinal_to_read = 0;
12736            let mut next_offset = offset;
12737            let end_offset = offset + bytes_len;
12738            _next_ordinal_to_read += 1;
12739            if next_offset >= end_offset {
12740                return Ok(());
12741            }
12742
12743            // Decode unknown envelopes for gaps in ordinals.
12744            while _next_ordinal_to_read < 1 {
12745                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12746                _next_ordinal_to_read += 1;
12747                next_offset += envelope_size;
12748            }
12749
12750            let next_out_of_line = decoder.next_out_of_line();
12751            let handles_before = decoder.remaining_handles();
12752            if let Some((inlined, num_bytes, num_handles)) =
12753                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12754            {
12755                let member_inline_size = <fidl::encoding::Endpoint<
12756                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12757                > as fidl::encoding::TypeMarker>::inline_size(
12758                    decoder.context
12759                );
12760                if inlined != (member_inline_size <= 4) {
12761                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12762                }
12763                let inner_offset;
12764                let mut inner_depth = depth.clone();
12765                if inlined {
12766                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12767                    inner_offset = next_offset;
12768                } else {
12769                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12770                    inner_depth.increment()?;
12771                }
12772                let val_ref = self.runtime_dir.get_or_insert_with(|| {
12773                    fidl::new_empty!(
12774                        fidl::encoding::Endpoint<
12775                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12776                        >,
12777                        fidl::encoding::DefaultFuchsiaResourceDialect
12778                    )
12779                });
12780                fidl::decode!(
12781                    fidl::encoding::Endpoint<
12782                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12783                    >,
12784                    fidl::encoding::DefaultFuchsiaResourceDialect,
12785                    val_ref,
12786                    decoder,
12787                    inner_offset,
12788                    inner_depth
12789                )?;
12790                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12791                {
12792                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12793                }
12794                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12795                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12796                }
12797            }
12798
12799            next_offset += envelope_size;
12800            _next_ordinal_to_read += 1;
12801            if next_offset >= end_offset {
12802                return Ok(());
12803            }
12804
12805            // Decode unknown envelopes for gaps in ordinals.
12806            while _next_ordinal_to_read < 2 {
12807                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12808                _next_ordinal_to_read += 1;
12809                next_offset += envelope_size;
12810            }
12811
12812            let next_out_of_line = decoder.next_out_of_line();
12813            let handles_before = decoder.remaining_handles();
12814            if let Some((inlined, num_bytes, num_handles)) =
12815                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12816            {
12817                let member_inline_size = <fidl::encoding::HandleType<
12818                    fidl::EventPair,
12819                    { fidl::ObjectType::EVENTPAIR.into_raw() },
12820                    2147483648,
12821                > as fidl::encoding::TypeMarker>::inline_size(
12822                    decoder.context
12823                );
12824                if inlined != (member_inline_size <= 4) {
12825                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12826                }
12827                let inner_offset;
12828                let mut inner_depth = depth.clone();
12829                if inlined {
12830                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12831                    inner_offset = next_offset;
12832                } else {
12833                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12834                    inner_depth.increment()?;
12835                }
12836                let val_ref =
12837                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));
12838                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12839                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12840                {
12841                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12842                }
12843                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12844                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12845                }
12846            }
12847
12848            next_offset += envelope_size;
12849
12850            // Decode the remaining unknown envelopes.
12851            while next_offset < end_offset {
12852                _next_ordinal_to_read += 1;
12853                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12854                next_offset += envelope_size;
12855            }
12856
12857            Ok(())
12858        }
12859    }
12860
12861    impl Event {
12862        #[inline(always)]
12863        fn max_ordinal_present(&self) -> u64 {
12864            if let Some(_) = self.payload {
12865                return 2;
12866            }
12867            if let Some(_) = self.header {
12868                return 1;
12869            }
12870            0
12871        }
12872    }
12873
12874    impl fidl::encoding::ResourceTypeMarker for Event {
12875        type Borrowed<'a> = &'a mut Self;
12876        fn take_or_borrow<'a>(
12877            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12878        ) -> Self::Borrowed<'a> {
12879            value
12880        }
12881    }
12882
12883    unsafe impl fidl::encoding::TypeMarker for Event {
12884        type Owned = Self;
12885
12886        #[inline(always)]
12887        fn inline_align(_context: fidl::encoding::Context) -> usize {
12888            8
12889        }
12890
12891        #[inline(always)]
12892        fn inline_size(_context: fidl::encoding::Context) -> usize {
12893            16
12894        }
12895    }
12896
12897    unsafe impl fidl::encoding::Encode<Event, fidl::encoding::DefaultFuchsiaResourceDialect>
12898        for &mut Event
12899    {
12900        unsafe fn encode(
12901            self,
12902            encoder: &mut fidl::encoding::Encoder<
12903                '_,
12904                fidl::encoding::DefaultFuchsiaResourceDialect,
12905            >,
12906            offset: usize,
12907            mut depth: fidl::encoding::Depth,
12908        ) -> fidl::Result<()> {
12909            encoder.debug_check_bounds::<Event>(offset);
12910            // Vector header
12911            let max_ordinal: u64 = self.max_ordinal_present();
12912            encoder.write_num(max_ordinal, offset);
12913            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12914            // Calling encoder.out_of_line_offset(0) is not allowed.
12915            if max_ordinal == 0 {
12916                return Ok(());
12917            }
12918            depth.increment()?;
12919            let envelope_size = 8;
12920            let bytes_len = max_ordinal as usize * envelope_size;
12921            #[allow(unused_variables)]
12922            let offset = encoder.out_of_line_offset(bytes_len);
12923            let mut _prev_end_offset: usize = 0;
12924            if 1 > max_ordinal {
12925                return Ok(());
12926            }
12927
12928            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12929            // are envelope_size bytes.
12930            let cur_offset: usize = (1 - 1) * envelope_size;
12931
12932            // Zero reserved fields.
12933            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12934
12935            // Safety:
12936            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12937            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12938            //   envelope_size bytes, there is always sufficient room.
12939            fidl::encoding::encode_in_envelope_optional::<
12940                EventHeader,
12941                fidl::encoding::DefaultFuchsiaResourceDialect,
12942            >(
12943                self.header.as_ref().map(<EventHeader as fidl::encoding::ValueTypeMarker>::borrow),
12944                encoder,
12945                offset + cur_offset,
12946                depth,
12947            )?;
12948
12949            _prev_end_offset = cur_offset + envelope_size;
12950            if 2 > max_ordinal {
12951                return Ok(());
12952            }
12953
12954            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12955            // are envelope_size bytes.
12956            let cur_offset: usize = (2 - 1) * envelope_size;
12957
12958            // Zero reserved fields.
12959            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12960
12961            // Safety:
12962            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12963            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12964            //   envelope_size bytes, there is always sufficient room.
12965            fidl::encoding::encode_in_envelope_optional::<
12966                EventPayload,
12967                fidl::encoding::DefaultFuchsiaResourceDialect,
12968            >(
12969                self.payload
12970                    .as_mut()
12971                    .map(<EventPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12972                encoder,
12973                offset + cur_offset,
12974                depth,
12975            )?;
12976
12977            _prev_end_offset = cur_offset + envelope_size;
12978
12979            Ok(())
12980        }
12981    }
12982
12983    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Event {
12984        #[inline(always)]
12985        fn new_empty() -> Self {
12986            Self::default()
12987        }
12988
12989        unsafe fn decode(
12990            &mut self,
12991            decoder: &mut fidl::encoding::Decoder<
12992                '_,
12993                fidl::encoding::DefaultFuchsiaResourceDialect,
12994            >,
12995            offset: usize,
12996            mut depth: fidl::encoding::Depth,
12997        ) -> fidl::Result<()> {
12998            decoder.debug_check_bounds::<Self>(offset);
12999            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13000                None => return Err(fidl::Error::NotNullable),
13001                Some(len) => len,
13002            };
13003            // Calling decoder.out_of_line_offset(0) is not allowed.
13004            if len == 0 {
13005                return Ok(());
13006            };
13007            depth.increment()?;
13008            let envelope_size = 8;
13009            let bytes_len = len * envelope_size;
13010            let offset = decoder.out_of_line_offset(bytes_len)?;
13011            // Decode the envelope for each type.
13012            let mut _next_ordinal_to_read = 0;
13013            let mut next_offset = offset;
13014            let end_offset = offset + bytes_len;
13015            _next_ordinal_to_read += 1;
13016            if next_offset >= end_offset {
13017                return Ok(());
13018            }
13019
13020            // Decode unknown envelopes for gaps in ordinals.
13021            while _next_ordinal_to_read < 1 {
13022                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13023                _next_ordinal_to_read += 1;
13024                next_offset += envelope_size;
13025            }
13026
13027            let next_out_of_line = decoder.next_out_of_line();
13028            let handles_before = decoder.remaining_handles();
13029            if let Some((inlined, num_bytes, num_handles)) =
13030                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13031            {
13032                let member_inline_size =
13033                    <EventHeader as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13034                if inlined != (member_inline_size <= 4) {
13035                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13036                }
13037                let inner_offset;
13038                let mut inner_depth = depth.clone();
13039                if inlined {
13040                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13041                    inner_offset = next_offset;
13042                } else {
13043                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13044                    inner_depth.increment()?;
13045                }
13046                let val_ref = self.header.get_or_insert_with(|| {
13047                    fidl::new_empty!(EventHeader, fidl::encoding::DefaultFuchsiaResourceDialect)
13048                });
13049                fidl::decode!(
13050                    EventHeader,
13051                    fidl::encoding::DefaultFuchsiaResourceDialect,
13052                    val_ref,
13053                    decoder,
13054                    inner_offset,
13055                    inner_depth
13056                )?;
13057                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13058                {
13059                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13060                }
13061                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13062                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13063                }
13064            }
13065
13066            next_offset += envelope_size;
13067            _next_ordinal_to_read += 1;
13068            if next_offset >= end_offset {
13069                return Ok(());
13070            }
13071
13072            // Decode unknown envelopes for gaps in ordinals.
13073            while _next_ordinal_to_read < 2 {
13074                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13075                _next_ordinal_to_read += 1;
13076                next_offset += envelope_size;
13077            }
13078
13079            let next_out_of_line = decoder.next_out_of_line();
13080            let handles_before = decoder.remaining_handles();
13081            if let Some((inlined, num_bytes, num_handles)) =
13082                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13083            {
13084                let member_inline_size =
13085                    <EventPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13086                if inlined != (member_inline_size <= 4) {
13087                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13088                }
13089                let inner_offset;
13090                let mut inner_depth = depth.clone();
13091                if inlined {
13092                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13093                    inner_offset = next_offset;
13094                } else {
13095                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13096                    inner_depth.increment()?;
13097                }
13098                let val_ref = self.payload.get_or_insert_with(|| {
13099                    fidl::new_empty!(EventPayload, fidl::encoding::DefaultFuchsiaResourceDialect)
13100                });
13101                fidl::decode!(
13102                    EventPayload,
13103                    fidl::encoding::DefaultFuchsiaResourceDialect,
13104                    val_ref,
13105                    decoder,
13106                    inner_offset,
13107                    inner_depth
13108                )?;
13109                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13110                {
13111                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13112                }
13113                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13114                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13115                }
13116            }
13117
13118            next_offset += envelope_size;
13119
13120            // Decode the remaining unknown envelopes.
13121            while next_offset < end_offset {
13122                _next_ordinal_to_read += 1;
13123                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13124                next_offset += envelope_size;
13125            }
13126
13127            Ok(())
13128        }
13129    }
13130
13131    impl NamespaceEntry {
13132        #[inline(always)]
13133        fn max_ordinal_present(&self) -> u64 {
13134            if let Some(_) = self.directory {
13135                return 2;
13136            }
13137            if let Some(_) = self.path {
13138                return 1;
13139            }
13140            0
13141        }
13142    }
13143
13144    impl fidl::encoding::ResourceTypeMarker for NamespaceEntry {
13145        type Borrowed<'a> = &'a mut Self;
13146        fn take_or_borrow<'a>(
13147            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13148        ) -> Self::Borrowed<'a> {
13149            value
13150        }
13151    }
13152
13153    unsafe impl fidl::encoding::TypeMarker for NamespaceEntry {
13154        type Owned = Self;
13155
13156        #[inline(always)]
13157        fn inline_align(_context: fidl::encoding::Context) -> usize {
13158            8
13159        }
13160
13161        #[inline(always)]
13162        fn inline_size(_context: fidl::encoding::Context) -> usize {
13163            16
13164        }
13165    }
13166
13167    unsafe impl
13168        fidl::encoding::Encode<NamespaceEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
13169        for &mut NamespaceEntry
13170    {
13171        unsafe fn encode(
13172            self,
13173            encoder: &mut fidl::encoding::Encoder<
13174                '_,
13175                fidl::encoding::DefaultFuchsiaResourceDialect,
13176            >,
13177            offset: usize,
13178            mut depth: fidl::encoding::Depth,
13179        ) -> fidl::Result<()> {
13180            encoder.debug_check_bounds::<NamespaceEntry>(offset);
13181            // Vector header
13182            let max_ordinal: u64 = self.max_ordinal_present();
13183            encoder.write_num(max_ordinal, offset);
13184            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13185            // Calling encoder.out_of_line_offset(0) is not allowed.
13186            if max_ordinal == 0 {
13187                return Ok(());
13188            }
13189            depth.increment()?;
13190            let envelope_size = 8;
13191            let bytes_len = max_ordinal as usize * envelope_size;
13192            #[allow(unused_variables)]
13193            let offset = encoder.out_of_line_offset(bytes_len);
13194            let mut _prev_end_offset: usize = 0;
13195            if 1 > max_ordinal {
13196                return Ok(());
13197            }
13198
13199            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13200            // are envelope_size bytes.
13201            let cur_offset: usize = (1 - 1) * envelope_size;
13202
13203            // Zero reserved fields.
13204            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13205
13206            // Safety:
13207            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13208            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13209            //   envelope_size bytes, there is always sufficient room.
13210            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4095>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13211            self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
13212            encoder, offset + cur_offset, depth
13213        )?;
13214
13215            _prev_end_offset = cur_offset + envelope_size;
13216            if 2 > max_ordinal {
13217                return Ok(());
13218            }
13219
13220            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13221            // are envelope_size bytes.
13222            let cur_offset: usize = (2 - 1) * envelope_size;
13223
13224            // Zero reserved fields.
13225            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13226
13227            // Safety:
13228            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13229            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13230            //   envelope_size bytes, there is always sufficient room.
13231            fidl::encoding::encode_in_envelope_optional::<
13232                fidl::encoding::Endpoint<
13233                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13234                >,
13235                fidl::encoding::DefaultFuchsiaResourceDialect,
13236            >(
13237                self.directory.as_mut().map(
13238                    <fidl::encoding::Endpoint<
13239                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13240                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13241                ),
13242                encoder,
13243                offset + cur_offset,
13244                depth,
13245            )?;
13246
13247            _prev_end_offset = cur_offset + envelope_size;
13248
13249            Ok(())
13250        }
13251    }
13252
13253    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13254        for NamespaceEntry
13255    {
13256        #[inline(always)]
13257        fn new_empty() -> Self {
13258            Self::default()
13259        }
13260
13261        unsafe fn decode(
13262            &mut self,
13263            decoder: &mut fidl::encoding::Decoder<
13264                '_,
13265                fidl::encoding::DefaultFuchsiaResourceDialect,
13266            >,
13267            offset: usize,
13268            mut depth: fidl::encoding::Depth,
13269        ) -> fidl::Result<()> {
13270            decoder.debug_check_bounds::<Self>(offset);
13271            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13272                None => return Err(fidl::Error::NotNullable),
13273                Some(len) => len,
13274            };
13275            // Calling decoder.out_of_line_offset(0) is not allowed.
13276            if len == 0 {
13277                return Ok(());
13278            };
13279            depth.increment()?;
13280            let envelope_size = 8;
13281            let bytes_len = len * envelope_size;
13282            let offset = decoder.out_of_line_offset(bytes_len)?;
13283            // Decode the envelope for each type.
13284            let mut _next_ordinal_to_read = 0;
13285            let mut next_offset = offset;
13286            let end_offset = offset + bytes_len;
13287            _next_ordinal_to_read += 1;
13288            if next_offset >= end_offset {
13289                return Ok(());
13290            }
13291
13292            // Decode unknown envelopes for gaps in ordinals.
13293            while _next_ordinal_to_read < 1 {
13294                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13295                _next_ordinal_to_read += 1;
13296                next_offset += envelope_size;
13297            }
13298
13299            let next_out_of_line = decoder.next_out_of_line();
13300            let handles_before = decoder.remaining_handles();
13301            if let Some((inlined, num_bytes, num_handles)) =
13302                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13303            {
13304                let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13305                if inlined != (member_inline_size <= 4) {
13306                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13307                }
13308                let inner_offset;
13309                let mut inner_depth = depth.clone();
13310                if inlined {
13311                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13312                    inner_offset = next_offset;
13313                } else {
13314                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13315                    inner_depth.increment()?;
13316                }
13317                let val_ref = self.path.get_or_insert_with(|| {
13318                    fidl::new_empty!(
13319                        fidl::encoding::BoundedString<4095>,
13320                        fidl::encoding::DefaultFuchsiaResourceDialect
13321                    )
13322                });
13323                fidl::decode!(
13324                    fidl::encoding::BoundedString<4095>,
13325                    fidl::encoding::DefaultFuchsiaResourceDialect,
13326                    val_ref,
13327                    decoder,
13328                    inner_offset,
13329                    inner_depth
13330                )?;
13331                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13332                {
13333                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13334                }
13335                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13336                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13337                }
13338            }
13339
13340            next_offset += envelope_size;
13341            _next_ordinal_to_read += 1;
13342            if next_offset >= end_offset {
13343                return Ok(());
13344            }
13345
13346            // Decode unknown envelopes for gaps in ordinals.
13347            while _next_ordinal_to_read < 2 {
13348                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13349                _next_ordinal_to_read += 1;
13350                next_offset += envelope_size;
13351            }
13352
13353            let next_out_of_line = decoder.next_out_of_line();
13354            let handles_before = decoder.remaining_handles();
13355            if let Some((inlined, num_bytes, num_handles)) =
13356                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13357            {
13358                let member_inline_size = <fidl::encoding::Endpoint<
13359                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13360                > as fidl::encoding::TypeMarker>::inline_size(
13361                    decoder.context
13362                );
13363                if inlined != (member_inline_size <= 4) {
13364                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13365                }
13366                let inner_offset;
13367                let mut inner_depth = depth.clone();
13368                if inlined {
13369                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13370                    inner_offset = next_offset;
13371                } else {
13372                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13373                    inner_depth.increment()?;
13374                }
13375                let val_ref = self.directory.get_or_insert_with(|| {
13376                    fidl::new_empty!(
13377                        fidl::encoding::Endpoint<
13378                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13379                        >,
13380                        fidl::encoding::DefaultFuchsiaResourceDialect
13381                    )
13382                });
13383                fidl::decode!(
13384                    fidl::encoding::Endpoint<
13385                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13386                    >,
13387                    fidl::encoding::DefaultFuchsiaResourceDialect,
13388                    val_ref,
13389                    decoder,
13390                    inner_offset,
13391                    inner_depth
13392                )?;
13393                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13394                {
13395                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13396                }
13397                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13398                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13399                }
13400            }
13401
13402            next_offset += envelope_size;
13403
13404            // Decode the remaining unknown envelopes.
13405            while next_offset < end_offset {
13406                _next_ordinal_to_read += 1;
13407                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13408                next_offset += envelope_size;
13409            }
13410
13411            Ok(())
13412        }
13413    }
13414
13415    impl StartChildArgs {
13416        #[inline(always)]
13417        fn max_ordinal_present(&self) -> u64 {
13418            if let Some(_) = self.additional_inputs {
13419                return 4;
13420            }
13421            if let Some(_) = self.dictionary {
13422                return 3;
13423            }
13424            if let Some(_) = self.namespace_entries {
13425                return 2;
13426            }
13427            if let Some(_) = self.numbered_handles {
13428                return 1;
13429            }
13430            0
13431        }
13432    }
13433
13434    impl fidl::encoding::ResourceTypeMarker for StartChildArgs {
13435        type Borrowed<'a> = &'a mut Self;
13436        fn take_or_borrow<'a>(
13437            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13438        ) -> Self::Borrowed<'a> {
13439            value
13440        }
13441    }
13442
13443    unsafe impl fidl::encoding::TypeMarker for StartChildArgs {
13444        type Owned = Self;
13445
13446        #[inline(always)]
13447        fn inline_align(_context: fidl::encoding::Context) -> usize {
13448            8
13449        }
13450
13451        #[inline(always)]
13452        fn inline_size(_context: fidl::encoding::Context) -> usize {
13453            16
13454        }
13455    }
13456
13457    unsafe impl
13458        fidl::encoding::Encode<StartChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
13459        for &mut StartChildArgs
13460    {
13461        unsafe fn encode(
13462            self,
13463            encoder: &mut fidl::encoding::Encoder<
13464                '_,
13465                fidl::encoding::DefaultFuchsiaResourceDialect,
13466            >,
13467            offset: usize,
13468            mut depth: fidl::encoding::Depth,
13469        ) -> fidl::Result<()> {
13470            encoder.debug_check_bounds::<StartChildArgs>(offset);
13471            // Vector header
13472            let max_ordinal: u64 = self.max_ordinal_present();
13473            encoder.write_num(max_ordinal, offset);
13474            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13475            // Calling encoder.out_of_line_offset(0) is not allowed.
13476            if max_ordinal == 0 {
13477                return Ok(());
13478            }
13479            depth.increment()?;
13480            let envelope_size = 8;
13481            let bytes_len = max_ordinal as usize * envelope_size;
13482            #[allow(unused_variables)]
13483            let offset = encoder.out_of_line_offset(bytes_len);
13484            let mut _prev_end_offset: usize = 0;
13485            if 1 > max_ordinal {
13486                return Ok(());
13487            }
13488
13489            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13490            // are envelope_size bytes.
13491            let cur_offset: usize = (1 - 1) * envelope_size;
13492
13493            // Zero reserved fields.
13494            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13495
13496            // Safety:
13497            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13498            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13499            //   envelope_size bytes, there is always sufficient room.
13500            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13501            self.numbered_handles.as_mut().map(<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13502            encoder, offset + cur_offset, depth
13503        )?;
13504
13505            _prev_end_offset = cur_offset + envelope_size;
13506            if 2 > max_ordinal {
13507                return Ok(());
13508            }
13509
13510            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13511            // are envelope_size bytes.
13512            let cur_offset: usize = (2 - 1) * envelope_size;
13513
13514            // Zero reserved fields.
13515            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13516
13517            // Safety:
13518            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13519            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13520            //   envelope_size bytes, there is always sufficient room.
13521            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13522            self.namespace_entries.as_mut().map(<fidl::encoding::Vector<NamespaceEntry, 32> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13523            encoder, offset + cur_offset, depth
13524        )?;
13525
13526            _prev_end_offset = cur_offset + envelope_size;
13527            if 3 > max_ordinal {
13528                return Ok(());
13529            }
13530
13531            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13532            // are envelope_size bytes.
13533            let cur_offset: usize = (3 - 1) * envelope_size;
13534
13535            // Zero reserved fields.
13536            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13537
13538            // Safety:
13539            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13540            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13541            //   envelope_size bytes, there is always sufficient room.
13542            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
13543            self.dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13544            encoder, offset + cur_offset, depth
13545        )?;
13546
13547            _prev_end_offset = cur_offset + envelope_size;
13548            if 4 > max_ordinal {
13549                return Ok(());
13550            }
13551
13552            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13553            // are envelope_size bytes.
13554            let cur_offset: usize = (4 - 1) * envelope_size;
13555
13556            // Zero reserved fields.
13557            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13558
13559            // Safety:
13560            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13561            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13562            //   envelope_size bytes, there is always sufficient room.
13563            fidl::encoding::encode_in_envelope_optional::<
13564                fidl::encoding::HandleType<
13565                    fidl::EventPair,
13566                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13567                    2147483648,
13568                >,
13569                fidl::encoding::DefaultFuchsiaResourceDialect,
13570            >(
13571                self.additional_inputs.as_mut().map(
13572                    <fidl::encoding::HandleType<
13573                        fidl::EventPair,
13574                        { fidl::ObjectType::EVENTPAIR.into_raw() },
13575                        2147483648,
13576                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13577                ),
13578                encoder,
13579                offset + cur_offset,
13580                depth,
13581            )?;
13582
13583            _prev_end_offset = cur_offset + envelope_size;
13584
13585            Ok(())
13586        }
13587    }
13588
13589    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13590        for StartChildArgs
13591    {
13592        #[inline(always)]
13593        fn new_empty() -> Self {
13594            Self::default()
13595        }
13596
13597        unsafe fn decode(
13598            &mut self,
13599            decoder: &mut fidl::encoding::Decoder<
13600                '_,
13601                fidl::encoding::DefaultFuchsiaResourceDialect,
13602            >,
13603            offset: usize,
13604            mut depth: fidl::encoding::Depth,
13605        ) -> fidl::Result<()> {
13606            decoder.debug_check_bounds::<Self>(offset);
13607            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13608                None => return Err(fidl::Error::NotNullable),
13609                Some(len) => len,
13610            };
13611            // Calling decoder.out_of_line_offset(0) is not allowed.
13612            if len == 0 {
13613                return Ok(());
13614            };
13615            depth.increment()?;
13616            let envelope_size = 8;
13617            let bytes_len = len * envelope_size;
13618            let offset = decoder.out_of_line_offset(bytes_len)?;
13619            // Decode the envelope for each type.
13620            let mut _next_ordinal_to_read = 0;
13621            let mut next_offset = offset;
13622            let end_offset = offset + bytes_len;
13623            _next_ordinal_to_read += 1;
13624            if next_offset >= end_offset {
13625                return Ok(());
13626            }
13627
13628            // Decode unknown envelopes for gaps in ordinals.
13629            while _next_ordinal_to_read < 1 {
13630                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13631                _next_ordinal_to_read += 1;
13632                next_offset += envelope_size;
13633            }
13634
13635            let next_out_of_line = decoder.next_out_of_line();
13636            let handles_before = decoder.remaining_handles();
13637            if let Some((inlined, num_bytes, num_handles)) =
13638                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13639            {
13640                let member_inline_size = <fidl::encoding::Vector<
13641                    fidl_fuchsia_process::HandleInfo,
13642                    128,
13643                > as fidl::encoding::TypeMarker>::inline_size(
13644                    decoder.context
13645                );
13646                if inlined != (member_inline_size <= 4) {
13647                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13648                }
13649                let inner_offset;
13650                let mut inner_depth = depth.clone();
13651                if inlined {
13652                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13653                    inner_offset = next_offset;
13654                } else {
13655                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13656                    inner_depth.increment()?;
13657                }
13658                let val_ref =
13659                self.numbered_handles.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
13660                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13661                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13662                {
13663                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13664                }
13665                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13666                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13667                }
13668            }
13669
13670            next_offset += envelope_size;
13671            _next_ordinal_to_read += 1;
13672            if next_offset >= end_offset {
13673                return Ok(());
13674            }
13675
13676            // Decode unknown envelopes for gaps in ordinals.
13677            while _next_ordinal_to_read < 2 {
13678                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13679                _next_ordinal_to_read += 1;
13680                next_offset += envelope_size;
13681            }
13682
13683            let next_out_of_line = decoder.next_out_of_line();
13684            let handles_before = decoder.remaining_handles();
13685            if let Some((inlined, num_bytes, num_handles)) =
13686                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13687            {
13688                let member_inline_size = <fidl::encoding::Vector<NamespaceEntry, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13689                if inlined != (member_inline_size <= 4) {
13690                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13691                }
13692                let inner_offset;
13693                let mut inner_depth = depth.clone();
13694                if inlined {
13695                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13696                    inner_offset = next_offset;
13697                } else {
13698                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13699                    inner_depth.increment()?;
13700                }
13701                let val_ref =
13702                self.namespace_entries.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
13703                fidl::decode!(fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13704                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13705                {
13706                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13707                }
13708                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13709                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13710                }
13711            }
13712
13713            next_offset += envelope_size;
13714            _next_ordinal_to_read += 1;
13715            if next_offset >= end_offset {
13716                return Ok(());
13717            }
13718
13719            // Decode unknown envelopes for gaps in ordinals.
13720            while _next_ordinal_to_read < 3 {
13721                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13722                _next_ordinal_to_read += 1;
13723                next_offset += envelope_size;
13724            }
13725
13726            let next_out_of_line = decoder.next_out_of_line();
13727            let handles_before = decoder.remaining_handles();
13728            if let Some((inlined, num_bytes, num_handles)) =
13729                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13730            {
13731                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13732                if inlined != (member_inline_size <= 4) {
13733                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13734                }
13735                let inner_offset;
13736                let mut inner_depth = depth.clone();
13737                if inlined {
13738                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13739                    inner_offset = next_offset;
13740                } else {
13741                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13742                    inner_depth.increment()?;
13743                }
13744                let val_ref = self.dictionary.get_or_insert_with(|| {
13745                    fidl::new_empty!(
13746                        fidl_fuchsia_component_sandbox::DictionaryRef,
13747                        fidl::encoding::DefaultFuchsiaResourceDialect
13748                    )
13749                });
13750                fidl::decode!(
13751                    fidl_fuchsia_component_sandbox::DictionaryRef,
13752                    fidl::encoding::DefaultFuchsiaResourceDialect,
13753                    val_ref,
13754                    decoder,
13755                    inner_offset,
13756                    inner_depth
13757                )?;
13758                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13759                {
13760                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13761                }
13762                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13763                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13764                }
13765            }
13766
13767            next_offset += envelope_size;
13768            _next_ordinal_to_read += 1;
13769            if next_offset >= end_offset {
13770                return Ok(());
13771            }
13772
13773            // Decode unknown envelopes for gaps in ordinals.
13774            while _next_ordinal_to_read < 4 {
13775                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13776                _next_ordinal_to_read += 1;
13777                next_offset += envelope_size;
13778            }
13779
13780            let next_out_of_line = decoder.next_out_of_line();
13781            let handles_before = decoder.remaining_handles();
13782            if let Some((inlined, num_bytes, num_handles)) =
13783                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13784            {
13785                let member_inline_size = <fidl::encoding::HandleType<
13786                    fidl::EventPair,
13787                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13788                    2147483648,
13789                > as fidl::encoding::TypeMarker>::inline_size(
13790                    decoder.context
13791                );
13792                if inlined != (member_inline_size <= 4) {
13793                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13794                }
13795                let inner_offset;
13796                let mut inner_depth = depth.clone();
13797                if inlined {
13798                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13799                    inner_offset = next_offset;
13800                } else {
13801                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13802                    inner_depth.increment()?;
13803                }
13804                let val_ref =
13805                self.additional_inputs.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
13806                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13807                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13808                {
13809                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13810                }
13811                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13812                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13813                }
13814            }
13815
13816            next_offset += envelope_size;
13817
13818            // Decode the remaining unknown envelopes.
13819            while next_offset < end_offset {
13820                _next_ordinal_to_read += 1;
13821                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13822                next_offset += envelope_size;
13823            }
13824
13825            Ok(())
13826        }
13827    }
13828
13829    impl fidl::encoding::ResourceTypeMarker for EventPayload {
13830        type Borrowed<'a> = &'a mut Self;
13831        fn take_or_borrow<'a>(
13832            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13833        ) -> Self::Borrowed<'a> {
13834            value
13835        }
13836    }
13837
13838    unsafe impl fidl::encoding::TypeMarker for EventPayload {
13839        type Owned = Self;
13840
13841        #[inline(always)]
13842        fn inline_align(_context: fidl::encoding::Context) -> usize {
13843            8
13844        }
13845
13846        #[inline(always)]
13847        fn inline_size(_context: fidl::encoding::Context) -> usize {
13848            16
13849        }
13850    }
13851
13852    unsafe impl fidl::encoding::Encode<EventPayload, fidl::encoding::DefaultFuchsiaResourceDialect>
13853        for &mut EventPayload
13854    {
13855        #[inline]
13856        unsafe fn encode(
13857            self,
13858            encoder: &mut fidl::encoding::Encoder<
13859                '_,
13860                fidl::encoding::DefaultFuchsiaResourceDialect,
13861            >,
13862            offset: usize,
13863            _depth: fidl::encoding::Depth,
13864        ) -> fidl::Result<()> {
13865            encoder.debug_check_bounds::<EventPayload>(offset);
13866            encoder.write_num::<u64>(self.ordinal(), offset);
13867            match self {
13868            EventPayload::CapabilityRequested(ref mut val) => {
13869                fidl::encoding::encode_in_envelope::<CapabilityRequestedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13870                    <CapabilityRequestedPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
13871                    encoder, offset + 8, _depth
13872                )
13873            }
13874            EventPayload::Purged(ref val) => {
13875                fidl::encoding::encode_in_envelope::<PurgedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13876                    <PurgedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13877                    encoder, offset + 8, _depth
13878                )
13879            }
13880            EventPayload::Discovered(ref val) => {
13881                fidl::encoding::encode_in_envelope::<DiscoveredPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13882                    <DiscoveredPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13883                    encoder, offset + 8, _depth
13884                )
13885            }
13886            EventPayload::Destroyed(ref val) => {
13887                fidl::encoding::encode_in_envelope::<DestroyedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13888                    <DestroyedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13889                    encoder, offset + 8, _depth
13890                )
13891            }
13892            EventPayload::Resolved(ref val) => {
13893                fidl::encoding::encode_in_envelope::<ResolvedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13894                    <ResolvedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13895                    encoder, offset + 8, _depth
13896                )
13897            }
13898            EventPayload::Started(ref val) => {
13899                fidl::encoding::encode_in_envelope::<StartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13900                    <StartedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13901                    encoder, offset + 8, _depth
13902                )
13903            }
13904            EventPayload::Stopped(ref val) => {
13905                fidl::encoding::encode_in_envelope::<StoppedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13906                    <StoppedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13907                    encoder, offset + 8, _depth
13908                )
13909            }
13910            EventPayload::DebugStarted(ref mut val) => {
13911                fidl::encoding::encode_in_envelope::<DebugStartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13912                    <DebugStartedPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
13913                    encoder, offset + 8, _depth
13914                )
13915            }
13916            EventPayload::Unresolved(ref val) => {
13917                fidl::encoding::encode_in_envelope::<UnresolvedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13918                    <UnresolvedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13919                    encoder, offset + 8, _depth
13920                )
13921            }
13922            EventPayload::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
13923        }
13924        }
13925    }
13926
13927    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for EventPayload {
13928        #[inline(always)]
13929        fn new_empty() -> Self {
13930            Self::__SourceBreaking { unknown_ordinal: 0 }
13931        }
13932
13933        #[inline]
13934        unsafe fn decode(
13935            &mut self,
13936            decoder: &mut fidl::encoding::Decoder<
13937                '_,
13938                fidl::encoding::DefaultFuchsiaResourceDialect,
13939            >,
13940            offset: usize,
13941            mut depth: fidl::encoding::Depth,
13942        ) -> fidl::Result<()> {
13943            decoder.debug_check_bounds::<Self>(offset);
13944            #[allow(unused_variables)]
13945            let next_out_of_line = decoder.next_out_of_line();
13946            let handles_before = decoder.remaining_handles();
13947            let (ordinal, inlined, num_bytes, num_handles) =
13948                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
13949
13950            let member_inline_size = match ordinal {
13951                1 => <CapabilityRequestedPayload as fidl::encoding::TypeMarker>::inline_size(
13952                    decoder.context,
13953                ),
13954                2 => <PurgedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13955                4 => {
13956                    <DiscoveredPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context)
13957                }
13958                5 => <DestroyedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13959                6 => <ResolvedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13960                7 => <StartedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13961                8 => <StoppedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13962                9 => <DebugStartedPayload as fidl::encoding::TypeMarker>::inline_size(
13963                    decoder.context,
13964                ),
13965                10 => {
13966                    <UnresolvedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context)
13967                }
13968                0 => return Err(fidl::Error::UnknownUnionTag),
13969                _ => num_bytes as usize,
13970            };
13971
13972            if inlined != (member_inline_size <= 4) {
13973                return Err(fidl::Error::InvalidInlineBitInEnvelope);
13974            }
13975            let _inner_offset;
13976            if inlined {
13977                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
13978                _inner_offset = offset + 8;
13979            } else {
13980                depth.increment()?;
13981                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13982            }
13983            match ordinal {
13984                1 => {
13985                    #[allow(irrefutable_let_patterns)]
13986                    if let EventPayload::CapabilityRequested(_) = self {
13987                        // Do nothing, read the value into the object
13988                    } else {
13989                        // Initialize `self` to the right variant
13990                        *self = EventPayload::CapabilityRequested(fidl::new_empty!(
13991                            CapabilityRequestedPayload,
13992                            fidl::encoding::DefaultFuchsiaResourceDialect
13993                        ));
13994                    }
13995                    #[allow(irrefutable_let_patterns)]
13996                    if let EventPayload::CapabilityRequested(ref mut val) = self {
13997                        fidl::decode!(
13998                            CapabilityRequestedPayload,
13999                            fidl::encoding::DefaultFuchsiaResourceDialect,
14000                            val,
14001                            decoder,
14002                            _inner_offset,
14003                            depth
14004                        )?;
14005                    } else {
14006                        unreachable!()
14007                    }
14008                }
14009                2 => {
14010                    #[allow(irrefutable_let_patterns)]
14011                    if let EventPayload::Purged(_) = self {
14012                        // Do nothing, read the value into the object
14013                    } else {
14014                        // Initialize `self` to the right variant
14015                        *self = EventPayload::Purged(fidl::new_empty!(
14016                            PurgedPayload,
14017                            fidl::encoding::DefaultFuchsiaResourceDialect
14018                        ));
14019                    }
14020                    #[allow(irrefutable_let_patterns)]
14021                    if let EventPayload::Purged(ref mut val) = self {
14022                        fidl::decode!(
14023                            PurgedPayload,
14024                            fidl::encoding::DefaultFuchsiaResourceDialect,
14025                            val,
14026                            decoder,
14027                            _inner_offset,
14028                            depth
14029                        )?;
14030                    } else {
14031                        unreachable!()
14032                    }
14033                }
14034                4 => {
14035                    #[allow(irrefutable_let_patterns)]
14036                    if let EventPayload::Discovered(_) = self {
14037                        // Do nothing, read the value into the object
14038                    } else {
14039                        // Initialize `self` to the right variant
14040                        *self = EventPayload::Discovered(fidl::new_empty!(
14041                            DiscoveredPayload,
14042                            fidl::encoding::DefaultFuchsiaResourceDialect
14043                        ));
14044                    }
14045                    #[allow(irrefutable_let_patterns)]
14046                    if let EventPayload::Discovered(ref mut val) = self {
14047                        fidl::decode!(
14048                            DiscoveredPayload,
14049                            fidl::encoding::DefaultFuchsiaResourceDialect,
14050                            val,
14051                            decoder,
14052                            _inner_offset,
14053                            depth
14054                        )?;
14055                    } else {
14056                        unreachable!()
14057                    }
14058                }
14059                5 => {
14060                    #[allow(irrefutable_let_patterns)]
14061                    if let EventPayload::Destroyed(_) = self {
14062                        // Do nothing, read the value into the object
14063                    } else {
14064                        // Initialize `self` to the right variant
14065                        *self = EventPayload::Destroyed(fidl::new_empty!(
14066                            DestroyedPayload,
14067                            fidl::encoding::DefaultFuchsiaResourceDialect
14068                        ));
14069                    }
14070                    #[allow(irrefutable_let_patterns)]
14071                    if let EventPayload::Destroyed(ref mut val) = self {
14072                        fidl::decode!(
14073                            DestroyedPayload,
14074                            fidl::encoding::DefaultFuchsiaResourceDialect,
14075                            val,
14076                            decoder,
14077                            _inner_offset,
14078                            depth
14079                        )?;
14080                    } else {
14081                        unreachable!()
14082                    }
14083                }
14084                6 => {
14085                    #[allow(irrefutable_let_patterns)]
14086                    if let EventPayload::Resolved(_) = self {
14087                        // Do nothing, read the value into the object
14088                    } else {
14089                        // Initialize `self` to the right variant
14090                        *self = EventPayload::Resolved(fidl::new_empty!(
14091                            ResolvedPayload,
14092                            fidl::encoding::DefaultFuchsiaResourceDialect
14093                        ));
14094                    }
14095                    #[allow(irrefutable_let_patterns)]
14096                    if let EventPayload::Resolved(ref mut val) = self {
14097                        fidl::decode!(
14098                            ResolvedPayload,
14099                            fidl::encoding::DefaultFuchsiaResourceDialect,
14100                            val,
14101                            decoder,
14102                            _inner_offset,
14103                            depth
14104                        )?;
14105                    } else {
14106                        unreachable!()
14107                    }
14108                }
14109                7 => {
14110                    #[allow(irrefutable_let_patterns)]
14111                    if let EventPayload::Started(_) = self {
14112                        // Do nothing, read the value into the object
14113                    } else {
14114                        // Initialize `self` to the right variant
14115                        *self = EventPayload::Started(fidl::new_empty!(
14116                            StartedPayload,
14117                            fidl::encoding::DefaultFuchsiaResourceDialect
14118                        ));
14119                    }
14120                    #[allow(irrefutable_let_patterns)]
14121                    if let EventPayload::Started(ref mut val) = self {
14122                        fidl::decode!(
14123                            StartedPayload,
14124                            fidl::encoding::DefaultFuchsiaResourceDialect,
14125                            val,
14126                            decoder,
14127                            _inner_offset,
14128                            depth
14129                        )?;
14130                    } else {
14131                        unreachable!()
14132                    }
14133                }
14134                8 => {
14135                    #[allow(irrefutable_let_patterns)]
14136                    if let EventPayload::Stopped(_) = self {
14137                        // Do nothing, read the value into the object
14138                    } else {
14139                        // Initialize `self` to the right variant
14140                        *self = EventPayload::Stopped(fidl::new_empty!(
14141                            StoppedPayload,
14142                            fidl::encoding::DefaultFuchsiaResourceDialect
14143                        ));
14144                    }
14145                    #[allow(irrefutable_let_patterns)]
14146                    if let EventPayload::Stopped(ref mut val) = self {
14147                        fidl::decode!(
14148                            StoppedPayload,
14149                            fidl::encoding::DefaultFuchsiaResourceDialect,
14150                            val,
14151                            decoder,
14152                            _inner_offset,
14153                            depth
14154                        )?;
14155                    } else {
14156                        unreachable!()
14157                    }
14158                }
14159                9 => {
14160                    #[allow(irrefutable_let_patterns)]
14161                    if let EventPayload::DebugStarted(_) = self {
14162                        // Do nothing, read the value into the object
14163                    } else {
14164                        // Initialize `self` to the right variant
14165                        *self = EventPayload::DebugStarted(fidl::new_empty!(
14166                            DebugStartedPayload,
14167                            fidl::encoding::DefaultFuchsiaResourceDialect
14168                        ));
14169                    }
14170                    #[allow(irrefutable_let_patterns)]
14171                    if let EventPayload::DebugStarted(ref mut val) = self {
14172                        fidl::decode!(
14173                            DebugStartedPayload,
14174                            fidl::encoding::DefaultFuchsiaResourceDialect,
14175                            val,
14176                            decoder,
14177                            _inner_offset,
14178                            depth
14179                        )?;
14180                    } else {
14181                        unreachable!()
14182                    }
14183                }
14184                10 => {
14185                    #[allow(irrefutable_let_patterns)]
14186                    if let EventPayload::Unresolved(_) = self {
14187                        // Do nothing, read the value into the object
14188                    } else {
14189                        // Initialize `self` to the right variant
14190                        *self = EventPayload::Unresolved(fidl::new_empty!(
14191                            UnresolvedPayload,
14192                            fidl::encoding::DefaultFuchsiaResourceDialect
14193                        ));
14194                    }
14195                    #[allow(irrefutable_let_patterns)]
14196                    if let EventPayload::Unresolved(ref mut val) = self {
14197                        fidl::decode!(
14198                            UnresolvedPayload,
14199                            fidl::encoding::DefaultFuchsiaResourceDialect,
14200                            val,
14201                            decoder,
14202                            _inner_offset,
14203                            depth
14204                        )?;
14205                    } else {
14206                        unreachable!()
14207                    }
14208                }
14209                #[allow(deprecated)]
14210                ordinal => {
14211                    for _ in 0..num_handles {
14212                        decoder.drop_next_handle()?;
14213                    }
14214                    *self = EventPayload::__SourceBreaking { unknown_ordinal: ordinal };
14215                }
14216            }
14217            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
14218                return Err(fidl::Error::InvalidNumBytesInEnvelope);
14219            }
14220            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14221                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14222            }
14223            Ok(())
14224        }
14225    }
14226}