Skip to main content

fidl_fuchsia_component_test/
fidl_fuchsia_component_test.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_test_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct BuilderBuildRequest {
16    pub runner: fidl::endpoints::ClientEnd<fidl_fuchsia_component_runner::ComponentRunnerMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BuilderBuildRequest {}
20
21/// The contents of a directory that should be provided by the realm builder
22/// server.
23#[derive(Debug, PartialEq)]
24pub struct DirectoryContents {
25    pub entries: Vec<DirectoryEntry>,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DirectoryContents {}
29
30/// An entry in a directory.
31#[derive(Debug, PartialEq)]
32pub struct DirectoryEntry {
33    /// The path to the file. Valid examples include `foo.txt` and
34    /// `foo/bar.json`.
35    pub file_path: String,
36    /// The contents of the file.
37    pub file_contents: fidl_fuchsia_mem::Buffer,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DirectoryEntry {}
41
42#[derive(Debug, PartialEq)]
43pub struct RealmAddChildRealmFromDeclRequest {
44    /// The name of the child realm that is being added.
45    pub name: String,
46    /// The component's declaration.
47    pub decl: fidl_fuchsia_component_decl::Component,
48    /// Additional properties for the child.
49    pub options: ChildOptions,
50    /// The server end of the `Realm` channel that will be used to build the
51    /// sub-realm.
52    pub child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
56    for RealmAddChildRealmFromDeclRequest
57{
58}
59
60#[derive(Debug, PartialEq)]
61pub struct RealmAddChildRealmFromRelativeUrlRequest {
62    /// The name of the child realm that is being added.
63    pub name: String,
64    /// The relative (fragment-only) URL.
65    pub relative_url: String,
66    /// Additional properties for the child.
67    pub options: ChildOptions,
68    /// The server end of the `Realm` channel that will be used to build the
69    /// sub-realm.
70    pub child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
71}
72
73impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
74    for RealmAddChildRealmFromRelativeUrlRequest
75{
76}
77
78#[derive(Debug, PartialEq)]
79pub struct RealmAddChildRealmRequest {
80    /// The name of the child realm that is being added.
81    pub name: String,
82    /// Additional properties for the child.
83    pub options: ChildOptions,
84    /// The server end of the `Realm` channel that will be used to build the
85    /// sub-realm.
86    pub child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
87}
88
89impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmAddChildRealmRequest {}
90
91#[derive(Debug, PartialEq)]
92pub struct RealmAddStorageRequest {
93    /// The name of the storage capability.
94    pub name: String,
95    /// The target that this storage capability will be offered to.
96    pub to: Vec<fidl_fuchsia_component_decl::Ref>,
97    /// The server end to connect to this storage capability's
98    /// `fuchsia.sys2.StorageAdmin` protocol.
99    pub storage_admin:
100        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>>,
101}
102
103impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmAddStorageRequest {}
104
105#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
106pub struct RealmBuilderFactoryCreateFromRelativeUrlRequest {
107    pub pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
108    pub relative_url: String,
109    pub realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
110    pub builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
111}
112
113impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
114    for RealmBuilderFactoryCreateFromRelativeUrlRequest
115{
116}
117
118#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119pub struct RealmBuilderFactoryCreateRequest {
120    pub pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
121    pub realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
122    pub builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
123}
124
125impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
126    for RealmBuilderFactoryCreateRequest
127{
128}
129
130#[derive(Debug, PartialEq)]
131pub struct RealmReadOnlyDirectoryRequest {
132    /// The name of the directory capability.
133    pub name: String,
134    /// The target that this directory will be offered to.
135    pub to: Vec<fidl_fuchsia_component_decl::Ref>,
136    /// The contents of the directory.
137    pub directory_contents: DirectoryContents,
138}
139
140impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
141    for RealmReadOnlyDirectoryRequest
142{
143}
144
145#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
146pub struct BuilderMarker;
147
148impl fidl::endpoints::ProtocolMarker for BuilderMarker {
149    type Proxy = BuilderProxy;
150    type RequestStream = BuilderRequestStream;
151    #[cfg(target_os = "fuchsia")]
152    type SynchronousProxy = BuilderSynchronousProxy;
153
154    const DEBUG_NAME: &'static str = "fuchsia.component.test.Builder";
155}
156impl fidl::endpoints::DiscoverableProtocolMarker for BuilderMarker {}
157pub type BuilderBuildResult = Result<String, RealmBuilderError>;
158
159pub trait BuilderProxyInterface: Send + Sync {
160    type BuildResponseFut: std::future::Future<Output = Result<BuilderBuildResult, fidl::Error>>
161        + Send;
162    fn r#build(
163        &self,
164        runner: fidl::endpoints::ClientEnd<fidl_fuchsia_component_runner::ComponentRunnerMarker>,
165    ) -> Self::BuildResponseFut;
166}
167#[derive(Debug)]
168#[cfg(target_os = "fuchsia")]
169pub struct BuilderSynchronousProxy {
170    client: fidl::client::sync::Client,
171}
172
173#[cfg(target_os = "fuchsia")]
174impl fidl::endpoints::SynchronousProxy for BuilderSynchronousProxy {
175    type Proxy = BuilderProxy;
176    type Protocol = BuilderMarker;
177
178    fn from_channel(inner: fidl::Channel) -> Self {
179        Self::new(inner)
180    }
181
182    fn into_channel(self) -> fidl::Channel {
183        self.client.into_channel()
184    }
185
186    fn as_channel(&self) -> &fidl::Channel {
187        self.client.as_channel()
188    }
189}
190
191#[cfg(target_os = "fuchsia")]
192impl BuilderSynchronousProxy {
193    pub fn new(channel: fidl::Channel) -> Self {
194        Self { client: fidl::client::sync::Client::new(channel) }
195    }
196
197    pub fn into_channel(self) -> fidl::Channel {
198        self.client.into_channel()
199    }
200
201    /// Waits until an event arrives and returns it. It is safe for other
202    /// threads to make concurrent requests while waiting for an event.
203    pub fn wait_for_event(
204        &self,
205        deadline: zx::MonotonicInstant,
206    ) -> Result<BuilderEvent, fidl::Error> {
207        BuilderEvent::decode(self.client.wait_for_event::<BuilderMarker>(deadline)?)
208    }
209
210    /// Assembles the realm being constructed and returns the URL for the root
211    /// component in the realm, which may then be used to create a new component
212    /// in any collection where fuchsia-test-component is properly set up. Once
213    /// this is called, any Realm channels for the realm will no longer be
214    /// usable. The `runner` argument must be provided if the `AddLocalChild`
215    /// function has been used in this realm, as this runner channel will be
216    /// used to inform the client when to start and stop running any local
217    /// component implementations.
218    ///
219    /// Errors:
220    /// - `INVALID_COMPONENT_DECL`: A component declaration failed validaiton.
221    /// - `BUILD_ALREADY_CALLED`: The `Build` function has been called multiple
222    ///   times on this channel.
223    pub fn r#build(
224        &self,
225        mut runner: fidl::endpoints::ClientEnd<
226            fidl_fuchsia_component_runner::ComponentRunnerMarker,
227        >,
228        ___deadline: zx::MonotonicInstant,
229    ) -> Result<BuilderBuildResult, fidl::Error> {
230        let _response = self.client.send_query::<BuilderBuildRequest, fidl::encoding::ResultType<
231            BuilderBuildResponse,
232            RealmBuilderError,
233        >, BuilderMarker>(
234            (runner,),
235            0x172ba0923ec91575,
236            fidl::encoding::DynamicFlags::empty(),
237            ___deadline,
238        )?;
239        Ok(_response.map(|x| x.root_component_url))
240    }
241}
242
243#[cfg(target_os = "fuchsia")]
244impl From<BuilderSynchronousProxy> for zx::NullableHandle {
245    fn from(value: BuilderSynchronousProxy) -> Self {
246        value.into_channel().into()
247    }
248}
249
250#[cfg(target_os = "fuchsia")]
251impl From<fidl::Channel> for BuilderSynchronousProxy {
252    fn from(value: fidl::Channel) -> Self {
253        Self::new(value)
254    }
255}
256
257#[cfg(target_os = "fuchsia")]
258impl fidl::endpoints::FromClient for BuilderSynchronousProxy {
259    type Protocol = BuilderMarker;
260
261    fn from_client(value: fidl::endpoints::ClientEnd<BuilderMarker>) -> Self {
262        Self::new(value.into_channel())
263    }
264}
265
266#[derive(Debug, Clone)]
267pub struct BuilderProxy {
268    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
269}
270
271impl fidl::endpoints::Proxy for BuilderProxy {
272    type Protocol = BuilderMarker;
273
274    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
275        Self::new(inner)
276    }
277
278    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
279        self.client.into_channel().map_err(|client| Self { client })
280    }
281
282    fn as_channel(&self) -> &::fidl::AsyncChannel {
283        self.client.as_channel()
284    }
285}
286
287impl BuilderProxy {
288    /// Create a new Proxy for fuchsia.component.test/Builder.
289    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
290        let protocol_name = <BuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
291        Self { client: fidl::client::Client::new(channel, protocol_name) }
292    }
293
294    /// Get a Stream of events from the remote end of the protocol.
295    ///
296    /// # Panics
297    ///
298    /// Panics if the event stream was already taken.
299    pub fn take_event_stream(&self) -> BuilderEventStream {
300        BuilderEventStream { event_receiver: self.client.take_event_receiver() }
301    }
302
303    /// Assembles the realm being constructed and returns the URL for the root
304    /// component in the realm, which may then be used to create a new component
305    /// in any collection where fuchsia-test-component is properly set up. Once
306    /// this is called, any Realm channels for the realm will no longer be
307    /// usable. The `runner` argument must be provided if the `AddLocalChild`
308    /// function has been used in this realm, as this runner channel will be
309    /// used to inform the client when to start and stop running any local
310    /// component implementations.
311    ///
312    /// Errors:
313    /// - `INVALID_COMPONENT_DECL`: A component declaration failed validaiton.
314    /// - `BUILD_ALREADY_CALLED`: The `Build` function has been called multiple
315    ///   times on this channel.
316    pub fn r#build(
317        &self,
318        mut runner: fidl::endpoints::ClientEnd<
319            fidl_fuchsia_component_runner::ComponentRunnerMarker,
320        >,
321    ) -> fidl::client::QueryResponseFut<
322        BuilderBuildResult,
323        fidl::encoding::DefaultFuchsiaResourceDialect,
324    > {
325        BuilderProxyInterface::r#build(self, runner)
326    }
327}
328
329impl BuilderProxyInterface for BuilderProxy {
330    type BuildResponseFut = fidl::client::QueryResponseFut<
331        BuilderBuildResult,
332        fidl::encoding::DefaultFuchsiaResourceDialect,
333    >;
334    fn r#build(
335        &self,
336        mut runner: fidl::endpoints::ClientEnd<
337            fidl_fuchsia_component_runner::ComponentRunnerMarker,
338        >,
339    ) -> Self::BuildResponseFut {
340        fn _decode(
341            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
342        ) -> Result<BuilderBuildResult, fidl::Error> {
343            let _response = fidl::client::decode_transaction_body::<
344                fidl::encoding::ResultType<BuilderBuildResponse, RealmBuilderError>,
345                fidl::encoding::DefaultFuchsiaResourceDialect,
346                0x172ba0923ec91575,
347            >(_buf?)?;
348            Ok(_response.map(|x| x.root_component_url))
349        }
350        self.client.send_query_and_decode::<BuilderBuildRequest, BuilderBuildResult>(
351            (runner,),
352            0x172ba0923ec91575,
353            fidl::encoding::DynamicFlags::empty(),
354            _decode,
355        )
356    }
357}
358
359pub struct BuilderEventStream {
360    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
361}
362
363impl std::marker::Unpin for BuilderEventStream {}
364
365impl futures::stream::FusedStream for BuilderEventStream {
366    fn is_terminated(&self) -> bool {
367        self.event_receiver.is_terminated()
368    }
369}
370
371impl futures::Stream for BuilderEventStream {
372    type Item = Result<BuilderEvent, fidl::Error>;
373
374    fn poll_next(
375        mut self: std::pin::Pin<&mut Self>,
376        cx: &mut std::task::Context<'_>,
377    ) -> std::task::Poll<Option<Self::Item>> {
378        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
379            &mut self.event_receiver,
380            cx
381        )?) {
382            Some(buf) => std::task::Poll::Ready(Some(BuilderEvent::decode(buf))),
383            None => std::task::Poll::Ready(None),
384        }
385    }
386}
387
388#[derive(Debug)]
389pub enum BuilderEvent {}
390
391impl BuilderEvent {
392    /// Decodes a message buffer as a [`BuilderEvent`].
393    fn decode(
394        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
395    ) -> Result<BuilderEvent, fidl::Error> {
396        let (bytes, _handles) = buf.split_mut();
397        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
398        debug_assert_eq!(tx_header.tx_id, 0);
399        match tx_header.ordinal {
400            _ => Err(fidl::Error::UnknownOrdinal {
401                ordinal: tx_header.ordinal,
402                protocol_name: <BuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
403            }),
404        }
405    }
406}
407
408/// A Stream of incoming requests for fuchsia.component.test/Builder.
409pub struct BuilderRequestStream {
410    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
411    is_terminated: bool,
412}
413
414impl std::marker::Unpin for BuilderRequestStream {}
415
416impl futures::stream::FusedStream for BuilderRequestStream {
417    fn is_terminated(&self) -> bool {
418        self.is_terminated
419    }
420}
421
422impl fidl::endpoints::RequestStream for BuilderRequestStream {
423    type Protocol = BuilderMarker;
424    type ControlHandle = BuilderControlHandle;
425
426    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
427        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
428    }
429
430    fn control_handle(&self) -> Self::ControlHandle {
431        BuilderControlHandle { inner: self.inner.clone() }
432    }
433
434    fn into_inner(
435        self,
436    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
437    {
438        (self.inner, self.is_terminated)
439    }
440
441    fn from_inner(
442        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
443        is_terminated: bool,
444    ) -> Self {
445        Self { inner, is_terminated }
446    }
447}
448
449impl futures::Stream for BuilderRequestStream {
450    type Item = Result<BuilderRequest, fidl::Error>;
451
452    fn poll_next(
453        mut self: std::pin::Pin<&mut Self>,
454        cx: &mut std::task::Context<'_>,
455    ) -> std::task::Poll<Option<Self::Item>> {
456        let this = &mut *self;
457        if this.inner.check_shutdown(cx) {
458            this.is_terminated = true;
459            return std::task::Poll::Ready(None);
460        }
461        if this.is_terminated {
462            panic!("polled BuilderRequestStream after completion");
463        }
464        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
465            |bytes, handles| {
466                match this.inner.channel().read_etc(cx, bytes, handles) {
467                    std::task::Poll::Ready(Ok(())) => {}
468                    std::task::Poll::Pending => return std::task::Poll::Pending,
469                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
470                        this.is_terminated = true;
471                        return std::task::Poll::Ready(None);
472                    }
473                    std::task::Poll::Ready(Err(e)) => {
474                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
475                            e.into(),
476                        ))));
477                    }
478                }
479
480                // A message has been received from the channel
481                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
482
483                std::task::Poll::Ready(Some(match header.ordinal {
484                    0x172ba0923ec91575 => {
485                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
486                        let mut req = fidl::new_empty!(
487                            BuilderBuildRequest,
488                            fidl::encoding::DefaultFuchsiaResourceDialect
489                        );
490                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BuilderBuildRequest>(&header, _body_bytes, handles, &mut req)?;
491                        let control_handle = BuilderControlHandle { inner: this.inner.clone() };
492                        Ok(BuilderRequest::Build {
493                            runner: req.runner,
494
495                            responder: BuilderBuildResponder {
496                                control_handle: std::mem::ManuallyDrop::new(control_handle),
497                                tx_id: header.tx_id,
498                            },
499                        })
500                    }
501                    _ => Err(fidl::Error::UnknownOrdinal {
502                        ordinal: header.ordinal,
503                        protocol_name:
504                            <BuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
505                    }),
506                }))
507            },
508        )
509    }
510}
511
512#[derive(Debug)]
513pub enum BuilderRequest {
514    /// Assembles the realm being constructed and returns the URL for the root
515    /// component in the realm, which may then be used to create a new component
516    /// in any collection where fuchsia-test-component is properly set up. Once
517    /// this is called, any Realm channels for the realm will no longer be
518    /// usable. The `runner` argument must be provided if the `AddLocalChild`
519    /// function has been used in this realm, as this runner channel will be
520    /// used to inform the client when to start and stop running any local
521    /// component implementations.
522    ///
523    /// Errors:
524    /// - `INVALID_COMPONENT_DECL`: A component declaration failed validaiton.
525    /// - `BUILD_ALREADY_CALLED`: The `Build` function has been called multiple
526    ///   times on this channel.
527    Build {
528        runner: fidl::endpoints::ClientEnd<fidl_fuchsia_component_runner::ComponentRunnerMarker>,
529        responder: BuilderBuildResponder,
530    },
531}
532
533impl BuilderRequest {
534    #[allow(irrefutable_let_patterns)]
535    pub fn into_build(
536        self,
537    ) -> Option<(
538        fidl::endpoints::ClientEnd<fidl_fuchsia_component_runner::ComponentRunnerMarker>,
539        BuilderBuildResponder,
540    )> {
541        if let BuilderRequest::Build { runner, responder } = self {
542            Some((runner, responder))
543        } else {
544            None
545        }
546    }
547
548    /// Name of the method defined in FIDL
549    pub fn method_name(&self) -> &'static str {
550        match *self {
551            BuilderRequest::Build { .. } => "build",
552        }
553    }
554}
555
556#[derive(Debug, Clone)]
557pub struct BuilderControlHandle {
558    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
559}
560
561impl BuilderControlHandle {
562    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
563        self.inner.shutdown_with_epitaph(status.into())
564    }
565}
566
567impl fidl::endpoints::ControlHandle for BuilderControlHandle {
568    fn shutdown(&self) {
569        self.inner.shutdown()
570    }
571
572    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
573        self.inner.shutdown_with_epitaph(status)
574    }
575
576    fn is_closed(&self) -> bool {
577        self.inner.channel().is_closed()
578    }
579    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
580        self.inner.channel().on_closed()
581    }
582
583    #[cfg(target_os = "fuchsia")]
584    fn signal_peer(
585        &self,
586        clear_mask: zx::Signals,
587        set_mask: zx::Signals,
588    ) -> Result<(), zx_status::Status> {
589        use fidl::Peered;
590        self.inner.channel().signal_peer(clear_mask, set_mask)
591    }
592}
593
594impl BuilderControlHandle {}
595
596#[must_use = "FIDL methods require a response to be sent"]
597#[derive(Debug)]
598pub struct BuilderBuildResponder {
599    control_handle: std::mem::ManuallyDrop<BuilderControlHandle>,
600    tx_id: u32,
601}
602
603/// Set the the channel to be shutdown (see [`BuilderControlHandle::shutdown`])
604/// if the responder is dropped without sending a response, so that the client
605/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
606impl std::ops::Drop for BuilderBuildResponder {
607    fn drop(&mut self) {
608        self.control_handle.shutdown();
609        // Safety: drops once, never accessed again
610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
611    }
612}
613
614impl fidl::endpoints::Responder for BuilderBuildResponder {
615    type ControlHandle = BuilderControlHandle;
616
617    fn control_handle(&self) -> &BuilderControlHandle {
618        &self.control_handle
619    }
620
621    fn drop_without_shutdown(mut self) {
622        // Safety: drops once, never accessed again due to mem::forget
623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
624        // Prevent Drop from running (which would shut down the channel)
625        std::mem::forget(self);
626    }
627}
628
629impl BuilderBuildResponder {
630    /// Sends a response to the FIDL transaction.
631    ///
632    /// Sets the channel to shutdown if an error occurs.
633    pub fn send(self, mut result: Result<&str, RealmBuilderError>) -> Result<(), fidl::Error> {
634        let _result = self.send_raw(result);
635        if _result.is_err() {
636            self.control_handle.shutdown();
637        }
638        self.drop_without_shutdown();
639        _result
640    }
641
642    /// Similar to "send" but does not shutdown the channel if an error occurs.
643    pub fn send_no_shutdown_on_err(
644        self,
645        mut result: Result<&str, RealmBuilderError>,
646    ) -> Result<(), fidl::Error> {
647        let _result = self.send_raw(result);
648        self.drop_without_shutdown();
649        _result
650    }
651
652    fn send_raw(&self, mut result: Result<&str, RealmBuilderError>) -> Result<(), fidl::Error> {
653        self.control_handle
654            .inner
655            .send::<fidl::encoding::ResultType<BuilderBuildResponse, RealmBuilderError>>(
656                result.map(|root_component_url| (root_component_url,)),
657                self.tx_id,
658                0x172ba0923ec91575,
659                fidl::encoding::DynamicFlags::empty(),
660            )
661    }
662}
663
664#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
665pub struct RealmMarker;
666
667impl fidl::endpoints::ProtocolMarker for RealmMarker {
668    type Proxy = RealmProxy;
669    type RequestStream = RealmRequestStream;
670    #[cfg(target_os = "fuchsia")]
671    type SynchronousProxy = RealmSynchronousProxy;
672
673    const DEBUG_NAME: &'static str = "fuchsia.component.test.Realm";
674}
675impl fidl::endpoints::DiscoverableProtocolMarker for RealmMarker {}
676pub type RealmAddChildResult = Result<(), RealmBuilderError>;
677pub type RealmAddChildFromDeclResult = Result<(), RealmBuilderError>;
678pub type RealmAddLocalChildResult = Result<(), RealmBuilderError>;
679pub type RealmAddChildRealmResult = Result<(), RealmBuilderError>;
680pub type RealmAddChildRealmFromRelativeUrlResult = Result<(), RealmBuilderError>;
681pub type RealmAddChildRealmFromDeclResult = Result<(), RealmBuilderError>;
682pub type RealmGetComponentDeclResult =
683    Result<fidl_fuchsia_component_decl::Component, RealmBuilderError>;
684pub type RealmReplaceComponentDeclResult = Result<(), RealmBuilderError>;
685pub type RealmGetRealmDeclResult =
686    Result<fidl_fuchsia_component_decl::Component, RealmBuilderError>;
687pub type RealmReplaceRealmDeclResult = Result<(), RealmBuilderError>;
688pub type RealmUseNestedComponentManagerResult = Result<(), RealmBuilderError>;
689pub type RealmAddRouteResult = Result<(), RealmBuilderError>;
690pub type RealmAddRouteFromDictionaryResult = Result<(), RealmBuilderError>;
691pub type RealmReadOnlyDirectoryResult = Result<(), RealmBuilderError>;
692pub type RealmAddStorageResult = Result<(), RealmBuilderError>;
693pub type RealmInitMutableConfigFromPackageResult = Result<(), RealmBuilderError>;
694pub type RealmInitMutableConfigToEmptyResult = Result<(), RealmBuilderError>;
695pub type RealmAddCapabilityResult = Result<(), RealmBuilderError>;
696pub type RealmAddCollectionResult = Result<(), RealmBuilderError>;
697pub type RealmAddEnvironmentResult = Result<(), RealmBuilderError>;
698pub type RealmSetConfigValueResult = Result<(), RealmBuilderError>;
699
700pub trait RealmProxyInterface: Send + Sync {
701    type AddChildResponseFut: std::future::Future<Output = Result<RealmAddChildResult, fidl::Error>>
702        + Send;
703    fn r#add_child(
704        &self,
705        name: &str,
706        url: &str,
707        options: &ChildOptions,
708    ) -> Self::AddChildResponseFut;
709    type AddChildFromDeclResponseFut: std::future::Future<Output = Result<RealmAddChildFromDeclResult, fidl::Error>>
710        + Send;
711    fn r#add_child_from_decl(
712        &self,
713        name: &str,
714        decl: &fidl_fuchsia_component_decl::Component,
715        options: &ChildOptions,
716    ) -> Self::AddChildFromDeclResponseFut;
717    type AddLocalChildResponseFut: std::future::Future<Output = Result<RealmAddLocalChildResult, fidl::Error>>
718        + Send;
719    fn r#add_local_child(
720        &self,
721        name: &str,
722        options: &ChildOptions,
723    ) -> Self::AddLocalChildResponseFut;
724    type AddChildRealmResponseFut: std::future::Future<Output = Result<RealmAddChildRealmResult, fidl::Error>>
725        + Send;
726    fn r#add_child_realm(
727        &self,
728        name: &str,
729        options: &ChildOptions,
730        child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
731    ) -> Self::AddChildRealmResponseFut;
732    type AddChildRealmFromRelativeUrlResponseFut: std::future::Future<Output = Result<RealmAddChildRealmFromRelativeUrlResult, fidl::Error>>
733        + Send;
734    fn r#add_child_realm_from_relative_url(
735        &self,
736        name: &str,
737        relative_url: &str,
738        options: &ChildOptions,
739        child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
740    ) -> Self::AddChildRealmFromRelativeUrlResponseFut;
741    type AddChildRealmFromDeclResponseFut: std::future::Future<Output = Result<RealmAddChildRealmFromDeclResult, fidl::Error>>
742        + Send;
743    fn r#add_child_realm_from_decl(
744        &self,
745        name: &str,
746        decl: &fidl_fuchsia_component_decl::Component,
747        options: &ChildOptions,
748        child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
749    ) -> Self::AddChildRealmFromDeclResponseFut;
750    type GetComponentDeclResponseFut: std::future::Future<Output = Result<RealmGetComponentDeclResult, fidl::Error>>
751        + Send;
752    fn r#get_component_decl(&self, name: &str) -> Self::GetComponentDeclResponseFut;
753    type ReplaceComponentDeclResponseFut: std::future::Future<Output = Result<RealmReplaceComponentDeclResult, fidl::Error>>
754        + Send;
755    fn r#replace_component_decl(
756        &self,
757        name: &str,
758        component_decl: &fidl_fuchsia_component_decl::Component,
759    ) -> Self::ReplaceComponentDeclResponseFut;
760    type GetRealmDeclResponseFut: std::future::Future<Output = Result<RealmGetRealmDeclResult, fidl::Error>>
761        + Send;
762    fn r#get_realm_decl(&self) -> Self::GetRealmDeclResponseFut;
763    type ReplaceRealmDeclResponseFut: std::future::Future<Output = Result<RealmReplaceRealmDeclResult, fidl::Error>>
764        + Send;
765    fn r#replace_realm_decl(
766        &self,
767        component_decl: &fidl_fuchsia_component_decl::Component,
768    ) -> Self::ReplaceRealmDeclResponseFut;
769    type UseNestedComponentManagerResponseFut: std::future::Future<Output = Result<RealmUseNestedComponentManagerResult, fidl::Error>>
770        + Send;
771    fn r#use_nested_component_manager(
772        &self,
773        component_manager_relative_url: &str,
774    ) -> Self::UseNestedComponentManagerResponseFut;
775    type AddRouteResponseFut: std::future::Future<Output = Result<RealmAddRouteResult, fidl::Error>>
776        + Send;
777    fn r#add_route(
778        &self,
779        capabilities: &[Capability],
780        from: &fidl_fuchsia_component_decl::Ref,
781        to: &[fidl_fuchsia_component_decl::Ref],
782    ) -> Self::AddRouteResponseFut;
783    type AddRouteFromDictionaryResponseFut: std::future::Future<Output = Result<RealmAddRouteFromDictionaryResult, fidl::Error>>
784        + Send;
785    fn r#add_route_from_dictionary(
786        &self,
787        capabilities: &[Capability],
788        from: &fidl_fuchsia_component_decl::Ref,
789        from_dictionary: &str,
790        to: &[fidl_fuchsia_component_decl::Ref],
791    ) -> Self::AddRouteFromDictionaryResponseFut;
792    type ReadOnlyDirectoryResponseFut: std::future::Future<Output = Result<RealmReadOnlyDirectoryResult, fidl::Error>>
793        + Send;
794    fn r#read_only_directory(
795        &self,
796        name: &str,
797        to: &[fidl_fuchsia_component_decl::Ref],
798        directory_contents: DirectoryContents,
799    ) -> Self::ReadOnlyDirectoryResponseFut;
800    type AddStorageResponseFut: std::future::Future<Output = Result<RealmAddStorageResult, fidl::Error>>
801        + Send;
802    fn r#add_storage(
803        &self,
804        name: &str,
805        to: &[fidl_fuchsia_component_decl::Ref],
806        storage_admin: Option<
807            fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
808        >,
809    ) -> Self::AddStorageResponseFut;
810    type InitMutableConfigFromPackageResponseFut: std::future::Future<Output = Result<RealmInitMutableConfigFromPackageResult, fidl::Error>>
811        + Send;
812    fn r#init_mutable_config_from_package(
813        &self,
814        name: &str,
815    ) -> Self::InitMutableConfigFromPackageResponseFut;
816    type InitMutableConfigToEmptyResponseFut: std::future::Future<Output = Result<RealmInitMutableConfigToEmptyResult, fidl::Error>>
817        + Send;
818    fn r#init_mutable_config_to_empty(
819        &self,
820        name: &str,
821    ) -> Self::InitMutableConfigToEmptyResponseFut;
822    type AddCapabilityResponseFut: std::future::Future<Output = Result<RealmAddCapabilityResult, fidl::Error>>
823        + Send;
824    fn r#add_capability(
825        &self,
826        capability: &fidl_fuchsia_component_decl::Capability,
827    ) -> Self::AddCapabilityResponseFut;
828    type AddCollectionResponseFut: std::future::Future<Output = Result<RealmAddCollectionResult, fidl::Error>>
829        + Send;
830    fn r#add_collection(
831        &self,
832        collection: &fidl_fuchsia_component_decl::Collection,
833    ) -> Self::AddCollectionResponseFut;
834    type AddEnvironmentResponseFut: std::future::Future<Output = Result<RealmAddEnvironmentResult, fidl::Error>>
835        + Send;
836    fn r#add_environment(
837        &self,
838        environment: &fidl_fuchsia_component_decl::Environment,
839    ) -> Self::AddEnvironmentResponseFut;
840    type SetConfigValueResponseFut: std::future::Future<Output = Result<RealmSetConfigValueResult, fidl::Error>>
841        + Send;
842    fn r#set_config_value(
843        &self,
844        name: &str,
845        key: &str,
846        value: &fidl_fuchsia_component_decl::ConfigValueSpec,
847    ) -> Self::SetConfigValueResponseFut;
848}
849#[derive(Debug)]
850#[cfg(target_os = "fuchsia")]
851pub struct RealmSynchronousProxy {
852    client: fidl::client::sync::Client,
853}
854
855#[cfg(target_os = "fuchsia")]
856impl fidl::endpoints::SynchronousProxy for RealmSynchronousProxy {
857    type Proxy = RealmProxy;
858    type Protocol = RealmMarker;
859
860    fn from_channel(inner: fidl::Channel) -> Self {
861        Self::new(inner)
862    }
863
864    fn into_channel(self) -> fidl::Channel {
865        self.client.into_channel()
866    }
867
868    fn as_channel(&self) -> &fidl::Channel {
869        self.client.as_channel()
870    }
871}
872
873#[cfg(target_os = "fuchsia")]
874impl RealmSynchronousProxy {
875    pub fn new(channel: fidl::Channel) -> Self {
876        Self { client: fidl::client::sync::Client::new(channel) }
877    }
878
879    pub fn into_channel(self) -> fidl::Channel {
880        self.client.into_channel()
881    }
882
883    /// Waits until an event arrives and returns it. It is safe for other
884    /// threads to make concurrent requests while waiting for an event.
885    pub fn wait_for_event(
886        &self,
887        deadline: zx::MonotonicInstant,
888    ) -> Result<RealmEvent, fidl::Error> {
889        RealmEvent::decode(self.client.wait_for_event::<RealmMarker>(deadline)?)
890    }
891
892    /// Adds a component to the realm.
893    ///
894    /// The `url` can be in one of the following formats:
895    ///
896    /// - an absolute component URL (such as,
897    ///   "fuchsia-pkg://fuchsia.com/some-package#meta/some-component.cm")
898    /// - a relative path component URL to a subpackaged component (like,
899    ///   "some-subpackage#meta/subpackaged-component.cm"); or
900    /// - a relative fragment-only URL (like, `#meta/other-component.cm`;
901    ///   see https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
902    ///   indicating the path to a component manifest in the `pkg_dir` supplied
903    ///   to `RealmBuilderFactory::Create*()`.
904    ///
905    /// The realm builder client typically passes a handle to its own `/pkg`
906    /// directory, and bundles the `other-component` into the same package.
907    ///
908    /// Of the three URL types, _only_ component declarations added via the
909    /// fragment-only URL can be modified, via
910    /// `GetComponentDecl`/`ReplaceComponentDecl` because realm builder actually
911    /// performs its own component resolution from the component's manifest and
912    /// files bundled in the provided `pkg_dir` (typically from the package
913    /// shared by the realm builder client component and the components added
914    /// via fragment-only URL).
915    ///
916    /// Errors:
917    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
918    ///   given name.
919    /// - `INVALID_MANIFEST_EXTENSION`: `url` does not end with `.cm`
920    /// - `DECL_NOT_FOUND`: The test package does not contain the component
921    ///   declaration referenced by a fragment-only component URL.
922    /// - `DECL_READ_ERROR`: Encountered an I/O error when attempting to read a
923    ///   component declaration referenced by a fragment-only component URL from
924    ///   the test package.
925    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
926    ///   for this realm, and thus this `Realm` channel can no longer be used.
927    pub fn r#add_child(
928        &self,
929        mut name: &str,
930        mut url: &str,
931        mut options: &ChildOptions,
932        ___deadline: zx::MonotonicInstant,
933    ) -> Result<RealmAddChildResult, fidl::Error> {
934        let _response = self.client.send_query::<RealmAddChildRequest, fidl::encoding::ResultType<
935            fidl::encoding::EmptyStruct,
936            RealmBuilderError,
937        >, RealmMarker>(
938            (name, url, options),
939            0x3f6c07627303d801,
940            fidl::encoding::DynamicFlags::empty(),
941            ___deadline,
942        )?;
943        Ok(_response.map(|x| x))
944    }
945
946    /// Adds a component to this realm whose declaration is set to `decl`. When
947    /// launched, the component will share the test package as its package
948    /// directory, and may access any resources from it.
949    ///
950    /// Errors:
951    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
952    ///   given name.
953    /// - `INVALID_COMPONENT_DECL`: `decl` failed validation.
954    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
955    ///   for this realm, and thus this `Realm` channel can no longer be used.
956    pub fn r#add_child_from_decl(
957        &self,
958        mut name: &str,
959        mut decl: &fidl_fuchsia_component_decl::Component,
960        mut options: &ChildOptions,
961        ___deadline: zx::MonotonicInstant,
962    ) -> Result<RealmAddChildFromDeclResult, fidl::Error> {
963        let _response =
964            self.client.send_query::<RealmAddChildFromDeclRequest, fidl::encoding::ResultType<
965                fidl::encoding::EmptyStruct,
966                RealmBuilderError,
967            >, RealmMarker>(
968                (name, decl, options),
969                0x3950ad500258156d,
970                fidl::encoding::DynamicFlags::empty(),
971                ___deadline,
972            )?;
973        Ok(_response.map(|x| x))
974    }
975
976    /// Adds a component to the realm whose implementation will be provided by
977    /// the client. When this component should be started, the runner channel
978    /// passed into `Build` will receive a start request for a component whose
979    /// `ProgramDecl` contains the moniker from the root of the
980    /// constructed realm for the child that is to be run under the `program`
981    /// key `LOCAL_COMPONENT_NAME`.
982    ///
983    /// Errors:
984    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
985    ///   given name.
986    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
987    ///   for this realm, and thus this `Realm` channel can no longer be used.
988    pub fn r#add_local_child(
989        &self,
990        mut name: &str,
991        mut options: &ChildOptions,
992        ___deadline: zx::MonotonicInstant,
993    ) -> Result<RealmAddLocalChildResult, fidl::Error> {
994        let _response =
995            self.client.send_query::<RealmAddLocalChildRequest, fidl::encoding::ResultType<
996                fidl::encoding::EmptyStruct,
997                RealmBuilderError,
998            >, RealmMarker>(
999                (name, options),
1000                0x3249817bae10abbb,
1001                fidl::encoding::DynamicFlags::empty(),
1002                ___deadline,
1003            )?;
1004        Ok(_response.map(|x| x))
1005    }
1006
1007    /// Adds a child realm which can be built with the client end of
1008    /// `child_realm`.
1009    ///
1010    /// Errors:
1011    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
1012    ///   given name.
1013    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1014    ///   for this realm, and thus this `Realm` channel can no longer be used.
1015    pub fn r#add_child_realm(
1016        &self,
1017        mut name: &str,
1018        mut options: &ChildOptions,
1019        mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
1020        ___deadline: zx::MonotonicInstant,
1021    ) -> Result<RealmAddChildRealmResult, fidl::Error> {
1022        let _response =
1023            self.client.send_query::<RealmAddChildRealmRequest, fidl::encoding::ResultType<
1024                fidl::encoding::EmptyStruct,
1025                RealmBuilderError,
1026            >, RealmMarker>(
1027                (name, options, child_realm),
1028                0x3fdf98db373b9458,
1029                fidl::encoding::DynamicFlags::empty(),
1030                ___deadline,
1031            )?;
1032        Ok(_response.map(|x| x))
1033    }
1034
1035    /// Adds a child realm which can be built with the client end of
1036    /// `child_realm`, and whose contents are initialized from `relative_url`.
1037    /// `relative_url` must be a fragment-only URL.
1038    pub fn r#add_child_realm_from_relative_url(
1039        &self,
1040        mut name: &str,
1041        mut relative_url: &str,
1042        mut options: &ChildOptions,
1043        mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
1044        ___deadline: zx::MonotonicInstant,
1045    ) -> Result<RealmAddChildRealmFromRelativeUrlResult, fidl::Error> {
1046        let _response = self.client.send_query::<
1047            RealmAddChildRealmFromRelativeUrlRequest,
1048            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
1049            RealmMarker,
1050        >(
1051            (name, relative_url, options, child_realm,),
1052            0x44c34c8dcbe06abb,
1053            fidl::encoding::DynamicFlags::empty(),
1054            ___deadline,
1055        )?;
1056        Ok(_response.map(|x| x))
1057    }
1058
1059    /// Adds a child realm which can be built with the client end of
1060    /// `child_realm`, and whose contents are initialized from `decl`.
1061    pub fn r#add_child_realm_from_decl(
1062        &self,
1063        mut name: &str,
1064        mut decl: &fidl_fuchsia_component_decl::Component,
1065        mut options: &ChildOptions,
1066        mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
1067        ___deadline: zx::MonotonicInstant,
1068    ) -> Result<RealmAddChildRealmFromDeclResult, fidl::Error> {
1069        let _response = self.client.send_query::<
1070            RealmAddChildRealmFromDeclRequest,
1071            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
1072            RealmMarker,
1073        >(
1074            (name, decl, options, child_realm,),
1075            0x142e5c326732862e,
1076            fidl::encoding::DynamicFlags::empty(),
1077            ___deadline,
1078        )?;
1079        Ok(_response.map(|x| x))
1080    }
1081
1082    /// Returns the component decl for the given component. `name` must refer to
1083    /// a component that is one of the following:
1084    ///
1085    /// - A component with a local implementation
1086    /// - A legacy component
1087    /// - A component added with a fragment-only URL (typically, components
1088    ///   bundled in the same package as the realm builder client, sharing the
1089    ///   same `/pkg` directory, for example, `#meta/other-component.cm`; see
1090    ///   https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
1091    /// - An automatically generated realm (ex: the root)
1092    ///
1093    /// Errors:
1094    /// - `NO_SUCH_CHILD`: This realm does not contain a child with the given
1095    ///   name.
1096    /// - `CHILD_DECL_NOT_VISIBLE`: The component decl cannot be fetched for
1097    ///   the referenced child, because the child was added to the realm using
1098    ///   a modern (not legacy) absolute URL or subpackaged component's relative
1099    ///   path URL.
1100    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1101    ///   for this realm, and thus this `Realm` channel can no longer be used.
1102    pub fn r#get_component_decl(
1103        &self,
1104        mut name: &str,
1105        ___deadline: zx::MonotonicInstant,
1106    ) -> Result<RealmGetComponentDeclResult, fidl::Error> {
1107        let _response =
1108            self.client.send_query::<RealmGetComponentDeclRequest, fidl::encoding::ResultType<
1109                RealmGetComponentDeclResponse,
1110                RealmBuilderError,
1111            >, RealmMarker>(
1112                (name,),
1113                0x320832af6a4cbac6,
1114                fidl::encoding::DynamicFlags::empty(),
1115                ___deadline,
1116            )?;
1117        Ok(_response.map(|x| x.component_decl))
1118    }
1119
1120    /// Replaces the component decl for the given component. `name` must
1121    /// refer to a component that is one of the following:
1122    ///
1123    /// - A component with a local implementation
1124    /// - A legacy component
1125    /// - A component added with a fragment-only URL (typically, components
1126    ///   bundled in the same package as the realm builder client, sharing the
1127    ///   same `/pkg` directory, for example, `#meta/other-component.cm`; see
1128    ///   https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
1129    /// - An automatically generated realm (ex: the root)
1130    ///
1131    /// Errors:
1132    /// - `NO_SUCH_CHILD`: This realm does not contain a child with the given
1133    ///   name.
1134    /// - `CHILD_ALREADY_EXISTS`: The component whose decl is being replaced has
1135    ///   had a child added to it through realm builder with the same name as an
1136    ///   element in `component_decl.children`.
1137    /// - `CHILD_DECL_NOT_VISIBLE`: The component decl cannot be manipulated for
1138    ///   the referenced child, because the child was added to the realm using
1139    ///   an absolute (not relative) and modern (not legacy) URL.
1140    /// - `INVALID_COMPONENT_DECL`: `component_decl` failed validation.
1141    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1142    ///   for this realm, and thus this `Realm` channel can no longer be used.
1143    pub fn r#replace_component_decl(
1144        &self,
1145        mut name: &str,
1146        mut component_decl: &fidl_fuchsia_component_decl::Component,
1147        ___deadline: zx::MonotonicInstant,
1148    ) -> Result<RealmReplaceComponentDeclResult, fidl::Error> {
1149        let _response =
1150            self.client.send_query::<RealmReplaceComponentDeclRequest, fidl::encoding::ResultType<
1151                fidl::encoding::EmptyStruct,
1152                RealmBuilderError,
1153            >, RealmMarker>(
1154                (name, component_decl),
1155                0x59cecf31b314cd5f,
1156                fidl::encoding::DynamicFlags::empty(),
1157                ___deadline,
1158            )?;
1159        Ok(_response.map(|x| x))
1160    }
1161
1162    /// Returns the component decl for this realm.
1163    ///
1164    /// Errors:
1165    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1166    ///   for this realm, and thus this `Realm` channel can no longer be used.
1167    pub fn r#get_realm_decl(
1168        &self,
1169        ___deadline: zx::MonotonicInstant,
1170    ) -> Result<RealmGetRealmDeclResult, fidl::Error> {
1171        let _response = self.client.send_query::<
1172            fidl::encoding::EmptyPayload,
1173            fidl::encoding::ResultType<RealmGetRealmDeclResponse, RealmBuilderError>,
1174            RealmMarker,
1175        >(
1176            (),
1177            0x46fa05b17bd64269,
1178            fidl::encoding::DynamicFlags::empty(),
1179            ___deadline,
1180        )?;
1181        Ok(_response.map(|x| x.component_decl))
1182    }
1183
1184    /// Replaces the component decl for this realm.
1185    ///
1186    /// Errors:
1187    /// - `INVALID_COMPONENT_DECL`: `component_decl` failed validation.
1188    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1189    ///   for this realm, and thus this `Realm` channel can no longer be used.
1190    pub fn r#replace_realm_decl(
1191        &self,
1192        mut component_decl: &fidl_fuchsia_component_decl::Component,
1193        ___deadline: zx::MonotonicInstant,
1194    ) -> Result<RealmReplaceRealmDeclResult, fidl::Error> {
1195        let _response =
1196            self.client.send_query::<RealmReplaceRealmDeclRequest, fidl::encoding::ResultType<
1197                fidl::encoding::EmptyStruct,
1198                RealmBuilderError,
1199            >, RealmMarker>(
1200                (component_decl,),
1201                0x48fcba4ac1338da9,
1202                fidl::encoding::DynamicFlags::empty(),
1203                ___deadline,
1204            )?;
1205        Ok(_response.map(|x| x))
1206    }
1207
1208    /// Inform the realm builder server that this realm is using a nested component manager. It's
1209    /// expected that the client library has already replaced the realm's declaration with a
1210    /// passthrough component manager declaration, with the exception of the root url.
1211    /// This method will arrange for [Builder.Build] to install the realm's generated url as the
1212    /// root url in this component manager.
1213    pub fn r#use_nested_component_manager(
1214        &self,
1215        mut component_manager_relative_url: &str,
1216        ___deadline: zx::MonotonicInstant,
1217    ) -> Result<RealmUseNestedComponentManagerResult, fidl::Error> {
1218        let _response = self.client.send_query::<
1219            RealmUseNestedComponentManagerRequest,
1220            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
1221            RealmMarker,
1222        >(
1223            (component_manager_relative_url,),
1224            0x64bd27482f3dcc,
1225            fidl::encoding::DynamicFlags::empty(),
1226            ___deadline,
1227        )?;
1228        Ok(_response.map(|x| x))
1229    }
1230
1231    /// Identical to `AddRouteFromDictionary`, except it does not accept `from_dictionary` which
1232    /// it always sets to ".".
1233    pub fn r#add_route(
1234        &self,
1235        mut capabilities: &[Capability],
1236        mut from: &fidl_fuchsia_component_decl::Ref,
1237        mut to: &[fidl_fuchsia_component_decl::Ref],
1238        ___deadline: zx::MonotonicInstant,
1239    ) -> Result<RealmAddRouteResult, fidl::Error> {
1240        let _response = self.client.send_query::<RealmAddRouteRequest, fidl::encoding::ResultType<
1241            fidl::encoding::EmptyStruct,
1242            RealmBuilderError,
1243        >, RealmMarker>(
1244            (capabilities, from, to),
1245            0x9d523295be53a0a,
1246            fidl::encoding::DynamicFlags::empty(),
1247            ___deadline,
1248        )?;
1249        Ok(_response.map(|x| x))
1250    }
1251
1252    /// Mutates component manifests in the realm such that every component in
1253    /// `to` will have a valid capability route for each item in `capabilities`
1254    /// provided by `from`.
1255    ///
1256    /// Errors:
1257    /// - `NO_SUCH_SOURCE`: `from` references a non-existent child.
1258    /// - `NO_SUCH_TARGET`: `to` references a non-existent child.
1259    /// - `CAPABILITIES_EMPTY`: `capabilities` is empty.
1260    /// - `TARGETS_EMPTY`: `to` is empty.
1261    /// - `SOURCE_AND_TARGET_MATCH`: `from` is equal to one of the elements in
1262    ///   `to`.
1263    /// - `INVALID_COMPONENT_DECL`: The requested route caused one of the
1264    ///   involved manifests to fail validation.
1265    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1266    ///   for this realm, and thus this `Realm` channel can no longer be used.
1267    pub fn r#add_route_from_dictionary(
1268        &self,
1269        mut capabilities: &[Capability],
1270        mut from: &fidl_fuchsia_component_decl::Ref,
1271        mut from_dictionary: &str,
1272        mut to: &[fidl_fuchsia_component_decl::Ref],
1273        ___deadline: zx::MonotonicInstant,
1274    ) -> Result<RealmAddRouteFromDictionaryResult, fidl::Error> {
1275        let _response = self.client.send_query::<
1276            RealmAddRouteFromDictionaryRequest,
1277            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
1278            RealmMarker,
1279        >(
1280            (capabilities, from, from_dictionary, to,),
1281            0x21fac42c3e1d14d2,
1282            fidl::encoding::DynamicFlags::empty(),
1283            ___deadline,
1284        )?;
1285        Ok(_response.map(|x| x))
1286    }
1287
1288    /// Offers a directory capability to a component in this realm. The
1289    /// directory will be read-only (i.e. have `r*` rights), and will have the
1290    /// contents described in `directory_contents`.
1291    ///
1292    /// Errors:
1293    /// - `NO_SUCH_TARGET`: `offer-to` references a non-existent child.
1294    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1295    ///   for this realm, and thus this `Realm` channel can no longer be used.
1296    pub fn r#read_only_directory(
1297        &self,
1298        mut name: &str,
1299        mut to: &[fidl_fuchsia_component_decl::Ref],
1300        mut directory_contents: DirectoryContents,
1301        ___deadline: zx::MonotonicInstant,
1302    ) -> Result<RealmReadOnlyDirectoryResult, fidl::Error> {
1303        let _response =
1304            self.client.send_query::<RealmReadOnlyDirectoryRequest, fidl::encoding::ResultType<
1305                fidl::encoding::EmptyStruct,
1306                RealmBuilderError,
1307            >, RealmMarker>(
1308                (name, to, &mut directory_contents),
1309                0x78a6d150a66e00dc,
1310                fidl::encoding::DynamicFlags::empty(),
1311                ___deadline,
1312            )?;
1313        Ok(_response.map(|x| x))
1314    }
1315
1316    /// Creates and routes a new storage capability to the provided targets.
1317    /// Optionally can connect the provided channel the the
1318    /// `fuchsia.sys2.StorageAdmin` protocol for this storage capability.
1319    pub fn r#add_storage(
1320        &self,
1321        mut name: &str,
1322        mut to: &[fidl_fuchsia_component_decl::Ref],
1323        mut storage_admin: Option<
1324            fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
1325        >,
1326        ___deadline: zx::MonotonicInstant,
1327    ) -> Result<RealmAddStorageResult, fidl::Error> {
1328        let _response =
1329            self.client.send_query::<RealmAddStorageRequest, fidl::encoding::ResultType<
1330                fidl::encoding::EmptyStruct,
1331                RealmBuilderError,
1332            >, RealmMarker>(
1333                (name, to, storage_admin),
1334                0x4709da0c9576b7c1,
1335                fidl::encoding::DynamicFlags::empty(),
1336                ___deadline,
1337            )?;
1338        Ok(_response.map(|x| x))
1339    }
1340
1341    /// Load any packaged configuration for `name` before using values provided to
1342    /// the builder.
1343    ///
1344    /// Allows calling `SetConfigValue` to override packaged configuration.
1345    pub fn r#init_mutable_config_from_package(
1346        &self,
1347        mut name: &str,
1348        ___deadline: zx::MonotonicInstant,
1349    ) -> Result<RealmInitMutableConfigFromPackageResult, fidl::Error> {
1350        let _response = self.client.send_query::<
1351            RealmInitMutableConfigFromPackageRequest,
1352            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
1353            RealmMarker,
1354        >(
1355            (name,),
1356            0x36a30c9837c64216,
1357            fidl::encoding::DynamicFlags::empty(),
1358            ___deadline,
1359        )?;
1360        Ok(_response.map(|x| x))
1361    }
1362
1363    /// Use only values provided to the builder for `name`'s configuration.
1364    ///
1365    /// Allows calling `SetConfigValue` to provide configuration.
1366    pub fn r#init_mutable_config_to_empty(
1367        &self,
1368        mut name: &str,
1369        ___deadline: zx::MonotonicInstant,
1370    ) -> Result<RealmInitMutableConfigToEmptyResult, fidl::Error> {
1371        let _response = self.client.send_query::<
1372            RealmInitMutableConfigToEmptyRequest,
1373            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
1374            RealmMarker,
1375        >(
1376            (name,),
1377            0x772cb99e2e0dccc5,
1378            fidl::encoding::DynamicFlags::empty(),
1379            ___deadline,
1380        )?;
1381        Ok(_response.map(|x| x))
1382    }
1383
1384    /// Add a capability to the realm.
1385    pub fn r#add_capability(
1386        &self,
1387        mut capability: &fidl_fuchsia_component_decl::Capability,
1388        ___deadline: zx::MonotonicInstant,
1389    ) -> Result<RealmAddCapabilityResult, fidl::Error> {
1390        let _response =
1391            self.client.send_query::<RealmAddCapabilityRequest, fidl::encoding::ResultType<
1392                fidl::encoding::EmptyStruct,
1393                RealmBuilderError,
1394            >, RealmMarker>(
1395                (capability,),
1396                0x23a6499eb6080249,
1397                fidl::encoding::DynamicFlags::empty(),
1398                ___deadline,
1399            )?;
1400        Ok(_response.map(|x| x))
1401    }
1402
1403    /// Adds a collection to the realm.
1404    pub fn r#add_collection(
1405        &self,
1406        mut collection: &fidl_fuchsia_component_decl::Collection,
1407        ___deadline: zx::MonotonicInstant,
1408    ) -> Result<RealmAddCollectionResult, fidl::Error> {
1409        let _response =
1410            self.client.send_query::<RealmAddCollectionRequest, fidl::encoding::ResultType<
1411                fidl::encoding::EmptyStruct,
1412                RealmBuilderError,
1413            >, RealmMarker>(
1414                (collection,),
1415                0x56b75210a03a99b5,
1416                fidl::encoding::DynamicFlags::empty(),
1417                ___deadline,
1418            )?;
1419        Ok(_response.map(|x| x))
1420    }
1421
1422    /// Adds an environment to the realm.
1423    pub fn r#add_environment(
1424        &self,
1425        mut environment: &fidl_fuchsia_component_decl::Environment,
1426        ___deadline: zx::MonotonicInstant,
1427    ) -> Result<RealmAddEnvironmentResult, fidl::Error> {
1428        let _response =
1429            self.client.send_query::<RealmAddEnvironmentRequest, fidl::encoding::ResultType<
1430                fidl::encoding::EmptyStruct,
1431                RealmBuilderError,
1432            >, RealmMarker>(
1433                (environment,),
1434                0x1cd7caefa2cce0e9,
1435                fidl::encoding::DynamicFlags::empty(),
1436                ___deadline,
1437            )?;
1438        Ok(_response.map(|x| x))
1439    }
1440
1441    /// Sets the configuration value for a field specified by `key`.
1442    /// The component specified must have a config schema with this field.
1443    /// The value must conform to all constraints as defined by the schema.
1444    ///
1445    /// This method must be called after either `InitMutableConfigFromPackage` or
1446    /// `InitMutableConfigToEmpty`.
1447    ///
1448    /// Errors:
1449    /// - `NO_CONFIG_SCHEMA`: component does not have a config schema
1450    /// - `NO_SUCH_CONFIG_FIELD`: `key` could not be found in component's config schema
1451    /// - `CONFIG_VALUE_INVALID`: `value` does not meet config schema constraints
1452    pub fn r#set_config_value(
1453        &self,
1454        mut name: &str,
1455        mut key: &str,
1456        mut value: &fidl_fuchsia_component_decl::ConfigValueSpec,
1457        ___deadline: zx::MonotonicInstant,
1458    ) -> Result<RealmSetConfigValueResult, fidl::Error> {
1459        let _response =
1460            self.client.send_query::<RealmSetConfigValueRequest, fidl::encoding::ResultType<
1461                fidl::encoding::EmptyStruct,
1462                RealmBuilderError,
1463            >, RealmMarker>(
1464                (name, key, value),
1465                0x886450d291217f2,
1466                fidl::encoding::DynamicFlags::empty(),
1467                ___deadline,
1468            )?;
1469        Ok(_response.map(|x| x))
1470    }
1471}
1472
1473#[cfg(target_os = "fuchsia")]
1474impl From<RealmSynchronousProxy> for zx::NullableHandle {
1475    fn from(value: RealmSynchronousProxy) -> Self {
1476        value.into_channel().into()
1477    }
1478}
1479
1480#[cfg(target_os = "fuchsia")]
1481impl From<fidl::Channel> for RealmSynchronousProxy {
1482    fn from(value: fidl::Channel) -> Self {
1483        Self::new(value)
1484    }
1485}
1486
1487#[cfg(target_os = "fuchsia")]
1488impl fidl::endpoints::FromClient for RealmSynchronousProxy {
1489    type Protocol = RealmMarker;
1490
1491    fn from_client(value: fidl::endpoints::ClientEnd<RealmMarker>) -> Self {
1492        Self::new(value.into_channel())
1493    }
1494}
1495
1496#[derive(Debug, Clone)]
1497pub struct RealmProxy {
1498    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1499}
1500
1501impl fidl::endpoints::Proxy for RealmProxy {
1502    type Protocol = RealmMarker;
1503
1504    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1505        Self::new(inner)
1506    }
1507
1508    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1509        self.client.into_channel().map_err(|client| Self { client })
1510    }
1511
1512    fn as_channel(&self) -> &::fidl::AsyncChannel {
1513        self.client.as_channel()
1514    }
1515}
1516
1517impl RealmProxy {
1518    /// Create a new Proxy for fuchsia.component.test/Realm.
1519    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1520        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1521        Self { client: fidl::client::Client::new(channel, protocol_name) }
1522    }
1523
1524    /// Get a Stream of events from the remote end of the protocol.
1525    ///
1526    /// # Panics
1527    ///
1528    /// Panics if the event stream was already taken.
1529    pub fn take_event_stream(&self) -> RealmEventStream {
1530        RealmEventStream { event_receiver: self.client.take_event_receiver() }
1531    }
1532
1533    /// Adds a component to the realm.
1534    ///
1535    /// The `url` can be in one of the following formats:
1536    ///
1537    /// - an absolute component URL (such as,
1538    ///   "fuchsia-pkg://fuchsia.com/some-package#meta/some-component.cm")
1539    /// - a relative path component URL to a subpackaged component (like,
1540    ///   "some-subpackage#meta/subpackaged-component.cm"); or
1541    /// - a relative fragment-only URL (like, `#meta/other-component.cm`;
1542    ///   see https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
1543    ///   indicating the path to a component manifest in the `pkg_dir` supplied
1544    ///   to `RealmBuilderFactory::Create*()`.
1545    ///
1546    /// The realm builder client typically passes a handle to its own `/pkg`
1547    /// directory, and bundles the `other-component` into the same package.
1548    ///
1549    /// Of the three URL types, _only_ component declarations added via the
1550    /// fragment-only URL can be modified, via
1551    /// `GetComponentDecl`/`ReplaceComponentDecl` because realm builder actually
1552    /// performs its own component resolution from the component's manifest and
1553    /// files bundled in the provided `pkg_dir` (typically from the package
1554    /// shared by the realm builder client component and the components added
1555    /// via fragment-only URL).
1556    ///
1557    /// Errors:
1558    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
1559    ///   given name.
1560    /// - `INVALID_MANIFEST_EXTENSION`: `url` does not end with `.cm`
1561    /// - `DECL_NOT_FOUND`: The test package does not contain the component
1562    ///   declaration referenced by a fragment-only component URL.
1563    /// - `DECL_READ_ERROR`: Encountered an I/O error when attempting to read a
1564    ///   component declaration referenced by a fragment-only component URL from
1565    ///   the test package.
1566    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1567    ///   for this realm, and thus this `Realm` channel can no longer be used.
1568    pub fn r#add_child(
1569        &self,
1570        mut name: &str,
1571        mut url: &str,
1572        mut options: &ChildOptions,
1573    ) -> fidl::client::QueryResponseFut<
1574        RealmAddChildResult,
1575        fidl::encoding::DefaultFuchsiaResourceDialect,
1576    > {
1577        RealmProxyInterface::r#add_child(self, name, url, options)
1578    }
1579
1580    /// Adds a component to this realm whose declaration is set to `decl`. When
1581    /// launched, the component will share the test package as its package
1582    /// directory, and may access any resources from it.
1583    ///
1584    /// Errors:
1585    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
1586    ///   given name.
1587    /// - `INVALID_COMPONENT_DECL`: `decl` failed validation.
1588    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1589    ///   for this realm, and thus this `Realm` channel can no longer be used.
1590    pub fn r#add_child_from_decl(
1591        &self,
1592        mut name: &str,
1593        mut decl: &fidl_fuchsia_component_decl::Component,
1594        mut options: &ChildOptions,
1595    ) -> fidl::client::QueryResponseFut<
1596        RealmAddChildFromDeclResult,
1597        fidl::encoding::DefaultFuchsiaResourceDialect,
1598    > {
1599        RealmProxyInterface::r#add_child_from_decl(self, name, decl, options)
1600    }
1601
1602    /// Adds a component to the realm whose implementation will be provided by
1603    /// the client. When this component should be started, the runner channel
1604    /// passed into `Build` will receive a start request for a component whose
1605    /// `ProgramDecl` contains the moniker from the root of the
1606    /// constructed realm for the child that is to be run under the `program`
1607    /// key `LOCAL_COMPONENT_NAME`.
1608    ///
1609    /// Errors:
1610    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
1611    ///   given name.
1612    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1613    ///   for this realm, and thus this `Realm` channel can no longer be used.
1614    pub fn r#add_local_child(
1615        &self,
1616        mut name: &str,
1617        mut options: &ChildOptions,
1618    ) -> fidl::client::QueryResponseFut<
1619        RealmAddLocalChildResult,
1620        fidl::encoding::DefaultFuchsiaResourceDialect,
1621    > {
1622        RealmProxyInterface::r#add_local_child(self, name, options)
1623    }
1624
1625    /// Adds a child realm which can be built with the client end of
1626    /// `child_realm`.
1627    ///
1628    /// Errors:
1629    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
1630    ///   given name.
1631    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1632    ///   for this realm, and thus this `Realm` channel can no longer be used.
1633    pub fn r#add_child_realm(
1634        &self,
1635        mut name: &str,
1636        mut options: &ChildOptions,
1637        mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
1638    ) -> fidl::client::QueryResponseFut<
1639        RealmAddChildRealmResult,
1640        fidl::encoding::DefaultFuchsiaResourceDialect,
1641    > {
1642        RealmProxyInterface::r#add_child_realm(self, name, options, child_realm)
1643    }
1644
1645    /// Adds a child realm which can be built with the client end of
1646    /// `child_realm`, and whose contents are initialized from `relative_url`.
1647    /// `relative_url` must be a fragment-only URL.
1648    pub fn r#add_child_realm_from_relative_url(
1649        &self,
1650        mut name: &str,
1651        mut relative_url: &str,
1652        mut options: &ChildOptions,
1653        mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
1654    ) -> fidl::client::QueryResponseFut<
1655        RealmAddChildRealmFromRelativeUrlResult,
1656        fidl::encoding::DefaultFuchsiaResourceDialect,
1657    > {
1658        RealmProxyInterface::r#add_child_realm_from_relative_url(
1659            self,
1660            name,
1661            relative_url,
1662            options,
1663            child_realm,
1664        )
1665    }
1666
1667    /// Adds a child realm which can be built with the client end of
1668    /// `child_realm`, and whose contents are initialized from `decl`.
1669    pub fn r#add_child_realm_from_decl(
1670        &self,
1671        mut name: &str,
1672        mut decl: &fidl_fuchsia_component_decl::Component,
1673        mut options: &ChildOptions,
1674        mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
1675    ) -> fidl::client::QueryResponseFut<
1676        RealmAddChildRealmFromDeclResult,
1677        fidl::encoding::DefaultFuchsiaResourceDialect,
1678    > {
1679        RealmProxyInterface::r#add_child_realm_from_decl(self, name, decl, options, child_realm)
1680    }
1681
1682    /// Returns the component decl for the given component. `name` must refer to
1683    /// a component that is one of the following:
1684    ///
1685    /// - A component with a local implementation
1686    /// - A legacy component
1687    /// - A component added with a fragment-only URL (typically, components
1688    ///   bundled in the same package as the realm builder client, sharing the
1689    ///   same `/pkg` directory, for example, `#meta/other-component.cm`; see
1690    ///   https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
1691    /// - An automatically generated realm (ex: the root)
1692    ///
1693    /// Errors:
1694    /// - `NO_SUCH_CHILD`: This realm does not contain a child with the given
1695    ///   name.
1696    /// - `CHILD_DECL_NOT_VISIBLE`: The component decl cannot be fetched for
1697    ///   the referenced child, because the child was added to the realm using
1698    ///   a modern (not legacy) absolute URL or subpackaged component's relative
1699    ///   path URL.
1700    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1701    ///   for this realm, and thus this `Realm` channel can no longer be used.
1702    pub fn r#get_component_decl(
1703        &self,
1704        mut name: &str,
1705    ) -> fidl::client::QueryResponseFut<
1706        RealmGetComponentDeclResult,
1707        fidl::encoding::DefaultFuchsiaResourceDialect,
1708    > {
1709        RealmProxyInterface::r#get_component_decl(self, name)
1710    }
1711
1712    /// Replaces the component decl for the given component. `name` must
1713    /// refer to a component that is one of the following:
1714    ///
1715    /// - A component with a local implementation
1716    /// - A legacy component
1717    /// - A component added with a fragment-only URL (typically, components
1718    ///   bundled in the same package as the realm builder client, sharing the
1719    ///   same `/pkg` directory, for example, `#meta/other-component.cm`; see
1720    ///   https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
1721    /// - An automatically generated realm (ex: the root)
1722    ///
1723    /// Errors:
1724    /// - `NO_SUCH_CHILD`: This realm does not contain a child with the given
1725    ///   name.
1726    /// - `CHILD_ALREADY_EXISTS`: The component whose decl is being replaced has
1727    ///   had a child added to it through realm builder with the same name as an
1728    ///   element in `component_decl.children`.
1729    /// - `CHILD_DECL_NOT_VISIBLE`: The component decl cannot be manipulated for
1730    ///   the referenced child, because the child was added to the realm using
1731    ///   an absolute (not relative) and modern (not legacy) URL.
1732    /// - `INVALID_COMPONENT_DECL`: `component_decl` failed validation.
1733    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1734    ///   for this realm, and thus this `Realm` channel can no longer be used.
1735    pub fn r#replace_component_decl(
1736        &self,
1737        mut name: &str,
1738        mut component_decl: &fidl_fuchsia_component_decl::Component,
1739    ) -> fidl::client::QueryResponseFut<
1740        RealmReplaceComponentDeclResult,
1741        fidl::encoding::DefaultFuchsiaResourceDialect,
1742    > {
1743        RealmProxyInterface::r#replace_component_decl(self, name, component_decl)
1744    }
1745
1746    /// Returns the component decl for this realm.
1747    ///
1748    /// Errors:
1749    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1750    ///   for this realm, and thus this `Realm` channel can no longer be used.
1751    pub fn r#get_realm_decl(
1752        &self,
1753    ) -> fidl::client::QueryResponseFut<
1754        RealmGetRealmDeclResult,
1755        fidl::encoding::DefaultFuchsiaResourceDialect,
1756    > {
1757        RealmProxyInterface::r#get_realm_decl(self)
1758    }
1759
1760    /// Replaces the component decl for this realm.
1761    ///
1762    /// Errors:
1763    /// - `INVALID_COMPONENT_DECL`: `component_decl` failed validation.
1764    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1765    ///   for this realm, and thus this `Realm` channel can no longer be used.
1766    pub fn r#replace_realm_decl(
1767        &self,
1768        mut component_decl: &fidl_fuchsia_component_decl::Component,
1769    ) -> fidl::client::QueryResponseFut<
1770        RealmReplaceRealmDeclResult,
1771        fidl::encoding::DefaultFuchsiaResourceDialect,
1772    > {
1773        RealmProxyInterface::r#replace_realm_decl(self, component_decl)
1774    }
1775
1776    /// Inform the realm builder server that this realm is using a nested component manager. It's
1777    /// expected that the client library has already replaced the realm's declaration with a
1778    /// passthrough component manager declaration, with the exception of the root url.
1779    /// This method will arrange for [Builder.Build] to install the realm's generated url as the
1780    /// root url in this component manager.
1781    pub fn r#use_nested_component_manager(
1782        &self,
1783        mut component_manager_relative_url: &str,
1784    ) -> fidl::client::QueryResponseFut<
1785        RealmUseNestedComponentManagerResult,
1786        fidl::encoding::DefaultFuchsiaResourceDialect,
1787    > {
1788        RealmProxyInterface::r#use_nested_component_manager(self, component_manager_relative_url)
1789    }
1790
1791    /// Identical to `AddRouteFromDictionary`, except it does not accept `from_dictionary` which
1792    /// it always sets to ".".
1793    pub fn r#add_route(
1794        &self,
1795        mut capabilities: &[Capability],
1796        mut from: &fidl_fuchsia_component_decl::Ref,
1797        mut to: &[fidl_fuchsia_component_decl::Ref],
1798    ) -> fidl::client::QueryResponseFut<
1799        RealmAddRouteResult,
1800        fidl::encoding::DefaultFuchsiaResourceDialect,
1801    > {
1802        RealmProxyInterface::r#add_route(self, capabilities, from, to)
1803    }
1804
1805    /// Mutates component manifests in the realm such that every component in
1806    /// `to` will have a valid capability route for each item in `capabilities`
1807    /// provided by `from`.
1808    ///
1809    /// Errors:
1810    /// - `NO_SUCH_SOURCE`: `from` references a non-existent child.
1811    /// - `NO_SUCH_TARGET`: `to` references a non-existent child.
1812    /// - `CAPABILITIES_EMPTY`: `capabilities` is empty.
1813    /// - `TARGETS_EMPTY`: `to` is empty.
1814    /// - `SOURCE_AND_TARGET_MATCH`: `from` is equal to one of the elements in
1815    ///   `to`.
1816    /// - `INVALID_COMPONENT_DECL`: The requested route caused one of the
1817    ///   involved manifests to fail validation.
1818    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1819    ///   for this realm, and thus this `Realm` channel can no longer be used.
1820    pub fn r#add_route_from_dictionary(
1821        &self,
1822        mut capabilities: &[Capability],
1823        mut from: &fidl_fuchsia_component_decl::Ref,
1824        mut from_dictionary: &str,
1825        mut to: &[fidl_fuchsia_component_decl::Ref],
1826    ) -> fidl::client::QueryResponseFut<
1827        RealmAddRouteFromDictionaryResult,
1828        fidl::encoding::DefaultFuchsiaResourceDialect,
1829    > {
1830        RealmProxyInterface::r#add_route_from_dictionary(
1831            self,
1832            capabilities,
1833            from,
1834            from_dictionary,
1835            to,
1836        )
1837    }
1838
1839    /// Offers a directory capability to a component in this realm. The
1840    /// directory will be read-only (i.e. have `r*` rights), and will have the
1841    /// contents described in `directory_contents`.
1842    ///
1843    /// Errors:
1844    /// - `NO_SUCH_TARGET`: `offer-to` references a non-existent child.
1845    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
1846    ///   for this realm, and thus this `Realm` channel can no longer be used.
1847    pub fn r#read_only_directory(
1848        &self,
1849        mut name: &str,
1850        mut to: &[fidl_fuchsia_component_decl::Ref],
1851        mut directory_contents: DirectoryContents,
1852    ) -> fidl::client::QueryResponseFut<
1853        RealmReadOnlyDirectoryResult,
1854        fidl::encoding::DefaultFuchsiaResourceDialect,
1855    > {
1856        RealmProxyInterface::r#read_only_directory(self, name, to, directory_contents)
1857    }
1858
1859    /// Creates and routes a new storage capability to the provided targets.
1860    /// Optionally can connect the provided channel the the
1861    /// `fuchsia.sys2.StorageAdmin` protocol for this storage capability.
1862    pub fn r#add_storage(
1863        &self,
1864        mut name: &str,
1865        mut to: &[fidl_fuchsia_component_decl::Ref],
1866        mut storage_admin: Option<
1867            fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
1868        >,
1869    ) -> fidl::client::QueryResponseFut<
1870        RealmAddStorageResult,
1871        fidl::encoding::DefaultFuchsiaResourceDialect,
1872    > {
1873        RealmProxyInterface::r#add_storage(self, name, to, storage_admin)
1874    }
1875
1876    /// Load any packaged configuration for `name` before using values provided to
1877    /// the builder.
1878    ///
1879    /// Allows calling `SetConfigValue` to override packaged configuration.
1880    pub fn r#init_mutable_config_from_package(
1881        &self,
1882        mut name: &str,
1883    ) -> fidl::client::QueryResponseFut<
1884        RealmInitMutableConfigFromPackageResult,
1885        fidl::encoding::DefaultFuchsiaResourceDialect,
1886    > {
1887        RealmProxyInterface::r#init_mutable_config_from_package(self, name)
1888    }
1889
1890    /// Use only values provided to the builder for `name`'s configuration.
1891    ///
1892    /// Allows calling `SetConfigValue` to provide configuration.
1893    pub fn r#init_mutable_config_to_empty(
1894        &self,
1895        mut name: &str,
1896    ) -> fidl::client::QueryResponseFut<
1897        RealmInitMutableConfigToEmptyResult,
1898        fidl::encoding::DefaultFuchsiaResourceDialect,
1899    > {
1900        RealmProxyInterface::r#init_mutable_config_to_empty(self, name)
1901    }
1902
1903    /// Add a capability to the realm.
1904    pub fn r#add_capability(
1905        &self,
1906        mut capability: &fidl_fuchsia_component_decl::Capability,
1907    ) -> fidl::client::QueryResponseFut<
1908        RealmAddCapabilityResult,
1909        fidl::encoding::DefaultFuchsiaResourceDialect,
1910    > {
1911        RealmProxyInterface::r#add_capability(self, capability)
1912    }
1913
1914    /// Adds a collection to the realm.
1915    pub fn r#add_collection(
1916        &self,
1917        mut collection: &fidl_fuchsia_component_decl::Collection,
1918    ) -> fidl::client::QueryResponseFut<
1919        RealmAddCollectionResult,
1920        fidl::encoding::DefaultFuchsiaResourceDialect,
1921    > {
1922        RealmProxyInterface::r#add_collection(self, collection)
1923    }
1924
1925    /// Adds an environment to the realm.
1926    pub fn r#add_environment(
1927        &self,
1928        mut environment: &fidl_fuchsia_component_decl::Environment,
1929    ) -> fidl::client::QueryResponseFut<
1930        RealmAddEnvironmentResult,
1931        fidl::encoding::DefaultFuchsiaResourceDialect,
1932    > {
1933        RealmProxyInterface::r#add_environment(self, environment)
1934    }
1935
1936    /// Sets the configuration value for a field specified by `key`.
1937    /// The component specified must have a config schema with this field.
1938    /// The value must conform to all constraints as defined by the schema.
1939    ///
1940    /// This method must be called after either `InitMutableConfigFromPackage` or
1941    /// `InitMutableConfigToEmpty`.
1942    ///
1943    /// Errors:
1944    /// - `NO_CONFIG_SCHEMA`: component does not have a config schema
1945    /// - `NO_SUCH_CONFIG_FIELD`: `key` could not be found in component's config schema
1946    /// - `CONFIG_VALUE_INVALID`: `value` does not meet config schema constraints
1947    pub fn r#set_config_value(
1948        &self,
1949        mut name: &str,
1950        mut key: &str,
1951        mut value: &fidl_fuchsia_component_decl::ConfigValueSpec,
1952    ) -> fidl::client::QueryResponseFut<
1953        RealmSetConfigValueResult,
1954        fidl::encoding::DefaultFuchsiaResourceDialect,
1955    > {
1956        RealmProxyInterface::r#set_config_value(self, name, key, value)
1957    }
1958}
1959
1960impl RealmProxyInterface for RealmProxy {
1961    type AddChildResponseFut = fidl::client::QueryResponseFut<
1962        RealmAddChildResult,
1963        fidl::encoding::DefaultFuchsiaResourceDialect,
1964    >;
1965    fn r#add_child(
1966        &self,
1967        mut name: &str,
1968        mut url: &str,
1969        mut options: &ChildOptions,
1970    ) -> Self::AddChildResponseFut {
1971        fn _decode(
1972            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1973        ) -> Result<RealmAddChildResult, fidl::Error> {
1974            let _response = fidl::client::decode_transaction_body::<
1975                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
1976                fidl::encoding::DefaultFuchsiaResourceDialect,
1977                0x3f6c07627303d801,
1978            >(_buf?)?;
1979            Ok(_response.map(|x| x))
1980        }
1981        self.client.send_query_and_decode::<RealmAddChildRequest, RealmAddChildResult>(
1982            (name, url, options),
1983            0x3f6c07627303d801,
1984            fidl::encoding::DynamicFlags::empty(),
1985            _decode,
1986        )
1987    }
1988
1989    type AddChildFromDeclResponseFut = fidl::client::QueryResponseFut<
1990        RealmAddChildFromDeclResult,
1991        fidl::encoding::DefaultFuchsiaResourceDialect,
1992    >;
1993    fn r#add_child_from_decl(
1994        &self,
1995        mut name: &str,
1996        mut decl: &fidl_fuchsia_component_decl::Component,
1997        mut options: &ChildOptions,
1998    ) -> Self::AddChildFromDeclResponseFut {
1999        fn _decode(
2000            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2001        ) -> Result<RealmAddChildFromDeclResult, fidl::Error> {
2002            let _response = fidl::client::decode_transaction_body::<
2003                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2004                fidl::encoding::DefaultFuchsiaResourceDialect,
2005                0x3950ad500258156d,
2006            >(_buf?)?;
2007            Ok(_response.map(|x| x))
2008        }
2009        self.client
2010            .send_query_and_decode::<RealmAddChildFromDeclRequest, RealmAddChildFromDeclResult>(
2011                (name, decl, options),
2012                0x3950ad500258156d,
2013                fidl::encoding::DynamicFlags::empty(),
2014                _decode,
2015            )
2016    }
2017
2018    type AddLocalChildResponseFut = fidl::client::QueryResponseFut<
2019        RealmAddLocalChildResult,
2020        fidl::encoding::DefaultFuchsiaResourceDialect,
2021    >;
2022    fn r#add_local_child(
2023        &self,
2024        mut name: &str,
2025        mut options: &ChildOptions,
2026    ) -> Self::AddLocalChildResponseFut {
2027        fn _decode(
2028            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2029        ) -> Result<RealmAddLocalChildResult, fidl::Error> {
2030            let _response = fidl::client::decode_transaction_body::<
2031                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2032                fidl::encoding::DefaultFuchsiaResourceDialect,
2033                0x3249817bae10abbb,
2034            >(_buf?)?;
2035            Ok(_response.map(|x| x))
2036        }
2037        self.client.send_query_and_decode::<RealmAddLocalChildRequest, RealmAddLocalChildResult>(
2038            (name, options),
2039            0x3249817bae10abbb,
2040            fidl::encoding::DynamicFlags::empty(),
2041            _decode,
2042        )
2043    }
2044
2045    type AddChildRealmResponseFut = fidl::client::QueryResponseFut<
2046        RealmAddChildRealmResult,
2047        fidl::encoding::DefaultFuchsiaResourceDialect,
2048    >;
2049    fn r#add_child_realm(
2050        &self,
2051        mut name: &str,
2052        mut options: &ChildOptions,
2053        mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
2054    ) -> Self::AddChildRealmResponseFut {
2055        fn _decode(
2056            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2057        ) -> Result<RealmAddChildRealmResult, fidl::Error> {
2058            let _response = fidl::client::decode_transaction_body::<
2059                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2060                fidl::encoding::DefaultFuchsiaResourceDialect,
2061                0x3fdf98db373b9458,
2062            >(_buf?)?;
2063            Ok(_response.map(|x| x))
2064        }
2065        self.client.send_query_and_decode::<RealmAddChildRealmRequest, RealmAddChildRealmResult>(
2066            (name, options, child_realm),
2067            0x3fdf98db373b9458,
2068            fidl::encoding::DynamicFlags::empty(),
2069            _decode,
2070        )
2071    }
2072
2073    type AddChildRealmFromRelativeUrlResponseFut = fidl::client::QueryResponseFut<
2074        RealmAddChildRealmFromRelativeUrlResult,
2075        fidl::encoding::DefaultFuchsiaResourceDialect,
2076    >;
2077    fn r#add_child_realm_from_relative_url(
2078        &self,
2079        mut name: &str,
2080        mut relative_url: &str,
2081        mut options: &ChildOptions,
2082        mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
2083    ) -> Self::AddChildRealmFromRelativeUrlResponseFut {
2084        fn _decode(
2085            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2086        ) -> Result<RealmAddChildRealmFromRelativeUrlResult, fidl::Error> {
2087            let _response = fidl::client::decode_transaction_body::<
2088                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2089                fidl::encoding::DefaultFuchsiaResourceDialect,
2090                0x44c34c8dcbe06abb,
2091            >(_buf?)?;
2092            Ok(_response.map(|x| x))
2093        }
2094        self.client.send_query_and_decode::<
2095            RealmAddChildRealmFromRelativeUrlRequest,
2096            RealmAddChildRealmFromRelativeUrlResult,
2097        >(
2098            (name, relative_url, options, child_realm,),
2099            0x44c34c8dcbe06abb,
2100            fidl::encoding::DynamicFlags::empty(),
2101            _decode,
2102        )
2103    }
2104
2105    type AddChildRealmFromDeclResponseFut = fidl::client::QueryResponseFut<
2106        RealmAddChildRealmFromDeclResult,
2107        fidl::encoding::DefaultFuchsiaResourceDialect,
2108    >;
2109    fn r#add_child_realm_from_decl(
2110        &self,
2111        mut name: &str,
2112        mut decl: &fidl_fuchsia_component_decl::Component,
2113        mut options: &ChildOptions,
2114        mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
2115    ) -> Self::AddChildRealmFromDeclResponseFut {
2116        fn _decode(
2117            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2118        ) -> Result<RealmAddChildRealmFromDeclResult, fidl::Error> {
2119            let _response = fidl::client::decode_transaction_body::<
2120                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2121                fidl::encoding::DefaultFuchsiaResourceDialect,
2122                0x142e5c326732862e,
2123            >(_buf?)?;
2124            Ok(_response.map(|x| x))
2125        }
2126        self.client.send_query_and_decode::<
2127            RealmAddChildRealmFromDeclRequest,
2128            RealmAddChildRealmFromDeclResult,
2129        >(
2130            (name, decl, options, child_realm,),
2131            0x142e5c326732862e,
2132            fidl::encoding::DynamicFlags::empty(),
2133            _decode,
2134        )
2135    }
2136
2137    type GetComponentDeclResponseFut = fidl::client::QueryResponseFut<
2138        RealmGetComponentDeclResult,
2139        fidl::encoding::DefaultFuchsiaResourceDialect,
2140    >;
2141    fn r#get_component_decl(&self, mut name: &str) -> Self::GetComponentDeclResponseFut {
2142        fn _decode(
2143            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2144        ) -> Result<RealmGetComponentDeclResult, fidl::Error> {
2145            let _response = fidl::client::decode_transaction_body::<
2146                fidl::encoding::ResultType<RealmGetComponentDeclResponse, RealmBuilderError>,
2147                fidl::encoding::DefaultFuchsiaResourceDialect,
2148                0x320832af6a4cbac6,
2149            >(_buf?)?;
2150            Ok(_response.map(|x| x.component_decl))
2151        }
2152        self.client
2153            .send_query_and_decode::<RealmGetComponentDeclRequest, RealmGetComponentDeclResult>(
2154                (name,),
2155                0x320832af6a4cbac6,
2156                fidl::encoding::DynamicFlags::empty(),
2157                _decode,
2158            )
2159    }
2160
2161    type ReplaceComponentDeclResponseFut = fidl::client::QueryResponseFut<
2162        RealmReplaceComponentDeclResult,
2163        fidl::encoding::DefaultFuchsiaResourceDialect,
2164    >;
2165    fn r#replace_component_decl(
2166        &self,
2167        mut name: &str,
2168        mut component_decl: &fidl_fuchsia_component_decl::Component,
2169    ) -> Self::ReplaceComponentDeclResponseFut {
2170        fn _decode(
2171            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2172        ) -> Result<RealmReplaceComponentDeclResult, fidl::Error> {
2173            let _response = fidl::client::decode_transaction_body::<
2174                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2175                fidl::encoding::DefaultFuchsiaResourceDialect,
2176                0x59cecf31b314cd5f,
2177            >(_buf?)?;
2178            Ok(_response.map(|x| x))
2179        }
2180        self.client.send_query_and_decode::<
2181            RealmReplaceComponentDeclRequest,
2182            RealmReplaceComponentDeclResult,
2183        >(
2184            (name, component_decl,),
2185            0x59cecf31b314cd5f,
2186            fidl::encoding::DynamicFlags::empty(),
2187            _decode,
2188        )
2189    }
2190
2191    type GetRealmDeclResponseFut = fidl::client::QueryResponseFut<
2192        RealmGetRealmDeclResult,
2193        fidl::encoding::DefaultFuchsiaResourceDialect,
2194    >;
2195    fn r#get_realm_decl(&self) -> Self::GetRealmDeclResponseFut {
2196        fn _decode(
2197            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2198        ) -> Result<RealmGetRealmDeclResult, fidl::Error> {
2199            let _response = fidl::client::decode_transaction_body::<
2200                fidl::encoding::ResultType<RealmGetRealmDeclResponse, RealmBuilderError>,
2201                fidl::encoding::DefaultFuchsiaResourceDialect,
2202                0x46fa05b17bd64269,
2203            >(_buf?)?;
2204            Ok(_response.map(|x| x.component_decl))
2205        }
2206        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RealmGetRealmDeclResult>(
2207            (),
2208            0x46fa05b17bd64269,
2209            fidl::encoding::DynamicFlags::empty(),
2210            _decode,
2211        )
2212    }
2213
2214    type ReplaceRealmDeclResponseFut = fidl::client::QueryResponseFut<
2215        RealmReplaceRealmDeclResult,
2216        fidl::encoding::DefaultFuchsiaResourceDialect,
2217    >;
2218    fn r#replace_realm_decl(
2219        &self,
2220        mut component_decl: &fidl_fuchsia_component_decl::Component,
2221    ) -> Self::ReplaceRealmDeclResponseFut {
2222        fn _decode(
2223            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2224        ) -> Result<RealmReplaceRealmDeclResult, fidl::Error> {
2225            let _response = fidl::client::decode_transaction_body::<
2226                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2227                fidl::encoding::DefaultFuchsiaResourceDialect,
2228                0x48fcba4ac1338da9,
2229            >(_buf?)?;
2230            Ok(_response.map(|x| x))
2231        }
2232        self.client
2233            .send_query_and_decode::<RealmReplaceRealmDeclRequest, RealmReplaceRealmDeclResult>(
2234                (component_decl,),
2235                0x48fcba4ac1338da9,
2236                fidl::encoding::DynamicFlags::empty(),
2237                _decode,
2238            )
2239    }
2240
2241    type UseNestedComponentManagerResponseFut = fidl::client::QueryResponseFut<
2242        RealmUseNestedComponentManagerResult,
2243        fidl::encoding::DefaultFuchsiaResourceDialect,
2244    >;
2245    fn r#use_nested_component_manager(
2246        &self,
2247        mut component_manager_relative_url: &str,
2248    ) -> Self::UseNestedComponentManagerResponseFut {
2249        fn _decode(
2250            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2251        ) -> Result<RealmUseNestedComponentManagerResult, fidl::Error> {
2252            let _response = fidl::client::decode_transaction_body::<
2253                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2254                fidl::encoding::DefaultFuchsiaResourceDialect,
2255                0x64bd27482f3dcc,
2256            >(_buf?)?;
2257            Ok(_response.map(|x| x))
2258        }
2259        self.client.send_query_and_decode::<
2260            RealmUseNestedComponentManagerRequest,
2261            RealmUseNestedComponentManagerResult,
2262        >(
2263            (component_manager_relative_url,),
2264            0x64bd27482f3dcc,
2265            fidl::encoding::DynamicFlags::empty(),
2266            _decode,
2267        )
2268    }
2269
2270    type AddRouteResponseFut = fidl::client::QueryResponseFut<
2271        RealmAddRouteResult,
2272        fidl::encoding::DefaultFuchsiaResourceDialect,
2273    >;
2274    fn r#add_route(
2275        &self,
2276        mut capabilities: &[Capability],
2277        mut from: &fidl_fuchsia_component_decl::Ref,
2278        mut to: &[fidl_fuchsia_component_decl::Ref],
2279    ) -> Self::AddRouteResponseFut {
2280        fn _decode(
2281            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2282        ) -> Result<RealmAddRouteResult, fidl::Error> {
2283            let _response = fidl::client::decode_transaction_body::<
2284                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2285                fidl::encoding::DefaultFuchsiaResourceDialect,
2286                0x9d523295be53a0a,
2287            >(_buf?)?;
2288            Ok(_response.map(|x| x))
2289        }
2290        self.client.send_query_and_decode::<RealmAddRouteRequest, RealmAddRouteResult>(
2291            (capabilities, from, to),
2292            0x9d523295be53a0a,
2293            fidl::encoding::DynamicFlags::empty(),
2294            _decode,
2295        )
2296    }
2297
2298    type AddRouteFromDictionaryResponseFut = fidl::client::QueryResponseFut<
2299        RealmAddRouteFromDictionaryResult,
2300        fidl::encoding::DefaultFuchsiaResourceDialect,
2301    >;
2302    fn r#add_route_from_dictionary(
2303        &self,
2304        mut capabilities: &[Capability],
2305        mut from: &fidl_fuchsia_component_decl::Ref,
2306        mut from_dictionary: &str,
2307        mut to: &[fidl_fuchsia_component_decl::Ref],
2308    ) -> Self::AddRouteFromDictionaryResponseFut {
2309        fn _decode(
2310            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2311        ) -> Result<RealmAddRouteFromDictionaryResult, fidl::Error> {
2312            let _response = fidl::client::decode_transaction_body::<
2313                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2314                fidl::encoding::DefaultFuchsiaResourceDialect,
2315                0x21fac42c3e1d14d2,
2316            >(_buf?)?;
2317            Ok(_response.map(|x| x))
2318        }
2319        self.client.send_query_and_decode::<
2320            RealmAddRouteFromDictionaryRequest,
2321            RealmAddRouteFromDictionaryResult,
2322        >(
2323            (capabilities, from, from_dictionary, to,),
2324            0x21fac42c3e1d14d2,
2325            fidl::encoding::DynamicFlags::empty(),
2326            _decode,
2327        )
2328    }
2329
2330    type ReadOnlyDirectoryResponseFut = fidl::client::QueryResponseFut<
2331        RealmReadOnlyDirectoryResult,
2332        fidl::encoding::DefaultFuchsiaResourceDialect,
2333    >;
2334    fn r#read_only_directory(
2335        &self,
2336        mut name: &str,
2337        mut to: &[fidl_fuchsia_component_decl::Ref],
2338        mut directory_contents: DirectoryContents,
2339    ) -> Self::ReadOnlyDirectoryResponseFut {
2340        fn _decode(
2341            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2342        ) -> Result<RealmReadOnlyDirectoryResult, fidl::Error> {
2343            let _response = fidl::client::decode_transaction_body::<
2344                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2345                fidl::encoding::DefaultFuchsiaResourceDialect,
2346                0x78a6d150a66e00dc,
2347            >(_buf?)?;
2348            Ok(_response.map(|x| x))
2349        }
2350        self.client
2351            .send_query_and_decode::<RealmReadOnlyDirectoryRequest, RealmReadOnlyDirectoryResult>(
2352                (name, to, &mut directory_contents),
2353                0x78a6d150a66e00dc,
2354                fidl::encoding::DynamicFlags::empty(),
2355                _decode,
2356            )
2357    }
2358
2359    type AddStorageResponseFut = fidl::client::QueryResponseFut<
2360        RealmAddStorageResult,
2361        fidl::encoding::DefaultFuchsiaResourceDialect,
2362    >;
2363    fn r#add_storage(
2364        &self,
2365        mut name: &str,
2366        mut to: &[fidl_fuchsia_component_decl::Ref],
2367        mut storage_admin: Option<
2368            fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
2369        >,
2370    ) -> Self::AddStorageResponseFut {
2371        fn _decode(
2372            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2373        ) -> Result<RealmAddStorageResult, fidl::Error> {
2374            let _response = fidl::client::decode_transaction_body::<
2375                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2376                fidl::encoding::DefaultFuchsiaResourceDialect,
2377                0x4709da0c9576b7c1,
2378            >(_buf?)?;
2379            Ok(_response.map(|x| x))
2380        }
2381        self.client.send_query_and_decode::<RealmAddStorageRequest, RealmAddStorageResult>(
2382            (name, to, storage_admin),
2383            0x4709da0c9576b7c1,
2384            fidl::encoding::DynamicFlags::empty(),
2385            _decode,
2386        )
2387    }
2388
2389    type InitMutableConfigFromPackageResponseFut = fidl::client::QueryResponseFut<
2390        RealmInitMutableConfigFromPackageResult,
2391        fidl::encoding::DefaultFuchsiaResourceDialect,
2392    >;
2393    fn r#init_mutable_config_from_package(
2394        &self,
2395        mut name: &str,
2396    ) -> Self::InitMutableConfigFromPackageResponseFut {
2397        fn _decode(
2398            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2399        ) -> Result<RealmInitMutableConfigFromPackageResult, fidl::Error> {
2400            let _response = fidl::client::decode_transaction_body::<
2401                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2402                fidl::encoding::DefaultFuchsiaResourceDialect,
2403                0x36a30c9837c64216,
2404            >(_buf?)?;
2405            Ok(_response.map(|x| x))
2406        }
2407        self.client.send_query_and_decode::<
2408            RealmInitMutableConfigFromPackageRequest,
2409            RealmInitMutableConfigFromPackageResult,
2410        >(
2411            (name,),
2412            0x36a30c9837c64216,
2413            fidl::encoding::DynamicFlags::empty(),
2414            _decode,
2415        )
2416    }
2417
2418    type InitMutableConfigToEmptyResponseFut = fidl::client::QueryResponseFut<
2419        RealmInitMutableConfigToEmptyResult,
2420        fidl::encoding::DefaultFuchsiaResourceDialect,
2421    >;
2422    fn r#init_mutable_config_to_empty(
2423        &self,
2424        mut name: &str,
2425    ) -> Self::InitMutableConfigToEmptyResponseFut {
2426        fn _decode(
2427            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2428        ) -> Result<RealmInitMutableConfigToEmptyResult, fidl::Error> {
2429            let _response = fidl::client::decode_transaction_body::<
2430                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2431                fidl::encoding::DefaultFuchsiaResourceDialect,
2432                0x772cb99e2e0dccc5,
2433            >(_buf?)?;
2434            Ok(_response.map(|x| x))
2435        }
2436        self.client.send_query_and_decode::<
2437            RealmInitMutableConfigToEmptyRequest,
2438            RealmInitMutableConfigToEmptyResult,
2439        >(
2440            (name,),
2441            0x772cb99e2e0dccc5,
2442            fidl::encoding::DynamicFlags::empty(),
2443            _decode,
2444        )
2445    }
2446
2447    type AddCapabilityResponseFut = fidl::client::QueryResponseFut<
2448        RealmAddCapabilityResult,
2449        fidl::encoding::DefaultFuchsiaResourceDialect,
2450    >;
2451    fn r#add_capability(
2452        &self,
2453        mut capability: &fidl_fuchsia_component_decl::Capability,
2454    ) -> Self::AddCapabilityResponseFut {
2455        fn _decode(
2456            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2457        ) -> Result<RealmAddCapabilityResult, fidl::Error> {
2458            let _response = fidl::client::decode_transaction_body::<
2459                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2460                fidl::encoding::DefaultFuchsiaResourceDialect,
2461                0x23a6499eb6080249,
2462            >(_buf?)?;
2463            Ok(_response.map(|x| x))
2464        }
2465        self.client.send_query_and_decode::<RealmAddCapabilityRequest, RealmAddCapabilityResult>(
2466            (capability,),
2467            0x23a6499eb6080249,
2468            fidl::encoding::DynamicFlags::empty(),
2469            _decode,
2470        )
2471    }
2472
2473    type AddCollectionResponseFut = fidl::client::QueryResponseFut<
2474        RealmAddCollectionResult,
2475        fidl::encoding::DefaultFuchsiaResourceDialect,
2476    >;
2477    fn r#add_collection(
2478        &self,
2479        mut collection: &fidl_fuchsia_component_decl::Collection,
2480    ) -> Self::AddCollectionResponseFut {
2481        fn _decode(
2482            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2483        ) -> Result<RealmAddCollectionResult, fidl::Error> {
2484            let _response = fidl::client::decode_transaction_body::<
2485                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2486                fidl::encoding::DefaultFuchsiaResourceDialect,
2487                0x56b75210a03a99b5,
2488            >(_buf?)?;
2489            Ok(_response.map(|x| x))
2490        }
2491        self.client.send_query_and_decode::<RealmAddCollectionRequest, RealmAddCollectionResult>(
2492            (collection,),
2493            0x56b75210a03a99b5,
2494            fidl::encoding::DynamicFlags::empty(),
2495            _decode,
2496        )
2497    }
2498
2499    type AddEnvironmentResponseFut = fidl::client::QueryResponseFut<
2500        RealmAddEnvironmentResult,
2501        fidl::encoding::DefaultFuchsiaResourceDialect,
2502    >;
2503    fn r#add_environment(
2504        &self,
2505        mut environment: &fidl_fuchsia_component_decl::Environment,
2506    ) -> Self::AddEnvironmentResponseFut {
2507        fn _decode(
2508            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2509        ) -> Result<RealmAddEnvironmentResult, fidl::Error> {
2510            let _response = fidl::client::decode_transaction_body::<
2511                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2512                fidl::encoding::DefaultFuchsiaResourceDialect,
2513                0x1cd7caefa2cce0e9,
2514            >(_buf?)?;
2515            Ok(_response.map(|x| x))
2516        }
2517        self.client.send_query_and_decode::<RealmAddEnvironmentRequest, RealmAddEnvironmentResult>(
2518            (environment,),
2519            0x1cd7caefa2cce0e9,
2520            fidl::encoding::DynamicFlags::empty(),
2521            _decode,
2522        )
2523    }
2524
2525    type SetConfigValueResponseFut = fidl::client::QueryResponseFut<
2526        RealmSetConfigValueResult,
2527        fidl::encoding::DefaultFuchsiaResourceDialect,
2528    >;
2529    fn r#set_config_value(
2530        &self,
2531        mut name: &str,
2532        mut key: &str,
2533        mut value: &fidl_fuchsia_component_decl::ConfigValueSpec,
2534    ) -> Self::SetConfigValueResponseFut {
2535        fn _decode(
2536            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2537        ) -> Result<RealmSetConfigValueResult, fidl::Error> {
2538            let _response = fidl::client::decode_transaction_body::<
2539                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
2540                fidl::encoding::DefaultFuchsiaResourceDialect,
2541                0x886450d291217f2,
2542            >(_buf?)?;
2543            Ok(_response.map(|x| x))
2544        }
2545        self.client.send_query_and_decode::<RealmSetConfigValueRequest, RealmSetConfigValueResult>(
2546            (name, key, value),
2547            0x886450d291217f2,
2548            fidl::encoding::DynamicFlags::empty(),
2549            _decode,
2550        )
2551    }
2552}
2553
2554pub struct RealmEventStream {
2555    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2556}
2557
2558impl std::marker::Unpin for RealmEventStream {}
2559
2560impl futures::stream::FusedStream for RealmEventStream {
2561    fn is_terminated(&self) -> bool {
2562        self.event_receiver.is_terminated()
2563    }
2564}
2565
2566impl futures::Stream for RealmEventStream {
2567    type Item = Result<RealmEvent, fidl::Error>;
2568
2569    fn poll_next(
2570        mut self: std::pin::Pin<&mut Self>,
2571        cx: &mut std::task::Context<'_>,
2572    ) -> std::task::Poll<Option<Self::Item>> {
2573        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2574            &mut self.event_receiver,
2575            cx
2576        )?) {
2577            Some(buf) => std::task::Poll::Ready(Some(RealmEvent::decode(buf))),
2578            None => std::task::Poll::Ready(None),
2579        }
2580    }
2581}
2582
2583#[derive(Debug)]
2584pub enum RealmEvent {}
2585
2586impl RealmEvent {
2587    /// Decodes a message buffer as a [`RealmEvent`].
2588    fn decode(
2589        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2590    ) -> Result<RealmEvent, fidl::Error> {
2591        let (bytes, _handles) = buf.split_mut();
2592        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2593        debug_assert_eq!(tx_header.tx_id, 0);
2594        match tx_header.ordinal {
2595            _ => Err(fidl::Error::UnknownOrdinal {
2596                ordinal: tx_header.ordinal,
2597                protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2598            }),
2599        }
2600    }
2601}
2602
2603/// A Stream of incoming requests for fuchsia.component.test/Realm.
2604pub struct RealmRequestStream {
2605    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2606    is_terminated: bool,
2607}
2608
2609impl std::marker::Unpin for RealmRequestStream {}
2610
2611impl futures::stream::FusedStream for RealmRequestStream {
2612    fn is_terminated(&self) -> bool {
2613        self.is_terminated
2614    }
2615}
2616
2617impl fidl::endpoints::RequestStream for RealmRequestStream {
2618    type Protocol = RealmMarker;
2619    type ControlHandle = RealmControlHandle;
2620
2621    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2622        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2623    }
2624
2625    fn control_handle(&self) -> Self::ControlHandle {
2626        RealmControlHandle { inner: self.inner.clone() }
2627    }
2628
2629    fn into_inner(
2630        self,
2631    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2632    {
2633        (self.inner, self.is_terminated)
2634    }
2635
2636    fn from_inner(
2637        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2638        is_terminated: bool,
2639    ) -> Self {
2640        Self { inner, is_terminated }
2641    }
2642}
2643
2644impl futures::Stream for RealmRequestStream {
2645    type Item = Result<RealmRequest, fidl::Error>;
2646
2647    fn poll_next(
2648        mut self: std::pin::Pin<&mut Self>,
2649        cx: &mut std::task::Context<'_>,
2650    ) -> std::task::Poll<Option<Self::Item>> {
2651        let this = &mut *self;
2652        if this.inner.check_shutdown(cx) {
2653            this.is_terminated = true;
2654            return std::task::Poll::Ready(None);
2655        }
2656        if this.is_terminated {
2657            panic!("polled RealmRequestStream after completion");
2658        }
2659        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2660            |bytes, handles| {
2661                match this.inner.channel().read_etc(cx, bytes, handles) {
2662                    std::task::Poll::Ready(Ok(())) => {}
2663                    std::task::Poll::Pending => return std::task::Poll::Pending,
2664                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2665                        this.is_terminated = true;
2666                        return std::task::Poll::Ready(None);
2667                    }
2668                    std::task::Poll::Ready(Err(e)) => {
2669                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2670                            e.into(),
2671                        ))));
2672                    }
2673                }
2674
2675                // A message has been received from the channel
2676                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2677
2678                std::task::Poll::Ready(Some(match header.ordinal {
2679                    0x3f6c07627303d801 => {
2680                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2681                        let mut req = fidl::new_empty!(
2682                            RealmAddChildRequest,
2683                            fidl::encoding::DefaultFuchsiaResourceDialect
2684                        );
2685                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
2686                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2687                        Ok(RealmRequest::AddChild {
2688                            name: req.name,
2689                            url: req.url,
2690                            options: req.options,
2691
2692                            responder: RealmAddChildResponder {
2693                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2694                                tx_id: header.tx_id,
2695                            },
2696                        })
2697                    }
2698                    0x3950ad500258156d => {
2699                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2700                        let mut req = fidl::new_empty!(
2701                            RealmAddChildFromDeclRequest,
2702                            fidl::encoding::DefaultFuchsiaResourceDialect
2703                        );
2704                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddChildFromDeclRequest>(&header, _body_bytes, handles, &mut req)?;
2705                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2706                        Ok(RealmRequest::AddChildFromDecl {
2707                            name: req.name,
2708                            decl: req.decl,
2709                            options: req.options,
2710
2711                            responder: RealmAddChildFromDeclResponder {
2712                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2713                                tx_id: header.tx_id,
2714                            },
2715                        })
2716                    }
2717                    0x3249817bae10abbb => {
2718                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2719                        let mut req = fidl::new_empty!(
2720                            RealmAddLocalChildRequest,
2721                            fidl::encoding::DefaultFuchsiaResourceDialect
2722                        );
2723                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddLocalChildRequest>(&header, _body_bytes, handles, &mut req)?;
2724                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2725                        Ok(RealmRequest::AddLocalChild {
2726                            name: req.name,
2727                            options: req.options,
2728
2729                            responder: RealmAddLocalChildResponder {
2730                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2731                                tx_id: header.tx_id,
2732                            },
2733                        })
2734                    }
2735                    0x3fdf98db373b9458 => {
2736                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2737                        let mut req = fidl::new_empty!(
2738                            RealmAddChildRealmRequest,
2739                            fidl::encoding::DefaultFuchsiaResourceDialect
2740                        );
2741                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddChildRealmRequest>(&header, _body_bytes, handles, &mut req)?;
2742                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2743                        Ok(RealmRequest::AddChildRealm {
2744                            name: req.name,
2745                            options: req.options,
2746                            child_realm: req.child_realm,
2747
2748                            responder: RealmAddChildRealmResponder {
2749                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2750                                tx_id: header.tx_id,
2751                            },
2752                        })
2753                    }
2754                    0x44c34c8dcbe06abb => {
2755                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2756                        let mut req = fidl::new_empty!(
2757                            RealmAddChildRealmFromRelativeUrlRequest,
2758                            fidl::encoding::DefaultFuchsiaResourceDialect
2759                        );
2760                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddChildRealmFromRelativeUrlRequest>(&header, _body_bytes, handles, &mut req)?;
2761                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2762                        Ok(RealmRequest::AddChildRealmFromRelativeUrl {
2763                            name: req.name,
2764                            relative_url: req.relative_url,
2765                            options: req.options,
2766                            child_realm: req.child_realm,
2767
2768                            responder: RealmAddChildRealmFromRelativeUrlResponder {
2769                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2770                                tx_id: header.tx_id,
2771                            },
2772                        })
2773                    }
2774                    0x142e5c326732862e => {
2775                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2776                        let mut req = fidl::new_empty!(
2777                            RealmAddChildRealmFromDeclRequest,
2778                            fidl::encoding::DefaultFuchsiaResourceDialect
2779                        );
2780                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddChildRealmFromDeclRequest>(&header, _body_bytes, handles, &mut req)?;
2781                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2782                        Ok(RealmRequest::AddChildRealmFromDecl {
2783                            name: req.name,
2784                            decl: req.decl,
2785                            options: req.options,
2786                            child_realm: req.child_realm,
2787
2788                            responder: RealmAddChildRealmFromDeclResponder {
2789                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2790                                tx_id: header.tx_id,
2791                            },
2792                        })
2793                    }
2794                    0x320832af6a4cbac6 => {
2795                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2796                        let mut req = fidl::new_empty!(
2797                            RealmGetComponentDeclRequest,
2798                            fidl::encoding::DefaultFuchsiaResourceDialect
2799                        );
2800                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmGetComponentDeclRequest>(&header, _body_bytes, handles, &mut req)?;
2801                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2802                        Ok(RealmRequest::GetComponentDecl {
2803                            name: req.name,
2804
2805                            responder: RealmGetComponentDeclResponder {
2806                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2807                                tx_id: header.tx_id,
2808                            },
2809                        })
2810                    }
2811                    0x59cecf31b314cd5f => {
2812                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2813                        let mut req = fidl::new_empty!(
2814                            RealmReplaceComponentDeclRequest,
2815                            fidl::encoding::DefaultFuchsiaResourceDialect
2816                        );
2817                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmReplaceComponentDeclRequest>(&header, _body_bytes, handles, &mut req)?;
2818                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2819                        Ok(RealmRequest::ReplaceComponentDecl {
2820                            name: req.name,
2821                            component_decl: req.component_decl,
2822
2823                            responder: RealmReplaceComponentDeclResponder {
2824                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2825                                tx_id: header.tx_id,
2826                            },
2827                        })
2828                    }
2829                    0x46fa05b17bd64269 => {
2830                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2831                        let mut req = fidl::new_empty!(
2832                            fidl::encoding::EmptyPayload,
2833                            fidl::encoding::DefaultFuchsiaResourceDialect
2834                        );
2835                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2836                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2837                        Ok(RealmRequest::GetRealmDecl {
2838                            responder: RealmGetRealmDeclResponder {
2839                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2840                                tx_id: header.tx_id,
2841                            },
2842                        })
2843                    }
2844                    0x48fcba4ac1338da9 => {
2845                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2846                        let mut req = fidl::new_empty!(
2847                            RealmReplaceRealmDeclRequest,
2848                            fidl::encoding::DefaultFuchsiaResourceDialect
2849                        );
2850                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmReplaceRealmDeclRequest>(&header, _body_bytes, handles, &mut req)?;
2851                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2852                        Ok(RealmRequest::ReplaceRealmDecl {
2853                            component_decl: req.component_decl,
2854
2855                            responder: RealmReplaceRealmDeclResponder {
2856                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2857                                tx_id: header.tx_id,
2858                            },
2859                        })
2860                    }
2861                    0x64bd27482f3dcc => {
2862                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2863                        let mut req = fidl::new_empty!(
2864                            RealmUseNestedComponentManagerRequest,
2865                            fidl::encoding::DefaultFuchsiaResourceDialect
2866                        );
2867                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmUseNestedComponentManagerRequest>(&header, _body_bytes, handles, &mut req)?;
2868                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2869                        Ok(RealmRequest::UseNestedComponentManager {
2870                            component_manager_relative_url: req.component_manager_relative_url,
2871
2872                            responder: RealmUseNestedComponentManagerResponder {
2873                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2874                                tx_id: header.tx_id,
2875                            },
2876                        })
2877                    }
2878                    0x9d523295be53a0a => {
2879                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2880                        let mut req = fidl::new_empty!(
2881                            RealmAddRouteRequest,
2882                            fidl::encoding::DefaultFuchsiaResourceDialect
2883                        );
2884                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2885                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2886                        Ok(RealmRequest::AddRoute {
2887                            capabilities: req.capabilities,
2888                            from: req.from,
2889                            to: req.to,
2890
2891                            responder: RealmAddRouteResponder {
2892                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2893                                tx_id: header.tx_id,
2894                            },
2895                        })
2896                    }
2897                    0x21fac42c3e1d14d2 => {
2898                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2899                        let mut req = fidl::new_empty!(
2900                            RealmAddRouteFromDictionaryRequest,
2901                            fidl::encoding::DefaultFuchsiaResourceDialect
2902                        );
2903                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddRouteFromDictionaryRequest>(&header, _body_bytes, handles, &mut req)?;
2904                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2905                        Ok(RealmRequest::AddRouteFromDictionary {
2906                            capabilities: req.capabilities,
2907                            from: req.from,
2908                            from_dictionary: req.from_dictionary,
2909                            to: req.to,
2910
2911                            responder: RealmAddRouteFromDictionaryResponder {
2912                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2913                                tx_id: header.tx_id,
2914                            },
2915                        })
2916                    }
2917                    0x78a6d150a66e00dc => {
2918                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2919                        let mut req = fidl::new_empty!(
2920                            RealmReadOnlyDirectoryRequest,
2921                            fidl::encoding::DefaultFuchsiaResourceDialect
2922                        );
2923                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmReadOnlyDirectoryRequest>(&header, _body_bytes, handles, &mut req)?;
2924                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2925                        Ok(RealmRequest::ReadOnlyDirectory {
2926                            name: req.name,
2927                            to: req.to,
2928                            directory_contents: req.directory_contents,
2929
2930                            responder: RealmReadOnlyDirectoryResponder {
2931                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2932                                tx_id: header.tx_id,
2933                            },
2934                        })
2935                    }
2936                    0x4709da0c9576b7c1 => {
2937                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2938                        let mut req = fidl::new_empty!(
2939                            RealmAddStorageRequest,
2940                            fidl::encoding::DefaultFuchsiaResourceDialect
2941                        );
2942                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddStorageRequest>(&header, _body_bytes, handles, &mut req)?;
2943                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2944                        Ok(RealmRequest::AddStorage {
2945                            name: req.name,
2946                            to: req.to,
2947                            storage_admin: req.storage_admin,
2948
2949                            responder: RealmAddStorageResponder {
2950                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2951                                tx_id: header.tx_id,
2952                            },
2953                        })
2954                    }
2955                    0x36a30c9837c64216 => {
2956                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2957                        let mut req = fidl::new_empty!(
2958                            RealmInitMutableConfigFromPackageRequest,
2959                            fidl::encoding::DefaultFuchsiaResourceDialect
2960                        );
2961                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmInitMutableConfigFromPackageRequest>(&header, _body_bytes, handles, &mut req)?;
2962                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2963                        Ok(RealmRequest::InitMutableConfigFromPackage {
2964                            name: req.name,
2965
2966                            responder: RealmInitMutableConfigFromPackageResponder {
2967                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2968                                tx_id: header.tx_id,
2969                            },
2970                        })
2971                    }
2972                    0x772cb99e2e0dccc5 => {
2973                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2974                        let mut req = fidl::new_empty!(
2975                            RealmInitMutableConfigToEmptyRequest,
2976                            fidl::encoding::DefaultFuchsiaResourceDialect
2977                        );
2978                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmInitMutableConfigToEmptyRequest>(&header, _body_bytes, handles, &mut req)?;
2979                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2980                        Ok(RealmRequest::InitMutableConfigToEmpty {
2981                            name: req.name,
2982
2983                            responder: RealmInitMutableConfigToEmptyResponder {
2984                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2985                                tx_id: header.tx_id,
2986                            },
2987                        })
2988                    }
2989                    0x23a6499eb6080249 => {
2990                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2991                        let mut req = fidl::new_empty!(
2992                            RealmAddCapabilityRequest,
2993                            fidl::encoding::DefaultFuchsiaResourceDialect
2994                        );
2995                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddCapabilityRequest>(&header, _body_bytes, handles, &mut req)?;
2996                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
2997                        Ok(RealmRequest::AddCapability {
2998                            capability: req.capability,
2999
3000                            responder: RealmAddCapabilityResponder {
3001                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3002                                tx_id: header.tx_id,
3003                            },
3004                        })
3005                    }
3006                    0x56b75210a03a99b5 => {
3007                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3008                        let mut req = fidl::new_empty!(
3009                            RealmAddCollectionRequest,
3010                            fidl::encoding::DefaultFuchsiaResourceDialect
3011                        );
3012                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddCollectionRequest>(&header, _body_bytes, handles, &mut req)?;
3013                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
3014                        Ok(RealmRequest::AddCollection {
3015                            collection: req.collection,
3016
3017                            responder: RealmAddCollectionResponder {
3018                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3019                                tx_id: header.tx_id,
3020                            },
3021                        })
3022                    }
3023                    0x1cd7caefa2cce0e9 => {
3024                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3025                        let mut req = fidl::new_empty!(
3026                            RealmAddEnvironmentRequest,
3027                            fidl::encoding::DefaultFuchsiaResourceDialect
3028                        );
3029                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmAddEnvironmentRequest>(&header, _body_bytes, handles, &mut req)?;
3030                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
3031                        Ok(RealmRequest::AddEnvironment {
3032                            environment: req.environment,
3033
3034                            responder: RealmAddEnvironmentResponder {
3035                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3036                                tx_id: header.tx_id,
3037                            },
3038                        })
3039                    }
3040                    0x886450d291217f2 => {
3041                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3042                        let mut req = fidl::new_empty!(
3043                            RealmSetConfigValueRequest,
3044                            fidl::encoding::DefaultFuchsiaResourceDialect
3045                        );
3046                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmSetConfigValueRequest>(&header, _body_bytes, handles, &mut req)?;
3047                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
3048                        Ok(RealmRequest::SetConfigValue {
3049                            name: req.name,
3050                            key: req.key,
3051                            value: req.value,
3052
3053                            responder: RealmSetConfigValueResponder {
3054                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3055                                tx_id: header.tx_id,
3056                            },
3057                        })
3058                    }
3059                    _ => Err(fidl::Error::UnknownOrdinal {
3060                        ordinal: header.ordinal,
3061                        protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3062                    }),
3063                }))
3064            },
3065        )
3066    }
3067}
3068
3069#[derive(Debug)]
3070pub enum RealmRequest {
3071    /// Adds a component to the realm.
3072    ///
3073    /// The `url` can be in one of the following formats:
3074    ///
3075    /// - an absolute component URL (such as,
3076    ///   "fuchsia-pkg://fuchsia.com/some-package#meta/some-component.cm")
3077    /// - a relative path component URL to a subpackaged component (like,
3078    ///   "some-subpackage#meta/subpackaged-component.cm"); or
3079    /// - a relative fragment-only URL (like, `#meta/other-component.cm`;
3080    ///   see https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
3081    ///   indicating the path to a component manifest in the `pkg_dir` supplied
3082    ///   to `RealmBuilderFactory::Create*()`.
3083    ///
3084    /// The realm builder client typically passes a handle to its own `/pkg`
3085    /// directory, and bundles the `other-component` into the same package.
3086    ///
3087    /// Of the three URL types, _only_ component declarations added via the
3088    /// fragment-only URL can be modified, via
3089    /// `GetComponentDecl`/`ReplaceComponentDecl` because realm builder actually
3090    /// performs its own component resolution from the component's manifest and
3091    /// files bundled in the provided `pkg_dir` (typically from the package
3092    /// shared by the realm builder client component and the components added
3093    /// via fragment-only URL).
3094    ///
3095    /// Errors:
3096    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
3097    ///   given name.
3098    /// - `INVALID_MANIFEST_EXTENSION`: `url` does not end with `.cm`
3099    /// - `DECL_NOT_FOUND`: The test package does not contain the component
3100    ///   declaration referenced by a fragment-only component URL.
3101    /// - `DECL_READ_ERROR`: Encountered an I/O error when attempting to read a
3102    ///   component declaration referenced by a fragment-only component URL from
3103    ///   the test package.
3104    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3105    ///   for this realm, and thus this `Realm` channel can no longer be used.
3106    AddChild { name: String, url: String, options: ChildOptions, responder: RealmAddChildResponder },
3107    /// Adds a component to this realm whose declaration is set to `decl`. When
3108    /// launched, the component will share the test package as its package
3109    /// directory, and may access any resources from it.
3110    ///
3111    /// Errors:
3112    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
3113    ///   given name.
3114    /// - `INVALID_COMPONENT_DECL`: `decl` failed validation.
3115    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3116    ///   for this realm, and thus this `Realm` channel can no longer be used.
3117    AddChildFromDecl {
3118        name: String,
3119        decl: fidl_fuchsia_component_decl::Component,
3120        options: ChildOptions,
3121        responder: RealmAddChildFromDeclResponder,
3122    },
3123    /// Adds a component to the realm whose implementation will be provided by
3124    /// the client. When this component should be started, the runner channel
3125    /// passed into `Build` will receive a start request for a component whose
3126    /// `ProgramDecl` contains the moniker from the root of the
3127    /// constructed realm for the child that is to be run under the `program`
3128    /// key `LOCAL_COMPONENT_NAME`.
3129    ///
3130    /// Errors:
3131    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
3132    ///   given name.
3133    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3134    ///   for this realm, and thus this `Realm` channel can no longer be used.
3135    AddLocalChild { name: String, options: ChildOptions, responder: RealmAddLocalChildResponder },
3136    /// Adds a child realm which can be built with the client end of
3137    /// `child_realm`.
3138    ///
3139    /// Errors:
3140    /// - `CHILD_ALREADY_EXISTS`: this realm already contains a child with the
3141    ///   given name.
3142    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3143    ///   for this realm, and thus this `Realm` channel can no longer be used.
3144    AddChildRealm {
3145        name: String,
3146        options: ChildOptions,
3147        child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
3148        responder: RealmAddChildRealmResponder,
3149    },
3150    /// Adds a child realm which can be built with the client end of
3151    /// `child_realm`, and whose contents are initialized from `relative_url`.
3152    /// `relative_url` must be a fragment-only URL.
3153    AddChildRealmFromRelativeUrl {
3154        name: String,
3155        relative_url: String,
3156        options: ChildOptions,
3157        child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
3158        responder: RealmAddChildRealmFromRelativeUrlResponder,
3159    },
3160    /// Adds a child realm which can be built with the client end of
3161    /// `child_realm`, and whose contents are initialized from `decl`.
3162    AddChildRealmFromDecl {
3163        name: String,
3164        decl: fidl_fuchsia_component_decl::Component,
3165        options: ChildOptions,
3166        child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
3167        responder: RealmAddChildRealmFromDeclResponder,
3168    },
3169    /// Returns the component decl for the given component. `name` must refer to
3170    /// a component that is one of the following:
3171    ///
3172    /// - A component with a local implementation
3173    /// - A legacy component
3174    /// - A component added with a fragment-only URL (typically, components
3175    ///   bundled in the same package as the realm builder client, sharing the
3176    ///   same `/pkg` directory, for example, `#meta/other-component.cm`; see
3177    ///   https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
3178    /// - An automatically generated realm (ex: the root)
3179    ///
3180    /// Errors:
3181    /// - `NO_SUCH_CHILD`: This realm does not contain a child with the given
3182    ///   name.
3183    /// - `CHILD_DECL_NOT_VISIBLE`: The component decl cannot be fetched for
3184    ///   the referenced child, because the child was added to the realm using
3185    ///   a modern (not legacy) absolute URL or subpackaged component's relative
3186    ///   path URL.
3187    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3188    ///   for this realm, and thus this `Realm` channel can no longer be used.
3189    GetComponentDecl { name: String, responder: RealmGetComponentDeclResponder },
3190    /// Replaces the component decl for the given component. `name` must
3191    /// refer to a component that is one of the following:
3192    ///
3193    /// - A component with a local implementation
3194    /// - A legacy component
3195    /// - A component added with a fragment-only URL (typically, components
3196    ///   bundled in the same package as the realm builder client, sharing the
3197    ///   same `/pkg` directory, for example, `#meta/other-component.cm`; see
3198    ///   https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only)
3199    /// - An automatically generated realm (ex: the root)
3200    ///
3201    /// Errors:
3202    /// - `NO_SUCH_CHILD`: This realm does not contain a child with the given
3203    ///   name.
3204    /// - `CHILD_ALREADY_EXISTS`: The component whose decl is being replaced has
3205    ///   had a child added to it through realm builder with the same name as an
3206    ///   element in `component_decl.children`.
3207    /// - `CHILD_DECL_NOT_VISIBLE`: The component decl cannot be manipulated for
3208    ///   the referenced child, because the child was added to the realm using
3209    ///   an absolute (not relative) and modern (not legacy) URL.
3210    /// - `INVALID_COMPONENT_DECL`: `component_decl` failed validation.
3211    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3212    ///   for this realm, and thus this `Realm` channel can no longer be used.
3213    ReplaceComponentDecl {
3214        name: String,
3215        component_decl: fidl_fuchsia_component_decl::Component,
3216        responder: RealmReplaceComponentDeclResponder,
3217    },
3218    /// Returns the component decl for this realm.
3219    ///
3220    /// Errors:
3221    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3222    ///   for this realm, and thus this `Realm` channel can no longer be used.
3223    GetRealmDecl { responder: RealmGetRealmDeclResponder },
3224    /// Replaces the component decl for this realm.
3225    ///
3226    /// Errors:
3227    /// - `INVALID_COMPONENT_DECL`: `component_decl` failed validation.
3228    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3229    ///   for this realm, and thus this `Realm` channel can no longer be used.
3230    ReplaceRealmDecl {
3231        component_decl: fidl_fuchsia_component_decl::Component,
3232        responder: RealmReplaceRealmDeclResponder,
3233    },
3234    /// Inform the realm builder server that this realm is using a nested component manager. It's
3235    /// expected that the client library has already replaced the realm's declaration with a
3236    /// passthrough component manager declaration, with the exception of the root url.
3237    /// This method will arrange for [Builder.Build] to install the realm's generated url as the
3238    /// root url in this component manager.
3239    UseNestedComponentManager {
3240        component_manager_relative_url: String,
3241        responder: RealmUseNestedComponentManagerResponder,
3242    },
3243    /// Identical to `AddRouteFromDictionary`, except it does not accept `from_dictionary` which
3244    /// it always sets to ".".
3245    AddRoute {
3246        capabilities: Vec<Capability>,
3247        from: fidl_fuchsia_component_decl::Ref,
3248        to: Vec<fidl_fuchsia_component_decl::Ref>,
3249        responder: RealmAddRouteResponder,
3250    },
3251    /// Mutates component manifests in the realm such that every component in
3252    /// `to` will have a valid capability route for each item in `capabilities`
3253    /// provided by `from`.
3254    ///
3255    /// Errors:
3256    /// - `NO_SUCH_SOURCE`: `from` references a non-existent child.
3257    /// - `NO_SUCH_TARGET`: `to` references a non-existent child.
3258    /// - `CAPABILITIES_EMPTY`: `capabilities` is empty.
3259    /// - `TARGETS_EMPTY`: `to` is empty.
3260    /// - `SOURCE_AND_TARGET_MATCH`: `from` is equal to one of the elements in
3261    ///   `to`.
3262    /// - `INVALID_COMPONENT_DECL`: The requested route caused one of the
3263    ///   involved manifests to fail validation.
3264    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3265    ///   for this realm, and thus this `Realm` channel can no longer be used.
3266    AddRouteFromDictionary {
3267        capabilities: Vec<Capability>,
3268        from: fidl_fuchsia_component_decl::Ref,
3269        from_dictionary: String,
3270        to: Vec<fidl_fuchsia_component_decl::Ref>,
3271        responder: RealmAddRouteFromDictionaryResponder,
3272    },
3273    /// Offers a directory capability to a component in this realm. The
3274    /// directory will be read-only (i.e. have `r*` rights), and will have the
3275    /// contents described in `directory_contents`.
3276    ///
3277    /// Errors:
3278    /// - `NO_SUCH_TARGET`: `offer-to` references a non-existent child.
3279    /// - `BUILD_ALREADY_CALLED`: The `Builder.Build` function has been called
3280    ///   for this realm, and thus this `Realm` channel can no longer be used.
3281    ReadOnlyDirectory {
3282        name: String,
3283        to: Vec<fidl_fuchsia_component_decl::Ref>,
3284        directory_contents: DirectoryContents,
3285        responder: RealmReadOnlyDirectoryResponder,
3286    },
3287    /// Creates and routes a new storage capability to the provided targets.
3288    /// Optionally can connect the provided channel the the
3289    /// `fuchsia.sys2.StorageAdmin` protocol for this storage capability.
3290    AddStorage {
3291        name: String,
3292        to: Vec<fidl_fuchsia_component_decl::Ref>,
3293        storage_admin:
3294            Option<fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>>,
3295        responder: RealmAddStorageResponder,
3296    },
3297    /// Load any packaged configuration for `name` before using values provided to
3298    /// the builder.
3299    ///
3300    /// Allows calling `SetConfigValue` to override packaged configuration.
3301    InitMutableConfigFromPackage {
3302        name: String,
3303        responder: RealmInitMutableConfigFromPackageResponder,
3304    },
3305    /// Use only values provided to the builder for `name`'s configuration.
3306    ///
3307    /// Allows calling `SetConfigValue` to provide configuration.
3308    InitMutableConfigToEmpty { name: String, responder: RealmInitMutableConfigToEmptyResponder },
3309    /// Add a capability to the realm.
3310    AddCapability {
3311        capability: fidl_fuchsia_component_decl::Capability,
3312        responder: RealmAddCapabilityResponder,
3313    },
3314    /// Adds a collection to the realm.
3315    AddCollection {
3316        collection: fidl_fuchsia_component_decl::Collection,
3317        responder: RealmAddCollectionResponder,
3318    },
3319    /// Adds an environment to the realm.
3320    AddEnvironment {
3321        environment: fidl_fuchsia_component_decl::Environment,
3322        responder: RealmAddEnvironmentResponder,
3323    },
3324    /// Sets the configuration value for a field specified by `key`.
3325    /// The component specified must have a config schema with this field.
3326    /// The value must conform to all constraints as defined by the schema.
3327    ///
3328    /// This method must be called after either `InitMutableConfigFromPackage` or
3329    /// `InitMutableConfigToEmpty`.
3330    ///
3331    /// Errors:
3332    /// - `NO_CONFIG_SCHEMA`: component does not have a config schema
3333    /// - `NO_SUCH_CONFIG_FIELD`: `key` could not be found in component's config schema
3334    /// - `CONFIG_VALUE_INVALID`: `value` does not meet config schema constraints
3335    SetConfigValue {
3336        name: String,
3337        key: String,
3338        value: fidl_fuchsia_component_decl::ConfigValueSpec,
3339        responder: RealmSetConfigValueResponder,
3340    },
3341}
3342
3343impl RealmRequest {
3344    #[allow(irrefutable_let_patterns)]
3345    pub fn into_add_child(self) -> Option<(String, String, ChildOptions, RealmAddChildResponder)> {
3346        if let RealmRequest::AddChild { name, url, options, responder } = self {
3347            Some((name, url, options, responder))
3348        } else {
3349            None
3350        }
3351    }
3352
3353    #[allow(irrefutable_let_patterns)]
3354    pub fn into_add_child_from_decl(
3355        self,
3356    ) -> Option<(
3357        String,
3358        fidl_fuchsia_component_decl::Component,
3359        ChildOptions,
3360        RealmAddChildFromDeclResponder,
3361    )> {
3362        if let RealmRequest::AddChildFromDecl { name, decl, options, responder } = self {
3363            Some((name, decl, options, responder))
3364        } else {
3365            None
3366        }
3367    }
3368
3369    #[allow(irrefutable_let_patterns)]
3370    pub fn into_add_local_child(
3371        self,
3372    ) -> Option<(String, ChildOptions, RealmAddLocalChildResponder)> {
3373        if let RealmRequest::AddLocalChild { name, options, responder } = self {
3374            Some((name, options, responder))
3375        } else {
3376            None
3377        }
3378    }
3379
3380    #[allow(irrefutable_let_patterns)]
3381    pub fn into_add_child_realm(
3382        self,
3383    ) -> Option<(
3384        String,
3385        ChildOptions,
3386        fidl::endpoints::ServerEnd<RealmMarker>,
3387        RealmAddChildRealmResponder,
3388    )> {
3389        if let RealmRequest::AddChildRealm { name, options, child_realm, responder } = self {
3390            Some((name, options, child_realm, responder))
3391        } else {
3392            None
3393        }
3394    }
3395
3396    #[allow(irrefutable_let_patterns)]
3397    pub fn into_add_child_realm_from_relative_url(
3398        self,
3399    ) -> Option<(
3400        String,
3401        String,
3402        ChildOptions,
3403        fidl::endpoints::ServerEnd<RealmMarker>,
3404        RealmAddChildRealmFromRelativeUrlResponder,
3405    )> {
3406        if let RealmRequest::AddChildRealmFromRelativeUrl {
3407            name,
3408            relative_url,
3409            options,
3410            child_realm,
3411            responder,
3412        } = self
3413        {
3414            Some((name, relative_url, options, child_realm, responder))
3415        } else {
3416            None
3417        }
3418    }
3419
3420    #[allow(irrefutable_let_patterns)]
3421    pub fn into_add_child_realm_from_decl(
3422        self,
3423    ) -> Option<(
3424        String,
3425        fidl_fuchsia_component_decl::Component,
3426        ChildOptions,
3427        fidl::endpoints::ServerEnd<RealmMarker>,
3428        RealmAddChildRealmFromDeclResponder,
3429    )> {
3430        if let RealmRequest::AddChildRealmFromDecl { name, decl, options, child_realm, responder } =
3431            self
3432        {
3433            Some((name, decl, options, child_realm, responder))
3434        } else {
3435            None
3436        }
3437    }
3438
3439    #[allow(irrefutable_let_patterns)]
3440    pub fn into_get_component_decl(self) -> Option<(String, RealmGetComponentDeclResponder)> {
3441        if let RealmRequest::GetComponentDecl { name, responder } = self {
3442            Some((name, responder))
3443        } else {
3444            None
3445        }
3446    }
3447
3448    #[allow(irrefutable_let_patterns)]
3449    pub fn into_replace_component_decl(
3450        self,
3451    ) -> Option<(String, fidl_fuchsia_component_decl::Component, RealmReplaceComponentDeclResponder)>
3452    {
3453        if let RealmRequest::ReplaceComponentDecl { name, component_decl, responder } = self {
3454            Some((name, component_decl, responder))
3455        } else {
3456            None
3457        }
3458    }
3459
3460    #[allow(irrefutable_let_patterns)]
3461    pub fn into_get_realm_decl(self) -> Option<(RealmGetRealmDeclResponder)> {
3462        if let RealmRequest::GetRealmDecl { responder } = self { Some((responder)) } else { None }
3463    }
3464
3465    #[allow(irrefutable_let_patterns)]
3466    pub fn into_replace_realm_decl(
3467        self,
3468    ) -> Option<(fidl_fuchsia_component_decl::Component, RealmReplaceRealmDeclResponder)> {
3469        if let RealmRequest::ReplaceRealmDecl { component_decl, responder } = self {
3470            Some((component_decl, responder))
3471        } else {
3472            None
3473        }
3474    }
3475
3476    #[allow(irrefutable_let_patterns)]
3477    pub fn into_use_nested_component_manager(
3478        self,
3479    ) -> Option<(String, RealmUseNestedComponentManagerResponder)> {
3480        if let RealmRequest::UseNestedComponentManager {
3481            component_manager_relative_url,
3482            responder,
3483        } = self
3484        {
3485            Some((component_manager_relative_url, responder))
3486        } else {
3487            None
3488        }
3489    }
3490
3491    #[allow(irrefutable_let_patterns)]
3492    pub fn into_add_route(
3493        self,
3494    ) -> Option<(
3495        Vec<Capability>,
3496        fidl_fuchsia_component_decl::Ref,
3497        Vec<fidl_fuchsia_component_decl::Ref>,
3498        RealmAddRouteResponder,
3499    )> {
3500        if let RealmRequest::AddRoute { capabilities, from, to, responder } = self {
3501            Some((capabilities, from, to, responder))
3502        } else {
3503            None
3504        }
3505    }
3506
3507    #[allow(irrefutable_let_patterns)]
3508    pub fn into_add_route_from_dictionary(
3509        self,
3510    ) -> Option<(
3511        Vec<Capability>,
3512        fidl_fuchsia_component_decl::Ref,
3513        String,
3514        Vec<fidl_fuchsia_component_decl::Ref>,
3515        RealmAddRouteFromDictionaryResponder,
3516    )> {
3517        if let RealmRequest::AddRouteFromDictionary {
3518            capabilities,
3519            from,
3520            from_dictionary,
3521            to,
3522            responder,
3523        } = self
3524        {
3525            Some((capabilities, from, from_dictionary, to, responder))
3526        } else {
3527            None
3528        }
3529    }
3530
3531    #[allow(irrefutable_let_patterns)]
3532    pub fn into_read_only_directory(
3533        self,
3534    ) -> Option<(
3535        String,
3536        Vec<fidl_fuchsia_component_decl::Ref>,
3537        DirectoryContents,
3538        RealmReadOnlyDirectoryResponder,
3539    )> {
3540        if let RealmRequest::ReadOnlyDirectory { name, to, directory_contents, responder } = self {
3541            Some((name, to, directory_contents, responder))
3542        } else {
3543            None
3544        }
3545    }
3546
3547    #[allow(irrefutable_let_patterns)]
3548    pub fn into_add_storage(
3549        self,
3550    ) -> Option<(
3551        String,
3552        Vec<fidl_fuchsia_component_decl::Ref>,
3553        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>>,
3554        RealmAddStorageResponder,
3555    )> {
3556        if let RealmRequest::AddStorage { name, to, storage_admin, responder } = self {
3557            Some((name, to, storage_admin, responder))
3558        } else {
3559            None
3560        }
3561    }
3562
3563    #[allow(irrefutable_let_patterns)]
3564    pub fn into_init_mutable_config_from_package(
3565        self,
3566    ) -> Option<(String, RealmInitMutableConfigFromPackageResponder)> {
3567        if let RealmRequest::InitMutableConfigFromPackage { name, responder } = self {
3568            Some((name, responder))
3569        } else {
3570            None
3571        }
3572    }
3573
3574    #[allow(irrefutable_let_patterns)]
3575    pub fn into_init_mutable_config_to_empty(
3576        self,
3577    ) -> Option<(String, RealmInitMutableConfigToEmptyResponder)> {
3578        if let RealmRequest::InitMutableConfigToEmpty { name, responder } = self {
3579            Some((name, responder))
3580        } else {
3581            None
3582        }
3583    }
3584
3585    #[allow(irrefutable_let_patterns)]
3586    pub fn into_add_capability(
3587        self,
3588    ) -> Option<(fidl_fuchsia_component_decl::Capability, RealmAddCapabilityResponder)> {
3589        if let RealmRequest::AddCapability { capability, responder } = self {
3590            Some((capability, responder))
3591        } else {
3592            None
3593        }
3594    }
3595
3596    #[allow(irrefutable_let_patterns)]
3597    pub fn into_add_collection(
3598        self,
3599    ) -> Option<(fidl_fuchsia_component_decl::Collection, RealmAddCollectionResponder)> {
3600        if let RealmRequest::AddCollection { collection, responder } = self {
3601            Some((collection, responder))
3602        } else {
3603            None
3604        }
3605    }
3606
3607    #[allow(irrefutable_let_patterns)]
3608    pub fn into_add_environment(
3609        self,
3610    ) -> Option<(fidl_fuchsia_component_decl::Environment, RealmAddEnvironmentResponder)> {
3611        if let RealmRequest::AddEnvironment { environment, responder } = self {
3612            Some((environment, responder))
3613        } else {
3614            None
3615        }
3616    }
3617
3618    #[allow(irrefutable_let_patterns)]
3619    pub fn into_set_config_value(
3620        self,
3621    ) -> Option<(
3622        String,
3623        String,
3624        fidl_fuchsia_component_decl::ConfigValueSpec,
3625        RealmSetConfigValueResponder,
3626    )> {
3627        if let RealmRequest::SetConfigValue { name, key, value, responder } = self {
3628            Some((name, key, value, responder))
3629        } else {
3630            None
3631        }
3632    }
3633
3634    /// Name of the method defined in FIDL
3635    pub fn method_name(&self) -> &'static str {
3636        match *self {
3637            RealmRequest::AddChild { .. } => "add_child",
3638            RealmRequest::AddChildFromDecl { .. } => "add_child_from_decl",
3639            RealmRequest::AddLocalChild { .. } => "add_local_child",
3640            RealmRequest::AddChildRealm { .. } => "add_child_realm",
3641            RealmRequest::AddChildRealmFromRelativeUrl { .. } => {
3642                "add_child_realm_from_relative_url"
3643            }
3644            RealmRequest::AddChildRealmFromDecl { .. } => "add_child_realm_from_decl",
3645            RealmRequest::GetComponentDecl { .. } => "get_component_decl",
3646            RealmRequest::ReplaceComponentDecl { .. } => "replace_component_decl",
3647            RealmRequest::GetRealmDecl { .. } => "get_realm_decl",
3648            RealmRequest::ReplaceRealmDecl { .. } => "replace_realm_decl",
3649            RealmRequest::UseNestedComponentManager { .. } => "use_nested_component_manager",
3650            RealmRequest::AddRoute { .. } => "add_route",
3651            RealmRequest::AddRouteFromDictionary { .. } => "add_route_from_dictionary",
3652            RealmRequest::ReadOnlyDirectory { .. } => "read_only_directory",
3653            RealmRequest::AddStorage { .. } => "add_storage",
3654            RealmRequest::InitMutableConfigFromPackage { .. } => "init_mutable_config_from_package",
3655            RealmRequest::InitMutableConfigToEmpty { .. } => "init_mutable_config_to_empty",
3656            RealmRequest::AddCapability { .. } => "add_capability",
3657            RealmRequest::AddCollection { .. } => "add_collection",
3658            RealmRequest::AddEnvironment { .. } => "add_environment",
3659            RealmRequest::SetConfigValue { .. } => "set_config_value",
3660        }
3661    }
3662}
3663
3664#[derive(Debug, Clone)]
3665pub struct RealmControlHandle {
3666    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3667}
3668
3669impl RealmControlHandle {
3670    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3671        self.inner.shutdown_with_epitaph(status.into())
3672    }
3673}
3674
3675impl fidl::endpoints::ControlHandle for RealmControlHandle {
3676    fn shutdown(&self) {
3677        self.inner.shutdown()
3678    }
3679
3680    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3681        self.inner.shutdown_with_epitaph(status)
3682    }
3683
3684    fn is_closed(&self) -> bool {
3685        self.inner.channel().is_closed()
3686    }
3687    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3688        self.inner.channel().on_closed()
3689    }
3690
3691    #[cfg(target_os = "fuchsia")]
3692    fn signal_peer(
3693        &self,
3694        clear_mask: zx::Signals,
3695        set_mask: zx::Signals,
3696    ) -> Result<(), zx_status::Status> {
3697        use fidl::Peered;
3698        self.inner.channel().signal_peer(clear_mask, set_mask)
3699    }
3700}
3701
3702impl RealmControlHandle {}
3703
3704#[must_use = "FIDL methods require a response to be sent"]
3705#[derive(Debug)]
3706pub struct RealmAddChildResponder {
3707    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
3708    tx_id: u32,
3709}
3710
3711/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
3712/// if the responder is dropped without sending a response, so that the client
3713/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3714impl std::ops::Drop for RealmAddChildResponder {
3715    fn drop(&mut self) {
3716        self.control_handle.shutdown();
3717        // Safety: drops once, never accessed again
3718        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3719    }
3720}
3721
3722impl fidl::endpoints::Responder for RealmAddChildResponder {
3723    type ControlHandle = RealmControlHandle;
3724
3725    fn control_handle(&self) -> &RealmControlHandle {
3726        &self.control_handle
3727    }
3728
3729    fn drop_without_shutdown(mut self) {
3730        // Safety: drops once, never accessed again due to mem::forget
3731        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3732        // Prevent Drop from running (which would shut down the channel)
3733        std::mem::forget(self);
3734    }
3735}
3736
3737impl RealmAddChildResponder {
3738    /// Sends a response to the FIDL transaction.
3739    ///
3740    /// Sets the channel to shutdown if an error occurs.
3741    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
3742        let _result = self.send_raw(result);
3743        if _result.is_err() {
3744            self.control_handle.shutdown();
3745        }
3746        self.drop_without_shutdown();
3747        _result
3748    }
3749
3750    /// Similar to "send" but does not shutdown the channel if an error occurs.
3751    pub fn send_no_shutdown_on_err(
3752        self,
3753        mut result: Result<(), RealmBuilderError>,
3754    ) -> Result<(), fidl::Error> {
3755        let _result = self.send_raw(result);
3756        self.drop_without_shutdown();
3757        _result
3758    }
3759
3760    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
3761        self.control_handle.inner.send::<fidl::encoding::ResultType<
3762            fidl::encoding::EmptyStruct,
3763            RealmBuilderError,
3764        >>(
3765            result,
3766            self.tx_id,
3767            0x3f6c07627303d801,
3768            fidl::encoding::DynamicFlags::empty(),
3769        )
3770    }
3771}
3772
3773#[must_use = "FIDL methods require a response to be sent"]
3774#[derive(Debug)]
3775pub struct RealmAddChildFromDeclResponder {
3776    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
3777    tx_id: u32,
3778}
3779
3780/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
3781/// if the responder is dropped without sending a response, so that the client
3782/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3783impl std::ops::Drop for RealmAddChildFromDeclResponder {
3784    fn drop(&mut self) {
3785        self.control_handle.shutdown();
3786        // Safety: drops once, never accessed again
3787        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3788    }
3789}
3790
3791impl fidl::endpoints::Responder for RealmAddChildFromDeclResponder {
3792    type ControlHandle = RealmControlHandle;
3793
3794    fn control_handle(&self) -> &RealmControlHandle {
3795        &self.control_handle
3796    }
3797
3798    fn drop_without_shutdown(mut self) {
3799        // Safety: drops once, never accessed again due to mem::forget
3800        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3801        // Prevent Drop from running (which would shut down the channel)
3802        std::mem::forget(self);
3803    }
3804}
3805
3806impl RealmAddChildFromDeclResponder {
3807    /// Sends a response to the FIDL transaction.
3808    ///
3809    /// Sets the channel to shutdown if an error occurs.
3810    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
3811        let _result = self.send_raw(result);
3812        if _result.is_err() {
3813            self.control_handle.shutdown();
3814        }
3815        self.drop_without_shutdown();
3816        _result
3817    }
3818
3819    /// Similar to "send" but does not shutdown the channel if an error occurs.
3820    pub fn send_no_shutdown_on_err(
3821        self,
3822        mut result: Result<(), RealmBuilderError>,
3823    ) -> Result<(), fidl::Error> {
3824        let _result = self.send_raw(result);
3825        self.drop_without_shutdown();
3826        _result
3827    }
3828
3829    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
3830        self.control_handle.inner.send::<fidl::encoding::ResultType<
3831            fidl::encoding::EmptyStruct,
3832            RealmBuilderError,
3833        >>(
3834            result,
3835            self.tx_id,
3836            0x3950ad500258156d,
3837            fidl::encoding::DynamicFlags::empty(),
3838        )
3839    }
3840}
3841
3842#[must_use = "FIDL methods require a response to be sent"]
3843#[derive(Debug)]
3844pub struct RealmAddLocalChildResponder {
3845    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
3846    tx_id: u32,
3847}
3848
3849/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
3850/// if the responder is dropped without sending a response, so that the client
3851/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3852impl std::ops::Drop for RealmAddLocalChildResponder {
3853    fn drop(&mut self) {
3854        self.control_handle.shutdown();
3855        // Safety: drops once, never accessed again
3856        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3857    }
3858}
3859
3860impl fidl::endpoints::Responder for RealmAddLocalChildResponder {
3861    type ControlHandle = RealmControlHandle;
3862
3863    fn control_handle(&self) -> &RealmControlHandle {
3864        &self.control_handle
3865    }
3866
3867    fn drop_without_shutdown(mut self) {
3868        // Safety: drops once, never accessed again due to mem::forget
3869        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3870        // Prevent Drop from running (which would shut down the channel)
3871        std::mem::forget(self);
3872    }
3873}
3874
3875impl RealmAddLocalChildResponder {
3876    /// Sends a response to the FIDL transaction.
3877    ///
3878    /// Sets the channel to shutdown if an error occurs.
3879    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
3880        let _result = self.send_raw(result);
3881        if _result.is_err() {
3882            self.control_handle.shutdown();
3883        }
3884        self.drop_without_shutdown();
3885        _result
3886    }
3887
3888    /// Similar to "send" but does not shutdown the channel if an error occurs.
3889    pub fn send_no_shutdown_on_err(
3890        self,
3891        mut result: Result<(), RealmBuilderError>,
3892    ) -> Result<(), fidl::Error> {
3893        let _result = self.send_raw(result);
3894        self.drop_without_shutdown();
3895        _result
3896    }
3897
3898    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
3899        self.control_handle.inner.send::<fidl::encoding::ResultType<
3900            fidl::encoding::EmptyStruct,
3901            RealmBuilderError,
3902        >>(
3903            result,
3904            self.tx_id,
3905            0x3249817bae10abbb,
3906            fidl::encoding::DynamicFlags::empty(),
3907        )
3908    }
3909}
3910
3911#[must_use = "FIDL methods require a response to be sent"]
3912#[derive(Debug)]
3913pub struct RealmAddChildRealmResponder {
3914    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
3915    tx_id: u32,
3916}
3917
3918/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
3919/// if the responder is dropped without sending a response, so that the client
3920/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3921impl std::ops::Drop for RealmAddChildRealmResponder {
3922    fn drop(&mut self) {
3923        self.control_handle.shutdown();
3924        // Safety: drops once, never accessed again
3925        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3926    }
3927}
3928
3929impl fidl::endpoints::Responder for RealmAddChildRealmResponder {
3930    type ControlHandle = RealmControlHandle;
3931
3932    fn control_handle(&self) -> &RealmControlHandle {
3933        &self.control_handle
3934    }
3935
3936    fn drop_without_shutdown(mut self) {
3937        // Safety: drops once, never accessed again due to mem::forget
3938        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3939        // Prevent Drop from running (which would shut down the channel)
3940        std::mem::forget(self);
3941    }
3942}
3943
3944impl RealmAddChildRealmResponder {
3945    /// Sends a response to the FIDL transaction.
3946    ///
3947    /// Sets the channel to shutdown if an error occurs.
3948    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
3949        let _result = self.send_raw(result);
3950        if _result.is_err() {
3951            self.control_handle.shutdown();
3952        }
3953        self.drop_without_shutdown();
3954        _result
3955    }
3956
3957    /// Similar to "send" but does not shutdown the channel if an error occurs.
3958    pub fn send_no_shutdown_on_err(
3959        self,
3960        mut result: Result<(), RealmBuilderError>,
3961    ) -> Result<(), fidl::Error> {
3962        let _result = self.send_raw(result);
3963        self.drop_without_shutdown();
3964        _result
3965    }
3966
3967    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
3968        self.control_handle.inner.send::<fidl::encoding::ResultType<
3969            fidl::encoding::EmptyStruct,
3970            RealmBuilderError,
3971        >>(
3972            result,
3973            self.tx_id,
3974            0x3fdf98db373b9458,
3975            fidl::encoding::DynamicFlags::empty(),
3976        )
3977    }
3978}
3979
3980#[must_use = "FIDL methods require a response to be sent"]
3981#[derive(Debug)]
3982pub struct RealmAddChildRealmFromRelativeUrlResponder {
3983    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
3984    tx_id: u32,
3985}
3986
3987/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
3988/// if the responder is dropped without sending a response, so that the client
3989/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3990impl std::ops::Drop for RealmAddChildRealmFromRelativeUrlResponder {
3991    fn drop(&mut self) {
3992        self.control_handle.shutdown();
3993        // Safety: drops once, never accessed again
3994        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3995    }
3996}
3997
3998impl fidl::endpoints::Responder for RealmAddChildRealmFromRelativeUrlResponder {
3999    type ControlHandle = RealmControlHandle;
4000
4001    fn control_handle(&self) -> &RealmControlHandle {
4002        &self.control_handle
4003    }
4004
4005    fn drop_without_shutdown(mut self) {
4006        // Safety: drops once, never accessed again due to mem::forget
4007        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4008        // Prevent Drop from running (which would shut down the channel)
4009        std::mem::forget(self);
4010    }
4011}
4012
4013impl RealmAddChildRealmFromRelativeUrlResponder {
4014    /// Sends a response to the FIDL transaction.
4015    ///
4016    /// Sets the channel to shutdown if an error occurs.
4017    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4018        let _result = self.send_raw(result);
4019        if _result.is_err() {
4020            self.control_handle.shutdown();
4021        }
4022        self.drop_without_shutdown();
4023        _result
4024    }
4025
4026    /// Similar to "send" but does not shutdown the channel if an error occurs.
4027    pub fn send_no_shutdown_on_err(
4028        self,
4029        mut result: Result<(), RealmBuilderError>,
4030    ) -> Result<(), fidl::Error> {
4031        let _result = self.send_raw(result);
4032        self.drop_without_shutdown();
4033        _result
4034    }
4035
4036    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4037        self.control_handle.inner.send::<fidl::encoding::ResultType<
4038            fidl::encoding::EmptyStruct,
4039            RealmBuilderError,
4040        >>(
4041            result,
4042            self.tx_id,
4043            0x44c34c8dcbe06abb,
4044            fidl::encoding::DynamicFlags::empty(),
4045        )
4046    }
4047}
4048
4049#[must_use = "FIDL methods require a response to be sent"]
4050#[derive(Debug)]
4051pub struct RealmAddChildRealmFromDeclResponder {
4052    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4053    tx_id: u32,
4054}
4055
4056/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4057/// if the responder is dropped without sending a response, so that the client
4058/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4059impl std::ops::Drop for RealmAddChildRealmFromDeclResponder {
4060    fn drop(&mut self) {
4061        self.control_handle.shutdown();
4062        // Safety: drops once, never accessed again
4063        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4064    }
4065}
4066
4067impl fidl::endpoints::Responder for RealmAddChildRealmFromDeclResponder {
4068    type ControlHandle = RealmControlHandle;
4069
4070    fn control_handle(&self) -> &RealmControlHandle {
4071        &self.control_handle
4072    }
4073
4074    fn drop_without_shutdown(mut self) {
4075        // Safety: drops once, never accessed again due to mem::forget
4076        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4077        // Prevent Drop from running (which would shut down the channel)
4078        std::mem::forget(self);
4079    }
4080}
4081
4082impl RealmAddChildRealmFromDeclResponder {
4083    /// Sends a response to the FIDL transaction.
4084    ///
4085    /// Sets the channel to shutdown if an error occurs.
4086    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4087        let _result = self.send_raw(result);
4088        if _result.is_err() {
4089            self.control_handle.shutdown();
4090        }
4091        self.drop_without_shutdown();
4092        _result
4093    }
4094
4095    /// Similar to "send" but does not shutdown the channel if an error occurs.
4096    pub fn send_no_shutdown_on_err(
4097        self,
4098        mut result: Result<(), RealmBuilderError>,
4099    ) -> Result<(), fidl::Error> {
4100        let _result = self.send_raw(result);
4101        self.drop_without_shutdown();
4102        _result
4103    }
4104
4105    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4106        self.control_handle.inner.send::<fidl::encoding::ResultType<
4107            fidl::encoding::EmptyStruct,
4108            RealmBuilderError,
4109        >>(
4110            result,
4111            self.tx_id,
4112            0x142e5c326732862e,
4113            fidl::encoding::DynamicFlags::empty(),
4114        )
4115    }
4116}
4117
4118#[must_use = "FIDL methods require a response to be sent"]
4119#[derive(Debug)]
4120pub struct RealmGetComponentDeclResponder {
4121    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4122    tx_id: u32,
4123}
4124
4125/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4126/// if the responder is dropped without sending a response, so that the client
4127/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4128impl std::ops::Drop for RealmGetComponentDeclResponder {
4129    fn drop(&mut self) {
4130        self.control_handle.shutdown();
4131        // Safety: drops once, never accessed again
4132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4133    }
4134}
4135
4136impl fidl::endpoints::Responder for RealmGetComponentDeclResponder {
4137    type ControlHandle = RealmControlHandle;
4138
4139    fn control_handle(&self) -> &RealmControlHandle {
4140        &self.control_handle
4141    }
4142
4143    fn drop_without_shutdown(mut self) {
4144        // Safety: drops once, never accessed again due to mem::forget
4145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4146        // Prevent Drop from running (which would shut down the channel)
4147        std::mem::forget(self);
4148    }
4149}
4150
4151impl RealmGetComponentDeclResponder {
4152    /// Sends a response to the FIDL transaction.
4153    ///
4154    /// Sets the channel to shutdown if an error occurs.
4155    pub fn send(
4156        self,
4157        mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
4158    ) -> Result<(), fidl::Error> {
4159        let _result = self.send_raw(result);
4160        if _result.is_err() {
4161            self.control_handle.shutdown();
4162        }
4163        self.drop_without_shutdown();
4164        _result
4165    }
4166
4167    /// Similar to "send" but does not shutdown the channel if an error occurs.
4168    pub fn send_no_shutdown_on_err(
4169        self,
4170        mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
4171    ) -> Result<(), fidl::Error> {
4172        let _result = self.send_raw(result);
4173        self.drop_without_shutdown();
4174        _result
4175    }
4176
4177    fn send_raw(
4178        &self,
4179        mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
4180    ) -> Result<(), fidl::Error> {
4181        self.control_handle.inner.send::<fidl::encoding::ResultType<
4182            RealmGetComponentDeclResponse,
4183            RealmBuilderError,
4184        >>(
4185            result.map(|component_decl| (component_decl,)),
4186            self.tx_id,
4187            0x320832af6a4cbac6,
4188            fidl::encoding::DynamicFlags::empty(),
4189        )
4190    }
4191}
4192
4193#[must_use = "FIDL methods require a response to be sent"]
4194#[derive(Debug)]
4195pub struct RealmReplaceComponentDeclResponder {
4196    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4197    tx_id: u32,
4198}
4199
4200/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4201/// if the responder is dropped without sending a response, so that the client
4202/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4203impl std::ops::Drop for RealmReplaceComponentDeclResponder {
4204    fn drop(&mut self) {
4205        self.control_handle.shutdown();
4206        // Safety: drops once, never accessed again
4207        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4208    }
4209}
4210
4211impl fidl::endpoints::Responder for RealmReplaceComponentDeclResponder {
4212    type ControlHandle = RealmControlHandle;
4213
4214    fn control_handle(&self) -> &RealmControlHandle {
4215        &self.control_handle
4216    }
4217
4218    fn drop_without_shutdown(mut self) {
4219        // Safety: drops once, never accessed again due to mem::forget
4220        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4221        // Prevent Drop from running (which would shut down the channel)
4222        std::mem::forget(self);
4223    }
4224}
4225
4226impl RealmReplaceComponentDeclResponder {
4227    /// Sends a response to the FIDL transaction.
4228    ///
4229    /// Sets the channel to shutdown if an error occurs.
4230    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4231        let _result = self.send_raw(result);
4232        if _result.is_err() {
4233            self.control_handle.shutdown();
4234        }
4235        self.drop_without_shutdown();
4236        _result
4237    }
4238
4239    /// Similar to "send" but does not shutdown the channel if an error occurs.
4240    pub fn send_no_shutdown_on_err(
4241        self,
4242        mut result: Result<(), RealmBuilderError>,
4243    ) -> Result<(), fidl::Error> {
4244        let _result = self.send_raw(result);
4245        self.drop_without_shutdown();
4246        _result
4247    }
4248
4249    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4250        self.control_handle.inner.send::<fidl::encoding::ResultType<
4251            fidl::encoding::EmptyStruct,
4252            RealmBuilderError,
4253        >>(
4254            result,
4255            self.tx_id,
4256            0x59cecf31b314cd5f,
4257            fidl::encoding::DynamicFlags::empty(),
4258        )
4259    }
4260}
4261
4262#[must_use = "FIDL methods require a response to be sent"]
4263#[derive(Debug)]
4264pub struct RealmGetRealmDeclResponder {
4265    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4266    tx_id: u32,
4267}
4268
4269/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4270/// if the responder is dropped without sending a response, so that the client
4271/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4272impl std::ops::Drop for RealmGetRealmDeclResponder {
4273    fn drop(&mut self) {
4274        self.control_handle.shutdown();
4275        // Safety: drops once, never accessed again
4276        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4277    }
4278}
4279
4280impl fidl::endpoints::Responder for RealmGetRealmDeclResponder {
4281    type ControlHandle = RealmControlHandle;
4282
4283    fn control_handle(&self) -> &RealmControlHandle {
4284        &self.control_handle
4285    }
4286
4287    fn drop_without_shutdown(mut self) {
4288        // Safety: drops once, never accessed again due to mem::forget
4289        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4290        // Prevent Drop from running (which would shut down the channel)
4291        std::mem::forget(self);
4292    }
4293}
4294
4295impl RealmGetRealmDeclResponder {
4296    /// Sends a response to the FIDL transaction.
4297    ///
4298    /// Sets the channel to shutdown if an error occurs.
4299    pub fn send(
4300        self,
4301        mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
4302    ) -> Result<(), fidl::Error> {
4303        let _result = self.send_raw(result);
4304        if _result.is_err() {
4305            self.control_handle.shutdown();
4306        }
4307        self.drop_without_shutdown();
4308        _result
4309    }
4310
4311    /// Similar to "send" but does not shutdown the channel if an error occurs.
4312    pub fn send_no_shutdown_on_err(
4313        self,
4314        mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
4315    ) -> Result<(), fidl::Error> {
4316        let _result = self.send_raw(result);
4317        self.drop_without_shutdown();
4318        _result
4319    }
4320
4321    fn send_raw(
4322        &self,
4323        mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
4324    ) -> Result<(), fidl::Error> {
4325        self.control_handle.inner.send::<fidl::encoding::ResultType<
4326            RealmGetRealmDeclResponse,
4327            RealmBuilderError,
4328        >>(
4329            result.map(|component_decl| (component_decl,)),
4330            self.tx_id,
4331            0x46fa05b17bd64269,
4332            fidl::encoding::DynamicFlags::empty(),
4333        )
4334    }
4335}
4336
4337#[must_use = "FIDL methods require a response to be sent"]
4338#[derive(Debug)]
4339pub struct RealmReplaceRealmDeclResponder {
4340    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4341    tx_id: u32,
4342}
4343
4344/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4345/// if the responder is dropped without sending a response, so that the client
4346/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4347impl std::ops::Drop for RealmReplaceRealmDeclResponder {
4348    fn drop(&mut self) {
4349        self.control_handle.shutdown();
4350        // Safety: drops once, never accessed again
4351        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4352    }
4353}
4354
4355impl fidl::endpoints::Responder for RealmReplaceRealmDeclResponder {
4356    type ControlHandle = RealmControlHandle;
4357
4358    fn control_handle(&self) -> &RealmControlHandle {
4359        &self.control_handle
4360    }
4361
4362    fn drop_without_shutdown(mut self) {
4363        // Safety: drops once, never accessed again due to mem::forget
4364        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4365        // Prevent Drop from running (which would shut down the channel)
4366        std::mem::forget(self);
4367    }
4368}
4369
4370impl RealmReplaceRealmDeclResponder {
4371    /// Sends a response to the FIDL transaction.
4372    ///
4373    /// Sets the channel to shutdown if an error occurs.
4374    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4375        let _result = self.send_raw(result);
4376        if _result.is_err() {
4377            self.control_handle.shutdown();
4378        }
4379        self.drop_without_shutdown();
4380        _result
4381    }
4382
4383    /// Similar to "send" but does not shutdown the channel if an error occurs.
4384    pub fn send_no_shutdown_on_err(
4385        self,
4386        mut result: Result<(), RealmBuilderError>,
4387    ) -> Result<(), fidl::Error> {
4388        let _result = self.send_raw(result);
4389        self.drop_without_shutdown();
4390        _result
4391    }
4392
4393    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4394        self.control_handle.inner.send::<fidl::encoding::ResultType<
4395            fidl::encoding::EmptyStruct,
4396            RealmBuilderError,
4397        >>(
4398            result,
4399            self.tx_id,
4400            0x48fcba4ac1338da9,
4401            fidl::encoding::DynamicFlags::empty(),
4402        )
4403    }
4404}
4405
4406#[must_use = "FIDL methods require a response to be sent"]
4407#[derive(Debug)]
4408pub struct RealmUseNestedComponentManagerResponder {
4409    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4410    tx_id: u32,
4411}
4412
4413/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4414/// if the responder is dropped without sending a response, so that the client
4415/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4416impl std::ops::Drop for RealmUseNestedComponentManagerResponder {
4417    fn drop(&mut self) {
4418        self.control_handle.shutdown();
4419        // Safety: drops once, never accessed again
4420        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4421    }
4422}
4423
4424impl fidl::endpoints::Responder for RealmUseNestedComponentManagerResponder {
4425    type ControlHandle = RealmControlHandle;
4426
4427    fn control_handle(&self) -> &RealmControlHandle {
4428        &self.control_handle
4429    }
4430
4431    fn drop_without_shutdown(mut self) {
4432        // Safety: drops once, never accessed again due to mem::forget
4433        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4434        // Prevent Drop from running (which would shut down the channel)
4435        std::mem::forget(self);
4436    }
4437}
4438
4439impl RealmUseNestedComponentManagerResponder {
4440    /// Sends a response to the FIDL transaction.
4441    ///
4442    /// Sets the channel to shutdown if an error occurs.
4443    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4444        let _result = self.send_raw(result);
4445        if _result.is_err() {
4446            self.control_handle.shutdown();
4447        }
4448        self.drop_without_shutdown();
4449        _result
4450    }
4451
4452    /// Similar to "send" but does not shutdown the channel if an error occurs.
4453    pub fn send_no_shutdown_on_err(
4454        self,
4455        mut result: Result<(), RealmBuilderError>,
4456    ) -> Result<(), fidl::Error> {
4457        let _result = self.send_raw(result);
4458        self.drop_without_shutdown();
4459        _result
4460    }
4461
4462    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4463        self.control_handle.inner.send::<fidl::encoding::ResultType<
4464            fidl::encoding::EmptyStruct,
4465            RealmBuilderError,
4466        >>(
4467            result,
4468            self.tx_id,
4469            0x64bd27482f3dcc,
4470            fidl::encoding::DynamicFlags::empty(),
4471        )
4472    }
4473}
4474
4475#[must_use = "FIDL methods require a response to be sent"]
4476#[derive(Debug)]
4477pub struct RealmAddRouteResponder {
4478    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4479    tx_id: u32,
4480}
4481
4482/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4483/// if the responder is dropped without sending a response, so that the client
4484/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4485impl std::ops::Drop for RealmAddRouteResponder {
4486    fn drop(&mut self) {
4487        self.control_handle.shutdown();
4488        // Safety: drops once, never accessed again
4489        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4490    }
4491}
4492
4493impl fidl::endpoints::Responder for RealmAddRouteResponder {
4494    type ControlHandle = RealmControlHandle;
4495
4496    fn control_handle(&self) -> &RealmControlHandle {
4497        &self.control_handle
4498    }
4499
4500    fn drop_without_shutdown(mut self) {
4501        // Safety: drops once, never accessed again due to mem::forget
4502        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4503        // Prevent Drop from running (which would shut down the channel)
4504        std::mem::forget(self);
4505    }
4506}
4507
4508impl RealmAddRouteResponder {
4509    /// Sends a response to the FIDL transaction.
4510    ///
4511    /// Sets the channel to shutdown if an error occurs.
4512    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4513        let _result = self.send_raw(result);
4514        if _result.is_err() {
4515            self.control_handle.shutdown();
4516        }
4517        self.drop_without_shutdown();
4518        _result
4519    }
4520
4521    /// Similar to "send" but does not shutdown the channel if an error occurs.
4522    pub fn send_no_shutdown_on_err(
4523        self,
4524        mut result: Result<(), RealmBuilderError>,
4525    ) -> Result<(), fidl::Error> {
4526        let _result = self.send_raw(result);
4527        self.drop_without_shutdown();
4528        _result
4529    }
4530
4531    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4532        self.control_handle.inner.send::<fidl::encoding::ResultType<
4533            fidl::encoding::EmptyStruct,
4534            RealmBuilderError,
4535        >>(
4536            result,
4537            self.tx_id,
4538            0x9d523295be53a0a,
4539            fidl::encoding::DynamicFlags::empty(),
4540        )
4541    }
4542}
4543
4544#[must_use = "FIDL methods require a response to be sent"]
4545#[derive(Debug)]
4546pub struct RealmAddRouteFromDictionaryResponder {
4547    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4548    tx_id: u32,
4549}
4550
4551/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4552/// if the responder is dropped without sending a response, so that the client
4553/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4554impl std::ops::Drop for RealmAddRouteFromDictionaryResponder {
4555    fn drop(&mut self) {
4556        self.control_handle.shutdown();
4557        // Safety: drops once, never accessed again
4558        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4559    }
4560}
4561
4562impl fidl::endpoints::Responder for RealmAddRouteFromDictionaryResponder {
4563    type ControlHandle = RealmControlHandle;
4564
4565    fn control_handle(&self) -> &RealmControlHandle {
4566        &self.control_handle
4567    }
4568
4569    fn drop_without_shutdown(mut self) {
4570        // Safety: drops once, never accessed again due to mem::forget
4571        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4572        // Prevent Drop from running (which would shut down the channel)
4573        std::mem::forget(self);
4574    }
4575}
4576
4577impl RealmAddRouteFromDictionaryResponder {
4578    /// Sends a response to the FIDL transaction.
4579    ///
4580    /// Sets the channel to shutdown if an error occurs.
4581    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4582        let _result = self.send_raw(result);
4583        if _result.is_err() {
4584            self.control_handle.shutdown();
4585        }
4586        self.drop_without_shutdown();
4587        _result
4588    }
4589
4590    /// Similar to "send" but does not shutdown the channel if an error occurs.
4591    pub fn send_no_shutdown_on_err(
4592        self,
4593        mut result: Result<(), RealmBuilderError>,
4594    ) -> Result<(), fidl::Error> {
4595        let _result = self.send_raw(result);
4596        self.drop_without_shutdown();
4597        _result
4598    }
4599
4600    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4601        self.control_handle.inner.send::<fidl::encoding::ResultType<
4602            fidl::encoding::EmptyStruct,
4603            RealmBuilderError,
4604        >>(
4605            result,
4606            self.tx_id,
4607            0x21fac42c3e1d14d2,
4608            fidl::encoding::DynamicFlags::empty(),
4609        )
4610    }
4611}
4612
4613#[must_use = "FIDL methods require a response to be sent"]
4614#[derive(Debug)]
4615pub struct RealmReadOnlyDirectoryResponder {
4616    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4617    tx_id: u32,
4618}
4619
4620/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4621/// if the responder is dropped without sending a response, so that the client
4622/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4623impl std::ops::Drop for RealmReadOnlyDirectoryResponder {
4624    fn drop(&mut self) {
4625        self.control_handle.shutdown();
4626        // Safety: drops once, never accessed again
4627        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4628    }
4629}
4630
4631impl fidl::endpoints::Responder for RealmReadOnlyDirectoryResponder {
4632    type ControlHandle = RealmControlHandle;
4633
4634    fn control_handle(&self) -> &RealmControlHandle {
4635        &self.control_handle
4636    }
4637
4638    fn drop_without_shutdown(mut self) {
4639        // Safety: drops once, never accessed again due to mem::forget
4640        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4641        // Prevent Drop from running (which would shut down the channel)
4642        std::mem::forget(self);
4643    }
4644}
4645
4646impl RealmReadOnlyDirectoryResponder {
4647    /// Sends a response to the FIDL transaction.
4648    ///
4649    /// Sets the channel to shutdown if an error occurs.
4650    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4651        let _result = self.send_raw(result);
4652        if _result.is_err() {
4653            self.control_handle.shutdown();
4654        }
4655        self.drop_without_shutdown();
4656        _result
4657    }
4658
4659    /// Similar to "send" but does not shutdown the channel if an error occurs.
4660    pub fn send_no_shutdown_on_err(
4661        self,
4662        mut result: Result<(), RealmBuilderError>,
4663    ) -> Result<(), fidl::Error> {
4664        let _result = self.send_raw(result);
4665        self.drop_without_shutdown();
4666        _result
4667    }
4668
4669    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4670        self.control_handle.inner.send::<fidl::encoding::ResultType<
4671            fidl::encoding::EmptyStruct,
4672            RealmBuilderError,
4673        >>(
4674            result,
4675            self.tx_id,
4676            0x78a6d150a66e00dc,
4677            fidl::encoding::DynamicFlags::empty(),
4678        )
4679    }
4680}
4681
4682#[must_use = "FIDL methods require a response to be sent"]
4683#[derive(Debug)]
4684pub struct RealmAddStorageResponder {
4685    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4686    tx_id: u32,
4687}
4688
4689/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4690/// if the responder is dropped without sending a response, so that the client
4691/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4692impl std::ops::Drop for RealmAddStorageResponder {
4693    fn drop(&mut self) {
4694        self.control_handle.shutdown();
4695        // Safety: drops once, never accessed again
4696        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4697    }
4698}
4699
4700impl fidl::endpoints::Responder for RealmAddStorageResponder {
4701    type ControlHandle = RealmControlHandle;
4702
4703    fn control_handle(&self) -> &RealmControlHandle {
4704        &self.control_handle
4705    }
4706
4707    fn drop_without_shutdown(mut self) {
4708        // Safety: drops once, never accessed again due to mem::forget
4709        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4710        // Prevent Drop from running (which would shut down the channel)
4711        std::mem::forget(self);
4712    }
4713}
4714
4715impl RealmAddStorageResponder {
4716    /// Sends a response to the FIDL transaction.
4717    ///
4718    /// Sets the channel to shutdown if an error occurs.
4719    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4720        let _result = self.send_raw(result);
4721        if _result.is_err() {
4722            self.control_handle.shutdown();
4723        }
4724        self.drop_without_shutdown();
4725        _result
4726    }
4727
4728    /// Similar to "send" but does not shutdown the channel if an error occurs.
4729    pub fn send_no_shutdown_on_err(
4730        self,
4731        mut result: Result<(), RealmBuilderError>,
4732    ) -> Result<(), fidl::Error> {
4733        let _result = self.send_raw(result);
4734        self.drop_without_shutdown();
4735        _result
4736    }
4737
4738    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4739        self.control_handle.inner.send::<fidl::encoding::ResultType<
4740            fidl::encoding::EmptyStruct,
4741            RealmBuilderError,
4742        >>(
4743            result,
4744            self.tx_id,
4745            0x4709da0c9576b7c1,
4746            fidl::encoding::DynamicFlags::empty(),
4747        )
4748    }
4749}
4750
4751#[must_use = "FIDL methods require a response to be sent"]
4752#[derive(Debug)]
4753pub struct RealmInitMutableConfigFromPackageResponder {
4754    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4755    tx_id: u32,
4756}
4757
4758/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4759/// if the responder is dropped without sending a response, so that the client
4760/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4761impl std::ops::Drop for RealmInitMutableConfigFromPackageResponder {
4762    fn drop(&mut self) {
4763        self.control_handle.shutdown();
4764        // Safety: drops once, never accessed again
4765        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4766    }
4767}
4768
4769impl fidl::endpoints::Responder for RealmInitMutableConfigFromPackageResponder {
4770    type ControlHandle = RealmControlHandle;
4771
4772    fn control_handle(&self) -> &RealmControlHandle {
4773        &self.control_handle
4774    }
4775
4776    fn drop_without_shutdown(mut self) {
4777        // Safety: drops once, never accessed again due to mem::forget
4778        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4779        // Prevent Drop from running (which would shut down the channel)
4780        std::mem::forget(self);
4781    }
4782}
4783
4784impl RealmInitMutableConfigFromPackageResponder {
4785    /// Sends a response to the FIDL transaction.
4786    ///
4787    /// Sets the channel to shutdown if an error occurs.
4788    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4789        let _result = self.send_raw(result);
4790        if _result.is_err() {
4791            self.control_handle.shutdown();
4792        }
4793        self.drop_without_shutdown();
4794        _result
4795    }
4796
4797    /// Similar to "send" but does not shutdown the channel if an error occurs.
4798    pub fn send_no_shutdown_on_err(
4799        self,
4800        mut result: Result<(), RealmBuilderError>,
4801    ) -> Result<(), fidl::Error> {
4802        let _result = self.send_raw(result);
4803        self.drop_without_shutdown();
4804        _result
4805    }
4806
4807    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4808        self.control_handle.inner.send::<fidl::encoding::ResultType<
4809            fidl::encoding::EmptyStruct,
4810            RealmBuilderError,
4811        >>(
4812            result,
4813            self.tx_id,
4814            0x36a30c9837c64216,
4815            fidl::encoding::DynamicFlags::empty(),
4816        )
4817    }
4818}
4819
4820#[must_use = "FIDL methods require a response to be sent"]
4821#[derive(Debug)]
4822pub struct RealmInitMutableConfigToEmptyResponder {
4823    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4824    tx_id: u32,
4825}
4826
4827/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4828/// if the responder is dropped without sending a response, so that the client
4829/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4830impl std::ops::Drop for RealmInitMutableConfigToEmptyResponder {
4831    fn drop(&mut self) {
4832        self.control_handle.shutdown();
4833        // Safety: drops once, never accessed again
4834        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4835    }
4836}
4837
4838impl fidl::endpoints::Responder for RealmInitMutableConfigToEmptyResponder {
4839    type ControlHandle = RealmControlHandle;
4840
4841    fn control_handle(&self) -> &RealmControlHandle {
4842        &self.control_handle
4843    }
4844
4845    fn drop_without_shutdown(mut self) {
4846        // Safety: drops once, never accessed again due to mem::forget
4847        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4848        // Prevent Drop from running (which would shut down the channel)
4849        std::mem::forget(self);
4850    }
4851}
4852
4853impl RealmInitMutableConfigToEmptyResponder {
4854    /// Sends a response to the FIDL transaction.
4855    ///
4856    /// Sets the channel to shutdown if an error occurs.
4857    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4858        let _result = self.send_raw(result);
4859        if _result.is_err() {
4860            self.control_handle.shutdown();
4861        }
4862        self.drop_without_shutdown();
4863        _result
4864    }
4865
4866    /// Similar to "send" but does not shutdown the channel if an error occurs.
4867    pub fn send_no_shutdown_on_err(
4868        self,
4869        mut result: Result<(), RealmBuilderError>,
4870    ) -> Result<(), fidl::Error> {
4871        let _result = self.send_raw(result);
4872        self.drop_without_shutdown();
4873        _result
4874    }
4875
4876    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4877        self.control_handle.inner.send::<fidl::encoding::ResultType<
4878            fidl::encoding::EmptyStruct,
4879            RealmBuilderError,
4880        >>(
4881            result,
4882            self.tx_id,
4883            0x772cb99e2e0dccc5,
4884            fidl::encoding::DynamicFlags::empty(),
4885        )
4886    }
4887}
4888
4889#[must_use = "FIDL methods require a response to be sent"]
4890#[derive(Debug)]
4891pub struct RealmAddCapabilityResponder {
4892    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4893    tx_id: u32,
4894}
4895
4896/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4897/// if the responder is dropped without sending a response, so that the client
4898/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4899impl std::ops::Drop for RealmAddCapabilityResponder {
4900    fn drop(&mut self) {
4901        self.control_handle.shutdown();
4902        // Safety: drops once, never accessed again
4903        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4904    }
4905}
4906
4907impl fidl::endpoints::Responder for RealmAddCapabilityResponder {
4908    type ControlHandle = RealmControlHandle;
4909
4910    fn control_handle(&self) -> &RealmControlHandle {
4911        &self.control_handle
4912    }
4913
4914    fn drop_without_shutdown(mut self) {
4915        // Safety: drops once, never accessed again due to mem::forget
4916        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4917        // Prevent Drop from running (which would shut down the channel)
4918        std::mem::forget(self);
4919    }
4920}
4921
4922impl RealmAddCapabilityResponder {
4923    /// Sends a response to the FIDL transaction.
4924    ///
4925    /// Sets the channel to shutdown if an error occurs.
4926    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4927        let _result = self.send_raw(result);
4928        if _result.is_err() {
4929            self.control_handle.shutdown();
4930        }
4931        self.drop_without_shutdown();
4932        _result
4933    }
4934
4935    /// Similar to "send" but does not shutdown the channel if an error occurs.
4936    pub fn send_no_shutdown_on_err(
4937        self,
4938        mut result: Result<(), RealmBuilderError>,
4939    ) -> Result<(), fidl::Error> {
4940        let _result = self.send_raw(result);
4941        self.drop_without_shutdown();
4942        _result
4943    }
4944
4945    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4946        self.control_handle.inner.send::<fidl::encoding::ResultType<
4947            fidl::encoding::EmptyStruct,
4948            RealmBuilderError,
4949        >>(
4950            result,
4951            self.tx_id,
4952            0x23a6499eb6080249,
4953            fidl::encoding::DynamicFlags::empty(),
4954        )
4955    }
4956}
4957
4958#[must_use = "FIDL methods require a response to be sent"]
4959#[derive(Debug)]
4960pub struct RealmAddCollectionResponder {
4961    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
4962    tx_id: u32,
4963}
4964
4965/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
4966/// if the responder is dropped without sending a response, so that the client
4967/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4968impl std::ops::Drop for RealmAddCollectionResponder {
4969    fn drop(&mut self) {
4970        self.control_handle.shutdown();
4971        // Safety: drops once, never accessed again
4972        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4973    }
4974}
4975
4976impl fidl::endpoints::Responder for RealmAddCollectionResponder {
4977    type ControlHandle = RealmControlHandle;
4978
4979    fn control_handle(&self) -> &RealmControlHandle {
4980        &self.control_handle
4981    }
4982
4983    fn drop_without_shutdown(mut self) {
4984        // Safety: drops once, never accessed again due to mem::forget
4985        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4986        // Prevent Drop from running (which would shut down the channel)
4987        std::mem::forget(self);
4988    }
4989}
4990
4991impl RealmAddCollectionResponder {
4992    /// Sends a response to the FIDL transaction.
4993    ///
4994    /// Sets the channel to shutdown if an error occurs.
4995    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
4996        let _result = self.send_raw(result);
4997        if _result.is_err() {
4998            self.control_handle.shutdown();
4999        }
5000        self.drop_without_shutdown();
5001        _result
5002    }
5003
5004    /// Similar to "send" but does not shutdown the channel if an error occurs.
5005    pub fn send_no_shutdown_on_err(
5006        self,
5007        mut result: Result<(), RealmBuilderError>,
5008    ) -> Result<(), fidl::Error> {
5009        let _result = self.send_raw(result);
5010        self.drop_without_shutdown();
5011        _result
5012    }
5013
5014    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
5015        self.control_handle.inner.send::<fidl::encoding::ResultType<
5016            fidl::encoding::EmptyStruct,
5017            RealmBuilderError,
5018        >>(
5019            result,
5020            self.tx_id,
5021            0x56b75210a03a99b5,
5022            fidl::encoding::DynamicFlags::empty(),
5023        )
5024    }
5025}
5026
5027#[must_use = "FIDL methods require a response to be sent"]
5028#[derive(Debug)]
5029pub struct RealmAddEnvironmentResponder {
5030    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5031    tx_id: u32,
5032}
5033
5034/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5035/// if the responder is dropped without sending a response, so that the client
5036/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5037impl std::ops::Drop for RealmAddEnvironmentResponder {
5038    fn drop(&mut self) {
5039        self.control_handle.shutdown();
5040        // Safety: drops once, never accessed again
5041        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5042    }
5043}
5044
5045impl fidl::endpoints::Responder for RealmAddEnvironmentResponder {
5046    type ControlHandle = RealmControlHandle;
5047
5048    fn control_handle(&self) -> &RealmControlHandle {
5049        &self.control_handle
5050    }
5051
5052    fn drop_without_shutdown(mut self) {
5053        // Safety: drops once, never accessed again due to mem::forget
5054        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5055        // Prevent Drop from running (which would shut down the channel)
5056        std::mem::forget(self);
5057    }
5058}
5059
5060impl RealmAddEnvironmentResponder {
5061    /// Sends a response to the FIDL transaction.
5062    ///
5063    /// Sets the channel to shutdown if an error occurs.
5064    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
5065        let _result = self.send_raw(result);
5066        if _result.is_err() {
5067            self.control_handle.shutdown();
5068        }
5069        self.drop_without_shutdown();
5070        _result
5071    }
5072
5073    /// Similar to "send" but does not shutdown the channel if an error occurs.
5074    pub fn send_no_shutdown_on_err(
5075        self,
5076        mut result: Result<(), RealmBuilderError>,
5077    ) -> Result<(), fidl::Error> {
5078        let _result = self.send_raw(result);
5079        self.drop_without_shutdown();
5080        _result
5081    }
5082
5083    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
5084        self.control_handle.inner.send::<fidl::encoding::ResultType<
5085            fidl::encoding::EmptyStruct,
5086            RealmBuilderError,
5087        >>(
5088            result,
5089            self.tx_id,
5090            0x1cd7caefa2cce0e9,
5091            fidl::encoding::DynamicFlags::empty(),
5092        )
5093    }
5094}
5095
5096#[must_use = "FIDL methods require a response to be sent"]
5097#[derive(Debug)]
5098pub struct RealmSetConfigValueResponder {
5099    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
5100    tx_id: u32,
5101}
5102
5103/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
5104/// if the responder is dropped without sending a response, so that the client
5105/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5106impl std::ops::Drop for RealmSetConfigValueResponder {
5107    fn drop(&mut self) {
5108        self.control_handle.shutdown();
5109        // Safety: drops once, never accessed again
5110        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5111    }
5112}
5113
5114impl fidl::endpoints::Responder for RealmSetConfigValueResponder {
5115    type ControlHandle = RealmControlHandle;
5116
5117    fn control_handle(&self) -> &RealmControlHandle {
5118        &self.control_handle
5119    }
5120
5121    fn drop_without_shutdown(mut self) {
5122        // Safety: drops once, never accessed again due to mem::forget
5123        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5124        // Prevent Drop from running (which would shut down the channel)
5125        std::mem::forget(self);
5126    }
5127}
5128
5129impl RealmSetConfigValueResponder {
5130    /// Sends a response to the FIDL transaction.
5131    ///
5132    /// Sets the channel to shutdown if an error occurs.
5133    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
5134        let _result = self.send_raw(result);
5135        if _result.is_err() {
5136            self.control_handle.shutdown();
5137        }
5138        self.drop_without_shutdown();
5139        _result
5140    }
5141
5142    /// Similar to "send" but does not shutdown the channel if an error occurs.
5143    pub fn send_no_shutdown_on_err(
5144        self,
5145        mut result: Result<(), RealmBuilderError>,
5146    ) -> Result<(), fidl::Error> {
5147        let _result = self.send_raw(result);
5148        self.drop_without_shutdown();
5149        _result
5150    }
5151
5152    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
5153        self.control_handle.inner.send::<fidl::encoding::ResultType<
5154            fidl::encoding::EmptyStruct,
5155            RealmBuilderError,
5156        >>(
5157            result,
5158            self.tx_id,
5159            0x886450d291217f2,
5160            fidl::encoding::DynamicFlags::empty(),
5161        )
5162    }
5163}
5164
5165#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5166pub struct RealmBuilderFactoryMarker;
5167
5168impl fidl::endpoints::ProtocolMarker for RealmBuilderFactoryMarker {
5169    type Proxy = RealmBuilderFactoryProxy;
5170    type RequestStream = RealmBuilderFactoryRequestStream;
5171    #[cfg(target_os = "fuchsia")]
5172    type SynchronousProxy = RealmBuilderFactorySynchronousProxy;
5173
5174    const DEBUG_NAME: &'static str = "fuchsia.component.test.RealmBuilderFactory";
5175}
5176impl fidl::endpoints::DiscoverableProtocolMarker for RealmBuilderFactoryMarker {}
5177pub type RealmBuilderFactoryCreateResult = Result<(), RealmBuilderError>;
5178pub type RealmBuilderFactoryCreateFromRelativeUrlResult = Result<(), RealmBuilderError>;
5179
5180pub trait RealmBuilderFactoryProxyInterface: Send + Sync {
5181    type CreateResponseFut: std::future::Future<Output = Result<RealmBuilderFactoryCreateResult, fidl::Error>>
5182        + Send;
5183    fn r#create(
5184        &self,
5185        pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5186        realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5187        builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5188    ) -> Self::CreateResponseFut;
5189    type CreateFromRelativeUrlResponseFut: std::future::Future<
5190            Output = Result<RealmBuilderFactoryCreateFromRelativeUrlResult, fidl::Error>,
5191        > + Send;
5192    fn r#create_from_relative_url(
5193        &self,
5194        pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5195        relative_url: &str,
5196        realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5197        builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5198    ) -> Self::CreateFromRelativeUrlResponseFut;
5199}
5200#[derive(Debug)]
5201#[cfg(target_os = "fuchsia")]
5202pub struct RealmBuilderFactorySynchronousProxy {
5203    client: fidl::client::sync::Client,
5204}
5205
5206#[cfg(target_os = "fuchsia")]
5207impl fidl::endpoints::SynchronousProxy for RealmBuilderFactorySynchronousProxy {
5208    type Proxy = RealmBuilderFactoryProxy;
5209    type Protocol = RealmBuilderFactoryMarker;
5210
5211    fn from_channel(inner: fidl::Channel) -> Self {
5212        Self::new(inner)
5213    }
5214
5215    fn into_channel(self) -> fidl::Channel {
5216        self.client.into_channel()
5217    }
5218
5219    fn as_channel(&self) -> &fidl::Channel {
5220        self.client.as_channel()
5221    }
5222}
5223
5224#[cfg(target_os = "fuchsia")]
5225impl RealmBuilderFactorySynchronousProxy {
5226    pub fn new(channel: fidl::Channel) -> Self {
5227        Self { client: fidl::client::sync::Client::new(channel) }
5228    }
5229
5230    pub fn into_channel(self) -> fidl::Channel {
5231        self.client.into_channel()
5232    }
5233
5234    /// Waits until an event arrives and returns it. It is safe for other
5235    /// threads to make concurrent requests while waiting for an event.
5236    pub fn wait_for_event(
5237        &self,
5238        deadline: zx::MonotonicInstant,
5239    ) -> Result<RealmBuilderFactoryEvent, fidl::Error> {
5240        RealmBuilderFactoryEvent::decode(
5241            self.client.wait_for_event::<RealmBuilderFactoryMarker>(deadline)?,
5242        )
5243    }
5244
5245    /// Creates a new RealmBuilder. The client end of `realm_server_end` can be
5246    /// used to mutate the realm that is being constructed, by doing things such
5247    /// as adding new children to the realm or adding capability routes between
5248    /// them. The client end of `builder_server_end` is used to finalize the
5249    /// realm, after which point it can be launched in a collection.
5250    ///
5251    /// `pkg_dir_handle` is a handle to the test package. The realm builder
5252    /// client typically passes a handle to its own `/pkg` directory, and
5253    /// bundles the `other-component` into the same package.
5254    pub fn r#create(
5255        &self,
5256        mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5257        mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5258        mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5259        ___deadline: zx::MonotonicInstant,
5260    ) -> Result<RealmBuilderFactoryCreateResult, fidl::Error> {
5261        let _response =
5262            self.client.send_query::<RealmBuilderFactoryCreateRequest, fidl::encoding::ResultType<
5263                fidl::encoding::EmptyStruct,
5264                RealmBuilderError,
5265            >, RealmBuilderFactoryMarker>(
5266                (pkg_dir_handle, realm_server_end, builder_server_end),
5267                0x73528b1135cb01be,
5268                fidl::encoding::DynamicFlags::empty(),
5269                ___deadline,
5270            )?;
5271        Ok(_response.map(|x| x))
5272    }
5273
5274    /// Identical to `Create`, but instead of the realm being empty by default
5275    /// it contains the contents of the manifest located in the test package at
5276    /// the path indicated by `relative_url`, which must be a fragment-only URL
5277    /// (for example, `#meta/other-component.cm`; see
5278    /// https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only).
5279    pub fn r#create_from_relative_url(
5280        &self,
5281        mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5282        mut relative_url: &str,
5283        mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5284        mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5285        ___deadline: zx::MonotonicInstant,
5286    ) -> Result<RealmBuilderFactoryCreateFromRelativeUrlResult, fidl::Error> {
5287        let _response = self.client.send_query::<
5288            RealmBuilderFactoryCreateFromRelativeUrlRequest,
5289            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
5290            RealmBuilderFactoryMarker,
5291        >(
5292            (pkg_dir_handle, relative_url, realm_server_end, builder_server_end,),
5293            0x1cafd9042c54a86b,
5294            fidl::encoding::DynamicFlags::empty(),
5295            ___deadline,
5296        )?;
5297        Ok(_response.map(|x| x))
5298    }
5299}
5300
5301#[cfg(target_os = "fuchsia")]
5302impl From<RealmBuilderFactorySynchronousProxy> for zx::NullableHandle {
5303    fn from(value: RealmBuilderFactorySynchronousProxy) -> Self {
5304        value.into_channel().into()
5305    }
5306}
5307
5308#[cfg(target_os = "fuchsia")]
5309impl From<fidl::Channel> for RealmBuilderFactorySynchronousProxy {
5310    fn from(value: fidl::Channel) -> Self {
5311        Self::new(value)
5312    }
5313}
5314
5315#[cfg(target_os = "fuchsia")]
5316impl fidl::endpoints::FromClient for RealmBuilderFactorySynchronousProxy {
5317    type Protocol = RealmBuilderFactoryMarker;
5318
5319    fn from_client(value: fidl::endpoints::ClientEnd<RealmBuilderFactoryMarker>) -> Self {
5320        Self::new(value.into_channel())
5321    }
5322}
5323
5324#[derive(Debug, Clone)]
5325pub struct RealmBuilderFactoryProxy {
5326    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5327}
5328
5329impl fidl::endpoints::Proxy for RealmBuilderFactoryProxy {
5330    type Protocol = RealmBuilderFactoryMarker;
5331
5332    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5333        Self::new(inner)
5334    }
5335
5336    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5337        self.client.into_channel().map_err(|client| Self { client })
5338    }
5339
5340    fn as_channel(&self) -> &::fidl::AsyncChannel {
5341        self.client.as_channel()
5342    }
5343}
5344
5345impl RealmBuilderFactoryProxy {
5346    /// Create a new Proxy for fuchsia.component.test/RealmBuilderFactory.
5347    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5348        let protocol_name =
5349            <RealmBuilderFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5350        Self { client: fidl::client::Client::new(channel, protocol_name) }
5351    }
5352
5353    /// Get a Stream of events from the remote end of the protocol.
5354    ///
5355    /// # Panics
5356    ///
5357    /// Panics if the event stream was already taken.
5358    pub fn take_event_stream(&self) -> RealmBuilderFactoryEventStream {
5359        RealmBuilderFactoryEventStream { event_receiver: self.client.take_event_receiver() }
5360    }
5361
5362    /// Creates a new RealmBuilder. The client end of `realm_server_end` can be
5363    /// used to mutate the realm that is being constructed, by doing things such
5364    /// as adding new children to the realm or adding capability routes between
5365    /// them. The client end of `builder_server_end` is used to finalize the
5366    /// realm, after which point it can be launched in a collection.
5367    ///
5368    /// `pkg_dir_handle` is a handle to the test package. The realm builder
5369    /// client typically passes a handle to its own `/pkg` directory, and
5370    /// bundles the `other-component` into the same package.
5371    pub fn r#create(
5372        &self,
5373        mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5374        mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5375        mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5376    ) -> fidl::client::QueryResponseFut<
5377        RealmBuilderFactoryCreateResult,
5378        fidl::encoding::DefaultFuchsiaResourceDialect,
5379    > {
5380        RealmBuilderFactoryProxyInterface::r#create(
5381            self,
5382            pkg_dir_handle,
5383            realm_server_end,
5384            builder_server_end,
5385        )
5386    }
5387
5388    /// Identical to `Create`, but instead of the realm being empty by default
5389    /// it contains the contents of the manifest located in the test package at
5390    /// the path indicated by `relative_url`, which must be a fragment-only URL
5391    /// (for example, `#meta/other-component.cm`; see
5392    /// https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only).
5393    pub fn r#create_from_relative_url(
5394        &self,
5395        mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5396        mut relative_url: &str,
5397        mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5398        mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5399    ) -> fidl::client::QueryResponseFut<
5400        RealmBuilderFactoryCreateFromRelativeUrlResult,
5401        fidl::encoding::DefaultFuchsiaResourceDialect,
5402    > {
5403        RealmBuilderFactoryProxyInterface::r#create_from_relative_url(
5404            self,
5405            pkg_dir_handle,
5406            relative_url,
5407            realm_server_end,
5408            builder_server_end,
5409        )
5410    }
5411}
5412
5413impl RealmBuilderFactoryProxyInterface for RealmBuilderFactoryProxy {
5414    type CreateResponseFut = fidl::client::QueryResponseFut<
5415        RealmBuilderFactoryCreateResult,
5416        fidl::encoding::DefaultFuchsiaResourceDialect,
5417    >;
5418    fn r#create(
5419        &self,
5420        mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5421        mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5422        mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5423    ) -> Self::CreateResponseFut {
5424        fn _decode(
5425            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5426        ) -> Result<RealmBuilderFactoryCreateResult, fidl::Error> {
5427            let _response = fidl::client::decode_transaction_body::<
5428                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
5429                fidl::encoding::DefaultFuchsiaResourceDialect,
5430                0x73528b1135cb01be,
5431            >(_buf?)?;
5432            Ok(_response.map(|x| x))
5433        }
5434        self.client.send_query_and_decode::<
5435            RealmBuilderFactoryCreateRequest,
5436            RealmBuilderFactoryCreateResult,
5437        >(
5438            (pkg_dir_handle, realm_server_end, builder_server_end,),
5439            0x73528b1135cb01be,
5440            fidl::encoding::DynamicFlags::empty(),
5441            _decode,
5442        )
5443    }
5444
5445    type CreateFromRelativeUrlResponseFut = fidl::client::QueryResponseFut<
5446        RealmBuilderFactoryCreateFromRelativeUrlResult,
5447        fidl::encoding::DefaultFuchsiaResourceDialect,
5448    >;
5449    fn r#create_from_relative_url(
5450        &self,
5451        mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5452        mut relative_url: &str,
5453        mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5454        mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5455    ) -> Self::CreateFromRelativeUrlResponseFut {
5456        fn _decode(
5457            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5458        ) -> Result<RealmBuilderFactoryCreateFromRelativeUrlResult, fidl::Error> {
5459            let _response = fidl::client::decode_transaction_body::<
5460                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
5461                fidl::encoding::DefaultFuchsiaResourceDialect,
5462                0x1cafd9042c54a86b,
5463            >(_buf?)?;
5464            Ok(_response.map(|x| x))
5465        }
5466        self.client.send_query_and_decode::<
5467            RealmBuilderFactoryCreateFromRelativeUrlRequest,
5468            RealmBuilderFactoryCreateFromRelativeUrlResult,
5469        >(
5470            (pkg_dir_handle, relative_url, realm_server_end, builder_server_end,),
5471            0x1cafd9042c54a86b,
5472            fidl::encoding::DynamicFlags::empty(),
5473            _decode,
5474        )
5475    }
5476}
5477
5478pub struct RealmBuilderFactoryEventStream {
5479    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5480}
5481
5482impl std::marker::Unpin for RealmBuilderFactoryEventStream {}
5483
5484impl futures::stream::FusedStream for RealmBuilderFactoryEventStream {
5485    fn is_terminated(&self) -> bool {
5486        self.event_receiver.is_terminated()
5487    }
5488}
5489
5490impl futures::Stream for RealmBuilderFactoryEventStream {
5491    type Item = Result<RealmBuilderFactoryEvent, fidl::Error>;
5492
5493    fn poll_next(
5494        mut self: std::pin::Pin<&mut Self>,
5495        cx: &mut std::task::Context<'_>,
5496    ) -> std::task::Poll<Option<Self::Item>> {
5497        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5498            &mut self.event_receiver,
5499            cx
5500        )?) {
5501            Some(buf) => std::task::Poll::Ready(Some(RealmBuilderFactoryEvent::decode(buf))),
5502            None => std::task::Poll::Ready(None),
5503        }
5504    }
5505}
5506
5507#[derive(Debug)]
5508pub enum RealmBuilderFactoryEvent {}
5509
5510impl RealmBuilderFactoryEvent {
5511    /// Decodes a message buffer as a [`RealmBuilderFactoryEvent`].
5512    fn decode(
5513        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5514    ) -> Result<RealmBuilderFactoryEvent, fidl::Error> {
5515        let (bytes, _handles) = buf.split_mut();
5516        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5517        debug_assert_eq!(tx_header.tx_id, 0);
5518        match tx_header.ordinal {
5519            _ => Err(fidl::Error::UnknownOrdinal {
5520                ordinal: tx_header.ordinal,
5521                protocol_name:
5522                    <RealmBuilderFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5523            }),
5524        }
5525    }
5526}
5527
5528/// A Stream of incoming requests for fuchsia.component.test/RealmBuilderFactory.
5529pub struct RealmBuilderFactoryRequestStream {
5530    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5531    is_terminated: bool,
5532}
5533
5534impl std::marker::Unpin for RealmBuilderFactoryRequestStream {}
5535
5536impl futures::stream::FusedStream for RealmBuilderFactoryRequestStream {
5537    fn is_terminated(&self) -> bool {
5538        self.is_terminated
5539    }
5540}
5541
5542impl fidl::endpoints::RequestStream for RealmBuilderFactoryRequestStream {
5543    type Protocol = RealmBuilderFactoryMarker;
5544    type ControlHandle = RealmBuilderFactoryControlHandle;
5545
5546    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5547        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5548    }
5549
5550    fn control_handle(&self) -> Self::ControlHandle {
5551        RealmBuilderFactoryControlHandle { inner: self.inner.clone() }
5552    }
5553
5554    fn into_inner(
5555        self,
5556    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5557    {
5558        (self.inner, self.is_terminated)
5559    }
5560
5561    fn from_inner(
5562        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5563        is_terminated: bool,
5564    ) -> Self {
5565        Self { inner, is_terminated }
5566    }
5567}
5568
5569impl futures::Stream for RealmBuilderFactoryRequestStream {
5570    type Item = Result<RealmBuilderFactoryRequest, fidl::Error>;
5571
5572    fn poll_next(
5573        mut self: std::pin::Pin<&mut Self>,
5574        cx: &mut std::task::Context<'_>,
5575    ) -> std::task::Poll<Option<Self::Item>> {
5576        let this = &mut *self;
5577        if this.inner.check_shutdown(cx) {
5578            this.is_terminated = true;
5579            return std::task::Poll::Ready(None);
5580        }
5581        if this.is_terminated {
5582            panic!("polled RealmBuilderFactoryRequestStream after completion");
5583        }
5584        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5585            |bytes, handles| {
5586                match this.inner.channel().read_etc(cx, bytes, handles) {
5587                    std::task::Poll::Ready(Ok(())) => {}
5588                    std::task::Poll::Pending => return std::task::Poll::Pending,
5589                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5590                        this.is_terminated = true;
5591                        return std::task::Poll::Ready(None);
5592                    }
5593                    std::task::Poll::Ready(Err(e)) => {
5594                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5595                            e.into(),
5596                        ))));
5597                    }
5598                }
5599
5600                // A message has been received from the channel
5601                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5602
5603                std::task::Poll::Ready(Some(match header.ordinal {
5604                0x73528b1135cb01be => {
5605                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5606                    let mut req = fidl::new_empty!(RealmBuilderFactoryCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5607                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmBuilderFactoryCreateRequest>(&header, _body_bytes, handles, &mut req)?;
5608                    let control_handle = RealmBuilderFactoryControlHandle {
5609                        inner: this.inner.clone(),
5610                    };
5611                    Ok(RealmBuilderFactoryRequest::Create {pkg_dir_handle: req.pkg_dir_handle,
5612realm_server_end: req.realm_server_end,
5613builder_server_end: req.builder_server_end,
5614
5615                        responder: RealmBuilderFactoryCreateResponder {
5616                            control_handle: std::mem::ManuallyDrop::new(control_handle),
5617                            tx_id: header.tx_id,
5618                        },
5619                    })
5620                }
5621                0x1cafd9042c54a86b => {
5622                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5623                    let mut req = fidl::new_empty!(RealmBuilderFactoryCreateFromRelativeUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5624                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmBuilderFactoryCreateFromRelativeUrlRequest>(&header, _body_bytes, handles, &mut req)?;
5625                    let control_handle = RealmBuilderFactoryControlHandle {
5626                        inner: this.inner.clone(),
5627                    };
5628                    Ok(RealmBuilderFactoryRequest::CreateFromRelativeUrl {pkg_dir_handle: req.pkg_dir_handle,
5629relative_url: req.relative_url,
5630realm_server_end: req.realm_server_end,
5631builder_server_end: req.builder_server_end,
5632
5633                        responder: RealmBuilderFactoryCreateFromRelativeUrlResponder {
5634                            control_handle: std::mem::ManuallyDrop::new(control_handle),
5635                            tx_id: header.tx_id,
5636                        },
5637                    })
5638                }
5639                _ => Err(fidl::Error::UnknownOrdinal {
5640                    ordinal: header.ordinal,
5641                    protocol_name: <RealmBuilderFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5642                }),
5643            }))
5644            },
5645        )
5646    }
5647}
5648
5649/// This protocol can be used to instruct the Realm Builder Server to begin
5650/// creating a new realm.
5651#[derive(Debug)]
5652pub enum RealmBuilderFactoryRequest {
5653    /// Creates a new RealmBuilder. The client end of `realm_server_end` can be
5654    /// used to mutate the realm that is being constructed, by doing things such
5655    /// as adding new children to the realm or adding capability routes between
5656    /// them. The client end of `builder_server_end` is used to finalize the
5657    /// realm, after which point it can be launched in a collection.
5658    ///
5659    /// `pkg_dir_handle` is a handle to the test package. The realm builder
5660    /// client typically passes a handle to its own `/pkg` directory, and
5661    /// bundles the `other-component` into the same package.
5662    Create {
5663        pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5664        realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5665        builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5666        responder: RealmBuilderFactoryCreateResponder,
5667    },
5668    /// Identical to `Create`, but instead of the realm being empty by default
5669    /// it contains the contents of the manifest located in the test package at
5670    /// the path indicated by `relative_url`, which must be a fragment-only URL
5671    /// (for example, `#meta/other-component.cm`; see
5672    /// https://fuchsia.dev/fuchsia-src/reference/components/url#relative-fragment-only).
5673    CreateFromRelativeUrl {
5674        pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5675        relative_url: String,
5676        realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
5677        builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
5678        responder: RealmBuilderFactoryCreateFromRelativeUrlResponder,
5679    },
5680}
5681
5682impl RealmBuilderFactoryRequest {
5683    #[allow(irrefutable_let_patterns)]
5684    pub fn into_create(
5685        self,
5686    ) -> Option<(
5687        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5688        fidl::endpoints::ServerEnd<RealmMarker>,
5689        fidl::endpoints::ServerEnd<BuilderMarker>,
5690        RealmBuilderFactoryCreateResponder,
5691    )> {
5692        if let RealmBuilderFactoryRequest::Create {
5693            pkg_dir_handle,
5694            realm_server_end,
5695            builder_server_end,
5696            responder,
5697        } = self
5698        {
5699            Some((pkg_dir_handle, realm_server_end, builder_server_end, responder))
5700        } else {
5701            None
5702        }
5703    }
5704
5705    #[allow(irrefutable_let_patterns)]
5706    pub fn into_create_from_relative_url(
5707        self,
5708    ) -> Option<(
5709        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5710        String,
5711        fidl::endpoints::ServerEnd<RealmMarker>,
5712        fidl::endpoints::ServerEnd<BuilderMarker>,
5713        RealmBuilderFactoryCreateFromRelativeUrlResponder,
5714    )> {
5715        if let RealmBuilderFactoryRequest::CreateFromRelativeUrl {
5716            pkg_dir_handle,
5717            relative_url,
5718            realm_server_end,
5719            builder_server_end,
5720            responder,
5721        } = self
5722        {
5723            Some((pkg_dir_handle, relative_url, realm_server_end, builder_server_end, responder))
5724        } else {
5725            None
5726        }
5727    }
5728
5729    /// Name of the method defined in FIDL
5730    pub fn method_name(&self) -> &'static str {
5731        match *self {
5732            RealmBuilderFactoryRequest::Create { .. } => "create",
5733            RealmBuilderFactoryRequest::CreateFromRelativeUrl { .. } => "create_from_relative_url",
5734        }
5735    }
5736}
5737
5738#[derive(Debug, Clone)]
5739pub struct RealmBuilderFactoryControlHandle {
5740    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5741}
5742
5743impl RealmBuilderFactoryControlHandle {
5744    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5745        self.inner.shutdown_with_epitaph(status.into())
5746    }
5747}
5748
5749impl fidl::endpoints::ControlHandle for RealmBuilderFactoryControlHandle {
5750    fn shutdown(&self) {
5751        self.inner.shutdown()
5752    }
5753
5754    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5755        self.inner.shutdown_with_epitaph(status)
5756    }
5757
5758    fn is_closed(&self) -> bool {
5759        self.inner.channel().is_closed()
5760    }
5761    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5762        self.inner.channel().on_closed()
5763    }
5764
5765    #[cfg(target_os = "fuchsia")]
5766    fn signal_peer(
5767        &self,
5768        clear_mask: zx::Signals,
5769        set_mask: zx::Signals,
5770    ) -> Result<(), zx_status::Status> {
5771        use fidl::Peered;
5772        self.inner.channel().signal_peer(clear_mask, set_mask)
5773    }
5774}
5775
5776impl RealmBuilderFactoryControlHandle {}
5777
5778#[must_use = "FIDL methods require a response to be sent"]
5779#[derive(Debug)]
5780pub struct RealmBuilderFactoryCreateResponder {
5781    control_handle: std::mem::ManuallyDrop<RealmBuilderFactoryControlHandle>,
5782    tx_id: u32,
5783}
5784
5785/// Set the the channel to be shutdown (see [`RealmBuilderFactoryControlHandle::shutdown`])
5786/// if the responder is dropped without sending a response, so that the client
5787/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5788impl std::ops::Drop for RealmBuilderFactoryCreateResponder {
5789    fn drop(&mut self) {
5790        self.control_handle.shutdown();
5791        // Safety: drops once, never accessed again
5792        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5793    }
5794}
5795
5796impl fidl::endpoints::Responder for RealmBuilderFactoryCreateResponder {
5797    type ControlHandle = RealmBuilderFactoryControlHandle;
5798
5799    fn control_handle(&self) -> &RealmBuilderFactoryControlHandle {
5800        &self.control_handle
5801    }
5802
5803    fn drop_without_shutdown(mut self) {
5804        // Safety: drops once, never accessed again due to mem::forget
5805        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5806        // Prevent Drop from running (which would shut down the channel)
5807        std::mem::forget(self);
5808    }
5809}
5810
5811impl RealmBuilderFactoryCreateResponder {
5812    /// Sends a response to the FIDL transaction.
5813    ///
5814    /// Sets the channel to shutdown if an error occurs.
5815    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
5816        let _result = self.send_raw(result);
5817        if _result.is_err() {
5818            self.control_handle.shutdown();
5819        }
5820        self.drop_without_shutdown();
5821        _result
5822    }
5823
5824    /// Similar to "send" but does not shutdown the channel if an error occurs.
5825    pub fn send_no_shutdown_on_err(
5826        self,
5827        mut result: Result<(), RealmBuilderError>,
5828    ) -> Result<(), fidl::Error> {
5829        let _result = self.send_raw(result);
5830        self.drop_without_shutdown();
5831        _result
5832    }
5833
5834    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
5835        self.control_handle.inner.send::<fidl::encoding::ResultType<
5836            fidl::encoding::EmptyStruct,
5837            RealmBuilderError,
5838        >>(
5839            result,
5840            self.tx_id,
5841            0x73528b1135cb01be,
5842            fidl::encoding::DynamicFlags::empty(),
5843        )
5844    }
5845}
5846
5847#[must_use = "FIDL methods require a response to be sent"]
5848#[derive(Debug)]
5849pub struct RealmBuilderFactoryCreateFromRelativeUrlResponder {
5850    control_handle: std::mem::ManuallyDrop<RealmBuilderFactoryControlHandle>,
5851    tx_id: u32,
5852}
5853
5854/// Set the the channel to be shutdown (see [`RealmBuilderFactoryControlHandle::shutdown`])
5855/// if the responder is dropped without sending a response, so that the client
5856/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5857impl std::ops::Drop for RealmBuilderFactoryCreateFromRelativeUrlResponder {
5858    fn drop(&mut self) {
5859        self.control_handle.shutdown();
5860        // Safety: drops once, never accessed again
5861        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5862    }
5863}
5864
5865impl fidl::endpoints::Responder for RealmBuilderFactoryCreateFromRelativeUrlResponder {
5866    type ControlHandle = RealmBuilderFactoryControlHandle;
5867
5868    fn control_handle(&self) -> &RealmBuilderFactoryControlHandle {
5869        &self.control_handle
5870    }
5871
5872    fn drop_without_shutdown(mut self) {
5873        // Safety: drops once, never accessed again due to mem::forget
5874        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5875        // Prevent Drop from running (which would shut down the channel)
5876        std::mem::forget(self);
5877    }
5878}
5879
5880impl RealmBuilderFactoryCreateFromRelativeUrlResponder {
5881    /// Sends a response to the FIDL transaction.
5882    ///
5883    /// Sets the channel to shutdown if an error occurs.
5884    pub fn send(self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
5885        let _result = self.send_raw(result);
5886        if _result.is_err() {
5887            self.control_handle.shutdown();
5888        }
5889        self.drop_without_shutdown();
5890        _result
5891    }
5892
5893    /// Similar to "send" but does not shutdown the channel if an error occurs.
5894    pub fn send_no_shutdown_on_err(
5895        self,
5896        mut result: Result<(), RealmBuilderError>,
5897    ) -> Result<(), fidl::Error> {
5898        let _result = self.send_raw(result);
5899        self.drop_without_shutdown();
5900        _result
5901    }
5902
5903    fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
5904        self.control_handle.inner.send::<fidl::encoding::ResultType<
5905            fidl::encoding::EmptyStruct,
5906            RealmBuilderError,
5907        >>(
5908            result,
5909            self.tx_id,
5910            0x1cafd9042c54a86b,
5911            fidl::encoding::DynamicFlags::empty(),
5912        )
5913    }
5914}
5915
5916mod internal {
5917    use super::*;
5918
5919    impl fidl::encoding::ResourceTypeMarker for BuilderBuildRequest {
5920        type Borrowed<'a> = &'a mut Self;
5921        fn take_or_borrow<'a>(
5922            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5923        ) -> Self::Borrowed<'a> {
5924            value
5925        }
5926    }
5927
5928    unsafe impl fidl::encoding::TypeMarker for BuilderBuildRequest {
5929        type Owned = Self;
5930
5931        #[inline(always)]
5932        fn inline_align(_context: fidl::encoding::Context) -> usize {
5933            4
5934        }
5935
5936        #[inline(always)]
5937        fn inline_size(_context: fidl::encoding::Context) -> usize {
5938            4
5939        }
5940    }
5941
5942    unsafe impl
5943        fidl::encoding::Encode<BuilderBuildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5944        for &mut BuilderBuildRequest
5945    {
5946        #[inline]
5947        unsafe fn encode(
5948            self,
5949            encoder: &mut fidl::encoding::Encoder<
5950                '_,
5951                fidl::encoding::DefaultFuchsiaResourceDialect,
5952            >,
5953            offset: usize,
5954            _depth: fidl::encoding::Depth,
5955        ) -> fidl::Result<()> {
5956            encoder.debug_check_bounds::<BuilderBuildRequest>(offset);
5957            // Delegate to tuple encoding.
5958            fidl::encoding::Encode::<
5959                BuilderBuildRequest,
5960                fidl::encoding::DefaultFuchsiaResourceDialect,
5961            >::encode(
5962                (<fidl::encoding::Endpoint<
5963                    fidl::endpoints::ClientEnd<
5964                        fidl_fuchsia_component_runner::ComponentRunnerMarker,
5965                    >,
5966                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5967                    &mut self.runner
5968                ),),
5969                encoder,
5970                offset,
5971                _depth,
5972            )
5973        }
5974    }
5975    unsafe impl<
5976        T0: fidl::encoding::Encode<
5977                fidl::encoding::Endpoint<
5978                    fidl::endpoints::ClientEnd<
5979                        fidl_fuchsia_component_runner::ComponentRunnerMarker,
5980                    >,
5981                >,
5982                fidl::encoding::DefaultFuchsiaResourceDialect,
5983            >,
5984    > fidl::encoding::Encode<BuilderBuildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5985        for (T0,)
5986    {
5987        #[inline]
5988        unsafe fn encode(
5989            self,
5990            encoder: &mut fidl::encoding::Encoder<
5991                '_,
5992                fidl::encoding::DefaultFuchsiaResourceDialect,
5993            >,
5994            offset: usize,
5995            depth: fidl::encoding::Depth,
5996        ) -> fidl::Result<()> {
5997            encoder.debug_check_bounds::<BuilderBuildRequest>(offset);
5998            // Zero out padding regions. There's no need to apply masks
5999            // because the unmasked parts will be overwritten by fields.
6000            // Write the fields.
6001            self.0.encode(encoder, offset + 0, depth)?;
6002            Ok(())
6003        }
6004    }
6005
6006    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6007        for BuilderBuildRequest
6008    {
6009        #[inline(always)]
6010        fn new_empty() -> Self {
6011            Self {
6012                runner: fidl::new_empty!(
6013                    fidl::encoding::Endpoint<
6014                        fidl::endpoints::ClientEnd<
6015                            fidl_fuchsia_component_runner::ComponentRunnerMarker,
6016                        >,
6017                    >,
6018                    fidl::encoding::DefaultFuchsiaResourceDialect
6019                ),
6020            }
6021        }
6022
6023        #[inline]
6024        unsafe fn decode(
6025            &mut self,
6026            decoder: &mut fidl::encoding::Decoder<
6027                '_,
6028                fidl::encoding::DefaultFuchsiaResourceDialect,
6029            >,
6030            offset: usize,
6031            _depth: fidl::encoding::Depth,
6032        ) -> fidl::Result<()> {
6033            decoder.debug_check_bounds::<Self>(offset);
6034            // Verify that padding bytes are zero.
6035            fidl::decode!(
6036                fidl::encoding::Endpoint<
6037                    fidl::endpoints::ClientEnd<
6038                        fidl_fuchsia_component_runner::ComponentRunnerMarker,
6039                    >,
6040                >,
6041                fidl::encoding::DefaultFuchsiaResourceDialect,
6042                &mut self.runner,
6043                decoder,
6044                offset + 0,
6045                _depth
6046            )?;
6047            Ok(())
6048        }
6049    }
6050
6051    impl fidl::encoding::ResourceTypeMarker for DirectoryContents {
6052        type Borrowed<'a> = &'a mut Self;
6053        fn take_or_borrow<'a>(
6054            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6055        ) -> Self::Borrowed<'a> {
6056            value
6057        }
6058    }
6059
6060    unsafe impl fidl::encoding::TypeMarker for DirectoryContents {
6061        type Owned = Self;
6062
6063        #[inline(always)]
6064        fn inline_align(_context: fidl::encoding::Context) -> usize {
6065            8
6066        }
6067
6068        #[inline(always)]
6069        fn inline_size(_context: fidl::encoding::Context) -> usize {
6070            16
6071        }
6072    }
6073
6074    unsafe impl
6075        fidl::encoding::Encode<DirectoryContents, fidl::encoding::DefaultFuchsiaResourceDialect>
6076        for &mut DirectoryContents
6077    {
6078        #[inline]
6079        unsafe fn encode(
6080            self,
6081            encoder: &mut fidl::encoding::Encoder<
6082                '_,
6083                fidl::encoding::DefaultFuchsiaResourceDialect,
6084            >,
6085            offset: usize,
6086            _depth: fidl::encoding::Depth,
6087        ) -> fidl::Result<()> {
6088            encoder.debug_check_bounds::<DirectoryContents>(offset);
6089            // Delegate to tuple encoding.
6090            fidl::encoding::Encode::<DirectoryContents, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6091                (
6092                    <fidl::encoding::Vector<DirectoryEntry, 1024> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
6093                ),
6094                encoder, offset, _depth
6095            )
6096        }
6097    }
6098    unsafe impl<
6099        T0: fidl::encoding::Encode<
6100                fidl::encoding::Vector<DirectoryEntry, 1024>,
6101                fidl::encoding::DefaultFuchsiaResourceDialect,
6102            >,
6103    > fidl::encoding::Encode<DirectoryContents, fidl::encoding::DefaultFuchsiaResourceDialect>
6104        for (T0,)
6105    {
6106        #[inline]
6107        unsafe fn encode(
6108            self,
6109            encoder: &mut fidl::encoding::Encoder<
6110                '_,
6111                fidl::encoding::DefaultFuchsiaResourceDialect,
6112            >,
6113            offset: usize,
6114            depth: fidl::encoding::Depth,
6115        ) -> fidl::Result<()> {
6116            encoder.debug_check_bounds::<DirectoryContents>(offset);
6117            // Zero out padding regions. There's no need to apply masks
6118            // because the unmasked parts will be overwritten by fields.
6119            // Write the fields.
6120            self.0.encode(encoder, offset + 0, depth)?;
6121            Ok(())
6122        }
6123    }
6124
6125    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6126        for DirectoryContents
6127    {
6128        #[inline(always)]
6129        fn new_empty() -> Self {
6130            Self {
6131                entries: fidl::new_empty!(fidl::encoding::Vector<DirectoryEntry, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect),
6132            }
6133        }
6134
6135        #[inline]
6136        unsafe fn decode(
6137            &mut self,
6138            decoder: &mut fidl::encoding::Decoder<
6139                '_,
6140                fidl::encoding::DefaultFuchsiaResourceDialect,
6141            >,
6142            offset: usize,
6143            _depth: fidl::encoding::Depth,
6144        ) -> fidl::Result<()> {
6145            decoder.debug_check_bounds::<Self>(offset);
6146            // Verify that padding bytes are zero.
6147            fidl::decode!(fidl::encoding::Vector<DirectoryEntry, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.entries, decoder, offset + 0, _depth)?;
6148            Ok(())
6149        }
6150    }
6151
6152    impl fidl::encoding::ResourceTypeMarker for DirectoryEntry {
6153        type Borrowed<'a> = &'a mut Self;
6154        fn take_or_borrow<'a>(
6155            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6156        ) -> Self::Borrowed<'a> {
6157            value
6158        }
6159    }
6160
6161    unsafe impl fidl::encoding::TypeMarker for DirectoryEntry {
6162        type Owned = Self;
6163
6164        #[inline(always)]
6165        fn inline_align(_context: fidl::encoding::Context) -> usize {
6166            8
6167        }
6168
6169        #[inline(always)]
6170        fn inline_size(_context: fidl::encoding::Context) -> usize {
6171            32
6172        }
6173    }
6174
6175    unsafe impl
6176        fidl::encoding::Encode<DirectoryEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
6177        for &mut DirectoryEntry
6178    {
6179        #[inline]
6180        unsafe fn encode(
6181            self,
6182            encoder: &mut fidl::encoding::Encoder<
6183                '_,
6184                fidl::encoding::DefaultFuchsiaResourceDialect,
6185            >,
6186            offset: usize,
6187            _depth: fidl::encoding::Depth,
6188        ) -> fidl::Result<()> {
6189            encoder.debug_check_bounds::<DirectoryEntry>(offset);
6190            // Delegate to tuple encoding.
6191            fidl::encoding::Encode::<DirectoryEntry, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6192                (
6193                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.file_path),
6194                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.file_contents),
6195                ),
6196                encoder, offset, _depth
6197            )
6198        }
6199    }
6200    unsafe impl<
6201        T0: fidl::encoding::Encode<
6202                fidl::encoding::BoundedString<255>,
6203                fidl::encoding::DefaultFuchsiaResourceDialect,
6204            >,
6205        T1: fidl::encoding::Encode<
6206                fidl_fuchsia_mem::Buffer,
6207                fidl::encoding::DefaultFuchsiaResourceDialect,
6208            >,
6209    > fidl::encoding::Encode<DirectoryEntry, fidl::encoding::DefaultFuchsiaResourceDialect>
6210        for (T0, T1)
6211    {
6212        #[inline]
6213        unsafe fn encode(
6214            self,
6215            encoder: &mut fidl::encoding::Encoder<
6216                '_,
6217                fidl::encoding::DefaultFuchsiaResourceDialect,
6218            >,
6219            offset: usize,
6220            depth: fidl::encoding::Depth,
6221        ) -> fidl::Result<()> {
6222            encoder.debug_check_bounds::<DirectoryEntry>(offset);
6223            // Zero out padding regions. There's no need to apply masks
6224            // because the unmasked parts will be overwritten by fields.
6225            // Write the fields.
6226            self.0.encode(encoder, offset + 0, depth)?;
6227            self.1.encode(encoder, offset + 16, depth)?;
6228            Ok(())
6229        }
6230    }
6231
6232    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6233        for DirectoryEntry
6234    {
6235        #[inline(always)]
6236        fn new_empty() -> Self {
6237            Self {
6238                file_path: fidl::new_empty!(
6239                    fidl::encoding::BoundedString<255>,
6240                    fidl::encoding::DefaultFuchsiaResourceDialect
6241                ),
6242                file_contents: fidl::new_empty!(
6243                    fidl_fuchsia_mem::Buffer,
6244                    fidl::encoding::DefaultFuchsiaResourceDialect
6245                ),
6246            }
6247        }
6248
6249        #[inline]
6250        unsafe fn decode(
6251            &mut self,
6252            decoder: &mut fidl::encoding::Decoder<
6253                '_,
6254                fidl::encoding::DefaultFuchsiaResourceDialect,
6255            >,
6256            offset: usize,
6257            _depth: fidl::encoding::Depth,
6258        ) -> fidl::Result<()> {
6259            decoder.debug_check_bounds::<Self>(offset);
6260            // Verify that padding bytes are zero.
6261            fidl::decode!(
6262                fidl::encoding::BoundedString<255>,
6263                fidl::encoding::DefaultFuchsiaResourceDialect,
6264                &mut self.file_path,
6265                decoder,
6266                offset + 0,
6267                _depth
6268            )?;
6269            fidl::decode!(
6270                fidl_fuchsia_mem::Buffer,
6271                fidl::encoding::DefaultFuchsiaResourceDialect,
6272                &mut self.file_contents,
6273                decoder,
6274                offset + 16,
6275                _depth
6276            )?;
6277            Ok(())
6278        }
6279    }
6280
6281    impl fidl::encoding::ResourceTypeMarker for RealmAddChildRealmFromDeclRequest {
6282        type Borrowed<'a> = &'a mut Self;
6283        fn take_or_borrow<'a>(
6284            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6285        ) -> Self::Borrowed<'a> {
6286            value
6287        }
6288    }
6289
6290    unsafe impl fidl::encoding::TypeMarker for RealmAddChildRealmFromDeclRequest {
6291        type Owned = Self;
6292
6293        #[inline(always)]
6294        fn inline_align(_context: fidl::encoding::Context) -> usize {
6295            8
6296        }
6297
6298        #[inline(always)]
6299        fn inline_size(_context: fidl::encoding::Context) -> usize {
6300            56
6301        }
6302    }
6303
6304    unsafe impl
6305        fidl::encoding::Encode<
6306            RealmAddChildRealmFromDeclRequest,
6307            fidl::encoding::DefaultFuchsiaResourceDialect,
6308        > for &mut RealmAddChildRealmFromDeclRequest
6309    {
6310        #[inline]
6311        unsafe fn encode(
6312            self,
6313            encoder: &mut fidl::encoding::Encoder<
6314                '_,
6315                fidl::encoding::DefaultFuchsiaResourceDialect,
6316            >,
6317            offset: usize,
6318            _depth: fidl::encoding::Depth,
6319        ) -> fidl::Result<()> {
6320            encoder.debug_check_bounds::<RealmAddChildRealmFromDeclRequest>(offset);
6321            // Delegate to tuple encoding.
6322            fidl::encoding::Encode::<RealmAddChildRealmFromDeclRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6323                (
6324                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
6325                    <fidl_fuchsia_component_decl::Component as fidl::encoding::ValueTypeMarker>::borrow(&self.decl),
6326                    <ChildOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
6327                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_realm),
6328                ),
6329                encoder, offset, _depth
6330            )
6331        }
6332    }
6333    unsafe impl<
6334        T0: fidl::encoding::Encode<
6335                fidl::encoding::BoundedString<255>,
6336                fidl::encoding::DefaultFuchsiaResourceDialect,
6337            >,
6338        T1: fidl::encoding::Encode<
6339                fidl_fuchsia_component_decl::Component,
6340                fidl::encoding::DefaultFuchsiaResourceDialect,
6341            >,
6342        T2: fidl::encoding::Encode<ChildOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
6343        T3: fidl::encoding::Encode<
6344                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
6345                fidl::encoding::DefaultFuchsiaResourceDialect,
6346            >,
6347    >
6348        fidl::encoding::Encode<
6349            RealmAddChildRealmFromDeclRequest,
6350            fidl::encoding::DefaultFuchsiaResourceDialect,
6351        > for (T0, T1, T2, T3)
6352    {
6353        #[inline]
6354        unsafe fn encode(
6355            self,
6356            encoder: &mut fidl::encoding::Encoder<
6357                '_,
6358                fidl::encoding::DefaultFuchsiaResourceDialect,
6359            >,
6360            offset: usize,
6361            depth: fidl::encoding::Depth,
6362        ) -> fidl::Result<()> {
6363            encoder.debug_check_bounds::<RealmAddChildRealmFromDeclRequest>(offset);
6364            // Zero out padding regions. There's no need to apply masks
6365            // because the unmasked parts will be overwritten by fields.
6366            unsafe {
6367                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
6368                (ptr as *mut u64).write_unaligned(0);
6369            }
6370            // Write the fields.
6371            self.0.encode(encoder, offset + 0, depth)?;
6372            self.1.encode(encoder, offset + 16, depth)?;
6373            self.2.encode(encoder, offset + 32, depth)?;
6374            self.3.encode(encoder, offset + 48, depth)?;
6375            Ok(())
6376        }
6377    }
6378
6379    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6380        for RealmAddChildRealmFromDeclRequest
6381    {
6382        #[inline(always)]
6383        fn new_empty() -> Self {
6384            Self {
6385                name: fidl::new_empty!(
6386                    fidl::encoding::BoundedString<255>,
6387                    fidl::encoding::DefaultFuchsiaResourceDialect
6388                ),
6389                decl: fidl::new_empty!(
6390                    fidl_fuchsia_component_decl::Component,
6391                    fidl::encoding::DefaultFuchsiaResourceDialect
6392                ),
6393                options: fidl::new_empty!(
6394                    ChildOptions,
6395                    fidl::encoding::DefaultFuchsiaResourceDialect
6396                ),
6397                child_realm: fidl::new_empty!(
6398                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
6399                    fidl::encoding::DefaultFuchsiaResourceDialect
6400                ),
6401            }
6402        }
6403
6404        #[inline]
6405        unsafe fn decode(
6406            &mut self,
6407            decoder: &mut fidl::encoding::Decoder<
6408                '_,
6409                fidl::encoding::DefaultFuchsiaResourceDialect,
6410            >,
6411            offset: usize,
6412            _depth: fidl::encoding::Depth,
6413        ) -> fidl::Result<()> {
6414            decoder.debug_check_bounds::<Self>(offset);
6415            // Verify that padding bytes are zero.
6416            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
6417            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6418            let mask = 0xffffffff00000000u64;
6419            let maskedval = padval & mask;
6420            if maskedval != 0 {
6421                return Err(fidl::Error::NonZeroPadding {
6422                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
6423                });
6424            }
6425            fidl::decode!(
6426                fidl::encoding::BoundedString<255>,
6427                fidl::encoding::DefaultFuchsiaResourceDialect,
6428                &mut self.name,
6429                decoder,
6430                offset + 0,
6431                _depth
6432            )?;
6433            fidl::decode!(
6434                fidl_fuchsia_component_decl::Component,
6435                fidl::encoding::DefaultFuchsiaResourceDialect,
6436                &mut self.decl,
6437                decoder,
6438                offset + 16,
6439                _depth
6440            )?;
6441            fidl::decode!(
6442                ChildOptions,
6443                fidl::encoding::DefaultFuchsiaResourceDialect,
6444                &mut self.options,
6445                decoder,
6446                offset + 32,
6447                _depth
6448            )?;
6449            fidl::decode!(
6450                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
6451                fidl::encoding::DefaultFuchsiaResourceDialect,
6452                &mut self.child_realm,
6453                decoder,
6454                offset + 48,
6455                _depth
6456            )?;
6457            Ok(())
6458        }
6459    }
6460
6461    impl fidl::encoding::ResourceTypeMarker for RealmAddChildRealmFromRelativeUrlRequest {
6462        type Borrowed<'a> = &'a mut Self;
6463        fn take_or_borrow<'a>(
6464            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6465        ) -> Self::Borrowed<'a> {
6466            value
6467        }
6468    }
6469
6470    unsafe impl fidl::encoding::TypeMarker for RealmAddChildRealmFromRelativeUrlRequest {
6471        type Owned = Self;
6472
6473        #[inline(always)]
6474        fn inline_align(_context: fidl::encoding::Context) -> usize {
6475            8
6476        }
6477
6478        #[inline(always)]
6479        fn inline_size(_context: fidl::encoding::Context) -> usize {
6480            56
6481        }
6482    }
6483
6484    unsafe impl
6485        fidl::encoding::Encode<
6486            RealmAddChildRealmFromRelativeUrlRequest,
6487            fidl::encoding::DefaultFuchsiaResourceDialect,
6488        > for &mut RealmAddChildRealmFromRelativeUrlRequest
6489    {
6490        #[inline]
6491        unsafe fn encode(
6492            self,
6493            encoder: &mut fidl::encoding::Encoder<
6494                '_,
6495                fidl::encoding::DefaultFuchsiaResourceDialect,
6496            >,
6497            offset: usize,
6498            _depth: fidl::encoding::Depth,
6499        ) -> fidl::Result<()> {
6500            encoder.debug_check_bounds::<RealmAddChildRealmFromRelativeUrlRequest>(offset);
6501            // Delegate to tuple encoding.
6502            fidl::encoding::Encode::<RealmAddChildRealmFromRelativeUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6503                (
6504                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
6505                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_url),
6506                    <ChildOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
6507                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_realm),
6508                ),
6509                encoder, offset, _depth
6510            )
6511        }
6512    }
6513    unsafe impl<
6514        T0: fidl::encoding::Encode<
6515                fidl::encoding::BoundedString<255>,
6516                fidl::encoding::DefaultFuchsiaResourceDialect,
6517            >,
6518        T1: fidl::encoding::Encode<
6519                fidl::encoding::BoundedString<4096>,
6520                fidl::encoding::DefaultFuchsiaResourceDialect,
6521            >,
6522        T2: fidl::encoding::Encode<ChildOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
6523        T3: fidl::encoding::Encode<
6524                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
6525                fidl::encoding::DefaultFuchsiaResourceDialect,
6526            >,
6527    >
6528        fidl::encoding::Encode<
6529            RealmAddChildRealmFromRelativeUrlRequest,
6530            fidl::encoding::DefaultFuchsiaResourceDialect,
6531        > for (T0, T1, T2, T3)
6532    {
6533        #[inline]
6534        unsafe fn encode(
6535            self,
6536            encoder: &mut fidl::encoding::Encoder<
6537                '_,
6538                fidl::encoding::DefaultFuchsiaResourceDialect,
6539            >,
6540            offset: usize,
6541            depth: fidl::encoding::Depth,
6542        ) -> fidl::Result<()> {
6543            encoder.debug_check_bounds::<RealmAddChildRealmFromRelativeUrlRequest>(offset);
6544            // Zero out padding regions. There's no need to apply masks
6545            // because the unmasked parts will be overwritten by fields.
6546            unsafe {
6547                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
6548                (ptr as *mut u64).write_unaligned(0);
6549            }
6550            // Write the fields.
6551            self.0.encode(encoder, offset + 0, depth)?;
6552            self.1.encode(encoder, offset + 16, depth)?;
6553            self.2.encode(encoder, offset + 32, depth)?;
6554            self.3.encode(encoder, offset + 48, depth)?;
6555            Ok(())
6556        }
6557    }
6558
6559    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6560        for RealmAddChildRealmFromRelativeUrlRequest
6561    {
6562        #[inline(always)]
6563        fn new_empty() -> Self {
6564            Self {
6565                name: fidl::new_empty!(
6566                    fidl::encoding::BoundedString<255>,
6567                    fidl::encoding::DefaultFuchsiaResourceDialect
6568                ),
6569                relative_url: fidl::new_empty!(
6570                    fidl::encoding::BoundedString<4096>,
6571                    fidl::encoding::DefaultFuchsiaResourceDialect
6572                ),
6573                options: fidl::new_empty!(
6574                    ChildOptions,
6575                    fidl::encoding::DefaultFuchsiaResourceDialect
6576                ),
6577                child_realm: fidl::new_empty!(
6578                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
6579                    fidl::encoding::DefaultFuchsiaResourceDialect
6580                ),
6581            }
6582        }
6583
6584        #[inline]
6585        unsafe fn decode(
6586            &mut self,
6587            decoder: &mut fidl::encoding::Decoder<
6588                '_,
6589                fidl::encoding::DefaultFuchsiaResourceDialect,
6590            >,
6591            offset: usize,
6592            _depth: fidl::encoding::Depth,
6593        ) -> fidl::Result<()> {
6594            decoder.debug_check_bounds::<Self>(offset);
6595            // Verify that padding bytes are zero.
6596            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
6597            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6598            let mask = 0xffffffff00000000u64;
6599            let maskedval = padval & mask;
6600            if maskedval != 0 {
6601                return Err(fidl::Error::NonZeroPadding {
6602                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
6603                });
6604            }
6605            fidl::decode!(
6606                fidl::encoding::BoundedString<255>,
6607                fidl::encoding::DefaultFuchsiaResourceDialect,
6608                &mut self.name,
6609                decoder,
6610                offset + 0,
6611                _depth
6612            )?;
6613            fidl::decode!(
6614                fidl::encoding::BoundedString<4096>,
6615                fidl::encoding::DefaultFuchsiaResourceDialect,
6616                &mut self.relative_url,
6617                decoder,
6618                offset + 16,
6619                _depth
6620            )?;
6621            fidl::decode!(
6622                ChildOptions,
6623                fidl::encoding::DefaultFuchsiaResourceDialect,
6624                &mut self.options,
6625                decoder,
6626                offset + 32,
6627                _depth
6628            )?;
6629            fidl::decode!(
6630                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
6631                fidl::encoding::DefaultFuchsiaResourceDialect,
6632                &mut self.child_realm,
6633                decoder,
6634                offset + 48,
6635                _depth
6636            )?;
6637            Ok(())
6638        }
6639    }
6640
6641    impl fidl::encoding::ResourceTypeMarker for RealmAddChildRealmRequest {
6642        type Borrowed<'a> = &'a mut Self;
6643        fn take_or_borrow<'a>(
6644            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6645        ) -> Self::Borrowed<'a> {
6646            value
6647        }
6648    }
6649
6650    unsafe impl fidl::encoding::TypeMarker for RealmAddChildRealmRequest {
6651        type Owned = Self;
6652
6653        #[inline(always)]
6654        fn inline_align(_context: fidl::encoding::Context) -> usize {
6655            8
6656        }
6657
6658        #[inline(always)]
6659        fn inline_size(_context: fidl::encoding::Context) -> usize {
6660            40
6661        }
6662    }
6663
6664    unsafe impl
6665        fidl::encoding::Encode<
6666            RealmAddChildRealmRequest,
6667            fidl::encoding::DefaultFuchsiaResourceDialect,
6668        > for &mut RealmAddChildRealmRequest
6669    {
6670        #[inline]
6671        unsafe fn encode(
6672            self,
6673            encoder: &mut fidl::encoding::Encoder<
6674                '_,
6675                fidl::encoding::DefaultFuchsiaResourceDialect,
6676            >,
6677            offset: usize,
6678            _depth: fidl::encoding::Depth,
6679        ) -> fidl::Result<()> {
6680            encoder.debug_check_bounds::<RealmAddChildRealmRequest>(offset);
6681            // Delegate to tuple encoding.
6682            fidl::encoding::Encode::<RealmAddChildRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6683                (
6684                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
6685                    <ChildOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
6686                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_realm),
6687                ),
6688                encoder, offset, _depth
6689            )
6690        }
6691    }
6692    unsafe impl<
6693        T0: fidl::encoding::Encode<
6694                fidl::encoding::BoundedString<255>,
6695                fidl::encoding::DefaultFuchsiaResourceDialect,
6696            >,
6697        T1: fidl::encoding::Encode<ChildOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
6698        T2: fidl::encoding::Encode<
6699                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
6700                fidl::encoding::DefaultFuchsiaResourceDialect,
6701            >,
6702    >
6703        fidl::encoding::Encode<
6704            RealmAddChildRealmRequest,
6705            fidl::encoding::DefaultFuchsiaResourceDialect,
6706        > for (T0, T1, T2)
6707    {
6708        #[inline]
6709        unsafe fn encode(
6710            self,
6711            encoder: &mut fidl::encoding::Encoder<
6712                '_,
6713                fidl::encoding::DefaultFuchsiaResourceDialect,
6714            >,
6715            offset: usize,
6716            depth: fidl::encoding::Depth,
6717        ) -> fidl::Result<()> {
6718            encoder.debug_check_bounds::<RealmAddChildRealmRequest>(offset);
6719            // Zero out padding regions. There's no need to apply masks
6720            // because the unmasked parts will be overwritten by fields.
6721            unsafe {
6722                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
6723                (ptr as *mut u64).write_unaligned(0);
6724            }
6725            // Write the fields.
6726            self.0.encode(encoder, offset + 0, depth)?;
6727            self.1.encode(encoder, offset + 16, depth)?;
6728            self.2.encode(encoder, offset + 32, depth)?;
6729            Ok(())
6730        }
6731    }
6732
6733    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6734        for RealmAddChildRealmRequest
6735    {
6736        #[inline(always)]
6737        fn new_empty() -> Self {
6738            Self {
6739                name: fidl::new_empty!(
6740                    fidl::encoding::BoundedString<255>,
6741                    fidl::encoding::DefaultFuchsiaResourceDialect
6742                ),
6743                options: fidl::new_empty!(
6744                    ChildOptions,
6745                    fidl::encoding::DefaultFuchsiaResourceDialect
6746                ),
6747                child_realm: fidl::new_empty!(
6748                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
6749                    fidl::encoding::DefaultFuchsiaResourceDialect
6750                ),
6751            }
6752        }
6753
6754        #[inline]
6755        unsafe fn decode(
6756            &mut self,
6757            decoder: &mut fidl::encoding::Decoder<
6758                '_,
6759                fidl::encoding::DefaultFuchsiaResourceDialect,
6760            >,
6761            offset: usize,
6762            _depth: fidl::encoding::Depth,
6763        ) -> fidl::Result<()> {
6764            decoder.debug_check_bounds::<Self>(offset);
6765            // Verify that padding bytes are zero.
6766            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
6767            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6768            let mask = 0xffffffff00000000u64;
6769            let maskedval = padval & mask;
6770            if maskedval != 0 {
6771                return Err(fidl::Error::NonZeroPadding {
6772                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
6773                });
6774            }
6775            fidl::decode!(
6776                fidl::encoding::BoundedString<255>,
6777                fidl::encoding::DefaultFuchsiaResourceDialect,
6778                &mut self.name,
6779                decoder,
6780                offset + 0,
6781                _depth
6782            )?;
6783            fidl::decode!(
6784                ChildOptions,
6785                fidl::encoding::DefaultFuchsiaResourceDialect,
6786                &mut self.options,
6787                decoder,
6788                offset + 16,
6789                _depth
6790            )?;
6791            fidl::decode!(
6792                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
6793                fidl::encoding::DefaultFuchsiaResourceDialect,
6794                &mut self.child_realm,
6795                decoder,
6796                offset + 32,
6797                _depth
6798            )?;
6799            Ok(())
6800        }
6801    }
6802
6803    impl fidl::encoding::ResourceTypeMarker for RealmAddStorageRequest {
6804        type Borrowed<'a> = &'a mut Self;
6805        fn take_or_borrow<'a>(
6806            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6807        ) -> Self::Borrowed<'a> {
6808            value
6809        }
6810    }
6811
6812    unsafe impl fidl::encoding::TypeMarker for RealmAddStorageRequest {
6813        type Owned = Self;
6814
6815        #[inline(always)]
6816        fn inline_align(_context: fidl::encoding::Context) -> usize {
6817            8
6818        }
6819
6820        #[inline(always)]
6821        fn inline_size(_context: fidl::encoding::Context) -> usize {
6822            40
6823        }
6824    }
6825
6826    unsafe impl
6827        fidl::encoding::Encode<
6828            RealmAddStorageRequest,
6829            fidl::encoding::DefaultFuchsiaResourceDialect,
6830        > for &mut RealmAddStorageRequest
6831    {
6832        #[inline]
6833        unsafe fn encode(
6834            self,
6835            encoder: &mut fidl::encoding::Encoder<
6836                '_,
6837                fidl::encoding::DefaultFuchsiaResourceDialect,
6838            >,
6839            offset: usize,
6840            _depth: fidl::encoding::Depth,
6841        ) -> fidl::Result<()> {
6842            encoder.debug_check_bounds::<RealmAddStorageRequest>(offset);
6843            // Delegate to tuple encoding.
6844            fidl::encoding::Encode::<RealmAddStorageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6845                (
6846                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
6847                    <fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref> as fidl::encoding::ValueTypeMarker>::borrow(&self.to),
6848                    <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.storage_admin),
6849                ),
6850                encoder, offset, _depth
6851            )
6852        }
6853    }
6854    unsafe impl<
6855        T0: fidl::encoding::Encode<
6856                fidl::encoding::BoundedString<255>,
6857                fidl::encoding::DefaultFuchsiaResourceDialect,
6858            >,
6859        T1: fidl::encoding::Encode<
6860                fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
6861                fidl::encoding::DefaultFuchsiaResourceDialect,
6862            >,
6863        T2: fidl::encoding::Encode<
6864                fidl::encoding::Optional<
6865                    fidl::encoding::Endpoint<
6866                        fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
6867                    >,
6868                >,
6869                fidl::encoding::DefaultFuchsiaResourceDialect,
6870            >,
6871    >
6872        fidl::encoding::Encode<
6873            RealmAddStorageRequest,
6874            fidl::encoding::DefaultFuchsiaResourceDialect,
6875        > for (T0, T1, T2)
6876    {
6877        #[inline]
6878        unsafe fn encode(
6879            self,
6880            encoder: &mut fidl::encoding::Encoder<
6881                '_,
6882                fidl::encoding::DefaultFuchsiaResourceDialect,
6883            >,
6884            offset: usize,
6885            depth: fidl::encoding::Depth,
6886        ) -> fidl::Result<()> {
6887            encoder.debug_check_bounds::<RealmAddStorageRequest>(offset);
6888            // Zero out padding regions. There's no need to apply masks
6889            // because the unmasked parts will be overwritten by fields.
6890            unsafe {
6891                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
6892                (ptr as *mut u64).write_unaligned(0);
6893            }
6894            // Write the fields.
6895            self.0.encode(encoder, offset + 0, depth)?;
6896            self.1.encode(encoder, offset + 16, depth)?;
6897            self.2.encode(encoder, offset + 32, depth)?;
6898            Ok(())
6899        }
6900    }
6901
6902    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6903        for RealmAddStorageRequest
6904    {
6905        #[inline(always)]
6906        fn new_empty() -> Self {
6907            Self {
6908                name: fidl::new_empty!(
6909                    fidl::encoding::BoundedString<255>,
6910                    fidl::encoding::DefaultFuchsiaResourceDialect
6911                ),
6912                to: fidl::new_empty!(
6913                    fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
6914                    fidl::encoding::DefaultFuchsiaResourceDialect
6915                ),
6916                storage_admin: fidl::new_empty!(
6917                    fidl::encoding::Optional<
6918                        fidl::encoding::Endpoint<
6919                            fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
6920                        >,
6921                    >,
6922                    fidl::encoding::DefaultFuchsiaResourceDialect
6923                ),
6924            }
6925        }
6926
6927        #[inline]
6928        unsafe fn decode(
6929            &mut self,
6930            decoder: &mut fidl::encoding::Decoder<
6931                '_,
6932                fidl::encoding::DefaultFuchsiaResourceDialect,
6933            >,
6934            offset: usize,
6935            _depth: fidl::encoding::Depth,
6936        ) -> fidl::Result<()> {
6937            decoder.debug_check_bounds::<Self>(offset);
6938            // Verify that padding bytes are zero.
6939            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
6940            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6941            let mask = 0xffffffff00000000u64;
6942            let maskedval = padval & mask;
6943            if maskedval != 0 {
6944                return Err(fidl::Error::NonZeroPadding {
6945                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
6946                });
6947            }
6948            fidl::decode!(
6949                fidl::encoding::BoundedString<255>,
6950                fidl::encoding::DefaultFuchsiaResourceDialect,
6951                &mut self.name,
6952                decoder,
6953                offset + 0,
6954                _depth
6955            )?;
6956            fidl::decode!(
6957                fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
6958                fidl::encoding::DefaultFuchsiaResourceDialect,
6959                &mut self.to,
6960                decoder,
6961                offset + 16,
6962                _depth
6963            )?;
6964            fidl::decode!(
6965                fidl::encoding::Optional<
6966                    fidl::encoding::Endpoint<
6967                        fidl::endpoints::ServerEnd<fidl_fuchsia_component::StorageAdminMarker>,
6968                    >,
6969                >,
6970                fidl::encoding::DefaultFuchsiaResourceDialect,
6971                &mut self.storage_admin,
6972                decoder,
6973                offset + 32,
6974                _depth
6975            )?;
6976            Ok(())
6977        }
6978    }
6979
6980    impl fidl::encoding::ResourceTypeMarker for RealmBuilderFactoryCreateFromRelativeUrlRequest {
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 RealmBuilderFactoryCreateFromRelativeUrlRequest {
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            32
7000        }
7001    }
7002
7003    unsafe impl
7004        fidl::encoding::Encode<
7005            RealmBuilderFactoryCreateFromRelativeUrlRequest,
7006            fidl::encoding::DefaultFuchsiaResourceDialect,
7007        > for &mut RealmBuilderFactoryCreateFromRelativeUrlRequest
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::<RealmBuilderFactoryCreateFromRelativeUrlRequest>(offset);
7020            // Delegate to tuple encoding.
7021            fidl::encoding::Encode::<RealmBuilderFactoryCreateFromRelativeUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7022                (
7023                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.pkg_dir_handle),
7024                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_url),
7025                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.realm_server_end),
7026                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.builder_server_end),
7027                ),
7028                encoder, offset, _depth
7029            )
7030        }
7031    }
7032    unsafe impl<
7033        T0: fidl::encoding::Encode<
7034                fidl::encoding::Endpoint<
7035                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
7036                >,
7037                fidl::encoding::DefaultFuchsiaResourceDialect,
7038            >,
7039        T1: fidl::encoding::Encode<
7040                fidl::encoding::BoundedString<4096>,
7041                fidl::encoding::DefaultFuchsiaResourceDialect,
7042            >,
7043        T2: fidl::encoding::Encode<
7044                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
7045                fidl::encoding::DefaultFuchsiaResourceDialect,
7046            >,
7047        T3: fidl::encoding::Encode<
7048                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
7049                fidl::encoding::DefaultFuchsiaResourceDialect,
7050            >,
7051    >
7052        fidl::encoding::Encode<
7053            RealmBuilderFactoryCreateFromRelativeUrlRequest,
7054            fidl::encoding::DefaultFuchsiaResourceDialect,
7055        > for (T0, T1, T2, T3)
7056    {
7057        #[inline]
7058        unsafe fn encode(
7059            self,
7060            encoder: &mut fidl::encoding::Encoder<
7061                '_,
7062                fidl::encoding::DefaultFuchsiaResourceDialect,
7063            >,
7064            offset: usize,
7065            depth: fidl::encoding::Depth,
7066        ) -> fidl::Result<()> {
7067            encoder.debug_check_bounds::<RealmBuilderFactoryCreateFromRelativeUrlRequest>(offset);
7068            // Zero out padding regions. There's no need to apply masks
7069            // because the unmasked parts will be overwritten by fields.
7070            unsafe {
7071                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
7072                (ptr as *mut u64).write_unaligned(0);
7073            }
7074            // Write the fields.
7075            self.0.encode(encoder, offset + 0, depth)?;
7076            self.1.encode(encoder, offset + 8, depth)?;
7077            self.2.encode(encoder, offset + 24, depth)?;
7078            self.3.encode(encoder, offset + 28, depth)?;
7079            Ok(())
7080        }
7081    }
7082
7083    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7084        for RealmBuilderFactoryCreateFromRelativeUrlRequest
7085    {
7086        #[inline(always)]
7087        fn new_empty() -> Self {
7088            Self {
7089                pkg_dir_handle: fidl::new_empty!(
7090                    fidl::encoding::Endpoint<
7091                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
7092                    >,
7093                    fidl::encoding::DefaultFuchsiaResourceDialect
7094                ),
7095                relative_url: fidl::new_empty!(
7096                    fidl::encoding::BoundedString<4096>,
7097                    fidl::encoding::DefaultFuchsiaResourceDialect
7098                ),
7099                realm_server_end: fidl::new_empty!(
7100                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
7101                    fidl::encoding::DefaultFuchsiaResourceDialect
7102                ),
7103                builder_server_end: fidl::new_empty!(
7104                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
7105                    fidl::encoding::DefaultFuchsiaResourceDialect
7106                ),
7107            }
7108        }
7109
7110        #[inline]
7111        unsafe fn decode(
7112            &mut self,
7113            decoder: &mut fidl::encoding::Decoder<
7114                '_,
7115                fidl::encoding::DefaultFuchsiaResourceDialect,
7116            >,
7117            offset: usize,
7118            _depth: fidl::encoding::Depth,
7119        ) -> fidl::Result<()> {
7120            decoder.debug_check_bounds::<Self>(offset);
7121            // Verify that padding bytes are zero.
7122            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
7123            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7124            let mask = 0xffffffff00000000u64;
7125            let maskedval = padval & mask;
7126            if maskedval != 0 {
7127                return Err(fidl::Error::NonZeroPadding {
7128                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
7129                });
7130            }
7131            fidl::decode!(
7132                fidl::encoding::Endpoint<
7133                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
7134                >,
7135                fidl::encoding::DefaultFuchsiaResourceDialect,
7136                &mut self.pkg_dir_handle,
7137                decoder,
7138                offset + 0,
7139                _depth
7140            )?;
7141            fidl::decode!(
7142                fidl::encoding::BoundedString<4096>,
7143                fidl::encoding::DefaultFuchsiaResourceDialect,
7144                &mut self.relative_url,
7145                decoder,
7146                offset + 8,
7147                _depth
7148            )?;
7149            fidl::decode!(
7150                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
7151                fidl::encoding::DefaultFuchsiaResourceDialect,
7152                &mut self.realm_server_end,
7153                decoder,
7154                offset + 24,
7155                _depth
7156            )?;
7157            fidl::decode!(
7158                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
7159                fidl::encoding::DefaultFuchsiaResourceDialect,
7160                &mut self.builder_server_end,
7161                decoder,
7162                offset + 28,
7163                _depth
7164            )?;
7165            Ok(())
7166        }
7167    }
7168
7169    impl fidl::encoding::ResourceTypeMarker for RealmBuilderFactoryCreateRequest {
7170        type Borrowed<'a> = &'a mut Self;
7171        fn take_or_borrow<'a>(
7172            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7173        ) -> Self::Borrowed<'a> {
7174            value
7175        }
7176    }
7177
7178    unsafe impl fidl::encoding::TypeMarker for RealmBuilderFactoryCreateRequest {
7179        type Owned = Self;
7180
7181        #[inline(always)]
7182        fn inline_align(_context: fidl::encoding::Context) -> usize {
7183            4
7184        }
7185
7186        #[inline(always)]
7187        fn inline_size(_context: fidl::encoding::Context) -> usize {
7188            12
7189        }
7190    }
7191
7192    unsafe impl
7193        fidl::encoding::Encode<
7194            RealmBuilderFactoryCreateRequest,
7195            fidl::encoding::DefaultFuchsiaResourceDialect,
7196        > for &mut RealmBuilderFactoryCreateRequest
7197    {
7198        #[inline]
7199        unsafe fn encode(
7200            self,
7201            encoder: &mut fidl::encoding::Encoder<
7202                '_,
7203                fidl::encoding::DefaultFuchsiaResourceDialect,
7204            >,
7205            offset: usize,
7206            _depth: fidl::encoding::Depth,
7207        ) -> fidl::Result<()> {
7208            encoder.debug_check_bounds::<RealmBuilderFactoryCreateRequest>(offset);
7209            // Delegate to tuple encoding.
7210            fidl::encoding::Encode::<RealmBuilderFactoryCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7211                (
7212                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.pkg_dir_handle),
7213                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.realm_server_end),
7214                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.builder_server_end),
7215                ),
7216                encoder, offset, _depth
7217            )
7218        }
7219    }
7220    unsafe impl<
7221        T0: fidl::encoding::Encode<
7222                fidl::encoding::Endpoint<
7223                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
7224                >,
7225                fidl::encoding::DefaultFuchsiaResourceDialect,
7226            >,
7227        T1: fidl::encoding::Encode<
7228                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
7229                fidl::encoding::DefaultFuchsiaResourceDialect,
7230            >,
7231        T2: fidl::encoding::Encode<
7232                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
7233                fidl::encoding::DefaultFuchsiaResourceDialect,
7234            >,
7235    >
7236        fidl::encoding::Encode<
7237            RealmBuilderFactoryCreateRequest,
7238            fidl::encoding::DefaultFuchsiaResourceDialect,
7239        > for (T0, T1, T2)
7240    {
7241        #[inline]
7242        unsafe fn encode(
7243            self,
7244            encoder: &mut fidl::encoding::Encoder<
7245                '_,
7246                fidl::encoding::DefaultFuchsiaResourceDialect,
7247            >,
7248            offset: usize,
7249            depth: fidl::encoding::Depth,
7250        ) -> fidl::Result<()> {
7251            encoder.debug_check_bounds::<RealmBuilderFactoryCreateRequest>(offset);
7252            // Zero out padding regions. There's no need to apply masks
7253            // because the unmasked parts will be overwritten by fields.
7254            // Write the fields.
7255            self.0.encode(encoder, offset + 0, depth)?;
7256            self.1.encode(encoder, offset + 4, depth)?;
7257            self.2.encode(encoder, offset + 8, depth)?;
7258            Ok(())
7259        }
7260    }
7261
7262    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7263        for RealmBuilderFactoryCreateRequest
7264    {
7265        #[inline(always)]
7266        fn new_empty() -> Self {
7267            Self {
7268                pkg_dir_handle: fidl::new_empty!(
7269                    fidl::encoding::Endpoint<
7270                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
7271                    >,
7272                    fidl::encoding::DefaultFuchsiaResourceDialect
7273                ),
7274                realm_server_end: fidl::new_empty!(
7275                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
7276                    fidl::encoding::DefaultFuchsiaResourceDialect
7277                ),
7278                builder_server_end: fidl::new_empty!(
7279                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
7280                    fidl::encoding::DefaultFuchsiaResourceDialect
7281                ),
7282            }
7283        }
7284
7285        #[inline]
7286        unsafe fn decode(
7287            &mut self,
7288            decoder: &mut fidl::encoding::Decoder<
7289                '_,
7290                fidl::encoding::DefaultFuchsiaResourceDialect,
7291            >,
7292            offset: usize,
7293            _depth: fidl::encoding::Depth,
7294        ) -> fidl::Result<()> {
7295            decoder.debug_check_bounds::<Self>(offset);
7296            // Verify that padding bytes are zero.
7297            fidl::decode!(
7298                fidl::encoding::Endpoint<
7299                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
7300                >,
7301                fidl::encoding::DefaultFuchsiaResourceDialect,
7302                &mut self.pkg_dir_handle,
7303                decoder,
7304                offset + 0,
7305                _depth
7306            )?;
7307            fidl::decode!(
7308                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
7309                fidl::encoding::DefaultFuchsiaResourceDialect,
7310                &mut self.realm_server_end,
7311                decoder,
7312                offset + 4,
7313                _depth
7314            )?;
7315            fidl::decode!(
7316                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
7317                fidl::encoding::DefaultFuchsiaResourceDialect,
7318                &mut self.builder_server_end,
7319                decoder,
7320                offset + 8,
7321                _depth
7322            )?;
7323            Ok(())
7324        }
7325    }
7326
7327    impl fidl::encoding::ResourceTypeMarker for RealmReadOnlyDirectoryRequest {
7328        type Borrowed<'a> = &'a mut Self;
7329        fn take_or_borrow<'a>(
7330            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7331        ) -> Self::Borrowed<'a> {
7332            value
7333        }
7334    }
7335
7336    unsafe impl fidl::encoding::TypeMarker for RealmReadOnlyDirectoryRequest {
7337        type Owned = Self;
7338
7339        #[inline(always)]
7340        fn inline_align(_context: fidl::encoding::Context) -> usize {
7341            8
7342        }
7343
7344        #[inline(always)]
7345        fn inline_size(_context: fidl::encoding::Context) -> usize {
7346            48
7347        }
7348    }
7349
7350    unsafe impl
7351        fidl::encoding::Encode<
7352            RealmReadOnlyDirectoryRequest,
7353            fidl::encoding::DefaultFuchsiaResourceDialect,
7354        > for &mut RealmReadOnlyDirectoryRequest
7355    {
7356        #[inline]
7357        unsafe fn encode(
7358            self,
7359            encoder: &mut fidl::encoding::Encoder<
7360                '_,
7361                fidl::encoding::DefaultFuchsiaResourceDialect,
7362            >,
7363            offset: usize,
7364            _depth: fidl::encoding::Depth,
7365        ) -> fidl::Result<()> {
7366            encoder.debug_check_bounds::<RealmReadOnlyDirectoryRequest>(offset);
7367            // Delegate to tuple encoding.
7368            fidl::encoding::Encode::<RealmReadOnlyDirectoryRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7369                (
7370                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
7371                    <fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref> as fidl::encoding::ValueTypeMarker>::borrow(&self.to),
7372                    <DirectoryContents as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.directory_contents),
7373                ),
7374                encoder, offset, _depth
7375            )
7376        }
7377    }
7378    unsafe impl<
7379        T0: fidl::encoding::Encode<
7380                fidl::encoding::BoundedString<255>,
7381                fidl::encoding::DefaultFuchsiaResourceDialect,
7382            >,
7383        T1: fidl::encoding::Encode<
7384                fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
7385                fidl::encoding::DefaultFuchsiaResourceDialect,
7386            >,
7387        T2: fidl::encoding::Encode<DirectoryContents, fidl::encoding::DefaultFuchsiaResourceDialect>,
7388    >
7389        fidl::encoding::Encode<
7390            RealmReadOnlyDirectoryRequest,
7391            fidl::encoding::DefaultFuchsiaResourceDialect,
7392        > for (T0, T1, T2)
7393    {
7394        #[inline]
7395        unsafe fn encode(
7396            self,
7397            encoder: &mut fidl::encoding::Encoder<
7398                '_,
7399                fidl::encoding::DefaultFuchsiaResourceDialect,
7400            >,
7401            offset: usize,
7402            depth: fidl::encoding::Depth,
7403        ) -> fidl::Result<()> {
7404            encoder.debug_check_bounds::<RealmReadOnlyDirectoryRequest>(offset);
7405            // Zero out padding regions. There's no need to apply masks
7406            // because the unmasked parts will be overwritten by fields.
7407            // Write the fields.
7408            self.0.encode(encoder, offset + 0, depth)?;
7409            self.1.encode(encoder, offset + 16, depth)?;
7410            self.2.encode(encoder, offset + 32, depth)?;
7411            Ok(())
7412        }
7413    }
7414
7415    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7416        for RealmReadOnlyDirectoryRequest
7417    {
7418        #[inline(always)]
7419        fn new_empty() -> Self {
7420            Self {
7421                name: fidl::new_empty!(
7422                    fidl::encoding::BoundedString<255>,
7423                    fidl::encoding::DefaultFuchsiaResourceDialect
7424                ),
7425                to: fidl::new_empty!(
7426                    fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
7427                    fidl::encoding::DefaultFuchsiaResourceDialect
7428                ),
7429                directory_contents: fidl::new_empty!(
7430                    DirectoryContents,
7431                    fidl::encoding::DefaultFuchsiaResourceDialect
7432                ),
7433            }
7434        }
7435
7436        #[inline]
7437        unsafe fn decode(
7438            &mut self,
7439            decoder: &mut fidl::encoding::Decoder<
7440                '_,
7441                fidl::encoding::DefaultFuchsiaResourceDialect,
7442            >,
7443            offset: usize,
7444            _depth: fidl::encoding::Depth,
7445        ) -> fidl::Result<()> {
7446            decoder.debug_check_bounds::<Self>(offset);
7447            // Verify that padding bytes are zero.
7448            fidl::decode!(
7449                fidl::encoding::BoundedString<255>,
7450                fidl::encoding::DefaultFuchsiaResourceDialect,
7451                &mut self.name,
7452                decoder,
7453                offset + 0,
7454                _depth
7455            )?;
7456            fidl::decode!(
7457                fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
7458                fidl::encoding::DefaultFuchsiaResourceDialect,
7459                &mut self.to,
7460                decoder,
7461                offset + 16,
7462                _depth
7463            )?;
7464            fidl::decode!(
7465                DirectoryContents,
7466                fidl::encoding::DefaultFuchsiaResourceDialect,
7467                &mut self.directory_contents,
7468                decoder,
7469                offset + 32,
7470                _depth
7471            )?;
7472            Ok(())
7473        }
7474    }
7475}