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