Skip to main content

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        Self { client: fidl::client::sync::Client::new(channel) }
523    }
524
525    pub fn into_channel(self) -> fidl::Channel {
526        self.client.into_channel()
527    }
528
529    /// Waits until an event arrives and returns it. It is safe for other
530    /// threads to make concurrent requests while waiting for an event.
531    pub fn wait_for_event(
532        &self,
533        deadline: zx::MonotonicInstant,
534    ) -> Result<BinderEvent, fidl::Error> {
535        BinderEvent::decode(self.client.wait_for_event::<BinderMarker>(deadline)?)
536    }
537}
538
539#[cfg(target_os = "fuchsia")]
540impl From<BinderSynchronousProxy> for zx::NullableHandle {
541    fn from(value: BinderSynchronousProxy) -> Self {
542        value.into_channel().into()
543    }
544}
545
546#[cfg(target_os = "fuchsia")]
547impl From<fidl::Channel> for BinderSynchronousProxy {
548    fn from(value: fidl::Channel) -> Self {
549        Self::new(value)
550    }
551}
552
553#[cfg(target_os = "fuchsia")]
554impl fidl::endpoints::FromClient for BinderSynchronousProxy {
555    type Protocol = BinderMarker;
556
557    fn from_client(value: fidl::endpoints::ClientEnd<BinderMarker>) -> Self {
558        Self::new(value.into_channel())
559    }
560}
561
562#[derive(Debug, Clone)]
563pub struct BinderProxy {
564    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
565}
566
567impl fidl::endpoints::Proxy for BinderProxy {
568    type Protocol = BinderMarker;
569
570    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
571        Self::new(inner)
572    }
573
574    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
575        self.client.into_channel().map_err(|client| Self { client })
576    }
577
578    fn as_channel(&self) -> &::fidl::AsyncChannel {
579        self.client.as_channel()
580    }
581}
582
583impl BinderProxy {
584    /// Create a new Proxy for fuchsia.component/Binder.
585    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
586        let protocol_name = <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
587        Self { client: fidl::client::Client::new(channel, protocol_name) }
588    }
589
590    /// Get a Stream of events from the remote end of the protocol.
591    ///
592    /// # Panics
593    ///
594    /// Panics if the event stream was already taken.
595    pub fn take_event_stream(&self) -> BinderEventStream {
596        BinderEventStream { event_receiver: self.client.take_event_receiver() }
597    }
598}
599
600impl BinderProxyInterface for BinderProxy {}
601
602pub struct BinderEventStream {
603    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
604}
605
606impl std::marker::Unpin for BinderEventStream {}
607
608impl futures::stream::FusedStream for BinderEventStream {
609    fn is_terminated(&self) -> bool {
610        self.event_receiver.is_terminated()
611    }
612}
613
614impl futures::Stream for BinderEventStream {
615    type Item = Result<BinderEvent, fidl::Error>;
616
617    fn poll_next(
618        mut self: std::pin::Pin<&mut Self>,
619        cx: &mut std::task::Context<'_>,
620    ) -> std::task::Poll<Option<Self::Item>> {
621        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
622            &mut self.event_receiver,
623            cx
624        )?) {
625            Some(buf) => std::task::Poll::Ready(Some(BinderEvent::decode(buf))),
626            None => std::task::Poll::Ready(None),
627        }
628    }
629}
630
631#[derive(Debug)]
632pub enum BinderEvent {}
633
634impl BinderEvent {
635    /// Decodes a message buffer as a [`BinderEvent`].
636    fn decode(
637        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
638    ) -> Result<BinderEvent, fidl::Error> {
639        let (bytes, _handles) = buf.split_mut();
640        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
641        debug_assert_eq!(tx_header.tx_id, 0);
642        match tx_header.ordinal {
643            _ => Err(fidl::Error::UnknownOrdinal {
644                ordinal: tx_header.ordinal,
645                protocol_name: <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
646            }),
647        }
648    }
649}
650
651/// A Stream of incoming requests for fuchsia.component/Binder.
652pub struct BinderRequestStream {
653    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
654    is_terminated: bool,
655}
656
657impl std::marker::Unpin for BinderRequestStream {}
658
659impl futures::stream::FusedStream for BinderRequestStream {
660    fn is_terminated(&self) -> bool {
661        self.is_terminated
662    }
663}
664
665impl fidl::endpoints::RequestStream for BinderRequestStream {
666    type Protocol = BinderMarker;
667    type ControlHandle = BinderControlHandle;
668
669    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
670        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
671    }
672
673    fn control_handle(&self) -> Self::ControlHandle {
674        BinderControlHandle { inner: self.inner.clone() }
675    }
676
677    fn into_inner(
678        self,
679    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
680    {
681        (self.inner, self.is_terminated)
682    }
683
684    fn from_inner(
685        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
686        is_terminated: bool,
687    ) -> Self {
688        Self { inner, is_terminated }
689    }
690}
691
692impl futures::Stream for BinderRequestStream {
693    type Item = Result<BinderRequest, fidl::Error>;
694
695    fn poll_next(
696        mut self: std::pin::Pin<&mut Self>,
697        cx: &mut std::task::Context<'_>,
698    ) -> std::task::Poll<Option<Self::Item>> {
699        let this = &mut *self;
700        if this.inner.check_shutdown(cx) {
701            this.is_terminated = true;
702            return std::task::Poll::Ready(None);
703        }
704        if this.is_terminated {
705            panic!("polled BinderRequestStream after completion");
706        }
707        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
708            |bytes, handles| {
709                match this.inner.channel().read_etc(cx, bytes, handles) {
710                    std::task::Poll::Ready(Ok(())) => {}
711                    std::task::Poll::Pending => return std::task::Poll::Pending,
712                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
713                        this.is_terminated = true;
714                        return std::task::Poll::Ready(None);
715                    }
716                    std::task::Poll::Ready(Err(e)) => {
717                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
718                            e.into(),
719                        ))));
720                    }
721                }
722
723                // A message has been received from the channel
724                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
725
726                std::task::Poll::Ready(Some(match header.ordinal {
727                    _ => Err(fidl::Error::UnknownOrdinal {
728                        ordinal: header.ordinal,
729                        protocol_name:
730                            <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
731                    }),
732                }))
733            },
734        )
735    }
736}
737
738/// A framework-provided protocol that allows components that use it to bind to
739/// the component that exposes it. The act of connecting to this protocol will
740/// trigger the bind. Thus, this protocol contains no methods. For more details
741/// on binding, see
742/// https://fuchsia.dev/fuchsia-src/concepts/components/v2/lifecycle#binding.
743///
744/// When a component connects to protocol, the component exposing this capability
745/// will be started if it's not already running. Upon a failure to start, the
746/// component framework will close the server end of the channel with a
747/// zx.Status epitaph.
748#[derive(Debug)]
749pub enum BinderRequest {}
750
751impl BinderRequest {
752    /// Name of the method defined in FIDL
753    pub fn method_name(&self) -> &'static str {
754        match *self {}
755    }
756}
757
758#[derive(Debug, Clone)]
759pub struct BinderControlHandle {
760    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
761}
762
763impl fidl::endpoints::ControlHandle for BinderControlHandle {
764    fn shutdown(&self) {
765        self.inner.shutdown()
766    }
767
768    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
769        self.inner.shutdown_with_epitaph(status)
770    }
771
772    fn is_closed(&self) -> bool {
773        self.inner.channel().is_closed()
774    }
775    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
776        self.inner.channel().on_closed()
777    }
778
779    #[cfg(target_os = "fuchsia")]
780    fn signal_peer(
781        &self,
782        clear_mask: zx::Signals,
783        set_mask: zx::Signals,
784    ) -> Result<(), zx_status::Status> {
785        use fidl::Peered;
786        self.inner.channel().signal_peer(clear_mask, set_mask)
787    }
788}
789
790impl BinderControlHandle {}
791
792#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
793pub struct ChildIteratorMarker;
794
795impl fidl::endpoints::ProtocolMarker for ChildIteratorMarker {
796    type Proxy = ChildIteratorProxy;
797    type RequestStream = ChildIteratorRequestStream;
798    #[cfg(target_os = "fuchsia")]
799    type SynchronousProxy = ChildIteratorSynchronousProxy;
800
801    const DEBUG_NAME: &'static str = "(anonymous) ChildIterator";
802}
803
804pub trait ChildIteratorProxyInterface: Send + Sync {
805    type NextResponseFut: std::future::Future<
806            Output = Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error>,
807        > + Send;
808    fn r#next(&self) -> Self::NextResponseFut;
809}
810#[derive(Debug)]
811#[cfg(target_os = "fuchsia")]
812pub struct ChildIteratorSynchronousProxy {
813    client: fidl::client::sync::Client,
814}
815
816#[cfg(target_os = "fuchsia")]
817impl fidl::endpoints::SynchronousProxy for ChildIteratorSynchronousProxy {
818    type Proxy = ChildIteratorProxy;
819    type Protocol = ChildIteratorMarker;
820
821    fn from_channel(inner: fidl::Channel) -> Self {
822        Self::new(inner)
823    }
824
825    fn into_channel(self) -> fidl::Channel {
826        self.client.into_channel()
827    }
828
829    fn as_channel(&self) -> &fidl::Channel {
830        self.client.as_channel()
831    }
832}
833
834#[cfg(target_os = "fuchsia")]
835impl ChildIteratorSynchronousProxy {
836    pub fn new(channel: fidl::Channel) -> Self {
837        Self { client: fidl::client::sync::Client::new(channel) }
838    }
839
840    pub fn into_channel(self) -> fidl::Channel {
841        self.client.into_channel()
842    }
843
844    /// Waits until an event arrives and returns it. It is safe for other
845    /// threads to make concurrent requests while waiting for an event.
846    pub fn wait_for_event(
847        &self,
848        deadline: zx::MonotonicInstant,
849    ) -> Result<ChildIteratorEvent, fidl::Error> {
850        ChildIteratorEvent::decode(self.client.wait_for_event::<ChildIteratorMarker>(deadline)?)
851    }
852
853    /// Advance the iterator and return the next batch of children.
854    ///
855    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
856    /// no more children.
857    pub fn r#next(
858        &self,
859        ___deadline: zx::MonotonicInstant,
860    ) -> Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error> {
861        let _response = self.client.send_query::<
862            fidl::encoding::EmptyPayload,
863            ChildIteratorNextResponse,
864            ChildIteratorMarker,
865        >(
866            (),
867            0x40e4c3882b050d08,
868            fidl::encoding::DynamicFlags::empty(),
869            ___deadline,
870        )?;
871        Ok(_response.children)
872    }
873}
874
875#[cfg(target_os = "fuchsia")]
876impl From<ChildIteratorSynchronousProxy> for zx::NullableHandle {
877    fn from(value: ChildIteratorSynchronousProxy) -> Self {
878        value.into_channel().into()
879    }
880}
881
882#[cfg(target_os = "fuchsia")]
883impl From<fidl::Channel> for ChildIteratorSynchronousProxy {
884    fn from(value: fidl::Channel) -> Self {
885        Self::new(value)
886    }
887}
888
889#[cfg(target_os = "fuchsia")]
890impl fidl::endpoints::FromClient for ChildIteratorSynchronousProxy {
891    type Protocol = ChildIteratorMarker;
892
893    fn from_client(value: fidl::endpoints::ClientEnd<ChildIteratorMarker>) -> Self {
894        Self::new(value.into_channel())
895    }
896}
897
898#[derive(Debug, Clone)]
899pub struct ChildIteratorProxy {
900    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
901}
902
903impl fidl::endpoints::Proxy for ChildIteratorProxy {
904    type Protocol = ChildIteratorMarker;
905
906    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
907        Self::new(inner)
908    }
909
910    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
911        self.client.into_channel().map_err(|client| Self { client })
912    }
913
914    fn as_channel(&self) -> &::fidl::AsyncChannel {
915        self.client.as_channel()
916    }
917}
918
919impl ChildIteratorProxy {
920    /// Create a new Proxy for fuchsia.component/ChildIterator.
921    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
922        let protocol_name = <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
923        Self { client: fidl::client::Client::new(channel, protocol_name) }
924    }
925
926    /// Get a Stream of events from the remote end of the protocol.
927    ///
928    /// # Panics
929    ///
930    /// Panics if the event stream was already taken.
931    pub fn take_event_stream(&self) -> ChildIteratorEventStream {
932        ChildIteratorEventStream { event_receiver: self.client.take_event_receiver() }
933    }
934
935    /// Advance the iterator and return the next batch of children.
936    ///
937    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
938    /// no more children.
939    pub fn r#next(
940        &self,
941    ) -> fidl::client::QueryResponseFut<
942        Vec<fidl_fuchsia_component_decl::ChildRef>,
943        fidl::encoding::DefaultFuchsiaResourceDialect,
944    > {
945        ChildIteratorProxyInterface::r#next(self)
946    }
947}
948
949impl ChildIteratorProxyInterface for ChildIteratorProxy {
950    type NextResponseFut = fidl::client::QueryResponseFut<
951        Vec<fidl_fuchsia_component_decl::ChildRef>,
952        fidl::encoding::DefaultFuchsiaResourceDialect,
953    >;
954    fn r#next(&self) -> Self::NextResponseFut {
955        fn _decode(
956            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
957        ) -> Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error> {
958            let _response = fidl::client::decode_transaction_body::<
959                ChildIteratorNextResponse,
960                fidl::encoding::DefaultFuchsiaResourceDialect,
961                0x40e4c3882b050d08,
962            >(_buf?)?;
963            Ok(_response.children)
964        }
965        self.client.send_query_and_decode::<
966            fidl::encoding::EmptyPayload,
967            Vec<fidl_fuchsia_component_decl::ChildRef>,
968        >(
969            (),
970            0x40e4c3882b050d08,
971            fidl::encoding::DynamicFlags::empty(),
972            _decode,
973        )
974    }
975}
976
977pub struct ChildIteratorEventStream {
978    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
979}
980
981impl std::marker::Unpin for ChildIteratorEventStream {}
982
983impl futures::stream::FusedStream for ChildIteratorEventStream {
984    fn is_terminated(&self) -> bool {
985        self.event_receiver.is_terminated()
986    }
987}
988
989impl futures::Stream for ChildIteratorEventStream {
990    type Item = Result<ChildIteratorEvent, fidl::Error>;
991
992    fn poll_next(
993        mut self: std::pin::Pin<&mut Self>,
994        cx: &mut std::task::Context<'_>,
995    ) -> std::task::Poll<Option<Self::Item>> {
996        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
997            &mut self.event_receiver,
998            cx
999        )?) {
1000            Some(buf) => std::task::Poll::Ready(Some(ChildIteratorEvent::decode(buf))),
1001            None => std::task::Poll::Ready(None),
1002        }
1003    }
1004}
1005
1006#[derive(Debug)]
1007pub enum ChildIteratorEvent {}
1008
1009impl ChildIteratorEvent {
1010    /// Decodes a message buffer as a [`ChildIteratorEvent`].
1011    fn decode(
1012        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1013    ) -> Result<ChildIteratorEvent, fidl::Error> {
1014        let (bytes, _handles) = buf.split_mut();
1015        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1016        debug_assert_eq!(tx_header.tx_id, 0);
1017        match tx_header.ordinal {
1018            _ => Err(fidl::Error::UnknownOrdinal {
1019                ordinal: tx_header.ordinal,
1020                protocol_name: <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1021            }),
1022        }
1023    }
1024}
1025
1026/// A Stream of incoming requests for fuchsia.component/ChildIterator.
1027pub struct ChildIteratorRequestStream {
1028    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1029    is_terminated: bool,
1030}
1031
1032impl std::marker::Unpin for ChildIteratorRequestStream {}
1033
1034impl futures::stream::FusedStream for ChildIteratorRequestStream {
1035    fn is_terminated(&self) -> bool {
1036        self.is_terminated
1037    }
1038}
1039
1040impl fidl::endpoints::RequestStream for ChildIteratorRequestStream {
1041    type Protocol = ChildIteratorMarker;
1042    type ControlHandle = ChildIteratorControlHandle;
1043
1044    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1045        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1046    }
1047
1048    fn control_handle(&self) -> Self::ControlHandle {
1049        ChildIteratorControlHandle { inner: self.inner.clone() }
1050    }
1051
1052    fn into_inner(
1053        self,
1054    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1055    {
1056        (self.inner, self.is_terminated)
1057    }
1058
1059    fn from_inner(
1060        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1061        is_terminated: bool,
1062    ) -> Self {
1063        Self { inner, is_terminated }
1064    }
1065}
1066
1067impl futures::Stream for ChildIteratorRequestStream {
1068    type Item = Result<ChildIteratorRequest, fidl::Error>;
1069
1070    fn poll_next(
1071        mut self: std::pin::Pin<&mut Self>,
1072        cx: &mut std::task::Context<'_>,
1073    ) -> std::task::Poll<Option<Self::Item>> {
1074        let this = &mut *self;
1075        if this.inner.check_shutdown(cx) {
1076            this.is_terminated = true;
1077            return std::task::Poll::Ready(None);
1078        }
1079        if this.is_terminated {
1080            panic!("polled ChildIteratorRequestStream after completion");
1081        }
1082        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1083            |bytes, handles| {
1084                match this.inner.channel().read_etc(cx, bytes, handles) {
1085                    std::task::Poll::Ready(Ok(())) => {}
1086                    std::task::Poll::Pending => return std::task::Poll::Pending,
1087                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1088                        this.is_terminated = true;
1089                        return std::task::Poll::Ready(None);
1090                    }
1091                    std::task::Poll::Ready(Err(e)) => {
1092                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1093                            e.into(),
1094                        ))));
1095                    }
1096                }
1097
1098                // A message has been received from the channel
1099                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1100
1101                std::task::Poll::Ready(Some(match header.ordinal {
1102                    0x40e4c3882b050d08 => {
1103                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1104                        let mut req = fidl::new_empty!(
1105                            fidl::encoding::EmptyPayload,
1106                            fidl::encoding::DefaultFuchsiaResourceDialect
1107                        );
1108                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1109                        let control_handle =
1110                            ChildIteratorControlHandle { inner: this.inner.clone() };
1111                        Ok(ChildIteratorRequest::Next {
1112                            responder: ChildIteratorNextResponder {
1113                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1114                                tx_id: header.tx_id,
1115                            },
1116                        })
1117                    }
1118                    _ => Err(fidl::Error::UnknownOrdinal {
1119                        ordinal: header.ordinal,
1120                        protocol_name:
1121                            <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1122                    }),
1123                }))
1124            },
1125        )
1126    }
1127}
1128
1129/// A protocol to iterate over the list of children in a realm.
1130#[derive(Debug)]
1131pub enum ChildIteratorRequest {
1132    /// Advance the iterator and return the next batch of children.
1133    ///
1134    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
1135    /// no more children.
1136    Next { responder: ChildIteratorNextResponder },
1137}
1138
1139impl ChildIteratorRequest {
1140    #[allow(irrefutable_let_patterns)]
1141    pub fn into_next(self) -> Option<(ChildIteratorNextResponder)> {
1142        if let ChildIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
1143    }
1144
1145    /// Name of the method defined in FIDL
1146    pub fn method_name(&self) -> &'static str {
1147        match *self {
1148            ChildIteratorRequest::Next { .. } => "next",
1149        }
1150    }
1151}
1152
1153#[derive(Debug, Clone)]
1154pub struct ChildIteratorControlHandle {
1155    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1156}
1157
1158impl fidl::endpoints::ControlHandle for ChildIteratorControlHandle {
1159    fn shutdown(&self) {
1160        self.inner.shutdown()
1161    }
1162
1163    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1164        self.inner.shutdown_with_epitaph(status)
1165    }
1166
1167    fn is_closed(&self) -> bool {
1168        self.inner.channel().is_closed()
1169    }
1170    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1171        self.inner.channel().on_closed()
1172    }
1173
1174    #[cfg(target_os = "fuchsia")]
1175    fn signal_peer(
1176        &self,
1177        clear_mask: zx::Signals,
1178        set_mask: zx::Signals,
1179    ) -> Result<(), zx_status::Status> {
1180        use fidl::Peered;
1181        self.inner.channel().signal_peer(clear_mask, set_mask)
1182    }
1183}
1184
1185impl ChildIteratorControlHandle {}
1186
1187#[must_use = "FIDL methods require a response to be sent"]
1188#[derive(Debug)]
1189pub struct ChildIteratorNextResponder {
1190    control_handle: std::mem::ManuallyDrop<ChildIteratorControlHandle>,
1191    tx_id: u32,
1192}
1193
1194/// Set the the channel to be shutdown (see [`ChildIteratorControlHandle::shutdown`])
1195/// if the responder is dropped without sending a response, so that the client
1196/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1197impl std::ops::Drop for ChildIteratorNextResponder {
1198    fn drop(&mut self) {
1199        self.control_handle.shutdown();
1200        // Safety: drops once, never accessed again
1201        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1202    }
1203}
1204
1205impl fidl::endpoints::Responder for ChildIteratorNextResponder {
1206    type ControlHandle = ChildIteratorControlHandle;
1207
1208    fn control_handle(&self) -> &ChildIteratorControlHandle {
1209        &self.control_handle
1210    }
1211
1212    fn drop_without_shutdown(mut self) {
1213        // Safety: drops once, never accessed again due to mem::forget
1214        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1215        // Prevent Drop from running (which would shut down the channel)
1216        std::mem::forget(self);
1217    }
1218}
1219
1220impl ChildIteratorNextResponder {
1221    /// Sends a response to the FIDL transaction.
1222    ///
1223    /// Sets the channel to shutdown if an error occurs.
1224    pub fn send(
1225        self,
1226        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1227    ) -> Result<(), fidl::Error> {
1228        let _result = self.send_raw(children);
1229        if _result.is_err() {
1230            self.control_handle.shutdown();
1231        }
1232        self.drop_without_shutdown();
1233        _result
1234    }
1235
1236    /// Similar to "send" but does not shutdown the channel if an error occurs.
1237    pub fn send_no_shutdown_on_err(
1238        self,
1239        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1240    ) -> Result<(), fidl::Error> {
1241        let _result = self.send_raw(children);
1242        self.drop_without_shutdown();
1243        _result
1244    }
1245
1246    fn send_raw(
1247        &self,
1248        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1249    ) -> Result<(), fidl::Error> {
1250        self.control_handle.inner.send::<ChildIteratorNextResponse>(
1251            (children,),
1252            self.tx_id,
1253            0x40e4c3882b050d08,
1254            fidl::encoding::DynamicFlags::empty(),
1255        )
1256    }
1257}
1258
1259#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1260pub struct ControllerMarker;
1261
1262impl fidl::endpoints::ProtocolMarker for ControllerMarker {
1263    type Proxy = ControllerProxy;
1264    type RequestStream = ControllerRequestStream;
1265    #[cfg(target_os = "fuchsia")]
1266    type SynchronousProxy = ControllerSynchronousProxy;
1267
1268    const DEBUG_NAME: &'static str = "(anonymous) Controller";
1269}
1270pub type ControllerStartResult = Result<(), Error>;
1271pub type ControllerIsStartedResult = Result<bool, Error>;
1272pub type ControllerOpenExposedDirResult = Result<(), Error>;
1273pub type ControllerGetExposedDictionaryResult =
1274    Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>;
1275pub type ControllerGetOutputDictionaryResult = Result<fidl::EventPair, Error>;
1276pub type ControllerDestroyResult = Result<(), Error>;
1277
1278pub trait ControllerProxyInterface: Send + Sync {
1279    type StartResponseFut: std::future::Future<Output = Result<ControllerStartResult, fidl::Error>>
1280        + Send;
1281    fn r#start(
1282        &self,
1283        args: StartChildArgs,
1284        execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1285    ) -> Self::StartResponseFut;
1286    type IsStartedResponseFut: std::future::Future<Output = Result<ControllerIsStartedResult, fidl::Error>>
1287        + Send;
1288    fn r#is_started(&self) -> Self::IsStartedResponseFut;
1289    type OpenExposedDirResponseFut: std::future::Future<Output = Result<ControllerOpenExposedDirResult, fidl::Error>>
1290        + Send;
1291    fn r#open_exposed_dir(
1292        &self,
1293        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1294    ) -> Self::OpenExposedDirResponseFut;
1295    type GetExposedDictionaryResponseFut: std::future::Future<Output = Result<ControllerGetExposedDictionaryResult, fidl::Error>>
1296        + Send;
1297    fn r#get_exposed_dictionary(&self) -> Self::GetExposedDictionaryResponseFut;
1298    type GetOutputDictionaryResponseFut: std::future::Future<Output = Result<ControllerGetOutputDictionaryResult, fidl::Error>>
1299        + Send;
1300    fn r#get_output_dictionary(&self) -> Self::GetOutputDictionaryResponseFut;
1301    type DestroyResponseFut: std::future::Future<Output = Result<ControllerDestroyResult, fidl::Error>>
1302        + Send;
1303    fn r#destroy(&self) -> Self::DestroyResponseFut;
1304}
1305#[derive(Debug)]
1306#[cfg(target_os = "fuchsia")]
1307pub struct ControllerSynchronousProxy {
1308    client: fidl::client::sync::Client,
1309}
1310
1311#[cfg(target_os = "fuchsia")]
1312impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
1313    type Proxy = ControllerProxy;
1314    type Protocol = ControllerMarker;
1315
1316    fn from_channel(inner: fidl::Channel) -> Self {
1317        Self::new(inner)
1318    }
1319
1320    fn into_channel(self) -> fidl::Channel {
1321        self.client.into_channel()
1322    }
1323
1324    fn as_channel(&self) -> &fidl::Channel {
1325        self.client.as_channel()
1326    }
1327}
1328
1329#[cfg(target_os = "fuchsia")]
1330impl ControllerSynchronousProxy {
1331    pub fn new(channel: fidl::Channel) -> Self {
1332        Self { client: fidl::client::sync::Client::new(channel) }
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::<ControllerMarker>(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            ControllerMarker,
1361        >(
1362            (&mut args, execution_controller,),
1363            0x68878076b8d2eac5,
1364            fidl::encoding::DynamicFlags::FLEXIBLE,
1365            ___deadline,
1366        )?
1367        .into_result::<ControllerMarker>("start")?;
1368        Ok(_response.map(|x| x))
1369    }
1370
1371    /// Returns true if this instance is currently running.
1372    pub fn r#is_started(
1373        &self,
1374        ___deadline: zx::MonotonicInstant,
1375    ) -> Result<ControllerIsStartedResult, fidl::Error> {
1376        let _response = self.client.send_query::<
1377            fidl::encoding::EmptyPayload,
1378            fidl::encoding::FlexibleResultType<ControllerIsStartedResponse, Error>,
1379            ControllerMarker,
1380        >(
1381            (),
1382            0x2155e6e1db2083c3,
1383            fidl::encoding::DynamicFlags::FLEXIBLE,
1384            ___deadline,
1385        )?
1386        .into_result::<ControllerMarker>("is_started")?;
1387        Ok(_response.map(|x| x.is_started))
1388    }
1389
1390    /// Opens the exposed directory of the controlled component, through which
1391    /// capabilities the component exposed via `ComponentDecl.exposes` are
1392    /// available, on success.
1393    ///
1394    /// Binding to the exposed directory requires that the component be
1395    /// resolved, but it will not be started until/unless some capability is
1396    /// requested that requires it to be.
1397    ///
1398    /// If this component is destroyed, any outstanding connections to
1399    /// `exposed_dir` will be closed.
1400    ///
1401    /// Errors:
1402    /// - `INSTANCE_CANNOT_RESOLVE`: This component failed to resolve.
1403    pub fn r#open_exposed_dir(
1404        &self,
1405        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1406        ___deadline: zx::MonotonicInstant,
1407    ) -> Result<ControllerOpenExposedDirResult, fidl::Error> {
1408        let _response = self.client.send_query::<
1409            ControllerOpenExposedDirRequest,
1410            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1411            ControllerMarker,
1412        >(
1413            (exposed_dir,),
1414            0x253cabb9a840ed94,
1415            fidl::encoding::DynamicFlags::empty(),
1416            ___deadline,
1417        )?;
1418        Ok(_response.map(|x| x))
1419    }
1420
1421    /// Returns the dictionary containing the component's exposed capabilities.
1422    pub fn r#get_exposed_dictionary(
1423        &self,
1424        ___deadline: zx::MonotonicInstant,
1425    ) -> Result<ControllerGetExposedDictionaryResult, fidl::Error> {
1426        let _response = self.client.send_query::<
1427            fidl::encoding::EmptyPayload,
1428            fidl::encoding::FlexibleResultType<ControllerGetExposedDictionaryResponse, Error>,
1429            ControllerMarker,
1430        >(
1431            (),
1432            0x7e48373e5eda1f9b,
1433            fidl::encoding::DynamicFlags::FLEXIBLE,
1434            ___deadline,
1435        )?
1436        .into_result::<ControllerMarker>("get_exposed_dictionary")?;
1437        Ok(_response.map(|x| x.dictionary))
1438    }
1439
1440    /// Returns a reference to the component's output dictionary, which may be
1441    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
1442    pub fn r#get_output_dictionary(
1443        &self,
1444        ___deadline: zx::MonotonicInstant,
1445    ) -> Result<ControllerGetOutputDictionaryResult, fidl::Error> {
1446        let _response = self.client.send_query::<
1447            fidl::encoding::EmptyPayload,
1448            fidl::encoding::FlexibleResultType<ControllerGetOutputDictionaryResponse, Error>,
1449            ControllerMarker,
1450        >(
1451            (),
1452            0x3a0c4696620ad221,
1453            fidl::encoding::DynamicFlags::FLEXIBLE,
1454            ___deadline,
1455        )?
1456        .into_result::<ControllerMarker>("get_output_dictionary")?;
1457        Ok(_response.map(|x| x.dictionary))
1458    }
1459
1460    /// Destroys this component. When this method returns, the component is
1461    /// either destroyed or in the case of an error no destruction happened.
1462    ///
1463    /// Errors:
1464    ///
1465    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1466    /// Currently, this can happen if the component is a static child of its
1467    /// parent.
1468    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1469    ///   manager's logs will contain more detail.
1470    pub fn r#destroy(
1471        &self,
1472        ___deadline: zx::MonotonicInstant,
1473    ) -> Result<ControllerDestroyResult, fidl::Error> {
1474        let _response = self.client.send_query::<
1475            fidl::encoding::EmptyPayload,
1476            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1477            ControllerMarker,
1478        >(
1479            (),
1480            0x74529fa68b5c1741,
1481            fidl::encoding::DynamicFlags::FLEXIBLE,
1482            ___deadline,
1483        )?
1484        .into_result::<ControllerMarker>("destroy")?;
1485        Ok(_response.map(|x| x))
1486    }
1487}
1488
1489#[cfg(target_os = "fuchsia")]
1490impl From<ControllerSynchronousProxy> for zx::NullableHandle {
1491    fn from(value: ControllerSynchronousProxy) -> Self {
1492        value.into_channel().into()
1493    }
1494}
1495
1496#[cfg(target_os = "fuchsia")]
1497impl From<fidl::Channel> for ControllerSynchronousProxy {
1498    fn from(value: fidl::Channel) -> Self {
1499        Self::new(value)
1500    }
1501}
1502
1503#[cfg(target_os = "fuchsia")]
1504impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
1505    type Protocol = ControllerMarker;
1506
1507    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
1508        Self::new(value.into_channel())
1509    }
1510}
1511
1512#[derive(Debug, Clone)]
1513pub struct ControllerProxy {
1514    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1515}
1516
1517impl fidl::endpoints::Proxy for ControllerProxy {
1518    type Protocol = ControllerMarker;
1519
1520    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1521        Self::new(inner)
1522    }
1523
1524    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1525        self.client.into_channel().map_err(|client| Self { client })
1526    }
1527
1528    fn as_channel(&self) -> &::fidl::AsyncChannel {
1529        self.client.as_channel()
1530    }
1531}
1532
1533impl ControllerProxy {
1534    /// Create a new Proxy for fuchsia.component/Controller.
1535    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1536        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1537        Self { client: fidl::client::Client::new(channel, protocol_name) }
1538    }
1539
1540    /// Get a Stream of events from the remote end of the protocol.
1541    ///
1542    /// # Panics
1543    ///
1544    /// Panics if the event stream was already taken.
1545    pub fn take_event_stream(&self) -> ControllerEventStream {
1546        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
1547    }
1548
1549    /// Start the component, optionally providing additional handles to be given
1550    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
1551    /// currently running.
1552    pub fn r#start(
1553        &self,
1554        mut args: StartChildArgs,
1555        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1556    ) -> fidl::client::QueryResponseFut<
1557        ControllerStartResult,
1558        fidl::encoding::DefaultFuchsiaResourceDialect,
1559    > {
1560        ControllerProxyInterface::r#start(self, args, execution_controller)
1561    }
1562
1563    /// Returns true if this instance is currently running.
1564    pub fn r#is_started(
1565        &self,
1566    ) -> fidl::client::QueryResponseFut<
1567        ControllerIsStartedResult,
1568        fidl::encoding::DefaultFuchsiaResourceDialect,
1569    > {
1570        ControllerProxyInterface::r#is_started(self)
1571    }
1572
1573    /// Opens the exposed directory of the controlled component, through which
1574    /// capabilities the component exposed via `ComponentDecl.exposes` are
1575    /// available, on success.
1576    ///
1577    /// Binding to the exposed directory requires that the component be
1578    /// resolved, but it will not be started until/unless some capability is
1579    /// requested that requires it to be.
1580    ///
1581    /// If this component is destroyed, any outstanding connections to
1582    /// `exposed_dir` will be closed.
1583    ///
1584    /// Errors:
1585    /// - `INSTANCE_CANNOT_RESOLVE`: This component failed to resolve.
1586    pub fn r#open_exposed_dir(
1587        &self,
1588        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1589    ) -> fidl::client::QueryResponseFut<
1590        ControllerOpenExposedDirResult,
1591        fidl::encoding::DefaultFuchsiaResourceDialect,
1592    > {
1593        ControllerProxyInterface::r#open_exposed_dir(self, exposed_dir)
1594    }
1595
1596    /// Returns the dictionary containing the component's exposed capabilities.
1597    pub fn r#get_exposed_dictionary(
1598        &self,
1599    ) -> fidl::client::QueryResponseFut<
1600        ControllerGetExposedDictionaryResult,
1601        fidl::encoding::DefaultFuchsiaResourceDialect,
1602    > {
1603        ControllerProxyInterface::r#get_exposed_dictionary(self)
1604    }
1605
1606    /// Returns a reference to the component's output dictionary, which may be
1607    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
1608    pub fn r#get_output_dictionary(
1609        &self,
1610    ) -> fidl::client::QueryResponseFut<
1611        ControllerGetOutputDictionaryResult,
1612        fidl::encoding::DefaultFuchsiaResourceDialect,
1613    > {
1614        ControllerProxyInterface::r#get_output_dictionary(self)
1615    }
1616
1617    /// Destroys this component. When this method returns, the component is
1618    /// either destroyed or in the case of an error no destruction happened.
1619    ///
1620    /// Errors:
1621    ///
1622    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1623    /// Currently, this can happen if the component is a static child of its
1624    /// parent.
1625    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1626    ///   manager's logs will contain more detail.
1627    pub fn r#destroy(
1628        &self,
1629    ) -> fidl::client::QueryResponseFut<
1630        ControllerDestroyResult,
1631        fidl::encoding::DefaultFuchsiaResourceDialect,
1632    > {
1633        ControllerProxyInterface::r#destroy(self)
1634    }
1635}
1636
1637impl ControllerProxyInterface for ControllerProxy {
1638    type StartResponseFut = fidl::client::QueryResponseFut<
1639        ControllerStartResult,
1640        fidl::encoding::DefaultFuchsiaResourceDialect,
1641    >;
1642    fn r#start(
1643        &self,
1644        mut args: StartChildArgs,
1645        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1646    ) -> Self::StartResponseFut {
1647        fn _decode(
1648            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1649        ) -> Result<ControllerStartResult, fidl::Error> {
1650            let _response = fidl::client::decode_transaction_body::<
1651                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1652                fidl::encoding::DefaultFuchsiaResourceDialect,
1653                0x68878076b8d2eac5,
1654            >(_buf?)?
1655            .into_result::<ControllerMarker>("start")?;
1656            Ok(_response.map(|x| x))
1657        }
1658        self.client.send_query_and_decode::<ControllerStartRequest, ControllerStartResult>(
1659            (&mut args, execution_controller),
1660            0x68878076b8d2eac5,
1661            fidl::encoding::DynamicFlags::FLEXIBLE,
1662            _decode,
1663        )
1664    }
1665
1666    type IsStartedResponseFut = fidl::client::QueryResponseFut<
1667        ControllerIsStartedResult,
1668        fidl::encoding::DefaultFuchsiaResourceDialect,
1669    >;
1670    fn r#is_started(&self) -> Self::IsStartedResponseFut {
1671        fn _decode(
1672            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1673        ) -> Result<ControllerIsStartedResult, fidl::Error> {
1674            let _response = fidl::client::decode_transaction_body::<
1675                fidl::encoding::FlexibleResultType<ControllerIsStartedResponse, Error>,
1676                fidl::encoding::DefaultFuchsiaResourceDialect,
1677                0x2155e6e1db2083c3,
1678            >(_buf?)?
1679            .into_result::<ControllerMarker>("is_started")?;
1680            Ok(_response.map(|x| x.is_started))
1681        }
1682        self.client
1683            .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerIsStartedResult>(
1684                (),
1685                0x2155e6e1db2083c3,
1686                fidl::encoding::DynamicFlags::FLEXIBLE,
1687                _decode,
1688            )
1689    }
1690
1691    type OpenExposedDirResponseFut = fidl::client::QueryResponseFut<
1692        ControllerOpenExposedDirResult,
1693        fidl::encoding::DefaultFuchsiaResourceDialect,
1694    >;
1695    fn r#open_exposed_dir(
1696        &self,
1697        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1698    ) -> Self::OpenExposedDirResponseFut {
1699        fn _decode(
1700            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1701        ) -> Result<ControllerOpenExposedDirResult, fidl::Error> {
1702            let _response = fidl::client::decode_transaction_body::<
1703                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1704                fidl::encoding::DefaultFuchsiaResourceDialect,
1705                0x253cabb9a840ed94,
1706            >(_buf?)?;
1707            Ok(_response.map(|x| x))
1708        }
1709        self.client.send_query_and_decode::<
1710            ControllerOpenExposedDirRequest,
1711            ControllerOpenExposedDirResult,
1712        >(
1713            (exposed_dir,),
1714            0x253cabb9a840ed94,
1715            fidl::encoding::DynamicFlags::empty(),
1716            _decode,
1717        )
1718    }
1719
1720    type GetExposedDictionaryResponseFut = fidl::client::QueryResponseFut<
1721        ControllerGetExposedDictionaryResult,
1722        fidl::encoding::DefaultFuchsiaResourceDialect,
1723    >;
1724    fn r#get_exposed_dictionary(&self) -> Self::GetExposedDictionaryResponseFut {
1725        fn _decode(
1726            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1727        ) -> Result<ControllerGetExposedDictionaryResult, fidl::Error> {
1728            let _response = fidl::client::decode_transaction_body::<
1729                fidl::encoding::FlexibleResultType<ControllerGetExposedDictionaryResponse, Error>,
1730                fidl::encoding::DefaultFuchsiaResourceDialect,
1731                0x7e48373e5eda1f9b,
1732            >(_buf?)?
1733            .into_result::<ControllerMarker>("get_exposed_dictionary")?;
1734            Ok(_response.map(|x| x.dictionary))
1735        }
1736        self.client.send_query_and_decode::<
1737            fidl::encoding::EmptyPayload,
1738            ControllerGetExposedDictionaryResult,
1739        >(
1740            (),
1741            0x7e48373e5eda1f9b,
1742            fidl::encoding::DynamicFlags::FLEXIBLE,
1743            _decode,
1744        )
1745    }
1746
1747    type GetOutputDictionaryResponseFut = fidl::client::QueryResponseFut<
1748        ControllerGetOutputDictionaryResult,
1749        fidl::encoding::DefaultFuchsiaResourceDialect,
1750    >;
1751    fn r#get_output_dictionary(&self) -> Self::GetOutputDictionaryResponseFut {
1752        fn _decode(
1753            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1754        ) -> Result<ControllerGetOutputDictionaryResult, fidl::Error> {
1755            let _response = fidl::client::decode_transaction_body::<
1756                fidl::encoding::FlexibleResultType<ControllerGetOutputDictionaryResponse, Error>,
1757                fidl::encoding::DefaultFuchsiaResourceDialect,
1758                0x3a0c4696620ad221,
1759            >(_buf?)?
1760            .into_result::<ControllerMarker>("get_output_dictionary")?;
1761            Ok(_response.map(|x| x.dictionary))
1762        }
1763        self.client.send_query_and_decode::<
1764            fidl::encoding::EmptyPayload,
1765            ControllerGetOutputDictionaryResult,
1766        >(
1767            (),
1768            0x3a0c4696620ad221,
1769            fidl::encoding::DynamicFlags::FLEXIBLE,
1770            _decode,
1771        )
1772    }
1773
1774    type DestroyResponseFut = fidl::client::QueryResponseFut<
1775        ControllerDestroyResult,
1776        fidl::encoding::DefaultFuchsiaResourceDialect,
1777    >;
1778    fn r#destroy(&self) -> Self::DestroyResponseFut {
1779        fn _decode(
1780            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1781        ) -> Result<ControllerDestroyResult, fidl::Error> {
1782            let _response = fidl::client::decode_transaction_body::<
1783                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1784                fidl::encoding::DefaultFuchsiaResourceDialect,
1785                0x74529fa68b5c1741,
1786            >(_buf?)?
1787            .into_result::<ControllerMarker>("destroy")?;
1788            Ok(_response.map(|x| x))
1789        }
1790        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerDestroyResult>(
1791            (),
1792            0x74529fa68b5c1741,
1793            fidl::encoding::DynamicFlags::FLEXIBLE,
1794            _decode,
1795        )
1796    }
1797}
1798
1799pub struct ControllerEventStream {
1800    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1801}
1802
1803impl std::marker::Unpin for ControllerEventStream {}
1804
1805impl futures::stream::FusedStream for ControllerEventStream {
1806    fn is_terminated(&self) -> bool {
1807        self.event_receiver.is_terminated()
1808    }
1809}
1810
1811impl futures::Stream for ControllerEventStream {
1812    type Item = Result<ControllerEvent, fidl::Error>;
1813
1814    fn poll_next(
1815        mut self: std::pin::Pin<&mut Self>,
1816        cx: &mut std::task::Context<'_>,
1817    ) -> std::task::Poll<Option<Self::Item>> {
1818        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1819            &mut self.event_receiver,
1820            cx
1821        )?) {
1822            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
1823            None => std::task::Poll::Ready(None),
1824        }
1825    }
1826}
1827
1828#[derive(Debug)]
1829pub enum ControllerEvent {
1830    #[non_exhaustive]
1831    _UnknownEvent {
1832        /// Ordinal of the event that was sent.
1833        ordinal: u64,
1834    },
1835}
1836
1837impl ControllerEvent {
1838    /// Decodes a message buffer as a [`ControllerEvent`].
1839    fn decode(
1840        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1841    ) -> Result<ControllerEvent, fidl::Error> {
1842        let (bytes, _handles) = buf.split_mut();
1843        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1844        debug_assert_eq!(tx_header.tx_id, 0);
1845        match tx_header.ordinal {
1846            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1847                Ok(ControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1848            }
1849            _ => Err(fidl::Error::UnknownOrdinal {
1850                ordinal: tx_header.ordinal,
1851                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1852            }),
1853        }
1854    }
1855}
1856
1857/// A Stream of incoming requests for fuchsia.component/Controller.
1858pub struct ControllerRequestStream {
1859    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1860    is_terminated: bool,
1861}
1862
1863impl std::marker::Unpin for ControllerRequestStream {}
1864
1865impl futures::stream::FusedStream for ControllerRequestStream {
1866    fn is_terminated(&self) -> bool {
1867        self.is_terminated
1868    }
1869}
1870
1871impl fidl::endpoints::RequestStream for ControllerRequestStream {
1872    type Protocol = ControllerMarker;
1873    type ControlHandle = ControllerControlHandle;
1874
1875    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1876        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1877    }
1878
1879    fn control_handle(&self) -> Self::ControlHandle {
1880        ControllerControlHandle { inner: self.inner.clone() }
1881    }
1882
1883    fn into_inner(
1884        self,
1885    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1886    {
1887        (self.inner, self.is_terminated)
1888    }
1889
1890    fn from_inner(
1891        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1892        is_terminated: bool,
1893    ) -> Self {
1894        Self { inner, is_terminated }
1895    }
1896}
1897
1898impl futures::Stream for ControllerRequestStream {
1899    type Item = Result<ControllerRequest, fidl::Error>;
1900
1901    fn poll_next(
1902        mut self: std::pin::Pin<&mut Self>,
1903        cx: &mut std::task::Context<'_>,
1904    ) -> std::task::Poll<Option<Self::Item>> {
1905        let this = &mut *self;
1906        if this.inner.check_shutdown(cx) {
1907            this.is_terminated = true;
1908            return std::task::Poll::Ready(None);
1909        }
1910        if this.is_terminated {
1911            panic!("polled ControllerRequestStream after completion");
1912        }
1913        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1914            |bytes, handles| {
1915                match this.inner.channel().read_etc(cx, bytes, handles) {
1916                    std::task::Poll::Ready(Ok(())) => {}
1917                    std::task::Poll::Pending => return std::task::Poll::Pending,
1918                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1919                        this.is_terminated = true;
1920                        return std::task::Poll::Ready(None);
1921                    }
1922                    std::task::Poll::Ready(Err(e)) => {
1923                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1924                            e.into(),
1925                        ))));
1926                    }
1927                }
1928
1929                // A message has been received from the channel
1930                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1931
1932                std::task::Poll::Ready(Some(match header.ordinal {
1933                    0x68878076b8d2eac5 => {
1934                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1935                        let mut req = fidl::new_empty!(
1936                            ControllerStartRequest,
1937                            fidl::encoding::DefaultFuchsiaResourceDialect
1938                        );
1939                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerStartRequest>(&header, _body_bytes, handles, &mut req)?;
1940                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1941                        Ok(ControllerRequest::Start {
1942                            args: req.args,
1943                            execution_controller: req.execution_controller,
1944
1945                            responder: ControllerStartResponder {
1946                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1947                                tx_id: header.tx_id,
1948                            },
1949                        })
1950                    }
1951                    0x2155e6e1db2083c3 => {
1952                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1953                        let mut req = fidl::new_empty!(
1954                            fidl::encoding::EmptyPayload,
1955                            fidl::encoding::DefaultFuchsiaResourceDialect
1956                        );
1957                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1958                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1959                        Ok(ControllerRequest::IsStarted {
1960                            responder: ControllerIsStartedResponder {
1961                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1962                                tx_id: header.tx_id,
1963                            },
1964                        })
1965                    }
1966                    0x253cabb9a840ed94 => {
1967                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1968                        let mut req = fidl::new_empty!(
1969                            ControllerOpenExposedDirRequest,
1970                            fidl::encoding::DefaultFuchsiaResourceDialect
1971                        );
1972                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerOpenExposedDirRequest>(&header, _body_bytes, handles, &mut req)?;
1973                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1974                        Ok(ControllerRequest::OpenExposedDir {
1975                            exposed_dir: req.exposed_dir,
1976
1977                            responder: ControllerOpenExposedDirResponder {
1978                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1979                                tx_id: header.tx_id,
1980                            },
1981                        })
1982                    }
1983                    0x7e48373e5eda1f9b => {
1984                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1985                        let mut req = fidl::new_empty!(
1986                            fidl::encoding::EmptyPayload,
1987                            fidl::encoding::DefaultFuchsiaResourceDialect
1988                        );
1989                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1990                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1991                        Ok(ControllerRequest::GetExposedDictionary {
1992                            responder: ControllerGetExposedDictionaryResponder {
1993                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1994                                tx_id: header.tx_id,
1995                            },
1996                        })
1997                    }
1998                    0x3a0c4696620ad221 => {
1999                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2000                        let mut req = fidl::new_empty!(
2001                            fidl::encoding::EmptyPayload,
2002                            fidl::encoding::DefaultFuchsiaResourceDialect
2003                        );
2004                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2005                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
2006                        Ok(ControllerRequest::GetOutputDictionary {
2007                            responder: ControllerGetOutputDictionaryResponder {
2008                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2009                                tx_id: header.tx_id,
2010                            },
2011                        })
2012                    }
2013                    0x74529fa68b5c1741 => {
2014                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2015                        let mut req = fidl::new_empty!(
2016                            fidl::encoding::EmptyPayload,
2017                            fidl::encoding::DefaultFuchsiaResourceDialect
2018                        );
2019                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2020                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
2021                        Ok(ControllerRequest::Destroy {
2022                            responder: ControllerDestroyResponder {
2023                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2024                                tx_id: header.tx_id,
2025                            },
2026                        })
2027                    }
2028                    _ if header.tx_id == 0
2029                        && header
2030                            .dynamic_flags()
2031                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2032                    {
2033                        Ok(ControllerRequest::_UnknownMethod {
2034                            ordinal: header.ordinal,
2035                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
2036                            method_type: fidl::MethodType::OneWay,
2037                        })
2038                    }
2039                    _ if header
2040                        .dynamic_flags()
2041                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2042                    {
2043                        this.inner.send_framework_err(
2044                            fidl::encoding::FrameworkErr::UnknownMethod,
2045                            header.tx_id,
2046                            header.ordinal,
2047                            header.dynamic_flags(),
2048                            (bytes, handles),
2049                        )?;
2050                        Ok(ControllerRequest::_UnknownMethod {
2051                            ordinal: header.ordinal,
2052                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
2053                            method_type: fidl::MethodType::TwoWay,
2054                        })
2055                    }
2056                    _ => Err(fidl::Error::UnknownOrdinal {
2057                        ordinal: header.ordinal,
2058                        protocol_name:
2059                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2060                    }),
2061                }))
2062            },
2063        )
2064    }
2065}
2066
2067/// A protocol used to operate on a component.
2068///
2069/// One may get access to a `Controller` when creating a component with the
2070/// `Realm.CreateChild` method. You may also obtain a `Controller` for an
2071/// existing child component with the `Realm.OpenController` method.
2072#[derive(Debug)]
2073pub enum ControllerRequest {
2074    /// Start the component, optionally providing additional handles to be given
2075    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
2076    /// currently running.
2077    Start {
2078        args: StartChildArgs,
2079        execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
2080        responder: ControllerStartResponder,
2081    },
2082    /// Returns true if this instance is currently running.
2083    IsStarted { responder: ControllerIsStartedResponder },
2084    /// Opens the exposed directory of the controlled component, through which
2085    /// capabilities the component exposed via `ComponentDecl.exposes` are
2086    /// available, on success.
2087    ///
2088    /// Binding to the exposed directory requires that the component be
2089    /// resolved, but it will not be started until/unless some capability is
2090    /// requested that requires it to be.
2091    ///
2092    /// If this component is destroyed, any outstanding connections to
2093    /// `exposed_dir` will be closed.
2094    ///
2095    /// Errors:
2096    /// - `INSTANCE_CANNOT_RESOLVE`: This component failed to resolve.
2097    OpenExposedDir {
2098        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2099        responder: ControllerOpenExposedDirResponder,
2100    },
2101    /// Returns the dictionary containing the component's exposed capabilities.
2102    GetExposedDictionary { responder: ControllerGetExposedDictionaryResponder },
2103    /// Returns a reference to the component's output dictionary, which may be
2104    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
2105    GetOutputDictionary { responder: ControllerGetOutputDictionaryResponder },
2106    /// Destroys this component. When this method returns, the component is
2107    /// either destroyed or in the case of an error no destruction happened.
2108    ///
2109    /// Errors:
2110    ///
2111    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
2112    /// Currently, this can happen if the component is a static child of its
2113    /// parent.
2114    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
2115    ///   manager's logs will contain more detail.
2116    Destroy { responder: ControllerDestroyResponder },
2117    /// An interaction was received which does not match any known method.
2118    #[non_exhaustive]
2119    _UnknownMethod {
2120        /// Ordinal of the method that was called.
2121        ordinal: u64,
2122        control_handle: ControllerControlHandle,
2123        method_type: fidl::MethodType,
2124    },
2125}
2126
2127impl ControllerRequest {
2128    #[allow(irrefutable_let_patterns)]
2129    pub fn into_start(
2130        self,
2131    ) -> Option<(
2132        StartChildArgs,
2133        fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
2134        ControllerStartResponder,
2135    )> {
2136        if let ControllerRequest::Start { args, execution_controller, responder } = self {
2137            Some((args, execution_controller, responder))
2138        } else {
2139            None
2140        }
2141    }
2142
2143    #[allow(irrefutable_let_patterns)]
2144    pub fn into_is_started(self) -> Option<(ControllerIsStartedResponder)> {
2145        if let ControllerRequest::IsStarted { responder } = self { Some((responder)) } else { None }
2146    }
2147
2148    #[allow(irrefutable_let_patterns)]
2149    pub fn into_open_exposed_dir(
2150        self,
2151    ) -> Option<(
2152        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2153        ControllerOpenExposedDirResponder,
2154    )> {
2155        if let ControllerRequest::OpenExposedDir { exposed_dir, responder } = self {
2156            Some((exposed_dir, responder))
2157        } else {
2158            None
2159        }
2160    }
2161
2162    #[allow(irrefutable_let_patterns)]
2163    pub fn into_get_exposed_dictionary(self) -> Option<(ControllerGetExposedDictionaryResponder)> {
2164        if let ControllerRequest::GetExposedDictionary { responder } = self {
2165            Some((responder))
2166        } else {
2167            None
2168        }
2169    }
2170
2171    #[allow(irrefutable_let_patterns)]
2172    pub fn into_get_output_dictionary(self) -> Option<(ControllerGetOutputDictionaryResponder)> {
2173        if let ControllerRequest::GetOutputDictionary { responder } = self {
2174            Some((responder))
2175        } else {
2176            None
2177        }
2178    }
2179
2180    #[allow(irrefutable_let_patterns)]
2181    pub fn into_destroy(self) -> Option<(ControllerDestroyResponder)> {
2182        if let ControllerRequest::Destroy { responder } = self { Some((responder)) } else { None }
2183    }
2184
2185    /// Name of the method defined in FIDL
2186    pub fn method_name(&self) -> &'static str {
2187        match *self {
2188            ControllerRequest::Start { .. } => "start",
2189            ControllerRequest::IsStarted { .. } => "is_started",
2190            ControllerRequest::OpenExposedDir { .. } => "open_exposed_dir",
2191            ControllerRequest::GetExposedDictionary { .. } => "get_exposed_dictionary",
2192            ControllerRequest::GetOutputDictionary { .. } => "get_output_dictionary",
2193            ControllerRequest::Destroy { .. } => "destroy",
2194            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2195                "unknown one-way method"
2196            }
2197            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2198                "unknown two-way method"
2199            }
2200        }
2201    }
2202}
2203
2204#[derive(Debug, Clone)]
2205pub struct ControllerControlHandle {
2206    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2207}
2208
2209impl fidl::endpoints::ControlHandle for ControllerControlHandle {
2210    fn shutdown(&self) {
2211        self.inner.shutdown()
2212    }
2213
2214    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2215        self.inner.shutdown_with_epitaph(status)
2216    }
2217
2218    fn is_closed(&self) -> bool {
2219        self.inner.channel().is_closed()
2220    }
2221    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2222        self.inner.channel().on_closed()
2223    }
2224
2225    #[cfg(target_os = "fuchsia")]
2226    fn signal_peer(
2227        &self,
2228        clear_mask: zx::Signals,
2229        set_mask: zx::Signals,
2230    ) -> Result<(), zx_status::Status> {
2231        use fidl::Peered;
2232        self.inner.channel().signal_peer(clear_mask, set_mask)
2233    }
2234}
2235
2236impl ControllerControlHandle {}
2237
2238#[must_use = "FIDL methods require a response to be sent"]
2239#[derive(Debug)]
2240pub struct ControllerStartResponder {
2241    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2242    tx_id: u32,
2243}
2244
2245/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2246/// if the responder is dropped without sending a response, so that the client
2247/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2248impl std::ops::Drop for ControllerStartResponder {
2249    fn drop(&mut self) {
2250        self.control_handle.shutdown();
2251        // Safety: drops once, never accessed again
2252        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2253    }
2254}
2255
2256impl fidl::endpoints::Responder for ControllerStartResponder {
2257    type ControlHandle = ControllerControlHandle;
2258
2259    fn control_handle(&self) -> &ControllerControlHandle {
2260        &self.control_handle
2261    }
2262
2263    fn drop_without_shutdown(mut self) {
2264        // Safety: drops once, never accessed again due to mem::forget
2265        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2266        // Prevent Drop from running (which would shut down the channel)
2267        std::mem::forget(self);
2268    }
2269}
2270
2271impl ControllerStartResponder {
2272    /// Sends a response to the FIDL transaction.
2273    ///
2274    /// Sets the channel to shutdown if an error occurs.
2275    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2276        let _result = self.send_raw(result);
2277        if _result.is_err() {
2278            self.control_handle.shutdown();
2279        }
2280        self.drop_without_shutdown();
2281        _result
2282    }
2283
2284    /// Similar to "send" but does not shutdown the channel if an error occurs.
2285    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2286        let _result = self.send_raw(result);
2287        self.drop_without_shutdown();
2288        _result
2289    }
2290
2291    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2292        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2293            fidl::encoding::EmptyStruct,
2294            Error,
2295        >>(
2296            fidl::encoding::FlexibleResult::new(result),
2297            self.tx_id,
2298            0x68878076b8d2eac5,
2299            fidl::encoding::DynamicFlags::FLEXIBLE,
2300        )
2301    }
2302}
2303
2304#[must_use = "FIDL methods require a response to be sent"]
2305#[derive(Debug)]
2306pub struct ControllerIsStartedResponder {
2307    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2308    tx_id: u32,
2309}
2310
2311/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2312/// if the responder is dropped without sending a response, so that the client
2313/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2314impl std::ops::Drop for ControllerIsStartedResponder {
2315    fn drop(&mut self) {
2316        self.control_handle.shutdown();
2317        // Safety: drops once, never accessed again
2318        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2319    }
2320}
2321
2322impl fidl::endpoints::Responder for ControllerIsStartedResponder {
2323    type ControlHandle = ControllerControlHandle;
2324
2325    fn control_handle(&self) -> &ControllerControlHandle {
2326        &self.control_handle
2327    }
2328
2329    fn drop_without_shutdown(mut self) {
2330        // Safety: drops once, never accessed again due to mem::forget
2331        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2332        // Prevent Drop from running (which would shut down the channel)
2333        std::mem::forget(self);
2334    }
2335}
2336
2337impl ControllerIsStartedResponder {
2338    /// Sends a response to the FIDL transaction.
2339    ///
2340    /// Sets the channel to shutdown if an error occurs.
2341    pub fn send(self, mut result: Result<bool, Error>) -> Result<(), fidl::Error> {
2342        let _result = self.send_raw(result);
2343        if _result.is_err() {
2344            self.control_handle.shutdown();
2345        }
2346        self.drop_without_shutdown();
2347        _result
2348    }
2349
2350    /// Similar to "send" but does not shutdown the channel if an error occurs.
2351    pub fn send_no_shutdown_on_err(
2352        self,
2353        mut result: Result<bool, Error>,
2354    ) -> Result<(), fidl::Error> {
2355        let _result = self.send_raw(result);
2356        self.drop_without_shutdown();
2357        _result
2358    }
2359
2360    fn send_raw(&self, mut result: Result<bool, Error>) -> Result<(), fidl::Error> {
2361        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2362            ControllerIsStartedResponse,
2363            Error,
2364        >>(
2365            fidl::encoding::FlexibleResult::new(result.map(|is_started| (is_started,))),
2366            self.tx_id,
2367            0x2155e6e1db2083c3,
2368            fidl::encoding::DynamicFlags::FLEXIBLE,
2369        )
2370    }
2371}
2372
2373#[must_use = "FIDL methods require a response to be sent"]
2374#[derive(Debug)]
2375pub struct ControllerOpenExposedDirResponder {
2376    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2377    tx_id: u32,
2378}
2379
2380/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2381/// if the responder is dropped without sending a response, so that the client
2382/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2383impl std::ops::Drop for ControllerOpenExposedDirResponder {
2384    fn drop(&mut self) {
2385        self.control_handle.shutdown();
2386        // Safety: drops once, never accessed again
2387        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2388    }
2389}
2390
2391impl fidl::endpoints::Responder for ControllerOpenExposedDirResponder {
2392    type ControlHandle = ControllerControlHandle;
2393
2394    fn control_handle(&self) -> &ControllerControlHandle {
2395        &self.control_handle
2396    }
2397
2398    fn drop_without_shutdown(mut self) {
2399        // Safety: drops once, never accessed again due to mem::forget
2400        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2401        // Prevent Drop from running (which would shut down the channel)
2402        std::mem::forget(self);
2403    }
2404}
2405
2406impl ControllerOpenExposedDirResponder {
2407    /// Sends a response to the FIDL transaction.
2408    ///
2409    /// Sets the channel to shutdown if an error occurs.
2410    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2411        let _result = self.send_raw(result);
2412        if _result.is_err() {
2413            self.control_handle.shutdown();
2414        }
2415        self.drop_without_shutdown();
2416        _result
2417    }
2418
2419    /// Similar to "send" but does not shutdown the channel if an error occurs.
2420    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2421        let _result = self.send_raw(result);
2422        self.drop_without_shutdown();
2423        _result
2424    }
2425
2426    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2427        self.control_handle
2428            .inner
2429            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2430                result,
2431                self.tx_id,
2432                0x253cabb9a840ed94,
2433                fidl::encoding::DynamicFlags::empty(),
2434            )
2435    }
2436}
2437
2438#[must_use = "FIDL methods require a response to be sent"]
2439#[derive(Debug)]
2440pub struct ControllerGetExposedDictionaryResponder {
2441    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2442    tx_id: u32,
2443}
2444
2445/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2446/// if the responder is dropped without sending a response, so that the client
2447/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2448impl std::ops::Drop for ControllerGetExposedDictionaryResponder {
2449    fn drop(&mut self) {
2450        self.control_handle.shutdown();
2451        // Safety: drops once, never accessed again
2452        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2453    }
2454}
2455
2456impl fidl::endpoints::Responder for ControllerGetExposedDictionaryResponder {
2457    type ControlHandle = ControllerControlHandle;
2458
2459    fn control_handle(&self) -> &ControllerControlHandle {
2460        &self.control_handle
2461    }
2462
2463    fn drop_without_shutdown(mut self) {
2464        // Safety: drops once, never accessed again due to mem::forget
2465        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2466        // Prevent Drop from running (which would shut down the channel)
2467        std::mem::forget(self);
2468    }
2469}
2470
2471impl ControllerGetExposedDictionaryResponder {
2472    /// Sends a response to the FIDL transaction.
2473    ///
2474    /// Sets the channel to shutdown if an error occurs.
2475    pub fn send(
2476        self,
2477        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2478    ) -> Result<(), fidl::Error> {
2479        let _result = self.send_raw(result);
2480        if _result.is_err() {
2481            self.control_handle.shutdown();
2482        }
2483        self.drop_without_shutdown();
2484        _result
2485    }
2486
2487    /// Similar to "send" but does not shutdown the channel if an error occurs.
2488    pub fn send_no_shutdown_on_err(
2489        self,
2490        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2491    ) -> Result<(), fidl::Error> {
2492        let _result = self.send_raw(result);
2493        self.drop_without_shutdown();
2494        _result
2495    }
2496
2497    fn send_raw(
2498        &self,
2499        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2500    ) -> Result<(), fidl::Error> {
2501        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2502            ControllerGetExposedDictionaryResponse,
2503            Error,
2504        >>(
2505            fidl::encoding::FlexibleResult::new(
2506                result.as_mut().map_err(|e| *e).map(|dictionary| (dictionary,)),
2507            ),
2508            self.tx_id,
2509            0x7e48373e5eda1f9b,
2510            fidl::encoding::DynamicFlags::FLEXIBLE,
2511        )
2512    }
2513}
2514
2515#[must_use = "FIDL methods require a response to be sent"]
2516#[derive(Debug)]
2517pub struct ControllerGetOutputDictionaryResponder {
2518    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2519    tx_id: u32,
2520}
2521
2522/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2523/// if the responder is dropped without sending a response, so that the client
2524/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2525impl std::ops::Drop for ControllerGetOutputDictionaryResponder {
2526    fn drop(&mut self) {
2527        self.control_handle.shutdown();
2528        // Safety: drops once, never accessed again
2529        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2530    }
2531}
2532
2533impl fidl::endpoints::Responder for ControllerGetOutputDictionaryResponder {
2534    type ControlHandle = ControllerControlHandle;
2535
2536    fn control_handle(&self) -> &ControllerControlHandle {
2537        &self.control_handle
2538    }
2539
2540    fn drop_without_shutdown(mut self) {
2541        // Safety: drops once, never accessed again due to mem::forget
2542        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2543        // Prevent Drop from running (which would shut down the channel)
2544        std::mem::forget(self);
2545    }
2546}
2547
2548impl ControllerGetOutputDictionaryResponder {
2549    /// Sends a response to the FIDL transaction.
2550    ///
2551    /// Sets the channel to shutdown if an error occurs.
2552    pub fn send(self, mut result: Result<fidl::EventPair, Error>) -> Result<(), fidl::Error> {
2553        let _result = self.send_raw(result);
2554        if _result.is_err() {
2555            self.control_handle.shutdown();
2556        }
2557        self.drop_without_shutdown();
2558        _result
2559    }
2560
2561    /// Similar to "send" but does not shutdown the channel if an error occurs.
2562    pub fn send_no_shutdown_on_err(
2563        self,
2564        mut result: Result<fidl::EventPair, Error>,
2565    ) -> Result<(), fidl::Error> {
2566        let _result = self.send_raw(result);
2567        self.drop_without_shutdown();
2568        _result
2569    }
2570
2571    fn send_raw(&self, mut result: Result<fidl::EventPair, Error>) -> Result<(), fidl::Error> {
2572        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2573            ControllerGetOutputDictionaryResponse,
2574            Error,
2575        >>(
2576            fidl::encoding::FlexibleResult::new(result.map(|dictionary| (dictionary,))),
2577            self.tx_id,
2578            0x3a0c4696620ad221,
2579            fidl::encoding::DynamicFlags::FLEXIBLE,
2580        )
2581    }
2582}
2583
2584#[must_use = "FIDL methods require a response to be sent"]
2585#[derive(Debug)]
2586pub struct ControllerDestroyResponder {
2587    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2588    tx_id: u32,
2589}
2590
2591/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2592/// if the responder is dropped without sending a response, so that the client
2593/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2594impl std::ops::Drop for ControllerDestroyResponder {
2595    fn drop(&mut self) {
2596        self.control_handle.shutdown();
2597        // Safety: drops once, never accessed again
2598        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2599    }
2600}
2601
2602impl fidl::endpoints::Responder for ControllerDestroyResponder {
2603    type ControlHandle = ControllerControlHandle;
2604
2605    fn control_handle(&self) -> &ControllerControlHandle {
2606        &self.control_handle
2607    }
2608
2609    fn drop_without_shutdown(mut self) {
2610        // Safety: drops once, never accessed again due to mem::forget
2611        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2612        // Prevent Drop from running (which would shut down the channel)
2613        std::mem::forget(self);
2614    }
2615}
2616
2617impl ControllerDestroyResponder {
2618    /// Sends a response to the FIDL transaction.
2619    ///
2620    /// Sets the channel to shutdown if an error occurs.
2621    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2622        let _result = self.send_raw(result);
2623        if _result.is_err() {
2624            self.control_handle.shutdown();
2625        }
2626        self.drop_without_shutdown();
2627        _result
2628    }
2629
2630    /// Similar to "send" but does not shutdown the channel if an error occurs.
2631    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2632        let _result = self.send_raw(result);
2633        self.drop_without_shutdown();
2634        _result
2635    }
2636
2637    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2638        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2639            fidl::encoding::EmptyStruct,
2640            Error,
2641        >>(
2642            fidl::encoding::FlexibleResult::new(result),
2643            self.tx_id,
2644            0x74529fa68b5c1741,
2645            fidl::encoding::DynamicFlags::FLEXIBLE,
2646        )
2647    }
2648}
2649
2650#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2651pub struct EventStreamMarker;
2652
2653impl fidl::endpoints::ProtocolMarker for EventStreamMarker {
2654    type Proxy = EventStreamProxy;
2655    type RequestStream = EventStreamRequestStream;
2656    #[cfg(target_os = "fuchsia")]
2657    type SynchronousProxy = EventStreamSynchronousProxy;
2658
2659    const DEBUG_NAME: &'static str = "fuchsia.component.EventStream";
2660}
2661impl fidl::endpoints::DiscoverableProtocolMarker for EventStreamMarker {}
2662
2663pub trait EventStreamProxyInterface: Send + Sync {
2664    type GetNextResponseFut: std::future::Future<Output = Result<Vec<Event>, fidl::Error>> + Send;
2665    fn r#get_next(&self) -> Self::GetNextResponseFut;
2666    type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2667    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
2668}
2669#[derive(Debug)]
2670#[cfg(target_os = "fuchsia")]
2671pub struct EventStreamSynchronousProxy {
2672    client: fidl::client::sync::Client,
2673}
2674
2675#[cfg(target_os = "fuchsia")]
2676impl fidl::endpoints::SynchronousProxy for EventStreamSynchronousProxy {
2677    type Proxy = EventStreamProxy;
2678    type Protocol = EventStreamMarker;
2679
2680    fn from_channel(inner: fidl::Channel) -> Self {
2681        Self::new(inner)
2682    }
2683
2684    fn into_channel(self) -> fidl::Channel {
2685        self.client.into_channel()
2686    }
2687
2688    fn as_channel(&self) -> &fidl::Channel {
2689        self.client.as_channel()
2690    }
2691}
2692
2693#[cfg(target_os = "fuchsia")]
2694impl EventStreamSynchronousProxy {
2695    pub fn new(channel: fidl::Channel) -> Self {
2696        Self { client: fidl::client::sync::Client::new(channel) }
2697    }
2698
2699    pub fn into_channel(self) -> fidl::Channel {
2700        self.client.into_channel()
2701    }
2702
2703    /// Waits until an event arrives and returns it. It is safe for other
2704    /// threads to make concurrent requests while waiting for an event.
2705    pub fn wait_for_event(
2706        &self,
2707        deadline: zx::MonotonicInstant,
2708    ) -> Result<EventStreamEvent, fidl::Error> {
2709        EventStreamEvent::decode(self.client.wait_for_event::<EventStreamMarker>(deadline)?)
2710    }
2711
2712    pub fn r#get_next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Event>, fidl::Error> {
2713        let _response = self.client.send_query::<
2714            fidl::encoding::EmptyPayload,
2715            EventStreamGetNextResponse,
2716            EventStreamMarker,
2717        >(
2718            (),
2719            0x3f24c9495978eb86,
2720            fidl::encoding::DynamicFlags::empty(),
2721            ___deadline,
2722        )?;
2723        Ok(_response.events)
2724    }
2725
2726    /// Returns immediately. Used to indicate that the FIDL connection
2727    /// completed. This is needed for non-static streams to verify
2728    /// that subscribe has completed before components are started.
2729    pub fn r#wait_for_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
2730        let _response = self.client.send_query::<
2731            fidl::encoding::EmptyPayload,
2732            fidl::encoding::EmptyPayload,
2733            EventStreamMarker,
2734        >(
2735            (),
2736            0x31331f9578d2e682,
2737            fidl::encoding::DynamicFlags::empty(),
2738            ___deadline,
2739        )?;
2740        Ok(_response)
2741    }
2742}
2743
2744#[cfg(target_os = "fuchsia")]
2745impl From<EventStreamSynchronousProxy> for zx::NullableHandle {
2746    fn from(value: EventStreamSynchronousProxy) -> Self {
2747        value.into_channel().into()
2748    }
2749}
2750
2751#[cfg(target_os = "fuchsia")]
2752impl From<fidl::Channel> for EventStreamSynchronousProxy {
2753    fn from(value: fidl::Channel) -> Self {
2754        Self::new(value)
2755    }
2756}
2757
2758#[cfg(target_os = "fuchsia")]
2759impl fidl::endpoints::FromClient for EventStreamSynchronousProxy {
2760    type Protocol = EventStreamMarker;
2761
2762    fn from_client(value: fidl::endpoints::ClientEnd<EventStreamMarker>) -> Self {
2763        Self::new(value.into_channel())
2764    }
2765}
2766
2767#[derive(Debug, Clone)]
2768pub struct EventStreamProxy {
2769    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2770}
2771
2772impl fidl::endpoints::Proxy for EventStreamProxy {
2773    type Protocol = EventStreamMarker;
2774
2775    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2776        Self::new(inner)
2777    }
2778
2779    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2780        self.client.into_channel().map_err(|client| Self { client })
2781    }
2782
2783    fn as_channel(&self) -> &::fidl::AsyncChannel {
2784        self.client.as_channel()
2785    }
2786}
2787
2788impl EventStreamProxy {
2789    /// Create a new Proxy for fuchsia.component/EventStream.
2790    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2791        let protocol_name = <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2792        Self { client: fidl::client::Client::new(channel, protocol_name) }
2793    }
2794
2795    /// Get a Stream of events from the remote end of the protocol.
2796    ///
2797    /// # Panics
2798    ///
2799    /// Panics if the event stream was already taken.
2800    pub fn take_event_stream(&self) -> EventStreamEventStream {
2801        EventStreamEventStream { event_receiver: self.client.take_event_receiver() }
2802    }
2803
2804    pub fn r#get_next(
2805        &self,
2806    ) -> fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>
2807    {
2808        EventStreamProxyInterface::r#get_next(self)
2809    }
2810
2811    /// Returns immediately. Used to indicate that the FIDL connection
2812    /// completed. This is needed for non-static streams to verify
2813    /// that subscribe has completed before components are started.
2814    pub fn r#wait_for_ready(
2815        &self,
2816    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2817        EventStreamProxyInterface::r#wait_for_ready(self)
2818    }
2819}
2820
2821impl EventStreamProxyInterface for EventStreamProxy {
2822    type GetNextResponseFut =
2823        fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2824    fn r#get_next(&self) -> Self::GetNextResponseFut {
2825        fn _decode(
2826            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2827        ) -> Result<Vec<Event>, fidl::Error> {
2828            let _response = fidl::client::decode_transaction_body::<
2829                EventStreamGetNextResponse,
2830                fidl::encoding::DefaultFuchsiaResourceDialect,
2831                0x3f24c9495978eb86,
2832            >(_buf?)?;
2833            Ok(_response.events)
2834        }
2835        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Event>>(
2836            (),
2837            0x3f24c9495978eb86,
2838            fidl::encoding::DynamicFlags::empty(),
2839            _decode,
2840        )
2841    }
2842
2843    type WaitForReadyResponseFut =
2844        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2845    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
2846        fn _decode(
2847            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2848        ) -> Result<(), fidl::Error> {
2849            let _response = fidl::client::decode_transaction_body::<
2850                fidl::encoding::EmptyPayload,
2851                fidl::encoding::DefaultFuchsiaResourceDialect,
2852                0x31331f9578d2e682,
2853            >(_buf?)?;
2854            Ok(_response)
2855        }
2856        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2857            (),
2858            0x31331f9578d2e682,
2859            fidl::encoding::DynamicFlags::empty(),
2860            _decode,
2861        )
2862    }
2863}
2864
2865pub struct EventStreamEventStream {
2866    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2867}
2868
2869impl std::marker::Unpin for EventStreamEventStream {}
2870
2871impl futures::stream::FusedStream for EventStreamEventStream {
2872    fn is_terminated(&self) -> bool {
2873        self.event_receiver.is_terminated()
2874    }
2875}
2876
2877impl futures::Stream for EventStreamEventStream {
2878    type Item = Result<EventStreamEvent, fidl::Error>;
2879
2880    fn poll_next(
2881        mut self: std::pin::Pin<&mut Self>,
2882        cx: &mut std::task::Context<'_>,
2883    ) -> std::task::Poll<Option<Self::Item>> {
2884        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2885            &mut self.event_receiver,
2886            cx
2887        )?) {
2888            Some(buf) => std::task::Poll::Ready(Some(EventStreamEvent::decode(buf))),
2889            None => std::task::Poll::Ready(None),
2890        }
2891    }
2892}
2893
2894#[derive(Debug)]
2895pub enum EventStreamEvent {}
2896
2897impl EventStreamEvent {
2898    /// Decodes a message buffer as a [`EventStreamEvent`].
2899    fn decode(
2900        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2901    ) -> Result<EventStreamEvent, fidl::Error> {
2902        let (bytes, _handles) = buf.split_mut();
2903        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2904        debug_assert_eq!(tx_header.tx_id, 0);
2905        match tx_header.ordinal {
2906            _ => Err(fidl::Error::UnknownOrdinal {
2907                ordinal: tx_header.ordinal,
2908                protocol_name: <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2909            }),
2910        }
2911    }
2912}
2913
2914/// A Stream of incoming requests for fuchsia.component/EventStream.
2915pub struct EventStreamRequestStream {
2916    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2917    is_terminated: bool,
2918}
2919
2920impl std::marker::Unpin for EventStreamRequestStream {}
2921
2922impl futures::stream::FusedStream for EventStreamRequestStream {
2923    fn is_terminated(&self) -> bool {
2924        self.is_terminated
2925    }
2926}
2927
2928impl fidl::endpoints::RequestStream for EventStreamRequestStream {
2929    type Protocol = EventStreamMarker;
2930    type ControlHandle = EventStreamControlHandle;
2931
2932    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2933        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2934    }
2935
2936    fn control_handle(&self) -> Self::ControlHandle {
2937        EventStreamControlHandle { inner: self.inner.clone() }
2938    }
2939
2940    fn into_inner(
2941        self,
2942    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2943    {
2944        (self.inner, self.is_terminated)
2945    }
2946
2947    fn from_inner(
2948        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2949        is_terminated: bool,
2950    ) -> Self {
2951        Self { inner, is_terminated }
2952    }
2953}
2954
2955impl futures::Stream for EventStreamRequestStream {
2956    type Item = Result<EventStreamRequest, fidl::Error>;
2957
2958    fn poll_next(
2959        mut self: std::pin::Pin<&mut Self>,
2960        cx: &mut std::task::Context<'_>,
2961    ) -> std::task::Poll<Option<Self::Item>> {
2962        let this = &mut *self;
2963        if this.inner.check_shutdown(cx) {
2964            this.is_terminated = true;
2965            return std::task::Poll::Ready(None);
2966        }
2967        if this.is_terminated {
2968            panic!("polled EventStreamRequestStream after completion");
2969        }
2970        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2971            |bytes, handles| {
2972                match this.inner.channel().read_etc(cx, bytes, handles) {
2973                    std::task::Poll::Ready(Ok(())) => {}
2974                    std::task::Poll::Pending => return std::task::Poll::Pending,
2975                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2976                        this.is_terminated = true;
2977                        return std::task::Poll::Ready(None);
2978                    }
2979                    std::task::Poll::Ready(Err(e)) => {
2980                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2981                            e.into(),
2982                        ))));
2983                    }
2984                }
2985
2986                // A message has been received from the channel
2987                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2988
2989                std::task::Poll::Ready(Some(match header.ordinal {
2990                    0x3f24c9495978eb86 => {
2991                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2992                        let mut req = fidl::new_empty!(
2993                            fidl::encoding::EmptyPayload,
2994                            fidl::encoding::DefaultFuchsiaResourceDialect
2995                        );
2996                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2997                        let control_handle = EventStreamControlHandle { inner: this.inner.clone() };
2998                        Ok(EventStreamRequest::GetNext {
2999                            responder: EventStreamGetNextResponder {
3000                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3001                                tx_id: header.tx_id,
3002                            },
3003                        })
3004                    }
3005                    0x31331f9578d2e682 => {
3006                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3007                        let mut req = fidl::new_empty!(
3008                            fidl::encoding::EmptyPayload,
3009                            fidl::encoding::DefaultFuchsiaResourceDialect
3010                        );
3011                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3012                        let control_handle = EventStreamControlHandle { inner: this.inner.clone() };
3013                        Ok(EventStreamRequest::WaitForReady {
3014                            responder: EventStreamWaitForReadyResponder {
3015                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3016                                tx_id: header.tx_id,
3017                            },
3018                        })
3019                    }
3020                    _ => Err(fidl::Error::UnknownOrdinal {
3021                        ordinal: header.ordinal,
3022                        protocol_name:
3023                            <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3024                    }),
3025                }))
3026            },
3027        )
3028    }
3029}
3030
3031/// Listener for events on the component hierarchy.
3032/// Can't be used outside of the platform.
3033#[derive(Debug)]
3034pub enum EventStreamRequest {
3035    GetNext {
3036        responder: EventStreamGetNextResponder,
3037    },
3038    /// Returns immediately. Used to indicate that the FIDL connection
3039    /// completed. This is needed for non-static streams to verify
3040    /// that subscribe has completed before components are started.
3041    WaitForReady {
3042        responder: EventStreamWaitForReadyResponder,
3043    },
3044}
3045
3046impl EventStreamRequest {
3047    #[allow(irrefutable_let_patterns)]
3048    pub fn into_get_next(self) -> Option<(EventStreamGetNextResponder)> {
3049        if let EventStreamRequest::GetNext { responder } = self { Some((responder)) } else { None }
3050    }
3051
3052    #[allow(irrefutable_let_patterns)]
3053    pub fn into_wait_for_ready(self) -> Option<(EventStreamWaitForReadyResponder)> {
3054        if let EventStreamRequest::WaitForReady { responder } = self {
3055            Some((responder))
3056        } else {
3057            None
3058        }
3059    }
3060
3061    /// Name of the method defined in FIDL
3062    pub fn method_name(&self) -> &'static str {
3063        match *self {
3064            EventStreamRequest::GetNext { .. } => "get_next",
3065            EventStreamRequest::WaitForReady { .. } => "wait_for_ready",
3066        }
3067    }
3068}
3069
3070#[derive(Debug, Clone)]
3071pub struct EventStreamControlHandle {
3072    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3073}
3074
3075impl fidl::endpoints::ControlHandle for EventStreamControlHandle {
3076    fn shutdown(&self) {
3077        self.inner.shutdown()
3078    }
3079
3080    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3081        self.inner.shutdown_with_epitaph(status)
3082    }
3083
3084    fn is_closed(&self) -> bool {
3085        self.inner.channel().is_closed()
3086    }
3087    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3088        self.inner.channel().on_closed()
3089    }
3090
3091    #[cfg(target_os = "fuchsia")]
3092    fn signal_peer(
3093        &self,
3094        clear_mask: zx::Signals,
3095        set_mask: zx::Signals,
3096    ) -> Result<(), zx_status::Status> {
3097        use fidl::Peered;
3098        self.inner.channel().signal_peer(clear_mask, set_mask)
3099    }
3100}
3101
3102impl EventStreamControlHandle {}
3103
3104#[must_use = "FIDL methods require a response to be sent"]
3105#[derive(Debug)]
3106pub struct EventStreamGetNextResponder {
3107    control_handle: std::mem::ManuallyDrop<EventStreamControlHandle>,
3108    tx_id: u32,
3109}
3110
3111/// Set the the channel to be shutdown (see [`EventStreamControlHandle::shutdown`])
3112/// if the responder is dropped without sending a response, so that the client
3113/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3114impl std::ops::Drop for EventStreamGetNextResponder {
3115    fn drop(&mut self) {
3116        self.control_handle.shutdown();
3117        // Safety: drops once, never accessed again
3118        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3119    }
3120}
3121
3122impl fidl::endpoints::Responder for EventStreamGetNextResponder {
3123    type ControlHandle = EventStreamControlHandle;
3124
3125    fn control_handle(&self) -> &EventStreamControlHandle {
3126        &self.control_handle
3127    }
3128
3129    fn drop_without_shutdown(mut self) {
3130        // Safety: drops once, never accessed again due to mem::forget
3131        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3132        // Prevent Drop from running (which would shut down the channel)
3133        std::mem::forget(self);
3134    }
3135}
3136
3137impl EventStreamGetNextResponder {
3138    /// Sends a response to the FIDL transaction.
3139    ///
3140    /// Sets the channel to shutdown if an error occurs.
3141    pub fn send(self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
3142        let _result = self.send_raw(events);
3143        if _result.is_err() {
3144            self.control_handle.shutdown();
3145        }
3146        self.drop_without_shutdown();
3147        _result
3148    }
3149
3150    /// Similar to "send" but does not shutdown the channel if an error occurs.
3151    pub fn send_no_shutdown_on_err(self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
3152        let _result = self.send_raw(events);
3153        self.drop_without_shutdown();
3154        _result
3155    }
3156
3157    fn send_raw(&self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
3158        self.control_handle.inner.send::<EventStreamGetNextResponse>(
3159            (events.as_mut(),),
3160            self.tx_id,
3161            0x3f24c9495978eb86,
3162            fidl::encoding::DynamicFlags::empty(),
3163        )
3164    }
3165}
3166
3167#[must_use = "FIDL methods require a response to be sent"]
3168#[derive(Debug)]
3169pub struct EventStreamWaitForReadyResponder {
3170    control_handle: std::mem::ManuallyDrop<EventStreamControlHandle>,
3171    tx_id: u32,
3172}
3173
3174/// Set the the channel to be shutdown (see [`EventStreamControlHandle::shutdown`])
3175/// if the responder is dropped without sending a response, so that the client
3176/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3177impl std::ops::Drop for EventStreamWaitForReadyResponder {
3178    fn drop(&mut self) {
3179        self.control_handle.shutdown();
3180        // Safety: drops once, never accessed again
3181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3182    }
3183}
3184
3185impl fidl::endpoints::Responder for EventStreamWaitForReadyResponder {
3186    type ControlHandle = EventStreamControlHandle;
3187
3188    fn control_handle(&self) -> &EventStreamControlHandle {
3189        &self.control_handle
3190    }
3191
3192    fn drop_without_shutdown(mut self) {
3193        // Safety: drops once, never accessed again due to mem::forget
3194        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3195        // Prevent Drop from running (which would shut down the channel)
3196        std::mem::forget(self);
3197    }
3198}
3199
3200impl EventStreamWaitForReadyResponder {
3201    /// Sends a response to the FIDL transaction.
3202    ///
3203    /// Sets the channel to shutdown if an error occurs.
3204    pub fn send(self) -> Result<(), fidl::Error> {
3205        let _result = self.send_raw();
3206        if _result.is_err() {
3207            self.control_handle.shutdown();
3208        }
3209        self.drop_without_shutdown();
3210        _result
3211    }
3212
3213    /// Similar to "send" but does not shutdown the channel if an error occurs.
3214    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3215        let _result = self.send_raw();
3216        self.drop_without_shutdown();
3217        _result
3218    }
3219
3220    fn send_raw(&self) -> Result<(), fidl::Error> {
3221        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3222            (),
3223            self.tx_id,
3224            0x31331f9578d2e682,
3225            fidl::encoding::DynamicFlags::empty(),
3226        )
3227    }
3228}
3229
3230#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3231pub struct ExecutionControllerMarker;
3232
3233impl fidl::endpoints::ProtocolMarker for ExecutionControllerMarker {
3234    type Proxy = ExecutionControllerProxy;
3235    type RequestStream = ExecutionControllerRequestStream;
3236    #[cfg(target_os = "fuchsia")]
3237    type SynchronousProxy = ExecutionControllerSynchronousProxy;
3238
3239    const DEBUG_NAME: &'static str = "(anonymous) ExecutionController";
3240}
3241
3242pub trait ExecutionControllerProxyInterface: Send + Sync {
3243    fn r#stop(&self) -> Result<(), fidl::Error>;
3244}
3245#[derive(Debug)]
3246#[cfg(target_os = "fuchsia")]
3247pub struct ExecutionControllerSynchronousProxy {
3248    client: fidl::client::sync::Client,
3249}
3250
3251#[cfg(target_os = "fuchsia")]
3252impl fidl::endpoints::SynchronousProxy for ExecutionControllerSynchronousProxy {
3253    type Proxy = ExecutionControllerProxy;
3254    type Protocol = ExecutionControllerMarker;
3255
3256    fn from_channel(inner: fidl::Channel) -> Self {
3257        Self::new(inner)
3258    }
3259
3260    fn into_channel(self) -> fidl::Channel {
3261        self.client.into_channel()
3262    }
3263
3264    fn as_channel(&self) -> &fidl::Channel {
3265        self.client.as_channel()
3266    }
3267}
3268
3269#[cfg(target_os = "fuchsia")]
3270impl ExecutionControllerSynchronousProxy {
3271    pub fn new(channel: fidl::Channel) -> Self {
3272        Self { client: fidl::client::sync::Client::new(channel) }
3273    }
3274
3275    pub fn into_channel(self) -> fidl::Channel {
3276        self.client.into_channel()
3277    }
3278
3279    /// Waits until an event arrives and returns it. It is safe for other
3280    /// threads to make concurrent requests while waiting for an event.
3281    pub fn wait_for_event(
3282        &self,
3283        deadline: zx::MonotonicInstant,
3284    ) -> Result<ExecutionControllerEvent, fidl::Error> {
3285        ExecutionControllerEvent::decode(
3286            self.client.wait_for_event::<ExecutionControllerMarker>(deadline)?,
3287        )
3288    }
3289
3290    /// Initiates a stop action on this component. Once complete, OnStop will be
3291    /// called with the stopped payload and this channel is closed.
3292    ///
3293    /// Note that a component may stop running on its own at any time, so it is
3294    /// possible for `OnStop` to be received before `Stop` is called.
3295    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3296        self.client.send::<fidl::encoding::EmptyPayload>(
3297            (),
3298            0x56d23cec21036117,
3299            fidl::encoding::DynamicFlags::FLEXIBLE,
3300        )
3301    }
3302}
3303
3304#[cfg(target_os = "fuchsia")]
3305impl From<ExecutionControllerSynchronousProxy> for zx::NullableHandle {
3306    fn from(value: ExecutionControllerSynchronousProxy) -> Self {
3307        value.into_channel().into()
3308    }
3309}
3310
3311#[cfg(target_os = "fuchsia")]
3312impl From<fidl::Channel> for ExecutionControllerSynchronousProxy {
3313    fn from(value: fidl::Channel) -> Self {
3314        Self::new(value)
3315    }
3316}
3317
3318#[cfg(target_os = "fuchsia")]
3319impl fidl::endpoints::FromClient for ExecutionControllerSynchronousProxy {
3320    type Protocol = ExecutionControllerMarker;
3321
3322    fn from_client(value: fidl::endpoints::ClientEnd<ExecutionControllerMarker>) -> Self {
3323        Self::new(value.into_channel())
3324    }
3325}
3326
3327#[derive(Debug, Clone)]
3328pub struct ExecutionControllerProxy {
3329    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3330}
3331
3332impl fidl::endpoints::Proxy for ExecutionControllerProxy {
3333    type Protocol = ExecutionControllerMarker;
3334
3335    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3336        Self::new(inner)
3337    }
3338
3339    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3340        self.client.into_channel().map_err(|client| Self { client })
3341    }
3342
3343    fn as_channel(&self) -> &::fidl::AsyncChannel {
3344        self.client.as_channel()
3345    }
3346}
3347
3348impl ExecutionControllerProxy {
3349    /// Create a new Proxy for fuchsia.component/ExecutionController.
3350    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3351        let protocol_name =
3352            <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3353        Self { client: fidl::client::Client::new(channel, protocol_name) }
3354    }
3355
3356    /// Get a Stream of events from the remote end of the protocol.
3357    ///
3358    /// # Panics
3359    ///
3360    /// Panics if the event stream was already taken.
3361    pub fn take_event_stream(&self) -> ExecutionControllerEventStream {
3362        ExecutionControllerEventStream { event_receiver: self.client.take_event_receiver() }
3363    }
3364
3365    /// Initiates a stop action on this component. Once complete, OnStop will be
3366    /// called with the stopped payload and this channel is closed.
3367    ///
3368    /// Note that a component may stop running on its own at any time, so it is
3369    /// possible for `OnStop` to be received before `Stop` is called.
3370    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3371        ExecutionControllerProxyInterface::r#stop(self)
3372    }
3373}
3374
3375impl ExecutionControllerProxyInterface for ExecutionControllerProxy {
3376    fn r#stop(&self) -> Result<(), fidl::Error> {
3377        self.client.send::<fidl::encoding::EmptyPayload>(
3378            (),
3379            0x56d23cec21036117,
3380            fidl::encoding::DynamicFlags::FLEXIBLE,
3381        )
3382    }
3383}
3384
3385pub struct ExecutionControllerEventStream {
3386    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3387}
3388
3389impl std::marker::Unpin for ExecutionControllerEventStream {}
3390
3391impl futures::stream::FusedStream for ExecutionControllerEventStream {
3392    fn is_terminated(&self) -> bool {
3393        self.event_receiver.is_terminated()
3394    }
3395}
3396
3397impl futures::Stream for ExecutionControllerEventStream {
3398    type Item = Result<ExecutionControllerEvent, fidl::Error>;
3399
3400    fn poll_next(
3401        mut self: std::pin::Pin<&mut Self>,
3402        cx: &mut std::task::Context<'_>,
3403    ) -> std::task::Poll<Option<Self::Item>> {
3404        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3405            &mut self.event_receiver,
3406            cx
3407        )?) {
3408            Some(buf) => std::task::Poll::Ready(Some(ExecutionControllerEvent::decode(buf))),
3409            None => std::task::Poll::Ready(None),
3410        }
3411    }
3412}
3413
3414#[derive(Debug)]
3415pub enum ExecutionControllerEvent {
3416    OnStop {
3417        stopped_payload: StoppedPayload,
3418    },
3419    #[non_exhaustive]
3420    _UnknownEvent {
3421        /// Ordinal of the event that was sent.
3422        ordinal: u64,
3423    },
3424}
3425
3426impl ExecutionControllerEvent {
3427    #[allow(irrefutable_let_patterns)]
3428    pub fn into_on_stop(self) -> Option<StoppedPayload> {
3429        if let ExecutionControllerEvent::OnStop { stopped_payload } = self {
3430            Some((stopped_payload))
3431        } else {
3432            None
3433        }
3434    }
3435
3436    /// Decodes a message buffer as a [`ExecutionControllerEvent`].
3437    fn decode(
3438        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3439    ) -> Result<ExecutionControllerEvent, fidl::Error> {
3440        let (bytes, _handles) = buf.split_mut();
3441        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3442        debug_assert_eq!(tx_header.tx_id, 0);
3443        match tx_header.ordinal {
3444            0x62d5018e2174f57f => {
3445                let mut out = fidl::new_empty!(
3446                    ExecutionControllerOnStopRequest,
3447                    fidl::encoding::DefaultFuchsiaResourceDialect
3448                );
3449                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ExecutionControllerOnStopRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3450                Ok((ExecutionControllerEvent::OnStop { stopped_payload: out.stopped_payload }))
3451            }
3452            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3453                Ok(ExecutionControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3454            }
3455            _ => Err(fidl::Error::UnknownOrdinal {
3456                ordinal: tx_header.ordinal,
3457                protocol_name:
3458                    <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3459            }),
3460        }
3461    }
3462}
3463
3464/// A Stream of incoming requests for fuchsia.component/ExecutionController.
3465pub struct ExecutionControllerRequestStream {
3466    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3467    is_terminated: bool,
3468}
3469
3470impl std::marker::Unpin for ExecutionControllerRequestStream {}
3471
3472impl futures::stream::FusedStream for ExecutionControllerRequestStream {
3473    fn is_terminated(&self) -> bool {
3474        self.is_terminated
3475    }
3476}
3477
3478impl fidl::endpoints::RequestStream for ExecutionControllerRequestStream {
3479    type Protocol = ExecutionControllerMarker;
3480    type ControlHandle = ExecutionControllerControlHandle;
3481
3482    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3483        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3484    }
3485
3486    fn control_handle(&self) -> Self::ControlHandle {
3487        ExecutionControllerControlHandle { inner: self.inner.clone() }
3488    }
3489
3490    fn into_inner(
3491        self,
3492    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3493    {
3494        (self.inner, self.is_terminated)
3495    }
3496
3497    fn from_inner(
3498        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3499        is_terminated: bool,
3500    ) -> Self {
3501        Self { inner, is_terminated }
3502    }
3503}
3504
3505impl futures::Stream for ExecutionControllerRequestStream {
3506    type Item = Result<ExecutionControllerRequest, fidl::Error>;
3507
3508    fn poll_next(
3509        mut self: std::pin::Pin<&mut Self>,
3510        cx: &mut std::task::Context<'_>,
3511    ) -> std::task::Poll<Option<Self::Item>> {
3512        let this = &mut *self;
3513        if this.inner.check_shutdown(cx) {
3514            this.is_terminated = true;
3515            return std::task::Poll::Ready(None);
3516        }
3517        if this.is_terminated {
3518            panic!("polled ExecutionControllerRequestStream after completion");
3519        }
3520        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3521            |bytes, handles| {
3522                match this.inner.channel().read_etc(cx, bytes, handles) {
3523                    std::task::Poll::Ready(Ok(())) => {}
3524                    std::task::Poll::Pending => return std::task::Poll::Pending,
3525                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3526                        this.is_terminated = true;
3527                        return std::task::Poll::Ready(None);
3528                    }
3529                    std::task::Poll::Ready(Err(e)) => {
3530                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3531                            e.into(),
3532                        ))));
3533                    }
3534                }
3535
3536                // A message has been received from the channel
3537                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3538
3539                std::task::Poll::Ready(Some(match header.ordinal {
3540                0x56d23cec21036117 => {
3541                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3542                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3543                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3544                    let control_handle = ExecutionControllerControlHandle {
3545                        inner: this.inner.clone(),
3546                    };
3547                    Ok(ExecutionControllerRequest::Stop {
3548                        control_handle,
3549                    })
3550                }
3551                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3552                    Ok(ExecutionControllerRequest::_UnknownMethod {
3553                        ordinal: header.ordinal,
3554                        control_handle: ExecutionControllerControlHandle { inner: this.inner.clone() },
3555                        method_type: fidl::MethodType::OneWay,
3556                    })
3557                }
3558                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3559                    this.inner.send_framework_err(
3560                        fidl::encoding::FrameworkErr::UnknownMethod,
3561                        header.tx_id,
3562                        header.ordinal,
3563                        header.dynamic_flags(),
3564                        (bytes, handles),
3565                    )?;
3566                    Ok(ExecutionControllerRequest::_UnknownMethod {
3567                        ordinal: header.ordinal,
3568                        control_handle: ExecutionControllerControlHandle { inner: this.inner.clone() },
3569                        method_type: fidl::MethodType::TwoWay,
3570                    })
3571                }
3572                _ => Err(fidl::Error::UnknownOrdinal {
3573                    ordinal: header.ordinal,
3574                    protocol_name: <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3575                }),
3576            }))
3577            },
3578        )
3579    }
3580}
3581
3582#[derive(Debug)]
3583pub enum ExecutionControllerRequest {
3584    /// Initiates a stop action on this component. Once complete, OnStop will be
3585    /// called with the stopped payload and this channel is closed.
3586    ///
3587    /// Note that a component may stop running on its own at any time, so it is
3588    /// possible for `OnStop` to be received before `Stop` is called.
3589    Stop { control_handle: ExecutionControllerControlHandle },
3590    /// An interaction was received which does not match any known method.
3591    #[non_exhaustive]
3592    _UnknownMethod {
3593        /// Ordinal of the method that was called.
3594        ordinal: u64,
3595        control_handle: ExecutionControllerControlHandle,
3596        method_type: fidl::MethodType,
3597    },
3598}
3599
3600impl ExecutionControllerRequest {
3601    #[allow(irrefutable_let_patterns)]
3602    pub fn into_stop(self) -> Option<(ExecutionControllerControlHandle)> {
3603        if let ExecutionControllerRequest::Stop { control_handle } = self {
3604            Some((control_handle))
3605        } else {
3606            None
3607        }
3608    }
3609
3610    /// Name of the method defined in FIDL
3611    pub fn method_name(&self) -> &'static str {
3612        match *self {
3613            ExecutionControllerRequest::Stop { .. } => "stop",
3614            ExecutionControllerRequest::_UnknownMethod {
3615                method_type: fidl::MethodType::OneWay,
3616                ..
3617            } => "unknown one-way method",
3618            ExecutionControllerRequest::_UnknownMethod {
3619                method_type: fidl::MethodType::TwoWay,
3620                ..
3621            } => "unknown two-way method",
3622        }
3623    }
3624}
3625
3626#[derive(Debug, Clone)]
3627pub struct ExecutionControllerControlHandle {
3628    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3629}
3630
3631impl fidl::endpoints::ControlHandle for ExecutionControllerControlHandle {
3632    fn shutdown(&self) {
3633        self.inner.shutdown()
3634    }
3635
3636    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3637        self.inner.shutdown_with_epitaph(status)
3638    }
3639
3640    fn is_closed(&self) -> bool {
3641        self.inner.channel().is_closed()
3642    }
3643    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3644        self.inner.channel().on_closed()
3645    }
3646
3647    #[cfg(target_os = "fuchsia")]
3648    fn signal_peer(
3649        &self,
3650        clear_mask: zx::Signals,
3651        set_mask: zx::Signals,
3652    ) -> Result<(), zx_status::Status> {
3653        use fidl::Peered;
3654        self.inner.channel().signal_peer(clear_mask, set_mask)
3655    }
3656}
3657
3658impl ExecutionControllerControlHandle {
3659    pub fn send_on_stop(&self, mut stopped_payload: &StoppedPayload) -> Result<(), fidl::Error> {
3660        self.inner.send::<ExecutionControllerOnStopRequest>(
3661            (stopped_payload,),
3662            0,
3663            0x62d5018e2174f57f,
3664            fidl::encoding::DynamicFlags::FLEXIBLE,
3665        )
3666    }
3667}
3668
3669#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3670pub struct IntrospectorMarker;
3671
3672impl fidl::endpoints::ProtocolMarker for IntrospectorMarker {
3673    type Proxy = IntrospectorProxy;
3674    type RequestStream = IntrospectorRequestStream;
3675    #[cfg(target_os = "fuchsia")]
3676    type SynchronousProxy = IntrospectorSynchronousProxy;
3677
3678    const DEBUG_NAME: &'static str = "fuchsia.component.Introspector";
3679}
3680impl fidl::endpoints::DiscoverableProtocolMarker for IntrospectorMarker {}
3681pub type IntrospectorGetMonikerResult = Result<String, Error>;
3682
3683pub trait IntrospectorProxyInterface: Send + Sync {
3684    type GetMonikerResponseFut: std::future::Future<Output = Result<IntrospectorGetMonikerResult, fidl::Error>>
3685        + Send;
3686    fn r#get_moniker(&self, component_instance: fidl::Event) -> Self::GetMonikerResponseFut;
3687}
3688#[derive(Debug)]
3689#[cfg(target_os = "fuchsia")]
3690pub struct IntrospectorSynchronousProxy {
3691    client: fidl::client::sync::Client,
3692}
3693
3694#[cfg(target_os = "fuchsia")]
3695impl fidl::endpoints::SynchronousProxy for IntrospectorSynchronousProxy {
3696    type Proxy = IntrospectorProxy;
3697    type Protocol = IntrospectorMarker;
3698
3699    fn from_channel(inner: fidl::Channel) -> Self {
3700        Self::new(inner)
3701    }
3702
3703    fn into_channel(self) -> fidl::Channel {
3704        self.client.into_channel()
3705    }
3706
3707    fn as_channel(&self) -> &fidl::Channel {
3708        self.client.as_channel()
3709    }
3710}
3711
3712#[cfg(target_os = "fuchsia")]
3713impl IntrospectorSynchronousProxy {
3714    pub fn new(channel: fidl::Channel) -> Self {
3715        Self { client: fidl::client::sync::Client::new(channel) }
3716    }
3717
3718    pub fn into_channel(self) -> fidl::Channel {
3719        self.client.into_channel()
3720    }
3721
3722    /// Waits until an event arrives and returns it. It is safe for other
3723    /// threads to make concurrent requests while waiting for an event.
3724    pub fn wait_for_event(
3725        &self,
3726        deadline: zx::MonotonicInstant,
3727    ) -> Result<IntrospectorEvent, fidl::Error> {
3728        IntrospectorEvent::decode(self.client.wait_for_event::<IntrospectorMarker>(deadline)?)
3729    }
3730
3731    /// Obtains the moniker relative to this realm of the component
3732    /// corresponding to the provided token. Runners may obtain the token via
3733    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3734    ///
3735    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3736    /// does not correspond to a component under this realm.
3737    pub fn r#get_moniker(
3738        &self,
3739        mut component_instance: fidl::Event,
3740        ___deadline: zx::MonotonicInstant,
3741    ) -> Result<IntrospectorGetMonikerResult, fidl::Error> {
3742        let _response = self.client.send_query::<
3743            IntrospectorGetMonikerRequest,
3744            fidl::encoding::FlexibleResultType<IntrospectorGetMonikerResponse, Error>,
3745            IntrospectorMarker,
3746        >(
3747            (component_instance,),
3748            0x2f980ceb37bf458,
3749            fidl::encoding::DynamicFlags::FLEXIBLE,
3750            ___deadline,
3751        )?
3752        .into_result::<IntrospectorMarker>("get_moniker")?;
3753        Ok(_response.map(|x| x.moniker))
3754    }
3755}
3756
3757#[cfg(target_os = "fuchsia")]
3758impl From<IntrospectorSynchronousProxy> for zx::NullableHandle {
3759    fn from(value: IntrospectorSynchronousProxy) -> Self {
3760        value.into_channel().into()
3761    }
3762}
3763
3764#[cfg(target_os = "fuchsia")]
3765impl From<fidl::Channel> for IntrospectorSynchronousProxy {
3766    fn from(value: fidl::Channel) -> Self {
3767        Self::new(value)
3768    }
3769}
3770
3771#[cfg(target_os = "fuchsia")]
3772impl fidl::endpoints::FromClient for IntrospectorSynchronousProxy {
3773    type Protocol = IntrospectorMarker;
3774
3775    fn from_client(value: fidl::endpoints::ClientEnd<IntrospectorMarker>) -> Self {
3776        Self::new(value.into_channel())
3777    }
3778}
3779
3780#[derive(Debug, Clone)]
3781pub struct IntrospectorProxy {
3782    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3783}
3784
3785impl fidl::endpoints::Proxy for IntrospectorProxy {
3786    type Protocol = IntrospectorMarker;
3787
3788    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3789        Self::new(inner)
3790    }
3791
3792    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3793        self.client.into_channel().map_err(|client| Self { client })
3794    }
3795
3796    fn as_channel(&self) -> &::fidl::AsyncChannel {
3797        self.client.as_channel()
3798    }
3799}
3800
3801impl IntrospectorProxy {
3802    /// Create a new Proxy for fuchsia.component/Introspector.
3803    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3804        let protocol_name = <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3805        Self { client: fidl::client::Client::new(channel, protocol_name) }
3806    }
3807
3808    /// Get a Stream of events from the remote end of the protocol.
3809    ///
3810    /// # Panics
3811    ///
3812    /// Panics if the event stream was already taken.
3813    pub fn take_event_stream(&self) -> IntrospectorEventStream {
3814        IntrospectorEventStream { event_receiver: self.client.take_event_receiver() }
3815    }
3816
3817    /// Obtains the moniker relative to this realm of the component
3818    /// corresponding to the provided token. Runners may obtain the token via
3819    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3820    ///
3821    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3822    /// does not correspond to a component under this realm.
3823    pub fn r#get_moniker(
3824        &self,
3825        mut component_instance: fidl::Event,
3826    ) -> fidl::client::QueryResponseFut<
3827        IntrospectorGetMonikerResult,
3828        fidl::encoding::DefaultFuchsiaResourceDialect,
3829    > {
3830        IntrospectorProxyInterface::r#get_moniker(self, component_instance)
3831    }
3832}
3833
3834impl IntrospectorProxyInterface for IntrospectorProxy {
3835    type GetMonikerResponseFut = fidl::client::QueryResponseFut<
3836        IntrospectorGetMonikerResult,
3837        fidl::encoding::DefaultFuchsiaResourceDialect,
3838    >;
3839    fn r#get_moniker(&self, mut component_instance: fidl::Event) -> Self::GetMonikerResponseFut {
3840        fn _decode(
3841            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3842        ) -> Result<IntrospectorGetMonikerResult, fidl::Error> {
3843            let _response = fidl::client::decode_transaction_body::<
3844                fidl::encoding::FlexibleResultType<IntrospectorGetMonikerResponse, Error>,
3845                fidl::encoding::DefaultFuchsiaResourceDialect,
3846                0x2f980ceb37bf458,
3847            >(_buf?)?
3848            .into_result::<IntrospectorMarker>("get_moniker")?;
3849            Ok(_response.map(|x| x.moniker))
3850        }
3851        self.client
3852            .send_query_and_decode::<IntrospectorGetMonikerRequest, IntrospectorGetMonikerResult>(
3853                (component_instance,),
3854                0x2f980ceb37bf458,
3855                fidl::encoding::DynamicFlags::FLEXIBLE,
3856                _decode,
3857            )
3858    }
3859}
3860
3861pub struct IntrospectorEventStream {
3862    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3863}
3864
3865impl std::marker::Unpin for IntrospectorEventStream {}
3866
3867impl futures::stream::FusedStream for IntrospectorEventStream {
3868    fn is_terminated(&self) -> bool {
3869        self.event_receiver.is_terminated()
3870    }
3871}
3872
3873impl futures::Stream for IntrospectorEventStream {
3874    type Item = Result<IntrospectorEvent, fidl::Error>;
3875
3876    fn poll_next(
3877        mut self: std::pin::Pin<&mut Self>,
3878        cx: &mut std::task::Context<'_>,
3879    ) -> std::task::Poll<Option<Self::Item>> {
3880        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3881            &mut self.event_receiver,
3882            cx
3883        )?) {
3884            Some(buf) => std::task::Poll::Ready(Some(IntrospectorEvent::decode(buf))),
3885            None => std::task::Poll::Ready(None),
3886        }
3887    }
3888}
3889
3890#[derive(Debug)]
3891pub enum IntrospectorEvent {
3892    #[non_exhaustive]
3893    _UnknownEvent {
3894        /// Ordinal of the event that was sent.
3895        ordinal: u64,
3896    },
3897}
3898
3899impl IntrospectorEvent {
3900    /// Decodes a message buffer as a [`IntrospectorEvent`].
3901    fn decode(
3902        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3903    ) -> Result<IntrospectorEvent, fidl::Error> {
3904        let (bytes, _handles) = buf.split_mut();
3905        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3906        debug_assert_eq!(tx_header.tx_id, 0);
3907        match tx_header.ordinal {
3908            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3909                Ok(IntrospectorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3910            }
3911            _ => Err(fidl::Error::UnknownOrdinal {
3912                ordinal: tx_header.ordinal,
3913                protocol_name: <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3914            }),
3915        }
3916    }
3917}
3918
3919/// A Stream of incoming requests for fuchsia.component/Introspector.
3920pub struct IntrospectorRequestStream {
3921    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3922    is_terminated: bool,
3923}
3924
3925impl std::marker::Unpin for IntrospectorRequestStream {}
3926
3927impl futures::stream::FusedStream for IntrospectorRequestStream {
3928    fn is_terminated(&self) -> bool {
3929        self.is_terminated
3930    }
3931}
3932
3933impl fidl::endpoints::RequestStream for IntrospectorRequestStream {
3934    type Protocol = IntrospectorMarker;
3935    type ControlHandle = IntrospectorControlHandle;
3936
3937    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3938        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3939    }
3940
3941    fn control_handle(&self) -> Self::ControlHandle {
3942        IntrospectorControlHandle { inner: self.inner.clone() }
3943    }
3944
3945    fn into_inner(
3946        self,
3947    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3948    {
3949        (self.inner, self.is_terminated)
3950    }
3951
3952    fn from_inner(
3953        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3954        is_terminated: bool,
3955    ) -> Self {
3956        Self { inner, is_terminated }
3957    }
3958}
3959
3960impl futures::Stream for IntrospectorRequestStream {
3961    type Item = Result<IntrospectorRequest, fidl::Error>;
3962
3963    fn poll_next(
3964        mut self: std::pin::Pin<&mut Self>,
3965        cx: &mut std::task::Context<'_>,
3966    ) -> std::task::Poll<Option<Self::Item>> {
3967        let this = &mut *self;
3968        if this.inner.check_shutdown(cx) {
3969            this.is_terminated = true;
3970            return std::task::Poll::Ready(None);
3971        }
3972        if this.is_terminated {
3973            panic!("polled IntrospectorRequestStream after completion");
3974        }
3975        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3976            |bytes, handles| {
3977                match this.inner.channel().read_etc(cx, bytes, handles) {
3978                    std::task::Poll::Ready(Ok(())) => {}
3979                    std::task::Poll::Pending => return std::task::Poll::Pending,
3980                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3981                        this.is_terminated = true;
3982                        return std::task::Poll::Ready(None);
3983                    }
3984                    std::task::Poll::Ready(Err(e)) => {
3985                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3986                            e.into(),
3987                        ))));
3988                    }
3989                }
3990
3991                // A message has been received from the channel
3992                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3993
3994                std::task::Poll::Ready(Some(match header.ordinal {
3995                    0x2f980ceb37bf458 => {
3996                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3997                        let mut req = fidl::new_empty!(
3998                            IntrospectorGetMonikerRequest,
3999                            fidl::encoding::DefaultFuchsiaResourceDialect
4000                        );
4001                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IntrospectorGetMonikerRequest>(&header, _body_bytes, handles, &mut req)?;
4002                        let control_handle =
4003                            IntrospectorControlHandle { inner: this.inner.clone() };
4004                        Ok(IntrospectorRequest::GetMoniker {
4005                            component_instance: req.component_instance,
4006
4007                            responder: IntrospectorGetMonikerResponder {
4008                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4009                                tx_id: header.tx_id,
4010                            },
4011                        })
4012                    }
4013                    _ if header.tx_id == 0
4014                        && header
4015                            .dynamic_flags()
4016                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4017                    {
4018                        Ok(IntrospectorRequest::_UnknownMethod {
4019                            ordinal: header.ordinal,
4020                            control_handle: IntrospectorControlHandle { inner: this.inner.clone() },
4021                            method_type: fidl::MethodType::OneWay,
4022                        })
4023                    }
4024                    _ if header
4025                        .dynamic_flags()
4026                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4027                    {
4028                        this.inner.send_framework_err(
4029                            fidl::encoding::FrameworkErr::UnknownMethod,
4030                            header.tx_id,
4031                            header.ordinal,
4032                            header.dynamic_flags(),
4033                            (bytes, handles),
4034                        )?;
4035                        Ok(IntrospectorRequest::_UnknownMethod {
4036                            ordinal: header.ordinal,
4037                            control_handle: IntrospectorControlHandle { inner: this.inner.clone() },
4038                            method_type: fidl::MethodType::TwoWay,
4039                        })
4040                    }
4041                    _ => Err(fidl::Error::UnknownOrdinal {
4042                        ordinal: header.ordinal,
4043                        protocol_name:
4044                            <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4045                    }),
4046                }))
4047            },
4048        )
4049    }
4050}
4051
4052/// A protocol used by a component instance to obtain information about
4053/// components in its own realm.
4054///
4055/// This protocol only supports getting the moniker at the moment but could
4056/// expand to other privileged information such as the URL of a component.
4057///
4058/// The component framework provides this capability to components that use
4059/// `fuchsia.component.Introspector` from framework.
4060#[derive(Debug)]
4061pub enum IntrospectorRequest {
4062    /// Obtains the moniker relative to this realm of the component
4063    /// corresponding to the provided token. Runners may obtain the token via
4064    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
4065    ///
4066    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
4067    /// does not correspond to a component under this realm.
4068    GetMoniker { component_instance: fidl::Event, responder: IntrospectorGetMonikerResponder },
4069    /// An interaction was received which does not match any known method.
4070    #[non_exhaustive]
4071    _UnknownMethod {
4072        /// Ordinal of the method that was called.
4073        ordinal: u64,
4074        control_handle: IntrospectorControlHandle,
4075        method_type: fidl::MethodType,
4076    },
4077}
4078
4079impl IntrospectorRequest {
4080    #[allow(irrefutable_let_patterns)]
4081    pub fn into_get_moniker(self) -> Option<(fidl::Event, IntrospectorGetMonikerResponder)> {
4082        if let IntrospectorRequest::GetMoniker { component_instance, responder } = self {
4083            Some((component_instance, responder))
4084        } else {
4085            None
4086        }
4087    }
4088
4089    /// Name of the method defined in FIDL
4090    pub fn method_name(&self) -> &'static str {
4091        match *self {
4092            IntrospectorRequest::GetMoniker { .. } => "get_moniker",
4093            IntrospectorRequest::_UnknownMethod {
4094                method_type: fidl::MethodType::OneWay, ..
4095            } => "unknown one-way method",
4096            IntrospectorRequest::_UnknownMethod {
4097                method_type: fidl::MethodType::TwoWay, ..
4098            } => "unknown two-way method",
4099        }
4100    }
4101}
4102
4103#[derive(Debug, Clone)]
4104pub struct IntrospectorControlHandle {
4105    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4106}
4107
4108impl fidl::endpoints::ControlHandle for IntrospectorControlHandle {
4109    fn shutdown(&self) {
4110        self.inner.shutdown()
4111    }
4112
4113    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4114        self.inner.shutdown_with_epitaph(status)
4115    }
4116
4117    fn is_closed(&self) -> bool {
4118        self.inner.channel().is_closed()
4119    }
4120    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4121        self.inner.channel().on_closed()
4122    }
4123
4124    #[cfg(target_os = "fuchsia")]
4125    fn signal_peer(
4126        &self,
4127        clear_mask: zx::Signals,
4128        set_mask: zx::Signals,
4129    ) -> Result<(), zx_status::Status> {
4130        use fidl::Peered;
4131        self.inner.channel().signal_peer(clear_mask, set_mask)
4132    }
4133}
4134
4135impl IntrospectorControlHandle {}
4136
4137#[must_use = "FIDL methods require a response to be sent"]
4138#[derive(Debug)]
4139pub struct IntrospectorGetMonikerResponder {
4140    control_handle: std::mem::ManuallyDrop<IntrospectorControlHandle>,
4141    tx_id: u32,
4142}
4143
4144/// Set the the channel to be shutdown (see [`IntrospectorControlHandle::shutdown`])
4145/// if the responder is dropped without sending a response, so that the client
4146/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4147impl std::ops::Drop for IntrospectorGetMonikerResponder {
4148    fn drop(&mut self) {
4149        self.control_handle.shutdown();
4150        // Safety: drops once, never accessed again
4151        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4152    }
4153}
4154
4155impl fidl::endpoints::Responder for IntrospectorGetMonikerResponder {
4156    type ControlHandle = IntrospectorControlHandle;
4157
4158    fn control_handle(&self) -> &IntrospectorControlHandle {
4159        &self.control_handle
4160    }
4161
4162    fn drop_without_shutdown(mut self) {
4163        // Safety: drops once, never accessed again due to mem::forget
4164        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4165        // Prevent Drop from running (which would shut down the channel)
4166        std::mem::forget(self);
4167    }
4168}
4169
4170impl IntrospectorGetMonikerResponder {
4171    /// Sends a response to the FIDL transaction.
4172    ///
4173    /// Sets the channel to shutdown if an error occurs.
4174    pub fn send(self, mut result: Result<&str, Error>) -> Result<(), fidl::Error> {
4175        let _result = self.send_raw(result);
4176        if _result.is_err() {
4177            self.control_handle.shutdown();
4178        }
4179        self.drop_without_shutdown();
4180        _result
4181    }
4182
4183    /// Similar to "send" but does not shutdown the channel if an error occurs.
4184    pub fn send_no_shutdown_on_err(
4185        self,
4186        mut result: Result<&str, Error>,
4187    ) -> Result<(), fidl::Error> {
4188        let _result = self.send_raw(result);
4189        self.drop_without_shutdown();
4190        _result
4191    }
4192
4193    fn send_raw(&self, mut result: Result<&str, Error>) -> Result<(), fidl::Error> {
4194        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4195            IntrospectorGetMonikerResponse,
4196            Error,
4197        >>(
4198            fidl::encoding::FlexibleResult::new(result.map(|moniker| (moniker,))),
4199            self.tx_id,
4200            0x2f980ceb37bf458,
4201            fidl::encoding::DynamicFlags::FLEXIBLE,
4202        )
4203    }
4204}
4205
4206#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4207pub struct NamespaceMarker;
4208
4209impl fidl::endpoints::ProtocolMarker for NamespaceMarker {
4210    type Proxy = NamespaceProxy;
4211    type RequestStream = NamespaceRequestStream;
4212    #[cfg(target_os = "fuchsia")]
4213    type SynchronousProxy = NamespaceSynchronousProxy;
4214
4215    const DEBUG_NAME: &'static str = "fuchsia.component.Namespace";
4216}
4217impl fidl::endpoints::DiscoverableProtocolMarker for NamespaceMarker {}
4218pub type NamespaceCreateResult = Result<Vec<NamespaceEntry>, NamespaceError>;
4219pub type NamespaceCreate2Result = Result<Vec<NamespaceEntry>, NamespaceError>;
4220
4221pub trait NamespaceProxyInterface: Send + Sync {
4222    type CreateResponseFut: std::future::Future<Output = Result<NamespaceCreateResult, fidl::Error>>
4223        + Send;
4224    fn r#create(&self, entries: Vec<NamespaceInputEntry>) -> Self::CreateResponseFut;
4225    type Create2ResponseFut: std::future::Future<Output = Result<NamespaceCreate2Result, fidl::Error>>
4226        + Send;
4227    fn r#create2(&self, entries: Vec<NamespaceInputEntry2>) -> Self::Create2ResponseFut;
4228}
4229#[derive(Debug)]
4230#[cfg(target_os = "fuchsia")]
4231pub struct NamespaceSynchronousProxy {
4232    client: fidl::client::sync::Client,
4233}
4234
4235#[cfg(target_os = "fuchsia")]
4236impl fidl::endpoints::SynchronousProxy for NamespaceSynchronousProxy {
4237    type Proxy = NamespaceProxy;
4238    type Protocol = NamespaceMarker;
4239
4240    fn from_channel(inner: fidl::Channel) -> Self {
4241        Self::new(inner)
4242    }
4243
4244    fn into_channel(self) -> fidl::Channel {
4245        self.client.into_channel()
4246    }
4247
4248    fn as_channel(&self) -> &fidl::Channel {
4249        self.client.as_channel()
4250    }
4251}
4252
4253#[cfg(target_os = "fuchsia")]
4254impl NamespaceSynchronousProxy {
4255    pub fn new(channel: fidl::Channel) -> Self {
4256        Self { client: fidl::client::sync::Client::new(channel) }
4257    }
4258
4259    pub fn into_channel(self) -> fidl::Channel {
4260        self.client.into_channel()
4261    }
4262
4263    /// Waits until an event arrives and returns it. It is safe for other
4264    /// threads to make concurrent requests while waiting for an event.
4265    pub fn wait_for_event(
4266        &self,
4267        deadline: zx::MonotonicInstant,
4268    ) -> Result<NamespaceEvent, fidl::Error> {
4269        NamespaceEvent::decode(self.client.wait_for_event::<NamespaceMarker>(deadline)?)
4270    }
4271
4272    pub fn r#create(
4273        &self,
4274        mut entries: Vec<NamespaceInputEntry>,
4275        ___deadline: zx::MonotonicInstant,
4276    ) -> Result<NamespaceCreateResult, fidl::Error> {
4277        let _response = self.client.send_query::<
4278            NamespaceCreateRequest,
4279            fidl::encoding::FlexibleResultType<NamespaceCreateResponse, NamespaceError>,
4280            NamespaceMarker,
4281        >(
4282            (entries.as_mut(),),
4283            0x4329fe12b2a790f9,
4284            fidl::encoding::DynamicFlags::FLEXIBLE,
4285            ___deadline,
4286        )?
4287        .into_result::<NamespaceMarker>("create")?;
4288        Ok(_response.map(|x| x.entries))
4289    }
4290
4291    pub fn r#create2(
4292        &self,
4293        mut entries: Vec<NamespaceInputEntry2>,
4294        ___deadline: zx::MonotonicInstant,
4295    ) -> Result<NamespaceCreate2Result, fidl::Error> {
4296        let _response = self.client.send_query::<
4297            NamespaceCreate2Request,
4298            fidl::encoding::FlexibleResultType<NamespaceCreate2Response, NamespaceError>,
4299            NamespaceMarker,
4300        >(
4301            (entries.as_mut(),),
4302            0x665aa4bb3773b351,
4303            fidl::encoding::DynamicFlags::FLEXIBLE,
4304            ___deadline,
4305        )?
4306        .into_result::<NamespaceMarker>("create2")?;
4307        Ok(_response.map(|x| x.entries))
4308    }
4309}
4310
4311#[cfg(target_os = "fuchsia")]
4312impl From<NamespaceSynchronousProxy> for zx::NullableHandle {
4313    fn from(value: NamespaceSynchronousProxy) -> Self {
4314        value.into_channel().into()
4315    }
4316}
4317
4318#[cfg(target_os = "fuchsia")]
4319impl From<fidl::Channel> for NamespaceSynchronousProxy {
4320    fn from(value: fidl::Channel) -> Self {
4321        Self::new(value)
4322    }
4323}
4324
4325#[cfg(target_os = "fuchsia")]
4326impl fidl::endpoints::FromClient for NamespaceSynchronousProxy {
4327    type Protocol = NamespaceMarker;
4328
4329    fn from_client(value: fidl::endpoints::ClientEnd<NamespaceMarker>) -> Self {
4330        Self::new(value.into_channel())
4331    }
4332}
4333
4334#[derive(Debug, Clone)]
4335pub struct NamespaceProxy {
4336    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4337}
4338
4339impl fidl::endpoints::Proxy for NamespaceProxy {
4340    type Protocol = NamespaceMarker;
4341
4342    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4343        Self::new(inner)
4344    }
4345
4346    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4347        self.client.into_channel().map_err(|client| Self { client })
4348    }
4349
4350    fn as_channel(&self) -> &::fidl::AsyncChannel {
4351        self.client.as_channel()
4352    }
4353}
4354
4355impl NamespaceProxy {
4356    /// Create a new Proxy for fuchsia.component/Namespace.
4357    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4358        let protocol_name = <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4359        Self { client: fidl::client::Client::new(channel, protocol_name) }
4360    }
4361
4362    /// Get a Stream of events from the remote end of the protocol.
4363    ///
4364    /// # Panics
4365    ///
4366    /// Panics if the event stream was already taken.
4367    pub fn take_event_stream(&self) -> NamespaceEventStream {
4368        NamespaceEventStream { event_receiver: self.client.take_event_receiver() }
4369    }
4370
4371    pub fn r#create(
4372        &self,
4373        mut entries: Vec<NamespaceInputEntry>,
4374    ) -> fidl::client::QueryResponseFut<
4375        NamespaceCreateResult,
4376        fidl::encoding::DefaultFuchsiaResourceDialect,
4377    > {
4378        NamespaceProxyInterface::r#create(self, entries)
4379    }
4380
4381    pub fn r#create2(
4382        &self,
4383        mut entries: Vec<NamespaceInputEntry2>,
4384    ) -> fidl::client::QueryResponseFut<
4385        NamespaceCreate2Result,
4386        fidl::encoding::DefaultFuchsiaResourceDialect,
4387    > {
4388        NamespaceProxyInterface::r#create2(self, entries)
4389    }
4390}
4391
4392impl NamespaceProxyInterface for NamespaceProxy {
4393    type CreateResponseFut = fidl::client::QueryResponseFut<
4394        NamespaceCreateResult,
4395        fidl::encoding::DefaultFuchsiaResourceDialect,
4396    >;
4397    fn r#create(&self, mut entries: Vec<NamespaceInputEntry>) -> Self::CreateResponseFut {
4398        fn _decode(
4399            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4400        ) -> Result<NamespaceCreateResult, fidl::Error> {
4401            let _response = fidl::client::decode_transaction_body::<
4402                fidl::encoding::FlexibleResultType<NamespaceCreateResponse, NamespaceError>,
4403                fidl::encoding::DefaultFuchsiaResourceDialect,
4404                0x4329fe12b2a790f9,
4405            >(_buf?)?
4406            .into_result::<NamespaceMarker>("create")?;
4407            Ok(_response.map(|x| x.entries))
4408        }
4409        self.client.send_query_and_decode::<NamespaceCreateRequest, NamespaceCreateResult>(
4410            (entries.as_mut(),),
4411            0x4329fe12b2a790f9,
4412            fidl::encoding::DynamicFlags::FLEXIBLE,
4413            _decode,
4414        )
4415    }
4416
4417    type Create2ResponseFut = fidl::client::QueryResponseFut<
4418        NamespaceCreate2Result,
4419        fidl::encoding::DefaultFuchsiaResourceDialect,
4420    >;
4421    fn r#create2(&self, mut entries: Vec<NamespaceInputEntry2>) -> Self::Create2ResponseFut {
4422        fn _decode(
4423            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4424        ) -> Result<NamespaceCreate2Result, fidl::Error> {
4425            let _response = fidl::client::decode_transaction_body::<
4426                fidl::encoding::FlexibleResultType<NamespaceCreate2Response, NamespaceError>,
4427                fidl::encoding::DefaultFuchsiaResourceDialect,
4428                0x665aa4bb3773b351,
4429            >(_buf?)?
4430            .into_result::<NamespaceMarker>("create2")?;
4431            Ok(_response.map(|x| x.entries))
4432        }
4433        self.client.send_query_and_decode::<NamespaceCreate2Request, NamespaceCreate2Result>(
4434            (entries.as_mut(),),
4435            0x665aa4bb3773b351,
4436            fidl::encoding::DynamicFlags::FLEXIBLE,
4437            _decode,
4438        )
4439    }
4440}
4441
4442pub struct NamespaceEventStream {
4443    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4444}
4445
4446impl std::marker::Unpin for NamespaceEventStream {}
4447
4448impl futures::stream::FusedStream for NamespaceEventStream {
4449    fn is_terminated(&self) -> bool {
4450        self.event_receiver.is_terminated()
4451    }
4452}
4453
4454impl futures::Stream for NamespaceEventStream {
4455    type Item = Result<NamespaceEvent, fidl::Error>;
4456
4457    fn poll_next(
4458        mut self: std::pin::Pin<&mut Self>,
4459        cx: &mut std::task::Context<'_>,
4460    ) -> std::task::Poll<Option<Self::Item>> {
4461        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4462            &mut self.event_receiver,
4463            cx
4464        )?) {
4465            Some(buf) => std::task::Poll::Ready(Some(NamespaceEvent::decode(buf))),
4466            None => std::task::Poll::Ready(None),
4467        }
4468    }
4469}
4470
4471#[derive(Debug)]
4472pub enum NamespaceEvent {
4473    #[non_exhaustive]
4474    _UnknownEvent {
4475        /// Ordinal of the event that was sent.
4476        ordinal: u64,
4477    },
4478}
4479
4480impl NamespaceEvent {
4481    /// Decodes a message buffer as a [`NamespaceEvent`].
4482    fn decode(
4483        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4484    ) -> Result<NamespaceEvent, fidl::Error> {
4485        let (bytes, _handles) = buf.split_mut();
4486        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4487        debug_assert_eq!(tx_header.tx_id, 0);
4488        match tx_header.ordinal {
4489            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4490                Ok(NamespaceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4491            }
4492            _ => Err(fidl::Error::UnknownOrdinal {
4493                ordinal: tx_header.ordinal,
4494                protocol_name: <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4495            }),
4496        }
4497    }
4498}
4499
4500/// A Stream of incoming requests for fuchsia.component/Namespace.
4501pub struct NamespaceRequestStream {
4502    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4503    is_terminated: bool,
4504}
4505
4506impl std::marker::Unpin for NamespaceRequestStream {}
4507
4508impl futures::stream::FusedStream for NamespaceRequestStream {
4509    fn is_terminated(&self) -> bool {
4510        self.is_terminated
4511    }
4512}
4513
4514impl fidl::endpoints::RequestStream for NamespaceRequestStream {
4515    type Protocol = NamespaceMarker;
4516    type ControlHandle = NamespaceControlHandle;
4517
4518    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4519        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4520    }
4521
4522    fn control_handle(&self) -> Self::ControlHandle {
4523        NamespaceControlHandle { inner: self.inner.clone() }
4524    }
4525
4526    fn into_inner(
4527        self,
4528    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4529    {
4530        (self.inner, self.is_terminated)
4531    }
4532
4533    fn from_inner(
4534        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4535        is_terminated: bool,
4536    ) -> Self {
4537        Self { inner, is_terminated }
4538    }
4539}
4540
4541impl futures::Stream for NamespaceRequestStream {
4542    type Item = Result<NamespaceRequest, fidl::Error>;
4543
4544    fn poll_next(
4545        mut self: std::pin::Pin<&mut Self>,
4546        cx: &mut std::task::Context<'_>,
4547    ) -> std::task::Poll<Option<Self::Item>> {
4548        let this = &mut *self;
4549        if this.inner.check_shutdown(cx) {
4550            this.is_terminated = true;
4551            return std::task::Poll::Ready(None);
4552        }
4553        if this.is_terminated {
4554            panic!("polled NamespaceRequestStream after completion");
4555        }
4556        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4557            |bytes, handles| {
4558                match this.inner.channel().read_etc(cx, bytes, handles) {
4559                    std::task::Poll::Ready(Ok(())) => {}
4560                    std::task::Poll::Pending => return std::task::Poll::Pending,
4561                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4562                        this.is_terminated = true;
4563                        return std::task::Poll::Ready(None);
4564                    }
4565                    std::task::Poll::Ready(Err(e)) => {
4566                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4567                            e.into(),
4568                        ))));
4569                    }
4570                }
4571
4572                // A message has been received from the channel
4573                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4574
4575                std::task::Poll::Ready(Some(match header.ordinal {
4576                    0x4329fe12b2a790f9 => {
4577                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4578                        let mut req = fidl::new_empty!(
4579                            NamespaceCreateRequest,
4580                            fidl::encoding::DefaultFuchsiaResourceDialect
4581                        );
4582                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NamespaceCreateRequest>(&header, _body_bytes, handles, &mut req)?;
4583                        let control_handle = NamespaceControlHandle { inner: this.inner.clone() };
4584                        Ok(NamespaceRequest::Create {
4585                            entries: req.entries,
4586
4587                            responder: NamespaceCreateResponder {
4588                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4589                                tx_id: header.tx_id,
4590                            },
4591                        })
4592                    }
4593                    0x665aa4bb3773b351 => {
4594                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4595                        let mut req = fidl::new_empty!(
4596                            NamespaceCreate2Request,
4597                            fidl::encoding::DefaultFuchsiaResourceDialect
4598                        );
4599                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NamespaceCreate2Request>(&header, _body_bytes, handles, &mut req)?;
4600                        let control_handle = NamespaceControlHandle { inner: this.inner.clone() };
4601                        Ok(NamespaceRequest::Create2 {
4602                            entries: req.entries,
4603
4604                            responder: NamespaceCreate2Responder {
4605                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4606                                tx_id: header.tx_id,
4607                            },
4608                        })
4609                    }
4610                    _ if header.tx_id == 0
4611                        && header
4612                            .dynamic_flags()
4613                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4614                    {
4615                        Ok(NamespaceRequest::_UnknownMethod {
4616                            ordinal: header.ordinal,
4617                            control_handle: NamespaceControlHandle { inner: this.inner.clone() },
4618                            method_type: fidl::MethodType::OneWay,
4619                        })
4620                    }
4621                    _ if header
4622                        .dynamic_flags()
4623                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4624                    {
4625                        this.inner.send_framework_err(
4626                            fidl::encoding::FrameworkErr::UnknownMethod,
4627                            header.tx_id,
4628                            header.ordinal,
4629                            header.dynamic_flags(),
4630                            (bytes, handles),
4631                        )?;
4632                        Ok(NamespaceRequest::_UnknownMethod {
4633                            ordinal: header.ordinal,
4634                            control_handle: NamespaceControlHandle { inner: this.inner.clone() },
4635                            method_type: fidl::MethodType::TwoWay,
4636                        })
4637                    }
4638                    _ => Err(fidl::Error::UnknownOrdinal {
4639                        ordinal: header.ordinal,
4640                        protocol_name:
4641                            <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4642                    }),
4643                }))
4644            },
4645        )
4646    }
4647}
4648
4649/// Protocol for performing namespace operations.
4650#[derive(Debug)]
4651pub enum NamespaceRequest {
4652    Create {
4653        entries: Vec<NamespaceInputEntry>,
4654        responder: NamespaceCreateResponder,
4655    },
4656    Create2 {
4657        entries: Vec<NamespaceInputEntry2>,
4658        responder: NamespaceCreate2Responder,
4659    },
4660    /// An interaction was received which does not match any known method.
4661    #[non_exhaustive]
4662    _UnknownMethod {
4663        /// Ordinal of the method that was called.
4664        ordinal: u64,
4665        control_handle: NamespaceControlHandle,
4666        method_type: fidl::MethodType,
4667    },
4668}
4669
4670impl NamespaceRequest {
4671    #[allow(irrefutable_let_patterns)]
4672    pub fn into_create(self) -> Option<(Vec<NamespaceInputEntry>, NamespaceCreateResponder)> {
4673        if let NamespaceRequest::Create { entries, responder } = self {
4674            Some((entries, responder))
4675        } else {
4676            None
4677        }
4678    }
4679
4680    #[allow(irrefutable_let_patterns)]
4681    pub fn into_create2(self) -> Option<(Vec<NamespaceInputEntry2>, NamespaceCreate2Responder)> {
4682        if let NamespaceRequest::Create2 { entries, responder } = self {
4683            Some((entries, responder))
4684        } else {
4685            None
4686        }
4687    }
4688
4689    /// Name of the method defined in FIDL
4690    pub fn method_name(&self) -> &'static str {
4691        match *self {
4692            NamespaceRequest::Create { .. } => "create",
4693            NamespaceRequest::Create2 { .. } => "create2",
4694            NamespaceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4695                "unknown one-way method"
4696            }
4697            NamespaceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4698                "unknown two-way method"
4699            }
4700        }
4701    }
4702}
4703
4704#[derive(Debug, Clone)]
4705pub struct NamespaceControlHandle {
4706    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4707}
4708
4709impl fidl::endpoints::ControlHandle for NamespaceControlHandle {
4710    fn shutdown(&self) {
4711        self.inner.shutdown()
4712    }
4713
4714    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4715        self.inner.shutdown_with_epitaph(status)
4716    }
4717
4718    fn is_closed(&self) -> bool {
4719        self.inner.channel().is_closed()
4720    }
4721    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4722        self.inner.channel().on_closed()
4723    }
4724
4725    #[cfg(target_os = "fuchsia")]
4726    fn signal_peer(
4727        &self,
4728        clear_mask: zx::Signals,
4729        set_mask: zx::Signals,
4730    ) -> Result<(), zx_status::Status> {
4731        use fidl::Peered;
4732        self.inner.channel().signal_peer(clear_mask, set_mask)
4733    }
4734}
4735
4736impl NamespaceControlHandle {}
4737
4738#[must_use = "FIDL methods require a response to be sent"]
4739#[derive(Debug)]
4740pub struct NamespaceCreateResponder {
4741    control_handle: std::mem::ManuallyDrop<NamespaceControlHandle>,
4742    tx_id: u32,
4743}
4744
4745/// Set the the channel to be shutdown (see [`NamespaceControlHandle::shutdown`])
4746/// if the responder is dropped without sending a response, so that the client
4747/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4748impl std::ops::Drop for NamespaceCreateResponder {
4749    fn drop(&mut self) {
4750        self.control_handle.shutdown();
4751        // Safety: drops once, never accessed again
4752        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4753    }
4754}
4755
4756impl fidl::endpoints::Responder for NamespaceCreateResponder {
4757    type ControlHandle = NamespaceControlHandle;
4758
4759    fn control_handle(&self) -> &NamespaceControlHandle {
4760        &self.control_handle
4761    }
4762
4763    fn drop_without_shutdown(mut self) {
4764        // Safety: drops once, never accessed again due to mem::forget
4765        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4766        // Prevent Drop from running (which would shut down the channel)
4767        std::mem::forget(self);
4768    }
4769}
4770
4771impl NamespaceCreateResponder {
4772    /// Sends a response to the FIDL transaction.
4773    ///
4774    /// Sets the channel to shutdown if an error occurs.
4775    pub fn send(
4776        self,
4777        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4778    ) -> Result<(), fidl::Error> {
4779        let _result = self.send_raw(result);
4780        if _result.is_err() {
4781            self.control_handle.shutdown();
4782        }
4783        self.drop_without_shutdown();
4784        _result
4785    }
4786
4787    /// Similar to "send" but does not shutdown the channel if an error occurs.
4788    pub fn send_no_shutdown_on_err(
4789        self,
4790        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4791    ) -> Result<(), fidl::Error> {
4792        let _result = self.send_raw(result);
4793        self.drop_without_shutdown();
4794        _result
4795    }
4796
4797    fn send_raw(
4798        &self,
4799        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4800    ) -> Result<(), fidl::Error> {
4801        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4802            NamespaceCreateResponse,
4803            NamespaceError,
4804        >>(
4805            fidl::encoding::FlexibleResult::new(
4806                result.as_mut().map_err(|e| *e).map(|entries| (entries.as_mut_slice(),)),
4807            ),
4808            self.tx_id,
4809            0x4329fe12b2a790f9,
4810            fidl::encoding::DynamicFlags::FLEXIBLE,
4811        )
4812    }
4813}
4814
4815#[must_use = "FIDL methods require a response to be sent"]
4816#[derive(Debug)]
4817pub struct NamespaceCreate2Responder {
4818    control_handle: std::mem::ManuallyDrop<NamespaceControlHandle>,
4819    tx_id: u32,
4820}
4821
4822/// Set the the channel to be shutdown (see [`NamespaceControlHandle::shutdown`])
4823/// if the responder is dropped without sending a response, so that the client
4824/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4825impl std::ops::Drop for NamespaceCreate2Responder {
4826    fn drop(&mut self) {
4827        self.control_handle.shutdown();
4828        // Safety: drops once, never accessed again
4829        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4830    }
4831}
4832
4833impl fidl::endpoints::Responder for NamespaceCreate2Responder {
4834    type ControlHandle = NamespaceControlHandle;
4835
4836    fn control_handle(&self) -> &NamespaceControlHandle {
4837        &self.control_handle
4838    }
4839
4840    fn drop_without_shutdown(mut self) {
4841        // Safety: drops once, never accessed again due to mem::forget
4842        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4843        // Prevent Drop from running (which would shut down the channel)
4844        std::mem::forget(self);
4845    }
4846}
4847
4848impl NamespaceCreate2Responder {
4849    /// Sends a response to the FIDL transaction.
4850    ///
4851    /// Sets the channel to shutdown if an error occurs.
4852    pub fn send(
4853        self,
4854        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4855    ) -> Result<(), fidl::Error> {
4856        let _result = self.send_raw(result);
4857        if _result.is_err() {
4858            self.control_handle.shutdown();
4859        }
4860        self.drop_without_shutdown();
4861        _result
4862    }
4863
4864    /// Similar to "send" but does not shutdown the channel if an error occurs.
4865    pub fn send_no_shutdown_on_err(
4866        self,
4867        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4868    ) -> Result<(), fidl::Error> {
4869        let _result = self.send_raw(result);
4870        self.drop_without_shutdown();
4871        _result
4872    }
4873
4874    fn send_raw(
4875        &self,
4876        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4877    ) -> Result<(), fidl::Error> {
4878        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4879            NamespaceCreate2Response,
4880            NamespaceError,
4881        >>(
4882            fidl::encoding::FlexibleResult::new(
4883                result.as_mut().map_err(|e| *e).map(|entries| (entries.as_mut_slice(),)),
4884            ),
4885            self.tx_id,
4886            0x665aa4bb3773b351,
4887            fidl::encoding::DynamicFlags::FLEXIBLE,
4888        )
4889    }
4890}
4891
4892#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4893pub struct RealmMarker;
4894
4895impl fidl::endpoints::ProtocolMarker for RealmMarker {
4896    type Proxy = RealmProxy;
4897    type RequestStream = RealmRequestStream;
4898    #[cfg(target_os = "fuchsia")]
4899    type SynchronousProxy = RealmSynchronousProxy;
4900
4901    const DEBUG_NAME: &'static str = "fuchsia.component.Realm";
4902}
4903impl fidl::endpoints::DiscoverableProtocolMarker for RealmMarker {}
4904pub type RealmOpenControllerResult = Result<(), Error>;
4905pub type RealmOpenExposedDirResult = Result<(), Error>;
4906pub type RealmCreateChildResult = Result<(), Error>;
4907pub type RealmDestroyChildResult = Result<(), Error>;
4908pub type RealmListChildrenResult = Result<(), Error>;
4909pub type RealmGetResolvedInfoResult = Result<fidl_fuchsia_component_resolution::Component, Error>;
4910pub type RealmGetChildOutputDictionaryDeprecatedResult =
4911    Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>;
4912pub type RealmGetChildOutputDictionaryResult = Result<fidl::EventPair, Error>;
4913
4914pub trait RealmProxyInterface: Send + Sync {
4915    type OpenControllerResponseFut: std::future::Future<Output = Result<RealmOpenControllerResult, fidl::Error>>
4916        + Send;
4917    fn r#open_controller(
4918        &self,
4919        child: &fidl_fuchsia_component_decl::ChildRef,
4920        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
4921    ) -> Self::OpenControllerResponseFut;
4922    type OpenExposedDirResponseFut: std::future::Future<Output = Result<RealmOpenExposedDirResult, fidl::Error>>
4923        + Send;
4924    fn r#open_exposed_dir(
4925        &self,
4926        child: &fidl_fuchsia_component_decl::ChildRef,
4927        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4928    ) -> Self::OpenExposedDirResponseFut;
4929    type CreateChildResponseFut: std::future::Future<Output = Result<RealmCreateChildResult, fidl::Error>>
4930        + Send;
4931    fn r#create_child(
4932        &self,
4933        collection: &fidl_fuchsia_component_decl::CollectionRef,
4934        decl: &fidl_fuchsia_component_decl::Child,
4935        args: CreateChildArgs,
4936    ) -> Self::CreateChildResponseFut;
4937    type DestroyChildResponseFut: std::future::Future<Output = Result<RealmDestroyChildResult, fidl::Error>>
4938        + Send;
4939    fn r#destroy_child(
4940        &self,
4941        child: &fidl_fuchsia_component_decl::ChildRef,
4942    ) -> Self::DestroyChildResponseFut;
4943    type ListChildrenResponseFut: std::future::Future<Output = Result<RealmListChildrenResult, fidl::Error>>
4944        + Send;
4945    fn r#list_children(
4946        &self,
4947        collection: &fidl_fuchsia_component_decl::CollectionRef,
4948        iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
4949    ) -> Self::ListChildrenResponseFut;
4950    type GetResolvedInfoResponseFut: std::future::Future<Output = Result<RealmGetResolvedInfoResult, fidl::Error>>
4951        + Send;
4952    fn r#get_resolved_info(&self) -> Self::GetResolvedInfoResponseFut;
4953    type GetChildOutputDictionaryDeprecatedResponseFut: std::future::Future<
4954            Output = Result<RealmGetChildOutputDictionaryDeprecatedResult, fidl::Error>,
4955        > + Send;
4956    fn r#get_child_output_dictionary_deprecated(
4957        &self,
4958        child: &fidl_fuchsia_component_decl::ChildRef,
4959    ) -> Self::GetChildOutputDictionaryDeprecatedResponseFut;
4960    type GetChildOutputDictionaryResponseFut: std::future::Future<Output = Result<RealmGetChildOutputDictionaryResult, fidl::Error>>
4961        + Send;
4962    fn r#get_child_output_dictionary(
4963        &self,
4964        child: &fidl_fuchsia_component_decl::ChildRef,
4965    ) -> Self::GetChildOutputDictionaryResponseFut;
4966}
4967#[derive(Debug)]
4968#[cfg(target_os = "fuchsia")]
4969pub struct RealmSynchronousProxy {
4970    client: fidl::client::sync::Client,
4971}
4972
4973#[cfg(target_os = "fuchsia")]
4974impl fidl::endpoints::SynchronousProxy for RealmSynchronousProxy {
4975    type Proxy = RealmProxy;
4976    type Protocol = RealmMarker;
4977
4978    fn from_channel(inner: fidl::Channel) -> Self {
4979        Self::new(inner)
4980    }
4981
4982    fn into_channel(self) -> fidl::Channel {
4983        self.client.into_channel()
4984    }
4985
4986    fn as_channel(&self) -> &fidl::Channel {
4987        self.client.as_channel()
4988    }
4989}
4990
4991#[cfg(target_os = "fuchsia")]
4992impl RealmSynchronousProxy {
4993    pub fn new(channel: fidl::Channel) -> Self {
4994        Self { client: fidl::client::sync::Client::new(channel) }
4995    }
4996
4997    pub fn into_channel(self) -> fidl::Channel {
4998        self.client.into_channel()
4999    }
5000
5001    /// Waits until an event arrives and returns it. It is safe for other
5002    /// threads to make concurrent requests while waiting for an event.
5003    pub fn wait_for_event(
5004        &self,
5005        deadline: zx::MonotonicInstant,
5006    ) -> Result<RealmEvent, fidl::Error> {
5007        RealmEvent::decode(self.client.wait_for_event::<RealmMarker>(deadline)?)
5008    }
5009
5010    /// Operate on a child component. See documentation for [`Controller`].
5011    ///
5012    /// Errors:
5013    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5014    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5015    /// - `INSTANCE_DIED`: This realm no longer exists.
5016    pub fn r#open_controller(
5017        &self,
5018        mut child: &fidl_fuchsia_component_decl::ChildRef,
5019        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5020        ___deadline: zx::MonotonicInstant,
5021    ) -> Result<RealmOpenControllerResult, fidl::Error> {
5022        let _response = self.client.send_query::<
5023            RealmOpenControllerRequest,
5024            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5025            RealmMarker,
5026        >(
5027            (child, controller,),
5028            0x7150b7898d1b1180,
5029            fidl::encoding::DynamicFlags::empty(),
5030            ___deadline,
5031        )?;
5032        Ok(_response.map(|x| x))
5033    }
5034
5035    /// Opens the exposed directory of a child component. When this function
5036    /// successfully returns, `exposed_dir` is bound to a directory that
5037    /// contains the capabilities which the child exposed to its realm via
5038    /// `ComponentDecl.exposes` (specified via "expose" declarations in the
5039    /// component's manifest). The child component will not start as a result of
5040    /// this call.
5041    ///
5042    /// `exposed_dir` is open as long as `child` exists.
5043    ///
5044    /// Errors:
5045    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5046    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5047    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
5048    /// - `INSTANCE_DIED`: This realm no longer exists.
5049    pub fn r#open_exposed_dir(
5050        &self,
5051        mut child: &fidl_fuchsia_component_decl::ChildRef,
5052        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5053        ___deadline: zx::MonotonicInstant,
5054    ) -> Result<RealmOpenExposedDirResult, fidl::Error> {
5055        let _response = self.client.send_query::<
5056            RealmOpenExposedDirRequest,
5057            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5058            RealmMarker,
5059        >(
5060            (child, exposed_dir,),
5061            0x7f993235ca59f92c,
5062            fidl::encoding::DynamicFlags::empty(),
5063            ___deadline,
5064        )?;
5065        Ok(_response.map(|x| x))
5066    }
5067
5068    /// Creates a child component instance dynamically. When this function
5069    /// returns successfully, the instance exists, but it may not be running.
5070    ///
5071    /// The environment of the child instance is determined by the environment
5072    /// of the collection. `decl` must not set `environment`.
5073    ///
5074    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
5075    /// [CreateChild] will start the component and return once the component is
5076    /// started. Otherwise, [CreateChild] will return immediately after creating
5077    /// the component and will not start or resolve it.
5078    ///
5079    /// Errors:
5080    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
5081    ///   is not a valid declaration.
5082    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5083    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
5084    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
5085    ///   in a `SingleRun` collection.
5086    /// - `NO_SPACE`: Could not allocate storage for the new instance.
5087    /// - `INSTANCE_DIED`: This realm no longer exists.
5088    pub fn r#create_child(
5089        &self,
5090        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5091        mut decl: &fidl_fuchsia_component_decl::Child,
5092        mut args: CreateChildArgs,
5093        ___deadline: zx::MonotonicInstant,
5094    ) -> Result<RealmCreateChildResult, fidl::Error> {
5095        let _response = self.client.send_query::<
5096            RealmCreateChildRequest,
5097            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5098            RealmMarker,
5099        >(
5100            (collection, decl, &mut args,),
5101            0x43e48ce8483d7560,
5102            fidl::encoding::DynamicFlags::empty(),
5103            ___deadline,
5104        )?;
5105        Ok(_response.map(|x| x))
5106    }
5107
5108    /// Destroys a dynamically-created component instance. When this function
5109    /// returns, the instance is destroyed and has stopped running.  However,
5110    /// cleanup of the component's resources (such as its isolated storage) may
5111    /// happen in the background after this function returns.
5112    ///
5113    /// Errors:
5114    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
5115    ///   to a dynamic instance.
5116    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5117    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5118    /// - `INSTANCE_DIED`: This realm no longer exists.
5119    pub fn r#destroy_child(
5120        &self,
5121        mut child: &fidl_fuchsia_component_decl::ChildRef,
5122        ___deadline: zx::MonotonicInstant,
5123    ) -> Result<RealmDestroyChildResult, fidl::Error> {
5124        let _response = self.client.send_query::<
5125            RealmDestroyChildRequest,
5126            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5127            RealmMarker,
5128        >(
5129            (child,),
5130            0x71d8caf8850c9222,
5131            fidl::encoding::DynamicFlags::empty(),
5132            ___deadline,
5133        )?;
5134        Ok(_response.map(|x| x))
5135    }
5136
5137    /// Returns an iterator that lists all instances in a collection.
5138    ///
5139    /// NOTE: The results are not guaranteed to be consistent. Instances may be
5140    /// created or destroyed while the iterator is live, but those changes
5141    /// won't be observed by the iterator after this method returns.
5142    ///
5143    /// Errors:
5144    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
5145    /// does not have `ZX_RIGHT_WAIT`.
5146    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5147    /// - `INSTANCE_DIED`: This realm no longer exists.
5148    /// - If `iter` does not have standard channel rights, this function may
5149    ///   return `ACCESS_DENIED` or component manager may close `iter`.
5150    pub fn r#list_children(
5151        &self,
5152        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5153        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5154        ___deadline: zx::MonotonicInstant,
5155    ) -> Result<RealmListChildrenResult, fidl::Error> {
5156        let _response = self.client.send_query::<
5157            RealmListChildrenRequest,
5158            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5159            RealmMarker,
5160        >(
5161            (collection, iter,),
5162            0x6888a76683efc0a1,
5163            fidl::encoding::DynamicFlags::empty(),
5164            ___deadline,
5165        )?;
5166        Ok(_response.map(|x| x))
5167    }
5168
5169    /// Returns the set of information that was given to the component framework
5170    /// by this component's resolver.
5171    pub fn r#get_resolved_info(
5172        &self,
5173        ___deadline: zx::MonotonicInstant,
5174    ) -> Result<RealmGetResolvedInfoResult, fidl::Error> {
5175        let _response = self.client.send_query::<
5176            fidl::encoding::EmptyPayload,
5177            fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>,
5178            RealmMarker,
5179        >(
5180            (),
5181            0x734f744cb7d210a2,
5182            fidl::encoding::DynamicFlags::empty(),
5183            ___deadline,
5184        )?;
5185        Ok(_response.map(|x| x.resolved_info))
5186    }
5187
5188    pub fn r#get_child_output_dictionary_deprecated(
5189        &self,
5190        mut child: &fidl_fuchsia_component_decl::ChildRef,
5191        ___deadline: zx::MonotonicInstant,
5192    ) -> Result<RealmGetChildOutputDictionaryDeprecatedResult, fidl::Error> {
5193        let _response = self.client.send_query::<
5194            RealmGetChildOutputDictionaryDeprecatedRequest,
5195            fidl::encoding::ResultType<RealmGetChildOutputDictionaryDeprecatedResponse, Error>,
5196            RealmMarker,
5197        >(
5198            (child,),
5199            0x39245b02aba94364,
5200            fidl::encoding::DynamicFlags::empty(),
5201            ___deadline,
5202        )?;
5203        Ok(_response.map(|x| x.dictionary))
5204    }
5205
5206    /// Returns a reference to a child's output dictionary, which may be
5207    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
5208    pub fn r#get_child_output_dictionary(
5209        &self,
5210        mut child: &fidl_fuchsia_component_decl::ChildRef,
5211        ___deadline: zx::MonotonicInstant,
5212    ) -> Result<RealmGetChildOutputDictionaryResult, fidl::Error> {
5213        let _response = self.client.send_query::<
5214            RealmGetChildOutputDictionaryRequest,
5215            fidl::encoding::ResultType<RealmGetChildOutputDictionaryResponse, Error>,
5216            RealmMarker,
5217        >(
5218            (child,),
5219            0x4259d08d261d5610,
5220            fidl::encoding::DynamicFlags::empty(),
5221            ___deadline,
5222        )?;
5223        Ok(_response.map(|x| x.dictionary))
5224    }
5225}
5226
5227#[cfg(target_os = "fuchsia")]
5228impl From<RealmSynchronousProxy> for zx::NullableHandle {
5229    fn from(value: RealmSynchronousProxy) -> Self {
5230        value.into_channel().into()
5231    }
5232}
5233
5234#[cfg(target_os = "fuchsia")]
5235impl From<fidl::Channel> for RealmSynchronousProxy {
5236    fn from(value: fidl::Channel) -> Self {
5237        Self::new(value)
5238    }
5239}
5240
5241#[cfg(target_os = "fuchsia")]
5242impl fidl::endpoints::FromClient for RealmSynchronousProxy {
5243    type Protocol = RealmMarker;
5244
5245    fn from_client(value: fidl::endpoints::ClientEnd<RealmMarker>) -> Self {
5246        Self::new(value.into_channel())
5247    }
5248}
5249
5250#[derive(Debug, Clone)]
5251pub struct RealmProxy {
5252    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5253}
5254
5255impl fidl::endpoints::Proxy for RealmProxy {
5256    type Protocol = RealmMarker;
5257
5258    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5259        Self::new(inner)
5260    }
5261
5262    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5263        self.client.into_channel().map_err(|client| Self { client })
5264    }
5265
5266    fn as_channel(&self) -> &::fidl::AsyncChannel {
5267        self.client.as_channel()
5268    }
5269}
5270
5271impl RealmProxy {
5272    /// Create a new Proxy for fuchsia.component/Realm.
5273    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5274        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5275        Self { client: fidl::client::Client::new(channel, protocol_name) }
5276    }
5277
5278    /// Get a Stream of events from the remote end of the protocol.
5279    ///
5280    /// # Panics
5281    ///
5282    /// Panics if the event stream was already taken.
5283    pub fn take_event_stream(&self) -> RealmEventStream {
5284        RealmEventStream { event_receiver: self.client.take_event_receiver() }
5285    }
5286
5287    /// Operate on a child component. See documentation for [`Controller`].
5288    ///
5289    /// Errors:
5290    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5291    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5292    /// - `INSTANCE_DIED`: This realm no longer exists.
5293    pub fn r#open_controller(
5294        &self,
5295        mut child: &fidl_fuchsia_component_decl::ChildRef,
5296        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5297    ) -> fidl::client::QueryResponseFut<
5298        RealmOpenControllerResult,
5299        fidl::encoding::DefaultFuchsiaResourceDialect,
5300    > {
5301        RealmProxyInterface::r#open_controller(self, child, controller)
5302    }
5303
5304    /// Opens the exposed directory of a child component. When this function
5305    /// successfully returns, `exposed_dir` is bound to a directory that
5306    /// contains the capabilities which the child exposed to its realm via
5307    /// `ComponentDecl.exposes` (specified via "expose" declarations in the
5308    /// component's manifest). The child component will not start as a result of
5309    /// this call.
5310    ///
5311    /// `exposed_dir` is open as long as `child` exists.
5312    ///
5313    /// Errors:
5314    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5315    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5316    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
5317    /// - `INSTANCE_DIED`: This realm no longer exists.
5318    pub fn r#open_exposed_dir(
5319        &self,
5320        mut child: &fidl_fuchsia_component_decl::ChildRef,
5321        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5322    ) -> fidl::client::QueryResponseFut<
5323        RealmOpenExposedDirResult,
5324        fidl::encoding::DefaultFuchsiaResourceDialect,
5325    > {
5326        RealmProxyInterface::r#open_exposed_dir(self, child, exposed_dir)
5327    }
5328
5329    /// Creates a child component instance dynamically. When this function
5330    /// returns successfully, the instance exists, but it may not be running.
5331    ///
5332    /// The environment of the child instance is determined by the environment
5333    /// of the collection. `decl` must not set `environment`.
5334    ///
5335    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
5336    /// [CreateChild] will start the component and return once the component is
5337    /// started. Otherwise, [CreateChild] will return immediately after creating
5338    /// the component and will not start or resolve it.
5339    ///
5340    /// Errors:
5341    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
5342    ///   is not a valid declaration.
5343    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5344    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
5345    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
5346    ///   in a `SingleRun` collection.
5347    /// - `NO_SPACE`: Could not allocate storage for the new instance.
5348    /// - `INSTANCE_DIED`: This realm no longer exists.
5349    pub fn r#create_child(
5350        &self,
5351        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5352        mut decl: &fidl_fuchsia_component_decl::Child,
5353        mut args: CreateChildArgs,
5354    ) -> fidl::client::QueryResponseFut<
5355        RealmCreateChildResult,
5356        fidl::encoding::DefaultFuchsiaResourceDialect,
5357    > {
5358        RealmProxyInterface::r#create_child(self, collection, decl, args)
5359    }
5360
5361    /// Destroys a dynamically-created component instance. When this function
5362    /// returns, the instance is destroyed and has stopped running.  However,
5363    /// cleanup of the component's resources (such as its isolated storage) may
5364    /// happen in the background after this function returns.
5365    ///
5366    /// Errors:
5367    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
5368    ///   to a dynamic instance.
5369    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5370    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5371    /// - `INSTANCE_DIED`: This realm no longer exists.
5372    pub fn r#destroy_child(
5373        &self,
5374        mut child: &fidl_fuchsia_component_decl::ChildRef,
5375    ) -> fidl::client::QueryResponseFut<
5376        RealmDestroyChildResult,
5377        fidl::encoding::DefaultFuchsiaResourceDialect,
5378    > {
5379        RealmProxyInterface::r#destroy_child(self, child)
5380    }
5381
5382    /// Returns an iterator that lists all instances in a collection.
5383    ///
5384    /// NOTE: The results are not guaranteed to be consistent. Instances may be
5385    /// created or destroyed while the iterator is live, but those changes
5386    /// won't be observed by the iterator after this method returns.
5387    ///
5388    /// Errors:
5389    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
5390    /// does not have `ZX_RIGHT_WAIT`.
5391    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5392    /// - `INSTANCE_DIED`: This realm no longer exists.
5393    /// - If `iter` does not have standard channel rights, this function may
5394    ///   return `ACCESS_DENIED` or component manager may close `iter`.
5395    pub fn r#list_children(
5396        &self,
5397        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5398        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5399    ) -> fidl::client::QueryResponseFut<
5400        RealmListChildrenResult,
5401        fidl::encoding::DefaultFuchsiaResourceDialect,
5402    > {
5403        RealmProxyInterface::r#list_children(self, collection, iter)
5404    }
5405
5406    /// Returns the set of information that was given to the component framework
5407    /// by this component's resolver.
5408    pub fn r#get_resolved_info(
5409        &self,
5410    ) -> fidl::client::QueryResponseFut<
5411        RealmGetResolvedInfoResult,
5412        fidl::encoding::DefaultFuchsiaResourceDialect,
5413    > {
5414        RealmProxyInterface::r#get_resolved_info(self)
5415    }
5416
5417    pub fn r#get_child_output_dictionary_deprecated(
5418        &self,
5419        mut child: &fidl_fuchsia_component_decl::ChildRef,
5420    ) -> fidl::client::QueryResponseFut<
5421        RealmGetChildOutputDictionaryDeprecatedResult,
5422        fidl::encoding::DefaultFuchsiaResourceDialect,
5423    > {
5424        RealmProxyInterface::r#get_child_output_dictionary_deprecated(self, child)
5425    }
5426
5427    /// Returns a reference to a child's output dictionary, which may be
5428    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
5429    pub fn r#get_child_output_dictionary(
5430        &self,
5431        mut child: &fidl_fuchsia_component_decl::ChildRef,
5432    ) -> fidl::client::QueryResponseFut<
5433        RealmGetChildOutputDictionaryResult,
5434        fidl::encoding::DefaultFuchsiaResourceDialect,
5435    > {
5436        RealmProxyInterface::r#get_child_output_dictionary(self, child)
5437    }
5438}
5439
5440impl RealmProxyInterface for RealmProxy {
5441    type OpenControllerResponseFut = fidl::client::QueryResponseFut<
5442        RealmOpenControllerResult,
5443        fidl::encoding::DefaultFuchsiaResourceDialect,
5444    >;
5445    fn r#open_controller(
5446        &self,
5447        mut child: &fidl_fuchsia_component_decl::ChildRef,
5448        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5449    ) -> Self::OpenControllerResponseFut {
5450        fn _decode(
5451            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5452        ) -> Result<RealmOpenControllerResult, fidl::Error> {
5453            let _response = fidl::client::decode_transaction_body::<
5454                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5455                fidl::encoding::DefaultFuchsiaResourceDialect,
5456                0x7150b7898d1b1180,
5457            >(_buf?)?;
5458            Ok(_response.map(|x| x))
5459        }
5460        self.client.send_query_and_decode::<RealmOpenControllerRequest, RealmOpenControllerResult>(
5461            (child, controller),
5462            0x7150b7898d1b1180,
5463            fidl::encoding::DynamicFlags::empty(),
5464            _decode,
5465        )
5466    }
5467
5468    type OpenExposedDirResponseFut = fidl::client::QueryResponseFut<
5469        RealmOpenExposedDirResult,
5470        fidl::encoding::DefaultFuchsiaResourceDialect,
5471    >;
5472    fn r#open_exposed_dir(
5473        &self,
5474        mut child: &fidl_fuchsia_component_decl::ChildRef,
5475        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5476    ) -> Self::OpenExposedDirResponseFut {
5477        fn _decode(
5478            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5479        ) -> Result<RealmOpenExposedDirResult, fidl::Error> {
5480            let _response = fidl::client::decode_transaction_body::<
5481                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5482                fidl::encoding::DefaultFuchsiaResourceDialect,
5483                0x7f993235ca59f92c,
5484            >(_buf?)?;
5485            Ok(_response.map(|x| x))
5486        }
5487        self.client.send_query_and_decode::<RealmOpenExposedDirRequest, RealmOpenExposedDirResult>(
5488            (child, exposed_dir),
5489            0x7f993235ca59f92c,
5490            fidl::encoding::DynamicFlags::empty(),
5491            _decode,
5492        )
5493    }
5494
5495    type CreateChildResponseFut = fidl::client::QueryResponseFut<
5496        RealmCreateChildResult,
5497        fidl::encoding::DefaultFuchsiaResourceDialect,
5498    >;
5499    fn r#create_child(
5500        &self,
5501        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5502        mut decl: &fidl_fuchsia_component_decl::Child,
5503        mut args: CreateChildArgs,
5504    ) -> Self::CreateChildResponseFut {
5505        fn _decode(
5506            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5507        ) -> Result<RealmCreateChildResult, fidl::Error> {
5508            let _response = fidl::client::decode_transaction_body::<
5509                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5510                fidl::encoding::DefaultFuchsiaResourceDialect,
5511                0x43e48ce8483d7560,
5512            >(_buf?)?;
5513            Ok(_response.map(|x| x))
5514        }
5515        self.client.send_query_and_decode::<RealmCreateChildRequest, RealmCreateChildResult>(
5516            (collection, decl, &mut args),
5517            0x43e48ce8483d7560,
5518            fidl::encoding::DynamicFlags::empty(),
5519            _decode,
5520        )
5521    }
5522
5523    type DestroyChildResponseFut = fidl::client::QueryResponseFut<
5524        RealmDestroyChildResult,
5525        fidl::encoding::DefaultFuchsiaResourceDialect,
5526    >;
5527    fn r#destroy_child(
5528        &self,
5529        mut child: &fidl_fuchsia_component_decl::ChildRef,
5530    ) -> Self::DestroyChildResponseFut {
5531        fn _decode(
5532            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5533        ) -> Result<RealmDestroyChildResult, fidl::Error> {
5534            let _response = fidl::client::decode_transaction_body::<
5535                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5536                fidl::encoding::DefaultFuchsiaResourceDialect,
5537                0x71d8caf8850c9222,
5538            >(_buf?)?;
5539            Ok(_response.map(|x| x))
5540        }
5541        self.client.send_query_and_decode::<RealmDestroyChildRequest, RealmDestroyChildResult>(
5542            (child,),
5543            0x71d8caf8850c9222,
5544            fidl::encoding::DynamicFlags::empty(),
5545            _decode,
5546        )
5547    }
5548
5549    type ListChildrenResponseFut = fidl::client::QueryResponseFut<
5550        RealmListChildrenResult,
5551        fidl::encoding::DefaultFuchsiaResourceDialect,
5552    >;
5553    fn r#list_children(
5554        &self,
5555        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
5556        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5557    ) -> Self::ListChildrenResponseFut {
5558        fn _decode(
5559            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5560        ) -> Result<RealmListChildrenResult, fidl::Error> {
5561            let _response = fidl::client::decode_transaction_body::<
5562                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
5563                fidl::encoding::DefaultFuchsiaResourceDialect,
5564                0x6888a76683efc0a1,
5565            >(_buf?)?;
5566            Ok(_response.map(|x| x))
5567        }
5568        self.client.send_query_and_decode::<RealmListChildrenRequest, RealmListChildrenResult>(
5569            (collection, iter),
5570            0x6888a76683efc0a1,
5571            fidl::encoding::DynamicFlags::empty(),
5572            _decode,
5573        )
5574    }
5575
5576    type GetResolvedInfoResponseFut = fidl::client::QueryResponseFut<
5577        RealmGetResolvedInfoResult,
5578        fidl::encoding::DefaultFuchsiaResourceDialect,
5579    >;
5580    fn r#get_resolved_info(&self) -> Self::GetResolvedInfoResponseFut {
5581        fn _decode(
5582            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5583        ) -> Result<RealmGetResolvedInfoResult, fidl::Error> {
5584            let _response = fidl::client::decode_transaction_body::<
5585                fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>,
5586                fidl::encoding::DefaultFuchsiaResourceDialect,
5587                0x734f744cb7d210a2,
5588            >(_buf?)?;
5589            Ok(_response.map(|x| x.resolved_info))
5590        }
5591        self.client
5592            .send_query_and_decode::<fidl::encoding::EmptyPayload, RealmGetResolvedInfoResult>(
5593                (),
5594                0x734f744cb7d210a2,
5595                fidl::encoding::DynamicFlags::empty(),
5596                _decode,
5597            )
5598    }
5599
5600    type GetChildOutputDictionaryDeprecatedResponseFut = fidl::client::QueryResponseFut<
5601        RealmGetChildOutputDictionaryDeprecatedResult,
5602        fidl::encoding::DefaultFuchsiaResourceDialect,
5603    >;
5604    fn r#get_child_output_dictionary_deprecated(
5605        &self,
5606        mut child: &fidl_fuchsia_component_decl::ChildRef,
5607    ) -> Self::GetChildOutputDictionaryDeprecatedResponseFut {
5608        fn _decode(
5609            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5610        ) -> Result<RealmGetChildOutputDictionaryDeprecatedResult, fidl::Error> {
5611            let _response = fidl::client::decode_transaction_body::<
5612                fidl::encoding::ResultType<RealmGetChildOutputDictionaryDeprecatedResponse, Error>,
5613                fidl::encoding::DefaultFuchsiaResourceDialect,
5614                0x39245b02aba94364,
5615            >(_buf?)?;
5616            Ok(_response.map(|x| x.dictionary))
5617        }
5618        self.client.send_query_and_decode::<
5619            RealmGetChildOutputDictionaryDeprecatedRequest,
5620            RealmGetChildOutputDictionaryDeprecatedResult,
5621        >(
5622            (child,),
5623            0x39245b02aba94364,
5624            fidl::encoding::DynamicFlags::empty(),
5625            _decode,
5626        )
5627    }
5628
5629    type GetChildOutputDictionaryResponseFut = fidl::client::QueryResponseFut<
5630        RealmGetChildOutputDictionaryResult,
5631        fidl::encoding::DefaultFuchsiaResourceDialect,
5632    >;
5633    fn r#get_child_output_dictionary(
5634        &self,
5635        mut child: &fidl_fuchsia_component_decl::ChildRef,
5636    ) -> Self::GetChildOutputDictionaryResponseFut {
5637        fn _decode(
5638            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5639        ) -> Result<RealmGetChildOutputDictionaryResult, fidl::Error> {
5640            let _response = fidl::client::decode_transaction_body::<
5641                fidl::encoding::ResultType<RealmGetChildOutputDictionaryResponse, Error>,
5642                fidl::encoding::DefaultFuchsiaResourceDialect,
5643                0x4259d08d261d5610,
5644            >(_buf?)?;
5645            Ok(_response.map(|x| x.dictionary))
5646        }
5647        self.client.send_query_and_decode::<
5648            RealmGetChildOutputDictionaryRequest,
5649            RealmGetChildOutputDictionaryResult,
5650        >(
5651            (child,),
5652            0x4259d08d261d5610,
5653            fidl::encoding::DynamicFlags::empty(),
5654            _decode,
5655        )
5656    }
5657}
5658
5659pub struct RealmEventStream {
5660    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5661}
5662
5663impl std::marker::Unpin for RealmEventStream {}
5664
5665impl futures::stream::FusedStream for RealmEventStream {
5666    fn is_terminated(&self) -> bool {
5667        self.event_receiver.is_terminated()
5668    }
5669}
5670
5671impl futures::Stream for RealmEventStream {
5672    type Item = Result<RealmEvent, fidl::Error>;
5673
5674    fn poll_next(
5675        mut self: std::pin::Pin<&mut Self>,
5676        cx: &mut std::task::Context<'_>,
5677    ) -> std::task::Poll<Option<Self::Item>> {
5678        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5679            &mut self.event_receiver,
5680            cx
5681        )?) {
5682            Some(buf) => std::task::Poll::Ready(Some(RealmEvent::decode(buf))),
5683            None => std::task::Poll::Ready(None),
5684        }
5685    }
5686}
5687
5688#[derive(Debug)]
5689pub enum RealmEvent {}
5690
5691impl RealmEvent {
5692    /// Decodes a message buffer as a [`RealmEvent`].
5693    fn decode(
5694        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5695    ) -> Result<RealmEvent, fidl::Error> {
5696        let (bytes, _handles) = buf.split_mut();
5697        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5698        debug_assert_eq!(tx_header.tx_id, 0);
5699        match tx_header.ordinal {
5700            _ => Err(fidl::Error::UnknownOrdinal {
5701                ordinal: tx_header.ordinal,
5702                protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5703            }),
5704        }
5705    }
5706}
5707
5708/// A Stream of incoming requests for fuchsia.component/Realm.
5709pub struct RealmRequestStream {
5710    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5711    is_terminated: bool,
5712}
5713
5714impl std::marker::Unpin for RealmRequestStream {}
5715
5716impl futures::stream::FusedStream for RealmRequestStream {
5717    fn is_terminated(&self) -> bool {
5718        self.is_terminated
5719    }
5720}
5721
5722impl fidl::endpoints::RequestStream for RealmRequestStream {
5723    type Protocol = RealmMarker;
5724    type ControlHandle = RealmControlHandle;
5725
5726    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5727        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5728    }
5729
5730    fn control_handle(&self) -> Self::ControlHandle {
5731        RealmControlHandle { inner: self.inner.clone() }
5732    }
5733
5734    fn into_inner(
5735        self,
5736    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5737    {
5738        (self.inner, self.is_terminated)
5739    }
5740
5741    fn from_inner(
5742        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5743        is_terminated: bool,
5744    ) -> Self {
5745        Self { inner, is_terminated }
5746    }
5747}
5748
5749impl futures::Stream for RealmRequestStream {
5750    type Item = Result<RealmRequest, fidl::Error>;
5751
5752    fn poll_next(
5753        mut self: std::pin::Pin<&mut Self>,
5754        cx: &mut std::task::Context<'_>,
5755    ) -> std::task::Poll<Option<Self::Item>> {
5756        let this = &mut *self;
5757        if this.inner.check_shutdown(cx) {
5758            this.is_terminated = true;
5759            return std::task::Poll::Ready(None);
5760        }
5761        if this.is_terminated {
5762            panic!("polled RealmRequestStream after completion");
5763        }
5764        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5765            |bytes, handles| {
5766                match this.inner.channel().read_etc(cx, bytes, handles) {
5767                    std::task::Poll::Ready(Ok(())) => {}
5768                    std::task::Poll::Pending => return std::task::Poll::Pending,
5769                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5770                        this.is_terminated = true;
5771                        return std::task::Poll::Ready(None);
5772                    }
5773                    std::task::Poll::Ready(Err(e)) => {
5774                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5775                            e.into(),
5776                        ))));
5777                    }
5778                }
5779
5780                // A message has been received from the channel
5781                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5782
5783                std::task::Poll::Ready(Some(match header.ordinal {
5784                    0x7150b7898d1b1180 => {
5785                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5786                        let mut req = fidl::new_empty!(
5787                            RealmOpenControllerRequest,
5788                            fidl::encoding::DefaultFuchsiaResourceDialect
5789                        );
5790                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmOpenControllerRequest>(&header, _body_bytes, handles, &mut req)?;
5791                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5792                        Ok(RealmRequest::OpenController {
5793                            child: req.child,
5794                            controller: req.controller,
5795
5796                            responder: RealmOpenControllerResponder {
5797                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5798                                tx_id: header.tx_id,
5799                            },
5800                        })
5801                    }
5802                    0x7f993235ca59f92c => {
5803                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5804                        let mut req = fidl::new_empty!(
5805                            RealmOpenExposedDirRequest,
5806                            fidl::encoding::DefaultFuchsiaResourceDialect
5807                        );
5808                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmOpenExposedDirRequest>(&header, _body_bytes, handles, &mut req)?;
5809                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5810                        Ok(RealmRequest::OpenExposedDir {
5811                            child: req.child,
5812                            exposed_dir: req.exposed_dir,
5813
5814                            responder: RealmOpenExposedDirResponder {
5815                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5816                                tx_id: header.tx_id,
5817                            },
5818                        })
5819                    }
5820                    0x43e48ce8483d7560 => {
5821                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5822                        let mut req = fidl::new_empty!(
5823                            RealmCreateChildRequest,
5824                            fidl::encoding::DefaultFuchsiaResourceDialect
5825                        );
5826                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmCreateChildRequest>(&header, _body_bytes, handles, &mut req)?;
5827                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5828                        Ok(RealmRequest::CreateChild {
5829                            collection: req.collection,
5830                            decl: req.decl,
5831                            args: req.args,
5832
5833                            responder: RealmCreateChildResponder {
5834                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5835                                tx_id: header.tx_id,
5836                            },
5837                        })
5838                    }
5839                    0x71d8caf8850c9222 => {
5840                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5841                        let mut req = fidl::new_empty!(
5842                            RealmDestroyChildRequest,
5843                            fidl::encoding::DefaultFuchsiaResourceDialect
5844                        );
5845                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmDestroyChildRequest>(&header, _body_bytes, handles, &mut req)?;
5846                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5847                        Ok(RealmRequest::DestroyChild {
5848                            child: req.child,
5849
5850                            responder: RealmDestroyChildResponder {
5851                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5852                                tx_id: header.tx_id,
5853                            },
5854                        })
5855                    }
5856                    0x6888a76683efc0a1 => {
5857                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5858                        let mut req = fidl::new_empty!(
5859                            RealmListChildrenRequest,
5860                            fidl::encoding::DefaultFuchsiaResourceDialect
5861                        );
5862                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmListChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
5863                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5864                        Ok(RealmRequest::ListChildren {
5865                            collection: req.collection,
5866                            iter: req.iter,
5867
5868                            responder: RealmListChildrenResponder {
5869                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5870                                tx_id: header.tx_id,
5871                            },
5872                        })
5873                    }
5874                    0x734f744cb7d210a2 => {
5875                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5876                        let mut req = fidl::new_empty!(
5877                            fidl::encoding::EmptyPayload,
5878                            fidl::encoding::DefaultFuchsiaResourceDialect
5879                        );
5880                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5881                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5882                        Ok(RealmRequest::GetResolvedInfo {
5883                            responder: RealmGetResolvedInfoResponder {
5884                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5885                                tx_id: header.tx_id,
5886                            },
5887                        })
5888                    }
5889                    0x39245b02aba94364 => {
5890                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5891                        let mut req = fidl::new_empty!(
5892                            RealmGetChildOutputDictionaryDeprecatedRequest,
5893                            fidl::encoding::DefaultFuchsiaResourceDialect
5894                        );
5895                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmGetChildOutputDictionaryDeprecatedRequest>(&header, _body_bytes, handles, &mut req)?;
5896                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5897                        Ok(RealmRequest::GetChildOutputDictionaryDeprecated {
5898                            child: req.child,
5899
5900                            responder: RealmGetChildOutputDictionaryDeprecatedResponder {
5901                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5902                                tx_id: header.tx_id,
5903                            },
5904                        })
5905                    }
5906                    0x4259d08d261d5610 => {
5907                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5908                        let mut req = fidl::new_empty!(
5909                            RealmGetChildOutputDictionaryRequest,
5910                            fidl::encoding::DefaultFuchsiaResourceDialect
5911                        );
5912                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmGetChildOutputDictionaryRequest>(&header, _body_bytes, handles, &mut req)?;
5913                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5914                        Ok(RealmRequest::GetChildOutputDictionary {
5915                            child: req.child,
5916
5917                            responder: RealmGetChildOutputDictionaryResponder {
5918                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5919                                tx_id: header.tx_id,
5920                            },
5921                        })
5922                    }
5923                    _ => Err(fidl::Error::UnknownOrdinal {
5924                        ordinal: header.ordinal,
5925                        protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5926                    }),
5927                }))
5928            },
5929        )
5930    }
5931}
5932
5933/// A protocol used by a component instance to manage its own realm, such as for
5934/// binding to its children.
5935///
5936/// Requests to this protocol are processed in the order they are received.
5937/// Clients that wish to send requests in parallel should open multiple
5938/// connections.
5939///
5940/// The component framework provides this service to components that use
5941/// `fuchsia.component.Realm`.
5942#[derive(Debug)]
5943pub enum RealmRequest {
5944    /// Operate on a child component. See documentation for [`Controller`].
5945    ///
5946    /// Errors:
5947    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5948    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5949    /// - `INSTANCE_DIED`: This realm no longer exists.
5950    OpenController {
5951        child: fidl_fuchsia_component_decl::ChildRef,
5952        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5953        responder: RealmOpenControllerResponder,
5954    },
5955    /// Opens the exposed directory of a child component. When this function
5956    /// successfully returns, `exposed_dir` is bound to a directory that
5957    /// contains the capabilities which the child exposed to its realm via
5958    /// `ComponentDecl.exposes` (specified via "expose" declarations in the
5959    /// component's manifest). The child component will not start as a result of
5960    /// this call.
5961    ///
5962    /// `exposed_dir` is open as long as `child` exists.
5963    ///
5964    /// Errors:
5965    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5966    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5967    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
5968    /// - `INSTANCE_DIED`: This realm no longer exists.
5969    OpenExposedDir {
5970        child: fidl_fuchsia_component_decl::ChildRef,
5971        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5972        responder: RealmOpenExposedDirResponder,
5973    },
5974    /// Creates a child component instance dynamically. When this function
5975    /// returns successfully, the instance exists, but it may not be running.
5976    ///
5977    /// The environment of the child instance is determined by the environment
5978    /// of the collection. `decl` must not set `environment`.
5979    ///
5980    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
5981    /// [CreateChild] will start the component and return once the component is
5982    /// started. Otherwise, [CreateChild] will return immediately after creating
5983    /// the component and will not start or resolve it.
5984    ///
5985    /// Errors:
5986    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
5987    ///   is not a valid declaration.
5988    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5989    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
5990    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
5991    ///   in a `SingleRun` collection.
5992    /// - `NO_SPACE`: Could not allocate storage for the new instance.
5993    /// - `INSTANCE_DIED`: This realm no longer exists.
5994    CreateChild {
5995        collection: fidl_fuchsia_component_decl::CollectionRef,
5996        decl: fidl_fuchsia_component_decl::Child,
5997        args: CreateChildArgs,
5998        responder: RealmCreateChildResponder,
5999    },
6000    /// Destroys a dynamically-created component instance. When this function
6001    /// returns, the instance is destroyed and has stopped running.  However,
6002    /// cleanup of the component's resources (such as its isolated storage) may
6003    /// happen in the background after this function returns.
6004    ///
6005    /// Errors:
6006    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
6007    ///   to a dynamic instance.
6008    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
6009    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
6010    /// - `INSTANCE_DIED`: This realm no longer exists.
6011    DestroyChild {
6012        child: fidl_fuchsia_component_decl::ChildRef,
6013        responder: RealmDestroyChildResponder,
6014    },
6015    /// Returns an iterator that lists all instances in a collection.
6016    ///
6017    /// NOTE: The results are not guaranteed to be consistent. Instances may be
6018    /// created or destroyed while the iterator is live, but those changes
6019    /// won't be observed by the iterator after this method returns.
6020    ///
6021    /// Errors:
6022    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
6023    /// does not have `ZX_RIGHT_WAIT`.
6024    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
6025    /// - `INSTANCE_DIED`: This realm no longer exists.
6026    /// - If `iter` does not have standard channel rights, this function may
6027    ///   return `ACCESS_DENIED` or component manager may close `iter`.
6028    ListChildren {
6029        collection: fidl_fuchsia_component_decl::CollectionRef,
6030        iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
6031        responder: RealmListChildrenResponder,
6032    },
6033    /// Returns the set of information that was given to the component framework
6034    /// by this component's resolver.
6035    GetResolvedInfo { responder: RealmGetResolvedInfoResponder },
6036    GetChildOutputDictionaryDeprecated {
6037        child: fidl_fuchsia_component_decl::ChildRef,
6038        responder: RealmGetChildOutputDictionaryDeprecatedResponder,
6039    },
6040    /// Returns a reference to a child's output dictionary, which may be
6041    /// interacted with by using the fuchsia.component.runtime.Capabilities API.
6042    GetChildOutputDictionary {
6043        child: fidl_fuchsia_component_decl::ChildRef,
6044        responder: RealmGetChildOutputDictionaryResponder,
6045    },
6046}
6047
6048impl RealmRequest {
6049    #[allow(irrefutable_let_patterns)]
6050    pub fn into_open_controller(
6051        self,
6052    ) -> Option<(
6053        fidl_fuchsia_component_decl::ChildRef,
6054        fidl::endpoints::ServerEnd<ControllerMarker>,
6055        RealmOpenControllerResponder,
6056    )> {
6057        if let RealmRequest::OpenController { child, controller, responder } = self {
6058            Some((child, controller, responder))
6059        } else {
6060            None
6061        }
6062    }
6063
6064    #[allow(irrefutable_let_patterns)]
6065    pub fn into_open_exposed_dir(
6066        self,
6067    ) -> Option<(
6068        fidl_fuchsia_component_decl::ChildRef,
6069        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6070        RealmOpenExposedDirResponder,
6071    )> {
6072        if let RealmRequest::OpenExposedDir { child, exposed_dir, responder } = self {
6073            Some((child, exposed_dir, responder))
6074        } else {
6075            None
6076        }
6077    }
6078
6079    #[allow(irrefutable_let_patterns)]
6080    pub fn into_create_child(
6081        self,
6082    ) -> Option<(
6083        fidl_fuchsia_component_decl::CollectionRef,
6084        fidl_fuchsia_component_decl::Child,
6085        CreateChildArgs,
6086        RealmCreateChildResponder,
6087    )> {
6088        if let RealmRequest::CreateChild { collection, decl, args, responder } = self {
6089            Some((collection, decl, args, responder))
6090        } else {
6091            None
6092        }
6093    }
6094
6095    #[allow(irrefutable_let_patterns)]
6096    pub fn into_destroy_child(
6097        self,
6098    ) -> Option<(fidl_fuchsia_component_decl::ChildRef, RealmDestroyChildResponder)> {
6099        if let RealmRequest::DestroyChild { child, responder } = self {
6100            Some((child, responder))
6101        } else {
6102            None
6103        }
6104    }
6105
6106    #[allow(irrefutable_let_patterns)]
6107    pub fn into_list_children(
6108        self,
6109    ) -> Option<(
6110        fidl_fuchsia_component_decl::CollectionRef,
6111        fidl::endpoints::ServerEnd<ChildIteratorMarker>,
6112        RealmListChildrenResponder,
6113    )> {
6114        if let RealmRequest::ListChildren { collection, iter, responder } = self {
6115            Some((collection, iter, responder))
6116        } else {
6117            None
6118        }
6119    }
6120
6121    #[allow(irrefutable_let_patterns)]
6122    pub fn into_get_resolved_info(self) -> Option<(RealmGetResolvedInfoResponder)> {
6123        if let RealmRequest::GetResolvedInfo { responder } = self {
6124            Some((responder))
6125        } else {
6126            None
6127        }
6128    }
6129
6130    #[allow(irrefutable_let_patterns)]
6131    pub fn into_get_child_output_dictionary_deprecated(
6132        self,
6133    ) -> Option<(
6134        fidl_fuchsia_component_decl::ChildRef,
6135        RealmGetChildOutputDictionaryDeprecatedResponder,
6136    )> {
6137        if let RealmRequest::GetChildOutputDictionaryDeprecated { child, responder } = self {
6138            Some((child, responder))
6139        } else {
6140            None
6141        }
6142    }
6143
6144    #[allow(irrefutable_let_patterns)]
6145    pub fn into_get_child_output_dictionary(
6146        self,
6147    ) -> Option<(fidl_fuchsia_component_decl::ChildRef, RealmGetChildOutputDictionaryResponder)>
6148    {
6149        if let RealmRequest::GetChildOutputDictionary { child, responder } = self {
6150            Some((child, responder))
6151        } else {
6152            None
6153        }
6154    }
6155
6156    /// Name of the method defined in FIDL
6157    pub fn method_name(&self) -> &'static str {
6158        match *self {
6159            RealmRequest::OpenController { .. } => "open_controller",
6160            RealmRequest::OpenExposedDir { .. } => "open_exposed_dir",
6161            RealmRequest::CreateChild { .. } => "create_child",
6162            RealmRequest::DestroyChild { .. } => "destroy_child",
6163            RealmRequest::ListChildren { .. } => "list_children",
6164            RealmRequest::GetResolvedInfo { .. } => "get_resolved_info",
6165            RealmRequest::GetChildOutputDictionaryDeprecated { .. } => {
6166                "get_child_output_dictionary_deprecated"
6167            }
6168            RealmRequest::GetChildOutputDictionary { .. } => "get_child_output_dictionary",
6169        }
6170    }
6171}
6172
6173#[derive(Debug, Clone)]
6174pub struct RealmControlHandle {
6175    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6176}
6177
6178impl fidl::endpoints::ControlHandle for RealmControlHandle {
6179    fn shutdown(&self) {
6180        self.inner.shutdown()
6181    }
6182
6183    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6184        self.inner.shutdown_with_epitaph(status)
6185    }
6186
6187    fn is_closed(&self) -> bool {
6188        self.inner.channel().is_closed()
6189    }
6190    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6191        self.inner.channel().on_closed()
6192    }
6193
6194    #[cfg(target_os = "fuchsia")]
6195    fn signal_peer(
6196        &self,
6197        clear_mask: zx::Signals,
6198        set_mask: zx::Signals,
6199    ) -> Result<(), zx_status::Status> {
6200        use fidl::Peered;
6201        self.inner.channel().signal_peer(clear_mask, set_mask)
6202    }
6203}
6204
6205impl RealmControlHandle {}
6206
6207#[must_use = "FIDL methods require a response to be sent"]
6208#[derive(Debug)]
6209pub struct RealmOpenControllerResponder {
6210    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6211    tx_id: u32,
6212}
6213
6214/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6215/// if the responder is dropped without sending a response, so that the client
6216/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6217impl std::ops::Drop for RealmOpenControllerResponder {
6218    fn drop(&mut self) {
6219        self.control_handle.shutdown();
6220        // Safety: drops once, never accessed again
6221        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6222    }
6223}
6224
6225impl fidl::endpoints::Responder for RealmOpenControllerResponder {
6226    type ControlHandle = RealmControlHandle;
6227
6228    fn control_handle(&self) -> &RealmControlHandle {
6229        &self.control_handle
6230    }
6231
6232    fn drop_without_shutdown(mut self) {
6233        // Safety: drops once, never accessed again due to mem::forget
6234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6235        // Prevent Drop from running (which would shut down the channel)
6236        std::mem::forget(self);
6237    }
6238}
6239
6240impl RealmOpenControllerResponder {
6241    /// Sends a response to the FIDL transaction.
6242    ///
6243    /// Sets the channel to shutdown if an error occurs.
6244    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6245        let _result = self.send_raw(result);
6246        if _result.is_err() {
6247            self.control_handle.shutdown();
6248        }
6249        self.drop_without_shutdown();
6250        _result
6251    }
6252
6253    /// Similar to "send" but does not shutdown the channel if an error occurs.
6254    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6255        let _result = self.send_raw(result);
6256        self.drop_without_shutdown();
6257        _result
6258    }
6259
6260    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6261        self.control_handle
6262            .inner
6263            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6264                result,
6265                self.tx_id,
6266                0x7150b7898d1b1180,
6267                fidl::encoding::DynamicFlags::empty(),
6268            )
6269    }
6270}
6271
6272#[must_use = "FIDL methods require a response to be sent"]
6273#[derive(Debug)]
6274pub struct RealmOpenExposedDirResponder {
6275    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6276    tx_id: u32,
6277}
6278
6279/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6280/// if the responder is dropped without sending a response, so that the client
6281/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6282impl std::ops::Drop for RealmOpenExposedDirResponder {
6283    fn drop(&mut self) {
6284        self.control_handle.shutdown();
6285        // Safety: drops once, never accessed again
6286        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6287    }
6288}
6289
6290impl fidl::endpoints::Responder for RealmOpenExposedDirResponder {
6291    type ControlHandle = RealmControlHandle;
6292
6293    fn control_handle(&self) -> &RealmControlHandle {
6294        &self.control_handle
6295    }
6296
6297    fn drop_without_shutdown(mut self) {
6298        // Safety: drops once, never accessed again due to mem::forget
6299        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6300        // Prevent Drop from running (which would shut down the channel)
6301        std::mem::forget(self);
6302    }
6303}
6304
6305impl RealmOpenExposedDirResponder {
6306    /// Sends a response to the FIDL transaction.
6307    ///
6308    /// Sets the channel to shutdown if an error occurs.
6309    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6310        let _result = self.send_raw(result);
6311        if _result.is_err() {
6312            self.control_handle.shutdown();
6313        }
6314        self.drop_without_shutdown();
6315        _result
6316    }
6317
6318    /// Similar to "send" but does not shutdown the channel if an error occurs.
6319    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6320        let _result = self.send_raw(result);
6321        self.drop_without_shutdown();
6322        _result
6323    }
6324
6325    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6326        self.control_handle
6327            .inner
6328            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6329                result,
6330                self.tx_id,
6331                0x7f993235ca59f92c,
6332                fidl::encoding::DynamicFlags::empty(),
6333            )
6334    }
6335}
6336
6337#[must_use = "FIDL methods require a response to be sent"]
6338#[derive(Debug)]
6339pub struct RealmCreateChildResponder {
6340    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6341    tx_id: u32,
6342}
6343
6344/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6345/// if the responder is dropped without sending a response, so that the client
6346/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6347impl std::ops::Drop for RealmCreateChildResponder {
6348    fn drop(&mut self) {
6349        self.control_handle.shutdown();
6350        // Safety: drops once, never accessed again
6351        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6352    }
6353}
6354
6355impl fidl::endpoints::Responder for RealmCreateChildResponder {
6356    type ControlHandle = RealmControlHandle;
6357
6358    fn control_handle(&self) -> &RealmControlHandle {
6359        &self.control_handle
6360    }
6361
6362    fn drop_without_shutdown(mut self) {
6363        // Safety: drops once, never accessed again due to mem::forget
6364        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6365        // Prevent Drop from running (which would shut down the channel)
6366        std::mem::forget(self);
6367    }
6368}
6369
6370impl RealmCreateChildResponder {
6371    /// Sends a response to the FIDL transaction.
6372    ///
6373    /// Sets the channel to shutdown if an error occurs.
6374    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6375        let _result = self.send_raw(result);
6376        if _result.is_err() {
6377            self.control_handle.shutdown();
6378        }
6379        self.drop_without_shutdown();
6380        _result
6381    }
6382
6383    /// Similar to "send" but does not shutdown the channel if an error occurs.
6384    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6385        let _result = self.send_raw(result);
6386        self.drop_without_shutdown();
6387        _result
6388    }
6389
6390    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6391        self.control_handle
6392            .inner
6393            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6394                result,
6395                self.tx_id,
6396                0x43e48ce8483d7560,
6397                fidl::encoding::DynamicFlags::empty(),
6398            )
6399    }
6400}
6401
6402#[must_use = "FIDL methods require a response to be sent"]
6403#[derive(Debug)]
6404pub struct RealmDestroyChildResponder {
6405    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6406    tx_id: u32,
6407}
6408
6409/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6410/// if the responder is dropped without sending a response, so that the client
6411/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6412impl std::ops::Drop for RealmDestroyChildResponder {
6413    fn drop(&mut self) {
6414        self.control_handle.shutdown();
6415        // Safety: drops once, never accessed again
6416        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6417    }
6418}
6419
6420impl fidl::endpoints::Responder for RealmDestroyChildResponder {
6421    type ControlHandle = RealmControlHandle;
6422
6423    fn control_handle(&self) -> &RealmControlHandle {
6424        &self.control_handle
6425    }
6426
6427    fn drop_without_shutdown(mut self) {
6428        // Safety: drops once, never accessed again due to mem::forget
6429        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6430        // Prevent Drop from running (which would shut down the channel)
6431        std::mem::forget(self);
6432    }
6433}
6434
6435impl RealmDestroyChildResponder {
6436    /// Sends a response to the FIDL transaction.
6437    ///
6438    /// Sets the channel to shutdown if an error occurs.
6439    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6440        let _result = self.send_raw(result);
6441        if _result.is_err() {
6442            self.control_handle.shutdown();
6443        }
6444        self.drop_without_shutdown();
6445        _result
6446    }
6447
6448    /// Similar to "send" but does not shutdown the channel if an error occurs.
6449    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6450        let _result = self.send_raw(result);
6451        self.drop_without_shutdown();
6452        _result
6453    }
6454
6455    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6456        self.control_handle
6457            .inner
6458            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6459                result,
6460                self.tx_id,
6461                0x71d8caf8850c9222,
6462                fidl::encoding::DynamicFlags::empty(),
6463            )
6464    }
6465}
6466
6467#[must_use = "FIDL methods require a response to be sent"]
6468#[derive(Debug)]
6469pub struct RealmListChildrenResponder {
6470    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6471    tx_id: u32,
6472}
6473
6474/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6475/// if the responder is dropped without sending a response, so that the client
6476/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6477impl std::ops::Drop for RealmListChildrenResponder {
6478    fn drop(&mut self) {
6479        self.control_handle.shutdown();
6480        // Safety: drops once, never accessed again
6481        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6482    }
6483}
6484
6485impl fidl::endpoints::Responder for RealmListChildrenResponder {
6486    type ControlHandle = RealmControlHandle;
6487
6488    fn control_handle(&self) -> &RealmControlHandle {
6489        &self.control_handle
6490    }
6491
6492    fn drop_without_shutdown(mut self) {
6493        // Safety: drops once, never accessed again due to mem::forget
6494        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6495        // Prevent Drop from running (which would shut down the channel)
6496        std::mem::forget(self);
6497    }
6498}
6499
6500impl RealmListChildrenResponder {
6501    /// Sends a response to the FIDL transaction.
6502    ///
6503    /// Sets the channel to shutdown if an error occurs.
6504    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6505        let _result = self.send_raw(result);
6506        if _result.is_err() {
6507            self.control_handle.shutdown();
6508        }
6509        self.drop_without_shutdown();
6510        _result
6511    }
6512
6513    /// Similar to "send" but does not shutdown the channel if an error occurs.
6514    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6515        let _result = self.send_raw(result);
6516        self.drop_without_shutdown();
6517        _result
6518    }
6519
6520    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6521        self.control_handle
6522            .inner
6523            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6524                result,
6525                self.tx_id,
6526                0x6888a76683efc0a1,
6527                fidl::encoding::DynamicFlags::empty(),
6528            )
6529    }
6530}
6531
6532#[must_use = "FIDL methods require a response to be sent"]
6533#[derive(Debug)]
6534pub struct RealmGetResolvedInfoResponder {
6535    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6536    tx_id: u32,
6537}
6538
6539/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6540/// if the responder is dropped without sending a response, so that the client
6541/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6542impl std::ops::Drop for RealmGetResolvedInfoResponder {
6543    fn drop(&mut self) {
6544        self.control_handle.shutdown();
6545        // Safety: drops once, never accessed again
6546        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6547    }
6548}
6549
6550impl fidl::endpoints::Responder for RealmGetResolvedInfoResponder {
6551    type ControlHandle = RealmControlHandle;
6552
6553    fn control_handle(&self) -> &RealmControlHandle {
6554        &self.control_handle
6555    }
6556
6557    fn drop_without_shutdown(mut self) {
6558        // Safety: drops once, never accessed again due to mem::forget
6559        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6560        // Prevent Drop from running (which would shut down the channel)
6561        std::mem::forget(self);
6562    }
6563}
6564
6565impl RealmGetResolvedInfoResponder {
6566    /// Sends a response to the FIDL transaction.
6567    ///
6568    /// Sets the channel to shutdown if an error occurs.
6569    pub fn send(
6570        self,
6571        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
6572    ) -> Result<(), fidl::Error> {
6573        let _result = self.send_raw(result);
6574        if _result.is_err() {
6575            self.control_handle.shutdown();
6576        }
6577        self.drop_without_shutdown();
6578        _result
6579    }
6580
6581    /// Similar to "send" but does not shutdown the channel if an error occurs.
6582    pub fn send_no_shutdown_on_err(
6583        self,
6584        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
6585    ) -> Result<(), fidl::Error> {
6586        let _result = self.send_raw(result);
6587        self.drop_without_shutdown();
6588        _result
6589    }
6590
6591    fn send_raw(
6592        &self,
6593        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
6594    ) -> Result<(), fidl::Error> {
6595        self.control_handle
6596            .inner
6597            .send::<fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>>(
6598                result.as_mut().map_err(|e| *e).map(|resolved_info| (resolved_info,)),
6599                self.tx_id,
6600                0x734f744cb7d210a2,
6601                fidl::encoding::DynamicFlags::empty(),
6602            )
6603    }
6604}
6605
6606#[must_use = "FIDL methods require a response to be sent"]
6607#[derive(Debug)]
6608pub struct RealmGetChildOutputDictionaryDeprecatedResponder {
6609    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6610    tx_id: u32,
6611}
6612
6613/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6614/// if the responder is dropped without sending a response, so that the client
6615/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6616impl std::ops::Drop for RealmGetChildOutputDictionaryDeprecatedResponder {
6617    fn drop(&mut self) {
6618        self.control_handle.shutdown();
6619        // Safety: drops once, never accessed again
6620        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6621    }
6622}
6623
6624impl fidl::endpoints::Responder for RealmGetChildOutputDictionaryDeprecatedResponder {
6625    type ControlHandle = RealmControlHandle;
6626
6627    fn control_handle(&self) -> &RealmControlHandle {
6628        &self.control_handle
6629    }
6630
6631    fn drop_without_shutdown(mut self) {
6632        // Safety: drops once, never accessed again due to mem::forget
6633        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6634        // Prevent Drop from running (which would shut down the channel)
6635        std::mem::forget(self);
6636    }
6637}
6638
6639impl RealmGetChildOutputDictionaryDeprecatedResponder {
6640    /// Sends a response to the FIDL transaction.
6641    ///
6642    /// Sets the channel to shutdown if an error occurs.
6643    pub fn send(
6644        self,
6645        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
6646    ) -> Result<(), fidl::Error> {
6647        let _result = self.send_raw(result);
6648        if _result.is_err() {
6649            self.control_handle.shutdown();
6650        }
6651        self.drop_without_shutdown();
6652        _result
6653    }
6654
6655    /// Similar to "send" but does not shutdown the channel if an error occurs.
6656    pub fn send_no_shutdown_on_err(
6657        self,
6658        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
6659    ) -> Result<(), fidl::Error> {
6660        let _result = self.send_raw(result);
6661        self.drop_without_shutdown();
6662        _result
6663    }
6664
6665    fn send_raw(
6666        &self,
6667        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
6668    ) -> Result<(), fidl::Error> {
6669        self.control_handle.inner.send::<fidl::encoding::ResultType<
6670            RealmGetChildOutputDictionaryDeprecatedResponse,
6671            Error,
6672        >>(
6673            result.as_mut().map_err(|e| *e).map(|dictionary| (dictionary,)),
6674            self.tx_id,
6675            0x39245b02aba94364,
6676            fidl::encoding::DynamicFlags::empty(),
6677        )
6678    }
6679}
6680
6681#[must_use = "FIDL methods require a response to be sent"]
6682#[derive(Debug)]
6683pub struct RealmGetChildOutputDictionaryResponder {
6684    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
6685    tx_id: u32,
6686}
6687
6688/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
6689/// if the responder is dropped without sending a response, so that the client
6690/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6691impl std::ops::Drop for RealmGetChildOutputDictionaryResponder {
6692    fn drop(&mut self) {
6693        self.control_handle.shutdown();
6694        // Safety: drops once, never accessed again
6695        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6696    }
6697}
6698
6699impl fidl::endpoints::Responder for RealmGetChildOutputDictionaryResponder {
6700    type ControlHandle = RealmControlHandle;
6701
6702    fn control_handle(&self) -> &RealmControlHandle {
6703        &self.control_handle
6704    }
6705
6706    fn drop_without_shutdown(mut self) {
6707        // Safety: drops once, never accessed again due to mem::forget
6708        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6709        // Prevent Drop from running (which would shut down the channel)
6710        std::mem::forget(self);
6711    }
6712}
6713
6714impl RealmGetChildOutputDictionaryResponder {
6715    /// Sends a response to the FIDL transaction.
6716    ///
6717    /// Sets the channel to shutdown if an error occurs.
6718    pub fn send(self, mut result: Result<fidl::EventPair, Error>) -> Result<(), fidl::Error> {
6719        let _result = self.send_raw(result);
6720        if _result.is_err() {
6721            self.control_handle.shutdown();
6722        }
6723        self.drop_without_shutdown();
6724        _result
6725    }
6726
6727    /// Similar to "send" but does not shutdown the channel if an error occurs.
6728    pub fn send_no_shutdown_on_err(
6729        self,
6730        mut result: Result<fidl::EventPair, Error>,
6731    ) -> Result<(), fidl::Error> {
6732        let _result = self.send_raw(result);
6733        self.drop_without_shutdown();
6734        _result
6735    }
6736
6737    fn send_raw(&self, mut result: Result<fidl::EventPair, Error>) -> Result<(), fidl::Error> {
6738        self.control_handle.inner.send::<fidl::encoding::ResultType<
6739            RealmGetChildOutputDictionaryResponse,
6740            Error,
6741        >>(
6742            result.map(|dictionary| (dictionary,)),
6743            self.tx_id,
6744            0x4259d08d261d5610,
6745            fidl::encoding::DynamicFlags::empty(),
6746        )
6747    }
6748}
6749
6750#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6751pub struct StorageAdminMarker;
6752
6753impl fidl::endpoints::ProtocolMarker for StorageAdminMarker {
6754    type Proxy = StorageAdminProxy;
6755    type RequestStream = StorageAdminRequestStream;
6756    #[cfg(target_os = "fuchsia")]
6757    type SynchronousProxy = StorageAdminSynchronousProxy;
6758
6759    const DEBUG_NAME: &'static str = "fuchsia.component.StorageAdmin";
6760}
6761impl fidl::endpoints::DiscoverableProtocolMarker for StorageAdminMarker {}
6762pub type StorageAdminOpenStorageResult = Result<(), Error>;
6763pub type StorageAdminListStorageInRealmResult = Result<(), Error>;
6764pub type StorageAdminOpenComponentStorageByIdResult = Result<(), Error>;
6765pub type StorageAdminDeleteComponentStorageResult = Result<(), Error>;
6766pub type StorageAdminGetStatusResult = Result<StorageStatus, StatusError>;
6767pub type StorageAdminDeleteAllStorageContentsResult = Result<(), DeletionError>;
6768
6769pub trait StorageAdminProxyInterface: Send + Sync {
6770    type OpenStorageResponseFut: std::future::Future<Output = Result<StorageAdminOpenStorageResult, fidl::Error>>
6771        + Send;
6772    fn r#open_storage(
6773        &self,
6774        relative_moniker: &str,
6775        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6776    ) -> Self::OpenStorageResponseFut;
6777    type ListStorageInRealmResponseFut: std::future::Future<Output = Result<StorageAdminListStorageInRealmResult, fidl::Error>>
6778        + Send;
6779    fn r#list_storage_in_realm(
6780        &self,
6781        relative_moniker: &str,
6782        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6783    ) -> Self::ListStorageInRealmResponseFut;
6784    type OpenComponentStorageByIdResponseFut: std::future::Future<
6785            Output = Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error>,
6786        > + Send;
6787    fn r#open_component_storage_by_id(
6788        &self,
6789        id: &str,
6790        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6791    ) -> Self::OpenComponentStorageByIdResponseFut;
6792    type DeleteComponentStorageResponseFut: std::future::Future<Output = Result<StorageAdminDeleteComponentStorageResult, fidl::Error>>
6793        + Send;
6794    fn r#delete_component_storage(
6795        &self,
6796        relative_moniker: &str,
6797    ) -> Self::DeleteComponentStorageResponseFut;
6798    type GetStatusResponseFut: std::future::Future<Output = Result<StorageAdminGetStatusResult, fidl::Error>>
6799        + Send;
6800    fn r#get_status(&self) -> Self::GetStatusResponseFut;
6801    type DeleteAllStorageContentsResponseFut: std::future::Future<
6802            Output = Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error>,
6803        > + Send;
6804    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut;
6805}
6806#[derive(Debug)]
6807#[cfg(target_os = "fuchsia")]
6808pub struct StorageAdminSynchronousProxy {
6809    client: fidl::client::sync::Client,
6810}
6811
6812#[cfg(target_os = "fuchsia")]
6813impl fidl::endpoints::SynchronousProxy for StorageAdminSynchronousProxy {
6814    type Proxy = StorageAdminProxy;
6815    type Protocol = StorageAdminMarker;
6816
6817    fn from_channel(inner: fidl::Channel) -> Self {
6818        Self::new(inner)
6819    }
6820
6821    fn into_channel(self) -> fidl::Channel {
6822        self.client.into_channel()
6823    }
6824
6825    fn as_channel(&self) -> &fidl::Channel {
6826        self.client.as_channel()
6827    }
6828}
6829
6830#[cfg(target_os = "fuchsia")]
6831impl StorageAdminSynchronousProxy {
6832    pub fn new(channel: fidl::Channel) -> Self {
6833        Self { client: fidl::client::sync::Client::new(channel) }
6834    }
6835
6836    pub fn into_channel(self) -> fidl::Channel {
6837        self.client.into_channel()
6838    }
6839
6840    /// Waits until an event arrives and returns it. It is safe for other
6841    /// threads to make concurrent requests while waiting for an event.
6842    pub fn wait_for_event(
6843        &self,
6844        deadline: zx::MonotonicInstant,
6845    ) -> Result<StorageAdminEvent, fidl::Error> {
6846        StorageAdminEvent::decode(self.client.wait_for_event::<StorageAdminMarker>(deadline)?)
6847    }
6848
6849    /// Opens the isolated directory for the given component. The provided
6850    /// moniker is relative to the component that declares the storage
6851    /// capability. Creates the backing sub-directory for this storage if it
6852    /// hasn't yet been created.
6853    pub fn r#open_storage(
6854        &self,
6855        mut relative_moniker: &str,
6856        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6857        ___deadline: zx::MonotonicInstant,
6858    ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
6859        let _response = self.client.send_query::<
6860            StorageAdminOpenStorageRequest,
6861            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6862            StorageAdminMarker,
6863        >(
6864            (relative_moniker, object,),
6865            0x6ceaa5904cfe4377,
6866            fidl::encoding::DynamicFlags::empty(),
6867            ___deadline,
6868        )?;
6869        Ok(_response.map(|x| x))
6870    }
6871
6872    /// Lists the descendant components under the specified realm that use the
6873    /// storage capability. The provided moniker is relative to the component
6874    /// that declares the storage capability.
6875    ///
6876    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
6877    /// if |relative_moniker| is malformed.
6878    pub fn r#list_storage_in_realm(
6879        &self,
6880        mut relative_moniker: &str,
6881        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6882        ___deadline: zx::MonotonicInstant,
6883    ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
6884        let _response = self.client.send_query::<
6885            StorageAdminListStorageInRealmRequest,
6886            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6887            StorageAdminMarker,
6888        >(
6889            (relative_moniker, iterator,),
6890            0x764f6d1f083e8bfb,
6891            fidl::encoding::DynamicFlags::empty(),
6892            ___deadline,
6893        )?;
6894        Ok(_response.map(|x| x))
6895    }
6896
6897    /// Opens the isolated directory for the given storage ID. Creates the
6898    /// backing sub-directory for this storage if it hasn't yet been created.
6899    pub fn r#open_component_storage_by_id(
6900        &self,
6901        mut id: &str,
6902        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6903        ___deadline: zx::MonotonicInstant,
6904    ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
6905        let _response = self.client.send_query::<
6906            StorageAdminOpenComponentStorageByIdRequest,
6907            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6908            StorageAdminMarker,
6909        >(
6910            (id, object,),
6911            0x4802102cc55d5df1,
6912            fidl::encoding::DynamicFlags::empty(),
6913            ___deadline,
6914        )?;
6915        Ok(_response.map(|x| x))
6916    }
6917
6918    /// Deletes the contents of the storage for this component. Preserves the
6919    /// component's subdirectory itself within the storage backing directory.
6920    /// The provided moniker is relative to the component that declares the
6921    /// storage capability.
6922    pub fn r#delete_component_storage(
6923        &self,
6924        mut relative_moniker: &str,
6925        ___deadline: zx::MonotonicInstant,
6926    ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
6927        let _response = self.client.send_query::<
6928            StorageAdminDeleteComponentStorageRequest,
6929            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6930            StorageAdminMarker,
6931        >(
6932            (relative_moniker,),
6933            0x1677c1cdfcdbf45a,
6934            fidl::encoding::DynamicFlags::empty(),
6935            ___deadline,
6936        )?;
6937        Ok(_response.map(|x| x))
6938    }
6939
6940    /// Get the current status of the storage.
6941    pub fn r#get_status(
6942        &self,
6943        ___deadline: zx::MonotonicInstant,
6944    ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
6945        let _response = self.client.send_query::<
6946            fidl::encoding::EmptyPayload,
6947            fidl::encoding::ResultType<StorageStatus, StatusError>,
6948            StorageAdminMarker,
6949        >(
6950            (),
6951            0x7729e325a6c526c8,
6952            fidl::encoding::DynamicFlags::empty(),
6953            ___deadline,
6954        )?;
6955        Ok(_response.map(|x| x))
6956    }
6957
6958    /// Deletes the contents of all the storage. Storage directories are
6959    /// retained so any components using storage will be able to continue using
6960    /// it to create new files and directories.
6961    ///
6962    /// Returns Error::INTERNAL only if no storage at all could be cleared.
6963    /// Returns successfully even if some errors happen during the deletion
6964    /// progress.
6965    pub fn r#delete_all_storage_contents(
6966        &self,
6967        ___deadline: zx::MonotonicInstant,
6968    ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
6969        let _response = self.client.send_query::<
6970            fidl::encoding::EmptyPayload,
6971            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
6972            StorageAdminMarker,
6973        >(
6974            (),
6975            0x2ee980b4b2d24adb,
6976            fidl::encoding::DynamicFlags::empty(),
6977            ___deadline,
6978        )?;
6979        Ok(_response.map(|x| x))
6980    }
6981}
6982
6983#[cfg(target_os = "fuchsia")]
6984impl From<StorageAdminSynchronousProxy> for zx::NullableHandle {
6985    fn from(value: StorageAdminSynchronousProxy) -> Self {
6986        value.into_channel().into()
6987    }
6988}
6989
6990#[cfg(target_os = "fuchsia")]
6991impl From<fidl::Channel> for StorageAdminSynchronousProxy {
6992    fn from(value: fidl::Channel) -> Self {
6993        Self::new(value)
6994    }
6995}
6996
6997#[cfg(target_os = "fuchsia")]
6998impl fidl::endpoints::FromClient for StorageAdminSynchronousProxy {
6999    type Protocol = StorageAdminMarker;
7000
7001    fn from_client(value: fidl::endpoints::ClientEnd<StorageAdminMarker>) -> Self {
7002        Self::new(value.into_channel())
7003    }
7004}
7005
7006#[derive(Debug, Clone)]
7007pub struct StorageAdminProxy {
7008    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7009}
7010
7011impl fidl::endpoints::Proxy for StorageAdminProxy {
7012    type Protocol = StorageAdminMarker;
7013
7014    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7015        Self::new(inner)
7016    }
7017
7018    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7019        self.client.into_channel().map_err(|client| Self { client })
7020    }
7021
7022    fn as_channel(&self) -> &::fidl::AsyncChannel {
7023        self.client.as_channel()
7024    }
7025}
7026
7027impl StorageAdminProxy {
7028    /// Create a new Proxy for fuchsia.component/StorageAdmin.
7029    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7030        let protocol_name = <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7031        Self { client: fidl::client::Client::new(channel, protocol_name) }
7032    }
7033
7034    /// Get a Stream of events from the remote end of the protocol.
7035    ///
7036    /// # Panics
7037    ///
7038    /// Panics if the event stream was already taken.
7039    pub fn take_event_stream(&self) -> StorageAdminEventStream {
7040        StorageAdminEventStream { event_receiver: self.client.take_event_receiver() }
7041    }
7042
7043    /// Opens the isolated directory for the given component. The provided
7044    /// moniker is relative to the component that declares the storage
7045    /// capability. Creates the backing sub-directory for this storage if it
7046    /// hasn't yet been created.
7047    pub fn r#open_storage(
7048        &self,
7049        mut relative_moniker: &str,
7050        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7051    ) -> fidl::client::QueryResponseFut<
7052        StorageAdminOpenStorageResult,
7053        fidl::encoding::DefaultFuchsiaResourceDialect,
7054    > {
7055        StorageAdminProxyInterface::r#open_storage(self, relative_moniker, object)
7056    }
7057
7058    /// Lists the descendant components under the specified realm that use the
7059    /// storage capability. The provided moniker is relative to the component
7060    /// that declares the storage capability.
7061    ///
7062    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
7063    /// if |relative_moniker| is malformed.
7064    pub fn r#list_storage_in_realm(
7065        &self,
7066        mut relative_moniker: &str,
7067        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7068    ) -> fidl::client::QueryResponseFut<
7069        StorageAdminListStorageInRealmResult,
7070        fidl::encoding::DefaultFuchsiaResourceDialect,
7071    > {
7072        StorageAdminProxyInterface::r#list_storage_in_realm(self, relative_moniker, iterator)
7073    }
7074
7075    /// Opens the isolated directory for the given storage ID. Creates the
7076    /// backing sub-directory for this storage if it hasn't yet been created.
7077    pub fn r#open_component_storage_by_id(
7078        &self,
7079        mut id: &str,
7080        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7081    ) -> fidl::client::QueryResponseFut<
7082        StorageAdminOpenComponentStorageByIdResult,
7083        fidl::encoding::DefaultFuchsiaResourceDialect,
7084    > {
7085        StorageAdminProxyInterface::r#open_component_storage_by_id(self, id, object)
7086    }
7087
7088    /// Deletes the contents of the storage for this component. Preserves the
7089    /// component's subdirectory itself within the storage backing directory.
7090    /// The provided moniker is relative to the component that declares the
7091    /// storage capability.
7092    pub fn r#delete_component_storage(
7093        &self,
7094        mut relative_moniker: &str,
7095    ) -> fidl::client::QueryResponseFut<
7096        StorageAdminDeleteComponentStorageResult,
7097        fidl::encoding::DefaultFuchsiaResourceDialect,
7098    > {
7099        StorageAdminProxyInterface::r#delete_component_storage(self, relative_moniker)
7100    }
7101
7102    /// Get the current status of the storage.
7103    pub fn r#get_status(
7104        &self,
7105    ) -> fidl::client::QueryResponseFut<
7106        StorageAdminGetStatusResult,
7107        fidl::encoding::DefaultFuchsiaResourceDialect,
7108    > {
7109        StorageAdminProxyInterface::r#get_status(self)
7110    }
7111
7112    /// Deletes the contents of all the storage. Storage directories are
7113    /// retained so any components using storage will be able to continue using
7114    /// it to create new files and directories.
7115    ///
7116    /// Returns Error::INTERNAL only if no storage at all could be cleared.
7117    /// Returns successfully even if some errors happen during the deletion
7118    /// progress.
7119    pub fn r#delete_all_storage_contents(
7120        &self,
7121    ) -> fidl::client::QueryResponseFut<
7122        StorageAdminDeleteAllStorageContentsResult,
7123        fidl::encoding::DefaultFuchsiaResourceDialect,
7124    > {
7125        StorageAdminProxyInterface::r#delete_all_storage_contents(self)
7126    }
7127}
7128
7129impl StorageAdminProxyInterface for StorageAdminProxy {
7130    type OpenStorageResponseFut = fidl::client::QueryResponseFut<
7131        StorageAdminOpenStorageResult,
7132        fidl::encoding::DefaultFuchsiaResourceDialect,
7133    >;
7134    fn r#open_storage(
7135        &self,
7136        mut relative_moniker: &str,
7137        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7138    ) -> Self::OpenStorageResponseFut {
7139        fn _decode(
7140            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7141        ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
7142            let _response = fidl::client::decode_transaction_body::<
7143                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7144                fidl::encoding::DefaultFuchsiaResourceDialect,
7145                0x6ceaa5904cfe4377,
7146            >(_buf?)?;
7147            Ok(_response.map(|x| x))
7148        }
7149        self.client
7150            .send_query_and_decode::<StorageAdminOpenStorageRequest, StorageAdminOpenStorageResult>(
7151                (relative_moniker, object),
7152                0x6ceaa5904cfe4377,
7153                fidl::encoding::DynamicFlags::empty(),
7154                _decode,
7155            )
7156    }
7157
7158    type ListStorageInRealmResponseFut = fidl::client::QueryResponseFut<
7159        StorageAdminListStorageInRealmResult,
7160        fidl::encoding::DefaultFuchsiaResourceDialect,
7161    >;
7162    fn r#list_storage_in_realm(
7163        &self,
7164        mut relative_moniker: &str,
7165        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7166    ) -> Self::ListStorageInRealmResponseFut {
7167        fn _decode(
7168            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7169        ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
7170            let _response = fidl::client::decode_transaction_body::<
7171                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7172                fidl::encoding::DefaultFuchsiaResourceDialect,
7173                0x764f6d1f083e8bfb,
7174            >(_buf?)?;
7175            Ok(_response.map(|x| x))
7176        }
7177        self.client.send_query_and_decode::<
7178            StorageAdminListStorageInRealmRequest,
7179            StorageAdminListStorageInRealmResult,
7180        >(
7181            (relative_moniker, iterator,),
7182            0x764f6d1f083e8bfb,
7183            fidl::encoding::DynamicFlags::empty(),
7184            _decode,
7185        )
7186    }
7187
7188    type OpenComponentStorageByIdResponseFut = fidl::client::QueryResponseFut<
7189        StorageAdminOpenComponentStorageByIdResult,
7190        fidl::encoding::DefaultFuchsiaResourceDialect,
7191    >;
7192    fn r#open_component_storage_by_id(
7193        &self,
7194        mut id: &str,
7195        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7196    ) -> Self::OpenComponentStorageByIdResponseFut {
7197        fn _decode(
7198            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7199        ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
7200            let _response = fidl::client::decode_transaction_body::<
7201                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7202                fidl::encoding::DefaultFuchsiaResourceDialect,
7203                0x4802102cc55d5df1,
7204            >(_buf?)?;
7205            Ok(_response.map(|x| x))
7206        }
7207        self.client.send_query_and_decode::<
7208            StorageAdminOpenComponentStorageByIdRequest,
7209            StorageAdminOpenComponentStorageByIdResult,
7210        >(
7211            (id, object,),
7212            0x4802102cc55d5df1,
7213            fidl::encoding::DynamicFlags::empty(),
7214            _decode,
7215        )
7216    }
7217
7218    type DeleteComponentStorageResponseFut = fidl::client::QueryResponseFut<
7219        StorageAdminDeleteComponentStorageResult,
7220        fidl::encoding::DefaultFuchsiaResourceDialect,
7221    >;
7222    fn r#delete_component_storage(
7223        &self,
7224        mut relative_moniker: &str,
7225    ) -> Self::DeleteComponentStorageResponseFut {
7226        fn _decode(
7227            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7228        ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
7229            let _response = fidl::client::decode_transaction_body::<
7230                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
7231                fidl::encoding::DefaultFuchsiaResourceDialect,
7232                0x1677c1cdfcdbf45a,
7233            >(_buf?)?;
7234            Ok(_response.map(|x| x))
7235        }
7236        self.client.send_query_and_decode::<
7237            StorageAdminDeleteComponentStorageRequest,
7238            StorageAdminDeleteComponentStorageResult,
7239        >(
7240            (relative_moniker,),
7241            0x1677c1cdfcdbf45a,
7242            fidl::encoding::DynamicFlags::empty(),
7243            _decode,
7244        )
7245    }
7246
7247    type GetStatusResponseFut = fidl::client::QueryResponseFut<
7248        StorageAdminGetStatusResult,
7249        fidl::encoding::DefaultFuchsiaResourceDialect,
7250    >;
7251    fn r#get_status(&self) -> Self::GetStatusResponseFut {
7252        fn _decode(
7253            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7254        ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
7255            let _response = fidl::client::decode_transaction_body::<
7256                fidl::encoding::ResultType<StorageStatus, StatusError>,
7257                fidl::encoding::DefaultFuchsiaResourceDialect,
7258                0x7729e325a6c526c8,
7259            >(_buf?)?;
7260            Ok(_response.map(|x| x))
7261        }
7262        self.client
7263            .send_query_and_decode::<fidl::encoding::EmptyPayload, StorageAdminGetStatusResult>(
7264                (),
7265                0x7729e325a6c526c8,
7266                fidl::encoding::DynamicFlags::empty(),
7267                _decode,
7268            )
7269    }
7270
7271    type DeleteAllStorageContentsResponseFut = fidl::client::QueryResponseFut<
7272        StorageAdminDeleteAllStorageContentsResult,
7273        fidl::encoding::DefaultFuchsiaResourceDialect,
7274    >;
7275    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut {
7276        fn _decode(
7277            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7278        ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
7279            let _response = fidl::client::decode_transaction_body::<
7280                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
7281                fidl::encoding::DefaultFuchsiaResourceDialect,
7282                0x2ee980b4b2d24adb,
7283            >(_buf?)?;
7284            Ok(_response.map(|x| x))
7285        }
7286        self.client.send_query_and_decode::<
7287            fidl::encoding::EmptyPayload,
7288            StorageAdminDeleteAllStorageContentsResult,
7289        >(
7290            (),
7291            0x2ee980b4b2d24adb,
7292            fidl::encoding::DynamicFlags::empty(),
7293            _decode,
7294        )
7295    }
7296}
7297
7298pub struct StorageAdminEventStream {
7299    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7300}
7301
7302impl std::marker::Unpin for StorageAdminEventStream {}
7303
7304impl futures::stream::FusedStream for StorageAdminEventStream {
7305    fn is_terminated(&self) -> bool {
7306        self.event_receiver.is_terminated()
7307    }
7308}
7309
7310impl futures::Stream for StorageAdminEventStream {
7311    type Item = Result<StorageAdminEvent, fidl::Error>;
7312
7313    fn poll_next(
7314        mut self: std::pin::Pin<&mut Self>,
7315        cx: &mut std::task::Context<'_>,
7316    ) -> std::task::Poll<Option<Self::Item>> {
7317        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7318            &mut self.event_receiver,
7319            cx
7320        )?) {
7321            Some(buf) => std::task::Poll::Ready(Some(StorageAdminEvent::decode(buf))),
7322            None => std::task::Poll::Ready(None),
7323        }
7324    }
7325}
7326
7327#[derive(Debug)]
7328pub enum StorageAdminEvent {}
7329
7330impl StorageAdminEvent {
7331    /// Decodes a message buffer as a [`StorageAdminEvent`].
7332    fn decode(
7333        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7334    ) -> Result<StorageAdminEvent, fidl::Error> {
7335        let (bytes, _handles) = buf.split_mut();
7336        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7337        debug_assert_eq!(tx_header.tx_id, 0);
7338        match tx_header.ordinal {
7339            _ => Err(fidl::Error::UnknownOrdinal {
7340                ordinal: tx_header.ordinal,
7341                protocol_name: <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7342            }),
7343        }
7344    }
7345}
7346
7347/// A Stream of incoming requests for fuchsia.component/StorageAdmin.
7348pub struct StorageAdminRequestStream {
7349    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7350    is_terminated: bool,
7351}
7352
7353impl std::marker::Unpin for StorageAdminRequestStream {}
7354
7355impl futures::stream::FusedStream for StorageAdminRequestStream {
7356    fn is_terminated(&self) -> bool {
7357        self.is_terminated
7358    }
7359}
7360
7361impl fidl::endpoints::RequestStream for StorageAdminRequestStream {
7362    type Protocol = StorageAdminMarker;
7363    type ControlHandle = StorageAdminControlHandle;
7364
7365    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7366        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7367    }
7368
7369    fn control_handle(&self) -> Self::ControlHandle {
7370        StorageAdminControlHandle { inner: self.inner.clone() }
7371    }
7372
7373    fn into_inner(
7374        self,
7375    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7376    {
7377        (self.inner, self.is_terminated)
7378    }
7379
7380    fn from_inner(
7381        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7382        is_terminated: bool,
7383    ) -> Self {
7384        Self { inner, is_terminated }
7385    }
7386}
7387
7388impl futures::Stream for StorageAdminRequestStream {
7389    type Item = Result<StorageAdminRequest, fidl::Error>;
7390
7391    fn poll_next(
7392        mut self: std::pin::Pin<&mut Self>,
7393        cx: &mut std::task::Context<'_>,
7394    ) -> std::task::Poll<Option<Self::Item>> {
7395        let this = &mut *self;
7396        if this.inner.check_shutdown(cx) {
7397            this.is_terminated = true;
7398            return std::task::Poll::Ready(None);
7399        }
7400        if this.is_terminated {
7401            panic!("polled StorageAdminRequestStream after completion");
7402        }
7403        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7404            |bytes, handles| {
7405                match this.inner.channel().read_etc(cx, bytes, handles) {
7406                    std::task::Poll::Ready(Ok(())) => {}
7407                    std::task::Poll::Pending => return std::task::Poll::Pending,
7408                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7409                        this.is_terminated = true;
7410                        return std::task::Poll::Ready(None);
7411                    }
7412                    std::task::Poll::Ready(Err(e)) => {
7413                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7414                            e.into(),
7415                        ))));
7416                    }
7417                }
7418
7419                // A message has been received from the channel
7420                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7421
7422                std::task::Poll::Ready(Some(match header.ordinal {
7423                    0x6ceaa5904cfe4377 => {
7424                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7425                        let mut req = fidl::new_empty!(
7426                            StorageAdminOpenStorageRequest,
7427                            fidl::encoding::DefaultFuchsiaResourceDialect
7428                        );
7429                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenStorageRequest>(&header, _body_bytes, handles, &mut req)?;
7430                        let control_handle =
7431                            StorageAdminControlHandle { inner: this.inner.clone() };
7432                        Ok(StorageAdminRequest::OpenStorage {
7433                            relative_moniker: req.relative_moniker,
7434                            object: req.object,
7435
7436                            responder: StorageAdminOpenStorageResponder {
7437                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7438                                tx_id: header.tx_id,
7439                            },
7440                        })
7441                    }
7442                    0x764f6d1f083e8bfb => {
7443                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7444                        let mut req = fidl::new_empty!(
7445                            StorageAdminListStorageInRealmRequest,
7446                            fidl::encoding::DefaultFuchsiaResourceDialect
7447                        );
7448                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminListStorageInRealmRequest>(&header, _body_bytes, handles, &mut req)?;
7449                        let control_handle =
7450                            StorageAdminControlHandle { inner: this.inner.clone() };
7451                        Ok(StorageAdminRequest::ListStorageInRealm {
7452                            relative_moniker: req.relative_moniker,
7453                            iterator: req.iterator,
7454
7455                            responder: StorageAdminListStorageInRealmResponder {
7456                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7457                                tx_id: header.tx_id,
7458                            },
7459                        })
7460                    }
7461                    0x4802102cc55d5df1 => {
7462                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7463                        let mut req = fidl::new_empty!(
7464                            StorageAdminOpenComponentStorageByIdRequest,
7465                            fidl::encoding::DefaultFuchsiaResourceDialect
7466                        );
7467                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenComponentStorageByIdRequest>(&header, _body_bytes, handles, &mut req)?;
7468                        let control_handle =
7469                            StorageAdminControlHandle { inner: this.inner.clone() };
7470                        Ok(StorageAdminRequest::OpenComponentStorageById {
7471                            id: req.id,
7472                            object: req.object,
7473
7474                            responder: StorageAdminOpenComponentStorageByIdResponder {
7475                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7476                                tx_id: header.tx_id,
7477                            },
7478                        })
7479                    }
7480                    0x1677c1cdfcdbf45a => {
7481                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7482                        let mut req = fidl::new_empty!(
7483                            StorageAdminDeleteComponentStorageRequest,
7484                            fidl::encoding::DefaultFuchsiaResourceDialect
7485                        );
7486                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminDeleteComponentStorageRequest>(&header, _body_bytes, handles, &mut req)?;
7487                        let control_handle =
7488                            StorageAdminControlHandle { inner: this.inner.clone() };
7489                        Ok(StorageAdminRequest::DeleteComponentStorage {
7490                            relative_moniker: req.relative_moniker,
7491
7492                            responder: StorageAdminDeleteComponentStorageResponder {
7493                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7494                                tx_id: header.tx_id,
7495                            },
7496                        })
7497                    }
7498                    0x7729e325a6c526c8 => {
7499                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7500                        let mut req = fidl::new_empty!(
7501                            fidl::encoding::EmptyPayload,
7502                            fidl::encoding::DefaultFuchsiaResourceDialect
7503                        );
7504                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7505                        let control_handle =
7506                            StorageAdminControlHandle { inner: this.inner.clone() };
7507                        Ok(StorageAdminRequest::GetStatus {
7508                            responder: StorageAdminGetStatusResponder {
7509                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7510                                tx_id: header.tx_id,
7511                            },
7512                        })
7513                    }
7514                    0x2ee980b4b2d24adb => {
7515                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7516                        let mut req = fidl::new_empty!(
7517                            fidl::encoding::EmptyPayload,
7518                            fidl::encoding::DefaultFuchsiaResourceDialect
7519                        );
7520                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7521                        let control_handle =
7522                            StorageAdminControlHandle { inner: this.inner.clone() };
7523                        Ok(StorageAdminRequest::DeleteAllStorageContents {
7524                            responder: StorageAdminDeleteAllStorageContentsResponder {
7525                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7526                                tx_id: header.tx_id,
7527                            },
7528                        })
7529                    }
7530                    _ => Err(fidl::Error::UnknownOrdinal {
7531                        ordinal: header.ordinal,
7532                        protocol_name:
7533                            <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7534                    }),
7535                }))
7536            },
7537        )
7538    }
7539}
7540
7541#[derive(Debug)]
7542pub enum StorageAdminRequest {
7543    /// Opens the isolated directory for the given component. The provided
7544    /// moniker is relative to the component that declares the storage
7545    /// capability. Creates the backing sub-directory for this storage if it
7546    /// hasn't yet been created.
7547    OpenStorage {
7548        relative_moniker: String,
7549        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7550        responder: StorageAdminOpenStorageResponder,
7551    },
7552    /// Lists the descendant components under the specified realm that use the
7553    /// storage capability. The provided moniker is relative to the component
7554    /// that declares the storage capability.
7555    ///
7556    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
7557    /// if |relative_moniker| is malformed.
7558    ListStorageInRealm {
7559        relative_moniker: String,
7560        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7561        responder: StorageAdminListStorageInRealmResponder,
7562    },
7563    /// Opens the isolated directory for the given storage ID. Creates the
7564    /// backing sub-directory for this storage if it hasn't yet been created.
7565    OpenComponentStorageById {
7566        id: String,
7567        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7568        responder: StorageAdminOpenComponentStorageByIdResponder,
7569    },
7570    /// Deletes the contents of the storage for this component. Preserves the
7571    /// component's subdirectory itself within the storage backing directory.
7572    /// The provided moniker is relative to the component that declares the
7573    /// storage capability.
7574    DeleteComponentStorage {
7575        relative_moniker: String,
7576        responder: StorageAdminDeleteComponentStorageResponder,
7577    },
7578    /// Get the current status of the storage.
7579    GetStatus { responder: StorageAdminGetStatusResponder },
7580    /// Deletes the contents of all the storage. Storage directories are
7581    /// retained so any components using storage will be able to continue using
7582    /// it to create new files and directories.
7583    ///
7584    /// Returns Error::INTERNAL only if no storage at all could be cleared.
7585    /// Returns successfully even if some errors happen during the deletion
7586    /// progress.
7587    DeleteAllStorageContents { responder: StorageAdminDeleteAllStorageContentsResponder },
7588}
7589
7590impl StorageAdminRequest {
7591    #[allow(irrefutable_let_patterns)]
7592    pub fn into_open_storage(
7593        self,
7594    ) -> Option<(
7595        String,
7596        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7597        StorageAdminOpenStorageResponder,
7598    )> {
7599        if let StorageAdminRequest::OpenStorage { relative_moniker, object, responder } = self {
7600            Some((relative_moniker, object, responder))
7601        } else {
7602            None
7603        }
7604    }
7605
7606    #[allow(irrefutable_let_patterns)]
7607    pub fn into_list_storage_in_realm(
7608        self,
7609    ) -> Option<(
7610        String,
7611        fidl::endpoints::ServerEnd<StorageIteratorMarker>,
7612        StorageAdminListStorageInRealmResponder,
7613    )> {
7614        if let StorageAdminRequest::ListStorageInRealm { relative_moniker, iterator, responder } =
7615            self
7616        {
7617            Some((relative_moniker, iterator, responder))
7618        } else {
7619            None
7620        }
7621    }
7622
7623    #[allow(irrefutable_let_patterns)]
7624    pub fn into_open_component_storage_by_id(
7625        self,
7626    ) -> Option<(
7627        String,
7628        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
7629        StorageAdminOpenComponentStorageByIdResponder,
7630    )> {
7631        if let StorageAdminRequest::OpenComponentStorageById { id, object, responder } = self {
7632            Some((id, object, responder))
7633        } else {
7634            None
7635        }
7636    }
7637
7638    #[allow(irrefutable_let_patterns)]
7639    pub fn into_delete_component_storage(
7640        self,
7641    ) -> Option<(String, StorageAdminDeleteComponentStorageResponder)> {
7642        if let StorageAdminRequest::DeleteComponentStorage { relative_moniker, responder } = self {
7643            Some((relative_moniker, responder))
7644        } else {
7645            None
7646        }
7647    }
7648
7649    #[allow(irrefutable_let_patterns)]
7650    pub fn into_get_status(self) -> Option<(StorageAdminGetStatusResponder)> {
7651        if let StorageAdminRequest::GetStatus { responder } = self {
7652            Some((responder))
7653        } else {
7654            None
7655        }
7656    }
7657
7658    #[allow(irrefutable_let_patterns)]
7659    pub fn into_delete_all_storage_contents(
7660        self,
7661    ) -> Option<(StorageAdminDeleteAllStorageContentsResponder)> {
7662        if let StorageAdminRequest::DeleteAllStorageContents { responder } = self {
7663            Some((responder))
7664        } else {
7665            None
7666        }
7667    }
7668
7669    /// Name of the method defined in FIDL
7670    pub fn method_name(&self) -> &'static str {
7671        match *self {
7672            StorageAdminRequest::OpenStorage { .. } => "open_storage",
7673            StorageAdminRequest::ListStorageInRealm { .. } => "list_storage_in_realm",
7674            StorageAdminRequest::OpenComponentStorageById { .. } => "open_component_storage_by_id",
7675            StorageAdminRequest::DeleteComponentStorage { .. } => "delete_component_storage",
7676            StorageAdminRequest::GetStatus { .. } => "get_status",
7677            StorageAdminRequest::DeleteAllStorageContents { .. } => "delete_all_storage_contents",
7678        }
7679    }
7680}
7681
7682#[derive(Debug, Clone)]
7683pub struct StorageAdminControlHandle {
7684    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7685}
7686
7687impl fidl::endpoints::ControlHandle for StorageAdminControlHandle {
7688    fn shutdown(&self) {
7689        self.inner.shutdown()
7690    }
7691
7692    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7693        self.inner.shutdown_with_epitaph(status)
7694    }
7695
7696    fn is_closed(&self) -> bool {
7697        self.inner.channel().is_closed()
7698    }
7699    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7700        self.inner.channel().on_closed()
7701    }
7702
7703    #[cfg(target_os = "fuchsia")]
7704    fn signal_peer(
7705        &self,
7706        clear_mask: zx::Signals,
7707        set_mask: zx::Signals,
7708    ) -> Result<(), zx_status::Status> {
7709        use fidl::Peered;
7710        self.inner.channel().signal_peer(clear_mask, set_mask)
7711    }
7712}
7713
7714impl StorageAdminControlHandle {}
7715
7716#[must_use = "FIDL methods require a response to be sent"]
7717#[derive(Debug)]
7718pub struct StorageAdminOpenStorageResponder {
7719    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7720    tx_id: u32,
7721}
7722
7723/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7724/// if the responder is dropped without sending a response, so that the client
7725/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7726impl std::ops::Drop for StorageAdminOpenStorageResponder {
7727    fn drop(&mut self) {
7728        self.control_handle.shutdown();
7729        // Safety: drops once, never accessed again
7730        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7731    }
7732}
7733
7734impl fidl::endpoints::Responder for StorageAdminOpenStorageResponder {
7735    type ControlHandle = StorageAdminControlHandle;
7736
7737    fn control_handle(&self) -> &StorageAdminControlHandle {
7738        &self.control_handle
7739    }
7740
7741    fn drop_without_shutdown(mut self) {
7742        // Safety: drops once, never accessed again due to mem::forget
7743        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7744        // Prevent Drop from running (which would shut down the channel)
7745        std::mem::forget(self);
7746    }
7747}
7748
7749impl StorageAdminOpenStorageResponder {
7750    /// Sends a response to the FIDL transaction.
7751    ///
7752    /// Sets the channel to shutdown if an error occurs.
7753    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7754        let _result = self.send_raw(result);
7755        if _result.is_err() {
7756            self.control_handle.shutdown();
7757        }
7758        self.drop_without_shutdown();
7759        _result
7760    }
7761
7762    /// Similar to "send" but does not shutdown the channel if an error occurs.
7763    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7764        let _result = self.send_raw(result);
7765        self.drop_without_shutdown();
7766        _result
7767    }
7768
7769    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7770        self.control_handle
7771            .inner
7772            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7773                result,
7774                self.tx_id,
7775                0x6ceaa5904cfe4377,
7776                fidl::encoding::DynamicFlags::empty(),
7777            )
7778    }
7779}
7780
7781#[must_use = "FIDL methods require a response to be sent"]
7782#[derive(Debug)]
7783pub struct StorageAdminListStorageInRealmResponder {
7784    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7785    tx_id: u32,
7786}
7787
7788/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7789/// if the responder is dropped without sending a response, so that the client
7790/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7791impl std::ops::Drop for StorageAdminListStorageInRealmResponder {
7792    fn drop(&mut self) {
7793        self.control_handle.shutdown();
7794        // Safety: drops once, never accessed again
7795        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7796    }
7797}
7798
7799impl fidl::endpoints::Responder for StorageAdminListStorageInRealmResponder {
7800    type ControlHandle = StorageAdminControlHandle;
7801
7802    fn control_handle(&self) -> &StorageAdminControlHandle {
7803        &self.control_handle
7804    }
7805
7806    fn drop_without_shutdown(mut self) {
7807        // Safety: drops once, never accessed again due to mem::forget
7808        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7809        // Prevent Drop from running (which would shut down the channel)
7810        std::mem::forget(self);
7811    }
7812}
7813
7814impl StorageAdminListStorageInRealmResponder {
7815    /// Sends a response to the FIDL transaction.
7816    ///
7817    /// Sets the channel to shutdown if an error occurs.
7818    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7819        let _result = self.send_raw(result);
7820        if _result.is_err() {
7821            self.control_handle.shutdown();
7822        }
7823        self.drop_without_shutdown();
7824        _result
7825    }
7826
7827    /// Similar to "send" but does not shutdown the channel if an error occurs.
7828    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7829        let _result = self.send_raw(result);
7830        self.drop_without_shutdown();
7831        _result
7832    }
7833
7834    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7835        self.control_handle
7836            .inner
7837            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7838                result,
7839                self.tx_id,
7840                0x764f6d1f083e8bfb,
7841                fidl::encoding::DynamicFlags::empty(),
7842            )
7843    }
7844}
7845
7846#[must_use = "FIDL methods require a response to be sent"]
7847#[derive(Debug)]
7848pub struct StorageAdminOpenComponentStorageByIdResponder {
7849    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7850    tx_id: u32,
7851}
7852
7853/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7854/// if the responder is dropped without sending a response, so that the client
7855/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7856impl std::ops::Drop for StorageAdminOpenComponentStorageByIdResponder {
7857    fn drop(&mut self) {
7858        self.control_handle.shutdown();
7859        // Safety: drops once, never accessed again
7860        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7861    }
7862}
7863
7864impl fidl::endpoints::Responder for StorageAdminOpenComponentStorageByIdResponder {
7865    type ControlHandle = StorageAdminControlHandle;
7866
7867    fn control_handle(&self) -> &StorageAdminControlHandle {
7868        &self.control_handle
7869    }
7870
7871    fn drop_without_shutdown(mut self) {
7872        // Safety: drops once, never accessed again due to mem::forget
7873        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7874        // Prevent Drop from running (which would shut down the channel)
7875        std::mem::forget(self);
7876    }
7877}
7878
7879impl StorageAdminOpenComponentStorageByIdResponder {
7880    /// Sends a response to the FIDL transaction.
7881    ///
7882    /// Sets the channel to shutdown if an error occurs.
7883    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7884        let _result = self.send_raw(result);
7885        if _result.is_err() {
7886            self.control_handle.shutdown();
7887        }
7888        self.drop_without_shutdown();
7889        _result
7890    }
7891
7892    /// Similar to "send" but does not shutdown the channel if an error occurs.
7893    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7894        let _result = self.send_raw(result);
7895        self.drop_without_shutdown();
7896        _result
7897    }
7898
7899    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7900        self.control_handle
7901            .inner
7902            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7903                result,
7904                self.tx_id,
7905                0x4802102cc55d5df1,
7906                fidl::encoding::DynamicFlags::empty(),
7907            )
7908    }
7909}
7910
7911#[must_use = "FIDL methods require a response to be sent"]
7912#[derive(Debug)]
7913pub struct StorageAdminDeleteComponentStorageResponder {
7914    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7915    tx_id: u32,
7916}
7917
7918/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7919/// if the responder is dropped without sending a response, so that the client
7920/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7921impl std::ops::Drop for StorageAdminDeleteComponentStorageResponder {
7922    fn drop(&mut self) {
7923        self.control_handle.shutdown();
7924        // Safety: drops once, never accessed again
7925        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7926    }
7927}
7928
7929impl fidl::endpoints::Responder for StorageAdminDeleteComponentStorageResponder {
7930    type ControlHandle = StorageAdminControlHandle;
7931
7932    fn control_handle(&self) -> &StorageAdminControlHandle {
7933        &self.control_handle
7934    }
7935
7936    fn drop_without_shutdown(mut self) {
7937        // Safety: drops once, never accessed again due to mem::forget
7938        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7939        // Prevent Drop from running (which would shut down the channel)
7940        std::mem::forget(self);
7941    }
7942}
7943
7944impl StorageAdminDeleteComponentStorageResponder {
7945    /// Sends a response to the FIDL transaction.
7946    ///
7947    /// Sets the channel to shutdown if an error occurs.
7948    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7949        let _result = self.send_raw(result);
7950        if _result.is_err() {
7951            self.control_handle.shutdown();
7952        }
7953        self.drop_without_shutdown();
7954        _result
7955    }
7956
7957    /// Similar to "send" but does not shutdown the channel if an error occurs.
7958    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7959        let _result = self.send_raw(result);
7960        self.drop_without_shutdown();
7961        _result
7962    }
7963
7964    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7965        self.control_handle
7966            .inner
7967            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7968                result,
7969                self.tx_id,
7970                0x1677c1cdfcdbf45a,
7971                fidl::encoding::DynamicFlags::empty(),
7972            )
7973    }
7974}
7975
7976#[must_use = "FIDL methods require a response to be sent"]
7977#[derive(Debug)]
7978pub struct StorageAdminGetStatusResponder {
7979    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7980    tx_id: u32,
7981}
7982
7983/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7984/// if the responder is dropped without sending a response, so that the client
7985/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7986impl std::ops::Drop for StorageAdminGetStatusResponder {
7987    fn drop(&mut self) {
7988        self.control_handle.shutdown();
7989        // Safety: drops once, never accessed again
7990        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7991    }
7992}
7993
7994impl fidl::endpoints::Responder for StorageAdminGetStatusResponder {
7995    type ControlHandle = StorageAdminControlHandle;
7996
7997    fn control_handle(&self) -> &StorageAdminControlHandle {
7998        &self.control_handle
7999    }
8000
8001    fn drop_without_shutdown(mut self) {
8002        // Safety: drops once, never accessed again due to mem::forget
8003        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8004        // Prevent Drop from running (which would shut down the channel)
8005        std::mem::forget(self);
8006    }
8007}
8008
8009impl StorageAdminGetStatusResponder {
8010    /// Sends a response to the FIDL transaction.
8011    ///
8012    /// Sets the channel to shutdown if an error occurs.
8013    pub fn send(self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
8014        let _result = self.send_raw(result);
8015        if _result.is_err() {
8016            self.control_handle.shutdown();
8017        }
8018        self.drop_without_shutdown();
8019        _result
8020    }
8021
8022    /// Similar to "send" but does not shutdown the channel if an error occurs.
8023    pub fn send_no_shutdown_on_err(
8024        self,
8025        mut result: Result<&StorageStatus, StatusError>,
8026    ) -> Result<(), fidl::Error> {
8027        let _result = self.send_raw(result);
8028        self.drop_without_shutdown();
8029        _result
8030    }
8031
8032    fn send_raw(&self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
8033        self.control_handle.inner.send::<fidl::encoding::ResultType<StorageStatus, StatusError>>(
8034            result,
8035            self.tx_id,
8036            0x7729e325a6c526c8,
8037            fidl::encoding::DynamicFlags::empty(),
8038        )
8039    }
8040}
8041
8042#[must_use = "FIDL methods require a response to be sent"]
8043#[derive(Debug)]
8044pub struct StorageAdminDeleteAllStorageContentsResponder {
8045    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
8046    tx_id: u32,
8047}
8048
8049/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
8050/// if the responder is dropped without sending a response, so that the client
8051/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8052impl std::ops::Drop for StorageAdminDeleteAllStorageContentsResponder {
8053    fn drop(&mut self) {
8054        self.control_handle.shutdown();
8055        // Safety: drops once, never accessed again
8056        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8057    }
8058}
8059
8060impl fidl::endpoints::Responder for StorageAdminDeleteAllStorageContentsResponder {
8061    type ControlHandle = StorageAdminControlHandle;
8062
8063    fn control_handle(&self) -> &StorageAdminControlHandle {
8064        &self.control_handle
8065    }
8066
8067    fn drop_without_shutdown(mut self) {
8068        // Safety: drops once, never accessed again due to mem::forget
8069        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8070        // Prevent Drop from running (which would shut down the channel)
8071        std::mem::forget(self);
8072    }
8073}
8074
8075impl StorageAdminDeleteAllStorageContentsResponder {
8076    /// Sends a response to the FIDL transaction.
8077    ///
8078    /// Sets the channel to shutdown if an error occurs.
8079    pub fn send(self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
8080        let _result = self.send_raw(result);
8081        if _result.is_err() {
8082            self.control_handle.shutdown();
8083        }
8084        self.drop_without_shutdown();
8085        _result
8086    }
8087
8088    /// Similar to "send" but does not shutdown the channel if an error occurs.
8089    pub fn send_no_shutdown_on_err(
8090        self,
8091        mut result: Result<(), DeletionError>,
8092    ) -> Result<(), fidl::Error> {
8093        let _result = self.send_raw(result);
8094        self.drop_without_shutdown();
8095        _result
8096    }
8097
8098    fn send_raw(&self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
8099        self.control_handle.inner.send::<fidl::encoding::ResultType<
8100            fidl::encoding::EmptyStruct,
8101            DeletionError,
8102        >>(
8103            result,
8104            self.tx_id,
8105            0x2ee980b4b2d24adb,
8106            fidl::encoding::DynamicFlags::empty(),
8107        )
8108    }
8109}
8110
8111#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8112pub struct StorageIteratorMarker;
8113
8114impl fidl::endpoints::ProtocolMarker for StorageIteratorMarker {
8115    type Proxy = StorageIteratorProxy;
8116    type RequestStream = StorageIteratorRequestStream;
8117    #[cfg(target_os = "fuchsia")]
8118    type SynchronousProxy = StorageIteratorSynchronousProxy;
8119
8120    const DEBUG_NAME: &'static str = "(anonymous) StorageIterator";
8121}
8122
8123pub trait StorageIteratorProxyInterface: Send + Sync {
8124    type NextResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
8125    fn r#next(&self) -> Self::NextResponseFut;
8126}
8127#[derive(Debug)]
8128#[cfg(target_os = "fuchsia")]
8129pub struct StorageIteratorSynchronousProxy {
8130    client: fidl::client::sync::Client,
8131}
8132
8133#[cfg(target_os = "fuchsia")]
8134impl fidl::endpoints::SynchronousProxy for StorageIteratorSynchronousProxy {
8135    type Proxy = StorageIteratorProxy;
8136    type Protocol = StorageIteratorMarker;
8137
8138    fn from_channel(inner: fidl::Channel) -> Self {
8139        Self::new(inner)
8140    }
8141
8142    fn into_channel(self) -> fidl::Channel {
8143        self.client.into_channel()
8144    }
8145
8146    fn as_channel(&self) -> &fidl::Channel {
8147        self.client.as_channel()
8148    }
8149}
8150
8151#[cfg(target_os = "fuchsia")]
8152impl StorageIteratorSynchronousProxy {
8153    pub fn new(channel: fidl::Channel) -> Self {
8154        Self { client: fidl::client::sync::Client::new(channel) }
8155    }
8156
8157    pub fn into_channel(self) -> fidl::Channel {
8158        self.client.into_channel()
8159    }
8160
8161    /// Waits until an event arrives and returns it. It is safe for other
8162    /// threads to make concurrent requests while waiting for an event.
8163    pub fn wait_for_event(
8164        &self,
8165        deadline: zx::MonotonicInstant,
8166    ) -> Result<StorageIteratorEvent, fidl::Error> {
8167        StorageIteratorEvent::decode(self.client.wait_for_event::<StorageIteratorMarker>(deadline)?)
8168    }
8169
8170    /// Retrieve the next set of components using the storage capability. The
8171    /// returned monikers are relative to the component that declares the
8172    /// storage capability. Returns an empty vector after all components have
8173    /// been returned.
8174    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<String>, fidl::Error> {
8175        let _response = self.client.send_query::<
8176            fidl::encoding::EmptyPayload,
8177            StorageIteratorNextResponse,
8178            StorageIteratorMarker,
8179        >(
8180            (),
8181            0x7a6b21f15fd01b72,
8182            fidl::encoding::DynamicFlags::empty(),
8183            ___deadline,
8184        )?;
8185        Ok(_response.relative_monikers)
8186    }
8187}
8188
8189#[cfg(target_os = "fuchsia")]
8190impl From<StorageIteratorSynchronousProxy> for zx::NullableHandle {
8191    fn from(value: StorageIteratorSynchronousProxy) -> Self {
8192        value.into_channel().into()
8193    }
8194}
8195
8196#[cfg(target_os = "fuchsia")]
8197impl From<fidl::Channel> for StorageIteratorSynchronousProxy {
8198    fn from(value: fidl::Channel) -> Self {
8199        Self::new(value)
8200    }
8201}
8202
8203#[cfg(target_os = "fuchsia")]
8204impl fidl::endpoints::FromClient for StorageIteratorSynchronousProxy {
8205    type Protocol = StorageIteratorMarker;
8206
8207    fn from_client(value: fidl::endpoints::ClientEnd<StorageIteratorMarker>) -> Self {
8208        Self::new(value.into_channel())
8209    }
8210}
8211
8212#[derive(Debug, Clone)]
8213pub struct StorageIteratorProxy {
8214    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8215}
8216
8217impl fidl::endpoints::Proxy for StorageIteratorProxy {
8218    type Protocol = StorageIteratorMarker;
8219
8220    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8221        Self::new(inner)
8222    }
8223
8224    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8225        self.client.into_channel().map_err(|client| Self { client })
8226    }
8227
8228    fn as_channel(&self) -> &::fidl::AsyncChannel {
8229        self.client.as_channel()
8230    }
8231}
8232
8233impl StorageIteratorProxy {
8234    /// Create a new Proxy for fuchsia.component/StorageIterator.
8235    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8236        let protocol_name = <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8237        Self { client: fidl::client::Client::new(channel, protocol_name) }
8238    }
8239
8240    /// Get a Stream of events from the remote end of the protocol.
8241    ///
8242    /// # Panics
8243    ///
8244    /// Panics if the event stream was already taken.
8245    pub fn take_event_stream(&self) -> StorageIteratorEventStream {
8246        StorageIteratorEventStream { event_receiver: self.client.take_event_receiver() }
8247    }
8248
8249    /// Retrieve the next set of components using the storage capability. The
8250    /// returned monikers are relative to the component that declares the
8251    /// storage capability. Returns an empty vector after all components have
8252    /// been returned.
8253    pub fn r#next(
8254        &self,
8255    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
8256    {
8257        StorageIteratorProxyInterface::r#next(self)
8258    }
8259}
8260
8261impl StorageIteratorProxyInterface for StorageIteratorProxy {
8262    type NextResponseFut =
8263        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
8264    fn r#next(&self) -> Self::NextResponseFut {
8265        fn _decode(
8266            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8267        ) -> Result<Vec<String>, fidl::Error> {
8268            let _response = fidl::client::decode_transaction_body::<
8269                StorageIteratorNextResponse,
8270                fidl::encoding::DefaultFuchsiaResourceDialect,
8271                0x7a6b21f15fd01b72,
8272            >(_buf?)?;
8273            Ok(_response.relative_monikers)
8274        }
8275        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
8276            (),
8277            0x7a6b21f15fd01b72,
8278            fidl::encoding::DynamicFlags::empty(),
8279            _decode,
8280        )
8281    }
8282}
8283
8284pub struct StorageIteratorEventStream {
8285    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8286}
8287
8288impl std::marker::Unpin for StorageIteratorEventStream {}
8289
8290impl futures::stream::FusedStream for StorageIteratorEventStream {
8291    fn is_terminated(&self) -> bool {
8292        self.event_receiver.is_terminated()
8293    }
8294}
8295
8296impl futures::Stream for StorageIteratorEventStream {
8297    type Item = Result<StorageIteratorEvent, fidl::Error>;
8298
8299    fn poll_next(
8300        mut self: std::pin::Pin<&mut Self>,
8301        cx: &mut std::task::Context<'_>,
8302    ) -> std::task::Poll<Option<Self::Item>> {
8303        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8304            &mut self.event_receiver,
8305            cx
8306        )?) {
8307            Some(buf) => std::task::Poll::Ready(Some(StorageIteratorEvent::decode(buf))),
8308            None => std::task::Poll::Ready(None),
8309        }
8310    }
8311}
8312
8313#[derive(Debug)]
8314pub enum StorageIteratorEvent {}
8315
8316impl StorageIteratorEvent {
8317    /// Decodes a message buffer as a [`StorageIteratorEvent`].
8318    fn decode(
8319        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8320    ) -> Result<StorageIteratorEvent, fidl::Error> {
8321        let (bytes, _handles) = buf.split_mut();
8322        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8323        debug_assert_eq!(tx_header.tx_id, 0);
8324        match tx_header.ordinal {
8325            _ => Err(fidl::Error::UnknownOrdinal {
8326                ordinal: tx_header.ordinal,
8327                protocol_name:
8328                    <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8329            }),
8330        }
8331    }
8332}
8333
8334/// A Stream of incoming requests for fuchsia.component/StorageIterator.
8335pub struct StorageIteratorRequestStream {
8336    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8337    is_terminated: bool,
8338}
8339
8340impl std::marker::Unpin for StorageIteratorRequestStream {}
8341
8342impl futures::stream::FusedStream for StorageIteratorRequestStream {
8343    fn is_terminated(&self) -> bool {
8344        self.is_terminated
8345    }
8346}
8347
8348impl fidl::endpoints::RequestStream for StorageIteratorRequestStream {
8349    type Protocol = StorageIteratorMarker;
8350    type ControlHandle = StorageIteratorControlHandle;
8351
8352    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8353        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8354    }
8355
8356    fn control_handle(&self) -> Self::ControlHandle {
8357        StorageIteratorControlHandle { inner: self.inner.clone() }
8358    }
8359
8360    fn into_inner(
8361        self,
8362    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8363    {
8364        (self.inner, self.is_terminated)
8365    }
8366
8367    fn from_inner(
8368        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8369        is_terminated: bool,
8370    ) -> Self {
8371        Self { inner, is_terminated }
8372    }
8373}
8374
8375impl futures::Stream for StorageIteratorRequestStream {
8376    type Item = Result<StorageIteratorRequest, fidl::Error>;
8377
8378    fn poll_next(
8379        mut self: std::pin::Pin<&mut Self>,
8380        cx: &mut std::task::Context<'_>,
8381    ) -> std::task::Poll<Option<Self::Item>> {
8382        let this = &mut *self;
8383        if this.inner.check_shutdown(cx) {
8384            this.is_terminated = true;
8385            return std::task::Poll::Ready(None);
8386        }
8387        if this.is_terminated {
8388            panic!("polled StorageIteratorRequestStream after completion");
8389        }
8390        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8391            |bytes, handles| {
8392                match this.inner.channel().read_etc(cx, bytes, handles) {
8393                    std::task::Poll::Ready(Ok(())) => {}
8394                    std::task::Poll::Pending => return std::task::Poll::Pending,
8395                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8396                        this.is_terminated = true;
8397                        return std::task::Poll::Ready(None);
8398                    }
8399                    std::task::Poll::Ready(Err(e)) => {
8400                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8401                            e.into(),
8402                        ))));
8403                    }
8404                }
8405
8406                // A message has been received from the channel
8407                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8408
8409                std::task::Poll::Ready(Some(match header.ordinal {
8410                    0x7a6b21f15fd01b72 => {
8411                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8412                        let mut req = fidl::new_empty!(
8413                            fidl::encoding::EmptyPayload,
8414                            fidl::encoding::DefaultFuchsiaResourceDialect
8415                        );
8416                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8417                        let control_handle =
8418                            StorageIteratorControlHandle { inner: this.inner.clone() };
8419                        Ok(StorageIteratorRequest::Next {
8420                            responder: StorageIteratorNextResponder {
8421                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8422                                tx_id: header.tx_id,
8423                            },
8424                        })
8425                    }
8426                    _ => Err(fidl::Error::UnknownOrdinal {
8427                        ordinal: header.ordinal,
8428                        protocol_name:
8429                            <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8430                    }),
8431                }))
8432            },
8433        )
8434    }
8435}
8436
8437/// An iterator protocol for returning a set of components using a storage
8438/// capability. See |StorageAdmin.ListStorageInRealm| for more information.
8439#[derive(Debug)]
8440pub enum StorageIteratorRequest {
8441    /// Retrieve the next set of components using the storage capability. The
8442    /// returned monikers are relative to the component that declares the
8443    /// storage capability. Returns an empty vector after all components have
8444    /// been returned.
8445    Next { responder: StorageIteratorNextResponder },
8446}
8447
8448impl StorageIteratorRequest {
8449    #[allow(irrefutable_let_patterns)]
8450    pub fn into_next(self) -> Option<(StorageIteratorNextResponder)> {
8451        if let StorageIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
8452    }
8453
8454    /// Name of the method defined in FIDL
8455    pub fn method_name(&self) -> &'static str {
8456        match *self {
8457            StorageIteratorRequest::Next { .. } => "next",
8458        }
8459    }
8460}
8461
8462#[derive(Debug, Clone)]
8463pub struct StorageIteratorControlHandle {
8464    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8465}
8466
8467impl fidl::endpoints::ControlHandle for StorageIteratorControlHandle {
8468    fn shutdown(&self) {
8469        self.inner.shutdown()
8470    }
8471
8472    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8473        self.inner.shutdown_with_epitaph(status)
8474    }
8475
8476    fn is_closed(&self) -> bool {
8477        self.inner.channel().is_closed()
8478    }
8479    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8480        self.inner.channel().on_closed()
8481    }
8482
8483    #[cfg(target_os = "fuchsia")]
8484    fn signal_peer(
8485        &self,
8486        clear_mask: zx::Signals,
8487        set_mask: zx::Signals,
8488    ) -> Result<(), zx_status::Status> {
8489        use fidl::Peered;
8490        self.inner.channel().signal_peer(clear_mask, set_mask)
8491    }
8492}
8493
8494impl StorageIteratorControlHandle {}
8495
8496#[must_use = "FIDL methods require a response to be sent"]
8497#[derive(Debug)]
8498pub struct StorageIteratorNextResponder {
8499    control_handle: std::mem::ManuallyDrop<StorageIteratorControlHandle>,
8500    tx_id: u32,
8501}
8502
8503/// Set the the channel to be shutdown (see [`StorageIteratorControlHandle::shutdown`])
8504/// if the responder is dropped without sending a response, so that the client
8505/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8506impl std::ops::Drop for StorageIteratorNextResponder {
8507    fn drop(&mut self) {
8508        self.control_handle.shutdown();
8509        // Safety: drops once, never accessed again
8510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8511    }
8512}
8513
8514impl fidl::endpoints::Responder for StorageIteratorNextResponder {
8515    type ControlHandle = StorageIteratorControlHandle;
8516
8517    fn control_handle(&self) -> &StorageIteratorControlHandle {
8518        &self.control_handle
8519    }
8520
8521    fn drop_without_shutdown(mut self) {
8522        // Safety: drops once, never accessed again due to mem::forget
8523        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8524        // Prevent Drop from running (which would shut down the channel)
8525        std::mem::forget(self);
8526    }
8527}
8528
8529impl StorageIteratorNextResponder {
8530    /// Sends a response to the FIDL transaction.
8531    ///
8532    /// Sets the channel to shutdown if an error occurs.
8533    pub fn send(self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
8534        let _result = self.send_raw(relative_monikers);
8535        if _result.is_err() {
8536            self.control_handle.shutdown();
8537        }
8538        self.drop_without_shutdown();
8539        _result
8540    }
8541
8542    /// Similar to "send" but does not shutdown the channel if an error occurs.
8543    pub fn send_no_shutdown_on_err(
8544        self,
8545        mut relative_monikers: &[String],
8546    ) -> Result<(), fidl::Error> {
8547        let _result = self.send_raw(relative_monikers);
8548        self.drop_without_shutdown();
8549        _result
8550    }
8551
8552    fn send_raw(&self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
8553        self.control_handle.inner.send::<StorageIteratorNextResponse>(
8554            (relative_monikers,),
8555            self.tx_id,
8556            0x7a6b21f15fd01b72,
8557            fidl::encoding::DynamicFlags::empty(),
8558        )
8559    }
8560}
8561
8562mod internal {
8563    use super::*;
8564
8565    impl fidl::encoding::ResourceTypeMarker for ControllerOpenExposedDirRequest {
8566        type Borrowed<'a> = &'a mut Self;
8567        fn take_or_borrow<'a>(
8568            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8569        ) -> Self::Borrowed<'a> {
8570            value
8571        }
8572    }
8573
8574    unsafe impl fidl::encoding::TypeMarker for ControllerOpenExposedDirRequest {
8575        type Owned = Self;
8576
8577        #[inline(always)]
8578        fn inline_align(_context: fidl::encoding::Context) -> usize {
8579            4
8580        }
8581
8582        #[inline(always)]
8583        fn inline_size(_context: fidl::encoding::Context) -> usize {
8584            4
8585        }
8586    }
8587
8588    unsafe impl
8589        fidl::encoding::Encode<
8590            ControllerOpenExposedDirRequest,
8591            fidl::encoding::DefaultFuchsiaResourceDialect,
8592        > for &mut ControllerOpenExposedDirRequest
8593    {
8594        #[inline]
8595        unsafe fn encode(
8596            self,
8597            encoder: &mut fidl::encoding::Encoder<
8598                '_,
8599                fidl::encoding::DefaultFuchsiaResourceDialect,
8600            >,
8601            offset: usize,
8602            _depth: fidl::encoding::Depth,
8603        ) -> fidl::Result<()> {
8604            encoder.debug_check_bounds::<ControllerOpenExposedDirRequest>(offset);
8605            // Delegate to tuple encoding.
8606            fidl::encoding::Encode::<
8607                ControllerOpenExposedDirRequest,
8608                fidl::encoding::DefaultFuchsiaResourceDialect,
8609            >::encode(
8610                (<fidl::encoding::Endpoint<
8611                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8612                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8613                    &mut self.exposed_dir
8614                ),),
8615                encoder,
8616                offset,
8617                _depth,
8618            )
8619        }
8620    }
8621    unsafe impl<
8622        T0: fidl::encoding::Encode<
8623                fidl::encoding::Endpoint<
8624                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8625                >,
8626                fidl::encoding::DefaultFuchsiaResourceDialect,
8627            >,
8628    >
8629        fidl::encoding::Encode<
8630            ControllerOpenExposedDirRequest,
8631            fidl::encoding::DefaultFuchsiaResourceDialect,
8632        > for (T0,)
8633    {
8634        #[inline]
8635        unsafe fn encode(
8636            self,
8637            encoder: &mut fidl::encoding::Encoder<
8638                '_,
8639                fidl::encoding::DefaultFuchsiaResourceDialect,
8640            >,
8641            offset: usize,
8642            depth: fidl::encoding::Depth,
8643        ) -> fidl::Result<()> {
8644            encoder.debug_check_bounds::<ControllerOpenExposedDirRequest>(offset);
8645            // Zero out padding regions. There's no need to apply masks
8646            // because the unmasked parts will be overwritten by fields.
8647            // Write the fields.
8648            self.0.encode(encoder, offset + 0, depth)?;
8649            Ok(())
8650        }
8651    }
8652
8653    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8654        for ControllerOpenExposedDirRequest
8655    {
8656        #[inline(always)]
8657        fn new_empty() -> Self {
8658            Self {
8659                exposed_dir: fidl::new_empty!(
8660                    fidl::encoding::Endpoint<
8661                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8662                    >,
8663                    fidl::encoding::DefaultFuchsiaResourceDialect
8664                ),
8665            }
8666        }
8667
8668        #[inline]
8669        unsafe fn decode(
8670            &mut self,
8671            decoder: &mut fidl::encoding::Decoder<
8672                '_,
8673                fidl::encoding::DefaultFuchsiaResourceDialect,
8674            >,
8675            offset: usize,
8676            _depth: fidl::encoding::Depth,
8677        ) -> fidl::Result<()> {
8678            decoder.debug_check_bounds::<Self>(offset);
8679            // Verify that padding bytes are zero.
8680            fidl::decode!(
8681                fidl::encoding::Endpoint<
8682                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
8683                >,
8684                fidl::encoding::DefaultFuchsiaResourceDialect,
8685                &mut self.exposed_dir,
8686                decoder,
8687                offset + 0,
8688                _depth
8689            )?;
8690            Ok(())
8691        }
8692    }
8693
8694    impl fidl::encoding::ResourceTypeMarker for ControllerStartRequest {
8695        type Borrowed<'a> = &'a mut Self;
8696        fn take_or_borrow<'a>(
8697            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8698        ) -> Self::Borrowed<'a> {
8699            value
8700        }
8701    }
8702
8703    unsafe impl fidl::encoding::TypeMarker for ControllerStartRequest {
8704        type Owned = Self;
8705
8706        #[inline(always)]
8707        fn inline_align(_context: fidl::encoding::Context) -> usize {
8708            8
8709        }
8710
8711        #[inline(always)]
8712        fn inline_size(_context: fidl::encoding::Context) -> usize {
8713            24
8714        }
8715    }
8716
8717    unsafe impl
8718        fidl::encoding::Encode<
8719            ControllerStartRequest,
8720            fidl::encoding::DefaultFuchsiaResourceDialect,
8721        > for &mut ControllerStartRequest
8722    {
8723        #[inline]
8724        unsafe fn encode(
8725            self,
8726            encoder: &mut fidl::encoding::Encoder<
8727                '_,
8728                fidl::encoding::DefaultFuchsiaResourceDialect,
8729            >,
8730            offset: usize,
8731            _depth: fidl::encoding::Depth,
8732        ) -> fidl::Result<()> {
8733            encoder.debug_check_bounds::<ControllerStartRequest>(offset);
8734            // Delegate to tuple encoding.
8735            fidl::encoding::Encode::<ControllerStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8736                (
8737                    <StartChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
8738                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.execution_controller),
8739                ),
8740                encoder, offset, _depth
8741            )
8742        }
8743    }
8744    unsafe impl<
8745        T0: fidl::encoding::Encode<StartChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
8746        T1: fidl::encoding::Encode<
8747                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
8748                fidl::encoding::DefaultFuchsiaResourceDialect,
8749            >,
8750    >
8751        fidl::encoding::Encode<
8752            ControllerStartRequest,
8753            fidl::encoding::DefaultFuchsiaResourceDialect,
8754        > for (T0, T1)
8755    {
8756        #[inline]
8757        unsafe fn encode(
8758            self,
8759            encoder: &mut fidl::encoding::Encoder<
8760                '_,
8761                fidl::encoding::DefaultFuchsiaResourceDialect,
8762            >,
8763            offset: usize,
8764            depth: fidl::encoding::Depth,
8765        ) -> fidl::Result<()> {
8766            encoder.debug_check_bounds::<ControllerStartRequest>(offset);
8767            // Zero out padding regions. There's no need to apply masks
8768            // because the unmasked parts will be overwritten by fields.
8769            unsafe {
8770                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8771                (ptr as *mut u64).write_unaligned(0);
8772            }
8773            // Write the fields.
8774            self.0.encode(encoder, offset + 0, depth)?;
8775            self.1.encode(encoder, offset + 16, depth)?;
8776            Ok(())
8777        }
8778    }
8779
8780    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8781        for ControllerStartRequest
8782    {
8783        #[inline(always)]
8784        fn new_empty() -> Self {
8785            Self {
8786                args: fidl::new_empty!(
8787                    StartChildArgs,
8788                    fidl::encoding::DefaultFuchsiaResourceDialect
8789                ),
8790                execution_controller: fidl::new_empty!(
8791                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
8792                    fidl::encoding::DefaultFuchsiaResourceDialect
8793                ),
8794            }
8795        }
8796
8797        #[inline]
8798        unsafe fn decode(
8799            &mut self,
8800            decoder: &mut fidl::encoding::Decoder<
8801                '_,
8802                fidl::encoding::DefaultFuchsiaResourceDialect,
8803            >,
8804            offset: usize,
8805            _depth: fidl::encoding::Depth,
8806        ) -> fidl::Result<()> {
8807            decoder.debug_check_bounds::<Self>(offset);
8808            // Verify that padding bytes are zero.
8809            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8810            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8811            let mask = 0xffffffff00000000u64;
8812            let maskedval = padval & mask;
8813            if maskedval != 0 {
8814                return Err(fidl::Error::NonZeroPadding {
8815                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8816                });
8817            }
8818            fidl::decode!(
8819                StartChildArgs,
8820                fidl::encoding::DefaultFuchsiaResourceDialect,
8821                &mut self.args,
8822                decoder,
8823                offset + 0,
8824                _depth
8825            )?;
8826            fidl::decode!(
8827                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
8828                fidl::encoding::DefaultFuchsiaResourceDialect,
8829                &mut self.execution_controller,
8830                decoder,
8831                offset + 16,
8832                _depth
8833            )?;
8834            Ok(())
8835        }
8836    }
8837
8838    impl fidl::encoding::ResourceTypeMarker for ControllerGetExposedDictionaryResponse {
8839        type Borrowed<'a> = &'a mut Self;
8840        fn take_or_borrow<'a>(
8841            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8842        ) -> Self::Borrowed<'a> {
8843            value
8844        }
8845    }
8846
8847    unsafe impl fidl::encoding::TypeMarker for ControllerGetExposedDictionaryResponse {
8848        type Owned = Self;
8849
8850        #[inline(always)]
8851        fn inline_align(_context: fidl::encoding::Context) -> usize {
8852            4
8853        }
8854
8855        #[inline(always)]
8856        fn inline_size(_context: fidl::encoding::Context) -> usize {
8857            4
8858        }
8859    }
8860
8861    unsafe impl
8862        fidl::encoding::Encode<
8863            ControllerGetExposedDictionaryResponse,
8864            fidl::encoding::DefaultFuchsiaResourceDialect,
8865        > for &mut ControllerGetExposedDictionaryResponse
8866    {
8867        #[inline]
8868        unsafe fn encode(
8869            self,
8870            encoder: &mut fidl::encoding::Encoder<
8871                '_,
8872                fidl::encoding::DefaultFuchsiaResourceDialect,
8873            >,
8874            offset: usize,
8875            _depth: fidl::encoding::Depth,
8876        ) -> fidl::Result<()> {
8877            encoder.debug_check_bounds::<ControllerGetExposedDictionaryResponse>(offset);
8878            // Delegate to tuple encoding.
8879            fidl::encoding::Encode::<ControllerGetExposedDictionaryResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8880                (
8881                    <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
8882                ),
8883                encoder, offset, _depth
8884            )
8885        }
8886    }
8887    unsafe impl<
8888        T0: fidl::encoding::Encode<
8889                fidl_fuchsia_component_sandbox::DictionaryRef,
8890                fidl::encoding::DefaultFuchsiaResourceDialect,
8891            >,
8892    >
8893        fidl::encoding::Encode<
8894            ControllerGetExposedDictionaryResponse,
8895            fidl::encoding::DefaultFuchsiaResourceDialect,
8896        > for (T0,)
8897    {
8898        #[inline]
8899        unsafe fn encode(
8900            self,
8901            encoder: &mut fidl::encoding::Encoder<
8902                '_,
8903                fidl::encoding::DefaultFuchsiaResourceDialect,
8904            >,
8905            offset: usize,
8906            depth: fidl::encoding::Depth,
8907        ) -> fidl::Result<()> {
8908            encoder.debug_check_bounds::<ControllerGetExposedDictionaryResponse>(offset);
8909            // Zero out padding regions. There's no need to apply masks
8910            // because the unmasked parts will be overwritten by fields.
8911            // Write the fields.
8912            self.0.encode(encoder, offset + 0, depth)?;
8913            Ok(())
8914        }
8915    }
8916
8917    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8918        for ControllerGetExposedDictionaryResponse
8919    {
8920        #[inline(always)]
8921        fn new_empty() -> Self {
8922            Self {
8923                dictionary: fidl::new_empty!(
8924                    fidl_fuchsia_component_sandbox::DictionaryRef,
8925                    fidl::encoding::DefaultFuchsiaResourceDialect
8926                ),
8927            }
8928        }
8929
8930        #[inline]
8931        unsafe fn decode(
8932            &mut self,
8933            decoder: &mut fidl::encoding::Decoder<
8934                '_,
8935                fidl::encoding::DefaultFuchsiaResourceDialect,
8936            >,
8937            offset: usize,
8938            _depth: fidl::encoding::Depth,
8939        ) -> fidl::Result<()> {
8940            decoder.debug_check_bounds::<Self>(offset);
8941            // Verify that padding bytes are zero.
8942            fidl::decode!(
8943                fidl_fuchsia_component_sandbox::DictionaryRef,
8944                fidl::encoding::DefaultFuchsiaResourceDialect,
8945                &mut self.dictionary,
8946                decoder,
8947                offset + 0,
8948                _depth
8949            )?;
8950            Ok(())
8951        }
8952    }
8953
8954    impl fidl::encoding::ResourceTypeMarker for ControllerGetOutputDictionaryResponse {
8955        type Borrowed<'a> = &'a mut Self;
8956        fn take_or_borrow<'a>(
8957            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8958        ) -> Self::Borrowed<'a> {
8959            value
8960        }
8961    }
8962
8963    unsafe impl fidl::encoding::TypeMarker for ControllerGetOutputDictionaryResponse {
8964        type Owned = Self;
8965
8966        #[inline(always)]
8967        fn inline_align(_context: fidl::encoding::Context) -> usize {
8968            4
8969        }
8970
8971        #[inline(always)]
8972        fn inline_size(_context: fidl::encoding::Context) -> usize {
8973            4
8974        }
8975    }
8976
8977    unsafe impl
8978        fidl::encoding::Encode<
8979            ControllerGetOutputDictionaryResponse,
8980            fidl::encoding::DefaultFuchsiaResourceDialect,
8981        > for &mut ControllerGetOutputDictionaryResponse
8982    {
8983        #[inline]
8984        unsafe fn encode(
8985            self,
8986            encoder: &mut fidl::encoding::Encoder<
8987                '_,
8988                fidl::encoding::DefaultFuchsiaResourceDialect,
8989            >,
8990            offset: usize,
8991            _depth: fidl::encoding::Depth,
8992        ) -> fidl::Result<()> {
8993            encoder.debug_check_bounds::<ControllerGetOutputDictionaryResponse>(offset);
8994            // Delegate to tuple encoding.
8995            fidl::encoding::Encode::<
8996                ControllerGetOutputDictionaryResponse,
8997                fidl::encoding::DefaultFuchsiaResourceDialect,
8998            >::encode(
8999                (<fidl::encoding::HandleType<
9000                    fidl::EventPair,
9001                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9002                    2147483648,
9003                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9004                    &mut self.dictionary
9005                ),),
9006                encoder,
9007                offset,
9008                _depth,
9009            )
9010        }
9011    }
9012    unsafe impl<
9013        T0: fidl::encoding::Encode<
9014                fidl::encoding::HandleType<
9015                    fidl::EventPair,
9016                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9017                    2147483648,
9018                >,
9019                fidl::encoding::DefaultFuchsiaResourceDialect,
9020            >,
9021    >
9022        fidl::encoding::Encode<
9023            ControllerGetOutputDictionaryResponse,
9024            fidl::encoding::DefaultFuchsiaResourceDialect,
9025        > for (T0,)
9026    {
9027        #[inline]
9028        unsafe fn encode(
9029            self,
9030            encoder: &mut fidl::encoding::Encoder<
9031                '_,
9032                fidl::encoding::DefaultFuchsiaResourceDialect,
9033            >,
9034            offset: usize,
9035            depth: fidl::encoding::Depth,
9036        ) -> fidl::Result<()> {
9037            encoder.debug_check_bounds::<ControllerGetOutputDictionaryResponse>(offset);
9038            // Zero out padding regions. There's no need to apply masks
9039            // because the unmasked parts will be overwritten by fields.
9040            // Write the fields.
9041            self.0.encode(encoder, offset + 0, depth)?;
9042            Ok(())
9043        }
9044    }
9045
9046    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9047        for ControllerGetOutputDictionaryResponse
9048    {
9049        #[inline(always)]
9050        fn new_empty() -> Self {
9051            Self {
9052                dictionary: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9053            }
9054        }
9055
9056        #[inline]
9057        unsafe fn decode(
9058            &mut self,
9059            decoder: &mut fidl::encoding::Decoder<
9060                '_,
9061                fidl::encoding::DefaultFuchsiaResourceDialect,
9062            >,
9063            offset: usize,
9064            _depth: fidl::encoding::Depth,
9065        ) -> fidl::Result<()> {
9066            decoder.debug_check_bounds::<Self>(offset);
9067            // Verify that padding bytes are zero.
9068            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.dictionary, decoder, offset + 0, _depth)?;
9069            Ok(())
9070        }
9071    }
9072
9073    impl fidl::encoding::ResourceTypeMarker for ControllerIsStartedResponse {
9074        type Borrowed<'a> = &'a mut Self;
9075        fn take_or_borrow<'a>(
9076            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9077        ) -> Self::Borrowed<'a> {
9078            value
9079        }
9080    }
9081
9082    unsafe impl fidl::encoding::TypeMarker for ControllerIsStartedResponse {
9083        type Owned = Self;
9084
9085        #[inline(always)]
9086        fn inline_align(_context: fidl::encoding::Context) -> usize {
9087            1
9088        }
9089
9090        #[inline(always)]
9091        fn inline_size(_context: fidl::encoding::Context) -> usize {
9092            1
9093        }
9094    }
9095
9096    unsafe impl
9097        fidl::encoding::Encode<
9098            ControllerIsStartedResponse,
9099            fidl::encoding::DefaultFuchsiaResourceDialect,
9100        > for &mut ControllerIsStartedResponse
9101    {
9102        #[inline]
9103        unsafe fn encode(
9104            self,
9105            encoder: &mut fidl::encoding::Encoder<
9106                '_,
9107                fidl::encoding::DefaultFuchsiaResourceDialect,
9108            >,
9109            offset: usize,
9110            _depth: fidl::encoding::Depth,
9111        ) -> fidl::Result<()> {
9112            encoder.debug_check_bounds::<ControllerIsStartedResponse>(offset);
9113            // Delegate to tuple encoding.
9114            fidl::encoding::Encode::<
9115                ControllerIsStartedResponse,
9116                fidl::encoding::DefaultFuchsiaResourceDialect,
9117            >::encode(
9118                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_started),),
9119                encoder,
9120                offset,
9121                _depth,
9122            )
9123        }
9124    }
9125    unsafe impl<T0: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>>
9126        fidl::encoding::Encode<
9127            ControllerIsStartedResponse,
9128            fidl::encoding::DefaultFuchsiaResourceDialect,
9129        > for (T0,)
9130    {
9131        #[inline]
9132        unsafe fn encode(
9133            self,
9134            encoder: &mut fidl::encoding::Encoder<
9135                '_,
9136                fidl::encoding::DefaultFuchsiaResourceDialect,
9137            >,
9138            offset: usize,
9139            depth: fidl::encoding::Depth,
9140        ) -> fidl::Result<()> {
9141            encoder.debug_check_bounds::<ControllerIsStartedResponse>(offset);
9142            // Zero out padding regions. There's no need to apply masks
9143            // because the unmasked parts will be overwritten by fields.
9144            // Write the fields.
9145            self.0.encode(encoder, offset + 0, depth)?;
9146            Ok(())
9147        }
9148    }
9149
9150    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9151        for ControllerIsStartedResponse
9152    {
9153        #[inline(always)]
9154        fn new_empty() -> Self {
9155            Self {
9156                is_started: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
9157            }
9158        }
9159
9160        #[inline]
9161        unsafe fn decode(
9162            &mut self,
9163            decoder: &mut fidl::encoding::Decoder<
9164                '_,
9165                fidl::encoding::DefaultFuchsiaResourceDialect,
9166            >,
9167            offset: usize,
9168            _depth: fidl::encoding::Depth,
9169        ) -> fidl::Result<()> {
9170            decoder.debug_check_bounds::<Self>(offset);
9171            // Verify that padding bytes are zero.
9172            fidl::decode!(
9173                bool,
9174                fidl::encoding::DefaultFuchsiaResourceDialect,
9175                &mut self.is_started,
9176                decoder,
9177                offset + 0,
9178                _depth
9179            )?;
9180            Ok(())
9181        }
9182    }
9183
9184    impl fidl::encoding::ResourceTypeMarker for EventStreamGetNextResponse {
9185        type Borrowed<'a> = &'a mut Self;
9186        fn take_or_borrow<'a>(
9187            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9188        ) -> Self::Borrowed<'a> {
9189            value
9190        }
9191    }
9192
9193    unsafe impl fidl::encoding::TypeMarker for EventStreamGetNextResponse {
9194        type Owned = Self;
9195
9196        #[inline(always)]
9197        fn inline_align(_context: fidl::encoding::Context) -> usize {
9198            8
9199        }
9200
9201        #[inline(always)]
9202        fn inline_size(_context: fidl::encoding::Context) -> usize {
9203            16
9204        }
9205    }
9206
9207    unsafe impl
9208        fidl::encoding::Encode<
9209            EventStreamGetNextResponse,
9210            fidl::encoding::DefaultFuchsiaResourceDialect,
9211        > for &mut EventStreamGetNextResponse
9212    {
9213        #[inline]
9214        unsafe fn encode(
9215            self,
9216            encoder: &mut fidl::encoding::Encoder<
9217                '_,
9218                fidl::encoding::DefaultFuchsiaResourceDialect,
9219            >,
9220            offset: usize,
9221            _depth: fidl::encoding::Depth,
9222        ) -> fidl::Result<()> {
9223            encoder.debug_check_bounds::<EventStreamGetNextResponse>(offset);
9224            // Delegate to tuple encoding.
9225            fidl::encoding::Encode::<EventStreamGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9226                (
9227                    <fidl::encoding::UnboundedVector<Event> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.events),
9228                ),
9229                encoder, offset, _depth
9230            )
9231        }
9232    }
9233    unsafe impl<
9234        T0: fidl::encoding::Encode<
9235                fidl::encoding::UnboundedVector<Event>,
9236                fidl::encoding::DefaultFuchsiaResourceDialect,
9237            >,
9238    >
9239        fidl::encoding::Encode<
9240            EventStreamGetNextResponse,
9241            fidl::encoding::DefaultFuchsiaResourceDialect,
9242        > for (T0,)
9243    {
9244        #[inline]
9245        unsafe fn encode(
9246            self,
9247            encoder: &mut fidl::encoding::Encoder<
9248                '_,
9249                fidl::encoding::DefaultFuchsiaResourceDialect,
9250            >,
9251            offset: usize,
9252            depth: fidl::encoding::Depth,
9253        ) -> fidl::Result<()> {
9254            encoder.debug_check_bounds::<EventStreamGetNextResponse>(offset);
9255            // Zero out padding regions. There's no need to apply masks
9256            // because the unmasked parts will be overwritten by fields.
9257            // Write the fields.
9258            self.0.encode(encoder, offset + 0, depth)?;
9259            Ok(())
9260        }
9261    }
9262
9263    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9264        for EventStreamGetNextResponse
9265    {
9266        #[inline(always)]
9267        fn new_empty() -> Self {
9268            Self {
9269                events: fidl::new_empty!(
9270                    fidl::encoding::UnboundedVector<Event>,
9271                    fidl::encoding::DefaultFuchsiaResourceDialect
9272                ),
9273            }
9274        }
9275
9276        #[inline]
9277        unsafe fn decode(
9278            &mut self,
9279            decoder: &mut fidl::encoding::Decoder<
9280                '_,
9281                fidl::encoding::DefaultFuchsiaResourceDialect,
9282            >,
9283            offset: usize,
9284            _depth: fidl::encoding::Depth,
9285        ) -> fidl::Result<()> {
9286            decoder.debug_check_bounds::<Self>(offset);
9287            // Verify that padding bytes are zero.
9288            fidl::decode!(
9289                fidl::encoding::UnboundedVector<Event>,
9290                fidl::encoding::DefaultFuchsiaResourceDialect,
9291                &mut self.events,
9292                decoder,
9293                offset + 0,
9294                _depth
9295            )?;
9296            Ok(())
9297        }
9298    }
9299
9300    impl fidl::encoding::ResourceTypeMarker for IntrospectorGetMonikerRequest {
9301        type Borrowed<'a> = &'a mut Self;
9302        fn take_or_borrow<'a>(
9303            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9304        ) -> Self::Borrowed<'a> {
9305            value
9306        }
9307    }
9308
9309    unsafe impl fidl::encoding::TypeMarker for IntrospectorGetMonikerRequest {
9310        type Owned = Self;
9311
9312        #[inline(always)]
9313        fn inline_align(_context: fidl::encoding::Context) -> usize {
9314            4
9315        }
9316
9317        #[inline(always)]
9318        fn inline_size(_context: fidl::encoding::Context) -> usize {
9319            4
9320        }
9321    }
9322
9323    unsafe impl
9324        fidl::encoding::Encode<
9325            IntrospectorGetMonikerRequest,
9326            fidl::encoding::DefaultFuchsiaResourceDialect,
9327        > for &mut IntrospectorGetMonikerRequest
9328    {
9329        #[inline]
9330        unsafe fn encode(
9331            self,
9332            encoder: &mut fidl::encoding::Encoder<
9333                '_,
9334                fidl::encoding::DefaultFuchsiaResourceDialect,
9335            >,
9336            offset: usize,
9337            _depth: fidl::encoding::Depth,
9338        ) -> fidl::Result<()> {
9339            encoder.debug_check_bounds::<IntrospectorGetMonikerRequest>(offset);
9340            // Delegate to tuple encoding.
9341            fidl::encoding::Encode::<
9342                IntrospectorGetMonikerRequest,
9343                fidl::encoding::DefaultFuchsiaResourceDialect,
9344            >::encode(
9345                (<fidl::encoding::HandleType<
9346                    fidl::Event,
9347                    { fidl::ObjectType::EVENT.into_raw() },
9348                    2147483648,
9349                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9350                    &mut self.component_instance,
9351                ),),
9352                encoder,
9353                offset,
9354                _depth,
9355            )
9356        }
9357    }
9358    unsafe impl<
9359        T0: fidl::encoding::Encode<
9360                fidl::encoding::HandleType<
9361                    fidl::Event,
9362                    { fidl::ObjectType::EVENT.into_raw() },
9363                    2147483648,
9364                >,
9365                fidl::encoding::DefaultFuchsiaResourceDialect,
9366            >,
9367    >
9368        fidl::encoding::Encode<
9369            IntrospectorGetMonikerRequest,
9370            fidl::encoding::DefaultFuchsiaResourceDialect,
9371        > for (T0,)
9372    {
9373        #[inline]
9374        unsafe fn encode(
9375            self,
9376            encoder: &mut fidl::encoding::Encoder<
9377                '_,
9378                fidl::encoding::DefaultFuchsiaResourceDialect,
9379            >,
9380            offset: usize,
9381            depth: fidl::encoding::Depth,
9382        ) -> fidl::Result<()> {
9383            encoder.debug_check_bounds::<IntrospectorGetMonikerRequest>(offset);
9384            // Zero out padding regions. There's no need to apply masks
9385            // because the unmasked parts will be overwritten by fields.
9386            // Write the fields.
9387            self.0.encode(encoder, offset + 0, depth)?;
9388            Ok(())
9389        }
9390    }
9391
9392    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9393        for IntrospectorGetMonikerRequest
9394    {
9395        #[inline(always)]
9396        fn new_empty() -> Self {
9397            Self {
9398                component_instance: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9399            }
9400        }
9401
9402        #[inline]
9403        unsafe fn decode(
9404            &mut self,
9405            decoder: &mut fidl::encoding::Decoder<
9406                '_,
9407                fidl::encoding::DefaultFuchsiaResourceDialect,
9408            >,
9409            offset: usize,
9410            _depth: fidl::encoding::Depth,
9411        ) -> fidl::Result<()> {
9412            decoder.debug_check_bounds::<Self>(offset);
9413            // Verify that padding bytes are zero.
9414            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.component_instance, decoder, offset + 0, _depth)?;
9415            Ok(())
9416        }
9417    }
9418
9419    impl fidl::encoding::ResourceTypeMarker for NamespaceCreate2Request {
9420        type Borrowed<'a> = &'a mut Self;
9421        fn take_or_borrow<'a>(
9422            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9423        ) -> Self::Borrowed<'a> {
9424            value
9425        }
9426    }
9427
9428    unsafe impl fidl::encoding::TypeMarker for NamespaceCreate2Request {
9429        type Owned = Self;
9430
9431        #[inline(always)]
9432        fn inline_align(_context: fidl::encoding::Context) -> usize {
9433            8
9434        }
9435
9436        #[inline(always)]
9437        fn inline_size(_context: fidl::encoding::Context) -> usize {
9438            16
9439        }
9440    }
9441
9442    unsafe impl
9443        fidl::encoding::Encode<
9444            NamespaceCreate2Request,
9445            fidl::encoding::DefaultFuchsiaResourceDialect,
9446        > for &mut NamespaceCreate2Request
9447    {
9448        #[inline]
9449        unsafe fn encode(
9450            self,
9451            encoder: &mut fidl::encoding::Encoder<
9452                '_,
9453                fidl::encoding::DefaultFuchsiaResourceDialect,
9454            >,
9455            offset: usize,
9456            _depth: fidl::encoding::Depth,
9457        ) -> fidl::Result<()> {
9458            encoder.debug_check_bounds::<NamespaceCreate2Request>(offset);
9459            // Delegate to tuple encoding.
9460            fidl::encoding::Encode::<NamespaceCreate2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9461                (
9462                    <fidl::encoding::UnboundedVector<NamespaceInputEntry2> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
9463                ),
9464                encoder, offset, _depth
9465            )
9466        }
9467    }
9468    unsafe impl<
9469        T0: fidl::encoding::Encode<
9470                fidl::encoding::UnboundedVector<NamespaceInputEntry2>,
9471                fidl::encoding::DefaultFuchsiaResourceDialect,
9472            >,
9473    >
9474        fidl::encoding::Encode<
9475            NamespaceCreate2Request,
9476            fidl::encoding::DefaultFuchsiaResourceDialect,
9477        > for (T0,)
9478    {
9479        #[inline]
9480        unsafe fn encode(
9481            self,
9482            encoder: &mut fidl::encoding::Encoder<
9483                '_,
9484                fidl::encoding::DefaultFuchsiaResourceDialect,
9485            >,
9486            offset: usize,
9487            depth: fidl::encoding::Depth,
9488        ) -> fidl::Result<()> {
9489            encoder.debug_check_bounds::<NamespaceCreate2Request>(offset);
9490            // Zero out padding regions. There's no need to apply masks
9491            // because the unmasked parts will be overwritten by fields.
9492            // Write the fields.
9493            self.0.encode(encoder, offset + 0, depth)?;
9494            Ok(())
9495        }
9496    }
9497
9498    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9499        for NamespaceCreate2Request
9500    {
9501        #[inline(always)]
9502        fn new_empty() -> Self {
9503            Self {
9504                entries: fidl::new_empty!(
9505                    fidl::encoding::UnboundedVector<NamespaceInputEntry2>,
9506                    fidl::encoding::DefaultFuchsiaResourceDialect
9507                ),
9508            }
9509        }
9510
9511        #[inline]
9512        unsafe fn decode(
9513            &mut self,
9514            decoder: &mut fidl::encoding::Decoder<
9515                '_,
9516                fidl::encoding::DefaultFuchsiaResourceDialect,
9517            >,
9518            offset: usize,
9519            _depth: fidl::encoding::Depth,
9520        ) -> fidl::Result<()> {
9521            decoder.debug_check_bounds::<Self>(offset);
9522            // Verify that padding bytes are zero.
9523            fidl::decode!(
9524                fidl::encoding::UnboundedVector<NamespaceInputEntry2>,
9525                fidl::encoding::DefaultFuchsiaResourceDialect,
9526                &mut self.entries,
9527                decoder,
9528                offset + 0,
9529                _depth
9530            )?;
9531            Ok(())
9532        }
9533    }
9534
9535    impl fidl::encoding::ResourceTypeMarker for NamespaceCreateRequest {
9536        type Borrowed<'a> = &'a mut Self;
9537        fn take_or_borrow<'a>(
9538            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9539        ) -> Self::Borrowed<'a> {
9540            value
9541        }
9542    }
9543
9544    unsafe impl fidl::encoding::TypeMarker for NamespaceCreateRequest {
9545        type Owned = Self;
9546
9547        #[inline(always)]
9548        fn inline_align(_context: fidl::encoding::Context) -> usize {
9549            8
9550        }
9551
9552        #[inline(always)]
9553        fn inline_size(_context: fidl::encoding::Context) -> usize {
9554            16
9555        }
9556    }
9557
9558    unsafe impl
9559        fidl::encoding::Encode<
9560            NamespaceCreateRequest,
9561            fidl::encoding::DefaultFuchsiaResourceDialect,
9562        > for &mut NamespaceCreateRequest
9563    {
9564        #[inline]
9565        unsafe fn encode(
9566            self,
9567            encoder: &mut fidl::encoding::Encoder<
9568                '_,
9569                fidl::encoding::DefaultFuchsiaResourceDialect,
9570            >,
9571            offset: usize,
9572            _depth: fidl::encoding::Depth,
9573        ) -> fidl::Result<()> {
9574            encoder.debug_check_bounds::<NamespaceCreateRequest>(offset);
9575            // Delegate to tuple encoding.
9576            fidl::encoding::Encode::<NamespaceCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9577                (
9578                    <fidl::encoding::UnboundedVector<NamespaceInputEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
9579                ),
9580                encoder, offset, _depth
9581            )
9582        }
9583    }
9584    unsafe impl<
9585        T0: fidl::encoding::Encode<
9586                fidl::encoding::UnboundedVector<NamespaceInputEntry>,
9587                fidl::encoding::DefaultFuchsiaResourceDialect,
9588            >,
9589    >
9590        fidl::encoding::Encode<
9591            NamespaceCreateRequest,
9592            fidl::encoding::DefaultFuchsiaResourceDialect,
9593        > for (T0,)
9594    {
9595        #[inline]
9596        unsafe fn encode(
9597            self,
9598            encoder: &mut fidl::encoding::Encoder<
9599                '_,
9600                fidl::encoding::DefaultFuchsiaResourceDialect,
9601            >,
9602            offset: usize,
9603            depth: fidl::encoding::Depth,
9604        ) -> fidl::Result<()> {
9605            encoder.debug_check_bounds::<NamespaceCreateRequest>(offset);
9606            // Zero out padding regions. There's no need to apply masks
9607            // because the unmasked parts will be overwritten by fields.
9608            // Write the fields.
9609            self.0.encode(encoder, offset + 0, depth)?;
9610            Ok(())
9611        }
9612    }
9613
9614    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9615        for NamespaceCreateRequest
9616    {
9617        #[inline(always)]
9618        fn new_empty() -> Self {
9619            Self {
9620                entries: fidl::new_empty!(
9621                    fidl::encoding::UnboundedVector<NamespaceInputEntry>,
9622                    fidl::encoding::DefaultFuchsiaResourceDialect
9623                ),
9624            }
9625        }
9626
9627        #[inline]
9628        unsafe fn decode(
9629            &mut self,
9630            decoder: &mut fidl::encoding::Decoder<
9631                '_,
9632                fidl::encoding::DefaultFuchsiaResourceDialect,
9633            >,
9634            offset: usize,
9635            _depth: fidl::encoding::Depth,
9636        ) -> fidl::Result<()> {
9637            decoder.debug_check_bounds::<Self>(offset);
9638            // Verify that padding bytes are zero.
9639            fidl::decode!(
9640                fidl::encoding::UnboundedVector<NamespaceInputEntry>,
9641                fidl::encoding::DefaultFuchsiaResourceDialect,
9642                &mut self.entries,
9643                decoder,
9644                offset + 0,
9645                _depth
9646            )?;
9647            Ok(())
9648        }
9649    }
9650
9651    impl fidl::encoding::ResourceTypeMarker for NamespaceInputEntry {
9652        type Borrowed<'a> = &'a mut Self;
9653        fn take_or_borrow<'a>(
9654            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9655        ) -> Self::Borrowed<'a> {
9656            value
9657        }
9658    }
9659
9660    unsafe impl fidl::encoding::TypeMarker for NamespaceInputEntry {
9661        type Owned = Self;
9662
9663        #[inline(always)]
9664        fn inline_align(_context: fidl::encoding::Context) -> usize {
9665            8
9666        }
9667
9668        #[inline(always)]
9669        fn inline_size(_context: fidl::encoding::Context) -> usize {
9670            24
9671        }
9672    }
9673
9674    unsafe impl
9675        fidl::encoding::Encode<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
9676        for &mut NamespaceInputEntry
9677    {
9678        #[inline]
9679        unsafe fn encode(
9680            self,
9681            encoder: &mut fidl::encoding::Encoder<
9682                '_,
9683                fidl::encoding::DefaultFuchsiaResourceDialect,
9684            >,
9685            offset: usize,
9686            _depth: fidl::encoding::Depth,
9687        ) -> fidl::Result<()> {
9688            encoder.debug_check_bounds::<NamespaceInputEntry>(offset);
9689            // Delegate to tuple encoding.
9690            fidl::encoding::Encode::<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9691                (
9692                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
9693                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
9694                ),
9695                encoder, offset, _depth
9696            )
9697        }
9698    }
9699    unsafe impl<
9700        T0: fidl::encoding::Encode<
9701                fidl::encoding::BoundedString<4095>,
9702                fidl::encoding::DefaultFuchsiaResourceDialect,
9703            >,
9704        T1: fidl::encoding::Encode<
9705                fidl::encoding::Endpoint<
9706                    fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
9707                >,
9708                fidl::encoding::DefaultFuchsiaResourceDialect,
9709            >,
9710    > fidl::encoding::Encode<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
9711        for (T0, T1)
9712    {
9713        #[inline]
9714        unsafe fn encode(
9715            self,
9716            encoder: &mut fidl::encoding::Encoder<
9717                '_,
9718                fidl::encoding::DefaultFuchsiaResourceDialect,
9719            >,
9720            offset: usize,
9721            depth: fidl::encoding::Depth,
9722        ) -> fidl::Result<()> {
9723            encoder.debug_check_bounds::<NamespaceInputEntry>(offset);
9724            // Zero out padding regions. There's no need to apply masks
9725            // because the unmasked parts will be overwritten by fields.
9726            unsafe {
9727                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9728                (ptr as *mut u64).write_unaligned(0);
9729            }
9730            // Write the fields.
9731            self.0.encode(encoder, offset + 0, depth)?;
9732            self.1.encode(encoder, offset + 16, depth)?;
9733            Ok(())
9734        }
9735    }
9736
9737    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9738        for NamespaceInputEntry
9739    {
9740        #[inline(always)]
9741        fn new_empty() -> Self {
9742            Self {
9743                path: fidl::new_empty!(
9744                    fidl::encoding::BoundedString<4095>,
9745                    fidl::encoding::DefaultFuchsiaResourceDialect
9746                ),
9747                dictionary: fidl::new_empty!(
9748                    fidl::encoding::Endpoint<
9749                        fidl::endpoints::ClientEnd<
9750                            fidl_fuchsia_component_sandbox::DictionaryMarker,
9751                        >,
9752                    >,
9753                    fidl::encoding::DefaultFuchsiaResourceDialect
9754                ),
9755            }
9756        }
9757
9758        #[inline]
9759        unsafe fn decode(
9760            &mut self,
9761            decoder: &mut fidl::encoding::Decoder<
9762                '_,
9763                fidl::encoding::DefaultFuchsiaResourceDialect,
9764            >,
9765            offset: usize,
9766            _depth: fidl::encoding::Depth,
9767        ) -> fidl::Result<()> {
9768            decoder.debug_check_bounds::<Self>(offset);
9769            // Verify that padding bytes are zero.
9770            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9771            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9772            let mask = 0xffffffff00000000u64;
9773            let maskedval = padval & mask;
9774            if maskedval != 0 {
9775                return Err(fidl::Error::NonZeroPadding {
9776                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9777                });
9778            }
9779            fidl::decode!(
9780                fidl::encoding::BoundedString<4095>,
9781                fidl::encoding::DefaultFuchsiaResourceDialect,
9782                &mut self.path,
9783                decoder,
9784                offset + 0,
9785                _depth
9786            )?;
9787            fidl::decode!(
9788                fidl::encoding::Endpoint<
9789                    fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
9790                >,
9791                fidl::encoding::DefaultFuchsiaResourceDialect,
9792                &mut self.dictionary,
9793                decoder,
9794                offset + 16,
9795                _depth
9796            )?;
9797            Ok(())
9798        }
9799    }
9800
9801    impl fidl::encoding::ResourceTypeMarker for NamespaceInputEntry2 {
9802        type Borrowed<'a> = &'a mut Self;
9803        fn take_or_borrow<'a>(
9804            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9805        ) -> Self::Borrowed<'a> {
9806            value
9807        }
9808    }
9809
9810    unsafe impl fidl::encoding::TypeMarker for NamespaceInputEntry2 {
9811        type Owned = Self;
9812
9813        #[inline(always)]
9814        fn inline_align(_context: fidl::encoding::Context) -> usize {
9815            8
9816        }
9817
9818        #[inline(always)]
9819        fn inline_size(_context: fidl::encoding::Context) -> usize {
9820            24
9821        }
9822    }
9823
9824    unsafe impl
9825        fidl::encoding::Encode<NamespaceInputEntry2, fidl::encoding::DefaultFuchsiaResourceDialect>
9826        for &mut NamespaceInputEntry2
9827    {
9828        #[inline]
9829        unsafe fn encode(
9830            self,
9831            encoder: &mut fidl::encoding::Encoder<
9832                '_,
9833                fidl::encoding::DefaultFuchsiaResourceDialect,
9834            >,
9835            offset: usize,
9836            _depth: fidl::encoding::Depth,
9837        ) -> fidl::Result<()> {
9838            encoder.debug_check_bounds::<NamespaceInputEntry2>(offset);
9839            // Delegate to tuple encoding.
9840            fidl::encoding::Encode::<NamespaceInputEntry2, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9841                (
9842                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
9843                    <fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.capability),
9844                ),
9845                encoder, offset, _depth
9846            )
9847        }
9848    }
9849    unsafe impl<
9850        T0: fidl::encoding::Encode<
9851                fidl::encoding::BoundedString<4095>,
9852                fidl::encoding::DefaultFuchsiaResourceDialect,
9853            >,
9854        T1: fidl::encoding::Encode<
9855                fidl::encoding::HandleType<
9856                    fidl::EventPair,
9857                    { fidl::ObjectType::EVENTPAIR.into_raw() },
9858                    2147483648,
9859                >,
9860                fidl::encoding::DefaultFuchsiaResourceDialect,
9861            >,
9862    >
9863        fidl::encoding::Encode<NamespaceInputEntry2, fidl::encoding::DefaultFuchsiaResourceDialect>
9864        for (T0, T1)
9865    {
9866        #[inline]
9867        unsafe fn encode(
9868            self,
9869            encoder: &mut fidl::encoding::Encoder<
9870                '_,
9871                fidl::encoding::DefaultFuchsiaResourceDialect,
9872            >,
9873            offset: usize,
9874            depth: fidl::encoding::Depth,
9875        ) -> fidl::Result<()> {
9876            encoder.debug_check_bounds::<NamespaceInputEntry2>(offset);
9877            // Zero out padding regions. There's no need to apply masks
9878            // because the unmasked parts will be overwritten by fields.
9879            unsafe {
9880                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9881                (ptr as *mut u64).write_unaligned(0);
9882            }
9883            // Write the fields.
9884            self.0.encode(encoder, offset + 0, depth)?;
9885            self.1.encode(encoder, offset + 16, depth)?;
9886            Ok(())
9887        }
9888    }
9889
9890    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9891        for NamespaceInputEntry2
9892    {
9893        #[inline(always)]
9894        fn new_empty() -> Self {
9895            Self {
9896                path: fidl::new_empty!(
9897                    fidl::encoding::BoundedString<4095>,
9898                    fidl::encoding::DefaultFuchsiaResourceDialect
9899                ),
9900                capability: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9901            }
9902        }
9903
9904        #[inline]
9905        unsafe fn decode(
9906            &mut self,
9907            decoder: &mut fidl::encoding::Decoder<
9908                '_,
9909                fidl::encoding::DefaultFuchsiaResourceDialect,
9910            >,
9911            offset: usize,
9912            _depth: fidl::encoding::Depth,
9913        ) -> fidl::Result<()> {
9914            decoder.debug_check_bounds::<Self>(offset);
9915            // Verify that padding bytes are zero.
9916            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9917            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9918            let mask = 0xffffffff00000000u64;
9919            let maskedval = padval & mask;
9920            if maskedval != 0 {
9921                return Err(fidl::Error::NonZeroPadding {
9922                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9923                });
9924            }
9925            fidl::decode!(
9926                fidl::encoding::BoundedString<4095>,
9927                fidl::encoding::DefaultFuchsiaResourceDialect,
9928                &mut self.path,
9929                decoder,
9930                offset + 0,
9931                _depth
9932            )?;
9933            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.capability, decoder, offset + 16, _depth)?;
9934            Ok(())
9935        }
9936    }
9937
9938    impl fidl::encoding::ResourceTypeMarker for NamespaceCreate2Response {
9939        type Borrowed<'a> = &'a mut Self;
9940        fn take_or_borrow<'a>(
9941            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9942        ) -> Self::Borrowed<'a> {
9943            value
9944        }
9945    }
9946
9947    unsafe impl fidl::encoding::TypeMarker for NamespaceCreate2Response {
9948        type Owned = Self;
9949
9950        #[inline(always)]
9951        fn inline_align(_context: fidl::encoding::Context) -> usize {
9952            8
9953        }
9954
9955        #[inline(always)]
9956        fn inline_size(_context: fidl::encoding::Context) -> usize {
9957            16
9958        }
9959    }
9960
9961    unsafe impl
9962        fidl::encoding::Encode<
9963            NamespaceCreate2Response,
9964            fidl::encoding::DefaultFuchsiaResourceDialect,
9965        > for &mut NamespaceCreate2Response
9966    {
9967        #[inline]
9968        unsafe fn encode(
9969            self,
9970            encoder: &mut fidl::encoding::Encoder<
9971                '_,
9972                fidl::encoding::DefaultFuchsiaResourceDialect,
9973            >,
9974            offset: usize,
9975            _depth: fidl::encoding::Depth,
9976        ) -> fidl::Result<()> {
9977            encoder.debug_check_bounds::<NamespaceCreate2Response>(offset);
9978            // Delegate to tuple encoding.
9979            fidl::encoding::Encode::<NamespaceCreate2Response, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9980                (
9981                    <fidl::encoding::UnboundedVector<NamespaceEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
9982                ),
9983                encoder, offset, _depth
9984            )
9985        }
9986    }
9987    unsafe impl<
9988        T0: fidl::encoding::Encode<
9989                fidl::encoding::UnboundedVector<NamespaceEntry>,
9990                fidl::encoding::DefaultFuchsiaResourceDialect,
9991            >,
9992    >
9993        fidl::encoding::Encode<
9994            NamespaceCreate2Response,
9995            fidl::encoding::DefaultFuchsiaResourceDialect,
9996        > for (T0,)
9997    {
9998        #[inline]
9999        unsafe fn encode(
10000            self,
10001            encoder: &mut fidl::encoding::Encoder<
10002                '_,
10003                fidl::encoding::DefaultFuchsiaResourceDialect,
10004            >,
10005            offset: usize,
10006            depth: fidl::encoding::Depth,
10007        ) -> fidl::Result<()> {
10008            encoder.debug_check_bounds::<NamespaceCreate2Response>(offset);
10009            // Zero out padding regions. There's no need to apply masks
10010            // because the unmasked parts will be overwritten by fields.
10011            // Write the fields.
10012            self.0.encode(encoder, offset + 0, depth)?;
10013            Ok(())
10014        }
10015    }
10016
10017    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10018        for NamespaceCreate2Response
10019    {
10020        #[inline(always)]
10021        fn new_empty() -> Self {
10022            Self {
10023                entries: fidl::new_empty!(
10024                    fidl::encoding::UnboundedVector<NamespaceEntry>,
10025                    fidl::encoding::DefaultFuchsiaResourceDialect
10026                ),
10027            }
10028        }
10029
10030        #[inline]
10031        unsafe fn decode(
10032            &mut self,
10033            decoder: &mut fidl::encoding::Decoder<
10034                '_,
10035                fidl::encoding::DefaultFuchsiaResourceDialect,
10036            >,
10037            offset: usize,
10038            _depth: fidl::encoding::Depth,
10039        ) -> fidl::Result<()> {
10040            decoder.debug_check_bounds::<Self>(offset);
10041            // Verify that padding bytes are zero.
10042            fidl::decode!(
10043                fidl::encoding::UnboundedVector<NamespaceEntry>,
10044                fidl::encoding::DefaultFuchsiaResourceDialect,
10045                &mut self.entries,
10046                decoder,
10047                offset + 0,
10048                _depth
10049            )?;
10050            Ok(())
10051        }
10052    }
10053
10054    impl fidl::encoding::ResourceTypeMarker for NamespaceCreateResponse {
10055        type Borrowed<'a> = &'a mut Self;
10056        fn take_or_borrow<'a>(
10057            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10058        ) -> Self::Borrowed<'a> {
10059            value
10060        }
10061    }
10062
10063    unsafe impl fidl::encoding::TypeMarker for NamespaceCreateResponse {
10064        type Owned = Self;
10065
10066        #[inline(always)]
10067        fn inline_align(_context: fidl::encoding::Context) -> usize {
10068            8
10069        }
10070
10071        #[inline(always)]
10072        fn inline_size(_context: fidl::encoding::Context) -> usize {
10073            16
10074        }
10075    }
10076
10077    unsafe impl
10078        fidl::encoding::Encode<
10079            NamespaceCreateResponse,
10080            fidl::encoding::DefaultFuchsiaResourceDialect,
10081        > for &mut NamespaceCreateResponse
10082    {
10083        #[inline]
10084        unsafe fn encode(
10085            self,
10086            encoder: &mut fidl::encoding::Encoder<
10087                '_,
10088                fidl::encoding::DefaultFuchsiaResourceDialect,
10089            >,
10090            offset: usize,
10091            _depth: fidl::encoding::Depth,
10092        ) -> fidl::Result<()> {
10093            encoder.debug_check_bounds::<NamespaceCreateResponse>(offset);
10094            // Delegate to tuple encoding.
10095            fidl::encoding::Encode::<NamespaceCreateResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10096                (
10097                    <fidl::encoding::UnboundedVector<NamespaceEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
10098                ),
10099                encoder, offset, _depth
10100            )
10101        }
10102    }
10103    unsafe impl<
10104        T0: fidl::encoding::Encode<
10105                fidl::encoding::UnboundedVector<NamespaceEntry>,
10106                fidl::encoding::DefaultFuchsiaResourceDialect,
10107            >,
10108    >
10109        fidl::encoding::Encode<
10110            NamespaceCreateResponse,
10111            fidl::encoding::DefaultFuchsiaResourceDialect,
10112        > for (T0,)
10113    {
10114        #[inline]
10115        unsafe fn encode(
10116            self,
10117            encoder: &mut fidl::encoding::Encoder<
10118                '_,
10119                fidl::encoding::DefaultFuchsiaResourceDialect,
10120            >,
10121            offset: usize,
10122            depth: fidl::encoding::Depth,
10123        ) -> fidl::Result<()> {
10124            encoder.debug_check_bounds::<NamespaceCreateResponse>(offset);
10125            // Zero out padding regions. There's no need to apply masks
10126            // because the unmasked parts will be overwritten by fields.
10127            // Write the fields.
10128            self.0.encode(encoder, offset + 0, depth)?;
10129            Ok(())
10130        }
10131    }
10132
10133    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10134        for NamespaceCreateResponse
10135    {
10136        #[inline(always)]
10137        fn new_empty() -> Self {
10138            Self {
10139                entries: fidl::new_empty!(
10140                    fidl::encoding::UnboundedVector<NamespaceEntry>,
10141                    fidl::encoding::DefaultFuchsiaResourceDialect
10142                ),
10143            }
10144        }
10145
10146        #[inline]
10147        unsafe fn decode(
10148            &mut self,
10149            decoder: &mut fidl::encoding::Decoder<
10150                '_,
10151                fidl::encoding::DefaultFuchsiaResourceDialect,
10152            >,
10153            offset: usize,
10154            _depth: fidl::encoding::Depth,
10155        ) -> fidl::Result<()> {
10156            decoder.debug_check_bounds::<Self>(offset);
10157            // Verify that padding bytes are zero.
10158            fidl::decode!(
10159                fidl::encoding::UnboundedVector<NamespaceEntry>,
10160                fidl::encoding::DefaultFuchsiaResourceDialect,
10161                &mut self.entries,
10162                decoder,
10163                offset + 0,
10164                _depth
10165            )?;
10166            Ok(())
10167        }
10168    }
10169
10170    impl fidl::encoding::ResourceTypeMarker for RealmCreateChildRequest {
10171        type Borrowed<'a> = &'a mut Self;
10172        fn take_or_borrow<'a>(
10173            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10174        ) -> Self::Borrowed<'a> {
10175            value
10176        }
10177    }
10178
10179    unsafe impl fidl::encoding::TypeMarker for RealmCreateChildRequest {
10180        type Owned = Self;
10181
10182        #[inline(always)]
10183        fn inline_align(_context: fidl::encoding::Context) -> usize {
10184            8
10185        }
10186
10187        #[inline(always)]
10188        fn inline_size(_context: fidl::encoding::Context) -> usize {
10189            48
10190        }
10191    }
10192
10193    unsafe impl
10194        fidl::encoding::Encode<
10195            RealmCreateChildRequest,
10196            fidl::encoding::DefaultFuchsiaResourceDialect,
10197        > for &mut RealmCreateChildRequest
10198    {
10199        #[inline]
10200        unsafe fn encode(
10201            self,
10202            encoder: &mut fidl::encoding::Encoder<
10203                '_,
10204                fidl::encoding::DefaultFuchsiaResourceDialect,
10205            >,
10206            offset: usize,
10207            _depth: fidl::encoding::Depth,
10208        ) -> fidl::Result<()> {
10209            encoder.debug_check_bounds::<RealmCreateChildRequest>(offset);
10210            // Delegate to tuple encoding.
10211            fidl::encoding::Encode::<RealmCreateChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10212                (
10213                    <fidl_fuchsia_component_decl::CollectionRef as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
10214                    <fidl_fuchsia_component_decl::Child as fidl::encoding::ValueTypeMarker>::borrow(&self.decl),
10215                    <CreateChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
10216                ),
10217                encoder, offset, _depth
10218            )
10219        }
10220    }
10221    unsafe impl<
10222        T0: fidl::encoding::Encode<
10223                fidl_fuchsia_component_decl::CollectionRef,
10224                fidl::encoding::DefaultFuchsiaResourceDialect,
10225            >,
10226        T1: fidl::encoding::Encode<
10227                fidl_fuchsia_component_decl::Child,
10228                fidl::encoding::DefaultFuchsiaResourceDialect,
10229            >,
10230        T2: fidl::encoding::Encode<CreateChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
10231    >
10232        fidl::encoding::Encode<
10233            RealmCreateChildRequest,
10234            fidl::encoding::DefaultFuchsiaResourceDialect,
10235        > for (T0, T1, T2)
10236    {
10237        #[inline]
10238        unsafe fn encode(
10239            self,
10240            encoder: &mut fidl::encoding::Encoder<
10241                '_,
10242                fidl::encoding::DefaultFuchsiaResourceDialect,
10243            >,
10244            offset: usize,
10245            depth: fidl::encoding::Depth,
10246        ) -> fidl::Result<()> {
10247            encoder.debug_check_bounds::<RealmCreateChildRequest>(offset);
10248            // Zero out padding regions. There's no need to apply masks
10249            // because the unmasked parts will be overwritten by fields.
10250            // Write the fields.
10251            self.0.encode(encoder, offset + 0, depth)?;
10252            self.1.encode(encoder, offset + 16, depth)?;
10253            self.2.encode(encoder, offset + 32, depth)?;
10254            Ok(())
10255        }
10256    }
10257
10258    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10259        for RealmCreateChildRequest
10260    {
10261        #[inline(always)]
10262        fn new_empty() -> Self {
10263            Self {
10264                collection: fidl::new_empty!(
10265                    fidl_fuchsia_component_decl::CollectionRef,
10266                    fidl::encoding::DefaultFuchsiaResourceDialect
10267                ),
10268                decl: fidl::new_empty!(
10269                    fidl_fuchsia_component_decl::Child,
10270                    fidl::encoding::DefaultFuchsiaResourceDialect
10271                ),
10272                args: fidl::new_empty!(
10273                    CreateChildArgs,
10274                    fidl::encoding::DefaultFuchsiaResourceDialect
10275                ),
10276            }
10277        }
10278
10279        #[inline]
10280        unsafe fn decode(
10281            &mut self,
10282            decoder: &mut fidl::encoding::Decoder<
10283                '_,
10284                fidl::encoding::DefaultFuchsiaResourceDialect,
10285            >,
10286            offset: usize,
10287            _depth: fidl::encoding::Depth,
10288        ) -> fidl::Result<()> {
10289            decoder.debug_check_bounds::<Self>(offset);
10290            // Verify that padding bytes are zero.
10291            fidl::decode!(
10292                fidl_fuchsia_component_decl::CollectionRef,
10293                fidl::encoding::DefaultFuchsiaResourceDialect,
10294                &mut self.collection,
10295                decoder,
10296                offset + 0,
10297                _depth
10298            )?;
10299            fidl::decode!(
10300                fidl_fuchsia_component_decl::Child,
10301                fidl::encoding::DefaultFuchsiaResourceDialect,
10302                &mut self.decl,
10303                decoder,
10304                offset + 16,
10305                _depth
10306            )?;
10307            fidl::decode!(
10308                CreateChildArgs,
10309                fidl::encoding::DefaultFuchsiaResourceDialect,
10310                &mut self.args,
10311                decoder,
10312                offset + 32,
10313                _depth
10314            )?;
10315            Ok(())
10316        }
10317    }
10318
10319    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryDeprecatedRequest {
10320        type Borrowed<'a> = &'a mut Self;
10321        fn take_or_borrow<'a>(
10322            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10323        ) -> Self::Borrowed<'a> {
10324            value
10325        }
10326    }
10327
10328    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryDeprecatedRequest {
10329        type Owned = Self;
10330
10331        #[inline(always)]
10332        fn inline_align(_context: fidl::encoding::Context) -> usize {
10333            8
10334        }
10335
10336        #[inline(always)]
10337        fn inline_size(_context: fidl::encoding::Context) -> usize {
10338            32
10339        }
10340    }
10341
10342    unsafe impl
10343        fidl::encoding::Encode<
10344            RealmGetChildOutputDictionaryDeprecatedRequest,
10345            fidl::encoding::DefaultFuchsiaResourceDialect,
10346        > for &mut RealmGetChildOutputDictionaryDeprecatedRequest
10347    {
10348        #[inline]
10349        unsafe fn encode(
10350            self,
10351            encoder: &mut fidl::encoding::Encoder<
10352                '_,
10353                fidl::encoding::DefaultFuchsiaResourceDialect,
10354            >,
10355            offset: usize,
10356            _depth: fidl::encoding::Depth,
10357        ) -> fidl::Result<()> {
10358            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryDeprecatedRequest>(offset);
10359            // Delegate to tuple encoding.
10360            fidl::encoding::Encode::<RealmGetChildOutputDictionaryDeprecatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10361                (
10362                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
10363                ),
10364                encoder, offset, _depth
10365            )
10366        }
10367    }
10368    unsafe impl<
10369        T0: fidl::encoding::Encode<
10370                fidl_fuchsia_component_decl::ChildRef,
10371                fidl::encoding::DefaultFuchsiaResourceDialect,
10372            >,
10373    >
10374        fidl::encoding::Encode<
10375            RealmGetChildOutputDictionaryDeprecatedRequest,
10376            fidl::encoding::DefaultFuchsiaResourceDialect,
10377        > for (T0,)
10378    {
10379        #[inline]
10380        unsafe fn encode(
10381            self,
10382            encoder: &mut fidl::encoding::Encoder<
10383                '_,
10384                fidl::encoding::DefaultFuchsiaResourceDialect,
10385            >,
10386            offset: usize,
10387            depth: fidl::encoding::Depth,
10388        ) -> fidl::Result<()> {
10389            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryDeprecatedRequest>(offset);
10390            // Zero out padding regions. There's no need to apply masks
10391            // because the unmasked parts will be overwritten by fields.
10392            // Write the fields.
10393            self.0.encode(encoder, offset + 0, depth)?;
10394            Ok(())
10395        }
10396    }
10397
10398    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10399        for RealmGetChildOutputDictionaryDeprecatedRequest
10400    {
10401        #[inline(always)]
10402        fn new_empty() -> Self {
10403            Self {
10404                child: fidl::new_empty!(
10405                    fidl_fuchsia_component_decl::ChildRef,
10406                    fidl::encoding::DefaultFuchsiaResourceDialect
10407                ),
10408            }
10409        }
10410
10411        #[inline]
10412        unsafe fn decode(
10413            &mut self,
10414            decoder: &mut fidl::encoding::Decoder<
10415                '_,
10416                fidl::encoding::DefaultFuchsiaResourceDialect,
10417            >,
10418            offset: usize,
10419            _depth: fidl::encoding::Depth,
10420        ) -> fidl::Result<()> {
10421            decoder.debug_check_bounds::<Self>(offset);
10422            // Verify that padding bytes are zero.
10423            fidl::decode!(
10424                fidl_fuchsia_component_decl::ChildRef,
10425                fidl::encoding::DefaultFuchsiaResourceDialect,
10426                &mut self.child,
10427                decoder,
10428                offset + 0,
10429                _depth
10430            )?;
10431            Ok(())
10432        }
10433    }
10434
10435    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryRequest {
10436        type Borrowed<'a> = &'a mut Self;
10437        fn take_or_borrow<'a>(
10438            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10439        ) -> Self::Borrowed<'a> {
10440            value
10441        }
10442    }
10443
10444    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryRequest {
10445        type Owned = Self;
10446
10447        #[inline(always)]
10448        fn inline_align(_context: fidl::encoding::Context) -> usize {
10449            8
10450        }
10451
10452        #[inline(always)]
10453        fn inline_size(_context: fidl::encoding::Context) -> usize {
10454            32
10455        }
10456    }
10457
10458    unsafe impl
10459        fidl::encoding::Encode<
10460            RealmGetChildOutputDictionaryRequest,
10461            fidl::encoding::DefaultFuchsiaResourceDialect,
10462        > for &mut RealmGetChildOutputDictionaryRequest
10463    {
10464        #[inline]
10465        unsafe fn encode(
10466            self,
10467            encoder: &mut fidl::encoding::Encoder<
10468                '_,
10469                fidl::encoding::DefaultFuchsiaResourceDialect,
10470            >,
10471            offset: usize,
10472            _depth: fidl::encoding::Depth,
10473        ) -> fidl::Result<()> {
10474            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryRequest>(offset);
10475            // Delegate to tuple encoding.
10476            fidl::encoding::Encode::<RealmGetChildOutputDictionaryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10477                (
10478                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
10479                ),
10480                encoder, offset, _depth
10481            )
10482        }
10483    }
10484    unsafe impl<
10485        T0: fidl::encoding::Encode<
10486                fidl_fuchsia_component_decl::ChildRef,
10487                fidl::encoding::DefaultFuchsiaResourceDialect,
10488            >,
10489    >
10490        fidl::encoding::Encode<
10491            RealmGetChildOutputDictionaryRequest,
10492            fidl::encoding::DefaultFuchsiaResourceDialect,
10493        > for (T0,)
10494    {
10495        #[inline]
10496        unsafe fn encode(
10497            self,
10498            encoder: &mut fidl::encoding::Encoder<
10499                '_,
10500                fidl::encoding::DefaultFuchsiaResourceDialect,
10501            >,
10502            offset: usize,
10503            depth: fidl::encoding::Depth,
10504        ) -> fidl::Result<()> {
10505            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryRequest>(offset);
10506            // Zero out padding regions. There's no need to apply masks
10507            // because the unmasked parts will be overwritten by fields.
10508            // Write the fields.
10509            self.0.encode(encoder, offset + 0, depth)?;
10510            Ok(())
10511        }
10512    }
10513
10514    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10515        for RealmGetChildOutputDictionaryRequest
10516    {
10517        #[inline(always)]
10518        fn new_empty() -> Self {
10519            Self {
10520                child: fidl::new_empty!(
10521                    fidl_fuchsia_component_decl::ChildRef,
10522                    fidl::encoding::DefaultFuchsiaResourceDialect
10523                ),
10524            }
10525        }
10526
10527        #[inline]
10528        unsafe fn decode(
10529            &mut self,
10530            decoder: &mut fidl::encoding::Decoder<
10531                '_,
10532                fidl::encoding::DefaultFuchsiaResourceDialect,
10533            >,
10534            offset: usize,
10535            _depth: fidl::encoding::Depth,
10536        ) -> fidl::Result<()> {
10537            decoder.debug_check_bounds::<Self>(offset);
10538            // Verify that padding bytes are zero.
10539            fidl::decode!(
10540                fidl_fuchsia_component_decl::ChildRef,
10541                fidl::encoding::DefaultFuchsiaResourceDialect,
10542                &mut self.child,
10543                decoder,
10544                offset + 0,
10545                _depth
10546            )?;
10547            Ok(())
10548        }
10549    }
10550
10551    impl fidl::encoding::ResourceTypeMarker for RealmListChildrenRequest {
10552        type Borrowed<'a> = &'a mut Self;
10553        fn take_or_borrow<'a>(
10554            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10555        ) -> Self::Borrowed<'a> {
10556            value
10557        }
10558    }
10559
10560    unsafe impl fidl::encoding::TypeMarker for RealmListChildrenRequest {
10561        type Owned = Self;
10562
10563        #[inline(always)]
10564        fn inline_align(_context: fidl::encoding::Context) -> usize {
10565            8
10566        }
10567
10568        #[inline(always)]
10569        fn inline_size(_context: fidl::encoding::Context) -> usize {
10570            24
10571        }
10572    }
10573
10574    unsafe impl
10575        fidl::encoding::Encode<
10576            RealmListChildrenRequest,
10577            fidl::encoding::DefaultFuchsiaResourceDialect,
10578        > for &mut RealmListChildrenRequest
10579    {
10580        #[inline]
10581        unsafe fn encode(
10582            self,
10583            encoder: &mut fidl::encoding::Encoder<
10584                '_,
10585                fidl::encoding::DefaultFuchsiaResourceDialect,
10586            >,
10587            offset: usize,
10588            _depth: fidl::encoding::Depth,
10589        ) -> fidl::Result<()> {
10590            encoder.debug_check_bounds::<RealmListChildrenRequest>(offset);
10591            // Delegate to tuple encoding.
10592            fidl::encoding::Encode::<RealmListChildrenRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10593                (
10594                    <fidl_fuchsia_component_decl::CollectionRef as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
10595                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iter),
10596                ),
10597                encoder, offset, _depth
10598            )
10599        }
10600    }
10601    unsafe impl<
10602        T0: fidl::encoding::Encode<
10603                fidl_fuchsia_component_decl::CollectionRef,
10604                fidl::encoding::DefaultFuchsiaResourceDialect,
10605            >,
10606        T1: fidl::encoding::Encode<
10607                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
10608                fidl::encoding::DefaultFuchsiaResourceDialect,
10609            >,
10610    >
10611        fidl::encoding::Encode<
10612            RealmListChildrenRequest,
10613            fidl::encoding::DefaultFuchsiaResourceDialect,
10614        > for (T0, T1)
10615    {
10616        #[inline]
10617        unsafe fn encode(
10618            self,
10619            encoder: &mut fidl::encoding::Encoder<
10620                '_,
10621                fidl::encoding::DefaultFuchsiaResourceDialect,
10622            >,
10623            offset: usize,
10624            depth: fidl::encoding::Depth,
10625        ) -> fidl::Result<()> {
10626            encoder.debug_check_bounds::<RealmListChildrenRequest>(offset);
10627            // Zero out padding regions. There's no need to apply masks
10628            // because the unmasked parts will be overwritten by fields.
10629            unsafe {
10630                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10631                (ptr as *mut u64).write_unaligned(0);
10632            }
10633            // Write the fields.
10634            self.0.encode(encoder, offset + 0, depth)?;
10635            self.1.encode(encoder, offset + 16, depth)?;
10636            Ok(())
10637        }
10638    }
10639
10640    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10641        for RealmListChildrenRequest
10642    {
10643        #[inline(always)]
10644        fn new_empty() -> Self {
10645            Self {
10646                collection: fidl::new_empty!(
10647                    fidl_fuchsia_component_decl::CollectionRef,
10648                    fidl::encoding::DefaultFuchsiaResourceDialect
10649                ),
10650                iter: fidl::new_empty!(
10651                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
10652                    fidl::encoding::DefaultFuchsiaResourceDialect
10653                ),
10654            }
10655        }
10656
10657        #[inline]
10658        unsafe fn decode(
10659            &mut self,
10660            decoder: &mut fidl::encoding::Decoder<
10661                '_,
10662                fidl::encoding::DefaultFuchsiaResourceDialect,
10663            >,
10664            offset: usize,
10665            _depth: fidl::encoding::Depth,
10666        ) -> fidl::Result<()> {
10667            decoder.debug_check_bounds::<Self>(offset);
10668            // Verify that padding bytes are zero.
10669            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10670            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10671            let mask = 0xffffffff00000000u64;
10672            let maskedval = padval & mask;
10673            if maskedval != 0 {
10674                return Err(fidl::Error::NonZeroPadding {
10675                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10676                });
10677            }
10678            fidl::decode!(
10679                fidl_fuchsia_component_decl::CollectionRef,
10680                fidl::encoding::DefaultFuchsiaResourceDialect,
10681                &mut self.collection,
10682                decoder,
10683                offset + 0,
10684                _depth
10685            )?;
10686            fidl::decode!(
10687                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
10688                fidl::encoding::DefaultFuchsiaResourceDialect,
10689                &mut self.iter,
10690                decoder,
10691                offset + 16,
10692                _depth
10693            )?;
10694            Ok(())
10695        }
10696    }
10697
10698    impl fidl::encoding::ResourceTypeMarker for RealmOpenControllerRequest {
10699        type Borrowed<'a> = &'a mut Self;
10700        fn take_or_borrow<'a>(
10701            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10702        ) -> Self::Borrowed<'a> {
10703            value
10704        }
10705    }
10706
10707    unsafe impl fidl::encoding::TypeMarker for RealmOpenControllerRequest {
10708        type Owned = Self;
10709
10710        #[inline(always)]
10711        fn inline_align(_context: fidl::encoding::Context) -> usize {
10712            8
10713        }
10714
10715        #[inline(always)]
10716        fn inline_size(_context: fidl::encoding::Context) -> usize {
10717            40
10718        }
10719    }
10720
10721    unsafe impl
10722        fidl::encoding::Encode<
10723            RealmOpenControllerRequest,
10724            fidl::encoding::DefaultFuchsiaResourceDialect,
10725        > for &mut RealmOpenControllerRequest
10726    {
10727        #[inline]
10728        unsafe fn encode(
10729            self,
10730            encoder: &mut fidl::encoding::Encoder<
10731                '_,
10732                fidl::encoding::DefaultFuchsiaResourceDialect,
10733            >,
10734            offset: usize,
10735            _depth: fidl::encoding::Depth,
10736        ) -> fidl::Result<()> {
10737            encoder.debug_check_bounds::<RealmOpenControllerRequest>(offset);
10738            // Delegate to tuple encoding.
10739            fidl::encoding::Encode::<RealmOpenControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10740                (
10741                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
10742                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
10743                ),
10744                encoder, offset, _depth
10745            )
10746        }
10747    }
10748    unsafe impl<
10749        T0: fidl::encoding::Encode<
10750                fidl_fuchsia_component_decl::ChildRef,
10751                fidl::encoding::DefaultFuchsiaResourceDialect,
10752            >,
10753        T1: fidl::encoding::Encode<
10754                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10755                fidl::encoding::DefaultFuchsiaResourceDialect,
10756            >,
10757    >
10758        fidl::encoding::Encode<
10759            RealmOpenControllerRequest,
10760            fidl::encoding::DefaultFuchsiaResourceDialect,
10761        > for (T0, T1)
10762    {
10763        #[inline]
10764        unsafe fn encode(
10765            self,
10766            encoder: &mut fidl::encoding::Encoder<
10767                '_,
10768                fidl::encoding::DefaultFuchsiaResourceDialect,
10769            >,
10770            offset: usize,
10771            depth: fidl::encoding::Depth,
10772        ) -> fidl::Result<()> {
10773            encoder.debug_check_bounds::<RealmOpenControllerRequest>(offset);
10774            // Zero out padding regions. There's no need to apply masks
10775            // because the unmasked parts will be overwritten by fields.
10776            unsafe {
10777                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10778                (ptr as *mut u64).write_unaligned(0);
10779            }
10780            // Write the fields.
10781            self.0.encode(encoder, offset + 0, depth)?;
10782            self.1.encode(encoder, offset + 32, depth)?;
10783            Ok(())
10784        }
10785    }
10786
10787    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10788        for RealmOpenControllerRequest
10789    {
10790        #[inline(always)]
10791        fn new_empty() -> Self {
10792            Self {
10793                child: fidl::new_empty!(
10794                    fidl_fuchsia_component_decl::ChildRef,
10795                    fidl::encoding::DefaultFuchsiaResourceDialect
10796                ),
10797                controller: fidl::new_empty!(
10798                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10799                    fidl::encoding::DefaultFuchsiaResourceDialect
10800                ),
10801            }
10802        }
10803
10804        #[inline]
10805        unsafe fn decode(
10806            &mut self,
10807            decoder: &mut fidl::encoding::Decoder<
10808                '_,
10809                fidl::encoding::DefaultFuchsiaResourceDialect,
10810            >,
10811            offset: usize,
10812            _depth: fidl::encoding::Depth,
10813        ) -> fidl::Result<()> {
10814            decoder.debug_check_bounds::<Self>(offset);
10815            // Verify that padding bytes are zero.
10816            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10817            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10818            let mask = 0xffffffff00000000u64;
10819            let maskedval = padval & mask;
10820            if maskedval != 0 {
10821                return Err(fidl::Error::NonZeroPadding {
10822                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10823                });
10824            }
10825            fidl::decode!(
10826                fidl_fuchsia_component_decl::ChildRef,
10827                fidl::encoding::DefaultFuchsiaResourceDialect,
10828                &mut self.child,
10829                decoder,
10830                offset + 0,
10831                _depth
10832            )?;
10833            fidl::decode!(
10834                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10835                fidl::encoding::DefaultFuchsiaResourceDialect,
10836                &mut self.controller,
10837                decoder,
10838                offset + 32,
10839                _depth
10840            )?;
10841            Ok(())
10842        }
10843    }
10844
10845    impl fidl::encoding::ResourceTypeMarker for RealmOpenExposedDirRequest {
10846        type Borrowed<'a> = &'a mut Self;
10847        fn take_or_borrow<'a>(
10848            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10849        ) -> Self::Borrowed<'a> {
10850            value
10851        }
10852    }
10853
10854    unsafe impl fidl::encoding::TypeMarker for RealmOpenExposedDirRequest {
10855        type Owned = Self;
10856
10857        #[inline(always)]
10858        fn inline_align(_context: fidl::encoding::Context) -> usize {
10859            8
10860        }
10861
10862        #[inline(always)]
10863        fn inline_size(_context: fidl::encoding::Context) -> usize {
10864            40
10865        }
10866    }
10867
10868    unsafe impl
10869        fidl::encoding::Encode<
10870            RealmOpenExposedDirRequest,
10871            fidl::encoding::DefaultFuchsiaResourceDialect,
10872        > for &mut RealmOpenExposedDirRequest
10873    {
10874        #[inline]
10875        unsafe fn encode(
10876            self,
10877            encoder: &mut fidl::encoding::Encoder<
10878                '_,
10879                fidl::encoding::DefaultFuchsiaResourceDialect,
10880            >,
10881            offset: usize,
10882            _depth: fidl::encoding::Depth,
10883        ) -> fidl::Result<()> {
10884            encoder.debug_check_bounds::<RealmOpenExposedDirRequest>(offset);
10885            // Delegate to tuple encoding.
10886            fidl::encoding::Encode::<RealmOpenExposedDirRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10887                (
10888                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
10889                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.exposed_dir),
10890                ),
10891                encoder, offset, _depth
10892            )
10893        }
10894    }
10895    unsafe impl<
10896        T0: fidl::encoding::Encode<
10897                fidl_fuchsia_component_decl::ChildRef,
10898                fidl::encoding::DefaultFuchsiaResourceDialect,
10899            >,
10900        T1: fidl::encoding::Encode<
10901                fidl::encoding::Endpoint<
10902                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10903                >,
10904                fidl::encoding::DefaultFuchsiaResourceDialect,
10905            >,
10906    >
10907        fidl::encoding::Encode<
10908            RealmOpenExposedDirRequest,
10909            fidl::encoding::DefaultFuchsiaResourceDialect,
10910        > for (T0, T1)
10911    {
10912        #[inline]
10913        unsafe fn encode(
10914            self,
10915            encoder: &mut fidl::encoding::Encoder<
10916                '_,
10917                fidl::encoding::DefaultFuchsiaResourceDialect,
10918            >,
10919            offset: usize,
10920            depth: fidl::encoding::Depth,
10921        ) -> fidl::Result<()> {
10922            encoder.debug_check_bounds::<RealmOpenExposedDirRequest>(offset);
10923            // Zero out padding regions. There's no need to apply masks
10924            // because the unmasked parts will be overwritten by fields.
10925            unsafe {
10926                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10927                (ptr as *mut u64).write_unaligned(0);
10928            }
10929            // Write the fields.
10930            self.0.encode(encoder, offset + 0, depth)?;
10931            self.1.encode(encoder, offset + 32, depth)?;
10932            Ok(())
10933        }
10934    }
10935
10936    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10937        for RealmOpenExposedDirRequest
10938    {
10939        #[inline(always)]
10940        fn new_empty() -> Self {
10941            Self {
10942                child: fidl::new_empty!(
10943                    fidl_fuchsia_component_decl::ChildRef,
10944                    fidl::encoding::DefaultFuchsiaResourceDialect
10945                ),
10946                exposed_dir: fidl::new_empty!(
10947                    fidl::encoding::Endpoint<
10948                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10949                    >,
10950                    fidl::encoding::DefaultFuchsiaResourceDialect
10951                ),
10952            }
10953        }
10954
10955        #[inline]
10956        unsafe fn decode(
10957            &mut self,
10958            decoder: &mut fidl::encoding::Decoder<
10959                '_,
10960                fidl::encoding::DefaultFuchsiaResourceDialect,
10961            >,
10962            offset: usize,
10963            _depth: fidl::encoding::Depth,
10964        ) -> fidl::Result<()> {
10965            decoder.debug_check_bounds::<Self>(offset);
10966            // Verify that padding bytes are zero.
10967            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10968            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10969            let mask = 0xffffffff00000000u64;
10970            let maskedval = padval & mask;
10971            if maskedval != 0 {
10972                return Err(fidl::Error::NonZeroPadding {
10973                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10974                });
10975            }
10976            fidl::decode!(
10977                fidl_fuchsia_component_decl::ChildRef,
10978                fidl::encoding::DefaultFuchsiaResourceDialect,
10979                &mut self.child,
10980                decoder,
10981                offset + 0,
10982                _depth
10983            )?;
10984            fidl::decode!(
10985                fidl::encoding::Endpoint<
10986                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
10987                >,
10988                fidl::encoding::DefaultFuchsiaResourceDialect,
10989                &mut self.exposed_dir,
10990                decoder,
10991                offset + 32,
10992                _depth
10993            )?;
10994            Ok(())
10995        }
10996    }
10997
10998    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryDeprecatedResponse {
10999        type Borrowed<'a> = &'a mut Self;
11000        fn take_or_borrow<'a>(
11001            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11002        ) -> Self::Borrowed<'a> {
11003            value
11004        }
11005    }
11006
11007    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryDeprecatedResponse {
11008        type Owned = Self;
11009
11010        #[inline(always)]
11011        fn inline_align(_context: fidl::encoding::Context) -> usize {
11012            4
11013        }
11014
11015        #[inline(always)]
11016        fn inline_size(_context: fidl::encoding::Context) -> usize {
11017            4
11018        }
11019    }
11020
11021    unsafe impl
11022        fidl::encoding::Encode<
11023            RealmGetChildOutputDictionaryDeprecatedResponse,
11024            fidl::encoding::DefaultFuchsiaResourceDialect,
11025        > for &mut RealmGetChildOutputDictionaryDeprecatedResponse
11026    {
11027        #[inline]
11028        unsafe fn encode(
11029            self,
11030            encoder: &mut fidl::encoding::Encoder<
11031                '_,
11032                fidl::encoding::DefaultFuchsiaResourceDialect,
11033            >,
11034            offset: usize,
11035            _depth: fidl::encoding::Depth,
11036        ) -> fidl::Result<()> {
11037            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryDeprecatedResponse>(offset);
11038            // Delegate to tuple encoding.
11039            fidl::encoding::Encode::<RealmGetChildOutputDictionaryDeprecatedResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11040                (
11041                    <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
11042                ),
11043                encoder, offset, _depth
11044            )
11045        }
11046    }
11047    unsafe impl<
11048        T0: fidl::encoding::Encode<
11049                fidl_fuchsia_component_sandbox::DictionaryRef,
11050                fidl::encoding::DefaultFuchsiaResourceDialect,
11051            >,
11052    >
11053        fidl::encoding::Encode<
11054            RealmGetChildOutputDictionaryDeprecatedResponse,
11055            fidl::encoding::DefaultFuchsiaResourceDialect,
11056        > for (T0,)
11057    {
11058        #[inline]
11059        unsafe fn encode(
11060            self,
11061            encoder: &mut fidl::encoding::Encoder<
11062                '_,
11063                fidl::encoding::DefaultFuchsiaResourceDialect,
11064            >,
11065            offset: usize,
11066            depth: fidl::encoding::Depth,
11067        ) -> fidl::Result<()> {
11068            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryDeprecatedResponse>(offset);
11069            // Zero out padding regions. There's no need to apply masks
11070            // because the unmasked parts will be overwritten by fields.
11071            // Write the fields.
11072            self.0.encode(encoder, offset + 0, depth)?;
11073            Ok(())
11074        }
11075    }
11076
11077    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11078        for RealmGetChildOutputDictionaryDeprecatedResponse
11079    {
11080        #[inline(always)]
11081        fn new_empty() -> Self {
11082            Self {
11083                dictionary: fidl::new_empty!(
11084                    fidl_fuchsia_component_sandbox::DictionaryRef,
11085                    fidl::encoding::DefaultFuchsiaResourceDialect
11086                ),
11087            }
11088        }
11089
11090        #[inline]
11091        unsafe fn decode(
11092            &mut self,
11093            decoder: &mut fidl::encoding::Decoder<
11094                '_,
11095                fidl::encoding::DefaultFuchsiaResourceDialect,
11096            >,
11097            offset: usize,
11098            _depth: fidl::encoding::Depth,
11099        ) -> fidl::Result<()> {
11100            decoder.debug_check_bounds::<Self>(offset);
11101            // Verify that padding bytes are zero.
11102            fidl::decode!(
11103                fidl_fuchsia_component_sandbox::DictionaryRef,
11104                fidl::encoding::DefaultFuchsiaResourceDialect,
11105                &mut self.dictionary,
11106                decoder,
11107                offset + 0,
11108                _depth
11109            )?;
11110            Ok(())
11111        }
11112    }
11113
11114    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryResponse {
11115        type Borrowed<'a> = &'a mut Self;
11116        fn take_or_borrow<'a>(
11117            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11118        ) -> Self::Borrowed<'a> {
11119            value
11120        }
11121    }
11122
11123    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryResponse {
11124        type Owned = Self;
11125
11126        #[inline(always)]
11127        fn inline_align(_context: fidl::encoding::Context) -> usize {
11128            4
11129        }
11130
11131        #[inline(always)]
11132        fn inline_size(_context: fidl::encoding::Context) -> usize {
11133            4
11134        }
11135    }
11136
11137    unsafe impl
11138        fidl::encoding::Encode<
11139            RealmGetChildOutputDictionaryResponse,
11140            fidl::encoding::DefaultFuchsiaResourceDialect,
11141        > for &mut RealmGetChildOutputDictionaryResponse
11142    {
11143        #[inline]
11144        unsafe fn encode(
11145            self,
11146            encoder: &mut fidl::encoding::Encoder<
11147                '_,
11148                fidl::encoding::DefaultFuchsiaResourceDialect,
11149            >,
11150            offset: usize,
11151            _depth: fidl::encoding::Depth,
11152        ) -> fidl::Result<()> {
11153            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryResponse>(offset);
11154            // Delegate to tuple encoding.
11155            fidl::encoding::Encode::<
11156                RealmGetChildOutputDictionaryResponse,
11157                fidl::encoding::DefaultFuchsiaResourceDialect,
11158            >::encode(
11159                (<fidl::encoding::HandleType<
11160                    fidl::EventPair,
11161                    { fidl::ObjectType::EVENTPAIR.into_raw() },
11162                    2147483648,
11163                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11164                    &mut self.dictionary
11165                ),),
11166                encoder,
11167                offset,
11168                _depth,
11169            )
11170        }
11171    }
11172    unsafe impl<
11173        T0: fidl::encoding::Encode<
11174                fidl::encoding::HandleType<
11175                    fidl::EventPair,
11176                    { fidl::ObjectType::EVENTPAIR.into_raw() },
11177                    2147483648,
11178                >,
11179                fidl::encoding::DefaultFuchsiaResourceDialect,
11180            >,
11181    >
11182        fidl::encoding::Encode<
11183            RealmGetChildOutputDictionaryResponse,
11184            fidl::encoding::DefaultFuchsiaResourceDialect,
11185        > for (T0,)
11186    {
11187        #[inline]
11188        unsafe fn encode(
11189            self,
11190            encoder: &mut fidl::encoding::Encoder<
11191                '_,
11192                fidl::encoding::DefaultFuchsiaResourceDialect,
11193            >,
11194            offset: usize,
11195            depth: fidl::encoding::Depth,
11196        ) -> fidl::Result<()> {
11197            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryResponse>(offset);
11198            // Zero out padding regions. There's no need to apply masks
11199            // because the unmasked parts will be overwritten by fields.
11200            // Write the fields.
11201            self.0.encode(encoder, offset + 0, depth)?;
11202            Ok(())
11203        }
11204    }
11205
11206    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11207        for RealmGetChildOutputDictionaryResponse
11208    {
11209        #[inline(always)]
11210        fn new_empty() -> Self {
11211            Self {
11212                dictionary: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11213            }
11214        }
11215
11216        #[inline]
11217        unsafe fn decode(
11218            &mut self,
11219            decoder: &mut fidl::encoding::Decoder<
11220                '_,
11221                fidl::encoding::DefaultFuchsiaResourceDialect,
11222            >,
11223            offset: usize,
11224            _depth: fidl::encoding::Depth,
11225        ) -> fidl::Result<()> {
11226            decoder.debug_check_bounds::<Self>(offset);
11227            // Verify that padding bytes are zero.
11228            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.dictionary, decoder, offset + 0, _depth)?;
11229            Ok(())
11230        }
11231    }
11232
11233    impl fidl::encoding::ResourceTypeMarker for RealmGetResolvedInfoResponse {
11234        type Borrowed<'a> = &'a mut Self;
11235        fn take_or_borrow<'a>(
11236            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11237        ) -> Self::Borrowed<'a> {
11238            value
11239        }
11240    }
11241
11242    unsafe impl fidl::encoding::TypeMarker for RealmGetResolvedInfoResponse {
11243        type Owned = Self;
11244
11245        #[inline(always)]
11246        fn inline_align(_context: fidl::encoding::Context) -> usize {
11247            8
11248        }
11249
11250        #[inline(always)]
11251        fn inline_size(_context: fidl::encoding::Context) -> usize {
11252            16
11253        }
11254    }
11255
11256    unsafe impl
11257        fidl::encoding::Encode<
11258            RealmGetResolvedInfoResponse,
11259            fidl::encoding::DefaultFuchsiaResourceDialect,
11260        > for &mut RealmGetResolvedInfoResponse
11261    {
11262        #[inline]
11263        unsafe fn encode(
11264            self,
11265            encoder: &mut fidl::encoding::Encoder<
11266                '_,
11267                fidl::encoding::DefaultFuchsiaResourceDialect,
11268            >,
11269            offset: usize,
11270            _depth: fidl::encoding::Depth,
11271        ) -> fidl::Result<()> {
11272            encoder.debug_check_bounds::<RealmGetResolvedInfoResponse>(offset);
11273            // Delegate to tuple encoding.
11274            fidl::encoding::Encode::<RealmGetResolvedInfoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11275                (
11276                    <fidl_fuchsia_component_resolution::Component as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.resolved_info),
11277                ),
11278                encoder, offset, _depth
11279            )
11280        }
11281    }
11282    unsafe impl<
11283        T0: fidl::encoding::Encode<
11284                fidl_fuchsia_component_resolution::Component,
11285                fidl::encoding::DefaultFuchsiaResourceDialect,
11286            >,
11287    >
11288        fidl::encoding::Encode<
11289            RealmGetResolvedInfoResponse,
11290            fidl::encoding::DefaultFuchsiaResourceDialect,
11291        > for (T0,)
11292    {
11293        #[inline]
11294        unsafe fn encode(
11295            self,
11296            encoder: &mut fidl::encoding::Encoder<
11297                '_,
11298                fidl::encoding::DefaultFuchsiaResourceDialect,
11299            >,
11300            offset: usize,
11301            depth: fidl::encoding::Depth,
11302        ) -> fidl::Result<()> {
11303            encoder.debug_check_bounds::<RealmGetResolvedInfoResponse>(offset);
11304            // Zero out padding regions. There's no need to apply masks
11305            // because the unmasked parts will be overwritten by fields.
11306            // Write the fields.
11307            self.0.encode(encoder, offset + 0, depth)?;
11308            Ok(())
11309        }
11310    }
11311
11312    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11313        for RealmGetResolvedInfoResponse
11314    {
11315        #[inline(always)]
11316        fn new_empty() -> Self {
11317            Self {
11318                resolved_info: fidl::new_empty!(
11319                    fidl_fuchsia_component_resolution::Component,
11320                    fidl::encoding::DefaultFuchsiaResourceDialect
11321                ),
11322            }
11323        }
11324
11325        #[inline]
11326        unsafe fn decode(
11327            &mut self,
11328            decoder: &mut fidl::encoding::Decoder<
11329                '_,
11330                fidl::encoding::DefaultFuchsiaResourceDialect,
11331            >,
11332            offset: usize,
11333            _depth: fidl::encoding::Depth,
11334        ) -> fidl::Result<()> {
11335            decoder.debug_check_bounds::<Self>(offset);
11336            // Verify that padding bytes are zero.
11337            fidl::decode!(
11338                fidl_fuchsia_component_resolution::Component,
11339                fidl::encoding::DefaultFuchsiaResourceDialect,
11340                &mut self.resolved_info,
11341                decoder,
11342                offset + 0,
11343                _depth
11344            )?;
11345            Ok(())
11346        }
11347    }
11348
11349    impl fidl::encoding::ResourceTypeMarker for StorageAdminListStorageInRealmRequest {
11350        type Borrowed<'a> = &'a mut Self;
11351        fn take_or_borrow<'a>(
11352            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11353        ) -> Self::Borrowed<'a> {
11354            value
11355        }
11356    }
11357
11358    unsafe impl fidl::encoding::TypeMarker for StorageAdminListStorageInRealmRequest {
11359        type Owned = Self;
11360
11361        #[inline(always)]
11362        fn inline_align(_context: fidl::encoding::Context) -> usize {
11363            8
11364        }
11365
11366        #[inline(always)]
11367        fn inline_size(_context: fidl::encoding::Context) -> usize {
11368            24
11369        }
11370    }
11371
11372    unsafe impl
11373        fidl::encoding::Encode<
11374            StorageAdminListStorageInRealmRequest,
11375            fidl::encoding::DefaultFuchsiaResourceDialect,
11376        > for &mut StorageAdminListStorageInRealmRequest
11377    {
11378        #[inline]
11379        unsafe fn encode(
11380            self,
11381            encoder: &mut fidl::encoding::Encoder<
11382                '_,
11383                fidl::encoding::DefaultFuchsiaResourceDialect,
11384            >,
11385            offset: usize,
11386            _depth: fidl::encoding::Depth,
11387        ) -> fidl::Result<()> {
11388            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
11389            // Delegate to tuple encoding.
11390            fidl::encoding::Encode::<StorageAdminListStorageInRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11391                (
11392                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
11393                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
11394                ),
11395                encoder, offset, _depth
11396            )
11397        }
11398    }
11399    unsafe impl<
11400        T0: fidl::encoding::Encode<
11401                fidl::encoding::BoundedString<4096>,
11402                fidl::encoding::DefaultFuchsiaResourceDialect,
11403            >,
11404        T1: fidl::encoding::Encode<
11405                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
11406                fidl::encoding::DefaultFuchsiaResourceDialect,
11407            >,
11408    >
11409        fidl::encoding::Encode<
11410            StorageAdminListStorageInRealmRequest,
11411            fidl::encoding::DefaultFuchsiaResourceDialect,
11412        > for (T0, T1)
11413    {
11414        #[inline]
11415        unsafe fn encode(
11416            self,
11417            encoder: &mut fidl::encoding::Encoder<
11418                '_,
11419                fidl::encoding::DefaultFuchsiaResourceDialect,
11420            >,
11421            offset: usize,
11422            depth: fidl::encoding::Depth,
11423        ) -> fidl::Result<()> {
11424            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
11425            // Zero out padding regions. There's no need to apply masks
11426            // because the unmasked parts will be overwritten by fields.
11427            unsafe {
11428                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11429                (ptr as *mut u64).write_unaligned(0);
11430            }
11431            // Write the fields.
11432            self.0.encode(encoder, offset + 0, depth)?;
11433            self.1.encode(encoder, offset + 16, depth)?;
11434            Ok(())
11435        }
11436    }
11437
11438    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11439        for StorageAdminListStorageInRealmRequest
11440    {
11441        #[inline(always)]
11442        fn new_empty() -> Self {
11443            Self {
11444                relative_moniker: fidl::new_empty!(
11445                    fidl::encoding::BoundedString<4096>,
11446                    fidl::encoding::DefaultFuchsiaResourceDialect
11447                ),
11448                iterator: fidl::new_empty!(
11449                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
11450                    fidl::encoding::DefaultFuchsiaResourceDialect
11451                ),
11452            }
11453        }
11454
11455        #[inline]
11456        unsafe fn decode(
11457            &mut self,
11458            decoder: &mut fidl::encoding::Decoder<
11459                '_,
11460                fidl::encoding::DefaultFuchsiaResourceDialect,
11461            >,
11462            offset: usize,
11463            _depth: fidl::encoding::Depth,
11464        ) -> fidl::Result<()> {
11465            decoder.debug_check_bounds::<Self>(offset);
11466            // Verify that padding bytes are zero.
11467            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11468            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11469            let mask = 0xffffffff00000000u64;
11470            let maskedval = padval & mask;
11471            if maskedval != 0 {
11472                return Err(fidl::Error::NonZeroPadding {
11473                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11474                });
11475            }
11476            fidl::decode!(
11477                fidl::encoding::BoundedString<4096>,
11478                fidl::encoding::DefaultFuchsiaResourceDialect,
11479                &mut self.relative_moniker,
11480                decoder,
11481                offset + 0,
11482                _depth
11483            )?;
11484            fidl::decode!(
11485                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
11486                fidl::encoding::DefaultFuchsiaResourceDialect,
11487                &mut self.iterator,
11488                decoder,
11489                offset + 16,
11490                _depth
11491            )?;
11492            Ok(())
11493        }
11494    }
11495
11496    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenComponentStorageByIdRequest {
11497        type Borrowed<'a> = &'a mut Self;
11498        fn take_or_borrow<'a>(
11499            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11500        ) -> Self::Borrowed<'a> {
11501            value
11502        }
11503    }
11504
11505    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenComponentStorageByIdRequest {
11506        type Owned = Self;
11507
11508        #[inline(always)]
11509        fn inline_align(_context: fidl::encoding::Context) -> usize {
11510            8
11511        }
11512
11513        #[inline(always)]
11514        fn inline_size(_context: fidl::encoding::Context) -> usize {
11515            24
11516        }
11517    }
11518
11519    unsafe impl
11520        fidl::encoding::Encode<
11521            StorageAdminOpenComponentStorageByIdRequest,
11522            fidl::encoding::DefaultFuchsiaResourceDialect,
11523        > for &mut StorageAdminOpenComponentStorageByIdRequest
11524    {
11525        #[inline]
11526        unsafe fn encode(
11527            self,
11528            encoder: &mut fidl::encoding::Encoder<
11529                '_,
11530                fidl::encoding::DefaultFuchsiaResourceDialect,
11531            >,
11532            offset: usize,
11533            _depth: fidl::encoding::Depth,
11534        ) -> fidl::Result<()> {
11535            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
11536            // Delegate to tuple encoding.
11537            fidl::encoding::Encode::<
11538                StorageAdminOpenComponentStorageByIdRequest,
11539                fidl::encoding::DefaultFuchsiaResourceDialect,
11540            >::encode(
11541                (
11542                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
11543                        &self.id,
11544                    ),
11545                    <fidl::encoding::Endpoint<
11546                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
11547                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11548                        &mut self.object
11549                    ),
11550                ),
11551                encoder,
11552                offset,
11553                _depth,
11554            )
11555        }
11556    }
11557    unsafe impl<
11558        T0: fidl::encoding::Encode<
11559                fidl::encoding::BoundedString<64>,
11560                fidl::encoding::DefaultFuchsiaResourceDialect,
11561            >,
11562        T1: fidl::encoding::Encode<
11563                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11564                fidl::encoding::DefaultFuchsiaResourceDialect,
11565            >,
11566    >
11567        fidl::encoding::Encode<
11568            StorageAdminOpenComponentStorageByIdRequest,
11569            fidl::encoding::DefaultFuchsiaResourceDialect,
11570        > for (T0, T1)
11571    {
11572        #[inline]
11573        unsafe fn encode(
11574            self,
11575            encoder: &mut fidl::encoding::Encoder<
11576                '_,
11577                fidl::encoding::DefaultFuchsiaResourceDialect,
11578            >,
11579            offset: usize,
11580            depth: fidl::encoding::Depth,
11581        ) -> fidl::Result<()> {
11582            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
11583            // Zero out padding regions. There's no need to apply masks
11584            // because the unmasked parts will be overwritten by fields.
11585            unsafe {
11586                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11587                (ptr as *mut u64).write_unaligned(0);
11588            }
11589            // Write the fields.
11590            self.0.encode(encoder, offset + 0, depth)?;
11591            self.1.encode(encoder, offset + 16, depth)?;
11592            Ok(())
11593        }
11594    }
11595
11596    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11597        for StorageAdminOpenComponentStorageByIdRequest
11598    {
11599        #[inline(always)]
11600        fn new_empty() -> Self {
11601            Self {
11602                id: fidl::new_empty!(
11603                    fidl::encoding::BoundedString<64>,
11604                    fidl::encoding::DefaultFuchsiaResourceDialect
11605                ),
11606                object: fidl::new_empty!(
11607                    fidl::encoding::Endpoint<
11608                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
11609                    >,
11610                    fidl::encoding::DefaultFuchsiaResourceDialect
11611                ),
11612            }
11613        }
11614
11615        #[inline]
11616        unsafe fn decode(
11617            &mut self,
11618            decoder: &mut fidl::encoding::Decoder<
11619                '_,
11620                fidl::encoding::DefaultFuchsiaResourceDialect,
11621            >,
11622            offset: usize,
11623            _depth: fidl::encoding::Depth,
11624        ) -> fidl::Result<()> {
11625            decoder.debug_check_bounds::<Self>(offset);
11626            // Verify that padding bytes are zero.
11627            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11628            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11629            let mask = 0xffffffff00000000u64;
11630            let maskedval = padval & mask;
11631            if maskedval != 0 {
11632                return Err(fidl::Error::NonZeroPadding {
11633                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11634                });
11635            }
11636            fidl::decode!(
11637                fidl::encoding::BoundedString<64>,
11638                fidl::encoding::DefaultFuchsiaResourceDialect,
11639                &mut self.id,
11640                decoder,
11641                offset + 0,
11642                _depth
11643            )?;
11644            fidl::decode!(
11645                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11646                fidl::encoding::DefaultFuchsiaResourceDialect,
11647                &mut self.object,
11648                decoder,
11649                offset + 16,
11650                _depth
11651            )?;
11652            Ok(())
11653        }
11654    }
11655
11656    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenStorageRequest {
11657        type Borrowed<'a> = &'a mut Self;
11658        fn take_or_borrow<'a>(
11659            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11660        ) -> Self::Borrowed<'a> {
11661            value
11662        }
11663    }
11664
11665    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenStorageRequest {
11666        type Owned = Self;
11667
11668        #[inline(always)]
11669        fn inline_align(_context: fidl::encoding::Context) -> usize {
11670            8
11671        }
11672
11673        #[inline(always)]
11674        fn inline_size(_context: fidl::encoding::Context) -> usize {
11675            24
11676        }
11677    }
11678
11679    unsafe impl
11680        fidl::encoding::Encode<
11681            StorageAdminOpenStorageRequest,
11682            fidl::encoding::DefaultFuchsiaResourceDialect,
11683        > for &mut StorageAdminOpenStorageRequest
11684    {
11685        #[inline]
11686        unsafe fn encode(
11687            self,
11688            encoder: &mut fidl::encoding::Encoder<
11689                '_,
11690                fidl::encoding::DefaultFuchsiaResourceDialect,
11691            >,
11692            offset: usize,
11693            _depth: fidl::encoding::Depth,
11694        ) -> fidl::Result<()> {
11695            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
11696            // Delegate to tuple encoding.
11697            fidl::encoding::Encode::<StorageAdminOpenStorageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11698                (
11699                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
11700                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.object),
11701                ),
11702                encoder, offset, _depth
11703            )
11704        }
11705    }
11706    unsafe impl<
11707        T0: fidl::encoding::Encode<
11708                fidl::encoding::BoundedString<4096>,
11709                fidl::encoding::DefaultFuchsiaResourceDialect,
11710            >,
11711        T1: fidl::encoding::Encode<
11712                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11713                fidl::encoding::DefaultFuchsiaResourceDialect,
11714            >,
11715    >
11716        fidl::encoding::Encode<
11717            StorageAdminOpenStorageRequest,
11718            fidl::encoding::DefaultFuchsiaResourceDialect,
11719        > for (T0, T1)
11720    {
11721        #[inline]
11722        unsafe fn encode(
11723            self,
11724            encoder: &mut fidl::encoding::Encoder<
11725                '_,
11726                fidl::encoding::DefaultFuchsiaResourceDialect,
11727            >,
11728            offset: usize,
11729            depth: fidl::encoding::Depth,
11730        ) -> fidl::Result<()> {
11731            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
11732            // Zero out padding regions. There's no need to apply masks
11733            // because the unmasked parts will be overwritten by fields.
11734            unsafe {
11735                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11736                (ptr as *mut u64).write_unaligned(0);
11737            }
11738            // Write the fields.
11739            self.0.encode(encoder, offset + 0, depth)?;
11740            self.1.encode(encoder, offset + 16, depth)?;
11741            Ok(())
11742        }
11743    }
11744
11745    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11746        for StorageAdminOpenStorageRequest
11747    {
11748        #[inline(always)]
11749        fn new_empty() -> Self {
11750            Self {
11751                relative_moniker: fidl::new_empty!(
11752                    fidl::encoding::BoundedString<4096>,
11753                    fidl::encoding::DefaultFuchsiaResourceDialect
11754                ),
11755                object: fidl::new_empty!(
11756                    fidl::encoding::Endpoint<
11757                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
11758                    >,
11759                    fidl::encoding::DefaultFuchsiaResourceDialect
11760                ),
11761            }
11762        }
11763
11764        #[inline]
11765        unsafe fn decode(
11766            &mut self,
11767            decoder: &mut fidl::encoding::Decoder<
11768                '_,
11769                fidl::encoding::DefaultFuchsiaResourceDialect,
11770            >,
11771            offset: usize,
11772            _depth: fidl::encoding::Depth,
11773        ) -> fidl::Result<()> {
11774            decoder.debug_check_bounds::<Self>(offset);
11775            // Verify that padding bytes are zero.
11776            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11777            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11778            let mask = 0xffffffff00000000u64;
11779            let maskedval = padval & mask;
11780            if maskedval != 0 {
11781                return Err(fidl::Error::NonZeroPadding {
11782                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11783                });
11784            }
11785            fidl::decode!(
11786                fidl::encoding::BoundedString<4096>,
11787                fidl::encoding::DefaultFuchsiaResourceDialect,
11788                &mut self.relative_moniker,
11789                decoder,
11790                offset + 0,
11791                _depth
11792            )?;
11793            fidl::decode!(
11794                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
11795                fidl::encoding::DefaultFuchsiaResourceDialect,
11796                &mut self.object,
11797                decoder,
11798                offset + 16,
11799                _depth
11800            )?;
11801            Ok(())
11802        }
11803    }
11804
11805    impl CapabilityRequestedPayload {
11806        #[inline(always)]
11807        fn max_ordinal_present(&self) -> u64 {
11808            if let Some(_) = self.capability {
11809                return 2;
11810            }
11811            if let Some(_) = self.name {
11812                return 1;
11813            }
11814            0
11815        }
11816    }
11817
11818    impl fidl::encoding::ResourceTypeMarker for CapabilityRequestedPayload {
11819        type Borrowed<'a> = &'a mut Self;
11820        fn take_or_borrow<'a>(
11821            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11822        ) -> Self::Borrowed<'a> {
11823            value
11824        }
11825    }
11826
11827    unsafe impl fidl::encoding::TypeMarker for CapabilityRequestedPayload {
11828        type Owned = Self;
11829
11830        #[inline(always)]
11831        fn inline_align(_context: fidl::encoding::Context) -> usize {
11832            8
11833        }
11834
11835        #[inline(always)]
11836        fn inline_size(_context: fidl::encoding::Context) -> usize {
11837            16
11838        }
11839    }
11840
11841    unsafe impl
11842        fidl::encoding::Encode<
11843            CapabilityRequestedPayload,
11844            fidl::encoding::DefaultFuchsiaResourceDialect,
11845        > for &mut CapabilityRequestedPayload
11846    {
11847        unsafe fn encode(
11848            self,
11849            encoder: &mut fidl::encoding::Encoder<
11850                '_,
11851                fidl::encoding::DefaultFuchsiaResourceDialect,
11852            >,
11853            offset: usize,
11854            mut depth: fidl::encoding::Depth,
11855        ) -> fidl::Result<()> {
11856            encoder.debug_check_bounds::<CapabilityRequestedPayload>(offset);
11857            // Vector header
11858            let max_ordinal: u64 = self.max_ordinal_present();
11859            encoder.write_num(max_ordinal, offset);
11860            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11861            // Calling encoder.out_of_line_offset(0) is not allowed.
11862            if max_ordinal == 0 {
11863                return Ok(());
11864            }
11865            depth.increment()?;
11866            let envelope_size = 8;
11867            let bytes_len = max_ordinal as usize * envelope_size;
11868            #[allow(unused_variables)]
11869            let offset = encoder.out_of_line_offset(bytes_len);
11870            let mut _prev_end_offset: usize = 0;
11871            if 1 > max_ordinal {
11872                return Ok(());
11873            }
11874
11875            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11876            // are envelope_size bytes.
11877            let cur_offset: usize = (1 - 1) * envelope_size;
11878
11879            // Zero reserved fields.
11880            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11881
11882            // Safety:
11883            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11884            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11885            //   envelope_size bytes, there is always sufficient room.
11886            fidl::encoding::encode_in_envelope_optional::<
11887                fidl::encoding::BoundedString<255>,
11888                fidl::encoding::DefaultFuchsiaResourceDialect,
11889            >(
11890                self.name.as_ref().map(
11891                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
11892                ),
11893                encoder,
11894                offset + cur_offset,
11895                depth,
11896            )?;
11897
11898            _prev_end_offset = cur_offset + envelope_size;
11899            if 2 > max_ordinal {
11900                return Ok(());
11901            }
11902
11903            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11904            // are envelope_size bytes.
11905            let cur_offset: usize = (2 - 1) * envelope_size;
11906
11907            // Zero reserved fields.
11908            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11909
11910            // Safety:
11911            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11912            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11913            //   envelope_size bytes, there is always sufficient room.
11914            fidl::encoding::encode_in_envelope_optional::<
11915                fidl::encoding::HandleType<
11916                    fidl::Channel,
11917                    { fidl::ObjectType::CHANNEL.into_raw() },
11918                    2147483648,
11919                >,
11920                fidl::encoding::DefaultFuchsiaResourceDialect,
11921            >(
11922                self.capability.as_mut().map(
11923                    <fidl::encoding::HandleType<
11924                        fidl::Channel,
11925                        { fidl::ObjectType::CHANNEL.into_raw() },
11926                        2147483648,
11927                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11928                ),
11929                encoder,
11930                offset + cur_offset,
11931                depth,
11932            )?;
11933
11934            _prev_end_offset = cur_offset + envelope_size;
11935
11936            Ok(())
11937        }
11938    }
11939
11940    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11941        for CapabilityRequestedPayload
11942    {
11943        #[inline(always)]
11944        fn new_empty() -> Self {
11945            Self::default()
11946        }
11947
11948        unsafe fn decode(
11949            &mut self,
11950            decoder: &mut fidl::encoding::Decoder<
11951                '_,
11952                fidl::encoding::DefaultFuchsiaResourceDialect,
11953            >,
11954            offset: usize,
11955            mut depth: fidl::encoding::Depth,
11956        ) -> fidl::Result<()> {
11957            decoder.debug_check_bounds::<Self>(offset);
11958            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11959                None => return Err(fidl::Error::NotNullable),
11960                Some(len) => len,
11961            };
11962            // Calling decoder.out_of_line_offset(0) is not allowed.
11963            if len == 0 {
11964                return Ok(());
11965            };
11966            depth.increment()?;
11967            let envelope_size = 8;
11968            let bytes_len = len * envelope_size;
11969            let offset = decoder.out_of_line_offset(bytes_len)?;
11970            // Decode the envelope for each type.
11971            let mut _next_ordinal_to_read = 0;
11972            let mut next_offset = offset;
11973            let end_offset = offset + bytes_len;
11974            _next_ordinal_to_read += 1;
11975            if next_offset >= end_offset {
11976                return Ok(());
11977            }
11978
11979            // Decode unknown envelopes for gaps in ordinals.
11980            while _next_ordinal_to_read < 1 {
11981                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11982                _next_ordinal_to_read += 1;
11983                next_offset += envelope_size;
11984            }
11985
11986            let next_out_of_line = decoder.next_out_of_line();
11987            let handles_before = decoder.remaining_handles();
11988            if let Some((inlined, num_bytes, num_handles)) =
11989                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11990            {
11991                let member_inline_size =
11992                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
11993                        decoder.context,
11994                    );
11995                if inlined != (member_inline_size <= 4) {
11996                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11997                }
11998                let inner_offset;
11999                let mut inner_depth = depth.clone();
12000                if inlined {
12001                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12002                    inner_offset = next_offset;
12003                } else {
12004                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12005                    inner_depth.increment()?;
12006                }
12007                let val_ref = self.name.get_or_insert_with(|| {
12008                    fidl::new_empty!(
12009                        fidl::encoding::BoundedString<255>,
12010                        fidl::encoding::DefaultFuchsiaResourceDialect
12011                    )
12012                });
12013                fidl::decode!(
12014                    fidl::encoding::BoundedString<255>,
12015                    fidl::encoding::DefaultFuchsiaResourceDialect,
12016                    val_ref,
12017                    decoder,
12018                    inner_offset,
12019                    inner_depth
12020                )?;
12021                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12022                {
12023                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12024                }
12025                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12026                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12027                }
12028            }
12029
12030            next_offset += envelope_size;
12031            _next_ordinal_to_read += 1;
12032            if next_offset >= end_offset {
12033                return Ok(());
12034            }
12035
12036            // Decode unknown envelopes for gaps in ordinals.
12037            while _next_ordinal_to_read < 2 {
12038                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12039                _next_ordinal_to_read += 1;
12040                next_offset += envelope_size;
12041            }
12042
12043            let next_out_of_line = decoder.next_out_of_line();
12044            let handles_before = decoder.remaining_handles();
12045            if let Some((inlined, num_bytes, num_handles)) =
12046                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12047            {
12048                let member_inline_size = <fidl::encoding::HandleType<
12049                    fidl::Channel,
12050                    { fidl::ObjectType::CHANNEL.into_raw() },
12051                    2147483648,
12052                > as fidl::encoding::TypeMarker>::inline_size(
12053                    decoder.context
12054                );
12055                if inlined != (member_inline_size <= 4) {
12056                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12057                }
12058                let inner_offset;
12059                let mut inner_depth = depth.clone();
12060                if inlined {
12061                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12062                    inner_offset = next_offset;
12063                } else {
12064                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12065                    inner_depth.increment()?;
12066                }
12067                let val_ref =
12068                self.capability.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
12069                fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12070                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12071                {
12072                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12073                }
12074                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12075                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12076                }
12077            }
12078
12079            next_offset += envelope_size;
12080
12081            // Decode the remaining unknown envelopes.
12082            while next_offset < end_offset {
12083                _next_ordinal_to_read += 1;
12084                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12085                next_offset += envelope_size;
12086            }
12087
12088            Ok(())
12089        }
12090    }
12091
12092    impl CreateChildArgs {
12093        #[inline(always)]
12094        fn max_ordinal_present(&self) -> u64 {
12095            if let Some(_) = self.additional_inputs {
12096                return 5;
12097            }
12098            if let Some(_) = self.dictionary {
12099                return 4;
12100            }
12101            if let Some(_) = self.controller {
12102                return 3;
12103            }
12104            if let Some(_) = self.dynamic_offers {
12105                return 2;
12106            }
12107            if let Some(_) = self.numbered_handles {
12108                return 1;
12109            }
12110            0
12111        }
12112    }
12113
12114    impl fidl::encoding::ResourceTypeMarker for CreateChildArgs {
12115        type Borrowed<'a> = &'a mut Self;
12116        fn take_or_borrow<'a>(
12117            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12118        ) -> Self::Borrowed<'a> {
12119            value
12120        }
12121    }
12122
12123    unsafe impl fidl::encoding::TypeMarker for CreateChildArgs {
12124        type Owned = Self;
12125
12126        #[inline(always)]
12127        fn inline_align(_context: fidl::encoding::Context) -> usize {
12128            8
12129        }
12130
12131        #[inline(always)]
12132        fn inline_size(_context: fidl::encoding::Context) -> usize {
12133            16
12134        }
12135    }
12136
12137    unsafe impl
12138        fidl::encoding::Encode<CreateChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
12139        for &mut CreateChildArgs
12140    {
12141        unsafe fn encode(
12142            self,
12143            encoder: &mut fidl::encoding::Encoder<
12144                '_,
12145                fidl::encoding::DefaultFuchsiaResourceDialect,
12146            >,
12147            offset: usize,
12148            mut depth: fidl::encoding::Depth,
12149        ) -> fidl::Result<()> {
12150            encoder.debug_check_bounds::<CreateChildArgs>(offset);
12151            // Vector header
12152            let max_ordinal: u64 = self.max_ordinal_present();
12153            encoder.write_num(max_ordinal, offset);
12154            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12155            // Calling encoder.out_of_line_offset(0) is not allowed.
12156            if max_ordinal == 0 {
12157                return Ok(());
12158            }
12159            depth.increment()?;
12160            let envelope_size = 8;
12161            let bytes_len = max_ordinal as usize * envelope_size;
12162            #[allow(unused_variables)]
12163            let offset = encoder.out_of_line_offset(bytes_len);
12164            let mut _prev_end_offset: usize = 0;
12165            if 1 > max_ordinal {
12166                return Ok(());
12167            }
12168
12169            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12170            // are envelope_size bytes.
12171            let cur_offset: usize = (1 - 1) * envelope_size;
12172
12173            // Zero reserved fields.
12174            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12175
12176            // Safety:
12177            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12178            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12179            //   envelope_size bytes, there is always sufficient room.
12180            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12181            self.numbered_handles.as_mut().map(<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12182            encoder, offset + cur_offset, depth
12183        )?;
12184
12185            _prev_end_offset = cur_offset + envelope_size;
12186            if 2 > max_ordinal {
12187                return Ok(());
12188            }
12189
12190            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12191            // are envelope_size bytes.
12192            let cur_offset: usize = (2 - 1) * envelope_size;
12193
12194            // Zero reserved fields.
12195            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12196
12197            // Safety:
12198            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12199            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12200            //   envelope_size bytes, there is always sufficient room.
12201            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12202            self.dynamic_offers.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128> as fidl::encoding::ValueTypeMarker>::borrow),
12203            encoder, offset + cur_offset, depth
12204        )?;
12205
12206            _prev_end_offset = cur_offset + envelope_size;
12207            if 3 > max_ordinal {
12208                return Ok(());
12209            }
12210
12211            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12212            // are envelope_size bytes.
12213            let cur_offset: usize = (3 - 1) * envelope_size;
12214
12215            // Zero reserved fields.
12216            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12217
12218            // Safety:
12219            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12220            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12221            //   envelope_size bytes, there is always sufficient room.
12222            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12223            self.controller.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12224            encoder, offset + cur_offset, depth
12225        )?;
12226
12227            _prev_end_offset = cur_offset + envelope_size;
12228            if 4 > max_ordinal {
12229                return Ok(());
12230            }
12231
12232            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12233            // are envelope_size bytes.
12234            let cur_offset: usize = (4 - 1) * envelope_size;
12235
12236            // Zero reserved fields.
12237            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12238
12239            // Safety:
12240            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12241            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12242            //   envelope_size bytes, there is always sufficient room.
12243            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
12244            self.dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12245            encoder, offset + cur_offset, depth
12246        )?;
12247
12248            _prev_end_offset = cur_offset + envelope_size;
12249            if 5 > max_ordinal {
12250                return Ok(());
12251            }
12252
12253            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12254            // are envelope_size bytes.
12255            let cur_offset: usize = (5 - 1) * envelope_size;
12256
12257            // Zero reserved fields.
12258            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12259
12260            // Safety:
12261            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12262            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12263            //   envelope_size bytes, there is always sufficient room.
12264            fidl::encoding::encode_in_envelope_optional::<
12265                fidl::encoding::HandleType<
12266                    fidl::EventPair,
12267                    { fidl::ObjectType::EVENTPAIR.into_raw() },
12268                    2147483648,
12269                >,
12270                fidl::encoding::DefaultFuchsiaResourceDialect,
12271            >(
12272                self.additional_inputs.as_mut().map(
12273                    <fidl::encoding::HandleType<
12274                        fidl::EventPair,
12275                        { fidl::ObjectType::EVENTPAIR.into_raw() },
12276                        2147483648,
12277                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12278                ),
12279                encoder,
12280                offset + cur_offset,
12281                depth,
12282            )?;
12283
12284            _prev_end_offset = cur_offset + envelope_size;
12285
12286            Ok(())
12287        }
12288    }
12289
12290    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12291        for CreateChildArgs
12292    {
12293        #[inline(always)]
12294        fn new_empty() -> Self {
12295            Self::default()
12296        }
12297
12298        unsafe fn decode(
12299            &mut self,
12300            decoder: &mut fidl::encoding::Decoder<
12301                '_,
12302                fidl::encoding::DefaultFuchsiaResourceDialect,
12303            >,
12304            offset: usize,
12305            mut depth: fidl::encoding::Depth,
12306        ) -> fidl::Result<()> {
12307            decoder.debug_check_bounds::<Self>(offset);
12308            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12309                None => return Err(fidl::Error::NotNullable),
12310                Some(len) => len,
12311            };
12312            // Calling decoder.out_of_line_offset(0) is not allowed.
12313            if len == 0 {
12314                return Ok(());
12315            };
12316            depth.increment()?;
12317            let envelope_size = 8;
12318            let bytes_len = len * envelope_size;
12319            let offset = decoder.out_of_line_offset(bytes_len)?;
12320            // Decode the envelope for each type.
12321            let mut _next_ordinal_to_read = 0;
12322            let mut next_offset = offset;
12323            let end_offset = offset + bytes_len;
12324            _next_ordinal_to_read += 1;
12325            if next_offset >= end_offset {
12326                return Ok(());
12327            }
12328
12329            // Decode unknown envelopes for gaps in ordinals.
12330            while _next_ordinal_to_read < 1 {
12331                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12332                _next_ordinal_to_read += 1;
12333                next_offset += envelope_size;
12334            }
12335
12336            let next_out_of_line = decoder.next_out_of_line();
12337            let handles_before = decoder.remaining_handles();
12338            if let Some((inlined, num_bytes, num_handles)) =
12339                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12340            {
12341                let member_inline_size = <fidl::encoding::Vector<
12342                    fidl_fuchsia_process::HandleInfo,
12343                    128,
12344                > as fidl::encoding::TypeMarker>::inline_size(
12345                    decoder.context
12346                );
12347                if inlined != (member_inline_size <= 4) {
12348                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12349                }
12350                let inner_offset;
12351                let mut inner_depth = depth.clone();
12352                if inlined {
12353                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12354                    inner_offset = next_offset;
12355                } else {
12356                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12357                    inner_depth.increment()?;
12358                }
12359                let val_ref =
12360                self.numbered_handles.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
12361                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12362                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12363                {
12364                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12365                }
12366                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12367                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12368                }
12369            }
12370
12371            next_offset += envelope_size;
12372            _next_ordinal_to_read += 1;
12373            if next_offset >= end_offset {
12374                return Ok(());
12375            }
12376
12377            // Decode unknown envelopes for gaps in ordinals.
12378            while _next_ordinal_to_read < 2 {
12379                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12380                _next_ordinal_to_read += 1;
12381                next_offset += envelope_size;
12382            }
12383
12384            let next_out_of_line = decoder.next_out_of_line();
12385            let handles_before = decoder.remaining_handles();
12386            if let Some((inlined, num_bytes, num_handles)) =
12387                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12388            {
12389                let member_inline_size = <fidl::encoding::Vector<
12390                    fidl_fuchsia_component_decl::Offer,
12391                    128,
12392                > as fidl::encoding::TypeMarker>::inline_size(
12393                    decoder.context
12394                );
12395                if inlined != (member_inline_size <= 4) {
12396                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12397                }
12398                let inner_offset;
12399                let mut inner_depth = depth.clone();
12400                if inlined {
12401                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12402                    inner_offset = next_offset;
12403                } else {
12404                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12405                    inner_depth.increment()?;
12406                }
12407                let val_ref =
12408                self.dynamic_offers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
12409                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12410                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12411                {
12412                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12413                }
12414                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12415                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12416                }
12417            }
12418
12419            next_offset += envelope_size;
12420            _next_ordinal_to_read += 1;
12421            if next_offset >= end_offset {
12422                return Ok(());
12423            }
12424
12425            // Decode unknown envelopes for gaps in ordinals.
12426            while _next_ordinal_to_read < 3 {
12427                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12428                _next_ordinal_to_read += 1;
12429                next_offset += envelope_size;
12430            }
12431
12432            let next_out_of_line = decoder.next_out_of_line();
12433            let handles_before = decoder.remaining_handles();
12434            if let Some((inlined, num_bytes, num_handles)) =
12435                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12436            {
12437                let member_inline_size = <fidl::encoding::Endpoint<
12438                    fidl::endpoints::ServerEnd<ControllerMarker>,
12439                > as fidl::encoding::TypeMarker>::inline_size(
12440                    decoder.context
12441                );
12442                if inlined != (member_inline_size <= 4) {
12443                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12444                }
12445                let inner_offset;
12446                let mut inner_depth = depth.clone();
12447                if inlined {
12448                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12449                    inner_offset = next_offset;
12450                } else {
12451                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12452                    inner_depth.increment()?;
12453                }
12454                let val_ref = self.controller.get_or_insert_with(|| {
12455                    fidl::new_empty!(
12456                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
12457                        fidl::encoding::DefaultFuchsiaResourceDialect
12458                    )
12459                });
12460                fidl::decode!(
12461                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
12462                    fidl::encoding::DefaultFuchsiaResourceDialect,
12463                    val_ref,
12464                    decoder,
12465                    inner_offset,
12466                    inner_depth
12467                )?;
12468                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12469                {
12470                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12471                }
12472                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12473                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12474                }
12475            }
12476
12477            next_offset += envelope_size;
12478            _next_ordinal_to_read += 1;
12479            if next_offset >= end_offset {
12480                return Ok(());
12481            }
12482
12483            // Decode unknown envelopes for gaps in ordinals.
12484            while _next_ordinal_to_read < 4 {
12485                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12486                _next_ordinal_to_read += 1;
12487                next_offset += envelope_size;
12488            }
12489
12490            let next_out_of_line = decoder.next_out_of_line();
12491            let handles_before = decoder.remaining_handles();
12492            if let Some((inlined, num_bytes, num_handles)) =
12493                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12494            {
12495                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12496                if inlined != (member_inline_size <= 4) {
12497                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12498                }
12499                let inner_offset;
12500                let mut inner_depth = depth.clone();
12501                if inlined {
12502                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12503                    inner_offset = next_offset;
12504                } else {
12505                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12506                    inner_depth.increment()?;
12507                }
12508                let val_ref = self.dictionary.get_or_insert_with(|| {
12509                    fidl::new_empty!(
12510                        fidl_fuchsia_component_sandbox::DictionaryRef,
12511                        fidl::encoding::DefaultFuchsiaResourceDialect
12512                    )
12513                });
12514                fidl::decode!(
12515                    fidl_fuchsia_component_sandbox::DictionaryRef,
12516                    fidl::encoding::DefaultFuchsiaResourceDialect,
12517                    val_ref,
12518                    decoder,
12519                    inner_offset,
12520                    inner_depth
12521                )?;
12522                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12523                {
12524                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12525                }
12526                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12527                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12528                }
12529            }
12530
12531            next_offset += envelope_size;
12532            _next_ordinal_to_read += 1;
12533            if next_offset >= end_offset {
12534                return Ok(());
12535            }
12536
12537            // Decode unknown envelopes for gaps in ordinals.
12538            while _next_ordinal_to_read < 5 {
12539                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12540                _next_ordinal_to_read += 1;
12541                next_offset += envelope_size;
12542            }
12543
12544            let next_out_of_line = decoder.next_out_of_line();
12545            let handles_before = decoder.remaining_handles();
12546            if let Some((inlined, num_bytes, num_handles)) =
12547                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12548            {
12549                let member_inline_size = <fidl::encoding::HandleType<
12550                    fidl::EventPair,
12551                    { fidl::ObjectType::EVENTPAIR.into_raw() },
12552                    2147483648,
12553                > as fidl::encoding::TypeMarker>::inline_size(
12554                    decoder.context
12555                );
12556                if inlined != (member_inline_size <= 4) {
12557                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12558                }
12559                let inner_offset;
12560                let mut inner_depth = depth.clone();
12561                if inlined {
12562                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12563                    inner_offset = next_offset;
12564                } else {
12565                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12566                    inner_depth.increment()?;
12567                }
12568                let val_ref =
12569                self.additional_inputs.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
12570                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12571                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12572                {
12573                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12574                }
12575                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12576                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12577                }
12578            }
12579
12580            next_offset += envelope_size;
12581
12582            // Decode the remaining unknown envelopes.
12583            while next_offset < end_offset {
12584                _next_ordinal_to_read += 1;
12585                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12586                next_offset += envelope_size;
12587            }
12588
12589            Ok(())
12590        }
12591    }
12592
12593    impl DebugStartedPayload {
12594        #[inline(always)]
12595        fn max_ordinal_present(&self) -> u64 {
12596            if let Some(_) = self.break_on_start {
12597                return 2;
12598            }
12599            if let Some(_) = self.runtime_dir {
12600                return 1;
12601            }
12602            0
12603        }
12604    }
12605
12606    impl fidl::encoding::ResourceTypeMarker for DebugStartedPayload {
12607        type Borrowed<'a> = &'a mut Self;
12608        fn take_or_borrow<'a>(
12609            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12610        ) -> Self::Borrowed<'a> {
12611            value
12612        }
12613    }
12614
12615    unsafe impl fidl::encoding::TypeMarker for DebugStartedPayload {
12616        type Owned = Self;
12617
12618        #[inline(always)]
12619        fn inline_align(_context: fidl::encoding::Context) -> usize {
12620            8
12621        }
12622
12623        #[inline(always)]
12624        fn inline_size(_context: fidl::encoding::Context) -> usize {
12625            16
12626        }
12627    }
12628
12629    unsafe impl
12630        fidl::encoding::Encode<DebugStartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>
12631        for &mut DebugStartedPayload
12632    {
12633        unsafe fn encode(
12634            self,
12635            encoder: &mut fidl::encoding::Encoder<
12636                '_,
12637                fidl::encoding::DefaultFuchsiaResourceDialect,
12638            >,
12639            offset: usize,
12640            mut depth: fidl::encoding::Depth,
12641        ) -> fidl::Result<()> {
12642            encoder.debug_check_bounds::<DebugStartedPayload>(offset);
12643            // Vector header
12644            let max_ordinal: u64 = self.max_ordinal_present();
12645            encoder.write_num(max_ordinal, offset);
12646            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12647            // Calling encoder.out_of_line_offset(0) is not allowed.
12648            if max_ordinal == 0 {
12649                return Ok(());
12650            }
12651            depth.increment()?;
12652            let envelope_size = 8;
12653            let bytes_len = max_ordinal as usize * envelope_size;
12654            #[allow(unused_variables)]
12655            let offset = encoder.out_of_line_offset(bytes_len);
12656            let mut _prev_end_offset: usize = 0;
12657            if 1 > max_ordinal {
12658                return Ok(());
12659            }
12660
12661            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12662            // are envelope_size bytes.
12663            let cur_offset: usize = (1 - 1) * envelope_size;
12664
12665            // Zero reserved fields.
12666            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12667
12668            // Safety:
12669            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12670            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12671            //   envelope_size bytes, there is always sufficient room.
12672            fidl::encoding::encode_in_envelope_optional::<
12673                fidl::encoding::Endpoint<
12674                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12675                >,
12676                fidl::encoding::DefaultFuchsiaResourceDialect,
12677            >(
12678                self.runtime_dir.as_mut().map(
12679                    <fidl::encoding::Endpoint<
12680                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12681                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12682                ),
12683                encoder,
12684                offset + cur_offset,
12685                depth,
12686            )?;
12687
12688            _prev_end_offset = cur_offset + envelope_size;
12689            if 2 > max_ordinal {
12690                return Ok(());
12691            }
12692
12693            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12694            // are envelope_size bytes.
12695            let cur_offset: usize = (2 - 1) * envelope_size;
12696
12697            // Zero reserved fields.
12698            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12699
12700            // Safety:
12701            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12702            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12703            //   envelope_size bytes, there is always sufficient room.
12704            fidl::encoding::encode_in_envelope_optional::<
12705                fidl::encoding::HandleType<
12706                    fidl::EventPair,
12707                    { fidl::ObjectType::EVENTPAIR.into_raw() },
12708                    2147483648,
12709                >,
12710                fidl::encoding::DefaultFuchsiaResourceDialect,
12711            >(
12712                self.break_on_start.as_mut().map(
12713                    <fidl::encoding::HandleType<
12714                        fidl::EventPair,
12715                        { fidl::ObjectType::EVENTPAIR.into_raw() },
12716                        2147483648,
12717                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12718                ),
12719                encoder,
12720                offset + cur_offset,
12721                depth,
12722            )?;
12723
12724            _prev_end_offset = cur_offset + envelope_size;
12725
12726            Ok(())
12727        }
12728    }
12729
12730    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12731        for DebugStartedPayload
12732    {
12733        #[inline(always)]
12734        fn new_empty() -> Self {
12735            Self::default()
12736        }
12737
12738        unsafe fn decode(
12739            &mut self,
12740            decoder: &mut fidl::encoding::Decoder<
12741                '_,
12742                fidl::encoding::DefaultFuchsiaResourceDialect,
12743            >,
12744            offset: usize,
12745            mut depth: fidl::encoding::Depth,
12746        ) -> fidl::Result<()> {
12747            decoder.debug_check_bounds::<Self>(offset);
12748            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12749                None => return Err(fidl::Error::NotNullable),
12750                Some(len) => len,
12751            };
12752            // Calling decoder.out_of_line_offset(0) is not allowed.
12753            if len == 0 {
12754                return Ok(());
12755            };
12756            depth.increment()?;
12757            let envelope_size = 8;
12758            let bytes_len = len * envelope_size;
12759            let offset = decoder.out_of_line_offset(bytes_len)?;
12760            // Decode the envelope for each type.
12761            let mut _next_ordinal_to_read = 0;
12762            let mut next_offset = offset;
12763            let end_offset = offset + bytes_len;
12764            _next_ordinal_to_read += 1;
12765            if next_offset >= end_offset {
12766                return Ok(());
12767            }
12768
12769            // Decode unknown envelopes for gaps in ordinals.
12770            while _next_ordinal_to_read < 1 {
12771                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12772                _next_ordinal_to_read += 1;
12773                next_offset += envelope_size;
12774            }
12775
12776            let next_out_of_line = decoder.next_out_of_line();
12777            let handles_before = decoder.remaining_handles();
12778            if let Some((inlined, num_bytes, num_handles)) =
12779                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12780            {
12781                let member_inline_size = <fidl::encoding::Endpoint<
12782                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12783                > as fidl::encoding::TypeMarker>::inline_size(
12784                    decoder.context
12785                );
12786                if inlined != (member_inline_size <= 4) {
12787                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12788                }
12789                let inner_offset;
12790                let mut inner_depth = depth.clone();
12791                if inlined {
12792                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12793                    inner_offset = next_offset;
12794                } else {
12795                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12796                    inner_depth.increment()?;
12797                }
12798                let val_ref = self.runtime_dir.get_or_insert_with(|| {
12799                    fidl::new_empty!(
12800                        fidl::encoding::Endpoint<
12801                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12802                        >,
12803                        fidl::encoding::DefaultFuchsiaResourceDialect
12804                    )
12805                });
12806                fidl::decode!(
12807                    fidl::encoding::Endpoint<
12808                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
12809                    >,
12810                    fidl::encoding::DefaultFuchsiaResourceDialect,
12811                    val_ref,
12812                    decoder,
12813                    inner_offset,
12814                    inner_depth
12815                )?;
12816                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12817                {
12818                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12819                }
12820                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12821                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12822                }
12823            }
12824
12825            next_offset += envelope_size;
12826            _next_ordinal_to_read += 1;
12827            if next_offset >= end_offset {
12828                return Ok(());
12829            }
12830
12831            // Decode unknown envelopes for gaps in ordinals.
12832            while _next_ordinal_to_read < 2 {
12833                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12834                _next_ordinal_to_read += 1;
12835                next_offset += envelope_size;
12836            }
12837
12838            let next_out_of_line = decoder.next_out_of_line();
12839            let handles_before = decoder.remaining_handles();
12840            if let Some((inlined, num_bytes, num_handles)) =
12841                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12842            {
12843                let member_inline_size = <fidl::encoding::HandleType<
12844                    fidl::EventPair,
12845                    { fidl::ObjectType::EVENTPAIR.into_raw() },
12846                    2147483648,
12847                > as fidl::encoding::TypeMarker>::inline_size(
12848                    decoder.context
12849                );
12850                if inlined != (member_inline_size <= 4) {
12851                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12852                }
12853                let inner_offset;
12854                let mut inner_depth = depth.clone();
12855                if inlined {
12856                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12857                    inner_offset = next_offset;
12858                } else {
12859                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12860                    inner_depth.increment()?;
12861                }
12862                let val_ref =
12863                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));
12864                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12865                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12866                {
12867                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12868                }
12869                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12870                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12871                }
12872            }
12873
12874            next_offset += envelope_size;
12875
12876            // Decode the remaining unknown envelopes.
12877            while next_offset < end_offset {
12878                _next_ordinal_to_read += 1;
12879                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12880                next_offset += envelope_size;
12881            }
12882
12883            Ok(())
12884        }
12885    }
12886
12887    impl Event {
12888        #[inline(always)]
12889        fn max_ordinal_present(&self) -> u64 {
12890            if let Some(_) = self.payload {
12891                return 2;
12892            }
12893            if let Some(_) = self.header {
12894                return 1;
12895            }
12896            0
12897        }
12898    }
12899
12900    impl fidl::encoding::ResourceTypeMarker for Event {
12901        type Borrowed<'a> = &'a mut Self;
12902        fn take_or_borrow<'a>(
12903            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12904        ) -> Self::Borrowed<'a> {
12905            value
12906        }
12907    }
12908
12909    unsafe impl fidl::encoding::TypeMarker for Event {
12910        type Owned = Self;
12911
12912        #[inline(always)]
12913        fn inline_align(_context: fidl::encoding::Context) -> usize {
12914            8
12915        }
12916
12917        #[inline(always)]
12918        fn inline_size(_context: fidl::encoding::Context) -> usize {
12919            16
12920        }
12921    }
12922
12923    unsafe impl fidl::encoding::Encode<Event, fidl::encoding::DefaultFuchsiaResourceDialect>
12924        for &mut Event
12925    {
12926        unsafe fn encode(
12927            self,
12928            encoder: &mut fidl::encoding::Encoder<
12929                '_,
12930                fidl::encoding::DefaultFuchsiaResourceDialect,
12931            >,
12932            offset: usize,
12933            mut depth: fidl::encoding::Depth,
12934        ) -> fidl::Result<()> {
12935            encoder.debug_check_bounds::<Event>(offset);
12936            // Vector header
12937            let max_ordinal: u64 = self.max_ordinal_present();
12938            encoder.write_num(max_ordinal, offset);
12939            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12940            // Calling encoder.out_of_line_offset(0) is not allowed.
12941            if max_ordinal == 0 {
12942                return Ok(());
12943            }
12944            depth.increment()?;
12945            let envelope_size = 8;
12946            let bytes_len = max_ordinal as usize * envelope_size;
12947            #[allow(unused_variables)]
12948            let offset = encoder.out_of_line_offset(bytes_len);
12949            let mut _prev_end_offset: usize = 0;
12950            if 1 > 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 = (1 - 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                EventHeader,
12967                fidl::encoding::DefaultFuchsiaResourceDialect,
12968            >(
12969                self.header.as_ref().map(<EventHeader as fidl::encoding::ValueTypeMarker>::borrow),
12970                encoder,
12971                offset + cur_offset,
12972                depth,
12973            )?;
12974
12975            _prev_end_offset = cur_offset + envelope_size;
12976            if 2 > max_ordinal {
12977                return Ok(());
12978            }
12979
12980            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12981            // are envelope_size bytes.
12982            let cur_offset: usize = (2 - 1) * envelope_size;
12983
12984            // Zero reserved fields.
12985            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12986
12987            // Safety:
12988            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12989            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12990            //   envelope_size bytes, there is always sufficient room.
12991            fidl::encoding::encode_in_envelope_optional::<
12992                EventPayload,
12993                fidl::encoding::DefaultFuchsiaResourceDialect,
12994            >(
12995                self.payload
12996                    .as_mut()
12997                    .map(<EventPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12998                encoder,
12999                offset + cur_offset,
13000                depth,
13001            )?;
13002
13003            _prev_end_offset = cur_offset + envelope_size;
13004
13005            Ok(())
13006        }
13007    }
13008
13009    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Event {
13010        #[inline(always)]
13011        fn new_empty() -> Self {
13012            Self::default()
13013        }
13014
13015        unsafe fn decode(
13016            &mut self,
13017            decoder: &mut fidl::encoding::Decoder<
13018                '_,
13019                fidl::encoding::DefaultFuchsiaResourceDialect,
13020            >,
13021            offset: usize,
13022            mut depth: fidl::encoding::Depth,
13023        ) -> fidl::Result<()> {
13024            decoder.debug_check_bounds::<Self>(offset);
13025            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13026                None => return Err(fidl::Error::NotNullable),
13027                Some(len) => len,
13028            };
13029            // Calling decoder.out_of_line_offset(0) is not allowed.
13030            if len == 0 {
13031                return Ok(());
13032            };
13033            depth.increment()?;
13034            let envelope_size = 8;
13035            let bytes_len = len * envelope_size;
13036            let offset = decoder.out_of_line_offset(bytes_len)?;
13037            // Decode the envelope for each type.
13038            let mut _next_ordinal_to_read = 0;
13039            let mut next_offset = offset;
13040            let end_offset = offset + bytes_len;
13041            _next_ordinal_to_read += 1;
13042            if next_offset >= end_offset {
13043                return Ok(());
13044            }
13045
13046            // Decode unknown envelopes for gaps in ordinals.
13047            while _next_ordinal_to_read < 1 {
13048                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13049                _next_ordinal_to_read += 1;
13050                next_offset += envelope_size;
13051            }
13052
13053            let next_out_of_line = decoder.next_out_of_line();
13054            let handles_before = decoder.remaining_handles();
13055            if let Some((inlined, num_bytes, num_handles)) =
13056                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13057            {
13058                let member_inline_size =
13059                    <EventHeader as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13060                if inlined != (member_inline_size <= 4) {
13061                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13062                }
13063                let inner_offset;
13064                let mut inner_depth = depth.clone();
13065                if inlined {
13066                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13067                    inner_offset = next_offset;
13068                } else {
13069                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13070                    inner_depth.increment()?;
13071                }
13072                let val_ref = self.header.get_or_insert_with(|| {
13073                    fidl::new_empty!(EventHeader, fidl::encoding::DefaultFuchsiaResourceDialect)
13074                });
13075                fidl::decode!(
13076                    EventHeader,
13077                    fidl::encoding::DefaultFuchsiaResourceDialect,
13078                    val_ref,
13079                    decoder,
13080                    inner_offset,
13081                    inner_depth
13082                )?;
13083                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13084                {
13085                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13086                }
13087                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13088                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13089                }
13090            }
13091
13092            next_offset += envelope_size;
13093            _next_ordinal_to_read += 1;
13094            if next_offset >= end_offset {
13095                return Ok(());
13096            }
13097
13098            // Decode unknown envelopes for gaps in ordinals.
13099            while _next_ordinal_to_read < 2 {
13100                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13101                _next_ordinal_to_read += 1;
13102                next_offset += envelope_size;
13103            }
13104
13105            let next_out_of_line = decoder.next_out_of_line();
13106            let handles_before = decoder.remaining_handles();
13107            if let Some((inlined, num_bytes, num_handles)) =
13108                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13109            {
13110                let member_inline_size =
13111                    <EventPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13112                if inlined != (member_inline_size <= 4) {
13113                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13114                }
13115                let inner_offset;
13116                let mut inner_depth = depth.clone();
13117                if inlined {
13118                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13119                    inner_offset = next_offset;
13120                } else {
13121                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13122                    inner_depth.increment()?;
13123                }
13124                let val_ref = self.payload.get_or_insert_with(|| {
13125                    fidl::new_empty!(EventPayload, fidl::encoding::DefaultFuchsiaResourceDialect)
13126                });
13127                fidl::decode!(
13128                    EventPayload,
13129                    fidl::encoding::DefaultFuchsiaResourceDialect,
13130                    val_ref,
13131                    decoder,
13132                    inner_offset,
13133                    inner_depth
13134                )?;
13135                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13136                {
13137                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13138                }
13139                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13140                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13141                }
13142            }
13143
13144            next_offset += envelope_size;
13145
13146            // Decode the remaining unknown envelopes.
13147            while next_offset < end_offset {
13148                _next_ordinal_to_read += 1;
13149                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13150                next_offset += envelope_size;
13151            }
13152
13153            Ok(())
13154        }
13155    }
13156
13157    impl NamespaceEntry {
13158        #[inline(always)]
13159        fn max_ordinal_present(&self) -> u64 {
13160            if let Some(_) = self.directory {
13161                return 2;
13162            }
13163            if let Some(_) = self.path {
13164                return 1;
13165            }
13166            0
13167        }
13168    }
13169
13170    impl fidl::encoding::ResourceTypeMarker for NamespaceEntry {
13171        type Borrowed<'a> = &'a mut Self;
13172        fn take_or_borrow<'a>(
13173            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13174        ) -> Self::Borrowed<'a> {
13175            value
13176        }
13177    }
13178
13179    unsafe impl fidl::encoding::TypeMarker for NamespaceEntry {
13180        type Owned = Self;
13181
13182        #[inline(always)]
13183        fn inline_align(_context: fidl::encoding::Context) -> usize {
13184            8
13185        }
13186
13187        #[inline(always)]
13188        fn inline_size(_context: fidl::encoding::Context) -> usize {
13189            16
13190        }
13191    }
13192
13193    unsafe impl
13194        fidl::encoding::Encode<NamespaceEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
13195        for &mut NamespaceEntry
13196    {
13197        unsafe fn encode(
13198            self,
13199            encoder: &mut fidl::encoding::Encoder<
13200                '_,
13201                fidl::encoding::DefaultFuchsiaResourceDialect,
13202            >,
13203            offset: usize,
13204            mut depth: fidl::encoding::Depth,
13205        ) -> fidl::Result<()> {
13206            encoder.debug_check_bounds::<NamespaceEntry>(offset);
13207            // Vector header
13208            let max_ordinal: u64 = self.max_ordinal_present();
13209            encoder.write_num(max_ordinal, offset);
13210            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13211            // Calling encoder.out_of_line_offset(0) is not allowed.
13212            if max_ordinal == 0 {
13213                return Ok(());
13214            }
13215            depth.increment()?;
13216            let envelope_size = 8;
13217            let bytes_len = max_ordinal as usize * envelope_size;
13218            #[allow(unused_variables)]
13219            let offset = encoder.out_of_line_offset(bytes_len);
13220            let mut _prev_end_offset: usize = 0;
13221            if 1 > max_ordinal {
13222                return Ok(());
13223            }
13224
13225            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13226            // are envelope_size bytes.
13227            let cur_offset: usize = (1 - 1) * envelope_size;
13228
13229            // Zero reserved fields.
13230            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13231
13232            // Safety:
13233            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13234            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13235            //   envelope_size bytes, there is always sufficient room.
13236            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4095>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13237            self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
13238            encoder, offset + cur_offset, depth
13239        )?;
13240
13241            _prev_end_offset = cur_offset + envelope_size;
13242            if 2 > max_ordinal {
13243                return Ok(());
13244            }
13245
13246            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13247            // are envelope_size bytes.
13248            let cur_offset: usize = (2 - 1) * envelope_size;
13249
13250            // Zero reserved fields.
13251            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13252
13253            // Safety:
13254            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13255            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13256            //   envelope_size bytes, there is always sufficient room.
13257            fidl::encoding::encode_in_envelope_optional::<
13258                fidl::encoding::Endpoint<
13259                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13260                >,
13261                fidl::encoding::DefaultFuchsiaResourceDialect,
13262            >(
13263                self.directory.as_mut().map(
13264                    <fidl::encoding::Endpoint<
13265                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13266                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13267                ),
13268                encoder,
13269                offset + cur_offset,
13270                depth,
13271            )?;
13272
13273            _prev_end_offset = cur_offset + envelope_size;
13274
13275            Ok(())
13276        }
13277    }
13278
13279    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13280        for NamespaceEntry
13281    {
13282        #[inline(always)]
13283        fn new_empty() -> Self {
13284            Self::default()
13285        }
13286
13287        unsafe fn decode(
13288            &mut self,
13289            decoder: &mut fidl::encoding::Decoder<
13290                '_,
13291                fidl::encoding::DefaultFuchsiaResourceDialect,
13292            >,
13293            offset: usize,
13294            mut depth: fidl::encoding::Depth,
13295        ) -> fidl::Result<()> {
13296            decoder.debug_check_bounds::<Self>(offset);
13297            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13298                None => return Err(fidl::Error::NotNullable),
13299                Some(len) => len,
13300            };
13301            // Calling decoder.out_of_line_offset(0) is not allowed.
13302            if len == 0 {
13303                return Ok(());
13304            };
13305            depth.increment()?;
13306            let envelope_size = 8;
13307            let bytes_len = len * envelope_size;
13308            let offset = decoder.out_of_line_offset(bytes_len)?;
13309            // Decode the envelope for each type.
13310            let mut _next_ordinal_to_read = 0;
13311            let mut next_offset = offset;
13312            let end_offset = offset + bytes_len;
13313            _next_ordinal_to_read += 1;
13314            if next_offset >= end_offset {
13315                return Ok(());
13316            }
13317
13318            // Decode unknown envelopes for gaps in ordinals.
13319            while _next_ordinal_to_read < 1 {
13320                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13321                _next_ordinal_to_read += 1;
13322                next_offset += envelope_size;
13323            }
13324
13325            let next_out_of_line = decoder.next_out_of_line();
13326            let handles_before = decoder.remaining_handles();
13327            if let Some((inlined, num_bytes, num_handles)) =
13328                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13329            {
13330                let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13331                if inlined != (member_inline_size <= 4) {
13332                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13333                }
13334                let inner_offset;
13335                let mut inner_depth = depth.clone();
13336                if inlined {
13337                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13338                    inner_offset = next_offset;
13339                } else {
13340                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13341                    inner_depth.increment()?;
13342                }
13343                let val_ref = self.path.get_or_insert_with(|| {
13344                    fidl::new_empty!(
13345                        fidl::encoding::BoundedString<4095>,
13346                        fidl::encoding::DefaultFuchsiaResourceDialect
13347                    )
13348                });
13349                fidl::decode!(
13350                    fidl::encoding::BoundedString<4095>,
13351                    fidl::encoding::DefaultFuchsiaResourceDialect,
13352                    val_ref,
13353                    decoder,
13354                    inner_offset,
13355                    inner_depth
13356                )?;
13357                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13358                {
13359                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13360                }
13361                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13362                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13363                }
13364            }
13365
13366            next_offset += envelope_size;
13367            _next_ordinal_to_read += 1;
13368            if next_offset >= end_offset {
13369                return Ok(());
13370            }
13371
13372            // Decode unknown envelopes for gaps in ordinals.
13373            while _next_ordinal_to_read < 2 {
13374                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13375                _next_ordinal_to_read += 1;
13376                next_offset += envelope_size;
13377            }
13378
13379            let next_out_of_line = decoder.next_out_of_line();
13380            let handles_before = decoder.remaining_handles();
13381            if let Some((inlined, num_bytes, num_handles)) =
13382                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13383            {
13384                let member_inline_size = <fidl::encoding::Endpoint<
13385                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13386                > as fidl::encoding::TypeMarker>::inline_size(
13387                    decoder.context
13388                );
13389                if inlined != (member_inline_size <= 4) {
13390                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13391                }
13392                let inner_offset;
13393                let mut inner_depth = depth.clone();
13394                if inlined {
13395                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13396                    inner_offset = next_offset;
13397                } else {
13398                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13399                    inner_depth.increment()?;
13400                }
13401                let val_ref = self.directory.get_or_insert_with(|| {
13402                    fidl::new_empty!(
13403                        fidl::encoding::Endpoint<
13404                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13405                        >,
13406                        fidl::encoding::DefaultFuchsiaResourceDialect
13407                    )
13408                });
13409                fidl::decode!(
13410                    fidl::encoding::Endpoint<
13411                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
13412                    >,
13413                    fidl::encoding::DefaultFuchsiaResourceDialect,
13414                    val_ref,
13415                    decoder,
13416                    inner_offset,
13417                    inner_depth
13418                )?;
13419                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13420                {
13421                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13422                }
13423                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13424                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13425                }
13426            }
13427
13428            next_offset += envelope_size;
13429
13430            // Decode the remaining unknown envelopes.
13431            while next_offset < end_offset {
13432                _next_ordinal_to_read += 1;
13433                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13434                next_offset += envelope_size;
13435            }
13436
13437            Ok(())
13438        }
13439    }
13440
13441    impl StartChildArgs {
13442        #[inline(always)]
13443        fn max_ordinal_present(&self) -> u64 {
13444            if let Some(_) = self.additional_inputs {
13445                return 4;
13446            }
13447            if let Some(_) = self.dictionary {
13448                return 3;
13449            }
13450            if let Some(_) = self.namespace_entries {
13451                return 2;
13452            }
13453            if let Some(_) = self.numbered_handles {
13454                return 1;
13455            }
13456            0
13457        }
13458    }
13459
13460    impl fidl::encoding::ResourceTypeMarker for StartChildArgs {
13461        type Borrowed<'a> = &'a mut Self;
13462        fn take_or_borrow<'a>(
13463            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13464        ) -> Self::Borrowed<'a> {
13465            value
13466        }
13467    }
13468
13469    unsafe impl fidl::encoding::TypeMarker for StartChildArgs {
13470        type Owned = Self;
13471
13472        #[inline(always)]
13473        fn inline_align(_context: fidl::encoding::Context) -> usize {
13474            8
13475        }
13476
13477        #[inline(always)]
13478        fn inline_size(_context: fidl::encoding::Context) -> usize {
13479            16
13480        }
13481    }
13482
13483    unsafe impl
13484        fidl::encoding::Encode<StartChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
13485        for &mut StartChildArgs
13486    {
13487        unsafe fn encode(
13488            self,
13489            encoder: &mut fidl::encoding::Encoder<
13490                '_,
13491                fidl::encoding::DefaultFuchsiaResourceDialect,
13492            >,
13493            offset: usize,
13494            mut depth: fidl::encoding::Depth,
13495        ) -> fidl::Result<()> {
13496            encoder.debug_check_bounds::<StartChildArgs>(offset);
13497            // Vector header
13498            let max_ordinal: u64 = self.max_ordinal_present();
13499            encoder.write_num(max_ordinal, offset);
13500            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13501            // Calling encoder.out_of_line_offset(0) is not allowed.
13502            if max_ordinal == 0 {
13503                return Ok(());
13504            }
13505            depth.increment()?;
13506            let envelope_size = 8;
13507            let bytes_len = max_ordinal as usize * envelope_size;
13508            #[allow(unused_variables)]
13509            let offset = encoder.out_of_line_offset(bytes_len);
13510            let mut _prev_end_offset: usize = 0;
13511            if 1 > max_ordinal {
13512                return Ok(());
13513            }
13514
13515            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13516            // are envelope_size bytes.
13517            let cur_offset: usize = (1 - 1) * envelope_size;
13518
13519            // Zero reserved fields.
13520            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13521
13522            // Safety:
13523            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13524            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13525            //   envelope_size bytes, there is always sufficient room.
13526            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13527            self.numbered_handles.as_mut().map(<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13528            encoder, offset + cur_offset, depth
13529        )?;
13530
13531            _prev_end_offset = cur_offset + envelope_size;
13532            if 2 > max_ordinal {
13533                return Ok(());
13534            }
13535
13536            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13537            // are envelope_size bytes.
13538            let cur_offset: usize = (2 - 1) * envelope_size;
13539
13540            // Zero reserved fields.
13541            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13542
13543            // Safety:
13544            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13545            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13546            //   envelope_size bytes, there is always sufficient room.
13547            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13548            self.namespace_entries.as_mut().map(<fidl::encoding::Vector<NamespaceEntry, 32> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13549            encoder, offset + cur_offset, depth
13550        )?;
13551
13552            _prev_end_offset = cur_offset + envelope_size;
13553            if 3 > max_ordinal {
13554                return Ok(());
13555            }
13556
13557            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13558            // are envelope_size bytes.
13559            let cur_offset: usize = (3 - 1) * envelope_size;
13560
13561            // Zero reserved fields.
13562            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13563
13564            // Safety:
13565            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13566            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13567            //   envelope_size bytes, there is always sufficient room.
13568            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
13569            self.dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13570            encoder, offset + cur_offset, depth
13571        )?;
13572
13573            _prev_end_offset = cur_offset + envelope_size;
13574            if 4 > max_ordinal {
13575                return Ok(());
13576            }
13577
13578            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13579            // are envelope_size bytes.
13580            let cur_offset: usize = (4 - 1) * envelope_size;
13581
13582            // Zero reserved fields.
13583            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13584
13585            // Safety:
13586            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13587            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13588            //   envelope_size bytes, there is always sufficient room.
13589            fidl::encoding::encode_in_envelope_optional::<
13590                fidl::encoding::HandleType<
13591                    fidl::EventPair,
13592                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13593                    2147483648,
13594                >,
13595                fidl::encoding::DefaultFuchsiaResourceDialect,
13596            >(
13597                self.additional_inputs.as_mut().map(
13598                    <fidl::encoding::HandleType<
13599                        fidl::EventPair,
13600                        { fidl::ObjectType::EVENTPAIR.into_raw() },
13601                        2147483648,
13602                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13603                ),
13604                encoder,
13605                offset + cur_offset,
13606                depth,
13607            )?;
13608
13609            _prev_end_offset = cur_offset + envelope_size;
13610
13611            Ok(())
13612        }
13613    }
13614
13615    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13616        for StartChildArgs
13617    {
13618        #[inline(always)]
13619        fn new_empty() -> Self {
13620            Self::default()
13621        }
13622
13623        unsafe fn decode(
13624            &mut self,
13625            decoder: &mut fidl::encoding::Decoder<
13626                '_,
13627                fidl::encoding::DefaultFuchsiaResourceDialect,
13628            >,
13629            offset: usize,
13630            mut depth: fidl::encoding::Depth,
13631        ) -> fidl::Result<()> {
13632            decoder.debug_check_bounds::<Self>(offset);
13633            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13634                None => return Err(fidl::Error::NotNullable),
13635                Some(len) => len,
13636            };
13637            // Calling decoder.out_of_line_offset(0) is not allowed.
13638            if len == 0 {
13639                return Ok(());
13640            };
13641            depth.increment()?;
13642            let envelope_size = 8;
13643            let bytes_len = len * envelope_size;
13644            let offset = decoder.out_of_line_offset(bytes_len)?;
13645            // Decode the envelope for each type.
13646            let mut _next_ordinal_to_read = 0;
13647            let mut next_offset = offset;
13648            let end_offset = offset + bytes_len;
13649            _next_ordinal_to_read += 1;
13650            if next_offset >= end_offset {
13651                return Ok(());
13652            }
13653
13654            // Decode unknown envelopes for gaps in ordinals.
13655            while _next_ordinal_to_read < 1 {
13656                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13657                _next_ordinal_to_read += 1;
13658                next_offset += envelope_size;
13659            }
13660
13661            let next_out_of_line = decoder.next_out_of_line();
13662            let handles_before = decoder.remaining_handles();
13663            if let Some((inlined, num_bytes, num_handles)) =
13664                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13665            {
13666                let member_inline_size = <fidl::encoding::Vector<
13667                    fidl_fuchsia_process::HandleInfo,
13668                    128,
13669                > as fidl::encoding::TypeMarker>::inline_size(
13670                    decoder.context
13671                );
13672                if inlined != (member_inline_size <= 4) {
13673                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13674                }
13675                let inner_offset;
13676                let mut inner_depth = depth.clone();
13677                if inlined {
13678                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13679                    inner_offset = next_offset;
13680                } else {
13681                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13682                    inner_depth.increment()?;
13683                }
13684                let val_ref =
13685                self.numbered_handles.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
13686                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13687                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13688                {
13689                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13690                }
13691                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13692                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13693                }
13694            }
13695
13696            next_offset += envelope_size;
13697            _next_ordinal_to_read += 1;
13698            if next_offset >= end_offset {
13699                return Ok(());
13700            }
13701
13702            // Decode unknown envelopes for gaps in ordinals.
13703            while _next_ordinal_to_read < 2 {
13704                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13705                _next_ordinal_to_read += 1;
13706                next_offset += envelope_size;
13707            }
13708
13709            let next_out_of_line = decoder.next_out_of_line();
13710            let handles_before = decoder.remaining_handles();
13711            if let Some((inlined, num_bytes, num_handles)) =
13712                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13713            {
13714                let member_inline_size = <fidl::encoding::Vector<NamespaceEntry, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13715                if inlined != (member_inline_size <= 4) {
13716                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13717                }
13718                let inner_offset;
13719                let mut inner_depth = depth.clone();
13720                if inlined {
13721                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13722                    inner_offset = next_offset;
13723                } else {
13724                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13725                    inner_depth.increment()?;
13726                }
13727                let val_ref =
13728                self.namespace_entries.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
13729                fidl::decode!(fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13730                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13731                {
13732                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13733                }
13734                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13735                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13736                }
13737            }
13738
13739            next_offset += envelope_size;
13740            _next_ordinal_to_read += 1;
13741            if next_offset >= end_offset {
13742                return Ok(());
13743            }
13744
13745            // Decode unknown envelopes for gaps in ordinals.
13746            while _next_ordinal_to_read < 3 {
13747                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13748                _next_ordinal_to_read += 1;
13749                next_offset += envelope_size;
13750            }
13751
13752            let next_out_of_line = decoder.next_out_of_line();
13753            let handles_before = decoder.remaining_handles();
13754            if let Some((inlined, num_bytes, num_handles)) =
13755                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13756            {
13757                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13758                if inlined != (member_inline_size <= 4) {
13759                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13760                }
13761                let inner_offset;
13762                let mut inner_depth = depth.clone();
13763                if inlined {
13764                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13765                    inner_offset = next_offset;
13766                } else {
13767                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13768                    inner_depth.increment()?;
13769                }
13770                let val_ref = self.dictionary.get_or_insert_with(|| {
13771                    fidl::new_empty!(
13772                        fidl_fuchsia_component_sandbox::DictionaryRef,
13773                        fidl::encoding::DefaultFuchsiaResourceDialect
13774                    )
13775                });
13776                fidl::decode!(
13777                    fidl_fuchsia_component_sandbox::DictionaryRef,
13778                    fidl::encoding::DefaultFuchsiaResourceDialect,
13779                    val_ref,
13780                    decoder,
13781                    inner_offset,
13782                    inner_depth
13783                )?;
13784                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13785                {
13786                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13787                }
13788                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13789                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13790                }
13791            }
13792
13793            next_offset += envelope_size;
13794            _next_ordinal_to_read += 1;
13795            if next_offset >= end_offset {
13796                return Ok(());
13797            }
13798
13799            // Decode unknown envelopes for gaps in ordinals.
13800            while _next_ordinal_to_read < 4 {
13801                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13802                _next_ordinal_to_read += 1;
13803                next_offset += envelope_size;
13804            }
13805
13806            let next_out_of_line = decoder.next_out_of_line();
13807            let handles_before = decoder.remaining_handles();
13808            if let Some((inlined, num_bytes, num_handles)) =
13809                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13810            {
13811                let member_inline_size = <fidl::encoding::HandleType<
13812                    fidl::EventPair,
13813                    { fidl::ObjectType::EVENTPAIR.into_raw() },
13814                    2147483648,
13815                > as fidl::encoding::TypeMarker>::inline_size(
13816                    decoder.context
13817                );
13818                if inlined != (member_inline_size <= 4) {
13819                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13820                }
13821                let inner_offset;
13822                let mut inner_depth = depth.clone();
13823                if inlined {
13824                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13825                    inner_offset = next_offset;
13826                } else {
13827                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13828                    inner_depth.increment()?;
13829                }
13830                let val_ref =
13831                self.additional_inputs.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
13832                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13833                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13834                {
13835                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13836                }
13837                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13838                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13839                }
13840            }
13841
13842            next_offset += envelope_size;
13843
13844            // Decode the remaining unknown envelopes.
13845            while next_offset < end_offset {
13846                _next_ordinal_to_read += 1;
13847                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13848                next_offset += envelope_size;
13849            }
13850
13851            Ok(())
13852        }
13853    }
13854
13855    impl fidl::encoding::ResourceTypeMarker for EventPayload {
13856        type Borrowed<'a> = &'a mut Self;
13857        fn take_or_borrow<'a>(
13858            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13859        ) -> Self::Borrowed<'a> {
13860            value
13861        }
13862    }
13863
13864    unsafe impl fidl::encoding::TypeMarker for EventPayload {
13865        type Owned = Self;
13866
13867        #[inline(always)]
13868        fn inline_align(_context: fidl::encoding::Context) -> usize {
13869            8
13870        }
13871
13872        #[inline(always)]
13873        fn inline_size(_context: fidl::encoding::Context) -> usize {
13874            16
13875        }
13876    }
13877
13878    unsafe impl fidl::encoding::Encode<EventPayload, fidl::encoding::DefaultFuchsiaResourceDialect>
13879        for &mut EventPayload
13880    {
13881        #[inline]
13882        unsafe fn encode(
13883            self,
13884            encoder: &mut fidl::encoding::Encoder<
13885                '_,
13886                fidl::encoding::DefaultFuchsiaResourceDialect,
13887            >,
13888            offset: usize,
13889            _depth: fidl::encoding::Depth,
13890        ) -> fidl::Result<()> {
13891            encoder.debug_check_bounds::<EventPayload>(offset);
13892            encoder.write_num::<u64>(self.ordinal(), offset);
13893            match self {
13894            EventPayload::CapabilityRequested(ref mut val) => {
13895                fidl::encoding::encode_in_envelope::<CapabilityRequestedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13896                    <CapabilityRequestedPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
13897                    encoder, offset + 8, _depth
13898                )
13899            }
13900            EventPayload::Purged(ref val) => {
13901                fidl::encoding::encode_in_envelope::<PurgedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13902                    <PurgedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13903                    encoder, offset + 8, _depth
13904                )
13905            }
13906            EventPayload::Discovered(ref val) => {
13907                fidl::encoding::encode_in_envelope::<DiscoveredPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13908                    <DiscoveredPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13909                    encoder, offset + 8, _depth
13910                )
13911            }
13912            EventPayload::Destroyed(ref val) => {
13913                fidl::encoding::encode_in_envelope::<DestroyedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13914                    <DestroyedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13915                    encoder, offset + 8, _depth
13916                )
13917            }
13918            EventPayload::Resolved(ref val) => {
13919                fidl::encoding::encode_in_envelope::<ResolvedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13920                    <ResolvedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13921                    encoder, offset + 8, _depth
13922                )
13923            }
13924            EventPayload::Started(ref val) => {
13925                fidl::encoding::encode_in_envelope::<StartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13926                    <StartedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13927                    encoder, offset + 8, _depth
13928                )
13929            }
13930            EventPayload::Stopped(ref val) => {
13931                fidl::encoding::encode_in_envelope::<StoppedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13932                    <StoppedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13933                    encoder, offset + 8, _depth
13934                )
13935            }
13936            EventPayload::DebugStarted(ref mut val) => {
13937                fidl::encoding::encode_in_envelope::<DebugStartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13938                    <DebugStartedPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
13939                    encoder, offset + 8, _depth
13940                )
13941            }
13942            EventPayload::Unresolved(ref val) => {
13943                fidl::encoding::encode_in_envelope::<UnresolvedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
13944                    <UnresolvedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
13945                    encoder, offset + 8, _depth
13946                )
13947            }
13948            EventPayload::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
13949        }
13950        }
13951    }
13952
13953    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for EventPayload {
13954        #[inline(always)]
13955        fn new_empty() -> Self {
13956            Self::__SourceBreaking { unknown_ordinal: 0 }
13957        }
13958
13959        #[inline]
13960        unsafe fn decode(
13961            &mut self,
13962            decoder: &mut fidl::encoding::Decoder<
13963                '_,
13964                fidl::encoding::DefaultFuchsiaResourceDialect,
13965            >,
13966            offset: usize,
13967            mut depth: fidl::encoding::Depth,
13968        ) -> fidl::Result<()> {
13969            decoder.debug_check_bounds::<Self>(offset);
13970            #[allow(unused_variables)]
13971            let next_out_of_line = decoder.next_out_of_line();
13972            let handles_before = decoder.remaining_handles();
13973            let (ordinal, inlined, num_bytes, num_handles) =
13974                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
13975
13976            let member_inline_size = match ordinal {
13977                1 => <CapabilityRequestedPayload as fidl::encoding::TypeMarker>::inline_size(
13978                    decoder.context,
13979                ),
13980                2 => <PurgedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13981                4 => {
13982                    <DiscoveredPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context)
13983                }
13984                5 => <DestroyedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13985                6 => <ResolvedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13986                7 => <StartedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13987                8 => <StoppedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13988                9 => <DebugStartedPayload as fidl::encoding::TypeMarker>::inline_size(
13989                    decoder.context,
13990                ),
13991                10 => {
13992                    <UnresolvedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context)
13993                }
13994                0 => return Err(fidl::Error::UnknownUnionTag),
13995                _ => num_bytes as usize,
13996            };
13997
13998            if inlined != (member_inline_size <= 4) {
13999                return Err(fidl::Error::InvalidInlineBitInEnvelope);
14000            }
14001            let _inner_offset;
14002            if inlined {
14003                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
14004                _inner_offset = offset + 8;
14005            } else {
14006                depth.increment()?;
14007                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14008            }
14009            match ordinal {
14010                1 => {
14011                    #[allow(irrefutable_let_patterns)]
14012                    if let EventPayload::CapabilityRequested(_) = self {
14013                        // Do nothing, read the value into the object
14014                    } else {
14015                        // Initialize `self` to the right variant
14016                        *self = EventPayload::CapabilityRequested(fidl::new_empty!(
14017                            CapabilityRequestedPayload,
14018                            fidl::encoding::DefaultFuchsiaResourceDialect
14019                        ));
14020                    }
14021                    #[allow(irrefutable_let_patterns)]
14022                    if let EventPayload::CapabilityRequested(ref mut val) = self {
14023                        fidl::decode!(
14024                            CapabilityRequestedPayload,
14025                            fidl::encoding::DefaultFuchsiaResourceDialect,
14026                            val,
14027                            decoder,
14028                            _inner_offset,
14029                            depth
14030                        )?;
14031                    } else {
14032                        unreachable!()
14033                    }
14034                }
14035                2 => {
14036                    #[allow(irrefutable_let_patterns)]
14037                    if let EventPayload::Purged(_) = self {
14038                        // Do nothing, read the value into the object
14039                    } else {
14040                        // Initialize `self` to the right variant
14041                        *self = EventPayload::Purged(fidl::new_empty!(
14042                            PurgedPayload,
14043                            fidl::encoding::DefaultFuchsiaResourceDialect
14044                        ));
14045                    }
14046                    #[allow(irrefutable_let_patterns)]
14047                    if let EventPayload::Purged(ref mut val) = self {
14048                        fidl::decode!(
14049                            PurgedPayload,
14050                            fidl::encoding::DefaultFuchsiaResourceDialect,
14051                            val,
14052                            decoder,
14053                            _inner_offset,
14054                            depth
14055                        )?;
14056                    } else {
14057                        unreachable!()
14058                    }
14059                }
14060                4 => {
14061                    #[allow(irrefutable_let_patterns)]
14062                    if let EventPayload::Discovered(_) = self {
14063                        // Do nothing, read the value into the object
14064                    } else {
14065                        // Initialize `self` to the right variant
14066                        *self = EventPayload::Discovered(fidl::new_empty!(
14067                            DiscoveredPayload,
14068                            fidl::encoding::DefaultFuchsiaResourceDialect
14069                        ));
14070                    }
14071                    #[allow(irrefutable_let_patterns)]
14072                    if let EventPayload::Discovered(ref mut val) = self {
14073                        fidl::decode!(
14074                            DiscoveredPayload,
14075                            fidl::encoding::DefaultFuchsiaResourceDialect,
14076                            val,
14077                            decoder,
14078                            _inner_offset,
14079                            depth
14080                        )?;
14081                    } else {
14082                        unreachable!()
14083                    }
14084                }
14085                5 => {
14086                    #[allow(irrefutable_let_patterns)]
14087                    if let EventPayload::Destroyed(_) = self {
14088                        // Do nothing, read the value into the object
14089                    } else {
14090                        // Initialize `self` to the right variant
14091                        *self = EventPayload::Destroyed(fidl::new_empty!(
14092                            DestroyedPayload,
14093                            fidl::encoding::DefaultFuchsiaResourceDialect
14094                        ));
14095                    }
14096                    #[allow(irrefutable_let_patterns)]
14097                    if let EventPayload::Destroyed(ref mut val) = self {
14098                        fidl::decode!(
14099                            DestroyedPayload,
14100                            fidl::encoding::DefaultFuchsiaResourceDialect,
14101                            val,
14102                            decoder,
14103                            _inner_offset,
14104                            depth
14105                        )?;
14106                    } else {
14107                        unreachable!()
14108                    }
14109                }
14110                6 => {
14111                    #[allow(irrefutable_let_patterns)]
14112                    if let EventPayload::Resolved(_) = self {
14113                        // Do nothing, read the value into the object
14114                    } else {
14115                        // Initialize `self` to the right variant
14116                        *self = EventPayload::Resolved(fidl::new_empty!(
14117                            ResolvedPayload,
14118                            fidl::encoding::DefaultFuchsiaResourceDialect
14119                        ));
14120                    }
14121                    #[allow(irrefutable_let_patterns)]
14122                    if let EventPayload::Resolved(ref mut val) = self {
14123                        fidl::decode!(
14124                            ResolvedPayload,
14125                            fidl::encoding::DefaultFuchsiaResourceDialect,
14126                            val,
14127                            decoder,
14128                            _inner_offset,
14129                            depth
14130                        )?;
14131                    } else {
14132                        unreachable!()
14133                    }
14134                }
14135                7 => {
14136                    #[allow(irrefutable_let_patterns)]
14137                    if let EventPayload::Started(_) = self {
14138                        // Do nothing, read the value into the object
14139                    } else {
14140                        // Initialize `self` to the right variant
14141                        *self = EventPayload::Started(fidl::new_empty!(
14142                            StartedPayload,
14143                            fidl::encoding::DefaultFuchsiaResourceDialect
14144                        ));
14145                    }
14146                    #[allow(irrefutable_let_patterns)]
14147                    if let EventPayload::Started(ref mut val) = self {
14148                        fidl::decode!(
14149                            StartedPayload,
14150                            fidl::encoding::DefaultFuchsiaResourceDialect,
14151                            val,
14152                            decoder,
14153                            _inner_offset,
14154                            depth
14155                        )?;
14156                    } else {
14157                        unreachable!()
14158                    }
14159                }
14160                8 => {
14161                    #[allow(irrefutable_let_patterns)]
14162                    if let EventPayload::Stopped(_) = self {
14163                        // Do nothing, read the value into the object
14164                    } else {
14165                        // Initialize `self` to the right variant
14166                        *self = EventPayload::Stopped(fidl::new_empty!(
14167                            StoppedPayload,
14168                            fidl::encoding::DefaultFuchsiaResourceDialect
14169                        ));
14170                    }
14171                    #[allow(irrefutable_let_patterns)]
14172                    if let EventPayload::Stopped(ref mut val) = self {
14173                        fidl::decode!(
14174                            StoppedPayload,
14175                            fidl::encoding::DefaultFuchsiaResourceDialect,
14176                            val,
14177                            decoder,
14178                            _inner_offset,
14179                            depth
14180                        )?;
14181                    } else {
14182                        unreachable!()
14183                    }
14184                }
14185                9 => {
14186                    #[allow(irrefutable_let_patterns)]
14187                    if let EventPayload::DebugStarted(_) = self {
14188                        // Do nothing, read the value into the object
14189                    } else {
14190                        // Initialize `self` to the right variant
14191                        *self = EventPayload::DebugStarted(fidl::new_empty!(
14192                            DebugStartedPayload,
14193                            fidl::encoding::DefaultFuchsiaResourceDialect
14194                        ));
14195                    }
14196                    #[allow(irrefutable_let_patterns)]
14197                    if let EventPayload::DebugStarted(ref mut val) = self {
14198                        fidl::decode!(
14199                            DebugStartedPayload,
14200                            fidl::encoding::DefaultFuchsiaResourceDialect,
14201                            val,
14202                            decoder,
14203                            _inner_offset,
14204                            depth
14205                        )?;
14206                    } else {
14207                        unreachable!()
14208                    }
14209                }
14210                10 => {
14211                    #[allow(irrefutable_let_patterns)]
14212                    if let EventPayload::Unresolved(_) = self {
14213                        // Do nothing, read the value into the object
14214                    } else {
14215                        // Initialize `self` to the right variant
14216                        *self = EventPayload::Unresolved(fidl::new_empty!(
14217                            UnresolvedPayload,
14218                            fidl::encoding::DefaultFuchsiaResourceDialect
14219                        ));
14220                    }
14221                    #[allow(irrefutable_let_patterns)]
14222                    if let EventPayload::Unresolved(ref mut val) = self {
14223                        fidl::decode!(
14224                            UnresolvedPayload,
14225                            fidl::encoding::DefaultFuchsiaResourceDialect,
14226                            val,
14227                            decoder,
14228                            _inner_offset,
14229                            depth
14230                        )?;
14231                    } else {
14232                        unreachable!()
14233                    }
14234                }
14235                #[allow(deprecated)]
14236                ordinal => {
14237                    for _ in 0..num_handles {
14238                        decoder.drop_next_handle()?;
14239                    }
14240                    *self = EventPayload::__SourceBreaking { unknown_ordinal: ordinal };
14241                }
14242            }
14243            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
14244                return Err(fidl::Error::InvalidNumBytesInEnvelope);
14245            }
14246            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14247                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14248            }
14249            Ok(())
14250        }
14251    }
14252}