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