Skip to main content

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, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DriverResumeRequest {
16    pub power_element_lease: Option<fidl::EventPair>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverResumeRequest {}
20
21#[derive(Debug, PartialEq)]
22pub struct DriverStartRequest {
23    pub start_args: DriverStartArgs,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverStartRequest {}
27
28#[derive(Debug, PartialEq)]
29pub struct NodeAddChildRequest {
30    pub args: NodeAddArgs,
31    pub controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
32    pub node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NodeAddChildRequest {}
36
37#[derive(Debug, PartialEq)]
38pub struct NodeManagerAddNodeRequest {
39    pub node: Node2,
40    pub controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
41    pub node_ref: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NodeManagerAddNodeRequest {}
45
46#[derive(Debug, PartialEq)]
47pub struct NodeProvideResourceRequest {
48    pub resource: ResourceArgs,
49    pub controller: fidl::endpoints::ServerEnd<ResourceControllerMarker>,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53    for NodeProvideResourceRequest
54{
55}
56
57#[derive(Debug, Default, PartialEq)]
58pub struct DevfsAddArgs {
59    /// This is the connector to be installed in devfs.
60    /// `Connect()` will be called when a client connects to this node in the filesystem.
61    /// Optional: If this is not provided then an empty node will appear in devfs.
62    pub connector: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>>,
63    /// This is the class name for installing this node in devfs.
64    /// The node will be placed within /dev/class/{class_name}.
65    /// If `class_name` does not exist under /dev/class/ it will be created.
66    /// Optional: If this is not provided then the node will only be added via topological path.
67    pub class_name: Option<String>,
68    /// This is a vmo of inspect data that will be installed in devfs.
69    /// Optional: If this is not provided then the devfs's inspect data will be empty.
70    pub inspect: Option<fidl::Vmo>,
71    /// The connection types that are supported by the |connector| given.
72    /// The driver framework should handle connection types that are not supported by the
73    /// connector.
74    /// If not provided, only the device type is assumed as supported by the connector.
75    pub connector_supports: Option<fidl_fuchsia_device_fs::ConnectionType>,
76    /// This is the controller connector to be installed in devfs.
77    /// `Connect()` will be called when a client connects to the device_controller connection
78    /// for this node in the filesystem.
79    /// Optional: If this is not provided then the Node will handle the connection natively.
80    /// This option should only be used by the compat shim or in tests
81    pub controller_connector:
82        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>>,
83    #[doc(hidden)]
84    pub __source_breaking: fidl::marker::SourceBreaking,
85}
86
87impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DevfsAddArgs {}
88
89/// Arguments for starting a driver.
90#[derive(Debug, Default, PartialEq)]
91pub struct DriverStartArgs {
92    /// Node that the driver is bound to.
93    pub node: Option<fidl::endpoints::ClientEnd<NodeMarker>>,
94    /// Symbols provided to the driver, for |node|. These come from the driver
95    /// that added |node|, and are filtered to the symbols requested in the bind
96    /// program.
97    pub symbols: Option<Vec<NodeSymbol>>,
98    /// URL of the package containing the driver. This is purely informational,
99    /// used only to provide data for inspect.
100    pub url: Option<String>,
101    /// Information about the driver to start. Currently, we support the
102    /// following entries:
103    ///   1. "binary": a string containing the package-relative path to the
104    ///      driver binary.
105    ///   2. "colocate" (optional): a string containing "true" or "false"
106    ///      specifying whether the driver should be colocated in the same
107    ///      driver host as the driver that added |node|. If not specified, the
108    ///      driver will be launched in a new driver host.
109    ///   3. "default_dispatcher_opts" (optional): an array of strings specifying
110    ///      the options for creating the default dispatcher. A string can be one
111    ///      of the following:
112    ///      * `allow_sync_calls`: allows synchronous calls to be done on the
113    ///      default dispatcher's thread.
114    ///   4. "default_dispatcher_scheduler_role" (optional): the scheduler role to
115    ///      set for the default dispatcher created for the driver.
116    pub program: Option<fidl_fuchsia_data::Dictionary>,
117    /// Incoming namespace provided to the driver.
118    pub incoming: Option<Vec<fidl_fuchsia_component_runner::ComponentNamespaceEntry>>,
119    /// Outgoing directory served by the driver.
120    pub outgoing_dir: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
121    /// Configuration passed to the driver.
122    pub config: Option<fidl::Vmo>,
123    /// The name of the node the driver is bound to.
124    pub node_name: Option<String>,
125    /// Node offers of the node the driver is bound to.
126    pub node_offers: Option<Vec<Offer>>,
127    /// Provides a token representing this node which can be exchanged with the
128    /// driver framework to discern additional information about this node.
129    pub node_token: Option<fidl::Event>,
130    pub node_properties_2: Option<Vec<NodePropertyEntry2>>,
131    /// Root VMAR the driver is mapped into. All child mappings should be placed into this VMAR
132    /// if they want to have the same scheduler profile applied to them.
133    pub vmar: Option<fidl::Vmar>,
134    /// Handles related to the driver's power elements on products where suspend is enabled by the
135    /// `fuchsia.power.SuspendEnabled` config capability.
136    /// If the driver's manifest contains `suspend_enabled = "true"` in the program section of its
137    /// manifest, the `element_server`, `lessor_client`, and `token` are passed to the driver,
138    /// otherwise the handles are retained by the driver host. `control_client` is always retained
139    /// by the driver host and never passed to the driver.
140    pub power_element_args: Option<PowerElementArgs>,
141    /// Log sink channel.
142    pub log_sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
143    #[doc(hidden)]
144    pub __source_breaking: fidl::marker::SourceBreaking,
145}
146
147impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverStartArgs {}
148
149/// Arguments for adding a node.
150#[derive(Debug, Default, PartialEq)]
151pub struct NodeAddArgs {
152    /// Name of the node.
153    pub name: Option<String>,
154    /// Functions to provide to the driver that is bound to this node.
155    pub symbols: Option<Vec<NodeSymbol>>,
156    /// The arguments for how this node should be added to devfs.
157    pub devfs_args: Option<DevfsAddArgs>,
158    /// Capabilities to offer to the driver that is bound to this node.
159    /// The driver must ensure these capabilities are added to its outgoing directory or in the
160    /// |offers_dictionary| (if any of these are |dictionary_offer| type)
161    /// before adding the child node.
162    pub offers2: Option<Vec<Offer>>,
163    /// Information that feeds into a structured bus topology for the device. It should
164    /// only be specified by bus drivers, ideally those which are included by default.
165    pub bus_info: Option<BusInfo>,
166    /// Properties of the node.
167    pub properties2: Option<Vec<NodeProperty2>>,
168    /// This can be used to provide additional offers, through a dictionary, to the driver that is
169    /// bound to this node. The user MUST use the |offers2| field to specify |dictionary_offer|
170    /// type offers for offers that exist in this dictionary.
171    pub offers_dictionary: Option<fidl_fuchsia_component_sandbox::DictionaryRef>,
172    /// An identifier for the driver host which a driver that binds to this node should live in.
173    /// All drivers which specify the same identifier will be colocated into the same driver host.
174    /// If the driver host hasn't been started, it will be started upon the time the node is bound
175    /// to. Only respected if the driver binds directly to this node. If a composite binds to this
176    /// node, then this field will be ignored as it should be expressed in the composite node spec
177    /// instead.
178    pub driver_host: Option<String>,
179    #[doc(hidden)]
180    pub __source_breaking: fidl::marker::SourceBreaking,
181}
182
183impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NodeAddArgs {}
184
185#[derive(Debug, Default, PartialEq)]
186pub struct NodeControllerOnBindRequest {
187    /// Provides a token representing this node which can be exchanged with the
188    /// driver framework to discern additional information about this node.
189    pub node_token: Option<fidl::Event>,
190    #[doc(hidden)]
191    pub __source_breaking: fidl::marker::SourceBreaking,
192}
193
194impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
195    for NodeControllerOnBindRequest
196{
197}
198
199#[derive(Debug, Default, PartialEq)]
200pub struct PowerElementArgs {
201    pub control_client:
202        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::ElementControlMarker>>,
203    pub runner_server:
204        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::ElementRunnerMarker>>,
205    pub lessor_client: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::LessorMarker>>,
206    pub token: Option<fidl::Event>,
207    #[doc(hidden)]
208    pub __source_breaking: fidl::marker::SourceBreaking,
209}
210
211impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PowerElementArgs {}
212
213/// Arguments for providing a resource.
214#[derive(Debug, Default, PartialEq)]
215pub struct ResourceArgs {
216    /// Name of the resource. Required.
217    pub name: Option<String>,
218    /// Properties of the resource. Required.
219    pub properties: Option<Vec<NodeProperty2>>,
220    /// Capabilities the resource offers to the node that depends on it. Required.
221    pub offers: Option<Vec<Offer>>,
222    /// Information that feeds into a structured bus topology for the device. It should
223    /// only be specified by bus drivers, ideally those which are included by default. Optional.
224    pub bus_info: Option<BusInfo>,
225    #[doc(hidden)]
226    pub __source_breaking: fidl::marker::SourceBreaking,
227}
228
229impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ResourceArgs {}
230
231#[derive(Debug)]
232pub enum DriverResult {
233    /// The token that belongs to the node that a driver has started successfully on.
234    DriverStartedNodeToken(fidl::Event),
235    /// The node failed to find a matching driver or composite spec.
236    MatchError(i32),
237    /// The driver that bound to the node failed to start successfully.
238    StartError(i32),
239    #[doc(hidden)]
240    __SourceBreaking { unknown_ordinal: u64 },
241}
242
243/// Pattern that matches an unknown `DriverResult` member.
244#[macro_export]
245macro_rules! DriverResultUnknown {
246    () => {
247        _
248    };
249}
250
251// Custom PartialEq so that unknown variants are not equal to themselves.
252impl PartialEq for DriverResult {
253    fn eq(&self, other: &Self) -> bool {
254        match (self, other) {
255            (Self::DriverStartedNodeToken(x), Self::DriverStartedNodeToken(y)) => *x == *y,
256            (Self::MatchError(x), Self::MatchError(y)) => *x == *y,
257            (Self::StartError(x), Self::StartError(y)) => *x == *y,
258            _ => false,
259        }
260    }
261}
262
263impl DriverResult {
264    #[inline]
265    pub fn ordinal(&self) -> u64 {
266        match *self {
267            Self::DriverStartedNodeToken(_) => 1,
268            Self::MatchError(_) => 2,
269            Self::StartError(_) => 3,
270            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
271        }
272    }
273
274    #[inline]
275    pub fn unknown_variant_for_testing() -> Self {
276        Self::__SourceBreaking { unknown_ordinal: 0 }
277    }
278
279    #[inline]
280    pub fn is_unknown(&self) -> bool {
281        match self {
282            Self::__SourceBreaking { .. } => true,
283            _ => false,
284        }
285    }
286}
287
288impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverResult {}
289
290#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
291pub struct CompositeNodeManagerMarker;
292
293impl fidl::endpoints::ProtocolMarker for CompositeNodeManagerMarker {
294    type Proxy = CompositeNodeManagerProxy;
295    type RequestStream = CompositeNodeManagerRequestStream;
296    #[cfg(target_os = "fuchsia")]
297    type SynchronousProxy = CompositeNodeManagerSynchronousProxy;
298
299    const DEBUG_NAME: &'static str = "fuchsia.driver.framework.CompositeNodeManager";
300}
301impl fidl::endpoints::DiscoverableProtocolMarker for CompositeNodeManagerMarker {}
302pub type CompositeNodeManagerAddSpecResult = Result<(), CompositeNodeSpecError>;
303
304pub trait CompositeNodeManagerProxyInterface: Send + Sync {
305    type AddSpecResponseFut: std::future::Future<Output = Result<CompositeNodeManagerAddSpecResult, fidl::Error>>
306        + Send;
307    fn r#add_spec(&self, payload: &CompositeNodeSpec) -> Self::AddSpecResponseFut;
308}
309#[derive(Debug)]
310#[cfg(target_os = "fuchsia")]
311pub struct CompositeNodeManagerSynchronousProxy {
312    client: fidl::client::sync::Client,
313}
314
315#[cfg(target_os = "fuchsia")]
316impl fidl::endpoints::SynchronousProxy for CompositeNodeManagerSynchronousProxy {
317    type Proxy = CompositeNodeManagerProxy;
318    type Protocol = CompositeNodeManagerMarker;
319
320    fn from_channel(inner: fidl::Channel) -> Self {
321        Self::new(inner)
322    }
323
324    fn into_channel(self) -> fidl::Channel {
325        self.client.into_channel()
326    }
327
328    fn as_channel(&self) -> &fidl::Channel {
329        self.client.as_channel()
330    }
331}
332
333#[cfg(target_os = "fuchsia")]
334impl CompositeNodeManagerSynchronousProxy {
335    pub fn new(channel: fidl::Channel) -> Self {
336        Self { client: fidl::client::sync::Client::new(channel) }
337    }
338
339    pub fn into_channel(self) -> fidl::Channel {
340        self.client.into_channel()
341    }
342
343    /// Waits until an event arrives and returns it. It is safe for other
344    /// threads to make concurrent requests while waiting for an event.
345    pub fn wait_for_event(
346        &self,
347        deadline: zx::MonotonicInstant,
348    ) -> Result<CompositeNodeManagerEvent, fidl::Error> {
349        CompositeNodeManagerEvent::decode(
350            self.client.wait_for_event::<CompositeNodeManagerMarker>(deadline)?,
351        )
352    }
353
354    /// Adds the given composite node specification to the driver framework.
355    pub fn r#add_spec(
356        &self,
357        mut payload: &CompositeNodeSpec,
358        ___deadline: zx::MonotonicInstant,
359    ) -> Result<CompositeNodeManagerAddSpecResult, fidl::Error> {
360        let _response =
361            self.client
362                .send_query::<CompositeNodeSpec, fidl::encoding::FlexibleResultType<
363                    fidl::encoding::EmptyStruct,
364                    CompositeNodeSpecError,
365                >, CompositeNodeManagerMarker>(
366                    payload,
367                    0x524e353c8130cc74,
368                    fidl::encoding::DynamicFlags::FLEXIBLE,
369                    ___deadline,
370                )?
371                .into_result::<CompositeNodeManagerMarker>("add_spec")?;
372        Ok(_response.map(|x| x))
373    }
374}
375
376#[cfg(target_os = "fuchsia")]
377impl From<CompositeNodeManagerSynchronousProxy> for zx::NullableHandle {
378    fn from(value: CompositeNodeManagerSynchronousProxy) -> Self {
379        value.into_channel().into()
380    }
381}
382
383#[cfg(target_os = "fuchsia")]
384impl From<fidl::Channel> for CompositeNodeManagerSynchronousProxy {
385    fn from(value: fidl::Channel) -> Self {
386        Self::new(value)
387    }
388}
389
390#[cfg(target_os = "fuchsia")]
391impl fidl::endpoints::FromClient for CompositeNodeManagerSynchronousProxy {
392    type Protocol = CompositeNodeManagerMarker;
393
394    fn from_client(value: fidl::endpoints::ClientEnd<CompositeNodeManagerMarker>) -> Self {
395        Self::new(value.into_channel())
396    }
397}
398
399#[derive(Debug, Clone)]
400pub struct CompositeNodeManagerProxy {
401    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
402}
403
404impl fidl::endpoints::Proxy for CompositeNodeManagerProxy {
405    type Protocol = CompositeNodeManagerMarker;
406
407    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
408        Self::new(inner)
409    }
410
411    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
412        self.client.into_channel().map_err(|client| Self { client })
413    }
414
415    fn as_channel(&self) -> &::fidl::AsyncChannel {
416        self.client.as_channel()
417    }
418}
419
420impl CompositeNodeManagerProxy {
421    /// Create a new Proxy for fuchsia.driver.framework/CompositeNodeManager.
422    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
423        let protocol_name =
424            <CompositeNodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
425        Self { client: fidl::client::Client::new(channel, protocol_name) }
426    }
427
428    /// Get a Stream of events from the remote end of the protocol.
429    ///
430    /// # Panics
431    ///
432    /// Panics if the event stream was already taken.
433    pub fn take_event_stream(&self) -> CompositeNodeManagerEventStream {
434        CompositeNodeManagerEventStream { event_receiver: self.client.take_event_receiver() }
435    }
436
437    /// Adds the given composite node specification to the driver framework.
438    pub fn r#add_spec(
439        &self,
440        mut payload: &CompositeNodeSpec,
441    ) -> fidl::client::QueryResponseFut<
442        CompositeNodeManagerAddSpecResult,
443        fidl::encoding::DefaultFuchsiaResourceDialect,
444    > {
445        CompositeNodeManagerProxyInterface::r#add_spec(self, payload)
446    }
447}
448
449impl CompositeNodeManagerProxyInterface for CompositeNodeManagerProxy {
450    type AddSpecResponseFut = fidl::client::QueryResponseFut<
451        CompositeNodeManagerAddSpecResult,
452        fidl::encoding::DefaultFuchsiaResourceDialect,
453    >;
454    fn r#add_spec(&self, mut payload: &CompositeNodeSpec) -> Self::AddSpecResponseFut {
455        fn _decode(
456            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
457        ) -> Result<CompositeNodeManagerAddSpecResult, fidl::Error> {
458            let _response = fidl::client::decode_transaction_body::<
459                fidl::encoding::FlexibleResultType<
460                    fidl::encoding::EmptyStruct,
461                    CompositeNodeSpecError,
462                >,
463                fidl::encoding::DefaultFuchsiaResourceDialect,
464                0x524e353c8130cc74,
465            >(_buf?)?
466            .into_result::<CompositeNodeManagerMarker>("add_spec")?;
467            Ok(_response.map(|x| x))
468        }
469        self.client.send_query_and_decode::<CompositeNodeSpec, CompositeNodeManagerAddSpecResult>(
470            payload,
471            0x524e353c8130cc74,
472            fidl::encoding::DynamicFlags::FLEXIBLE,
473            _decode,
474        )
475    }
476}
477
478pub struct CompositeNodeManagerEventStream {
479    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
480}
481
482impl std::marker::Unpin for CompositeNodeManagerEventStream {}
483
484impl futures::stream::FusedStream for CompositeNodeManagerEventStream {
485    fn is_terminated(&self) -> bool {
486        self.event_receiver.is_terminated()
487    }
488}
489
490impl futures::Stream for CompositeNodeManagerEventStream {
491    type Item = Result<CompositeNodeManagerEvent, fidl::Error>;
492
493    fn poll_next(
494        mut self: std::pin::Pin<&mut Self>,
495        cx: &mut std::task::Context<'_>,
496    ) -> std::task::Poll<Option<Self::Item>> {
497        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
498            &mut self.event_receiver,
499            cx
500        )?) {
501            Some(buf) => std::task::Poll::Ready(Some(CompositeNodeManagerEvent::decode(buf))),
502            None => std::task::Poll::Ready(None),
503        }
504    }
505}
506
507#[derive(Debug)]
508pub enum CompositeNodeManagerEvent {
509    #[non_exhaustive]
510    _UnknownEvent {
511        /// Ordinal of the event that was sent.
512        ordinal: u64,
513    },
514}
515
516impl CompositeNodeManagerEvent {
517    /// Decodes a message buffer as a [`CompositeNodeManagerEvent`].
518    fn decode(
519        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
520    ) -> Result<CompositeNodeManagerEvent, fidl::Error> {
521        let (bytes, _handles) = buf.split_mut();
522        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
523        debug_assert_eq!(tx_header.tx_id, 0);
524        match tx_header.ordinal {
525            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
526                Ok(CompositeNodeManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
527            }
528            _ => Err(fidl::Error::UnknownOrdinal {
529                ordinal: tx_header.ordinal,
530                protocol_name:
531                    <CompositeNodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
532            }),
533        }
534    }
535}
536
537/// A Stream of incoming requests for fuchsia.driver.framework/CompositeNodeManager.
538pub struct CompositeNodeManagerRequestStream {
539    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
540    is_terminated: bool,
541}
542
543impl std::marker::Unpin for CompositeNodeManagerRequestStream {}
544
545impl futures::stream::FusedStream for CompositeNodeManagerRequestStream {
546    fn is_terminated(&self) -> bool {
547        self.is_terminated
548    }
549}
550
551impl fidl::endpoints::RequestStream for CompositeNodeManagerRequestStream {
552    type Protocol = CompositeNodeManagerMarker;
553    type ControlHandle = CompositeNodeManagerControlHandle;
554
555    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
556        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
557    }
558
559    fn control_handle(&self) -> Self::ControlHandle {
560        CompositeNodeManagerControlHandle { inner: self.inner.clone() }
561    }
562
563    fn into_inner(
564        self,
565    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
566    {
567        (self.inner, self.is_terminated)
568    }
569
570    fn from_inner(
571        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
572        is_terminated: bool,
573    ) -> Self {
574        Self { inner, is_terminated }
575    }
576}
577
578impl futures::Stream for CompositeNodeManagerRequestStream {
579    type Item = Result<CompositeNodeManagerRequest, fidl::Error>;
580
581    fn poll_next(
582        mut self: std::pin::Pin<&mut Self>,
583        cx: &mut std::task::Context<'_>,
584    ) -> std::task::Poll<Option<Self::Item>> {
585        let this = &mut *self;
586        if this.inner.check_shutdown(cx) {
587            this.is_terminated = true;
588            return std::task::Poll::Ready(None);
589        }
590        if this.is_terminated {
591            panic!("polled CompositeNodeManagerRequestStream after completion");
592        }
593        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
594            |bytes, handles| {
595                match this.inner.channel().read_etc(cx, bytes, handles) {
596                    std::task::Poll::Ready(Ok(())) => {}
597                    std::task::Poll::Pending => return std::task::Poll::Pending,
598                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
599                        this.is_terminated = true;
600                        return std::task::Poll::Ready(None);
601                    }
602                    std::task::Poll::Ready(Err(e)) => {
603                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
604                            e.into(),
605                        ))));
606                    }
607                }
608
609                // A message has been received from the channel
610                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
611
612                std::task::Poll::Ready(Some(match header.ordinal {
613                0x524e353c8130cc74 => {
614                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
615                    let mut req = fidl::new_empty!(CompositeNodeSpec, fidl::encoding::DefaultFuchsiaResourceDialect);
616                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeNodeSpec>(&header, _body_bytes, handles, &mut req)?;
617                    let control_handle = CompositeNodeManagerControlHandle {
618                        inner: this.inner.clone(),
619                    };
620                    Ok(CompositeNodeManagerRequest::AddSpec {payload: req,
621                        responder: CompositeNodeManagerAddSpecResponder {
622                            control_handle: std::mem::ManuallyDrop::new(control_handle),
623                            tx_id: header.tx_id,
624                        },
625                    })
626                }
627                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
628                    Ok(CompositeNodeManagerRequest::_UnknownMethod {
629                        ordinal: header.ordinal,
630                        control_handle: CompositeNodeManagerControlHandle { inner: this.inner.clone() },
631                        method_type: fidl::MethodType::OneWay,
632                    })
633                }
634                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
635                    this.inner.send_framework_err(
636                        fidl::encoding::FrameworkErr::UnknownMethod,
637                        header.tx_id,
638                        header.ordinal,
639                        header.dynamic_flags(),
640                        (bytes, handles),
641                    )?;
642                    Ok(CompositeNodeManagerRequest::_UnknownMethod {
643                        ordinal: header.ordinal,
644                        control_handle: CompositeNodeManagerControlHandle { inner: this.inner.clone() },
645                        method_type: fidl::MethodType::TwoWay,
646                    })
647                }
648                _ => Err(fidl::Error::UnknownOrdinal {
649                    ordinal: header.ordinal,
650                    protocol_name: <CompositeNodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
651                }),
652            }))
653            },
654        )
655    }
656}
657
658/// Protocol through which board drivers can create composite node specs.
659///
660/// Composite node specs are created at runtime to dynamically bridge the
661/// static bind rules of a composite driver with the dynamic bind properties
662/// of nodes in the system so that the driver bind rules are more generic and reusable.
663#[derive(Debug)]
664pub enum CompositeNodeManagerRequest {
665    /// Adds the given composite node specification to the driver framework.
666    AddSpec { payload: CompositeNodeSpec, responder: CompositeNodeManagerAddSpecResponder },
667    /// An interaction was received which does not match any known method.
668    #[non_exhaustive]
669    _UnknownMethod {
670        /// Ordinal of the method that was called.
671        ordinal: u64,
672        control_handle: CompositeNodeManagerControlHandle,
673        method_type: fidl::MethodType,
674    },
675}
676
677impl CompositeNodeManagerRequest {
678    #[allow(irrefutable_let_patterns)]
679    pub fn into_add_spec(
680        self,
681    ) -> Option<(CompositeNodeSpec, CompositeNodeManagerAddSpecResponder)> {
682        if let CompositeNodeManagerRequest::AddSpec { payload, responder } = self {
683            Some((payload, responder))
684        } else {
685            None
686        }
687    }
688
689    /// Name of the method defined in FIDL
690    pub fn method_name(&self) -> &'static str {
691        match *self {
692            CompositeNodeManagerRequest::AddSpec { .. } => "add_spec",
693            CompositeNodeManagerRequest::_UnknownMethod {
694                method_type: fidl::MethodType::OneWay,
695                ..
696            } => "unknown one-way method",
697            CompositeNodeManagerRequest::_UnknownMethod {
698                method_type: fidl::MethodType::TwoWay,
699                ..
700            } => "unknown two-way method",
701        }
702    }
703}
704
705#[derive(Debug, Clone)]
706pub struct CompositeNodeManagerControlHandle {
707    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
708}
709
710impl CompositeNodeManagerControlHandle {
711    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
712        self.inner.shutdown_with_epitaph(status.into())
713    }
714}
715
716impl fidl::endpoints::ControlHandle for CompositeNodeManagerControlHandle {
717    fn shutdown(&self) {
718        self.inner.shutdown()
719    }
720
721    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
722        self.inner.shutdown_with_epitaph(status)
723    }
724
725    fn is_closed(&self) -> bool {
726        self.inner.channel().is_closed()
727    }
728    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
729        self.inner.channel().on_closed()
730    }
731
732    #[cfg(target_os = "fuchsia")]
733    fn signal_peer(
734        &self,
735        clear_mask: zx::Signals,
736        set_mask: zx::Signals,
737    ) -> Result<(), zx_status::Status> {
738        use fidl::Peered;
739        self.inner.channel().signal_peer(clear_mask, set_mask)
740    }
741}
742
743impl CompositeNodeManagerControlHandle {}
744
745#[must_use = "FIDL methods require a response to be sent"]
746#[derive(Debug)]
747pub struct CompositeNodeManagerAddSpecResponder {
748    control_handle: std::mem::ManuallyDrop<CompositeNodeManagerControlHandle>,
749    tx_id: u32,
750}
751
752/// Set the the channel to be shutdown (see [`CompositeNodeManagerControlHandle::shutdown`])
753/// if the responder is dropped without sending a response, so that the client
754/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
755impl std::ops::Drop for CompositeNodeManagerAddSpecResponder {
756    fn drop(&mut self) {
757        self.control_handle.shutdown();
758        // Safety: drops once, never accessed again
759        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
760    }
761}
762
763impl fidl::endpoints::Responder for CompositeNodeManagerAddSpecResponder {
764    type ControlHandle = CompositeNodeManagerControlHandle;
765
766    fn control_handle(&self) -> &CompositeNodeManagerControlHandle {
767        &self.control_handle
768    }
769
770    fn drop_without_shutdown(mut self) {
771        // Safety: drops once, never accessed again due to mem::forget
772        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
773        // Prevent Drop from running (which would shut down the channel)
774        std::mem::forget(self);
775    }
776}
777
778impl CompositeNodeManagerAddSpecResponder {
779    /// Sends a response to the FIDL transaction.
780    ///
781    /// Sets the channel to shutdown if an error occurs.
782    pub fn send(self, mut result: Result<(), CompositeNodeSpecError>) -> Result<(), fidl::Error> {
783        let _result = self.send_raw(result);
784        if _result.is_err() {
785            self.control_handle.shutdown();
786        }
787        self.drop_without_shutdown();
788        _result
789    }
790
791    /// Similar to "send" but does not shutdown the channel if an error occurs.
792    pub fn send_no_shutdown_on_err(
793        self,
794        mut result: Result<(), CompositeNodeSpecError>,
795    ) -> Result<(), fidl::Error> {
796        let _result = self.send_raw(result);
797        self.drop_without_shutdown();
798        _result
799    }
800
801    fn send_raw(&self, mut result: Result<(), CompositeNodeSpecError>) -> Result<(), fidl::Error> {
802        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
803            fidl::encoding::EmptyStruct,
804            CompositeNodeSpecError,
805        >>(
806            fidl::encoding::FlexibleResult::new(result),
807            self.tx_id,
808            0x524e353c8130cc74,
809            fidl::encoding::DynamicFlags::FLEXIBLE,
810        )
811    }
812}
813
814#[cfg(feature = "driver")]
815#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
816pub struct DriverMarker;
817
818#[cfg(feature = "driver")]
819impl fidl_driver::endpoints::DriverProtocolMarker for DriverMarker {
820    const DEBUG_NAME: &'static str = "(anonymous) Driver";
821}
822pub type DriverStartResult = Result<(), i32>;
823pub type DriverSuspendResult = Result<(), i32>;
824pub type DriverResumeResult = Result<(), i32>;
825
826/// This protocol is used by the Driver Framework's Driver Host to communicate various messages and
827/// lifecycle hooks to the driver. The connection for this protocol is established through the
828/// |DriverRegistration| defined in the `driver_symbols` library.
829///
830/// Once the driver has closed its server end, the Driver Framework will initiate the shutdown
831/// of all dispatchers belonging to this driver.
832
833#[cfg(feature = "driver")]
834#[derive(Debug)]
835pub enum DriverRequest {
836    /// Starts the driver with the given |start_args|.
837    ///
838    /// Drivers should finish their initial setup and enumeration before returning from |Start|.
839    /// In particular they should enumerate all currently available nodes by utilizing
840    /// `fuchsia.driver.framework/Node.AddChild` and waiting for all calls to be completed.
841    ///
842    /// The Framework will not consider the driver to be started until this call has returned
843    /// successfully. Therefore a driver will not have |Stop| called on it until after it has
844    /// replied to |Start| successfully.
845    ///
846    /// If a driver returns an error, it will not have |Stop| called on it before the
847    /// Driver Framework initiates shutdown of the driver's dispatchers. Therefore it should have
848    /// performed all necessary cleanup before returning an error.
849    Start { start_args: DriverStartArgs, responder: DriverStartResponder },
850    /// Stops the driver. To stop, the driver should teardown any resources it set up in or after
851    /// |Start|. This is a one-way FIDL method. When the driver has completed stopping, it should
852    /// close its server end. Asynchronous operations should fully complete before closing
853    /// the server end.
854    Stop {},
855    /// Returns when the driver has suspended the hardware.
856    /// This is called when the power element requests the off power state.
857    /// The driver should turn off the hardware as a response to this call.
858    ///
859    /// Note on execution order after a suspend is requested by the power element:
860    ///  - dispatchers stop accepting new work in the work queue
861    ///  - dispatcher drains previously queued work
862    ///  - Once all work is drained, this method is called
863    ///
864    /// The driver will not immediately |Stop| after it has been suspended.
865    /// It will first go through |Resume| before it is told to |Stop|.
866    Suspend { responder: DriverSuspendResponder },
867    /// Returns when the driver has resumed the hardware.
868    /// This is called when the power framework requests the power element move to the on power state.
869    /// The driver should turn the hardware back on as a response to this call.
870    ///
871    /// |power_element_lease| is the lease associated with the current wake if the
872    /// wake was from a wake vector. Otherwise it is None.
873    ///
874    /// Note on execution order after a resume is requested by the power element:
875    ///  - This method is called (the dispatcher does not accept any other work at this point)
876    ///  - Once this method completes, dispatchers start accepting new work in the work queue
877    Resume { power_element_lease: Option<fidl::EventPair>, responder: DriverResumeResponder },
878    /// An interaction was received which does not match any known method.
879    #[non_exhaustive]
880    _UnknownMethod {
881        /// Ordinal of the method that was called.
882        ordinal: u64,
883        method_type: fidl::MethodType,
884    },
885}
886
887#[cfg(feature = "driver")]
888impl DriverRequest {
889    #[allow(irrefutable_let_patterns)]
890    pub fn into_start(self) -> Option<(DriverStartArgs, DriverStartResponder)> {
891        if let DriverRequest::Start { start_args, responder } = self {
892            Some((start_args, responder))
893        } else {
894            None
895        }
896    }
897
898    #[allow(irrefutable_let_patterns)]
899    pub fn into_stop(self) -> Option<()> {
900        if let DriverRequest::Stop {} = self { Some(()) } else { None }
901    }
902
903    #[allow(irrefutable_let_patterns)]
904    pub fn into_suspend(self) -> Option<(DriverSuspendResponder)> {
905        if let DriverRequest::Suspend { responder } = self { Some((responder)) } else { None }
906    }
907
908    #[allow(irrefutable_let_patterns)]
909    pub fn into_resume(self) -> Option<(Option<fidl::EventPair>, DriverResumeResponder)> {
910        if let DriverRequest::Resume { power_element_lease, responder } = self {
911            Some((power_element_lease, responder))
912        } else {
913            None
914        }
915    }
916
917    pub fn new_start(self, start_args: DriverStartArgs, tx_id: u32) -> Self {
918        Self::Start { start_args, responder: DriverStartResponder { tx_id } }
919    }
920
921    pub fn new_stop(self) -> Self {
922        Self::Stop {}
923    }
924
925    pub fn new_suspend(self, tx_id: u32) -> Self {
926        Self::Suspend { responder: DriverSuspendResponder { tx_id } }
927    }
928
929    pub fn new_resume(self, power_element_lease: Option<fidl::EventPair>, tx_id: u32) -> Self {
930        Self::Resume { power_element_lease, responder: DriverResumeResponder { tx_id } }
931    }
932
933    pub fn r#start_as_message(
934        arena: fdf::Arena,
935        mut start_args: DriverStartArgs,
936        tx_id: u32,
937    ) -> Result<fdf::Message<[u8]>, fidl::Error> {
938        let ordinal = 0x27be00ae42aa60c2;
939        let dynamic_flags = fidl::encoding::DynamicFlags::FLEXIBLE;
940        let body = (&mut start_args,);
941        let msg = fidl::encoding::TransactionMessage {
942            header: fidl::encoding::TransactionHeader::new(tx_id, ordinal, dynamic_flags),
943            body,
944        };
945        fidl::encoding::with_tls_encoded::<
946            fidl::encoding::TransactionMessageType<DriverStartRequest>,
947            fidl::encoding::DefaultFuchsiaResourceDialect,
948            fdf::Message<[u8]>,
949        >(msg, |bytes, mut handles| {
950            let handles = arena.insert_from_iter(
951                std::mem::take(handles)
952                    .into_iter()
953                    .map(fidl_driver::encoding::mixed_from_handle_disposition),
954            );
955            Ok(fdf::Message::new(&arena, Some(arena.insert_slice(bytes)), Some(handles)))
956        })
957    }
958
959    pub fn r#stop_as_message(arena: fdf::Arena) -> Result<fdf::Message<[u8]>, fidl::Error> {
960        let tx_id = 0;
961        let ordinal = 0x4b96c67e29b3843d;
962        let dynamic_flags = fidl::encoding::DynamicFlags::FLEXIBLE;
963        let body = ();
964        let msg = fidl::encoding::TransactionMessage {
965            header: fidl::encoding::TransactionHeader::new(tx_id, ordinal, dynamic_flags),
966            body,
967        };
968        fidl::encoding::with_tls_encoded::<
969            fidl::encoding::TransactionMessageType<fidl::encoding::EmptyPayload>,
970            fidl::encoding::DefaultFuchsiaResourceDialect,
971            fdf::Message<[u8]>,
972        >(msg, |bytes, mut handles| {
973            let handles = arena.insert_from_iter(
974                std::mem::take(handles)
975                    .into_iter()
976                    .map(fidl_driver::encoding::mixed_from_handle_disposition),
977            );
978            Ok(fdf::Message::new(&arena, Some(arena.insert_slice(bytes)), Some(handles)))
979        })
980    }
981
982    pub fn r#suspend_as_message(
983        arena: fdf::Arena,
984        tx_id: u32,
985    ) -> Result<fdf::Message<[u8]>, fidl::Error> {
986        let ordinal = 0x4cebadedf5da22b8;
987        let dynamic_flags = fidl::encoding::DynamicFlags::FLEXIBLE;
988        let body = ();
989        let msg = fidl::encoding::TransactionMessage {
990            header: fidl::encoding::TransactionHeader::new(tx_id, ordinal, dynamic_flags),
991            body,
992        };
993        fidl::encoding::with_tls_encoded::<
994            fidl::encoding::TransactionMessageType<fidl::encoding::EmptyPayload>,
995            fidl::encoding::DefaultFuchsiaResourceDialect,
996            fdf::Message<[u8]>,
997        >(msg, |bytes, mut handles| {
998            let handles = arena.insert_from_iter(
999                std::mem::take(handles)
1000                    .into_iter()
1001                    .map(fidl_driver::encoding::mixed_from_handle_disposition),
1002            );
1003            Ok(fdf::Message::new(&arena, Some(arena.insert_slice(bytes)), Some(handles)))
1004        })
1005    }
1006
1007    pub fn r#resume_as_message(
1008        arena: fdf::Arena,
1009        mut power_element_lease: Option<fidl::EventPair>,
1010        tx_id: u32,
1011    ) -> Result<fdf::Message<[u8]>, fidl::Error> {
1012        let ordinal = 0x2535384cc6595148;
1013        let dynamic_flags = fidl::encoding::DynamicFlags::FLEXIBLE;
1014        let body = (power_element_lease,);
1015        let msg = fidl::encoding::TransactionMessage {
1016            header: fidl::encoding::TransactionHeader::new(tx_id, ordinal, dynamic_flags),
1017            body,
1018        };
1019        fidl::encoding::with_tls_encoded::<
1020            fidl::encoding::TransactionMessageType<DriverResumeRequest>,
1021            fidl::encoding::DefaultFuchsiaResourceDialect,
1022            fdf::Message<[u8]>,
1023        >(msg, |bytes, mut handles| {
1024            let handles = arena.insert_from_iter(
1025                std::mem::take(handles)
1026                    .into_iter()
1027                    .map(fidl_driver::encoding::mixed_from_handle_disposition),
1028            );
1029            Ok(fdf::Message::new(&arena, Some(arena.insert_slice(bytes)), Some(handles)))
1030        })
1031    }
1032
1033    #[allow(irrefutable_let_patterns)]
1034    pub fn read_from(bytes: &[u8], _handles: &mut [zx::HandleInfo]) -> Result<Self, fidl::Error> {
1035        let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1036
1037        match header.ordinal {
1038            0x27be00ae42aa60c2 => {
1039                header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1040                let mut req = fidl::new_empty!(
1041                    DriverStartRequest,
1042                    fidl::encoding::DefaultFuchsiaResourceDialect
1043                );
1044                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverStartRequest>(&header, _body_bytes, _handles, &mut req)?;
1045                Ok(DriverRequest::Start {
1046                    start_args: req.start_args,
1047
1048                    responder: DriverStartResponder { tx_id: header.tx_id },
1049                })
1050            }
1051            0x4b96c67e29b3843d => {
1052                header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1053                let mut req = fidl::new_empty!(
1054                    fidl::encoding::EmptyPayload,
1055                    fidl::encoding::DefaultFuchsiaResourceDialect
1056                );
1057                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, _handles, &mut req)?;
1058                Ok(DriverRequest::Stop {})
1059            }
1060            0x4cebadedf5da22b8 => {
1061                header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1062                let mut req = fidl::new_empty!(
1063                    fidl::encoding::EmptyPayload,
1064                    fidl::encoding::DefaultFuchsiaResourceDialect
1065                );
1066                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, _handles, &mut req)?;
1067                Ok(DriverRequest::Suspend {
1068                    responder: DriverSuspendResponder { tx_id: header.tx_id },
1069                })
1070            }
1071            0x2535384cc6595148 => {
1072                header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1073                let mut req = fidl::new_empty!(
1074                    DriverResumeRequest,
1075                    fidl::encoding::DefaultFuchsiaResourceDialect
1076                );
1077                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverResumeRequest>(&header, _body_bytes, _handles, &mut req)?;
1078                Ok(DriverRequest::Resume {
1079                    power_element_lease: req.power_element_lease,
1080
1081                    responder: DriverResumeResponder { tx_id: header.tx_id },
1082                })
1083            }
1084            _ if header.tx_id == 0
1085                && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1086            {
1087                Ok(DriverRequest::_UnknownMethod {
1088                    ordinal: header.ordinal,
1089                    method_type: fidl::MethodType::OneWay,
1090                })
1091            }
1092            _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1093                Ok(DriverRequest::_UnknownMethod {
1094                    ordinal: header.ordinal,
1095                    method_type: fidl::MethodType::TwoWay,
1096                })
1097            }
1098            _ => Err(fidl::Error::UnknownOrdinal {
1099                ordinal: header.ordinal,
1100                protocol_name:
1101                    <DriverMarker as fidl_driver::endpoints::DriverProtocolMarker>::DEBUG_NAME,
1102            }),
1103        }
1104    }
1105
1106    pub fn read_from_message(
1107        mut message: fdf::Message<[u8]>,
1108    ) -> Result<(fdf::Arena, Self), fidl::Error> {
1109        let (arena, Some(body), handles) = message.take_arena_boxes() else {
1110            return Err(fidl::Error::Invalid);
1111        };
1112        let mut handles =
1113            handles
1114                .map(|handles| {
1115                    arena.try_insert_from_iter(handles.into_iter().map(|handle| unsafe {
1116                        fidl_driver::encoding::mixed_into_handle_info(handle)
1117                    }))
1118                })
1119                .transpose();
1120        let res = match handles {
1121            Ok(ref mut handles) => {
1122                Self::read_from(&*body, handles.as_deref_mut().unwrap_or(&mut []))?
1123            }
1124            Err(_) => return Err(fidl::Error::Invalid),
1125        };
1126        std::mem::drop((body, handles));
1127        Ok((message.take_arena(), res))
1128    }
1129
1130    /// Name of the method defined in FIDL
1131    pub fn method_name(&self) -> &'static str {
1132        match *self {
1133            DriverRequest::Start { .. } => "start",
1134            DriverRequest::Stop { .. } => "stop",
1135            DriverRequest::Suspend { .. } => "suspend",
1136            DriverRequest::Resume { .. } => "resume",
1137            DriverRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1138                "unknown one-way method"
1139            }
1140            DriverRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1141                "unknown two-way method"
1142            }
1143        }
1144    }
1145}
1146
1147/// Like [`DriverRequest::read_from_message`] except it drops the [`Arena`].
1148#[cfg(feature = "driver")]
1149impl std::convert::TryFrom<fdf::Message<[u8]>> for DriverRequest {
1150    type Error = fidl::Error;
1151    fn try_from(msg: fdf::Message<[u8]>) -> Result<DriverRequest, fidl::Error> {
1152        Ok(DriverRequest::read_from_message(msg)?.1)
1153    }
1154}
1155
1156#[must_use = "FIDL methods require a response to be sent"]
1157#[cfg(feature = "driver")]
1158#[derive(Debug)]
1159pub struct DriverStartResponder {
1160    tx_id: u32,
1161}
1162
1163#[cfg(feature = "driver")]
1164impl DriverStartResponder {
1165    pub fn send_response(
1166        &self,
1167        server_handle: &fdf::Channel<[u8]>,
1168        mut result: Result<(), i32>,
1169    ) -> Result<(), fidl::Error> {
1170        let msg = fidl::encoding::TransactionMessage {
1171            header: fidl::encoding::TransactionHeader::new(
1172                self.tx_id,
1173                0x27be00ae42aa60c2,
1174                fidl::encoding::DynamicFlags::FLEXIBLE,
1175            ),
1176            body: fidl::encoding::FlexibleResult::new(result),
1177        };
1178        fidl::encoding::with_tls_encoded::<
1179            fidl::encoding::TransactionMessageType<
1180                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1181            >,
1182            fidl::encoding::DefaultFuchsiaResourceDialect,
1183            (),
1184        >(msg, |body, _handles| {
1185            server_handle
1186                .write_with_data(fdf::Arena::new(), |arena| arena.insert_slice(&body))
1187                .unwrap();
1188            Ok(())
1189        })
1190    }
1191}
1192
1193#[must_use = "FIDL methods require a response to be sent"]
1194#[cfg(feature = "driver")]
1195#[derive(Debug)]
1196pub struct DriverSuspendResponder {
1197    tx_id: u32,
1198}
1199
1200#[cfg(feature = "driver")]
1201impl DriverSuspendResponder {
1202    pub fn send_response(
1203        &self,
1204        server_handle: &fdf::Channel<[u8]>,
1205        mut result: Result<(), i32>,
1206    ) -> Result<(), fidl::Error> {
1207        let msg = fidl::encoding::TransactionMessage {
1208            header: fidl::encoding::TransactionHeader::new(
1209                self.tx_id,
1210                0x4cebadedf5da22b8,
1211                fidl::encoding::DynamicFlags::FLEXIBLE,
1212            ),
1213            body: fidl::encoding::FlexibleResult::new(result),
1214        };
1215        fidl::encoding::with_tls_encoded::<
1216            fidl::encoding::TransactionMessageType<
1217                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1218            >,
1219            fidl::encoding::DefaultFuchsiaResourceDialect,
1220            (),
1221        >(msg, |body, _handles| {
1222            server_handle
1223                .write_with_data(fdf::Arena::new(), |arena| arena.insert_slice(&body))
1224                .unwrap();
1225            Ok(())
1226        })
1227    }
1228}
1229
1230#[must_use = "FIDL methods require a response to be sent"]
1231#[cfg(feature = "driver")]
1232#[derive(Debug)]
1233pub struct DriverResumeResponder {
1234    tx_id: u32,
1235}
1236
1237#[cfg(feature = "driver")]
1238impl DriverResumeResponder {
1239    pub fn send_response(
1240        &self,
1241        server_handle: &fdf::Channel<[u8]>,
1242        mut result: Result<(), i32>,
1243    ) -> Result<(), fidl::Error> {
1244        let msg = fidl::encoding::TransactionMessage {
1245            header: fidl::encoding::TransactionHeader::new(
1246                self.tx_id,
1247                0x2535384cc6595148,
1248                fidl::encoding::DynamicFlags::FLEXIBLE,
1249            ),
1250            body: fidl::encoding::FlexibleResult::new(result),
1251        };
1252        fidl::encoding::with_tls_encoded::<
1253            fidl::encoding::TransactionMessageType<
1254                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1255            >,
1256            fidl::encoding::DefaultFuchsiaResourceDialect,
1257            (),
1258        >(msg, |body, _handles| {
1259            server_handle
1260                .write_with_data(fdf::Arena::new(), |arena| arena.insert_slice(&body))
1261                .unwrap();
1262            Ok(())
1263        })
1264    }
1265}
1266
1267#[cfg(feature = "driver")]
1268#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1269pub struct HealthMarker;
1270
1271#[cfg(feature = "driver")]
1272impl fidl_driver::endpoints::DriverProtocolMarker for HealthMarker {
1273    const DEBUG_NAME: &'static str = "(anonymous) Health";
1274}
1275pub type HealthHealthCheckResult = Result<HealthCheckResponse, HealthCheckError>;
1276
1277/// Protocol composed into `Driver` for performing active health checks and
1278/// receiving proactive health alerts.
1279
1280#[cfg(feature = "driver")]
1281#[derive(Debug)]
1282pub enum HealthRequest {
1283    /// Requests the driver to perform a self-diagnostic check.
1284    ///
1285    /// The Driver Host never issues `HealthCheck` between `Driver.Suspend` and
1286    /// the completion of `Driver.Resume`, answering
1287    /// `HealthCheckError.INVALID_STATE` itself while the driver is suspended or
1288    /// transitioning power states.
1289    HealthCheck { request: HealthCheckRequest, responder: HealthHealthCheckResponder },
1290    /// An interaction was received which does not match any known method.
1291    #[non_exhaustive]
1292    _UnknownMethod {
1293        /// Ordinal of the method that was called.
1294        ordinal: u64,
1295        method_type: fidl::MethodType,
1296    },
1297}
1298
1299#[cfg(feature = "driver")]
1300impl HealthRequest {
1301    #[allow(irrefutable_let_patterns)]
1302    pub fn into_health_check(self) -> Option<(HealthCheckRequest, HealthHealthCheckResponder)> {
1303        if let HealthRequest::HealthCheck { request, responder } = self {
1304            Some((request, responder))
1305        } else {
1306            None
1307        }
1308    }
1309
1310    pub fn new_health_check(self, request: HealthCheckRequest, tx_id: u32) -> Self {
1311        Self::HealthCheck { request, responder: HealthHealthCheckResponder { tx_id } }
1312    }
1313
1314    pub fn r#health_check_as_message(
1315        arena: fdf::Arena,
1316        mut request: HealthCheckRequest,
1317        tx_id: u32,
1318    ) -> Result<fdf::Message<[u8]>, fidl::Error> {
1319        let ordinal = 0x14f4749a0e351134;
1320        let dynamic_flags = fidl::encoding::DynamicFlags::FLEXIBLE;
1321        let body = (request,);
1322        let msg = fidl::encoding::TransactionMessage {
1323            header: fidl::encoding::TransactionHeader::new(tx_id, ordinal, dynamic_flags),
1324            body,
1325        };
1326        fidl::encoding::with_tls_encoded::<
1327            fidl::encoding::TransactionMessageType<HealthHealthCheckRequest>,
1328            fidl::encoding::DefaultFuchsiaResourceDialect,
1329            fdf::Message<[u8]>,
1330        >(msg, |bytes, mut handles| {
1331            let handles = arena.insert_from_iter(
1332                std::mem::take(handles)
1333                    .into_iter()
1334                    .map(fidl_driver::encoding::mixed_from_handle_disposition),
1335            );
1336            Ok(fdf::Message::new(&arena, Some(arena.insert_slice(bytes)), Some(handles)))
1337        })
1338    }
1339
1340    #[allow(irrefutable_let_patterns)]
1341    pub fn read_from(bytes: &[u8], _handles: &mut [zx::HandleInfo]) -> Result<Self, fidl::Error> {
1342        let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1343
1344        match header.ordinal {
1345            0x14f4749a0e351134 => {
1346                header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1347                let mut req = fidl::new_empty!(
1348                    HealthHealthCheckRequest,
1349                    fidl::encoding::DefaultFuchsiaResourceDialect
1350                );
1351                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HealthHealthCheckRequest>(&header, _body_bytes, _handles, &mut req)?;
1352                Ok(HealthRequest::HealthCheck {
1353                    request: req.request,
1354
1355                    responder: HealthHealthCheckResponder { tx_id: header.tx_id },
1356                })
1357            }
1358            _ if header.tx_id == 0
1359                && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1360            {
1361                Ok(HealthRequest::_UnknownMethod {
1362                    ordinal: header.ordinal,
1363                    method_type: fidl::MethodType::OneWay,
1364                })
1365            }
1366            _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1367                Ok(HealthRequest::_UnknownMethod {
1368                    ordinal: header.ordinal,
1369                    method_type: fidl::MethodType::TwoWay,
1370                })
1371            }
1372            _ => Err(fidl::Error::UnknownOrdinal {
1373                ordinal: header.ordinal,
1374                protocol_name:
1375                    <HealthMarker as fidl_driver::endpoints::DriverProtocolMarker>::DEBUG_NAME,
1376            }),
1377        }
1378    }
1379
1380    pub fn read_from_message(
1381        mut message: fdf::Message<[u8]>,
1382    ) -> Result<(fdf::Arena, Self), fidl::Error> {
1383        let (arena, Some(body), handles) = message.take_arena_boxes() else {
1384            return Err(fidl::Error::Invalid);
1385        };
1386        let mut handles =
1387            handles
1388                .map(|handles| {
1389                    arena.try_insert_from_iter(handles.into_iter().map(|handle| unsafe {
1390                        fidl_driver::encoding::mixed_into_handle_info(handle)
1391                    }))
1392                })
1393                .transpose();
1394        let res = match handles {
1395            Ok(ref mut handles) => {
1396                Self::read_from(&*body, handles.as_deref_mut().unwrap_or(&mut []))?
1397            }
1398            Err(_) => return Err(fidl::Error::Invalid),
1399        };
1400        std::mem::drop((body, handles));
1401        Ok((message.take_arena(), res))
1402    }
1403
1404    /// Name of the method defined in FIDL
1405    pub fn method_name(&self) -> &'static str {
1406        match *self {
1407            HealthRequest::HealthCheck { .. } => "health_check",
1408            HealthRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1409                "unknown one-way method"
1410            }
1411            HealthRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1412                "unknown two-way method"
1413            }
1414        }
1415    }
1416}
1417
1418/// Like [`HealthRequest::read_from_message`] except it drops the [`Arena`].
1419#[cfg(feature = "driver")]
1420impl std::convert::TryFrom<fdf::Message<[u8]>> for HealthRequest {
1421    type Error = fidl::Error;
1422    fn try_from(msg: fdf::Message<[u8]>) -> Result<HealthRequest, fidl::Error> {
1423        Ok(HealthRequest::read_from_message(msg)?.1)
1424    }
1425}
1426
1427#[must_use = "FIDL methods require a response to be sent"]
1428#[cfg(feature = "driver")]
1429#[derive(Debug)]
1430pub struct HealthHealthCheckResponder {
1431    tx_id: u32,
1432}
1433
1434#[cfg(feature = "driver")]
1435impl HealthHealthCheckResponder {
1436    pub fn send_response(
1437        &self,
1438        server_handle: &fdf::Channel<[u8]>,
1439        mut result: Result<&HealthCheckResponse, HealthCheckError>,
1440    ) -> Result<(), fidl::Error> {
1441        let msg = fidl::encoding::TransactionMessage {
1442            header: fidl::encoding::TransactionHeader::new(
1443                self.tx_id,
1444                0x14f4749a0e351134,
1445                fidl::encoding::DynamicFlags::FLEXIBLE,
1446            ),
1447            body: fidl::encoding::FlexibleResult::new(result),
1448        };
1449        fidl::encoding::with_tls_encoded::<
1450            fidl::encoding::TransactionMessageType<
1451                fidl::encoding::FlexibleResultType<HealthCheckResponse, HealthCheckError>,
1452            >,
1453            fidl::encoding::DefaultFuchsiaResourceDialect,
1454            (),
1455        >(msg, |body, _handles| {
1456            server_handle
1457                .write_with_data(fdf::Arena::new(), |arena| arena.insert_slice(&body))
1458                .unwrap();
1459            Ok(())
1460        })
1461    }
1462}
1463
1464#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1465pub struct NodeMarker;
1466
1467impl fidl::endpoints::ProtocolMarker for NodeMarker {
1468    type Proxy = NodeProxy;
1469    type RequestStream = NodeRequestStream;
1470    #[cfg(target_os = "fuchsia")]
1471    type SynchronousProxy = NodeSynchronousProxy;
1472
1473    const DEBUG_NAME: &'static str = "(anonymous) Node";
1474}
1475pub type NodeAddChildResult = Result<(), NodeError>;
1476pub type NodeProvideResourceResult = Result<(), NodeError>;
1477
1478pub trait NodeProxyInterface: Send + Sync {
1479    type AddChildResponseFut: std::future::Future<Output = Result<NodeAddChildResult, fidl::Error>>
1480        + Send;
1481    fn r#add_child(
1482        &self,
1483        args: NodeAddArgs,
1484        controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1485        node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1486    ) -> Self::AddChildResponseFut;
1487    type ProvideResourceResponseFut: std::future::Future<Output = Result<NodeProvideResourceResult, fidl::Error>>
1488        + Send;
1489    fn r#provide_resource(
1490        &self,
1491        resource: ResourceArgs,
1492        controller: fidl::endpoints::ServerEnd<ResourceControllerMarker>,
1493    ) -> Self::ProvideResourceResponseFut;
1494}
1495#[derive(Debug)]
1496#[cfg(target_os = "fuchsia")]
1497pub struct NodeSynchronousProxy {
1498    client: fidl::client::sync::Client,
1499}
1500
1501#[cfg(target_os = "fuchsia")]
1502impl fidl::endpoints::SynchronousProxy for NodeSynchronousProxy {
1503    type Proxy = NodeProxy;
1504    type Protocol = NodeMarker;
1505
1506    fn from_channel(inner: fidl::Channel) -> Self {
1507        Self::new(inner)
1508    }
1509
1510    fn into_channel(self) -> fidl::Channel {
1511        self.client.into_channel()
1512    }
1513
1514    fn as_channel(&self) -> &fidl::Channel {
1515        self.client.as_channel()
1516    }
1517}
1518
1519#[cfg(target_os = "fuchsia")]
1520impl NodeSynchronousProxy {
1521    pub fn new(channel: fidl::Channel) -> Self {
1522        Self { client: fidl::client::sync::Client::new(channel) }
1523    }
1524
1525    pub fn into_channel(self) -> fidl::Channel {
1526        self.client.into_channel()
1527    }
1528
1529    /// Waits until an event arrives and returns it. It is safe for other
1530    /// threads to make concurrent requests while waiting for an event.
1531    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<NodeEvent, fidl::Error> {
1532        NodeEvent::decode(self.client.wait_for_event::<NodeMarker>(deadline)?)
1533    }
1534
1535    /// Adds a child node to this node.
1536    ///
1537    /// If `node` is present, this driver takes responsibility for binding to
1538    /// the newly created child. Otherwise, the driver framework will locate an
1539    /// appropriate driver to bind the child to.
1540    pub fn r#add_child(
1541        &self,
1542        mut args: NodeAddArgs,
1543        mut controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1544        mut node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1545        ___deadline: zx::MonotonicInstant,
1546    ) -> Result<NodeAddChildResult, fidl::Error> {
1547        let _response = self.client.send_query::<
1548            NodeAddChildRequest,
1549            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, NodeError>,
1550            NodeMarker,
1551        >(
1552            (&mut args, controller, node,),
1553            0x77d10dff3c1ea129,
1554            fidl::encoding::DynamicFlags::FLEXIBLE,
1555            ___deadline,
1556        )?
1557        .into_result::<NodeMarker>("add_child")?;
1558        Ok(_response.map(|x| x))
1559    }
1560
1561    /// Provides a resource that other nodes can depend on. The lifetime of the
1562    /// provided resource is tied to the `controller` client connection. Dropping
1563    /// the client connection will cause the resource to be removed.
1564    pub fn r#provide_resource(
1565        &self,
1566        mut resource: ResourceArgs,
1567        mut controller: fidl::endpoints::ServerEnd<ResourceControllerMarker>,
1568        ___deadline: zx::MonotonicInstant,
1569    ) -> Result<NodeProvideResourceResult, fidl::Error> {
1570        let _response = self.client.send_query::<
1571            NodeProvideResourceRequest,
1572            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, NodeError>,
1573            NodeMarker,
1574        >(
1575            (&mut resource, controller,),
1576            0x2ba4a8e5f3409ace,
1577            fidl::encoding::DynamicFlags::FLEXIBLE,
1578            ___deadline,
1579        )?
1580        .into_result::<NodeMarker>("provide_resource")?;
1581        Ok(_response.map(|x| x))
1582    }
1583}
1584
1585#[cfg(target_os = "fuchsia")]
1586impl From<NodeSynchronousProxy> for zx::NullableHandle {
1587    fn from(value: NodeSynchronousProxy) -> Self {
1588        value.into_channel().into()
1589    }
1590}
1591
1592#[cfg(target_os = "fuchsia")]
1593impl From<fidl::Channel> for NodeSynchronousProxy {
1594    fn from(value: fidl::Channel) -> Self {
1595        Self::new(value)
1596    }
1597}
1598
1599#[cfg(target_os = "fuchsia")]
1600impl fidl::endpoints::FromClient for NodeSynchronousProxy {
1601    type Protocol = NodeMarker;
1602
1603    fn from_client(value: fidl::endpoints::ClientEnd<NodeMarker>) -> Self {
1604        Self::new(value.into_channel())
1605    }
1606}
1607
1608#[derive(Debug, Clone)]
1609pub struct NodeProxy {
1610    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1611}
1612
1613impl fidl::endpoints::Proxy for NodeProxy {
1614    type Protocol = NodeMarker;
1615
1616    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1617        Self::new(inner)
1618    }
1619
1620    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1621        self.client.into_channel().map_err(|client| Self { client })
1622    }
1623
1624    fn as_channel(&self) -> &::fidl::AsyncChannel {
1625        self.client.as_channel()
1626    }
1627}
1628
1629impl NodeProxy {
1630    /// Create a new Proxy for fuchsia.driver.framework/Node.
1631    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1632        let protocol_name = <NodeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1633        Self { client: fidl::client::Client::new(channel, protocol_name) }
1634    }
1635
1636    /// Get a Stream of events from the remote end of the protocol.
1637    ///
1638    /// # Panics
1639    ///
1640    /// Panics if the event stream was already taken.
1641    pub fn take_event_stream(&self) -> NodeEventStream {
1642        NodeEventStream { event_receiver: self.client.take_event_receiver() }
1643    }
1644
1645    /// Adds a child node to this node.
1646    ///
1647    /// If `node` is present, this driver takes responsibility for binding to
1648    /// the newly created child. Otherwise, the driver framework will locate an
1649    /// appropriate driver to bind the child to.
1650    pub fn r#add_child(
1651        &self,
1652        mut args: NodeAddArgs,
1653        mut controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1654        mut node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1655    ) -> fidl::client::QueryResponseFut<
1656        NodeAddChildResult,
1657        fidl::encoding::DefaultFuchsiaResourceDialect,
1658    > {
1659        NodeProxyInterface::r#add_child(self, args, controller, node)
1660    }
1661
1662    /// Provides a resource that other nodes can depend on. The lifetime of the
1663    /// provided resource is tied to the `controller` client connection. Dropping
1664    /// the client connection will cause the resource to be removed.
1665    pub fn r#provide_resource(
1666        &self,
1667        mut resource: ResourceArgs,
1668        mut controller: fidl::endpoints::ServerEnd<ResourceControllerMarker>,
1669    ) -> fidl::client::QueryResponseFut<
1670        NodeProvideResourceResult,
1671        fidl::encoding::DefaultFuchsiaResourceDialect,
1672    > {
1673        NodeProxyInterface::r#provide_resource(self, resource, controller)
1674    }
1675}
1676
1677impl NodeProxyInterface for NodeProxy {
1678    type AddChildResponseFut = fidl::client::QueryResponseFut<
1679        NodeAddChildResult,
1680        fidl::encoding::DefaultFuchsiaResourceDialect,
1681    >;
1682    fn r#add_child(
1683        &self,
1684        mut args: NodeAddArgs,
1685        mut controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1686        mut node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1687    ) -> Self::AddChildResponseFut {
1688        fn _decode(
1689            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1690        ) -> Result<NodeAddChildResult, fidl::Error> {
1691            let _response = fidl::client::decode_transaction_body::<
1692                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, NodeError>,
1693                fidl::encoding::DefaultFuchsiaResourceDialect,
1694                0x77d10dff3c1ea129,
1695            >(_buf?)?
1696            .into_result::<NodeMarker>("add_child")?;
1697            Ok(_response.map(|x| x))
1698        }
1699        self.client.send_query_and_decode::<NodeAddChildRequest, NodeAddChildResult>(
1700            (&mut args, controller, node),
1701            0x77d10dff3c1ea129,
1702            fidl::encoding::DynamicFlags::FLEXIBLE,
1703            _decode,
1704        )
1705    }
1706
1707    type ProvideResourceResponseFut = fidl::client::QueryResponseFut<
1708        NodeProvideResourceResult,
1709        fidl::encoding::DefaultFuchsiaResourceDialect,
1710    >;
1711    fn r#provide_resource(
1712        &self,
1713        mut resource: ResourceArgs,
1714        mut controller: fidl::endpoints::ServerEnd<ResourceControllerMarker>,
1715    ) -> Self::ProvideResourceResponseFut {
1716        fn _decode(
1717            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1718        ) -> Result<NodeProvideResourceResult, fidl::Error> {
1719            let _response = fidl::client::decode_transaction_body::<
1720                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, NodeError>,
1721                fidl::encoding::DefaultFuchsiaResourceDialect,
1722                0x2ba4a8e5f3409ace,
1723            >(_buf?)?
1724            .into_result::<NodeMarker>("provide_resource")?;
1725            Ok(_response.map(|x| x))
1726        }
1727        self.client.send_query_and_decode::<NodeProvideResourceRequest, NodeProvideResourceResult>(
1728            (&mut resource, controller),
1729            0x2ba4a8e5f3409ace,
1730            fidl::encoding::DynamicFlags::FLEXIBLE,
1731            _decode,
1732        )
1733    }
1734}
1735
1736pub struct NodeEventStream {
1737    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1738}
1739
1740impl std::marker::Unpin for NodeEventStream {}
1741
1742impl futures::stream::FusedStream for NodeEventStream {
1743    fn is_terminated(&self) -> bool {
1744        self.event_receiver.is_terminated()
1745    }
1746}
1747
1748impl futures::Stream for NodeEventStream {
1749    type Item = Result<NodeEvent, fidl::Error>;
1750
1751    fn poll_next(
1752        mut self: std::pin::Pin<&mut Self>,
1753        cx: &mut std::task::Context<'_>,
1754    ) -> std::task::Poll<Option<Self::Item>> {
1755        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1756            &mut self.event_receiver,
1757            cx
1758        )?) {
1759            Some(buf) => std::task::Poll::Ready(Some(NodeEvent::decode(buf))),
1760            None => std::task::Poll::Ready(None),
1761        }
1762    }
1763}
1764
1765#[derive(Debug)]
1766pub enum NodeEvent {
1767    #[non_exhaustive]
1768    _UnknownEvent {
1769        /// Ordinal of the event that was sent.
1770        ordinal: u64,
1771    },
1772}
1773
1774impl NodeEvent {
1775    /// Decodes a message buffer as a [`NodeEvent`].
1776    fn decode(
1777        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1778    ) -> Result<NodeEvent, fidl::Error> {
1779        let (bytes, _handles) = buf.split_mut();
1780        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1781        debug_assert_eq!(tx_header.tx_id, 0);
1782        match tx_header.ordinal {
1783            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1784                Ok(NodeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1785            }
1786            _ => Err(fidl::Error::UnknownOrdinal {
1787                ordinal: tx_header.ordinal,
1788                protocol_name: <NodeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1789            }),
1790        }
1791    }
1792}
1793
1794/// A Stream of incoming requests for fuchsia.driver.framework/Node.
1795pub struct NodeRequestStream {
1796    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1797    is_terminated: bool,
1798}
1799
1800impl std::marker::Unpin for NodeRequestStream {}
1801
1802impl futures::stream::FusedStream for NodeRequestStream {
1803    fn is_terminated(&self) -> bool {
1804        self.is_terminated
1805    }
1806}
1807
1808impl fidl::endpoints::RequestStream for NodeRequestStream {
1809    type Protocol = NodeMarker;
1810    type ControlHandle = NodeControlHandle;
1811
1812    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1813        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1814    }
1815
1816    fn control_handle(&self) -> Self::ControlHandle {
1817        NodeControlHandle { inner: self.inner.clone() }
1818    }
1819
1820    fn into_inner(
1821        self,
1822    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1823    {
1824        (self.inner, self.is_terminated)
1825    }
1826
1827    fn from_inner(
1828        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1829        is_terminated: bool,
1830    ) -> Self {
1831        Self { inner, is_terminated }
1832    }
1833}
1834
1835impl futures::Stream for NodeRequestStream {
1836    type Item = Result<NodeRequest, fidl::Error>;
1837
1838    fn poll_next(
1839        mut self: std::pin::Pin<&mut Self>,
1840        cx: &mut std::task::Context<'_>,
1841    ) -> std::task::Poll<Option<Self::Item>> {
1842        let this = &mut *self;
1843        if this.inner.check_shutdown(cx) {
1844            this.is_terminated = true;
1845            return std::task::Poll::Ready(None);
1846        }
1847        if this.is_terminated {
1848            panic!("polled NodeRequestStream after completion");
1849        }
1850        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1851            |bytes, handles| {
1852                match this.inner.channel().read_etc(cx, bytes, handles) {
1853                    std::task::Poll::Ready(Ok(())) => {}
1854                    std::task::Poll::Pending => return std::task::Poll::Pending,
1855                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1856                        this.is_terminated = true;
1857                        return std::task::Poll::Ready(None);
1858                    }
1859                    std::task::Poll::Ready(Err(e)) => {
1860                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1861                            e.into(),
1862                        ))));
1863                    }
1864                }
1865
1866                // A message has been received from the channel
1867                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1868
1869                std::task::Poll::Ready(Some(match header.ordinal {
1870                    0x77d10dff3c1ea129 => {
1871                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1872                        let mut req = fidl::new_empty!(
1873                            NodeAddChildRequest,
1874                            fidl::encoding::DefaultFuchsiaResourceDialect
1875                        );
1876                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeAddChildRequest>(&header, _body_bytes, handles, &mut req)?;
1877                        let control_handle = NodeControlHandle { inner: this.inner.clone() };
1878                        Ok(NodeRequest::AddChild {
1879                            args: req.args,
1880                            controller: req.controller,
1881                            node: req.node,
1882
1883                            responder: NodeAddChildResponder {
1884                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1885                                tx_id: header.tx_id,
1886                            },
1887                        })
1888                    }
1889                    0x2ba4a8e5f3409ace => {
1890                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1891                        let mut req = fidl::new_empty!(
1892                            NodeProvideResourceRequest,
1893                            fidl::encoding::DefaultFuchsiaResourceDialect
1894                        );
1895                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeProvideResourceRequest>(&header, _body_bytes, handles, &mut req)?;
1896                        let control_handle = NodeControlHandle { inner: this.inner.clone() };
1897                        Ok(NodeRequest::ProvideResource {
1898                            resource: req.resource,
1899                            controller: req.controller,
1900
1901                            responder: NodeProvideResourceResponder {
1902                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1903                                tx_id: header.tx_id,
1904                            },
1905                        })
1906                    }
1907                    _ if header.tx_id == 0
1908                        && header
1909                            .dynamic_flags()
1910                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1911                    {
1912                        Ok(NodeRequest::_UnknownMethod {
1913                            ordinal: header.ordinal,
1914                            control_handle: NodeControlHandle { inner: this.inner.clone() },
1915                            method_type: fidl::MethodType::OneWay,
1916                        })
1917                    }
1918                    _ if header
1919                        .dynamic_flags()
1920                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1921                    {
1922                        this.inner.send_framework_err(
1923                            fidl::encoding::FrameworkErr::UnknownMethod,
1924                            header.tx_id,
1925                            header.ordinal,
1926                            header.dynamic_flags(),
1927                            (bytes, handles),
1928                        )?;
1929                        Ok(NodeRequest::_UnknownMethod {
1930                            ordinal: header.ordinal,
1931                            control_handle: NodeControlHandle { inner: this.inner.clone() },
1932                            method_type: fidl::MethodType::TwoWay,
1933                        })
1934                    }
1935                    _ => Err(fidl::Error::UnknownOrdinal {
1936                        ordinal: header.ordinal,
1937                        protocol_name: <NodeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1938                    }),
1939                }))
1940            },
1941        )
1942    }
1943}
1944
1945/// Protocol through which a driver manages a node that it is bound to.
1946/// Drivers should maintain their client connection to the node. Dropping
1947/// the client connection while the driver is running will cause the
1948/// driver framework to remove the driver and node from the topology.
1949/// If the driver has set `host_restart_on_crash` to "true" in their
1950/// component manifest, dropping the connection will initiate a restart of
1951/// the driver host and driver.
1952#[derive(Debug)]
1953pub enum NodeRequest {
1954    /// Adds a child node to this node.
1955    ///
1956    /// If `node` is present, this driver takes responsibility for binding to
1957    /// the newly created child. Otherwise, the driver framework will locate an
1958    /// appropriate driver to bind the child to.
1959    AddChild {
1960        args: NodeAddArgs,
1961        controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
1962        node: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1963        responder: NodeAddChildResponder,
1964    },
1965    /// Provides a resource that other nodes can depend on. The lifetime of the
1966    /// provided resource is tied to the `controller` client connection. Dropping
1967    /// the client connection will cause the resource to be removed.
1968    ProvideResource {
1969        resource: ResourceArgs,
1970        controller: fidl::endpoints::ServerEnd<ResourceControllerMarker>,
1971        responder: NodeProvideResourceResponder,
1972    },
1973    /// An interaction was received which does not match any known method.
1974    #[non_exhaustive]
1975    _UnknownMethod {
1976        /// Ordinal of the method that was called.
1977        ordinal: u64,
1978        control_handle: NodeControlHandle,
1979        method_type: fidl::MethodType,
1980    },
1981}
1982
1983impl NodeRequest {
1984    #[allow(irrefutable_let_patterns)]
1985    pub fn into_add_child(
1986        self,
1987    ) -> Option<(
1988        NodeAddArgs,
1989        fidl::endpoints::ServerEnd<NodeControllerMarker>,
1990        Option<fidl::endpoints::ServerEnd<NodeMarker>>,
1991        NodeAddChildResponder,
1992    )> {
1993        if let NodeRequest::AddChild { args, controller, node, responder } = self {
1994            Some((args, controller, node, responder))
1995        } else {
1996            None
1997        }
1998    }
1999
2000    #[allow(irrefutable_let_patterns)]
2001    pub fn into_provide_resource(
2002        self,
2003    ) -> Option<(
2004        ResourceArgs,
2005        fidl::endpoints::ServerEnd<ResourceControllerMarker>,
2006        NodeProvideResourceResponder,
2007    )> {
2008        if let NodeRequest::ProvideResource { resource, controller, responder } = self {
2009            Some((resource, controller, responder))
2010        } else {
2011            None
2012        }
2013    }
2014
2015    /// Name of the method defined in FIDL
2016    pub fn method_name(&self) -> &'static str {
2017        match *self {
2018            NodeRequest::AddChild { .. } => "add_child",
2019            NodeRequest::ProvideResource { .. } => "provide_resource",
2020            NodeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2021                "unknown one-way method"
2022            }
2023            NodeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2024                "unknown two-way method"
2025            }
2026        }
2027    }
2028}
2029
2030#[derive(Debug, Clone)]
2031pub struct NodeControlHandle {
2032    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2033}
2034
2035impl NodeControlHandle {
2036    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2037        self.inner.shutdown_with_epitaph(status.into())
2038    }
2039}
2040
2041impl fidl::endpoints::ControlHandle for NodeControlHandle {
2042    fn shutdown(&self) {
2043        self.inner.shutdown()
2044    }
2045
2046    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2047        self.inner.shutdown_with_epitaph(status)
2048    }
2049
2050    fn is_closed(&self) -> bool {
2051        self.inner.channel().is_closed()
2052    }
2053    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2054        self.inner.channel().on_closed()
2055    }
2056
2057    #[cfg(target_os = "fuchsia")]
2058    fn signal_peer(
2059        &self,
2060        clear_mask: zx::Signals,
2061        set_mask: zx::Signals,
2062    ) -> Result<(), zx_status::Status> {
2063        use fidl::Peered;
2064        self.inner.channel().signal_peer(clear_mask, set_mask)
2065    }
2066}
2067
2068impl NodeControlHandle {}
2069
2070#[must_use = "FIDL methods require a response to be sent"]
2071#[derive(Debug)]
2072pub struct NodeAddChildResponder {
2073    control_handle: std::mem::ManuallyDrop<NodeControlHandle>,
2074    tx_id: u32,
2075}
2076
2077/// Set the the channel to be shutdown (see [`NodeControlHandle::shutdown`])
2078/// if the responder is dropped without sending a response, so that the client
2079/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2080impl std::ops::Drop for NodeAddChildResponder {
2081    fn drop(&mut self) {
2082        self.control_handle.shutdown();
2083        // Safety: drops once, never accessed again
2084        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2085    }
2086}
2087
2088impl fidl::endpoints::Responder for NodeAddChildResponder {
2089    type ControlHandle = NodeControlHandle;
2090
2091    fn control_handle(&self) -> &NodeControlHandle {
2092        &self.control_handle
2093    }
2094
2095    fn drop_without_shutdown(mut self) {
2096        // Safety: drops once, never accessed again due to mem::forget
2097        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2098        // Prevent Drop from running (which would shut down the channel)
2099        std::mem::forget(self);
2100    }
2101}
2102
2103impl NodeAddChildResponder {
2104    /// Sends a response to the FIDL transaction.
2105    ///
2106    /// Sets the channel to shutdown if an error occurs.
2107    pub fn send(self, mut result: Result<(), NodeError>) -> Result<(), fidl::Error> {
2108        let _result = self.send_raw(result);
2109        if _result.is_err() {
2110            self.control_handle.shutdown();
2111        }
2112        self.drop_without_shutdown();
2113        _result
2114    }
2115
2116    /// Similar to "send" but does not shutdown the channel if an error occurs.
2117    pub fn send_no_shutdown_on_err(
2118        self,
2119        mut result: Result<(), NodeError>,
2120    ) -> Result<(), fidl::Error> {
2121        let _result = self.send_raw(result);
2122        self.drop_without_shutdown();
2123        _result
2124    }
2125
2126    fn send_raw(&self, mut result: Result<(), NodeError>) -> Result<(), fidl::Error> {
2127        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2128            fidl::encoding::EmptyStruct,
2129            NodeError,
2130        >>(
2131            fidl::encoding::FlexibleResult::new(result),
2132            self.tx_id,
2133            0x77d10dff3c1ea129,
2134            fidl::encoding::DynamicFlags::FLEXIBLE,
2135        )
2136    }
2137}
2138
2139#[must_use = "FIDL methods require a response to be sent"]
2140#[derive(Debug)]
2141pub struct NodeProvideResourceResponder {
2142    control_handle: std::mem::ManuallyDrop<NodeControlHandle>,
2143    tx_id: u32,
2144}
2145
2146/// Set the the channel to be shutdown (see [`NodeControlHandle::shutdown`])
2147/// if the responder is dropped without sending a response, so that the client
2148/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2149impl std::ops::Drop for NodeProvideResourceResponder {
2150    fn drop(&mut self) {
2151        self.control_handle.shutdown();
2152        // Safety: drops once, never accessed again
2153        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2154    }
2155}
2156
2157impl fidl::endpoints::Responder for NodeProvideResourceResponder {
2158    type ControlHandle = NodeControlHandle;
2159
2160    fn control_handle(&self) -> &NodeControlHandle {
2161        &self.control_handle
2162    }
2163
2164    fn drop_without_shutdown(mut self) {
2165        // Safety: drops once, never accessed again due to mem::forget
2166        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2167        // Prevent Drop from running (which would shut down the channel)
2168        std::mem::forget(self);
2169    }
2170}
2171
2172impl NodeProvideResourceResponder {
2173    /// Sends a response to the FIDL transaction.
2174    ///
2175    /// Sets the channel to shutdown if an error occurs.
2176    pub fn send(self, mut result: Result<(), NodeError>) -> Result<(), fidl::Error> {
2177        let _result = self.send_raw(result);
2178        if _result.is_err() {
2179            self.control_handle.shutdown();
2180        }
2181        self.drop_without_shutdown();
2182        _result
2183    }
2184
2185    /// Similar to "send" but does not shutdown the channel if an error occurs.
2186    pub fn send_no_shutdown_on_err(
2187        self,
2188        mut result: Result<(), NodeError>,
2189    ) -> Result<(), fidl::Error> {
2190        let _result = self.send_raw(result);
2191        self.drop_without_shutdown();
2192        _result
2193    }
2194
2195    fn send_raw(&self, mut result: Result<(), NodeError>) -> Result<(), fidl::Error> {
2196        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2197            fidl::encoding::EmptyStruct,
2198            NodeError,
2199        >>(
2200            fidl::encoding::FlexibleResult::new(result),
2201            self.tx_id,
2202            0x2ba4a8e5f3409ace,
2203            fidl::encoding::DynamicFlags::FLEXIBLE,
2204        )
2205    }
2206}
2207
2208#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2209pub struct NodeControllerMarker;
2210
2211impl fidl::endpoints::ProtocolMarker for NodeControllerMarker {
2212    type Proxy = NodeControllerProxy;
2213    type RequestStream = NodeControllerRequestStream;
2214    #[cfg(target_os = "fuchsia")]
2215    type SynchronousProxy = NodeControllerSynchronousProxy;
2216
2217    const DEBUG_NAME: &'static str = "(anonymous) NodeController";
2218}
2219pub type NodeControllerRequestBindResult = Result<(), i32>;
2220pub type NodeControllerWaitForDriverResult = Result<DriverResult, i32>;
2221
2222pub trait NodeControllerProxyInterface: Send + Sync {
2223    fn r#remove(&self) -> Result<(), fidl::Error>;
2224    type RequestBindResponseFut: std::future::Future<Output = Result<NodeControllerRequestBindResult, fidl::Error>>
2225        + Send;
2226    fn r#request_bind(
2227        &self,
2228        payload: &NodeControllerRequestBindRequest,
2229    ) -> Self::RequestBindResponseFut;
2230    type WaitForDriverResponseFut: std::future::Future<Output = Result<NodeControllerWaitForDriverResult, fidl::Error>>
2231        + Send;
2232    fn r#wait_for_driver(&self) -> Self::WaitForDriverResponseFut;
2233}
2234#[derive(Debug)]
2235#[cfg(target_os = "fuchsia")]
2236pub struct NodeControllerSynchronousProxy {
2237    client: fidl::client::sync::Client,
2238}
2239
2240#[cfg(target_os = "fuchsia")]
2241impl fidl::endpoints::SynchronousProxy for NodeControllerSynchronousProxy {
2242    type Proxy = NodeControllerProxy;
2243    type Protocol = NodeControllerMarker;
2244
2245    fn from_channel(inner: fidl::Channel) -> Self {
2246        Self::new(inner)
2247    }
2248
2249    fn into_channel(self) -> fidl::Channel {
2250        self.client.into_channel()
2251    }
2252
2253    fn as_channel(&self) -> &fidl::Channel {
2254        self.client.as_channel()
2255    }
2256}
2257
2258#[cfg(target_os = "fuchsia")]
2259impl NodeControllerSynchronousProxy {
2260    pub fn new(channel: fidl::Channel) -> Self {
2261        Self { client: fidl::client::sync::Client::new(channel) }
2262    }
2263
2264    pub fn into_channel(self) -> fidl::Channel {
2265        self.client.into_channel()
2266    }
2267
2268    /// Waits until an event arrives and returns it. It is safe for other
2269    /// threads to make concurrent requests while waiting for an event.
2270    pub fn wait_for_event(
2271        &self,
2272        deadline: zx::MonotonicInstant,
2273    ) -> Result<NodeControllerEvent, fidl::Error> {
2274        NodeControllerEvent::decode(self.client.wait_for_event::<NodeControllerMarker>(deadline)?)
2275    }
2276
2277    /// Removes the node and all of its children.
2278    pub fn r#remove(&self) -> Result<(), fidl::Error> {
2279        self.client.send::<fidl::encoding::EmptyPayload>(
2280            (),
2281            0x54fa8b3dfe7bb341,
2282            fidl::encoding::DynamicFlags::FLEXIBLE,
2283        )
2284    }
2285
2286    /// Request that the framework attempts to bind a driver to this node.
2287    /// This is an *additional* request for binding as the framework attempts to bind a node once
2288    /// when the node is created.
2289    /// * error `ZX_ERR_ALREADY_BOUND` if the node is already bound and `force_rebind` is false.
2290    /// * error `ZX_ERR_ALREADY_EXISTS` if the node has an outstanding |RequestBind| call which has
2291    /// not completed.
2292    pub fn r#request_bind(
2293        &self,
2294        mut payload: &NodeControllerRequestBindRequest,
2295        ___deadline: zx::MonotonicInstant,
2296    ) -> Result<NodeControllerRequestBindResult, fidl::Error> {
2297        let _response = self.client.send_query::<
2298            NodeControllerRequestBindRequest,
2299            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2300            NodeControllerMarker,
2301        >(
2302            payload,
2303            0x41b954726b13508f,
2304            fidl::encoding::DynamicFlags::FLEXIBLE,
2305            ___deadline,
2306        )?
2307        .into_result::<NodeControllerMarker>("request_bind")?;
2308        Ok(_response.map(|x| x))
2309    }
2310
2311    /// Hanging get style call that returns a terminal state for the associated `Node`,
2312    /// or the composite node that is parented by this node.
2313    /// For a successfully started driver this returns immediately with the token of the
2314    /// node that the driver started on.
2315    /// If an error happens we wait until bootup is complete, which is when all drivers that
2316    /// can bind and start have done so, before returning the error.
2317    pub fn r#wait_for_driver(
2318        &self,
2319        ___deadline: zx::MonotonicInstant,
2320    ) -> Result<NodeControllerWaitForDriverResult, fidl::Error> {
2321        let _response = self.client.send_query::<
2322            fidl::encoding::EmptyPayload,
2323            fidl::encoding::FlexibleResultType<DriverResult, i32>,
2324            NodeControllerMarker,
2325        >(
2326            (),
2327            0x69f7106e47d81387,
2328            fidl::encoding::DynamicFlags::FLEXIBLE,
2329            ___deadline,
2330        )?
2331        .into_result::<NodeControllerMarker>("wait_for_driver")?;
2332        Ok(_response.map(|x| x))
2333    }
2334}
2335
2336#[cfg(target_os = "fuchsia")]
2337impl From<NodeControllerSynchronousProxy> for zx::NullableHandle {
2338    fn from(value: NodeControllerSynchronousProxy) -> Self {
2339        value.into_channel().into()
2340    }
2341}
2342
2343#[cfg(target_os = "fuchsia")]
2344impl From<fidl::Channel> for NodeControllerSynchronousProxy {
2345    fn from(value: fidl::Channel) -> Self {
2346        Self::new(value)
2347    }
2348}
2349
2350#[cfg(target_os = "fuchsia")]
2351impl fidl::endpoints::FromClient for NodeControllerSynchronousProxy {
2352    type Protocol = NodeControllerMarker;
2353
2354    fn from_client(value: fidl::endpoints::ClientEnd<NodeControllerMarker>) -> Self {
2355        Self::new(value.into_channel())
2356    }
2357}
2358
2359#[derive(Debug, Clone)]
2360pub struct NodeControllerProxy {
2361    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2362}
2363
2364impl fidl::endpoints::Proxy for NodeControllerProxy {
2365    type Protocol = NodeControllerMarker;
2366
2367    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2368        Self::new(inner)
2369    }
2370
2371    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2372        self.client.into_channel().map_err(|client| Self { client })
2373    }
2374
2375    fn as_channel(&self) -> &::fidl::AsyncChannel {
2376        self.client.as_channel()
2377    }
2378}
2379
2380impl NodeControllerProxy {
2381    /// Create a new Proxy for fuchsia.driver.framework/NodeController.
2382    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2383        let protocol_name = <NodeControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2384        Self { client: fidl::client::Client::new(channel, protocol_name) }
2385    }
2386
2387    /// Get a Stream of events from the remote end of the protocol.
2388    ///
2389    /// # Panics
2390    ///
2391    /// Panics if the event stream was already taken.
2392    pub fn take_event_stream(&self) -> NodeControllerEventStream {
2393        NodeControllerEventStream { event_receiver: self.client.take_event_receiver() }
2394    }
2395
2396    /// Removes the node and all of its children.
2397    pub fn r#remove(&self) -> Result<(), fidl::Error> {
2398        NodeControllerProxyInterface::r#remove(self)
2399    }
2400
2401    /// Request that the framework attempts to bind a driver to this node.
2402    /// This is an *additional* request for binding as the framework attempts to bind a node once
2403    /// when the node is created.
2404    /// * error `ZX_ERR_ALREADY_BOUND` if the node is already bound and `force_rebind` is false.
2405    /// * error `ZX_ERR_ALREADY_EXISTS` if the node has an outstanding |RequestBind| call which has
2406    /// not completed.
2407    pub fn r#request_bind(
2408        &self,
2409        mut payload: &NodeControllerRequestBindRequest,
2410    ) -> fidl::client::QueryResponseFut<
2411        NodeControllerRequestBindResult,
2412        fidl::encoding::DefaultFuchsiaResourceDialect,
2413    > {
2414        NodeControllerProxyInterface::r#request_bind(self, payload)
2415    }
2416
2417    /// Hanging get style call that returns a terminal state for the associated `Node`,
2418    /// or the composite node that is parented by this node.
2419    /// For a successfully started driver this returns immediately with the token of the
2420    /// node that the driver started on.
2421    /// If an error happens we wait until bootup is complete, which is when all drivers that
2422    /// can bind and start have done so, before returning the error.
2423    pub fn r#wait_for_driver(
2424        &self,
2425    ) -> fidl::client::QueryResponseFut<
2426        NodeControllerWaitForDriverResult,
2427        fidl::encoding::DefaultFuchsiaResourceDialect,
2428    > {
2429        NodeControllerProxyInterface::r#wait_for_driver(self)
2430    }
2431}
2432
2433impl NodeControllerProxyInterface for NodeControllerProxy {
2434    fn r#remove(&self) -> Result<(), fidl::Error> {
2435        self.client.send::<fidl::encoding::EmptyPayload>(
2436            (),
2437            0x54fa8b3dfe7bb341,
2438            fidl::encoding::DynamicFlags::FLEXIBLE,
2439        )
2440    }
2441
2442    type RequestBindResponseFut = fidl::client::QueryResponseFut<
2443        NodeControllerRequestBindResult,
2444        fidl::encoding::DefaultFuchsiaResourceDialect,
2445    >;
2446    fn r#request_bind(
2447        &self,
2448        mut payload: &NodeControllerRequestBindRequest,
2449    ) -> Self::RequestBindResponseFut {
2450        fn _decode(
2451            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2452        ) -> Result<NodeControllerRequestBindResult, fidl::Error> {
2453            let _response = fidl::client::decode_transaction_body::<
2454                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2455                fidl::encoding::DefaultFuchsiaResourceDialect,
2456                0x41b954726b13508f,
2457            >(_buf?)?
2458            .into_result::<NodeControllerMarker>("request_bind")?;
2459            Ok(_response.map(|x| x))
2460        }
2461        self.client.send_query_and_decode::<
2462            NodeControllerRequestBindRequest,
2463            NodeControllerRequestBindResult,
2464        >(
2465            payload,
2466            0x41b954726b13508f,
2467            fidl::encoding::DynamicFlags::FLEXIBLE,
2468            _decode,
2469        )
2470    }
2471
2472    type WaitForDriverResponseFut = fidl::client::QueryResponseFut<
2473        NodeControllerWaitForDriverResult,
2474        fidl::encoding::DefaultFuchsiaResourceDialect,
2475    >;
2476    fn r#wait_for_driver(&self) -> Self::WaitForDriverResponseFut {
2477        fn _decode(
2478            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2479        ) -> Result<NodeControllerWaitForDriverResult, fidl::Error> {
2480            let _response = fidl::client::decode_transaction_body::<
2481                fidl::encoding::FlexibleResultType<DriverResult, i32>,
2482                fidl::encoding::DefaultFuchsiaResourceDialect,
2483                0x69f7106e47d81387,
2484            >(_buf?)?
2485            .into_result::<NodeControllerMarker>("wait_for_driver")?;
2486            Ok(_response.map(|x| x))
2487        }
2488        self.client.send_query_and_decode::<
2489            fidl::encoding::EmptyPayload,
2490            NodeControllerWaitForDriverResult,
2491        >(
2492            (),
2493            0x69f7106e47d81387,
2494            fidl::encoding::DynamicFlags::FLEXIBLE,
2495            _decode,
2496        )
2497    }
2498}
2499
2500pub struct NodeControllerEventStream {
2501    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2502}
2503
2504impl std::marker::Unpin for NodeControllerEventStream {}
2505
2506impl futures::stream::FusedStream for NodeControllerEventStream {
2507    fn is_terminated(&self) -> bool {
2508        self.event_receiver.is_terminated()
2509    }
2510}
2511
2512impl futures::Stream for NodeControllerEventStream {
2513    type Item = Result<NodeControllerEvent, fidl::Error>;
2514
2515    fn poll_next(
2516        mut self: std::pin::Pin<&mut Self>,
2517        cx: &mut std::task::Context<'_>,
2518    ) -> std::task::Poll<Option<Self::Item>> {
2519        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2520            &mut self.event_receiver,
2521            cx
2522        )?) {
2523            Some(buf) => std::task::Poll::Ready(Some(NodeControllerEvent::decode(buf))),
2524            None => std::task::Poll::Ready(None),
2525        }
2526    }
2527}
2528
2529#[derive(Debug)]
2530pub enum NodeControllerEvent {
2531    OnBind {
2532        payload: NodeControllerOnBindRequest,
2533    },
2534    #[non_exhaustive]
2535    _UnknownEvent {
2536        /// Ordinal of the event that was sent.
2537        ordinal: u64,
2538    },
2539}
2540
2541impl NodeControllerEvent {
2542    #[allow(irrefutable_let_patterns)]
2543    pub fn into_on_bind(self) -> Option<NodeControllerOnBindRequest> {
2544        if let NodeControllerEvent::OnBind { payload } = self { Some((payload)) } else { None }
2545    }
2546
2547    /// Decodes a message buffer as a [`NodeControllerEvent`].
2548    fn decode(
2549        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2550    ) -> Result<NodeControllerEvent, fidl::Error> {
2551        let (bytes, _handles) = buf.split_mut();
2552        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2553        debug_assert_eq!(tx_header.tx_id, 0);
2554        match tx_header.ordinal {
2555            0x51f4165bc5ea202a => {
2556                let mut out = fidl::new_empty!(
2557                    NodeControllerOnBindRequest,
2558                    fidl::encoding::DefaultFuchsiaResourceDialect
2559                );
2560                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeControllerOnBindRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2561                Ok((NodeControllerEvent::OnBind { payload: out }))
2562            }
2563            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2564                Ok(NodeControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2565            }
2566            _ => Err(fidl::Error::UnknownOrdinal {
2567                ordinal: tx_header.ordinal,
2568                protocol_name:
2569                    <NodeControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2570            }),
2571        }
2572    }
2573}
2574
2575/// A Stream of incoming requests for fuchsia.driver.framework/NodeController.
2576pub struct NodeControllerRequestStream {
2577    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2578    is_terminated: bool,
2579}
2580
2581impl std::marker::Unpin for NodeControllerRequestStream {}
2582
2583impl futures::stream::FusedStream for NodeControllerRequestStream {
2584    fn is_terminated(&self) -> bool {
2585        self.is_terminated
2586    }
2587}
2588
2589impl fidl::endpoints::RequestStream for NodeControllerRequestStream {
2590    type Protocol = NodeControllerMarker;
2591    type ControlHandle = NodeControllerControlHandle;
2592
2593    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2594        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2595    }
2596
2597    fn control_handle(&self) -> Self::ControlHandle {
2598        NodeControllerControlHandle { inner: self.inner.clone() }
2599    }
2600
2601    fn into_inner(
2602        self,
2603    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2604    {
2605        (self.inner, self.is_terminated)
2606    }
2607
2608    fn from_inner(
2609        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2610        is_terminated: bool,
2611    ) -> Self {
2612        Self { inner, is_terminated }
2613    }
2614}
2615
2616impl futures::Stream for NodeControllerRequestStream {
2617    type Item = Result<NodeControllerRequest, fidl::Error>;
2618
2619    fn poll_next(
2620        mut self: std::pin::Pin<&mut Self>,
2621        cx: &mut std::task::Context<'_>,
2622    ) -> std::task::Poll<Option<Self::Item>> {
2623        let this = &mut *self;
2624        if this.inner.check_shutdown(cx) {
2625            this.is_terminated = true;
2626            return std::task::Poll::Ready(None);
2627        }
2628        if this.is_terminated {
2629            panic!("polled NodeControllerRequestStream after completion");
2630        }
2631        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2632            |bytes, handles| {
2633                match this.inner.channel().read_etc(cx, bytes, handles) {
2634                    std::task::Poll::Ready(Ok(())) => {}
2635                    std::task::Poll::Pending => return std::task::Poll::Pending,
2636                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2637                        this.is_terminated = true;
2638                        return std::task::Poll::Ready(None);
2639                    }
2640                    std::task::Poll::Ready(Err(e)) => {
2641                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2642                            e.into(),
2643                        ))));
2644                    }
2645                }
2646
2647                // A message has been received from the channel
2648                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2649
2650                std::task::Poll::Ready(Some(match header.ordinal {
2651                    0x54fa8b3dfe7bb341 => {
2652                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2653                        let mut req = fidl::new_empty!(
2654                            fidl::encoding::EmptyPayload,
2655                            fidl::encoding::DefaultFuchsiaResourceDialect
2656                        );
2657                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2658                        let control_handle =
2659                            NodeControllerControlHandle { inner: this.inner.clone() };
2660                        Ok(NodeControllerRequest::Remove { control_handle })
2661                    }
2662                    0x41b954726b13508f => {
2663                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2664                        let mut req = fidl::new_empty!(
2665                            NodeControllerRequestBindRequest,
2666                            fidl::encoding::DefaultFuchsiaResourceDialect
2667                        );
2668                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeControllerRequestBindRequest>(&header, _body_bytes, handles, &mut req)?;
2669                        let control_handle =
2670                            NodeControllerControlHandle { inner: this.inner.clone() };
2671                        Ok(NodeControllerRequest::RequestBind {
2672                            payload: req,
2673                            responder: NodeControllerRequestBindResponder {
2674                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2675                                tx_id: header.tx_id,
2676                            },
2677                        })
2678                    }
2679                    0x69f7106e47d81387 => {
2680                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2681                        let mut req = fidl::new_empty!(
2682                            fidl::encoding::EmptyPayload,
2683                            fidl::encoding::DefaultFuchsiaResourceDialect
2684                        );
2685                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2686                        let control_handle =
2687                            NodeControllerControlHandle { inner: this.inner.clone() };
2688                        Ok(NodeControllerRequest::WaitForDriver {
2689                            responder: NodeControllerWaitForDriverResponder {
2690                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2691                                tx_id: header.tx_id,
2692                            },
2693                        })
2694                    }
2695                    _ if header.tx_id == 0
2696                        && header
2697                            .dynamic_flags()
2698                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2699                    {
2700                        Ok(NodeControllerRequest::_UnknownMethod {
2701                            ordinal: header.ordinal,
2702                            control_handle: NodeControllerControlHandle {
2703                                inner: this.inner.clone(),
2704                            },
2705                            method_type: fidl::MethodType::OneWay,
2706                        })
2707                    }
2708                    _ if header
2709                        .dynamic_flags()
2710                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2711                    {
2712                        this.inner.send_framework_err(
2713                            fidl::encoding::FrameworkErr::UnknownMethod,
2714                            header.tx_id,
2715                            header.ordinal,
2716                            header.dynamic_flags(),
2717                            (bytes, handles),
2718                        )?;
2719                        Ok(NodeControllerRequest::_UnknownMethod {
2720                            ordinal: header.ordinal,
2721                            control_handle: NodeControllerControlHandle {
2722                                inner: this.inner.clone(),
2723                            },
2724                            method_type: fidl::MethodType::TwoWay,
2725                        })
2726                    }
2727                    _ => Err(fidl::Error::UnknownOrdinal {
2728                        ordinal: header.ordinal,
2729                        protocol_name:
2730                            <NodeControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2731                    }),
2732                }))
2733            },
2734        )
2735    }
2736}
2737
2738/// Protocol through which a parent node controls one of its children.
2739#[derive(Debug)]
2740pub enum NodeControllerRequest {
2741    /// Removes the node and all of its children.
2742    Remove { control_handle: NodeControllerControlHandle },
2743    /// Request that the framework attempts to bind a driver to this node.
2744    /// This is an *additional* request for binding as the framework attempts to bind a node once
2745    /// when the node is created.
2746    /// * error `ZX_ERR_ALREADY_BOUND` if the node is already bound and `force_rebind` is false.
2747    /// * error `ZX_ERR_ALREADY_EXISTS` if the node has an outstanding |RequestBind| call which has
2748    /// not completed.
2749    RequestBind {
2750        payload: NodeControllerRequestBindRequest,
2751        responder: NodeControllerRequestBindResponder,
2752    },
2753    /// Hanging get style call that returns a terminal state for the associated `Node`,
2754    /// or the composite node that is parented by this node.
2755    /// For a successfully started driver this returns immediately with the token of the
2756    /// node that the driver started on.
2757    /// If an error happens we wait until bootup is complete, which is when all drivers that
2758    /// can bind and start have done so, before returning the error.
2759    WaitForDriver { responder: NodeControllerWaitForDriverResponder },
2760    /// An interaction was received which does not match any known method.
2761    #[non_exhaustive]
2762    _UnknownMethod {
2763        /// Ordinal of the method that was called.
2764        ordinal: u64,
2765        control_handle: NodeControllerControlHandle,
2766        method_type: fidl::MethodType,
2767    },
2768}
2769
2770impl NodeControllerRequest {
2771    #[allow(irrefutable_let_patterns)]
2772    pub fn into_remove(self) -> Option<(NodeControllerControlHandle)> {
2773        if let NodeControllerRequest::Remove { control_handle } = self {
2774            Some((control_handle))
2775        } else {
2776            None
2777        }
2778    }
2779
2780    #[allow(irrefutable_let_patterns)]
2781    pub fn into_request_bind(
2782        self,
2783    ) -> Option<(NodeControllerRequestBindRequest, NodeControllerRequestBindResponder)> {
2784        if let NodeControllerRequest::RequestBind { payload, responder } = self {
2785            Some((payload, responder))
2786        } else {
2787            None
2788        }
2789    }
2790
2791    #[allow(irrefutable_let_patterns)]
2792    pub fn into_wait_for_driver(self) -> Option<(NodeControllerWaitForDriverResponder)> {
2793        if let NodeControllerRequest::WaitForDriver { responder } = self {
2794            Some((responder))
2795        } else {
2796            None
2797        }
2798    }
2799
2800    /// Name of the method defined in FIDL
2801    pub fn method_name(&self) -> &'static str {
2802        match *self {
2803            NodeControllerRequest::Remove { .. } => "remove",
2804            NodeControllerRequest::RequestBind { .. } => "request_bind",
2805            NodeControllerRequest::WaitForDriver { .. } => "wait_for_driver",
2806            NodeControllerRequest::_UnknownMethod {
2807                method_type: fidl::MethodType::OneWay, ..
2808            } => "unknown one-way method",
2809            NodeControllerRequest::_UnknownMethod {
2810                method_type: fidl::MethodType::TwoWay, ..
2811            } => "unknown two-way method",
2812        }
2813    }
2814}
2815
2816#[derive(Debug, Clone)]
2817pub struct NodeControllerControlHandle {
2818    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2819}
2820
2821impl NodeControllerControlHandle {
2822    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2823        self.inner.shutdown_with_epitaph(status.into())
2824    }
2825}
2826
2827impl fidl::endpoints::ControlHandle for NodeControllerControlHandle {
2828    fn shutdown(&self) {
2829        self.inner.shutdown()
2830    }
2831
2832    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2833        self.inner.shutdown_with_epitaph(status)
2834    }
2835
2836    fn is_closed(&self) -> bool {
2837        self.inner.channel().is_closed()
2838    }
2839    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2840        self.inner.channel().on_closed()
2841    }
2842
2843    #[cfg(target_os = "fuchsia")]
2844    fn signal_peer(
2845        &self,
2846        clear_mask: zx::Signals,
2847        set_mask: zx::Signals,
2848    ) -> Result<(), zx_status::Status> {
2849        use fidl::Peered;
2850        self.inner.channel().signal_peer(clear_mask, set_mask)
2851    }
2852}
2853
2854impl NodeControllerControlHandle {
2855    pub fn send_on_bind(
2856        &self,
2857        mut payload: NodeControllerOnBindRequest,
2858    ) -> Result<(), fidl::Error> {
2859        self.inner.send::<NodeControllerOnBindRequest>(
2860            &mut payload,
2861            0,
2862            0x51f4165bc5ea202a,
2863            fidl::encoding::DynamicFlags::FLEXIBLE,
2864        )
2865    }
2866}
2867
2868#[must_use = "FIDL methods require a response to be sent"]
2869#[derive(Debug)]
2870pub struct NodeControllerRequestBindResponder {
2871    control_handle: std::mem::ManuallyDrop<NodeControllerControlHandle>,
2872    tx_id: u32,
2873}
2874
2875/// Set the the channel to be shutdown (see [`NodeControllerControlHandle::shutdown`])
2876/// if the responder is dropped without sending a response, so that the client
2877/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2878impl std::ops::Drop for NodeControllerRequestBindResponder {
2879    fn drop(&mut self) {
2880        self.control_handle.shutdown();
2881        // Safety: drops once, never accessed again
2882        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2883    }
2884}
2885
2886impl fidl::endpoints::Responder for NodeControllerRequestBindResponder {
2887    type ControlHandle = NodeControllerControlHandle;
2888
2889    fn control_handle(&self) -> &NodeControllerControlHandle {
2890        &self.control_handle
2891    }
2892
2893    fn drop_without_shutdown(mut self) {
2894        // Safety: drops once, never accessed again due to mem::forget
2895        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2896        // Prevent Drop from running (which would shut down the channel)
2897        std::mem::forget(self);
2898    }
2899}
2900
2901impl NodeControllerRequestBindResponder {
2902    /// Sends a response to the FIDL transaction.
2903    ///
2904    /// Sets the channel to shutdown if an error occurs.
2905    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2906        let _result = self.send_raw(result);
2907        if _result.is_err() {
2908            self.control_handle.shutdown();
2909        }
2910        self.drop_without_shutdown();
2911        _result
2912    }
2913
2914    /// Similar to "send" but does not shutdown the channel if an error occurs.
2915    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2916        let _result = self.send_raw(result);
2917        self.drop_without_shutdown();
2918        _result
2919    }
2920
2921    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2922        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2923            fidl::encoding::EmptyStruct,
2924            i32,
2925        >>(
2926            fidl::encoding::FlexibleResult::new(result),
2927            self.tx_id,
2928            0x41b954726b13508f,
2929            fidl::encoding::DynamicFlags::FLEXIBLE,
2930        )
2931    }
2932}
2933
2934#[must_use = "FIDL methods require a response to be sent"]
2935#[derive(Debug)]
2936pub struct NodeControllerWaitForDriverResponder {
2937    control_handle: std::mem::ManuallyDrop<NodeControllerControlHandle>,
2938    tx_id: u32,
2939}
2940
2941/// Set the the channel to be shutdown (see [`NodeControllerControlHandle::shutdown`])
2942/// if the responder is dropped without sending a response, so that the client
2943/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2944impl std::ops::Drop for NodeControllerWaitForDriverResponder {
2945    fn drop(&mut self) {
2946        self.control_handle.shutdown();
2947        // Safety: drops once, never accessed again
2948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2949    }
2950}
2951
2952impl fidl::endpoints::Responder for NodeControllerWaitForDriverResponder {
2953    type ControlHandle = NodeControllerControlHandle;
2954
2955    fn control_handle(&self) -> &NodeControllerControlHandle {
2956        &self.control_handle
2957    }
2958
2959    fn drop_without_shutdown(mut self) {
2960        // Safety: drops once, never accessed again due to mem::forget
2961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2962        // Prevent Drop from running (which would shut down the channel)
2963        std::mem::forget(self);
2964    }
2965}
2966
2967impl NodeControllerWaitForDriverResponder {
2968    /// Sends a response to the FIDL transaction.
2969    ///
2970    /// Sets the channel to shutdown if an error occurs.
2971    pub fn send(self, mut result: Result<DriverResult, i32>) -> Result<(), fidl::Error> {
2972        let _result = self.send_raw(result);
2973        if _result.is_err() {
2974            self.control_handle.shutdown();
2975        }
2976        self.drop_without_shutdown();
2977        _result
2978    }
2979
2980    /// Similar to "send" but does not shutdown the channel if an error occurs.
2981    pub fn send_no_shutdown_on_err(
2982        self,
2983        mut result: Result<DriverResult, i32>,
2984    ) -> Result<(), fidl::Error> {
2985        let _result = self.send_raw(result);
2986        self.drop_without_shutdown();
2987        _result
2988    }
2989
2990    fn send_raw(&self, mut result: Result<DriverResult, i32>) -> Result<(), fidl::Error> {
2991        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<DriverResult, i32>>(
2992            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
2993            self.tx_id,
2994            0x69f7106e47d81387,
2995            fidl::encoding::DynamicFlags::FLEXIBLE,
2996        )
2997    }
2998}
2999
3000#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3001pub struct NodeManagerMarker;
3002
3003impl fidl::endpoints::ProtocolMarker for NodeManagerMarker {
3004    type Proxy = NodeManagerProxy;
3005    type RequestStream = NodeManagerRequestStream;
3006    #[cfg(target_os = "fuchsia")]
3007    type SynchronousProxy = NodeManagerSynchronousProxy;
3008
3009    const DEBUG_NAME: &'static str = "fuchsia.driver.framework.NodeManager";
3010}
3011impl fidl::endpoints::DiscoverableProtocolMarker for NodeManagerMarker {}
3012pub type NodeManagerAddNodeResult = Result<(), NodeError>;
3013
3014pub trait NodeManagerProxyInterface: Send + Sync {
3015    type AddNodeResponseFut: std::future::Future<Output = Result<NodeManagerAddNodeResult, fidl::Error>>
3016        + Send;
3017    fn r#add_node(
3018        &self,
3019        node: &Node2,
3020        controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
3021        node_ref: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
3022    ) -> Self::AddNodeResponseFut;
3023}
3024#[derive(Debug)]
3025#[cfg(target_os = "fuchsia")]
3026pub struct NodeManagerSynchronousProxy {
3027    client: fidl::client::sync::Client,
3028}
3029
3030#[cfg(target_os = "fuchsia")]
3031impl fidl::endpoints::SynchronousProxy for NodeManagerSynchronousProxy {
3032    type Proxy = NodeManagerProxy;
3033    type Protocol = NodeManagerMarker;
3034
3035    fn from_channel(inner: fidl::Channel) -> Self {
3036        Self::new(inner)
3037    }
3038
3039    fn into_channel(self) -> fidl::Channel {
3040        self.client.into_channel()
3041    }
3042
3043    fn as_channel(&self) -> &fidl::Channel {
3044        self.client.as_channel()
3045    }
3046}
3047
3048#[cfg(target_os = "fuchsia")]
3049impl NodeManagerSynchronousProxy {
3050    pub fn new(channel: fidl::Channel) -> Self {
3051        Self { client: fidl::client::sync::Client::new(channel) }
3052    }
3053
3054    pub fn into_channel(self) -> fidl::Channel {
3055        self.client.into_channel()
3056    }
3057
3058    /// Waits until an event arrives and returns it. It is safe for other
3059    /// threads to make concurrent requests while waiting for an event.
3060    pub fn wait_for_event(
3061        &self,
3062        deadline: zx::MonotonicInstant,
3063    ) -> Result<NodeManagerEvent, fidl::Error> {
3064        NodeManagerEvent::decode(self.client.wait_for_event::<NodeManagerMarker>(deadline)?)
3065    }
3066
3067    /// Adds a Node2 to the driver framework.
3068    pub fn r#add_node(
3069        &self,
3070        mut node: &Node2,
3071        mut controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
3072        mut node_ref: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
3073        ___deadline: zx::MonotonicInstant,
3074    ) -> Result<NodeManagerAddNodeResult, fidl::Error> {
3075        let _response = self.client.send_query::<
3076            NodeManagerAddNodeRequest,
3077            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, NodeError>,
3078            NodeManagerMarker,
3079        >(
3080            (node, controller, node_ref,),
3081            0x71873eed0baf16fd,
3082            fidl::encoding::DynamicFlags::FLEXIBLE,
3083            ___deadline,
3084        )?
3085        .into_result::<NodeManagerMarker>("add_node")?;
3086        Ok(_response.map(|x| x))
3087    }
3088}
3089
3090#[cfg(target_os = "fuchsia")]
3091impl From<NodeManagerSynchronousProxy> for zx::NullableHandle {
3092    fn from(value: NodeManagerSynchronousProxy) -> Self {
3093        value.into_channel().into()
3094    }
3095}
3096
3097#[cfg(target_os = "fuchsia")]
3098impl From<fidl::Channel> for NodeManagerSynchronousProxy {
3099    fn from(value: fidl::Channel) -> Self {
3100        Self::new(value)
3101    }
3102}
3103
3104#[cfg(target_os = "fuchsia")]
3105impl fidl::endpoints::FromClient for NodeManagerSynchronousProxy {
3106    type Protocol = NodeManagerMarker;
3107
3108    fn from_client(value: fidl::endpoints::ClientEnd<NodeManagerMarker>) -> Self {
3109        Self::new(value.into_channel())
3110    }
3111}
3112
3113#[derive(Debug, Clone)]
3114pub struct NodeManagerProxy {
3115    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3116}
3117
3118impl fidl::endpoints::Proxy for NodeManagerProxy {
3119    type Protocol = NodeManagerMarker;
3120
3121    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3122        Self::new(inner)
3123    }
3124
3125    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3126        self.client.into_channel().map_err(|client| Self { client })
3127    }
3128
3129    fn as_channel(&self) -> &::fidl::AsyncChannel {
3130        self.client.as_channel()
3131    }
3132}
3133
3134impl NodeManagerProxy {
3135    /// Create a new Proxy for fuchsia.driver.framework/NodeManager.
3136    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3137        let protocol_name = <NodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3138        Self { client: fidl::client::Client::new(channel, protocol_name) }
3139    }
3140
3141    /// Get a Stream of events from the remote end of the protocol.
3142    ///
3143    /// # Panics
3144    ///
3145    /// Panics if the event stream was already taken.
3146    pub fn take_event_stream(&self) -> NodeManagerEventStream {
3147        NodeManagerEventStream { event_receiver: self.client.take_event_receiver() }
3148    }
3149
3150    /// Adds a Node2 to the driver framework.
3151    pub fn r#add_node(
3152        &self,
3153        mut node: &Node2,
3154        mut controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
3155        mut node_ref: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
3156    ) -> fidl::client::QueryResponseFut<
3157        NodeManagerAddNodeResult,
3158        fidl::encoding::DefaultFuchsiaResourceDialect,
3159    > {
3160        NodeManagerProxyInterface::r#add_node(self, node, controller, node_ref)
3161    }
3162}
3163
3164impl NodeManagerProxyInterface for NodeManagerProxy {
3165    type AddNodeResponseFut = fidl::client::QueryResponseFut<
3166        NodeManagerAddNodeResult,
3167        fidl::encoding::DefaultFuchsiaResourceDialect,
3168    >;
3169    fn r#add_node(
3170        &self,
3171        mut node: &Node2,
3172        mut controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
3173        mut node_ref: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
3174    ) -> Self::AddNodeResponseFut {
3175        fn _decode(
3176            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3177        ) -> Result<NodeManagerAddNodeResult, fidl::Error> {
3178            let _response = fidl::client::decode_transaction_body::<
3179                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, NodeError>,
3180                fidl::encoding::DefaultFuchsiaResourceDialect,
3181                0x71873eed0baf16fd,
3182            >(_buf?)?
3183            .into_result::<NodeManagerMarker>("add_node")?;
3184            Ok(_response.map(|x| x))
3185        }
3186        self.client.send_query_and_decode::<NodeManagerAddNodeRequest, NodeManagerAddNodeResult>(
3187            (node, controller, node_ref),
3188            0x71873eed0baf16fd,
3189            fidl::encoding::DynamicFlags::FLEXIBLE,
3190            _decode,
3191        )
3192    }
3193}
3194
3195pub struct NodeManagerEventStream {
3196    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3197}
3198
3199impl std::marker::Unpin for NodeManagerEventStream {}
3200
3201impl futures::stream::FusedStream for NodeManagerEventStream {
3202    fn is_terminated(&self) -> bool {
3203        self.event_receiver.is_terminated()
3204    }
3205}
3206
3207impl futures::Stream for NodeManagerEventStream {
3208    type Item = Result<NodeManagerEvent, fidl::Error>;
3209
3210    fn poll_next(
3211        mut self: std::pin::Pin<&mut Self>,
3212        cx: &mut std::task::Context<'_>,
3213    ) -> std::task::Poll<Option<Self::Item>> {
3214        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3215            &mut self.event_receiver,
3216            cx
3217        )?) {
3218            Some(buf) => std::task::Poll::Ready(Some(NodeManagerEvent::decode(buf))),
3219            None => std::task::Poll::Ready(None),
3220        }
3221    }
3222}
3223
3224#[derive(Debug)]
3225pub enum NodeManagerEvent {
3226    #[non_exhaustive]
3227    _UnknownEvent {
3228        /// Ordinal of the event that was sent.
3229        ordinal: u64,
3230    },
3231}
3232
3233impl NodeManagerEvent {
3234    /// Decodes a message buffer as a [`NodeManagerEvent`].
3235    fn decode(
3236        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3237    ) -> Result<NodeManagerEvent, fidl::Error> {
3238        let (bytes, _handles) = buf.split_mut();
3239        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3240        debug_assert_eq!(tx_header.tx_id, 0);
3241        match tx_header.ordinal {
3242            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3243                Ok(NodeManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3244            }
3245            _ => Err(fidl::Error::UnknownOrdinal {
3246                ordinal: tx_header.ordinal,
3247                protocol_name: <NodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3248            }),
3249        }
3250    }
3251}
3252
3253/// A Stream of incoming requests for fuchsia.driver.framework/NodeManager.
3254pub struct NodeManagerRequestStream {
3255    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3256    is_terminated: bool,
3257}
3258
3259impl std::marker::Unpin for NodeManagerRequestStream {}
3260
3261impl futures::stream::FusedStream for NodeManagerRequestStream {
3262    fn is_terminated(&self) -> bool {
3263        self.is_terminated
3264    }
3265}
3266
3267impl fidl::endpoints::RequestStream for NodeManagerRequestStream {
3268    type Protocol = NodeManagerMarker;
3269    type ControlHandle = NodeManagerControlHandle;
3270
3271    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3272        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3273    }
3274
3275    fn control_handle(&self) -> Self::ControlHandle {
3276        NodeManagerControlHandle { inner: self.inner.clone() }
3277    }
3278
3279    fn into_inner(
3280        self,
3281    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3282    {
3283        (self.inner, self.is_terminated)
3284    }
3285
3286    fn from_inner(
3287        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3288        is_terminated: bool,
3289    ) -> Self {
3290        Self { inner, is_terminated }
3291    }
3292}
3293
3294impl futures::Stream for NodeManagerRequestStream {
3295    type Item = Result<NodeManagerRequest, fidl::Error>;
3296
3297    fn poll_next(
3298        mut self: std::pin::Pin<&mut Self>,
3299        cx: &mut std::task::Context<'_>,
3300    ) -> std::task::Poll<Option<Self::Item>> {
3301        let this = &mut *self;
3302        if this.inner.check_shutdown(cx) {
3303            this.is_terminated = true;
3304            return std::task::Poll::Ready(None);
3305        }
3306        if this.is_terminated {
3307            panic!("polled NodeManagerRequestStream after completion");
3308        }
3309        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3310            |bytes, handles| {
3311                match this.inner.channel().read_etc(cx, bytes, handles) {
3312                    std::task::Poll::Ready(Ok(())) => {}
3313                    std::task::Poll::Pending => return std::task::Poll::Pending,
3314                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3315                        this.is_terminated = true;
3316                        return std::task::Poll::Ready(None);
3317                    }
3318                    std::task::Poll::Ready(Err(e)) => {
3319                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3320                            e.into(),
3321                        ))));
3322                    }
3323                }
3324
3325                // A message has been received from the channel
3326                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3327
3328                std::task::Poll::Ready(Some(match header.ordinal {
3329                    0x71873eed0baf16fd => {
3330                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3331                        let mut req = fidl::new_empty!(
3332                            NodeManagerAddNodeRequest,
3333                            fidl::encoding::DefaultFuchsiaResourceDialect
3334                        );
3335                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NodeManagerAddNodeRequest>(&header, _body_bytes, handles, &mut req)?;
3336                        let control_handle = NodeManagerControlHandle { inner: this.inner.clone() };
3337                        Ok(NodeManagerRequest::AddNode {
3338                            node: req.node,
3339                            controller: req.controller,
3340                            node_ref: req.node_ref,
3341
3342                            responder: NodeManagerAddNodeResponder {
3343                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3344                                tx_id: header.tx_id,
3345                            },
3346                        })
3347                    }
3348                    _ if header.tx_id == 0
3349                        && header
3350                            .dynamic_flags()
3351                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3352                    {
3353                        Ok(NodeManagerRequest::_UnknownMethod {
3354                            ordinal: header.ordinal,
3355                            control_handle: NodeManagerControlHandle { inner: this.inner.clone() },
3356                            method_type: fidl::MethodType::OneWay,
3357                        })
3358                    }
3359                    _ if header
3360                        .dynamic_flags()
3361                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3362                    {
3363                        this.inner.send_framework_err(
3364                            fidl::encoding::FrameworkErr::UnknownMethod,
3365                            header.tx_id,
3366                            header.ordinal,
3367                            header.dynamic_flags(),
3368                            (bytes, handles),
3369                        )?;
3370                        Ok(NodeManagerRequest::_UnknownMethod {
3371                            ordinal: header.ordinal,
3372                            control_handle: NodeManagerControlHandle { inner: this.inner.clone() },
3373                            method_type: fidl::MethodType::TwoWay,
3374                        })
3375                    }
3376                    _ => Err(fidl::Error::UnknownOrdinal {
3377                        ordinal: header.ordinal,
3378                        protocol_name:
3379                            <NodeManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3380                    }),
3381                }))
3382            },
3383        )
3384    }
3385}
3386
3387/// Protocol through which a client can add a Node2 to the driver topology.
3388#[derive(Debug)]
3389pub enum NodeManagerRequest {
3390    /// Adds a Node2 to the driver framework.
3391    AddNode {
3392        node: Node2,
3393        controller: fidl::endpoints::ServerEnd<NodeControllerMarker>,
3394        node_ref: Option<fidl::endpoints::ServerEnd<NodeMarker>>,
3395        responder: NodeManagerAddNodeResponder,
3396    },
3397    /// An interaction was received which does not match any known method.
3398    #[non_exhaustive]
3399    _UnknownMethod {
3400        /// Ordinal of the method that was called.
3401        ordinal: u64,
3402        control_handle: NodeManagerControlHandle,
3403        method_type: fidl::MethodType,
3404    },
3405}
3406
3407impl NodeManagerRequest {
3408    #[allow(irrefutable_let_patterns)]
3409    pub fn into_add_node(
3410        self,
3411    ) -> Option<(
3412        Node2,
3413        fidl::endpoints::ServerEnd<NodeControllerMarker>,
3414        Option<fidl::endpoints::ServerEnd<NodeMarker>>,
3415        NodeManagerAddNodeResponder,
3416    )> {
3417        if let NodeManagerRequest::AddNode { node, controller, node_ref, responder } = self {
3418            Some((node, controller, node_ref, responder))
3419        } else {
3420            None
3421        }
3422    }
3423
3424    /// Name of the method defined in FIDL
3425    pub fn method_name(&self) -> &'static str {
3426        match *self {
3427            NodeManagerRequest::AddNode { .. } => "add_node",
3428            NodeManagerRequest::_UnknownMethod {
3429                method_type: fidl::MethodType::OneWay, ..
3430            } => "unknown one-way method",
3431            NodeManagerRequest::_UnknownMethod {
3432                method_type: fidl::MethodType::TwoWay, ..
3433            } => "unknown two-way method",
3434        }
3435    }
3436}
3437
3438#[derive(Debug, Clone)]
3439pub struct NodeManagerControlHandle {
3440    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3441}
3442
3443impl NodeManagerControlHandle {
3444    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3445        self.inner.shutdown_with_epitaph(status.into())
3446    }
3447}
3448
3449impl fidl::endpoints::ControlHandle for NodeManagerControlHandle {
3450    fn shutdown(&self) {
3451        self.inner.shutdown()
3452    }
3453
3454    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3455        self.inner.shutdown_with_epitaph(status)
3456    }
3457
3458    fn is_closed(&self) -> bool {
3459        self.inner.channel().is_closed()
3460    }
3461    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3462        self.inner.channel().on_closed()
3463    }
3464
3465    #[cfg(target_os = "fuchsia")]
3466    fn signal_peer(
3467        &self,
3468        clear_mask: zx::Signals,
3469        set_mask: zx::Signals,
3470    ) -> Result<(), zx_status::Status> {
3471        use fidl::Peered;
3472        self.inner.channel().signal_peer(clear_mask, set_mask)
3473    }
3474}
3475
3476impl NodeManagerControlHandle {}
3477
3478#[must_use = "FIDL methods require a response to be sent"]
3479#[derive(Debug)]
3480pub struct NodeManagerAddNodeResponder {
3481    control_handle: std::mem::ManuallyDrop<NodeManagerControlHandle>,
3482    tx_id: u32,
3483}
3484
3485/// Set the the channel to be shutdown (see [`NodeManagerControlHandle::shutdown`])
3486/// if the responder is dropped without sending a response, so that the client
3487/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3488impl std::ops::Drop for NodeManagerAddNodeResponder {
3489    fn drop(&mut self) {
3490        self.control_handle.shutdown();
3491        // Safety: drops once, never accessed again
3492        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3493    }
3494}
3495
3496impl fidl::endpoints::Responder for NodeManagerAddNodeResponder {
3497    type ControlHandle = NodeManagerControlHandle;
3498
3499    fn control_handle(&self) -> &NodeManagerControlHandle {
3500        &self.control_handle
3501    }
3502
3503    fn drop_without_shutdown(mut self) {
3504        // Safety: drops once, never accessed again due to mem::forget
3505        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3506        // Prevent Drop from running (which would shut down the channel)
3507        std::mem::forget(self);
3508    }
3509}
3510
3511impl NodeManagerAddNodeResponder {
3512    /// Sends a response to the FIDL transaction.
3513    ///
3514    /// Sets the channel to shutdown if an error occurs.
3515    pub fn send(self, mut result: Result<(), NodeError>) -> Result<(), fidl::Error> {
3516        let _result = self.send_raw(result);
3517        if _result.is_err() {
3518            self.control_handle.shutdown();
3519        }
3520        self.drop_without_shutdown();
3521        _result
3522    }
3523
3524    /// Similar to "send" but does not shutdown the channel if an error occurs.
3525    pub fn send_no_shutdown_on_err(
3526        self,
3527        mut result: Result<(), NodeError>,
3528    ) -> Result<(), fidl::Error> {
3529        let _result = self.send_raw(result);
3530        self.drop_without_shutdown();
3531        _result
3532    }
3533
3534    fn send_raw(&self, mut result: Result<(), NodeError>) -> Result<(), fidl::Error> {
3535        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3536            fidl::encoding::EmptyStruct,
3537            NodeError,
3538        >>(
3539            fidl::encoding::FlexibleResult::new(result),
3540            self.tx_id,
3541            0x71873eed0baf16fd,
3542            fidl::encoding::DynamicFlags::FLEXIBLE,
3543        )
3544    }
3545}
3546
3547#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3548pub struct ResourceControllerMarker;
3549
3550impl fidl::endpoints::ProtocolMarker for ResourceControllerMarker {
3551    type Proxy = ResourceControllerProxy;
3552    type RequestStream = ResourceControllerRequestStream;
3553    #[cfg(target_os = "fuchsia")]
3554    type SynchronousProxy = ResourceControllerSynchronousProxy;
3555
3556    const DEBUG_NAME: &'static str = "(anonymous) ResourceController";
3557}
3558
3559pub trait ResourceControllerProxyInterface: Send + Sync {
3560    fn r#remove(&self) -> Result<(), fidl::Error>;
3561}
3562#[derive(Debug)]
3563#[cfg(target_os = "fuchsia")]
3564pub struct ResourceControllerSynchronousProxy {
3565    client: fidl::client::sync::Client,
3566}
3567
3568#[cfg(target_os = "fuchsia")]
3569impl fidl::endpoints::SynchronousProxy for ResourceControllerSynchronousProxy {
3570    type Proxy = ResourceControllerProxy;
3571    type Protocol = ResourceControllerMarker;
3572
3573    fn from_channel(inner: fidl::Channel) -> Self {
3574        Self::new(inner)
3575    }
3576
3577    fn into_channel(self) -> fidl::Channel {
3578        self.client.into_channel()
3579    }
3580
3581    fn as_channel(&self) -> &fidl::Channel {
3582        self.client.as_channel()
3583    }
3584}
3585
3586#[cfg(target_os = "fuchsia")]
3587impl ResourceControllerSynchronousProxy {
3588    pub fn new(channel: fidl::Channel) -> Self {
3589        Self { client: fidl::client::sync::Client::new(channel) }
3590    }
3591
3592    pub fn into_channel(self) -> fidl::Channel {
3593        self.client.into_channel()
3594    }
3595
3596    /// Waits until an event arrives and returns it. It is safe for other
3597    /// threads to make concurrent requests while waiting for an event.
3598    pub fn wait_for_event(
3599        &self,
3600        deadline: zx::MonotonicInstant,
3601    ) -> Result<ResourceControllerEvent, fidl::Error> {
3602        ResourceControllerEvent::decode(
3603            self.client.wait_for_event::<ResourceControllerMarker>(deadline)?,
3604        )
3605    }
3606
3607    /// Removes the resource.
3608    pub fn r#remove(&self) -> Result<(), fidl::Error> {
3609        self.client.send::<fidl::encoding::EmptyPayload>(
3610            (),
3611            0x1257bec06bde4f98,
3612            fidl::encoding::DynamicFlags::FLEXIBLE,
3613        )
3614    }
3615}
3616
3617#[cfg(target_os = "fuchsia")]
3618impl From<ResourceControllerSynchronousProxy> for zx::NullableHandle {
3619    fn from(value: ResourceControllerSynchronousProxy) -> Self {
3620        value.into_channel().into()
3621    }
3622}
3623
3624#[cfg(target_os = "fuchsia")]
3625impl From<fidl::Channel> for ResourceControllerSynchronousProxy {
3626    fn from(value: fidl::Channel) -> Self {
3627        Self::new(value)
3628    }
3629}
3630
3631#[cfg(target_os = "fuchsia")]
3632impl fidl::endpoints::FromClient for ResourceControllerSynchronousProxy {
3633    type Protocol = ResourceControllerMarker;
3634
3635    fn from_client(value: fidl::endpoints::ClientEnd<ResourceControllerMarker>) -> Self {
3636        Self::new(value.into_channel())
3637    }
3638}
3639
3640#[derive(Debug, Clone)]
3641pub struct ResourceControllerProxy {
3642    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3643}
3644
3645impl fidl::endpoints::Proxy for ResourceControllerProxy {
3646    type Protocol = ResourceControllerMarker;
3647
3648    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3649        Self::new(inner)
3650    }
3651
3652    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3653        self.client.into_channel().map_err(|client| Self { client })
3654    }
3655
3656    fn as_channel(&self) -> &::fidl::AsyncChannel {
3657        self.client.as_channel()
3658    }
3659}
3660
3661impl ResourceControllerProxy {
3662    /// Create a new Proxy for fuchsia.driver.framework/ResourceController.
3663    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3664        let protocol_name =
3665            <ResourceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3666        Self { client: fidl::client::Client::new(channel, protocol_name) }
3667    }
3668
3669    /// Get a Stream of events from the remote end of the protocol.
3670    ///
3671    /// # Panics
3672    ///
3673    /// Panics if the event stream was already taken.
3674    pub fn take_event_stream(&self) -> ResourceControllerEventStream {
3675        ResourceControllerEventStream { event_receiver: self.client.take_event_receiver() }
3676    }
3677
3678    /// Removes the resource.
3679    pub fn r#remove(&self) -> Result<(), fidl::Error> {
3680        ResourceControllerProxyInterface::r#remove(self)
3681    }
3682}
3683
3684impl ResourceControllerProxyInterface for ResourceControllerProxy {
3685    fn r#remove(&self) -> Result<(), fidl::Error> {
3686        self.client.send::<fidl::encoding::EmptyPayload>(
3687            (),
3688            0x1257bec06bde4f98,
3689            fidl::encoding::DynamicFlags::FLEXIBLE,
3690        )
3691    }
3692}
3693
3694pub struct ResourceControllerEventStream {
3695    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3696}
3697
3698impl std::marker::Unpin for ResourceControllerEventStream {}
3699
3700impl futures::stream::FusedStream for ResourceControllerEventStream {
3701    fn is_terminated(&self) -> bool {
3702        self.event_receiver.is_terminated()
3703    }
3704}
3705
3706impl futures::Stream for ResourceControllerEventStream {
3707    type Item = Result<ResourceControllerEvent, fidl::Error>;
3708
3709    fn poll_next(
3710        mut self: std::pin::Pin<&mut Self>,
3711        cx: &mut std::task::Context<'_>,
3712    ) -> std::task::Poll<Option<Self::Item>> {
3713        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3714            &mut self.event_receiver,
3715            cx
3716        )?) {
3717            Some(buf) => std::task::Poll::Ready(Some(ResourceControllerEvent::decode(buf))),
3718            None => std::task::Poll::Ready(None),
3719        }
3720    }
3721}
3722
3723#[derive(Debug)]
3724pub enum ResourceControllerEvent {
3725    #[non_exhaustive]
3726    _UnknownEvent {
3727        /// Ordinal of the event that was sent.
3728        ordinal: u64,
3729    },
3730}
3731
3732impl ResourceControllerEvent {
3733    /// Decodes a message buffer as a [`ResourceControllerEvent`].
3734    fn decode(
3735        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3736    ) -> Result<ResourceControllerEvent, fidl::Error> {
3737        let (bytes, _handles) = buf.split_mut();
3738        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3739        debug_assert_eq!(tx_header.tx_id, 0);
3740        match tx_header.ordinal {
3741            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3742                Ok(ResourceControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3743            }
3744            _ => Err(fidl::Error::UnknownOrdinal {
3745                ordinal: tx_header.ordinal,
3746                protocol_name:
3747                    <ResourceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3748            }),
3749        }
3750    }
3751}
3752
3753/// A Stream of incoming requests for fuchsia.driver.framework/ResourceController.
3754pub struct ResourceControllerRequestStream {
3755    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3756    is_terminated: bool,
3757}
3758
3759impl std::marker::Unpin for ResourceControllerRequestStream {}
3760
3761impl futures::stream::FusedStream for ResourceControllerRequestStream {
3762    fn is_terminated(&self) -> bool {
3763        self.is_terminated
3764    }
3765}
3766
3767impl fidl::endpoints::RequestStream for ResourceControllerRequestStream {
3768    type Protocol = ResourceControllerMarker;
3769    type ControlHandle = ResourceControllerControlHandle;
3770
3771    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3772        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3773    }
3774
3775    fn control_handle(&self) -> Self::ControlHandle {
3776        ResourceControllerControlHandle { inner: self.inner.clone() }
3777    }
3778
3779    fn into_inner(
3780        self,
3781    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3782    {
3783        (self.inner, self.is_terminated)
3784    }
3785
3786    fn from_inner(
3787        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3788        is_terminated: bool,
3789    ) -> Self {
3790        Self { inner, is_terminated }
3791    }
3792}
3793
3794impl futures::Stream for ResourceControllerRequestStream {
3795    type Item = Result<ResourceControllerRequest, fidl::Error>;
3796
3797    fn poll_next(
3798        mut self: std::pin::Pin<&mut Self>,
3799        cx: &mut std::task::Context<'_>,
3800    ) -> std::task::Poll<Option<Self::Item>> {
3801        let this = &mut *self;
3802        if this.inner.check_shutdown(cx) {
3803            this.is_terminated = true;
3804            return std::task::Poll::Ready(None);
3805        }
3806        if this.is_terminated {
3807            panic!("polled ResourceControllerRequestStream after completion");
3808        }
3809        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3810            |bytes, handles| {
3811                match this.inner.channel().read_etc(cx, bytes, handles) {
3812                    std::task::Poll::Ready(Ok(())) => {}
3813                    std::task::Poll::Pending => return std::task::Poll::Pending,
3814                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3815                        this.is_terminated = true;
3816                        return std::task::Poll::Ready(None);
3817                    }
3818                    std::task::Poll::Ready(Err(e)) => {
3819                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3820                            e.into(),
3821                        ))));
3822                    }
3823                }
3824
3825                // A message has been received from the channel
3826                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3827
3828                std::task::Poll::Ready(Some(match header.ordinal {
3829                0x1257bec06bde4f98 => {
3830                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3831                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3832                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3833                    let control_handle = ResourceControllerControlHandle {
3834                        inner: this.inner.clone(),
3835                    };
3836                    Ok(ResourceControllerRequest::Remove {
3837                        control_handle,
3838                    })
3839                }
3840                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3841                    Ok(ResourceControllerRequest::_UnknownMethod {
3842                        ordinal: header.ordinal,
3843                        control_handle: ResourceControllerControlHandle { inner: this.inner.clone() },
3844                        method_type: fidl::MethodType::OneWay,
3845                    })
3846                }
3847                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3848                    this.inner.send_framework_err(
3849                        fidl::encoding::FrameworkErr::UnknownMethod,
3850                        header.tx_id,
3851                        header.ordinal,
3852                        header.dynamic_flags(),
3853                        (bytes, handles),
3854                    )?;
3855                    Ok(ResourceControllerRequest::_UnknownMethod {
3856                        ordinal: header.ordinal,
3857                        control_handle: ResourceControllerControlHandle { inner: this.inner.clone() },
3858                        method_type: fidl::MethodType::TwoWay,
3859                    })
3860                }
3861                _ => Err(fidl::Error::UnknownOrdinal {
3862                    ordinal: header.ordinal,
3863                    protocol_name: <ResourceControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3864                }),
3865            }))
3866            },
3867        )
3868    }
3869}
3870
3871/// Protocol through which the resource's provider can use to control it.
3872#[derive(Debug)]
3873pub enum ResourceControllerRequest {
3874    /// Removes the resource.
3875    Remove { control_handle: ResourceControllerControlHandle },
3876    /// An interaction was received which does not match any known method.
3877    #[non_exhaustive]
3878    _UnknownMethod {
3879        /// Ordinal of the method that was called.
3880        ordinal: u64,
3881        control_handle: ResourceControllerControlHandle,
3882        method_type: fidl::MethodType,
3883    },
3884}
3885
3886impl ResourceControllerRequest {
3887    #[allow(irrefutable_let_patterns)]
3888    pub fn into_remove(self) -> Option<(ResourceControllerControlHandle)> {
3889        if let ResourceControllerRequest::Remove { control_handle } = self {
3890            Some((control_handle))
3891        } else {
3892            None
3893        }
3894    }
3895
3896    /// Name of the method defined in FIDL
3897    pub fn method_name(&self) -> &'static str {
3898        match *self {
3899            ResourceControllerRequest::Remove { .. } => "remove",
3900            ResourceControllerRequest::_UnknownMethod {
3901                method_type: fidl::MethodType::OneWay,
3902                ..
3903            } => "unknown one-way method",
3904            ResourceControllerRequest::_UnknownMethod {
3905                method_type: fidl::MethodType::TwoWay,
3906                ..
3907            } => "unknown two-way method",
3908        }
3909    }
3910}
3911
3912#[derive(Debug, Clone)]
3913pub struct ResourceControllerControlHandle {
3914    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3915}
3916
3917impl ResourceControllerControlHandle {
3918    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3919        self.inner.shutdown_with_epitaph(status.into())
3920    }
3921}
3922
3923impl fidl::endpoints::ControlHandle for ResourceControllerControlHandle {
3924    fn shutdown(&self) {
3925        self.inner.shutdown()
3926    }
3927
3928    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3929        self.inner.shutdown_with_epitaph(status)
3930    }
3931
3932    fn is_closed(&self) -> bool {
3933        self.inner.channel().is_closed()
3934    }
3935    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3936        self.inner.channel().on_closed()
3937    }
3938
3939    #[cfg(target_os = "fuchsia")]
3940    fn signal_peer(
3941        &self,
3942        clear_mask: zx::Signals,
3943        set_mask: zx::Signals,
3944    ) -> Result<(), zx_status::Status> {
3945        use fidl::Peered;
3946        self.inner.channel().signal_peer(clear_mask, set_mask)
3947    }
3948}
3949
3950impl ResourceControllerControlHandle {}
3951
3952mod internal {
3953    use super::*;
3954
3955    impl fidl::encoding::ResourceTypeMarker for DriverResumeRequest {
3956        type Borrowed<'a> = &'a mut Self;
3957        fn take_or_borrow<'a>(
3958            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3959        ) -> Self::Borrowed<'a> {
3960            value
3961        }
3962    }
3963
3964    unsafe impl fidl::encoding::TypeMarker for DriverResumeRequest {
3965        type Owned = Self;
3966
3967        #[inline(always)]
3968        fn inline_align(_context: fidl::encoding::Context) -> usize {
3969            4
3970        }
3971
3972        #[inline(always)]
3973        fn inline_size(_context: fidl::encoding::Context) -> usize {
3974            4
3975        }
3976    }
3977
3978    unsafe impl
3979        fidl::encoding::Encode<DriverResumeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3980        for &mut DriverResumeRequest
3981    {
3982        #[inline]
3983        unsafe fn encode(
3984            self,
3985            encoder: &mut fidl::encoding::Encoder<
3986                '_,
3987                fidl::encoding::DefaultFuchsiaResourceDialect,
3988            >,
3989            offset: usize,
3990            _depth: fidl::encoding::Depth,
3991        ) -> fidl::Result<()> {
3992            encoder.debug_check_bounds::<DriverResumeRequest>(offset);
3993            // Delegate to tuple encoding.
3994            fidl::encoding::Encode::<
3995                DriverResumeRequest,
3996                fidl::encoding::DefaultFuchsiaResourceDialect,
3997            >::encode(
3998                (<fidl::encoding::Optional<
3999                    fidl::encoding::HandleType<
4000                        fidl::EventPair,
4001                        { fidl::ObjectType::EVENTPAIR.into_raw() },
4002                        24579,
4003                    >,
4004                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4005                    &mut self.power_element_lease,
4006                ),),
4007                encoder,
4008                offset,
4009                _depth,
4010            )
4011        }
4012    }
4013    unsafe impl<
4014        T0: fidl::encoding::Encode<
4015                fidl::encoding::Optional<
4016                    fidl::encoding::HandleType<
4017                        fidl::EventPair,
4018                        { fidl::ObjectType::EVENTPAIR.into_raw() },
4019                        24579,
4020                    >,
4021                >,
4022                fidl::encoding::DefaultFuchsiaResourceDialect,
4023            >,
4024    > fidl::encoding::Encode<DriverResumeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4025        for (T0,)
4026    {
4027        #[inline]
4028        unsafe fn encode(
4029            self,
4030            encoder: &mut fidl::encoding::Encoder<
4031                '_,
4032                fidl::encoding::DefaultFuchsiaResourceDialect,
4033            >,
4034            offset: usize,
4035            depth: fidl::encoding::Depth,
4036        ) -> fidl::Result<()> {
4037            encoder.debug_check_bounds::<DriverResumeRequest>(offset);
4038            // Zero out padding regions. There's no need to apply masks
4039            // because the unmasked parts will be overwritten by fields.
4040            // Write the fields.
4041            self.0.encode(encoder, offset + 0, depth)?;
4042            Ok(())
4043        }
4044    }
4045
4046    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4047        for DriverResumeRequest
4048    {
4049        #[inline(always)]
4050        fn new_empty() -> Self {
4051            Self {
4052                power_element_lease: fidl::new_empty!(
4053                    fidl::encoding::Optional<
4054                        fidl::encoding::HandleType<
4055                            fidl::EventPair,
4056                            { fidl::ObjectType::EVENTPAIR.into_raw() },
4057                            24579,
4058                        >,
4059                    >,
4060                    fidl::encoding::DefaultFuchsiaResourceDialect
4061                ),
4062            }
4063        }
4064
4065        #[inline]
4066        unsafe fn decode(
4067            &mut self,
4068            decoder: &mut fidl::encoding::Decoder<
4069                '_,
4070                fidl::encoding::DefaultFuchsiaResourceDialect,
4071            >,
4072            offset: usize,
4073            _depth: fidl::encoding::Depth,
4074        ) -> fidl::Result<()> {
4075            decoder.debug_check_bounds::<Self>(offset);
4076            // Verify that padding bytes are zero.
4077            fidl::decode!(
4078                fidl::encoding::Optional<
4079                    fidl::encoding::HandleType<
4080                        fidl::EventPair,
4081                        { fidl::ObjectType::EVENTPAIR.into_raw() },
4082                        24579,
4083                    >,
4084                >,
4085                fidl::encoding::DefaultFuchsiaResourceDialect,
4086                &mut self.power_element_lease,
4087                decoder,
4088                offset + 0,
4089                _depth
4090            )?;
4091            Ok(())
4092        }
4093    }
4094
4095    impl fidl::encoding::ResourceTypeMarker for DriverStartRequest {
4096        type Borrowed<'a> = &'a mut Self;
4097        fn take_or_borrow<'a>(
4098            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4099        ) -> Self::Borrowed<'a> {
4100            value
4101        }
4102    }
4103
4104    unsafe impl fidl::encoding::TypeMarker for DriverStartRequest {
4105        type Owned = Self;
4106
4107        #[inline(always)]
4108        fn inline_align(_context: fidl::encoding::Context) -> usize {
4109            8
4110        }
4111
4112        #[inline(always)]
4113        fn inline_size(_context: fidl::encoding::Context) -> usize {
4114            16
4115        }
4116    }
4117
4118    unsafe impl
4119        fidl::encoding::Encode<DriverStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4120        for &mut DriverStartRequest
4121    {
4122        #[inline]
4123        unsafe fn encode(
4124            self,
4125            encoder: &mut fidl::encoding::Encoder<
4126                '_,
4127                fidl::encoding::DefaultFuchsiaResourceDialect,
4128            >,
4129            offset: usize,
4130            _depth: fidl::encoding::Depth,
4131        ) -> fidl::Result<()> {
4132            encoder.debug_check_bounds::<DriverStartRequest>(offset);
4133            // Delegate to tuple encoding.
4134            fidl::encoding::Encode::<
4135                DriverStartRequest,
4136                fidl::encoding::DefaultFuchsiaResourceDialect,
4137            >::encode(
4138                (<DriverStartArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4139                    &mut self.start_args,
4140                ),),
4141                encoder,
4142                offset,
4143                _depth,
4144            )
4145        }
4146    }
4147    unsafe impl<
4148        T0: fidl::encoding::Encode<DriverStartArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
4149    > fidl::encoding::Encode<DriverStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4150        for (T0,)
4151    {
4152        #[inline]
4153        unsafe fn encode(
4154            self,
4155            encoder: &mut fidl::encoding::Encoder<
4156                '_,
4157                fidl::encoding::DefaultFuchsiaResourceDialect,
4158            >,
4159            offset: usize,
4160            depth: fidl::encoding::Depth,
4161        ) -> fidl::Result<()> {
4162            encoder.debug_check_bounds::<DriverStartRequest>(offset);
4163            // Zero out padding regions. There's no need to apply masks
4164            // because the unmasked parts will be overwritten by fields.
4165            // Write the fields.
4166            self.0.encode(encoder, offset + 0, depth)?;
4167            Ok(())
4168        }
4169    }
4170
4171    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4172        for DriverStartRequest
4173    {
4174        #[inline(always)]
4175        fn new_empty() -> Self {
4176            Self {
4177                start_args: fidl::new_empty!(
4178                    DriverStartArgs,
4179                    fidl::encoding::DefaultFuchsiaResourceDialect
4180                ),
4181            }
4182        }
4183
4184        #[inline]
4185        unsafe fn decode(
4186            &mut self,
4187            decoder: &mut fidl::encoding::Decoder<
4188                '_,
4189                fidl::encoding::DefaultFuchsiaResourceDialect,
4190            >,
4191            offset: usize,
4192            _depth: fidl::encoding::Depth,
4193        ) -> fidl::Result<()> {
4194            decoder.debug_check_bounds::<Self>(offset);
4195            // Verify that padding bytes are zero.
4196            fidl::decode!(
4197                DriverStartArgs,
4198                fidl::encoding::DefaultFuchsiaResourceDialect,
4199                &mut self.start_args,
4200                decoder,
4201                offset + 0,
4202                _depth
4203            )?;
4204            Ok(())
4205        }
4206    }
4207
4208    impl fidl::encoding::ResourceTypeMarker for NodeAddChildRequest {
4209        type Borrowed<'a> = &'a mut Self;
4210        fn take_or_borrow<'a>(
4211            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4212        ) -> Self::Borrowed<'a> {
4213            value
4214        }
4215    }
4216
4217    unsafe impl fidl::encoding::TypeMarker for NodeAddChildRequest {
4218        type Owned = Self;
4219
4220        #[inline(always)]
4221        fn inline_align(_context: fidl::encoding::Context) -> usize {
4222            8
4223        }
4224
4225        #[inline(always)]
4226        fn inline_size(_context: fidl::encoding::Context) -> usize {
4227            24
4228        }
4229    }
4230
4231    unsafe impl
4232        fidl::encoding::Encode<NodeAddChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4233        for &mut NodeAddChildRequest
4234    {
4235        #[inline]
4236        unsafe fn encode(
4237            self,
4238            encoder: &mut fidl::encoding::Encoder<
4239                '_,
4240                fidl::encoding::DefaultFuchsiaResourceDialect,
4241            >,
4242            offset: usize,
4243            _depth: fidl::encoding::Depth,
4244        ) -> fidl::Result<()> {
4245            encoder.debug_check_bounds::<NodeAddChildRequest>(offset);
4246            // Delegate to tuple encoding.
4247            fidl::encoding::Encode::<NodeAddChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4248                (
4249                    <NodeAddArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.args),
4250                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
4251                    <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.node),
4252                ),
4253                encoder, offset, _depth
4254            )
4255        }
4256    }
4257    unsafe impl<
4258        T0: fidl::encoding::Encode<NodeAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
4259        T1: fidl::encoding::Encode<
4260                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>>,
4261                fidl::encoding::DefaultFuchsiaResourceDialect,
4262            >,
4263        T2: fidl::encoding::Encode<
4264                fidl::encoding::Optional<
4265                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>,
4266                >,
4267                fidl::encoding::DefaultFuchsiaResourceDialect,
4268            >,
4269    > fidl::encoding::Encode<NodeAddChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4270        for (T0, T1, T2)
4271    {
4272        #[inline]
4273        unsafe fn encode(
4274            self,
4275            encoder: &mut fidl::encoding::Encoder<
4276                '_,
4277                fidl::encoding::DefaultFuchsiaResourceDialect,
4278            >,
4279            offset: usize,
4280            depth: fidl::encoding::Depth,
4281        ) -> fidl::Result<()> {
4282            encoder.debug_check_bounds::<NodeAddChildRequest>(offset);
4283            // Zero out padding regions. There's no need to apply masks
4284            // because the unmasked parts will be overwritten by fields.
4285            // Write the fields.
4286            self.0.encode(encoder, offset + 0, depth)?;
4287            self.1.encode(encoder, offset + 16, depth)?;
4288            self.2.encode(encoder, offset + 20, depth)?;
4289            Ok(())
4290        }
4291    }
4292
4293    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4294        for NodeAddChildRequest
4295    {
4296        #[inline(always)]
4297        fn new_empty() -> Self {
4298            Self {
4299                args: fidl::new_empty!(NodeAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect),
4300                controller: fidl::new_empty!(
4301                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>>,
4302                    fidl::encoding::DefaultFuchsiaResourceDialect
4303                ),
4304                node: fidl::new_empty!(
4305                    fidl::encoding::Optional<
4306                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>,
4307                    >,
4308                    fidl::encoding::DefaultFuchsiaResourceDialect
4309                ),
4310            }
4311        }
4312
4313        #[inline]
4314        unsafe fn decode(
4315            &mut self,
4316            decoder: &mut fidl::encoding::Decoder<
4317                '_,
4318                fidl::encoding::DefaultFuchsiaResourceDialect,
4319            >,
4320            offset: usize,
4321            _depth: fidl::encoding::Depth,
4322        ) -> fidl::Result<()> {
4323            decoder.debug_check_bounds::<Self>(offset);
4324            // Verify that padding bytes are zero.
4325            fidl::decode!(
4326                NodeAddArgs,
4327                fidl::encoding::DefaultFuchsiaResourceDialect,
4328                &mut self.args,
4329                decoder,
4330                offset + 0,
4331                _depth
4332            )?;
4333            fidl::decode!(
4334                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>>,
4335                fidl::encoding::DefaultFuchsiaResourceDialect,
4336                &mut self.controller,
4337                decoder,
4338                offset + 16,
4339                _depth
4340            )?;
4341            fidl::decode!(
4342                fidl::encoding::Optional<
4343                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>,
4344                >,
4345                fidl::encoding::DefaultFuchsiaResourceDialect,
4346                &mut self.node,
4347                decoder,
4348                offset + 20,
4349                _depth
4350            )?;
4351            Ok(())
4352        }
4353    }
4354
4355    impl fidl::encoding::ResourceTypeMarker for NodeManagerAddNodeRequest {
4356        type Borrowed<'a> = &'a mut Self;
4357        fn take_or_borrow<'a>(
4358            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4359        ) -> Self::Borrowed<'a> {
4360            value
4361        }
4362    }
4363
4364    unsafe impl fidl::encoding::TypeMarker for NodeManagerAddNodeRequest {
4365        type Owned = Self;
4366
4367        #[inline(always)]
4368        fn inline_align(_context: fidl::encoding::Context) -> usize {
4369            8
4370        }
4371
4372        #[inline(always)]
4373        fn inline_size(_context: fidl::encoding::Context) -> usize {
4374            24
4375        }
4376    }
4377
4378    unsafe impl
4379        fidl::encoding::Encode<
4380            NodeManagerAddNodeRequest,
4381            fidl::encoding::DefaultFuchsiaResourceDialect,
4382        > for &mut NodeManagerAddNodeRequest
4383    {
4384        #[inline]
4385        unsafe fn encode(
4386            self,
4387            encoder: &mut fidl::encoding::Encoder<
4388                '_,
4389                fidl::encoding::DefaultFuchsiaResourceDialect,
4390            >,
4391            offset: usize,
4392            _depth: fidl::encoding::Depth,
4393        ) -> fidl::Result<()> {
4394            encoder.debug_check_bounds::<NodeManagerAddNodeRequest>(offset);
4395            // Delegate to tuple encoding.
4396            fidl::encoding::Encode::<NodeManagerAddNodeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4397                (
4398                    <Node2 as fidl::encoding::ValueTypeMarker>::borrow(&self.node),
4399                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
4400                    <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.node_ref),
4401                ),
4402                encoder, offset, _depth
4403            )
4404        }
4405    }
4406    unsafe impl<
4407        T0: fidl::encoding::Encode<Node2, fidl::encoding::DefaultFuchsiaResourceDialect>,
4408        T1: fidl::encoding::Encode<
4409                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>>,
4410                fidl::encoding::DefaultFuchsiaResourceDialect,
4411            >,
4412        T2: fidl::encoding::Encode<
4413                fidl::encoding::Optional<
4414                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>,
4415                >,
4416                fidl::encoding::DefaultFuchsiaResourceDialect,
4417            >,
4418    >
4419        fidl::encoding::Encode<
4420            NodeManagerAddNodeRequest,
4421            fidl::encoding::DefaultFuchsiaResourceDialect,
4422        > for (T0, T1, T2)
4423    {
4424        #[inline]
4425        unsafe fn encode(
4426            self,
4427            encoder: &mut fidl::encoding::Encoder<
4428                '_,
4429                fidl::encoding::DefaultFuchsiaResourceDialect,
4430            >,
4431            offset: usize,
4432            depth: fidl::encoding::Depth,
4433        ) -> fidl::Result<()> {
4434            encoder.debug_check_bounds::<NodeManagerAddNodeRequest>(offset);
4435            // Zero out padding regions. There's no need to apply masks
4436            // because the unmasked parts will be overwritten by fields.
4437            // Write the fields.
4438            self.0.encode(encoder, offset + 0, depth)?;
4439            self.1.encode(encoder, offset + 16, depth)?;
4440            self.2.encode(encoder, offset + 20, depth)?;
4441            Ok(())
4442        }
4443    }
4444
4445    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4446        for NodeManagerAddNodeRequest
4447    {
4448        #[inline(always)]
4449        fn new_empty() -> Self {
4450            Self {
4451                node: fidl::new_empty!(Node2, fidl::encoding::DefaultFuchsiaResourceDialect),
4452                controller: fidl::new_empty!(
4453                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>>,
4454                    fidl::encoding::DefaultFuchsiaResourceDialect
4455                ),
4456                node_ref: fidl::new_empty!(
4457                    fidl::encoding::Optional<
4458                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>,
4459                    >,
4460                    fidl::encoding::DefaultFuchsiaResourceDialect
4461                ),
4462            }
4463        }
4464
4465        #[inline]
4466        unsafe fn decode(
4467            &mut self,
4468            decoder: &mut fidl::encoding::Decoder<
4469                '_,
4470                fidl::encoding::DefaultFuchsiaResourceDialect,
4471            >,
4472            offset: usize,
4473            _depth: fidl::encoding::Depth,
4474        ) -> fidl::Result<()> {
4475            decoder.debug_check_bounds::<Self>(offset);
4476            // Verify that padding bytes are zero.
4477            fidl::decode!(
4478                Node2,
4479                fidl::encoding::DefaultFuchsiaResourceDialect,
4480                &mut self.node,
4481                decoder,
4482                offset + 0,
4483                _depth
4484            )?;
4485            fidl::decode!(
4486                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeControllerMarker>>,
4487                fidl::encoding::DefaultFuchsiaResourceDialect,
4488                &mut self.controller,
4489                decoder,
4490                offset + 16,
4491                _depth
4492            )?;
4493            fidl::decode!(
4494                fidl::encoding::Optional<
4495                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NodeMarker>>,
4496                >,
4497                fidl::encoding::DefaultFuchsiaResourceDialect,
4498                &mut self.node_ref,
4499                decoder,
4500                offset + 20,
4501                _depth
4502            )?;
4503            Ok(())
4504        }
4505    }
4506
4507    impl fidl::encoding::ResourceTypeMarker for NodeProvideResourceRequest {
4508        type Borrowed<'a> = &'a mut Self;
4509        fn take_or_borrow<'a>(
4510            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4511        ) -> Self::Borrowed<'a> {
4512            value
4513        }
4514    }
4515
4516    unsafe impl fidl::encoding::TypeMarker for NodeProvideResourceRequest {
4517        type Owned = Self;
4518
4519        #[inline(always)]
4520        fn inline_align(_context: fidl::encoding::Context) -> usize {
4521            8
4522        }
4523
4524        #[inline(always)]
4525        fn inline_size(_context: fidl::encoding::Context) -> usize {
4526            24
4527        }
4528    }
4529
4530    unsafe impl
4531        fidl::encoding::Encode<
4532            NodeProvideResourceRequest,
4533            fidl::encoding::DefaultFuchsiaResourceDialect,
4534        > for &mut NodeProvideResourceRequest
4535    {
4536        #[inline]
4537        unsafe fn encode(
4538            self,
4539            encoder: &mut fidl::encoding::Encoder<
4540                '_,
4541                fidl::encoding::DefaultFuchsiaResourceDialect,
4542            >,
4543            offset: usize,
4544            _depth: fidl::encoding::Depth,
4545        ) -> fidl::Result<()> {
4546            encoder.debug_check_bounds::<NodeProvideResourceRequest>(offset);
4547            // Delegate to tuple encoding.
4548            fidl::encoding::Encode::<NodeProvideResourceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4549                (
4550                    <ResourceArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.resource),
4551                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ResourceControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
4552                ),
4553                encoder, offset, _depth
4554            )
4555        }
4556    }
4557    unsafe impl<
4558        T0: fidl::encoding::Encode<ResourceArgs, fidl::encoding::DefaultFuchsiaResourceDialect>,
4559        T1: fidl::encoding::Encode<
4560                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ResourceControllerMarker>>,
4561                fidl::encoding::DefaultFuchsiaResourceDialect,
4562            >,
4563    >
4564        fidl::encoding::Encode<
4565            NodeProvideResourceRequest,
4566            fidl::encoding::DefaultFuchsiaResourceDialect,
4567        > for (T0, T1)
4568    {
4569        #[inline]
4570        unsafe fn encode(
4571            self,
4572            encoder: &mut fidl::encoding::Encoder<
4573                '_,
4574                fidl::encoding::DefaultFuchsiaResourceDialect,
4575            >,
4576            offset: usize,
4577            depth: fidl::encoding::Depth,
4578        ) -> fidl::Result<()> {
4579            encoder.debug_check_bounds::<NodeProvideResourceRequest>(offset);
4580            // Zero out padding regions. There's no need to apply masks
4581            // because the unmasked parts will be overwritten by fields.
4582            unsafe {
4583                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4584                (ptr as *mut u64).write_unaligned(0);
4585            }
4586            // Write the fields.
4587            self.0.encode(encoder, offset + 0, depth)?;
4588            self.1.encode(encoder, offset + 16, depth)?;
4589            Ok(())
4590        }
4591    }
4592
4593    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4594        for NodeProvideResourceRequest
4595    {
4596        #[inline(always)]
4597        fn new_empty() -> Self {
4598            Self {
4599                resource: fidl::new_empty!(
4600                    ResourceArgs,
4601                    fidl::encoding::DefaultFuchsiaResourceDialect
4602                ),
4603                controller: fidl::new_empty!(
4604                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ResourceControllerMarker>>,
4605                    fidl::encoding::DefaultFuchsiaResourceDialect
4606                ),
4607            }
4608        }
4609
4610        #[inline]
4611        unsafe fn decode(
4612            &mut self,
4613            decoder: &mut fidl::encoding::Decoder<
4614                '_,
4615                fidl::encoding::DefaultFuchsiaResourceDialect,
4616            >,
4617            offset: usize,
4618            _depth: fidl::encoding::Depth,
4619        ) -> fidl::Result<()> {
4620            decoder.debug_check_bounds::<Self>(offset);
4621            // Verify that padding bytes are zero.
4622            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4623            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4624            let mask = 0xffffffff00000000u64;
4625            let maskedval = padval & mask;
4626            if maskedval != 0 {
4627                return Err(fidl::Error::NonZeroPadding {
4628                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4629                });
4630            }
4631            fidl::decode!(
4632                ResourceArgs,
4633                fidl::encoding::DefaultFuchsiaResourceDialect,
4634                &mut self.resource,
4635                decoder,
4636                offset + 0,
4637                _depth
4638            )?;
4639            fidl::decode!(
4640                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ResourceControllerMarker>>,
4641                fidl::encoding::DefaultFuchsiaResourceDialect,
4642                &mut self.controller,
4643                decoder,
4644                offset + 16,
4645                _depth
4646            )?;
4647            Ok(())
4648        }
4649    }
4650
4651    impl DevfsAddArgs {
4652        #[inline(always)]
4653        fn max_ordinal_present(&self) -> u64 {
4654            if let Some(_) = self.controller_connector {
4655                return 5;
4656            }
4657            if let Some(_) = self.connector_supports {
4658                return 4;
4659            }
4660            if let Some(_) = self.inspect {
4661                return 3;
4662            }
4663            if let Some(_) = self.class_name {
4664                return 2;
4665            }
4666            if let Some(_) = self.connector {
4667                return 1;
4668            }
4669            0
4670        }
4671    }
4672
4673    impl fidl::encoding::ResourceTypeMarker for DevfsAddArgs {
4674        type Borrowed<'a> = &'a mut Self;
4675        fn take_or_borrow<'a>(
4676            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4677        ) -> Self::Borrowed<'a> {
4678            value
4679        }
4680    }
4681
4682    unsafe impl fidl::encoding::TypeMarker for DevfsAddArgs {
4683        type Owned = Self;
4684
4685        #[inline(always)]
4686        fn inline_align(_context: fidl::encoding::Context) -> usize {
4687            8
4688        }
4689
4690        #[inline(always)]
4691        fn inline_size(_context: fidl::encoding::Context) -> usize {
4692            16
4693        }
4694    }
4695
4696    unsafe impl fidl::encoding::Encode<DevfsAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
4697        for &mut DevfsAddArgs
4698    {
4699        unsafe fn encode(
4700            self,
4701            encoder: &mut fidl::encoding::Encoder<
4702                '_,
4703                fidl::encoding::DefaultFuchsiaResourceDialect,
4704            >,
4705            offset: usize,
4706            mut depth: fidl::encoding::Depth,
4707        ) -> fidl::Result<()> {
4708            encoder.debug_check_bounds::<DevfsAddArgs>(offset);
4709            // Vector header
4710            let max_ordinal: u64 = self.max_ordinal_present();
4711            encoder.write_num(max_ordinal, offset);
4712            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4713            // Calling encoder.out_of_line_offset(0) is not allowed.
4714            if max_ordinal == 0 {
4715                return Ok(());
4716            }
4717            depth.increment()?;
4718            let envelope_size = 8;
4719            let bytes_len = max_ordinal as usize * envelope_size;
4720            #[allow(unused_variables)]
4721            let offset = encoder.out_of_line_offset(bytes_len);
4722            let mut _prev_end_offset: usize = 0;
4723            if 1 > max_ordinal {
4724                return Ok(());
4725            }
4726
4727            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4728            // are envelope_size bytes.
4729            let cur_offset: usize = (1 - 1) * envelope_size;
4730
4731            // Zero reserved fields.
4732            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4733
4734            // Safety:
4735            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4736            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4737            //   envelope_size bytes, there is always sufficient room.
4738            fidl::encoding::encode_in_envelope_optional::<
4739                fidl::encoding::Endpoint<
4740                    fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
4741                >,
4742                fidl::encoding::DefaultFuchsiaResourceDialect,
4743            >(
4744                self.connector.as_mut().map(
4745                    <fidl::encoding::Endpoint<
4746                        fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
4747                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4748                ),
4749                encoder,
4750                offset + cur_offset,
4751                depth,
4752            )?;
4753
4754            _prev_end_offset = cur_offset + envelope_size;
4755            if 2 > max_ordinal {
4756                return Ok(());
4757            }
4758
4759            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4760            // are envelope_size bytes.
4761            let cur_offset: usize = (2 - 1) * envelope_size;
4762
4763            // Zero reserved fields.
4764            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4765
4766            // Safety:
4767            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4768            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4769            //   envelope_size bytes, there is always sufficient room.
4770            fidl::encoding::encode_in_envelope_optional::<
4771                fidl::encoding::BoundedString<255>,
4772                fidl::encoding::DefaultFuchsiaResourceDialect,
4773            >(
4774                self.class_name.as_ref().map(
4775                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
4776                ),
4777                encoder,
4778                offset + cur_offset,
4779                depth,
4780            )?;
4781
4782            _prev_end_offset = cur_offset + envelope_size;
4783            if 3 > max_ordinal {
4784                return Ok(());
4785            }
4786
4787            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4788            // are envelope_size bytes.
4789            let cur_offset: usize = (3 - 1) * envelope_size;
4790
4791            // Zero reserved fields.
4792            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4793
4794            // Safety:
4795            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4796            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4797            //   envelope_size bytes, there is always sufficient room.
4798            fidl::encoding::encode_in_envelope_optional::<
4799                fidl::encoding::HandleType<
4800                    fidl::Vmo,
4801                    { fidl::ObjectType::VMO.into_raw() },
4802                    2147483648,
4803                >,
4804                fidl::encoding::DefaultFuchsiaResourceDialect,
4805            >(
4806                self.inspect.as_mut().map(
4807                    <fidl::encoding::HandleType<
4808                        fidl::Vmo,
4809                        { fidl::ObjectType::VMO.into_raw() },
4810                        2147483648,
4811                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4812                ),
4813                encoder,
4814                offset + cur_offset,
4815                depth,
4816            )?;
4817
4818            _prev_end_offset = cur_offset + envelope_size;
4819            if 4 > max_ordinal {
4820                return Ok(());
4821            }
4822
4823            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4824            // are envelope_size bytes.
4825            let cur_offset: usize = (4 - 1) * envelope_size;
4826
4827            // Zero reserved fields.
4828            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4829
4830            // Safety:
4831            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4832            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4833            //   envelope_size bytes, there is always sufficient room.
4834            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_device_fs::ConnectionType, fidl::encoding::DefaultFuchsiaResourceDialect>(
4835            self.connector_supports.as_ref().map(<fidl_fuchsia_device_fs::ConnectionType as fidl::encoding::ValueTypeMarker>::borrow),
4836            encoder, offset + cur_offset, depth
4837        )?;
4838
4839            _prev_end_offset = cur_offset + envelope_size;
4840            if 5 > max_ordinal {
4841                return Ok(());
4842            }
4843
4844            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4845            // are envelope_size bytes.
4846            let cur_offset: usize = (5 - 1) * envelope_size;
4847
4848            // Zero reserved fields.
4849            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4850
4851            // Safety:
4852            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4853            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4854            //   envelope_size bytes, there is always sufficient room.
4855            fidl::encoding::encode_in_envelope_optional::<
4856                fidl::encoding::Endpoint<
4857                    fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
4858                >,
4859                fidl::encoding::DefaultFuchsiaResourceDialect,
4860            >(
4861                self.controller_connector.as_mut().map(
4862                    <fidl::encoding::Endpoint<
4863                        fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
4864                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4865                ),
4866                encoder,
4867                offset + cur_offset,
4868                depth,
4869            )?;
4870
4871            _prev_end_offset = cur_offset + envelope_size;
4872
4873            Ok(())
4874        }
4875    }
4876
4877    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DevfsAddArgs {
4878        #[inline(always)]
4879        fn new_empty() -> Self {
4880            Self::default()
4881        }
4882
4883        unsafe fn decode(
4884            &mut self,
4885            decoder: &mut fidl::encoding::Decoder<
4886                '_,
4887                fidl::encoding::DefaultFuchsiaResourceDialect,
4888            >,
4889            offset: usize,
4890            mut depth: fidl::encoding::Depth,
4891        ) -> fidl::Result<()> {
4892            decoder.debug_check_bounds::<Self>(offset);
4893            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4894                None => return Err(fidl::Error::NotNullable),
4895                Some(len) => len,
4896            };
4897            // Calling decoder.out_of_line_offset(0) is not allowed.
4898            if len == 0 {
4899                return Ok(());
4900            };
4901            depth.increment()?;
4902            let envelope_size = 8;
4903            let bytes_len = len * envelope_size;
4904            let offset = decoder.out_of_line_offset(bytes_len)?;
4905            // Decode the envelope for each type.
4906            let mut _next_ordinal_to_read = 0;
4907            let mut next_offset = offset;
4908            let end_offset = offset + bytes_len;
4909            _next_ordinal_to_read += 1;
4910            if next_offset >= end_offset {
4911                return Ok(());
4912            }
4913
4914            // Decode unknown envelopes for gaps in ordinals.
4915            while _next_ordinal_to_read < 1 {
4916                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4917                _next_ordinal_to_read += 1;
4918                next_offset += envelope_size;
4919            }
4920
4921            let next_out_of_line = decoder.next_out_of_line();
4922            let handles_before = decoder.remaining_handles();
4923            if let Some((inlined, num_bytes, num_handles)) =
4924                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4925            {
4926                let member_inline_size = <fidl::encoding::Endpoint<
4927                    fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
4928                > as fidl::encoding::TypeMarker>::inline_size(
4929                    decoder.context
4930                );
4931                if inlined != (member_inline_size <= 4) {
4932                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4933                }
4934                let inner_offset;
4935                let mut inner_depth = depth.clone();
4936                if inlined {
4937                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4938                    inner_offset = next_offset;
4939                } else {
4940                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4941                    inner_depth.increment()?;
4942                }
4943                let val_ref = self.connector.get_or_insert_with(|| {
4944                    fidl::new_empty!(
4945                        fidl::encoding::Endpoint<
4946                            fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
4947                        >,
4948                        fidl::encoding::DefaultFuchsiaResourceDialect
4949                    )
4950                });
4951                fidl::decode!(
4952                    fidl::encoding::Endpoint<
4953                        fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
4954                    >,
4955                    fidl::encoding::DefaultFuchsiaResourceDialect,
4956                    val_ref,
4957                    decoder,
4958                    inner_offset,
4959                    inner_depth
4960                )?;
4961                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4962                {
4963                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4964                }
4965                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4966                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4967                }
4968            }
4969
4970            next_offset += envelope_size;
4971            _next_ordinal_to_read += 1;
4972            if next_offset >= end_offset {
4973                return Ok(());
4974            }
4975
4976            // Decode unknown envelopes for gaps in ordinals.
4977            while _next_ordinal_to_read < 2 {
4978                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4979                _next_ordinal_to_read += 1;
4980                next_offset += envelope_size;
4981            }
4982
4983            let next_out_of_line = decoder.next_out_of_line();
4984            let handles_before = decoder.remaining_handles();
4985            if let Some((inlined, num_bytes, num_handles)) =
4986                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4987            {
4988                let member_inline_size =
4989                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
4990                        decoder.context,
4991                    );
4992                if inlined != (member_inline_size <= 4) {
4993                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4994                }
4995                let inner_offset;
4996                let mut inner_depth = depth.clone();
4997                if inlined {
4998                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4999                    inner_offset = next_offset;
5000                } else {
5001                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5002                    inner_depth.increment()?;
5003                }
5004                let val_ref = self.class_name.get_or_insert_with(|| {
5005                    fidl::new_empty!(
5006                        fidl::encoding::BoundedString<255>,
5007                        fidl::encoding::DefaultFuchsiaResourceDialect
5008                    )
5009                });
5010                fidl::decode!(
5011                    fidl::encoding::BoundedString<255>,
5012                    fidl::encoding::DefaultFuchsiaResourceDialect,
5013                    val_ref,
5014                    decoder,
5015                    inner_offset,
5016                    inner_depth
5017                )?;
5018                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5019                {
5020                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5021                }
5022                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5023                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5024                }
5025            }
5026
5027            next_offset += envelope_size;
5028            _next_ordinal_to_read += 1;
5029            if next_offset >= end_offset {
5030                return Ok(());
5031            }
5032
5033            // Decode unknown envelopes for gaps in ordinals.
5034            while _next_ordinal_to_read < 3 {
5035                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5036                _next_ordinal_to_read += 1;
5037                next_offset += envelope_size;
5038            }
5039
5040            let next_out_of_line = decoder.next_out_of_line();
5041            let handles_before = decoder.remaining_handles();
5042            if let Some((inlined, num_bytes, num_handles)) =
5043                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5044            {
5045                let member_inline_size = <fidl::encoding::HandleType<
5046                    fidl::Vmo,
5047                    { fidl::ObjectType::VMO.into_raw() },
5048                    2147483648,
5049                > as fidl::encoding::TypeMarker>::inline_size(
5050                    decoder.context
5051                );
5052                if inlined != (member_inline_size <= 4) {
5053                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5054                }
5055                let inner_offset;
5056                let mut inner_depth = depth.clone();
5057                if inlined {
5058                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5059                    inner_offset = next_offset;
5060                } else {
5061                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5062                    inner_depth.increment()?;
5063                }
5064                let val_ref =
5065                self.inspect.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
5066                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5067                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5068                {
5069                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5070                }
5071                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5072                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5073                }
5074            }
5075
5076            next_offset += envelope_size;
5077            _next_ordinal_to_read += 1;
5078            if next_offset >= end_offset {
5079                return Ok(());
5080            }
5081
5082            // Decode unknown envelopes for gaps in ordinals.
5083            while _next_ordinal_to_read < 4 {
5084                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5085                _next_ordinal_to_read += 1;
5086                next_offset += envelope_size;
5087            }
5088
5089            let next_out_of_line = decoder.next_out_of_line();
5090            let handles_before = decoder.remaining_handles();
5091            if let Some((inlined, num_bytes, num_handles)) =
5092                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5093            {
5094                let member_inline_size = <fidl_fuchsia_device_fs::ConnectionType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5095                if inlined != (member_inline_size <= 4) {
5096                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5097                }
5098                let inner_offset;
5099                let mut inner_depth = depth.clone();
5100                if inlined {
5101                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5102                    inner_offset = next_offset;
5103                } else {
5104                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5105                    inner_depth.increment()?;
5106                }
5107                let val_ref = self.connector_supports.get_or_insert_with(|| {
5108                    fidl::new_empty!(
5109                        fidl_fuchsia_device_fs::ConnectionType,
5110                        fidl::encoding::DefaultFuchsiaResourceDialect
5111                    )
5112                });
5113                fidl::decode!(
5114                    fidl_fuchsia_device_fs::ConnectionType,
5115                    fidl::encoding::DefaultFuchsiaResourceDialect,
5116                    val_ref,
5117                    decoder,
5118                    inner_offset,
5119                    inner_depth
5120                )?;
5121                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5122                {
5123                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5124                }
5125                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5126                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5127                }
5128            }
5129
5130            next_offset += envelope_size;
5131            _next_ordinal_to_read += 1;
5132            if next_offset >= end_offset {
5133                return Ok(());
5134            }
5135
5136            // Decode unknown envelopes for gaps in ordinals.
5137            while _next_ordinal_to_read < 5 {
5138                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5139                _next_ordinal_to_read += 1;
5140                next_offset += envelope_size;
5141            }
5142
5143            let next_out_of_line = decoder.next_out_of_line();
5144            let handles_before = decoder.remaining_handles();
5145            if let Some((inlined, num_bytes, num_handles)) =
5146                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5147            {
5148                let member_inline_size = <fidl::encoding::Endpoint<
5149                    fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
5150                > as fidl::encoding::TypeMarker>::inline_size(
5151                    decoder.context
5152                );
5153                if inlined != (member_inline_size <= 4) {
5154                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5155                }
5156                let inner_offset;
5157                let mut inner_depth = depth.clone();
5158                if inlined {
5159                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5160                    inner_offset = next_offset;
5161                } else {
5162                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5163                    inner_depth.increment()?;
5164                }
5165                let val_ref = self.controller_connector.get_or_insert_with(|| {
5166                    fidl::new_empty!(
5167                        fidl::encoding::Endpoint<
5168                            fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
5169                        >,
5170                        fidl::encoding::DefaultFuchsiaResourceDialect
5171                    )
5172                });
5173                fidl::decode!(
5174                    fidl::encoding::Endpoint<
5175                        fidl::endpoints::ClientEnd<fidl_fuchsia_device_fs::ConnectorMarker>,
5176                    >,
5177                    fidl::encoding::DefaultFuchsiaResourceDialect,
5178                    val_ref,
5179                    decoder,
5180                    inner_offset,
5181                    inner_depth
5182                )?;
5183                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5184                {
5185                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5186                }
5187                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5188                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5189                }
5190            }
5191
5192            next_offset += envelope_size;
5193
5194            // Decode the remaining unknown envelopes.
5195            while next_offset < end_offset {
5196                _next_ordinal_to_read += 1;
5197                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5198                next_offset += envelope_size;
5199            }
5200
5201            Ok(())
5202        }
5203    }
5204
5205    impl DriverStartArgs {
5206        #[inline(always)]
5207        fn max_ordinal_present(&self) -> u64 {
5208            if let Some(_) = self.log_sink {
5209                return 15;
5210            }
5211            if let Some(_) = self.power_element_args {
5212                return 14;
5213            }
5214            if let Some(_) = self.vmar {
5215                return 13;
5216            }
5217            if let Some(_) = self.node_properties_2 {
5218                return 12;
5219            }
5220            if let Some(_) = self.node_token {
5221                return 11;
5222            }
5223            if let Some(_) = self.node_offers {
5224                return 10;
5225            }
5226            if let Some(_) = self.node_name {
5227                return 8;
5228            }
5229            if let Some(_) = self.config {
5230                return 7;
5231            }
5232            if let Some(_) = self.outgoing_dir {
5233                return 6;
5234            }
5235            if let Some(_) = self.incoming {
5236                return 5;
5237            }
5238            if let Some(_) = self.program {
5239                return 4;
5240            }
5241            if let Some(_) = self.url {
5242                return 3;
5243            }
5244            if let Some(_) = self.symbols {
5245                return 2;
5246            }
5247            if let Some(_) = self.node {
5248                return 1;
5249            }
5250            0
5251        }
5252    }
5253
5254    impl fidl::encoding::ResourceTypeMarker for DriverStartArgs {
5255        type Borrowed<'a> = &'a mut Self;
5256        fn take_or_borrow<'a>(
5257            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5258        ) -> Self::Borrowed<'a> {
5259            value
5260        }
5261    }
5262
5263    unsafe impl fidl::encoding::TypeMarker for DriverStartArgs {
5264        type Owned = Self;
5265
5266        #[inline(always)]
5267        fn inline_align(_context: fidl::encoding::Context) -> usize {
5268            8
5269        }
5270
5271        #[inline(always)]
5272        fn inline_size(_context: fidl::encoding::Context) -> usize {
5273            16
5274        }
5275    }
5276
5277    unsafe impl
5278        fidl::encoding::Encode<DriverStartArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
5279        for &mut DriverStartArgs
5280    {
5281        unsafe fn encode(
5282            self,
5283            encoder: &mut fidl::encoding::Encoder<
5284                '_,
5285                fidl::encoding::DefaultFuchsiaResourceDialect,
5286            >,
5287            offset: usize,
5288            mut depth: fidl::encoding::Depth,
5289        ) -> fidl::Result<()> {
5290            encoder.debug_check_bounds::<DriverStartArgs>(offset);
5291            // Vector header
5292            let max_ordinal: u64 = self.max_ordinal_present();
5293            encoder.write_num(max_ordinal, offset);
5294            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5295            // Calling encoder.out_of_line_offset(0) is not allowed.
5296            if max_ordinal == 0 {
5297                return Ok(());
5298            }
5299            depth.increment()?;
5300            let envelope_size = 8;
5301            let bytes_len = max_ordinal as usize * envelope_size;
5302            #[allow(unused_variables)]
5303            let offset = encoder.out_of_line_offset(bytes_len);
5304            let mut _prev_end_offset: usize = 0;
5305            if 1 > max_ordinal {
5306                return Ok(());
5307            }
5308
5309            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5310            // are envelope_size bytes.
5311            let cur_offset: usize = (1 - 1) * envelope_size;
5312
5313            // Zero reserved fields.
5314            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5315
5316            // Safety:
5317            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5318            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5319            //   envelope_size bytes, there is always sufficient room.
5320            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NodeMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5321            self.node.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NodeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5322            encoder, offset + cur_offset, depth
5323        )?;
5324
5325            _prev_end_offset = cur_offset + envelope_size;
5326            if 2 > max_ordinal {
5327                return Ok(());
5328            }
5329
5330            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5331            // are envelope_size bytes.
5332            let cur_offset: usize = (2 - 1) * envelope_size;
5333
5334            // Zero reserved fields.
5335            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5336
5337            // Safety:
5338            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5339            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5340            //   envelope_size bytes, there is always sufficient room.
5341            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5342            self.symbols.as_ref().map(<fidl::encoding::Vector<NodeSymbol, 64> as fidl::encoding::ValueTypeMarker>::borrow),
5343            encoder, offset + cur_offset, depth
5344        )?;
5345
5346            _prev_end_offset = cur_offset + envelope_size;
5347            if 3 > max_ordinal {
5348                return Ok(());
5349            }
5350
5351            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5352            // are envelope_size bytes.
5353            let cur_offset: usize = (3 - 1) * envelope_size;
5354
5355            // Zero reserved fields.
5356            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5357
5358            // Safety:
5359            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5360            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5361            //   envelope_size bytes, there is always sufficient room.
5362            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5363            self.url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
5364            encoder, offset + cur_offset, depth
5365        )?;
5366
5367            _prev_end_offset = cur_offset + envelope_size;
5368            if 4 > max_ordinal {
5369                return Ok(());
5370            }
5371
5372            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5373            // are envelope_size bytes.
5374            let cur_offset: usize = (4 - 1) * envelope_size;
5375
5376            // Zero reserved fields.
5377            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5378
5379            // Safety:
5380            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5381            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5382            //   envelope_size bytes, there is always sufficient room.
5383            fidl::encoding::encode_in_envelope_optional::<
5384                fidl_fuchsia_data::Dictionary,
5385                fidl::encoding::DefaultFuchsiaResourceDialect,
5386            >(
5387                self.program.as_ref().map(
5388                    <fidl_fuchsia_data::Dictionary as fidl::encoding::ValueTypeMarker>::borrow,
5389                ),
5390                encoder,
5391                offset + cur_offset,
5392                depth,
5393            )?;
5394
5395            _prev_end_offset = cur_offset + envelope_size;
5396            if 5 > max_ordinal {
5397                return Ok(());
5398            }
5399
5400            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5401            // are envelope_size bytes.
5402            let cur_offset: usize = (5 - 1) * envelope_size;
5403
5404            // Zero reserved fields.
5405            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5406
5407            // Safety:
5408            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5409            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5410            //   envelope_size bytes, there is always sufficient room.
5411            fidl::encoding::encode_in_envelope_optional::<
5412                fidl::encoding::Vector<fidl_fuchsia_component_runner::ComponentNamespaceEntry, 32>,
5413                fidl::encoding::DefaultFuchsiaResourceDialect,
5414            >(
5415                self.incoming.as_mut().map(
5416                    <fidl::encoding::Vector<
5417                        fidl_fuchsia_component_runner::ComponentNamespaceEntry,
5418                        32,
5419                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5420                ),
5421                encoder,
5422                offset + cur_offset,
5423                depth,
5424            )?;
5425
5426            _prev_end_offset = cur_offset + envelope_size;
5427            if 6 > max_ordinal {
5428                return Ok(());
5429            }
5430
5431            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5432            // are envelope_size bytes.
5433            let cur_offset: usize = (6 - 1) * envelope_size;
5434
5435            // Zero reserved fields.
5436            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5437
5438            // Safety:
5439            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5440            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5441            //   envelope_size bytes, there is always sufficient room.
5442            fidl::encoding::encode_in_envelope_optional::<
5443                fidl::encoding::Endpoint<
5444                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5445                >,
5446                fidl::encoding::DefaultFuchsiaResourceDialect,
5447            >(
5448                self.outgoing_dir.as_mut().map(
5449                    <fidl::encoding::Endpoint<
5450                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
5451                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5452                ),
5453                encoder,
5454                offset + cur_offset,
5455                depth,
5456            )?;
5457
5458            _prev_end_offset = cur_offset + envelope_size;
5459            if 7 > max_ordinal {
5460                return Ok(());
5461            }
5462
5463            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5464            // are envelope_size bytes.
5465            let cur_offset: usize = (7 - 1) * envelope_size;
5466
5467            // Zero reserved fields.
5468            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5469
5470            // Safety:
5471            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5472            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5473            //   envelope_size bytes, there is always sufficient room.
5474            fidl::encoding::encode_in_envelope_optional::<
5475                fidl::encoding::HandleType<
5476                    fidl::Vmo,
5477                    { fidl::ObjectType::VMO.into_raw() },
5478                    2147483648,
5479                >,
5480                fidl::encoding::DefaultFuchsiaResourceDialect,
5481            >(
5482                self.config.as_mut().map(
5483                    <fidl::encoding::HandleType<
5484                        fidl::Vmo,
5485                        { fidl::ObjectType::VMO.into_raw() },
5486                        2147483648,
5487                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5488                ),
5489                encoder,
5490                offset + cur_offset,
5491                depth,
5492            )?;
5493
5494            _prev_end_offset = cur_offset + envelope_size;
5495            if 8 > max_ordinal {
5496                return Ok(());
5497            }
5498
5499            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5500            // are envelope_size bytes.
5501            let cur_offset: usize = (8 - 1) * envelope_size;
5502
5503            // Zero reserved fields.
5504            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5505
5506            // Safety:
5507            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5508            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5509            //   envelope_size bytes, there is always sufficient room.
5510            fidl::encoding::encode_in_envelope_optional::<
5511                fidl::encoding::UnboundedString,
5512                fidl::encoding::DefaultFuchsiaResourceDialect,
5513            >(
5514                self.node_name.as_ref().map(
5515                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
5516                ),
5517                encoder,
5518                offset + cur_offset,
5519                depth,
5520            )?;
5521
5522            _prev_end_offset = cur_offset + envelope_size;
5523            if 10 > max_ordinal {
5524                return Ok(());
5525            }
5526
5527            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5528            // are envelope_size bytes.
5529            let cur_offset: usize = (10 - 1) * envelope_size;
5530
5531            // Zero reserved fields.
5532            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5533
5534            // Safety:
5535            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5536            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5537            //   envelope_size bytes, there is always sufficient room.
5538            fidl::encoding::encode_in_envelope_optional::<
5539                fidl::encoding::Vector<Offer, 128>,
5540                fidl::encoding::DefaultFuchsiaResourceDialect,
5541            >(
5542                self.node_offers.as_ref().map(
5543                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::ValueTypeMarker>::borrow,
5544                ),
5545                encoder,
5546                offset + cur_offset,
5547                depth,
5548            )?;
5549
5550            _prev_end_offset = cur_offset + envelope_size;
5551            if 11 > max_ordinal {
5552                return Ok(());
5553            }
5554
5555            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5556            // are envelope_size bytes.
5557            let cur_offset: usize = (11 - 1) * envelope_size;
5558
5559            // Zero reserved fields.
5560            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5561
5562            // Safety:
5563            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5564            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5565            //   envelope_size bytes, there is always sufficient room.
5566            fidl::encoding::encode_in_envelope_optional::<
5567                fidl::encoding::HandleType<
5568                    fidl::Event,
5569                    { fidl::ObjectType::EVENT.into_raw() },
5570                    2147483648,
5571                >,
5572                fidl::encoding::DefaultFuchsiaResourceDialect,
5573            >(
5574                self.node_token.as_mut().map(
5575                    <fidl::encoding::HandleType<
5576                        fidl::Event,
5577                        { fidl::ObjectType::EVENT.into_raw() },
5578                        2147483648,
5579                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5580                ),
5581                encoder,
5582                offset + cur_offset,
5583                depth,
5584            )?;
5585
5586            _prev_end_offset = cur_offset + envelope_size;
5587            if 12 > max_ordinal {
5588                return Ok(());
5589            }
5590
5591            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5592            // are envelope_size bytes.
5593            let cur_offset: usize = (12 - 1) * envelope_size;
5594
5595            // Zero reserved fields.
5596            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5597
5598            // Safety:
5599            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5600            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5601            //   envelope_size bytes, there is always sufficient room.
5602            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<NodePropertyEntry2>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5603            self.node_properties_2.as_ref().map(<fidl::encoding::UnboundedVector<NodePropertyEntry2> as fidl::encoding::ValueTypeMarker>::borrow),
5604            encoder, offset + cur_offset, depth
5605        )?;
5606
5607            _prev_end_offset = cur_offset + envelope_size;
5608            if 13 > max_ordinal {
5609                return Ok(());
5610            }
5611
5612            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5613            // are envelope_size bytes.
5614            let cur_offset: usize = (13 - 1) * envelope_size;
5615
5616            // Zero reserved fields.
5617            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5618
5619            // Safety:
5620            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5621            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5622            //   envelope_size bytes, there is always sufficient room.
5623            fidl::encoding::encode_in_envelope_optional::<
5624                fidl::encoding::HandleType<
5625                    fidl::Vmar,
5626                    { fidl::ObjectType::VMAR.into_raw() },
5627                    2147483648,
5628                >,
5629                fidl::encoding::DefaultFuchsiaResourceDialect,
5630            >(
5631                self.vmar.as_mut().map(
5632                    <fidl::encoding::HandleType<
5633                        fidl::Vmar,
5634                        { fidl::ObjectType::VMAR.into_raw() },
5635                        2147483648,
5636                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5637                ),
5638                encoder,
5639                offset + cur_offset,
5640                depth,
5641            )?;
5642
5643            _prev_end_offset = cur_offset + envelope_size;
5644            if 14 > max_ordinal {
5645                return Ok(());
5646            }
5647
5648            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5649            // are envelope_size bytes.
5650            let cur_offset: usize = (14 - 1) * envelope_size;
5651
5652            // Zero reserved fields.
5653            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5654
5655            // Safety:
5656            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5657            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5658            //   envelope_size bytes, there is always sufficient room.
5659            fidl::encoding::encode_in_envelope_optional::<
5660                PowerElementArgs,
5661                fidl::encoding::DefaultFuchsiaResourceDialect,
5662            >(
5663                self.power_element_args
5664                    .as_mut()
5665                    .map(<PowerElementArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5666                encoder,
5667                offset + cur_offset,
5668                depth,
5669            )?;
5670
5671            _prev_end_offset = cur_offset + envelope_size;
5672            if 15 > max_ordinal {
5673                return Ok(());
5674            }
5675
5676            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5677            // are envelope_size bytes.
5678            let cur_offset: usize = (15 - 1) * envelope_size;
5679
5680            // Zero reserved fields.
5681            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5682
5683            // Safety:
5684            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5685            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5686            //   envelope_size bytes, there is always sufficient room.
5687            fidl::encoding::encode_in_envelope_optional::<
5688                fidl::encoding::Endpoint<
5689                    fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
5690                >,
5691                fidl::encoding::DefaultFuchsiaResourceDialect,
5692            >(
5693                self.log_sink.as_mut().map(
5694                    <fidl::encoding::Endpoint<
5695                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
5696                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5697                ),
5698                encoder,
5699                offset + cur_offset,
5700                depth,
5701            )?;
5702
5703            _prev_end_offset = cur_offset + envelope_size;
5704
5705            Ok(())
5706        }
5707    }
5708
5709    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5710        for DriverStartArgs
5711    {
5712        #[inline(always)]
5713        fn new_empty() -> Self {
5714            Self::default()
5715        }
5716
5717        unsafe fn decode(
5718            &mut self,
5719            decoder: &mut fidl::encoding::Decoder<
5720                '_,
5721                fidl::encoding::DefaultFuchsiaResourceDialect,
5722            >,
5723            offset: usize,
5724            mut depth: fidl::encoding::Depth,
5725        ) -> fidl::Result<()> {
5726            decoder.debug_check_bounds::<Self>(offset);
5727            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5728                None => return Err(fidl::Error::NotNullable),
5729                Some(len) => len,
5730            };
5731            // Calling decoder.out_of_line_offset(0) is not allowed.
5732            if len == 0 {
5733                return Ok(());
5734            };
5735            depth.increment()?;
5736            let envelope_size = 8;
5737            let bytes_len = len * envelope_size;
5738            let offset = decoder.out_of_line_offset(bytes_len)?;
5739            // Decode the envelope for each type.
5740            let mut _next_ordinal_to_read = 0;
5741            let mut next_offset = offset;
5742            let end_offset = offset + bytes_len;
5743            _next_ordinal_to_read += 1;
5744            if next_offset >= end_offset {
5745                return Ok(());
5746            }
5747
5748            // Decode unknown envelopes for gaps in ordinals.
5749            while _next_ordinal_to_read < 1 {
5750                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5751                _next_ordinal_to_read += 1;
5752                next_offset += envelope_size;
5753            }
5754
5755            let next_out_of_line = decoder.next_out_of_line();
5756            let handles_before = decoder.remaining_handles();
5757            if let Some((inlined, num_bytes, num_handles)) =
5758                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5759            {
5760                let member_inline_size = <fidl::encoding::Endpoint<
5761                    fidl::endpoints::ClientEnd<NodeMarker>,
5762                > as fidl::encoding::TypeMarker>::inline_size(
5763                    decoder.context
5764                );
5765                if inlined != (member_inline_size <= 4) {
5766                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5767                }
5768                let inner_offset;
5769                let mut inner_depth = depth.clone();
5770                if inlined {
5771                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5772                    inner_offset = next_offset;
5773                } else {
5774                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5775                    inner_depth.increment()?;
5776                }
5777                let val_ref = self.node.get_or_insert_with(|| {
5778                    fidl::new_empty!(
5779                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NodeMarker>>,
5780                        fidl::encoding::DefaultFuchsiaResourceDialect
5781                    )
5782                });
5783                fidl::decode!(
5784                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NodeMarker>>,
5785                    fidl::encoding::DefaultFuchsiaResourceDialect,
5786                    val_ref,
5787                    decoder,
5788                    inner_offset,
5789                    inner_depth
5790                )?;
5791                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5792                {
5793                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5794                }
5795                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5796                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5797                }
5798            }
5799
5800            next_offset += envelope_size;
5801            _next_ordinal_to_read += 1;
5802            if next_offset >= end_offset {
5803                return Ok(());
5804            }
5805
5806            // Decode unknown envelopes for gaps in ordinals.
5807            while _next_ordinal_to_read < 2 {
5808                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5809                _next_ordinal_to_read += 1;
5810                next_offset += envelope_size;
5811            }
5812
5813            let next_out_of_line = decoder.next_out_of_line();
5814            let handles_before = decoder.remaining_handles();
5815            if let Some((inlined, num_bytes, num_handles)) =
5816                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5817            {
5818                let member_inline_size = <fidl::encoding::Vector<NodeSymbol, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5819                if inlined != (member_inline_size <= 4) {
5820                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5821                }
5822                let inner_offset;
5823                let mut inner_depth = depth.clone();
5824                if inlined {
5825                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5826                    inner_offset = next_offset;
5827                } else {
5828                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5829                    inner_depth.increment()?;
5830                }
5831                let val_ref =
5832                self.symbols.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
5833                fidl::decode!(fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5834                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5835                {
5836                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5837                }
5838                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5839                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5840                }
5841            }
5842
5843            next_offset += envelope_size;
5844            _next_ordinal_to_read += 1;
5845            if next_offset >= end_offset {
5846                return Ok(());
5847            }
5848
5849            // Decode unknown envelopes for gaps in ordinals.
5850            while _next_ordinal_to_read < 3 {
5851                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5852                _next_ordinal_to_read += 1;
5853                next_offset += envelope_size;
5854            }
5855
5856            let next_out_of_line = decoder.next_out_of_line();
5857            let handles_before = decoder.remaining_handles();
5858            if let Some((inlined, num_bytes, num_handles)) =
5859                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5860            {
5861                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5862                if inlined != (member_inline_size <= 4) {
5863                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5864                }
5865                let inner_offset;
5866                let mut inner_depth = depth.clone();
5867                if inlined {
5868                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5869                    inner_offset = next_offset;
5870                } else {
5871                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5872                    inner_depth.increment()?;
5873                }
5874                let val_ref = self.url.get_or_insert_with(|| {
5875                    fidl::new_empty!(
5876                        fidl::encoding::BoundedString<4096>,
5877                        fidl::encoding::DefaultFuchsiaResourceDialect
5878                    )
5879                });
5880                fidl::decode!(
5881                    fidl::encoding::BoundedString<4096>,
5882                    fidl::encoding::DefaultFuchsiaResourceDialect,
5883                    val_ref,
5884                    decoder,
5885                    inner_offset,
5886                    inner_depth
5887                )?;
5888                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5889                {
5890                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5891                }
5892                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5893                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5894                }
5895            }
5896
5897            next_offset += envelope_size;
5898            _next_ordinal_to_read += 1;
5899            if next_offset >= end_offset {
5900                return Ok(());
5901            }
5902
5903            // Decode unknown envelopes for gaps in ordinals.
5904            while _next_ordinal_to_read < 4 {
5905                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5906                _next_ordinal_to_read += 1;
5907                next_offset += envelope_size;
5908            }
5909
5910            let next_out_of_line = decoder.next_out_of_line();
5911            let handles_before = decoder.remaining_handles();
5912            if let Some((inlined, num_bytes, num_handles)) =
5913                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5914            {
5915                let member_inline_size =
5916                    <fidl_fuchsia_data::Dictionary as fidl::encoding::TypeMarker>::inline_size(
5917                        decoder.context,
5918                    );
5919                if inlined != (member_inline_size <= 4) {
5920                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5921                }
5922                let inner_offset;
5923                let mut inner_depth = depth.clone();
5924                if inlined {
5925                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5926                    inner_offset = next_offset;
5927                } else {
5928                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5929                    inner_depth.increment()?;
5930                }
5931                let val_ref = self.program.get_or_insert_with(|| {
5932                    fidl::new_empty!(
5933                        fidl_fuchsia_data::Dictionary,
5934                        fidl::encoding::DefaultFuchsiaResourceDialect
5935                    )
5936                });
5937                fidl::decode!(
5938                    fidl_fuchsia_data::Dictionary,
5939                    fidl::encoding::DefaultFuchsiaResourceDialect,
5940                    val_ref,
5941                    decoder,
5942                    inner_offset,
5943                    inner_depth
5944                )?;
5945                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5946                {
5947                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5948                }
5949                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5950                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5951                }
5952            }
5953
5954            next_offset += envelope_size;
5955            _next_ordinal_to_read += 1;
5956            if next_offset >= end_offset {
5957                return Ok(());
5958            }
5959
5960            // Decode unknown envelopes for gaps in ordinals.
5961            while _next_ordinal_to_read < 5 {
5962                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5963                _next_ordinal_to_read += 1;
5964                next_offset += envelope_size;
5965            }
5966
5967            let next_out_of_line = decoder.next_out_of_line();
5968            let handles_before = decoder.remaining_handles();
5969            if let Some((inlined, num_bytes, num_handles)) =
5970                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5971            {
5972                let member_inline_size = <fidl::encoding::Vector<
5973                    fidl_fuchsia_component_runner::ComponentNamespaceEntry,
5974                    32,
5975                > as fidl::encoding::TypeMarker>::inline_size(
5976                    decoder.context
5977                );
5978                if inlined != (member_inline_size <= 4) {
5979                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5980                }
5981                let inner_offset;
5982                let mut inner_depth = depth.clone();
5983                if inlined {
5984                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5985                    inner_offset = next_offset;
5986                } else {
5987                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5988                    inner_depth.increment()?;
5989                }
5990                let val_ref =
5991                self.incoming.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_component_runner::ComponentNamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
5992                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_component_runner::ComponentNamespaceEntry, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
5993                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5994                {
5995                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5996                }
5997                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5998                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5999                }
6000            }
6001
6002            next_offset += envelope_size;
6003            _next_ordinal_to_read += 1;
6004            if next_offset >= end_offset {
6005                return Ok(());
6006            }
6007
6008            // Decode unknown envelopes for gaps in ordinals.
6009            while _next_ordinal_to_read < 6 {
6010                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6011                _next_ordinal_to_read += 1;
6012                next_offset += envelope_size;
6013            }
6014
6015            let next_out_of_line = decoder.next_out_of_line();
6016            let handles_before = decoder.remaining_handles();
6017            if let Some((inlined, num_bytes, num_handles)) =
6018                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6019            {
6020                let member_inline_size = <fidl::encoding::Endpoint<
6021                    fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6022                > as fidl::encoding::TypeMarker>::inline_size(
6023                    decoder.context
6024                );
6025                if inlined != (member_inline_size <= 4) {
6026                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6027                }
6028                let inner_offset;
6029                let mut inner_depth = depth.clone();
6030                if inlined {
6031                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6032                    inner_offset = next_offset;
6033                } else {
6034                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6035                    inner_depth.increment()?;
6036                }
6037                let val_ref = self.outgoing_dir.get_or_insert_with(|| {
6038                    fidl::new_empty!(
6039                        fidl::encoding::Endpoint<
6040                            fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6041                        >,
6042                        fidl::encoding::DefaultFuchsiaResourceDialect
6043                    )
6044                });
6045                fidl::decode!(
6046                    fidl::encoding::Endpoint<
6047                        fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
6048                    >,
6049                    fidl::encoding::DefaultFuchsiaResourceDialect,
6050                    val_ref,
6051                    decoder,
6052                    inner_offset,
6053                    inner_depth
6054                )?;
6055                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6056                {
6057                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6058                }
6059                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6060                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6061                }
6062            }
6063
6064            next_offset += envelope_size;
6065            _next_ordinal_to_read += 1;
6066            if next_offset >= end_offset {
6067                return Ok(());
6068            }
6069
6070            // Decode unknown envelopes for gaps in ordinals.
6071            while _next_ordinal_to_read < 7 {
6072                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6073                _next_ordinal_to_read += 1;
6074                next_offset += envelope_size;
6075            }
6076
6077            let next_out_of_line = decoder.next_out_of_line();
6078            let handles_before = decoder.remaining_handles();
6079            if let Some((inlined, num_bytes, num_handles)) =
6080                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6081            {
6082                let member_inline_size = <fidl::encoding::HandleType<
6083                    fidl::Vmo,
6084                    { fidl::ObjectType::VMO.into_raw() },
6085                    2147483648,
6086                > as fidl::encoding::TypeMarker>::inline_size(
6087                    decoder.context
6088                );
6089                if inlined != (member_inline_size <= 4) {
6090                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6091                }
6092                let inner_offset;
6093                let mut inner_depth = depth.clone();
6094                if inlined {
6095                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6096                    inner_offset = next_offset;
6097                } else {
6098                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6099                    inner_depth.increment()?;
6100                }
6101                let val_ref =
6102                self.config.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6103                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6104                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6105                {
6106                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6107                }
6108                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6109                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6110                }
6111            }
6112
6113            next_offset += envelope_size;
6114            _next_ordinal_to_read += 1;
6115            if next_offset >= end_offset {
6116                return Ok(());
6117            }
6118
6119            // Decode unknown envelopes for gaps in ordinals.
6120            while _next_ordinal_to_read < 8 {
6121                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6122                _next_ordinal_to_read += 1;
6123                next_offset += envelope_size;
6124            }
6125
6126            let next_out_of_line = decoder.next_out_of_line();
6127            let handles_before = decoder.remaining_handles();
6128            if let Some((inlined, num_bytes, num_handles)) =
6129                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6130            {
6131                let member_inline_size =
6132                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
6133                        decoder.context,
6134                    );
6135                if inlined != (member_inline_size <= 4) {
6136                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6137                }
6138                let inner_offset;
6139                let mut inner_depth = depth.clone();
6140                if inlined {
6141                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6142                    inner_offset = next_offset;
6143                } else {
6144                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6145                    inner_depth.increment()?;
6146                }
6147                let val_ref = self.node_name.get_or_insert_with(|| {
6148                    fidl::new_empty!(
6149                        fidl::encoding::UnboundedString,
6150                        fidl::encoding::DefaultFuchsiaResourceDialect
6151                    )
6152                });
6153                fidl::decode!(
6154                    fidl::encoding::UnboundedString,
6155                    fidl::encoding::DefaultFuchsiaResourceDialect,
6156                    val_ref,
6157                    decoder,
6158                    inner_offset,
6159                    inner_depth
6160                )?;
6161                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6162                {
6163                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6164                }
6165                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6166                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6167                }
6168            }
6169
6170            next_offset += envelope_size;
6171            _next_ordinal_to_read += 1;
6172            if next_offset >= end_offset {
6173                return Ok(());
6174            }
6175
6176            // Decode unknown envelopes for gaps in ordinals.
6177            while _next_ordinal_to_read < 10 {
6178                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6179                _next_ordinal_to_read += 1;
6180                next_offset += envelope_size;
6181            }
6182
6183            let next_out_of_line = decoder.next_out_of_line();
6184            let handles_before = decoder.remaining_handles();
6185            if let Some((inlined, num_bytes, num_handles)) =
6186                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6187            {
6188                let member_inline_size =
6189                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::TypeMarker>::inline_size(
6190                        decoder.context,
6191                    );
6192                if inlined != (member_inline_size <= 4) {
6193                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6194                }
6195                let inner_offset;
6196                let mut inner_depth = depth.clone();
6197                if inlined {
6198                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6199                    inner_offset = next_offset;
6200                } else {
6201                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6202                    inner_depth.increment()?;
6203                }
6204                let val_ref =
6205                self.node_offers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
6206                fidl::decode!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6207                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6208                {
6209                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6210                }
6211                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6212                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6213                }
6214            }
6215
6216            next_offset += envelope_size;
6217            _next_ordinal_to_read += 1;
6218            if next_offset >= end_offset {
6219                return Ok(());
6220            }
6221
6222            // Decode unknown envelopes for gaps in ordinals.
6223            while _next_ordinal_to_read < 11 {
6224                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6225                _next_ordinal_to_read += 1;
6226                next_offset += envelope_size;
6227            }
6228
6229            let next_out_of_line = decoder.next_out_of_line();
6230            let handles_before = decoder.remaining_handles();
6231            if let Some((inlined, num_bytes, num_handles)) =
6232                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6233            {
6234                let member_inline_size = <fidl::encoding::HandleType<
6235                    fidl::Event,
6236                    { fidl::ObjectType::EVENT.into_raw() },
6237                    2147483648,
6238                > as fidl::encoding::TypeMarker>::inline_size(
6239                    decoder.context
6240                );
6241                if inlined != (member_inline_size <= 4) {
6242                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6243                }
6244                let inner_offset;
6245                let mut inner_depth = depth.clone();
6246                if inlined {
6247                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6248                    inner_offset = next_offset;
6249                } else {
6250                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6251                    inner_depth.increment()?;
6252                }
6253                let val_ref =
6254                self.node_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6255                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6256                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6257                {
6258                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6259                }
6260                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6261                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6262                }
6263            }
6264
6265            next_offset += envelope_size;
6266            _next_ordinal_to_read += 1;
6267            if next_offset >= end_offset {
6268                return Ok(());
6269            }
6270
6271            // Decode unknown envelopes for gaps in ordinals.
6272            while _next_ordinal_to_read < 12 {
6273                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6274                _next_ordinal_to_read += 1;
6275                next_offset += envelope_size;
6276            }
6277
6278            let next_out_of_line = decoder.next_out_of_line();
6279            let handles_before = decoder.remaining_handles();
6280            if let Some((inlined, num_bytes, num_handles)) =
6281                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6282            {
6283                let member_inline_size = <fidl::encoding::UnboundedVector<NodePropertyEntry2> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6284                if inlined != (member_inline_size <= 4) {
6285                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6286                }
6287                let inner_offset;
6288                let mut inner_depth = depth.clone();
6289                if inlined {
6290                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6291                    inner_offset = next_offset;
6292                } else {
6293                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6294                    inner_depth.increment()?;
6295                }
6296                let val_ref = self.node_properties_2.get_or_insert_with(|| {
6297                    fidl::new_empty!(
6298                        fidl::encoding::UnboundedVector<NodePropertyEntry2>,
6299                        fidl::encoding::DefaultFuchsiaResourceDialect
6300                    )
6301                });
6302                fidl::decode!(
6303                    fidl::encoding::UnboundedVector<NodePropertyEntry2>,
6304                    fidl::encoding::DefaultFuchsiaResourceDialect,
6305                    val_ref,
6306                    decoder,
6307                    inner_offset,
6308                    inner_depth
6309                )?;
6310                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6311                {
6312                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6313                }
6314                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6315                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6316                }
6317            }
6318
6319            next_offset += envelope_size;
6320            _next_ordinal_to_read += 1;
6321            if next_offset >= end_offset {
6322                return Ok(());
6323            }
6324
6325            // Decode unknown envelopes for gaps in ordinals.
6326            while _next_ordinal_to_read < 13 {
6327                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6328                _next_ordinal_to_read += 1;
6329                next_offset += envelope_size;
6330            }
6331
6332            let next_out_of_line = decoder.next_out_of_line();
6333            let handles_before = decoder.remaining_handles();
6334            if let Some((inlined, num_bytes, num_handles)) =
6335                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6336            {
6337                let member_inline_size = <fidl::encoding::HandleType<
6338                    fidl::Vmar,
6339                    { fidl::ObjectType::VMAR.into_raw() },
6340                    2147483648,
6341                > as fidl::encoding::TypeMarker>::inline_size(
6342                    decoder.context
6343                );
6344                if inlined != (member_inline_size <= 4) {
6345                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6346                }
6347                let inner_offset;
6348                let mut inner_depth = depth.clone();
6349                if inlined {
6350                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6351                    inner_offset = next_offset;
6352                } else {
6353                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6354                    inner_depth.increment()?;
6355                }
6356                let val_ref =
6357                self.vmar.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
6358                fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6359                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6360                {
6361                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6362                }
6363                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6364                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6365                }
6366            }
6367
6368            next_offset += envelope_size;
6369            _next_ordinal_to_read += 1;
6370            if next_offset >= end_offset {
6371                return Ok(());
6372            }
6373
6374            // Decode unknown envelopes for gaps in ordinals.
6375            while _next_ordinal_to_read < 14 {
6376                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6377                _next_ordinal_to_read += 1;
6378                next_offset += envelope_size;
6379            }
6380
6381            let next_out_of_line = decoder.next_out_of_line();
6382            let handles_before = decoder.remaining_handles();
6383            if let Some((inlined, num_bytes, num_handles)) =
6384                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6385            {
6386                let member_inline_size =
6387                    <PowerElementArgs as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6388                if inlined != (member_inline_size <= 4) {
6389                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6390                }
6391                let inner_offset;
6392                let mut inner_depth = depth.clone();
6393                if inlined {
6394                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6395                    inner_offset = next_offset;
6396                } else {
6397                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6398                    inner_depth.increment()?;
6399                }
6400                let val_ref = self.power_element_args.get_or_insert_with(|| {
6401                    fidl::new_empty!(
6402                        PowerElementArgs,
6403                        fidl::encoding::DefaultFuchsiaResourceDialect
6404                    )
6405                });
6406                fidl::decode!(
6407                    PowerElementArgs,
6408                    fidl::encoding::DefaultFuchsiaResourceDialect,
6409                    val_ref,
6410                    decoder,
6411                    inner_offset,
6412                    inner_depth
6413                )?;
6414                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6415                {
6416                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6417                }
6418                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6419                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6420                }
6421            }
6422
6423            next_offset += envelope_size;
6424            _next_ordinal_to_read += 1;
6425            if next_offset >= end_offset {
6426                return Ok(());
6427            }
6428
6429            // Decode unknown envelopes for gaps in ordinals.
6430            while _next_ordinal_to_read < 15 {
6431                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6432                _next_ordinal_to_read += 1;
6433                next_offset += envelope_size;
6434            }
6435
6436            let next_out_of_line = decoder.next_out_of_line();
6437            let handles_before = decoder.remaining_handles();
6438            if let Some((inlined, num_bytes, num_handles)) =
6439                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6440            {
6441                let member_inline_size = <fidl::encoding::Endpoint<
6442                    fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
6443                > as fidl::encoding::TypeMarker>::inline_size(
6444                    decoder.context
6445                );
6446                if inlined != (member_inline_size <= 4) {
6447                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6448                }
6449                let inner_offset;
6450                let mut inner_depth = depth.clone();
6451                if inlined {
6452                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6453                    inner_offset = next_offset;
6454                } else {
6455                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6456                    inner_depth.increment()?;
6457                }
6458                let val_ref = self.log_sink.get_or_insert_with(|| {
6459                    fidl::new_empty!(
6460                        fidl::encoding::Endpoint<
6461                            fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
6462                        >,
6463                        fidl::encoding::DefaultFuchsiaResourceDialect
6464                    )
6465                });
6466                fidl::decode!(
6467                    fidl::encoding::Endpoint<
6468                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
6469                    >,
6470                    fidl::encoding::DefaultFuchsiaResourceDialect,
6471                    val_ref,
6472                    decoder,
6473                    inner_offset,
6474                    inner_depth
6475                )?;
6476                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6477                {
6478                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6479                }
6480                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6481                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6482                }
6483            }
6484
6485            next_offset += envelope_size;
6486
6487            // Decode the remaining unknown envelopes.
6488            while next_offset < end_offset {
6489                _next_ordinal_to_read += 1;
6490                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6491                next_offset += envelope_size;
6492            }
6493
6494            Ok(())
6495        }
6496    }
6497
6498    impl NodeAddArgs {
6499        #[inline(always)]
6500        fn max_ordinal_present(&self) -> u64 {
6501            if let Some(_) = self.driver_host {
6502                return 10;
6503            }
6504            if let Some(_) = self.offers_dictionary {
6505                return 9;
6506            }
6507            if let Some(_) = self.properties2 {
6508                return 8;
6509            }
6510            if let Some(_) = self.bus_info {
6511                return 7;
6512            }
6513            if let Some(_) = self.offers2 {
6514                return 6;
6515            }
6516            if let Some(_) = self.devfs_args {
6517                return 5;
6518            }
6519            if let Some(_) = self.symbols {
6520                return 3;
6521            }
6522            if let Some(_) = self.name {
6523                return 1;
6524            }
6525            0
6526        }
6527    }
6528
6529    impl fidl::encoding::ResourceTypeMarker for NodeAddArgs {
6530        type Borrowed<'a> = &'a mut Self;
6531        fn take_or_borrow<'a>(
6532            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6533        ) -> Self::Borrowed<'a> {
6534            value
6535        }
6536    }
6537
6538    unsafe impl fidl::encoding::TypeMarker for NodeAddArgs {
6539        type Owned = Self;
6540
6541        #[inline(always)]
6542        fn inline_align(_context: fidl::encoding::Context) -> usize {
6543            8
6544        }
6545
6546        #[inline(always)]
6547        fn inline_size(_context: fidl::encoding::Context) -> usize {
6548            16
6549        }
6550    }
6551
6552    unsafe impl fidl::encoding::Encode<NodeAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
6553        for &mut NodeAddArgs
6554    {
6555        unsafe fn encode(
6556            self,
6557            encoder: &mut fidl::encoding::Encoder<
6558                '_,
6559                fidl::encoding::DefaultFuchsiaResourceDialect,
6560            >,
6561            offset: usize,
6562            mut depth: fidl::encoding::Depth,
6563        ) -> fidl::Result<()> {
6564            encoder.debug_check_bounds::<NodeAddArgs>(offset);
6565            // Vector header
6566            let max_ordinal: u64 = self.max_ordinal_present();
6567            encoder.write_num(max_ordinal, offset);
6568            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6569            // Calling encoder.out_of_line_offset(0) is not allowed.
6570            if max_ordinal == 0 {
6571                return Ok(());
6572            }
6573            depth.increment()?;
6574            let envelope_size = 8;
6575            let bytes_len = max_ordinal as usize * envelope_size;
6576            #[allow(unused_variables)]
6577            let offset = encoder.out_of_line_offset(bytes_len);
6578            let mut _prev_end_offset: usize = 0;
6579            if 1 > max_ordinal {
6580                return Ok(());
6581            }
6582
6583            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6584            // are envelope_size bytes.
6585            let cur_offset: usize = (1 - 1) * envelope_size;
6586
6587            // Zero reserved fields.
6588            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6589
6590            // Safety:
6591            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6592            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6593            //   envelope_size bytes, there is always sufficient room.
6594            fidl::encoding::encode_in_envelope_optional::<
6595                fidl::encoding::BoundedString<128>,
6596                fidl::encoding::DefaultFuchsiaResourceDialect,
6597            >(
6598                self.name.as_ref().map(
6599                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
6600                ),
6601                encoder,
6602                offset + cur_offset,
6603                depth,
6604            )?;
6605
6606            _prev_end_offset = cur_offset + envelope_size;
6607            if 3 > max_ordinal {
6608                return Ok(());
6609            }
6610
6611            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6612            // are envelope_size bytes.
6613            let cur_offset: usize = (3 - 1) * envelope_size;
6614
6615            // Zero reserved fields.
6616            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6617
6618            // Safety:
6619            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6620            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6621            //   envelope_size bytes, there is always sufficient room.
6622            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6623            self.symbols.as_ref().map(<fidl::encoding::Vector<NodeSymbol, 64> as fidl::encoding::ValueTypeMarker>::borrow),
6624            encoder, offset + cur_offset, depth
6625        )?;
6626
6627            _prev_end_offset = cur_offset + envelope_size;
6628            if 5 > max_ordinal {
6629                return Ok(());
6630            }
6631
6632            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6633            // are envelope_size bytes.
6634            let cur_offset: usize = (5 - 1) * envelope_size;
6635
6636            // Zero reserved fields.
6637            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6638
6639            // Safety:
6640            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6641            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6642            //   envelope_size bytes, there is always sufficient room.
6643            fidl::encoding::encode_in_envelope_optional::<
6644                DevfsAddArgs,
6645                fidl::encoding::DefaultFuchsiaResourceDialect,
6646            >(
6647                self.devfs_args
6648                    .as_mut()
6649                    .map(<DevfsAddArgs as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6650                encoder,
6651                offset + cur_offset,
6652                depth,
6653            )?;
6654
6655            _prev_end_offset = cur_offset + envelope_size;
6656            if 6 > max_ordinal {
6657                return Ok(());
6658            }
6659
6660            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6661            // are envelope_size bytes.
6662            let cur_offset: usize = (6 - 1) * envelope_size;
6663
6664            // Zero reserved fields.
6665            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6666
6667            // Safety:
6668            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6669            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6670            //   envelope_size bytes, there is always sufficient room.
6671            fidl::encoding::encode_in_envelope_optional::<
6672                fidl::encoding::Vector<Offer, 128>,
6673                fidl::encoding::DefaultFuchsiaResourceDialect,
6674            >(
6675                self.offers2.as_ref().map(
6676                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::ValueTypeMarker>::borrow,
6677                ),
6678                encoder,
6679                offset + cur_offset,
6680                depth,
6681            )?;
6682
6683            _prev_end_offset = cur_offset + envelope_size;
6684            if 7 > max_ordinal {
6685                return Ok(());
6686            }
6687
6688            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6689            // are envelope_size bytes.
6690            let cur_offset: usize = (7 - 1) * envelope_size;
6691
6692            // Zero reserved fields.
6693            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6694
6695            // Safety:
6696            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6697            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6698            //   envelope_size bytes, there is always sufficient room.
6699            fidl::encoding::encode_in_envelope_optional::<
6700                BusInfo,
6701                fidl::encoding::DefaultFuchsiaResourceDialect,
6702            >(
6703                self.bus_info.as_ref().map(<BusInfo as fidl::encoding::ValueTypeMarker>::borrow),
6704                encoder,
6705                offset + cur_offset,
6706                depth,
6707            )?;
6708
6709            _prev_end_offset = cur_offset + envelope_size;
6710            if 8 > max_ordinal {
6711                return Ok(());
6712            }
6713
6714            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6715            // are envelope_size bytes.
6716            let cur_offset: usize = (8 - 1) * envelope_size;
6717
6718            // Zero reserved fields.
6719            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6720
6721            // Safety:
6722            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6723            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6724            //   envelope_size bytes, there is always sufficient room.
6725            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NodeProperty2, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6726            self.properties2.as_ref().map(<fidl::encoding::Vector<NodeProperty2, 64> as fidl::encoding::ValueTypeMarker>::borrow),
6727            encoder, offset + cur_offset, depth
6728        )?;
6729
6730            _prev_end_offset = cur_offset + envelope_size;
6731            if 9 > max_ordinal {
6732                return Ok(());
6733            }
6734
6735            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6736            // are envelope_size bytes.
6737            let cur_offset: usize = (9 - 1) * envelope_size;
6738
6739            // Zero reserved fields.
6740            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6741
6742            // Safety:
6743            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6744            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6745            //   envelope_size bytes, there is always sufficient room.
6746            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_component_sandbox::DictionaryRef, fidl::encoding::DefaultFuchsiaResourceDialect>(
6747            self.offers_dictionary.as_mut().map(<fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
6748            encoder, offset + cur_offset, depth
6749        )?;
6750
6751            _prev_end_offset = cur_offset + envelope_size;
6752            if 10 > max_ordinal {
6753                return Ok(());
6754            }
6755
6756            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6757            // are envelope_size bytes.
6758            let cur_offset: usize = (10 - 1) * envelope_size;
6759
6760            // Zero reserved fields.
6761            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6762
6763            // Safety:
6764            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6765            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6766            //   envelope_size bytes, there is always sufficient room.
6767            fidl::encoding::encode_in_envelope_optional::<
6768                fidl::encoding::BoundedString<128>,
6769                fidl::encoding::DefaultFuchsiaResourceDialect,
6770            >(
6771                self.driver_host.as_ref().map(
6772                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
6773                ),
6774                encoder,
6775                offset + cur_offset,
6776                depth,
6777            )?;
6778
6779            _prev_end_offset = cur_offset + envelope_size;
6780
6781            Ok(())
6782        }
6783    }
6784
6785    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NodeAddArgs {
6786        #[inline(always)]
6787        fn new_empty() -> Self {
6788            Self::default()
6789        }
6790
6791        unsafe fn decode(
6792            &mut self,
6793            decoder: &mut fidl::encoding::Decoder<
6794                '_,
6795                fidl::encoding::DefaultFuchsiaResourceDialect,
6796            >,
6797            offset: usize,
6798            mut depth: fidl::encoding::Depth,
6799        ) -> fidl::Result<()> {
6800            decoder.debug_check_bounds::<Self>(offset);
6801            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6802                None => return Err(fidl::Error::NotNullable),
6803                Some(len) => len,
6804            };
6805            // Calling decoder.out_of_line_offset(0) is not allowed.
6806            if len == 0 {
6807                return Ok(());
6808            };
6809            depth.increment()?;
6810            let envelope_size = 8;
6811            let bytes_len = len * envelope_size;
6812            let offset = decoder.out_of_line_offset(bytes_len)?;
6813            // Decode the envelope for each type.
6814            let mut _next_ordinal_to_read = 0;
6815            let mut next_offset = offset;
6816            let end_offset = offset + bytes_len;
6817            _next_ordinal_to_read += 1;
6818            if next_offset >= end_offset {
6819                return Ok(());
6820            }
6821
6822            // Decode unknown envelopes for gaps in ordinals.
6823            while _next_ordinal_to_read < 1 {
6824                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6825                _next_ordinal_to_read += 1;
6826                next_offset += envelope_size;
6827            }
6828
6829            let next_out_of_line = decoder.next_out_of_line();
6830            let handles_before = decoder.remaining_handles();
6831            if let Some((inlined, num_bytes, num_handles)) =
6832                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6833            {
6834                let member_inline_size =
6835                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
6836                        decoder.context,
6837                    );
6838                if inlined != (member_inline_size <= 4) {
6839                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6840                }
6841                let inner_offset;
6842                let mut inner_depth = depth.clone();
6843                if inlined {
6844                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6845                    inner_offset = next_offset;
6846                } else {
6847                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6848                    inner_depth.increment()?;
6849                }
6850                let val_ref = self.name.get_or_insert_with(|| {
6851                    fidl::new_empty!(
6852                        fidl::encoding::BoundedString<128>,
6853                        fidl::encoding::DefaultFuchsiaResourceDialect
6854                    )
6855                });
6856                fidl::decode!(
6857                    fidl::encoding::BoundedString<128>,
6858                    fidl::encoding::DefaultFuchsiaResourceDialect,
6859                    val_ref,
6860                    decoder,
6861                    inner_offset,
6862                    inner_depth
6863                )?;
6864                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6865                {
6866                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6867                }
6868                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6869                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6870                }
6871            }
6872
6873            next_offset += envelope_size;
6874            _next_ordinal_to_read += 1;
6875            if next_offset >= end_offset {
6876                return Ok(());
6877            }
6878
6879            // Decode unknown envelopes for gaps in ordinals.
6880            while _next_ordinal_to_read < 3 {
6881                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6882                _next_ordinal_to_read += 1;
6883                next_offset += envelope_size;
6884            }
6885
6886            let next_out_of_line = decoder.next_out_of_line();
6887            let handles_before = decoder.remaining_handles();
6888            if let Some((inlined, num_bytes, num_handles)) =
6889                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6890            {
6891                let member_inline_size = <fidl::encoding::Vector<NodeSymbol, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6892                if inlined != (member_inline_size <= 4) {
6893                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6894                }
6895                let inner_offset;
6896                let mut inner_depth = depth.clone();
6897                if inlined {
6898                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6899                    inner_offset = next_offset;
6900                } else {
6901                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6902                    inner_depth.increment()?;
6903                }
6904                let val_ref =
6905                self.symbols.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
6906                fidl::decode!(fidl::encoding::Vector<NodeSymbol, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
6907                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6908                {
6909                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6910                }
6911                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6912                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6913                }
6914            }
6915
6916            next_offset += envelope_size;
6917            _next_ordinal_to_read += 1;
6918            if next_offset >= end_offset {
6919                return Ok(());
6920            }
6921
6922            // Decode unknown envelopes for gaps in ordinals.
6923            while _next_ordinal_to_read < 5 {
6924                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6925                _next_ordinal_to_read += 1;
6926                next_offset += envelope_size;
6927            }
6928
6929            let next_out_of_line = decoder.next_out_of_line();
6930            let handles_before = decoder.remaining_handles();
6931            if let Some((inlined, num_bytes, num_handles)) =
6932                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6933            {
6934                let member_inline_size =
6935                    <DevfsAddArgs as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6936                if inlined != (member_inline_size <= 4) {
6937                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6938                }
6939                let inner_offset;
6940                let mut inner_depth = depth.clone();
6941                if inlined {
6942                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6943                    inner_offset = next_offset;
6944                } else {
6945                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6946                    inner_depth.increment()?;
6947                }
6948                let val_ref = self.devfs_args.get_or_insert_with(|| {
6949                    fidl::new_empty!(DevfsAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect)
6950                });
6951                fidl::decode!(
6952                    DevfsAddArgs,
6953                    fidl::encoding::DefaultFuchsiaResourceDialect,
6954                    val_ref,
6955                    decoder,
6956                    inner_offset,
6957                    inner_depth
6958                )?;
6959                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6960                {
6961                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6962                }
6963                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6964                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6965                }
6966            }
6967
6968            next_offset += envelope_size;
6969            _next_ordinal_to_read += 1;
6970            if next_offset >= end_offset {
6971                return Ok(());
6972            }
6973
6974            // Decode unknown envelopes for gaps in ordinals.
6975            while _next_ordinal_to_read < 6 {
6976                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6977                _next_ordinal_to_read += 1;
6978                next_offset += envelope_size;
6979            }
6980
6981            let next_out_of_line = decoder.next_out_of_line();
6982            let handles_before = decoder.remaining_handles();
6983            if let Some((inlined, num_bytes, num_handles)) =
6984                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6985            {
6986                let member_inline_size =
6987                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::TypeMarker>::inline_size(
6988                        decoder.context,
6989                    );
6990                if inlined != (member_inline_size <= 4) {
6991                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6992                }
6993                let inner_offset;
6994                let mut inner_depth = depth.clone();
6995                if inlined {
6996                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6997                    inner_offset = next_offset;
6998                } else {
6999                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7000                    inner_depth.increment()?;
7001                }
7002                let val_ref =
7003                self.offers2.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
7004                fidl::decode!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7005                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7006                {
7007                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7008                }
7009                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7010                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7011                }
7012            }
7013
7014            next_offset += envelope_size;
7015            _next_ordinal_to_read += 1;
7016            if next_offset >= end_offset {
7017                return Ok(());
7018            }
7019
7020            // Decode unknown envelopes for gaps in ordinals.
7021            while _next_ordinal_to_read < 7 {
7022                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7023                _next_ordinal_to_read += 1;
7024                next_offset += envelope_size;
7025            }
7026
7027            let next_out_of_line = decoder.next_out_of_line();
7028            let handles_before = decoder.remaining_handles();
7029            if let Some((inlined, num_bytes, num_handles)) =
7030                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7031            {
7032                let member_inline_size =
7033                    <BusInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7034                if inlined != (member_inline_size <= 4) {
7035                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7036                }
7037                let inner_offset;
7038                let mut inner_depth = depth.clone();
7039                if inlined {
7040                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7041                    inner_offset = next_offset;
7042                } else {
7043                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7044                    inner_depth.increment()?;
7045                }
7046                let val_ref = self.bus_info.get_or_insert_with(|| {
7047                    fidl::new_empty!(BusInfo, fidl::encoding::DefaultFuchsiaResourceDialect)
7048                });
7049                fidl::decode!(
7050                    BusInfo,
7051                    fidl::encoding::DefaultFuchsiaResourceDialect,
7052                    val_ref,
7053                    decoder,
7054                    inner_offset,
7055                    inner_depth
7056                )?;
7057                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7058                {
7059                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7060                }
7061                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7062                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7063                }
7064            }
7065
7066            next_offset += envelope_size;
7067            _next_ordinal_to_read += 1;
7068            if next_offset >= end_offset {
7069                return Ok(());
7070            }
7071
7072            // Decode unknown envelopes for gaps in ordinals.
7073            while _next_ordinal_to_read < 8 {
7074                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7075                _next_ordinal_to_read += 1;
7076                next_offset += envelope_size;
7077            }
7078
7079            let next_out_of_line = decoder.next_out_of_line();
7080            let handles_before = decoder.remaining_handles();
7081            if let Some((inlined, num_bytes, num_handles)) =
7082                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7083            {
7084                let member_inline_size = <fidl::encoding::Vector<NodeProperty2, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7085                if inlined != (member_inline_size <= 4) {
7086                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7087                }
7088                let inner_offset;
7089                let mut inner_depth = depth.clone();
7090                if inlined {
7091                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7092                    inner_offset = next_offset;
7093                } else {
7094                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7095                    inner_depth.increment()?;
7096                }
7097                let val_ref =
7098                self.properties2.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NodeProperty2, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
7099                fidl::decode!(fidl::encoding::Vector<NodeProperty2, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7100                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7101                {
7102                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7103                }
7104                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7105                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7106                }
7107            }
7108
7109            next_offset += envelope_size;
7110            _next_ordinal_to_read += 1;
7111            if next_offset >= end_offset {
7112                return Ok(());
7113            }
7114
7115            // Decode unknown envelopes for gaps in ordinals.
7116            while _next_ordinal_to_read < 9 {
7117                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7118                _next_ordinal_to_read += 1;
7119                next_offset += envelope_size;
7120            }
7121
7122            let next_out_of_line = decoder.next_out_of_line();
7123            let handles_before = decoder.remaining_handles();
7124            if let Some((inlined, num_bytes, num_handles)) =
7125                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7126            {
7127                let member_inline_size = <fidl_fuchsia_component_sandbox::DictionaryRef as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7128                if inlined != (member_inline_size <= 4) {
7129                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7130                }
7131                let inner_offset;
7132                let mut inner_depth = depth.clone();
7133                if inlined {
7134                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7135                    inner_offset = next_offset;
7136                } else {
7137                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7138                    inner_depth.increment()?;
7139                }
7140                let val_ref = self.offers_dictionary.get_or_insert_with(|| {
7141                    fidl::new_empty!(
7142                        fidl_fuchsia_component_sandbox::DictionaryRef,
7143                        fidl::encoding::DefaultFuchsiaResourceDialect
7144                    )
7145                });
7146                fidl::decode!(
7147                    fidl_fuchsia_component_sandbox::DictionaryRef,
7148                    fidl::encoding::DefaultFuchsiaResourceDialect,
7149                    val_ref,
7150                    decoder,
7151                    inner_offset,
7152                    inner_depth
7153                )?;
7154                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7155                {
7156                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7157                }
7158                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7159                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7160                }
7161            }
7162
7163            next_offset += envelope_size;
7164            _next_ordinal_to_read += 1;
7165            if next_offset >= end_offset {
7166                return Ok(());
7167            }
7168
7169            // Decode unknown envelopes for gaps in ordinals.
7170            while _next_ordinal_to_read < 10 {
7171                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7172                _next_ordinal_to_read += 1;
7173                next_offset += envelope_size;
7174            }
7175
7176            let next_out_of_line = decoder.next_out_of_line();
7177            let handles_before = decoder.remaining_handles();
7178            if let Some((inlined, num_bytes, num_handles)) =
7179                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7180            {
7181                let member_inline_size =
7182                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
7183                        decoder.context,
7184                    );
7185                if inlined != (member_inline_size <= 4) {
7186                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7187                }
7188                let inner_offset;
7189                let mut inner_depth = depth.clone();
7190                if inlined {
7191                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7192                    inner_offset = next_offset;
7193                } else {
7194                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7195                    inner_depth.increment()?;
7196                }
7197                let val_ref = self.driver_host.get_or_insert_with(|| {
7198                    fidl::new_empty!(
7199                        fidl::encoding::BoundedString<128>,
7200                        fidl::encoding::DefaultFuchsiaResourceDialect
7201                    )
7202                });
7203                fidl::decode!(
7204                    fidl::encoding::BoundedString<128>,
7205                    fidl::encoding::DefaultFuchsiaResourceDialect,
7206                    val_ref,
7207                    decoder,
7208                    inner_offset,
7209                    inner_depth
7210                )?;
7211                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7212                {
7213                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7214                }
7215                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7216                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7217                }
7218            }
7219
7220            next_offset += envelope_size;
7221
7222            // Decode the remaining unknown envelopes.
7223            while next_offset < end_offset {
7224                _next_ordinal_to_read += 1;
7225                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7226                next_offset += envelope_size;
7227            }
7228
7229            Ok(())
7230        }
7231    }
7232
7233    impl NodeControllerOnBindRequest {
7234        #[inline(always)]
7235        fn max_ordinal_present(&self) -> u64 {
7236            if let Some(_) = self.node_token {
7237                return 1;
7238            }
7239            0
7240        }
7241    }
7242
7243    impl fidl::encoding::ResourceTypeMarker for NodeControllerOnBindRequest {
7244        type Borrowed<'a> = &'a mut Self;
7245        fn take_or_borrow<'a>(
7246            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7247        ) -> Self::Borrowed<'a> {
7248            value
7249        }
7250    }
7251
7252    unsafe impl fidl::encoding::TypeMarker for NodeControllerOnBindRequest {
7253        type Owned = Self;
7254
7255        #[inline(always)]
7256        fn inline_align(_context: fidl::encoding::Context) -> usize {
7257            8
7258        }
7259
7260        #[inline(always)]
7261        fn inline_size(_context: fidl::encoding::Context) -> usize {
7262            16
7263        }
7264    }
7265
7266    unsafe impl
7267        fidl::encoding::Encode<
7268            NodeControllerOnBindRequest,
7269            fidl::encoding::DefaultFuchsiaResourceDialect,
7270        > for &mut NodeControllerOnBindRequest
7271    {
7272        unsafe fn encode(
7273            self,
7274            encoder: &mut fidl::encoding::Encoder<
7275                '_,
7276                fidl::encoding::DefaultFuchsiaResourceDialect,
7277            >,
7278            offset: usize,
7279            mut depth: fidl::encoding::Depth,
7280        ) -> fidl::Result<()> {
7281            encoder.debug_check_bounds::<NodeControllerOnBindRequest>(offset);
7282            // Vector header
7283            let max_ordinal: u64 = self.max_ordinal_present();
7284            encoder.write_num(max_ordinal, offset);
7285            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7286            // Calling encoder.out_of_line_offset(0) is not allowed.
7287            if max_ordinal == 0 {
7288                return Ok(());
7289            }
7290            depth.increment()?;
7291            let envelope_size = 8;
7292            let bytes_len = max_ordinal as usize * envelope_size;
7293            #[allow(unused_variables)]
7294            let offset = encoder.out_of_line_offset(bytes_len);
7295            let mut _prev_end_offset: usize = 0;
7296            if 1 > max_ordinal {
7297                return Ok(());
7298            }
7299
7300            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7301            // are envelope_size bytes.
7302            let cur_offset: usize = (1 - 1) * envelope_size;
7303
7304            // Zero reserved fields.
7305            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7306
7307            // Safety:
7308            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7309            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7310            //   envelope_size bytes, there is always sufficient room.
7311            fidl::encoding::encode_in_envelope_optional::<
7312                fidl::encoding::HandleType<
7313                    fidl::Event,
7314                    { fidl::ObjectType::EVENT.into_raw() },
7315                    2147483648,
7316                >,
7317                fidl::encoding::DefaultFuchsiaResourceDialect,
7318            >(
7319                self.node_token.as_mut().map(
7320                    <fidl::encoding::HandleType<
7321                        fidl::Event,
7322                        { fidl::ObjectType::EVENT.into_raw() },
7323                        2147483648,
7324                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7325                ),
7326                encoder,
7327                offset + cur_offset,
7328                depth,
7329            )?;
7330
7331            _prev_end_offset = cur_offset + envelope_size;
7332
7333            Ok(())
7334        }
7335    }
7336
7337    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7338        for NodeControllerOnBindRequest
7339    {
7340        #[inline(always)]
7341        fn new_empty() -> Self {
7342            Self::default()
7343        }
7344
7345        unsafe fn decode(
7346            &mut self,
7347            decoder: &mut fidl::encoding::Decoder<
7348                '_,
7349                fidl::encoding::DefaultFuchsiaResourceDialect,
7350            >,
7351            offset: usize,
7352            mut depth: fidl::encoding::Depth,
7353        ) -> fidl::Result<()> {
7354            decoder.debug_check_bounds::<Self>(offset);
7355            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7356                None => return Err(fidl::Error::NotNullable),
7357                Some(len) => len,
7358            };
7359            // Calling decoder.out_of_line_offset(0) is not allowed.
7360            if len == 0 {
7361                return Ok(());
7362            };
7363            depth.increment()?;
7364            let envelope_size = 8;
7365            let bytes_len = len * envelope_size;
7366            let offset = decoder.out_of_line_offset(bytes_len)?;
7367            // Decode the envelope for each type.
7368            let mut _next_ordinal_to_read = 0;
7369            let mut next_offset = offset;
7370            let end_offset = offset + bytes_len;
7371            _next_ordinal_to_read += 1;
7372            if next_offset >= end_offset {
7373                return Ok(());
7374            }
7375
7376            // Decode unknown envelopes for gaps in ordinals.
7377            while _next_ordinal_to_read < 1 {
7378                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7379                _next_ordinal_to_read += 1;
7380                next_offset += envelope_size;
7381            }
7382
7383            let next_out_of_line = decoder.next_out_of_line();
7384            let handles_before = decoder.remaining_handles();
7385            if let Some((inlined, num_bytes, num_handles)) =
7386                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7387            {
7388                let member_inline_size = <fidl::encoding::HandleType<
7389                    fidl::Event,
7390                    { fidl::ObjectType::EVENT.into_raw() },
7391                    2147483648,
7392                > as fidl::encoding::TypeMarker>::inline_size(
7393                    decoder.context
7394                );
7395                if inlined != (member_inline_size <= 4) {
7396                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7397                }
7398                let inner_offset;
7399                let mut inner_depth = depth.clone();
7400                if inlined {
7401                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7402                    inner_offset = next_offset;
7403                } else {
7404                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7405                    inner_depth.increment()?;
7406                }
7407                let val_ref =
7408                self.node_token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
7409                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7410                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7411                {
7412                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7413                }
7414                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7415                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7416                }
7417            }
7418
7419            next_offset += envelope_size;
7420
7421            // Decode the remaining unknown envelopes.
7422            while next_offset < end_offset {
7423                _next_ordinal_to_read += 1;
7424                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7425                next_offset += envelope_size;
7426            }
7427
7428            Ok(())
7429        }
7430    }
7431
7432    impl PowerElementArgs {
7433        #[inline(always)]
7434        fn max_ordinal_present(&self) -> u64 {
7435            if let Some(_) = self.token {
7436                return 4;
7437            }
7438            if let Some(_) = self.lessor_client {
7439                return 3;
7440            }
7441            if let Some(_) = self.runner_server {
7442                return 2;
7443            }
7444            if let Some(_) = self.control_client {
7445                return 1;
7446            }
7447            0
7448        }
7449    }
7450
7451    impl fidl::encoding::ResourceTypeMarker for PowerElementArgs {
7452        type Borrowed<'a> = &'a mut Self;
7453        fn take_or_borrow<'a>(
7454            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7455        ) -> Self::Borrowed<'a> {
7456            value
7457        }
7458    }
7459
7460    unsafe impl fidl::encoding::TypeMarker for PowerElementArgs {
7461        type Owned = Self;
7462
7463        #[inline(always)]
7464        fn inline_align(_context: fidl::encoding::Context) -> usize {
7465            8
7466        }
7467
7468        #[inline(always)]
7469        fn inline_size(_context: fidl::encoding::Context) -> usize {
7470            16
7471        }
7472    }
7473
7474    unsafe impl
7475        fidl::encoding::Encode<PowerElementArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
7476        for &mut PowerElementArgs
7477    {
7478        unsafe fn encode(
7479            self,
7480            encoder: &mut fidl::encoding::Encoder<
7481                '_,
7482                fidl::encoding::DefaultFuchsiaResourceDialect,
7483            >,
7484            offset: usize,
7485            mut depth: fidl::encoding::Depth,
7486        ) -> fidl::Result<()> {
7487            encoder.debug_check_bounds::<PowerElementArgs>(offset);
7488            // Vector header
7489            let max_ordinal: u64 = self.max_ordinal_present();
7490            encoder.write_num(max_ordinal, offset);
7491            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7492            // Calling encoder.out_of_line_offset(0) is not allowed.
7493            if max_ordinal == 0 {
7494                return Ok(());
7495            }
7496            depth.increment()?;
7497            let envelope_size = 8;
7498            let bytes_len = max_ordinal as usize * envelope_size;
7499            #[allow(unused_variables)]
7500            let offset = encoder.out_of_line_offset(bytes_len);
7501            let mut _prev_end_offset: usize = 0;
7502            if 1 > max_ordinal {
7503                return Ok(());
7504            }
7505
7506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7507            // are envelope_size bytes.
7508            let cur_offset: usize = (1 - 1) * envelope_size;
7509
7510            // Zero reserved fields.
7511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7512
7513            // Safety:
7514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7516            //   envelope_size bytes, there is always sufficient room.
7517            fidl::encoding::encode_in_envelope_optional::<
7518                fidl::encoding::Endpoint<
7519                    fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::ElementControlMarker>,
7520                >,
7521                fidl::encoding::DefaultFuchsiaResourceDialect,
7522            >(
7523                self.control_client.as_mut().map(
7524                    <fidl::encoding::Endpoint<
7525                        fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::ElementControlMarker>,
7526                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7527                ),
7528                encoder,
7529                offset + cur_offset,
7530                depth,
7531            )?;
7532
7533            _prev_end_offset = cur_offset + envelope_size;
7534            if 2 > max_ordinal {
7535                return Ok(());
7536            }
7537
7538            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7539            // are envelope_size bytes.
7540            let cur_offset: usize = (2 - 1) * envelope_size;
7541
7542            // Zero reserved fields.
7543            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7544
7545            // Safety:
7546            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7547            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7548            //   envelope_size bytes, there is always sufficient room.
7549            fidl::encoding::encode_in_envelope_optional::<
7550                fidl::encoding::Endpoint<
7551                    fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::ElementRunnerMarker>,
7552                >,
7553                fidl::encoding::DefaultFuchsiaResourceDialect,
7554            >(
7555                self.runner_server.as_mut().map(
7556                    <fidl::encoding::Endpoint<
7557                        fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::ElementRunnerMarker>,
7558                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7559                ),
7560                encoder,
7561                offset + cur_offset,
7562                depth,
7563            )?;
7564
7565            _prev_end_offset = cur_offset + envelope_size;
7566            if 3 > max_ordinal {
7567                return Ok(());
7568            }
7569
7570            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7571            // are envelope_size bytes.
7572            let cur_offset: usize = (3 - 1) * envelope_size;
7573
7574            // Zero reserved fields.
7575            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7576
7577            // Safety:
7578            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7579            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7580            //   envelope_size bytes, there is always sufficient room.
7581            fidl::encoding::encode_in_envelope_optional::<
7582                fidl::encoding::Endpoint<
7583                    fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::LessorMarker>,
7584                >,
7585                fidl::encoding::DefaultFuchsiaResourceDialect,
7586            >(
7587                self.lessor_client.as_mut().map(
7588                    <fidl::encoding::Endpoint<
7589                        fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::LessorMarker>,
7590                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7591                ),
7592                encoder,
7593                offset + cur_offset,
7594                depth,
7595            )?;
7596
7597            _prev_end_offset = cur_offset + envelope_size;
7598            if 4 > max_ordinal {
7599                return Ok(());
7600            }
7601
7602            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7603            // are envelope_size bytes.
7604            let cur_offset: usize = (4 - 1) * envelope_size;
7605
7606            // Zero reserved fields.
7607            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7608
7609            // Safety:
7610            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7611            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7612            //   envelope_size bytes, there is always sufficient room.
7613            fidl::encoding::encode_in_envelope_optional::<
7614                fidl::encoding::HandleType<
7615                    fidl::Event,
7616                    { fidl::ObjectType::EVENT.into_raw() },
7617                    2147483648,
7618                >,
7619                fidl::encoding::DefaultFuchsiaResourceDialect,
7620            >(
7621                self.token.as_mut().map(
7622                    <fidl::encoding::HandleType<
7623                        fidl::Event,
7624                        { fidl::ObjectType::EVENT.into_raw() },
7625                        2147483648,
7626                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
7627                ),
7628                encoder,
7629                offset + cur_offset,
7630                depth,
7631            )?;
7632
7633            _prev_end_offset = cur_offset + envelope_size;
7634
7635            Ok(())
7636        }
7637    }
7638
7639    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7640        for PowerElementArgs
7641    {
7642        #[inline(always)]
7643        fn new_empty() -> Self {
7644            Self::default()
7645        }
7646
7647        unsafe fn decode(
7648            &mut self,
7649            decoder: &mut fidl::encoding::Decoder<
7650                '_,
7651                fidl::encoding::DefaultFuchsiaResourceDialect,
7652            >,
7653            offset: usize,
7654            mut depth: fidl::encoding::Depth,
7655        ) -> fidl::Result<()> {
7656            decoder.debug_check_bounds::<Self>(offset);
7657            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7658                None => return Err(fidl::Error::NotNullable),
7659                Some(len) => len,
7660            };
7661            // Calling decoder.out_of_line_offset(0) is not allowed.
7662            if len == 0 {
7663                return Ok(());
7664            };
7665            depth.increment()?;
7666            let envelope_size = 8;
7667            let bytes_len = len * envelope_size;
7668            let offset = decoder.out_of_line_offset(bytes_len)?;
7669            // Decode the envelope for each type.
7670            let mut _next_ordinal_to_read = 0;
7671            let mut next_offset = offset;
7672            let end_offset = offset + bytes_len;
7673            _next_ordinal_to_read += 1;
7674            if next_offset >= end_offset {
7675                return Ok(());
7676            }
7677
7678            // Decode unknown envelopes for gaps in ordinals.
7679            while _next_ordinal_to_read < 1 {
7680                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7681                _next_ordinal_to_read += 1;
7682                next_offset += envelope_size;
7683            }
7684
7685            let next_out_of_line = decoder.next_out_of_line();
7686            let handles_before = decoder.remaining_handles();
7687            if let Some((inlined, num_bytes, num_handles)) =
7688                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7689            {
7690                let member_inline_size = <fidl::encoding::Endpoint<
7691                    fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::ElementControlMarker>,
7692                > as fidl::encoding::TypeMarker>::inline_size(
7693                    decoder.context
7694                );
7695                if inlined != (member_inline_size <= 4) {
7696                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7697                }
7698                let inner_offset;
7699                let mut inner_depth = depth.clone();
7700                if inlined {
7701                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7702                    inner_offset = next_offset;
7703                } else {
7704                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7705                    inner_depth.increment()?;
7706                }
7707                let val_ref = self.control_client.get_or_insert_with(|| {
7708                    fidl::new_empty!(
7709                        fidl::encoding::Endpoint<
7710                            fidl::endpoints::ClientEnd<
7711                                fidl_fuchsia_power_broker::ElementControlMarker,
7712                            >,
7713                        >,
7714                        fidl::encoding::DefaultFuchsiaResourceDialect
7715                    )
7716                });
7717                fidl::decode!(
7718                    fidl::encoding::Endpoint<
7719                        fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::ElementControlMarker>,
7720                    >,
7721                    fidl::encoding::DefaultFuchsiaResourceDialect,
7722                    val_ref,
7723                    decoder,
7724                    inner_offset,
7725                    inner_depth
7726                )?;
7727                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7728                {
7729                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7730                }
7731                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7732                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7733                }
7734            }
7735
7736            next_offset += envelope_size;
7737            _next_ordinal_to_read += 1;
7738            if next_offset >= end_offset {
7739                return Ok(());
7740            }
7741
7742            // Decode unknown envelopes for gaps in ordinals.
7743            while _next_ordinal_to_read < 2 {
7744                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7745                _next_ordinal_to_read += 1;
7746                next_offset += envelope_size;
7747            }
7748
7749            let next_out_of_line = decoder.next_out_of_line();
7750            let handles_before = decoder.remaining_handles();
7751            if let Some((inlined, num_bytes, num_handles)) =
7752                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7753            {
7754                let member_inline_size = <fidl::encoding::Endpoint<
7755                    fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::ElementRunnerMarker>,
7756                > as fidl::encoding::TypeMarker>::inline_size(
7757                    decoder.context
7758                );
7759                if inlined != (member_inline_size <= 4) {
7760                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7761                }
7762                let inner_offset;
7763                let mut inner_depth = depth.clone();
7764                if inlined {
7765                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7766                    inner_offset = next_offset;
7767                } else {
7768                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7769                    inner_depth.increment()?;
7770                }
7771                let val_ref = self.runner_server.get_or_insert_with(|| {
7772                    fidl::new_empty!(
7773                        fidl::encoding::Endpoint<
7774                            fidl::endpoints::ServerEnd<
7775                                fidl_fuchsia_power_broker::ElementRunnerMarker,
7776                            >,
7777                        >,
7778                        fidl::encoding::DefaultFuchsiaResourceDialect
7779                    )
7780                });
7781                fidl::decode!(
7782                    fidl::encoding::Endpoint<
7783                        fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::ElementRunnerMarker>,
7784                    >,
7785                    fidl::encoding::DefaultFuchsiaResourceDialect,
7786                    val_ref,
7787                    decoder,
7788                    inner_offset,
7789                    inner_depth
7790                )?;
7791                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7792                {
7793                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7794                }
7795                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7796                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7797                }
7798            }
7799
7800            next_offset += envelope_size;
7801            _next_ordinal_to_read += 1;
7802            if next_offset >= end_offset {
7803                return Ok(());
7804            }
7805
7806            // Decode unknown envelopes for gaps in ordinals.
7807            while _next_ordinal_to_read < 3 {
7808                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7809                _next_ordinal_to_read += 1;
7810                next_offset += envelope_size;
7811            }
7812
7813            let next_out_of_line = decoder.next_out_of_line();
7814            let handles_before = decoder.remaining_handles();
7815            if let Some((inlined, num_bytes, num_handles)) =
7816                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7817            {
7818                let member_inline_size = <fidl::encoding::Endpoint<
7819                    fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::LessorMarker>,
7820                > as fidl::encoding::TypeMarker>::inline_size(
7821                    decoder.context
7822                );
7823                if inlined != (member_inline_size <= 4) {
7824                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7825                }
7826                let inner_offset;
7827                let mut inner_depth = depth.clone();
7828                if inlined {
7829                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7830                    inner_offset = next_offset;
7831                } else {
7832                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7833                    inner_depth.increment()?;
7834                }
7835                let val_ref = self.lessor_client.get_or_insert_with(|| {
7836                    fidl::new_empty!(
7837                        fidl::encoding::Endpoint<
7838                            fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::LessorMarker>,
7839                        >,
7840                        fidl::encoding::DefaultFuchsiaResourceDialect
7841                    )
7842                });
7843                fidl::decode!(
7844                    fidl::encoding::Endpoint<
7845                        fidl::endpoints::ClientEnd<fidl_fuchsia_power_broker::LessorMarker>,
7846                    >,
7847                    fidl::encoding::DefaultFuchsiaResourceDialect,
7848                    val_ref,
7849                    decoder,
7850                    inner_offset,
7851                    inner_depth
7852                )?;
7853                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7854                {
7855                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7856                }
7857                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7858                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7859                }
7860            }
7861
7862            next_offset += envelope_size;
7863            _next_ordinal_to_read += 1;
7864            if next_offset >= end_offset {
7865                return Ok(());
7866            }
7867
7868            // Decode unknown envelopes for gaps in ordinals.
7869            while _next_ordinal_to_read < 4 {
7870                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7871                _next_ordinal_to_read += 1;
7872                next_offset += envelope_size;
7873            }
7874
7875            let next_out_of_line = decoder.next_out_of_line();
7876            let handles_before = decoder.remaining_handles();
7877            if let Some((inlined, num_bytes, num_handles)) =
7878                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7879            {
7880                let member_inline_size = <fidl::encoding::HandleType<
7881                    fidl::Event,
7882                    { fidl::ObjectType::EVENT.into_raw() },
7883                    2147483648,
7884                > as fidl::encoding::TypeMarker>::inline_size(
7885                    decoder.context
7886                );
7887                if inlined != (member_inline_size <= 4) {
7888                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7889                }
7890                let inner_offset;
7891                let mut inner_depth = depth.clone();
7892                if inlined {
7893                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7894                    inner_offset = next_offset;
7895                } else {
7896                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7897                    inner_depth.increment()?;
7898                }
7899                let val_ref =
7900                self.token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
7901                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
7902                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7903                {
7904                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7905                }
7906                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7907                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7908                }
7909            }
7910
7911            next_offset += envelope_size;
7912
7913            // Decode the remaining unknown envelopes.
7914            while next_offset < end_offset {
7915                _next_ordinal_to_read += 1;
7916                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7917                next_offset += envelope_size;
7918            }
7919
7920            Ok(())
7921        }
7922    }
7923
7924    impl ResourceArgs {
7925        #[inline(always)]
7926        fn max_ordinal_present(&self) -> u64 {
7927            if let Some(_) = self.bus_info {
7928                return 4;
7929            }
7930            if let Some(_) = self.offers {
7931                return 3;
7932            }
7933            if let Some(_) = self.properties {
7934                return 2;
7935            }
7936            if let Some(_) = self.name {
7937                return 1;
7938            }
7939            0
7940        }
7941    }
7942
7943    impl fidl::encoding::ResourceTypeMarker for ResourceArgs {
7944        type Borrowed<'a> = &'a mut Self;
7945        fn take_or_borrow<'a>(
7946            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7947        ) -> Self::Borrowed<'a> {
7948            value
7949        }
7950    }
7951
7952    unsafe impl fidl::encoding::TypeMarker for ResourceArgs {
7953        type Owned = Self;
7954
7955        #[inline(always)]
7956        fn inline_align(_context: fidl::encoding::Context) -> usize {
7957            8
7958        }
7959
7960        #[inline(always)]
7961        fn inline_size(_context: fidl::encoding::Context) -> usize {
7962            16
7963        }
7964    }
7965
7966    unsafe impl fidl::encoding::Encode<ResourceArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
7967        for &mut ResourceArgs
7968    {
7969        unsafe fn encode(
7970            self,
7971            encoder: &mut fidl::encoding::Encoder<
7972                '_,
7973                fidl::encoding::DefaultFuchsiaResourceDialect,
7974            >,
7975            offset: usize,
7976            mut depth: fidl::encoding::Depth,
7977        ) -> fidl::Result<()> {
7978            encoder.debug_check_bounds::<ResourceArgs>(offset);
7979            // Vector header
7980            let max_ordinal: u64 = self.max_ordinal_present();
7981            encoder.write_num(max_ordinal, offset);
7982            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7983            // Calling encoder.out_of_line_offset(0) is not allowed.
7984            if max_ordinal == 0 {
7985                return Ok(());
7986            }
7987            depth.increment()?;
7988            let envelope_size = 8;
7989            let bytes_len = max_ordinal as usize * envelope_size;
7990            #[allow(unused_variables)]
7991            let offset = encoder.out_of_line_offset(bytes_len);
7992            let mut _prev_end_offset: usize = 0;
7993            if 1 > max_ordinal {
7994                return Ok(());
7995            }
7996
7997            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7998            // are envelope_size bytes.
7999            let cur_offset: usize = (1 - 1) * envelope_size;
8000
8001            // Zero reserved fields.
8002            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8003
8004            // Safety:
8005            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8006            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8007            //   envelope_size bytes, there is always sufficient room.
8008            fidl::encoding::encode_in_envelope_optional::<
8009                fidl::encoding::BoundedString<128>,
8010                fidl::encoding::DefaultFuchsiaResourceDialect,
8011            >(
8012                self.name.as_ref().map(
8013                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
8014                ),
8015                encoder,
8016                offset + cur_offset,
8017                depth,
8018            )?;
8019
8020            _prev_end_offset = cur_offset + envelope_size;
8021            if 2 > max_ordinal {
8022                return Ok(());
8023            }
8024
8025            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8026            // are envelope_size bytes.
8027            let cur_offset: usize = (2 - 1) * envelope_size;
8028
8029            // Zero reserved fields.
8030            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8031
8032            // Safety:
8033            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8034            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8035            //   envelope_size bytes, there is always sufficient room.
8036            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NodeProperty2, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8037            self.properties.as_ref().map(<fidl::encoding::Vector<NodeProperty2, 64> as fidl::encoding::ValueTypeMarker>::borrow),
8038            encoder, offset + cur_offset, depth
8039        )?;
8040
8041            _prev_end_offset = cur_offset + envelope_size;
8042            if 3 > max_ordinal {
8043                return Ok(());
8044            }
8045
8046            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8047            // are envelope_size bytes.
8048            let cur_offset: usize = (3 - 1) * envelope_size;
8049
8050            // Zero reserved fields.
8051            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8052
8053            // Safety:
8054            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8055            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8056            //   envelope_size bytes, there is always sufficient room.
8057            fidl::encoding::encode_in_envelope_optional::<
8058                fidl::encoding::Vector<Offer, 128>,
8059                fidl::encoding::DefaultFuchsiaResourceDialect,
8060            >(
8061                self.offers.as_ref().map(
8062                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::ValueTypeMarker>::borrow,
8063                ),
8064                encoder,
8065                offset + cur_offset,
8066                depth,
8067            )?;
8068
8069            _prev_end_offset = cur_offset + envelope_size;
8070            if 4 > max_ordinal {
8071                return Ok(());
8072            }
8073
8074            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8075            // are envelope_size bytes.
8076            let cur_offset: usize = (4 - 1) * envelope_size;
8077
8078            // Zero reserved fields.
8079            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8080
8081            // Safety:
8082            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8083            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8084            //   envelope_size bytes, there is always sufficient room.
8085            fidl::encoding::encode_in_envelope_optional::<
8086                BusInfo,
8087                fidl::encoding::DefaultFuchsiaResourceDialect,
8088            >(
8089                self.bus_info.as_ref().map(<BusInfo as fidl::encoding::ValueTypeMarker>::borrow),
8090                encoder,
8091                offset + cur_offset,
8092                depth,
8093            )?;
8094
8095            _prev_end_offset = cur_offset + envelope_size;
8096
8097            Ok(())
8098        }
8099    }
8100
8101    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ResourceArgs {
8102        #[inline(always)]
8103        fn new_empty() -> Self {
8104            Self::default()
8105        }
8106
8107        unsafe fn decode(
8108            &mut self,
8109            decoder: &mut fidl::encoding::Decoder<
8110                '_,
8111                fidl::encoding::DefaultFuchsiaResourceDialect,
8112            >,
8113            offset: usize,
8114            mut depth: fidl::encoding::Depth,
8115        ) -> fidl::Result<()> {
8116            decoder.debug_check_bounds::<Self>(offset);
8117            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8118                None => return Err(fidl::Error::NotNullable),
8119                Some(len) => len,
8120            };
8121            // Calling decoder.out_of_line_offset(0) is not allowed.
8122            if len == 0 {
8123                return Ok(());
8124            };
8125            depth.increment()?;
8126            let envelope_size = 8;
8127            let bytes_len = len * envelope_size;
8128            let offset = decoder.out_of_line_offset(bytes_len)?;
8129            // Decode the envelope for each type.
8130            let mut _next_ordinal_to_read = 0;
8131            let mut next_offset = offset;
8132            let end_offset = offset + bytes_len;
8133            _next_ordinal_to_read += 1;
8134            if next_offset >= end_offset {
8135                return Ok(());
8136            }
8137
8138            // Decode unknown envelopes for gaps in ordinals.
8139            while _next_ordinal_to_read < 1 {
8140                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8141                _next_ordinal_to_read += 1;
8142                next_offset += envelope_size;
8143            }
8144
8145            let next_out_of_line = decoder.next_out_of_line();
8146            let handles_before = decoder.remaining_handles();
8147            if let Some((inlined, num_bytes, num_handles)) =
8148                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8149            {
8150                let member_inline_size =
8151                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
8152                        decoder.context,
8153                    );
8154                if inlined != (member_inline_size <= 4) {
8155                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8156                }
8157                let inner_offset;
8158                let mut inner_depth = depth.clone();
8159                if inlined {
8160                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8161                    inner_offset = next_offset;
8162                } else {
8163                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8164                    inner_depth.increment()?;
8165                }
8166                let val_ref = self.name.get_or_insert_with(|| {
8167                    fidl::new_empty!(
8168                        fidl::encoding::BoundedString<128>,
8169                        fidl::encoding::DefaultFuchsiaResourceDialect
8170                    )
8171                });
8172                fidl::decode!(
8173                    fidl::encoding::BoundedString<128>,
8174                    fidl::encoding::DefaultFuchsiaResourceDialect,
8175                    val_ref,
8176                    decoder,
8177                    inner_offset,
8178                    inner_depth
8179                )?;
8180                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8181                {
8182                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8183                }
8184                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8185                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8186                }
8187            }
8188
8189            next_offset += envelope_size;
8190            _next_ordinal_to_read += 1;
8191            if next_offset >= end_offset {
8192                return Ok(());
8193            }
8194
8195            // Decode unknown envelopes for gaps in ordinals.
8196            while _next_ordinal_to_read < 2 {
8197                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8198                _next_ordinal_to_read += 1;
8199                next_offset += envelope_size;
8200            }
8201
8202            let next_out_of_line = decoder.next_out_of_line();
8203            let handles_before = decoder.remaining_handles();
8204            if let Some((inlined, num_bytes, num_handles)) =
8205                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8206            {
8207                let member_inline_size = <fidl::encoding::Vector<NodeProperty2, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8208                if inlined != (member_inline_size <= 4) {
8209                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8210                }
8211                let inner_offset;
8212                let mut inner_depth = depth.clone();
8213                if inlined {
8214                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8215                    inner_offset = next_offset;
8216                } else {
8217                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8218                    inner_depth.increment()?;
8219                }
8220                let val_ref =
8221                self.properties.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NodeProperty2, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
8222                fidl::decode!(fidl::encoding::Vector<NodeProperty2, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8223                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8224                {
8225                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8226                }
8227                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8228                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8229                }
8230            }
8231
8232            next_offset += envelope_size;
8233            _next_ordinal_to_read += 1;
8234            if next_offset >= end_offset {
8235                return Ok(());
8236            }
8237
8238            // Decode unknown envelopes for gaps in ordinals.
8239            while _next_ordinal_to_read < 3 {
8240                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8241                _next_ordinal_to_read += 1;
8242                next_offset += envelope_size;
8243            }
8244
8245            let next_out_of_line = decoder.next_out_of_line();
8246            let handles_before = decoder.remaining_handles();
8247            if let Some((inlined, num_bytes, num_handles)) =
8248                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8249            {
8250                let member_inline_size =
8251                    <fidl::encoding::Vector<Offer, 128> as fidl::encoding::TypeMarker>::inline_size(
8252                        decoder.context,
8253                    );
8254                if inlined != (member_inline_size <= 4) {
8255                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8256                }
8257                let inner_offset;
8258                let mut inner_depth = depth.clone();
8259                if inlined {
8260                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8261                    inner_offset = next_offset;
8262                } else {
8263                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8264                    inner_depth.increment()?;
8265                }
8266                let val_ref =
8267                self.offers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect));
8268                fidl::decode!(fidl::encoding::Vector<Offer, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
8269                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8270                {
8271                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8272                }
8273                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8274                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8275                }
8276            }
8277
8278            next_offset += envelope_size;
8279            _next_ordinal_to_read += 1;
8280            if next_offset >= end_offset {
8281                return Ok(());
8282            }
8283
8284            // Decode unknown envelopes for gaps in ordinals.
8285            while _next_ordinal_to_read < 4 {
8286                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8287                _next_ordinal_to_read += 1;
8288                next_offset += envelope_size;
8289            }
8290
8291            let next_out_of_line = decoder.next_out_of_line();
8292            let handles_before = decoder.remaining_handles();
8293            if let Some((inlined, num_bytes, num_handles)) =
8294                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8295            {
8296                let member_inline_size =
8297                    <BusInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8298                if inlined != (member_inline_size <= 4) {
8299                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8300                }
8301                let inner_offset;
8302                let mut inner_depth = depth.clone();
8303                if inlined {
8304                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8305                    inner_offset = next_offset;
8306                } else {
8307                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8308                    inner_depth.increment()?;
8309                }
8310                let val_ref = self.bus_info.get_or_insert_with(|| {
8311                    fidl::new_empty!(BusInfo, fidl::encoding::DefaultFuchsiaResourceDialect)
8312                });
8313                fidl::decode!(
8314                    BusInfo,
8315                    fidl::encoding::DefaultFuchsiaResourceDialect,
8316                    val_ref,
8317                    decoder,
8318                    inner_offset,
8319                    inner_depth
8320                )?;
8321                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8322                {
8323                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8324                }
8325                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8326                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8327                }
8328            }
8329
8330            next_offset += envelope_size;
8331
8332            // Decode the remaining unknown envelopes.
8333            while next_offset < end_offset {
8334                _next_ordinal_to_read += 1;
8335                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8336                next_offset += envelope_size;
8337            }
8338
8339            Ok(())
8340        }
8341    }
8342
8343    impl fidl::encoding::ResourceTypeMarker for DriverResult {
8344        type Borrowed<'a> = &'a mut Self;
8345        fn take_or_borrow<'a>(
8346            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8347        ) -> Self::Borrowed<'a> {
8348            value
8349        }
8350    }
8351
8352    unsafe impl fidl::encoding::TypeMarker for DriverResult {
8353        type Owned = Self;
8354
8355        #[inline(always)]
8356        fn inline_align(_context: fidl::encoding::Context) -> usize {
8357            8
8358        }
8359
8360        #[inline(always)]
8361        fn inline_size(_context: fidl::encoding::Context) -> usize {
8362            16
8363        }
8364    }
8365
8366    unsafe impl fidl::encoding::Encode<DriverResult, fidl::encoding::DefaultFuchsiaResourceDialect>
8367        for &mut DriverResult
8368    {
8369        #[inline]
8370        unsafe fn encode(
8371            self,
8372            encoder: &mut fidl::encoding::Encoder<
8373                '_,
8374                fidl::encoding::DefaultFuchsiaResourceDialect,
8375            >,
8376            offset: usize,
8377            _depth: fidl::encoding::Depth,
8378        ) -> fidl::Result<()> {
8379            encoder.debug_check_bounds::<DriverResult>(offset);
8380            encoder.write_num::<u64>(self.ordinal(), offset);
8381            match self {
8382                DriverResult::DriverStartedNodeToken(ref mut val) => {
8383                    fidl::encoding::encode_in_envelope::<
8384                        fidl::encoding::HandleType<
8385                            fidl::Event,
8386                            { fidl::ObjectType::EVENT.into_raw() },
8387                            2147483648,
8388                        >,
8389                        fidl::encoding::DefaultFuchsiaResourceDialect,
8390                    >(
8391                        <fidl::encoding::HandleType<
8392                            fidl::Event,
8393                            { fidl::ObjectType::EVENT.into_raw() },
8394                            2147483648,
8395                        > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8396                            val
8397                        ),
8398                        encoder,
8399                        offset + 8,
8400                        _depth,
8401                    )
8402                }
8403                DriverResult::MatchError(ref val) => fidl::encoding::encode_in_envelope::<
8404                    i32,
8405                    fidl::encoding::DefaultFuchsiaResourceDialect,
8406                >(
8407                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
8408                    encoder,
8409                    offset + 8,
8410                    _depth,
8411                ),
8412                DriverResult::StartError(ref val) => fidl::encoding::encode_in_envelope::<
8413                    i32,
8414                    fidl::encoding::DefaultFuchsiaResourceDialect,
8415                >(
8416                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
8417                    encoder,
8418                    offset + 8,
8419                    _depth,
8420                ),
8421                DriverResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
8422            }
8423        }
8424    }
8425
8426    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DriverResult {
8427        #[inline(always)]
8428        fn new_empty() -> Self {
8429            Self::__SourceBreaking { unknown_ordinal: 0 }
8430        }
8431
8432        #[inline]
8433        unsafe fn decode(
8434            &mut self,
8435            decoder: &mut fidl::encoding::Decoder<
8436                '_,
8437                fidl::encoding::DefaultFuchsiaResourceDialect,
8438            >,
8439            offset: usize,
8440            mut depth: fidl::encoding::Depth,
8441        ) -> fidl::Result<()> {
8442            decoder.debug_check_bounds::<Self>(offset);
8443            #[allow(unused_variables)]
8444            let next_out_of_line = decoder.next_out_of_line();
8445            let handles_before = decoder.remaining_handles();
8446            let (ordinal, inlined, num_bytes, num_handles) =
8447                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8448
8449            let member_inline_size = match ordinal {
8450                1 => <fidl::encoding::HandleType<
8451                    fidl::Event,
8452                    { fidl::ObjectType::EVENT.into_raw() },
8453                    2147483648,
8454                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8455                2 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8456                3 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8457                0 => return Err(fidl::Error::UnknownUnionTag),
8458                _ => num_bytes as usize,
8459            };
8460
8461            if inlined != (member_inline_size <= 4) {
8462                return Err(fidl::Error::InvalidInlineBitInEnvelope);
8463            }
8464            let _inner_offset;
8465            if inlined {
8466                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8467                _inner_offset = offset + 8;
8468            } else {
8469                depth.increment()?;
8470                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8471            }
8472            match ordinal {
8473                1 => {
8474                    #[allow(irrefutable_let_patterns)]
8475                    if let DriverResult::DriverStartedNodeToken(_) = self {
8476                        // Do nothing, read the value into the object
8477                    } else {
8478                        // Initialize `self` to the right variant
8479                        *self = DriverResult::DriverStartedNodeToken(
8480                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8481                        );
8482                    }
8483                    #[allow(irrefutable_let_patterns)]
8484                    if let DriverResult::DriverStartedNodeToken(ref mut val) = self {
8485                        fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
8486                    } else {
8487                        unreachable!()
8488                    }
8489                }
8490                2 => {
8491                    #[allow(irrefutable_let_patterns)]
8492                    if let DriverResult::MatchError(_) = self {
8493                        // Do nothing, read the value into the object
8494                    } else {
8495                        // Initialize `self` to the right variant
8496                        *self = DriverResult::MatchError(fidl::new_empty!(
8497                            i32,
8498                            fidl::encoding::DefaultFuchsiaResourceDialect
8499                        ));
8500                    }
8501                    #[allow(irrefutable_let_patterns)]
8502                    if let DriverResult::MatchError(ref mut val) = self {
8503                        fidl::decode!(
8504                            i32,
8505                            fidl::encoding::DefaultFuchsiaResourceDialect,
8506                            val,
8507                            decoder,
8508                            _inner_offset,
8509                            depth
8510                        )?;
8511                    } else {
8512                        unreachable!()
8513                    }
8514                }
8515                3 => {
8516                    #[allow(irrefutable_let_patterns)]
8517                    if let DriverResult::StartError(_) = self {
8518                        // Do nothing, read the value into the object
8519                    } else {
8520                        // Initialize `self` to the right variant
8521                        *self = DriverResult::StartError(fidl::new_empty!(
8522                            i32,
8523                            fidl::encoding::DefaultFuchsiaResourceDialect
8524                        ));
8525                    }
8526                    #[allow(irrefutable_let_patterns)]
8527                    if let DriverResult::StartError(ref mut val) = self {
8528                        fidl::decode!(
8529                            i32,
8530                            fidl::encoding::DefaultFuchsiaResourceDialect,
8531                            val,
8532                            decoder,
8533                            _inner_offset,
8534                            depth
8535                        )?;
8536                    } else {
8537                        unreachable!()
8538                    }
8539                }
8540                #[allow(deprecated)]
8541                ordinal => {
8542                    for _ in 0..num_handles {
8543                        decoder.drop_next_handle()?;
8544                    }
8545                    *self = DriverResult::__SourceBreaking { unknown_ordinal: ordinal };
8546                }
8547            }
8548            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8549                return Err(fidl::Error::InvalidNumBytesInEnvelope);
8550            }
8551            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8552                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8553            }
8554            Ok(())
8555        }
8556    }
8557}