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<T0: fidl::encoding::Encode<RealmArgs, fidl::encoding::DefaultFuchsiaResourceDialect>>
2421        fidl::encoding::Encode<RealmStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2422        for (T0,)
2423    {
2424        #[inline]
2425        unsafe fn encode(
2426            self,
2427            encoder: &mut fidl::encoding::Encoder<
2428                '_,
2429                fidl::encoding::DefaultFuchsiaResourceDialect,
2430            >,
2431            offset: usize,
2432            depth: fidl::encoding::Depth,
2433        ) -> fidl::Result<()> {
2434            encoder.debug_check_bounds::<RealmStartRequest>(offset);
2435            // Zero out padding regions. There's no need to apply masks
2436            // because the unmasked parts will be overwritten by fields.
2437            // Write the fields.
2438            self.0.encode(encoder, offset + 0, depth)?;
2439            Ok(())
2440        }
2441    }
2442
2443    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2444        for RealmStartRequest
2445    {
2446        #[inline(always)]
2447        fn new_empty() -> Self {
2448            Self {
2449                args: fidl::new_empty!(RealmArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
2450            }
2451        }
2452
2453        #[inline]
2454        unsafe fn decode(
2455            &mut self,
2456            decoder: &mut fidl::encoding::Decoder<
2457                '_,
2458                fidl::encoding::DefaultFuchsiaResourceDialect,
2459            >,
2460            offset: usize,
2461            _depth: fidl::encoding::Depth,
2462        ) -> fidl::Result<()> {
2463            decoder.debug_check_bounds::<Self>(offset);
2464            // Verify that padding bytes are zero.
2465            fidl::decode!(
2466                RealmArgs,
2467                fidl::encoding::DefaultFuchsiaResourceDialect,
2468                &mut self.args,
2469                decoder,
2470                offset + 0,
2471                _depth
2472            )?;
2473            Ok(())
2474        }
2475    }
2476
2477    impl RealmArgs {
2478        #[inline(always)]
2479        fn max_ordinal_present(&self) -> u64 {
2480            if let Some(_) = self.platform_pid {
2481                return 22;
2482            }
2483            if let Some(_) = self.platform_vid {
2484                return 21;
2485            }
2486            if let Some(_) = self.devicetree {
2487                return 20;
2488            }
2489            if let Some(_) = self.boot_driver_components {
2490                return 19;
2491            }
2492            if let Some(_) = self.software_devices {
2493                return 18;
2494            }
2495            if let Some(_) = self.driver_index_stop_timeout_millis {
2496                return 17;
2497            }
2498            if let Some(_) = self.test_component {
2499                return 16;
2500            }
2501            if let Some(_) = self.dtr_exposes {
2502                return 15;
2503            }
2504            if let Some(_) = self.dtr_offers {
2505                return 14;
2506            }
2507            if let Some(_) = self.pkg {
2508                return 13;
2509            }
2510            if let Some(_) = self.exposes {
2511                return 12;
2512            }
2513            if let Some(_) = self.offers {
2514                return 11;
2515            }
2516            if let Some(_) = self.board_name {
2517                return 10;
2518            }
2519            if let Some(_) = self.driver_bind_eager {
2520                return 9;
2521            }
2522            if let Some(_) = self.driver_disable {
2523                return 8;
2524            }
2525            if let Some(_) = self.driver_log_level {
2526                return 7;
2527            }
2528            if let Some(_) = self.driver_tests_disable {
2529                return 6;
2530            }
2531            if let Some(_) = self.driver_tests_enable {
2532                return 5;
2533            }
2534            if let Some(_) = self.driver_tests_enable_all {
2535                return 4;
2536            }
2537            if let Some(_) = self.root_driver {
2538                return 2;
2539            }
2540            if let Some(_) = self.boot {
2541                return 1;
2542            }
2543            0
2544        }
2545    }
2546
2547    impl fidl::encoding::ResourceTypeMarker for RealmArgs {
2548        type Borrowed<'a> = &'a mut Self;
2549        fn take_or_borrow<'a>(
2550            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2551        ) -> Self::Borrowed<'a> {
2552            value
2553        }
2554    }
2555
2556    unsafe impl fidl::encoding::TypeMarker for RealmArgs {
2557        type Owned = Self;
2558
2559        #[inline(always)]
2560        fn inline_align(_context: fidl::encoding::Context) -> usize {
2561            8
2562        }
2563
2564        #[inline(always)]
2565        fn inline_size(_context: fidl::encoding::Context) -> usize {
2566            16
2567        }
2568    }
2569
2570    unsafe impl fidl::encoding::Encode<RealmArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
2571        for &mut RealmArgs
2572    {
2573        unsafe fn encode(
2574            self,
2575            encoder: &mut fidl::encoding::Encoder<
2576                '_,
2577                fidl::encoding::DefaultFuchsiaResourceDialect,
2578            >,
2579            offset: usize,
2580            mut depth: fidl::encoding::Depth,
2581        ) -> fidl::Result<()> {
2582            encoder.debug_check_bounds::<RealmArgs>(offset);
2583            // Vector header
2584            let max_ordinal: u64 = self.max_ordinal_present();
2585            encoder.write_num(max_ordinal, offset);
2586            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2587            // Calling encoder.out_of_line_offset(0) is not allowed.
2588            if max_ordinal == 0 {
2589                return Ok(());
2590            }
2591            depth.increment()?;
2592            let envelope_size = 8;
2593            let bytes_len = max_ordinal as usize * envelope_size;
2594            #[allow(unused_variables)]
2595            let offset = encoder.out_of_line_offset(bytes_len);
2596            let mut _prev_end_offset: usize = 0;
2597            if 1 > max_ordinal {
2598                return Ok(());
2599            }
2600
2601            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2602            // are envelope_size bytes.
2603            let cur_offset: usize = (1 - 1) * envelope_size;
2604
2605            // Zero reserved fields.
2606            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2607
2608            // Safety:
2609            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2610            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2611            //   envelope_size bytes, there is always sufficient room.
2612            fidl::encoding::encode_in_envelope_optional::<
2613                fidl::encoding::Endpoint<
2614                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2615                >,
2616                fidl::encoding::DefaultFuchsiaResourceDialect,
2617            >(
2618                self.boot.as_mut().map(
2619                    <fidl::encoding::Endpoint<
2620                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2621                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2622                ),
2623                encoder,
2624                offset + cur_offset,
2625                depth,
2626            )?;
2627
2628            _prev_end_offset = cur_offset + envelope_size;
2629            if 2 > max_ordinal {
2630                return Ok(());
2631            }
2632
2633            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2634            // are envelope_size bytes.
2635            let cur_offset: usize = (2 - 1) * envelope_size;
2636
2637            // Zero reserved fields.
2638            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2639
2640            // Safety:
2641            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2642            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2643            //   envelope_size bytes, there is always sufficient room.
2644            fidl::encoding::encode_in_envelope_optional::<
2645                fidl::encoding::UnboundedString,
2646                fidl::encoding::DefaultFuchsiaResourceDialect,
2647            >(
2648                self.root_driver.as_ref().map(
2649                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
2650                ),
2651                encoder,
2652                offset + cur_offset,
2653                depth,
2654            )?;
2655
2656            _prev_end_offset = cur_offset + envelope_size;
2657            if 4 > max_ordinal {
2658                return Ok(());
2659            }
2660
2661            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2662            // are envelope_size bytes.
2663            let cur_offset: usize = (4 - 1) * envelope_size;
2664
2665            // Zero reserved fields.
2666            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2667
2668            // Safety:
2669            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2670            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2671            //   envelope_size bytes, there is always sufficient room.
2672            fidl::encoding::encode_in_envelope_optional::<
2673                bool,
2674                fidl::encoding::DefaultFuchsiaResourceDialect,
2675            >(
2676                self.driver_tests_enable_all
2677                    .as_ref()
2678                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2679                encoder,
2680                offset + cur_offset,
2681                depth,
2682            )?;
2683
2684            _prev_end_offset = cur_offset + envelope_size;
2685            if 5 > max_ordinal {
2686                return Ok(());
2687            }
2688
2689            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2690            // are envelope_size bytes.
2691            let cur_offset: usize = (5 - 1) * envelope_size;
2692
2693            // Zero reserved fields.
2694            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2695
2696            // Safety:
2697            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2698            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2699            //   envelope_size bytes, there is always sufficient room.
2700            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2701            self.driver_tests_enable.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2702            encoder, offset + cur_offset, depth
2703        )?;
2704
2705            _prev_end_offset = cur_offset + envelope_size;
2706            if 6 > max_ordinal {
2707                return Ok(());
2708            }
2709
2710            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2711            // are envelope_size bytes.
2712            let cur_offset: usize = (6 - 1) * envelope_size;
2713
2714            // Zero reserved fields.
2715            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2716
2717            // Safety:
2718            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2719            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2720            //   envelope_size bytes, there is always sufficient room.
2721            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2722            self.driver_tests_disable.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2723            encoder, offset + cur_offset, depth
2724        )?;
2725
2726            _prev_end_offset = cur_offset + envelope_size;
2727            if 7 > max_ordinal {
2728                return Ok(());
2729            }
2730
2731            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2732            // are envelope_size bytes.
2733            let cur_offset: usize = (7 - 1) * envelope_size;
2734
2735            // Zero reserved fields.
2736            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2737
2738            // Safety:
2739            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2740            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2741            //   envelope_size bytes, there is always sufficient room.
2742            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<DriverLog>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2743            self.driver_log_level.as_ref().map(<fidl::encoding::UnboundedVector<DriverLog> as fidl::encoding::ValueTypeMarker>::borrow),
2744            encoder, offset + cur_offset, depth
2745        )?;
2746
2747            _prev_end_offset = cur_offset + envelope_size;
2748            if 8 > max_ordinal {
2749                return Ok(());
2750            }
2751
2752            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2753            // are envelope_size bytes.
2754            let cur_offset: usize = (8 - 1) * envelope_size;
2755
2756            // Zero reserved fields.
2757            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2758
2759            // Safety:
2760            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2761            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2762            //   envelope_size bytes, there is always sufficient room.
2763            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2764            self.driver_disable.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2765            encoder, offset + cur_offset, depth
2766        )?;
2767
2768            _prev_end_offset = cur_offset + envelope_size;
2769            if 9 > max_ordinal {
2770                return Ok(());
2771            }
2772
2773            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2774            // are envelope_size bytes.
2775            let cur_offset: usize = (9 - 1) * envelope_size;
2776
2777            // Zero reserved fields.
2778            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2779
2780            // Safety:
2781            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2782            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2783            //   envelope_size bytes, there is always sufficient room.
2784            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2785            self.driver_bind_eager.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
2786            encoder, offset + cur_offset, depth
2787        )?;
2788
2789            _prev_end_offset = cur_offset + envelope_size;
2790            if 10 > max_ordinal {
2791                return Ok(());
2792            }
2793
2794            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2795            // are envelope_size bytes.
2796            let cur_offset: usize = (10 - 1) * envelope_size;
2797
2798            // Zero reserved fields.
2799            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2800
2801            // Safety:
2802            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2803            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2804            //   envelope_size bytes, there is always sufficient room.
2805            fidl::encoding::encode_in_envelope_optional::<
2806                fidl::encoding::UnboundedString,
2807                fidl::encoding::DefaultFuchsiaResourceDialect,
2808            >(
2809                self.board_name.as_ref().map(
2810                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
2811                ),
2812                encoder,
2813                offset + cur_offset,
2814                depth,
2815            )?;
2816
2817            _prev_end_offset = cur_offset + envelope_size;
2818            if 11 > max_ordinal {
2819                return Ok(());
2820            }
2821
2822            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2823            // are envelope_size bytes.
2824            let cur_offset: usize = (11 - 1) * envelope_size;
2825
2826            // Zero reserved fields.
2827            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2828
2829            // Safety:
2830            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2831            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2832            //   envelope_size bytes, there is always sufficient room.
2833            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Offer>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2834            self.offers.as_ref().map(<fidl::encoding::UnboundedVector<Offer> as fidl::encoding::ValueTypeMarker>::borrow),
2835            encoder, offset + cur_offset, depth
2836        )?;
2837
2838            _prev_end_offset = cur_offset + envelope_size;
2839            if 12 > max_ordinal {
2840                return Ok(());
2841            }
2842
2843            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2844            // are envelope_size bytes.
2845            let cur_offset: usize = (12 - 1) * envelope_size;
2846
2847            // Zero reserved fields.
2848            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2849
2850            // Safety:
2851            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2852            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2853            //   envelope_size bytes, there is always sufficient room.
2854            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Expose>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2855            self.exposes.as_ref().map(<fidl::encoding::UnboundedVector<Expose> as fidl::encoding::ValueTypeMarker>::borrow),
2856            encoder, offset + cur_offset, depth
2857        )?;
2858
2859            _prev_end_offset = cur_offset + envelope_size;
2860            if 13 > max_ordinal {
2861                return Ok(());
2862            }
2863
2864            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2865            // are envelope_size bytes.
2866            let cur_offset: usize = (13 - 1) * envelope_size;
2867
2868            // Zero reserved fields.
2869            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2870
2871            // Safety:
2872            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2873            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2874            //   envelope_size bytes, there is always sufficient room.
2875            fidl::encoding::encode_in_envelope_optional::<
2876                fidl::encoding::Endpoint<
2877                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2878                >,
2879                fidl::encoding::DefaultFuchsiaResourceDialect,
2880            >(
2881                self.pkg.as_mut().map(
2882                    <fidl::encoding::Endpoint<
2883                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2884                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2885                ),
2886                encoder,
2887                offset + cur_offset,
2888                depth,
2889            )?;
2890
2891            _prev_end_offset = cur_offset + envelope_size;
2892            if 14 > max_ordinal {
2893                return Ok(());
2894            }
2895
2896            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2897            // are envelope_size bytes.
2898            let cur_offset: usize = (14 - 1) * envelope_size;
2899
2900            // Zero reserved fields.
2901            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2902
2903            // Safety:
2904            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2905            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2906            //   envelope_size bytes, there is always sufficient room.
2907            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2908            self.dtr_offers.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability> as fidl::encoding::ValueTypeMarker>::borrow),
2909            encoder, offset + cur_offset, depth
2910        )?;
2911
2912            _prev_end_offset = cur_offset + envelope_size;
2913            if 15 > max_ordinal {
2914                return Ok(());
2915            }
2916
2917            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2918            // are envelope_size bytes.
2919            let cur_offset: usize = (15 - 1) * envelope_size;
2920
2921            // Zero reserved fields.
2922            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2923
2924            // Safety:
2925            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2926            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2927            //   envelope_size bytes, there is always sufficient room.
2928            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2929            self.dtr_exposes.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability> as fidl::encoding::ValueTypeMarker>::borrow),
2930            encoder, offset + cur_offset, depth
2931        )?;
2932
2933            _prev_end_offset = cur_offset + envelope_size;
2934            if 16 > max_ordinal {
2935                return Ok(());
2936            }
2937
2938            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2939            // are envelope_size bytes.
2940            let cur_offset: usize = (16 - 1) * envelope_size;
2941
2942            // Zero reserved fields.
2943            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2944
2945            // Safety:
2946            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2947            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2948            //   envelope_size bytes, there is always sufficient room.
2949            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_resolution::Component, fidl::encoding::DefaultFuchsiaResourceDialect>(
2950            self.test_component.as_mut().map(<fidl_fuchsia_component_resolution::Component as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2951            encoder, offset + cur_offset, depth
2952        )?;
2953
2954            _prev_end_offset = cur_offset + envelope_size;
2955            if 17 > max_ordinal {
2956                return Ok(());
2957            }
2958
2959            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2960            // are envelope_size bytes.
2961            let cur_offset: usize = (17 - 1) * envelope_size;
2962
2963            // Zero reserved fields.
2964            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2965
2966            // Safety:
2967            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2968            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2969            //   envelope_size bytes, there is always sufficient room.
2970            fidl::encoding::encode_in_envelope_optional::<
2971                i64,
2972                fidl::encoding::DefaultFuchsiaResourceDialect,
2973            >(
2974                self.driver_index_stop_timeout_millis
2975                    .as_ref()
2976                    .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2977                encoder,
2978                offset + cur_offset,
2979                depth,
2980            )?;
2981
2982            _prev_end_offset = cur_offset + envelope_size;
2983            if 18 > max_ordinal {
2984                return Ok(());
2985            }
2986
2987            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2988            // are envelope_size bytes.
2989            let cur_offset: usize = (18 - 1) * envelope_size;
2990
2991            // Zero reserved fields.
2992            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2993
2994            // Safety:
2995            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2996            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2997            //   envelope_size bytes, there is always sufficient room.
2998            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SoftwareDevice, 20>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2999            self.software_devices.as_ref().map(<fidl::encoding::Vector<SoftwareDevice, 20> as fidl::encoding::ValueTypeMarker>::borrow),
3000            encoder, offset + cur_offset, depth
3001        )?;
3002
3003            _prev_end_offset = cur_offset + envelope_size;
3004            if 19 > max_ordinal {
3005                return Ok(());
3006            }
3007
3008            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3009            // are envelope_size bytes.
3010            let cur_offset: usize = (19 - 1) * envelope_size;
3011
3012            // Zero reserved fields.
3013            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3014
3015            // Safety:
3016            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3017            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3018            //   envelope_size bytes, there is always sufficient room.
3019            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3020            self.boot_driver_components.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
3021            encoder, offset + cur_offset, depth
3022        )?;
3023
3024            _prev_end_offset = cur_offset + envelope_size;
3025            if 20 > max_ordinal {
3026                return Ok(());
3027            }
3028
3029            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3030            // are envelope_size bytes.
3031            let cur_offset: usize = (20 - 1) * envelope_size;
3032
3033            // Zero reserved fields.
3034            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3035
3036            // Safety:
3037            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3038            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3039            //   envelope_size bytes, there is always sufficient room.
3040            fidl::encoding::encode_in_envelope_optional::<
3041                fidl::encoding::HandleType<
3042                    fidl::Vmo,
3043                    { fidl::ObjectType::VMO.into_raw() },
3044                    2147483648,
3045                >,
3046                fidl::encoding::DefaultFuchsiaResourceDialect,
3047            >(
3048                self.devicetree.as_mut().map(
3049                    <fidl::encoding::HandleType<
3050                        fidl::Vmo,
3051                        { fidl::ObjectType::VMO.into_raw() },
3052                        2147483648,
3053                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3054                ),
3055                encoder,
3056                offset + cur_offset,
3057                depth,
3058            )?;
3059
3060            _prev_end_offset = cur_offset + envelope_size;
3061            if 21 > max_ordinal {
3062                return Ok(());
3063            }
3064
3065            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3066            // are envelope_size bytes.
3067            let cur_offset: usize = (21 - 1) * envelope_size;
3068
3069            // Zero reserved fields.
3070            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3071
3072            // Safety:
3073            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3074            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3075            //   envelope_size bytes, there is always sufficient room.
3076            fidl::encoding::encode_in_envelope_optional::<
3077                u32,
3078                fidl::encoding::DefaultFuchsiaResourceDialect,
3079            >(
3080                self.platform_vid.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3081                encoder,
3082                offset + cur_offset,
3083                depth,
3084            )?;
3085
3086            _prev_end_offset = cur_offset + envelope_size;
3087            if 22 > max_ordinal {
3088                return Ok(());
3089            }
3090
3091            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3092            // are envelope_size bytes.
3093            let cur_offset: usize = (22 - 1) * envelope_size;
3094
3095            // Zero reserved fields.
3096            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3097
3098            // Safety:
3099            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3100            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3101            //   envelope_size bytes, there is always sufficient room.
3102            fidl::encoding::encode_in_envelope_optional::<
3103                u32,
3104                fidl::encoding::DefaultFuchsiaResourceDialect,
3105            >(
3106                self.platform_pid.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3107                encoder,
3108                offset + cur_offset,
3109                depth,
3110            )?;
3111
3112            _prev_end_offset = cur_offset + envelope_size;
3113
3114            Ok(())
3115        }
3116    }
3117
3118    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmArgs {
3119        #[inline(always)]
3120        fn new_empty() -> Self {
3121            Self::default()
3122        }
3123
3124        unsafe fn decode(
3125            &mut self,
3126            decoder: &mut fidl::encoding::Decoder<
3127                '_,
3128                fidl::encoding::DefaultFuchsiaResourceDialect,
3129            >,
3130            offset: usize,
3131            mut depth: fidl::encoding::Depth,
3132        ) -> fidl::Result<()> {
3133            decoder.debug_check_bounds::<Self>(offset);
3134            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3135                None => return Err(fidl::Error::NotNullable),
3136                Some(len) => len,
3137            };
3138            // Calling decoder.out_of_line_offset(0) is not allowed.
3139            if len == 0 {
3140                return Ok(());
3141            };
3142            depth.increment()?;
3143            let envelope_size = 8;
3144            let bytes_len = len * envelope_size;
3145            let offset = decoder.out_of_line_offset(bytes_len)?;
3146            // Decode the envelope for each type.
3147            let mut _next_ordinal_to_read = 0;
3148            let mut next_offset = offset;
3149            let end_offset = offset + bytes_len;
3150            _next_ordinal_to_read += 1;
3151            if next_offset >= end_offset {
3152                return Ok(());
3153            }
3154
3155            // Decode unknown envelopes for gaps in ordinals.
3156            while _next_ordinal_to_read < 1 {
3157                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3158                _next_ordinal_to_read += 1;
3159                next_offset += envelope_size;
3160            }
3161
3162            let next_out_of_line = decoder.next_out_of_line();
3163            let handles_before = decoder.remaining_handles();
3164            if let Some((inlined, num_bytes, num_handles)) =
3165                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3166            {
3167                let member_inline_size = <fidl::encoding::Endpoint<
3168                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3169                > as fidl::encoding::TypeMarker>::inline_size(
3170                    decoder.context
3171                );
3172                if inlined != (member_inline_size <= 4) {
3173                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3174                }
3175                let inner_offset;
3176                let mut inner_depth = depth.clone();
3177                if inlined {
3178                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3179                    inner_offset = next_offset;
3180                } else {
3181                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3182                    inner_depth.increment()?;
3183                }
3184                let val_ref = self.boot.get_or_insert_with(|| {
3185                    fidl::new_empty!(
3186                        fidl::encoding::Endpoint<
3187                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3188                        >,
3189                        fidl::encoding::DefaultFuchsiaResourceDialect
3190                    )
3191                });
3192                fidl::decode!(
3193                    fidl::encoding::Endpoint<
3194                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3195                    >,
3196                    fidl::encoding::DefaultFuchsiaResourceDialect,
3197                    val_ref,
3198                    decoder,
3199                    inner_offset,
3200                    inner_depth
3201                )?;
3202                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3203                {
3204                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3205                }
3206                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3207                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3208                }
3209            }
3210
3211            next_offset += envelope_size;
3212            _next_ordinal_to_read += 1;
3213            if next_offset >= end_offset {
3214                return Ok(());
3215            }
3216
3217            // Decode unknown envelopes for gaps in ordinals.
3218            while _next_ordinal_to_read < 2 {
3219                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3220                _next_ordinal_to_read += 1;
3221                next_offset += envelope_size;
3222            }
3223
3224            let next_out_of_line = decoder.next_out_of_line();
3225            let handles_before = decoder.remaining_handles();
3226            if let Some((inlined, num_bytes, num_handles)) =
3227                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3228            {
3229                let member_inline_size =
3230                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
3231                        decoder.context,
3232                    );
3233                if inlined != (member_inline_size <= 4) {
3234                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3235                }
3236                let inner_offset;
3237                let mut inner_depth = depth.clone();
3238                if inlined {
3239                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3240                    inner_offset = next_offset;
3241                } else {
3242                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3243                    inner_depth.increment()?;
3244                }
3245                let val_ref = self.root_driver.get_or_insert_with(|| {
3246                    fidl::new_empty!(
3247                        fidl::encoding::UnboundedString,
3248                        fidl::encoding::DefaultFuchsiaResourceDialect
3249                    )
3250                });
3251                fidl::decode!(
3252                    fidl::encoding::UnboundedString,
3253                    fidl::encoding::DefaultFuchsiaResourceDialect,
3254                    val_ref,
3255                    decoder,
3256                    inner_offset,
3257                    inner_depth
3258                )?;
3259                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3260                {
3261                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3262                }
3263                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3264                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3265                }
3266            }
3267
3268            next_offset += envelope_size;
3269            _next_ordinal_to_read += 1;
3270            if next_offset >= end_offset {
3271                return Ok(());
3272            }
3273
3274            // Decode unknown envelopes for gaps in ordinals.
3275            while _next_ordinal_to_read < 4 {
3276                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3277                _next_ordinal_to_read += 1;
3278                next_offset += envelope_size;
3279            }
3280
3281            let next_out_of_line = decoder.next_out_of_line();
3282            let handles_before = decoder.remaining_handles();
3283            if let Some((inlined, num_bytes, num_handles)) =
3284                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3285            {
3286                let member_inline_size =
3287                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3288                if inlined != (member_inline_size <= 4) {
3289                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3290                }
3291                let inner_offset;
3292                let mut inner_depth = depth.clone();
3293                if inlined {
3294                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3295                    inner_offset = next_offset;
3296                } else {
3297                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3298                    inner_depth.increment()?;
3299                }
3300                let val_ref = self.driver_tests_enable_all.get_or_insert_with(|| {
3301                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3302                });
3303                fidl::decode!(
3304                    bool,
3305                    fidl::encoding::DefaultFuchsiaResourceDialect,
3306                    val_ref,
3307                    decoder,
3308                    inner_offset,
3309                    inner_depth
3310                )?;
3311                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3312                {
3313                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3314                }
3315                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3316                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3317                }
3318            }
3319
3320            next_offset += envelope_size;
3321            _next_ordinal_to_read += 1;
3322            if next_offset >= end_offset {
3323                return Ok(());
3324            }
3325
3326            // Decode unknown envelopes for gaps in ordinals.
3327            while _next_ordinal_to_read < 5 {
3328                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3329                _next_ordinal_to_read += 1;
3330                next_offset += envelope_size;
3331            }
3332
3333            let next_out_of_line = decoder.next_out_of_line();
3334            let handles_before = decoder.remaining_handles();
3335            if let Some((inlined, num_bytes, num_handles)) =
3336                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3337            {
3338                let member_inline_size = <fidl::encoding::UnboundedVector<
3339                    fidl::encoding::UnboundedString,
3340                > as fidl::encoding::TypeMarker>::inline_size(
3341                    decoder.context
3342                );
3343                if inlined != (member_inline_size <= 4) {
3344                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3345                }
3346                let inner_offset;
3347                let mut inner_depth = depth.clone();
3348                if inlined {
3349                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3350                    inner_offset = next_offset;
3351                } else {
3352                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3353                    inner_depth.increment()?;
3354                }
3355                let val_ref = self.driver_tests_enable.get_or_insert_with(|| {
3356                    fidl::new_empty!(
3357                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3358                        fidl::encoding::DefaultFuchsiaResourceDialect
3359                    )
3360                });
3361                fidl::decode!(
3362                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3363                    fidl::encoding::DefaultFuchsiaResourceDialect,
3364                    val_ref,
3365                    decoder,
3366                    inner_offset,
3367                    inner_depth
3368                )?;
3369                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3370                {
3371                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3372                }
3373                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3374                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3375                }
3376            }
3377
3378            next_offset += envelope_size;
3379            _next_ordinal_to_read += 1;
3380            if next_offset >= end_offset {
3381                return Ok(());
3382            }
3383
3384            // Decode unknown envelopes for gaps in ordinals.
3385            while _next_ordinal_to_read < 6 {
3386                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3387                _next_ordinal_to_read += 1;
3388                next_offset += envelope_size;
3389            }
3390
3391            let next_out_of_line = decoder.next_out_of_line();
3392            let handles_before = decoder.remaining_handles();
3393            if let Some((inlined, num_bytes, num_handles)) =
3394                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3395            {
3396                let member_inline_size = <fidl::encoding::UnboundedVector<
3397                    fidl::encoding::UnboundedString,
3398                > as fidl::encoding::TypeMarker>::inline_size(
3399                    decoder.context
3400                );
3401                if inlined != (member_inline_size <= 4) {
3402                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3403                }
3404                let inner_offset;
3405                let mut inner_depth = depth.clone();
3406                if inlined {
3407                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3408                    inner_offset = next_offset;
3409                } else {
3410                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3411                    inner_depth.increment()?;
3412                }
3413                let val_ref = self.driver_tests_disable.get_or_insert_with(|| {
3414                    fidl::new_empty!(
3415                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3416                        fidl::encoding::DefaultFuchsiaResourceDialect
3417                    )
3418                });
3419                fidl::decode!(
3420                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3421                    fidl::encoding::DefaultFuchsiaResourceDialect,
3422                    val_ref,
3423                    decoder,
3424                    inner_offset,
3425                    inner_depth
3426                )?;
3427                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3428                {
3429                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3430                }
3431                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3432                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3433                }
3434            }
3435
3436            next_offset += envelope_size;
3437            _next_ordinal_to_read += 1;
3438            if next_offset >= end_offset {
3439                return Ok(());
3440            }
3441
3442            // Decode unknown envelopes for gaps in ordinals.
3443            while _next_ordinal_to_read < 7 {
3444                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3445                _next_ordinal_to_read += 1;
3446                next_offset += envelope_size;
3447            }
3448
3449            let next_out_of_line = decoder.next_out_of_line();
3450            let handles_before = decoder.remaining_handles();
3451            if let Some((inlined, num_bytes, num_handles)) =
3452                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3453            {
3454                let member_inline_size = <fidl::encoding::UnboundedVector<DriverLog> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3455                if inlined != (member_inline_size <= 4) {
3456                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3457                }
3458                let inner_offset;
3459                let mut inner_depth = depth.clone();
3460                if inlined {
3461                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3462                    inner_offset = next_offset;
3463                } else {
3464                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3465                    inner_depth.increment()?;
3466                }
3467                let val_ref = self.driver_log_level.get_or_insert_with(|| {
3468                    fidl::new_empty!(
3469                        fidl::encoding::UnboundedVector<DriverLog>,
3470                        fidl::encoding::DefaultFuchsiaResourceDialect
3471                    )
3472                });
3473                fidl::decode!(
3474                    fidl::encoding::UnboundedVector<DriverLog>,
3475                    fidl::encoding::DefaultFuchsiaResourceDialect,
3476                    val_ref,
3477                    decoder,
3478                    inner_offset,
3479                    inner_depth
3480                )?;
3481                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3482                {
3483                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3484                }
3485                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3486                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3487                }
3488            }
3489
3490            next_offset += envelope_size;
3491            _next_ordinal_to_read += 1;
3492            if next_offset >= end_offset {
3493                return Ok(());
3494            }
3495
3496            // Decode unknown envelopes for gaps in ordinals.
3497            while _next_ordinal_to_read < 8 {
3498                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3499                _next_ordinal_to_read += 1;
3500                next_offset += envelope_size;
3501            }
3502
3503            let next_out_of_line = decoder.next_out_of_line();
3504            let handles_before = decoder.remaining_handles();
3505            if let Some((inlined, num_bytes, num_handles)) =
3506                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3507            {
3508                let member_inline_size = <fidl::encoding::UnboundedVector<
3509                    fidl::encoding::UnboundedString,
3510                > as fidl::encoding::TypeMarker>::inline_size(
3511                    decoder.context
3512                );
3513                if inlined != (member_inline_size <= 4) {
3514                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3515                }
3516                let inner_offset;
3517                let mut inner_depth = depth.clone();
3518                if inlined {
3519                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3520                    inner_offset = next_offset;
3521                } else {
3522                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3523                    inner_depth.increment()?;
3524                }
3525                let val_ref = self.driver_disable.get_or_insert_with(|| {
3526                    fidl::new_empty!(
3527                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3528                        fidl::encoding::DefaultFuchsiaResourceDialect
3529                    )
3530                });
3531                fidl::decode!(
3532                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3533                    fidl::encoding::DefaultFuchsiaResourceDialect,
3534                    val_ref,
3535                    decoder,
3536                    inner_offset,
3537                    inner_depth
3538                )?;
3539                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3540                {
3541                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3542                }
3543                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3544                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3545                }
3546            }
3547
3548            next_offset += envelope_size;
3549            _next_ordinal_to_read += 1;
3550            if next_offset >= end_offset {
3551                return Ok(());
3552            }
3553
3554            // Decode unknown envelopes for gaps in ordinals.
3555            while _next_ordinal_to_read < 9 {
3556                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3557                _next_ordinal_to_read += 1;
3558                next_offset += envelope_size;
3559            }
3560
3561            let next_out_of_line = decoder.next_out_of_line();
3562            let handles_before = decoder.remaining_handles();
3563            if let Some((inlined, num_bytes, num_handles)) =
3564                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3565            {
3566                let member_inline_size = <fidl::encoding::UnboundedVector<
3567                    fidl::encoding::UnboundedString,
3568                > as fidl::encoding::TypeMarker>::inline_size(
3569                    decoder.context
3570                );
3571                if inlined != (member_inline_size <= 4) {
3572                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3573                }
3574                let inner_offset;
3575                let mut inner_depth = depth.clone();
3576                if inlined {
3577                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3578                    inner_offset = next_offset;
3579                } else {
3580                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3581                    inner_depth.increment()?;
3582                }
3583                let val_ref = self.driver_bind_eager.get_or_insert_with(|| {
3584                    fidl::new_empty!(
3585                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3586                        fidl::encoding::DefaultFuchsiaResourceDialect
3587                    )
3588                });
3589                fidl::decode!(
3590                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
3591                    fidl::encoding::DefaultFuchsiaResourceDialect,
3592                    val_ref,
3593                    decoder,
3594                    inner_offset,
3595                    inner_depth
3596                )?;
3597                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3598                {
3599                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3600                }
3601                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3602                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3603                }
3604            }
3605
3606            next_offset += envelope_size;
3607            _next_ordinal_to_read += 1;
3608            if next_offset >= end_offset {
3609                return Ok(());
3610            }
3611
3612            // Decode unknown envelopes for gaps in ordinals.
3613            while _next_ordinal_to_read < 10 {
3614                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3615                _next_ordinal_to_read += 1;
3616                next_offset += envelope_size;
3617            }
3618
3619            let next_out_of_line = decoder.next_out_of_line();
3620            let handles_before = decoder.remaining_handles();
3621            if let Some((inlined, num_bytes, num_handles)) =
3622                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3623            {
3624                let member_inline_size =
3625                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
3626                        decoder.context,
3627                    );
3628                if inlined != (member_inline_size <= 4) {
3629                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3630                }
3631                let inner_offset;
3632                let mut inner_depth = depth.clone();
3633                if inlined {
3634                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3635                    inner_offset = next_offset;
3636                } else {
3637                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3638                    inner_depth.increment()?;
3639                }
3640                let val_ref = self.board_name.get_or_insert_with(|| {
3641                    fidl::new_empty!(
3642                        fidl::encoding::UnboundedString,
3643                        fidl::encoding::DefaultFuchsiaResourceDialect
3644                    )
3645                });
3646                fidl::decode!(
3647                    fidl::encoding::UnboundedString,
3648                    fidl::encoding::DefaultFuchsiaResourceDialect,
3649                    val_ref,
3650                    decoder,
3651                    inner_offset,
3652                    inner_depth
3653                )?;
3654                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3655                {
3656                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3657                }
3658                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3659                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3660                }
3661            }
3662
3663            next_offset += envelope_size;
3664            _next_ordinal_to_read += 1;
3665            if next_offset >= end_offset {
3666                return Ok(());
3667            }
3668
3669            // Decode unknown envelopes for gaps in ordinals.
3670            while _next_ordinal_to_read < 11 {
3671                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3672                _next_ordinal_to_read += 1;
3673                next_offset += envelope_size;
3674            }
3675
3676            let next_out_of_line = decoder.next_out_of_line();
3677            let handles_before = decoder.remaining_handles();
3678            if let Some((inlined, num_bytes, num_handles)) =
3679                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3680            {
3681                let member_inline_size = <fidl::encoding::UnboundedVector<Offer> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3682                if inlined != (member_inline_size <= 4) {
3683                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3684                }
3685                let inner_offset;
3686                let mut inner_depth = depth.clone();
3687                if inlined {
3688                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3689                    inner_offset = next_offset;
3690                } else {
3691                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3692                    inner_depth.increment()?;
3693                }
3694                let val_ref = self.offers.get_or_insert_with(|| {
3695                    fidl::new_empty!(
3696                        fidl::encoding::UnboundedVector<Offer>,
3697                        fidl::encoding::DefaultFuchsiaResourceDialect
3698                    )
3699                });
3700                fidl::decode!(
3701                    fidl::encoding::UnboundedVector<Offer>,
3702                    fidl::encoding::DefaultFuchsiaResourceDialect,
3703                    val_ref,
3704                    decoder,
3705                    inner_offset,
3706                    inner_depth
3707                )?;
3708                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3709                {
3710                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3711                }
3712                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3713                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3714                }
3715            }
3716
3717            next_offset += envelope_size;
3718            _next_ordinal_to_read += 1;
3719            if next_offset >= end_offset {
3720                return Ok(());
3721            }
3722
3723            // Decode unknown envelopes for gaps in ordinals.
3724            while _next_ordinal_to_read < 12 {
3725                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3726                _next_ordinal_to_read += 1;
3727                next_offset += envelope_size;
3728            }
3729
3730            let next_out_of_line = decoder.next_out_of_line();
3731            let handles_before = decoder.remaining_handles();
3732            if let Some((inlined, num_bytes, num_handles)) =
3733                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3734            {
3735                let member_inline_size = <fidl::encoding::UnboundedVector<Expose> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3736                if inlined != (member_inline_size <= 4) {
3737                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3738                }
3739                let inner_offset;
3740                let mut inner_depth = depth.clone();
3741                if inlined {
3742                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3743                    inner_offset = next_offset;
3744                } else {
3745                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3746                    inner_depth.increment()?;
3747                }
3748                let val_ref = self.exposes.get_or_insert_with(|| {
3749                    fidl::new_empty!(
3750                        fidl::encoding::UnboundedVector<Expose>,
3751                        fidl::encoding::DefaultFuchsiaResourceDialect
3752                    )
3753                });
3754                fidl::decode!(
3755                    fidl::encoding::UnboundedVector<Expose>,
3756                    fidl::encoding::DefaultFuchsiaResourceDialect,
3757                    val_ref,
3758                    decoder,
3759                    inner_offset,
3760                    inner_depth
3761                )?;
3762                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3763                {
3764                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3765                }
3766                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3767                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3768                }
3769            }
3770
3771            next_offset += envelope_size;
3772            _next_ordinal_to_read += 1;
3773            if next_offset >= end_offset {
3774                return Ok(());
3775            }
3776
3777            // Decode unknown envelopes for gaps in ordinals.
3778            while _next_ordinal_to_read < 13 {
3779                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3780                _next_ordinal_to_read += 1;
3781                next_offset += envelope_size;
3782            }
3783
3784            let next_out_of_line = decoder.next_out_of_line();
3785            let handles_before = decoder.remaining_handles();
3786            if let Some((inlined, num_bytes, num_handles)) =
3787                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3788            {
3789                let member_inline_size = <fidl::encoding::Endpoint<
3790                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3791                > as fidl::encoding::TypeMarker>::inline_size(
3792                    decoder.context
3793                );
3794                if inlined != (member_inline_size <= 4) {
3795                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3796                }
3797                let inner_offset;
3798                let mut inner_depth = depth.clone();
3799                if inlined {
3800                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3801                    inner_offset = next_offset;
3802                } else {
3803                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3804                    inner_depth.increment()?;
3805                }
3806                let val_ref = self.pkg.get_or_insert_with(|| {
3807                    fidl::new_empty!(
3808                        fidl::encoding::Endpoint<
3809                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3810                        >,
3811                        fidl::encoding::DefaultFuchsiaResourceDialect
3812                    )
3813                });
3814                fidl::decode!(
3815                    fidl::encoding::Endpoint<
3816                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
3817                    >,
3818                    fidl::encoding::DefaultFuchsiaResourceDialect,
3819                    val_ref,
3820                    decoder,
3821                    inner_offset,
3822                    inner_depth
3823                )?;
3824                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3825                {
3826                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3827                }
3828                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3829                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3830                }
3831            }
3832
3833            next_offset += envelope_size;
3834            _next_ordinal_to_read += 1;
3835            if next_offset >= end_offset {
3836                return Ok(());
3837            }
3838
3839            // Decode unknown envelopes for gaps in ordinals.
3840            while _next_ordinal_to_read < 14 {
3841                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3842                _next_ordinal_to_read += 1;
3843                next_offset += envelope_size;
3844            }
3845
3846            let next_out_of_line = decoder.next_out_of_line();
3847            let handles_before = decoder.remaining_handles();
3848            if let Some((inlined, num_bytes, num_handles)) =
3849                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3850            {
3851                let member_inline_size = <fidl::encoding::UnboundedVector<
3852                    fidl_fuchsia_component_test::Capability,
3853                > as fidl::encoding::TypeMarker>::inline_size(
3854                    decoder.context
3855                );
3856                if inlined != (member_inline_size <= 4) {
3857                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3858                }
3859                let inner_offset;
3860                let mut inner_depth = depth.clone();
3861                if inlined {
3862                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3863                    inner_offset = next_offset;
3864                } else {
3865                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3866                    inner_depth.increment()?;
3867                }
3868                let val_ref = self.dtr_offers.get_or_insert_with(|| {
3869                    fidl::new_empty!(
3870                        fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>,
3871                        fidl::encoding::DefaultFuchsiaResourceDialect
3872                    )
3873                });
3874                fidl::decode!(
3875                    fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>,
3876                    fidl::encoding::DefaultFuchsiaResourceDialect,
3877                    val_ref,
3878                    decoder,
3879                    inner_offset,
3880                    inner_depth
3881                )?;
3882                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3883                {
3884                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3885                }
3886                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3887                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3888                }
3889            }
3890
3891            next_offset += envelope_size;
3892            _next_ordinal_to_read += 1;
3893            if next_offset >= end_offset {
3894                return Ok(());
3895            }
3896
3897            // Decode unknown envelopes for gaps in ordinals.
3898            while _next_ordinal_to_read < 15 {
3899                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3900                _next_ordinal_to_read += 1;
3901                next_offset += envelope_size;
3902            }
3903
3904            let next_out_of_line = decoder.next_out_of_line();
3905            let handles_before = decoder.remaining_handles();
3906            if let Some((inlined, num_bytes, num_handles)) =
3907                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3908            {
3909                let member_inline_size = <fidl::encoding::UnboundedVector<
3910                    fidl_fuchsia_component_test::Capability,
3911                > as fidl::encoding::TypeMarker>::inline_size(
3912                    decoder.context
3913                );
3914                if inlined != (member_inline_size <= 4) {
3915                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3916                }
3917                let inner_offset;
3918                let mut inner_depth = depth.clone();
3919                if inlined {
3920                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3921                    inner_offset = next_offset;
3922                } else {
3923                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3924                    inner_depth.increment()?;
3925                }
3926                let val_ref = self.dtr_exposes.get_or_insert_with(|| {
3927                    fidl::new_empty!(
3928                        fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>,
3929                        fidl::encoding::DefaultFuchsiaResourceDialect
3930                    )
3931                });
3932                fidl::decode!(
3933                    fidl::encoding::UnboundedVector<fidl_fuchsia_component_test::Capability>,
3934                    fidl::encoding::DefaultFuchsiaResourceDialect,
3935                    val_ref,
3936                    decoder,
3937                    inner_offset,
3938                    inner_depth
3939                )?;
3940                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3941                {
3942                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3943                }
3944                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3945                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3946                }
3947            }
3948
3949            next_offset += envelope_size;
3950            _next_ordinal_to_read += 1;
3951            if next_offset >= end_offset {
3952                return Ok(());
3953            }
3954
3955            // Decode unknown envelopes for gaps in ordinals.
3956            while _next_ordinal_to_read < 16 {
3957                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3958                _next_ordinal_to_read += 1;
3959                next_offset += envelope_size;
3960            }
3961
3962            let next_out_of_line = decoder.next_out_of_line();
3963            let handles_before = decoder.remaining_handles();
3964            if let Some((inlined, num_bytes, num_handles)) =
3965                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3966            {
3967                let member_inline_size = <fidl_fuchsia_component_resolution::Component as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3968                if inlined != (member_inline_size <= 4) {
3969                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3970                }
3971                let inner_offset;
3972                let mut inner_depth = depth.clone();
3973                if inlined {
3974                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3975                    inner_offset = next_offset;
3976                } else {
3977                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3978                    inner_depth.increment()?;
3979                }
3980                let val_ref = self.test_component.get_or_insert_with(|| {
3981                    fidl::new_empty!(
3982                        fidl_fuchsia_component_resolution::Component,
3983                        fidl::encoding::DefaultFuchsiaResourceDialect
3984                    )
3985                });
3986                fidl::decode!(
3987                    fidl_fuchsia_component_resolution::Component,
3988                    fidl::encoding::DefaultFuchsiaResourceDialect,
3989                    val_ref,
3990                    decoder,
3991                    inner_offset,
3992                    inner_depth
3993                )?;
3994                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3995                {
3996                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3997                }
3998                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3999                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4000                }
4001            }
4002
4003            next_offset += envelope_size;
4004            _next_ordinal_to_read += 1;
4005            if next_offset >= end_offset {
4006                return Ok(());
4007            }
4008
4009            // Decode unknown envelopes for gaps in ordinals.
4010            while _next_ordinal_to_read < 17 {
4011                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4012                _next_ordinal_to_read += 1;
4013                next_offset += envelope_size;
4014            }
4015
4016            let next_out_of_line = decoder.next_out_of_line();
4017            let handles_before = decoder.remaining_handles();
4018            if let Some((inlined, num_bytes, num_handles)) =
4019                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4020            {
4021                let member_inline_size =
4022                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4023                if inlined != (member_inline_size <= 4) {
4024                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4025                }
4026                let inner_offset;
4027                let mut inner_depth = depth.clone();
4028                if inlined {
4029                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4030                    inner_offset = next_offset;
4031                } else {
4032                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4033                    inner_depth.increment()?;
4034                }
4035                let val_ref = self.driver_index_stop_timeout_millis.get_or_insert_with(|| {
4036                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
4037                });
4038                fidl::decode!(
4039                    i64,
4040                    fidl::encoding::DefaultFuchsiaResourceDialect,
4041                    val_ref,
4042                    decoder,
4043                    inner_offset,
4044                    inner_depth
4045                )?;
4046                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4047                {
4048                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4049                }
4050                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4051                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4052                }
4053            }
4054
4055            next_offset += envelope_size;
4056            _next_ordinal_to_read += 1;
4057            if next_offset >= end_offset {
4058                return Ok(());
4059            }
4060
4061            // Decode unknown envelopes for gaps in ordinals.
4062            while _next_ordinal_to_read < 18 {
4063                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4064                _next_ordinal_to_read += 1;
4065                next_offset += envelope_size;
4066            }
4067
4068            let next_out_of_line = decoder.next_out_of_line();
4069            let handles_before = decoder.remaining_handles();
4070            if let Some((inlined, num_bytes, num_handles)) =
4071                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4072            {
4073                let member_inline_size = <fidl::encoding::Vector<SoftwareDevice, 20> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4074                if inlined != (member_inline_size <= 4) {
4075                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4076                }
4077                let inner_offset;
4078                let mut inner_depth = depth.clone();
4079                if inlined {
4080                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4081                    inner_offset = next_offset;
4082                } else {
4083                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4084                    inner_depth.increment()?;
4085                }
4086                let val_ref =
4087                self.software_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<SoftwareDevice, 20>, fidl::encoding::DefaultFuchsiaResourceDialect));
4088                fidl::decode!(fidl::encoding::Vector<SoftwareDevice, 20>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4089                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4090                {
4091                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4092                }
4093                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4094                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4095                }
4096            }
4097
4098            next_offset += envelope_size;
4099            _next_ordinal_to_read += 1;
4100            if next_offset >= end_offset {
4101                return Ok(());
4102            }
4103
4104            // Decode unknown envelopes for gaps in ordinals.
4105            while _next_ordinal_to_read < 19 {
4106                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4107                _next_ordinal_to_read += 1;
4108                next_offset += envelope_size;
4109            }
4110
4111            let next_out_of_line = decoder.next_out_of_line();
4112            let handles_before = decoder.remaining_handles();
4113            if let Some((inlined, num_bytes, num_handles)) =
4114                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4115            {
4116                let member_inline_size = <fidl::encoding::UnboundedVector<
4117                    fidl::encoding::UnboundedString,
4118                > as fidl::encoding::TypeMarker>::inline_size(
4119                    decoder.context
4120                );
4121                if inlined != (member_inline_size <= 4) {
4122                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4123                }
4124                let inner_offset;
4125                let mut inner_depth = depth.clone();
4126                if inlined {
4127                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4128                    inner_offset = next_offset;
4129                } else {
4130                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4131                    inner_depth.increment()?;
4132                }
4133                let val_ref = self.boot_driver_components.get_or_insert_with(|| {
4134                    fidl::new_empty!(
4135                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
4136                        fidl::encoding::DefaultFuchsiaResourceDialect
4137                    )
4138                });
4139                fidl::decode!(
4140                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
4141                    fidl::encoding::DefaultFuchsiaResourceDialect,
4142                    val_ref,
4143                    decoder,
4144                    inner_offset,
4145                    inner_depth
4146                )?;
4147                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4148                {
4149                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4150                }
4151                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4152                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4153                }
4154            }
4155
4156            next_offset += envelope_size;
4157            _next_ordinal_to_read += 1;
4158            if next_offset >= end_offset {
4159                return Ok(());
4160            }
4161
4162            // Decode unknown envelopes for gaps in ordinals.
4163            while _next_ordinal_to_read < 20 {
4164                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4165                _next_ordinal_to_read += 1;
4166                next_offset += envelope_size;
4167            }
4168
4169            let next_out_of_line = decoder.next_out_of_line();
4170            let handles_before = decoder.remaining_handles();
4171            if let Some((inlined, num_bytes, num_handles)) =
4172                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4173            {
4174                let member_inline_size = <fidl::encoding::HandleType<
4175                    fidl::Vmo,
4176                    { fidl::ObjectType::VMO.into_raw() },
4177                    2147483648,
4178                > as fidl::encoding::TypeMarker>::inline_size(
4179                    decoder.context
4180                );
4181                if inlined != (member_inline_size <= 4) {
4182                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4183                }
4184                let inner_offset;
4185                let mut inner_depth = depth.clone();
4186                if inlined {
4187                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4188                    inner_offset = next_offset;
4189                } else {
4190                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4191                    inner_depth.increment()?;
4192                }
4193                let val_ref =
4194                self.devicetree.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4195                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4196                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4197                {
4198                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4199                }
4200                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4201                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4202                }
4203            }
4204
4205            next_offset += envelope_size;
4206            _next_ordinal_to_read += 1;
4207            if next_offset >= end_offset {
4208                return Ok(());
4209            }
4210
4211            // Decode unknown envelopes for gaps in ordinals.
4212            while _next_ordinal_to_read < 21 {
4213                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4214                _next_ordinal_to_read += 1;
4215                next_offset += envelope_size;
4216            }
4217
4218            let next_out_of_line = decoder.next_out_of_line();
4219            let handles_before = decoder.remaining_handles();
4220            if let Some((inlined, num_bytes, num_handles)) =
4221                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4222            {
4223                let member_inline_size =
4224                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4225                if inlined != (member_inline_size <= 4) {
4226                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4227                }
4228                let inner_offset;
4229                let mut inner_depth = depth.clone();
4230                if inlined {
4231                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4232                    inner_offset = next_offset;
4233                } else {
4234                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4235                    inner_depth.increment()?;
4236                }
4237                let val_ref = self.platform_vid.get_or_insert_with(|| {
4238                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
4239                });
4240                fidl::decode!(
4241                    u32,
4242                    fidl::encoding::DefaultFuchsiaResourceDialect,
4243                    val_ref,
4244                    decoder,
4245                    inner_offset,
4246                    inner_depth
4247                )?;
4248                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4249                {
4250                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4251                }
4252                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4253                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4254                }
4255            }
4256
4257            next_offset += envelope_size;
4258            _next_ordinal_to_read += 1;
4259            if next_offset >= end_offset {
4260                return Ok(());
4261            }
4262
4263            // Decode unknown envelopes for gaps in ordinals.
4264            while _next_ordinal_to_read < 22 {
4265                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4266                _next_ordinal_to_read += 1;
4267                next_offset += envelope_size;
4268            }
4269
4270            let next_out_of_line = decoder.next_out_of_line();
4271            let handles_before = decoder.remaining_handles();
4272            if let Some((inlined, num_bytes, num_handles)) =
4273                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4274            {
4275                let member_inline_size =
4276                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4277                if inlined != (member_inline_size <= 4) {
4278                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4279                }
4280                let inner_offset;
4281                let mut inner_depth = depth.clone();
4282                if inlined {
4283                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4284                    inner_offset = next_offset;
4285                } else {
4286                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4287                    inner_depth.increment()?;
4288                }
4289                let val_ref = self.platform_pid.get_or_insert_with(|| {
4290                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
4291                });
4292                fidl::decode!(
4293                    u32,
4294                    fidl::encoding::DefaultFuchsiaResourceDialect,
4295                    val_ref,
4296                    decoder,
4297                    inner_offset,
4298                    inner_depth
4299                )?;
4300                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4301                {
4302                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4303                }
4304                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4305                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4306                }
4307            }
4308
4309            next_offset += envelope_size;
4310
4311            // Decode the remaining unknown envelopes.
4312            while next_offset < end_offset {
4313                _next_ordinal_to_read += 1;
4314                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4315                next_offset += envelope_size;
4316            }
4317
4318            Ok(())
4319        }
4320    }
4321}