fidl_fuchsia_driver_test/
fidl_fuchsia_driver_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_driver_test__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct InternalGetBootDirectoryResponse {
16    pub boot_dir: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for InternalGetBootDirectoryResponse
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct InternalGetTestPackageResponse {
26    pub test_pkg_dir: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for InternalGetTestPackageResponse
31{
32}
33
34#[derive(Debug, PartialEq)]
35pub struct RealmStartRequest {
36    pub args: RealmArgs,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmStartRequest {}
40
41/// A list of arguments that can be used to configure DriverTestRealm.
42#[derive(Debug, Default, PartialEq)]
43pub struct RealmArgs {
44    /// This is what DriverManager will see as its boot directory.
45    /// Default: DriverTestRealm's package directory
46    pub boot: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
47    /// The URL for the driver that will be bound to root.
48    /// Default: fuchsia-boot:///dtr#meta/test-parent-sys.cm
49    /// NOTE: The test parent driver is not included by default. This must
50    ///  be included in your package to work correctly.
51    pub root_driver: Option<String>,
52    /// If this is true, then DriverManager will enable the unit tests
53    /// for each driver that is loaded.
54    /// Default: false
55    pub driver_tests_enable_all: Option<bool>,
56    /// If this is true, then DriverManager will enable the unit tests
57    /// for each driver in this vector.
58    /// Default: empty
59    pub driver_tests_enable: Option<Vec<String>>,
60    /// If this is true, then DriverManager will disable the unit tests
61    /// for each driver in this vector. This overrides both a specific
62    /// request for enabling a test and the 'driver_tests_enable_all'
63    /// parameter.
64    /// Default: empty
65    pub driver_tests_disable: Option<Vec<String>>,
66    /// Set a log level for the specific driver.
67    /// Default: Log levels are set to INFO
68    pub driver_log_level: Option<Vec<DriverLog>>,
69    /// Disable specific drivers. These drivers will not be bound or loaded.
70    /// Default: empty
71    pub driver_disable: Option<Vec<String>>,
72    /// Specify drivers to bind 'eagerly'. This turns a driver that normally
73    /// binds as a fallback driver into a driver that will be bound normally.
74    /// Default: empty
75    pub driver_bind_eager: Option<Vec<String>>,
76    /// Specify the board name that drivers are aware of.
77    /// Default: driver-integration-test
78    pub board_name: Option<String>,
79    /// DEPRECATED: Use dtr_offers.
80    /// Specify additional offers from the test to a driver collection
81    /// Default: empty
82    pub offers: Option<Vec<Offer>>,
83    /// DEPRECATED: Use dtr_exposes.
84    /// Specify services to expose from the test to a driver collection
85    /// Default: empty
86    pub exposes: Option<Vec<Expose>>,
87    /// DEPRECATED: Use test_component to provide resolved test component.
88    /// The driver test realm can load drivers packaged with the test suite
89    /// through this directory. Note that this directory must be readable
90    /// and executable.
91    ///
92    /// This can be used if the test suite needs to use some drivers packaged
93    /// with the DriverTestRealm in addition to drivers packaged with the test
94    /// suite. In that case, the user can leave RealmArgs::boot unset and use
95    /// RealmArgs::pkg and RealmArgs::driver_urls.
96    ///
97    /// Drivers in this directory can be registered using the `driver_urls`
98    /// argument below.
99    ///
100    /// Default: DriverTestRealm's package directory.
101    pub pkg: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
102    /// Specify offers from the test to the driver test realm.
103    /// The driver test realm will forward these to the driver collections.
104    /// Default: empty
105    pub dtr_offers: Option<Vec<fidl_fuchsia_component_test::Capability>>,
106    /// Specify exposes from the driver test realm to the test.
107    /// The driver test realm will forward these from the driver collections.
108    /// Default: empty
109    pub dtr_exposes: Option<Vec<fidl_fuchsia_component_test::Capability>>,
110    /// The resolved component information of the test component that is starting
111    /// the driver test realm. This will be used to discover drivers that the test
112    /// wants to provide to the driver test realm. Drivers can be both in the test
113    /// component package, or a subpackage of the test component package.
114    /// By default all drivers discovered that don't also exist in the |boot| directory
115    /// will be considered to be base drivers.
116    /// Use |boot_driver_components| to provide a list of drivers that should be
117    /// boot drivers.
118    /// Default: empty
119    pub test_component: Option<fidl_fuchsia_component_resolution::Component>,
120    /// How long the driver index waits idle before it saves state, escrows its handles
121    /// with the component framework, and shuts down.
122    /// Default: never shuts down
123    pub driver_index_stop_timeout_millis: Option<i64>,
124    /// A list of software only devices that should be created. Typically this is used
125    /// to create fake hardware for tests. Devices will be spawned as platform devices
126    /// under the platform bus. Note that the platform bus must be the root driver for
127    /// this to do anything meaningful.
128    pub software_devices: Option<Vec<SoftwareDevice>>,
129    /// The list of driver component names that should be considered as boot drivers.
130    /// Boot drivers are started in the boot-drivers collection which has more
131    /// capabilities available to it.
132    /// Entries should be the component name (eg: "my_driver_component.cm").
133    /// Default: empty
134    pub boot_driver_components: Option<Vec<String>>,
135    /// Devicetree blob that should be handed to the board driver.
136    pub devicetree: Option<fidl::Vmo>,
137    /// Platform Vendor ID which should be specified to the platform bus driver.
138    pub platform_vid: Option<u32>,
139    /// Platform ID which should be specified to the platform bus driver.
140    pub platform_pid: Option<u32>,
141    #[doc(hidden)]
142    pub __source_breaking: fidl::marker::SourceBreaking,
143}
144
145impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmArgs {}
146
147#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
148pub struct DriverListsMarker;
149
150impl fidl::endpoints::ProtocolMarker for DriverListsMarker {
151    type Proxy = DriverListsProxy;
152    type RequestStream = DriverListsRequestStream;
153    #[cfg(target_os = "fuchsia")]
154    type SynchronousProxy = DriverListsSynchronousProxy;
155
156    const DEBUG_NAME: &'static str = "fuchsia.driver.test.DriverLists";
157}
158impl fidl::endpoints::DiscoverableProtocolMarker for DriverListsMarker {}
159pub type DriverListsGetDriverListsResult = Result<(Vec<String>, Vec<String>), i32>;
160
161pub trait DriverListsProxyInterface: Send + Sync {
162    type GetDriverListsResponseFut: std::future::Future<Output = Result<DriverListsGetDriverListsResult, fidl::Error>>
163        + Send;
164    fn r#get_driver_lists(&self) -> Self::GetDriverListsResponseFut;
165}
166#[derive(Debug)]
167#[cfg(target_os = "fuchsia")]
168pub struct DriverListsSynchronousProxy {
169    client: fidl::client::sync::Client,
170}
171
172#[cfg(target_os = "fuchsia")]
173impl fidl::endpoints::SynchronousProxy for DriverListsSynchronousProxy {
174    type Proxy = DriverListsProxy;
175    type Protocol = DriverListsMarker;
176
177    fn from_channel(inner: fidl::Channel) -> Self {
178        Self::new(inner)
179    }
180
181    fn into_channel(self) -> fidl::Channel {
182        self.client.into_channel()
183    }
184
185    fn as_channel(&self) -> &fidl::Channel {
186        self.client.as_channel()
187    }
188}
189
190#[cfg(target_os = "fuchsia")]
191impl DriverListsSynchronousProxy {
192    pub fn new(channel: fidl::Channel) -> Self {
193        let protocol_name = <DriverListsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
194        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
195    }
196
197    pub fn into_channel(self) -> fidl::Channel {
198        self.client.into_channel()
199    }
200
201    /// Waits until an event arrives and returns it. It is safe for other
202    /// threads to make concurrent requests while waiting for an event.
203    pub fn wait_for_event(
204        &self,
205        deadline: zx::MonotonicInstant,
206    ) -> Result<DriverListsEvent, fidl::Error> {
207        DriverListsEvent::decode(self.client.wait_for_event(deadline)?)
208    }
209
210    pub fn r#get_driver_lists(
211        &self,
212        ___deadline: zx::MonotonicInstant,
213    ) -> Result<DriverListsGetDriverListsResult, fidl::Error> {
214        let _response = self.client.send_query::<
215            fidl::encoding::EmptyPayload,
216            fidl::encoding::ResultType<DriverListsGetDriverListsResponse, i32>,
217        >(
218            (),
219            0x63c3de40e768357,
220            fidl::encoding::DynamicFlags::empty(),
221            ___deadline,
222        )?;
223        Ok(_response.map(|x| (x.boot_drivers, x.base_drivers)))
224    }
225}
226
227#[cfg(target_os = "fuchsia")]
228impl From<DriverListsSynchronousProxy> for zx::Handle {
229    fn from(value: DriverListsSynchronousProxy) -> Self {
230        value.into_channel().into()
231    }
232}
233
234#[cfg(target_os = "fuchsia")]
235impl From<fidl::Channel> for DriverListsSynchronousProxy {
236    fn from(value: fidl::Channel) -> Self {
237        Self::new(value)
238    }
239}
240
241#[cfg(target_os = "fuchsia")]
242impl fidl::endpoints::FromClient for DriverListsSynchronousProxy {
243    type Protocol = DriverListsMarker;
244
245    fn from_client(value: fidl::endpoints::ClientEnd<DriverListsMarker>) -> Self {
246        Self::new(value.into_channel())
247    }
248}
249
250#[derive(Debug, Clone)]
251pub struct DriverListsProxy {
252    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
253}
254
255impl fidl::endpoints::Proxy for DriverListsProxy {
256    type Protocol = DriverListsMarker;
257
258    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
259        Self::new(inner)
260    }
261
262    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
263        self.client.into_channel().map_err(|client| Self { client })
264    }
265
266    fn as_channel(&self) -> &::fidl::AsyncChannel {
267        self.client.as_channel()
268    }
269}
270
271impl DriverListsProxy {
272    /// Create a new Proxy for fuchsia.driver.test/DriverLists.
273    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
274        let protocol_name = <DriverListsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
275        Self { client: fidl::client::Client::new(channel, protocol_name) }
276    }
277
278    /// Get a Stream of events from the remote end of the protocol.
279    ///
280    /// # Panics
281    ///
282    /// Panics if the event stream was already taken.
283    pub fn take_event_stream(&self) -> DriverListsEventStream {
284        DriverListsEventStream { event_receiver: self.client.take_event_receiver() }
285    }
286
287    pub fn r#get_driver_lists(
288        &self,
289    ) -> fidl::client::QueryResponseFut<
290        DriverListsGetDriverListsResult,
291        fidl::encoding::DefaultFuchsiaResourceDialect,
292    > {
293        DriverListsProxyInterface::r#get_driver_lists(self)
294    }
295}
296
297impl DriverListsProxyInterface for DriverListsProxy {
298    type GetDriverListsResponseFut = fidl::client::QueryResponseFut<
299        DriverListsGetDriverListsResult,
300        fidl::encoding::DefaultFuchsiaResourceDialect,
301    >;
302    fn r#get_driver_lists(&self) -> Self::GetDriverListsResponseFut {
303        fn _decode(
304            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
305        ) -> Result<DriverListsGetDriverListsResult, fidl::Error> {
306            let _response = fidl::client::decode_transaction_body::<
307                fidl::encoding::ResultType<DriverListsGetDriverListsResponse, i32>,
308                fidl::encoding::DefaultFuchsiaResourceDialect,
309                0x63c3de40e768357,
310            >(_buf?)?;
311            Ok(_response.map(|x| (x.boot_drivers, x.base_drivers)))
312        }
313        self.client
314            .send_query_and_decode::<fidl::encoding::EmptyPayload, DriverListsGetDriverListsResult>(
315                (),
316                0x63c3de40e768357,
317                fidl::encoding::DynamicFlags::empty(),
318                _decode,
319            )
320    }
321}
322
323pub struct DriverListsEventStream {
324    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
325}
326
327impl std::marker::Unpin for DriverListsEventStream {}
328
329impl futures::stream::FusedStream for DriverListsEventStream {
330    fn is_terminated(&self) -> bool {
331        self.event_receiver.is_terminated()
332    }
333}
334
335impl futures::Stream for DriverListsEventStream {
336    type Item = Result<DriverListsEvent, fidl::Error>;
337
338    fn poll_next(
339        mut self: std::pin::Pin<&mut Self>,
340        cx: &mut std::task::Context<'_>,
341    ) -> std::task::Poll<Option<Self::Item>> {
342        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
343            &mut self.event_receiver,
344            cx
345        )?) {
346            Some(buf) => std::task::Poll::Ready(Some(DriverListsEvent::decode(buf))),
347            None => std::task::Poll::Ready(None),
348        }
349    }
350}
351
352#[derive(Debug)]
353pub enum DriverListsEvent {}
354
355impl DriverListsEvent {
356    /// Decodes a message buffer as a [`DriverListsEvent`].
357    fn decode(
358        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
359    ) -> Result<DriverListsEvent, fidl::Error> {
360        let (bytes, _handles) = buf.split_mut();
361        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
362        debug_assert_eq!(tx_header.tx_id, 0);
363        match tx_header.ordinal {
364            _ => Err(fidl::Error::UnknownOrdinal {
365                ordinal: tx_header.ordinal,
366                protocol_name: <DriverListsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
367            }),
368        }
369    }
370}
371
372/// A Stream of incoming requests for fuchsia.driver.test/DriverLists.
373pub struct DriverListsRequestStream {
374    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
375    is_terminated: bool,
376}
377
378impl std::marker::Unpin for DriverListsRequestStream {}
379
380impl futures::stream::FusedStream for DriverListsRequestStream {
381    fn is_terminated(&self) -> bool {
382        self.is_terminated
383    }
384}
385
386impl fidl::endpoints::RequestStream for DriverListsRequestStream {
387    type Protocol = DriverListsMarker;
388    type ControlHandle = DriverListsControlHandle;
389
390    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
391        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
392    }
393
394    fn control_handle(&self) -> Self::ControlHandle {
395        DriverListsControlHandle { inner: self.inner.clone() }
396    }
397
398    fn into_inner(
399        self,
400    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
401    {
402        (self.inner, self.is_terminated)
403    }
404
405    fn from_inner(
406        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
407        is_terminated: bool,
408    ) -> Self {
409        Self { inner, is_terminated }
410    }
411}
412
413impl futures::Stream for DriverListsRequestStream {
414    type Item = Result<DriverListsRequest, fidl::Error>;
415
416    fn poll_next(
417        mut self: std::pin::Pin<&mut Self>,
418        cx: &mut std::task::Context<'_>,
419    ) -> std::task::Poll<Option<Self::Item>> {
420        let this = &mut *self;
421        if this.inner.check_shutdown(cx) {
422            this.is_terminated = true;
423            return std::task::Poll::Ready(None);
424        }
425        if this.is_terminated {
426            panic!("polled DriverListsRequestStream after completion");
427        }
428        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
429            |bytes, handles| {
430                match this.inner.channel().read_etc(cx, bytes, handles) {
431                    std::task::Poll::Ready(Ok(())) => {}
432                    std::task::Poll::Pending => return std::task::Poll::Pending,
433                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
434                        this.is_terminated = true;
435                        return std::task::Poll::Ready(None);
436                    }
437                    std::task::Poll::Ready(Err(e)) => {
438                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
439                            e.into(),
440                        ))));
441                    }
442                }
443
444                // A message has been received from the channel
445                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
446
447                std::task::Poll::Ready(Some(match header.ordinal {
448                    0x63c3de40e768357 => {
449                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
450                        let mut req = fidl::new_empty!(
451                            fidl::encoding::EmptyPayload,
452                            fidl::encoding::DefaultFuchsiaResourceDialect
453                        );
454                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
455                        let control_handle = DriverListsControlHandle { inner: this.inner.clone() };
456                        Ok(DriverListsRequest::GetDriverLists {
457                            responder: DriverListsGetDriverListsResponder {
458                                control_handle: std::mem::ManuallyDrop::new(control_handle),
459                                tx_id: header.tx_id,
460                            },
461                        })
462                    }
463                    _ => Err(fidl::Error::UnknownOrdinal {
464                        ordinal: header.ordinal,
465                        protocol_name:
466                            <DriverListsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
467                    }),
468                }))
469            },
470        )
471    }
472}
473
474/// This protocol is served when running with the driver_test_realm to be used by the
475/// driver index to dynamically get the list of drivers.
476#[derive(Debug)]
477pub enum DriverListsRequest {
478    GetDriverLists { responder: DriverListsGetDriverListsResponder },
479}
480
481impl DriverListsRequest {
482    #[allow(irrefutable_let_patterns)]
483    pub fn into_get_driver_lists(self) -> Option<(DriverListsGetDriverListsResponder)> {
484        if let DriverListsRequest::GetDriverLists { responder } = self {
485            Some((responder))
486        } else {
487            None
488        }
489    }
490
491    /// Name of the method defined in FIDL
492    pub fn method_name(&self) -> &'static str {
493        match *self {
494            DriverListsRequest::GetDriverLists { .. } => "get_driver_lists",
495        }
496    }
497}
498
499#[derive(Debug, Clone)]
500pub struct DriverListsControlHandle {
501    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
502}
503
504impl fidl::endpoints::ControlHandle for DriverListsControlHandle {
505    fn shutdown(&self) {
506        self.inner.shutdown()
507    }
508    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
509        self.inner.shutdown_with_epitaph(status)
510    }
511
512    fn is_closed(&self) -> bool {
513        self.inner.channel().is_closed()
514    }
515    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
516        self.inner.channel().on_closed()
517    }
518
519    #[cfg(target_os = "fuchsia")]
520    fn signal_peer(
521        &self,
522        clear_mask: zx::Signals,
523        set_mask: zx::Signals,
524    ) -> Result<(), zx_status::Status> {
525        use fidl::Peered;
526        self.inner.channel().signal_peer(clear_mask, set_mask)
527    }
528}
529
530impl DriverListsControlHandle {}
531
532#[must_use = "FIDL methods require a response to be sent"]
533#[derive(Debug)]
534pub struct DriverListsGetDriverListsResponder {
535    control_handle: std::mem::ManuallyDrop<DriverListsControlHandle>,
536    tx_id: u32,
537}
538
539/// Set the the channel to be shutdown (see [`DriverListsControlHandle::shutdown`])
540/// if the responder is dropped without sending a response, so that the client
541/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
542impl std::ops::Drop for DriverListsGetDriverListsResponder {
543    fn drop(&mut self) {
544        self.control_handle.shutdown();
545        // Safety: drops once, never accessed again
546        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
547    }
548}
549
550impl fidl::endpoints::Responder for DriverListsGetDriverListsResponder {
551    type ControlHandle = DriverListsControlHandle;
552
553    fn control_handle(&self) -> &DriverListsControlHandle {
554        &self.control_handle
555    }
556
557    fn drop_without_shutdown(mut self) {
558        // Safety: drops once, never accessed again due to mem::forget
559        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
560        // Prevent Drop from running (which would shut down the channel)
561        std::mem::forget(self);
562    }
563}
564
565impl DriverListsGetDriverListsResponder {
566    /// Sends a response to the FIDL transaction.
567    ///
568    /// Sets the channel to shutdown if an error occurs.
569    pub fn send(self, mut result: Result<(&[String], &[String]), i32>) -> Result<(), fidl::Error> {
570        let _result = self.send_raw(result);
571        if _result.is_err() {
572            self.control_handle.shutdown();
573        }
574        self.drop_without_shutdown();
575        _result
576    }
577
578    /// Similar to "send" but does not shutdown the channel if an error occurs.
579    pub fn send_no_shutdown_on_err(
580        self,
581        mut result: Result<(&[String], &[String]), i32>,
582    ) -> Result<(), fidl::Error> {
583        let _result = self.send_raw(result);
584        self.drop_without_shutdown();
585        _result
586    }
587
588    fn send_raw(&self, mut result: Result<(&[String], &[String]), i32>) -> Result<(), fidl::Error> {
589        self.control_handle
590            .inner
591            .send::<fidl::encoding::ResultType<DriverListsGetDriverListsResponse, i32>>(
592                result,
593                self.tx_id,
594                0x63c3de40e768357,
595                fidl::encoding::DynamicFlags::empty(),
596            )
597    }
598}
599
600#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
601pub struct InternalMarker;
602
603impl fidl::endpoints::ProtocolMarker for InternalMarker {
604    type Proxy = InternalProxy;
605    type RequestStream = InternalRequestStream;
606    #[cfg(target_os = "fuchsia")]
607    type SynchronousProxy = InternalSynchronousProxy;
608
609    const DEBUG_NAME: &'static str = "fuchsia.driver.test.Internal";
610}
611impl fidl::endpoints::DiscoverableProtocolMarker for InternalMarker {}
612pub type InternalGetTestPackageResult =
613    Result<Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>, i32>;
614pub type InternalGetTestResolutionContextResult =
615    Result<Option<Box<fidl_fuchsia_component_resolution::Context>>, i32>;
616pub type InternalGetBootDirectoryResult =
617    Result<Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>, i32>;
618pub type InternalGetBootDriverOverridesResult = Result<Vec<String>, i32>;
619
620pub trait InternalProxyInterface: Send + Sync {
621    type GetTestPackageResponseFut: std::future::Future<Output = Result<InternalGetTestPackageResult, fidl::Error>>
622        + Send;
623    fn r#get_test_package(&self) -> Self::GetTestPackageResponseFut;
624    type GetTestResolutionContextResponseFut: std::future::Future<Output = Result<InternalGetTestResolutionContextResult, fidl::Error>>
625        + Send;
626    fn r#get_test_resolution_context(&self) -> Self::GetTestResolutionContextResponseFut;
627    type GetBootDirectoryResponseFut: std::future::Future<Output = Result<InternalGetBootDirectoryResult, fidl::Error>>
628        + Send;
629    fn r#get_boot_directory(&self) -> Self::GetBootDirectoryResponseFut;
630    type GetBootDriverOverridesResponseFut: std::future::Future<Output = Result<InternalGetBootDriverOverridesResult, fidl::Error>>
631        + Send;
632    fn r#get_boot_driver_overrides(&self) -> Self::GetBootDriverOverridesResponseFut;
633}
634#[derive(Debug)]
635#[cfg(target_os = "fuchsia")]
636pub struct InternalSynchronousProxy {
637    client: fidl::client::sync::Client,
638}
639
640#[cfg(target_os = "fuchsia")]
641impl fidl::endpoints::SynchronousProxy for InternalSynchronousProxy {
642    type Proxy = InternalProxy;
643    type Protocol = InternalMarker;
644
645    fn from_channel(inner: fidl::Channel) -> Self {
646        Self::new(inner)
647    }
648
649    fn into_channel(self) -> fidl::Channel {
650        self.client.into_channel()
651    }
652
653    fn as_channel(&self) -> &fidl::Channel {
654        self.client.as_channel()
655    }
656}
657
658#[cfg(target_os = "fuchsia")]
659impl InternalSynchronousProxy {
660    pub fn new(channel: fidl::Channel) -> Self {
661        let protocol_name = <InternalMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
662        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
663    }
664
665    pub fn into_channel(self) -> fidl::Channel {
666        self.client.into_channel()
667    }
668
669    /// Waits until an event arrives and returns it. It is safe for other
670    /// threads to make concurrent requests while waiting for an event.
671    pub fn wait_for_event(
672        &self,
673        deadline: zx::MonotonicInstant,
674    ) -> Result<InternalEvent, fidl::Error> {
675        InternalEvent::decode(self.client.wait_for_event(deadline)?)
676    }
677
678    /// Gets the test component's package directory. This is used to read drivers in this package.
679    /// If a test resolution context is available through |GetTestResolutionContext|, subpackages
680    /// in this test package are also discovered.
681    pub fn r#get_test_package(
682        &self,
683        ___deadline: zx::MonotonicInstant,
684    ) -> Result<InternalGetTestPackageResult, fidl::Error> {
685        let _response = self.client.send_query::<
686            fidl::encoding::EmptyPayload,
687            fidl::encoding::ResultType<InternalGetTestPackageResponse, i32>,
688        >(
689            (),
690            0x298c1d6e57d57db8,
691            fidl::encoding::DynamicFlags::empty(),
692            ___deadline,
693        )?;
694        Ok(_response.map(|x| x.test_pkg_dir))
695    }
696
697    /// Gets the test component's resolution context. This is used to open subpackages of the
698    /// test package.
699    pub fn r#get_test_resolution_context(
700        &self,
701        ___deadline: zx::MonotonicInstant,
702    ) -> Result<InternalGetTestResolutionContextResult, fidl::Error> {
703        let _response = self.client.send_query::<
704            fidl::encoding::EmptyPayload,
705            fidl::encoding::ResultType<InternalGetTestResolutionContextResponse, i32>,
706        >(
707            (),
708            0x78e5d4f1fefd67b7,
709            fidl::encoding::DynamicFlags::empty(),
710            ___deadline,
711        )?;
712        Ok(_response.map(|x| x.context))
713    }
714
715    /// Get the '/boot' directory to be used for the "fuchsia-boot:///" resolver.
716    /// If an invalid |boot_dir| is returned, the driver test realm's '/pkg' directory is
717    /// treated as the boot directory.
718    pub fn r#get_boot_directory(
719        &self,
720        ___deadline: zx::MonotonicInstant,
721    ) -> Result<InternalGetBootDirectoryResult, fidl::Error> {
722        let _response = self.client.send_query::<
723            fidl::encoding::EmptyPayload,
724            fidl::encoding::ResultType<InternalGetBootDirectoryResponse, i32>,
725        >(
726            (),
727            0x3e1969123c4dfb31,
728            fidl::encoding::DynamicFlags::empty(),
729            ___deadline,
730        )?;
731        Ok(_response.map(|x| x.boot_dir))
732    }
733
734    pub fn r#get_boot_driver_overrides(
735        &self,
736        ___deadline: zx::MonotonicInstant,
737    ) -> Result<InternalGetBootDriverOverridesResult, fidl::Error> {
738        let _response = self.client.send_query::<
739            fidl::encoding::EmptyPayload,
740            fidl::encoding::ResultType<InternalGetBootDriverOverridesResponse, i32>,
741        >(
742            (),
743            0x6a40991d8259e008,
744            fidl::encoding::DynamicFlags::empty(),
745            ___deadline,
746        )?;
747        Ok(_response.map(|x| x.boot_overrides))
748    }
749}
750
751#[cfg(target_os = "fuchsia")]
752impl From<InternalSynchronousProxy> for zx::Handle {
753    fn from(value: InternalSynchronousProxy) -> Self {
754        value.into_channel().into()
755    }
756}
757
758#[cfg(target_os = "fuchsia")]
759impl From<fidl::Channel> for InternalSynchronousProxy {
760    fn from(value: fidl::Channel) -> Self {
761        Self::new(value)
762    }
763}
764
765#[cfg(target_os = "fuchsia")]
766impl fidl::endpoints::FromClient for InternalSynchronousProxy {
767    type Protocol = InternalMarker;
768
769    fn from_client(value: fidl::endpoints::ClientEnd<InternalMarker>) -> Self {
770        Self::new(value.into_channel())
771    }
772}
773
774#[derive(Debug, Clone)]
775pub struct InternalProxy {
776    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
777}
778
779impl fidl::endpoints::Proxy for InternalProxy {
780    type Protocol = InternalMarker;
781
782    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
783        Self::new(inner)
784    }
785
786    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
787        self.client.into_channel().map_err(|client| Self { client })
788    }
789
790    fn as_channel(&self) -> &::fidl::AsyncChannel {
791        self.client.as_channel()
792    }
793}
794
795impl InternalProxy {
796    /// Create a new Proxy for fuchsia.driver.test/Internal.
797    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
798        let protocol_name = <InternalMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
799        Self { client: fidl::client::Client::new(channel, protocol_name) }
800    }
801
802    /// Get a Stream of events from the remote end of the protocol.
803    ///
804    /// # Panics
805    ///
806    /// Panics if the event stream was already taken.
807    pub fn take_event_stream(&self) -> InternalEventStream {
808        InternalEventStream { event_receiver: self.client.take_event_receiver() }
809    }
810
811    /// Gets the test component's package directory. This is used to read drivers in this package.
812    /// If a test resolution context is available through |GetTestResolutionContext|, subpackages
813    /// in this test package are also discovered.
814    pub fn r#get_test_package(
815        &self,
816    ) -> fidl::client::QueryResponseFut<
817        InternalGetTestPackageResult,
818        fidl::encoding::DefaultFuchsiaResourceDialect,
819    > {
820        InternalProxyInterface::r#get_test_package(self)
821    }
822
823    /// Gets the test component's resolution context. This is used to open subpackages of the
824    /// test package.
825    pub fn r#get_test_resolution_context(
826        &self,
827    ) -> fidl::client::QueryResponseFut<
828        InternalGetTestResolutionContextResult,
829        fidl::encoding::DefaultFuchsiaResourceDialect,
830    > {
831        InternalProxyInterface::r#get_test_resolution_context(self)
832    }
833
834    /// Get the '/boot' directory to be used for the "fuchsia-boot:///" resolver.
835    /// If an invalid |boot_dir| is returned, the driver test realm's '/pkg' directory is
836    /// treated as the boot directory.
837    pub fn r#get_boot_directory(
838        &self,
839    ) -> fidl::client::QueryResponseFut<
840        InternalGetBootDirectoryResult,
841        fidl::encoding::DefaultFuchsiaResourceDialect,
842    > {
843        InternalProxyInterface::r#get_boot_directory(self)
844    }
845
846    pub fn r#get_boot_driver_overrides(
847        &self,
848    ) -> fidl::client::QueryResponseFut<
849        InternalGetBootDriverOverridesResult,
850        fidl::encoding::DefaultFuchsiaResourceDialect,
851    > {
852        InternalProxyInterface::r#get_boot_driver_overrides(self)
853    }
854}
855
856impl InternalProxyInterface for InternalProxy {
857    type GetTestPackageResponseFut = fidl::client::QueryResponseFut<
858        InternalGetTestPackageResult,
859        fidl::encoding::DefaultFuchsiaResourceDialect,
860    >;
861    fn r#get_test_package(&self) -> Self::GetTestPackageResponseFut {
862        fn _decode(
863            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
864        ) -> Result<InternalGetTestPackageResult, fidl::Error> {
865            let _response = fidl::client::decode_transaction_body::<
866                fidl::encoding::ResultType<InternalGetTestPackageResponse, i32>,
867                fidl::encoding::DefaultFuchsiaResourceDialect,
868                0x298c1d6e57d57db8,
869            >(_buf?)?;
870            Ok(_response.map(|x| x.test_pkg_dir))
871        }
872        self.client
873            .send_query_and_decode::<fidl::encoding::EmptyPayload, InternalGetTestPackageResult>(
874                (),
875                0x298c1d6e57d57db8,
876                fidl::encoding::DynamicFlags::empty(),
877                _decode,
878            )
879    }
880
881    type GetTestResolutionContextResponseFut = fidl::client::QueryResponseFut<
882        InternalGetTestResolutionContextResult,
883        fidl::encoding::DefaultFuchsiaResourceDialect,
884    >;
885    fn r#get_test_resolution_context(&self) -> Self::GetTestResolutionContextResponseFut {
886        fn _decode(
887            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
888        ) -> Result<InternalGetTestResolutionContextResult, fidl::Error> {
889            let _response = fidl::client::decode_transaction_body::<
890                fidl::encoding::ResultType<InternalGetTestResolutionContextResponse, i32>,
891                fidl::encoding::DefaultFuchsiaResourceDialect,
892                0x78e5d4f1fefd67b7,
893            >(_buf?)?;
894            Ok(_response.map(|x| x.context))
895        }
896        self.client.send_query_and_decode::<
897            fidl::encoding::EmptyPayload,
898            InternalGetTestResolutionContextResult,
899        >(
900            (),
901            0x78e5d4f1fefd67b7,
902            fidl::encoding::DynamicFlags::empty(),
903            _decode,
904        )
905    }
906
907    type GetBootDirectoryResponseFut = fidl::client::QueryResponseFut<
908        InternalGetBootDirectoryResult,
909        fidl::encoding::DefaultFuchsiaResourceDialect,
910    >;
911    fn r#get_boot_directory(&self) -> Self::GetBootDirectoryResponseFut {
912        fn _decode(
913            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
914        ) -> Result<InternalGetBootDirectoryResult, fidl::Error> {
915            let _response = fidl::client::decode_transaction_body::<
916                fidl::encoding::ResultType<InternalGetBootDirectoryResponse, i32>,
917                fidl::encoding::DefaultFuchsiaResourceDialect,
918                0x3e1969123c4dfb31,
919            >(_buf?)?;
920            Ok(_response.map(|x| x.boot_dir))
921        }
922        self.client
923            .send_query_and_decode::<fidl::encoding::EmptyPayload, InternalGetBootDirectoryResult>(
924                (),
925                0x3e1969123c4dfb31,
926                fidl::encoding::DynamicFlags::empty(),
927                _decode,
928            )
929    }
930
931    type GetBootDriverOverridesResponseFut = fidl::client::QueryResponseFut<
932        InternalGetBootDriverOverridesResult,
933        fidl::encoding::DefaultFuchsiaResourceDialect,
934    >;
935    fn r#get_boot_driver_overrides(&self) -> Self::GetBootDriverOverridesResponseFut {
936        fn _decode(
937            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
938        ) -> Result<InternalGetBootDriverOverridesResult, fidl::Error> {
939            let _response = fidl::client::decode_transaction_body::<
940                fidl::encoding::ResultType<InternalGetBootDriverOverridesResponse, i32>,
941                fidl::encoding::DefaultFuchsiaResourceDialect,
942                0x6a40991d8259e008,
943            >(_buf?)?;
944            Ok(_response.map(|x| x.boot_overrides))
945        }
946        self.client.send_query_and_decode::<
947            fidl::encoding::EmptyPayload,
948            InternalGetBootDriverOverridesResult,
949        >(
950            (),
951            0x6a40991d8259e008,
952            fidl::encoding::DynamicFlags::empty(),
953            _decode,
954        )
955    }
956}
957
958pub struct InternalEventStream {
959    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
960}
961
962impl std::marker::Unpin for InternalEventStream {}
963
964impl futures::stream::FusedStream for InternalEventStream {
965    fn is_terminated(&self) -> bool {
966        self.event_receiver.is_terminated()
967    }
968}
969
970impl futures::Stream for InternalEventStream {
971    type Item = Result<InternalEvent, fidl::Error>;
972
973    fn poll_next(
974        mut self: std::pin::Pin<&mut Self>,
975        cx: &mut std::task::Context<'_>,
976    ) -> std::task::Poll<Option<Self::Item>> {
977        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
978            &mut self.event_receiver,
979            cx
980        )?) {
981            Some(buf) => std::task::Poll::Ready(Some(InternalEvent::decode(buf))),
982            None => std::task::Poll::Ready(None),
983        }
984    }
985}
986
987#[derive(Debug)]
988pub enum InternalEvent {}
989
990impl InternalEvent {
991    /// Decodes a message buffer as a [`InternalEvent`].
992    fn decode(
993        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
994    ) -> Result<InternalEvent, fidl::Error> {
995        let (bytes, _handles) = buf.split_mut();
996        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
997        debug_assert_eq!(tx_header.tx_id, 0);
998        match tx_header.ordinal {
999            _ => Err(fidl::Error::UnknownOrdinal {
1000                ordinal: tx_header.ordinal,
1001                protocol_name: <InternalMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1002            }),
1003        }
1004    }
1005}
1006
1007/// A Stream of incoming requests for fuchsia.driver.test/Internal.
1008pub struct InternalRequestStream {
1009    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1010    is_terminated: bool,
1011}
1012
1013impl std::marker::Unpin for InternalRequestStream {}
1014
1015impl futures::stream::FusedStream for InternalRequestStream {
1016    fn is_terminated(&self) -> bool {
1017        self.is_terminated
1018    }
1019}
1020
1021impl fidl::endpoints::RequestStream for InternalRequestStream {
1022    type Protocol = InternalMarker;
1023    type ControlHandle = InternalControlHandle;
1024
1025    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1026        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1027    }
1028
1029    fn control_handle(&self) -> Self::ControlHandle {
1030        InternalControlHandle { inner: self.inner.clone() }
1031    }
1032
1033    fn into_inner(
1034        self,
1035    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1036    {
1037        (self.inner, self.is_terminated)
1038    }
1039
1040    fn from_inner(
1041        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1042        is_terminated: bool,
1043    ) -> Self {
1044        Self { inner, is_terminated }
1045    }
1046}
1047
1048impl futures::Stream for InternalRequestStream {
1049    type Item = Result<InternalRequest, fidl::Error>;
1050
1051    fn poll_next(
1052        mut self: std::pin::Pin<&mut Self>,
1053        cx: &mut std::task::Context<'_>,
1054    ) -> std::task::Poll<Option<Self::Item>> {
1055        let this = &mut *self;
1056        if this.inner.check_shutdown(cx) {
1057            this.is_terminated = true;
1058            return std::task::Poll::Ready(None);
1059        }
1060        if this.is_terminated {
1061            panic!("polled InternalRequestStream after completion");
1062        }
1063        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1064            |bytes, handles| {
1065                match this.inner.channel().read_etc(cx, bytes, handles) {
1066                    std::task::Poll::Ready(Ok(())) => {}
1067                    std::task::Poll::Pending => return std::task::Poll::Pending,
1068                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1069                        this.is_terminated = true;
1070                        return std::task::Poll::Ready(None);
1071                    }
1072                    std::task::Poll::Ready(Err(e)) => {
1073                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1074                            e.into(),
1075                        ))));
1076                    }
1077                }
1078
1079                // A message has been received from the channel
1080                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1081
1082                std::task::Poll::Ready(Some(match header.ordinal {
1083                    0x298c1d6e57d57db8 => {
1084                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1085                        let mut req = fidl::new_empty!(
1086                            fidl::encoding::EmptyPayload,
1087                            fidl::encoding::DefaultFuchsiaResourceDialect
1088                        );
1089                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1090                        let control_handle = InternalControlHandle { inner: this.inner.clone() };
1091                        Ok(InternalRequest::GetTestPackage {
1092                            responder: InternalGetTestPackageResponder {
1093                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1094                                tx_id: header.tx_id,
1095                            },
1096                        })
1097                    }
1098                    0x78e5d4f1fefd67b7 => {
1099                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1100                        let mut req = fidl::new_empty!(
1101                            fidl::encoding::EmptyPayload,
1102                            fidl::encoding::DefaultFuchsiaResourceDialect
1103                        );
1104                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1105                        let control_handle = InternalControlHandle { inner: this.inner.clone() };
1106                        Ok(InternalRequest::GetTestResolutionContext {
1107                            responder: InternalGetTestResolutionContextResponder {
1108                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1109                                tx_id: header.tx_id,
1110                            },
1111                        })
1112                    }
1113                    0x3e1969123c4dfb31 => {
1114                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1115                        let mut req = fidl::new_empty!(
1116                            fidl::encoding::EmptyPayload,
1117                            fidl::encoding::DefaultFuchsiaResourceDialect
1118                        );
1119                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1120                        let control_handle = InternalControlHandle { inner: this.inner.clone() };
1121                        Ok(InternalRequest::GetBootDirectory {
1122                            responder: InternalGetBootDirectoryResponder {
1123                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1124                                tx_id: header.tx_id,
1125                            },
1126                        })
1127                    }
1128                    0x6a40991d8259e008 => {
1129                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1130                        let mut req = fidl::new_empty!(
1131                            fidl::encoding::EmptyPayload,
1132                            fidl::encoding::DefaultFuchsiaResourceDialect
1133                        );
1134                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1135                        let control_handle = InternalControlHandle { inner: this.inner.clone() };
1136                        Ok(InternalRequest::GetBootDriverOverrides {
1137                            responder: InternalGetBootDriverOverridesResponder {
1138                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1139                                tx_id: header.tx_id,
1140                            },
1141                        })
1142                    }
1143                    _ => Err(fidl::Error::UnknownOrdinal {
1144                        ordinal: header.ordinal,
1145                        protocol_name:
1146                            <InternalMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1147                    }),
1148                }))
1149            },
1150        )
1151    }
1152}
1153
1154/// This protocol is served when running with the driver_test_realm to be used by the
1155/// fake-resolver component to access the various directories and metadata of the test it needs.
1156#[derive(Debug)]
1157pub enum InternalRequest {
1158    /// Gets the test component's package directory. This is used to read drivers in this package.
1159    /// If a test resolution context is available through |GetTestResolutionContext|, subpackages
1160    /// in this test package are also discovered.
1161    GetTestPackage {
1162        responder: InternalGetTestPackageResponder,
1163    },
1164    /// Gets the test component's resolution context. This is used to open subpackages of the
1165    /// test package.
1166    GetTestResolutionContext {
1167        responder: InternalGetTestResolutionContextResponder,
1168    },
1169    /// Get the '/boot' directory to be used for the "fuchsia-boot:///" resolver.
1170    /// If an invalid |boot_dir| is returned, the driver test realm's '/pkg' directory is
1171    /// treated as the boot directory.
1172    GetBootDirectory {
1173        responder: InternalGetBootDirectoryResponder,
1174    },
1175    GetBootDriverOverrides {
1176        responder: InternalGetBootDriverOverridesResponder,
1177    },
1178}
1179
1180impl InternalRequest {
1181    #[allow(irrefutable_let_patterns)]
1182    pub fn into_get_test_package(self) -> Option<(InternalGetTestPackageResponder)> {
1183        if let InternalRequest::GetTestPackage { responder } = self {
1184            Some((responder))
1185        } else {
1186            None
1187        }
1188    }
1189
1190    #[allow(irrefutable_let_patterns)]
1191    pub fn into_get_test_resolution_context(
1192        self,
1193    ) -> Option<(InternalGetTestResolutionContextResponder)> {
1194        if let InternalRequest::GetTestResolutionContext { responder } = self {
1195            Some((responder))
1196        } else {
1197            None
1198        }
1199    }
1200
1201    #[allow(irrefutable_let_patterns)]
1202    pub fn into_get_boot_directory(self) -> Option<(InternalGetBootDirectoryResponder)> {
1203        if let InternalRequest::GetBootDirectory { responder } = self {
1204            Some((responder))
1205        } else {
1206            None
1207        }
1208    }
1209
1210    #[allow(irrefutable_let_patterns)]
1211    pub fn into_get_boot_driver_overrides(
1212        self,
1213    ) -> Option<(InternalGetBootDriverOverridesResponder)> {
1214        if let InternalRequest::GetBootDriverOverrides { responder } = self {
1215            Some((responder))
1216        } else {
1217            None
1218        }
1219    }
1220
1221    /// Name of the method defined in FIDL
1222    pub fn method_name(&self) -> &'static str {
1223        match *self {
1224            InternalRequest::GetTestPackage { .. } => "get_test_package",
1225            InternalRequest::GetTestResolutionContext { .. } => "get_test_resolution_context",
1226            InternalRequest::GetBootDirectory { .. } => "get_boot_directory",
1227            InternalRequest::GetBootDriverOverrides { .. } => "get_boot_driver_overrides",
1228        }
1229    }
1230}
1231
1232#[derive(Debug, Clone)]
1233pub struct InternalControlHandle {
1234    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1235}
1236
1237impl fidl::endpoints::ControlHandle for InternalControlHandle {
1238    fn shutdown(&self) {
1239        self.inner.shutdown()
1240    }
1241    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1242        self.inner.shutdown_with_epitaph(status)
1243    }
1244
1245    fn is_closed(&self) -> bool {
1246        self.inner.channel().is_closed()
1247    }
1248    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1249        self.inner.channel().on_closed()
1250    }
1251
1252    #[cfg(target_os = "fuchsia")]
1253    fn signal_peer(
1254        &self,
1255        clear_mask: zx::Signals,
1256        set_mask: zx::Signals,
1257    ) -> Result<(), zx_status::Status> {
1258        use fidl::Peered;
1259        self.inner.channel().signal_peer(clear_mask, set_mask)
1260    }
1261}
1262
1263impl InternalControlHandle {}
1264
1265#[must_use = "FIDL methods require a response to be sent"]
1266#[derive(Debug)]
1267pub struct InternalGetTestPackageResponder {
1268    control_handle: std::mem::ManuallyDrop<InternalControlHandle>,
1269    tx_id: u32,
1270}
1271
1272/// Set the the channel to be shutdown (see [`InternalControlHandle::shutdown`])
1273/// if the responder is dropped without sending a response, so that the client
1274/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1275impl std::ops::Drop for InternalGetTestPackageResponder {
1276    fn drop(&mut self) {
1277        self.control_handle.shutdown();
1278        // Safety: drops once, never accessed again
1279        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1280    }
1281}
1282
1283impl fidl::endpoints::Responder for InternalGetTestPackageResponder {
1284    type ControlHandle = InternalControlHandle;
1285
1286    fn control_handle(&self) -> &InternalControlHandle {
1287        &self.control_handle
1288    }
1289
1290    fn drop_without_shutdown(mut self) {
1291        // Safety: drops once, never accessed again due to mem::forget
1292        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1293        // Prevent Drop from running (which would shut down the channel)
1294        std::mem::forget(self);
1295    }
1296}
1297
1298impl InternalGetTestPackageResponder {
1299    /// Sends a response to the FIDL transaction.
1300    ///
1301    /// Sets the channel to shutdown if an error occurs.
1302    pub fn send(
1303        self,
1304        mut result: Result<
1305            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
1306            i32,
1307        >,
1308    ) -> Result<(), fidl::Error> {
1309        let _result = self.send_raw(result);
1310        if _result.is_err() {
1311            self.control_handle.shutdown();
1312        }
1313        self.drop_without_shutdown();
1314        _result
1315    }
1316
1317    /// Similar to "send" but does not shutdown the channel if an error occurs.
1318    pub fn send_no_shutdown_on_err(
1319        self,
1320        mut result: Result<
1321            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
1322            i32,
1323        >,
1324    ) -> Result<(), fidl::Error> {
1325        let _result = self.send_raw(result);
1326        self.drop_without_shutdown();
1327        _result
1328    }
1329
1330    fn send_raw(
1331        &self,
1332        mut result: Result<
1333            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
1334            i32,
1335        >,
1336    ) -> Result<(), fidl::Error> {
1337        self.control_handle
1338            .inner
1339            .send::<fidl::encoding::ResultType<InternalGetTestPackageResponse, i32>>(
1340                result.map(|test_pkg_dir| (test_pkg_dir,)),
1341                self.tx_id,
1342                0x298c1d6e57d57db8,
1343                fidl::encoding::DynamicFlags::empty(),
1344            )
1345    }
1346}
1347
1348#[must_use = "FIDL methods require a response to be sent"]
1349#[derive(Debug)]
1350pub struct InternalGetTestResolutionContextResponder {
1351    control_handle: std::mem::ManuallyDrop<InternalControlHandle>,
1352    tx_id: u32,
1353}
1354
1355/// Set the the channel to be shutdown (see [`InternalControlHandle::shutdown`])
1356/// if the responder is dropped without sending a response, so that the client
1357/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1358impl std::ops::Drop for InternalGetTestResolutionContextResponder {
1359    fn drop(&mut self) {
1360        self.control_handle.shutdown();
1361        // Safety: drops once, never accessed again
1362        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1363    }
1364}
1365
1366impl fidl::endpoints::Responder for InternalGetTestResolutionContextResponder {
1367    type ControlHandle = InternalControlHandle;
1368
1369    fn control_handle(&self) -> &InternalControlHandle {
1370        &self.control_handle
1371    }
1372
1373    fn drop_without_shutdown(mut self) {
1374        // Safety: drops once, never accessed again due to mem::forget
1375        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1376        // Prevent Drop from running (which would shut down the channel)
1377        std::mem::forget(self);
1378    }
1379}
1380
1381impl InternalGetTestResolutionContextResponder {
1382    /// Sends a response to the FIDL transaction.
1383    ///
1384    /// Sets the channel to shutdown if an error occurs.
1385    pub fn send(
1386        self,
1387        mut result: Result<Option<&fidl_fuchsia_component_resolution::Context>, i32>,
1388    ) -> Result<(), fidl::Error> {
1389        let _result = self.send_raw(result);
1390        if _result.is_err() {
1391            self.control_handle.shutdown();
1392        }
1393        self.drop_without_shutdown();
1394        _result
1395    }
1396
1397    /// Similar to "send" but does not shutdown the channel if an error occurs.
1398    pub fn send_no_shutdown_on_err(
1399        self,
1400        mut result: Result<Option<&fidl_fuchsia_component_resolution::Context>, i32>,
1401    ) -> Result<(), fidl::Error> {
1402        let _result = self.send_raw(result);
1403        self.drop_without_shutdown();
1404        _result
1405    }
1406
1407    fn send_raw(
1408        &self,
1409        mut result: Result<Option<&fidl_fuchsia_component_resolution::Context>, i32>,
1410    ) -> Result<(), fidl::Error> {
1411        self.control_handle.inner.send::<fidl::encoding::ResultType<
1412            InternalGetTestResolutionContextResponse,
1413            i32,
1414        >>(
1415            result.map(|context| (context,)),
1416            self.tx_id,
1417            0x78e5d4f1fefd67b7,
1418            fidl::encoding::DynamicFlags::empty(),
1419        )
1420    }
1421}
1422
1423#[must_use = "FIDL methods require a response to be sent"]
1424#[derive(Debug)]
1425pub struct InternalGetBootDirectoryResponder {
1426    control_handle: std::mem::ManuallyDrop<InternalControlHandle>,
1427    tx_id: u32,
1428}
1429
1430/// Set the the channel to be shutdown (see [`InternalControlHandle::shutdown`])
1431/// if the responder is dropped without sending a response, so that the client
1432/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1433impl std::ops::Drop for InternalGetBootDirectoryResponder {
1434    fn drop(&mut self) {
1435        self.control_handle.shutdown();
1436        // Safety: drops once, never accessed again
1437        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1438    }
1439}
1440
1441impl fidl::endpoints::Responder for InternalGetBootDirectoryResponder {
1442    type ControlHandle = InternalControlHandle;
1443
1444    fn control_handle(&self) -> &InternalControlHandle {
1445        &self.control_handle
1446    }
1447
1448    fn drop_without_shutdown(mut self) {
1449        // Safety: drops once, never accessed again due to mem::forget
1450        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1451        // Prevent Drop from running (which would shut down the channel)
1452        std::mem::forget(self);
1453    }
1454}
1455
1456impl InternalGetBootDirectoryResponder {
1457    /// Sends a response to the FIDL transaction.
1458    ///
1459    /// Sets the channel to shutdown if an error occurs.
1460    pub fn send(
1461        self,
1462        mut result: Result<
1463            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
1464            i32,
1465        >,
1466    ) -> Result<(), fidl::Error> {
1467        let _result = self.send_raw(result);
1468        if _result.is_err() {
1469            self.control_handle.shutdown();
1470        }
1471        self.drop_without_shutdown();
1472        _result
1473    }
1474
1475    /// Similar to "send" but does not shutdown the channel if an error occurs.
1476    pub fn send_no_shutdown_on_err(
1477        self,
1478        mut result: Result<
1479            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
1480            i32,
1481        >,
1482    ) -> Result<(), fidl::Error> {
1483        let _result = self.send_raw(result);
1484        self.drop_without_shutdown();
1485        _result
1486    }
1487
1488    fn send_raw(
1489        &self,
1490        mut result: Result<
1491            Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
1492            i32,
1493        >,
1494    ) -> Result<(), fidl::Error> {
1495        self.control_handle
1496            .inner
1497            .send::<fidl::encoding::ResultType<InternalGetBootDirectoryResponse, i32>>(
1498                result.map(|boot_dir| (boot_dir,)),
1499                self.tx_id,
1500                0x3e1969123c4dfb31,
1501                fidl::encoding::DynamicFlags::empty(),
1502            )
1503    }
1504}
1505
1506#[must_use = "FIDL methods require a response to be sent"]
1507#[derive(Debug)]
1508pub struct InternalGetBootDriverOverridesResponder {
1509    control_handle: std::mem::ManuallyDrop<InternalControlHandle>,
1510    tx_id: u32,
1511}
1512
1513/// Set the the channel to be shutdown (see [`InternalControlHandle::shutdown`])
1514/// if the responder is dropped without sending a response, so that the client
1515/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1516impl std::ops::Drop for InternalGetBootDriverOverridesResponder {
1517    fn drop(&mut self) {
1518        self.control_handle.shutdown();
1519        // Safety: drops once, never accessed again
1520        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1521    }
1522}
1523
1524impl fidl::endpoints::Responder for InternalGetBootDriverOverridesResponder {
1525    type ControlHandle = InternalControlHandle;
1526
1527    fn control_handle(&self) -> &InternalControlHandle {
1528        &self.control_handle
1529    }
1530
1531    fn drop_without_shutdown(mut self) {
1532        // Safety: drops once, never accessed again due to mem::forget
1533        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1534        // Prevent Drop from running (which would shut down the channel)
1535        std::mem::forget(self);
1536    }
1537}
1538
1539impl InternalGetBootDriverOverridesResponder {
1540    /// Sends a response to the FIDL transaction.
1541    ///
1542    /// Sets the channel to shutdown if an error occurs.
1543    pub fn send(self, mut result: Result<&[String], i32>) -> Result<(), fidl::Error> {
1544        let _result = self.send_raw(result);
1545        if _result.is_err() {
1546            self.control_handle.shutdown();
1547        }
1548        self.drop_without_shutdown();
1549        _result
1550    }
1551
1552    /// Similar to "send" but does not shutdown the channel if an error occurs.
1553    pub fn send_no_shutdown_on_err(
1554        self,
1555        mut result: Result<&[String], i32>,
1556    ) -> Result<(), fidl::Error> {
1557        let _result = self.send_raw(result);
1558        self.drop_without_shutdown();
1559        _result
1560    }
1561
1562    fn send_raw(&self, mut result: Result<&[String], i32>) -> Result<(), fidl::Error> {
1563        self.control_handle.inner.send::<fidl::encoding::ResultType<
1564            InternalGetBootDriverOverridesResponse,
1565            i32,
1566        >>(
1567            result.map(|boot_overrides| (boot_overrides,)),
1568            self.tx_id,
1569            0x6a40991d8259e008,
1570            fidl::encoding::DynamicFlags::empty(),
1571        )
1572    }
1573}
1574
1575#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1576pub struct RealmMarker;
1577
1578impl fidl::endpoints::ProtocolMarker for RealmMarker {
1579    type Proxy = RealmProxy;
1580    type RequestStream = RealmRequestStream;
1581    #[cfg(target_os = "fuchsia")]
1582    type SynchronousProxy = RealmSynchronousProxy;
1583
1584    const DEBUG_NAME: &'static str = "fuchsia.driver.test.Realm";
1585}
1586impl fidl::endpoints::DiscoverableProtocolMarker for RealmMarker {}
1587pub type RealmStartResult = Result<(), i32>;
1588
1589pub trait RealmProxyInterface: Send + Sync {
1590    type StartResponseFut: std::future::Future<Output = Result<RealmStartResult, fidl::Error>>
1591        + Send;
1592    fn r#start(&self, args: RealmArgs) -> Self::StartResponseFut;
1593}
1594#[derive(Debug)]
1595#[cfg(target_os = "fuchsia")]
1596pub struct RealmSynchronousProxy {
1597    client: fidl::client::sync::Client,
1598}
1599
1600#[cfg(target_os = "fuchsia")]
1601impl fidl::endpoints::SynchronousProxy for RealmSynchronousProxy {
1602    type Proxy = RealmProxy;
1603    type Protocol = RealmMarker;
1604
1605    fn from_channel(inner: fidl::Channel) -> Self {
1606        Self::new(inner)
1607    }
1608
1609    fn into_channel(self) -> fidl::Channel {
1610        self.client.into_channel()
1611    }
1612
1613    fn as_channel(&self) -> &fidl::Channel {
1614        self.client.as_channel()
1615    }
1616}
1617
1618#[cfg(target_os = "fuchsia")]
1619impl RealmSynchronousProxy {
1620    pub fn new(channel: fidl::Channel) -> Self {
1621        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1622        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1623    }
1624
1625    pub fn into_channel(self) -> fidl::Channel {
1626        self.client.into_channel()
1627    }
1628
1629    /// Waits until an event arrives and returns it. It is safe for other
1630    /// threads to make concurrent requests while waiting for an event.
1631    pub fn wait_for_event(
1632        &self,
1633        deadline: zx::MonotonicInstant,
1634    ) -> Result<RealmEvent, fidl::Error> {
1635        RealmEvent::decode(self.client.wait_for_event(deadline)?)
1636    }
1637
1638    /// Start the realm. Calling this will cause DriverTestRealm to start
1639    /// servicing other protocols (like /dev/). `args` is used to configure
1640    /// the DriverTestRealm.
1641    ///
1642    /// * error `ZX_ERR_ALREADY_EXISTS` the realm has already had `Start` called.
1643    pub fn r#start(
1644        &self,
1645        mut args: RealmArgs,
1646        ___deadline: zx::MonotonicInstant,
1647    ) -> Result<RealmStartResult, fidl::Error> {
1648        let _response = self.client.send_query::<
1649            RealmStartRequest,
1650            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1651        >(
1652            (&mut args,),
1653            0x3dc6949d581e96fa,
1654            fidl::encoding::DynamicFlags::FLEXIBLE,
1655            ___deadline,
1656        )?
1657        .into_result::<RealmMarker>("start")?;
1658        Ok(_response.map(|x| x))
1659    }
1660}
1661
1662#[cfg(target_os = "fuchsia")]
1663impl From<RealmSynchronousProxy> for zx::Handle {
1664    fn from(value: RealmSynchronousProxy) -> Self {
1665        value.into_channel().into()
1666    }
1667}
1668
1669#[cfg(target_os = "fuchsia")]
1670impl From<fidl::Channel> for RealmSynchronousProxy {
1671    fn from(value: fidl::Channel) -> Self {
1672        Self::new(value)
1673    }
1674}
1675
1676#[cfg(target_os = "fuchsia")]
1677impl fidl::endpoints::FromClient for RealmSynchronousProxy {
1678    type Protocol = RealmMarker;
1679
1680    fn from_client(value: fidl::endpoints::ClientEnd<RealmMarker>) -> Self {
1681        Self::new(value.into_channel())
1682    }
1683}
1684
1685#[derive(Debug, Clone)]
1686pub struct RealmProxy {
1687    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1688}
1689
1690impl fidl::endpoints::Proxy for RealmProxy {
1691    type Protocol = RealmMarker;
1692
1693    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1694        Self::new(inner)
1695    }
1696
1697    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1698        self.client.into_channel().map_err(|client| Self { client })
1699    }
1700
1701    fn as_channel(&self) -> &::fidl::AsyncChannel {
1702        self.client.as_channel()
1703    }
1704}
1705
1706impl RealmProxy {
1707    /// Create a new Proxy for fuchsia.driver.test/Realm.
1708    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1709        let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1710        Self { client: fidl::client::Client::new(channel, protocol_name) }
1711    }
1712
1713    /// Get a Stream of events from the remote end of the protocol.
1714    ///
1715    /// # Panics
1716    ///
1717    /// Panics if the event stream was already taken.
1718    pub fn take_event_stream(&self) -> RealmEventStream {
1719        RealmEventStream { event_receiver: self.client.take_event_receiver() }
1720    }
1721
1722    /// Start the realm. Calling this will cause DriverTestRealm to start
1723    /// servicing other protocols (like /dev/). `args` is used to configure
1724    /// the DriverTestRealm.
1725    ///
1726    /// * error `ZX_ERR_ALREADY_EXISTS` the realm has already had `Start` called.
1727    pub fn r#start(
1728        &self,
1729        mut args: RealmArgs,
1730    ) -> fidl::client::QueryResponseFut<
1731        RealmStartResult,
1732        fidl::encoding::DefaultFuchsiaResourceDialect,
1733    > {
1734        RealmProxyInterface::r#start(self, args)
1735    }
1736}
1737
1738impl RealmProxyInterface for RealmProxy {
1739    type StartResponseFut = fidl::client::QueryResponseFut<
1740        RealmStartResult,
1741        fidl::encoding::DefaultFuchsiaResourceDialect,
1742    >;
1743    fn r#start(&self, mut args: RealmArgs) -> Self::StartResponseFut {
1744        fn _decode(
1745            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1746        ) -> Result<RealmStartResult, fidl::Error> {
1747            let _response = fidl::client::decode_transaction_body::<
1748                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1749                fidl::encoding::DefaultFuchsiaResourceDialect,
1750                0x3dc6949d581e96fa,
1751            >(_buf?)?
1752            .into_result::<RealmMarker>("start")?;
1753            Ok(_response.map(|x| x))
1754        }
1755        self.client.send_query_and_decode::<RealmStartRequest, RealmStartResult>(
1756            (&mut args,),
1757            0x3dc6949d581e96fa,
1758            fidl::encoding::DynamicFlags::FLEXIBLE,
1759            _decode,
1760        )
1761    }
1762}
1763
1764pub struct RealmEventStream {
1765    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1766}
1767
1768impl std::marker::Unpin for RealmEventStream {}
1769
1770impl futures::stream::FusedStream for RealmEventStream {
1771    fn is_terminated(&self) -> bool {
1772        self.event_receiver.is_terminated()
1773    }
1774}
1775
1776impl futures::Stream for RealmEventStream {
1777    type Item = Result<RealmEvent, fidl::Error>;
1778
1779    fn poll_next(
1780        mut self: std::pin::Pin<&mut Self>,
1781        cx: &mut std::task::Context<'_>,
1782    ) -> std::task::Poll<Option<Self::Item>> {
1783        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1784            &mut self.event_receiver,
1785            cx
1786        )?) {
1787            Some(buf) => std::task::Poll::Ready(Some(RealmEvent::decode(buf))),
1788            None => std::task::Poll::Ready(None),
1789        }
1790    }
1791}
1792
1793#[derive(Debug)]
1794pub enum RealmEvent {
1795    #[non_exhaustive]
1796    _UnknownEvent {
1797        /// Ordinal of the event that was sent.
1798        ordinal: u64,
1799    },
1800}
1801
1802impl RealmEvent {
1803    /// Decodes a message buffer as a [`RealmEvent`].
1804    fn decode(
1805        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1806    ) -> Result<RealmEvent, fidl::Error> {
1807        let (bytes, _handles) = buf.split_mut();
1808        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1809        debug_assert_eq!(tx_header.tx_id, 0);
1810        match tx_header.ordinal {
1811            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1812                Ok(RealmEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1813            }
1814            _ => Err(fidl::Error::UnknownOrdinal {
1815                ordinal: tx_header.ordinal,
1816                protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1817            }),
1818        }
1819    }
1820}
1821
1822/// A Stream of incoming requests for fuchsia.driver.test/Realm.
1823pub struct RealmRequestStream {
1824    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1825    is_terminated: bool,
1826}
1827
1828impl std::marker::Unpin for RealmRequestStream {}
1829
1830impl futures::stream::FusedStream for RealmRequestStream {
1831    fn is_terminated(&self) -> bool {
1832        self.is_terminated
1833    }
1834}
1835
1836impl fidl::endpoints::RequestStream for RealmRequestStream {
1837    type Protocol = RealmMarker;
1838    type ControlHandle = RealmControlHandle;
1839
1840    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1841        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1842    }
1843
1844    fn control_handle(&self) -> Self::ControlHandle {
1845        RealmControlHandle { inner: self.inner.clone() }
1846    }
1847
1848    fn into_inner(
1849        self,
1850    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1851    {
1852        (self.inner, self.is_terminated)
1853    }
1854
1855    fn from_inner(
1856        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1857        is_terminated: bool,
1858    ) -> Self {
1859        Self { inner, is_terminated }
1860    }
1861}
1862
1863impl futures::Stream for RealmRequestStream {
1864    type Item = Result<RealmRequest, fidl::Error>;
1865
1866    fn poll_next(
1867        mut self: std::pin::Pin<&mut Self>,
1868        cx: &mut std::task::Context<'_>,
1869    ) -> std::task::Poll<Option<Self::Item>> {
1870        let this = &mut *self;
1871        if this.inner.check_shutdown(cx) {
1872            this.is_terminated = true;
1873            return std::task::Poll::Ready(None);
1874        }
1875        if this.is_terminated {
1876            panic!("polled RealmRequestStream after completion");
1877        }
1878        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1879            |bytes, handles| {
1880                match this.inner.channel().read_etc(cx, bytes, handles) {
1881                    std::task::Poll::Ready(Ok(())) => {}
1882                    std::task::Poll::Pending => return std::task::Poll::Pending,
1883                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1884                        this.is_terminated = true;
1885                        return std::task::Poll::Ready(None);
1886                    }
1887                    std::task::Poll::Ready(Err(e)) => {
1888                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1889                            e.into(),
1890                        ))));
1891                    }
1892                }
1893
1894                // A message has been received from the channel
1895                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1896
1897                std::task::Poll::Ready(Some(match header.ordinal {
1898                    0x3dc6949d581e96fa => {
1899                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1900                        let mut req = fidl::new_empty!(
1901                            RealmStartRequest,
1902                            fidl::encoding::DefaultFuchsiaResourceDialect
1903                        );
1904                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmStartRequest>(&header, _body_bytes, handles, &mut req)?;
1905                        let control_handle = RealmControlHandle { inner: this.inner.clone() };
1906                        Ok(RealmRequest::Start {
1907                            args: req.args,
1908
1909                            responder: RealmStartResponder {
1910                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1911                                tx_id: header.tx_id,
1912                            },
1913                        })
1914                    }
1915                    _ if header.tx_id == 0
1916                        && header
1917                            .dynamic_flags()
1918                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1919                    {
1920                        Ok(RealmRequest::_UnknownMethod {
1921                            ordinal: header.ordinal,
1922                            control_handle: RealmControlHandle { inner: this.inner.clone() },
1923                            method_type: fidl::MethodType::OneWay,
1924                        })
1925                    }
1926                    _ if header
1927                        .dynamic_flags()
1928                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1929                    {
1930                        this.inner.send_framework_err(
1931                            fidl::encoding::FrameworkErr::UnknownMethod,
1932                            header.tx_id,
1933                            header.ordinal,
1934                            header.dynamic_flags(),
1935                            (bytes, handles),
1936                        )?;
1937                        Ok(RealmRequest::_UnknownMethod {
1938                            ordinal: header.ordinal,
1939                            control_handle: RealmControlHandle { inner: this.inner.clone() },
1940                            method_type: fidl::MethodType::TwoWay,
1941                        })
1942                    }
1943                    _ => Err(fidl::Error::UnknownOrdinal {
1944                        ordinal: header.ordinal,
1945                        protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1946                    }),
1947                }))
1948            },
1949        )
1950    }
1951}
1952
1953/// This protocol is for the DriverTestRealm. It is an integration test
1954/// framework for drivers.
1955#[derive(Debug)]
1956pub enum RealmRequest {
1957    /// Start the realm. Calling this will cause DriverTestRealm to start
1958    /// servicing other protocols (like /dev/). `args` is used to configure
1959    /// the DriverTestRealm.
1960    ///
1961    /// * error `ZX_ERR_ALREADY_EXISTS` the realm has already had `Start` called.
1962    Start { args: RealmArgs, responder: RealmStartResponder },
1963    /// An interaction was received which does not match any known method.
1964    #[non_exhaustive]
1965    _UnknownMethod {
1966        /// Ordinal of the method that was called.
1967        ordinal: u64,
1968        control_handle: RealmControlHandle,
1969        method_type: fidl::MethodType,
1970    },
1971}
1972
1973impl RealmRequest {
1974    #[allow(irrefutable_let_patterns)]
1975    pub fn into_start(self) -> Option<(RealmArgs, RealmStartResponder)> {
1976        if let RealmRequest::Start { args, responder } = self {
1977            Some((args, responder))
1978        } else {
1979            None
1980        }
1981    }
1982
1983    /// Name of the method defined in FIDL
1984    pub fn method_name(&self) -> &'static str {
1985        match *self {
1986            RealmRequest::Start { .. } => "start",
1987            RealmRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1988                "unknown one-way method"
1989            }
1990            RealmRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1991                "unknown two-way method"
1992            }
1993        }
1994    }
1995}
1996
1997#[derive(Debug, Clone)]
1998pub struct RealmControlHandle {
1999    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2000}
2001
2002impl fidl::endpoints::ControlHandle for RealmControlHandle {
2003    fn shutdown(&self) {
2004        self.inner.shutdown()
2005    }
2006    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2007        self.inner.shutdown_with_epitaph(status)
2008    }
2009
2010    fn is_closed(&self) -> bool {
2011        self.inner.channel().is_closed()
2012    }
2013    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2014        self.inner.channel().on_closed()
2015    }
2016
2017    #[cfg(target_os = "fuchsia")]
2018    fn signal_peer(
2019        &self,
2020        clear_mask: zx::Signals,
2021        set_mask: zx::Signals,
2022    ) -> Result<(), zx_status::Status> {
2023        use fidl::Peered;
2024        self.inner.channel().signal_peer(clear_mask, set_mask)
2025    }
2026}
2027
2028impl RealmControlHandle {}
2029
2030#[must_use = "FIDL methods require a response to be sent"]
2031#[derive(Debug)]
2032pub struct RealmStartResponder {
2033    control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
2034    tx_id: u32,
2035}
2036
2037/// Set the the channel to be shutdown (see [`RealmControlHandle::shutdown`])
2038/// if the responder is dropped without sending a response, so that the client
2039/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2040impl std::ops::Drop for RealmStartResponder {
2041    fn drop(&mut self) {
2042        self.control_handle.shutdown();
2043        // Safety: drops once, never accessed again
2044        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2045    }
2046}
2047
2048impl fidl::endpoints::Responder for RealmStartResponder {
2049    type ControlHandle = RealmControlHandle;
2050
2051    fn control_handle(&self) -> &RealmControlHandle {
2052        &self.control_handle
2053    }
2054
2055    fn drop_without_shutdown(mut self) {
2056        // Safety: drops once, never accessed again due to mem::forget
2057        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2058        // Prevent Drop from running (which would shut down the channel)
2059        std::mem::forget(self);
2060    }
2061}
2062
2063impl RealmStartResponder {
2064    /// Sends a response to the FIDL transaction.
2065    ///
2066    /// Sets the channel to shutdown if an error occurs.
2067    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2068        let _result = self.send_raw(result);
2069        if _result.is_err() {
2070            self.control_handle.shutdown();
2071        }
2072        self.drop_without_shutdown();
2073        _result
2074    }
2075
2076    /// Similar to "send" but does not shutdown the channel if an error occurs.
2077    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2078        let _result = self.send_raw(result);
2079        self.drop_without_shutdown();
2080        _result
2081    }
2082
2083    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2084        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2085            fidl::encoding::EmptyStruct,
2086            i32,
2087        >>(
2088            fidl::encoding::FlexibleResult::new(result),
2089            self.tx_id,
2090            0x3dc6949d581e96fa,
2091            fidl::encoding::DynamicFlags::FLEXIBLE,
2092        )
2093    }
2094}
2095
2096mod internal {
2097    use super::*;
2098
2099    impl fidl::encoding::ResourceTypeMarker for InternalGetBootDirectoryResponse {
2100        type Borrowed<'a> = &'a mut Self;
2101        fn take_or_borrow<'a>(
2102            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2103        ) -> Self::Borrowed<'a> {
2104            value
2105        }
2106    }
2107
2108    unsafe impl fidl::encoding::TypeMarker for InternalGetBootDirectoryResponse {
2109        type Owned = Self;
2110
2111        #[inline(always)]
2112        fn inline_align(_context: fidl::encoding::Context) -> usize {
2113            4
2114        }
2115
2116        #[inline(always)]
2117        fn inline_size(_context: fidl::encoding::Context) -> usize {
2118            4
2119        }
2120    }
2121
2122    unsafe impl
2123        fidl::encoding::Encode<
2124            InternalGetBootDirectoryResponse,
2125            fidl::encoding::DefaultFuchsiaResourceDialect,
2126        > for &mut InternalGetBootDirectoryResponse
2127    {
2128        #[inline]
2129        unsafe fn encode(
2130            self,
2131            encoder: &mut fidl::encoding::Encoder<
2132                '_,
2133                fidl::encoding::DefaultFuchsiaResourceDialect,
2134            >,
2135            offset: usize,
2136            _depth: fidl::encoding::Depth,
2137        ) -> fidl::Result<()> {
2138            encoder.debug_check_bounds::<InternalGetBootDirectoryResponse>(offset);
2139            // Delegate to tuple encoding.
2140            fidl::encoding::Encode::<
2141                InternalGetBootDirectoryResponse,
2142                fidl::encoding::DefaultFuchsiaResourceDialect,
2143            >::encode(
2144                (<fidl::encoding::Optional<
2145                    fidl::encoding::Endpoint<
2146                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2147                    >,
2148                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2149                    &mut self.boot_dir
2150                ),),
2151                encoder,
2152                offset,
2153                _depth,
2154            )
2155        }
2156    }
2157    unsafe impl<
2158        T0: fidl::encoding::Encode<
2159                fidl::encoding::Optional<
2160                    fidl::encoding::Endpoint<
2161                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2162                    >,
2163                >,
2164                fidl::encoding::DefaultFuchsiaResourceDialect,
2165            >,
2166    >
2167        fidl::encoding::Encode<
2168            InternalGetBootDirectoryResponse,
2169            fidl::encoding::DefaultFuchsiaResourceDialect,
2170        > for (T0,)
2171    {
2172        #[inline]
2173        unsafe fn encode(
2174            self,
2175            encoder: &mut fidl::encoding::Encoder<
2176                '_,
2177                fidl::encoding::DefaultFuchsiaResourceDialect,
2178            >,
2179            offset: usize,
2180            depth: fidl::encoding::Depth,
2181        ) -> fidl::Result<()> {
2182            encoder.debug_check_bounds::<InternalGetBootDirectoryResponse>(offset);
2183            // Zero out padding regions. There's no need to apply masks
2184            // because the unmasked parts will be overwritten by fields.
2185            // Write the fields.
2186            self.0.encode(encoder, offset + 0, depth)?;
2187            Ok(())
2188        }
2189    }
2190
2191    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2192        for InternalGetBootDirectoryResponse
2193    {
2194        #[inline(always)]
2195        fn new_empty() -> Self {
2196            Self {
2197                boot_dir: fidl::new_empty!(
2198                    fidl::encoding::Optional<
2199                        fidl::encoding::Endpoint<
2200                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2201                        >,
2202                    >,
2203                    fidl::encoding::DefaultFuchsiaResourceDialect
2204                ),
2205            }
2206        }
2207
2208        #[inline]
2209        unsafe fn decode(
2210            &mut self,
2211            decoder: &mut fidl::encoding::Decoder<
2212                '_,
2213                fidl::encoding::DefaultFuchsiaResourceDialect,
2214            >,
2215            offset: usize,
2216            _depth: fidl::encoding::Depth,
2217        ) -> fidl::Result<()> {
2218            decoder.debug_check_bounds::<Self>(offset);
2219            // Verify that padding bytes are zero.
2220            fidl::decode!(
2221                fidl::encoding::Optional<
2222                    fidl::encoding::Endpoint<
2223                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2224                    >,
2225                >,
2226                fidl::encoding::DefaultFuchsiaResourceDialect,
2227                &mut self.boot_dir,
2228                decoder,
2229                offset + 0,
2230                _depth
2231            )?;
2232            Ok(())
2233        }
2234    }
2235
2236    impl fidl::encoding::ResourceTypeMarker for InternalGetTestPackageResponse {
2237        type Borrowed<'a> = &'a mut Self;
2238        fn take_or_borrow<'a>(
2239            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2240        ) -> Self::Borrowed<'a> {
2241            value
2242        }
2243    }
2244
2245    unsafe impl fidl::encoding::TypeMarker for InternalGetTestPackageResponse {
2246        type Owned = Self;
2247
2248        #[inline(always)]
2249        fn inline_align(_context: fidl::encoding::Context) -> usize {
2250            4
2251        }
2252
2253        #[inline(always)]
2254        fn inline_size(_context: fidl::encoding::Context) -> usize {
2255            4
2256        }
2257    }
2258
2259    unsafe impl
2260        fidl::encoding::Encode<
2261            InternalGetTestPackageResponse,
2262            fidl::encoding::DefaultFuchsiaResourceDialect,
2263        > for &mut InternalGetTestPackageResponse
2264    {
2265        #[inline]
2266        unsafe fn encode(
2267            self,
2268            encoder: &mut fidl::encoding::Encoder<
2269                '_,
2270                fidl::encoding::DefaultFuchsiaResourceDialect,
2271            >,
2272            offset: usize,
2273            _depth: fidl::encoding::Depth,
2274        ) -> fidl::Result<()> {
2275            encoder.debug_check_bounds::<InternalGetTestPackageResponse>(offset);
2276            // Delegate to tuple encoding.
2277            fidl::encoding::Encode::<
2278                InternalGetTestPackageResponse,
2279                fidl::encoding::DefaultFuchsiaResourceDialect,
2280            >::encode(
2281                (<fidl::encoding::Optional<
2282                    fidl::encoding::Endpoint<
2283                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2284                    >,
2285                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2286                    &mut self.test_pkg_dir
2287                ),),
2288                encoder,
2289                offset,
2290                _depth,
2291            )
2292        }
2293    }
2294    unsafe impl<
2295        T0: fidl::encoding::Encode<
2296                fidl::encoding::Optional<
2297                    fidl::encoding::Endpoint<
2298                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2299                    >,
2300                >,
2301                fidl::encoding::DefaultFuchsiaResourceDialect,
2302            >,
2303    >
2304        fidl::encoding::Encode<
2305            InternalGetTestPackageResponse,
2306            fidl::encoding::DefaultFuchsiaResourceDialect,
2307        > for (T0,)
2308    {
2309        #[inline]
2310        unsafe fn encode(
2311            self,
2312            encoder: &mut fidl::encoding::Encoder<
2313                '_,
2314                fidl::encoding::DefaultFuchsiaResourceDialect,
2315            >,
2316            offset: usize,
2317            depth: fidl::encoding::Depth,
2318        ) -> fidl::Result<()> {
2319            encoder.debug_check_bounds::<InternalGetTestPackageResponse>(offset);
2320            // Zero out padding regions. There's no need to apply masks
2321            // because the unmasked parts will be overwritten by fields.
2322            // Write the fields.
2323            self.0.encode(encoder, offset + 0, depth)?;
2324            Ok(())
2325        }
2326    }
2327
2328    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2329        for InternalGetTestPackageResponse
2330    {
2331        #[inline(always)]
2332        fn new_empty() -> Self {
2333            Self {
2334                test_pkg_dir: fidl::new_empty!(
2335                    fidl::encoding::Optional<
2336                        fidl::encoding::Endpoint<
2337                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2338                        >,
2339                    >,
2340                    fidl::encoding::DefaultFuchsiaResourceDialect
2341                ),
2342            }
2343        }
2344
2345        #[inline]
2346        unsafe fn decode(
2347            &mut self,
2348            decoder: &mut fidl::encoding::Decoder<
2349                '_,
2350                fidl::encoding::DefaultFuchsiaResourceDialect,
2351            >,
2352            offset: usize,
2353            _depth: fidl::encoding::Depth,
2354        ) -> fidl::Result<()> {
2355            decoder.debug_check_bounds::<Self>(offset);
2356            // Verify that padding bytes are zero.
2357            fidl::decode!(
2358                fidl::encoding::Optional<
2359                    fidl::encoding::Endpoint<
2360                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2361                    >,
2362                >,
2363                fidl::encoding::DefaultFuchsiaResourceDialect,
2364                &mut self.test_pkg_dir,
2365                decoder,
2366                offset + 0,
2367                _depth
2368            )?;
2369            Ok(())
2370        }
2371    }
2372
2373    impl fidl::encoding::ResourceTypeMarker for RealmStartRequest {
2374        type Borrowed<'a> = &'a mut Self;
2375        fn take_or_borrow<'a>(
2376            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2377        ) -> Self::Borrowed<'a> {
2378            value
2379        }
2380    }
2381
2382    unsafe impl fidl::encoding::TypeMarker for RealmStartRequest {
2383        type Owned = Self;
2384
2385        #[inline(always)]
2386        fn inline_align(_context: fidl::encoding::Context) -> usize {
2387            8
2388        }
2389
2390        #[inline(always)]
2391        fn inline_size(_context: fidl::encoding::Context) -> usize {
2392            16
2393        }
2394    }
2395
2396    unsafe impl
2397        fidl::encoding::Encode<RealmStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2398        for &mut RealmStartRequest
2399    {
2400        #[inline]
2401        unsafe fn encode(
2402            self,
2403            encoder: &mut fidl::encoding::Encoder<
2404                '_,
2405                fidl::encoding::DefaultFuchsiaResourceDialect,
2406            >,
2407            offset: usize,
2408            _depth: fidl::encoding::Depth,
2409        ) -> fidl::Result<()> {
2410            encoder.debug_check_bounds::<RealmStartRequest>(offset);
2411            // Delegate to tuple encoding.
2412            fidl::encoding::Encode::<RealmStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2413                (
2414                    <RealmArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
2415                ),
2416                encoder, offset, _depth
2417            )
2418        }
2419    }
2420    unsafe impl<
2421        T0: fidl::encoding::Encode<RealmArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
2422    > fidl::encoding::Encode<RealmStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2423        for (T0,)
2424    {
2425        #[inline]
2426        unsafe fn encode(
2427            self,
2428            encoder: &mut fidl::encoding::Encoder<
2429                '_,
2430                fidl::encoding::DefaultFuchsiaResourceDialect,
2431            >,
2432            offset: usize,
2433            depth: fidl::encoding::Depth,
2434        ) -> fidl::Result<()> {
2435            encoder.debug_check_bounds::<RealmStartRequest>(offset);
2436            // Zero out padding regions. There's no need to apply masks
2437            // because the unmasked parts will be overwritten by fields.
2438            // Write the fields.
2439            self.0.encode(encoder, offset + 0, depth)?;
2440            Ok(())
2441        }
2442    }
2443
2444    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2445        for RealmStartRequest
2446    {
2447        #[inline(always)]
2448        fn new_empty() -> Self {
2449            Self {
2450                args: fidl::new_empty!(RealmArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
2451            }
2452        }
2453
2454        #[inline]
2455        unsafe fn decode(
2456            &mut self,
2457            decoder: &mut fidl::encoding::Decoder<
2458                '_,
2459                fidl::encoding::DefaultFuchsiaResourceDialect,
2460            >,
2461            offset: usize,
2462            _depth: fidl::encoding::Depth,
2463        ) -> fidl::Result<()> {
2464            decoder.debug_check_bounds::<Self>(offset);
2465            // Verify that padding bytes are zero.
2466            fidl::decode!(
2467                RealmArgs,
2468                fidl::encoding::DefaultFuchsiaResourceDialect,
2469                &mut self.args,
2470                decoder,
2471                offset + 0,
2472                _depth
2473            )?;
2474            Ok(())
2475        }
2476    }
2477
2478    impl RealmArgs {
2479        #[inline(always)]
2480        fn max_ordinal_present(&self) -> u64 {
2481            if let Some(_) = self.platform_pid {
2482                return 22;
2483            }
2484            if let Some(_) = self.platform_vid {
2485                return 21;
2486            }
2487            if let Some(_) = self.devicetree {
2488                return 20;
2489            }
2490            if let Some(_) = self.boot_driver_components {
2491                return 19;
2492            }
2493            if let Some(_) = self.software_devices {
2494                return 18;
2495            }
2496            if let Some(_) = self.driver_index_stop_timeout_millis {
2497                return 17;
2498            }
2499            if let Some(_) = self.test_component {
2500                return 16;
2501            }
2502            if let Some(_) = self.dtr_exposes {
2503                return 15;
2504            }
2505            if let Some(_) = self.dtr_offers {
2506                return 14;
2507            }
2508            if let Some(_) = self.pkg {
2509                return 13;
2510            }
2511            if let Some(_) = self.exposes {
2512                return 12;
2513            }
2514            if let Some(_) = self.offers {
2515                return 11;
2516            }
2517            if let Some(_) = self.board_name {
2518                return 10;
2519            }
2520            if let Some(_) = self.driver_bind_eager {
2521                return 9;
2522            }
2523            if let Some(_) = self.driver_disable {
2524                return 8;
2525            }
2526            if let Some(_) = self.driver_log_level {
2527                return 7;
2528            }
2529            if let Some(_) = self.driver_tests_disable {
2530                return 6;
2531            }
2532            if let Some(_) = self.driver_tests_enable {
2533                return 5;
2534            }
2535            if let Some(_) = self.driver_tests_enable_all {
2536                return 4;
2537            }
2538            if let Some(_) = self.root_driver {
2539                return 2;
2540            }
2541            if let Some(_) = self.boot {
2542                return 1;
2543            }
2544            0
2545        }
2546    }
2547
2548    impl fidl::encoding::ResourceTypeMarker for RealmArgs {
2549        type Borrowed<'a> = &'a mut Self;
2550        fn take_or_borrow<'a>(
2551            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2552        ) -> Self::Borrowed<'a> {
2553            value
2554        }
2555    }
2556
2557    unsafe impl fidl::encoding::TypeMarker for RealmArgs {
2558        type Owned = Self;
2559
2560        #[inline(always)]
2561        fn inline_align(_context: fidl::encoding::Context) -> usize {
2562            8
2563        }
2564
2565        #[inline(always)]
2566        fn inline_size(_context: fidl::encoding::Context) -> usize {
2567            16
2568        }
2569    }
2570
2571    unsafe impl fidl::encoding::Encode<RealmArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
2572        for &mut RealmArgs
2573    {
2574        unsafe fn encode(
2575            self,
2576            encoder: &mut fidl::encoding::Encoder<
2577                '_,
2578                fidl::encoding::DefaultFuchsiaResourceDialect,
2579            >,
2580            offset: usize,
2581            mut depth: fidl::encoding::Depth,
2582        ) -> fidl::Result<()> {
2583            encoder.debug_check_bounds::<RealmArgs>(offset);
2584            // Vector header
2585            let max_ordinal: u64 = self.max_ordinal_present();
2586            encoder.write_num(max_ordinal, offset);
2587            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2588            // Calling encoder.out_of_line_offset(0) is not allowed.
2589            if max_ordinal == 0 {
2590                return Ok(());
2591            }
2592            depth.increment()?;
2593            let envelope_size = 8;
2594            let bytes_len = max_ordinal as usize * envelope_size;
2595            #[allow(unused_variables)]
2596            let offset = encoder.out_of_line_offset(bytes_len);
2597            let mut _prev_end_offset: usize = 0;
2598            if 1 > max_ordinal {
2599                return Ok(());
2600            }
2601
2602            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2603            // are envelope_size bytes.
2604            let cur_offset: usize = (1 - 1) * envelope_size;
2605
2606            // Zero reserved fields.
2607            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2608
2609            // Safety:
2610            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2611            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2612            //   envelope_size bytes, there is always sufficient room.
2613            fidl::encoding::encode_in_envelope_optional::<
2614                fidl::encoding::Endpoint<
2615                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2616                >,
2617                fidl::encoding::DefaultFuchsiaResourceDialect,
2618            >(
2619                self.boot.as_mut().map(
2620                    <fidl::encoding::Endpoint<
2621                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2622                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2623                ),
2624                encoder,
2625                offset + cur_offset,
2626                depth,
2627            )?;
2628
2629            _prev_end_offset = cur_offset + envelope_size;
2630            if 2 > max_ordinal {
2631                return Ok(());
2632            }
2633
2634            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2635            // are envelope_size bytes.
2636            let cur_offset: usize = (2 - 1) * envelope_size;
2637
2638            // Zero reserved fields.
2639            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2640
2641            // Safety:
2642            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2643            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2644            //   envelope_size bytes, there is always sufficient room.
2645            fidl::encoding::encode_in_envelope_optional::<
2646                fidl::encoding::UnboundedString,
2647                fidl::encoding::DefaultFuchsiaResourceDialect,
2648            >(
2649                self.root_driver.as_ref().map(
2650                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
2651                ),
2652                encoder,
2653                offset + cur_offset,
2654                depth,
2655            )?;
2656
2657            _prev_end_offset = cur_offset + envelope_size;
2658            if 4 > max_ordinal {
2659                return Ok(());
2660            }
2661
2662            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2663            // are envelope_size bytes.
2664            let cur_offset: usize = (4 - 1) * envelope_size;
2665
2666            // Zero reserved fields.
2667            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2668
2669            // Safety:
2670            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2671            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2672            //   envelope_size bytes, there is always sufficient room.
2673            fidl::encoding::encode_in_envelope_optional::<
2674                bool,
2675                fidl::encoding::DefaultFuchsiaResourceDialect,
2676            >(
2677                self.driver_tests_enable_all
2678                    .as_ref()
2679                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2680                encoder,
2681                offset + cur_offset,
2682                depth,
2683            )?;
2684
2685            _prev_end_offset = cur_offset + envelope_size;
2686            if 5 > max_ordinal {
2687                return Ok(());
2688            }
2689
2690            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2691            // are envelope_size bytes.
2692            let cur_offset: usize = (5 - 1) * envelope_size;
2693
2694            // Zero reserved fields.
2695            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2696
2697            // Safety:
2698            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2699            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2700            //   envelope_size bytes, there is always sufficient room.
2701            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2702            self.driver_tests_enable.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2703            encoder, offset + cur_offset, depth
2704        )?;
2705
2706            _prev_end_offset = cur_offset + envelope_size;
2707            if 6 > max_ordinal {
2708                return Ok(());
2709            }
2710
2711            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2712            // are envelope_size bytes.
2713            let cur_offset: usize = (6 - 1) * envelope_size;
2714
2715            // Zero reserved fields.
2716            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2717
2718            // Safety:
2719            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2720            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2721            //   envelope_size bytes, there is always sufficient room.
2722            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2723            self.driver_tests_disable.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2724            encoder, offset + cur_offset, depth
2725        )?;
2726
2727            _prev_end_offset = cur_offset + envelope_size;
2728            if 7 > max_ordinal {
2729                return Ok(());
2730            }
2731
2732            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2733            // are envelope_size bytes.
2734            let cur_offset: usize = (7 - 1) * envelope_size;
2735
2736            // Zero reserved fields.
2737            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2738
2739            // Safety:
2740            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2741            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2742            //   envelope_size bytes, there is always sufficient room.
2743            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<DriverLog>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2744            self.driver_log_level.as_ref().map(<fidl::encoding::UnboundedVector<DriverLog> as fidl::encoding::ValueTypeMarker>::borrow),
2745            encoder, offset + cur_offset, depth
2746        )?;
2747
2748            _prev_end_offset = cur_offset + envelope_size;
2749            if 8 > max_ordinal {
2750                return Ok(());
2751            }
2752
2753            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2754            // are envelope_size bytes.
2755            let cur_offset: usize = (8 - 1) * envelope_size;
2756
2757            // Zero reserved fields.
2758            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2759
2760            // Safety:
2761            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2762            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2763            //   envelope_size bytes, there is always sufficient room.
2764            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2765            self.driver_disable.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2766            encoder, offset + cur_offset, depth
2767        )?;
2768
2769            _prev_end_offset = cur_offset + envelope_size;
2770            if 9 > max_ordinal {
2771                return Ok(());
2772            }
2773
2774            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2775            // are envelope_size bytes.
2776            let cur_offset: usize = (9 - 1) * envelope_size;
2777
2778            // Zero reserved fields.
2779            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2780
2781            // Safety:
2782            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2783            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2784            //   envelope_size bytes, there is always sufficient room.
2785            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2786            self.driver_bind_eager.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2787            encoder, offset + cur_offset, depth
2788        )?;
2789
2790            _prev_end_offset = cur_offset + envelope_size;
2791            if 10 > max_ordinal {
2792                return Ok(());
2793            }
2794
2795            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2796            // are envelope_size bytes.
2797            let cur_offset: usize = (10 - 1) * envelope_size;
2798
2799            // Zero reserved fields.
2800            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2801
2802            // Safety:
2803            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2804            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2805            //   envelope_size bytes, there is always sufficient room.
2806            fidl::encoding::encode_in_envelope_optional::<
2807                fidl::encoding::UnboundedString,
2808                fidl::encoding::DefaultFuchsiaResourceDialect,
2809            >(
2810                self.board_name.as_ref().map(
2811                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
2812                ),
2813                encoder,
2814                offset + cur_offset,
2815                depth,
2816            )?;
2817
2818            _prev_end_offset = cur_offset + envelope_size;
2819            if 11 > max_ordinal {
2820                return Ok(());
2821            }
2822
2823            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2824            // are envelope_size bytes.
2825            let cur_offset: usize = (11 - 1) * envelope_size;
2826
2827            // Zero reserved fields.
2828            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2829
2830            // Safety:
2831            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2832            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2833            //   envelope_size bytes, there is always sufficient room.
2834            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Offer>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2835            self.offers.as_ref().map(<fidl::encoding::UnboundedVector<Offer> as fidl::encoding::ValueTypeMarker>::borrow),
2836            encoder, offset + cur_offset, depth
2837        )?;
2838
2839            _prev_end_offset = cur_offset + envelope_size;
2840            if 12 > max_ordinal {
2841                return Ok(());
2842            }
2843
2844            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2845            // are envelope_size bytes.
2846            let cur_offset: usize = (12 - 1) * envelope_size;
2847
2848            // Zero reserved fields.
2849            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2850
2851            // Safety:
2852            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2853            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2854            //   envelope_size bytes, there is always sufficient room.
2855            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Expose>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2856            self.exposes.as_ref().map(<fidl::encoding::UnboundedVector<Expose> as fidl::encoding::ValueTypeMarker>::borrow),
2857            encoder, offset + cur_offset, depth
2858        )?;
2859
2860            _prev_end_offset = cur_offset + envelope_size;
2861            if 13 > max_ordinal {
2862                return Ok(());
2863            }
2864
2865            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2866            // are envelope_size bytes.
2867            let cur_offset: usize = (13 - 1) * envelope_size;
2868
2869            // Zero reserved fields.
2870            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2871
2872            // Safety:
2873            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2874            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2875            //   envelope_size bytes, there is always sufficient room.
2876            fidl::encoding::encode_in_envelope_optional::<
2877                fidl::encoding::Endpoint<
2878                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2879                >,
2880                fidl::encoding::DefaultFuchsiaResourceDialect,
2881            >(
2882                self.pkg.as_mut().map(
2883                    <fidl::encoding::Endpoint<
2884                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2885                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2886                ),
2887                encoder,
2888                offset + cur_offset,
2889                depth,
2890            )?;
2891
2892            _prev_end_offset = cur_offset + envelope_size;
2893            if 14 > max_ordinal {
2894                return Ok(());
2895            }
2896
2897            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2898            // are envelope_size bytes.
2899            let cur_offset: usize = (14 - 1) * envelope_size;
2900
2901            // Zero reserved fields.
2902            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2903
2904            // Safety:
2905            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2906            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2907            //   envelope_size bytes, there is always sufficient room.
2908            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2909            self.dtr_offers.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability> as fidl::encoding::ValueTypeMarker>::borrow),
2910            encoder, offset + cur_offset, depth
2911        )?;
2912
2913            _prev_end_offset = cur_offset + envelope_size;
2914            if 15 > max_ordinal {
2915                return Ok(());
2916            }
2917
2918            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2919            // are envelope_size bytes.
2920            let cur_offset: usize = (15 - 1) * envelope_size;
2921
2922            // Zero reserved fields.
2923            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2924
2925            // Safety:
2926            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2927            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2928            //   envelope_size bytes, there is always sufficient room.
2929            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2930            self.dtr_exposes.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability> as fidl::encoding::ValueTypeMarker>::borrow),
2931            encoder, offset + cur_offset, depth
2932        )?;
2933
2934            _prev_end_offset = cur_offset + envelope_size;
2935            if 16 > max_ordinal {
2936                return Ok(());
2937            }
2938
2939            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2940            // are envelope_size bytes.
2941            let cur_offset: usize = (16 - 1) * envelope_size;
2942
2943            // Zero reserved fields.
2944            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2945
2946            // Safety:
2947            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2948            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2949            //   envelope_size bytes, there is always sufficient room.
2950            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_resolution::Component, fidl::encoding::DefaultFuchsiaResourceDialect>(
2951            self.test_component.as_mut().map(<fidl_fuchsia_component_resolution::Component as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2952            encoder, offset + cur_offset, depth
2953        )?;
2954
2955            _prev_end_offset = cur_offset + envelope_size;
2956            if 17 > max_ordinal {
2957                return Ok(());
2958            }
2959
2960            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2961            // are envelope_size bytes.
2962            let cur_offset: usize = (17 - 1) * envelope_size;
2963
2964            // Zero reserved fields.
2965            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2966
2967            // Safety:
2968            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2969            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2970            //   envelope_size bytes, there is always sufficient room.
2971            fidl::encoding::encode_in_envelope_optional::<
2972                i64,
2973                fidl::encoding::DefaultFuchsiaResourceDialect,
2974            >(
2975                self.driver_index_stop_timeout_millis
2976                    .as_ref()
2977                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2978                encoder,
2979                offset + cur_offset,
2980                depth,
2981            )?;
2982
2983            _prev_end_offset = cur_offset + envelope_size;
2984            if 18 > max_ordinal {
2985                return Ok(());
2986            }
2987
2988            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2989            // are envelope_size bytes.
2990            let cur_offset: usize = (18 - 1) * envelope_size;
2991
2992            // Zero reserved fields.
2993            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2994
2995            // Safety:
2996            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2997            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2998            //   envelope_size bytes, there is always sufficient room.
2999            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SoftwareDevice, 20>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3000            self.software_devices.as_ref().map(<fidl::encoding::Vector<SoftwareDevice, 20> as fidl::encoding::ValueTypeMarker>::borrow),
3001            encoder, offset + cur_offset, depth
3002        )?;
3003
3004            _prev_end_offset = cur_offset + envelope_size;
3005            if 19 > max_ordinal {
3006                return Ok(());
3007            }
3008
3009            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3010            // are envelope_size bytes.
3011            let cur_offset: usize = (19 - 1) * envelope_size;
3012
3013            // Zero reserved fields.
3014            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3015
3016            // Safety:
3017            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3018            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3019            //   envelope_size bytes, there is always sufficient room.
3020            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3021            self.boot_driver_components.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
3022            encoder, offset + cur_offset, depth
3023        )?;
3024
3025            _prev_end_offset = cur_offset + envelope_size;
3026            if 20 > max_ordinal {
3027                return Ok(());
3028            }
3029
3030            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3031            // are envelope_size bytes.
3032            let cur_offset: usize = (20 - 1) * envelope_size;
3033
3034            // Zero reserved fields.
3035            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3036
3037            // Safety:
3038            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3039            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3040            //   envelope_size bytes, there is always sufficient room.
3041            fidl::encoding::encode_in_envelope_optional::<
3042                fidl::encoding::HandleType<
3043                    fidl::Vmo,
3044                    { fidl::ObjectType::VMO.into_raw() },
3045                    2147483648,
3046                >,
3047                fidl::encoding::DefaultFuchsiaResourceDialect,
3048            >(
3049                self.devicetree.as_mut().map(
3050                    <fidl::encoding::HandleType<
3051                        fidl::Vmo,
3052                        { fidl::ObjectType::VMO.into_raw() },
3053                        2147483648,
3054                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3055                ),
3056                encoder,
3057                offset + cur_offset,
3058                depth,
3059            )?;
3060
3061            _prev_end_offset = cur_offset + envelope_size;
3062            if 21 > max_ordinal {
3063                return Ok(());
3064            }
3065
3066            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3067            // are envelope_size bytes.
3068            let cur_offset: usize = (21 - 1) * envelope_size;
3069
3070            // Zero reserved fields.
3071            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3072
3073            // Safety:
3074            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3075            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3076            //   envelope_size bytes, there is always sufficient room.
3077            fidl::encoding::encode_in_envelope_optional::<
3078                u32,
3079                fidl::encoding::DefaultFuchsiaResourceDialect,
3080            >(
3081                self.platform_vid.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3082                encoder,
3083                offset + cur_offset,
3084                depth,
3085            )?;
3086
3087            _prev_end_offset = cur_offset + envelope_size;
3088            if 22 > max_ordinal {
3089                return Ok(());
3090            }
3091
3092            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3093            // are envelope_size bytes.
3094            let cur_offset: usize = (22 - 1) * envelope_size;
3095
3096            // Zero reserved fields.
3097            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3098
3099            // Safety:
3100            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3101            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3102            //   envelope_size bytes, there is always sufficient room.
3103            fidl::encoding::encode_in_envelope_optional::<
3104                u32,
3105                fidl::encoding::DefaultFuchsiaResourceDialect,
3106            >(
3107                self.platform_pid.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3108                encoder,
3109                offset + cur_offset,
3110                depth,
3111            )?;
3112
3113            _prev_end_offset = cur_offset + envelope_size;
3114
3115            Ok(())
3116        }
3117    }
3118
3119    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmArgs {
3120        #[inline(always)]
3121        fn new_empty() -> Self {
3122            Self::default()
3123        }
3124
3125        unsafe fn decode(
3126            &mut self,
3127            decoder: &mut fidl::encoding::Decoder<
3128                '_,
3129                fidl::encoding::DefaultFuchsiaResourceDialect,
3130            >,
3131            offset: usize,
3132            mut depth: fidl::encoding::Depth,
3133        ) -> fidl::Result<()> {
3134            decoder.debug_check_bounds::<Self>(offset);
3135            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3136                None => return Err(fidl::Error::NotNullable),
3137                Some(len) => len,
3138            };
3139            // Calling decoder.out_of_line_offset(0) is not allowed.
3140            if len == 0 {
3141                return Ok(());
3142            };
3143            depth.increment()?;
3144            let envelope_size = 8;
3145            let bytes_len = len * envelope_size;
3146            let offset = decoder.out_of_line_offset(bytes_len)?;
3147            // Decode the envelope for each type.
3148            let mut _next_ordinal_to_read = 0;
3149            let mut next_offset = offset;
3150            let end_offset = offset + bytes_len;
3151            _next_ordinal_to_read += 1;
3152            if next_offset >= end_offset {
3153                return Ok(());
3154            }
3155
3156            // Decode unknown envelopes for gaps in ordinals.
3157            while _next_ordinal_to_read < 1 {
3158                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3159                _next_ordinal_to_read += 1;
3160                next_offset += envelope_size;
3161            }
3162
3163            let next_out_of_line = decoder.next_out_of_line();
3164            let handles_before = decoder.remaining_handles();
3165            if let Some((inlined, num_bytes, num_handles)) =
3166                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3167            {
3168                let member_inline_size = <fidl::encoding::Endpoint<
3169                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3170                > as fidl::encoding::TypeMarker>::inline_size(
3171                    decoder.context
3172                );
3173                if inlined != (member_inline_size <= 4) {
3174                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3175                }
3176                let inner_offset;
3177                let mut inner_depth = depth.clone();
3178                if inlined {
3179                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3180                    inner_offset = next_offset;
3181                } else {
3182                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3183                    inner_depth.increment()?;
3184                }
3185                let val_ref = self.boot.get_or_insert_with(|| {
3186                    fidl::new_empty!(
3187                        fidl::encoding::Endpoint<
3188                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3189                        >,
3190                        fidl::encoding::DefaultFuchsiaResourceDialect
3191                    )
3192                });
3193                fidl::decode!(
3194                    fidl::encoding::Endpoint<
3195                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3196                    >,
3197                    fidl::encoding::DefaultFuchsiaResourceDialect,
3198                    val_ref,
3199                    decoder,
3200                    inner_offset,
3201                    inner_depth
3202                )?;
3203                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3204                {
3205                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3206                }
3207                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3208                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3209                }
3210            }
3211
3212            next_offset += envelope_size;
3213            _next_ordinal_to_read += 1;
3214            if next_offset >= end_offset {
3215                return Ok(());
3216            }
3217
3218            // Decode unknown envelopes for gaps in ordinals.
3219            while _next_ordinal_to_read < 2 {
3220                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3221                _next_ordinal_to_read += 1;
3222                next_offset += envelope_size;
3223            }
3224
3225            let next_out_of_line = decoder.next_out_of_line();
3226            let handles_before = decoder.remaining_handles();
3227            if let Some((inlined, num_bytes, num_handles)) =
3228                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3229            {
3230                let member_inline_size =
3231                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
3232                        decoder.context,
3233                    );
3234                if inlined != (member_inline_size <= 4) {
3235                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3236                }
3237                let inner_offset;
3238                let mut inner_depth = depth.clone();
3239                if inlined {
3240                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3241                    inner_offset = next_offset;
3242                } else {
3243                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3244                    inner_depth.increment()?;
3245                }
3246                let val_ref = self.root_driver.get_or_insert_with(|| {
3247                    fidl::new_empty!(
3248                        fidl::encoding::UnboundedString,
3249                        fidl::encoding::DefaultFuchsiaResourceDialect
3250                    )
3251                });
3252                fidl::decode!(
3253                    fidl::encoding::UnboundedString,
3254                    fidl::encoding::DefaultFuchsiaResourceDialect,
3255                    val_ref,
3256                    decoder,
3257                    inner_offset,
3258                    inner_depth
3259                )?;
3260                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3261                {
3262                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3263                }
3264                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3265                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3266                }
3267            }
3268
3269            next_offset += envelope_size;
3270            _next_ordinal_to_read += 1;
3271            if next_offset >= end_offset {
3272                return Ok(());
3273            }
3274
3275            // Decode unknown envelopes for gaps in ordinals.
3276            while _next_ordinal_to_read < 4 {
3277                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3278                _next_ordinal_to_read += 1;
3279                next_offset += envelope_size;
3280            }
3281
3282            let next_out_of_line = decoder.next_out_of_line();
3283            let handles_before = decoder.remaining_handles();
3284            if let Some((inlined, num_bytes, num_handles)) =
3285                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3286            {
3287                let member_inline_size =
3288                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3289                if inlined != (member_inline_size <= 4) {
3290                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3291                }
3292                let inner_offset;
3293                let mut inner_depth = depth.clone();
3294                if inlined {
3295                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3296                    inner_offset = next_offset;
3297                } else {
3298                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3299                    inner_depth.increment()?;
3300                }
3301                let val_ref = self.driver_tests_enable_all.get_or_insert_with(|| {
3302                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3303                });
3304                fidl::decode!(
3305                    bool,
3306                    fidl::encoding::DefaultFuchsiaResourceDialect,
3307                    val_ref,
3308                    decoder,
3309                    inner_offset,
3310                    inner_depth
3311                )?;
3312                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3313                {
3314                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3315                }
3316                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3317                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3318                }
3319            }
3320
3321            next_offset += envelope_size;
3322            _next_ordinal_to_read += 1;
3323            if next_offset >= end_offset {
3324                return Ok(());
3325            }
3326
3327            // Decode unknown envelopes for gaps in ordinals.
3328            while _next_ordinal_to_read < 5 {
3329                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3330                _next_ordinal_to_read += 1;
3331                next_offset += envelope_size;
3332            }
3333
3334            let next_out_of_line = decoder.next_out_of_line();
3335            let handles_before = decoder.remaining_handles();
3336            if let Some((inlined, num_bytes, num_handles)) =
3337                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3338            {
3339                let member_inline_size = <fidl::encoding::UnboundedVector<
3340                    fidl::encoding::UnboundedString,
3341                > as fidl::encoding::TypeMarker>::inline_size(
3342                    decoder.context
3343                );
3344                if inlined != (member_inline_size <= 4) {
3345                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3346                }
3347                let inner_offset;
3348                let mut inner_depth = depth.clone();
3349                if inlined {
3350                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3351                    inner_offset = next_offset;
3352                } else {
3353                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3354                    inner_depth.increment()?;
3355                }
3356                let val_ref = self.driver_tests_enable.get_or_insert_with(|| {
3357                    fidl::new_empty!(
3358                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3359                        fidl::encoding::DefaultFuchsiaResourceDialect
3360                    )
3361                });
3362                fidl::decode!(
3363                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3364                    fidl::encoding::DefaultFuchsiaResourceDialect,
3365                    val_ref,
3366                    decoder,
3367                    inner_offset,
3368                    inner_depth
3369                )?;
3370                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3371                {
3372                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3373                }
3374                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3375                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3376                }
3377            }
3378
3379            next_offset += envelope_size;
3380            _next_ordinal_to_read += 1;
3381            if next_offset >= end_offset {
3382                return Ok(());
3383            }
3384
3385            // Decode unknown envelopes for gaps in ordinals.
3386            while _next_ordinal_to_read < 6 {
3387                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3388                _next_ordinal_to_read += 1;
3389                next_offset += envelope_size;
3390            }
3391
3392            let next_out_of_line = decoder.next_out_of_line();
3393            let handles_before = decoder.remaining_handles();
3394            if let Some((inlined, num_bytes, num_handles)) =
3395                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3396            {
3397                let member_inline_size = <fidl::encoding::UnboundedVector<
3398                    fidl::encoding::UnboundedString,
3399                > as fidl::encoding::TypeMarker>::inline_size(
3400                    decoder.context
3401                );
3402                if inlined != (member_inline_size <= 4) {
3403                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3404                }
3405                let inner_offset;
3406                let mut inner_depth = depth.clone();
3407                if inlined {
3408                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3409                    inner_offset = next_offset;
3410                } else {
3411                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3412                    inner_depth.increment()?;
3413                }
3414                let val_ref = self.driver_tests_disable.get_or_insert_with(|| {
3415                    fidl::new_empty!(
3416                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3417                        fidl::encoding::DefaultFuchsiaResourceDialect
3418                    )
3419                });
3420                fidl::decode!(
3421                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3422                    fidl::encoding::DefaultFuchsiaResourceDialect,
3423                    val_ref,
3424                    decoder,
3425                    inner_offset,
3426                    inner_depth
3427                )?;
3428                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3429                {
3430                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3431                }
3432                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3433                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3434                }
3435            }
3436
3437            next_offset += envelope_size;
3438            _next_ordinal_to_read += 1;
3439            if next_offset >= end_offset {
3440                return Ok(());
3441            }
3442
3443            // Decode unknown envelopes for gaps in ordinals.
3444            while _next_ordinal_to_read < 7 {
3445                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3446                _next_ordinal_to_read += 1;
3447                next_offset += envelope_size;
3448            }
3449
3450            let next_out_of_line = decoder.next_out_of_line();
3451            let handles_before = decoder.remaining_handles();
3452            if let Some((inlined, num_bytes, num_handles)) =
3453                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3454            {
3455                let member_inline_size = <fidl::encoding::UnboundedVector<DriverLog> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3456                if inlined != (member_inline_size <= 4) {
3457                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3458                }
3459                let inner_offset;
3460                let mut inner_depth = depth.clone();
3461                if inlined {
3462                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3463                    inner_offset = next_offset;
3464                } else {
3465                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3466                    inner_depth.increment()?;
3467                }
3468                let val_ref = self.driver_log_level.get_or_insert_with(|| {
3469                    fidl::new_empty!(
3470                        fidl::encoding::UnboundedVector<DriverLog>,
3471                        fidl::encoding::DefaultFuchsiaResourceDialect
3472                    )
3473                });
3474                fidl::decode!(
3475                    fidl::encoding::UnboundedVector<DriverLog>,
3476                    fidl::encoding::DefaultFuchsiaResourceDialect,
3477                    val_ref,
3478                    decoder,
3479                    inner_offset,
3480                    inner_depth
3481                )?;
3482                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3483                {
3484                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3485                }
3486                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3487                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3488                }
3489            }
3490
3491            next_offset += envelope_size;
3492            _next_ordinal_to_read += 1;
3493            if next_offset >= end_offset {
3494                return Ok(());
3495            }
3496
3497            // Decode unknown envelopes for gaps in ordinals.
3498            while _next_ordinal_to_read < 8 {
3499                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3500                _next_ordinal_to_read += 1;
3501                next_offset += envelope_size;
3502            }
3503
3504            let next_out_of_line = decoder.next_out_of_line();
3505            let handles_before = decoder.remaining_handles();
3506            if let Some((inlined, num_bytes, num_handles)) =
3507                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3508            {
3509                let member_inline_size = <fidl::encoding::UnboundedVector<
3510                    fidl::encoding::UnboundedString,
3511                > as fidl::encoding::TypeMarker>::inline_size(
3512                    decoder.context
3513                );
3514                if inlined != (member_inline_size <= 4) {
3515                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3516                }
3517                let inner_offset;
3518                let mut inner_depth = depth.clone();
3519                if inlined {
3520                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3521                    inner_offset = next_offset;
3522                } else {
3523                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3524                    inner_depth.increment()?;
3525                }
3526                let val_ref = self.driver_disable.get_or_insert_with(|| {
3527                    fidl::new_empty!(
3528                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3529                        fidl::encoding::DefaultFuchsiaResourceDialect
3530                    )
3531                });
3532                fidl::decode!(
3533                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3534                    fidl::encoding::DefaultFuchsiaResourceDialect,
3535                    val_ref,
3536                    decoder,
3537                    inner_offset,
3538                    inner_depth
3539                )?;
3540                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3541                {
3542                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3543                }
3544                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3545                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3546                }
3547            }
3548
3549            next_offset += envelope_size;
3550            _next_ordinal_to_read += 1;
3551            if next_offset >= end_offset {
3552                return Ok(());
3553            }
3554
3555            // Decode unknown envelopes for gaps in ordinals.
3556            while _next_ordinal_to_read < 9 {
3557                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3558                _next_ordinal_to_read += 1;
3559                next_offset += envelope_size;
3560            }
3561
3562            let next_out_of_line = decoder.next_out_of_line();
3563            let handles_before = decoder.remaining_handles();
3564            if let Some((inlined, num_bytes, num_handles)) =
3565                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3566            {
3567                let member_inline_size = <fidl::encoding::UnboundedVector<
3568                    fidl::encoding::UnboundedString,
3569                > as fidl::encoding::TypeMarker>::inline_size(
3570                    decoder.context
3571                );
3572                if inlined != (member_inline_size <= 4) {
3573                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3574                }
3575                let inner_offset;
3576                let mut inner_depth = depth.clone();
3577                if inlined {
3578                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3579                    inner_offset = next_offset;
3580                } else {
3581                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3582                    inner_depth.increment()?;
3583                }
3584                let val_ref = self.driver_bind_eager.get_or_insert_with(|| {
3585                    fidl::new_empty!(
3586                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3587                        fidl::encoding::DefaultFuchsiaResourceDialect
3588                    )
3589                });
3590                fidl::decode!(
3591                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3592                    fidl::encoding::DefaultFuchsiaResourceDialect,
3593                    val_ref,
3594                    decoder,
3595                    inner_offset,
3596                    inner_depth
3597                )?;
3598                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3599                {
3600                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3601                }
3602                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3603                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3604                }
3605            }
3606
3607            next_offset += envelope_size;
3608            _next_ordinal_to_read += 1;
3609            if next_offset >= end_offset {
3610                return Ok(());
3611            }
3612
3613            // Decode unknown envelopes for gaps in ordinals.
3614            while _next_ordinal_to_read < 10 {
3615                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3616                _next_ordinal_to_read += 1;
3617                next_offset += envelope_size;
3618            }
3619
3620            let next_out_of_line = decoder.next_out_of_line();
3621            let handles_before = decoder.remaining_handles();
3622            if let Some((inlined, num_bytes, num_handles)) =
3623                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3624            {
3625                let member_inline_size =
3626                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
3627                        decoder.context,
3628                    );
3629                if inlined != (member_inline_size <= 4) {
3630                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3631                }
3632                let inner_offset;
3633                let mut inner_depth = depth.clone();
3634                if inlined {
3635                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3636                    inner_offset = next_offset;
3637                } else {
3638                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3639                    inner_depth.increment()?;
3640                }
3641                let val_ref = self.board_name.get_or_insert_with(|| {
3642                    fidl::new_empty!(
3643                        fidl::encoding::UnboundedString,
3644                        fidl::encoding::DefaultFuchsiaResourceDialect
3645                    )
3646                });
3647                fidl::decode!(
3648                    fidl::encoding::UnboundedString,
3649                    fidl::encoding::DefaultFuchsiaResourceDialect,
3650                    val_ref,
3651                    decoder,
3652                    inner_offset,
3653                    inner_depth
3654                )?;
3655                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3656                {
3657                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3658                }
3659                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3660                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3661                }
3662            }
3663
3664            next_offset += envelope_size;
3665            _next_ordinal_to_read += 1;
3666            if next_offset >= end_offset {
3667                return Ok(());
3668            }
3669
3670            // Decode unknown envelopes for gaps in ordinals.
3671            while _next_ordinal_to_read < 11 {
3672                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3673                _next_ordinal_to_read += 1;
3674                next_offset += envelope_size;
3675            }
3676
3677            let next_out_of_line = decoder.next_out_of_line();
3678            let handles_before = decoder.remaining_handles();
3679            if let Some((inlined, num_bytes, num_handles)) =
3680                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3681            {
3682                let member_inline_size = <fidl::encoding::UnboundedVector<Offer> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3683                if inlined != (member_inline_size <= 4) {
3684                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3685                }
3686                let inner_offset;
3687                let mut inner_depth = depth.clone();
3688                if inlined {
3689                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3690                    inner_offset = next_offset;
3691                } else {
3692                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3693                    inner_depth.increment()?;
3694                }
3695                let val_ref = self.offers.get_or_insert_with(|| {
3696                    fidl::new_empty!(
3697                        fidl::encoding::UnboundedVector<Offer>,
3698                        fidl::encoding::DefaultFuchsiaResourceDialect
3699                    )
3700                });
3701                fidl::decode!(
3702                    fidl::encoding::UnboundedVector<Offer>,
3703                    fidl::encoding::DefaultFuchsiaResourceDialect,
3704                    val_ref,
3705                    decoder,
3706                    inner_offset,
3707                    inner_depth
3708                )?;
3709                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3710                {
3711                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3712                }
3713                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3714                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3715                }
3716            }
3717
3718            next_offset += envelope_size;
3719            _next_ordinal_to_read += 1;
3720            if next_offset >= end_offset {
3721                return Ok(());
3722            }
3723
3724            // Decode unknown envelopes for gaps in ordinals.
3725            while _next_ordinal_to_read < 12 {
3726                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3727                _next_ordinal_to_read += 1;
3728                next_offset += envelope_size;
3729            }
3730
3731            let next_out_of_line = decoder.next_out_of_line();
3732            let handles_before = decoder.remaining_handles();
3733            if let Some((inlined, num_bytes, num_handles)) =
3734                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3735            {
3736                let member_inline_size = <fidl::encoding::UnboundedVector<Expose> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3737                if inlined != (member_inline_size <= 4) {
3738                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3739                }
3740                let inner_offset;
3741                let mut inner_depth = depth.clone();
3742                if inlined {
3743                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3744                    inner_offset = next_offset;
3745                } else {
3746                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3747                    inner_depth.increment()?;
3748                }
3749                let val_ref = self.exposes.get_or_insert_with(|| {
3750                    fidl::new_empty!(
3751                        fidl::encoding::UnboundedVector<Expose>,
3752                        fidl::encoding::DefaultFuchsiaResourceDialect
3753                    )
3754                });
3755                fidl::decode!(
3756                    fidl::encoding::UnboundedVector<Expose>,
3757                    fidl::encoding::DefaultFuchsiaResourceDialect,
3758                    val_ref,
3759                    decoder,
3760                    inner_offset,
3761                    inner_depth
3762                )?;
3763                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3764                {
3765                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3766                }
3767                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3768                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3769                }
3770            }
3771
3772            next_offset += envelope_size;
3773            _next_ordinal_to_read += 1;
3774            if next_offset >= end_offset {
3775                return Ok(());
3776            }
3777
3778            // Decode unknown envelopes for gaps in ordinals.
3779            while _next_ordinal_to_read < 13 {
3780                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3781                _next_ordinal_to_read += 1;
3782                next_offset += envelope_size;
3783            }
3784
3785            let next_out_of_line = decoder.next_out_of_line();
3786            let handles_before = decoder.remaining_handles();
3787            if let Some((inlined, num_bytes, num_handles)) =
3788                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3789            {
3790                let member_inline_size = <fidl::encoding::Endpoint<
3791                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3792                > as fidl::encoding::TypeMarker>::inline_size(
3793                    decoder.context
3794                );
3795                if inlined != (member_inline_size <= 4) {
3796                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3797                }
3798                let inner_offset;
3799                let mut inner_depth = depth.clone();
3800                if inlined {
3801                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3802                    inner_offset = next_offset;
3803                } else {
3804                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3805                    inner_depth.increment()?;
3806                }
3807                let val_ref = self.pkg.get_or_insert_with(|| {
3808                    fidl::new_empty!(
3809                        fidl::encoding::Endpoint<
3810                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3811                        >,
3812                        fidl::encoding::DefaultFuchsiaResourceDialect
3813                    )
3814                });
3815                fidl::decode!(
3816                    fidl::encoding::Endpoint<
3817                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3818                    >,
3819                    fidl::encoding::DefaultFuchsiaResourceDialect,
3820                    val_ref,
3821                    decoder,
3822                    inner_offset,
3823                    inner_depth
3824                )?;
3825                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3826                {
3827                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3828                }
3829                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3830                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3831                }
3832            }
3833
3834            next_offset += envelope_size;
3835            _next_ordinal_to_read += 1;
3836            if next_offset >= end_offset {
3837                return Ok(());
3838            }
3839
3840            // Decode unknown envelopes for gaps in ordinals.
3841            while _next_ordinal_to_read < 14 {
3842                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3843                _next_ordinal_to_read += 1;
3844                next_offset += envelope_size;
3845            }
3846
3847            let next_out_of_line = decoder.next_out_of_line();
3848            let handles_before = decoder.remaining_handles();
3849            if let Some((inlined, num_bytes, num_handles)) =
3850                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3851            {
3852                let member_inline_size = <fidl::encoding::UnboundedVector<
3853                    fidl_fuchsia_component_test::Capability,
3854                > as fidl::encoding::TypeMarker>::inline_size(
3855                    decoder.context
3856                );
3857                if inlined != (member_inline_size <= 4) {
3858                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3859                }
3860                let inner_offset;
3861                let mut inner_depth = depth.clone();
3862                if inlined {
3863                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3864                    inner_offset = next_offset;
3865                } else {
3866                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3867                    inner_depth.increment()?;
3868                }
3869                let val_ref = self.dtr_offers.get_or_insert_with(|| {
3870                    fidl::new_empty!(
3871                        fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>,
3872                        fidl::encoding::DefaultFuchsiaResourceDialect
3873                    )
3874                });
3875                fidl::decode!(
3876                    fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>,
3877                    fidl::encoding::DefaultFuchsiaResourceDialect,
3878                    val_ref,
3879                    decoder,
3880                    inner_offset,
3881                    inner_depth
3882                )?;
3883                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3884                {
3885                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3886                }
3887                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3888                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3889                }
3890            }
3891
3892            next_offset += envelope_size;
3893            _next_ordinal_to_read += 1;
3894            if next_offset >= end_offset {
3895                return Ok(());
3896            }
3897
3898            // Decode unknown envelopes for gaps in ordinals.
3899            while _next_ordinal_to_read < 15 {
3900                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3901                _next_ordinal_to_read += 1;
3902                next_offset += envelope_size;
3903            }
3904
3905            let next_out_of_line = decoder.next_out_of_line();
3906            let handles_before = decoder.remaining_handles();
3907            if let Some((inlined, num_bytes, num_handles)) =
3908                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3909            {
3910                let member_inline_size = <fidl::encoding::UnboundedVector<
3911                    fidl_fuchsia_component_test::Capability,
3912                > as fidl::encoding::TypeMarker>::inline_size(
3913                    decoder.context
3914                );
3915                if inlined != (member_inline_size <= 4) {
3916                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3917                }
3918                let inner_offset;
3919                let mut inner_depth = depth.clone();
3920                if inlined {
3921                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3922                    inner_offset = next_offset;
3923                } else {
3924                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3925                    inner_depth.increment()?;
3926                }
3927                let val_ref = self.dtr_exposes.get_or_insert_with(|| {
3928                    fidl::new_empty!(
3929                        fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>,
3930                        fidl::encoding::DefaultFuchsiaResourceDialect
3931                    )
3932                });
3933                fidl::decode!(
3934                    fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>,
3935                    fidl::encoding::DefaultFuchsiaResourceDialect,
3936                    val_ref,
3937                    decoder,
3938                    inner_offset,
3939                    inner_depth
3940                )?;
3941                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3942                {
3943                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3944                }
3945                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3946                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3947                }
3948            }
3949
3950            next_offset += envelope_size;
3951            _next_ordinal_to_read += 1;
3952            if next_offset >= end_offset {
3953                return Ok(());
3954            }
3955
3956            // Decode unknown envelopes for gaps in ordinals.
3957            while _next_ordinal_to_read < 16 {
3958                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3959                _next_ordinal_to_read += 1;
3960                next_offset += envelope_size;
3961            }
3962
3963            let next_out_of_line = decoder.next_out_of_line();
3964            let handles_before = decoder.remaining_handles();
3965            if let Some((inlined, num_bytes, num_handles)) =
3966                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3967            {
3968                let member_inline_size = <fidl_fuchsia_component_resolution::Component as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3969                if inlined != (member_inline_size <= 4) {
3970                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3971                }
3972                let inner_offset;
3973                let mut inner_depth = depth.clone();
3974                if inlined {
3975                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3976                    inner_offset = next_offset;
3977                } else {
3978                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3979                    inner_depth.increment()?;
3980                }
3981                let val_ref = self.test_component.get_or_insert_with(|| {
3982                    fidl::new_empty!(
3983                        fidl_fuchsia_component_resolution::Component,
3984                        fidl::encoding::DefaultFuchsiaResourceDialect
3985                    )
3986                });
3987                fidl::decode!(
3988                    fidl_fuchsia_component_resolution::Component,
3989                    fidl::encoding::DefaultFuchsiaResourceDialect,
3990                    val_ref,
3991                    decoder,
3992                    inner_offset,
3993                    inner_depth
3994                )?;
3995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3996                {
3997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3998                }
3999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4001                }
4002            }
4003
4004            next_offset += envelope_size;
4005            _next_ordinal_to_read += 1;
4006            if next_offset >= end_offset {
4007                return Ok(());
4008            }
4009
4010            // Decode unknown envelopes for gaps in ordinals.
4011            while _next_ordinal_to_read < 17 {
4012                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4013                _next_ordinal_to_read += 1;
4014                next_offset += envelope_size;
4015            }
4016
4017            let next_out_of_line = decoder.next_out_of_line();
4018            let handles_before = decoder.remaining_handles();
4019            if let Some((inlined, num_bytes, num_handles)) =
4020                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4021            {
4022                let member_inline_size =
4023                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4024                if inlined != (member_inline_size <= 4) {
4025                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4026                }
4027                let inner_offset;
4028                let mut inner_depth = depth.clone();
4029                if inlined {
4030                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4031                    inner_offset = next_offset;
4032                } else {
4033                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4034                    inner_depth.increment()?;
4035                }
4036                let val_ref = self.driver_index_stop_timeout_millis.get_or_insert_with(|| {
4037                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
4038                });
4039                fidl::decode!(
4040                    i64,
4041                    fidl::encoding::DefaultFuchsiaResourceDialect,
4042                    val_ref,
4043                    decoder,
4044                    inner_offset,
4045                    inner_depth
4046                )?;
4047                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4048                {
4049                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4050                }
4051                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4052                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4053                }
4054            }
4055
4056            next_offset += envelope_size;
4057            _next_ordinal_to_read += 1;
4058            if next_offset >= end_offset {
4059                return Ok(());
4060            }
4061
4062            // Decode unknown envelopes for gaps in ordinals.
4063            while _next_ordinal_to_read < 18 {
4064                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4065                _next_ordinal_to_read += 1;
4066                next_offset += envelope_size;
4067            }
4068
4069            let next_out_of_line = decoder.next_out_of_line();
4070            let handles_before = decoder.remaining_handles();
4071            if let Some((inlined, num_bytes, num_handles)) =
4072                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4073            {
4074                let member_inline_size = <fidl::encoding::Vector<SoftwareDevice, 20> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4075                if inlined != (member_inline_size <= 4) {
4076                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4077                }
4078                let inner_offset;
4079                let mut inner_depth = depth.clone();
4080                if inlined {
4081                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4082                    inner_offset = next_offset;
4083                } else {
4084                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4085                    inner_depth.increment()?;
4086                }
4087                let val_ref =
4088                self.software_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<SoftwareDevice, 20>, fidl::encoding::DefaultFuchsiaResourceDialect));
4089                fidl::decode!(fidl::encoding::Vector<SoftwareDevice, 20>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4090                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4091                {
4092                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4093                }
4094                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4095                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4096                }
4097            }
4098
4099            next_offset += envelope_size;
4100            _next_ordinal_to_read += 1;
4101            if next_offset >= end_offset {
4102                return Ok(());
4103            }
4104
4105            // Decode unknown envelopes for gaps in ordinals.
4106            while _next_ordinal_to_read < 19 {
4107                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4108                _next_ordinal_to_read += 1;
4109                next_offset += envelope_size;
4110            }
4111
4112            let next_out_of_line = decoder.next_out_of_line();
4113            let handles_before = decoder.remaining_handles();
4114            if let Some((inlined, num_bytes, num_handles)) =
4115                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4116            {
4117                let member_inline_size = <fidl::encoding::UnboundedVector<
4118                    fidl::encoding::UnboundedString,
4119                > as fidl::encoding::TypeMarker>::inline_size(
4120                    decoder.context
4121                );
4122                if inlined != (member_inline_size <= 4) {
4123                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4124                }
4125                let inner_offset;
4126                let mut inner_depth = depth.clone();
4127                if inlined {
4128                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4129                    inner_offset = next_offset;
4130                } else {
4131                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4132                    inner_depth.increment()?;
4133                }
4134                let val_ref = self.boot_driver_components.get_or_insert_with(|| {
4135                    fidl::new_empty!(
4136                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
4137                        fidl::encoding::DefaultFuchsiaResourceDialect
4138                    )
4139                });
4140                fidl::decode!(
4141                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
4142                    fidl::encoding::DefaultFuchsiaResourceDialect,
4143                    val_ref,
4144                    decoder,
4145                    inner_offset,
4146                    inner_depth
4147                )?;
4148                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4149                {
4150                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4151                }
4152                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4153                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4154                }
4155            }
4156
4157            next_offset += envelope_size;
4158            _next_ordinal_to_read += 1;
4159            if next_offset >= end_offset {
4160                return Ok(());
4161            }
4162
4163            // Decode unknown envelopes for gaps in ordinals.
4164            while _next_ordinal_to_read < 20 {
4165                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4166                _next_ordinal_to_read += 1;
4167                next_offset += envelope_size;
4168            }
4169
4170            let next_out_of_line = decoder.next_out_of_line();
4171            let handles_before = decoder.remaining_handles();
4172            if let Some((inlined, num_bytes, num_handles)) =
4173                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4174            {
4175                let member_inline_size = <fidl::encoding::HandleType<
4176                    fidl::Vmo,
4177                    { fidl::ObjectType::VMO.into_raw() },
4178                    2147483648,
4179                > as fidl::encoding::TypeMarker>::inline_size(
4180                    decoder.context
4181                );
4182                if inlined != (member_inline_size <= 4) {
4183                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4184                }
4185                let inner_offset;
4186                let mut inner_depth = depth.clone();
4187                if inlined {
4188                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4189                    inner_offset = next_offset;
4190                } else {
4191                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4192                    inner_depth.increment()?;
4193                }
4194                let val_ref =
4195                self.devicetree.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4196                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4197                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4198                {
4199                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4200                }
4201                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4202                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4203                }
4204            }
4205
4206            next_offset += envelope_size;
4207            _next_ordinal_to_read += 1;
4208            if next_offset >= end_offset {
4209                return Ok(());
4210            }
4211
4212            // Decode unknown envelopes for gaps in ordinals.
4213            while _next_ordinal_to_read < 21 {
4214                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4215                _next_ordinal_to_read += 1;
4216                next_offset += envelope_size;
4217            }
4218
4219            let next_out_of_line = decoder.next_out_of_line();
4220            let handles_before = decoder.remaining_handles();
4221            if let Some((inlined, num_bytes, num_handles)) =
4222                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4223            {
4224                let member_inline_size =
4225                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4226                if inlined != (member_inline_size <= 4) {
4227                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4228                }
4229                let inner_offset;
4230                let mut inner_depth = depth.clone();
4231                if inlined {
4232                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4233                    inner_offset = next_offset;
4234                } else {
4235                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4236                    inner_depth.increment()?;
4237                }
4238                let val_ref = self.platform_vid.get_or_insert_with(|| {
4239                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
4240                });
4241                fidl::decode!(
4242                    u32,
4243                    fidl::encoding::DefaultFuchsiaResourceDialect,
4244                    val_ref,
4245                    decoder,
4246                    inner_offset,
4247                    inner_depth
4248                )?;
4249                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4250                {
4251                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4252                }
4253                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4254                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4255                }
4256            }
4257
4258            next_offset += envelope_size;
4259            _next_ordinal_to_read += 1;
4260            if next_offset >= end_offset {
4261                return Ok(());
4262            }
4263
4264            // Decode unknown envelopes for gaps in ordinals.
4265            while _next_ordinal_to_read < 22 {
4266                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4267                _next_ordinal_to_read += 1;
4268                next_offset += envelope_size;
4269            }
4270
4271            let next_out_of_line = decoder.next_out_of_line();
4272            let handles_before = decoder.remaining_handles();
4273            if let Some((inlined, num_bytes, num_handles)) =
4274                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4275            {
4276                let member_inline_size =
4277                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4278                if inlined != (member_inline_size <= 4) {
4279                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4280                }
4281                let inner_offset;
4282                let mut inner_depth = depth.clone();
4283                if inlined {
4284                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4285                    inner_offset = next_offset;
4286                } else {
4287                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4288                    inner_depth.increment()?;
4289                }
4290                let val_ref = self.platform_pid.get_or_insert_with(|| {
4291                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
4292                });
4293                fidl::decode!(
4294                    u32,
4295                    fidl::encoding::DefaultFuchsiaResourceDialect,
4296                    val_ref,
4297                    decoder,
4298                    inner_offset,
4299                    inner_depth
4300                )?;
4301                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4302                {
4303                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4304                }
4305                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4306                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4307                }
4308            }
4309
4310            next_offset += envelope_size;
4311
4312            // Decode the remaining unknown envelopes.
4313            while next_offset < end_offset {
4314                _next_ordinal_to_read += 1;
4315                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4316                next_offset += envelope_size;
4317            }
4318
4319            Ok(())
4320        }
4321    }
4322}