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