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