fidl_fuchsia_component/
fidl_fuchsia_component.rs

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