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