fidl_fuchsia_component/
fidl_fuchsia_component.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_component__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ControllerStartRequest {
16    pub args: StartChildArgs,
17    pub execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerStartRequest {}
21
22#[derive(Debug, PartialEq)]
23pub struct ControllerGetExposedDictionaryResponse {
24    pub dictionary: fidl_fuchsia_component_sandbox::DictionaryRef,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28    for ControllerGetExposedDictionaryResponse
29{
30}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct ControllerIsStartedResponse {
34    pub is_started: bool,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
38    for ControllerIsStartedResponse
39{
40}
41
42#[derive(Debug, PartialEq)]
43pub struct EventStreamGetNextResponse {
44    pub events: Vec<Event>,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
48    for EventStreamGetNextResponse
49{
50}
51
52#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
53pub struct IntrospectorGetMonikerRequest {
54    pub component_instance: fidl::Event,
55}
56
57impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
58    for IntrospectorGetMonikerRequest
59{
60}
61
62#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
63pub struct NamespaceCreateRequest {
64    pub entries: Vec<NamespaceInputEntry>,
65}
66
67impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceCreateRequest {}
68
69#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct NamespaceInputEntry {
71    pub path: String,
72    pub dictionary: fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceInputEntry {}
76
77#[derive(Debug, PartialEq)]
78pub struct NamespaceCreateResponse {
79    pub entries: Vec<NamespaceEntry>,
80}
81
82impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceCreateResponse {}
83
84#[derive(Debug, PartialEq)]
85pub struct RealmCreateChildRequest {
86    pub collection: fidl_fuchsia_component_decl::CollectionRef,
87    pub decl: fidl_fuchsia_component_decl::Child,
88    pub args: CreateChildArgs,
89}
90
91impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmCreateChildRequest {}
92
93#[derive(Debug, PartialEq)]
94pub struct RealmGetChildOutputDictionaryRequest {
95    pub child: fidl_fuchsia_component_decl::ChildRef,
96}
97
98impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
99    for RealmGetChildOutputDictionaryRequest
100{
101}
102
103#[derive(Debug, PartialEq)]
104pub struct RealmListChildrenRequest {
105    pub collection: fidl_fuchsia_component_decl::CollectionRef,
106    pub iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
107}
108
109impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmListChildrenRequest {}
110
111#[derive(Debug, PartialEq)]
112pub struct RealmOpenControllerRequest {
113    pub child: fidl_fuchsia_component_decl::ChildRef,
114    pub controller: fidl::endpoints::ServerEnd<ControllerMarker>,
115}
116
117impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
118    for RealmOpenControllerRequest
119{
120}
121
122#[derive(Debug, PartialEq)]
123pub struct RealmOpenExposedDirRequest {
124    pub child: fidl_fuchsia_component_decl::ChildRef,
125    pub exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
129    for RealmOpenExposedDirRequest
130{
131}
132
133#[derive(Debug, PartialEq)]
134pub struct RealmGetChildOutputDictionaryResponse {
135    pub dictionary: fidl_fuchsia_component_sandbox::DictionaryRef,
136}
137
138impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
139    for RealmGetChildOutputDictionaryResponse
140{
141}
142
143#[derive(Debug, PartialEq)]
144pub struct RealmGetResolvedInfoResponse {
145    pub resolved_info: fidl_fuchsia_component_resolution::Component,
146}
147
148impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
149    for RealmGetResolvedInfoResponse
150{
151}
152
153#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
154pub struct StorageAdminListStorageInRealmRequest {
155    pub relative_moniker: String,
156    pub iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
157}
158
159impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
160    for StorageAdminListStorageInRealmRequest
161{
162}
163
164#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
165pub struct StorageAdminOpenComponentStorageByIdRequest {
166    pub id: String,
167    pub object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
168}
169
170impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
171    for StorageAdminOpenComponentStorageByIdRequest
172{
173}
174
175#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
176pub struct StorageAdminOpenStorageRequest {
177    pub relative_moniker: String,
178    pub object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
179}
180
181impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
182    for StorageAdminOpenStorageRequest
183{
184}
185
186/// Payload for CapabilityRequested events
187#[derive(Debug, Default, PartialEq)]
188pub struct CapabilityRequestedPayload {
189    /// The name of the capability.
190    pub name: Option<String>,
191    /// A handle to the server end of the channel to host
192    /// capability.
193    pub capability: Option<fidl::Channel>,
194    #[doc(hidden)]
195    pub __source_breaking: fidl::marker::SourceBreaking,
196}
197
198impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
199    for CapabilityRequestedPayload
200{
201}
202
203#[derive(Debug, Default, PartialEq)]
204pub struct CreateChildArgs {
205    /// The numbered handles to pass to the component instance.
206    ///
207    /// If the runner for the component does not support the numbered handles it is
208    /// expected to close the handles.
209    pub numbered_handles: Option<Vec<fidl_fuchsia_process::HandleInfo>>,
210    /// Dynamic offers that will target the component instance.
211    ///
212    /// Including `OfferDecl`s in this vector will cause additional capabilities
213    /// to be offered to the newly created child, beyond the `OfferDecl`s in the
214    /// parent's `ComponentDecl` that target the collection.
215    ///
216    /// Any kind of offer (e.g., protocol, directory) can be used as a dynamic
217    /// offer. Any source that would be valid for a static offer is also valid
218    /// for a dynamic offer. Additionally, unlike static offers, dynamic offers
219    /// can use a "sibling" dynamic child component as a source by setting the
220    /// source to a `ChildRef` that sets the `collection` field.
221    ///
222    /// Dynamic offers always target the newly created child component. As a
223    /// result, `OfferDecl`s in `dynamic_offers` must not set the `target`
224    /// field, as its value is implied.
225    ///
226    /// If either the source (that is, the component named in the `source` field
227    /// of the `OfferDecl`) or the target of a dynamic offer is destroyed, the
228    /// offer itself is destroyed simultaneously.
229    ///
230    /// In order to set this field to a non-empty value, the collection in which
231    /// the child component is being created must specify
232    /// `ComponentDecl.allowed_offers = STATIC_AND_DYNAMIC`.
233    pub dynamic_offers: Option<Vec<fidl_fuchsia_component_decl::Offer>>,
234    /// The controller for this component, which may be used to influence the
235    /// component's lifecycle.
236    pub controller: Option<fidl::endpoints::ServerEnd<ControllerMarker>>,
237    /// A dictionary that contains extra capabilities for the component instance.
238    pub dictionary: Option<fidl_fuchsia_component_sandbox::DictionaryRef>,
239    #[doc(hidden)]
240    pub __source_breaking: fidl::marker::SourceBreaking,
241}
242
243impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateChildArgs {}
244
245/// Payload for DebugStarted events.
246#[derive(Debug, Default, PartialEq)]
247pub struct DebugStartedPayload {
248    /// The directory served by the runner to present runtime and runner-specific information
249    /// about the component. The other side is sent to the runner in ComponentStartInfo.
250    /// For example, it can be queried to know whether the component is an ELF component and
251    /// supports the break_on_start protocol below.
252    pub runtime_dir: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
253    /// An eventpair that can be used by debuggers to defer the launch of the component,
254    /// e.g., ELF debuggers can setup the exception channel on the job while holding
255    /// the eventpair, then drop the eventpair to notify the runner that processes could
256    /// be created. The other side is sent to the runner in ComponentStartInfo.
257    pub break_on_start: Option<fidl::EventPair>,
258    #[doc(hidden)]
259    pub __source_breaking: fidl::marker::SourceBreaking,
260}
261
262impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DebugStartedPayload {}
263
264/// Contains all information about a single event
265#[derive(Debug, Default, PartialEq)]
266pub struct Event {
267    /// Information about the component for which this event was generated.
268    pub header: Option<EventHeader>,
269    /// Optional payload for some event types
270    pub payload: Option<EventPayload>,
271    #[doc(hidden)]
272    pub __source_breaking: fidl::marker::SourceBreaking,
273}
274
275impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Event {}
276
277/// A single component namespace entry, which describes a namespace mount point
278/// (`path`) and the directory backing it (`directory`). This type is usually
279/// composed inside a vector.  See `ComponentStartInfo.ns` for more details.
280#[derive(Debug, Default, PartialEq)]
281pub struct NamespaceEntry {
282    /// The mount point for the directory, including a
283    /// leading slash. For example: "/pkg", "/svc", or "/config/data".
284    pub path: Option<String>,
285    /// The directory mounted at the above `path`.
286    pub directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
287    #[doc(hidden)]
288    pub __source_breaking: fidl::marker::SourceBreaking,
289}
290
291impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NamespaceEntry {}
292
293#[derive(Debug, Default, PartialEq)]
294pub struct StartChildArgs {
295    /// The numbered handles to pass to the component instance.
296    ///
297    /// If the runner for the component does not support the numbered handles it
298    /// is expected to close the handles.
299    ///
300    /// If set, the values given here will override the handles given in
301    /// CreateChildArgs.
302    pub numbered_handles: Option<Vec<fidl_fuchsia_process::HandleInfo>>,
303    /// The namespace generated by component manager will be extended to include
304    /// any namespace entries listed here before being given to the component's
305    /// runner.
306    ///
307    /// If there are any conflicting entries, an error will occur when starting
308    /// the component.
309    pub namespace_entries: Option<Vec<NamespaceEntry>>,
310    /// A dictionary that contains extra capabilities for the component instance.
311    pub dictionary: Option<fidl_fuchsia_component_sandbox::DictionaryRef>,
312    #[doc(hidden)]
313    pub __source_breaking: fidl::marker::SourceBreaking,
314}
315
316impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StartChildArgs {}
317
318/// Encapsulates additional data/protocols for some event types.
319#[derive(Debug)]
320pub enum EventPayload {
321    /// Payload for CapabilityRequested events
322    CapabilityRequested(CapabilityRequestedPayload),
323    /// Payload for Purged events.
324    Purged(PurgedPayload),
325    /// Payload for Discovered events.
326    Discovered(DiscoveredPayload),
327    /// Payload for Destroyed events.
328    Destroyed(DestroyedPayload),
329    /// Payload for Resolved events
330    Resolved(ResolvedPayload),
331    /// Payload for Started events
332    Started(StartedPayload),
333    /// Payload for Stopped events
334    Stopped(StoppedPayload),
335    /// Payload for DebugStarted events
336    DebugStarted(DebugStartedPayload),
337    /// Payload for Unresolved events
338    Unresolved(UnresolvedPayload),
339    #[doc(hidden)]
340    __SourceBreaking { unknown_ordinal: u64 },
341}
342
343/// Pattern that matches an unknown `EventPayload` member.
344#[macro_export]
345macro_rules! EventPayloadUnknown {
346    () => {
347        _
348    };
349}
350
351// Custom PartialEq so that unknown variants are not equal to themselves.
352impl PartialEq for EventPayload {
353    fn eq(&self, other: &Self) -> bool {
354        match (self, other) {
355            (Self::CapabilityRequested(x), Self::CapabilityRequested(y)) => *x == *y,
356            (Self::Purged(x), Self::Purged(y)) => *x == *y,
357            (Self::Discovered(x), Self::Discovered(y)) => *x == *y,
358            (Self::Destroyed(x), Self::Destroyed(y)) => *x == *y,
359            (Self::Resolved(x), Self::Resolved(y)) => *x == *y,
360            (Self::Started(x), Self::Started(y)) => *x == *y,
361            (Self::Stopped(x), Self::Stopped(y)) => *x == *y,
362            (Self::DebugStarted(x), Self::DebugStarted(y)) => *x == *y,
363            (Self::Unresolved(x), Self::Unresolved(y)) => *x == *y,
364            _ => false,
365        }
366    }
367}
368
369impl EventPayload {
370    #[inline]
371    pub fn ordinal(&self) -> u64 {
372        match *self {
373            Self::CapabilityRequested(_) => 1,
374            Self::Purged(_) => 2,
375            Self::Discovered(_) => 4,
376            Self::Destroyed(_) => 5,
377            Self::Resolved(_) => 6,
378            Self::Started(_) => 7,
379            Self::Stopped(_) => 8,
380            Self::DebugStarted(_) => 9,
381            Self::Unresolved(_) => 10,
382            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
383        }
384    }
385
386    #[inline]
387    pub fn unknown_variant_for_testing() -> Self {
388        Self::__SourceBreaking { unknown_ordinal: 0 }
389    }
390
391    #[inline]
392    pub fn is_unknown(&self) -> bool {
393        match self {
394            Self::__SourceBreaking { .. } => true,
395            _ => false,
396        }
397    }
398}
399
400impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EventPayload {}
401
402#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
403pub struct BinderMarker;
404
405impl fidl::endpoints::ProtocolMarker for BinderMarker {
406    type Proxy = BinderProxy;
407    type RequestStream = BinderRequestStream;
408    #[cfg(target_os = "fuchsia")]
409    type SynchronousProxy = BinderSynchronousProxy;
410
411    const DEBUG_NAME: &'static str = "fuchsia.component.Binder";
412}
413impl fidl::endpoints::DiscoverableProtocolMarker for BinderMarker {}
414
415pub trait BinderProxyInterface: Send + Sync {}
416#[derive(Debug)]
417#[cfg(target_os = "fuchsia")]
418pub struct BinderSynchronousProxy {
419    client: fidl::client::sync::Client,
420}
421
422#[cfg(target_os = "fuchsia")]
423impl fidl::endpoints::SynchronousProxy for BinderSynchronousProxy {
424    type Proxy = BinderProxy;
425    type Protocol = BinderMarker;
426
427    fn from_channel(inner: fidl::Channel) -> Self {
428        Self::new(inner)
429    }
430
431    fn into_channel(self) -> fidl::Channel {
432        self.client.into_channel()
433    }
434
435    fn as_channel(&self) -> &fidl::Channel {
436        self.client.as_channel()
437    }
438}
439
440#[cfg(target_os = "fuchsia")]
441impl BinderSynchronousProxy {
442    pub fn new(channel: fidl::Channel) -> Self {
443        let protocol_name = <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
444        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
445    }
446
447    pub fn into_channel(self) -> fidl::Channel {
448        self.client.into_channel()
449    }
450
451    /// Waits until an event arrives and returns it. It is safe for other
452    /// threads to make concurrent requests while waiting for an event.
453    pub fn wait_for_event(
454        &self,
455        deadline: zx::MonotonicInstant,
456    ) -> Result<BinderEvent, fidl::Error> {
457        BinderEvent::decode(self.client.wait_for_event(deadline)?)
458    }
459}
460
461#[cfg(target_os = "fuchsia")]
462impl From<BinderSynchronousProxy> for zx::Handle {
463    fn from(value: BinderSynchronousProxy) -> Self {
464        value.into_channel().into()
465    }
466}
467
468#[cfg(target_os = "fuchsia")]
469impl From<fidl::Channel> for BinderSynchronousProxy {
470    fn from(value: fidl::Channel) -> Self {
471        Self::new(value)
472    }
473}
474
475#[cfg(target_os = "fuchsia")]
476impl fidl::endpoints::FromClient for BinderSynchronousProxy {
477    type Protocol = BinderMarker;
478
479    fn from_client(value: fidl::endpoints::ClientEnd<BinderMarker>) -> Self {
480        Self::new(value.into_channel())
481    }
482}
483
484#[derive(Debug, Clone)]
485pub struct BinderProxy {
486    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
487}
488
489impl fidl::endpoints::Proxy for BinderProxy {
490    type Protocol = BinderMarker;
491
492    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
493        Self::new(inner)
494    }
495
496    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
497        self.client.into_channel().map_err(|client| Self { client })
498    }
499
500    fn as_channel(&self) -> &::fidl::AsyncChannel {
501        self.client.as_channel()
502    }
503}
504
505impl BinderProxy {
506    /// Create a new Proxy for fuchsia.component/Binder.
507    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
508        let protocol_name = <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
509        Self { client: fidl::client::Client::new(channel, protocol_name) }
510    }
511
512    /// Get a Stream of events from the remote end of the protocol.
513    ///
514    /// # Panics
515    ///
516    /// Panics if the event stream was already taken.
517    pub fn take_event_stream(&self) -> BinderEventStream {
518        BinderEventStream { event_receiver: self.client.take_event_receiver() }
519    }
520}
521
522impl BinderProxyInterface for BinderProxy {}
523
524pub struct BinderEventStream {
525    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
526}
527
528impl std::marker::Unpin for BinderEventStream {}
529
530impl futures::stream::FusedStream for BinderEventStream {
531    fn is_terminated(&self) -> bool {
532        self.event_receiver.is_terminated()
533    }
534}
535
536impl futures::Stream for BinderEventStream {
537    type Item = Result<BinderEvent, fidl::Error>;
538
539    fn poll_next(
540        mut self: std::pin::Pin<&mut Self>,
541        cx: &mut std::task::Context<'_>,
542    ) -> std::task::Poll<Option<Self::Item>> {
543        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
544            &mut self.event_receiver,
545            cx
546        )?) {
547            Some(buf) => std::task::Poll::Ready(Some(BinderEvent::decode(buf))),
548            None => std::task::Poll::Ready(None),
549        }
550    }
551}
552
553#[derive(Debug)]
554pub enum BinderEvent {}
555
556impl BinderEvent {
557    /// Decodes a message buffer as a [`BinderEvent`].
558    fn decode(
559        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
560    ) -> Result<BinderEvent, fidl::Error> {
561        let (bytes, _handles) = buf.split_mut();
562        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
563        debug_assert_eq!(tx_header.tx_id, 0);
564        match tx_header.ordinal {
565            _ => Err(fidl::Error::UnknownOrdinal {
566                ordinal: tx_header.ordinal,
567                protocol_name: <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
568            }),
569        }
570    }
571}
572
573/// A Stream of incoming requests for fuchsia.component/Binder.
574pub struct BinderRequestStream {
575    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
576    is_terminated: bool,
577}
578
579impl std::marker::Unpin for BinderRequestStream {}
580
581impl futures::stream::FusedStream for BinderRequestStream {
582    fn is_terminated(&self) -> bool {
583        self.is_terminated
584    }
585}
586
587impl fidl::endpoints::RequestStream for BinderRequestStream {
588    type Protocol = BinderMarker;
589    type ControlHandle = BinderControlHandle;
590
591    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
592        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
593    }
594
595    fn control_handle(&self) -> Self::ControlHandle {
596        BinderControlHandle { inner: self.inner.clone() }
597    }
598
599    fn into_inner(
600        self,
601    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
602    {
603        (self.inner, self.is_terminated)
604    }
605
606    fn from_inner(
607        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
608        is_terminated: bool,
609    ) -> Self {
610        Self { inner, is_terminated }
611    }
612}
613
614impl futures::Stream for BinderRequestStream {
615    type Item = Result<BinderRequest, 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        let this = &mut *self;
622        if this.inner.check_shutdown(cx) {
623            this.is_terminated = true;
624            return std::task::Poll::Ready(None);
625        }
626        if this.is_terminated {
627            panic!("polled BinderRequestStream after completion");
628        }
629        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
630            |bytes, handles| {
631                match this.inner.channel().read_etc(cx, bytes, handles) {
632                    std::task::Poll::Ready(Ok(())) => {}
633                    std::task::Poll::Pending => return std::task::Poll::Pending,
634                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
635                        this.is_terminated = true;
636                        return std::task::Poll::Ready(None);
637                    }
638                    std::task::Poll::Ready(Err(e)) => {
639                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
640                            e.into(),
641                        ))));
642                    }
643                }
644
645                // A message has been received from the channel
646                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
647
648                std::task::Poll::Ready(Some(match header.ordinal {
649                    _ => Err(fidl::Error::UnknownOrdinal {
650                        ordinal: header.ordinal,
651                        protocol_name:
652                            <BinderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
653                    }),
654                }))
655            },
656        )
657    }
658}
659
660/// A framework-provided protocol that allows components that use it to bind to
661/// the component that exposes it. The act of connecting to this protocol will
662/// trigger the bind. Thus, this protocol contains no methods. For more details
663/// on binding, see
664/// https://fuchsia.dev/fuchsia-src/concepts/components/v2/lifecycle#binding.
665///
666/// When a component connects to protocol, the component exposing this capability
667/// will be started if it's not already running. Upon a failure to start, the
668/// component framework will close the server end of the channel with a
669/// zx.Status epitaph.
670#[derive(Debug)]
671pub enum BinderRequest {}
672
673impl BinderRequest {
674    /// Name of the method defined in FIDL
675    pub fn method_name(&self) -> &'static str {
676        match *self {}
677    }
678}
679
680#[derive(Debug, Clone)]
681pub struct BinderControlHandle {
682    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
683}
684
685impl fidl::endpoints::ControlHandle for BinderControlHandle {
686    fn shutdown(&self) {
687        self.inner.shutdown()
688    }
689    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
690        self.inner.shutdown_with_epitaph(status)
691    }
692
693    fn is_closed(&self) -> bool {
694        self.inner.channel().is_closed()
695    }
696    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
697        self.inner.channel().on_closed()
698    }
699
700    #[cfg(target_os = "fuchsia")]
701    fn signal_peer(
702        &self,
703        clear_mask: zx::Signals,
704        set_mask: zx::Signals,
705    ) -> Result<(), zx_status::Status> {
706        use fidl::Peered;
707        self.inner.channel().signal_peer(clear_mask, set_mask)
708    }
709}
710
711impl BinderControlHandle {}
712
713#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
714pub struct ChildIteratorMarker;
715
716impl fidl::endpoints::ProtocolMarker for ChildIteratorMarker {
717    type Proxy = ChildIteratorProxy;
718    type RequestStream = ChildIteratorRequestStream;
719    #[cfg(target_os = "fuchsia")]
720    type SynchronousProxy = ChildIteratorSynchronousProxy;
721
722    const DEBUG_NAME: &'static str = "(anonymous) ChildIterator";
723}
724
725pub trait ChildIteratorProxyInterface: Send + Sync {
726    type NextResponseFut: std::future::Future<
727            Output = Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error>,
728        > + Send;
729    fn r#next(&self) -> Self::NextResponseFut;
730}
731#[derive(Debug)]
732#[cfg(target_os = "fuchsia")]
733pub struct ChildIteratorSynchronousProxy {
734    client: fidl::client::sync::Client,
735}
736
737#[cfg(target_os = "fuchsia")]
738impl fidl::endpoints::SynchronousProxy for ChildIteratorSynchronousProxy {
739    type Proxy = ChildIteratorProxy;
740    type Protocol = ChildIteratorMarker;
741
742    fn from_channel(inner: fidl::Channel) -> Self {
743        Self::new(inner)
744    }
745
746    fn into_channel(self) -> fidl::Channel {
747        self.client.into_channel()
748    }
749
750    fn as_channel(&self) -> &fidl::Channel {
751        self.client.as_channel()
752    }
753}
754
755#[cfg(target_os = "fuchsia")]
756impl ChildIteratorSynchronousProxy {
757    pub fn new(channel: fidl::Channel) -> Self {
758        let protocol_name = <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
759        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
760    }
761
762    pub fn into_channel(self) -> fidl::Channel {
763        self.client.into_channel()
764    }
765
766    /// Waits until an event arrives and returns it. It is safe for other
767    /// threads to make concurrent requests while waiting for an event.
768    pub fn wait_for_event(
769        &self,
770        deadline: zx::MonotonicInstant,
771    ) -> Result<ChildIteratorEvent, fidl::Error> {
772        ChildIteratorEvent::decode(self.client.wait_for_event(deadline)?)
773    }
774
775    /// Advance the iterator and return the next batch of children.
776    ///
777    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
778    /// no more children.
779    pub fn r#next(
780        &self,
781        ___deadline: zx::MonotonicInstant,
782    ) -> Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error> {
783        let _response =
784            self.client.send_query::<fidl::encoding::EmptyPayload, ChildIteratorNextResponse>(
785                (),
786                0x40e4c3882b050d08,
787                fidl::encoding::DynamicFlags::empty(),
788                ___deadline,
789            )?;
790        Ok(_response.children)
791    }
792}
793
794#[cfg(target_os = "fuchsia")]
795impl From<ChildIteratorSynchronousProxy> for zx::Handle {
796    fn from(value: ChildIteratorSynchronousProxy) -> Self {
797        value.into_channel().into()
798    }
799}
800
801#[cfg(target_os = "fuchsia")]
802impl From<fidl::Channel> for ChildIteratorSynchronousProxy {
803    fn from(value: fidl::Channel) -> Self {
804        Self::new(value)
805    }
806}
807
808#[cfg(target_os = "fuchsia")]
809impl fidl::endpoints::FromClient for ChildIteratorSynchronousProxy {
810    type Protocol = ChildIteratorMarker;
811
812    fn from_client(value: fidl::endpoints::ClientEnd<ChildIteratorMarker>) -> Self {
813        Self::new(value.into_channel())
814    }
815}
816
817#[derive(Debug, Clone)]
818pub struct ChildIteratorProxy {
819    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
820}
821
822impl fidl::endpoints::Proxy for ChildIteratorProxy {
823    type Protocol = ChildIteratorMarker;
824
825    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
826        Self::new(inner)
827    }
828
829    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
830        self.client.into_channel().map_err(|client| Self { client })
831    }
832
833    fn as_channel(&self) -> &::fidl::AsyncChannel {
834        self.client.as_channel()
835    }
836}
837
838impl ChildIteratorProxy {
839    /// Create a new Proxy for fuchsia.component/ChildIterator.
840    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
841        let protocol_name = <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
842        Self { client: fidl::client::Client::new(channel, protocol_name) }
843    }
844
845    /// Get a Stream of events from the remote end of the protocol.
846    ///
847    /// # Panics
848    ///
849    /// Panics if the event stream was already taken.
850    pub fn take_event_stream(&self) -> ChildIteratorEventStream {
851        ChildIteratorEventStream { event_receiver: self.client.take_event_receiver() }
852    }
853
854    /// Advance the iterator and return the next batch of children.
855    ///
856    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
857    /// no more children.
858    pub fn r#next(
859        &self,
860    ) -> fidl::client::QueryResponseFut<
861        Vec<fidl_fuchsia_component_decl::ChildRef>,
862        fidl::encoding::DefaultFuchsiaResourceDialect,
863    > {
864        ChildIteratorProxyInterface::r#next(self)
865    }
866}
867
868impl ChildIteratorProxyInterface for ChildIteratorProxy {
869    type NextResponseFut = fidl::client::QueryResponseFut<
870        Vec<fidl_fuchsia_component_decl::ChildRef>,
871        fidl::encoding::DefaultFuchsiaResourceDialect,
872    >;
873    fn r#next(&self) -> Self::NextResponseFut {
874        fn _decode(
875            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
876        ) -> Result<Vec<fidl_fuchsia_component_decl::ChildRef>, fidl::Error> {
877            let _response = fidl::client::decode_transaction_body::<
878                ChildIteratorNextResponse,
879                fidl::encoding::DefaultFuchsiaResourceDialect,
880                0x40e4c3882b050d08,
881            >(_buf?)?;
882            Ok(_response.children)
883        }
884        self.client.send_query_and_decode::<
885            fidl::encoding::EmptyPayload,
886            Vec<fidl_fuchsia_component_decl::ChildRef>,
887        >(
888            (),
889            0x40e4c3882b050d08,
890            fidl::encoding::DynamicFlags::empty(),
891            _decode,
892        )
893    }
894}
895
896pub struct ChildIteratorEventStream {
897    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
898}
899
900impl std::marker::Unpin for ChildIteratorEventStream {}
901
902impl futures::stream::FusedStream for ChildIteratorEventStream {
903    fn is_terminated(&self) -> bool {
904        self.event_receiver.is_terminated()
905    }
906}
907
908impl futures::Stream for ChildIteratorEventStream {
909    type Item = Result<ChildIteratorEvent, fidl::Error>;
910
911    fn poll_next(
912        mut self: std::pin::Pin<&mut Self>,
913        cx: &mut std::task::Context<'_>,
914    ) -> std::task::Poll<Option<Self::Item>> {
915        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
916            &mut self.event_receiver,
917            cx
918        )?) {
919            Some(buf) => std::task::Poll::Ready(Some(ChildIteratorEvent::decode(buf))),
920            None => std::task::Poll::Ready(None),
921        }
922    }
923}
924
925#[derive(Debug)]
926pub enum ChildIteratorEvent {}
927
928impl ChildIteratorEvent {
929    /// Decodes a message buffer as a [`ChildIteratorEvent`].
930    fn decode(
931        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
932    ) -> Result<ChildIteratorEvent, fidl::Error> {
933        let (bytes, _handles) = buf.split_mut();
934        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
935        debug_assert_eq!(tx_header.tx_id, 0);
936        match tx_header.ordinal {
937            _ => Err(fidl::Error::UnknownOrdinal {
938                ordinal: tx_header.ordinal,
939                protocol_name: <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
940            }),
941        }
942    }
943}
944
945/// A Stream of incoming requests for fuchsia.component/ChildIterator.
946pub struct ChildIteratorRequestStream {
947    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
948    is_terminated: bool,
949}
950
951impl std::marker::Unpin for ChildIteratorRequestStream {}
952
953impl futures::stream::FusedStream for ChildIteratorRequestStream {
954    fn is_terminated(&self) -> bool {
955        self.is_terminated
956    }
957}
958
959impl fidl::endpoints::RequestStream for ChildIteratorRequestStream {
960    type Protocol = ChildIteratorMarker;
961    type ControlHandle = ChildIteratorControlHandle;
962
963    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
964        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
965    }
966
967    fn control_handle(&self) -> Self::ControlHandle {
968        ChildIteratorControlHandle { inner: self.inner.clone() }
969    }
970
971    fn into_inner(
972        self,
973    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
974    {
975        (self.inner, self.is_terminated)
976    }
977
978    fn from_inner(
979        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
980        is_terminated: bool,
981    ) -> Self {
982        Self { inner, is_terminated }
983    }
984}
985
986impl futures::Stream for ChildIteratorRequestStream {
987    type Item = Result<ChildIteratorRequest, fidl::Error>;
988
989    fn poll_next(
990        mut self: std::pin::Pin<&mut Self>,
991        cx: &mut std::task::Context<'_>,
992    ) -> std::task::Poll<Option<Self::Item>> {
993        let this = &mut *self;
994        if this.inner.check_shutdown(cx) {
995            this.is_terminated = true;
996            return std::task::Poll::Ready(None);
997        }
998        if this.is_terminated {
999            panic!("polled ChildIteratorRequestStream after completion");
1000        }
1001        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1002            |bytes, handles| {
1003                match this.inner.channel().read_etc(cx, bytes, handles) {
1004                    std::task::Poll::Ready(Ok(())) => {}
1005                    std::task::Poll::Pending => return std::task::Poll::Pending,
1006                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1007                        this.is_terminated = true;
1008                        return std::task::Poll::Ready(None);
1009                    }
1010                    std::task::Poll::Ready(Err(e)) => {
1011                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1012                            e.into(),
1013                        ))));
1014                    }
1015                }
1016
1017                // A message has been received from the channel
1018                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1019
1020                std::task::Poll::Ready(Some(match header.ordinal {
1021                    0x40e4c3882b050d08 => {
1022                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1023                        let mut req = fidl::new_empty!(
1024                            fidl::encoding::EmptyPayload,
1025                            fidl::encoding::DefaultFuchsiaResourceDialect
1026                        );
1027                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1028                        let control_handle =
1029                            ChildIteratorControlHandle { inner: this.inner.clone() };
1030                        Ok(ChildIteratorRequest::Next {
1031                            responder: ChildIteratorNextResponder {
1032                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1033                                tx_id: header.tx_id,
1034                            },
1035                        })
1036                    }
1037                    _ => Err(fidl::Error::UnknownOrdinal {
1038                        ordinal: header.ordinal,
1039                        protocol_name:
1040                            <ChildIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1041                    }),
1042                }))
1043            },
1044        )
1045    }
1046}
1047
1048/// A protocol to iterate over the list of children in a realm.
1049#[derive(Debug)]
1050pub enum ChildIteratorRequest {
1051    /// Advance the iterator and return the next batch of children.
1052    ///
1053    /// Returns a vector of `ChildRef`. Returns an empty vector when there are
1054    /// no more children.
1055    Next { responder: ChildIteratorNextResponder },
1056}
1057
1058impl ChildIteratorRequest {
1059    #[allow(irrefutable_let_patterns)]
1060    pub fn into_next(self) -> Option<(ChildIteratorNextResponder)> {
1061        if let ChildIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
1062    }
1063
1064    /// Name of the method defined in FIDL
1065    pub fn method_name(&self) -> &'static str {
1066        match *self {
1067            ChildIteratorRequest::Next { .. } => "next",
1068        }
1069    }
1070}
1071
1072#[derive(Debug, Clone)]
1073pub struct ChildIteratorControlHandle {
1074    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1075}
1076
1077impl fidl::endpoints::ControlHandle for ChildIteratorControlHandle {
1078    fn shutdown(&self) {
1079        self.inner.shutdown()
1080    }
1081    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1082        self.inner.shutdown_with_epitaph(status)
1083    }
1084
1085    fn is_closed(&self) -> bool {
1086        self.inner.channel().is_closed()
1087    }
1088    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1089        self.inner.channel().on_closed()
1090    }
1091
1092    #[cfg(target_os = "fuchsia")]
1093    fn signal_peer(
1094        &self,
1095        clear_mask: zx::Signals,
1096        set_mask: zx::Signals,
1097    ) -> Result<(), zx_status::Status> {
1098        use fidl::Peered;
1099        self.inner.channel().signal_peer(clear_mask, set_mask)
1100    }
1101}
1102
1103impl ChildIteratorControlHandle {}
1104
1105#[must_use = "FIDL methods require a response to be sent"]
1106#[derive(Debug)]
1107pub struct ChildIteratorNextResponder {
1108    control_handle: std::mem::ManuallyDrop<ChildIteratorControlHandle>,
1109    tx_id: u32,
1110}
1111
1112/// Set the the channel to be shutdown (see [`ChildIteratorControlHandle::shutdown`])
1113/// if the responder is dropped without sending a response, so that the client
1114/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1115impl std::ops::Drop for ChildIteratorNextResponder {
1116    fn drop(&mut self) {
1117        self.control_handle.shutdown();
1118        // Safety: drops once, never accessed again
1119        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1120    }
1121}
1122
1123impl fidl::endpoints::Responder for ChildIteratorNextResponder {
1124    type ControlHandle = ChildIteratorControlHandle;
1125
1126    fn control_handle(&self) -> &ChildIteratorControlHandle {
1127        &self.control_handle
1128    }
1129
1130    fn drop_without_shutdown(mut self) {
1131        // Safety: drops once, never accessed again due to mem::forget
1132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1133        // Prevent Drop from running (which would shut down the channel)
1134        std::mem::forget(self);
1135    }
1136}
1137
1138impl ChildIteratorNextResponder {
1139    /// Sends a response to the FIDL transaction.
1140    ///
1141    /// Sets the channel to shutdown if an error occurs.
1142    pub fn send(
1143        self,
1144        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1145    ) -> Result<(), fidl::Error> {
1146        let _result = self.send_raw(children);
1147        if _result.is_err() {
1148            self.control_handle.shutdown();
1149        }
1150        self.drop_without_shutdown();
1151        _result
1152    }
1153
1154    /// Similar to "send" but does not shutdown the channel if an error occurs.
1155    pub fn send_no_shutdown_on_err(
1156        self,
1157        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1158    ) -> Result<(), fidl::Error> {
1159        let _result = self.send_raw(children);
1160        self.drop_without_shutdown();
1161        _result
1162    }
1163
1164    fn send_raw(
1165        &self,
1166        mut children: &[fidl_fuchsia_component_decl::ChildRef],
1167    ) -> Result<(), fidl::Error> {
1168        self.control_handle.inner.send::<ChildIteratorNextResponse>(
1169            (children,),
1170            self.tx_id,
1171            0x40e4c3882b050d08,
1172            fidl::encoding::DynamicFlags::empty(),
1173        )
1174    }
1175}
1176
1177#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1178pub struct ControllerMarker;
1179
1180impl fidl::endpoints::ProtocolMarker for ControllerMarker {
1181    type Proxy = ControllerProxy;
1182    type RequestStream = ControllerRequestStream;
1183    #[cfg(target_os = "fuchsia")]
1184    type SynchronousProxy = ControllerSynchronousProxy;
1185
1186    const DEBUG_NAME: &'static str = "(anonymous) Controller";
1187}
1188pub type ControllerStartResult = Result<(), Error>;
1189pub type ControllerIsStartedResult = Result<bool, Error>;
1190pub type ControllerGetExposedDictionaryResult =
1191    Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>;
1192pub type ControllerDestroyResult = Result<(), Error>;
1193
1194pub trait ControllerProxyInterface: Send + Sync {
1195    type StartResponseFut: std::future::Future<Output = Result<ControllerStartResult, fidl::Error>>
1196        + Send;
1197    fn r#start(
1198        &self,
1199        args: StartChildArgs,
1200        execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1201    ) -> Self::StartResponseFut;
1202    type IsStartedResponseFut: std::future::Future<Output = Result<ControllerIsStartedResult, fidl::Error>>
1203        + Send;
1204    fn r#is_started(&self) -> Self::IsStartedResponseFut;
1205    type GetExposedDictionaryResponseFut: std::future::Future<Output = Result<ControllerGetExposedDictionaryResult, fidl::Error>>
1206        + Send;
1207    fn r#get_exposed_dictionary(&self) -> Self::GetExposedDictionaryResponseFut;
1208    type DestroyResponseFut: std::future::Future<Output = Result<ControllerDestroyResult, fidl::Error>>
1209        + Send;
1210    fn r#destroy(&self) -> Self::DestroyResponseFut;
1211}
1212#[derive(Debug)]
1213#[cfg(target_os = "fuchsia")]
1214pub struct ControllerSynchronousProxy {
1215    client: fidl::client::sync::Client,
1216}
1217
1218#[cfg(target_os = "fuchsia")]
1219impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
1220    type Proxy = ControllerProxy;
1221    type Protocol = ControllerMarker;
1222
1223    fn from_channel(inner: fidl::Channel) -> Self {
1224        Self::new(inner)
1225    }
1226
1227    fn into_channel(self) -> fidl::Channel {
1228        self.client.into_channel()
1229    }
1230
1231    fn as_channel(&self) -> &fidl::Channel {
1232        self.client.as_channel()
1233    }
1234}
1235
1236#[cfg(target_os = "fuchsia")]
1237impl ControllerSynchronousProxy {
1238    pub fn new(channel: fidl::Channel) -> Self {
1239        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1240        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1241    }
1242
1243    pub fn into_channel(self) -> fidl::Channel {
1244        self.client.into_channel()
1245    }
1246
1247    /// Waits until an event arrives and returns it. It is safe for other
1248    /// threads to make concurrent requests while waiting for an event.
1249    pub fn wait_for_event(
1250        &self,
1251        deadline: zx::MonotonicInstant,
1252    ) -> Result<ControllerEvent, fidl::Error> {
1253        ControllerEvent::decode(self.client.wait_for_event(deadline)?)
1254    }
1255
1256    /// Start the component, optionally providing additional handles to be given
1257    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
1258    /// currently running.
1259    pub fn r#start(
1260        &self,
1261        mut args: StartChildArgs,
1262        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1263        ___deadline: zx::MonotonicInstant,
1264    ) -> Result<ControllerStartResult, fidl::Error> {
1265        let _response = self.client.send_query::<
1266            ControllerStartRequest,
1267            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1268        >(
1269            (&mut args, execution_controller,),
1270            0x68878076b8d2eac5,
1271            fidl::encoding::DynamicFlags::FLEXIBLE,
1272            ___deadline,
1273        )?
1274        .into_result::<ControllerMarker>("start")?;
1275        Ok(_response.map(|x| x))
1276    }
1277
1278    /// Returns true if this instance is currently running.
1279    pub fn r#is_started(
1280        &self,
1281        ___deadline: zx::MonotonicInstant,
1282    ) -> Result<ControllerIsStartedResult, fidl::Error> {
1283        let _response = self.client.send_query::<
1284            fidl::encoding::EmptyPayload,
1285            fidl::encoding::FlexibleResultType<ControllerIsStartedResponse, Error>,
1286        >(
1287            (),
1288            0x2155e6e1db2083c3,
1289            fidl::encoding::DynamicFlags::FLEXIBLE,
1290            ___deadline,
1291        )?
1292        .into_result::<ControllerMarker>("is_started")?;
1293        Ok(_response.map(|x| x.is_started))
1294    }
1295
1296    /// Returns the dictionary containing the component's exposed capabilities.
1297    pub fn r#get_exposed_dictionary(
1298        &self,
1299        ___deadline: zx::MonotonicInstant,
1300    ) -> Result<ControllerGetExposedDictionaryResult, fidl::Error> {
1301        let _response = self.client.send_query::<
1302            fidl::encoding::EmptyPayload,
1303            fidl::encoding::FlexibleResultType<ControllerGetExposedDictionaryResponse, Error>,
1304        >(
1305            (),
1306            0x7e48373e5eda1f9b,
1307            fidl::encoding::DynamicFlags::FLEXIBLE,
1308            ___deadline,
1309        )?
1310        .into_result::<ControllerMarker>("get_exposed_dictionary")?;
1311        Ok(_response.map(|x| x.dictionary))
1312    }
1313
1314    /// Destroys this component. When this method returns, the component is
1315    /// either destroyed or in the case of an error no destruction happened.
1316    ///
1317    /// Errors:
1318    ///
1319    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1320    /// Currently, this can happen if the component is a static child of its
1321    /// parent.
1322    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1323    ///   manager's logs will contain more detail.
1324    pub fn r#destroy(
1325        &self,
1326        ___deadline: zx::MonotonicInstant,
1327    ) -> Result<ControllerDestroyResult, fidl::Error> {
1328        let _response = self.client.send_query::<
1329            fidl::encoding::EmptyPayload,
1330            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1331        >(
1332            (),
1333            0x74529fa68b5c1741,
1334            fidl::encoding::DynamicFlags::FLEXIBLE,
1335            ___deadline,
1336        )?
1337        .into_result::<ControllerMarker>("destroy")?;
1338        Ok(_response.map(|x| x))
1339    }
1340}
1341
1342#[cfg(target_os = "fuchsia")]
1343impl From<ControllerSynchronousProxy> for zx::Handle {
1344    fn from(value: ControllerSynchronousProxy) -> Self {
1345        value.into_channel().into()
1346    }
1347}
1348
1349#[cfg(target_os = "fuchsia")]
1350impl From<fidl::Channel> for ControllerSynchronousProxy {
1351    fn from(value: fidl::Channel) -> Self {
1352        Self::new(value)
1353    }
1354}
1355
1356#[cfg(target_os = "fuchsia")]
1357impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
1358    type Protocol = ControllerMarker;
1359
1360    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
1361        Self::new(value.into_channel())
1362    }
1363}
1364
1365#[derive(Debug, Clone)]
1366pub struct ControllerProxy {
1367    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1368}
1369
1370impl fidl::endpoints::Proxy for ControllerProxy {
1371    type Protocol = ControllerMarker;
1372
1373    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1374        Self::new(inner)
1375    }
1376
1377    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1378        self.client.into_channel().map_err(|client| Self { client })
1379    }
1380
1381    fn as_channel(&self) -> &::fidl::AsyncChannel {
1382        self.client.as_channel()
1383    }
1384}
1385
1386impl ControllerProxy {
1387    /// Create a new Proxy for fuchsia.component/Controller.
1388    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1389        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1390        Self { client: fidl::client::Client::new(channel, protocol_name) }
1391    }
1392
1393    /// Get a Stream of events from the remote end of the protocol.
1394    ///
1395    /// # Panics
1396    ///
1397    /// Panics if the event stream was already taken.
1398    pub fn take_event_stream(&self) -> ControllerEventStream {
1399        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
1400    }
1401
1402    /// Start the component, optionally providing additional handles to be given
1403    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
1404    /// currently running.
1405    pub fn r#start(
1406        &self,
1407        mut args: StartChildArgs,
1408        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1409    ) -> fidl::client::QueryResponseFut<
1410        ControllerStartResult,
1411        fidl::encoding::DefaultFuchsiaResourceDialect,
1412    > {
1413        ControllerProxyInterface::r#start(self, args, execution_controller)
1414    }
1415
1416    /// Returns true if this instance is currently running.
1417    pub fn r#is_started(
1418        &self,
1419    ) -> fidl::client::QueryResponseFut<
1420        ControllerIsStartedResult,
1421        fidl::encoding::DefaultFuchsiaResourceDialect,
1422    > {
1423        ControllerProxyInterface::r#is_started(self)
1424    }
1425
1426    /// Returns the dictionary containing the component's exposed capabilities.
1427    pub fn r#get_exposed_dictionary(
1428        &self,
1429    ) -> fidl::client::QueryResponseFut<
1430        ControllerGetExposedDictionaryResult,
1431        fidl::encoding::DefaultFuchsiaResourceDialect,
1432    > {
1433        ControllerProxyInterface::r#get_exposed_dictionary(self)
1434    }
1435
1436    /// Destroys this component. When this method returns, the component is
1437    /// either destroyed or in the case of an error no destruction happened.
1438    ///
1439    /// Errors:
1440    ///
1441    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1442    /// Currently, this can happen if the component is a static child of its
1443    /// parent.
1444    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1445    ///   manager's logs will contain more detail.
1446    pub fn r#destroy(
1447        &self,
1448    ) -> fidl::client::QueryResponseFut<
1449        ControllerDestroyResult,
1450        fidl::encoding::DefaultFuchsiaResourceDialect,
1451    > {
1452        ControllerProxyInterface::r#destroy(self)
1453    }
1454}
1455
1456impl ControllerProxyInterface for ControllerProxy {
1457    type StartResponseFut = fidl::client::QueryResponseFut<
1458        ControllerStartResult,
1459        fidl::encoding::DefaultFuchsiaResourceDialect,
1460    >;
1461    fn r#start(
1462        &self,
1463        mut args: StartChildArgs,
1464        mut execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1465    ) -> Self::StartResponseFut {
1466        fn _decode(
1467            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1468        ) -> Result<ControllerStartResult, fidl::Error> {
1469            let _response = fidl::client::decode_transaction_body::<
1470                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1471                fidl::encoding::DefaultFuchsiaResourceDialect,
1472                0x68878076b8d2eac5,
1473            >(_buf?)?
1474            .into_result::<ControllerMarker>("start")?;
1475            Ok(_response.map(|x| x))
1476        }
1477        self.client.send_query_and_decode::<ControllerStartRequest, ControllerStartResult>(
1478            (&mut args, execution_controller),
1479            0x68878076b8d2eac5,
1480            fidl::encoding::DynamicFlags::FLEXIBLE,
1481            _decode,
1482        )
1483    }
1484
1485    type IsStartedResponseFut = fidl::client::QueryResponseFut<
1486        ControllerIsStartedResult,
1487        fidl::encoding::DefaultFuchsiaResourceDialect,
1488    >;
1489    fn r#is_started(&self) -> Self::IsStartedResponseFut {
1490        fn _decode(
1491            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1492        ) -> Result<ControllerIsStartedResult, fidl::Error> {
1493            let _response = fidl::client::decode_transaction_body::<
1494                fidl::encoding::FlexibleResultType<ControllerIsStartedResponse, Error>,
1495                fidl::encoding::DefaultFuchsiaResourceDialect,
1496                0x2155e6e1db2083c3,
1497            >(_buf?)?
1498            .into_result::<ControllerMarker>("is_started")?;
1499            Ok(_response.map(|x| x.is_started))
1500        }
1501        self.client
1502            .send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerIsStartedResult>(
1503                (),
1504                0x2155e6e1db2083c3,
1505                fidl::encoding::DynamicFlags::FLEXIBLE,
1506                _decode,
1507            )
1508    }
1509
1510    type GetExposedDictionaryResponseFut = fidl::client::QueryResponseFut<
1511        ControllerGetExposedDictionaryResult,
1512        fidl::encoding::DefaultFuchsiaResourceDialect,
1513    >;
1514    fn r#get_exposed_dictionary(&self) -> Self::GetExposedDictionaryResponseFut {
1515        fn _decode(
1516            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1517        ) -> Result<ControllerGetExposedDictionaryResult, fidl::Error> {
1518            let _response = fidl::client::decode_transaction_body::<
1519                fidl::encoding::FlexibleResultType<ControllerGetExposedDictionaryResponse, Error>,
1520                fidl::encoding::DefaultFuchsiaResourceDialect,
1521                0x7e48373e5eda1f9b,
1522            >(_buf?)?
1523            .into_result::<ControllerMarker>("get_exposed_dictionary")?;
1524            Ok(_response.map(|x| x.dictionary))
1525        }
1526        self.client.send_query_and_decode::<
1527            fidl::encoding::EmptyPayload,
1528            ControllerGetExposedDictionaryResult,
1529        >(
1530            (),
1531            0x7e48373e5eda1f9b,
1532            fidl::encoding::DynamicFlags::FLEXIBLE,
1533            _decode,
1534        )
1535    }
1536
1537    type DestroyResponseFut = fidl::client::QueryResponseFut<
1538        ControllerDestroyResult,
1539        fidl::encoding::DefaultFuchsiaResourceDialect,
1540    >;
1541    fn r#destroy(&self) -> Self::DestroyResponseFut {
1542        fn _decode(
1543            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1544        ) -> Result<ControllerDestroyResult, fidl::Error> {
1545            let _response = fidl::client::decode_transaction_body::<
1546                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1547                fidl::encoding::DefaultFuchsiaResourceDialect,
1548                0x74529fa68b5c1741,
1549            >(_buf?)?
1550            .into_result::<ControllerMarker>("destroy")?;
1551            Ok(_response.map(|x| x))
1552        }
1553        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerDestroyResult>(
1554            (),
1555            0x74529fa68b5c1741,
1556            fidl::encoding::DynamicFlags::FLEXIBLE,
1557            _decode,
1558        )
1559    }
1560}
1561
1562pub struct ControllerEventStream {
1563    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1564}
1565
1566impl std::marker::Unpin for ControllerEventStream {}
1567
1568impl futures::stream::FusedStream for ControllerEventStream {
1569    fn is_terminated(&self) -> bool {
1570        self.event_receiver.is_terminated()
1571    }
1572}
1573
1574impl futures::Stream for ControllerEventStream {
1575    type Item = Result<ControllerEvent, fidl::Error>;
1576
1577    fn poll_next(
1578        mut self: std::pin::Pin<&mut Self>,
1579        cx: &mut std::task::Context<'_>,
1580    ) -> std::task::Poll<Option<Self::Item>> {
1581        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1582            &mut self.event_receiver,
1583            cx
1584        )?) {
1585            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
1586            None => std::task::Poll::Ready(None),
1587        }
1588    }
1589}
1590
1591#[derive(Debug)]
1592pub enum ControllerEvent {
1593    #[non_exhaustive]
1594    _UnknownEvent {
1595        /// Ordinal of the event that was sent.
1596        ordinal: u64,
1597    },
1598}
1599
1600impl ControllerEvent {
1601    /// Decodes a message buffer as a [`ControllerEvent`].
1602    fn decode(
1603        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1604    ) -> Result<ControllerEvent, fidl::Error> {
1605        let (bytes, _handles) = buf.split_mut();
1606        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1607        debug_assert_eq!(tx_header.tx_id, 0);
1608        match tx_header.ordinal {
1609            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1610                Ok(ControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1611            }
1612            _ => Err(fidl::Error::UnknownOrdinal {
1613                ordinal: tx_header.ordinal,
1614                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1615            }),
1616        }
1617    }
1618}
1619
1620/// A Stream of incoming requests for fuchsia.component/Controller.
1621pub struct ControllerRequestStream {
1622    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1623    is_terminated: bool,
1624}
1625
1626impl std::marker::Unpin for ControllerRequestStream {}
1627
1628impl futures::stream::FusedStream for ControllerRequestStream {
1629    fn is_terminated(&self) -> bool {
1630        self.is_terminated
1631    }
1632}
1633
1634impl fidl::endpoints::RequestStream for ControllerRequestStream {
1635    type Protocol = ControllerMarker;
1636    type ControlHandle = ControllerControlHandle;
1637
1638    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1639        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1640    }
1641
1642    fn control_handle(&self) -> Self::ControlHandle {
1643        ControllerControlHandle { inner: self.inner.clone() }
1644    }
1645
1646    fn into_inner(
1647        self,
1648    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1649    {
1650        (self.inner, self.is_terminated)
1651    }
1652
1653    fn from_inner(
1654        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1655        is_terminated: bool,
1656    ) -> Self {
1657        Self { inner, is_terminated }
1658    }
1659}
1660
1661impl futures::Stream for ControllerRequestStream {
1662    type Item = Result<ControllerRequest, fidl::Error>;
1663
1664    fn poll_next(
1665        mut self: std::pin::Pin<&mut Self>,
1666        cx: &mut std::task::Context<'_>,
1667    ) -> std::task::Poll<Option<Self::Item>> {
1668        let this = &mut *self;
1669        if this.inner.check_shutdown(cx) {
1670            this.is_terminated = true;
1671            return std::task::Poll::Ready(None);
1672        }
1673        if this.is_terminated {
1674            panic!("polled ControllerRequestStream after completion");
1675        }
1676        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1677            |bytes, handles| {
1678                match this.inner.channel().read_etc(cx, bytes, handles) {
1679                    std::task::Poll::Ready(Ok(())) => {}
1680                    std::task::Poll::Pending => return std::task::Poll::Pending,
1681                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1682                        this.is_terminated = true;
1683                        return std::task::Poll::Ready(None);
1684                    }
1685                    std::task::Poll::Ready(Err(e)) => {
1686                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1687                            e.into(),
1688                        ))));
1689                    }
1690                }
1691
1692                // A message has been received from the channel
1693                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1694
1695                std::task::Poll::Ready(Some(match header.ordinal {
1696                    0x68878076b8d2eac5 => {
1697                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1698                        let mut req = fidl::new_empty!(
1699                            ControllerStartRequest,
1700                            fidl::encoding::DefaultFuchsiaResourceDialect
1701                        );
1702                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerStartRequest>(&header, _body_bytes, handles, &mut req)?;
1703                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1704                        Ok(ControllerRequest::Start {
1705                            args: req.args,
1706                            execution_controller: req.execution_controller,
1707
1708                            responder: ControllerStartResponder {
1709                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1710                                tx_id: header.tx_id,
1711                            },
1712                        })
1713                    }
1714                    0x2155e6e1db2083c3 => {
1715                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1716                        let mut req = fidl::new_empty!(
1717                            fidl::encoding::EmptyPayload,
1718                            fidl::encoding::DefaultFuchsiaResourceDialect
1719                        );
1720                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1721                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1722                        Ok(ControllerRequest::IsStarted {
1723                            responder: ControllerIsStartedResponder {
1724                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1725                                tx_id: header.tx_id,
1726                            },
1727                        })
1728                    }
1729                    0x7e48373e5eda1f9b => {
1730                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1731                        let mut req = fidl::new_empty!(
1732                            fidl::encoding::EmptyPayload,
1733                            fidl::encoding::DefaultFuchsiaResourceDialect
1734                        );
1735                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1736                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1737                        Ok(ControllerRequest::GetExposedDictionary {
1738                            responder: ControllerGetExposedDictionaryResponder {
1739                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1740                                tx_id: header.tx_id,
1741                            },
1742                        })
1743                    }
1744                    0x74529fa68b5c1741 => {
1745                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1746                        let mut req = fidl::new_empty!(
1747                            fidl::encoding::EmptyPayload,
1748                            fidl::encoding::DefaultFuchsiaResourceDialect
1749                        );
1750                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1751                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1752                        Ok(ControllerRequest::Destroy {
1753                            responder: ControllerDestroyResponder {
1754                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1755                                tx_id: header.tx_id,
1756                            },
1757                        })
1758                    }
1759                    _ if header.tx_id == 0
1760                        && header
1761                            .dynamic_flags()
1762                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1763                    {
1764                        Ok(ControllerRequest::_UnknownMethod {
1765                            ordinal: header.ordinal,
1766                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
1767                            method_type: fidl::MethodType::OneWay,
1768                        })
1769                    }
1770                    _ if header
1771                        .dynamic_flags()
1772                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1773                    {
1774                        this.inner.send_framework_err(
1775                            fidl::encoding::FrameworkErr::UnknownMethod,
1776                            header.tx_id,
1777                            header.ordinal,
1778                            header.dynamic_flags(),
1779                            (bytes, handles),
1780                        )?;
1781                        Ok(ControllerRequest::_UnknownMethod {
1782                            ordinal: header.ordinal,
1783                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
1784                            method_type: fidl::MethodType::TwoWay,
1785                        })
1786                    }
1787                    _ => Err(fidl::Error::UnknownOrdinal {
1788                        ordinal: header.ordinal,
1789                        protocol_name:
1790                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1791                    }),
1792                }))
1793            },
1794        )
1795    }
1796}
1797
1798/// A protocol used to operate on a component.
1799///
1800/// One may get access to a `Controller` when creating a component with the
1801/// `Realm.CreateChild` method. You may also obtain a `Controller` for an
1802/// existing child component with the `Realm.OpenController` method.
1803#[derive(Debug)]
1804pub enum ControllerRequest {
1805    /// Start the component, optionally providing additional handles to be given
1806    /// to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is
1807    /// currently running.
1808    Start {
1809        args: StartChildArgs,
1810        execution_controller: fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1811        responder: ControllerStartResponder,
1812    },
1813    /// Returns true if this instance is currently running.
1814    IsStarted { responder: ControllerIsStartedResponder },
1815    /// Returns the dictionary containing the component's exposed capabilities.
1816    GetExposedDictionary { responder: ControllerGetExposedDictionaryResponder },
1817    /// Destroys this component. When this method returns, the component is
1818    /// either destroyed or in the case of an error no destruction happened.
1819    ///
1820    /// Errors:
1821    ///
1822    /// - `ACCESS_DENIED`: Destruction of this component is not allowed.
1823    /// Currently, this can happen if the component is a static child of its
1824    /// parent.
1825    /// - `INTERNAL`: Something prevented destruction from succeeding -- component
1826    ///   manager's logs will contain more detail.
1827    Destroy { responder: ControllerDestroyResponder },
1828    /// An interaction was received which does not match any known method.
1829    #[non_exhaustive]
1830    _UnknownMethod {
1831        /// Ordinal of the method that was called.
1832        ordinal: u64,
1833        control_handle: ControllerControlHandle,
1834        method_type: fidl::MethodType,
1835    },
1836}
1837
1838impl ControllerRequest {
1839    #[allow(irrefutable_let_patterns)]
1840    pub fn into_start(
1841        self,
1842    ) -> Option<(
1843        StartChildArgs,
1844        fidl::endpoints::ServerEnd<ExecutionControllerMarker>,
1845        ControllerStartResponder,
1846    )> {
1847        if let ControllerRequest::Start { args, execution_controller, responder } = self {
1848            Some((args, execution_controller, responder))
1849        } else {
1850            None
1851        }
1852    }
1853
1854    #[allow(irrefutable_let_patterns)]
1855    pub fn into_is_started(self) -> Option<(ControllerIsStartedResponder)> {
1856        if let ControllerRequest::IsStarted { responder } = self { Some((responder)) } else { None }
1857    }
1858
1859    #[allow(irrefutable_let_patterns)]
1860    pub fn into_get_exposed_dictionary(self) -> Option<(ControllerGetExposedDictionaryResponder)> {
1861        if let ControllerRequest::GetExposedDictionary { responder } = self {
1862            Some((responder))
1863        } else {
1864            None
1865        }
1866    }
1867
1868    #[allow(irrefutable_let_patterns)]
1869    pub fn into_destroy(self) -> Option<(ControllerDestroyResponder)> {
1870        if let ControllerRequest::Destroy { responder } = self { Some((responder)) } else { None }
1871    }
1872
1873    /// Name of the method defined in FIDL
1874    pub fn method_name(&self) -> &'static str {
1875        match *self {
1876            ControllerRequest::Start { .. } => "start",
1877            ControllerRequest::IsStarted { .. } => "is_started",
1878            ControllerRequest::GetExposedDictionary { .. } => "get_exposed_dictionary",
1879            ControllerRequest::Destroy { .. } => "destroy",
1880            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1881                "unknown one-way method"
1882            }
1883            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1884                "unknown two-way method"
1885            }
1886        }
1887    }
1888}
1889
1890#[derive(Debug, Clone)]
1891pub struct ControllerControlHandle {
1892    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1893}
1894
1895impl fidl::endpoints::ControlHandle for ControllerControlHandle {
1896    fn shutdown(&self) {
1897        self.inner.shutdown()
1898    }
1899    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1900        self.inner.shutdown_with_epitaph(status)
1901    }
1902
1903    fn is_closed(&self) -> bool {
1904        self.inner.channel().is_closed()
1905    }
1906    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1907        self.inner.channel().on_closed()
1908    }
1909
1910    #[cfg(target_os = "fuchsia")]
1911    fn signal_peer(
1912        &self,
1913        clear_mask: zx::Signals,
1914        set_mask: zx::Signals,
1915    ) -> Result<(), zx_status::Status> {
1916        use fidl::Peered;
1917        self.inner.channel().signal_peer(clear_mask, set_mask)
1918    }
1919}
1920
1921impl ControllerControlHandle {}
1922
1923#[must_use = "FIDL methods require a response to be sent"]
1924#[derive(Debug)]
1925pub struct ControllerStartResponder {
1926    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1927    tx_id: u32,
1928}
1929
1930/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1931/// if the responder is dropped without sending a response, so that the client
1932/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1933impl std::ops::Drop for ControllerStartResponder {
1934    fn drop(&mut self) {
1935        self.control_handle.shutdown();
1936        // Safety: drops once, never accessed again
1937        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1938    }
1939}
1940
1941impl fidl::endpoints::Responder for ControllerStartResponder {
1942    type ControlHandle = ControllerControlHandle;
1943
1944    fn control_handle(&self) -> &ControllerControlHandle {
1945        &self.control_handle
1946    }
1947
1948    fn drop_without_shutdown(mut self) {
1949        // Safety: drops once, never accessed again due to mem::forget
1950        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1951        // Prevent Drop from running (which would shut down the channel)
1952        std::mem::forget(self);
1953    }
1954}
1955
1956impl ControllerStartResponder {
1957    /// Sends a response to the FIDL transaction.
1958    ///
1959    /// Sets the channel to shutdown if an error occurs.
1960    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1961        let _result = self.send_raw(result);
1962        if _result.is_err() {
1963            self.control_handle.shutdown();
1964        }
1965        self.drop_without_shutdown();
1966        _result
1967    }
1968
1969    /// Similar to "send" but does not shutdown the channel if an error occurs.
1970    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1971        let _result = self.send_raw(result);
1972        self.drop_without_shutdown();
1973        _result
1974    }
1975
1976    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1977        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1978            fidl::encoding::EmptyStruct,
1979            Error,
1980        >>(
1981            fidl::encoding::FlexibleResult::new(result),
1982            self.tx_id,
1983            0x68878076b8d2eac5,
1984            fidl::encoding::DynamicFlags::FLEXIBLE,
1985        )
1986    }
1987}
1988
1989#[must_use = "FIDL methods require a response to be sent"]
1990#[derive(Debug)]
1991pub struct ControllerIsStartedResponder {
1992    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1993    tx_id: u32,
1994}
1995
1996/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1997/// if the responder is dropped without sending a response, so that the client
1998/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1999impl std::ops::Drop for ControllerIsStartedResponder {
2000    fn drop(&mut self) {
2001        self.control_handle.shutdown();
2002        // Safety: drops once, never accessed again
2003        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2004    }
2005}
2006
2007impl fidl::endpoints::Responder for ControllerIsStartedResponder {
2008    type ControlHandle = ControllerControlHandle;
2009
2010    fn control_handle(&self) -> &ControllerControlHandle {
2011        &self.control_handle
2012    }
2013
2014    fn drop_without_shutdown(mut self) {
2015        // Safety: drops once, never accessed again due to mem::forget
2016        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2017        // Prevent Drop from running (which would shut down the channel)
2018        std::mem::forget(self);
2019    }
2020}
2021
2022impl ControllerIsStartedResponder {
2023    /// Sends a response to the FIDL transaction.
2024    ///
2025    /// Sets the channel to shutdown if an error occurs.
2026    pub fn send(self, mut result: Result<bool, Error>) -> Result<(), fidl::Error> {
2027        let _result = self.send_raw(result);
2028        if _result.is_err() {
2029            self.control_handle.shutdown();
2030        }
2031        self.drop_without_shutdown();
2032        _result
2033    }
2034
2035    /// Similar to "send" but does not shutdown the channel if an error occurs.
2036    pub fn send_no_shutdown_on_err(
2037        self,
2038        mut result: Result<bool, Error>,
2039    ) -> Result<(), fidl::Error> {
2040        let _result = self.send_raw(result);
2041        self.drop_without_shutdown();
2042        _result
2043    }
2044
2045    fn send_raw(&self, mut result: Result<bool, Error>) -> Result<(), fidl::Error> {
2046        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2047            ControllerIsStartedResponse,
2048            Error,
2049        >>(
2050            fidl::encoding::FlexibleResult::new(result.map(|is_started| (is_started,))),
2051            self.tx_id,
2052            0x2155e6e1db2083c3,
2053            fidl::encoding::DynamicFlags::FLEXIBLE,
2054        )
2055    }
2056}
2057
2058#[must_use = "FIDL methods require a response to be sent"]
2059#[derive(Debug)]
2060pub struct ControllerGetExposedDictionaryResponder {
2061    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2062    tx_id: u32,
2063}
2064
2065/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2066/// if the responder is dropped without sending a response, so that the client
2067/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2068impl std::ops::Drop for ControllerGetExposedDictionaryResponder {
2069    fn drop(&mut self) {
2070        self.control_handle.shutdown();
2071        // Safety: drops once, never accessed again
2072        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2073    }
2074}
2075
2076impl fidl::endpoints::Responder for ControllerGetExposedDictionaryResponder {
2077    type ControlHandle = ControllerControlHandle;
2078
2079    fn control_handle(&self) -> &ControllerControlHandle {
2080        &self.control_handle
2081    }
2082
2083    fn drop_without_shutdown(mut self) {
2084        // Safety: drops once, never accessed again due to mem::forget
2085        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2086        // Prevent Drop from running (which would shut down the channel)
2087        std::mem::forget(self);
2088    }
2089}
2090
2091impl ControllerGetExposedDictionaryResponder {
2092    /// Sends a response to the FIDL transaction.
2093    ///
2094    /// Sets the channel to shutdown if an error occurs.
2095    pub fn send(
2096        self,
2097        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2098    ) -> Result<(), fidl::Error> {
2099        let _result = self.send_raw(result);
2100        if _result.is_err() {
2101            self.control_handle.shutdown();
2102        }
2103        self.drop_without_shutdown();
2104        _result
2105    }
2106
2107    /// Similar to "send" but does not shutdown the channel if an error occurs.
2108    pub fn send_no_shutdown_on_err(
2109        self,
2110        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2111    ) -> Result<(), fidl::Error> {
2112        let _result = self.send_raw(result);
2113        self.drop_without_shutdown();
2114        _result
2115    }
2116
2117    fn send_raw(
2118        &self,
2119        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
2120    ) -> Result<(), fidl::Error> {
2121        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2122            ControllerGetExposedDictionaryResponse,
2123            Error,
2124        >>(
2125            fidl::encoding::FlexibleResult::new(
2126                result.as_mut().map_err(|e| *e).map(|dictionary| (dictionary,)),
2127            ),
2128            self.tx_id,
2129            0x7e48373e5eda1f9b,
2130            fidl::encoding::DynamicFlags::FLEXIBLE,
2131        )
2132    }
2133}
2134
2135#[must_use = "FIDL methods require a response to be sent"]
2136#[derive(Debug)]
2137pub struct ControllerDestroyResponder {
2138    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2139    tx_id: u32,
2140}
2141
2142/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2143/// if the responder is dropped without sending a response, so that the client
2144/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2145impl std::ops::Drop for ControllerDestroyResponder {
2146    fn drop(&mut self) {
2147        self.control_handle.shutdown();
2148        // Safety: drops once, never accessed again
2149        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2150    }
2151}
2152
2153impl fidl::endpoints::Responder for ControllerDestroyResponder {
2154    type ControlHandle = ControllerControlHandle;
2155
2156    fn control_handle(&self) -> &ControllerControlHandle {
2157        &self.control_handle
2158    }
2159
2160    fn drop_without_shutdown(mut self) {
2161        // Safety: drops once, never accessed again due to mem::forget
2162        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2163        // Prevent Drop from running (which would shut down the channel)
2164        std::mem::forget(self);
2165    }
2166}
2167
2168impl ControllerDestroyResponder {
2169    /// Sends a response to the FIDL transaction.
2170    ///
2171    /// Sets the channel to shutdown if an error occurs.
2172    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2173        let _result = self.send_raw(result);
2174        if _result.is_err() {
2175            self.control_handle.shutdown();
2176        }
2177        self.drop_without_shutdown();
2178        _result
2179    }
2180
2181    /// Similar to "send" but does not shutdown the channel if an error occurs.
2182    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2183        let _result = self.send_raw(result);
2184        self.drop_without_shutdown();
2185        _result
2186    }
2187
2188    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2189        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2190            fidl::encoding::EmptyStruct,
2191            Error,
2192        >>(
2193            fidl::encoding::FlexibleResult::new(result),
2194            self.tx_id,
2195            0x74529fa68b5c1741,
2196            fidl::encoding::DynamicFlags::FLEXIBLE,
2197        )
2198    }
2199}
2200
2201#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2202pub struct EventStreamMarker;
2203
2204impl fidl::endpoints::ProtocolMarker for EventStreamMarker {
2205    type Proxy = EventStreamProxy;
2206    type RequestStream = EventStreamRequestStream;
2207    #[cfg(target_os = "fuchsia")]
2208    type SynchronousProxy = EventStreamSynchronousProxy;
2209
2210    const DEBUG_NAME: &'static str = "fuchsia.component.EventStream";
2211}
2212impl fidl::endpoints::DiscoverableProtocolMarker for EventStreamMarker {}
2213
2214pub trait EventStreamProxyInterface: Send + Sync {
2215    type GetNextResponseFut: std::future::Future<Output = Result<Vec<Event>, fidl::Error>> + Send;
2216    fn r#get_next(&self) -> Self::GetNextResponseFut;
2217    type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2218    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
2219}
2220#[derive(Debug)]
2221#[cfg(target_os = "fuchsia")]
2222pub struct EventStreamSynchronousProxy {
2223    client: fidl::client::sync::Client,
2224}
2225
2226#[cfg(target_os = "fuchsia")]
2227impl fidl::endpoints::SynchronousProxy for EventStreamSynchronousProxy {
2228    type Proxy = EventStreamProxy;
2229    type Protocol = EventStreamMarker;
2230
2231    fn from_channel(inner: fidl::Channel) -> Self {
2232        Self::new(inner)
2233    }
2234
2235    fn into_channel(self) -> fidl::Channel {
2236        self.client.into_channel()
2237    }
2238
2239    fn as_channel(&self) -> &fidl::Channel {
2240        self.client.as_channel()
2241    }
2242}
2243
2244#[cfg(target_os = "fuchsia")]
2245impl EventStreamSynchronousProxy {
2246    pub fn new(channel: fidl::Channel) -> Self {
2247        let protocol_name = <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2248        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2249    }
2250
2251    pub fn into_channel(self) -> fidl::Channel {
2252        self.client.into_channel()
2253    }
2254
2255    /// Waits until an event arrives and returns it. It is safe for other
2256    /// threads to make concurrent requests while waiting for an event.
2257    pub fn wait_for_event(
2258        &self,
2259        deadline: zx::MonotonicInstant,
2260    ) -> Result<EventStreamEvent, fidl::Error> {
2261        EventStreamEvent::decode(self.client.wait_for_event(deadline)?)
2262    }
2263
2264    pub fn r#get_next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Event>, fidl::Error> {
2265        let _response =
2266            self.client.send_query::<fidl::encoding::EmptyPayload, EventStreamGetNextResponse>(
2267                (),
2268                0x3f24c9495978eb86,
2269                fidl::encoding::DynamicFlags::empty(),
2270                ___deadline,
2271            )?;
2272        Ok(_response.events)
2273    }
2274
2275    /// Returns immediately. Used to indicate that the FIDL connection
2276    /// completed. This is needed for non-static streams to verify
2277    /// that subscribe has completed before components are started.
2278    pub fn r#wait_for_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
2279        let _response =
2280            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
2281                (),
2282                0x31331f9578d2e682,
2283                fidl::encoding::DynamicFlags::empty(),
2284                ___deadline,
2285            )?;
2286        Ok(_response)
2287    }
2288}
2289
2290#[cfg(target_os = "fuchsia")]
2291impl From<EventStreamSynchronousProxy> for zx::Handle {
2292    fn from(value: EventStreamSynchronousProxy) -> Self {
2293        value.into_channel().into()
2294    }
2295}
2296
2297#[cfg(target_os = "fuchsia")]
2298impl From<fidl::Channel> for EventStreamSynchronousProxy {
2299    fn from(value: fidl::Channel) -> Self {
2300        Self::new(value)
2301    }
2302}
2303
2304#[cfg(target_os = "fuchsia")]
2305impl fidl::endpoints::FromClient for EventStreamSynchronousProxy {
2306    type Protocol = EventStreamMarker;
2307
2308    fn from_client(value: fidl::endpoints::ClientEnd<EventStreamMarker>) -> Self {
2309        Self::new(value.into_channel())
2310    }
2311}
2312
2313#[derive(Debug, Clone)]
2314pub struct EventStreamProxy {
2315    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2316}
2317
2318impl fidl::endpoints::Proxy for EventStreamProxy {
2319    type Protocol = EventStreamMarker;
2320
2321    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2322        Self::new(inner)
2323    }
2324
2325    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2326        self.client.into_channel().map_err(|client| Self { client })
2327    }
2328
2329    fn as_channel(&self) -> &::fidl::AsyncChannel {
2330        self.client.as_channel()
2331    }
2332}
2333
2334impl EventStreamProxy {
2335    /// Create a new Proxy for fuchsia.component/EventStream.
2336    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2337        let protocol_name = <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2338        Self { client: fidl::client::Client::new(channel, protocol_name) }
2339    }
2340
2341    /// Get a Stream of events from the remote end of the protocol.
2342    ///
2343    /// # Panics
2344    ///
2345    /// Panics if the event stream was already taken.
2346    pub fn take_event_stream(&self) -> EventStreamEventStream {
2347        EventStreamEventStream { event_receiver: self.client.take_event_receiver() }
2348    }
2349
2350    pub fn r#get_next(
2351        &self,
2352    ) -> fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>
2353    {
2354        EventStreamProxyInterface::r#get_next(self)
2355    }
2356
2357    /// Returns immediately. Used to indicate that the FIDL connection
2358    /// completed. This is needed for non-static streams to verify
2359    /// that subscribe has completed before components are started.
2360    pub fn r#wait_for_ready(
2361        &self,
2362    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2363        EventStreamProxyInterface::r#wait_for_ready(self)
2364    }
2365}
2366
2367impl EventStreamProxyInterface for EventStreamProxy {
2368    type GetNextResponseFut =
2369        fidl::client::QueryResponseFut<Vec<Event>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2370    fn r#get_next(&self) -> Self::GetNextResponseFut {
2371        fn _decode(
2372            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2373        ) -> Result<Vec<Event>, fidl::Error> {
2374            let _response = fidl::client::decode_transaction_body::<
2375                EventStreamGetNextResponse,
2376                fidl::encoding::DefaultFuchsiaResourceDialect,
2377                0x3f24c9495978eb86,
2378            >(_buf?)?;
2379            Ok(_response.events)
2380        }
2381        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Event>>(
2382            (),
2383            0x3f24c9495978eb86,
2384            fidl::encoding::DynamicFlags::empty(),
2385            _decode,
2386        )
2387    }
2388
2389    type WaitForReadyResponseFut =
2390        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2391    fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
2392        fn _decode(
2393            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2394        ) -> Result<(), fidl::Error> {
2395            let _response = fidl::client::decode_transaction_body::<
2396                fidl::encoding::EmptyPayload,
2397                fidl::encoding::DefaultFuchsiaResourceDialect,
2398                0x31331f9578d2e682,
2399            >(_buf?)?;
2400            Ok(_response)
2401        }
2402        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2403            (),
2404            0x31331f9578d2e682,
2405            fidl::encoding::DynamicFlags::empty(),
2406            _decode,
2407        )
2408    }
2409}
2410
2411pub struct EventStreamEventStream {
2412    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2413}
2414
2415impl std::marker::Unpin for EventStreamEventStream {}
2416
2417impl futures::stream::FusedStream for EventStreamEventStream {
2418    fn is_terminated(&self) -> bool {
2419        self.event_receiver.is_terminated()
2420    }
2421}
2422
2423impl futures::Stream for EventStreamEventStream {
2424    type Item = Result<EventStreamEvent, fidl::Error>;
2425
2426    fn poll_next(
2427        mut self: std::pin::Pin<&mut Self>,
2428        cx: &mut std::task::Context<'_>,
2429    ) -> std::task::Poll<Option<Self::Item>> {
2430        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2431            &mut self.event_receiver,
2432            cx
2433        )?) {
2434            Some(buf) => std::task::Poll::Ready(Some(EventStreamEvent::decode(buf))),
2435            None => std::task::Poll::Ready(None),
2436        }
2437    }
2438}
2439
2440#[derive(Debug)]
2441pub enum EventStreamEvent {}
2442
2443impl EventStreamEvent {
2444    /// Decodes a message buffer as a [`EventStreamEvent`].
2445    fn decode(
2446        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2447    ) -> Result<EventStreamEvent, fidl::Error> {
2448        let (bytes, _handles) = buf.split_mut();
2449        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2450        debug_assert_eq!(tx_header.tx_id, 0);
2451        match tx_header.ordinal {
2452            _ => Err(fidl::Error::UnknownOrdinal {
2453                ordinal: tx_header.ordinal,
2454                protocol_name: <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2455            }),
2456        }
2457    }
2458}
2459
2460/// A Stream of incoming requests for fuchsia.component/EventStream.
2461pub struct EventStreamRequestStream {
2462    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2463    is_terminated: bool,
2464}
2465
2466impl std::marker::Unpin for EventStreamRequestStream {}
2467
2468impl futures::stream::FusedStream for EventStreamRequestStream {
2469    fn is_terminated(&self) -> bool {
2470        self.is_terminated
2471    }
2472}
2473
2474impl fidl::endpoints::RequestStream for EventStreamRequestStream {
2475    type Protocol = EventStreamMarker;
2476    type ControlHandle = EventStreamControlHandle;
2477
2478    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2479        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2480    }
2481
2482    fn control_handle(&self) -> Self::ControlHandle {
2483        EventStreamControlHandle { inner: self.inner.clone() }
2484    }
2485
2486    fn into_inner(
2487        self,
2488    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2489    {
2490        (self.inner, self.is_terminated)
2491    }
2492
2493    fn from_inner(
2494        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2495        is_terminated: bool,
2496    ) -> Self {
2497        Self { inner, is_terminated }
2498    }
2499}
2500
2501impl futures::Stream for EventStreamRequestStream {
2502    type Item = Result<EventStreamRequest, fidl::Error>;
2503
2504    fn poll_next(
2505        mut self: std::pin::Pin<&mut Self>,
2506        cx: &mut std::task::Context<'_>,
2507    ) -> std::task::Poll<Option<Self::Item>> {
2508        let this = &mut *self;
2509        if this.inner.check_shutdown(cx) {
2510            this.is_terminated = true;
2511            return std::task::Poll::Ready(None);
2512        }
2513        if this.is_terminated {
2514            panic!("polled EventStreamRequestStream after completion");
2515        }
2516        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2517            |bytes, handles| {
2518                match this.inner.channel().read_etc(cx, bytes, handles) {
2519                    std::task::Poll::Ready(Ok(())) => {}
2520                    std::task::Poll::Pending => return std::task::Poll::Pending,
2521                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2522                        this.is_terminated = true;
2523                        return std::task::Poll::Ready(None);
2524                    }
2525                    std::task::Poll::Ready(Err(e)) => {
2526                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2527                            e.into(),
2528                        ))));
2529                    }
2530                }
2531
2532                // A message has been received from the channel
2533                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2534
2535                std::task::Poll::Ready(Some(match header.ordinal {
2536                    0x3f24c9495978eb86 => {
2537                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2538                        let mut req = fidl::new_empty!(
2539                            fidl::encoding::EmptyPayload,
2540                            fidl::encoding::DefaultFuchsiaResourceDialect
2541                        );
2542                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2543                        let control_handle = EventStreamControlHandle { inner: this.inner.clone() };
2544                        Ok(EventStreamRequest::GetNext {
2545                            responder: EventStreamGetNextResponder {
2546                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2547                                tx_id: header.tx_id,
2548                            },
2549                        })
2550                    }
2551                    0x31331f9578d2e682 => {
2552                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2553                        let mut req = fidl::new_empty!(
2554                            fidl::encoding::EmptyPayload,
2555                            fidl::encoding::DefaultFuchsiaResourceDialect
2556                        );
2557                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2558                        let control_handle = EventStreamControlHandle { inner: this.inner.clone() };
2559                        Ok(EventStreamRequest::WaitForReady {
2560                            responder: EventStreamWaitForReadyResponder {
2561                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2562                                tx_id: header.tx_id,
2563                            },
2564                        })
2565                    }
2566                    _ => Err(fidl::Error::UnknownOrdinal {
2567                        ordinal: header.ordinal,
2568                        protocol_name:
2569                            <EventStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2570                    }),
2571                }))
2572            },
2573        )
2574    }
2575}
2576
2577/// Listener for events on the component hierarchy.
2578/// Can't be used outside of the platform.
2579#[derive(Debug)]
2580pub enum EventStreamRequest {
2581    GetNext {
2582        responder: EventStreamGetNextResponder,
2583    },
2584    /// Returns immediately. Used to indicate that the FIDL connection
2585    /// completed. This is needed for non-static streams to verify
2586    /// that subscribe has completed before components are started.
2587    WaitForReady {
2588        responder: EventStreamWaitForReadyResponder,
2589    },
2590}
2591
2592impl EventStreamRequest {
2593    #[allow(irrefutable_let_patterns)]
2594    pub fn into_get_next(self) -> Option<(EventStreamGetNextResponder)> {
2595        if let EventStreamRequest::GetNext { responder } = self { Some((responder)) } else { None }
2596    }
2597
2598    #[allow(irrefutable_let_patterns)]
2599    pub fn into_wait_for_ready(self) -> Option<(EventStreamWaitForReadyResponder)> {
2600        if let EventStreamRequest::WaitForReady { responder } = self {
2601            Some((responder))
2602        } else {
2603            None
2604        }
2605    }
2606
2607    /// Name of the method defined in FIDL
2608    pub fn method_name(&self) -> &'static str {
2609        match *self {
2610            EventStreamRequest::GetNext { .. } => "get_next",
2611            EventStreamRequest::WaitForReady { .. } => "wait_for_ready",
2612        }
2613    }
2614}
2615
2616#[derive(Debug, Clone)]
2617pub struct EventStreamControlHandle {
2618    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2619}
2620
2621impl fidl::endpoints::ControlHandle for EventStreamControlHandle {
2622    fn shutdown(&self) {
2623        self.inner.shutdown()
2624    }
2625    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2626        self.inner.shutdown_with_epitaph(status)
2627    }
2628
2629    fn is_closed(&self) -> bool {
2630        self.inner.channel().is_closed()
2631    }
2632    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2633        self.inner.channel().on_closed()
2634    }
2635
2636    #[cfg(target_os = "fuchsia")]
2637    fn signal_peer(
2638        &self,
2639        clear_mask: zx::Signals,
2640        set_mask: zx::Signals,
2641    ) -> Result<(), zx_status::Status> {
2642        use fidl::Peered;
2643        self.inner.channel().signal_peer(clear_mask, set_mask)
2644    }
2645}
2646
2647impl EventStreamControlHandle {}
2648
2649#[must_use = "FIDL methods require a response to be sent"]
2650#[derive(Debug)]
2651pub struct EventStreamGetNextResponder {
2652    control_handle: std::mem::ManuallyDrop<EventStreamControlHandle>,
2653    tx_id: u32,
2654}
2655
2656/// Set the the channel to be shutdown (see [`EventStreamControlHandle::shutdown`])
2657/// if the responder is dropped without sending a response, so that the client
2658/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2659impl std::ops::Drop for EventStreamGetNextResponder {
2660    fn drop(&mut self) {
2661        self.control_handle.shutdown();
2662        // Safety: drops once, never accessed again
2663        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2664    }
2665}
2666
2667impl fidl::endpoints::Responder for EventStreamGetNextResponder {
2668    type ControlHandle = EventStreamControlHandle;
2669
2670    fn control_handle(&self) -> &EventStreamControlHandle {
2671        &self.control_handle
2672    }
2673
2674    fn drop_without_shutdown(mut self) {
2675        // Safety: drops once, never accessed again due to mem::forget
2676        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2677        // Prevent Drop from running (which would shut down the channel)
2678        std::mem::forget(self);
2679    }
2680}
2681
2682impl EventStreamGetNextResponder {
2683    /// Sends a response to the FIDL transaction.
2684    ///
2685    /// Sets the channel to shutdown if an error occurs.
2686    pub fn send(self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
2687        let _result = self.send_raw(events);
2688        if _result.is_err() {
2689            self.control_handle.shutdown();
2690        }
2691        self.drop_without_shutdown();
2692        _result
2693    }
2694
2695    /// Similar to "send" but does not shutdown the channel if an error occurs.
2696    pub fn send_no_shutdown_on_err(self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
2697        let _result = self.send_raw(events);
2698        self.drop_without_shutdown();
2699        _result
2700    }
2701
2702    fn send_raw(&self, mut events: Vec<Event>) -> Result<(), fidl::Error> {
2703        self.control_handle.inner.send::<EventStreamGetNextResponse>(
2704            (events.as_mut(),),
2705            self.tx_id,
2706            0x3f24c9495978eb86,
2707            fidl::encoding::DynamicFlags::empty(),
2708        )
2709    }
2710}
2711
2712#[must_use = "FIDL methods require a response to be sent"]
2713#[derive(Debug)]
2714pub struct EventStreamWaitForReadyResponder {
2715    control_handle: std::mem::ManuallyDrop<EventStreamControlHandle>,
2716    tx_id: u32,
2717}
2718
2719/// Set the the channel to be shutdown (see [`EventStreamControlHandle::shutdown`])
2720/// if the responder is dropped without sending a response, so that the client
2721/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2722impl std::ops::Drop for EventStreamWaitForReadyResponder {
2723    fn drop(&mut self) {
2724        self.control_handle.shutdown();
2725        // Safety: drops once, never accessed again
2726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2727    }
2728}
2729
2730impl fidl::endpoints::Responder for EventStreamWaitForReadyResponder {
2731    type ControlHandle = EventStreamControlHandle;
2732
2733    fn control_handle(&self) -> &EventStreamControlHandle {
2734        &self.control_handle
2735    }
2736
2737    fn drop_without_shutdown(mut self) {
2738        // Safety: drops once, never accessed again due to mem::forget
2739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2740        // Prevent Drop from running (which would shut down the channel)
2741        std::mem::forget(self);
2742    }
2743}
2744
2745impl EventStreamWaitForReadyResponder {
2746    /// Sends a response to the FIDL transaction.
2747    ///
2748    /// Sets the channel to shutdown if an error occurs.
2749    pub fn send(self) -> Result<(), fidl::Error> {
2750        let _result = self.send_raw();
2751        if _result.is_err() {
2752            self.control_handle.shutdown();
2753        }
2754        self.drop_without_shutdown();
2755        _result
2756    }
2757
2758    /// Similar to "send" but does not shutdown the channel if an error occurs.
2759    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2760        let _result = self.send_raw();
2761        self.drop_without_shutdown();
2762        _result
2763    }
2764
2765    fn send_raw(&self) -> Result<(), fidl::Error> {
2766        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2767            (),
2768            self.tx_id,
2769            0x31331f9578d2e682,
2770            fidl::encoding::DynamicFlags::empty(),
2771        )
2772    }
2773}
2774
2775#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2776pub struct ExecutionControllerMarker;
2777
2778impl fidl::endpoints::ProtocolMarker for ExecutionControllerMarker {
2779    type Proxy = ExecutionControllerProxy;
2780    type RequestStream = ExecutionControllerRequestStream;
2781    #[cfg(target_os = "fuchsia")]
2782    type SynchronousProxy = ExecutionControllerSynchronousProxy;
2783
2784    const DEBUG_NAME: &'static str = "(anonymous) ExecutionController";
2785}
2786
2787pub trait ExecutionControllerProxyInterface: Send + Sync {
2788    fn r#stop(&self) -> Result<(), fidl::Error>;
2789}
2790#[derive(Debug)]
2791#[cfg(target_os = "fuchsia")]
2792pub struct ExecutionControllerSynchronousProxy {
2793    client: fidl::client::sync::Client,
2794}
2795
2796#[cfg(target_os = "fuchsia")]
2797impl fidl::endpoints::SynchronousProxy for ExecutionControllerSynchronousProxy {
2798    type Proxy = ExecutionControllerProxy;
2799    type Protocol = ExecutionControllerMarker;
2800
2801    fn from_channel(inner: fidl::Channel) -> Self {
2802        Self::new(inner)
2803    }
2804
2805    fn into_channel(self) -> fidl::Channel {
2806        self.client.into_channel()
2807    }
2808
2809    fn as_channel(&self) -> &fidl::Channel {
2810        self.client.as_channel()
2811    }
2812}
2813
2814#[cfg(target_os = "fuchsia")]
2815impl ExecutionControllerSynchronousProxy {
2816    pub fn new(channel: fidl::Channel) -> Self {
2817        let protocol_name =
2818            <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2819        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2820    }
2821
2822    pub fn into_channel(self) -> fidl::Channel {
2823        self.client.into_channel()
2824    }
2825
2826    /// Waits until an event arrives and returns it. It is safe for other
2827    /// threads to make concurrent requests while waiting for an event.
2828    pub fn wait_for_event(
2829        &self,
2830        deadline: zx::MonotonicInstant,
2831    ) -> Result<ExecutionControllerEvent, fidl::Error> {
2832        ExecutionControllerEvent::decode(self.client.wait_for_event(deadline)?)
2833    }
2834
2835    /// Initiates a stop action on this component. Once complete, OnStop will be
2836    /// called with the stopped payload and this channel is closed.
2837    ///
2838    /// Note that a component may stop running on its own at any time, so it is
2839    /// possible for `OnStop` to be received before `Stop` is called.
2840    pub fn r#stop(&self) -> Result<(), fidl::Error> {
2841        self.client.send::<fidl::encoding::EmptyPayload>(
2842            (),
2843            0x56d23cec21036117,
2844            fidl::encoding::DynamicFlags::FLEXIBLE,
2845        )
2846    }
2847}
2848
2849#[cfg(target_os = "fuchsia")]
2850impl From<ExecutionControllerSynchronousProxy> for zx::Handle {
2851    fn from(value: ExecutionControllerSynchronousProxy) -> Self {
2852        value.into_channel().into()
2853    }
2854}
2855
2856#[cfg(target_os = "fuchsia")]
2857impl From<fidl::Channel> for ExecutionControllerSynchronousProxy {
2858    fn from(value: fidl::Channel) -> Self {
2859        Self::new(value)
2860    }
2861}
2862
2863#[cfg(target_os = "fuchsia")]
2864impl fidl::endpoints::FromClient for ExecutionControllerSynchronousProxy {
2865    type Protocol = ExecutionControllerMarker;
2866
2867    fn from_client(value: fidl::endpoints::ClientEnd<ExecutionControllerMarker>) -> Self {
2868        Self::new(value.into_channel())
2869    }
2870}
2871
2872#[derive(Debug, Clone)]
2873pub struct ExecutionControllerProxy {
2874    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2875}
2876
2877impl fidl::endpoints::Proxy for ExecutionControllerProxy {
2878    type Protocol = ExecutionControllerMarker;
2879
2880    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2881        Self::new(inner)
2882    }
2883
2884    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2885        self.client.into_channel().map_err(|client| Self { client })
2886    }
2887
2888    fn as_channel(&self) -> &::fidl::AsyncChannel {
2889        self.client.as_channel()
2890    }
2891}
2892
2893impl ExecutionControllerProxy {
2894    /// Create a new Proxy for fuchsia.component/ExecutionController.
2895    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2896        let protocol_name =
2897            <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2898        Self { client: fidl::client::Client::new(channel, protocol_name) }
2899    }
2900
2901    /// Get a Stream of events from the remote end of the protocol.
2902    ///
2903    /// # Panics
2904    ///
2905    /// Panics if the event stream was already taken.
2906    pub fn take_event_stream(&self) -> ExecutionControllerEventStream {
2907        ExecutionControllerEventStream { event_receiver: self.client.take_event_receiver() }
2908    }
2909
2910    /// Initiates a stop action on this component. Once complete, OnStop will be
2911    /// called with the stopped payload and this channel is closed.
2912    ///
2913    /// Note that a component may stop running on its own at any time, so it is
2914    /// possible for `OnStop` to be received before `Stop` is called.
2915    pub fn r#stop(&self) -> Result<(), fidl::Error> {
2916        ExecutionControllerProxyInterface::r#stop(self)
2917    }
2918}
2919
2920impl ExecutionControllerProxyInterface for ExecutionControllerProxy {
2921    fn r#stop(&self) -> Result<(), fidl::Error> {
2922        self.client.send::<fidl::encoding::EmptyPayload>(
2923            (),
2924            0x56d23cec21036117,
2925            fidl::encoding::DynamicFlags::FLEXIBLE,
2926        )
2927    }
2928}
2929
2930pub struct ExecutionControllerEventStream {
2931    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2932}
2933
2934impl std::marker::Unpin for ExecutionControllerEventStream {}
2935
2936impl futures::stream::FusedStream for ExecutionControllerEventStream {
2937    fn is_terminated(&self) -> bool {
2938        self.event_receiver.is_terminated()
2939    }
2940}
2941
2942impl futures::Stream for ExecutionControllerEventStream {
2943    type Item = Result<ExecutionControllerEvent, fidl::Error>;
2944
2945    fn poll_next(
2946        mut self: std::pin::Pin<&mut Self>,
2947        cx: &mut std::task::Context<'_>,
2948    ) -> std::task::Poll<Option<Self::Item>> {
2949        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2950            &mut self.event_receiver,
2951            cx
2952        )?) {
2953            Some(buf) => std::task::Poll::Ready(Some(ExecutionControllerEvent::decode(buf))),
2954            None => std::task::Poll::Ready(None),
2955        }
2956    }
2957}
2958
2959#[derive(Debug)]
2960pub enum ExecutionControllerEvent {
2961    OnStop {
2962        stopped_payload: StoppedPayload,
2963    },
2964    #[non_exhaustive]
2965    _UnknownEvent {
2966        /// Ordinal of the event that was sent.
2967        ordinal: u64,
2968    },
2969}
2970
2971impl ExecutionControllerEvent {
2972    #[allow(irrefutable_let_patterns)]
2973    pub fn into_on_stop(self) -> Option<StoppedPayload> {
2974        if let ExecutionControllerEvent::OnStop { stopped_payload } = self {
2975            Some((stopped_payload))
2976        } else {
2977            None
2978        }
2979    }
2980
2981    /// Decodes a message buffer as a [`ExecutionControllerEvent`].
2982    fn decode(
2983        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2984    ) -> Result<ExecutionControllerEvent, fidl::Error> {
2985        let (bytes, _handles) = buf.split_mut();
2986        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2987        debug_assert_eq!(tx_header.tx_id, 0);
2988        match tx_header.ordinal {
2989            0x62d5018e2174f57f => {
2990                let mut out = fidl::new_empty!(
2991                    ExecutionControllerOnStopRequest,
2992                    fidl::encoding::DefaultFuchsiaResourceDialect
2993                );
2994                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ExecutionControllerOnStopRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2995                Ok((ExecutionControllerEvent::OnStop { stopped_payload: out.stopped_payload }))
2996            }
2997            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2998                Ok(ExecutionControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2999            }
3000            _ => Err(fidl::Error::UnknownOrdinal {
3001                ordinal: tx_header.ordinal,
3002                protocol_name:
3003                    <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3004            }),
3005        }
3006    }
3007}
3008
3009/// A Stream of incoming requests for fuchsia.component/ExecutionController.
3010pub struct ExecutionControllerRequestStream {
3011    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3012    is_terminated: bool,
3013}
3014
3015impl std::marker::Unpin for ExecutionControllerRequestStream {}
3016
3017impl futures::stream::FusedStream for ExecutionControllerRequestStream {
3018    fn is_terminated(&self) -> bool {
3019        self.is_terminated
3020    }
3021}
3022
3023impl fidl::endpoints::RequestStream for ExecutionControllerRequestStream {
3024    type Protocol = ExecutionControllerMarker;
3025    type ControlHandle = ExecutionControllerControlHandle;
3026
3027    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3028        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3029    }
3030
3031    fn control_handle(&self) -> Self::ControlHandle {
3032        ExecutionControllerControlHandle { inner: self.inner.clone() }
3033    }
3034
3035    fn into_inner(
3036        self,
3037    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3038    {
3039        (self.inner, self.is_terminated)
3040    }
3041
3042    fn from_inner(
3043        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3044        is_terminated: bool,
3045    ) -> Self {
3046        Self { inner, is_terminated }
3047    }
3048}
3049
3050impl futures::Stream for ExecutionControllerRequestStream {
3051    type Item = Result<ExecutionControllerRequest, fidl::Error>;
3052
3053    fn poll_next(
3054        mut self: std::pin::Pin<&mut Self>,
3055        cx: &mut std::task::Context<'_>,
3056    ) -> std::task::Poll<Option<Self::Item>> {
3057        let this = &mut *self;
3058        if this.inner.check_shutdown(cx) {
3059            this.is_terminated = true;
3060            return std::task::Poll::Ready(None);
3061        }
3062        if this.is_terminated {
3063            panic!("polled ExecutionControllerRequestStream after completion");
3064        }
3065        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3066            |bytes, handles| {
3067                match this.inner.channel().read_etc(cx, bytes, handles) {
3068                    std::task::Poll::Ready(Ok(())) => {}
3069                    std::task::Poll::Pending => return std::task::Poll::Pending,
3070                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3071                        this.is_terminated = true;
3072                        return std::task::Poll::Ready(None);
3073                    }
3074                    std::task::Poll::Ready(Err(e)) => {
3075                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3076                            e.into(),
3077                        ))));
3078                    }
3079                }
3080
3081                // A message has been received from the channel
3082                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3083
3084                std::task::Poll::Ready(Some(match header.ordinal {
3085                0x56d23cec21036117 => {
3086                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3087                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3088                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3089                    let control_handle = ExecutionControllerControlHandle {
3090                        inner: this.inner.clone(),
3091                    };
3092                    Ok(ExecutionControllerRequest::Stop {
3093                        control_handle,
3094                    })
3095                }
3096                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3097                    Ok(ExecutionControllerRequest::_UnknownMethod {
3098                        ordinal: header.ordinal,
3099                        control_handle: ExecutionControllerControlHandle { inner: this.inner.clone() },
3100                        method_type: fidl::MethodType::OneWay,
3101                    })
3102                }
3103                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3104                    this.inner.send_framework_err(
3105                        fidl::encoding::FrameworkErr::UnknownMethod,
3106                        header.tx_id,
3107                        header.ordinal,
3108                        header.dynamic_flags(),
3109                        (bytes, handles),
3110                    )?;
3111                    Ok(ExecutionControllerRequest::_UnknownMethod {
3112                        ordinal: header.ordinal,
3113                        control_handle: ExecutionControllerControlHandle { inner: this.inner.clone() },
3114                        method_type: fidl::MethodType::TwoWay,
3115                    })
3116                }
3117                _ => Err(fidl::Error::UnknownOrdinal {
3118                    ordinal: header.ordinal,
3119                    protocol_name: <ExecutionControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3120                }),
3121            }))
3122            },
3123        )
3124    }
3125}
3126
3127#[derive(Debug)]
3128pub enum ExecutionControllerRequest {
3129    /// Initiates a stop action on this component. Once complete, OnStop will be
3130    /// called with the stopped payload and this channel is closed.
3131    ///
3132    /// Note that a component may stop running on its own at any time, so it is
3133    /// possible for `OnStop` to be received before `Stop` is called.
3134    Stop { control_handle: ExecutionControllerControlHandle },
3135    /// An interaction was received which does not match any known method.
3136    #[non_exhaustive]
3137    _UnknownMethod {
3138        /// Ordinal of the method that was called.
3139        ordinal: u64,
3140        control_handle: ExecutionControllerControlHandle,
3141        method_type: fidl::MethodType,
3142    },
3143}
3144
3145impl ExecutionControllerRequest {
3146    #[allow(irrefutable_let_patterns)]
3147    pub fn into_stop(self) -> Option<(ExecutionControllerControlHandle)> {
3148        if let ExecutionControllerRequest::Stop { control_handle } = self {
3149            Some((control_handle))
3150        } else {
3151            None
3152        }
3153    }
3154
3155    /// Name of the method defined in FIDL
3156    pub fn method_name(&self) -> &'static str {
3157        match *self {
3158            ExecutionControllerRequest::Stop { .. } => "stop",
3159            ExecutionControllerRequest::_UnknownMethod {
3160                method_type: fidl::MethodType::OneWay,
3161                ..
3162            } => "unknown one-way method",
3163            ExecutionControllerRequest::_UnknownMethod {
3164                method_type: fidl::MethodType::TwoWay,
3165                ..
3166            } => "unknown two-way method",
3167        }
3168    }
3169}
3170
3171#[derive(Debug, Clone)]
3172pub struct ExecutionControllerControlHandle {
3173    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3174}
3175
3176impl fidl::endpoints::ControlHandle for ExecutionControllerControlHandle {
3177    fn shutdown(&self) {
3178        self.inner.shutdown()
3179    }
3180    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3181        self.inner.shutdown_with_epitaph(status)
3182    }
3183
3184    fn is_closed(&self) -> bool {
3185        self.inner.channel().is_closed()
3186    }
3187    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3188        self.inner.channel().on_closed()
3189    }
3190
3191    #[cfg(target_os = "fuchsia")]
3192    fn signal_peer(
3193        &self,
3194        clear_mask: zx::Signals,
3195        set_mask: zx::Signals,
3196    ) -> Result<(), zx_status::Status> {
3197        use fidl::Peered;
3198        self.inner.channel().signal_peer(clear_mask, set_mask)
3199    }
3200}
3201
3202impl ExecutionControllerControlHandle {
3203    pub fn send_on_stop(&self, mut stopped_payload: &StoppedPayload) -> Result<(), fidl::Error> {
3204        self.inner.send::<ExecutionControllerOnStopRequest>(
3205            (stopped_payload,),
3206            0,
3207            0x62d5018e2174f57f,
3208            fidl::encoding::DynamicFlags::FLEXIBLE,
3209        )
3210    }
3211}
3212
3213#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3214pub struct IntrospectorMarker;
3215
3216impl fidl::endpoints::ProtocolMarker for IntrospectorMarker {
3217    type Proxy = IntrospectorProxy;
3218    type RequestStream = IntrospectorRequestStream;
3219    #[cfg(target_os = "fuchsia")]
3220    type SynchronousProxy = IntrospectorSynchronousProxy;
3221
3222    const DEBUG_NAME: &'static str = "fuchsia.component.Introspector";
3223}
3224impl fidl::endpoints::DiscoverableProtocolMarker for IntrospectorMarker {}
3225pub type IntrospectorGetMonikerResult = Result<String, Error>;
3226
3227pub trait IntrospectorProxyInterface: Send + Sync {
3228    type GetMonikerResponseFut: std::future::Future<Output = Result<IntrospectorGetMonikerResult, fidl::Error>>
3229        + Send;
3230    fn r#get_moniker(&self, component_instance: fidl::Event) -> Self::GetMonikerResponseFut;
3231}
3232#[derive(Debug)]
3233#[cfg(target_os = "fuchsia")]
3234pub struct IntrospectorSynchronousProxy {
3235    client: fidl::client::sync::Client,
3236}
3237
3238#[cfg(target_os = "fuchsia")]
3239impl fidl::endpoints::SynchronousProxy for IntrospectorSynchronousProxy {
3240    type Proxy = IntrospectorProxy;
3241    type Protocol = IntrospectorMarker;
3242
3243    fn from_channel(inner: fidl::Channel) -> Self {
3244        Self::new(inner)
3245    }
3246
3247    fn into_channel(self) -> fidl::Channel {
3248        self.client.into_channel()
3249    }
3250
3251    fn as_channel(&self) -> &fidl::Channel {
3252        self.client.as_channel()
3253    }
3254}
3255
3256#[cfg(target_os = "fuchsia")]
3257impl IntrospectorSynchronousProxy {
3258    pub fn new(channel: fidl::Channel) -> Self {
3259        let protocol_name = <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3260        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3261    }
3262
3263    pub fn into_channel(self) -> fidl::Channel {
3264        self.client.into_channel()
3265    }
3266
3267    /// Waits until an event arrives and returns it. It is safe for other
3268    /// threads to make concurrent requests while waiting for an event.
3269    pub fn wait_for_event(
3270        &self,
3271        deadline: zx::MonotonicInstant,
3272    ) -> Result<IntrospectorEvent, fidl::Error> {
3273        IntrospectorEvent::decode(self.client.wait_for_event(deadline)?)
3274    }
3275
3276    /// Obtains the moniker relative to this realm of the component
3277    /// corresponding to the provided token. Runners may obtain the token via
3278    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3279    ///
3280    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3281    /// does not correspond to a component under this realm.
3282    pub fn r#get_moniker(
3283        &self,
3284        mut component_instance: fidl::Event,
3285        ___deadline: zx::MonotonicInstant,
3286    ) -> Result<IntrospectorGetMonikerResult, fidl::Error> {
3287        let _response = self.client.send_query::<
3288            IntrospectorGetMonikerRequest,
3289            fidl::encoding::FlexibleResultType<IntrospectorGetMonikerResponse, Error>,
3290        >(
3291            (component_instance,),
3292            0x2f980ceb37bf458,
3293            fidl::encoding::DynamicFlags::FLEXIBLE,
3294            ___deadline,
3295        )?
3296        .into_result::<IntrospectorMarker>("get_moniker")?;
3297        Ok(_response.map(|x| x.moniker))
3298    }
3299}
3300
3301#[cfg(target_os = "fuchsia")]
3302impl From<IntrospectorSynchronousProxy> for zx::Handle {
3303    fn from(value: IntrospectorSynchronousProxy) -> Self {
3304        value.into_channel().into()
3305    }
3306}
3307
3308#[cfg(target_os = "fuchsia")]
3309impl From<fidl::Channel> for IntrospectorSynchronousProxy {
3310    fn from(value: fidl::Channel) -> Self {
3311        Self::new(value)
3312    }
3313}
3314
3315#[cfg(target_os = "fuchsia")]
3316impl fidl::endpoints::FromClient for IntrospectorSynchronousProxy {
3317    type Protocol = IntrospectorMarker;
3318
3319    fn from_client(value: fidl::endpoints::ClientEnd<IntrospectorMarker>) -> Self {
3320        Self::new(value.into_channel())
3321    }
3322}
3323
3324#[derive(Debug, Clone)]
3325pub struct IntrospectorProxy {
3326    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3327}
3328
3329impl fidl::endpoints::Proxy for IntrospectorProxy {
3330    type Protocol = IntrospectorMarker;
3331
3332    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3333        Self::new(inner)
3334    }
3335
3336    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3337        self.client.into_channel().map_err(|client| Self { client })
3338    }
3339
3340    fn as_channel(&self) -> &::fidl::AsyncChannel {
3341        self.client.as_channel()
3342    }
3343}
3344
3345impl IntrospectorProxy {
3346    /// Create a new Proxy for fuchsia.component/Introspector.
3347    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3348        let protocol_name = <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3349        Self { client: fidl::client::Client::new(channel, protocol_name) }
3350    }
3351
3352    /// Get a Stream of events from the remote end of the protocol.
3353    ///
3354    /// # Panics
3355    ///
3356    /// Panics if the event stream was already taken.
3357    pub fn take_event_stream(&self) -> IntrospectorEventStream {
3358        IntrospectorEventStream { event_receiver: self.client.take_event_receiver() }
3359    }
3360
3361    /// Obtains the moniker relative to this realm of the component
3362    /// corresponding to the provided token. Runners may obtain the token via
3363    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3364    ///
3365    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3366    /// does not correspond to a component under this realm.
3367    pub fn r#get_moniker(
3368        &self,
3369        mut component_instance: fidl::Event,
3370    ) -> fidl::client::QueryResponseFut<
3371        IntrospectorGetMonikerResult,
3372        fidl::encoding::DefaultFuchsiaResourceDialect,
3373    > {
3374        IntrospectorProxyInterface::r#get_moniker(self, component_instance)
3375    }
3376}
3377
3378impl IntrospectorProxyInterface for IntrospectorProxy {
3379    type GetMonikerResponseFut = fidl::client::QueryResponseFut<
3380        IntrospectorGetMonikerResult,
3381        fidl::encoding::DefaultFuchsiaResourceDialect,
3382    >;
3383    fn r#get_moniker(&self, mut component_instance: fidl::Event) -> Self::GetMonikerResponseFut {
3384        fn _decode(
3385            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3386        ) -> Result<IntrospectorGetMonikerResult, fidl::Error> {
3387            let _response = fidl::client::decode_transaction_body::<
3388                fidl::encoding::FlexibleResultType<IntrospectorGetMonikerResponse, Error>,
3389                fidl::encoding::DefaultFuchsiaResourceDialect,
3390                0x2f980ceb37bf458,
3391            >(_buf?)?
3392            .into_result::<IntrospectorMarker>("get_moniker")?;
3393            Ok(_response.map(|x| x.moniker))
3394        }
3395        self.client
3396            .send_query_and_decode::<IntrospectorGetMonikerRequest, IntrospectorGetMonikerResult>(
3397                (component_instance,),
3398                0x2f980ceb37bf458,
3399                fidl::encoding::DynamicFlags::FLEXIBLE,
3400                _decode,
3401            )
3402    }
3403}
3404
3405pub struct IntrospectorEventStream {
3406    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3407}
3408
3409impl std::marker::Unpin for IntrospectorEventStream {}
3410
3411impl futures::stream::FusedStream for IntrospectorEventStream {
3412    fn is_terminated(&self) -> bool {
3413        self.event_receiver.is_terminated()
3414    }
3415}
3416
3417impl futures::Stream for IntrospectorEventStream {
3418    type Item = Result<IntrospectorEvent, fidl::Error>;
3419
3420    fn poll_next(
3421        mut self: std::pin::Pin<&mut Self>,
3422        cx: &mut std::task::Context<'_>,
3423    ) -> std::task::Poll<Option<Self::Item>> {
3424        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3425            &mut self.event_receiver,
3426            cx
3427        )?) {
3428            Some(buf) => std::task::Poll::Ready(Some(IntrospectorEvent::decode(buf))),
3429            None => std::task::Poll::Ready(None),
3430        }
3431    }
3432}
3433
3434#[derive(Debug)]
3435pub enum IntrospectorEvent {
3436    #[non_exhaustive]
3437    _UnknownEvent {
3438        /// Ordinal of the event that was sent.
3439        ordinal: u64,
3440    },
3441}
3442
3443impl IntrospectorEvent {
3444    /// Decodes a message buffer as a [`IntrospectorEvent`].
3445    fn decode(
3446        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3447    ) -> Result<IntrospectorEvent, fidl::Error> {
3448        let (bytes, _handles) = buf.split_mut();
3449        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3450        debug_assert_eq!(tx_header.tx_id, 0);
3451        match tx_header.ordinal {
3452            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3453                Ok(IntrospectorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3454            }
3455            _ => Err(fidl::Error::UnknownOrdinal {
3456                ordinal: tx_header.ordinal,
3457                protocol_name: <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3458            }),
3459        }
3460    }
3461}
3462
3463/// A Stream of incoming requests for fuchsia.component/Introspector.
3464pub struct IntrospectorRequestStream {
3465    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3466    is_terminated: bool,
3467}
3468
3469impl std::marker::Unpin for IntrospectorRequestStream {}
3470
3471impl futures::stream::FusedStream for IntrospectorRequestStream {
3472    fn is_terminated(&self) -> bool {
3473        self.is_terminated
3474    }
3475}
3476
3477impl fidl::endpoints::RequestStream for IntrospectorRequestStream {
3478    type Protocol = IntrospectorMarker;
3479    type ControlHandle = IntrospectorControlHandle;
3480
3481    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3482        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3483    }
3484
3485    fn control_handle(&self) -> Self::ControlHandle {
3486        IntrospectorControlHandle { inner: self.inner.clone() }
3487    }
3488
3489    fn into_inner(
3490        self,
3491    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3492    {
3493        (self.inner, self.is_terminated)
3494    }
3495
3496    fn from_inner(
3497        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3498        is_terminated: bool,
3499    ) -> Self {
3500        Self { inner, is_terminated }
3501    }
3502}
3503
3504impl futures::Stream for IntrospectorRequestStream {
3505    type Item = Result<IntrospectorRequest, fidl::Error>;
3506
3507    fn poll_next(
3508        mut self: std::pin::Pin<&mut Self>,
3509        cx: &mut std::task::Context<'_>,
3510    ) -> std::task::Poll<Option<Self::Item>> {
3511        let this = &mut *self;
3512        if this.inner.check_shutdown(cx) {
3513            this.is_terminated = true;
3514            return std::task::Poll::Ready(None);
3515        }
3516        if this.is_terminated {
3517            panic!("polled IntrospectorRequestStream after completion");
3518        }
3519        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3520            |bytes, handles| {
3521                match this.inner.channel().read_etc(cx, bytes, handles) {
3522                    std::task::Poll::Ready(Ok(())) => {}
3523                    std::task::Poll::Pending => return std::task::Poll::Pending,
3524                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3525                        this.is_terminated = true;
3526                        return std::task::Poll::Ready(None);
3527                    }
3528                    std::task::Poll::Ready(Err(e)) => {
3529                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3530                            e.into(),
3531                        ))));
3532                    }
3533                }
3534
3535                // A message has been received from the channel
3536                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3537
3538                std::task::Poll::Ready(Some(match header.ordinal {
3539                    0x2f980ceb37bf458 => {
3540                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3541                        let mut req = fidl::new_empty!(
3542                            IntrospectorGetMonikerRequest,
3543                            fidl::encoding::DefaultFuchsiaResourceDialect
3544                        );
3545                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IntrospectorGetMonikerRequest>(&header, _body_bytes, handles, &mut req)?;
3546                        let control_handle =
3547                            IntrospectorControlHandle { inner: this.inner.clone() };
3548                        Ok(IntrospectorRequest::GetMoniker {
3549                            component_instance: req.component_instance,
3550
3551                            responder: IntrospectorGetMonikerResponder {
3552                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3553                                tx_id: header.tx_id,
3554                            },
3555                        })
3556                    }
3557                    _ if header.tx_id == 0
3558                        && header
3559                            .dynamic_flags()
3560                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3561                    {
3562                        Ok(IntrospectorRequest::_UnknownMethod {
3563                            ordinal: header.ordinal,
3564                            control_handle: IntrospectorControlHandle { inner: this.inner.clone() },
3565                            method_type: fidl::MethodType::OneWay,
3566                        })
3567                    }
3568                    _ if header
3569                        .dynamic_flags()
3570                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3571                    {
3572                        this.inner.send_framework_err(
3573                            fidl::encoding::FrameworkErr::UnknownMethod,
3574                            header.tx_id,
3575                            header.ordinal,
3576                            header.dynamic_flags(),
3577                            (bytes, handles),
3578                        )?;
3579                        Ok(IntrospectorRequest::_UnknownMethod {
3580                            ordinal: header.ordinal,
3581                            control_handle: IntrospectorControlHandle { inner: this.inner.clone() },
3582                            method_type: fidl::MethodType::TwoWay,
3583                        })
3584                    }
3585                    _ => Err(fidl::Error::UnknownOrdinal {
3586                        ordinal: header.ordinal,
3587                        protocol_name:
3588                            <IntrospectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3589                    }),
3590                }))
3591            },
3592        )
3593    }
3594}
3595
3596/// A protocol used by a component instance to obtain information about
3597/// components in its own realm.
3598///
3599/// This protocol only supports getting the moniker at the moment but could
3600/// expand to other privileged information such as the URL of a component.
3601///
3602/// The component framework provides this capability to components that use
3603/// `fuchsia.component.Introspector` from framework.
3604#[derive(Debug)]
3605pub enum IntrospectorRequest {
3606    /// Obtains the moniker relative to this realm of the component
3607    /// corresponding to the provided token. Runners may obtain the token via
3608    /// `fuchsia.component.runner/ComponentStartInfo.component_instance`.
3609    ///
3610    /// Returns `Error.INSTANCE_NOT_FOUND` if the token is invalid, or
3611    /// does not correspond to a component under this realm.
3612    GetMoniker { component_instance: fidl::Event, responder: IntrospectorGetMonikerResponder },
3613    /// An interaction was received which does not match any known method.
3614    #[non_exhaustive]
3615    _UnknownMethod {
3616        /// Ordinal of the method that was called.
3617        ordinal: u64,
3618        control_handle: IntrospectorControlHandle,
3619        method_type: fidl::MethodType,
3620    },
3621}
3622
3623impl IntrospectorRequest {
3624    #[allow(irrefutable_let_patterns)]
3625    pub fn into_get_moniker(self) -> Option<(fidl::Event, IntrospectorGetMonikerResponder)> {
3626        if let IntrospectorRequest::GetMoniker { component_instance, responder } = self {
3627            Some((component_instance, responder))
3628        } else {
3629            None
3630        }
3631    }
3632
3633    /// Name of the method defined in FIDL
3634    pub fn method_name(&self) -> &'static str {
3635        match *self {
3636            IntrospectorRequest::GetMoniker { .. } => "get_moniker",
3637            IntrospectorRequest::_UnknownMethod {
3638                method_type: fidl::MethodType::OneWay, ..
3639            } => "unknown one-way method",
3640            IntrospectorRequest::_UnknownMethod {
3641                method_type: fidl::MethodType::TwoWay, ..
3642            } => "unknown two-way method",
3643        }
3644    }
3645}
3646
3647#[derive(Debug, Clone)]
3648pub struct IntrospectorControlHandle {
3649    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3650}
3651
3652impl fidl::endpoints::ControlHandle for IntrospectorControlHandle {
3653    fn shutdown(&self) {
3654        self.inner.shutdown()
3655    }
3656    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3657        self.inner.shutdown_with_epitaph(status)
3658    }
3659
3660    fn is_closed(&self) -> bool {
3661        self.inner.channel().is_closed()
3662    }
3663    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3664        self.inner.channel().on_closed()
3665    }
3666
3667    #[cfg(target_os = "fuchsia")]
3668    fn signal_peer(
3669        &self,
3670        clear_mask: zx::Signals,
3671        set_mask: zx::Signals,
3672    ) -> Result<(), zx_status::Status> {
3673        use fidl::Peered;
3674        self.inner.channel().signal_peer(clear_mask, set_mask)
3675    }
3676}
3677
3678impl IntrospectorControlHandle {}
3679
3680#[must_use = "FIDL methods require a response to be sent"]
3681#[derive(Debug)]
3682pub struct IntrospectorGetMonikerResponder {
3683    control_handle: std::mem::ManuallyDrop<IntrospectorControlHandle>,
3684    tx_id: u32,
3685}
3686
3687/// Set the the channel to be shutdown (see [`IntrospectorControlHandle::shutdown`])
3688/// if the responder is dropped without sending a response, so that the client
3689/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3690impl std::ops::Drop for IntrospectorGetMonikerResponder {
3691    fn drop(&mut self) {
3692        self.control_handle.shutdown();
3693        // Safety: drops once, never accessed again
3694        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3695    }
3696}
3697
3698impl fidl::endpoints::Responder for IntrospectorGetMonikerResponder {
3699    type ControlHandle = IntrospectorControlHandle;
3700
3701    fn control_handle(&self) -> &IntrospectorControlHandle {
3702        &self.control_handle
3703    }
3704
3705    fn drop_without_shutdown(mut self) {
3706        // Safety: drops once, never accessed again due to mem::forget
3707        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3708        // Prevent Drop from running (which would shut down the channel)
3709        std::mem::forget(self);
3710    }
3711}
3712
3713impl IntrospectorGetMonikerResponder {
3714    /// Sends a response to the FIDL transaction.
3715    ///
3716    /// Sets the channel to shutdown if an error occurs.
3717    pub fn send(self, mut result: Result<&str, Error>) -> Result<(), fidl::Error> {
3718        let _result = self.send_raw(result);
3719        if _result.is_err() {
3720            self.control_handle.shutdown();
3721        }
3722        self.drop_without_shutdown();
3723        _result
3724    }
3725
3726    /// Similar to "send" but does not shutdown the channel if an error occurs.
3727    pub fn send_no_shutdown_on_err(
3728        self,
3729        mut result: Result<&str, Error>,
3730    ) -> Result<(), fidl::Error> {
3731        let _result = self.send_raw(result);
3732        self.drop_without_shutdown();
3733        _result
3734    }
3735
3736    fn send_raw(&self, mut result: Result<&str, Error>) -> Result<(), fidl::Error> {
3737        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3738            IntrospectorGetMonikerResponse,
3739            Error,
3740        >>(
3741            fidl::encoding::FlexibleResult::new(result.map(|moniker| (moniker,))),
3742            self.tx_id,
3743            0x2f980ceb37bf458,
3744            fidl::encoding::DynamicFlags::FLEXIBLE,
3745        )
3746    }
3747}
3748
3749#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3750pub struct NamespaceMarker;
3751
3752impl fidl::endpoints::ProtocolMarker for NamespaceMarker {
3753    type Proxy = NamespaceProxy;
3754    type RequestStream = NamespaceRequestStream;
3755    #[cfg(target_os = "fuchsia")]
3756    type SynchronousProxy = NamespaceSynchronousProxy;
3757
3758    const DEBUG_NAME: &'static str = "fuchsia.component.Namespace";
3759}
3760impl fidl::endpoints::DiscoverableProtocolMarker for NamespaceMarker {}
3761pub type NamespaceCreateResult = Result<Vec<NamespaceEntry>, NamespaceError>;
3762
3763pub trait NamespaceProxyInterface: Send + Sync {
3764    type CreateResponseFut: std::future::Future<Output = Result<NamespaceCreateResult, fidl::Error>>
3765        + Send;
3766    fn r#create(&self, entries: Vec<NamespaceInputEntry>) -> Self::CreateResponseFut;
3767}
3768#[derive(Debug)]
3769#[cfg(target_os = "fuchsia")]
3770pub struct NamespaceSynchronousProxy {
3771    client: fidl::client::sync::Client,
3772}
3773
3774#[cfg(target_os = "fuchsia")]
3775impl fidl::endpoints::SynchronousProxy for NamespaceSynchronousProxy {
3776    type Proxy = NamespaceProxy;
3777    type Protocol = NamespaceMarker;
3778
3779    fn from_channel(inner: fidl::Channel) -> Self {
3780        Self::new(inner)
3781    }
3782
3783    fn into_channel(self) -> fidl::Channel {
3784        self.client.into_channel()
3785    }
3786
3787    fn as_channel(&self) -> &fidl::Channel {
3788        self.client.as_channel()
3789    }
3790}
3791
3792#[cfg(target_os = "fuchsia")]
3793impl NamespaceSynchronousProxy {
3794    pub fn new(channel: fidl::Channel) -> Self {
3795        let protocol_name = <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3796        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3797    }
3798
3799    pub fn into_channel(self) -> fidl::Channel {
3800        self.client.into_channel()
3801    }
3802
3803    /// Waits until an event arrives and returns it. It is safe for other
3804    /// threads to make concurrent requests while waiting for an event.
3805    pub fn wait_for_event(
3806        &self,
3807        deadline: zx::MonotonicInstant,
3808    ) -> Result<NamespaceEvent, fidl::Error> {
3809        NamespaceEvent::decode(self.client.wait_for_event(deadline)?)
3810    }
3811
3812    pub fn r#create(
3813        &self,
3814        mut entries: Vec<NamespaceInputEntry>,
3815        ___deadline: zx::MonotonicInstant,
3816    ) -> Result<NamespaceCreateResult, fidl::Error> {
3817        let _response = self.client.send_query::<
3818            NamespaceCreateRequest,
3819            fidl::encoding::FlexibleResultType<NamespaceCreateResponse, NamespaceError>,
3820        >(
3821            (entries.as_mut(),),
3822            0x4329fe12b2a790f9,
3823            fidl::encoding::DynamicFlags::FLEXIBLE,
3824            ___deadline,
3825        )?
3826        .into_result::<NamespaceMarker>("create")?;
3827        Ok(_response.map(|x| x.entries))
3828    }
3829}
3830
3831#[cfg(target_os = "fuchsia")]
3832impl From<NamespaceSynchronousProxy> for zx::Handle {
3833    fn from(value: NamespaceSynchronousProxy) -> Self {
3834        value.into_channel().into()
3835    }
3836}
3837
3838#[cfg(target_os = "fuchsia")]
3839impl From<fidl::Channel> for NamespaceSynchronousProxy {
3840    fn from(value: fidl::Channel) -> Self {
3841        Self::new(value)
3842    }
3843}
3844
3845#[cfg(target_os = "fuchsia")]
3846impl fidl::endpoints::FromClient for NamespaceSynchronousProxy {
3847    type Protocol = NamespaceMarker;
3848
3849    fn from_client(value: fidl::endpoints::ClientEnd<NamespaceMarker>) -> Self {
3850        Self::new(value.into_channel())
3851    }
3852}
3853
3854#[derive(Debug, Clone)]
3855pub struct NamespaceProxy {
3856    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3857}
3858
3859impl fidl::endpoints::Proxy for NamespaceProxy {
3860    type Protocol = NamespaceMarker;
3861
3862    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3863        Self::new(inner)
3864    }
3865
3866    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3867        self.client.into_channel().map_err(|client| Self { client })
3868    }
3869
3870    fn as_channel(&self) -> &::fidl::AsyncChannel {
3871        self.client.as_channel()
3872    }
3873}
3874
3875impl NamespaceProxy {
3876    /// Create a new Proxy for fuchsia.component/Namespace.
3877    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3878        let protocol_name = <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3879        Self { client: fidl::client::Client::new(channel, protocol_name) }
3880    }
3881
3882    /// Get a Stream of events from the remote end of the protocol.
3883    ///
3884    /// # Panics
3885    ///
3886    /// Panics if the event stream was already taken.
3887    pub fn take_event_stream(&self) -> NamespaceEventStream {
3888        NamespaceEventStream { event_receiver: self.client.take_event_receiver() }
3889    }
3890
3891    pub fn r#create(
3892        &self,
3893        mut entries: Vec<NamespaceInputEntry>,
3894    ) -> fidl::client::QueryResponseFut<
3895        NamespaceCreateResult,
3896        fidl::encoding::DefaultFuchsiaResourceDialect,
3897    > {
3898        NamespaceProxyInterface::r#create(self, entries)
3899    }
3900}
3901
3902impl NamespaceProxyInterface for NamespaceProxy {
3903    type CreateResponseFut = fidl::client::QueryResponseFut<
3904        NamespaceCreateResult,
3905        fidl::encoding::DefaultFuchsiaResourceDialect,
3906    >;
3907    fn r#create(&self, mut entries: Vec<NamespaceInputEntry>) -> Self::CreateResponseFut {
3908        fn _decode(
3909            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3910        ) -> Result<NamespaceCreateResult, fidl::Error> {
3911            let _response = fidl::client::decode_transaction_body::<
3912                fidl::encoding::FlexibleResultType<NamespaceCreateResponse, NamespaceError>,
3913                fidl::encoding::DefaultFuchsiaResourceDialect,
3914                0x4329fe12b2a790f9,
3915            >(_buf?)?
3916            .into_result::<NamespaceMarker>("create")?;
3917            Ok(_response.map(|x| x.entries))
3918        }
3919        self.client.send_query_and_decode::<NamespaceCreateRequest, NamespaceCreateResult>(
3920            (entries.as_mut(),),
3921            0x4329fe12b2a790f9,
3922            fidl::encoding::DynamicFlags::FLEXIBLE,
3923            _decode,
3924        )
3925    }
3926}
3927
3928pub struct NamespaceEventStream {
3929    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3930}
3931
3932impl std::marker::Unpin for NamespaceEventStream {}
3933
3934impl futures::stream::FusedStream for NamespaceEventStream {
3935    fn is_terminated(&self) -> bool {
3936        self.event_receiver.is_terminated()
3937    }
3938}
3939
3940impl futures::Stream for NamespaceEventStream {
3941    type Item = Result<NamespaceEvent, fidl::Error>;
3942
3943    fn poll_next(
3944        mut self: std::pin::Pin<&mut Self>,
3945        cx: &mut std::task::Context<'_>,
3946    ) -> std::task::Poll<Option<Self::Item>> {
3947        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3948            &mut self.event_receiver,
3949            cx
3950        )?) {
3951            Some(buf) => std::task::Poll::Ready(Some(NamespaceEvent::decode(buf))),
3952            None => std::task::Poll::Ready(None),
3953        }
3954    }
3955}
3956
3957#[derive(Debug)]
3958pub enum NamespaceEvent {
3959    #[non_exhaustive]
3960    _UnknownEvent {
3961        /// Ordinal of the event that was sent.
3962        ordinal: u64,
3963    },
3964}
3965
3966impl NamespaceEvent {
3967    /// Decodes a message buffer as a [`NamespaceEvent`].
3968    fn decode(
3969        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3970    ) -> Result<NamespaceEvent, fidl::Error> {
3971        let (bytes, _handles) = buf.split_mut();
3972        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3973        debug_assert_eq!(tx_header.tx_id, 0);
3974        match tx_header.ordinal {
3975            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3976                Ok(NamespaceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3977            }
3978            _ => Err(fidl::Error::UnknownOrdinal {
3979                ordinal: tx_header.ordinal,
3980                protocol_name: <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3981            }),
3982        }
3983    }
3984}
3985
3986/// A Stream of incoming requests for fuchsia.component/Namespace.
3987pub struct NamespaceRequestStream {
3988    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3989    is_terminated: bool,
3990}
3991
3992impl std::marker::Unpin for NamespaceRequestStream {}
3993
3994impl futures::stream::FusedStream for NamespaceRequestStream {
3995    fn is_terminated(&self) -> bool {
3996        self.is_terminated
3997    }
3998}
3999
4000impl fidl::endpoints::RequestStream for NamespaceRequestStream {
4001    type Protocol = NamespaceMarker;
4002    type ControlHandle = NamespaceControlHandle;
4003
4004    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4005        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4006    }
4007
4008    fn control_handle(&self) -> Self::ControlHandle {
4009        NamespaceControlHandle { inner: self.inner.clone() }
4010    }
4011
4012    fn into_inner(
4013        self,
4014    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4015    {
4016        (self.inner, self.is_terminated)
4017    }
4018
4019    fn from_inner(
4020        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4021        is_terminated: bool,
4022    ) -> Self {
4023        Self { inner, is_terminated }
4024    }
4025}
4026
4027impl futures::Stream for NamespaceRequestStream {
4028    type Item = Result<NamespaceRequest, fidl::Error>;
4029
4030    fn poll_next(
4031        mut self: std::pin::Pin<&mut Self>,
4032        cx: &mut std::task::Context<'_>,
4033    ) -> std::task::Poll<Option<Self::Item>> {
4034        let this = &mut *self;
4035        if this.inner.check_shutdown(cx) {
4036            this.is_terminated = true;
4037            return std::task::Poll::Ready(None);
4038        }
4039        if this.is_terminated {
4040            panic!("polled NamespaceRequestStream after completion");
4041        }
4042        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4043            |bytes, handles| {
4044                match this.inner.channel().read_etc(cx, bytes, handles) {
4045                    std::task::Poll::Ready(Ok(())) => {}
4046                    std::task::Poll::Pending => return std::task::Poll::Pending,
4047                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4048                        this.is_terminated = true;
4049                        return std::task::Poll::Ready(None);
4050                    }
4051                    std::task::Poll::Ready(Err(e)) => {
4052                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4053                            e.into(),
4054                        ))));
4055                    }
4056                }
4057
4058                // A message has been received from the channel
4059                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4060
4061                std::task::Poll::Ready(Some(match header.ordinal {
4062                    0x4329fe12b2a790f9 => {
4063                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4064                        let mut req = fidl::new_empty!(
4065                            NamespaceCreateRequest,
4066                            fidl::encoding::DefaultFuchsiaResourceDialect
4067                        );
4068                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NamespaceCreateRequest>(&header, _body_bytes, handles, &mut req)?;
4069                        let control_handle = NamespaceControlHandle { inner: this.inner.clone() };
4070                        Ok(NamespaceRequest::Create {
4071                            entries: req.entries,
4072
4073                            responder: NamespaceCreateResponder {
4074                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4075                                tx_id: header.tx_id,
4076                            },
4077                        })
4078                    }
4079                    _ if header.tx_id == 0
4080                        && header
4081                            .dynamic_flags()
4082                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4083                    {
4084                        Ok(NamespaceRequest::_UnknownMethod {
4085                            ordinal: header.ordinal,
4086                            control_handle: NamespaceControlHandle { inner: this.inner.clone() },
4087                            method_type: fidl::MethodType::OneWay,
4088                        })
4089                    }
4090                    _ if header
4091                        .dynamic_flags()
4092                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4093                    {
4094                        this.inner.send_framework_err(
4095                            fidl::encoding::FrameworkErr::UnknownMethod,
4096                            header.tx_id,
4097                            header.ordinal,
4098                            header.dynamic_flags(),
4099                            (bytes, handles),
4100                        )?;
4101                        Ok(NamespaceRequest::_UnknownMethod {
4102                            ordinal: header.ordinal,
4103                            control_handle: NamespaceControlHandle { inner: this.inner.clone() },
4104                            method_type: fidl::MethodType::TwoWay,
4105                        })
4106                    }
4107                    _ => Err(fidl::Error::UnknownOrdinal {
4108                        ordinal: header.ordinal,
4109                        protocol_name:
4110                            <NamespaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4111                    }),
4112                }))
4113            },
4114        )
4115    }
4116}
4117
4118/// Protocol for performing namespace operations.
4119#[derive(Debug)]
4120pub enum NamespaceRequest {
4121    Create {
4122        entries: Vec<NamespaceInputEntry>,
4123        responder: NamespaceCreateResponder,
4124    },
4125    /// An interaction was received which does not match any known method.
4126    #[non_exhaustive]
4127    _UnknownMethod {
4128        /// Ordinal of the method that was called.
4129        ordinal: u64,
4130        control_handle: NamespaceControlHandle,
4131        method_type: fidl::MethodType,
4132    },
4133}
4134
4135impl NamespaceRequest {
4136    #[allow(irrefutable_let_patterns)]
4137    pub fn into_create(self) -> Option<(Vec<NamespaceInputEntry>, NamespaceCreateResponder)> {
4138        if let NamespaceRequest::Create { entries, responder } = self {
4139            Some((entries, responder))
4140        } else {
4141            None
4142        }
4143    }
4144
4145    /// Name of the method defined in FIDL
4146    pub fn method_name(&self) -> &'static str {
4147        match *self {
4148            NamespaceRequest::Create { .. } => "create",
4149            NamespaceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4150                "unknown one-way method"
4151            }
4152            NamespaceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4153                "unknown two-way method"
4154            }
4155        }
4156    }
4157}
4158
4159#[derive(Debug, Clone)]
4160pub struct NamespaceControlHandle {
4161    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4162}
4163
4164impl fidl::endpoints::ControlHandle for NamespaceControlHandle {
4165    fn shutdown(&self) {
4166        self.inner.shutdown()
4167    }
4168    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4169        self.inner.shutdown_with_epitaph(status)
4170    }
4171
4172    fn is_closed(&self) -> bool {
4173        self.inner.channel().is_closed()
4174    }
4175    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4176        self.inner.channel().on_closed()
4177    }
4178
4179    #[cfg(target_os = "fuchsia")]
4180    fn signal_peer(
4181        &self,
4182        clear_mask: zx::Signals,
4183        set_mask: zx::Signals,
4184    ) -> Result<(), zx_status::Status> {
4185        use fidl::Peered;
4186        self.inner.channel().signal_peer(clear_mask, set_mask)
4187    }
4188}
4189
4190impl NamespaceControlHandle {}
4191
4192#[must_use = "FIDL methods require a response to be sent"]
4193#[derive(Debug)]
4194pub struct NamespaceCreateResponder {
4195    control_handle: std::mem::ManuallyDrop<NamespaceControlHandle>,
4196    tx_id: u32,
4197}
4198
4199/// Set the the channel to be shutdown (see [`NamespaceControlHandle::shutdown`])
4200/// if the responder is dropped without sending a response, so that the client
4201/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4202impl std::ops::Drop for NamespaceCreateResponder {
4203    fn drop(&mut self) {
4204        self.control_handle.shutdown();
4205        // Safety: drops once, never accessed again
4206        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4207    }
4208}
4209
4210impl fidl::endpoints::Responder for NamespaceCreateResponder {
4211    type ControlHandle = NamespaceControlHandle;
4212
4213    fn control_handle(&self) -> &NamespaceControlHandle {
4214        &self.control_handle
4215    }
4216
4217    fn drop_without_shutdown(mut self) {
4218        // Safety: drops once, never accessed again due to mem::forget
4219        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4220        // Prevent Drop from running (which would shut down the channel)
4221        std::mem::forget(self);
4222    }
4223}
4224
4225impl NamespaceCreateResponder {
4226    /// Sends a response to the FIDL transaction.
4227    ///
4228    /// Sets the channel to shutdown if an error occurs.
4229    pub fn send(
4230        self,
4231        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4232    ) -> Result<(), fidl::Error> {
4233        let _result = self.send_raw(result);
4234        if _result.is_err() {
4235            self.control_handle.shutdown();
4236        }
4237        self.drop_without_shutdown();
4238        _result
4239    }
4240
4241    /// Similar to "send" but does not shutdown the channel if an error occurs.
4242    pub fn send_no_shutdown_on_err(
4243        self,
4244        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4245    ) -> Result<(), fidl::Error> {
4246        let _result = self.send_raw(result);
4247        self.drop_without_shutdown();
4248        _result
4249    }
4250
4251    fn send_raw(
4252        &self,
4253        mut result: Result<Vec<NamespaceEntry>, NamespaceError>,
4254    ) -> Result<(), fidl::Error> {
4255        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4256            NamespaceCreateResponse,
4257            NamespaceError,
4258        >>(
4259            fidl::encoding::FlexibleResult::new(
4260                result.as_mut().map_err(|e| *e).map(|entries| (entries.as_mut_slice(),)),
4261            ),
4262            self.tx_id,
4263            0x4329fe12b2a790f9,
4264            fidl::encoding::DynamicFlags::FLEXIBLE,
4265        )
4266    }
4267}
4268
4269#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4270pub struct RealmMarker;
4271
4272impl fidl::endpoints::ProtocolMarker for RealmMarker {
4273    type Proxy = RealmProxy;
4274    type RequestStream = RealmRequestStream;
4275    #[cfg(target_os = "fuchsia")]
4276    type SynchronousProxy = RealmSynchronousProxy;
4277
4278    const DEBUG_NAME: &'static str = "fuchsia.component.Realm";
4279}
4280impl fidl::endpoints::DiscoverableProtocolMarker for RealmMarker {}
4281pub type RealmOpenControllerResult = Result<(), Error>;
4282pub type RealmOpenExposedDirResult = Result<(), Error>;
4283pub type RealmCreateChildResult = Result<(), Error>;
4284pub type RealmDestroyChildResult = Result<(), Error>;
4285pub type RealmListChildrenResult = Result<(), Error>;
4286pub type RealmGetResolvedInfoResult = Result<fidl_fuchsia_component_resolution::Component, Error>;
4287pub type RealmGetChildOutputDictionaryResult =
4288    Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>;
4289
4290pub trait RealmProxyInterface: Send + Sync {
4291    type OpenControllerResponseFut: std::future::Future<Output = Result<RealmOpenControllerResult, fidl::Error>>
4292        + Send;
4293    fn r#open_controller(
4294        &self,
4295        child: &fidl_fuchsia_component_decl::ChildRef,
4296        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
4297    ) -> Self::OpenControllerResponseFut;
4298    type OpenExposedDirResponseFut: std::future::Future<Output = Result<RealmOpenExposedDirResult, fidl::Error>>
4299        + Send;
4300    fn r#open_exposed_dir(
4301        &self,
4302        child: &fidl_fuchsia_component_decl::ChildRef,
4303        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4304    ) -> Self::OpenExposedDirResponseFut;
4305    type CreateChildResponseFut: std::future::Future<Output = Result<RealmCreateChildResult, fidl::Error>>
4306        + Send;
4307    fn r#create_child(
4308        &self,
4309        collection: &fidl_fuchsia_component_decl::CollectionRef,
4310        decl: &fidl_fuchsia_component_decl::Child,
4311        args: CreateChildArgs,
4312    ) -> Self::CreateChildResponseFut;
4313    type DestroyChildResponseFut: std::future::Future<Output = Result<RealmDestroyChildResult, fidl::Error>>
4314        + Send;
4315    fn r#destroy_child(
4316        &self,
4317        child: &fidl_fuchsia_component_decl::ChildRef,
4318    ) -> Self::DestroyChildResponseFut;
4319    type ListChildrenResponseFut: std::future::Future<Output = Result<RealmListChildrenResult, fidl::Error>>
4320        + Send;
4321    fn r#list_children(
4322        &self,
4323        collection: &fidl_fuchsia_component_decl::CollectionRef,
4324        iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
4325    ) -> Self::ListChildrenResponseFut;
4326    type GetResolvedInfoResponseFut: std::future::Future<Output = Result<RealmGetResolvedInfoResult, fidl::Error>>
4327        + Send;
4328    fn r#get_resolved_info(&self) -> Self::GetResolvedInfoResponseFut;
4329    type GetChildOutputDictionaryResponseFut: std::future::Future<Output = Result<RealmGetChildOutputDictionaryResult, fidl::Error>>
4330        + Send;
4331    fn r#get_child_output_dictionary(
4332        &self,
4333        child: &fidl_fuchsia_component_decl::ChildRef,
4334    ) -> Self::GetChildOutputDictionaryResponseFut;
4335}
4336#[derive(Debug)]
4337#[cfg(target_os = "fuchsia")]
4338pub struct RealmSynchronousProxy {
4339    client: fidl::client::sync::Client,
4340}
4341
4342#[cfg(target_os = "fuchsia")]
4343impl fidl::endpoints::SynchronousProxy for RealmSynchronousProxy {
4344    type Proxy = RealmProxy;
4345    type Protocol = RealmMarker;
4346
4347    fn from_channel(inner: fidl::Channel) -> Self {
4348        Self::new(inner)
4349    }
4350
4351    fn into_channel(self) -> fidl::Channel {
4352        self.client.into_channel()
4353    }
4354
4355    fn as_channel(&self) -> &fidl::Channel {
4356        self.client.as_channel()
4357    }
4358}
4359
4360#[cfg(target_os = "fuchsia")]
4361impl RealmSynchronousProxy {
4362    pub fn new(channel: fidl::Channel) -> Self {
4363        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4364        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4365    }
4366
4367    pub fn into_channel(self) -> fidl::Channel {
4368        self.client.into_channel()
4369    }
4370
4371    /// Waits until an event arrives and returns it. It is safe for other
4372    /// threads to make concurrent requests while waiting for an event.
4373    pub fn wait_for_event(
4374        &self,
4375        deadline: zx::MonotonicInstant,
4376    ) -> Result<RealmEvent, fidl::Error> {
4377        RealmEvent::decode(self.client.wait_for_event(deadline)?)
4378    }
4379
4380    /// Operate on a child component. See documentation for [`Controller`].
4381    ///
4382    /// Errors:
4383    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
4384    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4385    /// - `INSTANCE_DIED`: This realm no longer exists.
4386    pub fn r#open_controller(
4387        &self,
4388        mut child: &fidl_fuchsia_component_decl::ChildRef,
4389        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
4390        ___deadline: zx::MonotonicInstant,
4391    ) -> Result<RealmOpenControllerResult, fidl::Error> {
4392        let _response = self.client.send_query::<
4393            RealmOpenControllerRequest,
4394            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4395        >(
4396            (child, controller,),
4397            0x7150b7898d1b1180,
4398            fidl::encoding::DynamicFlags::empty(),
4399            ___deadline,
4400        )?;
4401        Ok(_response.map(|x| x))
4402    }
4403
4404    /// Opens the exposed directory of a child component instance. When this
4405    /// function successfully returns, `exposed_dir` is bound to a directory
4406    /// that contains the capabilities which the child exposed to its realm
4407    /// via `ComponentDecl.exposes` (specified via "expose" declarations in
4408    /// the component's manifest). The child component will not start as a
4409    /// result of this call. Instead, starting will occur iff the parent binds
4410    /// to one of the capabilities contained within `exposed_dir`.
4411    ///
4412    /// `exposed_dir` is open as long as `child` exists.
4413    ///
4414    /// Errors:
4415    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
4416    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4417    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
4418    /// - `INSTANCE_DIED`: This realm no longer exists.
4419    pub fn r#open_exposed_dir(
4420        &self,
4421        mut child: &fidl_fuchsia_component_decl::ChildRef,
4422        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4423        ___deadline: zx::MonotonicInstant,
4424    ) -> Result<RealmOpenExposedDirResult, fidl::Error> {
4425        let _response = self.client.send_query::<
4426            RealmOpenExposedDirRequest,
4427            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4428        >(
4429            (child, exposed_dir,),
4430            0x7f993235ca59f92c,
4431            fidl::encoding::DynamicFlags::empty(),
4432            ___deadline,
4433        )?;
4434        Ok(_response.map(|x| x))
4435    }
4436
4437    /// Creates a child component instance dynamically. When this function
4438    /// returns successfully, the instance exists, but it may not be running.
4439    ///
4440    /// The environment of the child instance is determined by the environment
4441    /// of the collection. `decl` must not set `environment`.
4442    ///
4443    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
4444    /// [CreateChild] will start the component and return once the component is
4445    /// started. Otherwise, [CreateChild] will return immediately after creating
4446    /// the component and will not start or resolve it.
4447    ///
4448    /// Errors:
4449    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
4450    ///   is not a valid declaration.
4451    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4452    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
4453    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
4454    ///   in a `SingleRun` collection.
4455    /// - `NO_SPACE`: Could not allocate storage for the new instance.
4456    /// - `INSTANCE_DIED`: This realm no longer exists.
4457    pub fn r#create_child(
4458        &self,
4459        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4460        mut decl: &fidl_fuchsia_component_decl::Child,
4461        mut args: CreateChildArgs,
4462        ___deadline: zx::MonotonicInstant,
4463    ) -> Result<RealmCreateChildResult, fidl::Error> {
4464        let _response = self.client.send_query::<
4465            RealmCreateChildRequest,
4466            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4467        >(
4468            (collection, decl, &mut args,),
4469            0x43e48ce8483d7560,
4470            fidl::encoding::DynamicFlags::empty(),
4471            ___deadline,
4472        )?;
4473        Ok(_response.map(|x| x))
4474    }
4475
4476    /// Destroys a dynamically-created component instance. When this function
4477    /// returns, the instance is destroyed and has stopped running.  However,
4478    /// cleanup of the component's resources (such as its isolated storage) may
4479    /// happen in the background after this function returns.
4480    ///
4481    /// Errors:
4482    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
4483    ///   to a dynamic instance.
4484    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4485    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4486    /// - `INSTANCE_DIED`: This realm no longer exists.
4487    pub fn r#destroy_child(
4488        &self,
4489        mut child: &fidl_fuchsia_component_decl::ChildRef,
4490        ___deadline: zx::MonotonicInstant,
4491    ) -> Result<RealmDestroyChildResult, fidl::Error> {
4492        let _response = self.client.send_query::<
4493            RealmDestroyChildRequest,
4494            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4495        >(
4496            (child,),
4497            0x71d8caf8850c9222,
4498            fidl::encoding::DynamicFlags::empty(),
4499            ___deadline,
4500        )?;
4501        Ok(_response.map(|x| x))
4502    }
4503
4504    /// Returns an iterator that lists all instances in a collection.
4505    ///
4506    /// NOTE: The results are not guaranteed to be consistent. Instances may be
4507    /// created or destroyed while the iterator is live, but those changes
4508    /// won't be observed by the iterator after this method returns.
4509    ///
4510    /// Errors:
4511    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
4512    /// does not have `ZX_RIGHT_WAIT`.
4513    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4514    /// - `INSTANCE_DIED`: This realm no longer exists.
4515    /// - If `iter` does not have standard channel rights, this function may
4516    ///   return `ACCESS_DENIED` or component manager may close `iter`.
4517    pub fn r#list_children(
4518        &self,
4519        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4520        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
4521        ___deadline: zx::MonotonicInstant,
4522    ) -> Result<RealmListChildrenResult, fidl::Error> {
4523        let _response = self.client.send_query::<
4524            RealmListChildrenRequest,
4525            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4526        >(
4527            (collection, iter,),
4528            0x6888a76683efc0a1,
4529            fidl::encoding::DynamicFlags::empty(),
4530            ___deadline,
4531        )?;
4532        Ok(_response.map(|x| x))
4533    }
4534
4535    /// Returns the set of information that was given to the component framework
4536    /// by this component's resolver.
4537    pub fn r#get_resolved_info(
4538        &self,
4539        ___deadline: zx::MonotonicInstant,
4540    ) -> Result<RealmGetResolvedInfoResult, fidl::Error> {
4541        let _response = self.client.send_query::<
4542            fidl::encoding::EmptyPayload,
4543            fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>,
4544        >(
4545            (),
4546            0x734f744cb7d210a2,
4547            fidl::encoding::DynamicFlags::empty(),
4548            ___deadline,
4549        )?;
4550        Ok(_response.map(|x| x.resolved_info))
4551    }
4552
4553    pub fn r#get_child_output_dictionary(
4554        &self,
4555        mut child: &fidl_fuchsia_component_decl::ChildRef,
4556        ___deadline: zx::MonotonicInstant,
4557    ) -> Result<RealmGetChildOutputDictionaryResult, fidl::Error> {
4558        let _response = self.client.send_query::<
4559            RealmGetChildOutputDictionaryRequest,
4560            fidl::encoding::ResultType<RealmGetChildOutputDictionaryResponse, Error>,
4561        >(
4562            (child,),
4563            0x4259d08d261d5610,
4564            fidl::encoding::DynamicFlags::empty(),
4565            ___deadline,
4566        )?;
4567        Ok(_response.map(|x| x.dictionary))
4568    }
4569}
4570
4571#[cfg(target_os = "fuchsia")]
4572impl From<RealmSynchronousProxy> for zx::Handle {
4573    fn from(value: RealmSynchronousProxy) -> Self {
4574        value.into_channel().into()
4575    }
4576}
4577
4578#[cfg(target_os = "fuchsia")]
4579impl From<fidl::Channel> for RealmSynchronousProxy {
4580    fn from(value: fidl::Channel) -> Self {
4581        Self::new(value)
4582    }
4583}
4584
4585#[cfg(target_os = "fuchsia")]
4586impl fidl::endpoints::FromClient for RealmSynchronousProxy {
4587    type Protocol = RealmMarker;
4588
4589    fn from_client(value: fidl::endpoints::ClientEnd<RealmMarker>) -> Self {
4590        Self::new(value.into_channel())
4591    }
4592}
4593
4594#[derive(Debug, Clone)]
4595pub struct RealmProxy {
4596    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4597}
4598
4599impl fidl::endpoints::Proxy for RealmProxy {
4600    type Protocol = RealmMarker;
4601
4602    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4603        Self::new(inner)
4604    }
4605
4606    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4607        self.client.into_channel().map_err(|client| Self { client })
4608    }
4609
4610    fn as_channel(&self) -> &::fidl::AsyncChannel {
4611        self.client.as_channel()
4612    }
4613}
4614
4615impl RealmProxy {
4616    /// Create a new Proxy for fuchsia.component/Realm.
4617    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4618        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4619        Self { client: fidl::client::Client::new(channel, protocol_name) }
4620    }
4621
4622    /// Get a Stream of events from the remote end of the protocol.
4623    ///
4624    /// # Panics
4625    ///
4626    /// Panics if the event stream was already taken.
4627    pub fn take_event_stream(&self) -> RealmEventStream {
4628        RealmEventStream { event_receiver: self.client.take_event_receiver() }
4629    }
4630
4631    /// Operate on a child component. See documentation for [`Controller`].
4632    ///
4633    /// Errors:
4634    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
4635    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4636    /// - `INSTANCE_DIED`: This realm no longer exists.
4637    pub fn r#open_controller(
4638        &self,
4639        mut child: &fidl_fuchsia_component_decl::ChildRef,
4640        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
4641    ) -> fidl::client::QueryResponseFut<
4642        RealmOpenControllerResult,
4643        fidl::encoding::DefaultFuchsiaResourceDialect,
4644    > {
4645        RealmProxyInterface::r#open_controller(self, child, controller)
4646    }
4647
4648    /// Opens the exposed directory of a child component instance. When this
4649    /// function successfully returns, `exposed_dir` is bound to a directory
4650    /// that contains the capabilities which the child exposed to its realm
4651    /// via `ComponentDecl.exposes` (specified via "expose" declarations in
4652    /// the component's manifest). The child component will not start as a
4653    /// result of this call. Instead, starting will occur iff the parent binds
4654    /// to one of the capabilities contained within `exposed_dir`.
4655    ///
4656    /// `exposed_dir` is open as long as `child` exists.
4657    ///
4658    /// Errors:
4659    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
4660    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4661    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
4662    /// - `INSTANCE_DIED`: This realm no longer exists.
4663    pub fn r#open_exposed_dir(
4664        &self,
4665        mut child: &fidl_fuchsia_component_decl::ChildRef,
4666        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4667    ) -> fidl::client::QueryResponseFut<
4668        RealmOpenExposedDirResult,
4669        fidl::encoding::DefaultFuchsiaResourceDialect,
4670    > {
4671        RealmProxyInterface::r#open_exposed_dir(self, child, exposed_dir)
4672    }
4673
4674    /// Creates a child component instance dynamically. When this function
4675    /// returns successfully, the instance exists, but it may not be running.
4676    ///
4677    /// The environment of the child instance is determined by the environment
4678    /// of the collection. `decl` must not set `environment`.
4679    ///
4680    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
4681    /// [CreateChild] will start the component and return once the component is
4682    /// started. Otherwise, [CreateChild] will return immediately after creating
4683    /// the component and will not start or resolve it.
4684    ///
4685    /// Errors:
4686    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
4687    ///   is not a valid declaration.
4688    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4689    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
4690    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
4691    ///   in a `SingleRun` collection.
4692    /// - `NO_SPACE`: Could not allocate storage for the new instance.
4693    /// - `INSTANCE_DIED`: This realm no longer exists.
4694    pub fn r#create_child(
4695        &self,
4696        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4697        mut decl: &fidl_fuchsia_component_decl::Child,
4698        mut args: CreateChildArgs,
4699    ) -> fidl::client::QueryResponseFut<
4700        RealmCreateChildResult,
4701        fidl::encoding::DefaultFuchsiaResourceDialect,
4702    > {
4703        RealmProxyInterface::r#create_child(self, collection, decl, args)
4704    }
4705
4706    /// Destroys a dynamically-created component instance. When this function
4707    /// returns, the instance is destroyed and has stopped running.  However,
4708    /// cleanup of the component's resources (such as its isolated storage) may
4709    /// happen in the background after this function returns.
4710    ///
4711    /// Errors:
4712    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
4713    ///   to a dynamic instance.
4714    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
4715    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4716    /// - `INSTANCE_DIED`: This realm no longer exists.
4717    pub fn r#destroy_child(
4718        &self,
4719        mut child: &fidl_fuchsia_component_decl::ChildRef,
4720    ) -> fidl::client::QueryResponseFut<
4721        RealmDestroyChildResult,
4722        fidl::encoding::DefaultFuchsiaResourceDialect,
4723    > {
4724        RealmProxyInterface::r#destroy_child(self, child)
4725    }
4726
4727    /// Returns an iterator that lists all instances in a collection.
4728    ///
4729    /// NOTE: The results are not guaranteed to be consistent. Instances may be
4730    /// created or destroyed while the iterator is live, but those changes
4731    /// won't be observed by the iterator after this method returns.
4732    ///
4733    /// Errors:
4734    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
4735    /// does not have `ZX_RIGHT_WAIT`.
4736    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
4737    /// - `INSTANCE_DIED`: This realm no longer exists.
4738    /// - If `iter` does not have standard channel rights, this function may
4739    ///   return `ACCESS_DENIED` or component manager may close `iter`.
4740    pub fn r#list_children(
4741        &self,
4742        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4743        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
4744    ) -> fidl::client::QueryResponseFut<
4745        RealmListChildrenResult,
4746        fidl::encoding::DefaultFuchsiaResourceDialect,
4747    > {
4748        RealmProxyInterface::r#list_children(self, collection, iter)
4749    }
4750
4751    /// Returns the set of information that was given to the component framework
4752    /// by this component's resolver.
4753    pub fn r#get_resolved_info(
4754        &self,
4755    ) -> fidl::client::QueryResponseFut<
4756        RealmGetResolvedInfoResult,
4757        fidl::encoding::DefaultFuchsiaResourceDialect,
4758    > {
4759        RealmProxyInterface::r#get_resolved_info(self)
4760    }
4761
4762    pub fn r#get_child_output_dictionary(
4763        &self,
4764        mut child: &fidl_fuchsia_component_decl::ChildRef,
4765    ) -> fidl::client::QueryResponseFut<
4766        RealmGetChildOutputDictionaryResult,
4767        fidl::encoding::DefaultFuchsiaResourceDialect,
4768    > {
4769        RealmProxyInterface::r#get_child_output_dictionary(self, child)
4770    }
4771}
4772
4773impl RealmProxyInterface for RealmProxy {
4774    type OpenControllerResponseFut = fidl::client::QueryResponseFut<
4775        RealmOpenControllerResult,
4776        fidl::encoding::DefaultFuchsiaResourceDialect,
4777    >;
4778    fn r#open_controller(
4779        &self,
4780        mut child: &fidl_fuchsia_component_decl::ChildRef,
4781        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
4782    ) -> Self::OpenControllerResponseFut {
4783        fn _decode(
4784            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4785        ) -> Result<RealmOpenControllerResult, fidl::Error> {
4786            let _response = fidl::client::decode_transaction_body::<
4787                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4788                fidl::encoding::DefaultFuchsiaResourceDialect,
4789                0x7150b7898d1b1180,
4790            >(_buf?)?;
4791            Ok(_response.map(|x| x))
4792        }
4793        self.client.send_query_and_decode::<RealmOpenControllerRequest, RealmOpenControllerResult>(
4794            (child, controller),
4795            0x7150b7898d1b1180,
4796            fidl::encoding::DynamicFlags::empty(),
4797            _decode,
4798        )
4799    }
4800
4801    type OpenExposedDirResponseFut = fidl::client::QueryResponseFut<
4802        RealmOpenExposedDirResult,
4803        fidl::encoding::DefaultFuchsiaResourceDialect,
4804    >;
4805    fn r#open_exposed_dir(
4806        &self,
4807        mut child: &fidl_fuchsia_component_decl::ChildRef,
4808        mut exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
4809    ) -> Self::OpenExposedDirResponseFut {
4810        fn _decode(
4811            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4812        ) -> Result<RealmOpenExposedDirResult, fidl::Error> {
4813            let _response = fidl::client::decode_transaction_body::<
4814                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4815                fidl::encoding::DefaultFuchsiaResourceDialect,
4816                0x7f993235ca59f92c,
4817            >(_buf?)?;
4818            Ok(_response.map(|x| x))
4819        }
4820        self.client.send_query_and_decode::<RealmOpenExposedDirRequest, RealmOpenExposedDirResult>(
4821            (child, exposed_dir),
4822            0x7f993235ca59f92c,
4823            fidl::encoding::DynamicFlags::empty(),
4824            _decode,
4825        )
4826    }
4827
4828    type CreateChildResponseFut = fidl::client::QueryResponseFut<
4829        RealmCreateChildResult,
4830        fidl::encoding::DefaultFuchsiaResourceDialect,
4831    >;
4832    fn r#create_child(
4833        &self,
4834        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4835        mut decl: &fidl_fuchsia_component_decl::Child,
4836        mut args: CreateChildArgs,
4837    ) -> Self::CreateChildResponseFut {
4838        fn _decode(
4839            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4840        ) -> Result<RealmCreateChildResult, fidl::Error> {
4841            let _response = fidl::client::decode_transaction_body::<
4842                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4843                fidl::encoding::DefaultFuchsiaResourceDialect,
4844                0x43e48ce8483d7560,
4845            >(_buf?)?;
4846            Ok(_response.map(|x| x))
4847        }
4848        self.client.send_query_and_decode::<RealmCreateChildRequest, RealmCreateChildResult>(
4849            (collection, decl, &mut args),
4850            0x43e48ce8483d7560,
4851            fidl::encoding::DynamicFlags::empty(),
4852            _decode,
4853        )
4854    }
4855
4856    type DestroyChildResponseFut = fidl::client::QueryResponseFut<
4857        RealmDestroyChildResult,
4858        fidl::encoding::DefaultFuchsiaResourceDialect,
4859    >;
4860    fn r#destroy_child(
4861        &self,
4862        mut child: &fidl_fuchsia_component_decl::ChildRef,
4863    ) -> Self::DestroyChildResponseFut {
4864        fn _decode(
4865            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4866        ) -> Result<RealmDestroyChildResult, fidl::Error> {
4867            let _response = fidl::client::decode_transaction_body::<
4868                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4869                fidl::encoding::DefaultFuchsiaResourceDialect,
4870                0x71d8caf8850c9222,
4871            >(_buf?)?;
4872            Ok(_response.map(|x| x))
4873        }
4874        self.client.send_query_and_decode::<RealmDestroyChildRequest, RealmDestroyChildResult>(
4875            (child,),
4876            0x71d8caf8850c9222,
4877            fidl::encoding::DynamicFlags::empty(),
4878            _decode,
4879        )
4880    }
4881
4882    type ListChildrenResponseFut = fidl::client::QueryResponseFut<
4883        RealmListChildrenResult,
4884        fidl::encoding::DefaultFuchsiaResourceDialect,
4885    >;
4886    fn r#list_children(
4887        &self,
4888        mut collection: &fidl_fuchsia_component_decl::CollectionRef,
4889        mut iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
4890    ) -> Self::ListChildrenResponseFut {
4891        fn _decode(
4892            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4893        ) -> Result<RealmListChildrenResult, fidl::Error> {
4894            let _response = fidl::client::decode_transaction_body::<
4895                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
4896                fidl::encoding::DefaultFuchsiaResourceDialect,
4897                0x6888a76683efc0a1,
4898            >(_buf?)?;
4899            Ok(_response.map(|x| x))
4900        }
4901        self.client.send_query_and_decode::<RealmListChildrenRequest, RealmListChildrenResult>(
4902            (collection, iter),
4903            0x6888a76683efc0a1,
4904            fidl::encoding::DynamicFlags::empty(),
4905            _decode,
4906        )
4907    }
4908
4909    type GetResolvedInfoResponseFut = fidl::client::QueryResponseFut<
4910        RealmGetResolvedInfoResult,
4911        fidl::encoding::DefaultFuchsiaResourceDialect,
4912    >;
4913    fn r#get_resolved_info(&self) -> Self::GetResolvedInfoResponseFut {
4914        fn _decode(
4915            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4916        ) -> Result<RealmGetResolvedInfoResult, fidl::Error> {
4917            let _response = fidl::client::decode_transaction_body::<
4918                fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>,
4919                fidl::encoding::DefaultFuchsiaResourceDialect,
4920                0x734f744cb7d210a2,
4921            >(_buf?)?;
4922            Ok(_response.map(|x| x.resolved_info))
4923        }
4924        self.client
4925            .send_query_and_decode::<fidl::encoding::EmptyPayload, RealmGetResolvedInfoResult>(
4926                (),
4927                0x734f744cb7d210a2,
4928                fidl::encoding::DynamicFlags::empty(),
4929                _decode,
4930            )
4931    }
4932
4933    type GetChildOutputDictionaryResponseFut = fidl::client::QueryResponseFut<
4934        RealmGetChildOutputDictionaryResult,
4935        fidl::encoding::DefaultFuchsiaResourceDialect,
4936    >;
4937    fn r#get_child_output_dictionary(
4938        &self,
4939        mut child: &fidl_fuchsia_component_decl::ChildRef,
4940    ) -> Self::GetChildOutputDictionaryResponseFut {
4941        fn _decode(
4942            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4943        ) -> Result<RealmGetChildOutputDictionaryResult, fidl::Error> {
4944            let _response = fidl::client::decode_transaction_body::<
4945                fidl::encoding::ResultType<RealmGetChildOutputDictionaryResponse, Error>,
4946                fidl::encoding::DefaultFuchsiaResourceDialect,
4947                0x4259d08d261d5610,
4948            >(_buf?)?;
4949            Ok(_response.map(|x| x.dictionary))
4950        }
4951        self.client.send_query_and_decode::<
4952            RealmGetChildOutputDictionaryRequest,
4953            RealmGetChildOutputDictionaryResult,
4954        >(
4955            (child,),
4956            0x4259d08d261d5610,
4957            fidl::encoding::DynamicFlags::empty(),
4958            _decode,
4959        )
4960    }
4961}
4962
4963pub struct RealmEventStream {
4964    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4965}
4966
4967impl std::marker::Unpin for RealmEventStream {}
4968
4969impl futures::stream::FusedStream for RealmEventStream {
4970    fn is_terminated(&self) -> bool {
4971        self.event_receiver.is_terminated()
4972    }
4973}
4974
4975impl futures::Stream for RealmEventStream {
4976    type Item = Result<RealmEvent, fidl::Error>;
4977
4978    fn poll_next(
4979        mut self: std::pin::Pin<&mut Self>,
4980        cx: &mut std::task::Context<'_>,
4981    ) -> std::task::Poll<Option<Self::Item>> {
4982        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4983            &mut self.event_receiver,
4984            cx
4985        )?) {
4986            Some(buf) => std::task::Poll::Ready(Some(RealmEvent::decode(buf))),
4987            None => std::task::Poll::Ready(None),
4988        }
4989    }
4990}
4991
4992#[derive(Debug)]
4993pub enum RealmEvent {}
4994
4995impl RealmEvent {
4996    /// Decodes a message buffer as a [`RealmEvent`].
4997    fn decode(
4998        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4999    ) -> Result<RealmEvent, fidl::Error> {
5000        let (bytes, _handles) = buf.split_mut();
5001        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5002        debug_assert_eq!(tx_header.tx_id, 0);
5003        match tx_header.ordinal {
5004            _ => Err(fidl::Error::UnknownOrdinal {
5005                ordinal: tx_header.ordinal,
5006                protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5007            }),
5008        }
5009    }
5010}
5011
5012/// A Stream of incoming requests for fuchsia.component/Realm.
5013pub struct RealmRequestStream {
5014    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5015    is_terminated: bool,
5016}
5017
5018impl std::marker::Unpin for RealmRequestStream {}
5019
5020impl futures::stream::FusedStream for RealmRequestStream {
5021    fn is_terminated(&self) -> bool {
5022        self.is_terminated
5023    }
5024}
5025
5026impl fidl::endpoints::RequestStream for RealmRequestStream {
5027    type Protocol = RealmMarker;
5028    type ControlHandle = RealmControlHandle;
5029
5030    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5031        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5032    }
5033
5034    fn control_handle(&self) -> Self::ControlHandle {
5035        RealmControlHandle { inner: self.inner.clone() }
5036    }
5037
5038    fn into_inner(
5039        self,
5040    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5041    {
5042        (self.inner, self.is_terminated)
5043    }
5044
5045    fn from_inner(
5046        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5047        is_terminated: bool,
5048    ) -> Self {
5049        Self { inner, is_terminated }
5050    }
5051}
5052
5053impl futures::Stream for RealmRequestStream {
5054    type Item = Result<RealmRequest, fidl::Error>;
5055
5056    fn poll_next(
5057        mut self: std::pin::Pin<&mut Self>,
5058        cx: &mut std::task::Context<'_>,
5059    ) -> std::task::Poll<Option<Self::Item>> {
5060        let this = &mut *self;
5061        if this.inner.check_shutdown(cx) {
5062            this.is_terminated = true;
5063            return std::task::Poll::Ready(None);
5064        }
5065        if this.is_terminated {
5066            panic!("polled RealmRequestStream after completion");
5067        }
5068        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5069            |bytes, handles| {
5070                match this.inner.channel().read_etc(cx, bytes, handles) {
5071                    std::task::Poll::Ready(Ok(())) => {}
5072                    std::task::Poll::Pending => return std::task::Poll::Pending,
5073                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5074                        this.is_terminated = true;
5075                        return std::task::Poll::Ready(None);
5076                    }
5077                    std::task::Poll::Ready(Err(e)) => {
5078                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5079                            e.into(),
5080                        ))));
5081                    }
5082                }
5083
5084                // A message has been received from the channel
5085                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5086
5087                std::task::Poll::Ready(Some(match header.ordinal {
5088                    0x7150b7898d1b1180 => {
5089                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5090                        let mut req = fidl::new_empty!(
5091                            RealmOpenControllerRequest,
5092                            fidl::encoding::DefaultFuchsiaResourceDialect
5093                        );
5094                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmOpenControllerRequest>(&header, _body_bytes, handles, &mut req)?;
5095                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5096                        Ok(RealmRequest::OpenController {
5097                            child: req.child,
5098                            controller: req.controller,
5099
5100                            responder: RealmOpenControllerResponder {
5101                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5102                                tx_id: header.tx_id,
5103                            },
5104                        })
5105                    }
5106                    0x7f993235ca59f92c => {
5107                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5108                        let mut req = fidl::new_empty!(
5109                            RealmOpenExposedDirRequest,
5110                            fidl::encoding::DefaultFuchsiaResourceDialect
5111                        );
5112                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmOpenExposedDirRequest>(&header, _body_bytes, handles, &mut req)?;
5113                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5114                        Ok(RealmRequest::OpenExposedDir {
5115                            child: req.child,
5116                            exposed_dir: req.exposed_dir,
5117
5118                            responder: RealmOpenExposedDirResponder {
5119                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5120                                tx_id: header.tx_id,
5121                            },
5122                        })
5123                    }
5124                    0x43e48ce8483d7560 => {
5125                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5126                        let mut req = fidl::new_empty!(
5127                            RealmCreateChildRequest,
5128                            fidl::encoding::DefaultFuchsiaResourceDialect
5129                        );
5130                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmCreateChildRequest>(&header, _body_bytes, handles, &mut req)?;
5131                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5132                        Ok(RealmRequest::CreateChild {
5133                            collection: req.collection,
5134                            decl: req.decl,
5135                            args: req.args,
5136
5137                            responder: RealmCreateChildResponder {
5138                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5139                                tx_id: header.tx_id,
5140                            },
5141                        })
5142                    }
5143                    0x71d8caf8850c9222 => {
5144                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5145                        let mut req = fidl::new_empty!(
5146                            RealmDestroyChildRequest,
5147                            fidl::encoding::DefaultFuchsiaResourceDialect
5148                        );
5149                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmDestroyChildRequest>(&header, _body_bytes, handles, &mut req)?;
5150                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5151                        Ok(RealmRequest::DestroyChild {
5152                            child: req.child,
5153
5154                            responder: RealmDestroyChildResponder {
5155                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5156                                tx_id: header.tx_id,
5157                            },
5158                        })
5159                    }
5160                    0x6888a76683efc0a1 => {
5161                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5162                        let mut req = fidl::new_empty!(
5163                            RealmListChildrenRequest,
5164                            fidl::encoding::DefaultFuchsiaResourceDialect
5165                        );
5166                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmListChildrenRequest>(&header, _body_bytes, handles, &mut req)?;
5167                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5168                        Ok(RealmRequest::ListChildren {
5169                            collection: req.collection,
5170                            iter: req.iter,
5171
5172                            responder: RealmListChildrenResponder {
5173                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5174                                tx_id: header.tx_id,
5175                            },
5176                        })
5177                    }
5178                    0x734f744cb7d210a2 => {
5179                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5180                        let mut req = fidl::new_empty!(
5181                            fidl::encoding::EmptyPayload,
5182                            fidl::encoding::DefaultFuchsiaResourceDialect
5183                        );
5184                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5185                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5186                        Ok(RealmRequest::GetResolvedInfo {
5187                            responder: RealmGetResolvedInfoResponder {
5188                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5189                                tx_id: header.tx_id,
5190                            },
5191                        })
5192                    }
5193                    0x4259d08d261d5610 => {
5194                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5195                        let mut req = fidl::new_empty!(
5196                            RealmGetChildOutputDictionaryRequest,
5197                            fidl::encoding::DefaultFuchsiaResourceDialect
5198                        );
5199                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmGetChildOutputDictionaryRequest>(&header, _body_bytes, handles, &mut req)?;
5200                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
5201                        Ok(RealmRequest::GetChildOutputDictionary {
5202                            child: req.child,
5203
5204                            responder: RealmGetChildOutputDictionaryResponder {
5205                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5206                                tx_id: header.tx_id,
5207                            },
5208                        })
5209                    }
5210                    _ => Err(fidl::Error::UnknownOrdinal {
5211                        ordinal: header.ordinal,
5212                        protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5213                    }),
5214                }))
5215            },
5216        )
5217    }
5218}
5219
5220/// A protocol used by a component instance to manage its own realm, such as for
5221/// binding to its children.
5222///
5223/// Requests to this protocol are processed in the order they are received.
5224/// Clients that wish to send requests in parallel should open multiple
5225/// connections.
5226///
5227/// The component framework provides this service to components that use
5228/// `fuchsia.component.Realm`.
5229#[derive(Debug)]
5230pub enum RealmRequest {
5231    /// Operate on a child component. See documentation for [`Controller`].
5232    ///
5233    /// Errors:
5234    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5235    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5236    /// - `INSTANCE_DIED`: This realm no longer exists.
5237    OpenController {
5238        child: fidl_fuchsia_component_decl::ChildRef,
5239        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5240        responder: RealmOpenControllerResponder,
5241    },
5242    /// Opens the exposed directory of a child component instance. When this
5243    /// function successfully returns, `exposed_dir` is bound to a directory
5244    /// that contains the capabilities which the child exposed to its realm
5245    /// via `ComponentDecl.exposes` (specified via "expose" declarations in
5246    /// the component's manifest). The child component will not start as a
5247    /// result of this call. Instead, starting will occur iff the parent binds
5248    /// to one of the capabilities contained within `exposed_dir`.
5249    ///
5250    /// `exposed_dir` is open as long as `child` exists.
5251    ///
5252    /// Errors:
5253    /// - `INVALID_ARGUMENTS`: `child` is not a valid child reference.
5254    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5255    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve.
5256    /// - `INSTANCE_DIED`: This realm no longer exists.
5257    OpenExposedDir {
5258        child: fidl_fuchsia_component_decl::ChildRef,
5259        exposed_dir: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5260        responder: RealmOpenExposedDirResponder,
5261    },
5262    /// Creates a child component instance dynamically. When this function
5263    /// returns successfully, the instance exists, but it may not be running.
5264    ///
5265    /// The environment of the child instance is determined by the environment
5266    /// of the collection. `decl` must not set `environment`.
5267    ///
5268    /// If `decl.startup == EAGER`, or `collection.durability == SINGLE_RUN`,
5269    /// [CreateChild] will start the component and return once the component is
5270    /// started. Otherwise, [CreateChild] will return immediately after creating
5271    /// the component and will not start or resolve it.
5272    ///
5273    /// Errors:
5274    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `child`
5275    ///   is not a valid declaration.
5276    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5277    /// - `INSTANCE_ALREADY_EXISTS`: `decl.name` already exists in `collection`.
5278    /// - `INSTANCE_CANNOT_RESOLVE`: `child`'s component declaration failed to resolve
5279    ///   in a `SingleRun` collection.
5280    /// - `NO_SPACE`: Could not allocate storage for the new instance.
5281    /// - `INSTANCE_DIED`: This realm no longer exists.
5282    CreateChild {
5283        collection: fidl_fuchsia_component_decl::CollectionRef,
5284        decl: fidl_fuchsia_component_decl::Child,
5285        args: CreateChildArgs,
5286        responder: RealmCreateChildResponder,
5287    },
5288    /// Destroys a dynamically-created component instance. When this function
5289    /// returns, the instance is destroyed and has stopped running.  However,
5290    /// cleanup of the component's resources (such as its isolated storage) may
5291    /// happen in the background after this function returns.
5292    ///
5293    /// Errors:
5294    /// - `INVALID_ARGUMENTS`: `child` is not a valid reference or does not refer
5295    ///   to a dynamic instance.
5296    /// - `INSTANCE_NOT_FOUND`: `child` does not exist.
5297    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5298    /// - `INSTANCE_DIED`: This realm no longer exists.
5299    DestroyChild {
5300        child: fidl_fuchsia_component_decl::ChildRef,
5301        responder: RealmDestroyChildResponder,
5302    },
5303    /// Returns an iterator that lists all instances in a collection.
5304    ///
5305    /// NOTE: The results are not guaranteed to be consistent. Instances may be
5306    /// created or destroyed while the iterator is live, but those changes
5307    /// won't be observed by the iterator after this method returns.
5308    ///
5309    /// Errors:
5310    /// - `INVALID_ARGUMENTS`: `collection` is not a valid reference or `iter`
5311    /// does not have `ZX_RIGHT_WAIT`.
5312    /// - `COLLECTION_NOT_FOUND`: `collection` does not exist.
5313    /// - `INSTANCE_DIED`: This realm no longer exists.
5314    /// - If `iter` does not have standard channel rights, this function may
5315    ///   return `ACCESS_DENIED` or component manager may close `iter`.
5316    ListChildren {
5317        collection: fidl_fuchsia_component_decl::CollectionRef,
5318        iter: fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5319        responder: RealmListChildrenResponder,
5320    },
5321    /// Returns the set of information that was given to the component framework
5322    /// by this component's resolver.
5323    GetResolvedInfo { responder: RealmGetResolvedInfoResponder },
5324    GetChildOutputDictionary {
5325        child: fidl_fuchsia_component_decl::ChildRef,
5326        responder: RealmGetChildOutputDictionaryResponder,
5327    },
5328}
5329
5330impl RealmRequest {
5331    #[allow(irrefutable_let_patterns)]
5332    pub fn into_open_controller(
5333        self,
5334    ) -> Option<(
5335        fidl_fuchsia_component_decl::ChildRef,
5336        fidl::endpoints::ServerEnd<ControllerMarker>,
5337        RealmOpenControllerResponder,
5338    )> {
5339        if let RealmRequest::OpenController { child, controller, responder } = self {
5340            Some((child, controller, responder))
5341        } else {
5342            None
5343        }
5344    }
5345
5346    #[allow(irrefutable_let_patterns)]
5347    pub fn into_open_exposed_dir(
5348        self,
5349    ) -> Option<(
5350        fidl_fuchsia_component_decl::ChildRef,
5351        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5352        RealmOpenExposedDirResponder,
5353    )> {
5354        if let RealmRequest::OpenExposedDir { child, exposed_dir, responder } = self {
5355            Some((child, exposed_dir, responder))
5356        } else {
5357            None
5358        }
5359    }
5360
5361    #[allow(irrefutable_let_patterns)]
5362    pub fn into_create_child(
5363        self,
5364    ) -> Option<(
5365        fidl_fuchsia_component_decl::CollectionRef,
5366        fidl_fuchsia_component_decl::Child,
5367        CreateChildArgs,
5368        RealmCreateChildResponder,
5369    )> {
5370        if let RealmRequest::CreateChild { collection, decl, args, responder } = self {
5371            Some((collection, decl, args, responder))
5372        } else {
5373            None
5374        }
5375    }
5376
5377    #[allow(irrefutable_let_patterns)]
5378    pub fn into_destroy_child(
5379        self,
5380    ) -> Option<(fidl_fuchsia_component_decl::ChildRef, RealmDestroyChildResponder)> {
5381        if let RealmRequest::DestroyChild { child, responder } = self {
5382            Some((child, responder))
5383        } else {
5384            None
5385        }
5386    }
5387
5388    #[allow(irrefutable_let_patterns)]
5389    pub fn into_list_children(
5390        self,
5391    ) -> Option<(
5392        fidl_fuchsia_component_decl::CollectionRef,
5393        fidl::endpoints::ServerEnd<ChildIteratorMarker>,
5394        RealmListChildrenResponder,
5395    )> {
5396        if let RealmRequest::ListChildren { collection, iter, responder } = self {
5397            Some((collection, iter, responder))
5398        } else {
5399            None
5400        }
5401    }
5402
5403    #[allow(irrefutable_let_patterns)]
5404    pub fn into_get_resolved_info(self) -> Option<(RealmGetResolvedInfoResponder)> {
5405        if let RealmRequest::GetResolvedInfo { responder } = self {
5406            Some((responder))
5407        } else {
5408            None
5409        }
5410    }
5411
5412    #[allow(irrefutable_let_patterns)]
5413    pub fn into_get_child_output_dictionary(
5414        self,
5415    ) -> Option<(fidl_fuchsia_component_decl::ChildRef, RealmGetChildOutputDictionaryResponder)>
5416    {
5417        if let RealmRequest::GetChildOutputDictionary { child, responder } = self {
5418            Some((child, responder))
5419        } else {
5420            None
5421        }
5422    }
5423
5424    /// Name of the method defined in FIDL
5425    pub fn method_name(&self) -> &'static str {
5426        match *self {
5427            RealmRequest::OpenController { .. } => "open_controller",
5428            RealmRequest::OpenExposedDir { .. } => "open_exposed_dir",
5429            RealmRequest::CreateChild { .. } => "create_child",
5430            RealmRequest::DestroyChild { .. } => "destroy_child",
5431            RealmRequest::ListChildren { .. } => "list_children",
5432            RealmRequest::GetResolvedInfo { .. } => "get_resolved_info",
5433            RealmRequest::GetChildOutputDictionary { .. } => "get_child_output_dictionary",
5434        }
5435    }
5436}
5437
5438#[derive(Debug, Clone)]
5439pub struct RealmControlHandle {
5440    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5441}
5442
5443impl fidl::endpoints::ControlHandle for RealmControlHandle {
5444    fn shutdown(&self) {
5445        self.inner.shutdown()
5446    }
5447    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5448        self.inner.shutdown_with_epitaph(status)
5449    }
5450
5451    fn is_closed(&self) -> bool {
5452        self.inner.channel().is_closed()
5453    }
5454    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5455        self.inner.channel().on_closed()
5456    }
5457
5458    #[cfg(target_os = "fuchsia")]
5459    fn signal_peer(
5460        &self,
5461        clear_mask: zx::Signals,
5462        set_mask: zx::Signals,
5463    ) -> Result<(), zx_status::Status> {
5464        use fidl::Peered;
5465        self.inner.channel().signal_peer(clear_mask, set_mask)
5466    }
5467}
5468
5469impl RealmControlHandle {}
5470
5471#[must_use = "FIDL methods require a response to be sent"]
5472#[derive(Debug)]
5473pub struct RealmOpenControllerResponder {
5474    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5475    tx_id: u32,
5476}
5477
5478/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5479/// if the responder is dropped without sending a response, so that the client
5480/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5481impl std::ops::Drop for RealmOpenControllerResponder {
5482    fn drop(&mut self) {
5483        self.control_handle.shutdown();
5484        // Safety: drops once, never accessed again
5485        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5486    }
5487}
5488
5489impl fidl::endpoints::Responder for RealmOpenControllerResponder {
5490    type ControlHandle = RealmControlHandle;
5491
5492    fn control_handle(&self) -> &RealmControlHandle {
5493        &self.control_handle
5494    }
5495
5496    fn drop_without_shutdown(mut self) {
5497        // Safety: drops once, never accessed again due to mem::forget
5498        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5499        // Prevent Drop from running (which would shut down the channel)
5500        std::mem::forget(self);
5501    }
5502}
5503
5504impl RealmOpenControllerResponder {
5505    /// Sends a response to the FIDL transaction.
5506    ///
5507    /// Sets the channel to shutdown if an error occurs.
5508    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5509        let _result = self.send_raw(result);
5510        if _result.is_err() {
5511            self.control_handle.shutdown();
5512        }
5513        self.drop_without_shutdown();
5514        _result
5515    }
5516
5517    /// Similar to "send" but does not shutdown the channel if an error occurs.
5518    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5519        let _result = self.send_raw(result);
5520        self.drop_without_shutdown();
5521        _result
5522    }
5523
5524    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5525        self.control_handle
5526            .inner
5527            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5528                result,
5529                self.tx_id,
5530                0x7150b7898d1b1180,
5531                fidl::encoding::DynamicFlags::empty(),
5532            )
5533    }
5534}
5535
5536#[must_use = "FIDL methods require a response to be sent"]
5537#[derive(Debug)]
5538pub struct RealmOpenExposedDirResponder {
5539    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5540    tx_id: u32,
5541}
5542
5543/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5544/// if the responder is dropped without sending a response, so that the client
5545/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5546impl std::ops::Drop for RealmOpenExposedDirResponder {
5547    fn drop(&mut self) {
5548        self.control_handle.shutdown();
5549        // Safety: drops once, never accessed again
5550        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5551    }
5552}
5553
5554impl fidl::endpoints::Responder for RealmOpenExposedDirResponder {
5555    type ControlHandle = RealmControlHandle;
5556
5557    fn control_handle(&self) -> &RealmControlHandle {
5558        &self.control_handle
5559    }
5560
5561    fn drop_without_shutdown(mut self) {
5562        // Safety: drops once, never accessed again due to mem::forget
5563        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5564        // Prevent Drop from running (which would shut down the channel)
5565        std::mem::forget(self);
5566    }
5567}
5568
5569impl RealmOpenExposedDirResponder {
5570    /// Sends a response to the FIDL transaction.
5571    ///
5572    /// Sets the channel to shutdown if an error occurs.
5573    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5574        let _result = self.send_raw(result);
5575        if _result.is_err() {
5576            self.control_handle.shutdown();
5577        }
5578        self.drop_without_shutdown();
5579        _result
5580    }
5581
5582    /// Similar to "send" but does not shutdown the channel if an error occurs.
5583    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5584        let _result = self.send_raw(result);
5585        self.drop_without_shutdown();
5586        _result
5587    }
5588
5589    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5590        self.control_handle
5591            .inner
5592            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5593                result,
5594                self.tx_id,
5595                0x7f993235ca59f92c,
5596                fidl::encoding::DynamicFlags::empty(),
5597            )
5598    }
5599}
5600
5601#[must_use = "FIDL methods require a response to be sent"]
5602#[derive(Debug)]
5603pub struct RealmCreateChildResponder {
5604    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5605    tx_id: u32,
5606}
5607
5608/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5609/// if the responder is dropped without sending a response, so that the client
5610/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5611impl std::ops::Drop for RealmCreateChildResponder {
5612    fn drop(&mut self) {
5613        self.control_handle.shutdown();
5614        // Safety: drops once, never accessed again
5615        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5616    }
5617}
5618
5619impl fidl::endpoints::Responder for RealmCreateChildResponder {
5620    type ControlHandle = RealmControlHandle;
5621
5622    fn control_handle(&self) -> &RealmControlHandle {
5623        &self.control_handle
5624    }
5625
5626    fn drop_without_shutdown(mut self) {
5627        // Safety: drops once, never accessed again due to mem::forget
5628        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5629        // Prevent Drop from running (which would shut down the channel)
5630        std::mem::forget(self);
5631    }
5632}
5633
5634impl RealmCreateChildResponder {
5635    /// Sends a response to the FIDL transaction.
5636    ///
5637    /// Sets the channel to shutdown if an error occurs.
5638    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5639        let _result = self.send_raw(result);
5640        if _result.is_err() {
5641            self.control_handle.shutdown();
5642        }
5643        self.drop_without_shutdown();
5644        _result
5645    }
5646
5647    /// Similar to "send" but does not shutdown the channel if an error occurs.
5648    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5649        let _result = self.send_raw(result);
5650        self.drop_without_shutdown();
5651        _result
5652    }
5653
5654    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5655        self.control_handle
5656            .inner
5657            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5658                result,
5659                self.tx_id,
5660                0x43e48ce8483d7560,
5661                fidl::encoding::DynamicFlags::empty(),
5662            )
5663    }
5664}
5665
5666#[must_use = "FIDL methods require a response to be sent"]
5667#[derive(Debug)]
5668pub struct RealmDestroyChildResponder {
5669    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5670    tx_id: u32,
5671}
5672
5673/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5674/// if the responder is dropped without sending a response, so that the client
5675/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5676impl std::ops::Drop for RealmDestroyChildResponder {
5677    fn drop(&mut self) {
5678        self.control_handle.shutdown();
5679        // Safety: drops once, never accessed again
5680        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5681    }
5682}
5683
5684impl fidl::endpoints::Responder for RealmDestroyChildResponder {
5685    type ControlHandle = RealmControlHandle;
5686
5687    fn control_handle(&self) -> &RealmControlHandle {
5688        &self.control_handle
5689    }
5690
5691    fn drop_without_shutdown(mut self) {
5692        // Safety: drops once, never accessed again due to mem::forget
5693        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5694        // Prevent Drop from running (which would shut down the channel)
5695        std::mem::forget(self);
5696    }
5697}
5698
5699impl RealmDestroyChildResponder {
5700    /// Sends a response to the FIDL transaction.
5701    ///
5702    /// Sets the channel to shutdown if an error occurs.
5703    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5704        let _result = self.send_raw(result);
5705        if _result.is_err() {
5706            self.control_handle.shutdown();
5707        }
5708        self.drop_without_shutdown();
5709        _result
5710    }
5711
5712    /// Similar to "send" but does not shutdown the channel if an error occurs.
5713    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5714        let _result = self.send_raw(result);
5715        self.drop_without_shutdown();
5716        _result
5717    }
5718
5719    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5720        self.control_handle
5721            .inner
5722            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5723                result,
5724                self.tx_id,
5725                0x71d8caf8850c9222,
5726                fidl::encoding::DynamicFlags::empty(),
5727            )
5728    }
5729}
5730
5731#[must_use = "FIDL methods require a response to be sent"]
5732#[derive(Debug)]
5733pub struct RealmListChildrenResponder {
5734    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5735    tx_id: u32,
5736}
5737
5738/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5739/// if the responder is dropped without sending a response, so that the client
5740/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5741impl std::ops::Drop for RealmListChildrenResponder {
5742    fn drop(&mut self) {
5743        self.control_handle.shutdown();
5744        // Safety: drops once, never accessed again
5745        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5746    }
5747}
5748
5749impl fidl::endpoints::Responder for RealmListChildrenResponder {
5750    type ControlHandle = RealmControlHandle;
5751
5752    fn control_handle(&self) -> &RealmControlHandle {
5753        &self.control_handle
5754    }
5755
5756    fn drop_without_shutdown(mut self) {
5757        // Safety: drops once, never accessed again due to mem::forget
5758        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5759        // Prevent Drop from running (which would shut down the channel)
5760        std::mem::forget(self);
5761    }
5762}
5763
5764impl RealmListChildrenResponder {
5765    /// Sends a response to the FIDL transaction.
5766    ///
5767    /// Sets the channel to shutdown if an error occurs.
5768    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5769        let _result = self.send_raw(result);
5770        if _result.is_err() {
5771            self.control_handle.shutdown();
5772        }
5773        self.drop_without_shutdown();
5774        _result
5775    }
5776
5777    /// Similar to "send" but does not shutdown the channel if an error occurs.
5778    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5779        let _result = self.send_raw(result);
5780        self.drop_without_shutdown();
5781        _result
5782    }
5783
5784    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
5785        self.control_handle
5786            .inner
5787            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
5788                result,
5789                self.tx_id,
5790                0x6888a76683efc0a1,
5791                fidl::encoding::DynamicFlags::empty(),
5792            )
5793    }
5794}
5795
5796#[must_use = "FIDL methods require a response to be sent"]
5797#[derive(Debug)]
5798pub struct RealmGetResolvedInfoResponder {
5799    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5800    tx_id: u32,
5801}
5802
5803/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5804/// if the responder is dropped without sending a response, so that the client
5805/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5806impl std::ops::Drop for RealmGetResolvedInfoResponder {
5807    fn drop(&mut self) {
5808        self.control_handle.shutdown();
5809        // Safety: drops once, never accessed again
5810        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5811    }
5812}
5813
5814impl fidl::endpoints::Responder for RealmGetResolvedInfoResponder {
5815    type ControlHandle = RealmControlHandle;
5816
5817    fn control_handle(&self) -> &RealmControlHandle {
5818        &self.control_handle
5819    }
5820
5821    fn drop_without_shutdown(mut self) {
5822        // Safety: drops once, never accessed again due to mem::forget
5823        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5824        // Prevent Drop from running (which would shut down the channel)
5825        std::mem::forget(self);
5826    }
5827}
5828
5829impl RealmGetResolvedInfoResponder {
5830    /// Sends a response to the FIDL transaction.
5831    ///
5832    /// Sets the channel to shutdown if an error occurs.
5833    pub fn send(
5834        self,
5835        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
5836    ) -> Result<(), fidl::Error> {
5837        let _result = self.send_raw(result);
5838        if _result.is_err() {
5839            self.control_handle.shutdown();
5840        }
5841        self.drop_without_shutdown();
5842        _result
5843    }
5844
5845    /// Similar to "send" but does not shutdown the channel if an error occurs.
5846    pub fn send_no_shutdown_on_err(
5847        self,
5848        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
5849    ) -> Result<(), fidl::Error> {
5850        let _result = self.send_raw(result);
5851        self.drop_without_shutdown();
5852        _result
5853    }
5854
5855    fn send_raw(
5856        &self,
5857        mut result: Result<fidl_fuchsia_component_resolution::Component, Error>,
5858    ) -> Result<(), fidl::Error> {
5859        self.control_handle
5860            .inner
5861            .send::<fidl::encoding::ResultType<RealmGetResolvedInfoResponse, Error>>(
5862                result.as_mut().map_err(|e| *e).map(|resolved_info| (resolved_info,)),
5863                self.tx_id,
5864                0x734f744cb7d210a2,
5865                fidl::encoding::DynamicFlags::empty(),
5866            )
5867    }
5868}
5869
5870#[must_use = "FIDL methods require a response to be sent"]
5871#[derive(Debug)]
5872pub struct RealmGetChildOutputDictionaryResponder {
5873    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5874    tx_id: u32,
5875}
5876
5877/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5878/// if the responder is dropped without sending a response, so that the client
5879/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5880impl std::ops::Drop for RealmGetChildOutputDictionaryResponder {
5881    fn drop(&mut self) {
5882        self.control_handle.shutdown();
5883        // Safety: drops once, never accessed again
5884        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5885    }
5886}
5887
5888impl fidl::endpoints::Responder for RealmGetChildOutputDictionaryResponder {
5889    type ControlHandle = RealmControlHandle;
5890
5891    fn control_handle(&self) -> &RealmControlHandle {
5892        &self.control_handle
5893    }
5894
5895    fn drop_without_shutdown(mut self) {
5896        // Safety: drops once, never accessed again due to mem::forget
5897        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5898        // Prevent Drop from running (which would shut down the channel)
5899        std::mem::forget(self);
5900    }
5901}
5902
5903impl RealmGetChildOutputDictionaryResponder {
5904    /// Sends a response to the FIDL transaction.
5905    ///
5906    /// Sets the channel to shutdown if an error occurs.
5907    pub fn send(
5908        self,
5909        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
5910    ) -> Result<(), fidl::Error> {
5911        let _result = self.send_raw(result);
5912        if _result.is_err() {
5913            self.control_handle.shutdown();
5914        }
5915        self.drop_without_shutdown();
5916        _result
5917    }
5918
5919    /// Similar to "send" but does not shutdown the channel if an error occurs.
5920    pub fn send_no_shutdown_on_err(
5921        self,
5922        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
5923    ) -> Result<(), fidl::Error> {
5924        let _result = self.send_raw(result);
5925        self.drop_without_shutdown();
5926        _result
5927    }
5928
5929    fn send_raw(
5930        &self,
5931        mut result: Result<fidl_fuchsia_component_sandbox::DictionaryRef, Error>,
5932    ) -> Result<(), fidl::Error> {
5933        self.control_handle.inner.send::<fidl::encoding::ResultType<
5934            RealmGetChildOutputDictionaryResponse,
5935            Error,
5936        >>(
5937            result.as_mut().map_err(|e| *e).map(|dictionary| (dictionary,)),
5938            self.tx_id,
5939            0x4259d08d261d5610,
5940            fidl::encoding::DynamicFlags::empty(),
5941        )
5942    }
5943}
5944
5945#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5946pub struct StorageAdminMarker;
5947
5948impl fidl::endpoints::ProtocolMarker for StorageAdminMarker {
5949    type Proxy = StorageAdminProxy;
5950    type RequestStream = StorageAdminRequestStream;
5951    #[cfg(target_os = "fuchsia")]
5952    type SynchronousProxy = StorageAdminSynchronousProxy;
5953
5954    const DEBUG_NAME: &'static str = "fuchsia.component.StorageAdmin";
5955}
5956impl fidl::endpoints::DiscoverableProtocolMarker for StorageAdminMarker {}
5957pub type StorageAdminOpenStorageResult = Result<(), Error>;
5958pub type StorageAdminListStorageInRealmResult = Result<(), Error>;
5959pub type StorageAdminOpenComponentStorageByIdResult = Result<(), Error>;
5960pub type StorageAdminDeleteComponentStorageResult = Result<(), Error>;
5961pub type StorageAdminGetStatusResult = Result<StorageStatus, StatusError>;
5962pub type StorageAdminDeleteAllStorageContentsResult = Result<(), DeletionError>;
5963
5964pub trait StorageAdminProxyInterface: Send + Sync {
5965    type OpenStorageResponseFut: std::future::Future<Output = Result<StorageAdminOpenStorageResult, fidl::Error>>
5966        + Send;
5967    fn r#open_storage(
5968        &self,
5969        relative_moniker: &str,
5970        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
5971    ) -> Self::OpenStorageResponseFut;
5972    type ListStorageInRealmResponseFut: std::future::Future<Output = Result<StorageAdminListStorageInRealmResult, fidl::Error>>
5973        + Send;
5974    fn r#list_storage_in_realm(
5975        &self,
5976        relative_moniker: &str,
5977        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
5978    ) -> Self::ListStorageInRealmResponseFut;
5979    type OpenComponentStorageByIdResponseFut: std::future::Future<
5980            Output = Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error>,
5981        > + Send;
5982    fn r#open_component_storage_by_id(
5983        &self,
5984        id: &str,
5985        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
5986    ) -> Self::OpenComponentStorageByIdResponseFut;
5987    type DeleteComponentStorageResponseFut: std::future::Future<Output = Result<StorageAdminDeleteComponentStorageResult, fidl::Error>>
5988        + Send;
5989    fn r#delete_component_storage(
5990        &self,
5991        relative_moniker: &str,
5992    ) -> Self::DeleteComponentStorageResponseFut;
5993    type GetStatusResponseFut: std::future::Future<Output = Result<StorageAdminGetStatusResult, fidl::Error>>
5994        + Send;
5995    fn r#get_status(&self) -> Self::GetStatusResponseFut;
5996    type DeleteAllStorageContentsResponseFut: std::future::Future<
5997            Output = Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error>,
5998        > + Send;
5999    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut;
6000}
6001#[derive(Debug)]
6002#[cfg(target_os = "fuchsia")]
6003pub struct StorageAdminSynchronousProxy {
6004    client: fidl::client::sync::Client,
6005}
6006
6007#[cfg(target_os = "fuchsia")]
6008impl fidl::endpoints::SynchronousProxy for StorageAdminSynchronousProxy {
6009    type Proxy = StorageAdminProxy;
6010    type Protocol = StorageAdminMarker;
6011
6012    fn from_channel(inner: fidl::Channel) -> Self {
6013        Self::new(inner)
6014    }
6015
6016    fn into_channel(self) -> fidl::Channel {
6017        self.client.into_channel()
6018    }
6019
6020    fn as_channel(&self) -> &fidl::Channel {
6021        self.client.as_channel()
6022    }
6023}
6024
6025#[cfg(target_os = "fuchsia")]
6026impl StorageAdminSynchronousProxy {
6027    pub fn new(channel: fidl::Channel) -> Self {
6028        let protocol_name = <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6029        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6030    }
6031
6032    pub fn into_channel(self) -> fidl::Channel {
6033        self.client.into_channel()
6034    }
6035
6036    /// Waits until an event arrives and returns it. It is safe for other
6037    /// threads to make concurrent requests while waiting for an event.
6038    pub fn wait_for_event(
6039        &self,
6040        deadline: zx::MonotonicInstant,
6041    ) -> Result<StorageAdminEvent, fidl::Error> {
6042        StorageAdminEvent::decode(self.client.wait_for_event(deadline)?)
6043    }
6044
6045    /// Opens the isolated directory for the given component. The provided
6046    /// moniker is relative to the component that declares the storage
6047    /// capability. Creates the backing sub-directory for this storage if it
6048    /// hasn't yet been created.
6049    pub fn r#open_storage(
6050        &self,
6051        mut relative_moniker: &str,
6052        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6053        ___deadline: zx::MonotonicInstant,
6054    ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
6055        let _response = self.client.send_query::<
6056            StorageAdminOpenStorageRequest,
6057            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6058        >(
6059            (relative_moniker, object,),
6060            0x6ceaa5904cfe4377,
6061            fidl::encoding::DynamicFlags::empty(),
6062            ___deadline,
6063        )?;
6064        Ok(_response.map(|x| x))
6065    }
6066
6067    /// Lists the descendant components under the specified realm that use the
6068    /// storage capability. The provided moniker is relative to the component
6069    /// that declares the storage capability.
6070    ///
6071    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
6072    /// if |relative_moniker| is malformed.
6073    pub fn r#list_storage_in_realm(
6074        &self,
6075        mut relative_moniker: &str,
6076        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6077        ___deadline: zx::MonotonicInstant,
6078    ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
6079        let _response = self.client.send_query::<
6080            StorageAdminListStorageInRealmRequest,
6081            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6082        >(
6083            (relative_moniker, iterator,),
6084            0x764f6d1f083e8bfb,
6085            fidl::encoding::DynamicFlags::empty(),
6086            ___deadline,
6087        )?;
6088        Ok(_response.map(|x| x))
6089    }
6090
6091    /// Opens the isolated directory for the given storage ID. Creates the
6092    /// backing sub-directory for this storage if it hasn't yet been created.
6093    pub fn r#open_component_storage_by_id(
6094        &self,
6095        mut id: &str,
6096        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6097        ___deadline: zx::MonotonicInstant,
6098    ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
6099        let _response = self.client.send_query::<
6100            StorageAdminOpenComponentStorageByIdRequest,
6101            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6102        >(
6103            (id, object,),
6104            0x4802102cc55d5df1,
6105            fidl::encoding::DynamicFlags::empty(),
6106            ___deadline,
6107        )?;
6108        Ok(_response.map(|x| x))
6109    }
6110
6111    /// Deletes the contents of the storage for this component. Preserves the
6112    /// component's subdirectory itself within the storage backing directory.
6113    /// The provided moniker is relative to the component that declares the
6114    /// storage capability.
6115    pub fn r#delete_component_storage(
6116        &self,
6117        mut relative_moniker: &str,
6118        ___deadline: zx::MonotonicInstant,
6119    ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
6120        let _response = self.client.send_query::<
6121            StorageAdminDeleteComponentStorageRequest,
6122            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6123        >(
6124            (relative_moniker,),
6125            0x1677c1cdfcdbf45a,
6126            fidl::encoding::DynamicFlags::empty(),
6127            ___deadline,
6128        )?;
6129        Ok(_response.map(|x| x))
6130    }
6131
6132    /// Get the current status of the storage.
6133    pub fn r#get_status(
6134        &self,
6135        ___deadline: zx::MonotonicInstant,
6136    ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
6137        let _response = self.client.send_query::<
6138            fidl::encoding::EmptyPayload,
6139            fidl::encoding::ResultType<StorageStatus, StatusError>,
6140        >(
6141            (),
6142            0x7729e325a6c526c8,
6143            fidl::encoding::DynamicFlags::empty(),
6144            ___deadline,
6145        )?;
6146        Ok(_response.map(|x| x))
6147    }
6148
6149    /// Deletes the contents of all the storage. Storage directories are
6150    /// retained so any components using storage will be able to continue using
6151    /// it to create new files and directories.
6152    ///
6153    /// Returns Error::INTERNAL only if no storage at all could be cleared.
6154    /// Returns successfully even if some errors happen during the deletion
6155    /// progress.
6156    pub fn r#delete_all_storage_contents(
6157        &self,
6158        ___deadline: zx::MonotonicInstant,
6159    ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
6160        let _response = self.client.send_query::<
6161            fidl::encoding::EmptyPayload,
6162            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
6163        >(
6164            (),
6165            0x2ee980b4b2d24adb,
6166            fidl::encoding::DynamicFlags::empty(),
6167            ___deadline,
6168        )?;
6169        Ok(_response.map(|x| x))
6170    }
6171}
6172
6173#[cfg(target_os = "fuchsia")]
6174impl From<StorageAdminSynchronousProxy> for zx::Handle {
6175    fn from(value: StorageAdminSynchronousProxy) -> Self {
6176        value.into_channel().into()
6177    }
6178}
6179
6180#[cfg(target_os = "fuchsia")]
6181impl From<fidl::Channel> for StorageAdminSynchronousProxy {
6182    fn from(value: fidl::Channel) -> Self {
6183        Self::new(value)
6184    }
6185}
6186
6187#[cfg(target_os = "fuchsia")]
6188impl fidl::endpoints::FromClient for StorageAdminSynchronousProxy {
6189    type Protocol = StorageAdminMarker;
6190
6191    fn from_client(value: fidl::endpoints::ClientEnd<StorageAdminMarker>) -> Self {
6192        Self::new(value.into_channel())
6193    }
6194}
6195
6196#[derive(Debug, Clone)]
6197pub struct StorageAdminProxy {
6198    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6199}
6200
6201impl fidl::endpoints::Proxy for StorageAdminProxy {
6202    type Protocol = StorageAdminMarker;
6203
6204    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6205        Self::new(inner)
6206    }
6207
6208    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6209        self.client.into_channel().map_err(|client| Self { client })
6210    }
6211
6212    fn as_channel(&self) -> &::fidl::AsyncChannel {
6213        self.client.as_channel()
6214    }
6215}
6216
6217impl StorageAdminProxy {
6218    /// Create a new Proxy for fuchsia.component/StorageAdmin.
6219    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6220        let protocol_name = <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6221        Self { client: fidl::client::Client::new(channel, protocol_name) }
6222    }
6223
6224    /// Get a Stream of events from the remote end of the protocol.
6225    ///
6226    /// # Panics
6227    ///
6228    /// Panics if the event stream was already taken.
6229    pub fn take_event_stream(&self) -> StorageAdminEventStream {
6230        StorageAdminEventStream { event_receiver: self.client.take_event_receiver() }
6231    }
6232
6233    /// Opens the isolated directory for the given component. The provided
6234    /// moniker is relative to the component that declares the storage
6235    /// capability. Creates the backing sub-directory for this storage if it
6236    /// hasn't yet been created.
6237    pub fn r#open_storage(
6238        &self,
6239        mut relative_moniker: &str,
6240        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6241    ) -> fidl::client::QueryResponseFut<
6242        StorageAdminOpenStorageResult,
6243        fidl::encoding::DefaultFuchsiaResourceDialect,
6244    > {
6245        StorageAdminProxyInterface::r#open_storage(self, relative_moniker, object)
6246    }
6247
6248    /// Lists the descendant components under the specified realm that use the
6249    /// storage capability. The provided moniker is relative to the component
6250    /// that declares the storage capability.
6251    ///
6252    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
6253    /// if |relative_moniker| is malformed.
6254    pub fn r#list_storage_in_realm(
6255        &self,
6256        mut relative_moniker: &str,
6257        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6258    ) -> fidl::client::QueryResponseFut<
6259        StorageAdminListStorageInRealmResult,
6260        fidl::encoding::DefaultFuchsiaResourceDialect,
6261    > {
6262        StorageAdminProxyInterface::r#list_storage_in_realm(self, relative_moniker, iterator)
6263    }
6264
6265    /// Opens the isolated directory for the given storage ID. Creates the
6266    /// backing sub-directory for this storage if it hasn't yet been created.
6267    pub fn r#open_component_storage_by_id(
6268        &self,
6269        mut id: &str,
6270        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6271    ) -> fidl::client::QueryResponseFut<
6272        StorageAdminOpenComponentStorageByIdResult,
6273        fidl::encoding::DefaultFuchsiaResourceDialect,
6274    > {
6275        StorageAdminProxyInterface::r#open_component_storage_by_id(self, id, object)
6276    }
6277
6278    /// Deletes the contents of the storage for this component. Preserves the
6279    /// component's subdirectory itself within the storage backing directory.
6280    /// The provided moniker is relative to the component that declares the
6281    /// storage capability.
6282    pub fn r#delete_component_storage(
6283        &self,
6284        mut relative_moniker: &str,
6285    ) -> fidl::client::QueryResponseFut<
6286        StorageAdminDeleteComponentStorageResult,
6287        fidl::encoding::DefaultFuchsiaResourceDialect,
6288    > {
6289        StorageAdminProxyInterface::r#delete_component_storage(self, relative_moniker)
6290    }
6291
6292    /// Get the current status of the storage.
6293    pub fn r#get_status(
6294        &self,
6295    ) -> fidl::client::QueryResponseFut<
6296        StorageAdminGetStatusResult,
6297        fidl::encoding::DefaultFuchsiaResourceDialect,
6298    > {
6299        StorageAdminProxyInterface::r#get_status(self)
6300    }
6301
6302    /// Deletes the contents of all the storage. Storage directories are
6303    /// retained so any components using storage will be able to continue using
6304    /// it to create new files and directories.
6305    ///
6306    /// Returns Error::INTERNAL only if no storage at all could be cleared.
6307    /// Returns successfully even if some errors happen during the deletion
6308    /// progress.
6309    pub fn r#delete_all_storage_contents(
6310        &self,
6311    ) -> fidl::client::QueryResponseFut<
6312        StorageAdminDeleteAllStorageContentsResult,
6313        fidl::encoding::DefaultFuchsiaResourceDialect,
6314    > {
6315        StorageAdminProxyInterface::r#delete_all_storage_contents(self)
6316    }
6317}
6318
6319impl StorageAdminProxyInterface for StorageAdminProxy {
6320    type OpenStorageResponseFut = fidl::client::QueryResponseFut<
6321        StorageAdminOpenStorageResult,
6322        fidl::encoding::DefaultFuchsiaResourceDialect,
6323    >;
6324    fn r#open_storage(
6325        &self,
6326        mut relative_moniker: &str,
6327        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6328    ) -> Self::OpenStorageResponseFut {
6329        fn _decode(
6330            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6331        ) -> Result<StorageAdminOpenStorageResult, fidl::Error> {
6332            let _response = fidl::client::decode_transaction_body::<
6333                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6334                fidl::encoding::DefaultFuchsiaResourceDialect,
6335                0x6ceaa5904cfe4377,
6336            >(_buf?)?;
6337            Ok(_response.map(|x| x))
6338        }
6339        self.client
6340            .send_query_and_decode::<StorageAdminOpenStorageRequest, StorageAdminOpenStorageResult>(
6341                (relative_moniker, object),
6342                0x6ceaa5904cfe4377,
6343                fidl::encoding::DynamicFlags::empty(),
6344                _decode,
6345            )
6346    }
6347
6348    type ListStorageInRealmResponseFut = fidl::client::QueryResponseFut<
6349        StorageAdminListStorageInRealmResult,
6350        fidl::encoding::DefaultFuchsiaResourceDialect,
6351    >;
6352    fn r#list_storage_in_realm(
6353        &self,
6354        mut relative_moniker: &str,
6355        mut iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6356    ) -> Self::ListStorageInRealmResponseFut {
6357        fn _decode(
6358            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6359        ) -> Result<StorageAdminListStorageInRealmResult, fidl::Error> {
6360            let _response = fidl::client::decode_transaction_body::<
6361                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6362                fidl::encoding::DefaultFuchsiaResourceDialect,
6363                0x764f6d1f083e8bfb,
6364            >(_buf?)?;
6365            Ok(_response.map(|x| x))
6366        }
6367        self.client.send_query_and_decode::<
6368            StorageAdminListStorageInRealmRequest,
6369            StorageAdminListStorageInRealmResult,
6370        >(
6371            (relative_moniker, iterator,),
6372            0x764f6d1f083e8bfb,
6373            fidl::encoding::DynamicFlags::empty(),
6374            _decode,
6375        )
6376    }
6377
6378    type OpenComponentStorageByIdResponseFut = fidl::client::QueryResponseFut<
6379        StorageAdminOpenComponentStorageByIdResult,
6380        fidl::encoding::DefaultFuchsiaResourceDialect,
6381    >;
6382    fn r#open_component_storage_by_id(
6383        &self,
6384        mut id: &str,
6385        mut object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6386    ) -> Self::OpenComponentStorageByIdResponseFut {
6387        fn _decode(
6388            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6389        ) -> Result<StorageAdminOpenComponentStorageByIdResult, fidl::Error> {
6390            let _response = fidl::client::decode_transaction_body::<
6391                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6392                fidl::encoding::DefaultFuchsiaResourceDialect,
6393                0x4802102cc55d5df1,
6394            >(_buf?)?;
6395            Ok(_response.map(|x| x))
6396        }
6397        self.client.send_query_and_decode::<
6398            StorageAdminOpenComponentStorageByIdRequest,
6399            StorageAdminOpenComponentStorageByIdResult,
6400        >(
6401            (id, object,),
6402            0x4802102cc55d5df1,
6403            fidl::encoding::DynamicFlags::empty(),
6404            _decode,
6405        )
6406    }
6407
6408    type DeleteComponentStorageResponseFut = fidl::client::QueryResponseFut<
6409        StorageAdminDeleteComponentStorageResult,
6410        fidl::encoding::DefaultFuchsiaResourceDialect,
6411    >;
6412    fn r#delete_component_storage(
6413        &self,
6414        mut relative_moniker: &str,
6415    ) -> Self::DeleteComponentStorageResponseFut {
6416        fn _decode(
6417            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6418        ) -> Result<StorageAdminDeleteComponentStorageResult, fidl::Error> {
6419            let _response = fidl::client::decode_transaction_body::<
6420                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
6421                fidl::encoding::DefaultFuchsiaResourceDialect,
6422                0x1677c1cdfcdbf45a,
6423            >(_buf?)?;
6424            Ok(_response.map(|x| x))
6425        }
6426        self.client.send_query_and_decode::<
6427            StorageAdminDeleteComponentStorageRequest,
6428            StorageAdminDeleteComponentStorageResult,
6429        >(
6430            (relative_moniker,),
6431            0x1677c1cdfcdbf45a,
6432            fidl::encoding::DynamicFlags::empty(),
6433            _decode,
6434        )
6435    }
6436
6437    type GetStatusResponseFut = fidl::client::QueryResponseFut<
6438        StorageAdminGetStatusResult,
6439        fidl::encoding::DefaultFuchsiaResourceDialect,
6440    >;
6441    fn r#get_status(&self) -> Self::GetStatusResponseFut {
6442        fn _decode(
6443            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6444        ) -> Result<StorageAdminGetStatusResult, fidl::Error> {
6445            let _response = fidl::client::decode_transaction_body::<
6446                fidl::encoding::ResultType<StorageStatus, StatusError>,
6447                fidl::encoding::DefaultFuchsiaResourceDialect,
6448                0x7729e325a6c526c8,
6449            >(_buf?)?;
6450            Ok(_response.map(|x| x))
6451        }
6452        self.client
6453            .send_query_and_decode::<fidl::encoding::EmptyPayload, StorageAdminGetStatusResult>(
6454                (),
6455                0x7729e325a6c526c8,
6456                fidl::encoding::DynamicFlags::empty(),
6457                _decode,
6458            )
6459    }
6460
6461    type DeleteAllStorageContentsResponseFut = fidl::client::QueryResponseFut<
6462        StorageAdminDeleteAllStorageContentsResult,
6463        fidl::encoding::DefaultFuchsiaResourceDialect,
6464    >;
6465    fn r#delete_all_storage_contents(&self) -> Self::DeleteAllStorageContentsResponseFut {
6466        fn _decode(
6467            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6468        ) -> Result<StorageAdminDeleteAllStorageContentsResult, fidl::Error> {
6469            let _response = fidl::client::decode_transaction_body::<
6470                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DeletionError>,
6471                fidl::encoding::DefaultFuchsiaResourceDialect,
6472                0x2ee980b4b2d24adb,
6473            >(_buf?)?;
6474            Ok(_response.map(|x| x))
6475        }
6476        self.client.send_query_and_decode::<
6477            fidl::encoding::EmptyPayload,
6478            StorageAdminDeleteAllStorageContentsResult,
6479        >(
6480            (),
6481            0x2ee980b4b2d24adb,
6482            fidl::encoding::DynamicFlags::empty(),
6483            _decode,
6484        )
6485    }
6486}
6487
6488pub struct StorageAdminEventStream {
6489    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6490}
6491
6492impl std::marker::Unpin for StorageAdminEventStream {}
6493
6494impl futures::stream::FusedStream for StorageAdminEventStream {
6495    fn is_terminated(&self) -> bool {
6496        self.event_receiver.is_terminated()
6497    }
6498}
6499
6500impl futures::Stream for StorageAdminEventStream {
6501    type Item = Result<StorageAdminEvent, fidl::Error>;
6502
6503    fn poll_next(
6504        mut self: std::pin::Pin<&mut Self>,
6505        cx: &mut std::task::Context<'_>,
6506    ) -> std::task::Poll<Option<Self::Item>> {
6507        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6508            &mut self.event_receiver,
6509            cx
6510        )?) {
6511            Some(buf) => std::task::Poll::Ready(Some(StorageAdminEvent::decode(buf))),
6512            None => std::task::Poll::Ready(None),
6513        }
6514    }
6515}
6516
6517#[derive(Debug)]
6518pub enum StorageAdminEvent {}
6519
6520impl StorageAdminEvent {
6521    /// Decodes a message buffer as a [`StorageAdminEvent`].
6522    fn decode(
6523        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6524    ) -> Result<StorageAdminEvent, fidl::Error> {
6525        let (bytes, _handles) = buf.split_mut();
6526        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6527        debug_assert_eq!(tx_header.tx_id, 0);
6528        match tx_header.ordinal {
6529            _ => Err(fidl::Error::UnknownOrdinal {
6530                ordinal: tx_header.ordinal,
6531                protocol_name: <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6532            }),
6533        }
6534    }
6535}
6536
6537/// A Stream of incoming requests for fuchsia.component/StorageAdmin.
6538pub struct StorageAdminRequestStream {
6539    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6540    is_terminated: bool,
6541}
6542
6543impl std::marker::Unpin for StorageAdminRequestStream {}
6544
6545impl futures::stream::FusedStream for StorageAdminRequestStream {
6546    fn is_terminated(&self) -> bool {
6547        self.is_terminated
6548    }
6549}
6550
6551impl fidl::endpoints::RequestStream for StorageAdminRequestStream {
6552    type Protocol = StorageAdminMarker;
6553    type ControlHandle = StorageAdminControlHandle;
6554
6555    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6556        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6557    }
6558
6559    fn control_handle(&self) -> Self::ControlHandle {
6560        StorageAdminControlHandle { inner: self.inner.clone() }
6561    }
6562
6563    fn into_inner(
6564        self,
6565    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6566    {
6567        (self.inner, self.is_terminated)
6568    }
6569
6570    fn from_inner(
6571        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6572        is_terminated: bool,
6573    ) -> Self {
6574        Self { inner, is_terminated }
6575    }
6576}
6577
6578impl futures::Stream for StorageAdminRequestStream {
6579    type Item = Result<StorageAdminRequest, fidl::Error>;
6580
6581    fn poll_next(
6582        mut self: std::pin::Pin<&mut Self>,
6583        cx: &mut std::task::Context<'_>,
6584    ) -> std::task::Poll<Option<Self::Item>> {
6585        let this = &mut *self;
6586        if this.inner.check_shutdown(cx) {
6587            this.is_terminated = true;
6588            return std::task::Poll::Ready(None);
6589        }
6590        if this.is_terminated {
6591            panic!("polled StorageAdminRequestStream after completion");
6592        }
6593        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6594            |bytes, handles| {
6595                match this.inner.channel().read_etc(cx, bytes, handles) {
6596                    std::task::Poll::Ready(Ok(())) => {}
6597                    std::task::Poll::Pending => return std::task::Poll::Pending,
6598                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6599                        this.is_terminated = true;
6600                        return std::task::Poll::Ready(None);
6601                    }
6602                    std::task::Poll::Ready(Err(e)) => {
6603                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6604                            e.into(),
6605                        ))));
6606                    }
6607                }
6608
6609                // A message has been received from the channel
6610                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6611
6612                std::task::Poll::Ready(Some(match header.ordinal {
6613                    0x6ceaa5904cfe4377 => {
6614                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6615                        let mut req = fidl::new_empty!(
6616                            StorageAdminOpenStorageRequest,
6617                            fidl::encoding::DefaultFuchsiaResourceDialect
6618                        );
6619                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenStorageRequest>(&header, _body_bytes, handles, &mut req)?;
6620                        let control_handle =
6621                            StorageAdminControlHandle { inner: this.inner.clone() };
6622                        Ok(StorageAdminRequest::OpenStorage {
6623                            relative_moniker: req.relative_moniker,
6624                            object: req.object,
6625
6626                            responder: StorageAdminOpenStorageResponder {
6627                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6628                                tx_id: header.tx_id,
6629                            },
6630                        })
6631                    }
6632                    0x764f6d1f083e8bfb => {
6633                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6634                        let mut req = fidl::new_empty!(
6635                            StorageAdminListStorageInRealmRequest,
6636                            fidl::encoding::DefaultFuchsiaResourceDialect
6637                        );
6638                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminListStorageInRealmRequest>(&header, _body_bytes, handles, &mut req)?;
6639                        let control_handle =
6640                            StorageAdminControlHandle { inner: this.inner.clone() };
6641                        Ok(StorageAdminRequest::ListStorageInRealm {
6642                            relative_moniker: req.relative_moniker,
6643                            iterator: req.iterator,
6644
6645                            responder: StorageAdminListStorageInRealmResponder {
6646                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6647                                tx_id: header.tx_id,
6648                            },
6649                        })
6650                    }
6651                    0x4802102cc55d5df1 => {
6652                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6653                        let mut req = fidl::new_empty!(
6654                            StorageAdminOpenComponentStorageByIdRequest,
6655                            fidl::encoding::DefaultFuchsiaResourceDialect
6656                        );
6657                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminOpenComponentStorageByIdRequest>(&header, _body_bytes, handles, &mut req)?;
6658                        let control_handle =
6659                            StorageAdminControlHandle { inner: this.inner.clone() };
6660                        Ok(StorageAdminRequest::OpenComponentStorageById {
6661                            id: req.id,
6662                            object: req.object,
6663
6664                            responder: StorageAdminOpenComponentStorageByIdResponder {
6665                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6666                                tx_id: header.tx_id,
6667                            },
6668                        })
6669                    }
6670                    0x1677c1cdfcdbf45a => {
6671                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6672                        let mut req = fidl::new_empty!(
6673                            StorageAdminDeleteComponentStorageRequest,
6674                            fidl::encoding::DefaultFuchsiaResourceDialect
6675                        );
6676                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StorageAdminDeleteComponentStorageRequest>(&header, _body_bytes, handles, &mut req)?;
6677                        let control_handle =
6678                            StorageAdminControlHandle { inner: this.inner.clone() };
6679                        Ok(StorageAdminRequest::DeleteComponentStorage {
6680                            relative_moniker: req.relative_moniker,
6681
6682                            responder: StorageAdminDeleteComponentStorageResponder {
6683                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6684                                tx_id: header.tx_id,
6685                            },
6686                        })
6687                    }
6688                    0x7729e325a6c526c8 => {
6689                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6690                        let mut req = fidl::new_empty!(
6691                            fidl::encoding::EmptyPayload,
6692                            fidl::encoding::DefaultFuchsiaResourceDialect
6693                        );
6694                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6695                        let control_handle =
6696                            StorageAdminControlHandle { inner: this.inner.clone() };
6697                        Ok(StorageAdminRequest::GetStatus {
6698                            responder: StorageAdminGetStatusResponder {
6699                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6700                                tx_id: header.tx_id,
6701                            },
6702                        })
6703                    }
6704                    0x2ee980b4b2d24adb => {
6705                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6706                        let mut req = fidl::new_empty!(
6707                            fidl::encoding::EmptyPayload,
6708                            fidl::encoding::DefaultFuchsiaResourceDialect
6709                        );
6710                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6711                        let control_handle =
6712                            StorageAdminControlHandle { inner: this.inner.clone() };
6713                        Ok(StorageAdminRequest::DeleteAllStorageContents {
6714                            responder: StorageAdminDeleteAllStorageContentsResponder {
6715                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6716                                tx_id: header.tx_id,
6717                            },
6718                        })
6719                    }
6720                    _ => Err(fidl::Error::UnknownOrdinal {
6721                        ordinal: header.ordinal,
6722                        protocol_name:
6723                            <StorageAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6724                    }),
6725                }))
6726            },
6727        )
6728    }
6729}
6730
6731#[derive(Debug)]
6732pub enum StorageAdminRequest {
6733    /// Opens the isolated directory for the given component. The provided
6734    /// moniker is relative to the component that declares the storage
6735    /// capability. Creates the backing sub-directory for this storage if it
6736    /// hasn't yet been created.
6737    OpenStorage {
6738        relative_moniker: String,
6739        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6740        responder: StorageAdminOpenStorageResponder,
6741    },
6742    /// Lists the descendant components under the specified realm that use the
6743    /// storage capability. The provided moniker is relative to the component
6744    /// that declares the storage capability.
6745    ///
6746    /// Returns INSTANCE_NOT_FOUND if the realm does not exist, and INVALID_ARGS
6747    /// if |relative_moniker| is malformed.
6748    ListStorageInRealm {
6749        relative_moniker: String,
6750        iterator: fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6751        responder: StorageAdminListStorageInRealmResponder,
6752    },
6753    /// Opens the isolated directory for the given storage ID. Creates the
6754    /// backing sub-directory for this storage if it hasn't yet been created.
6755    OpenComponentStorageById {
6756        id: String,
6757        object: fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6758        responder: StorageAdminOpenComponentStorageByIdResponder,
6759    },
6760    /// Deletes the contents of the storage for this component. Preserves the
6761    /// component's subdirectory itself within the storage backing directory.
6762    /// The provided moniker is relative to the component that declares the
6763    /// storage capability.
6764    DeleteComponentStorage {
6765        relative_moniker: String,
6766        responder: StorageAdminDeleteComponentStorageResponder,
6767    },
6768    /// Get the current status of the storage.
6769    GetStatus { responder: StorageAdminGetStatusResponder },
6770    /// Deletes the contents of all the storage. Storage directories are
6771    /// retained so any components using storage will be able to continue using
6772    /// it to create new files and directories.
6773    ///
6774    /// Returns Error::INTERNAL only if no storage at all could be cleared.
6775    /// Returns successfully even if some errors happen during the deletion
6776    /// progress.
6777    DeleteAllStorageContents { responder: StorageAdminDeleteAllStorageContentsResponder },
6778}
6779
6780impl StorageAdminRequest {
6781    #[allow(irrefutable_let_patterns)]
6782    pub fn into_open_storage(
6783        self,
6784    ) -> Option<(
6785        String,
6786        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6787        StorageAdminOpenStorageResponder,
6788    )> {
6789        if let StorageAdminRequest::OpenStorage { relative_moniker, object, responder } = self {
6790            Some((relative_moniker, object, responder))
6791        } else {
6792            None
6793        }
6794    }
6795
6796    #[allow(irrefutable_let_patterns)]
6797    pub fn into_list_storage_in_realm(
6798        self,
6799    ) -> Option<(
6800        String,
6801        fidl::endpoints::ServerEnd<StorageIteratorMarker>,
6802        StorageAdminListStorageInRealmResponder,
6803    )> {
6804        if let StorageAdminRequest::ListStorageInRealm { relative_moniker, iterator, responder } =
6805            self
6806        {
6807            Some((relative_moniker, iterator, responder))
6808        } else {
6809            None
6810        }
6811    }
6812
6813    #[allow(irrefutable_let_patterns)]
6814    pub fn into_open_component_storage_by_id(
6815        self,
6816    ) -> Option<(
6817        String,
6818        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
6819        StorageAdminOpenComponentStorageByIdResponder,
6820    )> {
6821        if let StorageAdminRequest::OpenComponentStorageById { id, object, responder } = self {
6822            Some((id, object, responder))
6823        } else {
6824            None
6825        }
6826    }
6827
6828    #[allow(irrefutable_let_patterns)]
6829    pub fn into_delete_component_storage(
6830        self,
6831    ) -> Option<(String, StorageAdminDeleteComponentStorageResponder)> {
6832        if let StorageAdminRequest::DeleteComponentStorage { relative_moniker, responder } = self {
6833            Some((relative_moniker, responder))
6834        } else {
6835            None
6836        }
6837    }
6838
6839    #[allow(irrefutable_let_patterns)]
6840    pub fn into_get_status(self) -> Option<(StorageAdminGetStatusResponder)> {
6841        if let StorageAdminRequest::GetStatus { responder } = self {
6842            Some((responder))
6843        } else {
6844            None
6845        }
6846    }
6847
6848    #[allow(irrefutable_let_patterns)]
6849    pub fn into_delete_all_storage_contents(
6850        self,
6851    ) -> Option<(StorageAdminDeleteAllStorageContentsResponder)> {
6852        if let StorageAdminRequest::DeleteAllStorageContents { responder } = self {
6853            Some((responder))
6854        } else {
6855            None
6856        }
6857    }
6858
6859    /// Name of the method defined in FIDL
6860    pub fn method_name(&self) -> &'static str {
6861        match *self {
6862            StorageAdminRequest::OpenStorage { .. } => "open_storage",
6863            StorageAdminRequest::ListStorageInRealm { .. } => "list_storage_in_realm",
6864            StorageAdminRequest::OpenComponentStorageById { .. } => "open_component_storage_by_id",
6865            StorageAdminRequest::DeleteComponentStorage { .. } => "delete_component_storage",
6866            StorageAdminRequest::GetStatus { .. } => "get_status",
6867            StorageAdminRequest::DeleteAllStorageContents { .. } => "delete_all_storage_contents",
6868        }
6869    }
6870}
6871
6872#[derive(Debug, Clone)]
6873pub struct StorageAdminControlHandle {
6874    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6875}
6876
6877impl fidl::endpoints::ControlHandle for StorageAdminControlHandle {
6878    fn shutdown(&self) {
6879        self.inner.shutdown()
6880    }
6881    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6882        self.inner.shutdown_with_epitaph(status)
6883    }
6884
6885    fn is_closed(&self) -> bool {
6886        self.inner.channel().is_closed()
6887    }
6888    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6889        self.inner.channel().on_closed()
6890    }
6891
6892    #[cfg(target_os = "fuchsia")]
6893    fn signal_peer(
6894        &self,
6895        clear_mask: zx::Signals,
6896        set_mask: zx::Signals,
6897    ) -> Result<(), zx_status::Status> {
6898        use fidl::Peered;
6899        self.inner.channel().signal_peer(clear_mask, set_mask)
6900    }
6901}
6902
6903impl StorageAdminControlHandle {}
6904
6905#[must_use = "FIDL methods require a response to be sent"]
6906#[derive(Debug)]
6907pub struct StorageAdminOpenStorageResponder {
6908    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
6909    tx_id: u32,
6910}
6911
6912/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
6913/// if the responder is dropped without sending a response, so that the client
6914/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6915impl std::ops::Drop for StorageAdminOpenStorageResponder {
6916    fn drop(&mut self) {
6917        self.control_handle.shutdown();
6918        // Safety: drops once, never accessed again
6919        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6920    }
6921}
6922
6923impl fidl::endpoints::Responder for StorageAdminOpenStorageResponder {
6924    type ControlHandle = StorageAdminControlHandle;
6925
6926    fn control_handle(&self) -> &StorageAdminControlHandle {
6927        &self.control_handle
6928    }
6929
6930    fn drop_without_shutdown(mut self) {
6931        // Safety: drops once, never accessed again due to mem::forget
6932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6933        // Prevent Drop from running (which would shut down the channel)
6934        std::mem::forget(self);
6935    }
6936}
6937
6938impl StorageAdminOpenStorageResponder {
6939    /// Sends a response to the FIDL transaction.
6940    ///
6941    /// Sets the channel to shutdown if an error occurs.
6942    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6943        let _result = self.send_raw(result);
6944        if _result.is_err() {
6945            self.control_handle.shutdown();
6946        }
6947        self.drop_without_shutdown();
6948        _result
6949    }
6950
6951    /// Similar to "send" but does not shutdown the channel if an error occurs.
6952    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6953        let _result = self.send_raw(result);
6954        self.drop_without_shutdown();
6955        _result
6956    }
6957
6958    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
6959        self.control_handle
6960            .inner
6961            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
6962                result,
6963                self.tx_id,
6964                0x6ceaa5904cfe4377,
6965                fidl::encoding::DynamicFlags::empty(),
6966            )
6967    }
6968}
6969
6970#[must_use = "FIDL methods require a response to be sent"]
6971#[derive(Debug)]
6972pub struct StorageAdminListStorageInRealmResponder {
6973    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
6974    tx_id: u32,
6975}
6976
6977/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
6978/// if the responder is dropped without sending a response, so that the client
6979/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6980impl std::ops::Drop for StorageAdminListStorageInRealmResponder {
6981    fn drop(&mut self) {
6982        self.control_handle.shutdown();
6983        // Safety: drops once, never accessed again
6984        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6985    }
6986}
6987
6988impl fidl::endpoints::Responder for StorageAdminListStorageInRealmResponder {
6989    type ControlHandle = StorageAdminControlHandle;
6990
6991    fn control_handle(&self) -> &StorageAdminControlHandle {
6992        &self.control_handle
6993    }
6994
6995    fn drop_without_shutdown(mut self) {
6996        // Safety: drops once, never accessed again due to mem::forget
6997        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6998        // Prevent Drop from running (which would shut down the channel)
6999        std::mem::forget(self);
7000    }
7001}
7002
7003impl StorageAdminListStorageInRealmResponder {
7004    /// Sends a response to the FIDL transaction.
7005    ///
7006    /// Sets the channel to shutdown if an error occurs.
7007    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7008        let _result = self.send_raw(result);
7009        if _result.is_err() {
7010            self.control_handle.shutdown();
7011        }
7012        self.drop_without_shutdown();
7013        _result
7014    }
7015
7016    /// Similar to "send" but does not shutdown the channel if an error occurs.
7017    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7018        let _result = self.send_raw(result);
7019        self.drop_without_shutdown();
7020        _result
7021    }
7022
7023    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7024        self.control_handle
7025            .inner
7026            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7027                result,
7028                self.tx_id,
7029                0x764f6d1f083e8bfb,
7030                fidl::encoding::DynamicFlags::empty(),
7031            )
7032    }
7033}
7034
7035#[must_use = "FIDL methods require a response to be sent"]
7036#[derive(Debug)]
7037pub struct StorageAdminOpenComponentStorageByIdResponder {
7038    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7039    tx_id: u32,
7040}
7041
7042/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7043/// if the responder is dropped without sending a response, so that the client
7044/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7045impl std::ops::Drop for StorageAdminOpenComponentStorageByIdResponder {
7046    fn drop(&mut self) {
7047        self.control_handle.shutdown();
7048        // Safety: drops once, never accessed again
7049        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7050    }
7051}
7052
7053impl fidl::endpoints::Responder for StorageAdminOpenComponentStorageByIdResponder {
7054    type ControlHandle = StorageAdminControlHandle;
7055
7056    fn control_handle(&self) -> &StorageAdminControlHandle {
7057        &self.control_handle
7058    }
7059
7060    fn drop_without_shutdown(mut self) {
7061        // Safety: drops once, never accessed again due to mem::forget
7062        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7063        // Prevent Drop from running (which would shut down the channel)
7064        std::mem::forget(self);
7065    }
7066}
7067
7068impl StorageAdminOpenComponentStorageByIdResponder {
7069    /// Sends a response to the FIDL transaction.
7070    ///
7071    /// Sets the channel to shutdown if an error occurs.
7072    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7073        let _result = self.send_raw(result);
7074        if _result.is_err() {
7075            self.control_handle.shutdown();
7076        }
7077        self.drop_without_shutdown();
7078        _result
7079    }
7080
7081    /// Similar to "send" but does not shutdown the channel if an error occurs.
7082    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7083        let _result = self.send_raw(result);
7084        self.drop_without_shutdown();
7085        _result
7086    }
7087
7088    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7089        self.control_handle
7090            .inner
7091            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7092                result,
7093                self.tx_id,
7094                0x4802102cc55d5df1,
7095                fidl::encoding::DynamicFlags::empty(),
7096            )
7097    }
7098}
7099
7100#[must_use = "FIDL methods require a response to be sent"]
7101#[derive(Debug)]
7102pub struct StorageAdminDeleteComponentStorageResponder {
7103    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7104    tx_id: u32,
7105}
7106
7107/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7108/// if the responder is dropped without sending a response, so that the client
7109/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7110impl std::ops::Drop for StorageAdminDeleteComponentStorageResponder {
7111    fn drop(&mut self) {
7112        self.control_handle.shutdown();
7113        // Safety: drops once, never accessed again
7114        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7115    }
7116}
7117
7118impl fidl::endpoints::Responder for StorageAdminDeleteComponentStorageResponder {
7119    type ControlHandle = StorageAdminControlHandle;
7120
7121    fn control_handle(&self) -> &StorageAdminControlHandle {
7122        &self.control_handle
7123    }
7124
7125    fn drop_without_shutdown(mut self) {
7126        // Safety: drops once, never accessed again due to mem::forget
7127        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7128        // Prevent Drop from running (which would shut down the channel)
7129        std::mem::forget(self);
7130    }
7131}
7132
7133impl StorageAdminDeleteComponentStorageResponder {
7134    /// Sends a response to the FIDL transaction.
7135    ///
7136    /// Sets the channel to shutdown if an error occurs.
7137    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7138        let _result = self.send_raw(result);
7139        if _result.is_err() {
7140            self.control_handle.shutdown();
7141        }
7142        self.drop_without_shutdown();
7143        _result
7144    }
7145
7146    /// Similar to "send" but does not shutdown the channel if an error occurs.
7147    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7148        let _result = self.send_raw(result);
7149        self.drop_without_shutdown();
7150        _result
7151    }
7152
7153    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
7154        self.control_handle
7155            .inner
7156            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
7157                result,
7158                self.tx_id,
7159                0x1677c1cdfcdbf45a,
7160                fidl::encoding::DynamicFlags::empty(),
7161            )
7162    }
7163}
7164
7165#[must_use = "FIDL methods require a response to be sent"]
7166#[derive(Debug)]
7167pub struct StorageAdminGetStatusResponder {
7168    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7169    tx_id: u32,
7170}
7171
7172/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7173/// if the responder is dropped without sending a response, so that the client
7174/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7175impl std::ops::Drop for StorageAdminGetStatusResponder {
7176    fn drop(&mut self) {
7177        self.control_handle.shutdown();
7178        // Safety: drops once, never accessed again
7179        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7180    }
7181}
7182
7183impl fidl::endpoints::Responder for StorageAdminGetStatusResponder {
7184    type ControlHandle = StorageAdminControlHandle;
7185
7186    fn control_handle(&self) -> &StorageAdminControlHandle {
7187        &self.control_handle
7188    }
7189
7190    fn drop_without_shutdown(mut self) {
7191        // Safety: drops once, never accessed again due to mem::forget
7192        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7193        // Prevent Drop from running (which would shut down the channel)
7194        std::mem::forget(self);
7195    }
7196}
7197
7198impl StorageAdminGetStatusResponder {
7199    /// Sends a response to the FIDL transaction.
7200    ///
7201    /// Sets the channel to shutdown if an error occurs.
7202    pub fn send(self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
7203        let _result = self.send_raw(result);
7204        if _result.is_err() {
7205            self.control_handle.shutdown();
7206        }
7207        self.drop_without_shutdown();
7208        _result
7209    }
7210
7211    /// Similar to "send" but does not shutdown the channel if an error occurs.
7212    pub fn send_no_shutdown_on_err(
7213        self,
7214        mut result: Result<&StorageStatus, StatusError>,
7215    ) -> Result<(), fidl::Error> {
7216        let _result = self.send_raw(result);
7217        self.drop_without_shutdown();
7218        _result
7219    }
7220
7221    fn send_raw(&self, mut result: Result<&StorageStatus, StatusError>) -> Result<(), fidl::Error> {
7222        self.control_handle.inner.send::<fidl::encoding::ResultType<StorageStatus, StatusError>>(
7223            result,
7224            self.tx_id,
7225            0x7729e325a6c526c8,
7226            fidl::encoding::DynamicFlags::empty(),
7227        )
7228    }
7229}
7230
7231#[must_use = "FIDL methods require a response to be sent"]
7232#[derive(Debug)]
7233pub struct StorageAdminDeleteAllStorageContentsResponder {
7234    control_handle: std::mem::ManuallyDrop<StorageAdminControlHandle>,
7235    tx_id: u32,
7236}
7237
7238/// Set the the channel to be shutdown (see [`StorageAdminControlHandle::shutdown`])
7239/// if the responder is dropped without sending a response, so that the client
7240/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7241impl std::ops::Drop for StorageAdminDeleteAllStorageContentsResponder {
7242    fn drop(&mut self) {
7243        self.control_handle.shutdown();
7244        // Safety: drops once, never accessed again
7245        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7246    }
7247}
7248
7249impl fidl::endpoints::Responder for StorageAdminDeleteAllStorageContentsResponder {
7250    type ControlHandle = StorageAdminControlHandle;
7251
7252    fn control_handle(&self) -> &StorageAdminControlHandle {
7253        &self.control_handle
7254    }
7255
7256    fn drop_without_shutdown(mut self) {
7257        // Safety: drops once, never accessed again due to mem::forget
7258        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7259        // Prevent Drop from running (which would shut down the channel)
7260        std::mem::forget(self);
7261    }
7262}
7263
7264impl StorageAdminDeleteAllStorageContentsResponder {
7265    /// Sends a response to the FIDL transaction.
7266    ///
7267    /// Sets the channel to shutdown if an error occurs.
7268    pub fn send(self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
7269        let _result = self.send_raw(result);
7270        if _result.is_err() {
7271            self.control_handle.shutdown();
7272        }
7273        self.drop_without_shutdown();
7274        _result
7275    }
7276
7277    /// Similar to "send" but does not shutdown the channel if an error occurs.
7278    pub fn send_no_shutdown_on_err(
7279        self,
7280        mut result: Result<(), DeletionError>,
7281    ) -> Result<(), fidl::Error> {
7282        let _result = self.send_raw(result);
7283        self.drop_without_shutdown();
7284        _result
7285    }
7286
7287    fn send_raw(&self, mut result: Result<(), DeletionError>) -> Result<(), fidl::Error> {
7288        self.control_handle.inner.send::<fidl::encoding::ResultType<
7289            fidl::encoding::EmptyStruct,
7290            DeletionError,
7291        >>(
7292            result,
7293            self.tx_id,
7294            0x2ee980b4b2d24adb,
7295            fidl::encoding::DynamicFlags::empty(),
7296        )
7297    }
7298}
7299
7300#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7301pub struct StorageIteratorMarker;
7302
7303impl fidl::endpoints::ProtocolMarker for StorageIteratorMarker {
7304    type Proxy = StorageIteratorProxy;
7305    type RequestStream = StorageIteratorRequestStream;
7306    #[cfg(target_os = "fuchsia")]
7307    type SynchronousProxy = StorageIteratorSynchronousProxy;
7308
7309    const DEBUG_NAME: &'static str = "(anonymous) StorageIterator";
7310}
7311
7312pub trait StorageIteratorProxyInterface: Send + Sync {
7313    type NextResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
7314    fn r#next(&self) -> Self::NextResponseFut;
7315}
7316#[derive(Debug)]
7317#[cfg(target_os = "fuchsia")]
7318pub struct StorageIteratorSynchronousProxy {
7319    client: fidl::client::sync::Client,
7320}
7321
7322#[cfg(target_os = "fuchsia")]
7323impl fidl::endpoints::SynchronousProxy for StorageIteratorSynchronousProxy {
7324    type Proxy = StorageIteratorProxy;
7325    type Protocol = StorageIteratorMarker;
7326
7327    fn from_channel(inner: fidl::Channel) -> Self {
7328        Self::new(inner)
7329    }
7330
7331    fn into_channel(self) -> fidl::Channel {
7332        self.client.into_channel()
7333    }
7334
7335    fn as_channel(&self) -> &fidl::Channel {
7336        self.client.as_channel()
7337    }
7338}
7339
7340#[cfg(target_os = "fuchsia")]
7341impl StorageIteratorSynchronousProxy {
7342    pub fn new(channel: fidl::Channel) -> Self {
7343        let protocol_name = <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7344        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7345    }
7346
7347    pub fn into_channel(self) -> fidl::Channel {
7348        self.client.into_channel()
7349    }
7350
7351    /// Waits until an event arrives and returns it. It is safe for other
7352    /// threads to make concurrent requests while waiting for an event.
7353    pub fn wait_for_event(
7354        &self,
7355        deadline: zx::MonotonicInstant,
7356    ) -> Result<StorageIteratorEvent, fidl::Error> {
7357        StorageIteratorEvent::decode(self.client.wait_for_event(deadline)?)
7358    }
7359
7360    /// Retrieve the next set of components using the storage capability. The
7361    /// returned monikers are relative to the component that declares the
7362    /// storage capability. Returns an empty vector after all components have
7363    /// been returned.
7364    pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<String>, fidl::Error> {
7365        let _response =
7366            self.client.send_query::<fidl::encoding::EmptyPayload, StorageIteratorNextResponse>(
7367                (),
7368                0x7a6b21f15fd01b72,
7369                fidl::encoding::DynamicFlags::empty(),
7370                ___deadline,
7371            )?;
7372        Ok(_response.relative_monikers)
7373    }
7374}
7375
7376#[cfg(target_os = "fuchsia")]
7377impl From<StorageIteratorSynchronousProxy> for zx::Handle {
7378    fn from(value: StorageIteratorSynchronousProxy) -> Self {
7379        value.into_channel().into()
7380    }
7381}
7382
7383#[cfg(target_os = "fuchsia")]
7384impl From<fidl::Channel> for StorageIteratorSynchronousProxy {
7385    fn from(value: fidl::Channel) -> Self {
7386        Self::new(value)
7387    }
7388}
7389
7390#[cfg(target_os = "fuchsia")]
7391impl fidl::endpoints::FromClient for StorageIteratorSynchronousProxy {
7392    type Protocol = StorageIteratorMarker;
7393
7394    fn from_client(value: fidl::endpoints::ClientEnd<StorageIteratorMarker>) -> Self {
7395        Self::new(value.into_channel())
7396    }
7397}
7398
7399#[derive(Debug, Clone)]
7400pub struct StorageIteratorProxy {
7401    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7402}
7403
7404impl fidl::endpoints::Proxy for StorageIteratorProxy {
7405    type Protocol = StorageIteratorMarker;
7406
7407    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7408        Self::new(inner)
7409    }
7410
7411    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7412        self.client.into_channel().map_err(|client| Self { client })
7413    }
7414
7415    fn as_channel(&self) -> &::fidl::AsyncChannel {
7416        self.client.as_channel()
7417    }
7418}
7419
7420impl StorageIteratorProxy {
7421    /// Create a new Proxy for fuchsia.component/StorageIterator.
7422    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7423        let protocol_name = <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7424        Self { client: fidl::client::Client::new(channel, protocol_name) }
7425    }
7426
7427    /// Get a Stream of events from the remote end of the protocol.
7428    ///
7429    /// # Panics
7430    ///
7431    /// Panics if the event stream was already taken.
7432    pub fn take_event_stream(&self) -> StorageIteratorEventStream {
7433        StorageIteratorEventStream { event_receiver: self.client.take_event_receiver() }
7434    }
7435
7436    /// Retrieve the next set of components using the storage capability. The
7437    /// returned monikers are relative to the component that declares the
7438    /// storage capability. Returns an empty vector after all components have
7439    /// been returned.
7440    pub fn r#next(
7441        &self,
7442    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
7443    {
7444        StorageIteratorProxyInterface::r#next(self)
7445    }
7446}
7447
7448impl StorageIteratorProxyInterface for StorageIteratorProxy {
7449    type NextResponseFut =
7450        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
7451    fn r#next(&self) -> Self::NextResponseFut {
7452        fn _decode(
7453            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7454        ) -> Result<Vec<String>, fidl::Error> {
7455            let _response = fidl::client::decode_transaction_body::<
7456                StorageIteratorNextResponse,
7457                fidl::encoding::DefaultFuchsiaResourceDialect,
7458                0x7a6b21f15fd01b72,
7459            >(_buf?)?;
7460            Ok(_response.relative_monikers)
7461        }
7462        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
7463            (),
7464            0x7a6b21f15fd01b72,
7465            fidl::encoding::DynamicFlags::empty(),
7466            _decode,
7467        )
7468    }
7469}
7470
7471pub struct StorageIteratorEventStream {
7472    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7473}
7474
7475impl std::marker::Unpin for StorageIteratorEventStream {}
7476
7477impl futures::stream::FusedStream for StorageIteratorEventStream {
7478    fn is_terminated(&self) -> bool {
7479        self.event_receiver.is_terminated()
7480    }
7481}
7482
7483impl futures::Stream for StorageIteratorEventStream {
7484    type Item = Result<StorageIteratorEvent, fidl::Error>;
7485
7486    fn poll_next(
7487        mut self: std::pin::Pin<&mut Self>,
7488        cx: &mut std::task::Context<'_>,
7489    ) -> std::task::Poll<Option<Self::Item>> {
7490        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7491            &mut self.event_receiver,
7492            cx
7493        )?) {
7494            Some(buf) => std::task::Poll::Ready(Some(StorageIteratorEvent::decode(buf))),
7495            None => std::task::Poll::Ready(None),
7496        }
7497    }
7498}
7499
7500#[derive(Debug)]
7501pub enum StorageIteratorEvent {}
7502
7503impl StorageIteratorEvent {
7504    /// Decodes a message buffer as a [`StorageIteratorEvent`].
7505    fn decode(
7506        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7507    ) -> Result<StorageIteratorEvent, fidl::Error> {
7508        let (bytes, _handles) = buf.split_mut();
7509        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7510        debug_assert_eq!(tx_header.tx_id, 0);
7511        match tx_header.ordinal {
7512            _ => Err(fidl::Error::UnknownOrdinal {
7513                ordinal: tx_header.ordinal,
7514                protocol_name:
7515                    <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7516            }),
7517        }
7518    }
7519}
7520
7521/// A Stream of incoming requests for fuchsia.component/StorageIterator.
7522pub struct StorageIteratorRequestStream {
7523    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7524    is_terminated: bool,
7525}
7526
7527impl std::marker::Unpin for StorageIteratorRequestStream {}
7528
7529impl futures::stream::FusedStream for StorageIteratorRequestStream {
7530    fn is_terminated(&self) -> bool {
7531        self.is_terminated
7532    }
7533}
7534
7535impl fidl::endpoints::RequestStream for StorageIteratorRequestStream {
7536    type Protocol = StorageIteratorMarker;
7537    type ControlHandle = StorageIteratorControlHandle;
7538
7539    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7540        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7541    }
7542
7543    fn control_handle(&self) -> Self::ControlHandle {
7544        StorageIteratorControlHandle { inner: self.inner.clone() }
7545    }
7546
7547    fn into_inner(
7548        self,
7549    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7550    {
7551        (self.inner, self.is_terminated)
7552    }
7553
7554    fn from_inner(
7555        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7556        is_terminated: bool,
7557    ) -> Self {
7558        Self { inner, is_terminated }
7559    }
7560}
7561
7562impl futures::Stream for StorageIteratorRequestStream {
7563    type Item = Result<StorageIteratorRequest, fidl::Error>;
7564
7565    fn poll_next(
7566        mut self: std::pin::Pin<&mut Self>,
7567        cx: &mut std::task::Context<'_>,
7568    ) -> std::task::Poll<Option<Self::Item>> {
7569        let this = &mut *self;
7570        if this.inner.check_shutdown(cx) {
7571            this.is_terminated = true;
7572            return std::task::Poll::Ready(None);
7573        }
7574        if this.is_terminated {
7575            panic!("polled StorageIteratorRequestStream after completion");
7576        }
7577        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7578            |bytes, handles| {
7579                match this.inner.channel().read_etc(cx, bytes, handles) {
7580                    std::task::Poll::Ready(Ok(())) => {}
7581                    std::task::Poll::Pending => return std::task::Poll::Pending,
7582                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7583                        this.is_terminated = true;
7584                        return std::task::Poll::Ready(None);
7585                    }
7586                    std::task::Poll::Ready(Err(e)) => {
7587                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7588                            e.into(),
7589                        ))));
7590                    }
7591                }
7592
7593                // A message has been received from the channel
7594                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7595
7596                std::task::Poll::Ready(Some(match header.ordinal {
7597                    0x7a6b21f15fd01b72 => {
7598                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7599                        let mut req = fidl::new_empty!(
7600                            fidl::encoding::EmptyPayload,
7601                            fidl::encoding::DefaultFuchsiaResourceDialect
7602                        );
7603                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7604                        let control_handle =
7605                            StorageIteratorControlHandle { inner: this.inner.clone() };
7606                        Ok(StorageIteratorRequest::Next {
7607                            responder: StorageIteratorNextResponder {
7608                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7609                                tx_id: header.tx_id,
7610                            },
7611                        })
7612                    }
7613                    _ => Err(fidl::Error::UnknownOrdinal {
7614                        ordinal: header.ordinal,
7615                        protocol_name:
7616                            <StorageIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7617                    }),
7618                }))
7619            },
7620        )
7621    }
7622}
7623
7624/// An iterator protocol for returning a set of components using a storage
7625/// capability. See |StorageAdmin.ListStorageInRealm| for more information.
7626#[derive(Debug)]
7627pub enum StorageIteratorRequest {
7628    /// Retrieve the next set of components using the storage capability. The
7629    /// returned monikers are relative to the component that declares the
7630    /// storage capability. Returns an empty vector after all components have
7631    /// been returned.
7632    Next { responder: StorageIteratorNextResponder },
7633}
7634
7635impl StorageIteratorRequest {
7636    #[allow(irrefutable_let_patterns)]
7637    pub fn into_next(self) -> Option<(StorageIteratorNextResponder)> {
7638        if let StorageIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
7639    }
7640
7641    /// Name of the method defined in FIDL
7642    pub fn method_name(&self) -> &'static str {
7643        match *self {
7644            StorageIteratorRequest::Next { .. } => "next",
7645        }
7646    }
7647}
7648
7649#[derive(Debug, Clone)]
7650pub struct StorageIteratorControlHandle {
7651    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7652}
7653
7654impl fidl::endpoints::ControlHandle for StorageIteratorControlHandle {
7655    fn shutdown(&self) {
7656        self.inner.shutdown()
7657    }
7658    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7659        self.inner.shutdown_with_epitaph(status)
7660    }
7661
7662    fn is_closed(&self) -> bool {
7663        self.inner.channel().is_closed()
7664    }
7665    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7666        self.inner.channel().on_closed()
7667    }
7668
7669    #[cfg(target_os = "fuchsia")]
7670    fn signal_peer(
7671        &self,
7672        clear_mask: zx::Signals,
7673        set_mask: zx::Signals,
7674    ) -> Result<(), zx_status::Status> {
7675        use fidl::Peered;
7676        self.inner.channel().signal_peer(clear_mask, set_mask)
7677    }
7678}
7679
7680impl StorageIteratorControlHandle {}
7681
7682#[must_use = "FIDL methods require a response to be sent"]
7683#[derive(Debug)]
7684pub struct StorageIteratorNextResponder {
7685    control_handle: std::mem::ManuallyDrop<StorageIteratorControlHandle>,
7686    tx_id: u32,
7687}
7688
7689/// Set the the channel to be shutdown (see [`StorageIteratorControlHandle::shutdown`])
7690/// if the responder is dropped without sending a response, so that the client
7691/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7692impl std::ops::Drop for StorageIteratorNextResponder {
7693    fn drop(&mut self) {
7694        self.control_handle.shutdown();
7695        // Safety: drops once, never accessed again
7696        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7697    }
7698}
7699
7700impl fidl::endpoints::Responder for StorageIteratorNextResponder {
7701    type ControlHandle = StorageIteratorControlHandle;
7702
7703    fn control_handle(&self) -> &StorageIteratorControlHandle {
7704        &self.control_handle
7705    }
7706
7707    fn drop_without_shutdown(mut self) {
7708        // Safety: drops once, never accessed again due to mem::forget
7709        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7710        // Prevent Drop from running (which would shut down the channel)
7711        std::mem::forget(self);
7712    }
7713}
7714
7715impl StorageIteratorNextResponder {
7716    /// Sends a response to the FIDL transaction.
7717    ///
7718    /// Sets the channel to shutdown if an error occurs.
7719    pub fn send(self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
7720        let _result = self.send_raw(relative_monikers);
7721        if _result.is_err() {
7722            self.control_handle.shutdown();
7723        }
7724        self.drop_without_shutdown();
7725        _result
7726    }
7727
7728    /// Similar to "send" but does not shutdown the channel if an error occurs.
7729    pub fn send_no_shutdown_on_err(
7730        self,
7731        mut relative_monikers: &[String],
7732    ) -> Result<(), fidl::Error> {
7733        let _result = self.send_raw(relative_monikers);
7734        self.drop_without_shutdown();
7735        _result
7736    }
7737
7738    fn send_raw(&self, mut relative_monikers: &[String]) -> Result<(), fidl::Error> {
7739        self.control_handle.inner.send::<StorageIteratorNextResponse>(
7740            (relative_monikers,),
7741            self.tx_id,
7742            0x7a6b21f15fd01b72,
7743            fidl::encoding::DynamicFlags::empty(),
7744        )
7745    }
7746}
7747
7748mod internal {
7749    use super::*;
7750
7751    impl fidl::encoding::ResourceTypeMarker for ControllerStartRequest {
7752        type Borrowed<'a> = &'a mut Self;
7753        fn take_or_borrow<'a>(
7754            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7755        ) -> Self::Borrowed<'a> {
7756            value
7757        }
7758    }
7759
7760    unsafe impl fidl::encoding::TypeMarker for ControllerStartRequest {
7761        type Owned = Self;
7762
7763        #[inline(always)]
7764        fn inline_align(_context: fidl::encoding::Context) -> usize {
7765            8
7766        }
7767
7768        #[inline(always)]
7769        fn inline_size(_context: fidl::encoding::Context) -> usize {
7770            24
7771        }
7772    }
7773
7774    unsafe impl
7775        fidl::encoding::Encode<
7776            ControllerStartRequest,
7777            fidl::encoding::DefaultFuchsiaResourceDialect,
7778        > for &mut ControllerStartRequest
7779    {
7780        #[inline]
7781        unsafe fn encode(
7782            self,
7783            encoder: &mut fidl::encoding::Encoder<
7784                '_,
7785                fidl::encoding::DefaultFuchsiaResourceDialect,
7786            >,
7787            offset: usize,
7788            _depth: fidl::encoding::Depth,
7789        ) -> fidl::Result<()> {
7790            encoder.debug_check_bounds::<ControllerStartRequest>(offset);
7791            // Delegate to tuple encoding.
7792            fidl::encoding::Encode::<ControllerStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7793                (
7794                    <StartChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
7795                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.execution_controller),
7796                ),
7797                encoder, offset, _depth
7798            )
7799        }
7800    }
7801    unsafe impl<
7802        T0: fidl::encoding::Encode<StartChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
7803        T1: fidl::encoding::Encode<
7804                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
7805                fidl::encoding::DefaultFuchsiaResourceDialect,
7806            >,
7807    >
7808        fidl::encoding::Encode<
7809            ControllerStartRequest,
7810            fidl::encoding::DefaultFuchsiaResourceDialect,
7811        > for (T0, T1)
7812    {
7813        #[inline]
7814        unsafe fn encode(
7815            self,
7816            encoder: &mut fidl::encoding::Encoder<
7817                '_,
7818                fidl::encoding::DefaultFuchsiaResourceDialect,
7819            >,
7820            offset: usize,
7821            depth: fidl::encoding::Depth,
7822        ) -> fidl::Result<()> {
7823            encoder.debug_check_bounds::<ControllerStartRequest>(offset);
7824            // Zero out padding regions. There's no need to apply masks
7825            // because the unmasked parts will be overwritten by fields.
7826            unsafe {
7827                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7828                (ptr as *mut u64).write_unaligned(0);
7829            }
7830            // Write the fields.
7831            self.0.encode(encoder, offset + 0, depth)?;
7832            self.1.encode(encoder, offset + 16, depth)?;
7833            Ok(())
7834        }
7835    }
7836
7837    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7838        for ControllerStartRequest
7839    {
7840        #[inline(always)]
7841        fn new_empty() -> Self {
7842            Self {
7843                args: fidl::new_empty!(
7844                    StartChildArgs,
7845                    fidl::encoding::DefaultFuchsiaResourceDialect
7846                ),
7847                execution_controller: fidl::new_empty!(
7848                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
7849                    fidl::encoding::DefaultFuchsiaResourceDialect
7850                ),
7851            }
7852        }
7853
7854        #[inline]
7855        unsafe fn decode(
7856            &mut self,
7857            decoder: &mut fidl::encoding::Decoder<
7858                '_,
7859                fidl::encoding::DefaultFuchsiaResourceDialect,
7860            >,
7861            offset: usize,
7862            _depth: fidl::encoding::Depth,
7863        ) -> fidl::Result<()> {
7864            decoder.debug_check_bounds::<Self>(offset);
7865            // Verify that padding bytes are zero.
7866            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7867            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7868            let mask = 0xffffffff00000000u64;
7869            let maskedval = padval & mask;
7870            if maskedval != 0 {
7871                return Err(fidl::Error::NonZeroPadding {
7872                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7873                });
7874            }
7875            fidl::decode!(
7876                StartChildArgs,
7877                fidl::encoding::DefaultFuchsiaResourceDialect,
7878                &mut self.args,
7879                decoder,
7880                offset + 0,
7881                _depth
7882            )?;
7883            fidl::decode!(
7884                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ExecutionControllerMarker>>,
7885                fidl::encoding::DefaultFuchsiaResourceDialect,
7886                &mut self.execution_controller,
7887                decoder,
7888                offset + 16,
7889                _depth
7890            )?;
7891            Ok(())
7892        }
7893    }
7894
7895    impl fidl::encoding::ResourceTypeMarker for ControllerGetExposedDictionaryResponse {
7896        type Borrowed<'a> = &'a mut Self;
7897        fn take_or_borrow<'a>(
7898            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7899        ) -> Self::Borrowed<'a> {
7900            value
7901        }
7902    }
7903
7904    unsafe impl fidl::encoding::TypeMarker for ControllerGetExposedDictionaryResponse {
7905        type Owned = Self;
7906
7907        #[inline(always)]
7908        fn inline_align(_context: fidl::encoding::Context) -> usize {
7909            4
7910        }
7911
7912        #[inline(always)]
7913        fn inline_size(_context: fidl::encoding::Context) -> usize {
7914            4
7915        }
7916    }
7917
7918    unsafe impl
7919        fidl::encoding::Encode<
7920            ControllerGetExposedDictionaryResponse,
7921            fidl::encoding::DefaultFuchsiaResourceDialect,
7922        > for &mut ControllerGetExposedDictionaryResponse
7923    {
7924        #[inline]
7925        unsafe fn encode(
7926            self,
7927            encoder: &mut fidl::encoding::Encoder<
7928                '_,
7929                fidl::encoding::DefaultFuchsiaResourceDialect,
7930            >,
7931            offset: usize,
7932            _depth: fidl::encoding::Depth,
7933        ) -> fidl::Result<()> {
7934            encoder.debug_check_bounds::<ControllerGetExposedDictionaryResponse>(offset);
7935            // Delegate to tuple encoding.
7936            fidl::encoding::Encode::<ControllerGetExposedDictionaryResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7937                (
7938                    <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
7939                ),
7940                encoder, offset, _depth
7941            )
7942        }
7943    }
7944    unsafe impl<
7945        T0: fidl::encoding::Encode<
7946                fidl_fuchsia_component_sandbox::DictionaryRef,
7947                fidl::encoding::DefaultFuchsiaResourceDialect,
7948            >,
7949    >
7950        fidl::encoding::Encode<
7951            ControllerGetExposedDictionaryResponse,
7952            fidl::encoding::DefaultFuchsiaResourceDialect,
7953        > for (T0,)
7954    {
7955        #[inline]
7956        unsafe fn encode(
7957            self,
7958            encoder: &mut fidl::encoding::Encoder<
7959                '_,
7960                fidl::encoding::DefaultFuchsiaResourceDialect,
7961            >,
7962            offset: usize,
7963            depth: fidl::encoding::Depth,
7964        ) -> fidl::Result<()> {
7965            encoder.debug_check_bounds::<ControllerGetExposedDictionaryResponse>(offset);
7966            // Zero out padding regions. There's no need to apply masks
7967            // because the unmasked parts will be overwritten by fields.
7968            // Write the fields.
7969            self.0.encode(encoder, offset + 0, depth)?;
7970            Ok(())
7971        }
7972    }
7973
7974    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7975        for ControllerGetExposedDictionaryResponse
7976    {
7977        #[inline(always)]
7978        fn new_empty() -> Self {
7979            Self {
7980                dictionary: fidl::new_empty!(
7981                    fidl_fuchsia_component_sandbox::DictionaryRef,
7982                    fidl::encoding::DefaultFuchsiaResourceDialect
7983                ),
7984            }
7985        }
7986
7987        #[inline]
7988        unsafe fn decode(
7989            &mut self,
7990            decoder: &mut fidl::encoding::Decoder<
7991                '_,
7992                fidl::encoding::DefaultFuchsiaResourceDialect,
7993            >,
7994            offset: usize,
7995            _depth: fidl::encoding::Depth,
7996        ) -> fidl::Result<()> {
7997            decoder.debug_check_bounds::<Self>(offset);
7998            // Verify that padding bytes are zero.
7999            fidl::decode!(
8000                fidl_fuchsia_component_sandbox::DictionaryRef,
8001                fidl::encoding::DefaultFuchsiaResourceDialect,
8002                &mut self.dictionary,
8003                decoder,
8004                offset + 0,
8005                _depth
8006            )?;
8007            Ok(())
8008        }
8009    }
8010
8011    impl fidl::encoding::ResourceTypeMarker for ControllerIsStartedResponse {
8012        type Borrowed<'a> = &'a mut Self;
8013        fn take_or_borrow<'a>(
8014            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8015        ) -> Self::Borrowed<'a> {
8016            value
8017        }
8018    }
8019
8020    unsafe impl fidl::encoding::TypeMarker for ControllerIsStartedResponse {
8021        type Owned = Self;
8022
8023        #[inline(always)]
8024        fn inline_align(_context: fidl::encoding::Context) -> usize {
8025            1
8026        }
8027
8028        #[inline(always)]
8029        fn inline_size(_context: fidl::encoding::Context) -> usize {
8030            1
8031        }
8032    }
8033
8034    unsafe impl
8035        fidl::encoding::Encode<
8036            ControllerIsStartedResponse,
8037            fidl::encoding::DefaultFuchsiaResourceDialect,
8038        > for &mut ControllerIsStartedResponse
8039    {
8040        #[inline]
8041        unsafe fn encode(
8042            self,
8043            encoder: &mut fidl::encoding::Encoder<
8044                '_,
8045                fidl::encoding::DefaultFuchsiaResourceDialect,
8046            >,
8047            offset: usize,
8048            _depth: fidl::encoding::Depth,
8049        ) -> fidl::Result<()> {
8050            encoder.debug_check_bounds::<ControllerIsStartedResponse>(offset);
8051            // Delegate to tuple encoding.
8052            fidl::encoding::Encode::<
8053                ControllerIsStartedResponse,
8054                fidl::encoding::DefaultFuchsiaResourceDialect,
8055            >::encode(
8056                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_started),),
8057                encoder,
8058                offset,
8059                _depth,
8060            )
8061        }
8062    }
8063    unsafe impl<T0: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>>
8064        fidl::encoding::Encode<
8065            ControllerIsStartedResponse,
8066            fidl::encoding::DefaultFuchsiaResourceDialect,
8067        > for (T0,)
8068    {
8069        #[inline]
8070        unsafe fn encode(
8071            self,
8072            encoder: &mut fidl::encoding::Encoder<
8073                '_,
8074                fidl::encoding::DefaultFuchsiaResourceDialect,
8075            >,
8076            offset: usize,
8077            depth: fidl::encoding::Depth,
8078        ) -> fidl::Result<()> {
8079            encoder.debug_check_bounds::<ControllerIsStartedResponse>(offset);
8080            // Zero out padding regions. There's no need to apply masks
8081            // because the unmasked parts will be overwritten by fields.
8082            // Write the fields.
8083            self.0.encode(encoder, offset + 0, depth)?;
8084            Ok(())
8085        }
8086    }
8087
8088    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8089        for ControllerIsStartedResponse
8090    {
8091        #[inline(always)]
8092        fn new_empty() -> Self {
8093            Self {
8094                is_started: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
8095            }
8096        }
8097
8098        #[inline]
8099        unsafe fn decode(
8100            &mut self,
8101            decoder: &mut fidl::encoding::Decoder<
8102                '_,
8103                fidl::encoding::DefaultFuchsiaResourceDialect,
8104            >,
8105            offset: usize,
8106            _depth: fidl::encoding::Depth,
8107        ) -> fidl::Result<()> {
8108            decoder.debug_check_bounds::<Self>(offset);
8109            // Verify that padding bytes are zero.
8110            fidl::decode!(
8111                bool,
8112                fidl::encoding::DefaultFuchsiaResourceDialect,
8113                &mut self.is_started,
8114                decoder,
8115                offset + 0,
8116                _depth
8117            )?;
8118            Ok(())
8119        }
8120    }
8121
8122    impl fidl::encoding::ResourceTypeMarker for EventStreamGetNextResponse {
8123        type Borrowed<'a> = &'a mut Self;
8124        fn take_or_borrow<'a>(
8125            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8126        ) -> Self::Borrowed<'a> {
8127            value
8128        }
8129    }
8130
8131    unsafe impl fidl::encoding::TypeMarker for EventStreamGetNextResponse {
8132        type Owned = Self;
8133
8134        #[inline(always)]
8135        fn inline_align(_context: fidl::encoding::Context) -> usize {
8136            8
8137        }
8138
8139        #[inline(always)]
8140        fn inline_size(_context: fidl::encoding::Context) -> usize {
8141            16
8142        }
8143    }
8144
8145    unsafe impl
8146        fidl::encoding::Encode<
8147            EventStreamGetNextResponse,
8148            fidl::encoding::DefaultFuchsiaResourceDialect,
8149        > for &mut EventStreamGetNextResponse
8150    {
8151        #[inline]
8152        unsafe fn encode(
8153            self,
8154            encoder: &mut fidl::encoding::Encoder<
8155                '_,
8156                fidl::encoding::DefaultFuchsiaResourceDialect,
8157            >,
8158            offset: usize,
8159            _depth: fidl::encoding::Depth,
8160        ) -> fidl::Result<()> {
8161            encoder.debug_check_bounds::<EventStreamGetNextResponse>(offset);
8162            // Delegate to tuple encoding.
8163            fidl::encoding::Encode::<EventStreamGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8164                (
8165                    <fidl::encoding::UnboundedVector<Event> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.events),
8166                ),
8167                encoder, offset, _depth
8168            )
8169        }
8170    }
8171    unsafe impl<
8172        T0: fidl::encoding::Encode<
8173                fidl::encoding::UnboundedVector<Event>,
8174                fidl::encoding::DefaultFuchsiaResourceDialect,
8175            >,
8176    >
8177        fidl::encoding::Encode<
8178            EventStreamGetNextResponse,
8179            fidl::encoding::DefaultFuchsiaResourceDialect,
8180        > for (T0,)
8181    {
8182        #[inline]
8183        unsafe fn encode(
8184            self,
8185            encoder: &mut fidl::encoding::Encoder<
8186                '_,
8187                fidl::encoding::DefaultFuchsiaResourceDialect,
8188            >,
8189            offset: usize,
8190            depth: fidl::encoding::Depth,
8191        ) -> fidl::Result<()> {
8192            encoder.debug_check_bounds::<EventStreamGetNextResponse>(offset);
8193            // Zero out padding regions. There's no need to apply masks
8194            // because the unmasked parts will be overwritten by fields.
8195            // Write the fields.
8196            self.0.encode(encoder, offset + 0, depth)?;
8197            Ok(())
8198        }
8199    }
8200
8201    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8202        for EventStreamGetNextResponse
8203    {
8204        #[inline(always)]
8205        fn new_empty() -> Self {
8206            Self {
8207                events: fidl::new_empty!(
8208                    fidl::encoding::UnboundedVector<Event>,
8209                    fidl::encoding::DefaultFuchsiaResourceDialect
8210                ),
8211            }
8212        }
8213
8214        #[inline]
8215        unsafe fn decode(
8216            &mut self,
8217            decoder: &mut fidl::encoding::Decoder<
8218                '_,
8219                fidl::encoding::DefaultFuchsiaResourceDialect,
8220            >,
8221            offset: usize,
8222            _depth: fidl::encoding::Depth,
8223        ) -> fidl::Result<()> {
8224            decoder.debug_check_bounds::<Self>(offset);
8225            // Verify that padding bytes are zero.
8226            fidl::decode!(
8227                fidl::encoding::UnboundedVector<Event>,
8228                fidl::encoding::DefaultFuchsiaResourceDialect,
8229                &mut self.events,
8230                decoder,
8231                offset + 0,
8232                _depth
8233            )?;
8234            Ok(())
8235        }
8236    }
8237
8238    impl fidl::encoding::ResourceTypeMarker for IntrospectorGetMonikerRequest {
8239        type Borrowed<'a> = &'a mut Self;
8240        fn take_or_borrow<'a>(
8241            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8242        ) -> Self::Borrowed<'a> {
8243            value
8244        }
8245    }
8246
8247    unsafe impl fidl::encoding::TypeMarker for IntrospectorGetMonikerRequest {
8248        type Owned = Self;
8249
8250        #[inline(always)]
8251        fn inline_align(_context: fidl::encoding::Context) -> usize {
8252            4
8253        }
8254
8255        #[inline(always)]
8256        fn inline_size(_context: fidl::encoding::Context) -> usize {
8257            4
8258        }
8259    }
8260
8261    unsafe impl
8262        fidl::encoding::Encode<
8263            IntrospectorGetMonikerRequest,
8264            fidl::encoding::DefaultFuchsiaResourceDialect,
8265        > for &mut IntrospectorGetMonikerRequest
8266    {
8267        #[inline]
8268        unsafe fn encode(
8269            self,
8270            encoder: &mut fidl::encoding::Encoder<
8271                '_,
8272                fidl::encoding::DefaultFuchsiaResourceDialect,
8273            >,
8274            offset: usize,
8275            _depth: fidl::encoding::Depth,
8276        ) -> fidl::Result<()> {
8277            encoder.debug_check_bounds::<IntrospectorGetMonikerRequest>(offset);
8278            // Delegate to tuple encoding.
8279            fidl::encoding::Encode::<
8280                IntrospectorGetMonikerRequest,
8281                fidl::encoding::DefaultFuchsiaResourceDialect,
8282            >::encode(
8283                (<fidl::encoding::HandleType<
8284                    fidl::Event,
8285                    { fidl::ObjectType::EVENT.into_raw() },
8286                    2147483648,
8287                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8288                    &mut self.component_instance,
8289                ),),
8290                encoder,
8291                offset,
8292                _depth,
8293            )
8294        }
8295    }
8296    unsafe impl<
8297        T0: fidl::encoding::Encode<
8298                fidl::encoding::HandleType<
8299                    fidl::Event,
8300                    { fidl::ObjectType::EVENT.into_raw() },
8301                    2147483648,
8302                >,
8303                fidl::encoding::DefaultFuchsiaResourceDialect,
8304            >,
8305    >
8306        fidl::encoding::Encode<
8307            IntrospectorGetMonikerRequest,
8308            fidl::encoding::DefaultFuchsiaResourceDialect,
8309        > for (T0,)
8310    {
8311        #[inline]
8312        unsafe fn encode(
8313            self,
8314            encoder: &mut fidl::encoding::Encoder<
8315                '_,
8316                fidl::encoding::DefaultFuchsiaResourceDialect,
8317            >,
8318            offset: usize,
8319            depth: fidl::encoding::Depth,
8320        ) -> fidl::Result<()> {
8321            encoder.debug_check_bounds::<IntrospectorGetMonikerRequest>(offset);
8322            // Zero out padding regions. There's no need to apply masks
8323            // because the unmasked parts will be overwritten by fields.
8324            // Write the fields.
8325            self.0.encode(encoder, offset + 0, depth)?;
8326            Ok(())
8327        }
8328    }
8329
8330    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8331        for IntrospectorGetMonikerRequest
8332    {
8333        #[inline(always)]
8334        fn new_empty() -> Self {
8335            Self {
8336                component_instance: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8337            }
8338        }
8339
8340        #[inline]
8341        unsafe fn decode(
8342            &mut self,
8343            decoder: &mut fidl::encoding::Decoder<
8344                '_,
8345                fidl::encoding::DefaultFuchsiaResourceDialect,
8346            >,
8347            offset: usize,
8348            _depth: fidl::encoding::Depth,
8349        ) -> fidl::Result<()> {
8350            decoder.debug_check_bounds::<Self>(offset);
8351            // Verify that padding bytes are zero.
8352            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.component_instance, decoder, offset + 0, _depth)?;
8353            Ok(())
8354        }
8355    }
8356
8357    impl fidl::encoding::ResourceTypeMarker for NamespaceCreateRequest {
8358        type Borrowed<'a> = &'a mut Self;
8359        fn take_or_borrow<'a>(
8360            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8361        ) -> Self::Borrowed<'a> {
8362            value
8363        }
8364    }
8365
8366    unsafe impl fidl::encoding::TypeMarker for NamespaceCreateRequest {
8367        type Owned = Self;
8368
8369        #[inline(always)]
8370        fn inline_align(_context: fidl::encoding::Context) -> usize {
8371            8
8372        }
8373
8374        #[inline(always)]
8375        fn inline_size(_context: fidl::encoding::Context) -> usize {
8376            16
8377        }
8378    }
8379
8380    unsafe impl
8381        fidl::encoding::Encode<
8382            NamespaceCreateRequest,
8383            fidl::encoding::DefaultFuchsiaResourceDialect,
8384        > for &mut NamespaceCreateRequest
8385    {
8386        #[inline]
8387        unsafe fn encode(
8388            self,
8389            encoder: &mut fidl::encoding::Encoder<
8390                '_,
8391                fidl::encoding::DefaultFuchsiaResourceDialect,
8392            >,
8393            offset: usize,
8394            _depth: fidl::encoding::Depth,
8395        ) -> fidl::Result<()> {
8396            encoder.debug_check_bounds::<NamespaceCreateRequest>(offset);
8397            // Delegate to tuple encoding.
8398            fidl::encoding::Encode::<NamespaceCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8399                (
8400                    <fidl::encoding::UnboundedVector<NamespaceInputEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
8401                ),
8402                encoder, offset, _depth
8403            )
8404        }
8405    }
8406    unsafe impl<
8407        T0: fidl::encoding::Encode<
8408                fidl::encoding::UnboundedVector<NamespaceInputEntry>,
8409                fidl::encoding::DefaultFuchsiaResourceDialect,
8410            >,
8411    >
8412        fidl::encoding::Encode<
8413            NamespaceCreateRequest,
8414            fidl::encoding::DefaultFuchsiaResourceDialect,
8415        > for (T0,)
8416    {
8417        #[inline]
8418        unsafe fn encode(
8419            self,
8420            encoder: &mut fidl::encoding::Encoder<
8421                '_,
8422                fidl::encoding::DefaultFuchsiaResourceDialect,
8423            >,
8424            offset: usize,
8425            depth: fidl::encoding::Depth,
8426        ) -> fidl::Result<()> {
8427            encoder.debug_check_bounds::<NamespaceCreateRequest>(offset);
8428            // Zero out padding regions. There's no need to apply masks
8429            // because the unmasked parts will be overwritten by fields.
8430            // Write the fields.
8431            self.0.encode(encoder, offset + 0, depth)?;
8432            Ok(())
8433        }
8434    }
8435
8436    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8437        for NamespaceCreateRequest
8438    {
8439        #[inline(always)]
8440        fn new_empty() -> Self {
8441            Self {
8442                entries: fidl::new_empty!(
8443                    fidl::encoding::UnboundedVector<NamespaceInputEntry>,
8444                    fidl::encoding::DefaultFuchsiaResourceDialect
8445                ),
8446            }
8447        }
8448
8449        #[inline]
8450        unsafe fn decode(
8451            &mut self,
8452            decoder: &mut fidl::encoding::Decoder<
8453                '_,
8454                fidl::encoding::DefaultFuchsiaResourceDialect,
8455            >,
8456            offset: usize,
8457            _depth: fidl::encoding::Depth,
8458        ) -> fidl::Result<()> {
8459            decoder.debug_check_bounds::<Self>(offset);
8460            // Verify that padding bytes are zero.
8461            fidl::decode!(
8462                fidl::encoding::UnboundedVector<NamespaceInputEntry>,
8463                fidl::encoding::DefaultFuchsiaResourceDialect,
8464                &mut self.entries,
8465                decoder,
8466                offset + 0,
8467                _depth
8468            )?;
8469            Ok(())
8470        }
8471    }
8472
8473    impl fidl::encoding::ResourceTypeMarker for NamespaceInputEntry {
8474        type Borrowed<'a> = &'a mut Self;
8475        fn take_or_borrow<'a>(
8476            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8477        ) -> Self::Borrowed<'a> {
8478            value
8479        }
8480    }
8481
8482    unsafe impl fidl::encoding::TypeMarker for NamespaceInputEntry {
8483        type Owned = Self;
8484
8485        #[inline(always)]
8486        fn inline_align(_context: fidl::encoding::Context) -> usize {
8487            8
8488        }
8489
8490        #[inline(always)]
8491        fn inline_size(_context: fidl::encoding::Context) -> usize {
8492            24
8493        }
8494    }
8495
8496    unsafe impl
8497        fidl::encoding::Encode<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
8498        for &mut NamespaceInputEntry
8499    {
8500        #[inline]
8501        unsafe fn encode(
8502            self,
8503            encoder: &mut fidl::encoding::Encoder<
8504                '_,
8505                fidl::encoding::DefaultFuchsiaResourceDialect,
8506            >,
8507            offset: usize,
8508            _depth: fidl::encoding::Depth,
8509        ) -> fidl::Result<()> {
8510            encoder.debug_check_bounds::<NamespaceInputEntry>(offset);
8511            // Delegate to tuple encoding.
8512            fidl::encoding::Encode::<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8513                (
8514                    <fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
8515                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
8516                ),
8517                encoder, offset, _depth
8518            )
8519        }
8520    }
8521    unsafe impl<
8522        T0: fidl::encoding::Encode<
8523                fidl::encoding::BoundedString<4095>,
8524                fidl::encoding::DefaultFuchsiaResourceDialect,
8525            >,
8526        T1: fidl::encoding::Encode<
8527                fidl::encoding::Endpoint<
8528                    fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
8529                >,
8530                fidl::encoding::DefaultFuchsiaResourceDialect,
8531            >,
8532    > fidl::encoding::Encode<NamespaceInputEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
8533        for (T0, T1)
8534    {
8535        #[inline]
8536        unsafe fn encode(
8537            self,
8538            encoder: &mut fidl::encoding::Encoder<
8539                '_,
8540                fidl::encoding::DefaultFuchsiaResourceDialect,
8541            >,
8542            offset: usize,
8543            depth: fidl::encoding::Depth,
8544        ) -> fidl::Result<()> {
8545            encoder.debug_check_bounds::<NamespaceInputEntry>(offset);
8546            // Zero out padding regions. There's no need to apply masks
8547            // because the unmasked parts will be overwritten by fields.
8548            unsafe {
8549                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8550                (ptr as *mut u64).write_unaligned(0);
8551            }
8552            // Write the fields.
8553            self.0.encode(encoder, offset + 0, depth)?;
8554            self.1.encode(encoder, offset + 16, depth)?;
8555            Ok(())
8556        }
8557    }
8558
8559    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8560        for NamespaceInputEntry
8561    {
8562        #[inline(always)]
8563        fn new_empty() -> Self {
8564            Self {
8565                path: fidl::new_empty!(
8566                    fidl::encoding::BoundedString<4095>,
8567                    fidl::encoding::DefaultFuchsiaResourceDialect
8568                ),
8569                dictionary: fidl::new_empty!(
8570                    fidl::encoding::Endpoint<
8571                        fidl::endpoints::ClientEnd<
8572                            fidl_fuchsia_component_sandbox::DictionaryMarker,
8573                        >,
8574                    >,
8575                    fidl::encoding::DefaultFuchsiaResourceDialect
8576                ),
8577            }
8578        }
8579
8580        #[inline]
8581        unsafe fn decode(
8582            &mut self,
8583            decoder: &mut fidl::encoding::Decoder<
8584                '_,
8585                fidl::encoding::DefaultFuchsiaResourceDialect,
8586            >,
8587            offset: usize,
8588            _depth: fidl::encoding::Depth,
8589        ) -> fidl::Result<()> {
8590            decoder.debug_check_bounds::<Self>(offset);
8591            // Verify that padding bytes are zero.
8592            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8593            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8594            let mask = 0xffffffff00000000u64;
8595            let maskedval = padval & mask;
8596            if maskedval != 0 {
8597                return Err(fidl::Error::NonZeroPadding {
8598                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8599                });
8600            }
8601            fidl::decode!(
8602                fidl::encoding::BoundedString<4095>,
8603                fidl::encoding::DefaultFuchsiaResourceDialect,
8604                &mut self.path,
8605                decoder,
8606                offset + 0,
8607                _depth
8608            )?;
8609            fidl::decode!(
8610                fidl::encoding::Endpoint<
8611                    fidl::endpoints::ClientEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
8612                >,
8613                fidl::encoding::DefaultFuchsiaResourceDialect,
8614                &mut self.dictionary,
8615                decoder,
8616                offset + 16,
8617                _depth
8618            )?;
8619            Ok(())
8620        }
8621    }
8622
8623    impl fidl::encoding::ResourceTypeMarker for NamespaceCreateResponse {
8624        type Borrowed<'a> = &'a mut Self;
8625        fn take_or_borrow<'a>(
8626            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8627        ) -> Self::Borrowed<'a> {
8628            value
8629        }
8630    }
8631
8632    unsafe impl fidl::encoding::TypeMarker for NamespaceCreateResponse {
8633        type Owned = Self;
8634
8635        #[inline(always)]
8636        fn inline_align(_context: fidl::encoding::Context) -> usize {
8637            8
8638        }
8639
8640        #[inline(always)]
8641        fn inline_size(_context: fidl::encoding::Context) -> usize {
8642            16
8643        }
8644    }
8645
8646    unsafe impl
8647        fidl::encoding::Encode<
8648            NamespaceCreateResponse,
8649            fidl::encoding::DefaultFuchsiaResourceDialect,
8650        > for &mut NamespaceCreateResponse
8651    {
8652        #[inline]
8653        unsafe fn encode(
8654            self,
8655            encoder: &mut fidl::encoding::Encoder<
8656                '_,
8657                fidl::encoding::DefaultFuchsiaResourceDialect,
8658            >,
8659            offset: usize,
8660            _depth: fidl::encoding::Depth,
8661        ) -> fidl::Result<()> {
8662            encoder.debug_check_bounds::<NamespaceCreateResponse>(offset);
8663            // Delegate to tuple encoding.
8664            fidl::encoding::Encode::<NamespaceCreateResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8665                (
8666                    <fidl::encoding::UnboundedVector<NamespaceEntry> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
8667                ),
8668                encoder, offset, _depth
8669            )
8670        }
8671    }
8672    unsafe impl<
8673        T0: fidl::encoding::Encode<
8674                fidl::encoding::UnboundedVector<NamespaceEntry>,
8675                fidl::encoding::DefaultFuchsiaResourceDialect,
8676            >,
8677    >
8678        fidl::encoding::Encode<
8679            NamespaceCreateResponse,
8680            fidl::encoding::DefaultFuchsiaResourceDialect,
8681        > for (T0,)
8682    {
8683        #[inline]
8684        unsafe fn encode(
8685            self,
8686            encoder: &mut fidl::encoding::Encoder<
8687                '_,
8688                fidl::encoding::DefaultFuchsiaResourceDialect,
8689            >,
8690            offset: usize,
8691            depth: fidl::encoding::Depth,
8692        ) -> fidl::Result<()> {
8693            encoder.debug_check_bounds::<NamespaceCreateResponse>(offset);
8694            // Zero out padding regions. There's no need to apply masks
8695            // because the unmasked parts will be overwritten by fields.
8696            // Write the fields.
8697            self.0.encode(encoder, offset + 0, depth)?;
8698            Ok(())
8699        }
8700    }
8701
8702    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8703        for NamespaceCreateResponse
8704    {
8705        #[inline(always)]
8706        fn new_empty() -> Self {
8707            Self {
8708                entries: fidl::new_empty!(
8709                    fidl::encoding::UnboundedVector<NamespaceEntry>,
8710                    fidl::encoding::DefaultFuchsiaResourceDialect
8711                ),
8712            }
8713        }
8714
8715        #[inline]
8716        unsafe fn decode(
8717            &mut self,
8718            decoder: &mut fidl::encoding::Decoder<
8719                '_,
8720                fidl::encoding::DefaultFuchsiaResourceDialect,
8721            >,
8722            offset: usize,
8723            _depth: fidl::encoding::Depth,
8724        ) -> fidl::Result<()> {
8725            decoder.debug_check_bounds::<Self>(offset);
8726            // Verify that padding bytes are zero.
8727            fidl::decode!(
8728                fidl::encoding::UnboundedVector<NamespaceEntry>,
8729                fidl::encoding::DefaultFuchsiaResourceDialect,
8730                &mut self.entries,
8731                decoder,
8732                offset + 0,
8733                _depth
8734            )?;
8735            Ok(())
8736        }
8737    }
8738
8739    impl fidl::encoding::ResourceTypeMarker for RealmCreateChildRequest {
8740        type Borrowed<'a> = &'a mut Self;
8741        fn take_or_borrow<'a>(
8742            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8743        ) -> Self::Borrowed<'a> {
8744            value
8745        }
8746    }
8747
8748    unsafe impl fidl::encoding::TypeMarker for RealmCreateChildRequest {
8749        type Owned = Self;
8750
8751        #[inline(always)]
8752        fn inline_align(_context: fidl::encoding::Context) -> usize {
8753            8
8754        }
8755
8756        #[inline(always)]
8757        fn inline_size(_context: fidl::encoding::Context) -> usize {
8758            48
8759        }
8760    }
8761
8762    unsafe impl
8763        fidl::encoding::Encode<
8764            RealmCreateChildRequest,
8765            fidl::encoding::DefaultFuchsiaResourceDialect,
8766        > for &mut RealmCreateChildRequest
8767    {
8768        #[inline]
8769        unsafe fn encode(
8770            self,
8771            encoder: &mut fidl::encoding::Encoder<
8772                '_,
8773                fidl::encoding::DefaultFuchsiaResourceDialect,
8774            >,
8775            offset: usize,
8776            _depth: fidl::encoding::Depth,
8777        ) -> fidl::Result<()> {
8778            encoder.debug_check_bounds::<RealmCreateChildRequest>(offset);
8779            // Delegate to tuple encoding.
8780            fidl::encoding::Encode::<RealmCreateChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8781                (
8782                    <fidl_fuchsia_component_decl::CollectionRef as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
8783                    <fidl_fuchsia_component_decl::Child as fidl::encoding::ValueTypeMarker>::borrow(&self.decl),
8784                    <CreateChildArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
8785                ),
8786                encoder, offset, _depth
8787            )
8788        }
8789    }
8790    unsafe impl<
8791        T0: fidl::encoding::Encode<
8792                fidl_fuchsia_component_decl::CollectionRef,
8793                fidl::encoding::DefaultFuchsiaResourceDialect,
8794            >,
8795        T1: fidl::encoding::Encode<
8796                fidl_fuchsia_component_decl::Child,
8797                fidl::encoding::DefaultFuchsiaResourceDialect,
8798            >,
8799        T2: fidl::encoding::Encode<CreateChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
8800    >
8801        fidl::encoding::Encode<
8802            RealmCreateChildRequest,
8803            fidl::encoding::DefaultFuchsiaResourceDialect,
8804        > for (T0, T1, T2)
8805    {
8806        #[inline]
8807        unsafe fn encode(
8808            self,
8809            encoder: &mut fidl::encoding::Encoder<
8810                '_,
8811                fidl::encoding::DefaultFuchsiaResourceDialect,
8812            >,
8813            offset: usize,
8814            depth: fidl::encoding::Depth,
8815        ) -> fidl::Result<()> {
8816            encoder.debug_check_bounds::<RealmCreateChildRequest>(offset);
8817            // Zero out padding regions. There's no need to apply masks
8818            // because the unmasked parts will be overwritten by fields.
8819            // Write the fields.
8820            self.0.encode(encoder, offset + 0, depth)?;
8821            self.1.encode(encoder, offset + 16, depth)?;
8822            self.2.encode(encoder, offset + 32, depth)?;
8823            Ok(())
8824        }
8825    }
8826
8827    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8828        for RealmCreateChildRequest
8829    {
8830        #[inline(always)]
8831        fn new_empty() -> Self {
8832            Self {
8833                collection: fidl::new_empty!(
8834                    fidl_fuchsia_component_decl::CollectionRef,
8835                    fidl::encoding::DefaultFuchsiaResourceDialect
8836                ),
8837                decl: fidl::new_empty!(
8838                    fidl_fuchsia_component_decl::Child,
8839                    fidl::encoding::DefaultFuchsiaResourceDialect
8840                ),
8841                args: fidl::new_empty!(
8842                    CreateChildArgs,
8843                    fidl::encoding::DefaultFuchsiaResourceDialect
8844                ),
8845            }
8846        }
8847
8848        #[inline]
8849        unsafe fn decode(
8850            &mut self,
8851            decoder: &mut fidl::encoding::Decoder<
8852                '_,
8853                fidl::encoding::DefaultFuchsiaResourceDialect,
8854            >,
8855            offset: usize,
8856            _depth: fidl::encoding::Depth,
8857        ) -> fidl::Result<()> {
8858            decoder.debug_check_bounds::<Self>(offset);
8859            // Verify that padding bytes are zero.
8860            fidl::decode!(
8861                fidl_fuchsia_component_decl::CollectionRef,
8862                fidl::encoding::DefaultFuchsiaResourceDialect,
8863                &mut self.collection,
8864                decoder,
8865                offset + 0,
8866                _depth
8867            )?;
8868            fidl::decode!(
8869                fidl_fuchsia_component_decl::Child,
8870                fidl::encoding::DefaultFuchsiaResourceDialect,
8871                &mut self.decl,
8872                decoder,
8873                offset + 16,
8874                _depth
8875            )?;
8876            fidl::decode!(
8877                CreateChildArgs,
8878                fidl::encoding::DefaultFuchsiaResourceDialect,
8879                &mut self.args,
8880                decoder,
8881                offset + 32,
8882                _depth
8883            )?;
8884            Ok(())
8885        }
8886    }
8887
8888    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryRequest {
8889        type Borrowed<'a> = &'a mut Self;
8890        fn take_or_borrow<'a>(
8891            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8892        ) -> Self::Borrowed<'a> {
8893            value
8894        }
8895    }
8896
8897    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryRequest {
8898        type Owned = Self;
8899
8900        #[inline(always)]
8901        fn inline_align(_context: fidl::encoding::Context) -> usize {
8902            8
8903        }
8904
8905        #[inline(always)]
8906        fn inline_size(_context: fidl::encoding::Context) -> usize {
8907            32
8908        }
8909    }
8910
8911    unsafe impl
8912        fidl::encoding::Encode<
8913            RealmGetChildOutputDictionaryRequest,
8914            fidl::encoding::DefaultFuchsiaResourceDialect,
8915        > for &mut RealmGetChildOutputDictionaryRequest
8916    {
8917        #[inline]
8918        unsafe fn encode(
8919            self,
8920            encoder: &mut fidl::encoding::Encoder<
8921                '_,
8922                fidl::encoding::DefaultFuchsiaResourceDialect,
8923            >,
8924            offset: usize,
8925            _depth: fidl::encoding::Depth,
8926        ) -> fidl::Result<()> {
8927            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryRequest>(offset);
8928            // Delegate to tuple encoding.
8929            fidl::encoding::Encode::<RealmGetChildOutputDictionaryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8930                (
8931                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
8932                ),
8933                encoder, offset, _depth
8934            )
8935        }
8936    }
8937    unsafe impl<
8938        T0: fidl::encoding::Encode<
8939                fidl_fuchsia_component_decl::ChildRef,
8940                fidl::encoding::DefaultFuchsiaResourceDialect,
8941            >,
8942    >
8943        fidl::encoding::Encode<
8944            RealmGetChildOutputDictionaryRequest,
8945            fidl::encoding::DefaultFuchsiaResourceDialect,
8946        > for (T0,)
8947    {
8948        #[inline]
8949        unsafe fn encode(
8950            self,
8951            encoder: &mut fidl::encoding::Encoder<
8952                '_,
8953                fidl::encoding::DefaultFuchsiaResourceDialect,
8954            >,
8955            offset: usize,
8956            depth: fidl::encoding::Depth,
8957        ) -> fidl::Result<()> {
8958            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryRequest>(offset);
8959            // Zero out padding regions. There's no need to apply masks
8960            // because the unmasked parts will be overwritten by fields.
8961            // Write the fields.
8962            self.0.encode(encoder, offset + 0, depth)?;
8963            Ok(())
8964        }
8965    }
8966
8967    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8968        for RealmGetChildOutputDictionaryRequest
8969    {
8970        #[inline(always)]
8971        fn new_empty() -> Self {
8972            Self {
8973                child: fidl::new_empty!(
8974                    fidl_fuchsia_component_decl::ChildRef,
8975                    fidl::encoding::DefaultFuchsiaResourceDialect
8976                ),
8977            }
8978        }
8979
8980        #[inline]
8981        unsafe fn decode(
8982            &mut self,
8983            decoder: &mut fidl::encoding::Decoder<
8984                '_,
8985                fidl::encoding::DefaultFuchsiaResourceDialect,
8986            >,
8987            offset: usize,
8988            _depth: fidl::encoding::Depth,
8989        ) -> fidl::Result<()> {
8990            decoder.debug_check_bounds::<Self>(offset);
8991            // Verify that padding bytes are zero.
8992            fidl::decode!(
8993                fidl_fuchsia_component_decl::ChildRef,
8994                fidl::encoding::DefaultFuchsiaResourceDialect,
8995                &mut self.child,
8996                decoder,
8997                offset + 0,
8998                _depth
8999            )?;
9000            Ok(())
9001        }
9002    }
9003
9004    impl fidl::encoding::ResourceTypeMarker for RealmListChildrenRequest {
9005        type Borrowed<'a> = &'a mut Self;
9006        fn take_or_borrow<'a>(
9007            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9008        ) -> Self::Borrowed<'a> {
9009            value
9010        }
9011    }
9012
9013    unsafe impl fidl::encoding::TypeMarker for RealmListChildrenRequest {
9014        type Owned = Self;
9015
9016        #[inline(always)]
9017        fn inline_align(_context: fidl::encoding::Context) -> usize {
9018            8
9019        }
9020
9021        #[inline(always)]
9022        fn inline_size(_context: fidl::encoding::Context) -> usize {
9023            24
9024        }
9025    }
9026
9027    unsafe impl
9028        fidl::encoding::Encode<
9029            RealmListChildrenRequest,
9030            fidl::encoding::DefaultFuchsiaResourceDialect,
9031        > for &mut RealmListChildrenRequest
9032    {
9033        #[inline]
9034        unsafe fn encode(
9035            self,
9036            encoder: &mut fidl::encoding::Encoder<
9037                '_,
9038                fidl::encoding::DefaultFuchsiaResourceDialect,
9039            >,
9040            offset: usize,
9041            _depth: fidl::encoding::Depth,
9042        ) -> fidl::Result<()> {
9043            encoder.debug_check_bounds::<RealmListChildrenRequest>(offset);
9044            // Delegate to tuple encoding.
9045            fidl::encoding::Encode::<RealmListChildrenRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9046                (
9047                    <fidl_fuchsia_component_decl::CollectionRef as fidl::encoding::ValueTypeMarker>::borrow(&self.collection),
9048                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iter),
9049                ),
9050                encoder, offset, _depth
9051            )
9052        }
9053    }
9054    unsafe impl<
9055        T0: fidl::encoding::Encode<
9056                fidl_fuchsia_component_decl::CollectionRef,
9057                fidl::encoding::DefaultFuchsiaResourceDialect,
9058            >,
9059        T1: fidl::encoding::Encode<
9060                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
9061                fidl::encoding::DefaultFuchsiaResourceDialect,
9062            >,
9063    >
9064        fidl::encoding::Encode<
9065            RealmListChildrenRequest,
9066            fidl::encoding::DefaultFuchsiaResourceDialect,
9067        > for (T0, T1)
9068    {
9069        #[inline]
9070        unsafe fn encode(
9071            self,
9072            encoder: &mut fidl::encoding::Encoder<
9073                '_,
9074                fidl::encoding::DefaultFuchsiaResourceDialect,
9075            >,
9076            offset: usize,
9077            depth: fidl::encoding::Depth,
9078        ) -> fidl::Result<()> {
9079            encoder.debug_check_bounds::<RealmListChildrenRequest>(offset);
9080            // Zero out padding regions. There's no need to apply masks
9081            // because the unmasked parts will be overwritten by fields.
9082            unsafe {
9083                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9084                (ptr as *mut u64).write_unaligned(0);
9085            }
9086            // Write the fields.
9087            self.0.encode(encoder, offset + 0, depth)?;
9088            self.1.encode(encoder, offset + 16, depth)?;
9089            Ok(())
9090        }
9091    }
9092
9093    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9094        for RealmListChildrenRequest
9095    {
9096        #[inline(always)]
9097        fn new_empty() -> Self {
9098            Self {
9099                collection: fidl::new_empty!(
9100                    fidl_fuchsia_component_decl::CollectionRef,
9101                    fidl::encoding::DefaultFuchsiaResourceDialect
9102                ),
9103                iter: fidl::new_empty!(
9104                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
9105                    fidl::encoding::DefaultFuchsiaResourceDialect
9106                ),
9107            }
9108        }
9109
9110        #[inline]
9111        unsafe fn decode(
9112            &mut self,
9113            decoder: &mut fidl::encoding::Decoder<
9114                '_,
9115                fidl::encoding::DefaultFuchsiaResourceDialect,
9116            >,
9117            offset: usize,
9118            _depth: fidl::encoding::Depth,
9119        ) -> fidl::Result<()> {
9120            decoder.debug_check_bounds::<Self>(offset);
9121            // Verify that padding bytes are zero.
9122            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9123            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9124            let mask = 0xffffffff00000000u64;
9125            let maskedval = padval & mask;
9126            if maskedval != 0 {
9127                return Err(fidl::Error::NonZeroPadding {
9128                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9129                });
9130            }
9131            fidl::decode!(
9132                fidl_fuchsia_component_decl::CollectionRef,
9133                fidl::encoding::DefaultFuchsiaResourceDialect,
9134                &mut self.collection,
9135                decoder,
9136                offset + 0,
9137                _depth
9138            )?;
9139            fidl::decode!(
9140                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChildIteratorMarker>>,
9141                fidl::encoding::DefaultFuchsiaResourceDialect,
9142                &mut self.iter,
9143                decoder,
9144                offset + 16,
9145                _depth
9146            )?;
9147            Ok(())
9148        }
9149    }
9150
9151    impl fidl::encoding::ResourceTypeMarker for RealmOpenControllerRequest {
9152        type Borrowed<'a> = &'a mut Self;
9153        fn take_or_borrow<'a>(
9154            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9155        ) -> Self::Borrowed<'a> {
9156            value
9157        }
9158    }
9159
9160    unsafe impl fidl::encoding::TypeMarker for RealmOpenControllerRequest {
9161        type Owned = Self;
9162
9163        #[inline(always)]
9164        fn inline_align(_context: fidl::encoding::Context) -> usize {
9165            8
9166        }
9167
9168        #[inline(always)]
9169        fn inline_size(_context: fidl::encoding::Context) -> usize {
9170            40
9171        }
9172    }
9173
9174    unsafe impl
9175        fidl::encoding::Encode<
9176            RealmOpenControllerRequest,
9177            fidl::encoding::DefaultFuchsiaResourceDialect,
9178        > for &mut RealmOpenControllerRequest
9179    {
9180        #[inline]
9181        unsafe fn encode(
9182            self,
9183            encoder: &mut fidl::encoding::Encoder<
9184                '_,
9185                fidl::encoding::DefaultFuchsiaResourceDialect,
9186            >,
9187            offset: usize,
9188            _depth: fidl::encoding::Depth,
9189        ) -> fidl::Result<()> {
9190            encoder.debug_check_bounds::<RealmOpenControllerRequest>(offset);
9191            // Delegate to tuple encoding.
9192            fidl::encoding::Encode::<RealmOpenControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9193                (
9194                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
9195                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
9196                ),
9197                encoder, offset, _depth
9198            )
9199        }
9200    }
9201    unsafe impl<
9202        T0: fidl::encoding::Encode<
9203                fidl_fuchsia_component_decl::ChildRef,
9204                fidl::encoding::DefaultFuchsiaResourceDialect,
9205            >,
9206        T1: fidl::encoding::Encode<
9207                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
9208                fidl::encoding::DefaultFuchsiaResourceDialect,
9209            >,
9210    >
9211        fidl::encoding::Encode<
9212            RealmOpenControllerRequest,
9213            fidl::encoding::DefaultFuchsiaResourceDialect,
9214        > for (T0, T1)
9215    {
9216        #[inline]
9217        unsafe fn encode(
9218            self,
9219            encoder: &mut fidl::encoding::Encoder<
9220                '_,
9221                fidl::encoding::DefaultFuchsiaResourceDialect,
9222            >,
9223            offset: usize,
9224            depth: fidl::encoding::Depth,
9225        ) -> fidl::Result<()> {
9226            encoder.debug_check_bounds::<RealmOpenControllerRequest>(offset);
9227            // Zero out padding regions. There's no need to apply masks
9228            // because the unmasked parts will be overwritten by fields.
9229            unsafe {
9230                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9231                (ptr as *mut u64).write_unaligned(0);
9232            }
9233            // Write the fields.
9234            self.0.encode(encoder, offset + 0, depth)?;
9235            self.1.encode(encoder, offset + 32, depth)?;
9236            Ok(())
9237        }
9238    }
9239
9240    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9241        for RealmOpenControllerRequest
9242    {
9243        #[inline(always)]
9244        fn new_empty() -> Self {
9245            Self {
9246                child: fidl::new_empty!(
9247                    fidl_fuchsia_component_decl::ChildRef,
9248                    fidl::encoding::DefaultFuchsiaResourceDialect
9249                ),
9250                controller: fidl::new_empty!(
9251                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
9252                    fidl::encoding::DefaultFuchsiaResourceDialect
9253                ),
9254            }
9255        }
9256
9257        #[inline]
9258        unsafe fn decode(
9259            &mut self,
9260            decoder: &mut fidl::encoding::Decoder<
9261                '_,
9262                fidl::encoding::DefaultFuchsiaResourceDialect,
9263            >,
9264            offset: usize,
9265            _depth: fidl::encoding::Depth,
9266        ) -> fidl::Result<()> {
9267            decoder.debug_check_bounds::<Self>(offset);
9268            // Verify that padding bytes are zero.
9269            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9270            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9271            let mask = 0xffffffff00000000u64;
9272            let maskedval = padval & mask;
9273            if maskedval != 0 {
9274                return Err(fidl::Error::NonZeroPadding {
9275                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9276                });
9277            }
9278            fidl::decode!(
9279                fidl_fuchsia_component_decl::ChildRef,
9280                fidl::encoding::DefaultFuchsiaResourceDialect,
9281                &mut self.child,
9282                decoder,
9283                offset + 0,
9284                _depth
9285            )?;
9286            fidl::decode!(
9287                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
9288                fidl::encoding::DefaultFuchsiaResourceDialect,
9289                &mut self.controller,
9290                decoder,
9291                offset + 32,
9292                _depth
9293            )?;
9294            Ok(())
9295        }
9296    }
9297
9298    impl fidl::encoding::ResourceTypeMarker for RealmOpenExposedDirRequest {
9299        type Borrowed<'a> = &'a mut Self;
9300        fn take_or_borrow<'a>(
9301            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9302        ) -> Self::Borrowed<'a> {
9303            value
9304        }
9305    }
9306
9307    unsafe impl fidl::encoding::TypeMarker for RealmOpenExposedDirRequest {
9308        type Owned = Self;
9309
9310        #[inline(always)]
9311        fn inline_align(_context: fidl::encoding::Context) -> usize {
9312            8
9313        }
9314
9315        #[inline(always)]
9316        fn inline_size(_context: fidl::encoding::Context) -> usize {
9317            40
9318        }
9319    }
9320
9321    unsafe impl
9322        fidl::encoding::Encode<
9323            RealmOpenExposedDirRequest,
9324            fidl::encoding::DefaultFuchsiaResourceDialect,
9325        > for &mut RealmOpenExposedDirRequest
9326    {
9327        #[inline]
9328        unsafe fn encode(
9329            self,
9330            encoder: &mut fidl::encoding::Encoder<
9331                '_,
9332                fidl::encoding::DefaultFuchsiaResourceDialect,
9333            >,
9334            offset: usize,
9335            _depth: fidl::encoding::Depth,
9336        ) -> fidl::Result<()> {
9337            encoder.debug_check_bounds::<RealmOpenExposedDirRequest>(offset);
9338            // Delegate to tuple encoding.
9339            fidl::encoding::Encode::<RealmOpenExposedDirRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9340                (
9341                    <fidl_fuchsia_component_decl::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
9342                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.exposed_dir),
9343                ),
9344                encoder, offset, _depth
9345            )
9346        }
9347    }
9348    unsafe impl<
9349        T0: fidl::encoding::Encode<
9350                fidl_fuchsia_component_decl::ChildRef,
9351                fidl::encoding::DefaultFuchsiaResourceDialect,
9352            >,
9353        T1: fidl::encoding::Encode<
9354                fidl::encoding::Endpoint<
9355                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9356                >,
9357                fidl::encoding::DefaultFuchsiaResourceDialect,
9358            >,
9359    >
9360        fidl::encoding::Encode<
9361            RealmOpenExposedDirRequest,
9362            fidl::encoding::DefaultFuchsiaResourceDialect,
9363        > for (T0, T1)
9364    {
9365        #[inline]
9366        unsafe fn encode(
9367            self,
9368            encoder: &mut fidl::encoding::Encoder<
9369                '_,
9370                fidl::encoding::DefaultFuchsiaResourceDialect,
9371            >,
9372            offset: usize,
9373            depth: fidl::encoding::Depth,
9374        ) -> fidl::Result<()> {
9375            encoder.debug_check_bounds::<RealmOpenExposedDirRequest>(offset);
9376            // Zero out padding regions. There's no need to apply masks
9377            // because the unmasked parts will be overwritten by fields.
9378            unsafe {
9379                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9380                (ptr as *mut u64).write_unaligned(0);
9381            }
9382            // Write the fields.
9383            self.0.encode(encoder, offset + 0, depth)?;
9384            self.1.encode(encoder, offset + 32, depth)?;
9385            Ok(())
9386        }
9387    }
9388
9389    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9390        for RealmOpenExposedDirRequest
9391    {
9392        #[inline(always)]
9393        fn new_empty() -> Self {
9394            Self {
9395                child: fidl::new_empty!(
9396                    fidl_fuchsia_component_decl::ChildRef,
9397                    fidl::encoding::DefaultFuchsiaResourceDialect
9398                ),
9399                exposed_dir: fidl::new_empty!(
9400                    fidl::encoding::Endpoint<
9401                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9402                    >,
9403                    fidl::encoding::DefaultFuchsiaResourceDialect
9404                ),
9405            }
9406        }
9407
9408        #[inline]
9409        unsafe fn decode(
9410            &mut self,
9411            decoder: &mut fidl::encoding::Decoder<
9412                '_,
9413                fidl::encoding::DefaultFuchsiaResourceDialect,
9414            >,
9415            offset: usize,
9416            _depth: fidl::encoding::Depth,
9417        ) -> fidl::Result<()> {
9418            decoder.debug_check_bounds::<Self>(offset);
9419            // Verify that padding bytes are zero.
9420            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9421            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9422            let mask = 0xffffffff00000000u64;
9423            let maskedval = padval & mask;
9424            if maskedval != 0 {
9425                return Err(fidl::Error::NonZeroPadding {
9426                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9427                });
9428            }
9429            fidl::decode!(
9430                fidl_fuchsia_component_decl::ChildRef,
9431                fidl::encoding::DefaultFuchsiaResourceDialect,
9432                &mut self.child,
9433                decoder,
9434                offset + 0,
9435                _depth
9436            )?;
9437            fidl::decode!(
9438                fidl::encoding::Endpoint<
9439                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
9440                >,
9441                fidl::encoding::DefaultFuchsiaResourceDialect,
9442                &mut self.exposed_dir,
9443                decoder,
9444                offset + 32,
9445                _depth
9446            )?;
9447            Ok(())
9448        }
9449    }
9450
9451    impl fidl::encoding::ResourceTypeMarker for RealmGetChildOutputDictionaryResponse {
9452        type Borrowed<'a> = &'a mut Self;
9453        fn take_or_borrow<'a>(
9454            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9455        ) -> Self::Borrowed<'a> {
9456            value
9457        }
9458    }
9459
9460    unsafe impl fidl::encoding::TypeMarker for RealmGetChildOutputDictionaryResponse {
9461        type Owned = Self;
9462
9463        #[inline(always)]
9464        fn inline_align(_context: fidl::encoding::Context) -> usize {
9465            4
9466        }
9467
9468        #[inline(always)]
9469        fn inline_size(_context: fidl::encoding::Context) -> usize {
9470            4
9471        }
9472    }
9473
9474    unsafe impl
9475        fidl::encoding::Encode<
9476            RealmGetChildOutputDictionaryResponse,
9477            fidl::encoding::DefaultFuchsiaResourceDialect,
9478        > for &mut RealmGetChildOutputDictionaryResponse
9479    {
9480        #[inline]
9481        unsafe fn encode(
9482            self,
9483            encoder: &mut fidl::encoding::Encoder<
9484                '_,
9485                fidl::encoding::DefaultFuchsiaResourceDialect,
9486            >,
9487            offset: usize,
9488            _depth: fidl::encoding::Depth,
9489        ) -> fidl::Result<()> {
9490            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryResponse>(offset);
9491            // Delegate to tuple encoding.
9492            fidl::encoding::Encode::<RealmGetChildOutputDictionaryResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9493                (
9494                    <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
9495                ),
9496                encoder, offset, _depth
9497            )
9498        }
9499    }
9500    unsafe impl<
9501        T0: fidl::encoding::Encode<
9502                fidl_fuchsia_component_sandbox::DictionaryRef,
9503                fidl::encoding::DefaultFuchsiaResourceDialect,
9504            >,
9505    >
9506        fidl::encoding::Encode<
9507            RealmGetChildOutputDictionaryResponse,
9508            fidl::encoding::DefaultFuchsiaResourceDialect,
9509        > for (T0,)
9510    {
9511        #[inline]
9512        unsafe fn encode(
9513            self,
9514            encoder: &mut fidl::encoding::Encoder<
9515                '_,
9516                fidl::encoding::DefaultFuchsiaResourceDialect,
9517            >,
9518            offset: usize,
9519            depth: fidl::encoding::Depth,
9520        ) -> fidl::Result<()> {
9521            encoder.debug_check_bounds::<RealmGetChildOutputDictionaryResponse>(offset);
9522            // Zero out padding regions. There's no need to apply masks
9523            // because the unmasked parts will be overwritten by fields.
9524            // Write the fields.
9525            self.0.encode(encoder, offset + 0, depth)?;
9526            Ok(())
9527        }
9528    }
9529
9530    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9531        for RealmGetChildOutputDictionaryResponse
9532    {
9533        #[inline(always)]
9534        fn new_empty() -> Self {
9535            Self {
9536                dictionary: fidl::new_empty!(
9537                    fidl_fuchsia_component_sandbox::DictionaryRef,
9538                    fidl::encoding::DefaultFuchsiaResourceDialect
9539                ),
9540            }
9541        }
9542
9543        #[inline]
9544        unsafe fn decode(
9545            &mut self,
9546            decoder: &mut fidl::encoding::Decoder<
9547                '_,
9548                fidl::encoding::DefaultFuchsiaResourceDialect,
9549            >,
9550            offset: usize,
9551            _depth: fidl::encoding::Depth,
9552        ) -> fidl::Result<()> {
9553            decoder.debug_check_bounds::<Self>(offset);
9554            // Verify that padding bytes are zero.
9555            fidl::decode!(
9556                fidl_fuchsia_component_sandbox::DictionaryRef,
9557                fidl::encoding::DefaultFuchsiaResourceDialect,
9558                &mut self.dictionary,
9559                decoder,
9560                offset + 0,
9561                _depth
9562            )?;
9563            Ok(())
9564        }
9565    }
9566
9567    impl fidl::encoding::ResourceTypeMarker for RealmGetResolvedInfoResponse {
9568        type Borrowed<'a> = &'a mut Self;
9569        fn take_or_borrow<'a>(
9570            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9571        ) -> Self::Borrowed<'a> {
9572            value
9573        }
9574    }
9575
9576    unsafe impl fidl::encoding::TypeMarker for RealmGetResolvedInfoResponse {
9577        type Owned = Self;
9578
9579        #[inline(always)]
9580        fn inline_align(_context: fidl::encoding::Context) -> usize {
9581            8
9582        }
9583
9584        #[inline(always)]
9585        fn inline_size(_context: fidl::encoding::Context) -> usize {
9586            16
9587        }
9588    }
9589
9590    unsafe impl
9591        fidl::encoding::Encode<
9592            RealmGetResolvedInfoResponse,
9593            fidl::encoding::DefaultFuchsiaResourceDialect,
9594        > for &mut RealmGetResolvedInfoResponse
9595    {
9596        #[inline]
9597        unsafe fn encode(
9598            self,
9599            encoder: &mut fidl::encoding::Encoder<
9600                '_,
9601                fidl::encoding::DefaultFuchsiaResourceDialect,
9602            >,
9603            offset: usize,
9604            _depth: fidl::encoding::Depth,
9605        ) -> fidl::Result<()> {
9606            encoder.debug_check_bounds::<RealmGetResolvedInfoResponse>(offset);
9607            // Delegate to tuple encoding.
9608            fidl::encoding::Encode::<RealmGetResolvedInfoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9609                (
9610                    <fidl_fuchsia_component_resolution::Component as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.resolved_info),
9611                ),
9612                encoder, offset, _depth
9613            )
9614        }
9615    }
9616    unsafe impl<
9617        T0: fidl::encoding::Encode<
9618                fidl_fuchsia_component_resolution::Component,
9619                fidl::encoding::DefaultFuchsiaResourceDialect,
9620            >,
9621    >
9622        fidl::encoding::Encode<
9623            RealmGetResolvedInfoResponse,
9624            fidl::encoding::DefaultFuchsiaResourceDialect,
9625        > for (T0,)
9626    {
9627        #[inline]
9628        unsafe fn encode(
9629            self,
9630            encoder: &mut fidl::encoding::Encoder<
9631                '_,
9632                fidl::encoding::DefaultFuchsiaResourceDialect,
9633            >,
9634            offset: usize,
9635            depth: fidl::encoding::Depth,
9636        ) -> fidl::Result<()> {
9637            encoder.debug_check_bounds::<RealmGetResolvedInfoResponse>(offset);
9638            // Zero out padding regions. There's no need to apply masks
9639            // because the unmasked parts will be overwritten by fields.
9640            // Write the fields.
9641            self.0.encode(encoder, offset + 0, depth)?;
9642            Ok(())
9643        }
9644    }
9645
9646    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9647        for RealmGetResolvedInfoResponse
9648    {
9649        #[inline(always)]
9650        fn new_empty() -> Self {
9651            Self {
9652                resolved_info: fidl::new_empty!(
9653                    fidl_fuchsia_component_resolution::Component,
9654                    fidl::encoding::DefaultFuchsiaResourceDialect
9655                ),
9656            }
9657        }
9658
9659        #[inline]
9660        unsafe fn decode(
9661            &mut self,
9662            decoder: &mut fidl::encoding::Decoder<
9663                '_,
9664                fidl::encoding::DefaultFuchsiaResourceDialect,
9665            >,
9666            offset: usize,
9667            _depth: fidl::encoding::Depth,
9668        ) -> fidl::Result<()> {
9669            decoder.debug_check_bounds::<Self>(offset);
9670            // Verify that padding bytes are zero.
9671            fidl::decode!(
9672                fidl_fuchsia_component_resolution::Component,
9673                fidl::encoding::DefaultFuchsiaResourceDialect,
9674                &mut self.resolved_info,
9675                decoder,
9676                offset + 0,
9677                _depth
9678            )?;
9679            Ok(())
9680        }
9681    }
9682
9683    impl fidl::encoding::ResourceTypeMarker for StorageAdminListStorageInRealmRequest {
9684        type Borrowed<'a> = &'a mut Self;
9685        fn take_or_borrow<'a>(
9686            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9687        ) -> Self::Borrowed<'a> {
9688            value
9689        }
9690    }
9691
9692    unsafe impl fidl::encoding::TypeMarker for StorageAdminListStorageInRealmRequest {
9693        type Owned = Self;
9694
9695        #[inline(always)]
9696        fn inline_align(_context: fidl::encoding::Context) -> usize {
9697            8
9698        }
9699
9700        #[inline(always)]
9701        fn inline_size(_context: fidl::encoding::Context) -> usize {
9702            24
9703        }
9704    }
9705
9706    unsafe impl
9707        fidl::encoding::Encode<
9708            StorageAdminListStorageInRealmRequest,
9709            fidl::encoding::DefaultFuchsiaResourceDialect,
9710        > for &mut StorageAdminListStorageInRealmRequest
9711    {
9712        #[inline]
9713        unsafe fn encode(
9714            self,
9715            encoder: &mut fidl::encoding::Encoder<
9716                '_,
9717                fidl::encoding::DefaultFuchsiaResourceDialect,
9718            >,
9719            offset: usize,
9720            _depth: fidl::encoding::Depth,
9721        ) -> fidl::Result<()> {
9722            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
9723            // Delegate to tuple encoding.
9724            fidl::encoding::Encode::<StorageAdminListStorageInRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9725                (
9726                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
9727                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
9728                ),
9729                encoder, offset, _depth
9730            )
9731        }
9732    }
9733    unsafe impl<
9734        T0: fidl::encoding::Encode<
9735                fidl::encoding::BoundedString<4096>,
9736                fidl::encoding::DefaultFuchsiaResourceDialect,
9737            >,
9738        T1: fidl::encoding::Encode<
9739                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
9740                fidl::encoding::DefaultFuchsiaResourceDialect,
9741            >,
9742    >
9743        fidl::encoding::Encode<
9744            StorageAdminListStorageInRealmRequest,
9745            fidl::encoding::DefaultFuchsiaResourceDialect,
9746        > for (T0, T1)
9747    {
9748        #[inline]
9749        unsafe fn encode(
9750            self,
9751            encoder: &mut fidl::encoding::Encoder<
9752                '_,
9753                fidl::encoding::DefaultFuchsiaResourceDialect,
9754            >,
9755            offset: usize,
9756            depth: fidl::encoding::Depth,
9757        ) -> fidl::Result<()> {
9758            encoder.debug_check_bounds::<StorageAdminListStorageInRealmRequest>(offset);
9759            // Zero out padding regions. There's no need to apply masks
9760            // because the unmasked parts will be overwritten by fields.
9761            unsafe {
9762                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9763                (ptr as *mut u64).write_unaligned(0);
9764            }
9765            // Write the fields.
9766            self.0.encode(encoder, offset + 0, depth)?;
9767            self.1.encode(encoder, offset + 16, depth)?;
9768            Ok(())
9769        }
9770    }
9771
9772    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9773        for StorageAdminListStorageInRealmRequest
9774    {
9775        #[inline(always)]
9776        fn new_empty() -> Self {
9777            Self {
9778                relative_moniker: fidl::new_empty!(
9779                    fidl::encoding::BoundedString<4096>,
9780                    fidl::encoding::DefaultFuchsiaResourceDialect
9781                ),
9782                iterator: fidl::new_empty!(
9783                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
9784                    fidl::encoding::DefaultFuchsiaResourceDialect
9785                ),
9786            }
9787        }
9788
9789        #[inline]
9790        unsafe fn decode(
9791            &mut self,
9792            decoder: &mut fidl::encoding::Decoder<
9793                '_,
9794                fidl::encoding::DefaultFuchsiaResourceDialect,
9795            >,
9796            offset: usize,
9797            _depth: fidl::encoding::Depth,
9798        ) -> fidl::Result<()> {
9799            decoder.debug_check_bounds::<Self>(offset);
9800            // Verify that padding bytes are zero.
9801            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9802            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9803            let mask = 0xffffffff00000000u64;
9804            let maskedval = padval & mask;
9805            if maskedval != 0 {
9806                return Err(fidl::Error::NonZeroPadding {
9807                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9808                });
9809            }
9810            fidl::decode!(
9811                fidl::encoding::BoundedString<4096>,
9812                fidl::encoding::DefaultFuchsiaResourceDialect,
9813                &mut self.relative_moniker,
9814                decoder,
9815                offset + 0,
9816                _depth
9817            )?;
9818            fidl::decode!(
9819                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StorageIteratorMarker>>,
9820                fidl::encoding::DefaultFuchsiaResourceDialect,
9821                &mut self.iterator,
9822                decoder,
9823                offset + 16,
9824                _depth
9825            )?;
9826            Ok(())
9827        }
9828    }
9829
9830    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenComponentStorageByIdRequest {
9831        type Borrowed<'a> = &'a mut Self;
9832        fn take_or_borrow<'a>(
9833            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9834        ) -> Self::Borrowed<'a> {
9835            value
9836        }
9837    }
9838
9839    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenComponentStorageByIdRequest {
9840        type Owned = Self;
9841
9842        #[inline(always)]
9843        fn inline_align(_context: fidl::encoding::Context) -> usize {
9844            8
9845        }
9846
9847        #[inline(always)]
9848        fn inline_size(_context: fidl::encoding::Context) -> usize {
9849            24
9850        }
9851    }
9852
9853    unsafe impl
9854        fidl::encoding::Encode<
9855            StorageAdminOpenComponentStorageByIdRequest,
9856            fidl::encoding::DefaultFuchsiaResourceDialect,
9857        > for &mut StorageAdminOpenComponentStorageByIdRequest
9858    {
9859        #[inline]
9860        unsafe fn encode(
9861            self,
9862            encoder: &mut fidl::encoding::Encoder<
9863                '_,
9864                fidl::encoding::DefaultFuchsiaResourceDialect,
9865            >,
9866            offset: usize,
9867            _depth: fidl::encoding::Depth,
9868        ) -> fidl::Result<()> {
9869            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
9870            // Delegate to tuple encoding.
9871            fidl::encoding::Encode::<
9872                StorageAdminOpenComponentStorageByIdRequest,
9873                fidl::encoding::DefaultFuchsiaResourceDialect,
9874            >::encode(
9875                (
9876                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
9877                        &self.id,
9878                    ),
9879                    <fidl::encoding::Endpoint<
9880                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
9881                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9882                        &mut self.object
9883                    ),
9884                ),
9885                encoder,
9886                offset,
9887                _depth,
9888            )
9889        }
9890    }
9891    unsafe impl<
9892        T0: fidl::encoding::Encode<
9893                fidl::encoding::BoundedString<64>,
9894                fidl::encoding::DefaultFuchsiaResourceDialect,
9895            >,
9896        T1: fidl::encoding::Encode<
9897                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
9898                fidl::encoding::DefaultFuchsiaResourceDialect,
9899            >,
9900    >
9901        fidl::encoding::Encode<
9902            StorageAdminOpenComponentStorageByIdRequest,
9903            fidl::encoding::DefaultFuchsiaResourceDialect,
9904        > for (T0, T1)
9905    {
9906        #[inline]
9907        unsafe fn encode(
9908            self,
9909            encoder: &mut fidl::encoding::Encoder<
9910                '_,
9911                fidl::encoding::DefaultFuchsiaResourceDialect,
9912            >,
9913            offset: usize,
9914            depth: fidl::encoding::Depth,
9915        ) -> fidl::Result<()> {
9916            encoder.debug_check_bounds::<StorageAdminOpenComponentStorageByIdRequest>(offset);
9917            // Zero out padding regions. There's no need to apply masks
9918            // because the unmasked parts will be overwritten by fields.
9919            unsafe {
9920                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9921                (ptr as *mut u64).write_unaligned(0);
9922            }
9923            // Write the fields.
9924            self.0.encode(encoder, offset + 0, depth)?;
9925            self.1.encode(encoder, offset + 16, depth)?;
9926            Ok(())
9927        }
9928    }
9929
9930    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9931        for StorageAdminOpenComponentStorageByIdRequest
9932    {
9933        #[inline(always)]
9934        fn new_empty() -> Self {
9935            Self {
9936                id: fidl::new_empty!(
9937                    fidl::encoding::BoundedString<64>,
9938                    fidl::encoding::DefaultFuchsiaResourceDialect
9939                ),
9940                object: fidl::new_empty!(
9941                    fidl::encoding::Endpoint<
9942                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
9943                    >,
9944                    fidl::encoding::DefaultFuchsiaResourceDialect
9945                ),
9946            }
9947        }
9948
9949        #[inline]
9950        unsafe fn decode(
9951            &mut self,
9952            decoder: &mut fidl::encoding::Decoder<
9953                '_,
9954                fidl::encoding::DefaultFuchsiaResourceDialect,
9955            >,
9956            offset: usize,
9957            _depth: fidl::encoding::Depth,
9958        ) -> fidl::Result<()> {
9959            decoder.debug_check_bounds::<Self>(offset);
9960            // Verify that padding bytes are zero.
9961            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9962            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9963            let mask = 0xffffffff00000000u64;
9964            let maskedval = padval & mask;
9965            if maskedval != 0 {
9966                return Err(fidl::Error::NonZeroPadding {
9967                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9968                });
9969            }
9970            fidl::decode!(
9971                fidl::encoding::BoundedString<64>,
9972                fidl::encoding::DefaultFuchsiaResourceDialect,
9973                &mut self.id,
9974                decoder,
9975                offset + 0,
9976                _depth
9977            )?;
9978            fidl::decode!(
9979                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
9980                fidl::encoding::DefaultFuchsiaResourceDialect,
9981                &mut self.object,
9982                decoder,
9983                offset + 16,
9984                _depth
9985            )?;
9986            Ok(())
9987        }
9988    }
9989
9990    impl fidl::encoding::ResourceTypeMarker for StorageAdminOpenStorageRequest {
9991        type Borrowed<'a> = &'a mut Self;
9992        fn take_or_borrow<'a>(
9993            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9994        ) -> Self::Borrowed<'a> {
9995            value
9996        }
9997    }
9998
9999    unsafe impl fidl::encoding::TypeMarker for StorageAdminOpenStorageRequest {
10000        type Owned = Self;
10001
10002        #[inline(always)]
10003        fn inline_align(_context: fidl::encoding::Context) -> usize {
10004            8
10005        }
10006
10007        #[inline(always)]
10008        fn inline_size(_context: fidl::encoding::Context) -> usize {
10009            24
10010        }
10011    }
10012
10013    unsafe impl
10014        fidl::encoding::Encode<
10015            StorageAdminOpenStorageRequest,
10016            fidl::encoding::DefaultFuchsiaResourceDialect,
10017        > for &mut StorageAdminOpenStorageRequest
10018    {
10019        #[inline]
10020        unsafe fn encode(
10021            self,
10022            encoder: &mut fidl::encoding::Encoder<
10023                '_,
10024                fidl::encoding::DefaultFuchsiaResourceDialect,
10025            >,
10026            offset: usize,
10027            _depth: fidl::encoding::Depth,
10028        ) -> fidl::Result<()> {
10029            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
10030            // Delegate to tuple encoding.
10031            fidl::encoding::Encode::<StorageAdminOpenStorageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10032                (
10033                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_moniker),
10034                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.object),
10035                ),
10036                encoder, offset, _depth
10037            )
10038        }
10039    }
10040    unsafe impl<
10041        T0: fidl::encoding::Encode<
10042                fidl::encoding::BoundedString<4096>,
10043                fidl::encoding::DefaultFuchsiaResourceDialect,
10044            >,
10045        T1: fidl::encoding::Encode<
10046                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
10047                fidl::encoding::DefaultFuchsiaResourceDialect,
10048            >,
10049    >
10050        fidl::encoding::Encode<
10051            StorageAdminOpenStorageRequest,
10052            fidl::encoding::DefaultFuchsiaResourceDialect,
10053        > for (T0, T1)
10054    {
10055        #[inline]
10056        unsafe fn encode(
10057            self,
10058            encoder: &mut fidl::encoding::Encoder<
10059                '_,
10060                fidl::encoding::DefaultFuchsiaResourceDialect,
10061            >,
10062            offset: usize,
10063            depth: fidl::encoding::Depth,
10064        ) -> fidl::Result<()> {
10065            encoder.debug_check_bounds::<StorageAdminOpenStorageRequest>(offset);
10066            // Zero out padding regions. There's no need to apply masks
10067            // because the unmasked parts will be overwritten by fields.
10068            unsafe {
10069                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10070                (ptr as *mut u64).write_unaligned(0);
10071            }
10072            // Write the fields.
10073            self.0.encode(encoder, offset + 0, depth)?;
10074            self.1.encode(encoder, offset + 16, depth)?;
10075            Ok(())
10076        }
10077    }
10078
10079    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10080        for StorageAdminOpenStorageRequest
10081    {
10082        #[inline(always)]
10083        fn new_empty() -> Self {
10084            Self {
10085                relative_moniker: fidl::new_empty!(
10086                    fidl::encoding::BoundedString<4096>,
10087                    fidl::encoding::DefaultFuchsiaResourceDialect
10088                ),
10089                object: fidl::new_empty!(
10090                    fidl::encoding::Endpoint<
10091                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>,
10092                    >,
10093                    fidl::encoding::DefaultFuchsiaResourceDialect
10094                ),
10095            }
10096        }
10097
10098        #[inline]
10099        unsafe fn decode(
10100            &mut self,
10101            decoder: &mut fidl::encoding::Decoder<
10102                '_,
10103                fidl::encoding::DefaultFuchsiaResourceDialect,
10104            >,
10105            offset: usize,
10106            _depth: fidl::encoding::Depth,
10107        ) -> fidl::Result<()> {
10108            decoder.debug_check_bounds::<Self>(offset);
10109            // Verify that padding bytes are zero.
10110            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10111            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10112            let mask = 0xffffffff00000000u64;
10113            let maskedval = padval & mask;
10114            if maskedval != 0 {
10115                return Err(fidl::Error::NonZeroPadding {
10116                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10117                });
10118            }
10119            fidl::decode!(
10120                fidl::encoding::BoundedString<4096>,
10121                fidl::encoding::DefaultFuchsiaResourceDialect,
10122                &mut self.relative_moniker,
10123                decoder,
10124                offset + 0,
10125                _depth
10126            )?;
10127            fidl::decode!(
10128                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_io::NodeMarker>>,
10129                fidl::encoding::DefaultFuchsiaResourceDialect,
10130                &mut self.object,
10131                decoder,
10132                offset + 16,
10133                _depth
10134            )?;
10135            Ok(())
10136        }
10137    }
10138
10139    impl CapabilityRequestedPayload {
10140        #[inline(always)]
10141        fn max_ordinal_present(&self) -> u64 {
10142            if let Some(_) = self.capability {
10143                return 2;
10144            }
10145            if let Some(_) = self.name {
10146                return 1;
10147            }
10148            0
10149        }
10150    }
10151
10152    impl fidl::encoding::ResourceTypeMarker for CapabilityRequestedPayload {
10153        type Borrowed<'a> = &'a mut Self;
10154        fn take_or_borrow<'a>(
10155            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10156        ) -> Self::Borrowed<'a> {
10157            value
10158        }
10159    }
10160
10161    unsafe impl fidl::encoding::TypeMarker for CapabilityRequestedPayload {
10162        type Owned = Self;
10163
10164        #[inline(always)]
10165        fn inline_align(_context: fidl::encoding::Context) -> usize {
10166            8
10167        }
10168
10169        #[inline(always)]
10170        fn inline_size(_context: fidl::encoding::Context) -> usize {
10171            16
10172        }
10173    }
10174
10175    unsafe impl
10176        fidl::encoding::Encode<
10177            CapabilityRequestedPayload,
10178            fidl::encoding::DefaultFuchsiaResourceDialect,
10179        > for &mut CapabilityRequestedPayload
10180    {
10181        unsafe fn encode(
10182            self,
10183            encoder: &mut fidl::encoding::Encoder<
10184                '_,
10185                fidl::encoding::DefaultFuchsiaResourceDialect,
10186            >,
10187            offset: usize,
10188            mut depth: fidl::encoding::Depth,
10189        ) -> fidl::Result<()> {
10190            encoder.debug_check_bounds::<CapabilityRequestedPayload>(offset);
10191            // Vector header
10192            let max_ordinal: u64 = self.max_ordinal_present();
10193            encoder.write_num(max_ordinal, offset);
10194            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10195            // Calling encoder.out_of_line_offset(0) is not allowed.
10196            if max_ordinal == 0 {
10197                return Ok(());
10198            }
10199            depth.increment()?;
10200            let envelope_size = 8;
10201            let bytes_len = max_ordinal as usize * envelope_size;
10202            #[allow(unused_variables)]
10203            let offset = encoder.out_of_line_offset(bytes_len);
10204            let mut _prev_end_offset: usize = 0;
10205            if 1 > max_ordinal {
10206                return Ok(());
10207            }
10208
10209            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10210            // are envelope_size bytes.
10211            let cur_offset: usize = (1 - 1) * envelope_size;
10212
10213            // Zero reserved fields.
10214            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10215
10216            // Safety:
10217            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10218            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10219            //   envelope_size bytes, there is always sufficient room.
10220            fidl::encoding::encode_in_envelope_optional::<
10221                fidl::encoding::BoundedString<255>,
10222                fidl::encoding::DefaultFuchsiaResourceDialect,
10223            >(
10224                self.name.as_ref().map(
10225                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
10226                ),
10227                encoder,
10228                offset + cur_offset,
10229                depth,
10230            )?;
10231
10232            _prev_end_offset = cur_offset + envelope_size;
10233            if 2 > max_ordinal {
10234                return Ok(());
10235            }
10236
10237            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10238            // are envelope_size bytes.
10239            let cur_offset: usize = (2 - 1) * envelope_size;
10240
10241            // Zero reserved fields.
10242            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10243
10244            // Safety:
10245            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10246            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10247            //   envelope_size bytes, there is always sufficient room.
10248            fidl::encoding::encode_in_envelope_optional::<
10249                fidl::encoding::HandleType<
10250                    fidl::Channel,
10251                    { fidl::ObjectType::CHANNEL.into_raw() },
10252                    2147483648,
10253                >,
10254                fidl::encoding::DefaultFuchsiaResourceDialect,
10255            >(
10256                self.capability.as_mut().map(
10257                    <fidl::encoding::HandleType<
10258                        fidl::Channel,
10259                        { fidl::ObjectType::CHANNEL.into_raw() },
10260                        2147483648,
10261                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10262                ),
10263                encoder,
10264                offset + cur_offset,
10265                depth,
10266            )?;
10267
10268            _prev_end_offset = cur_offset + envelope_size;
10269
10270            Ok(())
10271        }
10272    }
10273
10274    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10275        for CapabilityRequestedPayload
10276    {
10277        #[inline(always)]
10278        fn new_empty() -> Self {
10279            Self::default()
10280        }
10281
10282        unsafe fn decode(
10283            &mut self,
10284            decoder: &mut fidl::encoding::Decoder<
10285                '_,
10286                fidl::encoding::DefaultFuchsiaResourceDialect,
10287            >,
10288            offset: usize,
10289            mut depth: fidl::encoding::Depth,
10290        ) -> fidl::Result<()> {
10291            decoder.debug_check_bounds::<Self>(offset);
10292            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10293                None => return Err(fidl::Error::NotNullable),
10294                Some(len) => len,
10295            };
10296            // Calling decoder.out_of_line_offset(0) is not allowed.
10297            if len == 0 {
10298                return Ok(());
10299            };
10300            depth.increment()?;
10301            let envelope_size = 8;
10302            let bytes_len = len * envelope_size;
10303            let offset = decoder.out_of_line_offset(bytes_len)?;
10304            // Decode the envelope for each type.
10305            let mut _next_ordinal_to_read = 0;
10306            let mut next_offset = offset;
10307            let end_offset = offset + bytes_len;
10308            _next_ordinal_to_read += 1;
10309            if next_offset >= end_offset {
10310                return Ok(());
10311            }
10312
10313            // Decode unknown envelopes for gaps in ordinals.
10314            while _next_ordinal_to_read < 1 {
10315                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10316                _next_ordinal_to_read += 1;
10317                next_offset += envelope_size;
10318            }
10319
10320            let next_out_of_line = decoder.next_out_of_line();
10321            let handles_before = decoder.remaining_handles();
10322            if let Some((inlined, num_bytes, num_handles)) =
10323                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10324            {
10325                let member_inline_size =
10326                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
10327                        decoder.context,
10328                    );
10329                if inlined != (member_inline_size <= 4) {
10330                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10331                }
10332                let inner_offset;
10333                let mut inner_depth = depth.clone();
10334                if inlined {
10335                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10336                    inner_offset = next_offset;
10337                } else {
10338                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10339                    inner_depth.increment()?;
10340                }
10341                let val_ref = self.name.get_or_insert_with(|| {
10342                    fidl::new_empty!(
10343                        fidl::encoding::BoundedString<255>,
10344                        fidl::encoding::DefaultFuchsiaResourceDialect
10345                    )
10346                });
10347                fidl::decode!(
10348                    fidl::encoding::BoundedString<255>,
10349                    fidl::encoding::DefaultFuchsiaResourceDialect,
10350                    val_ref,
10351                    decoder,
10352                    inner_offset,
10353                    inner_depth
10354                )?;
10355                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10356                {
10357                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10358                }
10359                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10360                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10361                }
10362            }
10363
10364            next_offset += envelope_size;
10365            _next_ordinal_to_read += 1;
10366            if next_offset >= end_offset {
10367                return Ok(());
10368            }
10369
10370            // Decode unknown envelopes for gaps in ordinals.
10371            while _next_ordinal_to_read < 2 {
10372                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10373                _next_ordinal_to_read += 1;
10374                next_offset += envelope_size;
10375            }
10376
10377            let next_out_of_line = decoder.next_out_of_line();
10378            let handles_before = decoder.remaining_handles();
10379            if let Some((inlined, num_bytes, num_handles)) =
10380                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10381            {
10382                let member_inline_size = <fidl::encoding::HandleType<
10383                    fidl::Channel,
10384                    { fidl::ObjectType::CHANNEL.into_raw() },
10385                    2147483648,
10386                > as fidl::encoding::TypeMarker>::inline_size(
10387                    decoder.context
10388                );
10389                if inlined != (member_inline_size <= 4) {
10390                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10391                }
10392                let inner_offset;
10393                let mut inner_depth = depth.clone();
10394                if inlined {
10395                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10396                    inner_offset = next_offset;
10397                } else {
10398                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10399                    inner_depth.increment()?;
10400                }
10401                let val_ref =
10402                self.capability.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10403                fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10404                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10405                {
10406                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10407                }
10408                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10409                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10410                }
10411            }
10412
10413            next_offset += envelope_size;
10414
10415            // Decode the remaining unknown envelopes.
10416            while next_offset < end_offset {
10417                _next_ordinal_to_read += 1;
10418                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10419                next_offset += envelope_size;
10420            }
10421
10422            Ok(())
10423        }
10424    }
10425
10426    impl CreateChildArgs {
10427        #[inline(always)]
10428        fn max_ordinal_present(&self) -> u64 {
10429            if let Some(_) = self.dictionary {
10430                return 4;
10431            }
10432            if let Some(_) = self.controller {
10433                return 3;
10434            }
10435            if let Some(_) = self.dynamic_offers {
10436                return 2;
10437            }
10438            if let Some(_) = self.numbered_handles {
10439                return 1;
10440            }
10441            0
10442        }
10443    }
10444
10445    impl fidl::encoding::ResourceTypeMarker for CreateChildArgs {
10446        type Borrowed<'a> = &'a mut Self;
10447        fn take_or_borrow<'a>(
10448            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10449        ) -> Self::Borrowed<'a> {
10450            value
10451        }
10452    }
10453
10454    unsafe impl fidl::encoding::TypeMarker for CreateChildArgs {
10455        type Owned = Self;
10456
10457        #[inline(always)]
10458        fn inline_align(_context: fidl::encoding::Context) -> usize {
10459            8
10460        }
10461
10462        #[inline(always)]
10463        fn inline_size(_context: fidl::encoding::Context) -> usize {
10464            16
10465        }
10466    }
10467
10468    unsafe impl
10469        fidl::encoding::Encode<CreateChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
10470        for &mut CreateChildArgs
10471    {
10472        unsafe fn encode(
10473            self,
10474            encoder: &mut fidl::encoding::Encoder<
10475                '_,
10476                fidl::encoding::DefaultFuchsiaResourceDialect,
10477            >,
10478            offset: usize,
10479            mut depth: fidl::encoding::Depth,
10480        ) -> fidl::Result<()> {
10481            encoder.debug_check_bounds::<CreateChildArgs>(offset);
10482            // Vector header
10483            let max_ordinal: u64 = self.max_ordinal_present();
10484            encoder.write_num(max_ordinal, offset);
10485            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10486            // Calling encoder.out_of_line_offset(0) is not allowed.
10487            if max_ordinal == 0 {
10488                return Ok(());
10489            }
10490            depth.increment()?;
10491            let envelope_size = 8;
10492            let bytes_len = max_ordinal as usize * envelope_size;
10493            #[allow(unused_variables)]
10494            let offset = encoder.out_of_line_offset(bytes_len);
10495            let mut _prev_end_offset: usize = 0;
10496            if 1 > max_ordinal {
10497                return Ok(());
10498            }
10499
10500            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10501            // are envelope_size bytes.
10502            let cur_offset: usize = (1 - 1) * envelope_size;
10503
10504            // Zero reserved fields.
10505            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10506
10507            // Safety:
10508            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10509            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10510            //   envelope_size bytes, there is always sufficient room.
10511            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10512            self.numbered_handles.as_mut().map(<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10513            encoder, offset + cur_offset, depth
10514        )?;
10515
10516            _prev_end_offset = cur_offset + envelope_size;
10517            if 2 > max_ordinal {
10518                return Ok(());
10519            }
10520
10521            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10522            // are envelope_size bytes.
10523            let cur_offset: usize = (2 - 1) * envelope_size;
10524
10525            // Zero reserved fields.
10526            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10527
10528            // Safety:
10529            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10530            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10531            //   envelope_size bytes, there is always sufficient room.
10532            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10533            self.dynamic_offers.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128> as fidl::encoding::ValueTypeMarker>::borrow),
10534            encoder, offset + cur_offset, depth
10535        )?;
10536
10537            _prev_end_offset = cur_offset + envelope_size;
10538            if 3 > max_ordinal {
10539                return Ok(());
10540            }
10541
10542            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10543            // are envelope_size bytes.
10544            let cur_offset: usize = (3 - 1) * envelope_size;
10545
10546            // Zero reserved fields.
10547            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10548
10549            // Safety:
10550            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10551            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10552            //   envelope_size bytes, there is always sufficient room.
10553            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10554            self.controller.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10555            encoder, offset + cur_offset, depth
10556        )?;
10557
10558            _prev_end_offset = cur_offset + envelope_size;
10559            if 4 > max_ordinal {
10560                return Ok(());
10561            }
10562
10563            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10564            // are envelope_size bytes.
10565            let cur_offset: usize = (4 - 1) * envelope_size;
10566
10567            // Zero reserved fields.
10568            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10569
10570            // Safety:
10571            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10572            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10573            //   envelope_size bytes, there is always sufficient room.
10574            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
10575            self.dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10576            encoder, offset + cur_offset, depth
10577        )?;
10578
10579            _prev_end_offset = cur_offset + envelope_size;
10580
10581            Ok(())
10582        }
10583    }
10584
10585    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10586        for CreateChildArgs
10587    {
10588        #[inline(always)]
10589        fn new_empty() -> Self {
10590            Self::default()
10591        }
10592
10593        unsafe fn decode(
10594            &mut self,
10595            decoder: &mut fidl::encoding::Decoder<
10596                '_,
10597                fidl::encoding::DefaultFuchsiaResourceDialect,
10598            >,
10599            offset: usize,
10600            mut depth: fidl::encoding::Depth,
10601        ) -> fidl::Result<()> {
10602            decoder.debug_check_bounds::<Self>(offset);
10603            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10604                None => return Err(fidl::Error::NotNullable),
10605                Some(len) => len,
10606            };
10607            // Calling decoder.out_of_line_offset(0) is not allowed.
10608            if len == 0 {
10609                return Ok(());
10610            };
10611            depth.increment()?;
10612            let envelope_size = 8;
10613            let bytes_len = len * envelope_size;
10614            let offset = decoder.out_of_line_offset(bytes_len)?;
10615            // Decode the envelope for each type.
10616            let mut _next_ordinal_to_read = 0;
10617            let mut next_offset = offset;
10618            let end_offset = offset + bytes_len;
10619            _next_ordinal_to_read += 1;
10620            if next_offset >= end_offset {
10621                return Ok(());
10622            }
10623
10624            // Decode unknown envelopes for gaps in ordinals.
10625            while _next_ordinal_to_read < 1 {
10626                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10627                _next_ordinal_to_read += 1;
10628                next_offset += envelope_size;
10629            }
10630
10631            let next_out_of_line = decoder.next_out_of_line();
10632            let handles_before = decoder.remaining_handles();
10633            if let Some((inlined, num_bytes, num_handles)) =
10634                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10635            {
10636                let member_inline_size = <fidl::encoding::Vector<
10637                    fidl_fuchsia_process::HandleInfo,
10638                    128,
10639                > as fidl::encoding::TypeMarker>::inline_size(
10640                    decoder.context
10641                );
10642                if inlined != (member_inline_size <= 4) {
10643                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10644                }
10645                let inner_offset;
10646                let mut inner_depth = depth.clone();
10647                if inlined {
10648                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10649                    inner_offset = next_offset;
10650                } else {
10651                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10652                    inner_depth.increment()?;
10653                }
10654                let val_ref =
10655                self.numbered_handles.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
10656                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10657                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10658                {
10659                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10660                }
10661                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10662                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10663                }
10664            }
10665
10666            next_offset += envelope_size;
10667            _next_ordinal_to_read += 1;
10668            if next_offset >= end_offset {
10669                return Ok(());
10670            }
10671
10672            // Decode unknown envelopes for gaps in ordinals.
10673            while _next_ordinal_to_read < 2 {
10674                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10675                _next_ordinal_to_read += 1;
10676                next_offset += envelope_size;
10677            }
10678
10679            let next_out_of_line = decoder.next_out_of_line();
10680            let handles_before = decoder.remaining_handles();
10681            if let Some((inlined, num_bytes, num_handles)) =
10682                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10683            {
10684                let member_inline_size = <fidl::encoding::Vector<
10685                    fidl_fuchsia_component_decl::Offer,
10686                    128,
10687                > as fidl::encoding::TypeMarker>::inline_size(
10688                    decoder.context
10689                );
10690                if inlined != (member_inline_size <= 4) {
10691                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10692                }
10693                let inner_offset;
10694                let mut inner_depth = depth.clone();
10695                if inlined {
10696                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10697                    inner_offset = next_offset;
10698                } else {
10699                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10700                    inner_depth.increment()?;
10701                }
10702                let val_ref =
10703                self.dynamic_offers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
10704                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_component_decl::Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10705                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10706                {
10707                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10708                }
10709                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10710                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10711                }
10712            }
10713
10714            next_offset += envelope_size;
10715            _next_ordinal_to_read += 1;
10716            if next_offset >= end_offset {
10717                return Ok(());
10718            }
10719
10720            // Decode unknown envelopes for gaps in ordinals.
10721            while _next_ordinal_to_read < 3 {
10722                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10723                _next_ordinal_to_read += 1;
10724                next_offset += envelope_size;
10725            }
10726
10727            let next_out_of_line = decoder.next_out_of_line();
10728            let handles_before = decoder.remaining_handles();
10729            if let Some((inlined, num_bytes, num_handles)) =
10730                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10731            {
10732                let member_inline_size = <fidl::encoding::Endpoint<
10733                    fidl::endpoints::ServerEnd<ControllerMarker>,
10734                > as fidl::encoding::TypeMarker>::inline_size(
10735                    decoder.context
10736                );
10737                if inlined != (member_inline_size <= 4) {
10738                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10739                }
10740                let inner_offset;
10741                let mut inner_depth = depth.clone();
10742                if inlined {
10743                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10744                    inner_offset = next_offset;
10745                } else {
10746                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10747                    inner_depth.increment()?;
10748                }
10749                let val_ref = self.controller.get_or_insert_with(|| {
10750                    fidl::new_empty!(
10751                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10752                        fidl::encoding::DefaultFuchsiaResourceDialect
10753                    )
10754                });
10755                fidl::decode!(
10756                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10757                    fidl::encoding::DefaultFuchsiaResourceDialect,
10758                    val_ref,
10759                    decoder,
10760                    inner_offset,
10761                    inner_depth
10762                )?;
10763                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10764                {
10765                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10766                }
10767                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10768                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10769                }
10770            }
10771
10772            next_offset += envelope_size;
10773            _next_ordinal_to_read += 1;
10774            if next_offset >= end_offset {
10775                return Ok(());
10776            }
10777
10778            // Decode unknown envelopes for gaps in ordinals.
10779            while _next_ordinal_to_read < 4 {
10780                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10781                _next_ordinal_to_read += 1;
10782                next_offset += envelope_size;
10783            }
10784
10785            let next_out_of_line = decoder.next_out_of_line();
10786            let handles_before = decoder.remaining_handles();
10787            if let Some((inlined, num_bytes, num_handles)) =
10788                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10789            {
10790                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10791                if inlined != (member_inline_size <= 4) {
10792                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10793                }
10794                let inner_offset;
10795                let mut inner_depth = depth.clone();
10796                if inlined {
10797                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10798                    inner_offset = next_offset;
10799                } else {
10800                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10801                    inner_depth.increment()?;
10802                }
10803                let val_ref = self.dictionary.get_or_insert_with(|| {
10804                    fidl::new_empty!(
10805                        fidl_fuchsia_component_sandbox::DictionaryRef,
10806                        fidl::encoding::DefaultFuchsiaResourceDialect
10807                    )
10808                });
10809                fidl::decode!(
10810                    fidl_fuchsia_component_sandbox::DictionaryRef,
10811                    fidl::encoding::DefaultFuchsiaResourceDialect,
10812                    val_ref,
10813                    decoder,
10814                    inner_offset,
10815                    inner_depth
10816                )?;
10817                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10818                {
10819                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10820                }
10821                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10822                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10823                }
10824            }
10825
10826            next_offset += envelope_size;
10827
10828            // Decode the remaining unknown envelopes.
10829            while next_offset < end_offset {
10830                _next_ordinal_to_read += 1;
10831                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10832                next_offset += envelope_size;
10833            }
10834
10835            Ok(())
10836        }
10837    }
10838
10839    impl DebugStartedPayload {
10840        #[inline(always)]
10841        fn max_ordinal_present(&self) -> u64 {
10842            if let Some(_) = self.break_on_start {
10843                return 2;
10844            }
10845            if let Some(_) = self.runtime_dir {
10846                return 1;
10847            }
10848            0
10849        }
10850    }
10851
10852    impl fidl::encoding::ResourceTypeMarker for DebugStartedPayload {
10853        type Borrowed<'a> = &'a mut Self;
10854        fn take_or_borrow<'a>(
10855            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10856        ) -> Self::Borrowed<'a> {
10857            value
10858        }
10859    }
10860
10861    unsafe impl fidl::encoding::TypeMarker for DebugStartedPayload {
10862        type Owned = Self;
10863
10864        #[inline(always)]
10865        fn inline_align(_context: fidl::encoding::Context) -> usize {
10866            8
10867        }
10868
10869        #[inline(always)]
10870        fn inline_size(_context: fidl::encoding::Context) -> usize {
10871            16
10872        }
10873    }
10874
10875    unsafe impl
10876        fidl::encoding::Encode<DebugStartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>
10877        for &mut DebugStartedPayload
10878    {
10879        unsafe fn encode(
10880            self,
10881            encoder: &mut fidl::encoding::Encoder<
10882                '_,
10883                fidl::encoding::DefaultFuchsiaResourceDialect,
10884            >,
10885            offset: usize,
10886            mut depth: fidl::encoding::Depth,
10887        ) -> fidl::Result<()> {
10888            encoder.debug_check_bounds::<DebugStartedPayload>(offset);
10889            // Vector header
10890            let max_ordinal: u64 = self.max_ordinal_present();
10891            encoder.write_num(max_ordinal, offset);
10892            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10893            // Calling encoder.out_of_line_offset(0) is not allowed.
10894            if max_ordinal == 0 {
10895                return Ok(());
10896            }
10897            depth.increment()?;
10898            let envelope_size = 8;
10899            let bytes_len = max_ordinal as usize * envelope_size;
10900            #[allow(unused_variables)]
10901            let offset = encoder.out_of_line_offset(bytes_len);
10902            let mut _prev_end_offset: usize = 0;
10903            if 1 > max_ordinal {
10904                return Ok(());
10905            }
10906
10907            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10908            // are envelope_size bytes.
10909            let cur_offset: usize = (1 - 1) * envelope_size;
10910
10911            // Zero reserved fields.
10912            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10913
10914            // Safety:
10915            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10916            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10917            //   envelope_size bytes, there is always sufficient room.
10918            fidl::encoding::encode_in_envelope_optional::<
10919                fidl::encoding::Endpoint<
10920                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
10921                >,
10922                fidl::encoding::DefaultFuchsiaResourceDialect,
10923            >(
10924                self.runtime_dir.as_mut().map(
10925                    <fidl::encoding::Endpoint<
10926                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
10927                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10928                ),
10929                encoder,
10930                offset + cur_offset,
10931                depth,
10932            )?;
10933
10934            _prev_end_offset = cur_offset + envelope_size;
10935            if 2 > max_ordinal {
10936                return Ok(());
10937            }
10938
10939            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10940            // are envelope_size bytes.
10941            let cur_offset: usize = (2 - 1) * envelope_size;
10942
10943            // Zero reserved fields.
10944            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10945
10946            // Safety:
10947            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10948            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10949            //   envelope_size bytes, there is always sufficient room.
10950            fidl::encoding::encode_in_envelope_optional::<
10951                fidl::encoding::HandleType<
10952                    fidl::EventPair,
10953                    { fidl::ObjectType::EVENTPAIR.into_raw() },
10954                    2147483648,
10955                >,
10956                fidl::encoding::DefaultFuchsiaResourceDialect,
10957            >(
10958                self.break_on_start.as_mut().map(
10959                    <fidl::encoding::HandleType<
10960                        fidl::EventPair,
10961                        { fidl::ObjectType::EVENTPAIR.into_raw() },
10962                        2147483648,
10963                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10964                ),
10965                encoder,
10966                offset + cur_offset,
10967                depth,
10968            )?;
10969
10970            _prev_end_offset = cur_offset + envelope_size;
10971
10972            Ok(())
10973        }
10974    }
10975
10976    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10977        for DebugStartedPayload
10978    {
10979        #[inline(always)]
10980        fn new_empty() -> Self {
10981            Self::default()
10982        }
10983
10984        unsafe fn decode(
10985            &mut self,
10986            decoder: &mut fidl::encoding::Decoder<
10987                '_,
10988                fidl::encoding::DefaultFuchsiaResourceDialect,
10989            >,
10990            offset: usize,
10991            mut depth: fidl::encoding::Depth,
10992        ) -> fidl::Result<()> {
10993            decoder.debug_check_bounds::<Self>(offset);
10994            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10995                None => return Err(fidl::Error::NotNullable),
10996                Some(len) => len,
10997            };
10998            // Calling decoder.out_of_line_offset(0) is not allowed.
10999            if len == 0 {
11000                return Ok(());
11001            };
11002            depth.increment()?;
11003            let envelope_size = 8;
11004            let bytes_len = len * envelope_size;
11005            let offset = decoder.out_of_line_offset(bytes_len)?;
11006            // Decode the envelope for each type.
11007            let mut _next_ordinal_to_read = 0;
11008            let mut next_offset = offset;
11009            let end_offset = offset + bytes_len;
11010            _next_ordinal_to_read += 1;
11011            if next_offset >= end_offset {
11012                return Ok(());
11013            }
11014
11015            // Decode unknown envelopes for gaps in ordinals.
11016            while _next_ordinal_to_read < 1 {
11017                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11018                _next_ordinal_to_read += 1;
11019                next_offset += envelope_size;
11020            }
11021
11022            let next_out_of_line = decoder.next_out_of_line();
11023            let handles_before = decoder.remaining_handles();
11024            if let Some((inlined, num_bytes, num_handles)) =
11025                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11026            {
11027                let member_inline_size = <fidl::encoding::Endpoint<
11028                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11029                > as fidl::encoding::TypeMarker>::inline_size(
11030                    decoder.context
11031                );
11032                if inlined != (member_inline_size <= 4) {
11033                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11034                }
11035                let inner_offset;
11036                let mut inner_depth = depth.clone();
11037                if inlined {
11038                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11039                    inner_offset = next_offset;
11040                } else {
11041                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11042                    inner_depth.increment()?;
11043                }
11044                let val_ref = self.runtime_dir.get_or_insert_with(|| {
11045                    fidl::new_empty!(
11046                        fidl::encoding::Endpoint<
11047                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11048                        >,
11049                        fidl::encoding::DefaultFuchsiaResourceDialect
11050                    )
11051                });
11052                fidl::decode!(
11053                    fidl::encoding::Endpoint<
11054                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11055                    >,
11056                    fidl::encoding::DefaultFuchsiaResourceDialect,
11057                    val_ref,
11058                    decoder,
11059                    inner_offset,
11060                    inner_depth
11061                )?;
11062                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11063                {
11064                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11065                }
11066                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11067                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11068                }
11069            }
11070
11071            next_offset += envelope_size;
11072            _next_ordinal_to_read += 1;
11073            if next_offset >= end_offset {
11074                return Ok(());
11075            }
11076
11077            // Decode unknown envelopes for gaps in ordinals.
11078            while _next_ordinal_to_read < 2 {
11079                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11080                _next_ordinal_to_read += 1;
11081                next_offset += envelope_size;
11082            }
11083
11084            let next_out_of_line = decoder.next_out_of_line();
11085            let handles_before = decoder.remaining_handles();
11086            if let Some((inlined, num_bytes, num_handles)) =
11087                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11088            {
11089                let member_inline_size = <fidl::encoding::HandleType<
11090                    fidl::EventPair,
11091                    { fidl::ObjectType::EVENTPAIR.into_raw() },
11092                    2147483648,
11093                > as fidl::encoding::TypeMarker>::inline_size(
11094                    decoder.context
11095                );
11096                if inlined != (member_inline_size <= 4) {
11097                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11098                }
11099                let inner_offset;
11100                let mut inner_depth = depth.clone();
11101                if inlined {
11102                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11103                    inner_offset = next_offset;
11104                } else {
11105                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11106                    inner_depth.increment()?;
11107                }
11108                let val_ref =
11109                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));
11110                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11111                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11112                {
11113                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11114                }
11115                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11116                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11117                }
11118            }
11119
11120            next_offset += envelope_size;
11121
11122            // Decode the remaining unknown envelopes.
11123            while next_offset < end_offset {
11124                _next_ordinal_to_read += 1;
11125                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11126                next_offset += envelope_size;
11127            }
11128
11129            Ok(())
11130        }
11131    }
11132
11133    impl Event {
11134        #[inline(always)]
11135        fn max_ordinal_present(&self) -> u64 {
11136            if let Some(_) = self.payload {
11137                return 2;
11138            }
11139            if let Some(_) = self.header {
11140                return 1;
11141            }
11142            0
11143        }
11144    }
11145
11146    impl fidl::encoding::ResourceTypeMarker for Event {
11147        type Borrowed<'a> = &'a mut Self;
11148        fn take_or_borrow<'a>(
11149            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11150        ) -> Self::Borrowed<'a> {
11151            value
11152        }
11153    }
11154
11155    unsafe impl fidl::encoding::TypeMarker for Event {
11156        type Owned = Self;
11157
11158        #[inline(always)]
11159        fn inline_align(_context: fidl::encoding::Context) -> usize {
11160            8
11161        }
11162
11163        #[inline(always)]
11164        fn inline_size(_context: fidl::encoding::Context) -> usize {
11165            16
11166        }
11167    }
11168
11169    unsafe impl fidl::encoding::Encode<Event, fidl::encoding::DefaultFuchsiaResourceDialect>
11170        for &mut Event
11171    {
11172        unsafe fn encode(
11173            self,
11174            encoder: &mut fidl::encoding::Encoder<
11175                '_,
11176                fidl::encoding::DefaultFuchsiaResourceDialect,
11177            >,
11178            offset: usize,
11179            mut depth: fidl::encoding::Depth,
11180        ) -> fidl::Result<()> {
11181            encoder.debug_check_bounds::<Event>(offset);
11182            // Vector header
11183            let max_ordinal: u64 = self.max_ordinal_present();
11184            encoder.write_num(max_ordinal, offset);
11185            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11186            // Calling encoder.out_of_line_offset(0) is not allowed.
11187            if max_ordinal == 0 {
11188                return Ok(());
11189            }
11190            depth.increment()?;
11191            let envelope_size = 8;
11192            let bytes_len = max_ordinal as usize * envelope_size;
11193            #[allow(unused_variables)]
11194            let offset = encoder.out_of_line_offset(bytes_len);
11195            let mut _prev_end_offset: usize = 0;
11196            if 1 > max_ordinal {
11197                return Ok(());
11198            }
11199
11200            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11201            // are envelope_size bytes.
11202            let cur_offset: usize = (1 - 1) * envelope_size;
11203
11204            // Zero reserved fields.
11205            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11206
11207            // Safety:
11208            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11209            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11210            //   envelope_size bytes, there is always sufficient room.
11211            fidl::encoding::encode_in_envelope_optional::<
11212                EventHeader,
11213                fidl::encoding::DefaultFuchsiaResourceDialect,
11214            >(
11215                self.header.as_ref().map(<EventHeader as fidl::encoding::ValueTypeMarker>::borrow),
11216                encoder,
11217                offset + cur_offset,
11218                depth,
11219            )?;
11220
11221            _prev_end_offset = cur_offset + envelope_size;
11222            if 2 > max_ordinal {
11223                return Ok(());
11224            }
11225
11226            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11227            // are envelope_size bytes.
11228            let cur_offset: usize = (2 - 1) * envelope_size;
11229
11230            // Zero reserved fields.
11231            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11232
11233            // Safety:
11234            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11235            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11236            //   envelope_size bytes, there is always sufficient room.
11237            fidl::encoding::encode_in_envelope_optional::<
11238                EventPayload,
11239                fidl::encoding::DefaultFuchsiaResourceDialect,
11240            >(
11241                self.payload
11242                    .as_mut()
11243                    .map(<EventPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11244                encoder,
11245                offset + cur_offset,
11246                depth,
11247            )?;
11248
11249            _prev_end_offset = cur_offset + envelope_size;
11250
11251            Ok(())
11252        }
11253    }
11254
11255    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Event {
11256        #[inline(always)]
11257        fn new_empty() -> Self {
11258            Self::default()
11259        }
11260
11261        unsafe fn decode(
11262            &mut self,
11263            decoder: &mut fidl::encoding::Decoder<
11264                '_,
11265                fidl::encoding::DefaultFuchsiaResourceDialect,
11266            >,
11267            offset: usize,
11268            mut depth: fidl::encoding::Depth,
11269        ) -> fidl::Result<()> {
11270            decoder.debug_check_bounds::<Self>(offset);
11271            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11272                None => return Err(fidl::Error::NotNullable),
11273                Some(len) => len,
11274            };
11275            // Calling decoder.out_of_line_offset(0) is not allowed.
11276            if len == 0 {
11277                return Ok(());
11278            };
11279            depth.increment()?;
11280            let envelope_size = 8;
11281            let bytes_len = len * envelope_size;
11282            let offset = decoder.out_of_line_offset(bytes_len)?;
11283            // Decode the envelope for each type.
11284            let mut _next_ordinal_to_read = 0;
11285            let mut next_offset = offset;
11286            let end_offset = offset + bytes_len;
11287            _next_ordinal_to_read += 1;
11288            if next_offset >= end_offset {
11289                return Ok(());
11290            }
11291
11292            // Decode unknown envelopes for gaps in ordinals.
11293            while _next_ordinal_to_read < 1 {
11294                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11295                _next_ordinal_to_read += 1;
11296                next_offset += envelope_size;
11297            }
11298
11299            let next_out_of_line = decoder.next_out_of_line();
11300            let handles_before = decoder.remaining_handles();
11301            if let Some((inlined, num_bytes, num_handles)) =
11302                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11303            {
11304                let member_inline_size =
11305                    <EventHeader as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11306                if inlined != (member_inline_size <= 4) {
11307                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11308                }
11309                let inner_offset;
11310                let mut inner_depth = depth.clone();
11311                if inlined {
11312                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11313                    inner_offset = next_offset;
11314                } else {
11315                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11316                    inner_depth.increment()?;
11317                }
11318                let val_ref = self.header.get_or_insert_with(|| {
11319                    fidl::new_empty!(EventHeader, fidl::encoding::DefaultFuchsiaResourceDialect)
11320                });
11321                fidl::decode!(
11322                    EventHeader,
11323                    fidl::encoding::DefaultFuchsiaResourceDialect,
11324                    val_ref,
11325                    decoder,
11326                    inner_offset,
11327                    inner_depth
11328                )?;
11329                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11330                {
11331                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11332                }
11333                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11334                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11335                }
11336            }
11337
11338            next_offset += envelope_size;
11339            _next_ordinal_to_read += 1;
11340            if next_offset >= end_offset {
11341                return Ok(());
11342            }
11343
11344            // Decode unknown envelopes for gaps in ordinals.
11345            while _next_ordinal_to_read < 2 {
11346                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11347                _next_ordinal_to_read += 1;
11348                next_offset += envelope_size;
11349            }
11350
11351            let next_out_of_line = decoder.next_out_of_line();
11352            let handles_before = decoder.remaining_handles();
11353            if let Some((inlined, num_bytes, num_handles)) =
11354                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11355            {
11356                let member_inline_size =
11357                    <EventPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11358                if inlined != (member_inline_size <= 4) {
11359                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11360                }
11361                let inner_offset;
11362                let mut inner_depth = depth.clone();
11363                if inlined {
11364                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11365                    inner_offset = next_offset;
11366                } else {
11367                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11368                    inner_depth.increment()?;
11369                }
11370                let val_ref = self.payload.get_or_insert_with(|| {
11371                    fidl::new_empty!(EventPayload, fidl::encoding::DefaultFuchsiaResourceDialect)
11372                });
11373                fidl::decode!(
11374                    EventPayload,
11375                    fidl::encoding::DefaultFuchsiaResourceDialect,
11376                    val_ref,
11377                    decoder,
11378                    inner_offset,
11379                    inner_depth
11380                )?;
11381                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11382                {
11383                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11384                }
11385                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11386                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11387                }
11388            }
11389
11390            next_offset += envelope_size;
11391
11392            // Decode the remaining unknown envelopes.
11393            while next_offset < end_offset {
11394                _next_ordinal_to_read += 1;
11395                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11396                next_offset += envelope_size;
11397            }
11398
11399            Ok(())
11400        }
11401    }
11402
11403    impl NamespaceEntry {
11404        #[inline(always)]
11405        fn max_ordinal_present(&self) -> u64 {
11406            if let Some(_) = self.directory {
11407                return 2;
11408            }
11409            if let Some(_) = self.path {
11410                return 1;
11411            }
11412            0
11413        }
11414    }
11415
11416    impl fidl::encoding::ResourceTypeMarker for NamespaceEntry {
11417        type Borrowed<'a> = &'a mut Self;
11418        fn take_or_borrow<'a>(
11419            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11420        ) -> Self::Borrowed<'a> {
11421            value
11422        }
11423    }
11424
11425    unsafe impl fidl::encoding::TypeMarker for NamespaceEntry {
11426        type Owned = Self;
11427
11428        #[inline(always)]
11429        fn inline_align(_context: fidl::encoding::Context) -> usize {
11430            8
11431        }
11432
11433        #[inline(always)]
11434        fn inline_size(_context: fidl::encoding::Context) -> usize {
11435            16
11436        }
11437    }
11438
11439    unsafe impl
11440        fidl::encoding::Encode<NamespaceEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
11441        for &mut NamespaceEntry
11442    {
11443        unsafe fn encode(
11444            self,
11445            encoder: &mut fidl::encoding::Encoder<
11446                '_,
11447                fidl::encoding::DefaultFuchsiaResourceDialect,
11448            >,
11449            offset: usize,
11450            mut depth: fidl::encoding::Depth,
11451        ) -> fidl::Result<()> {
11452            encoder.debug_check_bounds::<NamespaceEntry>(offset);
11453            // Vector header
11454            let max_ordinal: u64 = self.max_ordinal_present();
11455            encoder.write_num(max_ordinal, offset);
11456            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11457            // Calling encoder.out_of_line_offset(0) is not allowed.
11458            if max_ordinal == 0 {
11459                return Ok(());
11460            }
11461            depth.increment()?;
11462            let envelope_size = 8;
11463            let bytes_len = max_ordinal as usize * envelope_size;
11464            #[allow(unused_variables)]
11465            let offset = encoder.out_of_line_offset(bytes_len);
11466            let mut _prev_end_offset: usize = 0;
11467            if 1 > max_ordinal {
11468                return Ok(());
11469            }
11470
11471            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11472            // are envelope_size bytes.
11473            let cur_offset: usize = (1 - 1) * envelope_size;
11474
11475            // Zero reserved fields.
11476            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11477
11478            // Safety:
11479            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11480            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11481            //   envelope_size bytes, there is always sufficient room.
11482            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4095>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11483            self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
11484            encoder, offset + cur_offset, depth
11485        )?;
11486
11487            _prev_end_offset = cur_offset + envelope_size;
11488            if 2 > max_ordinal {
11489                return Ok(());
11490            }
11491
11492            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11493            // are envelope_size bytes.
11494            let cur_offset: usize = (2 - 1) * envelope_size;
11495
11496            // Zero reserved fields.
11497            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11498
11499            // Safety:
11500            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11501            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11502            //   envelope_size bytes, there is always sufficient room.
11503            fidl::encoding::encode_in_envelope_optional::<
11504                fidl::encoding::Endpoint<
11505                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11506                >,
11507                fidl::encoding::DefaultFuchsiaResourceDialect,
11508            >(
11509                self.directory.as_mut().map(
11510                    <fidl::encoding::Endpoint<
11511                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11512                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
11513                ),
11514                encoder,
11515                offset + cur_offset,
11516                depth,
11517            )?;
11518
11519            _prev_end_offset = cur_offset + envelope_size;
11520
11521            Ok(())
11522        }
11523    }
11524
11525    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11526        for NamespaceEntry
11527    {
11528        #[inline(always)]
11529        fn new_empty() -> Self {
11530            Self::default()
11531        }
11532
11533        unsafe fn decode(
11534            &mut self,
11535            decoder: &mut fidl::encoding::Decoder<
11536                '_,
11537                fidl::encoding::DefaultFuchsiaResourceDialect,
11538            >,
11539            offset: usize,
11540            mut depth: fidl::encoding::Depth,
11541        ) -> fidl::Result<()> {
11542            decoder.debug_check_bounds::<Self>(offset);
11543            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11544                None => return Err(fidl::Error::NotNullable),
11545                Some(len) => len,
11546            };
11547            // Calling decoder.out_of_line_offset(0) is not allowed.
11548            if len == 0 {
11549                return Ok(());
11550            };
11551            depth.increment()?;
11552            let envelope_size = 8;
11553            let bytes_len = len * envelope_size;
11554            let offset = decoder.out_of_line_offset(bytes_len)?;
11555            // Decode the envelope for each type.
11556            let mut _next_ordinal_to_read = 0;
11557            let mut next_offset = offset;
11558            let end_offset = offset + bytes_len;
11559            _next_ordinal_to_read += 1;
11560            if next_offset >= end_offset {
11561                return Ok(());
11562            }
11563
11564            // Decode unknown envelopes for gaps in ordinals.
11565            while _next_ordinal_to_read < 1 {
11566                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11567                _next_ordinal_to_read += 1;
11568                next_offset += envelope_size;
11569            }
11570
11571            let next_out_of_line = decoder.next_out_of_line();
11572            let handles_before = decoder.remaining_handles();
11573            if let Some((inlined, num_bytes, num_handles)) =
11574                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11575            {
11576                let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11577                if inlined != (member_inline_size <= 4) {
11578                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11579                }
11580                let inner_offset;
11581                let mut inner_depth = depth.clone();
11582                if inlined {
11583                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11584                    inner_offset = next_offset;
11585                } else {
11586                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11587                    inner_depth.increment()?;
11588                }
11589                let val_ref = self.path.get_or_insert_with(|| {
11590                    fidl::new_empty!(
11591                        fidl::encoding::BoundedString<4095>,
11592                        fidl::encoding::DefaultFuchsiaResourceDialect
11593                    )
11594                });
11595                fidl::decode!(
11596                    fidl::encoding::BoundedString<4095>,
11597                    fidl::encoding::DefaultFuchsiaResourceDialect,
11598                    val_ref,
11599                    decoder,
11600                    inner_offset,
11601                    inner_depth
11602                )?;
11603                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11604                {
11605                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11606                }
11607                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11608                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11609                }
11610            }
11611
11612            next_offset += envelope_size;
11613            _next_ordinal_to_read += 1;
11614            if next_offset >= end_offset {
11615                return Ok(());
11616            }
11617
11618            // Decode unknown envelopes for gaps in ordinals.
11619            while _next_ordinal_to_read < 2 {
11620                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11621                _next_ordinal_to_read += 1;
11622                next_offset += envelope_size;
11623            }
11624
11625            let next_out_of_line = decoder.next_out_of_line();
11626            let handles_before = decoder.remaining_handles();
11627            if let Some((inlined, num_bytes, num_handles)) =
11628                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11629            {
11630                let member_inline_size = <fidl::encoding::Endpoint<
11631                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11632                > as fidl::encoding::TypeMarker>::inline_size(
11633                    decoder.context
11634                );
11635                if inlined != (member_inline_size <= 4) {
11636                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11637                }
11638                let inner_offset;
11639                let mut inner_depth = depth.clone();
11640                if inlined {
11641                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11642                    inner_offset = next_offset;
11643                } else {
11644                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11645                    inner_depth.increment()?;
11646                }
11647                let val_ref = self.directory.get_or_insert_with(|| {
11648                    fidl::new_empty!(
11649                        fidl::encoding::Endpoint<
11650                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11651                        >,
11652                        fidl::encoding::DefaultFuchsiaResourceDialect
11653                    )
11654                });
11655                fidl::decode!(
11656                    fidl::encoding::Endpoint<
11657                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
11658                    >,
11659                    fidl::encoding::DefaultFuchsiaResourceDialect,
11660                    val_ref,
11661                    decoder,
11662                    inner_offset,
11663                    inner_depth
11664                )?;
11665                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11666                {
11667                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11668                }
11669                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11670                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11671                }
11672            }
11673
11674            next_offset += envelope_size;
11675
11676            // Decode the remaining unknown envelopes.
11677            while next_offset < end_offset {
11678                _next_ordinal_to_read += 1;
11679                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11680                next_offset += envelope_size;
11681            }
11682
11683            Ok(())
11684        }
11685    }
11686
11687    impl StartChildArgs {
11688        #[inline(always)]
11689        fn max_ordinal_present(&self) -> u64 {
11690            if let Some(_) = self.dictionary {
11691                return 3;
11692            }
11693            if let Some(_) = self.namespace_entries {
11694                return 2;
11695            }
11696            if let Some(_) = self.numbered_handles {
11697                return 1;
11698            }
11699            0
11700        }
11701    }
11702
11703    impl fidl::encoding::ResourceTypeMarker for StartChildArgs {
11704        type Borrowed<'a> = &'a mut Self;
11705        fn take_or_borrow<'a>(
11706            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11707        ) -> Self::Borrowed<'a> {
11708            value
11709        }
11710    }
11711
11712    unsafe impl fidl::encoding::TypeMarker for StartChildArgs {
11713        type Owned = Self;
11714
11715        #[inline(always)]
11716        fn inline_align(_context: fidl::encoding::Context) -> usize {
11717            8
11718        }
11719
11720        #[inline(always)]
11721        fn inline_size(_context: fidl::encoding::Context) -> usize {
11722            16
11723        }
11724    }
11725
11726    unsafe impl
11727        fidl::encoding::Encode<StartChildArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
11728        for &mut StartChildArgs
11729    {
11730        unsafe fn encode(
11731            self,
11732            encoder: &mut fidl::encoding::Encoder<
11733                '_,
11734                fidl::encoding::DefaultFuchsiaResourceDialect,
11735            >,
11736            offset: usize,
11737            mut depth: fidl::encoding::Depth,
11738        ) -> fidl::Result<()> {
11739            encoder.debug_check_bounds::<StartChildArgs>(offset);
11740            // Vector header
11741            let max_ordinal: u64 = self.max_ordinal_present();
11742            encoder.write_num(max_ordinal, offset);
11743            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11744            // Calling encoder.out_of_line_offset(0) is not allowed.
11745            if max_ordinal == 0 {
11746                return Ok(());
11747            }
11748            depth.increment()?;
11749            let envelope_size = 8;
11750            let bytes_len = max_ordinal as usize * envelope_size;
11751            #[allow(unused_variables)]
11752            let offset = encoder.out_of_line_offset(bytes_len);
11753            let mut _prev_end_offset: usize = 0;
11754            if 1 > max_ordinal {
11755                return Ok(());
11756            }
11757
11758            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11759            // are envelope_size bytes.
11760            let cur_offset: usize = (1 - 1) * envelope_size;
11761
11762            // Zero reserved fields.
11763            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11764
11765            // Safety:
11766            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11767            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11768            //   envelope_size bytes, there is always sufficient room.
11769            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11770            self.numbered_handles.as_mut().map(<fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11771            encoder, offset + cur_offset, depth
11772        )?;
11773
11774            _prev_end_offset = cur_offset + envelope_size;
11775            if 2 > max_ordinal {
11776                return Ok(());
11777            }
11778
11779            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11780            // are envelope_size bytes.
11781            let cur_offset: usize = (2 - 1) * envelope_size;
11782
11783            // Zero reserved fields.
11784            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11785
11786            // Safety:
11787            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11788            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11789            //   envelope_size bytes, there is always sufficient room.
11790            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11791            self.namespace_entries.as_mut().map(<fidl::encoding::Vector<NamespaceEntry, 32> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11792            encoder, offset + cur_offset, depth
11793        )?;
11794
11795            _prev_end_offset = cur_offset + envelope_size;
11796            if 3 > max_ordinal {
11797                return Ok(());
11798            }
11799
11800            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11801            // are envelope_size bytes.
11802            let cur_offset: usize = (3 - 1) * envelope_size;
11803
11804            // Zero reserved fields.
11805            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11806
11807            // Safety:
11808            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11809            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11810            //   envelope_size bytes, there is always sufficient room.
11811            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
11812            self.dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11813            encoder, offset + cur_offset, depth
11814        )?;
11815
11816            _prev_end_offset = cur_offset + envelope_size;
11817
11818            Ok(())
11819        }
11820    }
11821
11822    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11823        for StartChildArgs
11824    {
11825        #[inline(always)]
11826        fn new_empty() -> Self {
11827            Self::default()
11828        }
11829
11830        unsafe fn decode(
11831            &mut self,
11832            decoder: &mut fidl::encoding::Decoder<
11833                '_,
11834                fidl::encoding::DefaultFuchsiaResourceDialect,
11835            >,
11836            offset: usize,
11837            mut depth: fidl::encoding::Depth,
11838        ) -> fidl::Result<()> {
11839            decoder.debug_check_bounds::<Self>(offset);
11840            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11841                None => return Err(fidl::Error::NotNullable),
11842                Some(len) => len,
11843            };
11844            // Calling decoder.out_of_line_offset(0) is not allowed.
11845            if len == 0 {
11846                return Ok(());
11847            };
11848            depth.increment()?;
11849            let envelope_size = 8;
11850            let bytes_len = len * envelope_size;
11851            let offset = decoder.out_of_line_offset(bytes_len)?;
11852            // Decode the envelope for each type.
11853            let mut _next_ordinal_to_read = 0;
11854            let mut next_offset = offset;
11855            let end_offset = offset + bytes_len;
11856            _next_ordinal_to_read += 1;
11857            if next_offset >= end_offset {
11858                return Ok(());
11859            }
11860
11861            // Decode unknown envelopes for gaps in ordinals.
11862            while _next_ordinal_to_read < 1 {
11863                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11864                _next_ordinal_to_read += 1;
11865                next_offset += envelope_size;
11866            }
11867
11868            let next_out_of_line = decoder.next_out_of_line();
11869            let handles_before = decoder.remaining_handles();
11870            if let Some((inlined, num_bytes, num_handles)) =
11871                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11872            {
11873                let member_inline_size = <fidl::encoding::Vector<
11874                    fidl_fuchsia_process::HandleInfo,
11875                    128,
11876                > as fidl::encoding::TypeMarker>::inline_size(
11877                    decoder.context
11878                );
11879                if inlined != (member_inline_size <= 4) {
11880                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11881                }
11882                let inner_offset;
11883                let mut inner_depth = depth.clone();
11884                if inlined {
11885                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11886                    inner_offset = next_offset;
11887                } else {
11888                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11889                    inner_depth.increment()?;
11890                }
11891                let val_ref =
11892                self.numbered_handles.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
11893                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_process::HandleInfo, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11894                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11895                {
11896                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11897                }
11898                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11899                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11900                }
11901            }
11902
11903            next_offset += envelope_size;
11904            _next_ordinal_to_read += 1;
11905            if next_offset >= end_offset {
11906                return Ok(());
11907            }
11908
11909            // Decode unknown envelopes for gaps in ordinals.
11910            while _next_ordinal_to_read < 2 {
11911                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11912                _next_ordinal_to_read += 1;
11913                next_offset += envelope_size;
11914            }
11915
11916            let next_out_of_line = decoder.next_out_of_line();
11917            let handles_before = decoder.remaining_handles();
11918            if let Some((inlined, num_bytes, num_handles)) =
11919                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11920            {
11921                let member_inline_size = <fidl::encoding::Vector<NamespaceEntry, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11922                if inlined != (member_inline_size <= 4) {
11923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11924                }
11925                let inner_offset;
11926                let mut inner_depth = depth.clone();
11927                if inlined {
11928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11929                    inner_offset = next_offset;
11930                } else {
11931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11932                    inner_depth.increment()?;
11933                }
11934                let val_ref =
11935                self.namespace_entries.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
11936                fidl::decode!(fidl::encoding::Vector<NamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11937                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11938                {
11939                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11940                }
11941                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11942                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11943                }
11944            }
11945
11946            next_offset += envelope_size;
11947            _next_ordinal_to_read += 1;
11948            if next_offset >= end_offset {
11949                return Ok(());
11950            }
11951
11952            // Decode unknown envelopes for gaps in ordinals.
11953            while _next_ordinal_to_read < 3 {
11954                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11955                _next_ordinal_to_read += 1;
11956                next_offset += envelope_size;
11957            }
11958
11959            let next_out_of_line = decoder.next_out_of_line();
11960            let handles_before = decoder.remaining_handles();
11961            if let Some((inlined, num_bytes, num_handles)) =
11962                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11963            {
11964                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11965                if inlined != (member_inline_size <= 4) {
11966                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11967                }
11968                let inner_offset;
11969                let mut inner_depth = depth.clone();
11970                if inlined {
11971                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11972                    inner_offset = next_offset;
11973                } else {
11974                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11975                    inner_depth.increment()?;
11976                }
11977                let val_ref = self.dictionary.get_or_insert_with(|| {
11978                    fidl::new_empty!(
11979                        fidl_fuchsia_component_sandbox::DictionaryRef,
11980                        fidl::encoding::DefaultFuchsiaResourceDialect
11981                    )
11982                });
11983                fidl::decode!(
11984                    fidl_fuchsia_component_sandbox::DictionaryRef,
11985                    fidl::encoding::DefaultFuchsiaResourceDialect,
11986                    val_ref,
11987                    decoder,
11988                    inner_offset,
11989                    inner_depth
11990                )?;
11991                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11992                {
11993                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11994                }
11995                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11996                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11997                }
11998            }
11999
12000            next_offset += envelope_size;
12001
12002            // Decode the remaining unknown envelopes.
12003            while next_offset < end_offset {
12004                _next_ordinal_to_read += 1;
12005                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12006                next_offset += envelope_size;
12007            }
12008
12009            Ok(())
12010        }
12011    }
12012
12013    impl fidl::encoding::ResourceTypeMarker for EventPayload {
12014        type Borrowed<'a> = &'a mut Self;
12015        fn take_or_borrow<'a>(
12016            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12017        ) -> Self::Borrowed<'a> {
12018            value
12019        }
12020    }
12021
12022    unsafe impl fidl::encoding::TypeMarker for EventPayload {
12023        type Owned = Self;
12024
12025        #[inline(always)]
12026        fn inline_align(_context: fidl::encoding::Context) -> usize {
12027            8
12028        }
12029
12030        #[inline(always)]
12031        fn inline_size(_context: fidl::encoding::Context) -> usize {
12032            16
12033        }
12034    }
12035
12036    unsafe impl fidl::encoding::Encode<EventPayload, fidl::encoding::DefaultFuchsiaResourceDialect>
12037        for &mut EventPayload
12038    {
12039        #[inline]
12040        unsafe fn encode(
12041            self,
12042            encoder: &mut fidl::encoding::Encoder<
12043                '_,
12044                fidl::encoding::DefaultFuchsiaResourceDialect,
12045            >,
12046            offset: usize,
12047            _depth: fidl::encoding::Depth,
12048        ) -> fidl::Result<()> {
12049            encoder.debug_check_bounds::<EventPayload>(offset);
12050            encoder.write_num::<u64>(self.ordinal(), offset);
12051            match self {
12052            EventPayload::CapabilityRequested(ref mut val) => {
12053                fidl::encoding::encode_in_envelope::<CapabilityRequestedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12054                    <CapabilityRequestedPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
12055                    encoder, offset + 8, _depth
12056                )
12057            }
12058            EventPayload::Purged(ref val) => {
12059                fidl::encoding::encode_in_envelope::<PurgedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12060                    <PurgedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12061                    encoder, offset + 8, _depth
12062                )
12063            }
12064            EventPayload::Discovered(ref val) => {
12065                fidl::encoding::encode_in_envelope::<DiscoveredPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12066                    <DiscoveredPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12067                    encoder, offset + 8, _depth
12068                )
12069            }
12070            EventPayload::Destroyed(ref val) => {
12071                fidl::encoding::encode_in_envelope::<DestroyedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12072                    <DestroyedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12073                    encoder, offset + 8, _depth
12074                )
12075            }
12076            EventPayload::Resolved(ref val) => {
12077                fidl::encoding::encode_in_envelope::<ResolvedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12078                    <ResolvedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12079                    encoder, offset + 8, _depth
12080                )
12081            }
12082            EventPayload::Started(ref val) => {
12083                fidl::encoding::encode_in_envelope::<StartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12084                    <StartedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12085                    encoder, offset + 8, _depth
12086                )
12087            }
12088            EventPayload::Stopped(ref val) => {
12089                fidl::encoding::encode_in_envelope::<StoppedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12090                    <StoppedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12091                    encoder, offset + 8, _depth
12092                )
12093            }
12094            EventPayload::DebugStarted(ref mut val) => {
12095                fidl::encoding::encode_in_envelope::<DebugStartedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12096                    <DebugStartedPayload as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
12097                    encoder, offset + 8, _depth
12098                )
12099            }
12100            EventPayload::Unresolved(ref val) => {
12101                fidl::encoding::encode_in_envelope::<UnresolvedPayload, fidl::encoding::DefaultFuchsiaResourceDialect>(
12102                    <UnresolvedPayload as fidl::encoding::ValueTypeMarker>::borrow(val),
12103                    encoder, offset + 8, _depth
12104                )
12105            }
12106            EventPayload::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
12107        }
12108        }
12109    }
12110
12111    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for EventPayload {
12112        #[inline(always)]
12113        fn new_empty() -> Self {
12114            Self::__SourceBreaking { unknown_ordinal: 0 }
12115        }
12116
12117        #[inline]
12118        unsafe fn decode(
12119            &mut self,
12120            decoder: &mut fidl::encoding::Decoder<
12121                '_,
12122                fidl::encoding::DefaultFuchsiaResourceDialect,
12123            >,
12124            offset: usize,
12125            mut depth: fidl::encoding::Depth,
12126        ) -> fidl::Result<()> {
12127            decoder.debug_check_bounds::<Self>(offset);
12128            #[allow(unused_variables)]
12129            let next_out_of_line = decoder.next_out_of_line();
12130            let handles_before = decoder.remaining_handles();
12131            let (ordinal, inlined, num_bytes, num_handles) =
12132                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
12133
12134            let member_inline_size = match ordinal {
12135                1 => <CapabilityRequestedPayload as fidl::encoding::TypeMarker>::inline_size(
12136                    decoder.context,
12137                ),
12138                2 => <PurgedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12139                4 => {
12140                    <DiscoveredPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context)
12141                }
12142                5 => <DestroyedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12143                6 => <ResolvedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12144                7 => <StartedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12145                8 => <StoppedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context),
12146                9 => <DebugStartedPayload as fidl::encoding::TypeMarker>::inline_size(
12147                    decoder.context,
12148                ),
12149                10 => {
12150                    <UnresolvedPayload as fidl::encoding::TypeMarker>::inline_size(decoder.context)
12151                }
12152                0 => return Err(fidl::Error::UnknownUnionTag),
12153                _ => num_bytes as usize,
12154            };
12155
12156            if inlined != (member_inline_size <= 4) {
12157                return Err(fidl::Error::InvalidInlineBitInEnvelope);
12158            }
12159            let _inner_offset;
12160            if inlined {
12161                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
12162                _inner_offset = offset + 8;
12163            } else {
12164                depth.increment()?;
12165                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12166            }
12167            match ordinal {
12168                1 => {
12169                    #[allow(irrefutable_let_patterns)]
12170                    if let EventPayload::CapabilityRequested(_) = self {
12171                        // Do nothing, read the value into the object
12172                    } else {
12173                        // Initialize `self` to the right variant
12174                        *self = EventPayload::CapabilityRequested(fidl::new_empty!(
12175                            CapabilityRequestedPayload,
12176                            fidl::encoding::DefaultFuchsiaResourceDialect
12177                        ));
12178                    }
12179                    #[allow(irrefutable_let_patterns)]
12180                    if let EventPayload::CapabilityRequested(ref mut val) = self {
12181                        fidl::decode!(
12182                            CapabilityRequestedPayload,
12183                            fidl::encoding::DefaultFuchsiaResourceDialect,
12184                            val,
12185                            decoder,
12186                            _inner_offset,
12187                            depth
12188                        )?;
12189                    } else {
12190                        unreachable!()
12191                    }
12192                }
12193                2 => {
12194                    #[allow(irrefutable_let_patterns)]
12195                    if let EventPayload::Purged(_) = self {
12196                        // Do nothing, read the value into the object
12197                    } else {
12198                        // Initialize `self` to the right variant
12199                        *self = EventPayload::Purged(fidl::new_empty!(
12200                            PurgedPayload,
12201                            fidl::encoding::DefaultFuchsiaResourceDialect
12202                        ));
12203                    }
12204                    #[allow(irrefutable_let_patterns)]
12205                    if let EventPayload::Purged(ref mut val) = self {
12206                        fidl::decode!(
12207                            PurgedPayload,
12208                            fidl::encoding::DefaultFuchsiaResourceDialect,
12209                            val,
12210                            decoder,
12211                            _inner_offset,
12212                            depth
12213                        )?;
12214                    } else {
12215                        unreachable!()
12216                    }
12217                }
12218                4 => {
12219                    #[allow(irrefutable_let_patterns)]
12220                    if let EventPayload::Discovered(_) = self {
12221                        // Do nothing, read the value into the object
12222                    } else {
12223                        // Initialize `self` to the right variant
12224                        *self = EventPayload::Discovered(fidl::new_empty!(
12225                            DiscoveredPayload,
12226                            fidl::encoding::DefaultFuchsiaResourceDialect
12227                        ));
12228                    }
12229                    #[allow(irrefutable_let_patterns)]
12230                    if let EventPayload::Discovered(ref mut val) = self {
12231                        fidl::decode!(
12232                            DiscoveredPayload,
12233                            fidl::encoding::DefaultFuchsiaResourceDialect,
12234                            val,
12235                            decoder,
12236                            _inner_offset,
12237                            depth
12238                        )?;
12239                    } else {
12240                        unreachable!()
12241                    }
12242                }
12243                5 => {
12244                    #[allow(irrefutable_let_patterns)]
12245                    if let EventPayload::Destroyed(_) = self {
12246                        // Do nothing, read the value into the object
12247                    } else {
12248                        // Initialize `self` to the right variant
12249                        *self = EventPayload::Destroyed(fidl::new_empty!(
12250                            DestroyedPayload,
12251                            fidl::encoding::DefaultFuchsiaResourceDialect
12252                        ));
12253                    }
12254                    #[allow(irrefutable_let_patterns)]
12255                    if let EventPayload::Destroyed(ref mut val) = self {
12256                        fidl::decode!(
12257                            DestroyedPayload,
12258                            fidl::encoding::DefaultFuchsiaResourceDialect,
12259                            val,
12260                            decoder,
12261                            _inner_offset,
12262                            depth
12263                        )?;
12264                    } else {
12265                        unreachable!()
12266                    }
12267                }
12268                6 => {
12269                    #[allow(irrefutable_let_patterns)]
12270                    if let EventPayload::Resolved(_) = self {
12271                        // Do nothing, read the value into the object
12272                    } else {
12273                        // Initialize `self` to the right variant
12274                        *self = EventPayload::Resolved(fidl::new_empty!(
12275                            ResolvedPayload,
12276                            fidl::encoding::DefaultFuchsiaResourceDialect
12277                        ));
12278                    }
12279                    #[allow(irrefutable_let_patterns)]
12280                    if let EventPayload::Resolved(ref mut val) = self {
12281                        fidl::decode!(
12282                            ResolvedPayload,
12283                            fidl::encoding::DefaultFuchsiaResourceDialect,
12284                            val,
12285                            decoder,
12286                            _inner_offset,
12287                            depth
12288                        )?;
12289                    } else {
12290                        unreachable!()
12291                    }
12292                }
12293                7 => {
12294                    #[allow(irrefutable_let_patterns)]
12295                    if let EventPayload::Started(_) = self {
12296                        // Do nothing, read the value into the object
12297                    } else {
12298                        // Initialize `self` to the right variant
12299                        *self = EventPayload::Started(fidl::new_empty!(
12300                            StartedPayload,
12301                            fidl::encoding::DefaultFuchsiaResourceDialect
12302                        ));
12303                    }
12304                    #[allow(irrefutable_let_patterns)]
12305                    if let EventPayload::Started(ref mut val) = self {
12306                        fidl::decode!(
12307                            StartedPayload,
12308                            fidl::encoding::DefaultFuchsiaResourceDialect,
12309                            val,
12310                            decoder,
12311                            _inner_offset,
12312                            depth
12313                        )?;
12314                    } else {
12315                        unreachable!()
12316                    }
12317                }
12318                8 => {
12319                    #[allow(irrefutable_let_patterns)]
12320                    if let EventPayload::Stopped(_) = self {
12321                        // Do nothing, read the value into the object
12322                    } else {
12323                        // Initialize `self` to the right variant
12324                        *self = EventPayload::Stopped(fidl::new_empty!(
12325                            StoppedPayload,
12326                            fidl::encoding::DefaultFuchsiaResourceDialect
12327                        ));
12328                    }
12329                    #[allow(irrefutable_let_patterns)]
12330                    if let EventPayload::Stopped(ref mut val) = self {
12331                        fidl::decode!(
12332                            StoppedPayload,
12333                            fidl::encoding::DefaultFuchsiaResourceDialect,
12334                            val,
12335                            decoder,
12336                            _inner_offset,
12337                            depth
12338                        )?;
12339                    } else {
12340                        unreachable!()
12341                    }
12342                }
12343                9 => {
12344                    #[allow(irrefutable_let_patterns)]
12345                    if let EventPayload::DebugStarted(_) = self {
12346                        // Do nothing, read the value into the object
12347                    } else {
12348                        // Initialize `self` to the right variant
12349                        *self = EventPayload::DebugStarted(fidl::new_empty!(
12350                            DebugStartedPayload,
12351                            fidl::encoding::DefaultFuchsiaResourceDialect
12352                        ));
12353                    }
12354                    #[allow(irrefutable_let_patterns)]
12355                    if let EventPayload::DebugStarted(ref mut val) = self {
12356                        fidl::decode!(
12357                            DebugStartedPayload,
12358                            fidl::encoding::DefaultFuchsiaResourceDialect,
12359                            val,
12360                            decoder,
12361                            _inner_offset,
12362                            depth
12363                        )?;
12364                    } else {
12365                        unreachable!()
12366                    }
12367                }
12368                10 => {
12369                    #[allow(irrefutable_let_patterns)]
12370                    if let EventPayload::Unresolved(_) = self {
12371                        // Do nothing, read the value into the object
12372                    } else {
12373                        // Initialize `self` to the right variant
12374                        *self = EventPayload::Unresolved(fidl::new_empty!(
12375                            UnresolvedPayload,
12376                            fidl::encoding::DefaultFuchsiaResourceDialect
12377                        ));
12378                    }
12379                    #[allow(irrefutable_let_patterns)]
12380                    if let EventPayload::Unresolved(ref mut val) = self {
12381                        fidl::decode!(
12382                            UnresolvedPayload,
12383                            fidl::encoding::DefaultFuchsiaResourceDialect,
12384                            val,
12385                            decoder,
12386                            _inner_offset,
12387                            depth
12388                        )?;
12389                    } else {
12390                        unreachable!()
12391                    }
12392                }
12393                #[allow(deprecated)]
12394                ordinal => {
12395                    for _ in 0..num_handles {
12396                        decoder.drop_next_handle()?;
12397                    }
12398                    *self = EventPayload::__SourceBreaking { unknown_ordinal: ordinal };
12399                }
12400            }
12401            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
12402                return Err(fidl::Error::InvalidNumBytesInEnvelope);
12403            }
12404            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12405                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12406            }
12407            Ok(())
12408        }
12409    }
12410}