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