fidl_fuchsia_driver_framework/
fidl_fuchsia_driver_framework.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_framework__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct DriverStartRequest {
16    pub start_args: DriverStartArgs,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverStartRequest {}
20
21#[derive(Debug, PartialEq)]
22pub struct NodeAddChildRequest {
23    pub args: NodeAddArgs,
24    pub controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
25    pub node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NodeAddChildRequest {}
29
30#[derive(Debug, Default, PartialEq)]
31pub struct DevfsAddArgs {
32    /// This is the connector to be installed in devfs.
33    /// `Connect()` will be called when a client connects to this node in the filesystem.
34    /// Optional: If this is not provided then an empty node will appear in devfs.
35    pub connector: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>>,
36    /// This is the class name for installing this node in devfs.
37    /// The node will be placed within /dev/class/{class_name}.
38    /// If `class_name` does not exist under /dev/class/ it will be created.
39    /// Optional: If this is not provided then the node will only be added via topological path.
40    pub class_name: Option<String>,
41    /// This is a vmo of inspect data that will be installed in devfs.
42    /// Optional: If this is not provided then the devfs's inspect data will be empty.
43    pub inspect: Option<fidl::Vmo>,
44    /// The connection types that are supported by the |connector| given.
45    /// The driver framework should handle connection types that are not supported by the
46    /// connector.
47    /// If not provided, only the device type is assumed as supported by the connector.
48    pub connector_supports: Option<fidl_fuchsia_device_fs::ConnectionType>,
49    /// This is the controller connector to be installed in devfs.
50    /// `Connect()` will be called when a client connects to the device_controller connection
51    /// for this node in the filesystem.
52    /// Optional: If this is not provided then the Node will handle the connection natively.
53    /// This option should only be used by the compat shim or in tests
54    pub controller_connector:
55        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>>,
56    #[doc(hidden)]
57    pub __source_breaking: fidl::marker::SourceBreaking,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DevfsAddArgs {}
61
62/// Arguments for starting a driver.
63#[derive(Debug, Default, PartialEq)]
64pub struct DriverStartArgs {
65    /// Node that the driver is bound to.
66    pub node: Option<fidl::endpoints::ClientEnd<NodeMarker>>,
67    /// Symbols provided to the driver, for |node|. These come from the driver
68    /// that added |node|, and are filtered to the symbols requested in the bind
69    /// program.
70    pub symbols: Option<Vec<NodeSymbol>>,
71    /// URL of the package containing the driver. This is purely informational,
72    /// used only to provide data for inspect.
73    pub url: Option<String>,
74    /// Information about the driver to start. Currently, we support the
75    /// following entries:
76    ///   1. "binary": a string containing the package-relative path to the
77    ///      driver binary.
78    ///   2. "colocate" (optional): a string containing "true" or "false"
79    ///      specifying whether the driver should be colocated in the same
80    ///      driver host as the driver that added |node|. If not specified, the
81    ///      driver will be launched in a new driver host.
82    ///   3. "default_dispatcher_opts" (optional): an array of strings specifying
83    ///      the options for creating the default dispatcher. A string can be one
84    ///      of the following:
85    ///      * `allow_sync_calls`: allows synchronous calls to be done on the
86    ///      default dispatcher's thread.
87    ///   4. "default_dispatcher_scheduler_role" (optional): the scheduler role to
88    ///      set for the default dispatcher created for the driver.
89    pub program: Option<fidl_fuchsia_data::Dictionary>,
90    /// Incoming namespace provided to the driver.
91    pub incoming: Option<Vec<fidl_fuchsia_component_runner::ComponentNamespaceEntry>>,
92    /// Outgoing directory served by the driver.
93    pub outgoing_dir: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
94    /// Configuration passed to the driver.
95    pub config: Option<fidl::Vmo>,
96    /// The name of the node the driver is bound to.
97    pub node_name: Option<String>,
98    /// Node properties of the node the driver is bound to.
99    /// If the node is non-composite then the "default" entry will contain the
100    /// node's own properties.
101    /// If the node is a composite then there is an entry for each of its parents
102    /// and the "default" entry will reference the primary composite parent
103    /// node's properties. The composite parent node's properties are those that
104    /// were provided in the composite node specification and not the original
105    /// properties of the parent.
106    pub node_properties: Option<Vec<NodePropertyEntry>>,
107    /// Node offers of the node the driver is bound to.
108    pub node_offers: Option<Vec<Offer>>,
109    /// Provides a token representing this node which can be exchanged with the
110    /// driver framework to discern additional information about this node.
111    pub node_token: Option<fidl::Event>,
112    pub node_properties_2: Option<Vec<NodePropertyEntry2>>,
113    /// Root VMAR the driver is mapped into. All child mappings should be placed into this VMAR
114    /// if they want to have the same scheduler profile applied to them.
115    pub vmar: Option<fidl::Vmar>,
116    #[doc(hidden)]
117    pub __source_breaking: fidl::marker::SourceBreaking,
118}
119
120impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverStartArgs {}
121
122/// Arguments for adding a node.
123#[derive(Debug, Default, PartialEq)]
124pub struct NodeAddArgs {
125    /// Name of the node.
126    pub name: Option<String>,
127    /// Functions to provide to the driver that is bound to this node.
128    pub symbols: Option<Vec<NodeSymbol>>,
129    /// Properties of the node. Deprecated: all new usages should set properties2 and leave
130    /// this field blank.
131    pub properties: Option<Vec<NodeProperty>>,
132    /// The arguments for how this node should be added to devfs.
133    pub devfs_args: Option<DevfsAddArgs>,
134    /// Capabilities to offer to the driver that is bound to this node.
135    /// The driver must ensure these capabilities are added to its outgoing directory
136    /// before adding the child node.
137    pub offers2: Option<Vec<Offer>>,
138    /// Information that feeds into a structured bus topology for the device. It should
139    /// only be specified by bus drivers, ideally those which are included by default.
140    pub bus_info: Option<BusInfo>,
141    /// Properties of the node. If set, the `properties` field must be blank. Otherwise,
142    /// adding the node will return an error.
143    pub properties2: Option<Vec<NodeProperty2>>,
144    #[doc(hidden)]
145    pub __source_breaking: fidl::marker::SourceBreaking,
146}
147
148impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NodeAddArgs {}
149
150#[derive(Debug, Default, PartialEq)]
151pub struct NodeControllerOnBindRequest {
152    /// Provides a token representing this node which can be exchanged with the
153    /// driver framework to discern additional information about this node.
154    pub node_token: Option<fidl::Event>,
155    #[doc(hidden)]
156    pub __source_breaking: fidl::marker::SourceBreaking,
157}
158
159impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
160    for NodeControllerOnBindRequest
161{
162}
163
164#[derive(Debug)]
165pub enum DriverResult {
166    /// The token that belongs to the node that a driver has started successfully on.
167    DriverStartedNodeToken(fidl::Event),
168    /// The node failed to find a matching driver or composite spec.
169    MatchError(i32),
170    /// The driver that bound to the node failed to start successfully.
171    StartError(i32),
172    #[doc(hidden)]
173    __SourceBreaking { unknown_ordinal: u64 },
174}
175
176/// Pattern that matches an unknown `DriverResult` member.
177#[macro_export]
178macro_rules! DriverResultUnknown {
179    () => {
180        _
181    };
182}
183
184// Custom PartialEq so that unknown variants are not equal to themselves.
185impl PartialEq for DriverResult {
186    fn eq(&self, other: &Self) -> bool {
187        match (self, other) {
188            (Self::DriverStartedNodeToken(x), Self::DriverStartedNodeToken(y)) => *x == *y,
189            (Self::MatchError(x), Self::MatchError(y)) => *x == *y,
190            (Self::StartError(x), Self::StartError(y)) => *x == *y,
191            _ => false,
192        }
193    }
194}
195
196impl DriverResult {
197    #[inline]
198    pub fn ordinal(&self) -> u64 {
199        match *self {
200            Self::DriverStartedNodeToken(_) => 1,
201            Self::MatchError(_) => 2,
202            Self::StartError(_) => 3,
203            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
204        }
205    }
206
207    #[inline]
208    pub fn unknown_variant_for_testing() -> Self {
209        Self::__SourceBreaking { unknown_ordinal: 0 }
210    }
211
212    #[inline]
213    pub fn is_unknown(&self) -> bool {
214        match self {
215            Self::__SourceBreaking { .. } => true,
216            _ => false,
217        }
218    }
219}
220
221impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverResult {}
222
223#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
224pub struct CompositeNodeManagerMarker;
225
226impl fidl::endpoints::ProtocolMarker for CompositeNodeManagerMarker {
227    type Proxy = CompositeNodeManagerProxy;
228    type RequestStream = CompositeNodeManagerRequestStream;
229    #[cfg(target_os = "fuchsia")]
230    type SynchronousProxy = CompositeNodeManagerSynchronousProxy;
231
232    const DEBUG_NAME: &'static str = "fuchsia.driver.framework.CompositeNodeManager";
233}
234impl fidl::endpoints::DiscoverableProtocolMarker for CompositeNodeManagerMarker {}
235pub type CompositeNodeManagerAddSpecResult = Result<(), CompositeNodeSpecError>;
236
237pub trait CompositeNodeManagerProxyInterface: Send + Sync {
238    type AddSpecResponseFut: std::future::Future<Output = Result<CompositeNodeManagerAddSpecResult, fidl::Error>>
239        + Send;
240    fn r#add_spec(&self, payload: &CompositeNodeSpec) -> Self::AddSpecResponseFut;
241}
242#[derive(Debug)]
243#[cfg(target_os = "fuchsia")]
244pub struct CompositeNodeManagerSynchronousProxy {
245    client: fidl::client::sync::Client,
246}
247
248#[cfg(target_os = "fuchsia")]
249impl fidl::endpoints::SynchronousProxy for CompositeNodeManagerSynchronousProxy {
250    type Proxy = CompositeNodeManagerProxy;
251    type Protocol = CompositeNodeManagerMarker;
252
253    fn from_channel(inner: fidl::Channel) -> Self {
254        Self::new(inner)
255    }
256
257    fn into_channel(self) -> fidl::Channel {
258        self.client.into_channel()
259    }
260
261    fn as_channel(&self) -> &fidl::Channel {
262        self.client.as_channel()
263    }
264}
265
266#[cfg(target_os = "fuchsia")]
267impl CompositeNodeManagerSynchronousProxy {
268    pub fn new(channel: fidl::Channel) -> Self {
269        let protocol_name =
270            <CompositeNodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
271        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
272    }
273
274    pub fn into_channel(self) -> fidl::Channel {
275        self.client.into_channel()
276    }
277
278    /// Waits until an event arrives and returns it. It is safe for other
279    /// threads to make concurrent requests while waiting for an event.
280    pub fn wait_for_event(
281        &self,
282        deadline: zx::MonotonicInstant,
283    ) -> Result<CompositeNodeManagerEvent, fidl::Error> {
284        CompositeNodeManagerEvent::decode(self.client.wait_for_event(deadline)?)
285    }
286
287    /// Adds the given composite node specification to the driver framework.
288    pub fn r#add_spec(
289        &self,
290        mut payload: &CompositeNodeSpec,
291        ___deadline: zx::MonotonicInstant,
292    ) -> Result<CompositeNodeManagerAddSpecResult, fidl::Error> {
293        let _response =
294            self.client
295                .send_query::<CompositeNodeSpec, fidl::encoding::FlexibleResultType<
296                    fidl::encoding::EmptyStruct,
297                    CompositeNodeSpecError,
298                >>(
299                    payload,
300                    0x524e353c8130cc74,
301                    fidl::encoding::DynamicFlags::FLEXIBLE,
302                    ___deadline,
303                )?
304                .into_result::<CompositeNodeManagerMarker>("add_spec")?;
305        Ok(_response.map(|x| x))
306    }
307}
308
309#[cfg(target_os = "fuchsia")]
310impl From<CompositeNodeManagerSynchronousProxy> for zx::Handle {
311    fn from(value: CompositeNodeManagerSynchronousProxy) -> Self {
312        value.into_channel().into()
313    }
314}
315
316#[cfg(target_os = "fuchsia")]
317impl From<fidl::Channel> for CompositeNodeManagerSynchronousProxy {
318    fn from(value: fidl::Channel) -> Self {
319        Self::new(value)
320    }
321}
322
323#[cfg(target_os = "fuchsia")]
324impl fidl::endpoints::FromClient for CompositeNodeManagerSynchronousProxy {
325    type Protocol = CompositeNodeManagerMarker;
326
327    fn from_client(value: fidl::endpoints::ClientEnd<CompositeNodeManagerMarker>) -> Self {
328        Self::new(value.into_channel())
329    }
330}
331
332#[derive(Debug, Clone)]
333pub struct CompositeNodeManagerProxy {
334    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
335}
336
337impl fidl::endpoints::Proxy for CompositeNodeManagerProxy {
338    type Protocol = CompositeNodeManagerMarker;
339
340    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
341        Self::new(inner)
342    }
343
344    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
345        self.client.into_channel().map_err(|client| Self { client })
346    }
347
348    fn as_channel(&self) -> &::fidl::AsyncChannel {
349        self.client.as_channel()
350    }
351}
352
353impl CompositeNodeManagerProxy {
354    /// Create a new Proxy for fuchsia.driver.framework/CompositeNodeManager.
355    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
356        let protocol_name =
357            <CompositeNodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
358        Self { client: fidl::client::Client::new(channel, protocol_name) }
359    }
360
361    /// Get a Stream of events from the remote end of the protocol.
362    ///
363    /// # Panics
364    ///
365    /// Panics if the event stream was already taken.
366    pub fn take_event_stream(&self) -> CompositeNodeManagerEventStream {
367        CompositeNodeManagerEventStream { event_receiver: self.client.take_event_receiver() }
368    }
369
370    /// Adds the given composite node specification to the driver framework.
371    pub fn r#add_spec(
372        &self,
373        mut payload: &CompositeNodeSpec,
374    ) -> fidl::client::QueryResponseFut<
375        CompositeNodeManagerAddSpecResult,
376        fidl::encoding::DefaultFuchsiaResourceDialect,
377    > {
378        CompositeNodeManagerProxyInterface::r#add_spec(self, payload)
379    }
380}
381
382impl CompositeNodeManagerProxyInterface for CompositeNodeManagerProxy {
383    type AddSpecResponseFut = fidl::client::QueryResponseFut<
384        CompositeNodeManagerAddSpecResult,
385        fidl::encoding::DefaultFuchsiaResourceDialect,
386    >;
387    fn r#add_spec(&self, mut payload: &CompositeNodeSpec) -> Self::AddSpecResponseFut {
388        fn _decode(
389            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
390        ) -> Result<CompositeNodeManagerAddSpecResult, fidl::Error> {
391            let _response = fidl::client::decode_transaction_body::<
392                fidl::encoding::FlexibleResultType<
393                    fidl::encoding::EmptyStruct,
394                    CompositeNodeSpecError,
395                >,
396                fidl::encoding::DefaultFuchsiaResourceDialect,
397                0x524e353c8130cc74,
398            >(_buf?)?
399            .into_result::<CompositeNodeManagerMarker>("add_spec")?;
400            Ok(_response.map(|x| x))
401        }
402        self.client.send_query_and_decode::<CompositeNodeSpec, CompositeNodeManagerAddSpecResult>(
403            payload,
404            0x524e353c8130cc74,
405            fidl::encoding::DynamicFlags::FLEXIBLE,
406            _decode,
407        )
408    }
409}
410
411pub struct CompositeNodeManagerEventStream {
412    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
413}
414
415impl std::marker::Unpin for CompositeNodeManagerEventStream {}
416
417impl futures::stream::FusedStream for CompositeNodeManagerEventStream {
418    fn is_terminated(&self) -> bool {
419        self.event_receiver.is_terminated()
420    }
421}
422
423impl futures::Stream for CompositeNodeManagerEventStream {
424    type Item = Result<CompositeNodeManagerEvent, fidl::Error>;
425
426    fn poll_next(
427        mut self: std::pin::Pin<&mut Self>,
428        cx: &mut std::task::Context<'_>,
429    ) -> std::task::Poll<Option<Self::Item>> {
430        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
431            &mut self.event_receiver,
432            cx
433        )?) {
434            Some(buf) => std::task::Poll::Ready(Some(CompositeNodeManagerEvent::decode(buf))),
435            None => std::task::Poll::Ready(None),
436        }
437    }
438}
439
440#[derive(Debug)]
441pub enum CompositeNodeManagerEvent {
442    #[non_exhaustive]
443    _UnknownEvent {
444        /// Ordinal of the event that was sent.
445        ordinal: u64,
446    },
447}
448
449impl CompositeNodeManagerEvent {
450    /// Decodes a message buffer as a [`CompositeNodeManagerEvent`].
451    fn decode(
452        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
453    ) -> Result<CompositeNodeManagerEvent, fidl::Error> {
454        let (bytes, _handles) = buf.split_mut();
455        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
456        debug_assert_eq!(tx_header.tx_id, 0);
457        match tx_header.ordinal {
458            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
459                Ok(CompositeNodeManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
460            }
461            _ => Err(fidl::Error::UnknownOrdinal {
462                ordinal: tx_header.ordinal,
463                protocol_name:
464                    <CompositeNodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
465            }),
466        }
467    }
468}
469
470/// A Stream of incoming requests for fuchsia.driver.framework/CompositeNodeManager.
471pub struct CompositeNodeManagerRequestStream {
472    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
473    is_terminated: bool,
474}
475
476impl std::marker::Unpin for CompositeNodeManagerRequestStream {}
477
478impl futures::stream::FusedStream for CompositeNodeManagerRequestStream {
479    fn is_terminated(&self) -> bool {
480        self.is_terminated
481    }
482}
483
484impl fidl::endpoints::RequestStream for CompositeNodeManagerRequestStream {
485    type Protocol = CompositeNodeManagerMarker;
486    type ControlHandle = CompositeNodeManagerControlHandle;
487
488    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
489        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
490    }
491
492    fn control_handle(&self) -> Self::ControlHandle {
493        CompositeNodeManagerControlHandle { inner: self.inner.clone() }
494    }
495
496    fn into_inner(
497        self,
498    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
499    {
500        (self.inner, self.is_terminated)
501    }
502
503    fn from_inner(
504        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
505        is_terminated: bool,
506    ) -> Self {
507        Self { inner, is_terminated }
508    }
509}
510
511impl futures::Stream for CompositeNodeManagerRequestStream {
512    type Item = Result<CompositeNodeManagerRequest, fidl::Error>;
513
514    fn poll_next(
515        mut self: std::pin::Pin<&mut Self>,
516        cx: &mut std::task::Context<'_>,
517    ) -> std::task::Poll<Option<Self::Item>> {
518        let this = &mut *self;
519        if this.inner.check_shutdown(cx) {
520            this.is_terminated = true;
521            return std::task::Poll::Ready(None);
522        }
523        if this.is_terminated {
524            panic!("polled CompositeNodeManagerRequestStream after completion");
525        }
526        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
527            |bytes, handles| {
528                match this.inner.channel().read_etc(cx, bytes, handles) {
529                    std::task::Poll::Ready(Ok(())) => {}
530                    std::task::Poll::Pending => return std::task::Poll::Pending,
531                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
532                        this.is_terminated = true;
533                        return std::task::Poll::Ready(None);
534                    }
535                    std::task::Poll::Ready(Err(e)) => {
536                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
537                            e.into(),
538                        ))));
539                    }
540                }
541
542                // A message has been received from the channel
543                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
544
545                std::task::Poll::Ready(Some(match header.ordinal {
546                0x524e353c8130cc74 => {
547                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
548                    let mut req = fidl::new_empty!(CompositeNodeSpec, fidl::encoding::DefaultFuchsiaResourceDialect);
549                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeNodeSpec>(&header, _body_bytes, handles, &mut req)?;
550                    let control_handle = CompositeNodeManagerControlHandle {
551                        inner: this.inner.clone(),
552                    };
553                    Ok(CompositeNodeManagerRequest::AddSpec {payload: req,
554                        responder: CompositeNodeManagerAddSpecResponder {
555                            control_handle: std::mem::ManuallyDrop::new(control_handle),
556                            tx_id: header.tx_id,
557                        },
558                    })
559                }
560                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
561                    Ok(CompositeNodeManagerRequest::_UnknownMethod {
562                        ordinal: header.ordinal,
563                        control_handle: CompositeNodeManagerControlHandle { inner: this.inner.clone() },
564                        method_type: fidl::MethodType::OneWay,
565                    })
566                }
567                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
568                    this.inner.send_framework_err(
569                        fidl::encoding::FrameworkErr::UnknownMethod,
570                        header.tx_id,
571                        header.ordinal,
572                        header.dynamic_flags(),
573                        (bytes, handles),
574                    )?;
575                    Ok(CompositeNodeManagerRequest::_UnknownMethod {
576                        ordinal: header.ordinal,
577                        control_handle: CompositeNodeManagerControlHandle { inner: this.inner.clone() },
578                        method_type: fidl::MethodType::TwoWay,
579                    })
580                }
581                _ => Err(fidl::Error::UnknownOrdinal {
582                    ordinal: header.ordinal,
583                    protocol_name: <CompositeNodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
584                }),
585            }))
586            },
587        )
588    }
589}
590
591/// Protocol through which board drivers can create composite node specs.
592///
593/// Composite node specs are created at runtime to dynamically bridge the
594/// static bind rules of a composite driver with the dynamic bind properties
595/// of nodes in the system so that the driver bind rules are more generic and reusable.
596#[derive(Debug)]
597pub enum CompositeNodeManagerRequest {
598    /// Adds the given composite node specification to the driver framework.
599    AddSpec { payload: CompositeNodeSpec, responder: CompositeNodeManagerAddSpecResponder },
600    /// An interaction was received which does not match any known method.
601    #[non_exhaustive]
602    _UnknownMethod {
603        /// Ordinal of the method that was called.
604        ordinal: u64,
605        control_handle: CompositeNodeManagerControlHandle,
606        method_type: fidl::MethodType,
607    },
608}
609
610impl CompositeNodeManagerRequest {
611    #[allow(irrefutable_let_patterns)]
612    pub fn into_add_spec(
613        self,
614    ) -> Option<(CompositeNodeSpec, CompositeNodeManagerAddSpecResponder)> {
615        if let CompositeNodeManagerRequest::AddSpec { payload, responder } = self {
616            Some((payload, responder))
617        } else {
618            None
619        }
620    }
621
622    /// Name of the method defined in FIDL
623    pub fn method_name(&self) -> &'static str {
624        match *self {
625            CompositeNodeManagerRequest::AddSpec { .. } => "add_spec",
626            CompositeNodeManagerRequest::_UnknownMethod {
627                method_type: fidl::MethodType::OneWay,
628                ..
629            } => "unknown one-way method",
630            CompositeNodeManagerRequest::_UnknownMethod {
631                method_type: fidl::MethodType::TwoWay,
632                ..
633            } => "unknown two-way method",
634        }
635    }
636}
637
638#[derive(Debug, Clone)]
639pub struct CompositeNodeManagerControlHandle {
640    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
641}
642
643impl fidl::endpoints::ControlHandle for CompositeNodeManagerControlHandle {
644    fn shutdown(&self) {
645        self.inner.shutdown()
646    }
647    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
648        self.inner.shutdown_with_epitaph(status)
649    }
650
651    fn is_closed(&self) -> bool {
652        self.inner.channel().is_closed()
653    }
654    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
655        self.inner.channel().on_closed()
656    }
657
658    #[cfg(target_os = "fuchsia")]
659    fn signal_peer(
660        &self,
661        clear_mask: zx::Signals,
662        set_mask: zx::Signals,
663    ) -> Result<(), zx_status::Status> {
664        use fidl::Peered;
665        self.inner.channel().signal_peer(clear_mask, set_mask)
666    }
667}
668
669impl CompositeNodeManagerControlHandle {}
670
671#[must_use = "FIDL methods require a response to be sent"]
672#[derive(Debug)]
673pub struct CompositeNodeManagerAddSpecResponder {
674    control_handle: std::mem::ManuallyDrop<CompositeNodeManagerControlHandle>,
675    tx_id: u32,
676}
677
678/// Set the the channel to be shutdown (see [`CompositeNodeManagerControlHandle::shutdown`])
679/// if the responder is dropped without sending a response, so that the client
680/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
681impl std::ops::Drop for CompositeNodeManagerAddSpecResponder {
682    fn drop(&mut self) {
683        self.control_handle.shutdown();
684        // Safety: drops once, never accessed again
685        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
686    }
687}
688
689impl fidl::endpoints::Responder for CompositeNodeManagerAddSpecResponder {
690    type ControlHandle = CompositeNodeManagerControlHandle;
691
692    fn control_handle(&self) -> &CompositeNodeManagerControlHandle {
693        &self.control_handle
694    }
695
696    fn drop_without_shutdown(mut self) {
697        // Safety: drops once, never accessed again due to mem::forget
698        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
699        // Prevent Drop from running (which would shut down the channel)
700        std::mem::forget(self);
701    }
702}
703
704impl CompositeNodeManagerAddSpecResponder {
705    /// Sends a response to the FIDL transaction.
706    ///
707    /// Sets the channel to shutdown if an error occurs.
708    pub fn send(self, mut result: Result<(), CompositeNodeSpecError>) -> Result<(), fidl::Error> {
709        let _result = self.send_raw(result);
710        if _result.is_err() {
711            self.control_handle.shutdown();
712        }
713        self.drop_without_shutdown();
714        _result
715    }
716
717    /// Similar to "send" but does not shutdown the channel if an error occurs.
718    pub fn send_no_shutdown_on_err(
719        self,
720        mut result: Result<(), CompositeNodeSpecError>,
721    ) -> Result<(), fidl::Error> {
722        let _result = self.send_raw(result);
723        self.drop_without_shutdown();
724        _result
725    }
726
727    fn send_raw(&self, mut result: Result<(), CompositeNodeSpecError>) -> Result<(), fidl::Error> {
728        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
729            fidl::encoding::EmptyStruct,
730            CompositeNodeSpecError,
731        >>(
732            fidl::encoding::FlexibleResult::new(result),
733            self.tx_id,
734            0x524e353c8130cc74,
735            fidl::encoding::DynamicFlags::FLEXIBLE,
736        )
737    }
738}
739
740#[cfg(feature = "driver")]
741#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
742pub struct DriverMarker;
743
744#[cfg(feature = "driver")]
745impl fidl_driver::endpoints::DriverProtocolMarker for DriverMarker {
746    const DEBUG_NAME: &'static str = "(anonymous) Driver";
747}
748pub type DriverStartResult = Result<(), i32>;
749
750/// This protocol is used by the Driver Framework's Driver Host to communicate various messages and
751/// lifecycle hooks to the driver. The connection for this protocol is established through the
752/// |DriverRegistration| defined in the `driver_symbols` library.
753///
754/// Once the driver has closed its server end, the Driver Framework will initiate the shutdown
755/// of all dispatchers belonging to this driver.
756
757#[cfg(feature = "driver")]
758#[derive(Debug)]
759pub enum DriverRequest {
760    /// Starts the driver with the given |start_args|.
761    ///
762    /// Drivers should finish their initial setup and enumeration before returning from |Start|.
763    /// In particular they should enumerate all currently available nodes by utilizing
764    /// `fuchsia.driver.framework/Node.AddChild` and waiting for all calls to be completed.
765    ///
766    /// The Framework will not consider the driver to be started until this call has returned
767    /// successfully. Therefore a driver will not have |Stop| called on it until after it has
768    /// replied to |Start| successfully.
769    ///
770    /// If a driver returns an error, it will not have |Stop| called on it before the
771    /// Driver Framework initiates shutdown of the driver's dispatchers. Therefore it should have
772    /// performed all necessary cleanup before returning an error.
773    Start { start_args: DriverStartArgs, responder: DriverStartResponder },
774    /// Stops the driver. To stop, the driver should teardown any resources it set up in or after
775    /// |Start|. This is a one-way FIDL method. When the driver has completed stopping, it should
776    /// close its server end. Asynchronous operations should fully complete before closing
777    /// the server end.
778    Stop {},
779    /// An interaction was received which does not match any known method.
780    #[non_exhaustive]
781    _UnknownMethod {
782        /// Ordinal of the method that was called.
783        ordinal: u64,
784        method_type: fidl::MethodType,
785    },
786}
787
788#[cfg(feature = "driver")]
789impl DriverRequest {
790    #[allow(irrefutable_let_patterns)]
791    pub fn into_start(self) -> Option<(DriverStartArgs, DriverStartResponder)> {
792        if let DriverRequest::Start { start_args, responder } = self {
793            Some((start_args, responder))
794        } else {
795            None
796        }
797    }
798
799    #[allow(irrefutable_let_patterns)]
800    pub fn into_stop(self) -> Option<()> {
801        if let DriverRequest::Stop {} = self { Some(()) } else { None }
802    }
803
804    pub fn new_start(self, start_args: DriverStartArgs, tx_id: u32) -> Self {
805        Self::Start { start_args, responder: DriverStartResponder { tx_id } }
806    }
807
808    pub fn new_stop(self) -> Self {
809        Self::Stop {}
810    }
811
812    pub fn r#start_as_message(
813        arena: fdf::Arena,
814        mut start_args: DriverStartArgs,
815        tx_id: u32,
816    ) -> Result<fdf::Message<[u8]>, fidl::Error> {
817        let ordinal = 0x27be00ae42aa60c2;
818        let dynamic_flags = fidl::encoding::DynamicFlags::FLEXIBLE;
819        let body = (&mut start_args,);
820        let msg = fidl::encoding::TransactionMessage {
821            header: fidl::encoding::TransactionHeader::new(tx_id, ordinal, dynamic_flags),
822            body,
823        };
824        fidl::encoding::with_tls_encoded::<
825            fidl::encoding::TransactionMessageType<DriverStartRequest>,
826            fidl::encoding::DefaultFuchsiaResourceDialect,
827            fdf::Message<[u8]>,
828        >(msg, |bytes, mut handles| {
829            let handles = arena.insert_from_iter(
830                std::mem::take(handles)
831                    .into_iter()
832                    .map(fidl_driver::encoding::mixed_from_handle_disposition),
833            );
834            Ok(fdf::Message::new(&arena, Some(arena.insert_slice(bytes)), Some(handles)))
835        })
836    }
837
838    pub fn r#stop_as_message(arena: fdf::Arena) -> Result<fdf::Message<[u8]>, fidl::Error> {
839        let tx_id = 0;
840        let ordinal = 0x4b96c67e29b3843d;
841        let dynamic_flags = fidl::encoding::DynamicFlags::FLEXIBLE;
842        let body = ();
843        let msg = fidl::encoding::TransactionMessage {
844            header: fidl::encoding::TransactionHeader::new(tx_id, ordinal, dynamic_flags),
845            body,
846        };
847        fidl::encoding::with_tls_encoded::<
848            fidl::encoding::TransactionMessageType<fidl::encoding::EmptyPayload>,
849            fidl::encoding::DefaultFuchsiaResourceDialect,
850            fdf::Message<[u8]>,
851        >(msg, |bytes, mut handles| {
852            let handles = arena.insert_from_iter(
853                std::mem::take(handles)
854                    .into_iter()
855                    .map(fidl_driver::encoding::mixed_from_handle_disposition),
856            );
857            Ok(fdf::Message::new(&arena, Some(arena.insert_slice(bytes)), Some(handles)))
858        })
859    }
860
861    #[allow(irrefutable_let_patterns)]
862    pub fn read_from(bytes: &[u8], _handles: &mut [zx::HandleInfo]) -> Result<Self, fidl::Error> {
863        let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
864
865        match header.ordinal {
866            0x27be00ae42aa60c2 => {
867                header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
868                let mut req = fidl::new_empty!(
869                    DriverStartRequest,
870                    fidl::encoding::DefaultFuchsiaResourceDialect
871                );
872                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverStartRequest>(&header, _body_bytes, _handles, &mut req)?;
873                Ok(DriverRequest::Start {
874                    start_args: req.start_args,
875
876                    responder: DriverStartResponder { tx_id: header.tx_id },
877                })
878            }
879            0x4b96c67e29b3843d => {
880                header.validate_request_tx_id(fidl::MethodType::OneWay)?;
881                let mut req = fidl::new_empty!(
882                    fidl::encoding::EmptyPayload,
883                    fidl::encoding::DefaultFuchsiaResourceDialect
884                );
885                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, _handles, &mut req)?;
886                Ok(DriverRequest::Stop {})
887            }
888            _ if header.tx_id == 0
889                && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
890            {
891                Ok(DriverRequest::_UnknownMethod {
892                    ordinal: header.ordinal,
893                    method_type: fidl::MethodType::OneWay,
894                })
895            }
896            _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
897                Ok(DriverRequest::_UnknownMethod {
898                    ordinal: header.ordinal,
899                    method_type: fidl::MethodType::TwoWay,
900                })
901            }
902            _ => Err(fidl::Error::UnknownOrdinal {
903                ordinal: header.ordinal,
904                protocol_name:
905                    <DriverMarker as fidl_driver::endpoints::DriverProtocolMarker>::DEBUG_NAME,
906            }),
907        }
908    }
909
910    pub fn read_from_message(
911        mut message: fdf::Message<[u8]>,
912    ) -> Result<(fdf::Arena, Self), fidl::Error> {
913        let (arena, Some(body), Some(handles)) = message.take_arena_boxes() else {
914            return Err(fidl::Error::Invalid);
915        };
916        let mut handles = arena.try_insert_from_iter(
917            handles
918                .into_iter()
919                .map(|handle| unsafe { fidl_driver::encoding::mixed_into_handle_info(handle) }),
920        );
921        let res = match handles {
922            Ok(ref mut handles) => Self::read_from(&*body, handles)?,
923            Err(_) => return Err(fidl::Error::Invalid),
924        };
925        std::mem::drop((body, handles));
926        Ok((message.take_arena(), res))
927    }
928
929    /// Name of the method defined in FIDL
930    pub fn method_name(&self) -> &'static str {
931        match *self {
932            DriverRequest::Start { .. } => "start",
933            DriverRequest::Stop { .. } => "stop",
934            DriverRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
935                "unknown one-way method"
936            }
937            DriverRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
938                "unknown two-way method"
939            }
940        }
941    }
942}
943
944/// Like [`DriverRequest::read_from_message`] except it drops the [`Arena`].
945#[cfg(feature = "driver")]
946impl std::convert::TryFrom<fdf::Message<[u8]>> for DriverRequest {
947    type Error = fidl::Error;
948    fn try_from(msg: fdf::Message<[u8]>) -> Result<DriverRequest, fidl::Error> {
949        Ok(DriverRequest::read_from_message(msg)?.1)
950    }
951}
952
953#[must_use = "FIDL methods require a response to be sent"]
954#[cfg(feature = "driver")]
955#[derive(Debug)]
956pub struct DriverStartResponder {
957    tx_id: u32,
958}
959
960#[cfg(feature = "driver")]
961impl DriverStartResponder {
962    pub fn send_response(
963        &self,
964        server_handle: &fdf::Channel<[u8]>,
965        mut result: Result<(), i32>,
966    ) -> Result<(), fidl::Error> {
967        let msg = fidl::encoding::TransactionMessage {
968            header: fidl::encoding::TransactionHeader::new(
969                self.tx_id,
970                0x27be00ae42aa60c2,
971                fidl::encoding::DynamicFlags::FLEXIBLE,
972            ),
973            body: fidl::encoding::FlexibleResult::new(result),
974        };
975        fidl::encoding::with_tls_encoded::<
976            fidl::encoding::TransactionMessageType<
977                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
978            >,
979            fidl::encoding::DefaultFuchsiaResourceDialect,
980            (),
981        >(msg, |body, _handles| {
982            server_handle
983                .write_with_data(fdf::Arena::new(), |arena| arena.insert_slice(&body))
984                .unwrap();
985            Ok(())
986        })
987    }
988}
989
990#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
991pub struct NodeMarker;
992
993impl fidl::endpoints::ProtocolMarker for NodeMarker {
994    type Proxy = NodeProxy;
995    type RequestStream = NodeRequestStream;
996    #[cfg(target_os = "fuchsia")]
997    type SynchronousProxy = NodeSynchronousProxy;
998
999    const DEBUG_NAME: &'static str = "(anonymous) Node";
1000}
1001pub type NodeAddChildResult = Result<(), NodeError>;
1002
1003pub trait NodeProxyInterface: Send + Sync {
1004    type AddChildResponseFut: std::future::Future<Output = Result<NodeAddChildResult, fidl::Error>>
1005        + Send;
1006    fn r#add_child(
1007        &self,
1008        args: NodeAddArgs,
1009        controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1010        node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1011    ) -> Self::AddChildResponseFut;
1012}
1013#[derive(Debug)]
1014#[cfg(target_os = "fuchsia")]
1015pub struct NodeSynchronousProxy {
1016    client: fidl::client::sync::Client,
1017}
1018
1019#[cfg(target_os = "fuchsia")]
1020impl fidl::endpoints::SynchronousProxy for NodeSynchronousProxy {
1021    type Proxy = NodeProxy;
1022    type Protocol = NodeMarker;
1023
1024    fn from_channel(inner: fidl::Channel) -> Self {
1025        Self::new(inner)
1026    }
1027
1028    fn into_channel(self) -> fidl::Channel {
1029        self.client.into_channel()
1030    }
1031
1032    fn as_channel(&self) -> &fidl::Channel {
1033        self.client.as_channel()
1034    }
1035}
1036
1037#[cfg(target_os = "fuchsia")]
1038impl NodeSynchronousProxy {
1039    pub fn new(channel: fidl::Channel) -> Self {
1040        let protocol_name = <NodeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1041        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1042    }
1043
1044    pub fn into_channel(self) -> fidl::Channel {
1045        self.client.into_channel()
1046    }
1047
1048    /// Waits until an event arrives and returns it. It is safe for other
1049    /// threads to make concurrent requests while waiting for an event.
1050    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<NodeEvent, fidl::Error> {
1051        NodeEvent::decode(self.client.wait_for_event(deadline)?)
1052    }
1053
1054    /// Adds a child node to this node.
1055    ///
1056    /// If `node` is present, this driver takes responsibility for binding to
1057    /// the newly created child. Otherwise, the driver framework will locate an
1058    /// appropriate driver to bind the child to.
1059    pub fn r#add_child(
1060        &self,
1061        mut args: NodeAddArgs,
1062        mut controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1063        mut node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1064        ___deadline: zx::MonotonicInstant,
1065    ) -> Result<NodeAddChildResult, fidl::Error> {
1066        let _response = self.client.send_query::<
1067            NodeAddChildRequest,
1068            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, NodeError>,
1069        >(
1070            (&mut args, controller, node,),
1071            0x77d10dff3c1ea129,
1072            fidl::encoding::DynamicFlags::FLEXIBLE,
1073            ___deadline,
1074        )?
1075        .into_result::<NodeMarker>("add_child")?;
1076        Ok(_response.map(|x| x))
1077    }
1078}
1079
1080#[cfg(target_os = "fuchsia")]
1081impl From<NodeSynchronousProxy> for zx::Handle {
1082    fn from(value: NodeSynchronousProxy) -> Self {
1083        value.into_channel().into()
1084    }
1085}
1086
1087#[cfg(target_os = "fuchsia")]
1088impl From<fidl::Channel> for NodeSynchronousProxy {
1089    fn from(value: fidl::Channel) -> Self {
1090        Self::new(value)
1091    }
1092}
1093
1094#[cfg(target_os = "fuchsia")]
1095impl fidl::endpoints::FromClient for NodeSynchronousProxy {
1096    type Protocol = NodeMarker;
1097
1098    fn from_client(value: fidl::endpoints::ClientEnd<NodeMarker>) -> Self {
1099        Self::new(value.into_channel())
1100    }
1101}
1102
1103#[derive(Debug, Clone)]
1104pub struct NodeProxy {
1105    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1106}
1107
1108impl fidl::endpoints::Proxy for NodeProxy {
1109    type Protocol = NodeMarker;
1110
1111    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1112        Self::new(inner)
1113    }
1114
1115    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1116        self.client.into_channel().map_err(|client| Self { client })
1117    }
1118
1119    fn as_channel(&self) -> &::fidl::AsyncChannel {
1120        self.client.as_channel()
1121    }
1122}
1123
1124impl NodeProxy {
1125    /// Create a new Proxy for fuchsia.driver.framework/Node.
1126    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1127        let protocol_name = <NodeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1128        Self { client: fidl::client::Client::new(channel, protocol_name) }
1129    }
1130
1131    /// Get a Stream of events from the remote end of the protocol.
1132    ///
1133    /// # Panics
1134    ///
1135    /// Panics if the event stream was already taken.
1136    pub fn take_event_stream(&self) -> NodeEventStream {
1137        NodeEventStream { event_receiver: self.client.take_event_receiver() }
1138    }
1139
1140    /// Adds a child node to this node.
1141    ///
1142    /// If `node` is present, this driver takes responsibility for binding to
1143    /// the newly created child. Otherwise, the driver framework will locate an
1144    /// appropriate driver to bind the child to.
1145    pub fn r#add_child(
1146        &self,
1147        mut args: NodeAddArgs,
1148        mut controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1149        mut node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1150    ) -> fidl::client::QueryResponseFut<
1151        NodeAddChildResult,
1152        fidl::encoding::DefaultFuchsiaResourceDialect,
1153    > {
1154        NodeProxyInterface::r#add_child(self, args, controller, node)
1155    }
1156}
1157
1158impl NodeProxyInterface for NodeProxy {
1159    type AddChildResponseFut = fidl::client::QueryResponseFut<
1160        NodeAddChildResult,
1161        fidl::encoding::DefaultFuchsiaResourceDialect,
1162    >;
1163    fn r#add_child(
1164        &self,
1165        mut args: NodeAddArgs,
1166        mut controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1167        mut node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1168    ) -> Self::AddChildResponseFut {
1169        fn _decode(
1170            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1171        ) -> Result<NodeAddChildResult, fidl::Error> {
1172            let _response = fidl::client::decode_transaction_body::<
1173                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, NodeError>,
1174                fidl::encoding::DefaultFuchsiaResourceDialect,
1175                0x77d10dff3c1ea129,
1176            >(_buf?)?
1177            .into_result::<NodeMarker>("add_child")?;
1178            Ok(_response.map(|x| x))
1179        }
1180        self.client.send_query_and_decode::<NodeAddChildRequest, NodeAddChildResult>(
1181            (&mut args, controller, node),
1182            0x77d10dff3c1ea129,
1183            fidl::encoding::DynamicFlags::FLEXIBLE,
1184            _decode,
1185        )
1186    }
1187}
1188
1189pub struct NodeEventStream {
1190    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1191}
1192
1193impl std::marker::Unpin for NodeEventStream {}
1194
1195impl futures::stream::FusedStream for NodeEventStream {
1196    fn is_terminated(&self) -> bool {
1197        self.event_receiver.is_terminated()
1198    }
1199}
1200
1201impl futures::Stream for NodeEventStream {
1202    type Item = Result<NodeEvent, fidl::Error>;
1203
1204    fn poll_next(
1205        mut self: std::pin::Pin<&mut Self>,
1206        cx: &mut std::task::Context<'_>,
1207    ) -> std::task::Poll<Option<Self::Item>> {
1208        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1209            &mut self.event_receiver,
1210            cx
1211        )?) {
1212            Some(buf) => std::task::Poll::Ready(Some(NodeEvent::decode(buf))),
1213            None => std::task::Poll::Ready(None),
1214        }
1215    }
1216}
1217
1218#[derive(Debug)]
1219pub enum NodeEvent {
1220    #[non_exhaustive]
1221    _UnknownEvent {
1222        /// Ordinal of the event that was sent.
1223        ordinal: u64,
1224    },
1225}
1226
1227impl NodeEvent {
1228    /// Decodes a message buffer as a [`NodeEvent`].
1229    fn decode(
1230        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1231    ) -> Result<NodeEvent, fidl::Error> {
1232        let (bytes, _handles) = buf.split_mut();
1233        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1234        debug_assert_eq!(tx_header.tx_id, 0);
1235        match tx_header.ordinal {
1236            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1237                Ok(NodeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1238            }
1239            _ => Err(fidl::Error::UnknownOrdinal {
1240                ordinal: tx_header.ordinal,
1241                protocol_name: <NodeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1242            }),
1243        }
1244    }
1245}
1246
1247/// A Stream of incoming requests for fuchsia.driver.framework/Node.
1248pub struct NodeRequestStream {
1249    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1250    is_terminated: bool,
1251}
1252
1253impl std::marker::Unpin for NodeRequestStream {}
1254
1255impl futures::stream::FusedStream for NodeRequestStream {
1256    fn is_terminated(&self) -> bool {
1257        self.is_terminated
1258    }
1259}
1260
1261impl fidl::endpoints::RequestStream for NodeRequestStream {
1262    type Protocol = NodeMarker;
1263    type ControlHandle = NodeControlHandle;
1264
1265    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1266        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1267    }
1268
1269    fn control_handle(&self) -> Self::ControlHandle {
1270        NodeControlHandle { inner: self.inner.clone() }
1271    }
1272
1273    fn into_inner(
1274        self,
1275    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1276    {
1277        (self.inner, self.is_terminated)
1278    }
1279
1280    fn from_inner(
1281        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1282        is_terminated: bool,
1283    ) -> Self {
1284        Self { inner, is_terminated }
1285    }
1286}
1287
1288impl futures::Stream for NodeRequestStream {
1289    type Item = Result<NodeRequest, fidl::Error>;
1290
1291    fn poll_next(
1292        mut self: std::pin::Pin<&mut Self>,
1293        cx: &mut std::task::Context<'_>,
1294    ) -> std::task::Poll<Option<Self::Item>> {
1295        let this = &mut *self;
1296        if this.inner.check_shutdown(cx) {
1297            this.is_terminated = true;
1298            return std::task::Poll::Ready(None);
1299        }
1300        if this.is_terminated {
1301            panic!("polled NodeRequestStream after completion");
1302        }
1303        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1304            |bytes, handles| {
1305                match this.inner.channel().read_etc(cx, bytes, handles) {
1306                    std::task::Poll::Ready(Ok(())) => {}
1307                    std::task::Poll::Pending => return std::task::Poll::Pending,
1308                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1309                        this.is_terminated = true;
1310                        return std::task::Poll::Ready(None);
1311                    }
1312                    std::task::Poll::Ready(Err(e)) => {
1313                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1314                            e.into(),
1315                        ))));
1316                    }
1317                }
1318
1319                // A message has been received from the channel
1320                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1321
1322                std::task::Poll::Ready(Some(match header.ordinal {
1323                    0x77d10dff3c1ea129 => {
1324                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1325                        let mut req = fidl::new_empty!(
1326                            NodeAddChildRequest,
1327                            fidl::encoding::DefaultFuchsiaResourceDialect
1328                        );
1329                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
1330                        let control_handle = NodeControlHandle { inner: this.inner.clone() };
1331                        Ok(NodeRequest::AddChild {
1332                            args: req.args,
1333                            controller: req.controller,
1334                            node: req.node,
1335
1336                            responder: NodeAddChildResponder {
1337                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1338                                tx_id: header.tx_id,
1339                            },
1340                        })
1341                    }
1342                    _ if header.tx_id == 0
1343                        && header
1344                            .dynamic_flags()
1345                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1346                    {
1347                        Ok(NodeRequest::_UnknownMethod {
1348                            ordinal: header.ordinal,
1349                            control_handle: NodeControlHandle { inner: this.inner.clone() },
1350                            method_type: fidl::MethodType::OneWay,
1351                        })
1352                    }
1353                    _ if header
1354                        .dynamic_flags()
1355                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1356                    {
1357                        this.inner.send_framework_err(
1358                            fidl::encoding::FrameworkErr::UnknownMethod,
1359                            header.tx_id,
1360                            header.ordinal,
1361                            header.dynamic_flags(),
1362                            (bytes, handles),
1363                        )?;
1364                        Ok(NodeRequest::_UnknownMethod {
1365                            ordinal: header.ordinal,
1366                            control_handle: NodeControlHandle { inner: this.inner.clone() },
1367                            method_type: fidl::MethodType::TwoWay,
1368                        })
1369                    }
1370                    _ => Err(fidl::Error::UnknownOrdinal {
1371                        ordinal: header.ordinal,
1372                        protocol_name: <NodeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1373                    }),
1374                }))
1375            },
1376        )
1377    }
1378}
1379
1380/// Protocol through which a driver manages a node that it is bound to.
1381/// Drivers should maintain their client connection to the node. Dropping
1382/// the client connection while the driver is running will cause the
1383/// driver framework to remove the driver and node from the topology.
1384/// If the driver has set `host_restart_on_crash` to "true" in their
1385/// component manifest, dropping the connection will initiate a restart of
1386/// the driver host and driver.
1387#[derive(Debug)]
1388pub enum NodeRequest {
1389    /// Adds a child node to this node.
1390    ///
1391    /// If `node` is present, this driver takes responsibility for binding to
1392    /// the newly created child. Otherwise, the driver framework will locate an
1393    /// appropriate driver to bind the child to.
1394    AddChild {
1395        args: NodeAddArgs,
1396        controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1397        node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1398        responder: NodeAddChildResponder,
1399    },
1400    /// An interaction was received which does not match any known method.
1401    #[non_exhaustive]
1402    _UnknownMethod {
1403        /// Ordinal of the method that was called.
1404        ordinal: u64,
1405        control_handle: NodeControlHandle,
1406        method_type: fidl::MethodType,
1407    },
1408}
1409
1410impl NodeRequest {
1411    #[allow(irrefutable_let_patterns)]
1412    pub fn into_add_child(
1413        self,
1414    ) -> Option<(
1415        NodeAddArgs,
1416        fidl::endpoints::ServerEnd<NodeControllerMarker>,
1417        Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1418        NodeAddChildResponder,
1419    )> {
1420        if let NodeRequest::AddChild { args, controller, node, responder } = self {
1421            Some((args, controller, node, responder))
1422        } else {
1423            None
1424        }
1425    }
1426
1427    /// Name of the method defined in FIDL
1428    pub fn method_name(&self) -> &'static str {
1429        match *self {
1430            NodeRequest::AddChild { .. } => "add_child",
1431            NodeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1432                "unknown one-way method"
1433            }
1434            NodeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1435                "unknown two-way method"
1436            }
1437        }
1438    }
1439}
1440
1441#[derive(Debug, Clone)]
1442pub struct NodeControlHandle {
1443    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1444}
1445
1446impl fidl::endpoints::ControlHandle for NodeControlHandle {
1447    fn shutdown(&self) {
1448        self.inner.shutdown()
1449    }
1450    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1451        self.inner.shutdown_with_epitaph(status)
1452    }
1453
1454    fn is_closed(&self) -> bool {
1455        self.inner.channel().is_closed()
1456    }
1457    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1458        self.inner.channel().on_closed()
1459    }
1460
1461    #[cfg(target_os = "fuchsia")]
1462    fn signal_peer(
1463        &self,
1464        clear_mask: zx::Signals,
1465        set_mask: zx::Signals,
1466    ) -> Result<(), zx_status::Status> {
1467        use fidl::Peered;
1468        self.inner.channel().signal_peer(clear_mask, set_mask)
1469    }
1470}
1471
1472impl NodeControlHandle {}
1473
1474#[must_use = "FIDL methods require a response to be sent"]
1475#[derive(Debug)]
1476pub struct NodeAddChildResponder {
1477    control_handle: std::mem::ManuallyDrop<NodeControlHandle>,
1478    tx_id: u32,
1479}
1480
1481/// Set the the channel to be shutdown (see [`NodeControlHandle::shutdown`])
1482/// if the responder is dropped without sending a response, so that the client
1483/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1484impl std::ops::Drop for NodeAddChildResponder {
1485    fn drop(&mut self) {
1486        self.control_handle.shutdown();
1487        // Safety: drops once, never accessed again
1488        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1489    }
1490}
1491
1492impl fidl::endpoints::Responder for NodeAddChildResponder {
1493    type ControlHandle = NodeControlHandle;
1494
1495    fn control_handle(&self) -> &NodeControlHandle {
1496        &self.control_handle
1497    }
1498
1499    fn drop_without_shutdown(mut self) {
1500        // Safety: drops once, never accessed again due to mem::forget
1501        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1502        // Prevent Drop from running (which would shut down the channel)
1503        std::mem::forget(self);
1504    }
1505}
1506
1507impl NodeAddChildResponder {
1508    /// Sends a response to the FIDL transaction.
1509    ///
1510    /// Sets the channel to shutdown if an error occurs.
1511    pub fn send(self, mut result: Result<(), NodeError>) -> Result<(), fidl::Error> {
1512        let _result = self.send_raw(result);
1513        if _result.is_err() {
1514            self.control_handle.shutdown();
1515        }
1516        self.drop_without_shutdown();
1517        _result
1518    }
1519
1520    /// Similar to "send" but does not shutdown the channel if an error occurs.
1521    pub fn send_no_shutdown_on_err(
1522        self,
1523        mut result: Result<(), NodeError>,
1524    ) -> Result<(), fidl::Error> {
1525        let _result = self.send_raw(result);
1526        self.drop_without_shutdown();
1527        _result
1528    }
1529
1530    fn send_raw(&self, mut result: Result<(), NodeError>) -> Result<(), fidl::Error> {
1531        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1532            fidl::encoding::EmptyStruct,
1533            NodeError,
1534        >>(
1535            fidl::encoding::FlexibleResult::new(result),
1536            self.tx_id,
1537            0x77d10dff3c1ea129,
1538            fidl::encoding::DynamicFlags::FLEXIBLE,
1539        )
1540    }
1541}
1542
1543#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1544pub struct NodeControllerMarker;
1545
1546impl fidl::endpoints::ProtocolMarker for NodeControllerMarker {
1547    type Proxy = NodeControllerProxy;
1548    type RequestStream = NodeControllerRequestStream;
1549    #[cfg(target_os = "fuchsia")]
1550    type SynchronousProxy = NodeControllerSynchronousProxy;
1551
1552    const DEBUG_NAME: &'static str = "(anonymous) NodeController";
1553}
1554pub type NodeControllerRequestBindResult = Result<(), i32>;
1555pub type NodeControllerWaitForDriverResult = Result<DriverResult, i32>;
1556
1557pub trait NodeControllerProxyInterface: Send + Sync {
1558    fn r#remove(&self) -> Result<(), fidl::Error>;
1559    type RequestBindResponseFut: std::future::Future<Output = Result<NodeControllerRequestBindResult, fidl::Error>>
1560        + Send;
1561    fn r#request_bind(
1562        &self,
1563        payload: &NodeControllerRequestBindRequest,
1564    ) -> Self::RequestBindResponseFut;
1565    type WaitForDriverResponseFut: std::future::Future<Output = Result<NodeControllerWaitForDriverResult, fidl::Error>>
1566        + Send;
1567    fn r#wait_for_driver(&self) -> Self::WaitForDriverResponseFut;
1568}
1569#[derive(Debug)]
1570#[cfg(target_os = "fuchsia")]
1571pub struct NodeControllerSynchronousProxy {
1572    client: fidl::client::sync::Client,
1573}
1574
1575#[cfg(target_os = "fuchsia")]
1576impl fidl::endpoints::SynchronousProxy for NodeControllerSynchronousProxy {
1577    type Proxy = NodeControllerProxy;
1578    type Protocol = NodeControllerMarker;
1579
1580    fn from_channel(inner: fidl::Channel) -> Self {
1581        Self::new(inner)
1582    }
1583
1584    fn into_channel(self) -> fidl::Channel {
1585        self.client.into_channel()
1586    }
1587
1588    fn as_channel(&self) -> &fidl::Channel {
1589        self.client.as_channel()
1590    }
1591}
1592
1593#[cfg(target_os = "fuchsia")]
1594impl NodeControllerSynchronousProxy {
1595    pub fn new(channel: fidl::Channel) -> Self {
1596        let protocol_name = <NodeControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1597        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1598    }
1599
1600    pub fn into_channel(self) -> fidl::Channel {
1601        self.client.into_channel()
1602    }
1603
1604    /// Waits until an event arrives and returns it. It is safe for other
1605    /// threads to make concurrent requests while waiting for an event.
1606    pub fn wait_for_event(
1607        &self,
1608        deadline: zx::MonotonicInstant,
1609    ) -> Result<NodeControllerEvent, fidl::Error> {
1610        NodeControllerEvent::decode(self.client.wait_for_event(deadline)?)
1611    }
1612
1613    /// Removes the node and all of its children.
1614    pub fn r#remove(&self) -> Result<(), fidl::Error> {
1615        self.client.send::<fidl::encoding::EmptyPayload>(
1616            (),
1617            0x54fa8b3dfe7bb341,
1618            fidl::encoding::DynamicFlags::FLEXIBLE,
1619        )
1620    }
1621
1622    /// Request that the framework attempts to bind a driver to this node.
1623    /// This is an *additional* request for binding as the framework attempts to bind a node once
1624    /// when the node is created.
1625    /// * error `ZX_ERR_ALREADY_BOUND` if the node is already bound and `force_rebind` is false.
1626    /// * error `ZX_ERR_ALREADY_EXISTS` if the node has an outstanding |RequestBind| call which has
1627    /// not completed.
1628    pub fn r#request_bind(
1629        &self,
1630        mut payload: &NodeControllerRequestBindRequest,
1631        ___deadline: zx::MonotonicInstant,
1632    ) -> Result<NodeControllerRequestBindResult, fidl::Error> {
1633        let _response = self.client.send_query::<
1634            NodeControllerRequestBindRequest,
1635            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1636        >(
1637            payload,
1638            0x41b954726b13508f,
1639            fidl::encoding::DynamicFlags::FLEXIBLE,
1640            ___deadline,
1641        )?
1642        .into_result::<NodeControllerMarker>("request_bind")?;
1643        Ok(_response.map(|x| x))
1644    }
1645
1646    /// Hanging get style call that returns a terminal state for the associated `Node`,
1647    /// or the composite node that is parented by this node.
1648    /// For a successfully started driver this returns immediately with the token of the
1649    /// node that the driver started on.
1650    /// If an error happens we wait until bootup is complete, which is when all drivers that
1651    /// can bind and start have done so, before returning the error.
1652    pub fn r#wait_for_driver(
1653        &self,
1654        ___deadline: zx::MonotonicInstant,
1655    ) -> Result<NodeControllerWaitForDriverResult, fidl::Error> {
1656        let _response = self.client.send_query::<
1657            fidl::encoding::EmptyPayload,
1658            fidl::encoding::FlexibleResultType<DriverResult, i32>,
1659        >(
1660            (),
1661            0x69f7106e47d81387,
1662            fidl::encoding::DynamicFlags::FLEXIBLE,
1663            ___deadline,
1664        )?
1665        .into_result::<NodeControllerMarker>("wait_for_driver")?;
1666        Ok(_response.map(|x| x))
1667    }
1668}
1669
1670#[cfg(target_os = "fuchsia")]
1671impl From<NodeControllerSynchronousProxy> for zx::Handle {
1672    fn from(value: NodeControllerSynchronousProxy) -> Self {
1673        value.into_channel().into()
1674    }
1675}
1676
1677#[cfg(target_os = "fuchsia")]
1678impl From<fidl::Channel> for NodeControllerSynchronousProxy {
1679    fn from(value: fidl::Channel) -> Self {
1680        Self::new(value)
1681    }
1682}
1683
1684#[cfg(target_os = "fuchsia")]
1685impl fidl::endpoints::FromClient for NodeControllerSynchronousProxy {
1686    type Protocol = NodeControllerMarker;
1687
1688    fn from_client(value: fidl::endpoints::ClientEnd<NodeControllerMarker>) -> Self {
1689        Self::new(value.into_channel())
1690    }
1691}
1692
1693#[derive(Debug, Clone)]
1694pub struct NodeControllerProxy {
1695    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1696}
1697
1698impl fidl::endpoints::Proxy for NodeControllerProxy {
1699    type Protocol = NodeControllerMarker;
1700
1701    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1702        Self::new(inner)
1703    }
1704
1705    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1706        self.client.into_channel().map_err(|client| Self { client })
1707    }
1708
1709    fn as_channel(&self) -> &::fidl::AsyncChannel {
1710        self.client.as_channel()
1711    }
1712}
1713
1714impl NodeControllerProxy {
1715    /// Create a new Proxy for fuchsia.driver.framework/NodeController.
1716    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1717        let protocol_name = <NodeControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1718        Self { client: fidl::client::Client::new(channel, protocol_name) }
1719    }
1720
1721    /// Get a Stream of events from the remote end of the protocol.
1722    ///
1723    /// # Panics
1724    ///
1725    /// Panics if the event stream was already taken.
1726    pub fn take_event_stream(&self) -> NodeControllerEventStream {
1727        NodeControllerEventStream { event_receiver: self.client.take_event_receiver() }
1728    }
1729
1730    /// Removes the node and all of its children.
1731    pub fn r#remove(&self) -> Result<(), fidl::Error> {
1732        NodeControllerProxyInterface::r#remove(self)
1733    }
1734
1735    /// Request that the framework attempts to bind a driver to this node.
1736    /// This is an *additional* request for binding as the framework attempts to bind a node once
1737    /// when the node is created.
1738    /// * error `ZX_ERR_ALREADY_BOUND` if the node is already bound and `force_rebind` is false.
1739    /// * error `ZX_ERR_ALREADY_EXISTS` if the node has an outstanding |RequestBind| call which has
1740    /// not completed.
1741    pub fn r#request_bind(
1742        &self,
1743        mut payload: &NodeControllerRequestBindRequest,
1744    ) -> fidl::client::QueryResponseFut<
1745        NodeControllerRequestBindResult,
1746        fidl::encoding::DefaultFuchsiaResourceDialect,
1747    > {
1748        NodeControllerProxyInterface::r#request_bind(self, payload)
1749    }
1750
1751    /// Hanging get style call that returns a terminal state for the associated `Node`,
1752    /// or the composite node that is parented by this node.
1753    /// For a successfully started driver this returns immediately with the token of the
1754    /// node that the driver started on.
1755    /// If an error happens we wait until bootup is complete, which is when all drivers that
1756    /// can bind and start have done so, before returning the error.
1757    pub fn r#wait_for_driver(
1758        &self,
1759    ) -> fidl::client::QueryResponseFut<
1760        NodeControllerWaitForDriverResult,
1761        fidl::encoding::DefaultFuchsiaResourceDialect,
1762    > {
1763        NodeControllerProxyInterface::r#wait_for_driver(self)
1764    }
1765}
1766
1767impl NodeControllerProxyInterface for NodeControllerProxy {
1768    fn r#remove(&self) -> Result<(), fidl::Error> {
1769        self.client.send::<fidl::encoding::EmptyPayload>(
1770            (),
1771            0x54fa8b3dfe7bb341,
1772            fidl::encoding::DynamicFlags::FLEXIBLE,
1773        )
1774    }
1775
1776    type RequestBindResponseFut = fidl::client::QueryResponseFut<
1777        NodeControllerRequestBindResult,
1778        fidl::encoding::DefaultFuchsiaResourceDialect,
1779    >;
1780    fn r#request_bind(
1781        &self,
1782        mut payload: &NodeControllerRequestBindRequest,
1783    ) -> Self::RequestBindResponseFut {
1784        fn _decode(
1785            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1786        ) -> Result<NodeControllerRequestBindResult, fidl::Error> {
1787            let _response = fidl::client::decode_transaction_body::<
1788                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1789                fidl::encoding::DefaultFuchsiaResourceDialect,
1790                0x41b954726b13508f,
1791            >(_buf?)?
1792            .into_result::<NodeControllerMarker>("request_bind")?;
1793            Ok(_response.map(|x| x))
1794        }
1795        self.client.send_query_and_decode::<
1796            NodeControllerRequestBindRequest,
1797            NodeControllerRequestBindResult,
1798        >(
1799            payload,
1800            0x41b954726b13508f,
1801            fidl::encoding::DynamicFlags::FLEXIBLE,
1802            _decode,
1803        )
1804    }
1805
1806    type WaitForDriverResponseFut = fidl::client::QueryResponseFut<
1807        NodeControllerWaitForDriverResult,
1808        fidl::encoding::DefaultFuchsiaResourceDialect,
1809    >;
1810    fn r#wait_for_driver(&self) -> Self::WaitForDriverResponseFut {
1811        fn _decode(
1812            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1813        ) -> Result<NodeControllerWaitForDriverResult, fidl::Error> {
1814            let _response = fidl::client::decode_transaction_body::<
1815                fidl::encoding::FlexibleResultType<DriverResult, i32>,
1816                fidl::encoding::DefaultFuchsiaResourceDialect,
1817                0x69f7106e47d81387,
1818            >(_buf?)?
1819            .into_result::<NodeControllerMarker>("wait_for_driver")?;
1820            Ok(_response.map(|x| x))
1821        }
1822        self.client.send_query_and_decode::<
1823            fidl::encoding::EmptyPayload,
1824            NodeControllerWaitForDriverResult,
1825        >(
1826            (),
1827            0x69f7106e47d81387,
1828            fidl::encoding::DynamicFlags::FLEXIBLE,
1829            _decode,
1830        )
1831    }
1832}
1833
1834pub struct NodeControllerEventStream {
1835    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1836}
1837
1838impl std::marker::Unpin for NodeControllerEventStream {}
1839
1840impl futures::stream::FusedStream for NodeControllerEventStream {
1841    fn is_terminated(&self) -> bool {
1842        self.event_receiver.is_terminated()
1843    }
1844}
1845
1846impl futures::Stream for NodeControllerEventStream {
1847    type Item = Result<NodeControllerEvent, fidl::Error>;
1848
1849    fn poll_next(
1850        mut self: std::pin::Pin<&mut Self>,
1851        cx: &mut std::task::Context<'_>,
1852    ) -> std::task::Poll<Option<Self::Item>> {
1853        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1854            &mut self.event_receiver,
1855            cx
1856        )?) {
1857            Some(buf) => std::task::Poll::Ready(Some(NodeControllerEvent::decode(buf))),
1858            None => std::task::Poll::Ready(None),
1859        }
1860    }
1861}
1862
1863#[derive(Debug)]
1864pub enum NodeControllerEvent {
1865    OnBind {
1866        payload: NodeControllerOnBindRequest,
1867    },
1868    #[non_exhaustive]
1869    _UnknownEvent {
1870        /// Ordinal of the event that was sent.
1871        ordinal: u64,
1872    },
1873}
1874
1875impl NodeControllerEvent {
1876    #[allow(irrefutable_let_patterns)]
1877    pub fn into_on_bind(self) -> Option<NodeControllerOnBindRequest> {
1878        if let NodeControllerEvent::OnBind { payload } = self { Some((payload)) } else { None }
1879    }
1880
1881    /// Decodes a message buffer as a [`NodeControllerEvent`].
1882    fn decode(
1883        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1884    ) -> Result<NodeControllerEvent, fidl::Error> {
1885        let (bytes, _handles) = buf.split_mut();
1886        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1887        debug_assert_eq!(tx_header.tx_id, 0);
1888        match tx_header.ordinal {
1889            0x51f4165bc5ea202a => {
1890                let mut out = fidl::new_empty!(
1891                    NodeControllerOnBindRequest,
1892                    fidl::encoding::DefaultFuchsiaResourceDialect
1893                );
1894                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeControllerOnBindRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1895                Ok((NodeControllerEvent::OnBind { payload: out }))
1896            }
1897            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1898                Ok(NodeControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1899            }
1900            _ => Err(fidl::Error::UnknownOrdinal {
1901                ordinal: tx_header.ordinal,
1902                protocol_name:
1903                    <NodeControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1904            }),
1905        }
1906    }
1907}
1908
1909/// A Stream of incoming requests for fuchsia.driver.framework/NodeController.
1910pub struct NodeControllerRequestStream {
1911    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1912    is_terminated: bool,
1913}
1914
1915impl std::marker::Unpin for NodeControllerRequestStream {}
1916
1917impl futures::stream::FusedStream for NodeControllerRequestStream {
1918    fn is_terminated(&self) -> bool {
1919        self.is_terminated
1920    }
1921}
1922
1923impl fidl::endpoints::RequestStream for NodeControllerRequestStream {
1924    type Protocol = NodeControllerMarker;
1925    type ControlHandle = NodeControllerControlHandle;
1926
1927    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1928        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1929    }
1930
1931    fn control_handle(&self) -> Self::ControlHandle {
1932        NodeControllerControlHandle { inner: self.inner.clone() }
1933    }
1934
1935    fn into_inner(
1936        self,
1937    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1938    {
1939        (self.inner, self.is_terminated)
1940    }
1941
1942    fn from_inner(
1943        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1944        is_terminated: bool,
1945    ) -> Self {
1946        Self { inner, is_terminated }
1947    }
1948}
1949
1950impl futures::Stream for NodeControllerRequestStream {
1951    type Item = Result<NodeControllerRequest, fidl::Error>;
1952
1953    fn poll_next(
1954        mut self: std::pin::Pin<&mut Self>,
1955        cx: &mut std::task::Context<'_>,
1956    ) -> std::task::Poll<Option<Self::Item>> {
1957        let this = &mut *self;
1958        if this.inner.check_shutdown(cx) {
1959            this.is_terminated = true;
1960            return std::task::Poll::Ready(None);
1961        }
1962        if this.is_terminated {
1963            panic!("polled NodeControllerRequestStream after completion");
1964        }
1965        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1966            |bytes, handles| {
1967                match this.inner.channel().read_etc(cx, bytes, handles) {
1968                    std::task::Poll::Ready(Ok(())) => {}
1969                    std::task::Poll::Pending => return std::task::Poll::Pending,
1970                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1971                        this.is_terminated = true;
1972                        return std::task::Poll::Ready(None);
1973                    }
1974                    std::task::Poll::Ready(Err(e)) => {
1975                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1976                            e.into(),
1977                        ))));
1978                    }
1979                }
1980
1981                // A message has been received from the channel
1982                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1983
1984                std::task::Poll::Ready(Some(match header.ordinal {
1985                    0x54fa8b3dfe7bb341 => {
1986                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1987                        let mut req = fidl::new_empty!(
1988                            fidl::encoding::EmptyPayload,
1989                            fidl::encoding::DefaultFuchsiaResourceDialect
1990                        );
1991                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1992                        let control_handle =
1993                            NodeControllerControlHandle { inner: this.inner.clone() };
1994                        Ok(NodeControllerRequest::Remove { control_handle })
1995                    }
1996                    0x41b954726b13508f => {
1997                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1998                        let mut req = fidl::new_empty!(
1999                            NodeControllerRequestBindRequest,
2000                            fidl::encoding::DefaultFuchsiaResourceDialect
2001                        );
2002                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeControllerRequestBindRequest>(&header, _body_bytes, handles, &mut req)?;
2003                        let control_handle =
2004                            NodeControllerControlHandle { inner: this.inner.clone() };
2005                        Ok(NodeControllerRequest::RequestBind {
2006                            payload: req,
2007                            responder: NodeControllerRequestBindResponder {
2008                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2009                                tx_id: header.tx_id,
2010                            },
2011                        })
2012                    }
2013                    0x69f7106e47d81387 => {
2014                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2015                        let mut req = fidl::new_empty!(
2016                            fidl::encoding::EmptyPayload,
2017                            fidl::encoding::DefaultFuchsiaResourceDialect
2018                        );
2019                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2020                        let control_handle =
2021                            NodeControllerControlHandle { inner: this.inner.clone() };
2022                        Ok(NodeControllerRequest::WaitForDriver {
2023                            responder: NodeControllerWaitForDriverResponder {
2024                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2025                                tx_id: header.tx_id,
2026                            },
2027                        })
2028                    }
2029                    _ if header.tx_id == 0
2030                        && header
2031                            .dynamic_flags()
2032                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2033                    {
2034                        Ok(NodeControllerRequest::_UnknownMethod {
2035                            ordinal: header.ordinal,
2036                            control_handle: NodeControllerControlHandle {
2037                                inner: this.inner.clone(),
2038                            },
2039                            method_type: fidl::MethodType::OneWay,
2040                        })
2041                    }
2042                    _ if header
2043                        .dynamic_flags()
2044                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2045                    {
2046                        this.inner.send_framework_err(
2047                            fidl::encoding::FrameworkErr::UnknownMethod,
2048                            header.tx_id,
2049                            header.ordinal,
2050                            header.dynamic_flags(),
2051                            (bytes, handles),
2052                        )?;
2053                        Ok(NodeControllerRequest::_UnknownMethod {
2054                            ordinal: header.ordinal,
2055                            control_handle: NodeControllerControlHandle {
2056                                inner: this.inner.clone(),
2057                            },
2058                            method_type: fidl::MethodType::TwoWay,
2059                        })
2060                    }
2061                    _ => Err(fidl::Error::UnknownOrdinal {
2062                        ordinal: header.ordinal,
2063                        protocol_name:
2064                            <NodeControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2065                    }),
2066                }))
2067            },
2068        )
2069    }
2070}
2071
2072/// Protocol through which a parent node controls one of its children.
2073#[derive(Debug)]
2074pub enum NodeControllerRequest {
2075    /// Removes the node and all of its children.
2076    Remove { control_handle: NodeControllerControlHandle },
2077    /// Request that the framework attempts to bind a driver to this node.
2078    /// This is an *additional* request for binding as the framework attempts to bind a node once
2079    /// when the node is created.
2080    /// * error `ZX_ERR_ALREADY_BOUND` if the node is already bound and `force_rebind` is false.
2081    /// * error `ZX_ERR_ALREADY_EXISTS` if the node has an outstanding |RequestBind| call which has
2082    /// not completed.
2083    RequestBind {
2084        payload: NodeControllerRequestBindRequest,
2085        responder: NodeControllerRequestBindResponder,
2086    },
2087    /// Hanging get style call that returns a terminal state for the associated `Node`,
2088    /// or the composite node that is parented by this node.
2089    /// For a successfully started driver this returns immediately with the token of the
2090    /// node that the driver started on.
2091    /// If an error happens we wait until bootup is complete, which is when all drivers that
2092    /// can bind and start have done so, before returning the error.
2093    WaitForDriver { responder: NodeControllerWaitForDriverResponder },
2094    /// An interaction was received which does not match any known method.
2095    #[non_exhaustive]
2096    _UnknownMethod {
2097        /// Ordinal of the method that was called.
2098        ordinal: u64,
2099        control_handle: NodeControllerControlHandle,
2100        method_type: fidl::MethodType,
2101    },
2102}
2103
2104impl NodeControllerRequest {
2105    #[allow(irrefutable_let_patterns)]
2106    pub fn into_remove(self) -> Option<(NodeControllerControlHandle)> {
2107        if let NodeControllerRequest::Remove { control_handle } = self {
2108            Some((control_handle))
2109        } else {
2110            None
2111        }
2112    }
2113
2114    #[allow(irrefutable_let_patterns)]
2115    pub fn into_request_bind(
2116        self,
2117    ) -> Option<(NodeControllerRequestBindRequest, NodeControllerRequestBindResponder)> {
2118        if let NodeControllerRequest::RequestBind { payload, responder } = self {
2119            Some((payload, responder))
2120        } else {
2121            None
2122        }
2123    }
2124
2125    #[allow(irrefutable_let_patterns)]
2126    pub fn into_wait_for_driver(self) -> Option<(NodeControllerWaitForDriverResponder)> {
2127        if let NodeControllerRequest::WaitForDriver { responder } = self {
2128            Some((responder))
2129        } else {
2130            None
2131        }
2132    }
2133
2134    /// Name of the method defined in FIDL
2135    pub fn method_name(&self) -> &'static str {
2136        match *self {
2137            NodeControllerRequest::Remove { .. } => "remove",
2138            NodeControllerRequest::RequestBind { .. } => "request_bind",
2139            NodeControllerRequest::WaitForDriver { .. } => "wait_for_driver",
2140            NodeControllerRequest::_UnknownMethod {
2141                method_type: fidl::MethodType::OneWay, ..
2142            } => "unknown one-way method",
2143            NodeControllerRequest::_UnknownMethod {
2144                method_type: fidl::MethodType::TwoWay, ..
2145            } => "unknown two-way method",
2146        }
2147    }
2148}
2149
2150#[derive(Debug, Clone)]
2151pub struct NodeControllerControlHandle {
2152    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2153}
2154
2155impl fidl::endpoints::ControlHandle for NodeControllerControlHandle {
2156    fn shutdown(&self) {
2157        self.inner.shutdown()
2158    }
2159    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2160        self.inner.shutdown_with_epitaph(status)
2161    }
2162
2163    fn is_closed(&self) -> bool {
2164        self.inner.channel().is_closed()
2165    }
2166    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2167        self.inner.channel().on_closed()
2168    }
2169
2170    #[cfg(target_os = "fuchsia")]
2171    fn signal_peer(
2172        &self,
2173        clear_mask: zx::Signals,
2174        set_mask: zx::Signals,
2175    ) -> Result<(), zx_status::Status> {
2176        use fidl::Peered;
2177        self.inner.channel().signal_peer(clear_mask, set_mask)
2178    }
2179}
2180
2181impl NodeControllerControlHandle {
2182    pub fn send_on_bind(
2183        &self,
2184        mut payload: NodeControllerOnBindRequest,
2185    ) -> Result<(), fidl::Error> {
2186        self.inner.send::<NodeControllerOnBindRequest>(
2187            &mut payload,
2188            0,
2189            0x51f4165bc5ea202a,
2190            fidl::encoding::DynamicFlags::FLEXIBLE,
2191        )
2192    }
2193}
2194
2195#[must_use = "FIDL methods require a response to be sent"]
2196#[derive(Debug)]
2197pub struct NodeControllerRequestBindResponder {
2198    control_handle: std::mem::ManuallyDrop<NodeControllerControlHandle>,
2199    tx_id: u32,
2200}
2201
2202/// Set the the channel to be shutdown (see [`NodeControllerControlHandle::shutdown`])
2203/// if the responder is dropped without sending a response, so that the client
2204/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2205impl std::ops::Drop for NodeControllerRequestBindResponder {
2206    fn drop(&mut self) {
2207        self.control_handle.shutdown();
2208        // Safety: drops once, never accessed again
2209        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2210    }
2211}
2212
2213impl fidl::endpoints::Responder for NodeControllerRequestBindResponder {
2214    type ControlHandle = NodeControllerControlHandle;
2215
2216    fn control_handle(&self) -> &NodeControllerControlHandle {
2217        &self.control_handle
2218    }
2219
2220    fn drop_without_shutdown(mut self) {
2221        // Safety: drops once, never accessed again due to mem::forget
2222        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2223        // Prevent Drop from running (which would shut down the channel)
2224        std::mem::forget(self);
2225    }
2226}
2227
2228impl NodeControllerRequestBindResponder {
2229    /// Sends a response to the FIDL transaction.
2230    ///
2231    /// Sets the channel to shutdown if an error occurs.
2232    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2233        let _result = self.send_raw(result);
2234        if _result.is_err() {
2235            self.control_handle.shutdown();
2236        }
2237        self.drop_without_shutdown();
2238        _result
2239    }
2240
2241    /// Similar to "send" but does not shutdown the channel if an error occurs.
2242    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2243        let _result = self.send_raw(result);
2244        self.drop_without_shutdown();
2245        _result
2246    }
2247
2248    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2249        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2250            fidl::encoding::EmptyStruct,
2251            i32,
2252        >>(
2253            fidl::encoding::FlexibleResult::new(result),
2254            self.tx_id,
2255            0x41b954726b13508f,
2256            fidl::encoding::DynamicFlags::FLEXIBLE,
2257        )
2258    }
2259}
2260
2261#[must_use = "FIDL methods require a response to be sent"]
2262#[derive(Debug)]
2263pub struct NodeControllerWaitForDriverResponder {
2264    control_handle: std::mem::ManuallyDrop<NodeControllerControlHandle>,
2265    tx_id: u32,
2266}
2267
2268/// Set the the channel to be shutdown (see [`NodeControllerControlHandle::shutdown`])
2269/// if the responder is dropped without sending a response, so that the client
2270/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2271impl std::ops::Drop for NodeControllerWaitForDriverResponder {
2272    fn drop(&mut self) {
2273        self.control_handle.shutdown();
2274        // Safety: drops once, never accessed again
2275        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2276    }
2277}
2278
2279impl fidl::endpoints::Responder for NodeControllerWaitForDriverResponder {
2280    type ControlHandle = NodeControllerControlHandle;
2281
2282    fn control_handle(&self) -> &NodeControllerControlHandle {
2283        &self.control_handle
2284    }
2285
2286    fn drop_without_shutdown(mut self) {
2287        // Safety: drops once, never accessed again due to mem::forget
2288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2289        // Prevent Drop from running (which would shut down the channel)
2290        std::mem::forget(self);
2291    }
2292}
2293
2294impl NodeControllerWaitForDriverResponder {
2295    /// Sends a response to the FIDL transaction.
2296    ///
2297    /// Sets the channel to shutdown if an error occurs.
2298    pub fn send(self, mut result: Result<DriverResult, i32>) -> Result<(), fidl::Error> {
2299        let _result = self.send_raw(result);
2300        if _result.is_err() {
2301            self.control_handle.shutdown();
2302        }
2303        self.drop_without_shutdown();
2304        _result
2305    }
2306
2307    /// Similar to "send" but does not shutdown the channel if an error occurs.
2308    pub fn send_no_shutdown_on_err(
2309        self,
2310        mut result: Result<DriverResult, i32>,
2311    ) -> Result<(), fidl::Error> {
2312        let _result = self.send_raw(result);
2313        self.drop_without_shutdown();
2314        _result
2315    }
2316
2317    fn send_raw(&self, mut result: Result<DriverResult, i32>) -> Result<(), fidl::Error> {
2318        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<DriverResult, i32>>(
2319            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
2320            self.tx_id,
2321            0x69f7106e47d81387,
2322            fidl::encoding::DynamicFlags::FLEXIBLE,
2323        )
2324    }
2325}
2326
2327mod internal {
2328    use super::*;
2329
2330    impl fidl::encoding::ResourceTypeMarker for DriverStartRequest {
2331        type Borrowed<'a> = &'a mut Self;
2332        fn take_or_borrow<'a>(
2333            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2334        ) -> Self::Borrowed<'a> {
2335            value
2336        }
2337    }
2338
2339    unsafe impl fidl::encoding::TypeMarker for DriverStartRequest {
2340        type Owned = Self;
2341
2342        #[inline(always)]
2343        fn inline_align(_context: fidl::encoding::Context) -> usize {
2344            8
2345        }
2346
2347        #[inline(always)]
2348        fn inline_size(_context: fidl::encoding::Context) -> usize {
2349            16
2350        }
2351    }
2352
2353    unsafe impl
2354        fidl::encoding::Encode<DriverStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2355        for &mut DriverStartRequest
2356    {
2357        #[inline]
2358        unsafe fn encode(
2359            self,
2360            encoder: &mut fidl::encoding::Encoder<
2361                '_,
2362                fidl::encoding::DefaultFuchsiaResourceDialect,
2363            >,
2364            offset: usize,
2365            _depth: fidl::encoding::Depth,
2366        ) -> fidl::Result<()> {
2367            encoder.debug_check_bounds::<DriverStartRequest>(offset);
2368            // Delegate to tuple encoding.
2369            fidl::encoding::Encode::<
2370                DriverStartRequest,
2371                fidl::encoding::DefaultFuchsiaResourceDialect,
2372            >::encode(
2373                (<DriverStartArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2374                    &mut self.start_args,
2375                ),),
2376                encoder,
2377                offset,
2378                _depth,
2379            )
2380        }
2381    }
2382    unsafe impl<
2383        T0: fidl::encoding::Encode<DriverStartArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
2384    > fidl::encoding::Encode<DriverStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2385        for (T0,)
2386    {
2387        #[inline]
2388        unsafe fn encode(
2389            self,
2390            encoder: &mut fidl::encoding::Encoder<
2391                '_,
2392                fidl::encoding::DefaultFuchsiaResourceDialect,
2393            >,
2394            offset: usize,
2395            depth: fidl::encoding::Depth,
2396        ) -> fidl::Result<()> {
2397            encoder.debug_check_bounds::<DriverStartRequest>(offset);
2398            // Zero out padding regions. There's no need to apply masks
2399            // because the unmasked parts will be overwritten by fields.
2400            // Write the fields.
2401            self.0.encode(encoder, offset + 0, depth)?;
2402            Ok(())
2403        }
2404    }
2405
2406    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2407        for DriverStartRequest
2408    {
2409        #[inline(always)]
2410        fn new_empty() -> Self {
2411            Self {
2412                start_args: fidl::new_empty!(
2413                    DriverStartArgs,
2414                    fidl::encoding::DefaultFuchsiaResourceDialect
2415                ),
2416            }
2417        }
2418
2419        #[inline]
2420        unsafe fn decode(
2421            &mut self,
2422            decoder: &mut fidl::encoding::Decoder<
2423                '_,
2424                fidl::encoding::DefaultFuchsiaResourceDialect,
2425            >,
2426            offset: usize,
2427            _depth: fidl::encoding::Depth,
2428        ) -> fidl::Result<()> {
2429            decoder.debug_check_bounds::<Self>(offset);
2430            // Verify that padding bytes are zero.
2431            fidl::decode!(
2432                DriverStartArgs,
2433                fidl::encoding::DefaultFuchsiaResourceDialect,
2434                &mut self.start_args,
2435                decoder,
2436                offset + 0,
2437                _depth
2438            )?;
2439            Ok(())
2440        }
2441    }
2442
2443    impl fidl::encoding::ResourceTypeMarker for NodeAddChildRequest {
2444        type Borrowed<'a> = &'a mut Self;
2445        fn take_or_borrow<'a>(
2446            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2447        ) -> Self::Borrowed<'a> {
2448            value
2449        }
2450    }
2451
2452    unsafe impl fidl::encoding::TypeMarker for NodeAddChildRequest {
2453        type Owned = Self;
2454
2455        #[inline(always)]
2456        fn inline_align(_context: fidl::encoding::Context) -> usize {
2457            8
2458        }
2459
2460        #[inline(always)]
2461        fn inline_size(_context: fidl::encoding::Context) -> usize {
2462            24
2463        }
2464    }
2465
2466    unsafe impl
2467        fidl::encoding::Encode<NodeAddChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2468        for &mut NodeAddChildRequest
2469    {
2470        #[inline]
2471        unsafe fn encode(
2472            self,
2473            encoder: &mut fidl::encoding::Encoder<
2474                '_,
2475                fidl::encoding::DefaultFuchsiaResourceDialect,
2476            >,
2477            offset: usize,
2478            _depth: fidl::encoding::Depth,
2479        ) -> fidl::Result<()> {
2480            encoder.debug_check_bounds::<NodeAddChildRequest>(offset);
2481            // Delegate to tuple encoding.
2482            fidl::encoding::Encode::<NodeAddChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2483                (
2484                    <NodeAddArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
2485                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
2486                    <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.node),
2487                ),
2488                encoder, offset, _depth
2489            )
2490        }
2491    }
2492    unsafe impl<
2493        T0: fidl::encoding::Encode<NodeAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
2494        T1: fidl::encoding::Encode<
2495                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>>,
2496                fidl::encoding::DefaultFuchsiaResourceDialect,
2497            >,
2498        T2: fidl::encoding::Encode<
2499                fidl::encoding::Optional<
2500                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>,
2501                >,
2502                fidl::encoding::DefaultFuchsiaResourceDialect,
2503            >,
2504    > fidl::encoding::Encode<NodeAddChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2505        for (T0, T1, T2)
2506    {
2507        #[inline]
2508        unsafe fn encode(
2509            self,
2510            encoder: &mut fidl::encoding::Encoder<
2511                '_,
2512                fidl::encoding::DefaultFuchsiaResourceDialect,
2513            >,
2514            offset: usize,
2515            depth: fidl::encoding::Depth,
2516        ) -> fidl::Result<()> {
2517            encoder.debug_check_bounds::<NodeAddChildRequest>(offset);
2518            // Zero out padding regions. There's no need to apply masks
2519            // because the unmasked parts will be overwritten by fields.
2520            // Write the fields.
2521            self.0.encode(encoder, offset + 0, depth)?;
2522            self.1.encode(encoder, offset + 16, depth)?;
2523            self.2.encode(encoder, offset + 20, depth)?;
2524            Ok(())
2525        }
2526    }
2527
2528    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2529        for NodeAddChildRequest
2530    {
2531        #[inline(always)]
2532        fn new_empty() -> Self {
2533            Self {
2534                args: fidl::new_empty!(NodeAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
2535                controller: fidl::new_empty!(
2536                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>>,
2537                    fidl::encoding::DefaultFuchsiaResourceDialect
2538                ),
2539                node: fidl::new_empty!(
2540                    fidl::encoding::Optional<
2541                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>,
2542                    >,
2543                    fidl::encoding::DefaultFuchsiaResourceDialect
2544                ),
2545            }
2546        }
2547
2548        #[inline]
2549        unsafe fn decode(
2550            &mut self,
2551            decoder: &mut fidl::encoding::Decoder<
2552                '_,
2553                fidl::encoding::DefaultFuchsiaResourceDialect,
2554            >,
2555            offset: usize,
2556            _depth: fidl::encoding::Depth,
2557        ) -> fidl::Result<()> {
2558            decoder.debug_check_bounds::<Self>(offset);
2559            // Verify that padding bytes are zero.
2560            fidl::decode!(
2561                NodeAddArgs,
2562                fidl::encoding::DefaultFuchsiaResourceDialect,
2563                &mut self.args,
2564                decoder,
2565                offset + 0,
2566                _depth
2567            )?;
2568            fidl::decode!(
2569                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>>,
2570                fidl::encoding::DefaultFuchsiaResourceDialect,
2571                &mut self.controller,
2572                decoder,
2573                offset + 16,
2574                _depth
2575            )?;
2576            fidl::decode!(
2577                fidl::encoding::Optional<
2578                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>,
2579                >,
2580                fidl::encoding::DefaultFuchsiaResourceDialect,
2581                &mut self.node,
2582                decoder,
2583                offset + 20,
2584                _depth
2585            )?;
2586            Ok(())
2587        }
2588    }
2589
2590    impl DevfsAddArgs {
2591        #[inline(always)]
2592        fn max_ordinal_present(&self) -> u64 {
2593            if let Some(_) = self.controller_connector {
2594                return 5;
2595            }
2596            if let Some(_) = self.connector_supports {
2597                return 4;
2598            }
2599            if let Some(_) = self.inspect {
2600                return 3;
2601            }
2602            if let Some(_) = self.class_name {
2603                return 2;
2604            }
2605            if let Some(_) = self.connector {
2606                return 1;
2607            }
2608            0
2609        }
2610    }
2611
2612    impl fidl::encoding::ResourceTypeMarker for DevfsAddArgs {
2613        type Borrowed<'a> = &'a mut Self;
2614        fn take_or_borrow<'a>(
2615            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2616        ) -> Self::Borrowed<'a> {
2617            value
2618        }
2619    }
2620
2621    unsafe impl fidl::encoding::TypeMarker for DevfsAddArgs {
2622        type Owned = Self;
2623
2624        #[inline(always)]
2625        fn inline_align(_context: fidl::encoding::Context) -> usize {
2626            8
2627        }
2628
2629        #[inline(always)]
2630        fn inline_size(_context: fidl::encoding::Context) -> usize {
2631            16
2632        }
2633    }
2634
2635    unsafe impl fidl::encoding::Encode<DevfsAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
2636        for &mut DevfsAddArgs
2637    {
2638        unsafe fn encode(
2639            self,
2640            encoder: &mut fidl::encoding::Encoder<
2641                '_,
2642                fidl::encoding::DefaultFuchsiaResourceDialect,
2643            >,
2644            offset: usize,
2645            mut depth: fidl::encoding::Depth,
2646        ) -> fidl::Result<()> {
2647            encoder.debug_check_bounds::<DevfsAddArgs>(offset);
2648            // Vector header
2649            let max_ordinal: u64 = self.max_ordinal_present();
2650            encoder.write_num(max_ordinal, offset);
2651            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2652            // Calling encoder.out_of_line_offset(0) is not allowed.
2653            if max_ordinal == 0 {
2654                return Ok(());
2655            }
2656            depth.increment()?;
2657            let envelope_size = 8;
2658            let bytes_len = max_ordinal as usize * envelope_size;
2659            #[allow(unused_variables)]
2660            let offset = encoder.out_of_line_offset(bytes_len);
2661            let mut _prev_end_offset: usize = 0;
2662            if 1 > max_ordinal {
2663                return Ok(());
2664            }
2665
2666            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2667            // are envelope_size bytes.
2668            let cur_offset: usize = (1 - 1) * envelope_size;
2669
2670            // Zero reserved fields.
2671            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2672
2673            // Safety:
2674            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2675            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2676            //   envelope_size bytes, there is always sufficient room.
2677            fidl::encoding::encode_in_envelope_optional::<
2678                fidl::encoding::Endpoint<
2679                    fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
2680                >,
2681                fidl::encoding::DefaultFuchsiaResourceDialect,
2682            >(
2683                self.connector.as_mut().map(
2684                    <fidl::encoding::Endpoint<
2685                        fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
2686                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2687                ),
2688                encoder,
2689                offset + cur_offset,
2690                depth,
2691            )?;
2692
2693            _prev_end_offset = cur_offset + envelope_size;
2694            if 2 > max_ordinal {
2695                return Ok(());
2696            }
2697
2698            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2699            // are envelope_size bytes.
2700            let cur_offset: usize = (2 - 1) * envelope_size;
2701
2702            // Zero reserved fields.
2703            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2704
2705            // Safety:
2706            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2707            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2708            //   envelope_size bytes, there is always sufficient room.
2709            fidl::encoding::encode_in_envelope_optional::<
2710                fidl::encoding::BoundedString<255>,
2711                fidl::encoding::DefaultFuchsiaResourceDialect,
2712            >(
2713                self.class_name.as_ref().map(
2714                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
2715                ),
2716                encoder,
2717                offset + cur_offset,
2718                depth,
2719            )?;
2720
2721            _prev_end_offset = cur_offset + envelope_size;
2722            if 3 > max_ordinal {
2723                return Ok(());
2724            }
2725
2726            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2727            // are envelope_size bytes.
2728            let cur_offset: usize = (3 - 1) * envelope_size;
2729
2730            // Zero reserved fields.
2731            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2732
2733            // Safety:
2734            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2735            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2736            //   envelope_size bytes, there is always sufficient room.
2737            fidl::encoding::encode_in_envelope_optional::<
2738                fidl::encoding::HandleType<
2739                    fidl::Vmo,
2740                    { fidl::ObjectType::VMO.into_raw() },
2741                    2147483648,
2742                >,
2743                fidl::encoding::DefaultFuchsiaResourceDialect,
2744            >(
2745                self.inspect.as_mut().map(
2746                    <fidl::encoding::HandleType<
2747                        fidl::Vmo,
2748                        { fidl::ObjectType::VMO.into_raw() },
2749                        2147483648,
2750                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2751                ),
2752                encoder,
2753                offset + cur_offset,
2754                depth,
2755            )?;
2756
2757            _prev_end_offset = cur_offset + envelope_size;
2758            if 4 > max_ordinal {
2759                return Ok(());
2760            }
2761
2762            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2763            // are envelope_size bytes.
2764            let cur_offset: usize = (4 - 1) * envelope_size;
2765
2766            // Zero reserved fields.
2767            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2768
2769            // Safety:
2770            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2771            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2772            //   envelope_size bytes, there is always sufficient room.
2773            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_device_fs::ConnectionType, fidl::encoding::DefaultFuchsiaResourceDialect>(
2774            self.connector_supports.as_ref().map(<fidl_fuchsia_device_fs::ConnectionType as fidl::encoding::ValueTypeMarker>::borrow),
2775            encoder, offset + cur_offset, depth
2776        )?;
2777
2778            _prev_end_offset = cur_offset + envelope_size;
2779            if 5 > max_ordinal {
2780                return Ok(());
2781            }
2782
2783            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2784            // are envelope_size bytes.
2785            let cur_offset: usize = (5 - 1) * envelope_size;
2786
2787            // Zero reserved fields.
2788            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2789
2790            // Safety:
2791            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2792            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2793            //   envelope_size bytes, there is always sufficient room.
2794            fidl::encoding::encode_in_envelope_optional::<
2795                fidl::encoding::Endpoint<
2796                    fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
2797                >,
2798                fidl::encoding::DefaultFuchsiaResourceDialect,
2799            >(
2800                self.controller_connector.as_mut().map(
2801                    <fidl::encoding::Endpoint<
2802                        fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
2803                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2804                ),
2805                encoder,
2806                offset + cur_offset,
2807                depth,
2808            )?;
2809
2810            _prev_end_offset = cur_offset + envelope_size;
2811
2812            Ok(())
2813        }
2814    }
2815
2816    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DevfsAddArgs {
2817        #[inline(always)]
2818        fn new_empty() -> Self {
2819            Self::default()
2820        }
2821
2822        unsafe fn decode(
2823            &mut self,
2824            decoder: &mut fidl::encoding::Decoder<
2825                '_,
2826                fidl::encoding::DefaultFuchsiaResourceDialect,
2827            >,
2828            offset: usize,
2829            mut depth: fidl::encoding::Depth,
2830        ) -> fidl::Result<()> {
2831            decoder.debug_check_bounds::<Self>(offset);
2832            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2833                None => return Err(fidl::Error::NotNullable),
2834                Some(len) => len,
2835            };
2836            // Calling decoder.out_of_line_offset(0) is not allowed.
2837            if len == 0 {
2838                return Ok(());
2839            };
2840            depth.increment()?;
2841            let envelope_size = 8;
2842            let bytes_len = len * envelope_size;
2843            let offset = decoder.out_of_line_offset(bytes_len)?;
2844            // Decode the envelope for each type.
2845            let mut _next_ordinal_to_read = 0;
2846            let mut next_offset = offset;
2847            let end_offset = offset + bytes_len;
2848            _next_ordinal_to_read += 1;
2849            if next_offset >= end_offset {
2850                return Ok(());
2851            }
2852
2853            // Decode unknown envelopes for gaps in ordinals.
2854            while _next_ordinal_to_read < 1 {
2855                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2856                _next_ordinal_to_read += 1;
2857                next_offset += envelope_size;
2858            }
2859
2860            let next_out_of_line = decoder.next_out_of_line();
2861            let handles_before = decoder.remaining_handles();
2862            if let Some((inlined, num_bytes, num_handles)) =
2863                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2864            {
2865                let member_inline_size = <fidl::encoding::Endpoint<
2866                    fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
2867                > as fidl::encoding::TypeMarker>::inline_size(
2868                    decoder.context
2869                );
2870                if inlined != (member_inline_size <= 4) {
2871                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2872                }
2873                let inner_offset;
2874                let mut inner_depth = depth.clone();
2875                if inlined {
2876                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2877                    inner_offset = next_offset;
2878                } else {
2879                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2880                    inner_depth.increment()?;
2881                }
2882                let val_ref = self.connector.get_or_insert_with(|| {
2883                    fidl::new_empty!(
2884                        fidl::encoding::Endpoint<
2885                            fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
2886                        >,
2887                        fidl::encoding::DefaultFuchsiaResourceDialect
2888                    )
2889                });
2890                fidl::decode!(
2891                    fidl::encoding::Endpoint<
2892                        fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
2893                    >,
2894                    fidl::encoding::DefaultFuchsiaResourceDialect,
2895                    val_ref,
2896                    decoder,
2897                    inner_offset,
2898                    inner_depth
2899                )?;
2900                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2901                {
2902                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2903                }
2904                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2905                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2906                }
2907            }
2908
2909            next_offset += envelope_size;
2910            _next_ordinal_to_read += 1;
2911            if next_offset >= end_offset {
2912                return Ok(());
2913            }
2914
2915            // Decode unknown envelopes for gaps in ordinals.
2916            while _next_ordinal_to_read < 2 {
2917                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2918                _next_ordinal_to_read += 1;
2919                next_offset += envelope_size;
2920            }
2921
2922            let next_out_of_line = decoder.next_out_of_line();
2923            let handles_before = decoder.remaining_handles();
2924            if let Some((inlined, num_bytes, num_handles)) =
2925                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2926            {
2927                let member_inline_size =
2928                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2929                        decoder.context,
2930                    );
2931                if inlined != (member_inline_size <= 4) {
2932                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2933                }
2934                let inner_offset;
2935                let mut inner_depth = depth.clone();
2936                if inlined {
2937                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2938                    inner_offset = next_offset;
2939                } else {
2940                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2941                    inner_depth.increment()?;
2942                }
2943                let val_ref = self.class_name.get_or_insert_with(|| {
2944                    fidl::new_empty!(
2945                        fidl::encoding::BoundedString<255>,
2946                        fidl::encoding::DefaultFuchsiaResourceDialect
2947                    )
2948                });
2949                fidl::decode!(
2950                    fidl::encoding::BoundedString<255>,
2951                    fidl::encoding::DefaultFuchsiaResourceDialect,
2952                    val_ref,
2953                    decoder,
2954                    inner_offset,
2955                    inner_depth
2956                )?;
2957                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2958                {
2959                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2960                }
2961                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2962                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2963                }
2964            }
2965
2966            next_offset += envelope_size;
2967            _next_ordinal_to_read += 1;
2968            if next_offset >= end_offset {
2969                return Ok(());
2970            }
2971
2972            // Decode unknown envelopes for gaps in ordinals.
2973            while _next_ordinal_to_read < 3 {
2974                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2975                _next_ordinal_to_read += 1;
2976                next_offset += envelope_size;
2977            }
2978
2979            let next_out_of_line = decoder.next_out_of_line();
2980            let handles_before = decoder.remaining_handles();
2981            if let Some((inlined, num_bytes, num_handles)) =
2982                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2983            {
2984                let member_inline_size = <fidl::encoding::HandleType<
2985                    fidl::Vmo,
2986                    { fidl::ObjectType::VMO.into_raw() },
2987                    2147483648,
2988                > as fidl::encoding::TypeMarker>::inline_size(
2989                    decoder.context
2990                );
2991                if inlined != (member_inline_size <= 4) {
2992                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2993                }
2994                let inner_offset;
2995                let mut inner_depth = depth.clone();
2996                if inlined {
2997                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2998                    inner_offset = next_offset;
2999                } else {
3000                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3001                    inner_depth.increment()?;
3002                }
3003                let val_ref =
3004                self.inspect.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3005                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3006                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3007                {
3008                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3009                }
3010                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3011                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3012                }
3013            }
3014
3015            next_offset += envelope_size;
3016            _next_ordinal_to_read += 1;
3017            if next_offset >= end_offset {
3018                return Ok(());
3019            }
3020
3021            // Decode unknown envelopes for gaps in ordinals.
3022            while _next_ordinal_to_read < 4 {
3023                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3024                _next_ordinal_to_read += 1;
3025                next_offset += envelope_size;
3026            }
3027
3028            let next_out_of_line = decoder.next_out_of_line();
3029            let handles_before = decoder.remaining_handles();
3030            if let Some((inlined, num_bytes, num_handles)) =
3031                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3032            {
3033                let member_inline_size = <fidl_fuchsia_device_fs::ConnectionType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3034                if inlined != (member_inline_size <= 4) {
3035                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3036                }
3037                let inner_offset;
3038                let mut inner_depth = depth.clone();
3039                if inlined {
3040                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3041                    inner_offset = next_offset;
3042                } else {
3043                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3044                    inner_depth.increment()?;
3045                }
3046                let val_ref = self.connector_supports.get_or_insert_with(|| {
3047                    fidl::new_empty!(
3048                        fidl_fuchsia_device_fs::ConnectionType,
3049                        fidl::encoding::DefaultFuchsiaResourceDialect
3050                    )
3051                });
3052                fidl::decode!(
3053                    fidl_fuchsia_device_fs::ConnectionType,
3054                    fidl::encoding::DefaultFuchsiaResourceDialect,
3055                    val_ref,
3056                    decoder,
3057                    inner_offset,
3058                    inner_depth
3059                )?;
3060                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3061                {
3062                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3063                }
3064                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3065                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3066                }
3067            }
3068
3069            next_offset += envelope_size;
3070            _next_ordinal_to_read += 1;
3071            if next_offset >= end_offset {
3072                return Ok(());
3073            }
3074
3075            // Decode unknown envelopes for gaps in ordinals.
3076            while _next_ordinal_to_read < 5 {
3077                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3078                _next_ordinal_to_read += 1;
3079                next_offset += envelope_size;
3080            }
3081
3082            let next_out_of_line = decoder.next_out_of_line();
3083            let handles_before = decoder.remaining_handles();
3084            if let Some((inlined, num_bytes, num_handles)) =
3085                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3086            {
3087                let member_inline_size = <fidl::encoding::Endpoint<
3088                    fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
3089                > as fidl::encoding::TypeMarker>::inline_size(
3090                    decoder.context
3091                );
3092                if inlined != (member_inline_size <= 4) {
3093                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3094                }
3095                let inner_offset;
3096                let mut inner_depth = depth.clone();
3097                if inlined {
3098                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3099                    inner_offset = next_offset;
3100                } else {
3101                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3102                    inner_depth.increment()?;
3103                }
3104                let val_ref = self.controller_connector.get_or_insert_with(|| {
3105                    fidl::new_empty!(
3106                        fidl::encoding::Endpoint<
3107                            fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
3108                        >,
3109                        fidl::encoding::DefaultFuchsiaResourceDialect
3110                    )
3111                });
3112                fidl::decode!(
3113                    fidl::encoding::Endpoint<
3114                        fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
3115                    >,
3116                    fidl::encoding::DefaultFuchsiaResourceDialect,
3117                    val_ref,
3118                    decoder,
3119                    inner_offset,
3120                    inner_depth
3121                )?;
3122                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3123                {
3124                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3125                }
3126                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3127                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3128                }
3129            }
3130
3131            next_offset += envelope_size;
3132
3133            // Decode the remaining unknown envelopes.
3134            while next_offset < end_offset {
3135                _next_ordinal_to_read += 1;
3136                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3137                next_offset += envelope_size;
3138            }
3139
3140            Ok(())
3141        }
3142    }
3143
3144    impl DriverStartArgs {
3145        #[inline(always)]
3146        fn max_ordinal_present(&self) -> u64 {
3147            if let Some(_) = self.vmar {
3148                return 13;
3149            }
3150            if let Some(_) = self.node_properties_2 {
3151                return 12;
3152            }
3153            if let Some(_) = self.node_token {
3154                return 11;
3155            }
3156            if let Some(_) = self.node_offers {
3157                return 10;
3158            }
3159            if let Some(_) = self.node_properties {
3160                return 9;
3161            }
3162            if let Some(_) = self.node_name {
3163                return 8;
3164            }
3165            if let Some(_) = self.config {
3166                return 7;
3167            }
3168            if let Some(_) = self.outgoing_dir {
3169                return 6;
3170            }
3171            if let Some(_) = self.incoming {
3172                return 5;
3173            }
3174            if let Some(_) = self.program {
3175                return 4;
3176            }
3177            if let Some(_) = self.url {
3178                return 3;
3179            }
3180            if let Some(_) = self.symbols {
3181                return 2;
3182            }
3183            if let Some(_) = self.node {
3184                return 1;
3185            }
3186            0
3187        }
3188    }
3189
3190    impl fidl::encoding::ResourceTypeMarker for DriverStartArgs {
3191        type Borrowed<'a> = &'a mut Self;
3192        fn take_or_borrow<'a>(
3193            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3194        ) -> Self::Borrowed<'a> {
3195            value
3196        }
3197    }
3198
3199    unsafe impl fidl::encoding::TypeMarker for DriverStartArgs {
3200        type Owned = Self;
3201
3202        #[inline(always)]
3203        fn inline_align(_context: fidl::encoding::Context) -> usize {
3204            8
3205        }
3206
3207        #[inline(always)]
3208        fn inline_size(_context: fidl::encoding::Context) -> usize {
3209            16
3210        }
3211    }
3212
3213    unsafe impl
3214        fidl::encoding::Encode<DriverStartArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
3215        for &mut DriverStartArgs
3216    {
3217        unsafe fn encode(
3218            self,
3219            encoder: &mut fidl::encoding::Encoder<
3220                '_,
3221                fidl::encoding::DefaultFuchsiaResourceDialect,
3222            >,
3223            offset: usize,
3224            mut depth: fidl::encoding::Depth,
3225        ) -> fidl::Result<()> {
3226            encoder.debug_check_bounds::<DriverStartArgs>(offset);
3227            // Vector header
3228            let max_ordinal: u64 = self.max_ordinal_present();
3229            encoder.write_num(max_ordinal, offset);
3230            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3231            // Calling encoder.out_of_line_offset(0) is not allowed.
3232            if max_ordinal == 0 {
3233                return Ok(());
3234            }
3235            depth.increment()?;
3236            let envelope_size = 8;
3237            let bytes_len = max_ordinal as usize * envelope_size;
3238            #[allow(unused_variables)]
3239            let offset = encoder.out_of_line_offset(bytes_len);
3240            let mut _prev_end_offset: usize = 0;
3241            if 1 > max_ordinal {
3242                return Ok(());
3243            }
3244
3245            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3246            // are envelope_size bytes.
3247            let cur_offset: usize = (1 - 1) * envelope_size;
3248
3249            // Zero reserved fields.
3250            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3251
3252            // Safety:
3253            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3254            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3255            //   envelope_size bytes, there is always sufficient room.
3256            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NodeMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3257            self.node.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NodeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3258            encoder, offset + cur_offset, depth
3259        )?;
3260
3261            _prev_end_offset = cur_offset + envelope_size;
3262            if 2 > max_ordinal {
3263                return Ok(());
3264            }
3265
3266            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3267            // are envelope_size bytes.
3268            let cur_offset: usize = (2 - 1) * envelope_size;
3269
3270            // Zero reserved fields.
3271            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3272
3273            // Safety:
3274            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3275            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3276            //   envelope_size bytes, there is always sufficient room.
3277            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3278            self.symbols.as_ref().map(<fidl::encoding::Vector<NodeSymbol, 64> as fidl::encoding::ValueTypeMarker>::borrow),
3279            encoder, offset + cur_offset, depth
3280        )?;
3281
3282            _prev_end_offset = cur_offset + envelope_size;
3283            if 3 > max_ordinal {
3284                return Ok(());
3285            }
3286
3287            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3288            // are envelope_size bytes.
3289            let cur_offset: usize = (3 - 1) * envelope_size;
3290
3291            // Zero reserved fields.
3292            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3293
3294            // Safety:
3295            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3296            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3297            //   envelope_size bytes, there is always sufficient room.
3298            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3299            self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
3300            encoder, offset + cur_offset, depth
3301        )?;
3302
3303            _prev_end_offset = cur_offset + envelope_size;
3304            if 4 > max_ordinal {
3305                return Ok(());
3306            }
3307
3308            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3309            // are envelope_size bytes.
3310            let cur_offset: usize = (4 - 1) * envelope_size;
3311
3312            // Zero reserved fields.
3313            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3314
3315            // Safety:
3316            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3317            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3318            //   envelope_size bytes, there is always sufficient room.
3319            fidl::encoding::encode_in_envelope_optional::<
3320                fidl_fuchsia_data::Dictionary,
3321                fidl::encoding::DefaultFuchsiaResourceDialect,
3322            >(
3323                self.program.as_ref().map(
3324                    <fidl_fuchsia_data::Dictionary as fidl::encoding::ValueTypeMarker>::borrow,
3325                ),
3326                encoder,
3327                offset + cur_offset,
3328                depth,
3329            )?;
3330
3331            _prev_end_offset = cur_offset + envelope_size;
3332            if 5 > max_ordinal {
3333                return Ok(());
3334            }
3335
3336            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3337            // are envelope_size bytes.
3338            let cur_offset: usize = (5 - 1) * envelope_size;
3339
3340            // Zero reserved fields.
3341            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3342
3343            // Safety:
3344            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3345            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3346            //   envelope_size bytes, there is always sufficient room.
3347            fidl::encoding::encode_in_envelope_optional::<
3348                fidl::encoding::Vector<fidl_fuchsia_component_runner::ComponentNamespaceEntry, 32>,
3349                fidl::encoding::DefaultFuchsiaResourceDialect,
3350            >(
3351                self.incoming.as_mut().map(
3352                    <fidl::encoding::Vector<
3353                        fidl_fuchsia_component_runner::ComponentNamespaceEntry,
3354                        32,
3355                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3356                ),
3357                encoder,
3358                offset + cur_offset,
3359                depth,
3360            )?;
3361
3362            _prev_end_offset = cur_offset + envelope_size;
3363            if 6 > max_ordinal {
3364                return Ok(());
3365            }
3366
3367            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3368            // are envelope_size bytes.
3369            let cur_offset: usize = (6 - 1) * envelope_size;
3370
3371            // Zero reserved fields.
3372            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3373
3374            // Safety:
3375            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3376            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3377            //   envelope_size bytes, there is always sufficient room.
3378            fidl::encoding::encode_in_envelope_optional::<
3379                fidl::encoding::Endpoint<
3380                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3381                >,
3382                fidl::encoding::DefaultFuchsiaResourceDialect,
3383            >(
3384                self.outgoing_dir.as_mut().map(
3385                    <fidl::encoding::Endpoint<
3386                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3387                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3388                ),
3389                encoder,
3390                offset + cur_offset,
3391                depth,
3392            )?;
3393
3394            _prev_end_offset = cur_offset + envelope_size;
3395            if 7 > max_ordinal {
3396                return Ok(());
3397            }
3398
3399            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3400            // are envelope_size bytes.
3401            let cur_offset: usize = (7 - 1) * envelope_size;
3402
3403            // Zero reserved fields.
3404            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3405
3406            // Safety:
3407            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3408            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3409            //   envelope_size bytes, there is always sufficient room.
3410            fidl::encoding::encode_in_envelope_optional::<
3411                fidl::encoding::HandleType<
3412                    fidl::Vmo,
3413                    { fidl::ObjectType::VMO.into_raw() },
3414                    2147483648,
3415                >,
3416                fidl::encoding::DefaultFuchsiaResourceDialect,
3417            >(
3418                self.config.as_mut().map(
3419                    <fidl::encoding::HandleType<
3420                        fidl::Vmo,
3421                        { fidl::ObjectType::VMO.into_raw() },
3422                        2147483648,
3423                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3424                ),
3425                encoder,
3426                offset + cur_offset,
3427                depth,
3428            )?;
3429
3430            _prev_end_offset = cur_offset + envelope_size;
3431            if 8 > max_ordinal {
3432                return Ok(());
3433            }
3434
3435            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3436            // are envelope_size bytes.
3437            let cur_offset: usize = (8 - 1) * envelope_size;
3438
3439            // Zero reserved fields.
3440            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3441
3442            // Safety:
3443            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3444            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3445            //   envelope_size bytes, there is always sufficient room.
3446            fidl::encoding::encode_in_envelope_optional::<
3447                fidl::encoding::UnboundedString,
3448                fidl::encoding::DefaultFuchsiaResourceDialect,
3449            >(
3450                self.node_name.as_ref().map(
3451                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
3452                ),
3453                encoder,
3454                offset + cur_offset,
3455                depth,
3456            )?;
3457
3458            _prev_end_offset = cur_offset + envelope_size;
3459            if 9 > max_ordinal {
3460                return Ok(());
3461            }
3462
3463            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3464            // are envelope_size bytes.
3465            let cur_offset: usize = (9 - 1) * envelope_size;
3466
3467            // Zero reserved fields.
3468            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3469
3470            // Safety:
3471            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3472            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3473            //   envelope_size bytes, there is always sufficient room.
3474            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<NodePropertyEntry>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3475            self.node_properties.as_ref().map(<fidl::encoding::UnboundedVector<NodePropertyEntry> as fidl::encoding::ValueTypeMarker>::borrow),
3476            encoder, offset + cur_offset, depth
3477        )?;
3478
3479            _prev_end_offset = cur_offset + envelope_size;
3480            if 10 > max_ordinal {
3481                return Ok(());
3482            }
3483
3484            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3485            // are envelope_size bytes.
3486            let cur_offset: usize = (10 - 1) * envelope_size;
3487
3488            // Zero reserved fields.
3489            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3490
3491            // Safety:
3492            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3493            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3494            //   envelope_size bytes, there is always sufficient room.
3495            fidl::encoding::encode_in_envelope_optional::<
3496                fidl::encoding::Vector<Offer, 128>,
3497                fidl::encoding::DefaultFuchsiaResourceDialect,
3498            >(
3499                self.node_offers.as_ref().map(
3500                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::ValueTypeMarker>::borrow,
3501                ),
3502                encoder,
3503                offset + cur_offset,
3504                depth,
3505            )?;
3506
3507            _prev_end_offset = cur_offset + envelope_size;
3508            if 11 > max_ordinal {
3509                return Ok(());
3510            }
3511
3512            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3513            // are envelope_size bytes.
3514            let cur_offset: usize = (11 - 1) * envelope_size;
3515
3516            // Zero reserved fields.
3517            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3518
3519            // Safety:
3520            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3521            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3522            //   envelope_size bytes, there is always sufficient room.
3523            fidl::encoding::encode_in_envelope_optional::<
3524                fidl::encoding::HandleType<
3525                    fidl::Event,
3526                    { fidl::ObjectType::EVENT.into_raw() },
3527                    2147483648,
3528                >,
3529                fidl::encoding::DefaultFuchsiaResourceDialect,
3530            >(
3531                self.node_token.as_mut().map(
3532                    <fidl::encoding::HandleType<
3533                        fidl::Event,
3534                        { fidl::ObjectType::EVENT.into_raw() },
3535                        2147483648,
3536                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3537                ),
3538                encoder,
3539                offset + cur_offset,
3540                depth,
3541            )?;
3542
3543            _prev_end_offset = cur_offset + envelope_size;
3544            if 12 > max_ordinal {
3545                return Ok(());
3546            }
3547
3548            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3549            // are envelope_size bytes.
3550            let cur_offset: usize = (12 - 1) * envelope_size;
3551
3552            // Zero reserved fields.
3553            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3554
3555            // Safety:
3556            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3557            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3558            //   envelope_size bytes, there is always sufficient room.
3559            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<NodePropertyEntry2>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3560            self.node_properties_2.as_ref().map(<fidl::encoding::UnboundedVector<NodePropertyEntry2> as fidl::encoding::ValueTypeMarker>::borrow),
3561            encoder, offset + cur_offset, depth
3562        )?;
3563
3564            _prev_end_offset = cur_offset + envelope_size;
3565            if 13 > max_ordinal {
3566                return Ok(());
3567            }
3568
3569            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3570            // are envelope_size bytes.
3571            let cur_offset: usize = (13 - 1) * envelope_size;
3572
3573            // Zero reserved fields.
3574            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3575
3576            // Safety:
3577            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3578            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3579            //   envelope_size bytes, there is always sufficient room.
3580            fidl::encoding::encode_in_envelope_optional::<
3581                fidl::encoding::HandleType<
3582                    fidl::Vmar,
3583                    { fidl::ObjectType::VMAR.into_raw() },
3584                    2147483648,
3585                >,
3586                fidl::encoding::DefaultFuchsiaResourceDialect,
3587            >(
3588                self.vmar.as_mut().map(
3589                    <fidl::encoding::HandleType<
3590                        fidl::Vmar,
3591                        { fidl::ObjectType::VMAR.into_raw() },
3592                        2147483648,
3593                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3594                ),
3595                encoder,
3596                offset + cur_offset,
3597                depth,
3598            )?;
3599
3600            _prev_end_offset = cur_offset + envelope_size;
3601
3602            Ok(())
3603        }
3604    }
3605
3606    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3607        for DriverStartArgs
3608    {
3609        #[inline(always)]
3610        fn new_empty() -> Self {
3611            Self::default()
3612        }
3613
3614        unsafe fn decode(
3615            &mut self,
3616            decoder: &mut fidl::encoding::Decoder<
3617                '_,
3618                fidl::encoding::DefaultFuchsiaResourceDialect,
3619            >,
3620            offset: usize,
3621            mut depth: fidl::encoding::Depth,
3622        ) -> fidl::Result<()> {
3623            decoder.debug_check_bounds::<Self>(offset);
3624            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3625                None => return Err(fidl::Error::NotNullable),
3626                Some(len) => len,
3627            };
3628            // Calling decoder.out_of_line_offset(0) is not allowed.
3629            if len == 0 {
3630                return Ok(());
3631            };
3632            depth.increment()?;
3633            let envelope_size = 8;
3634            let bytes_len = len * envelope_size;
3635            let offset = decoder.out_of_line_offset(bytes_len)?;
3636            // Decode the envelope for each type.
3637            let mut _next_ordinal_to_read = 0;
3638            let mut next_offset = offset;
3639            let end_offset = offset + bytes_len;
3640            _next_ordinal_to_read += 1;
3641            if next_offset >= end_offset {
3642                return Ok(());
3643            }
3644
3645            // Decode unknown envelopes for gaps in ordinals.
3646            while _next_ordinal_to_read < 1 {
3647                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3648                _next_ordinal_to_read += 1;
3649                next_offset += envelope_size;
3650            }
3651
3652            let next_out_of_line = decoder.next_out_of_line();
3653            let handles_before = decoder.remaining_handles();
3654            if let Some((inlined, num_bytes, num_handles)) =
3655                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3656            {
3657                let member_inline_size = <fidl::encoding::Endpoint<
3658                    fidl::endpoints::ClientEnd<NodeMarker>,
3659                > as fidl::encoding::TypeMarker>::inline_size(
3660                    decoder.context
3661                );
3662                if inlined != (member_inline_size <= 4) {
3663                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3664                }
3665                let inner_offset;
3666                let mut inner_depth = depth.clone();
3667                if inlined {
3668                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3669                    inner_offset = next_offset;
3670                } else {
3671                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3672                    inner_depth.increment()?;
3673                }
3674                let val_ref = self.node.get_or_insert_with(|| {
3675                    fidl::new_empty!(
3676                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NodeMarker>>,
3677                        fidl::encoding::DefaultFuchsiaResourceDialect
3678                    )
3679                });
3680                fidl::decode!(
3681                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NodeMarker>>,
3682                    fidl::encoding::DefaultFuchsiaResourceDialect,
3683                    val_ref,
3684                    decoder,
3685                    inner_offset,
3686                    inner_depth
3687                )?;
3688                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3689                {
3690                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3691                }
3692                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3693                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3694                }
3695            }
3696
3697            next_offset += envelope_size;
3698            _next_ordinal_to_read += 1;
3699            if next_offset >= end_offset {
3700                return Ok(());
3701            }
3702
3703            // Decode unknown envelopes for gaps in ordinals.
3704            while _next_ordinal_to_read < 2 {
3705                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3706                _next_ordinal_to_read += 1;
3707                next_offset += envelope_size;
3708            }
3709
3710            let next_out_of_line = decoder.next_out_of_line();
3711            let handles_before = decoder.remaining_handles();
3712            if let Some((inlined, num_bytes, num_handles)) =
3713                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3714            {
3715                let member_inline_size = <fidl::encoding::Vector<NodeSymbol, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3716                if inlined != (member_inline_size <= 4) {
3717                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3718                }
3719                let inner_offset;
3720                let mut inner_depth = depth.clone();
3721                if inlined {
3722                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3723                    inner_offset = next_offset;
3724                } else {
3725                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3726                    inner_depth.increment()?;
3727                }
3728                let val_ref =
3729                self.symbols.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
3730                fidl::decode!(fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3731                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3732                {
3733                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3734                }
3735                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3736                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3737                }
3738            }
3739
3740            next_offset += envelope_size;
3741            _next_ordinal_to_read += 1;
3742            if next_offset >= end_offset {
3743                return Ok(());
3744            }
3745
3746            // Decode unknown envelopes for gaps in ordinals.
3747            while _next_ordinal_to_read < 3 {
3748                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3749                _next_ordinal_to_read += 1;
3750                next_offset += envelope_size;
3751            }
3752
3753            let next_out_of_line = decoder.next_out_of_line();
3754            let handles_before = decoder.remaining_handles();
3755            if let Some((inlined, num_bytes, num_handles)) =
3756                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3757            {
3758                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3759                if inlined != (member_inline_size <= 4) {
3760                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3761                }
3762                let inner_offset;
3763                let mut inner_depth = depth.clone();
3764                if inlined {
3765                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3766                    inner_offset = next_offset;
3767                } else {
3768                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3769                    inner_depth.increment()?;
3770                }
3771                let val_ref = self.url.get_or_insert_with(|| {
3772                    fidl::new_empty!(
3773                        fidl::encoding::BoundedString<4096>,
3774                        fidl::encoding::DefaultFuchsiaResourceDialect
3775                    )
3776                });
3777                fidl::decode!(
3778                    fidl::encoding::BoundedString<4096>,
3779                    fidl::encoding::DefaultFuchsiaResourceDialect,
3780                    val_ref,
3781                    decoder,
3782                    inner_offset,
3783                    inner_depth
3784                )?;
3785                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3786                {
3787                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3788                }
3789                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3790                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3791                }
3792            }
3793
3794            next_offset += envelope_size;
3795            _next_ordinal_to_read += 1;
3796            if next_offset >= end_offset {
3797                return Ok(());
3798            }
3799
3800            // Decode unknown envelopes for gaps in ordinals.
3801            while _next_ordinal_to_read < 4 {
3802                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3803                _next_ordinal_to_read += 1;
3804                next_offset += envelope_size;
3805            }
3806
3807            let next_out_of_line = decoder.next_out_of_line();
3808            let handles_before = decoder.remaining_handles();
3809            if let Some((inlined, num_bytes, num_handles)) =
3810                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3811            {
3812                let member_inline_size =
3813                    <fidl_fuchsia_data::Dictionary as fidl::encoding::TypeMarker>::inline_size(
3814                        decoder.context,
3815                    );
3816                if inlined != (member_inline_size <= 4) {
3817                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3818                }
3819                let inner_offset;
3820                let mut inner_depth = depth.clone();
3821                if inlined {
3822                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3823                    inner_offset = next_offset;
3824                } else {
3825                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3826                    inner_depth.increment()?;
3827                }
3828                let val_ref = self.program.get_or_insert_with(|| {
3829                    fidl::new_empty!(
3830                        fidl_fuchsia_data::Dictionary,
3831                        fidl::encoding::DefaultFuchsiaResourceDialect
3832                    )
3833                });
3834                fidl::decode!(
3835                    fidl_fuchsia_data::Dictionary,
3836                    fidl::encoding::DefaultFuchsiaResourceDialect,
3837                    val_ref,
3838                    decoder,
3839                    inner_offset,
3840                    inner_depth
3841                )?;
3842                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3843                {
3844                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3845                }
3846                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3847                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3848                }
3849            }
3850
3851            next_offset += envelope_size;
3852            _next_ordinal_to_read += 1;
3853            if next_offset >= end_offset {
3854                return Ok(());
3855            }
3856
3857            // Decode unknown envelopes for gaps in ordinals.
3858            while _next_ordinal_to_read < 5 {
3859                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3860                _next_ordinal_to_read += 1;
3861                next_offset += envelope_size;
3862            }
3863
3864            let next_out_of_line = decoder.next_out_of_line();
3865            let handles_before = decoder.remaining_handles();
3866            if let Some((inlined, num_bytes, num_handles)) =
3867                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3868            {
3869                let member_inline_size = <fidl::encoding::Vector<
3870                    fidl_fuchsia_component_runner::ComponentNamespaceEntry,
3871                    32,
3872                > as fidl::encoding::TypeMarker>::inline_size(
3873                    decoder.context
3874                );
3875                if inlined != (member_inline_size <= 4) {
3876                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3877                }
3878                let inner_offset;
3879                let mut inner_depth = depth.clone();
3880                if inlined {
3881                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3882                    inner_offset = next_offset;
3883                } else {
3884                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3885                    inner_depth.increment()?;
3886                }
3887                let val_ref =
3888                self.incoming.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_component_runner::ComponentNamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
3889                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_component_runner::ComponentNamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3890                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3891                {
3892                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3893                }
3894                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3895                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3896                }
3897            }
3898
3899            next_offset += envelope_size;
3900            _next_ordinal_to_read += 1;
3901            if next_offset >= end_offset {
3902                return Ok(());
3903            }
3904
3905            // Decode unknown envelopes for gaps in ordinals.
3906            while _next_ordinal_to_read < 6 {
3907                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3908                _next_ordinal_to_read += 1;
3909                next_offset += envelope_size;
3910            }
3911
3912            let next_out_of_line = decoder.next_out_of_line();
3913            let handles_before = decoder.remaining_handles();
3914            if let Some((inlined, num_bytes, num_handles)) =
3915                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3916            {
3917                let member_inline_size = <fidl::encoding::Endpoint<
3918                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3919                > as fidl::encoding::TypeMarker>::inline_size(
3920                    decoder.context
3921                );
3922                if inlined != (member_inline_size <= 4) {
3923                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3924                }
3925                let inner_offset;
3926                let mut inner_depth = depth.clone();
3927                if inlined {
3928                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3929                    inner_offset = next_offset;
3930                } else {
3931                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3932                    inner_depth.increment()?;
3933                }
3934                let val_ref = self.outgoing_dir.get_or_insert_with(|| {
3935                    fidl::new_empty!(
3936                        fidl::encoding::Endpoint<
3937                            fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3938                        >,
3939                        fidl::encoding::DefaultFuchsiaResourceDialect
3940                    )
3941                });
3942                fidl::decode!(
3943                    fidl::encoding::Endpoint<
3944                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3945                    >,
3946                    fidl::encoding::DefaultFuchsiaResourceDialect,
3947                    val_ref,
3948                    decoder,
3949                    inner_offset,
3950                    inner_depth
3951                )?;
3952                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3953                {
3954                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3955                }
3956                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3957                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3958                }
3959            }
3960
3961            next_offset += envelope_size;
3962            _next_ordinal_to_read += 1;
3963            if next_offset >= end_offset {
3964                return Ok(());
3965            }
3966
3967            // Decode unknown envelopes for gaps in ordinals.
3968            while _next_ordinal_to_read < 7 {
3969                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3970                _next_ordinal_to_read += 1;
3971                next_offset += envelope_size;
3972            }
3973
3974            let next_out_of_line = decoder.next_out_of_line();
3975            let handles_before = decoder.remaining_handles();
3976            if let Some((inlined, num_bytes, num_handles)) =
3977                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3978            {
3979                let member_inline_size = <fidl::encoding::HandleType<
3980                    fidl::Vmo,
3981                    { fidl::ObjectType::VMO.into_raw() },
3982                    2147483648,
3983                > as fidl::encoding::TypeMarker>::inline_size(
3984                    decoder.context
3985                );
3986                if inlined != (member_inline_size <= 4) {
3987                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3988                }
3989                let inner_offset;
3990                let mut inner_depth = depth.clone();
3991                if inlined {
3992                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3993                    inner_offset = next_offset;
3994                } else {
3995                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3996                    inner_depth.increment()?;
3997                }
3998                let val_ref =
3999                self.config.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4000                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4001                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4002                {
4003                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4004                }
4005                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4006                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4007                }
4008            }
4009
4010            next_offset += envelope_size;
4011            _next_ordinal_to_read += 1;
4012            if next_offset >= end_offset {
4013                return Ok(());
4014            }
4015
4016            // Decode unknown envelopes for gaps in ordinals.
4017            while _next_ordinal_to_read < 8 {
4018                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4019                _next_ordinal_to_read += 1;
4020                next_offset += envelope_size;
4021            }
4022
4023            let next_out_of_line = decoder.next_out_of_line();
4024            let handles_before = decoder.remaining_handles();
4025            if let Some((inlined, num_bytes, num_handles)) =
4026                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4027            {
4028                let member_inline_size =
4029                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
4030                        decoder.context,
4031                    );
4032                if inlined != (member_inline_size <= 4) {
4033                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4034                }
4035                let inner_offset;
4036                let mut inner_depth = depth.clone();
4037                if inlined {
4038                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4039                    inner_offset = next_offset;
4040                } else {
4041                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4042                    inner_depth.increment()?;
4043                }
4044                let val_ref = self.node_name.get_or_insert_with(|| {
4045                    fidl::new_empty!(
4046                        fidl::encoding::UnboundedString,
4047                        fidl::encoding::DefaultFuchsiaResourceDialect
4048                    )
4049                });
4050                fidl::decode!(
4051                    fidl::encoding::UnboundedString,
4052                    fidl::encoding::DefaultFuchsiaResourceDialect,
4053                    val_ref,
4054                    decoder,
4055                    inner_offset,
4056                    inner_depth
4057                )?;
4058                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4059                {
4060                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4061                }
4062                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4063                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4064                }
4065            }
4066
4067            next_offset += envelope_size;
4068            _next_ordinal_to_read += 1;
4069            if next_offset >= end_offset {
4070                return Ok(());
4071            }
4072
4073            // Decode unknown envelopes for gaps in ordinals.
4074            while _next_ordinal_to_read < 9 {
4075                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4076                _next_ordinal_to_read += 1;
4077                next_offset += envelope_size;
4078            }
4079
4080            let next_out_of_line = decoder.next_out_of_line();
4081            let handles_before = decoder.remaining_handles();
4082            if let Some((inlined, num_bytes, num_handles)) =
4083                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4084            {
4085                let member_inline_size = <fidl::encoding::UnboundedVector<NodePropertyEntry> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4086                if inlined != (member_inline_size <= 4) {
4087                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4088                }
4089                let inner_offset;
4090                let mut inner_depth = depth.clone();
4091                if inlined {
4092                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4093                    inner_offset = next_offset;
4094                } else {
4095                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4096                    inner_depth.increment()?;
4097                }
4098                let val_ref = self.node_properties.get_or_insert_with(|| {
4099                    fidl::new_empty!(
4100                        fidl::encoding::UnboundedVector<NodePropertyEntry>,
4101                        fidl::encoding::DefaultFuchsiaResourceDialect
4102                    )
4103                });
4104                fidl::decode!(
4105                    fidl::encoding::UnboundedVector<NodePropertyEntry>,
4106                    fidl::encoding::DefaultFuchsiaResourceDialect,
4107                    val_ref,
4108                    decoder,
4109                    inner_offset,
4110                    inner_depth
4111                )?;
4112                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4113                {
4114                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4115                }
4116                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4117                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4118                }
4119            }
4120
4121            next_offset += envelope_size;
4122            _next_ordinal_to_read += 1;
4123            if next_offset >= end_offset {
4124                return Ok(());
4125            }
4126
4127            // Decode unknown envelopes for gaps in ordinals.
4128            while _next_ordinal_to_read < 10 {
4129                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4130                _next_ordinal_to_read += 1;
4131                next_offset += envelope_size;
4132            }
4133
4134            let next_out_of_line = decoder.next_out_of_line();
4135            let handles_before = decoder.remaining_handles();
4136            if let Some((inlined, num_bytes, num_handles)) =
4137                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4138            {
4139                let member_inline_size =
4140                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::TypeMarker>::inline_size(
4141                        decoder.context,
4142                    );
4143                if inlined != (member_inline_size <= 4) {
4144                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4145                }
4146                let inner_offset;
4147                let mut inner_depth = depth.clone();
4148                if inlined {
4149                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4150                    inner_offset = next_offset;
4151                } else {
4152                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4153                    inner_depth.increment()?;
4154                }
4155                let val_ref =
4156                self.node_offers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
4157                fidl::decode!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4158                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4159                {
4160                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4161                }
4162                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4163                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4164                }
4165            }
4166
4167            next_offset += envelope_size;
4168            _next_ordinal_to_read += 1;
4169            if next_offset >= end_offset {
4170                return Ok(());
4171            }
4172
4173            // Decode unknown envelopes for gaps in ordinals.
4174            while _next_ordinal_to_read < 11 {
4175                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4176                _next_ordinal_to_read += 1;
4177                next_offset += envelope_size;
4178            }
4179
4180            let next_out_of_line = decoder.next_out_of_line();
4181            let handles_before = decoder.remaining_handles();
4182            if let Some((inlined, num_bytes, num_handles)) =
4183                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4184            {
4185                let member_inline_size = <fidl::encoding::HandleType<
4186                    fidl::Event,
4187                    { fidl::ObjectType::EVENT.into_raw() },
4188                    2147483648,
4189                > as fidl::encoding::TypeMarker>::inline_size(
4190                    decoder.context
4191                );
4192                if inlined != (member_inline_size <= 4) {
4193                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4194                }
4195                let inner_offset;
4196                let mut inner_depth = depth.clone();
4197                if inlined {
4198                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4199                    inner_offset = next_offset;
4200                } else {
4201                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4202                    inner_depth.increment()?;
4203                }
4204                let val_ref =
4205                self.node_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4206                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4207                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4208                {
4209                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4210                }
4211                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4212                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4213                }
4214            }
4215
4216            next_offset += envelope_size;
4217            _next_ordinal_to_read += 1;
4218            if next_offset >= end_offset {
4219                return Ok(());
4220            }
4221
4222            // Decode unknown envelopes for gaps in ordinals.
4223            while _next_ordinal_to_read < 12 {
4224                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4225                _next_ordinal_to_read += 1;
4226                next_offset += envelope_size;
4227            }
4228
4229            let next_out_of_line = decoder.next_out_of_line();
4230            let handles_before = decoder.remaining_handles();
4231            if let Some((inlined, num_bytes, num_handles)) =
4232                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4233            {
4234                let member_inline_size = <fidl::encoding::UnboundedVector<NodePropertyEntry2> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4235                if inlined != (member_inline_size <= 4) {
4236                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4237                }
4238                let inner_offset;
4239                let mut inner_depth = depth.clone();
4240                if inlined {
4241                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4242                    inner_offset = next_offset;
4243                } else {
4244                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4245                    inner_depth.increment()?;
4246                }
4247                let val_ref = self.node_properties_2.get_or_insert_with(|| {
4248                    fidl::new_empty!(
4249                        fidl::encoding::UnboundedVector<NodePropertyEntry2>,
4250                        fidl::encoding::DefaultFuchsiaResourceDialect
4251                    )
4252                });
4253                fidl::decode!(
4254                    fidl::encoding::UnboundedVector<NodePropertyEntry2>,
4255                    fidl::encoding::DefaultFuchsiaResourceDialect,
4256                    val_ref,
4257                    decoder,
4258                    inner_offset,
4259                    inner_depth
4260                )?;
4261                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4262                {
4263                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4264                }
4265                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4266                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4267                }
4268            }
4269
4270            next_offset += envelope_size;
4271            _next_ordinal_to_read += 1;
4272            if next_offset >= end_offset {
4273                return Ok(());
4274            }
4275
4276            // Decode unknown envelopes for gaps in ordinals.
4277            while _next_ordinal_to_read < 13 {
4278                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4279                _next_ordinal_to_read += 1;
4280                next_offset += envelope_size;
4281            }
4282
4283            let next_out_of_line = decoder.next_out_of_line();
4284            let handles_before = decoder.remaining_handles();
4285            if let Some((inlined, num_bytes, num_handles)) =
4286                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4287            {
4288                let member_inline_size = <fidl::encoding::HandleType<
4289                    fidl::Vmar,
4290                    { fidl::ObjectType::VMAR.into_raw() },
4291                    2147483648,
4292                > as fidl::encoding::TypeMarker>::inline_size(
4293                    decoder.context
4294                );
4295                if inlined != (member_inline_size <= 4) {
4296                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4297                }
4298                let inner_offset;
4299                let mut inner_depth = depth.clone();
4300                if inlined {
4301                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4302                    inner_offset = next_offset;
4303                } else {
4304                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4305                    inner_depth.increment()?;
4306                }
4307                let val_ref =
4308                self.vmar.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4309                fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4310                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4311                {
4312                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4313                }
4314                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4315                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4316                }
4317            }
4318
4319            next_offset += envelope_size;
4320
4321            // Decode the remaining unknown envelopes.
4322            while next_offset < end_offset {
4323                _next_ordinal_to_read += 1;
4324                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4325                next_offset += envelope_size;
4326            }
4327
4328            Ok(())
4329        }
4330    }
4331
4332    impl NodeAddArgs {
4333        #[inline(always)]
4334        fn max_ordinal_present(&self) -> u64 {
4335            if let Some(_) = self.properties2 {
4336                return 8;
4337            }
4338            if let Some(_) = self.bus_info {
4339                return 7;
4340            }
4341            if let Some(_) = self.offers2 {
4342                return 6;
4343            }
4344            if let Some(_) = self.devfs_args {
4345                return 5;
4346            }
4347            if let Some(_) = self.properties {
4348                return 4;
4349            }
4350            if let Some(_) = self.symbols {
4351                return 3;
4352            }
4353            if let Some(_) = self.name {
4354                return 1;
4355            }
4356            0
4357        }
4358    }
4359
4360    impl fidl::encoding::ResourceTypeMarker for NodeAddArgs {
4361        type Borrowed<'a> = &'a mut Self;
4362        fn take_or_borrow<'a>(
4363            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4364        ) -> Self::Borrowed<'a> {
4365            value
4366        }
4367    }
4368
4369    unsafe impl fidl::encoding::TypeMarker for NodeAddArgs {
4370        type Owned = Self;
4371
4372        #[inline(always)]
4373        fn inline_align(_context: fidl::encoding::Context) -> usize {
4374            8
4375        }
4376
4377        #[inline(always)]
4378        fn inline_size(_context: fidl::encoding::Context) -> usize {
4379            16
4380        }
4381    }
4382
4383    unsafe impl fidl::encoding::Encode<NodeAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
4384        for &mut NodeAddArgs
4385    {
4386        unsafe fn encode(
4387            self,
4388            encoder: &mut fidl::encoding::Encoder<
4389                '_,
4390                fidl::encoding::DefaultFuchsiaResourceDialect,
4391            >,
4392            offset: usize,
4393            mut depth: fidl::encoding::Depth,
4394        ) -> fidl::Result<()> {
4395            encoder.debug_check_bounds::<NodeAddArgs>(offset);
4396            // Vector header
4397            let max_ordinal: u64 = self.max_ordinal_present();
4398            encoder.write_num(max_ordinal, offset);
4399            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4400            // Calling encoder.out_of_line_offset(0) is not allowed.
4401            if max_ordinal == 0 {
4402                return Ok(());
4403            }
4404            depth.increment()?;
4405            let envelope_size = 8;
4406            let bytes_len = max_ordinal as usize * envelope_size;
4407            #[allow(unused_variables)]
4408            let offset = encoder.out_of_line_offset(bytes_len);
4409            let mut _prev_end_offset: usize = 0;
4410            if 1 > max_ordinal {
4411                return Ok(());
4412            }
4413
4414            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4415            // are envelope_size bytes.
4416            let cur_offset: usize = (1 - 1) * envelope_size;
4417
4418            // Zero reserved fields.
4419            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4420
4421            // Safety:
4422            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4423            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4424            //   envelope_size bytes, there is always sufficient room.
4425            fidl::encoding::encode_in_envelope_optional::<
4426                fidl::encoding::BoundedString<128>,
4427                fidl::encoding::DefaultFuchsiaResourceDialect,
4428            >(
4429                self.name.as_ref().map(
4430                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
4431                ),
4432                encoder,
4433                offset + cur_offset,
4434                depth,
4435            )?;
4436
4437            _prev_end_offset = cur_offset + envelope_size;
4438            if 3 > max_ordinal {
4439                return Ok(());
4440            }
4441
4442            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4443            // are envelope_size bytes.
4444            let cur_offset: usize = (3 - 1) * envelope_size;
4445
4446            // Zero reserved fields.
4447            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4448
4449            // Safety:
4450            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4451            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4452            //   envelope_size bytes, there is always sufficient room.
4453            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4454            self.symbols.as_ref().map(<fidl::encoding::Vector<NodeSymbol, 64> as fidl::encoding::ValueTypeMarker>::borrow),
4455            encoder, offset + cur_offset, depth
4456        )?;
4457
4458            _prev_end_offset = cur_offset + envelope_size;
4459            if 4 > max_ordinal {
4460                return Ok(());
4461            }
4462
4463            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4464            // are envelope_size bytes.
4465            let cur_offset: usize = (4 - 1) * envelope_size;
4466
4467            // Zero reserved fields.
4468            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4469
4470            // Safety:
4471            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4472            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4473            //   envelope_size bytes, there is always sufficient room.
4474            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NodeProperty, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4475            self.properties.as_ref().map(<fidl::encoding::Vector<NodeProperty, 64> as fidl::encoding::ValueTypeMarker>::borrow),
4476            encoder, offset + cur_offset, depth
4477        )?;
4478
4479            _prev_end_offset = cur_offset + envelope_size;
4480            if 5 > max_ordinal {
4481                return Ok(());
4482            }
4483
4484            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4485            // are envelope_size bytes.
4486            let cur_offset: usize = (5 - 1) * envelope_size;
4487
4488            // Zero reserved fields.
4489            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4490
4491            // Safety:
4492            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4493            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4494            //   envelope_size bytes, there is always sufficient room.
4495            fidl::encoding::encode_in_envelope_optional::<
4496                DevfsAddArgs,
4497                fidl::encoding::DefaultFuchsiaResourceDialect,
4498            >(
4499                self.devfs_args
4500                    .as_mut()
4501                    .map(<DevfsAddArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4502                encoder,
4503                offset + cur_offset,
4504                depth,
4505            )?;
4506
4507            _prev_end_offset = cur_offset + envelope_size;
4508            if 6 > max_ordinal {
4509                return Ok(());
4510            }
4511
4512            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4513            // are envelope_size bytes.
4514            let cur_offset: usize = (6 - 1) * envelope_size;
4515
4516            // Zero reserved fields.
4517            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4518
4519            // Safety:
4520            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4521            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4522            //   envelope_size bytes, there is always sufficient room.
4523            fidl::encoding::encode_in_envelope_optional::<
4524                fidl::encoding::Vector<Offer, 128>,
4525                fidl::encoding::DefaultFuchsiaResourceDialect,
4526            >(
4527                self.offers2.as_ref().map(
4528                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::ValueTypeMarker>::borrow,
4529                ),
4530                encoder,
4531                offset + cur_offset,
4532                depth,
4533            )?;
4534
4535            _prev_end_offset = cur_offset + envelope_size;
4536            if 7 > max_ordinal {
4537                return Ok(());
4538            }
4539
4540            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4541            // are envelope_size bytes.
4542            let cur_offset: usize = (7 - 1) * envelope_size;
4543
4544            // Zero reserved fields.
4545            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4546
4547            // Safety:
4548            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4549            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4550            //   envelope_size bytes, there is always sufficient room.
4551            fidl::encoding::encode_in_envelope_optional::<
4552                BusInfo,
4553                fidl::encoding::DefaultFuchsiaResourceDialect,
4554            >(
4555                self.bus_info.as_ref().map(<BusInfo as fidl::encoding::ValueTypeMarker>::borrow),
4556                encoder,
4557                offset + cur_offset,
4558                depth,
4559            )?;
4560
4561            _prev_end_offset = cur_offset + envelope_size;
4562            if 8 > max_ordinal {
4563                return Ok(());
4564            }
4565
4566            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4567            // are envelope_size bytes.
4568            let cur_offset: usize = (8 - 1) * envelope_size;
4569
4570            // Zero reserved fields.
4571            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4572
4573            // Safety:
4574            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4575            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4576            //   envelope_size bytes, there is always sufficient room.
4577            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NodeProperty2, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4578            self.properties2.as_ref().map(<fidl::encoding::Vector<NodeProperty2, 64> as fidl::encoding::ValueTypeMarker>::borrow),
4579            encoder, offset + cur_offset, depth
4580        )?;
4581
4582            _prev_end_offset = cur_offset + envelope_size;
4583
4584            Ok(())
4585        }
4586    }
4587
4588    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NodeAddArgs {
4589        #[inline(always)]
4590        fn new_empty() -> Self {
4591            Self::default()
4592        }
4593
4594        unsafe fn decode(
4595            &mut self,
4596            decoder: &mut fidl::encoding::Decoder<
4597                '_,
4598                fidl::encoding::DefaultFuchsiaResourceDialect,
4599            >,
4600            offset: usize,
4601            mut depth: fidl::encoding::Depth,
4602        ) -> fidl::Result<()> {
4603            decoder.debug_check_bounds::<Self>(offset);
4604            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4605                None => return Err(fidl::Error::NotNullable),
4606                Some(len) => len,
4607            };
4608            // Calling decoder.out_of_line_offset(0) is not allowed.
4609            if len == 0 {
4610                return Ok(());
4611            };
4612            depth.increment()?;
4613            let envelope_size = 8;
4614            let bytes_len = len * envelope_size;
4615            let offset = decoder.out_of_line_offset(bytes_len)?;
4616            // Decode the envelope for each type.
4617            let mut _next_ordinal_to_read = 0;
4618            let mut next_offset = offset;
4619            let end_offset = offset + bytes_len;
4620            _next_ordinal_to_read += 1;
4621            if next_offset >= end_offset {
4622                return Ok(());
4623            }
4624
4625            // Decode unknown envelopes for gaps in ordinals.
4626            while _next_ordinal_to_read < 1 {
4627                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4628                _next_ordinal_to_read += 1;
4629                next_offset += envelope_size;
4630            }
4631
4632            let next_out_of_line = decoder.next_out_of_line();
4633            let handles_before = decoder.remaining_handles();
4634            if let Some((inlined, num_bytes, num_handles)) =
4635                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4636            {
4637                let member_inline_size =
4638                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
4639                        decoder.context,
4640                    );
4641                if inlined != (member_inline_size <= 4) {
4642                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4643                }
4644                let inner_offset;
4645                let mut inner_depth = depth.clone();
4646                if inlined {
4647                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4648                    inner_offset = next_offset;
4649                } else {
4650                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4651                    inner_depth.increment()?;
4652                }
4653                let val_ref = self.name.get_or_insert_with(|| {
4654                    fidl::new_empty!(
4655                        fidl::encoding::BoundedString<128>,
4656                        fidl::encoding::DefaultFuchsiaResourceDialect
4657                    )
4658                });
4659                fidl::decode!(
4660                    fidl::encoding::BoundedString<128>,
4661                    fidl::encoding::DefaultFuchsiaResourceDialect,
4662                    val_ref,
4663                    decoder,
4664                    inner_offset,
4665                    inner_depth
4666                )?;
4667                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4668                {
4669                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4670                }
4671                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4672                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4673                }
4674            }
4675
4676            next_offset += envelope_size;
4677            _next_ordinal_to_read += 1;
4678            if next_offset >= end_offset {
4679                return Ok(());
4680            }
4681
4682            // Decode unknown envelopes for gaps in ordinals.
4683            while _next_ordinal_to_read < 3 {
4684                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4685                _next_ordinal_to_read += 1;
4686                next_offset += envelope_size;
4687            }
4688
4689            let next_out_of_line = decoder.next_out_of_line();
4690            let handles_before = decoder.remaining_handles();
4691            if let Some((inlined, num_bytes, num_handles)) =
4692                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4693            {
4694                let member_inline_size = <fidl::encoding::Vector<NodeSymbol, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4695                if inlined != (member_inline_size <= 4) {
4696                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4697                }
4698                let inner_offset;
4699                let mut inner_depth = depth.clone();
4700                if inlined {
4701                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4702                    inner_offset = next_offset;
4703                } else {
4704                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4705                    inner_depth.increment()?;
4706                }
4707                let val_ref =
4708                self.symbols.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
4709                fidl::decode!(fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4710                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4711                {
4712                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4713                }
4714                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4715                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4716                }
4717            }
4718
4719            next_offset += envelope_size;
4720            _next_ordinal_to_read += 1;
4721            if next_offset >= end_offset {
4722                return Ok(());
4723            }
4724
4725            // Decode unknown envelopes for gaps in ordinals.
4726            while _next_ordinal_to_read < 4 {
4727                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4728                _next_ordinal_to_read += 1;
4729                next_offset += envelope_size;
4730            }
4731
4732            let next_out_of_line = decoder.next_out_of_line();
4733            let handles_before = decoder.remaining_handles();
4734            if let Some((inlined, num_bytes, num_handles)) =
4735                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4736            {
4737                let member_inline_size = <fidl::encoding::Vector<NodeProperty, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4738                if inlined != (member_inline_size <= 4) {
4739                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4740                }
4741                let inner_offset;
4742                let mut inner_depth = depth.clone();
4743                if inlined {
4744                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4745                    inner_offset = next_offset;
4746                } else {
4747                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4748                    inner_depth.increment()?;
4749                }
4750                let val_ref =
4751                self.properties.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NodeProperty, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
4752                fidl::decode!(fidl::encoding::Vector<NodeProperty, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4753                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4754                {
4755                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4756                }
4757                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4758                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4759                }
4760            }
4761
4762            next_offset += envelope_size;
4763            _next_ordinal_to_read += 1;
4764            if next_offset >= end_offset {
4765                return Ok(());
4766            }
4767
4768            // Decode unknown envelopes for gaps in ordinals.
4769            while _next_ordinal_to_read < 5 {
4770                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4771                _next_ordinal_to_read += 1;
4772                next_offset += envelope_size;
4773            }
4774
4775            let next_out_of_line = decoder.next_out_of_line();
4776            let handles_before = decoder.remaining_handles();
4777            if let Some((inlined, num_bytes, num_handles)) =
4778                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4779            {
4780                let member_inline_size =
4781                    <DevfsAddArgs as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4782                if inlined != (member_inline_size <= 4) {
4783                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4784                }
4785                let inner_offset;
4786                let mut inner_depth = depth.clone();
4787                if inlined {
4788                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4789                    inner_offset = next_offset;
4790                } else {
4791                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4792                    inner_depth.increment()?;
4793                }
4794                let val_ref = self.devfs_args.get_or_insert_with(|| {
4795                    fidl::new_empty!(DevfsAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect)
4796                });
4797                fidl::decode!(
4798                    DevfsAddArgs,
4799                    fidl::encoding::DefaultFuchsiaResourceDialect,
4800                    val_ref,
4801                    decoder,
4802                    inner_offset,
4803                    inner_depth
4804                )?;
4805                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4806                {
4807                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4808                }
4809                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4810                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4811                }
4812            }
4813
4814            next_offset += envelope_size;
4815            _next_ordinal_to_read += 1;
4816            if next_offset >= end_offset {
4817                return Ok(());
4818            }
4819
4820            // Decode unknown envelopes for gaps in ordinals.
4821            while _next_ordinal_to_read < 6 {
4822                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4823                _next_ordinal_to_read += 1;
4824                next_offset += envelope_size;
4825            }
4826
4827            let next_out_of_line = decoder.next_out_of_line();
4828            let handles_before = decoder.remaining_handles();
4829            if let Some((inlined, num_bytes, num_handles)) =
4830                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4831            {
4832                let member_inline_size =
4833                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::TypeMarker>::inline_size(
4834                        decoder.context,
4835                    );
4836                if inlined != (member_inline_size <= 4) {
4837                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4838                }
4839                let inner_offset;
4840                let mut inner_depth = depth.clone();
4841                if inlined {
4842                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4843                    inner_offset = next_offset;
4844                } else {
4845                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4846                    inner_depth.increment()?;
4847                }
4848                let val_ref =
4849                self.offers2.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
4850                fidl::decode!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4851                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4852                {
4853                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4854                }
4855                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4856                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4857                }
4858            }
4859
4860            next_offset += envelope_size;
4861            _next_ordinal_to_read += 1;
4862            if next_offset >= end_offset {
4863                return Ok(());
4864            }
4865
4866            // Decode unknown envelopes for gaps in ordinals.
4867            while _next_ordinal_to_read < 7 {
4868                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4869                _next_ordinal_to_read += 1;
4870                next_offset += envelope_size;
4871            }
4872
4873            let next_out_of_line = decoder.next_out_of_line();
4874            let handles_before = decoder.remaining_handles();
4875            if let Some((inlined, num_bytes, num_handles)) =
4876                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4877            {
4878                let member_inline_size =
4879                    <BusInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4880                if inlined != (member_inline_size <= 4) {
4881                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4882                }
4883                let inner_offset;
4884                let mut inner_depth = depth.clone();
4885                if inlined {
4886                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4887                    inner_offset = next_offset;
4888                } else {
4889                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4890                    inner_depth.increment()?;
4891                }
4892                let val_ref = self.bus_info.get_or_insert_with(|| {
4893                    fidl::new_empty!(BusInfo, fidl::encoding::DefaultFuchsiaResourceDialect)
4894                });
4895                fidl::decode!(
4896                    BusInfo,
4897                    fidl::encoding::DefaultFuchsiaResourceDialect,
4898                    val_ref,
4899                    decoder,
4900                    inner_offset,
4901                    inner_depth
4902                )?;
4903                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4904                {
4905                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4906                }
4907                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4908                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4909                }
4910            }
4911
4912            next_offset += envelope_size;
4913            _next_ordinal_to_read += 1;
4914            if next_offset >= end_offset {
4915                return Ok(());
4916            }
4917
4918            // Decode unknown envelopes for gaps in ordinals.
4919            while _next_ordinal_to_read < 8 {
4920                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4921                _next_ordinal_to_read += 1;
4922                next_offset += envelope_size;
4923            }
4924
4925            let next_out_of_line = decoder.next_out_of_line();
4926            let handles_before = decoder.remaining_handles();
4927            if let Some((inlined, num_bytes, num_handles)) =
4928                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4929            {
4930                let member_inline_size = <fidl::encoding::Vector<NodeProperty2, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4931                if inlined != (member_inline_size <= 4) {
4932                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4933                }
4934                let inner_offset;
4935                let mut inner_depth = depth.clone();
4936                if inlined {
4937                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4938                    inner_offset = next_offset;
4939                } else {
4940                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4941                    inner_depth.increment()?;
4942                }
4943                let val_ref =
4944                self.properties2.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NodeProperty2, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
4945                fidl::decode!(fidl::encoding::Vector<NodeProperty2, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4946                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4947                {
4948                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4949                }
4950                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4951                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4952                }
4953            }
4954
4955            next_offset += envelope_size;
4956
4957            // Decode the remaining unknown envelopes.
4958            while next_offset < end_offset {
4959                _next_ordinal_to_read += 1;
4960                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4961                next_offset += envelope_size;
4962            }
4963
4964            Ok(())
4965        }
4966    }
4967
4968    impl NodeControllerOnBindRequest {
4969        #[inline(always)]
4970        fn max_ordinal_present(&self) -> u64 {
4971            if let Some(_) = self.node_token {
4972                return 1;
4973            }
4974            0
4975        }
4976    }
4977
4978    impl fidl::encoding::ResourceTypeMarker for NodeControllerOnBindRequest {
4979        type Borrowed<'a> = &'a mut Self;
4980        fn take_or_borrow<'a>(
4981            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4982        ) -> Self::Borrowed<'a> {
4983            value
4984        }
4985    }
4986
4987    unsafe impl fidl::encoding::TypeMarker for NodeControllerOnBindRequest {
4988        type Owned = Self;
4989
4990        #[inline(always)]
4991        fn inline_align(_context: fidl::encoding::Context) -> usize {
4992            8
4993        }
4994
4995        #[inline(always)]
4996        fn inline_size(_context: fidl::encoding::Context) -> usize {
4997            16
4998        }
4999    }
5000
5001    unsafe impl
5002        fidl::encoding::Encode<
5003            NodeControllerOnBindRequest,
5004            fidl::encoding::DefaultFuchsiaResourceDialect,
5005        > for &mut NodeControllerOnBindRequest
5006    {
5007        unsafe fn encode(
5008            self,
5009            encoder: &mut fidl::encoding::Encoder<
5010                '_,
5011                fidl::encoding::DefaultFuchsiaResourceDialect,
5012            >,
5013            offset: usize,
5014            mut depth: fidl::encoding::Depth,
5015        ) -> fidl::Result<()> {
5016            encoder.debug_check_bounds::<NodeControllerOnBindRequest>(offset);
5017            // Vector header
5018            let max_ordinal: u64 = self.max_ordinal_present();
5019            encoder.write_num(max_ordinal, offset);
5020            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5021            // Calling encoder.out_of_line_offset(0) is not allowed.
5022            if max_ordinal == 0 {
5023                return Ok(());
5024            }
5025            depth.increment()?;
5026            let envelope_size = 8;
5027            let bytes_len = max_ordinal as usize * envelope_size;
5028            #[allow(unused_variables)]
5029            let offset = encoder.out_of_line_offset(bytes_len);
5030            let mut _prev_end_offset: usize = 0;
5031            if 1 > max_ordinal {
5032                return Ok(());
5033            }
5034
5035            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5036            // are envelope_size bytes.
5037            let cur_offset: usize = (1 - 1) * envelope_size;
5038
5039            // Zero reserved fields.
5040            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5041
5042            // Safety:
5043            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5044            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5045            //   envelope_size bytes, there is always sufficient room.
5046            fidl::encoding::encode_in_envelope_optional::<
5047                fidl::encoding::HandleType<
5048                    fidl::Event,
5049                    { fidl::ObjectType::EVENT.into_raw() },
5050                    2147483648,
5051                >,
5052                fidl::encoding::DefaultFuchsiaResourceDialect,
5053            >(
5054                self.node_token.as_mut().map(
5055                    <fidl::encoding::HandleType<
5056                        fidl::Event,
5057                        { fidl::ObjectType::EVENT.into_raw() },
5058                        2147483648,
5059                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5060                ),
5061                encoder,
5062                offset + cur_offset,
5063                depth,
5064            )?;
5065
5066            _prev_end_offset = cur_offset + envelope_size;
5067
5068            Ok(())
5069        }
5070    }
5071
5072    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5073        for NodeControllerOnBindRequest
5074    {
5075        #[inline(always)]
5076        fn new_empty() -> Self {
5077            Self::default()
5078        }
5079
5080        unsafe fn decode(
5081            &mut self,
5082            decoder: &mut fidl::encoding::Decoder<
5083                '_,
5084                fidl::encoding::DefaultFuchsiaResourceDialect,
5085            >,
5086            offset: usize,
5087            mut depth: fidl::encoding::Depth,
5088        ) -> fidl::Result<()> {
5089            decoder.debug_check_bounds::<Self>(offset);
5090            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5091                None => return Err(fidl::Error::NotNullable),
5092                Some(len) => len,
5093            };
5094            // Calling decoder.out_of_line_offset(0) is not allowed.
5095            if len == 0 {
5096                return Ok(());
5097            };
5098            depth.increment()?;
5099            let envelope_size = 8;
5100            let bytes_len = len * envelope_size;
5101            let offset = decoder.out_of_line_offset(bytes_len)?;
5102            // Decode the envelope for each type.
5103            let mut _next_ordinal_to_read = 0;
5104            let mut next_offset = offset;
5105            let end_offset = offset + bytes_len;
5106            _next_ordinal_to_read += 1;
5107            if next_offset >= end_offset {
5108                return Ok(());
5109            }
5110
5111            // Decode unknown envelopes for gaps in ordinals.
5112            while _next_ordinal_to_read < 1 {
5113                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5114                _next_ordinal_to_read += 1;
5115                next_offset += envelope_size;
5116            }
5117
5118            let next_out_of_line = decoder.next_out_of_line();
5119            let handles_before = decoder.remaining_handles();
5120            if let Some((inlined, num_bytes, num_handles)) =
5121                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5122            {
5123                let member_inline_size = <fidl::encoding::HandleType<
5124                    fidl::Event,
5125                    { fidl::ObjectType::EVENT.into_raw() },
5126                    2147483648,
5127                > as fidl::encoding::TypeMarker>::inline_size(
5128                    decoder.context
5129                );
5130                if inlined != (member_inline_size <= 4) {
5131                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5132                }
5133                let inner_offset;
5134                let mut inner_depth = depth.clone();
5135                if inlined {
5136                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5137                    inner_offset = next_offset;
5138                } else {
5139                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5140                    inner_depth.increment()?;
5141                }
5142                let val_ref =
5143                self.node_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
5144                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5145                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5146                {
5147                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5148                }
5149                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5150                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5151                }
5152            }
5153
5154            next_offset += envelope_size;
5155
5156            // Decode the remaining unknown envelopes.
5157            while next_offset < end_offset {
5158                _next_ordinal_to_read += 1;
5159                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5160                next_offset += envelope_size;
5161            }
5162
5163            Ok(())
5164        }
5165    }
5166
5167    impl fidl::encoding::ResourceTypeMarker for DriverResult {
5168        type Borrowed<'a> = &'a mut Self;
5169        fn take_or_borrow<'a>(
5170            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5171        ) -> Self::Borrowed<'a> {
5172            value
5173        }
5174    }
5175
5176    unsafe impl fidl::encoding::TypeMarker for DriverResult {
5177        type Owned = Self;
5178
5179        #[inline(always)]
5180        fn inline_align(_context: fidl::encoding::Context) -> usize {
5181            8
5182        }
5183
5184        #[inline(always)]
5185        fn inline_size(_context: fidl::encoding::Context) -> usize {
5186            16
5187        }
5188    }
5189
5190    unsafe impl fidl::encoding::Encode<DriverResult, fidl::encoding::DefaultFuchsiaResourceDialect>
5191        for &mut DriverResult
5192    {
5193        #[inline]
5194        unsafe fn encode(
5195            self,
5196            encoder: &mut fidl::encoding::Encoder<
5197                '_,
5198                fidl::encoding::DefaultFuchsiaResourceDialect,
5199            >,
5200            offset: usize,
5201            _depth: fidl::encoding::Depth,
5202        ) -> fidl::Result<()> {
5203            encoder.debug_check_bounds::<DriverResult>(offset);
5204            encoder.write_num::<u64>(self.ordinal(), offset);
5205            match self {
5206                DriverResult::DriverStartedNodeToken(ref mut val) => {
5207                    fidl::encoding::encode_in_envelope::<
5208                        fidl::encoding::HandleType<
5209                            fidl::Event,
5210                            { fidl::ObjectType::EVENT.into_raw() },
5211                            2147483648,
5212                        >,
5213                        fidl::encoding::DefaultFuchsiaResourceDialect,
5214                    >(
5215                        <fidl::encoding::HandleType<
5216                            fidl::Event,
5217                            { fidl::ObjectType::EVENT.into_raw() },
5218                            2147483648,
5219                        > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5220                            val
5221                        ),
5222                        encoder,
5223                        offset + 8,
5224                        _depth,
5225                    )
5226                }
5227                DriverResult::MatchError(ref val) => fidl::encoding::encode_in_envelope::<
5228                    i32,
5229                    fidl::encoding::DefaultFuchsiaResourceDialect,
5230                >(
5231                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
5232                    encoder,
5233                    offset + 8,
5234                    _depth,
5235                ),
5236                DriverResult::StartError(ref val) => fidl::encoding::encode_in_envelope::<
5237                    i32,
5238                    fidl::encoding::DefaultFuchsiaResourceDialect,
5239                >(
5240                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
5241                    encoder,
5242                    offset + 8,
5243                    _depth,
5244                ),
5245                DriverResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
5246            }
5247        }
5248    }
5249
5250    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DriverResult {
5251        #[inline(always)]
5252        fn new_empty() -> Self {
5253            Self::__SourceBreaking { unknown_ordinal: 0 }
5254        }
5255
5256        #[inline]
5257        unsafe fn decode(
5258            &mut self,
5259            decoder: &mut fidl::encoding::Decoder<
5260                '_,
5261                fidl::encoding::DefaultFuchsiaResourceDialect,
5262            >,
5263            offset: usize,
5264            mut depth: fidl::encoding::Depth,
5265        ) -> fidl::Result<()> {
5266            decoder.debug_check_bounds::<Self>(offset);
5267            #[allow(unused_variables)]
5268            let next_out_of_line = decoder.next_out_of_line();
5269            let handles_before = decoder.remaining_handles();
5270            let (ordinal, inlined, num_bytes, num_handles) =
5271                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5272
5273            let member_inline_size = match ordinal {
5274                1 => <fidl::encoding::HandleType<
5275                    fidl::Event,
5276                    { fidl::ObjectType::EVENT.into_raw() },
5277                    2147483648,
5278                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5279                2 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5280                3 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5281                0 => return Err(fidl::Error::UnknownUnionTag),
5282                _ => num_bytes as usize,
5283            };
5284
5285            if inlined != (member_inline_size <= 4) {
5286                return Err(fidl::Error::InvalidInlineBitInEnvelope);
5287            }
5288            let _inner_offset;
5289            if inlined {
5290                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5291                _inner_offset = offset + 8;
5292            } else {
5293                depth.increment()?;
5294                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5295            }
5296            match ordinal {
5297                1 => {
5298                    #[allow(irrefutable_let_patterns)]
5299                    if let DriverResult::DriverStartedNodeToken(_) = self {
5300                        // Do nothing, read the value into the object
5301                    } else {
5302                        // Initialize `self` to the right variant
5303                        *self = DriverResult::DriverStartedNodeToken(
5304                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5305                        );
5306                    }
5307                    #[allow(irrefutable_let_patterns)]
5308                    if let DriverResult::DriverStartedNodeToken(ref mut val) = self {
5309                        fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
5310                    } else {
5311                        unreachable!()
5312                    }
5313                }
5314                2 => {
5315                    #[allow(irrefutable_let_patterns)]
5316                    if let DriverResult::MatchError(_) = self {
5317                        // Do nothing, read the value into the object
5318                    } else {
5319                        // Initialize `self` to the right variant
5320                        *self = DriverResult::MatchError(fidl::new_empty!(
5321                            i32,
5322                            fidl::encoding::DefaultFuchsiaResourceDialect
5323                        ));
5324                    }
5325                    #[allow(irrefutable_let_patterns)]
5326                    if let DriverResult::MatchError(ref mut val) = self {
5327                        fidl::decode!(
5328                            i32,
5329                            fidl::encoding::DefaultFuchsiaResourceDialect,
5330                            val,
5331                            decoder,
5332                            _inner_offset,
5333                            depth
5334                        )?;
5335                    } else {
5336                        unreachable!()
5337                    }
5338                }
5339                3 => {
5340                    #[allow(irrefutable_let_patterns)]
5341                    if let DriverResult::StartError(_) = self {
5342                        // Do nothing, read the value into the object
5343                    } else {
5344                        // Initialize `self` to the right variant
5345                        *self = DriverResult::StartError(fidl::new_empty!(
5346                            i32,
5347                            fidl::encoding::DefaultFuchsiaResourceDialect
5348                        ));
5349                    }
5350                    #[allow(irrefutable_let_patterns)]
5351                    if let DriverResult::StartError(ref mut val) = self {
5352                        fidl::decode!(
5353                            i32,
5354                            fidl::encoding::DefaultFuchsiaResourceDialect,
5355                            val,
5356                            decoder,
5357                            _inner_offset,
5358                            depth
5359                        )?;
5360                    } else {
5361                        unreachable!()
5362                    }
5363                }
5364                #[allow(deprecated)]
5365                ordinal => {
5366                    for _ in 0..num_handles {
5367                        decoder.drop_next_handle()?;
5368                    }
5369                    *self = DriverResult::__SourceBreaking { unknown_ordinal: ordinal };
5370                }
5371            }
5372            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5373                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5374            }
5375            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5376                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5377            }
5378            Ok(())
5379        }
5380    }
5381}