fidl_fuchsia_hardware_platform_device/
fidl_fuchsia_hardware_platform_device.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_hardware_platform_device__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceGetBtiByIdResponse {
16    pub bti: fidl::Bti,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetBtiByIdResponse {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct DeviceGetBtiByNameResponse {
23    pub bti: fidl::Bti,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
27    for DeviceGetBtiByNameResponse
28{
29}
30
31#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
32pub struct DeviceGetInterruptByIdResponse {
33    pub irq: fidl::Interrupt,
34}
35
36impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
37    for DeviceGetInterruptByIdResponse
38{
39}
40
41#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
42pub struct DeviceGetInterruptByNameResponse {
43    pub irq: fidl::Interrupt,
44}
45
46impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
47    for DeviceGetInterruptByNameResponse
48{
49}
50
51#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
52pub struct DeviceGetSmcByIdResponse {
53    pub smc: fidl::Resource,
54}
55
56impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetSmcByIdResponse {}
57
58#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
59pub struct DeviceGetSmcByNameResponse {
60    pub smc: fidl::Resource,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64    for DeviceGetSmcByNameResponse
65{
66}
67
68#[derive(Debug, Default, PartialEq)]
69pub struct Mmio {
70    /// Offset from beginning of VMO where the mmio region begins.
71    pub offset: Option<u64>,
72    /// Size of mmio region.
73    pub size: Option<u64>,
74    /// The virtual memory object which should be mapped into the driver's address space.
75    pub vmo: Option<fidl::Vmo>,
76    #[doc(hidden)]
77    pub __source_breaking: fidl::marker::SourceBreaking,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Mmio {}
81
82#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
83pub struct DeviceMarker;
84
85impl fidl::endpoints::ProtocolMarker for DeviceMarker {
86    type Proxy = DeviceProxy;
87    type RequestStream = DeviceRequestStream;
88    #[cfg(target_os = "fuchsia")]
89    type SynchronousProxy = DeviceSynchronousProxy;
90
91    const DEBUG_NAME: &'static str = "fuchsia.hardware.platform.device.Device";
92}
93impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
94pub type DeviceGetMmioByIdResult = Result<Mmio, i32>;
95pub type DeviceGetMmioByNameResult = Result<Mmio, i32>;
96pub type DeviceGetInterruptByIdResult = Result<fidl::Interrupt, i32>;
97pub type DeviceGetInterruptByNameResult = Result<fidl::Interrupt, i32>;
98pub type DeviceGetBtiByIdResult = Result<fidl::Bti, i32>;
99pub type DeviceGetBtiByNameResult = Result<fidl::Bti, i32>;
100pub type DeviceGetSmcByIdResult = Result<fidl::Resource, i32>;
101pub type DeviceGetSmcByNameResult = Result<fidl::Resource, i32>;
102pub type DeviceGetPowerConfigurationResult =
103    Result<Vec<fidl_fuchsia_hardware_power::PowerElementConfiguration>, i32>;
104pub type DeviceGetNodeDeviceInfoResult = Result<NodeDeviceInfo, i32>;
105pub type DeviceGetBoardInfoResult = Result<BoardInfo, i32>;
106pub type DeviceGetMetadataResult = Result<Vec<u8>, i32>;
107
108pub trait DeviceProxyInterface: Send + Sync {
109    type GetMmioByIdResponseFut: std::future::Future<Output = Result<DeviceGetMmioByIdResult, fidl::Error>>
110        + Send;
111    fn r#get_mmio_by_id(&self, index: u32) -> Self::GetMmioByIdResponseFut;
112    type GetMmioByNameResponseFut: std::future::Future<Output = Result<DeviceGetMmioByNameResult, fidl::Error>>
113        + Send;
114    fn r#get_mmio_by_name(&self, name: &str) -> Self::GetMmioByNameResponseFut;
115    type GetInterruptByIdResponseFut: std::future::Future<Output = Result<DeviceGetInterruptByIdResult, fidl::Error>>
116        + Send;
117    fn r#get_interrupt_by_id(&self, index: u32, flags: u32) -> Self::GetInterruptByIdResponseFut;
118    type GetInterruptByNameResponseFut: std::future::Future<Output = Result<DeviceGetInterruptByNameResult, fidl::Error>>
119        + Send;
120    fn r#get_interrupt_by_name(
121        &self,
122        name: &str,
123        flags: u32,
124    ) -> Self::GetInterruptByNameResponseFut;
125    type GetBtiByIdResponseFut: std::future::Future<Output = Result<DeviceGetBtiByIdResult, fidl::Error>>
126        + Send;
127    fn r#get_bti_by_id(&self, index: u32) -> Self::GetBtiByIdResponseFut;
128    type GetBtiByNameResponseFut: std::future::Future<Output = Result<DeviceGetBtiByNameResult, fidl::Error>>
129        + Send;
130    fn r#get_bti_by_name(&self, name: &str) -> Self::GetBtiByNameResponseFut;
131    type GetSmcByIdResponseFut: std::future::Future<Output = Result<DeviceGetSmcByIdResult, fidl::Error>>
132        + Send;
133    fn r#get_smc_by_id(&self, index: u32) -> Self::GetSmcByIdResponseFut;
134    type GetSmcByNameResponseFut: std::future::Future<Output = Result<DeviceGetSmcByNameResult, fidl::Error>>
135        + Send;
136    fn r#get_smc_by_name(&self, name: &str) -> Self::GetSmcByNameResponseFut;
137    type GetPowerConfigurationResponseFut: std::future::Future<Output = Result<DeviceGetPowerConfigurationResult, fidl::Error>>
138        + Send;
139    fn r#get_power_configuration(&self) -> Self::GetPowerConfigurationResponseFut;
140    type GetNodeDeviceInfoResponseFut: std::future::Future<Output = Result<DeviceGetNodeDeviceInfoResult, fidl::Error>>
141        + Send;
142    fn r#get_node_device_info(&self) -> Self::GetNodeDeviceInfoResponseFut;
143    type GetBoardInfoResponseFut: std::future::Future<Output = Result<DeviceGetBoardInfoResult, fidl::Error>>
144        + Send;
145    fn r#get_board_info(&self) -> Self::GetBoardInfoResponseFut;
146    type GetMetadataResponseFut: std::future::Future<Output = Result<DeviceGetMetadataResult, fidl::Error>>
147        + Send;
148    fn r#get_metadata(&self, id: &str) -> Self::GetMetadataResponseFut;
149}
150#[derive(Debug)]
151#[cfg(target_os = "fuchsia")]
152pub struct DeviceSynchronousProxy {
153    client: fidl::client::sync::Client,
154}
155
156#[cfg(target_os = "fuchsia")]
157impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
158    type Proxy = DeviceProxy;
159    type Protocol = DeviceMarker;
160
161    fn from_channel(inner: fidl::Channel) -> Self {
162        Self::new(inner)
163    }
164
165    fn into_channel(self) -> fidl::Channel {
166        self.client.into_channel()
167    }
168
169    fn as_channel(&self) -> &fidl::Channel {
170        self.client.as_channel()
171    }
172}
173
174#[cfg(target_os = "fuchsia")]
175impl DeviceSynchronousProxy {
176    pub fn new(channel: fidl::Channel) -> Self {
177        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
178        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
179    }
180
181    pub fn into_channel(self) -> fidl::Channel {
182        self.client.into_channel()
183    }
184
185    /// Waits until an event arrives and returns it. It is safe for other
186    /// threads to make concurrent requests while waiting for an event.
187    pub fn wait_for_event(
188        &self,
189        deadline: zx::MonotonicInstant,
190    ) -> Result<DeviceEvent, fidl::Error> {
191        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
192    }
193
194    /// Returns a memory mapped IO (MMIO) resource for the given |index|.
195    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
196    /// mmios.
197    /// * error `ZX_ERR_INTERNAL` if the retrieved mmio is not valid.
198    /// * error `ZX_ERR_NOT_FOUND` if the retrieved mmio's base address is NULL.
199    pub fn r#get_mmio_by_id(
200        &self,
201        mut index: u32,
202        ___deadline: zx::MonotonicInstant,
203    ) -> Result<DeviceGetMmioByIdResult, fidl::Error> {
204        let _response = self
205            .client
206            .send_query::<DeviceGetMmioByIdRequest, fidl::encoding::FlexibleResultType<Mmio, i32>>(
207                (index,),
208                0x2fe2767f0aeec203,
209                fidl::encoding::DynamicFlags::FLEXIBLE,
210                ___deadline,
211            )?
212            .into_result::<DeviceMarker>("get_mmio_by_id")?;
213        Ok(_response.map(|x| x))
214    }
215
216    /// Returns a memory mapped IO (MMIO) resource for the given |name|.
217    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
218    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
219    /// * error `ZX_ERR_INTERNAL` if the retrieved mmio is not valid.
220    /// * error `ZX_ERR_NOT_FOUND` if the retrieved's mmio base address is NULL.
221    pub fn r#get_mmio_by_name(
222        &self,
223        mut name: &str,
224        ___deadline: zx::MonotonicInstant,
225    ) -> Result<DeviceGetMmioByNameResult, fidl::Error> {
226        let _response = self.client.send_query::<
227            DeviceGetMmioByNameRequest,
228            fidl::encoding::FlexibleResultType<Mmio, i32>,
229        >(
230            (name,),
231            0x27dc17076e665076,
232            fidl::encoding::DynamicFlags::FLEXIBLE,
233            ___deadline,
234        )?
235        .into_result::<DeviceMarker>("get_mmio_by_name")?;
236        Ok(_response.map(|x| x))
237    }
238
239    /// Returns an interrupt handle for the given |index|.
240    /// |flags| is forwarded as the |options| parameter to `zx_interrupt_create`.
241    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
242    /// interrupts.
243    /// * error `ZX_ERR_INTERNAL` if the retrieved interrupt is not valid.
244    pub fn r#get_interrupt_by_id(
245        &self,
246        mut index: u32,
247        mut flags: u32,
248        ___deadline: zx::MonotonicInstant,
249    ) -> Result<DeviceGetInterruptByIdResult, fidl::Error> {
250        let _response = self.client.send_query::<
251            DeviceGetInterruptByIdRequest,
252            fidl::encoding::FlexibleResultType<DeviceGetInterruptByIdResponse, i32>,
253        >(
254            (index, flags,),
255            0x4af1d7ccf7a4a4bc,
256            fidl::encoding::DynamicFlags::FLEXIBLE,
257            ___deadline,
258        )?
259        .into_result::<DeviceMarker>("get_interrupt_by_id")?;
260        Ok(_response.map(|x| x.irq))
261    }
262
263    /// Returns an interrupt handle for the given |name|.
264    /// |flags| is forwarded as the |options| parameter to `zx_interrupt_create`.
265    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
266    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
267    /// * error `ZX_ERR_INTERNAL` if the retrieved interrupt is not valid.
268    pub fn r#get_interrupt_by_name(
269        &self,
270        mut name: &str,
271        mut flags: u32,
272        ___deadline: zx::MonotonicInstant,
273    ) -> Result<DeviceGetInterruptByNameResult, fidl::Error> {
274        let _response = self.client.send_query::<
275            DeviceGetInterruptByNameRequest,
276            fidl::encoding::FlexibleResultType<DeviceGetInterruptByNameResponse, i32>,
277        >(
278            (name, flags,),
279            0x165fbc6619b2b64f,
280            fidl::encoding::DynamicFlags::FLEXIBLE,
281            ___deadline,
282        )?
283        .into_result::<DeviceMarker>("get_interrupt_by_name")?;
284        Ok(_response.map(|x| x.irq))
285    }
286
287    /// Returns a bus transaction initiator (bti) handle for the given |index|.
288    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
289    /// btis.
290    /// * error `ZX_ERR_INTERNAL` if the retrieved bti is not valid.
291    pub fn r#get_bti_by_id(
292        &self,
293        mut index: u32,
294        ___deadline: zx::MonotonicInstant,
295    ) -> Result<DeviceGetBtiByIdResult, fidl::Error> {
296        let _response = self.client.send_query::<
297            DeviceGetBtiByIdRequest,
298            fidl::encoding::FlexibleResultType<DeviceGetBtiByIdResponse, i32>,
299        >(
300            (index,),
301            0x7b4518a90bcd5463,
302            fidl::encoding::DynamicFlags::FLEXIBLE,
303            ___deadline,
304        )?
305        .into_result::<DeviceMarker>("get_bti_by_id")?;
306        Ok(_response.map(|x| x.bti))
307    }
308
309    /// Returns a bus transaction initiator (bti) handle for the given |name|.
310    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
311    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
312    /// * error `ZX_ERR_INTERNAL` if the retrieved bti is not valid.
313    pub fn r#get_bti_by_name(
314        &self,
315        mut name: &str,
316        ___deadline: zx::MonotonicInstant,
317    ) -> Result<DeviceGetBtiByNameResult, fidl::Error> {
318        let _response = self.client.send_query::<
319            DeviceGetBtiByNameRequest,
320            fidl::encoding::FlexibleResultType<DeviceGetBtiByNameResponse, i32>,
321        >(
322            (name,),
323            0x358f37bd43460531,
324            fidl::encoding::DynamicFlags::FLEXIBLE,
325            ___deadline,
326        )?
327        .into_result::<DeviceMarker>("get_bti_by_name")?;
328        Ok(_response.map(|x| x.bti))
329    }
330
331    /// Returns a secure monitor call (smc) handle for the given |index|.
332    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
333    /// smcs.
334    /// * error `ZX_ERR_INTERNAL` if the retrieved smc is not valid.
335    pub fn r#get_smc_by_id(
336        &self,
337        mut index: u32,
338        ___deadline: zx::MonotonicInstant,
339    ) -> Result<DeviceGetSmcByIdResult, fidl::Error> {
340        let _response = self.client.send_query::<
341            DeviceGetSmcByIdRequest,
342            fidl::encoding::FlexibleResultType<DeviceGetSmcByIdResponse, i32>,
343        >(
344            (index,),
345            0x40e6da56a39e0e34,
346            fidl::encoding::DynamicFlags::FLEXIBLE,
347            ___deadline,
348        )?
349        .into_result::<DeviceMarker>("get_smc_by_id")?;
350        Ok(_response.map(|x| x.smc))
351    }
352
353    /// Returns a secure monitor call (smc) handle for the given |name|.
354    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
355    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
356    /// * error `ZX_ERR_INTERNAL` if the retrieved smc is not valid.
357    pub fn r#get_smc_by_name(
358        &self,
359        mut name: &str,
360        ___deadline: zx::MonotonicInstant,
361    ) -> Result<DeviceGetSmcByNameResult, fidl::Error> {
362        let _response = self.client.send_query::<
363            DeviceGetSmcByNameRequest,
364            fidl::encoding::FlexibleResultType<DeviceGetSmcByNameResponse, i32>,
365        >(
366            (name,),
367            0x3e13238c0bba6da2,
368            fidl::encoding::DynamicFlags::FLEXIBLE,
369            ___deadline,
370        )?
371        .into_result::<DeviceMarker>("get_smc_by_name")?;
372        Ok(_response.map(|x| x.smc))
373    }
374
375    /// Returns power configuration for the device the driver has bound to.
376    pub fn r#get_power_configuration(
377        &self,
378        ___deadline: zx::MonotonicInstant,
379    ) -> Result<DeviceGetPowerConfigurationResult, fidl::Error> {
380        let _response = self.client.send_query::<
381            fidl::encoding::EmptyPayload,
382            fidl::encoding::FlexibleResultType<DeviceGetPowerConfigurationResponse, i32>,
383        >(
384            (),
385            0x8b08024ba9c2587,
386            fidl::encoding::DynamicFlags::FLEXIBLE,
387            ___deadline,
388        )?
389        .into_result::<DeviceMarker>("get_power_configuration")?;
390        Ok(_response.map(|x| x.config))
391    }
392
393    /// Returns information about the device corresponding to the node
394    /// that the driver has bound to.
395    pub fn r#get_node_device_info(
396        &self,
397        ___deadline: zx::MonotonicInstant,
398    ) -> Result<DeviceGetNodeDeviceInfoResult, fidl::Error> {
399        let _response = self.client.send_query::<
400            fidl::encoding::EmptyPayload,
401            fidl::encoding::FlexibleResultType<NodeDeviceInfo, i32>,
402        >(
403            (),
404            0x9a4e8a63ba682,
405            fidl::encoding::DynamicFlags::FLEXIBLE,
406            ___deadline,
407        )?
408        .into_result::<DeviceMarker>("get_node_device_info")?;
409        Ok(_response.map(|x| x))
410    }
411
412    /// Return information about the board the device is attached to.
413    pub fn r#get_board_info(
414        &self,
415        ___deadline: zx::MonotonicInstant,
416    ) -> Result<DeviceGetBoardInfoResult, fidl::Error> {
417        let _response = self.client.send_query::<
418            fidl::encoding::EmptyPayload,
419            fidl::encoding::FlexibleResultType<BoardInfo, i32>,
420        >(
421            (),
422            0x9140d82923eee4b,
423            fidl::encoding::DynamicFlags::FLEXIBLE,
424            ___deadline,
425        )?
426        .into_result::<DeviceMarker>("get_board_info")?;
427        Ok(_response.map(|x| x))
428    }
429
430    /// Returns the metadata associated with the device and |id|.
431    /// Returns ZX_ERR_NOT_FOUND if the metadata does not exist.
432    pub fn r#get_metadata(
433        &self,
434        mut id: &str,
435        ___deadline: zx::MonotonicInstant,
436    ) -> Result<DeviceGetMetadataResult, fidl::Error> {
437        let _response = self.client.send_query::<
438            DeviceGetMetadataRequest,
439            fidl::encoding::FlexibleResultType<DeviceGetMetadataResponse, i32>,
440        >(
441            (id,),
442            0x36e18be3a7c6cc70,
443            fidl::encoding::DynamicFlags::FLEXIBLE,
444            ___deadline,
445        )?
446        .into_result::<DeviceMarker>("get_metadata")?;
447        Ok(_response.map(|x| x.metadata))
448    }
449}
450
451#[cfg(target_os = "fuchsia")]
452impl From<DeviceSynchronousProxy> for zx::Handle {
453    fn from(value: DeviceSynchronousProxy) -> Self {
454        value.into_channel().into()
455    }
456}
457
458#[cfg(target_os = "fuchsia")]
459impl From<fidl::Channel> for DeviceSynchronousProxy {
460    fn from(value: fidl::Channel) -> Self {
461        Self::new(value)
462    }
463}
464
465#[cfg(target_os = "fuchsia")]
466impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
467    type Protocol = DeviceMarker;
468
469    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
470        Self::new(value.into_channel())
471    }
472}
473
474#[derive(Debug, Clone)]
475pub struct DeviceProxy {
476    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
477}
478
479impl fidl::endpoints::Proxy for DeviceProxy {
480    type Protocol = DeviceMarker;
481
482    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
483        Self::new(inner)
484    }
485
486    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
487        self.client.into_channel().map_err(|client| Self { client })
488    }
489
490    fn as_channel(&self) -> &::fidl::AsyncChannel {
491        self.client.as_channel()
492    }
493}
494
495impl DeviceProxy {
496    /// Create a new Proxy for fuchsia.hardware.platform.device/Device.
497    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
498        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
499        Self { client: fidl::client::Client::new(channel, protocol_name) }
500    }
501
502    /// Get a Stream of events from the remote end of the protocol.
503    ///
504    /// # Panics
505    ///
506    /// Panics if the event stream was already taken.
507    pub fn take_event_stream(&self) -> DeviceEventStream {
508        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
509    }
510
511    /// Returns a memory mapped IO (MMIO) resource for the given |index|.
512    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
513    /// mmios.
514    /// * error `ZX_ERR_INTERNAL` if the retrieved mmio is not valid.
515    /// * error `ZX_ERR_NOT_FOUND` if the retrieved mmio's base address is NULL.
516    pub fn r#get_mmio_by_id(
517        &self,
518        mut index: u32,
519    ) -> fidl::client::QueryResponseFut<
520        DeviceGetMmioByIdResult,
521        fidl::encoding::DefaultFuchsiaResourceDialect,
522    > {
523        DeviceProxyInterface::r#get_mmio_by_id(self, index)
524    }
525
526    /// Returns a memory mapped IO (MMIO) resource for the given |name|.
527    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
528    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
529    /// * error `ZX_ERR_INTERNAL` if the retrieved mmio is not valid.
530    /// * error `ZX_ERR_NOT_FOUND` if the retrieved's mmio base address is NULL.
531    pub fn r#get_mmio_by_name(
532        &self,
533        mut name: &str,
534    ) -> fidl::client::QueryResponseFut<
535        DeviceGetMmioByNameResult,
536        fidl::encoding::DefaultFuchsiaResourceDialect,
537    > {
538        DeviceProxyInterface::r#get_mmio_by_name(self, name)
539    }
540
541    /// Returns an interrupt handle for the given |index|.
542    /// |flags| is forwarded as the |options| parameter to `zx_interrupt_create`.
543    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
544    /// interrupts.
545    /// * error `ZX_ERR_INTERNAL` if the retrieved interrupt is not valid.
546    pub fn r#get_interrupt_by_id(
547        &self,
548        mut index: u32,
549        mut flags: u32,
550    ) -> fidl::client::QueryResponseFut<
551        DeviceGetInterruptByIdResult,
552        fidl::encoding::DefaultFuchsiaResourceDialect,
553    > {
554        DeviceProxyInterface::r#get_interrupt_by_id(self, index, flags)
555    }
556
557    /// Returns an interrupt handle for the given |name|.
558    /// |flags| is forwarded as the |options| parameter to `zx_interrupt_create`.
559    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
560    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
561    /// * error `ZX_ERR_INTERNAL` if the retrieved interrupt is not valid.
562    pub fn r#get_interrupt_by_name(
563        &self,
564        mut name: &str,
565        mut flags: u32,
566    ) -> fidl::client::QueryResponseFut<
567        DeviceGetInterruptByNameResult,
568        fidl::encoding::DefaultFuchsiaResourceDialect,
569    > {
570        DeviceProxyInterface::r#get_interrupt_by_name(self, name, flags)
571    }
572
573    /// Returns a bus transaction initiator (bti) handle for the given |index|.
574    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
575    /// btis.
576    /// * error `ZX_ERR_INTERNAL` if the retrieved bti is not valid.
577    pub fn r#get_bti_by_id(
578        &self,
579        mut index: u32,
580    ) -> fidl::client::QueryResponseFut<
581        DeviceGetBtiByIdResult,
582        fidl::encoding::DefaultFuchsiaResourceDialect,
583    > {
584        DeviceProxyInterface::r#get_bti_by_id(self, index)
585    }
586
587    /// Returns a bus transaction initiator (bti) handle for the given |name|.
588    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
589    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
590    /// * error `ZX_ERR_INTERNAL` if the retrieved bti is not valid.
591    pub fn r#get_bti_by_name(
592        &self,
593        mut name: &str,
594    ) -> fidl::client::QueryResponseFut<
595        DeviceGetBtiByNameResult,
596        fidl::encoding::DefaultFuchsiaResourceDialect,
597    > {
598        DeviceProxyInterface::r#get_bti_by_name(self, name)
599    }
600
601    /// Returns a secure monitor call (smc) handle for the given |index|.
602    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
603    /// smcs.
604    /// * error `ZX_ERR_INTERNAL` if the retrieved smc is not valid.
605    pub fn r#get_smc_by_id(
606        &self,
607        mut index: u32,
608    ) -> fidl::client::QueryResponseFut<
609        DeviceGetSmcByIdResult,
610        fidl::encoding::DefaultFuchsiaResourceDialect,
611    > {
612        DeviceProxyInterface::r#get_smc_by_id(self, index)
613    }
614
615    /// Returns a secure monitor call (smc) handle for the given |name|.
616    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
617    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
618    /// * error `ZX_ERR_INTERNAL` if the retrieved smc is not valid.
619    pub fn r#get_smc_by_name(
620        &self,
621        mut name: &str,
622    ) -> fidl::client::QueryResponseFut<
623        DeviceGetSmcByNameResult,
624        fidl::encoding::DefaultFuchsiaResourceDialect,
625    > {
626        DeviceProxyInterface::r#get_smc_by_name(self, name)
627    }
628
629    /// Returns power configuration for the device the driver has bound to.
630    pub fn r#get_power_configuration(
631        &self,
632    ) -> fidl::client::QueryResponseFut<
633        DeviceGetPowerConfigurationResult,
634        fidl::encoding::DefaultFuchsiaResourceDialect,
635    > {
636        DeviceProxyInterface::r#get_power_configuration(self)
637    }
638
639    /// Returns information about the device corresponding to the node
640    /// that the driver has bound to.
641    pub fn r#get_node_device_info(
642        &self,
643    ) -> fidl::client::QueryResponseFut<
644        DeviceGetNodeDeviceInfoResult,
645        fidl::encoding::DefaultFuchsiaResourceDialect,
646    > {
647        DeviceProxyInterface::r#get_node_device_info(self)
648    }
649
650    /// Return information about the board the device is attached to.
651    pub fn r#get_board_info(
652        &self,
653    ) -> fidl::client::QueryResponseFut<
654        DeviceGetBoardInfoResult,
655        fidl::encoding::DefaultFuchsiaResourceDialect,
656    > {
657        DeviceProxyInterface::r#get_board_info(self)
658    }
659
660    /// Returns the metadata associated with the device and |id|.
661    /// Returns ZX_ERR_NOT_FOUND if the metadata does not exist.
662    pub fn r#get_metadata(
663        &self,
664        mut id: &str,
665    ) -> fidl::client::QueryResponseFut<
666        DeviceGetMetadataResult,
667        fidl::encoding::DefaultFuchsiaResourceDialect,
668    > {
669        DeviceProxyInterface::r#get_metadata(self, id)
670    }
671}
672
673impl DeviceProxyInterface for DeviceProxy {
674    type GetMmioByIdResponseFut = fidl::client::QueryResponseFut<
675        DeviceGetMmioByIdResult,
676        fidl::encoding::DefaultFuchsiaResourceDialect,
677    >;
678    fn r#get_mmio_by_id(&self, mut index: u32) -> Self::GetMmioByIdResponseFut {
679        fn _decode(
680            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
681        ) -> Result<DeviceGetMmioByIdResult, fidl::Error> {
682            let _response = fidl::client::decode_transaction_body::<
683                fidl::encoding::FlexibleResultType<Mmio, i32>,
684                fidl::encoding::DefaultFuchsiaResourceDialect,
685                0x2fe2767f0aeec203,
686            >(_buf?)?
687            .into_result::<DeviceMarker>("get_mmio_by_id")?;
688            Ok(_response.map(|x| x))
689        }
690        self.client.send_query_and_decode::<DeviceGetMmioByIdRequest, DeviceGetMmioByIdResult>(
691            (index,),
692            0x2fe2767f0aeec203,
693            fidl::encoding::DynamicFlags::FLEXIBLE,
694            _decode,
695        )
696    }
697
698    type GetMmioByNameResponseFut = fidl::client::QueryResponseFut<
699        DeviceGetMmioByNameResult,
700        fidl::encoding::DefaultFuchsiaResourceDialect,
701    >;
702    fn r#get_mmio_by_name(&self, mut name: &str) -> Self::GetMmioByNameResponseFut {
703        fn _decode(
704            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
705        ) -> Result<DeviceGetMmioByNameResult, fidl::Error> {
706            let _response = fidl::client::decode_transaction_body::<
707                fidl::encoding::FlexibleResultType<Mmio, i32>,
708                fidl::encoding::DefaultFuchsiaResourceDialect,
709                0x27dc17076e665076,
710            >(_buf?)?
711            .into_result::<DeviceMarker>("get_mmio_by_name")?;
712            Ok(_response.map(|x| x))
713        }
714        self.client.send_query_and_decode::<DeviceGetMmioByNameRequest, DeviceGetMmioByNameResult>(
715            (name,),
716            0x27dc17076e665076,
717            fidl::encoding::DynamicFlags::FLEXIBLE,
718            _decode,
719        )
720    }
721
722    type GetInterruptByIdResponseFut = fidl::client::QueryResponseFut<
723        DeviceGetInterruptByIdResult,
724        fidl::encoding::DefaultFuchsiaResourceDialect,
725    >;
726    fn r#get_interrupt_by_id(
727        &self,
728        mut index: u32,
729        mut flags: u32,
730    ) -> Self::GetInterruptByIdResponseFut {
731        fn _decode(
732            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
733        ) -> Result<DeviceGetInterruptByIdResult, fidl::Error> {
734            let _response = fidl::client::decode_transaction_body::<
735                fidl::encoding::FlexibleResultType<DeviceGetInterruptByIdResponse, i32>,
736                fidl::encoding::DefaultFuchsiaResourceDialect,
737                0x4af1d7ccf7a4a4bc,
738            >(_buf?)?
739            .into_result::<DeviceMarker>("get_interrupt_by_id")?;
740            Ok(_response.map(|x| x.irq))
741        }
742        self.client
743            .send_query_and_decode::<DeviceGetInterruptByIdRequest, DeviceGetInterruptByIdResult>(
744                (index, flags),
745                0x4af1d7ccf7a4a4bc,
746                fidl::encoding::DynamicFlags::FLEXIBLE,
747                _decode,
748            )
749    }
750
751    type GetInterruptByNameResponseFut = fidl::client::QueryResponseFut<
752        DeviceGetInterruptByNameResult,
753        fidl::encoding::DefaultFuchsiaResourceDialect,
754    >;
755    fn r#get_interrupt_by_name(
756        &self,
757        mut name: &str,
758        mut flags: u32,
759    ) -> Self::GetInterruptByNameResponseFut {
760        fn _decode(
761            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
762        ) -> Result<DeviceGetInterruptByNameResult, fidl::Error> {
763            let _response = fidl::client::decode_transaction_body::<
764                fidl::encoding::FlexibleResultType<DeviceGetInterruptByNameResponse, i32>,
765                fidl::encoding::DefaultFuchsiaResourceDialect,
766                0x165fbc6619b2b64f,
767            >(_buf?)?
768            .into_result::<DeviceMarker>("get_interrupt_by_name")?;
769            Ok(_response.map(|x| x.irq))
770        }
771        self.client.send_query_and_decode::<
772            DeviceGetInterruptByNameRequest,
773            DeviceGetInterruptByNameResult,
774        >(
775            (name, flags,),
776            0x165fbc6619b2b64f,
777            fidl::encoding::DynamicFlags::FLEXIBLE,
778            _decode,
779        )
780    }
781
782    type GetBtiByIdResponseFut = fidl::client::QueryResponseFut<
783        DeviceGetBtiByIdResult,
784        fidl::encoding::DefaultFuchsiaResourceDialect,
785    >;
786    fn r#get_bti_by_id(&self, mut index: u32) -> Self::GetBtiByIdResponseFut {
787        fn _decode(
788            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
789        ) -> Result<DeviceGetBtiByIdResult, fidl::Error> {
790            let _response = fidl::client::decode_transaction_body::<
791                fidl::encoding::FlexibleResultType<DeviceGetBtiByIdResponse, i32>,
792                fidl::encoding::DefaultFuchsiaResourceDialect,
793                0x7b4518a90bcd5463,
794            >(_buf?)?
795            .into_result::<DeviceMarker>("get_bti_by_id")?;
796            Ok(_response.map(|x| x.bti))
797        }
798        self.client.send_query_and_decode::<DeviceGetBtiByIdRequest, DeviceGetBtiByIdResult>(
799            (index,),
800            0x7b4518a90bcd5463,
801            fidl::encoding::DynamicFlags::FLEXIBLE,
802            _decode,
803        )
804    }
805
806    type GetBtiByNameResponseFut = fidl::client::QueryResponseFut<
807        DeviceGetBtiByNameResult,
808        fidl::encoding::DefaultFuchsiaResourceDialect,
809    >;
810    fn r#get_bti_by_name(&self, mut name: &str) -> Self::GetBtiByNameResponseFut {
811        fn _decode(
812            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
813        ) -> Result<DeviceGetBtiByNameResult, fidl::Error> {
814            let _response = fidl::client::decode_transaction_body::<
815                fidl::encoding::FlexibleResultType<DeviceGetBtiByNameResponse, i32>,
816                fidl::encoding::DefaultFuchsiaResourceDialect,
817                0x358f37bd43460531,
818            >(_buf?)?
819            .into_result::<DeviceMarker>("get_bti_by_name")?;
820            Ok(_response.map(|x| x.bti))
821        }
822        self.client.send_query_and_decode::<DeviceGetBtiByNameRequest, DeviceGetBtiByNameResult>(
823            (name,),
824            0x358f37bd43460531,
825            fidl::encoding::DynamicFlags::FLEXIBLE,
826            _decode,
827        )
828    }
829
830    type GetSmcByIdResponseFut = fidl::client::QueryResponseFut<
831        DeviceGetSmcByIdResult,
832        fidl::encoding::DefaultFuchsiaResourceDialect,
833    >;
834    fn r#get_smc_by_id(&self, mut index: u32) -> Self::GetSmcByIdResponseFut {
835        fn _decode(
836            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
837        ) -> Result<DeviceGetSmcByIdResult, fidl::Error> {
838            let _response = fidl::client::decode_transaction_body::<
839                fidl::encoding::FlexibleResultType<DeviceGetSmcByIdResponse, i32>,
840                fidl::encoding::DefaultFuchsiaResourceDialect,
841                0x40e6da56a39e0e34,
842            >(_buf?)?
843            .into_result::<DeviceMarker>("get_smc_by_id")?;
844            Ok(_response.map(|x| x.smc))
845        }
846        self.client.send_query_and_decode::<DeviceGetSmcByIdRequest, DeviceGetSmcByIdResult>(
847            (index,),
848            0x40e6da56a39e0e34,
849            fidl::encoding::DynamicFlags::FLEXIBLE,
850            _decode,
851        )
852    }
853
854    type GetSmcByNameResponseFut = fidl::client::QueryResponseFut<
855        DeviceGetSmcByNameResult,
856        fidl::encoding::DefaultFuchsiaResourceDialect,
857    >;
858    fn r#get_smc_by_name(&self, mut name: &str) -> Self::GetSmcByNameResponseFut {
859        fn _decode(
860            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
861        ) -> Result<DeviceGetSmcByNameResult, fidl::Error> {
862            let _response = fidl::client::decode_transaction_body::<
863                fidl::encoding::FlexibleResultType<DeviceGetSmcByNameResponse, i32>,
864                fidl::encoding::DefaultFuchsiaResourceDialect,
865                0x3e13238c0bba6da2,
866            >(_buf?)?
867            .into_result::<DeviceMarker>("get_smc_by_name")?;
868            Ok(_response.map(|x| x.smc))
869        }
870        self.client.send_query_and_decode::<DeviceGetSmcByNameRequest, DeviceGetSmcByNameResult>(
871            (name,),
872            0x3e13238c0bba6da2,
873            fidl::encoding::DynamicFlags::FLEXIBLE,
874            _decode,
875        )
876    }
877
878    type GetPowerConfigurationResponseFut = fidl::client::QueryResponseFut<
879        DeviceGetPowerConfigurationResult,
880        fidl::encoding::DefaultFuchsiaResourceDialect,
881    >;
882    fn r#get_power_configuration(&self) -> Self::GetPowerConfigurationResponseFut {
883        fn _decode(
884            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
885        ) -> Result<DeviceGetPowerConfigurationResult, fidl::Error> {
886            let _response = fidl::client::decode_transaction_body::<
887                fidl::encoding::FlexibleResultType<DeviceGetPowerConfigurationResponse, i32>,
888                fidl::encoding::DefaultFuchsiaResourceDialect,
889                0x8b08024ba9c2587,
890            >(_buf?)?
891            .into_result::<DeviceMarker>("get_power_configuration")?;
892            Ok(_response.map(|x| x.config))
893        }
894        self.client.send_query_and_decode::<
895            fidl::encoding::EmptyPayload,
896            DeviceGetPowerConfigurationResult,
897        >(
898            (),
899            0x8b08024ba9c2587,
900            fidl::encoding::DynamicFlags::FLEXIBLE,
901            _decode,
902        )
903    }
904
905    type GetNodeDeviceInfoResponseFut = fidl::client::QueryResponseFut<
906        DeviceGetNodeDeviceInfoResult,
907        fidl::encoding::DefaultFuchsiaResourceDialect,
908    >;
909    fn r#get_node_device_info(&self) -> Self::GetNodeDeviceInfoResponseFut {
910        fn _decode(
911            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
912        ) -> Result<DeviceGetNodeDeviceInfoResult, fidl::Error> {
913            let _response = fidl::client::decode_transaction_body::<
914                fidl::encoding::FlexibleResultType<NodeDeviceInfo, i32>,
915                fidl::encoding::DefaultFuchsiaResourceDialect,
916                0x9a4e8a63ba682,
917            >(_buf?)?
918            .into_result::<DeviceMarker>("get_node_device_info")?;
919            Ok(_response.map(|x| x))
920        }
921        self.client
922            .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetNodeDeviceInfoResult>(
923                (),
924                0x9a4e8a63ba682,
925                fidl::encoding::DynamicFlags::FLEXIBLE,
926                _decode,
927            )
928    }
929
930    type GetBoardInfoResponseFut = fidl::client::QueryResponseFut<
931        DeviceGetBoardInfoResult,
932        fidl::encoding::DefaultFuchsiaResourceDialect,
933    >;
934    fn r#get_board_info(&self) -> Self::GetBoardInfoResponseFut {
935        fn _decode(
936            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
937        ) -> Result<DeviceGetBoardInfoResult, fidl::Error> {
938            let _response = fidl::client::decode_transaction_body::<
939                fidl::encoding::FlexibleResultType<BoardInfo, i32>,
940                fidl::encoding::DefaultFuchsiaResourceDialect,
941                0x9140d82923eee4b,
942            >(_buf?)?
943            .into_result::<DeviceMarker>("get_board_info")?;
944            Ok(_response.map(|x| x))
945        }
946        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetBoardInfoResult>(
947            (),
948            0x9140d82923eee4b,
949            fidl::encoding::DynamicFlags::FLEXIBLE,
950            _decode,
951        )
952    }
953
954    type GetMetadataResponseFut = fidl::client::QueryResponseFut<
955        DeviceGetMetadataResult,
956        fidl::encoding::DefaultFuchsiaResourceDialect,
957    >;
958    fn r#get_metadata(&self, mut id: &str) -> Self::GetMetadataResponseFut {
959        fn _decode(
960            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
961        ) -> Result<DeviceGetMetadataResult, fidl::Error> {
962            let _response = fidl::client::decode_transaction_body::<
963                fidl::encoding::FlexibleResultType<DeviceGetMetadataResponse, i32>,
964                fidl::encoding::DefaultFuchsiaResourceDialect,
965                0x36e18be3a7c6cc70,
966            >(_buf?)?
967            .into_result::<DeviceMarker>("get_metadata")?;
968            Ok(_response.map(|x| x.metadata))
969        }
970        self.client.send_query_and_decode::<DeviceGetMetadataRequest, DeviceGetMetadataResult>(
971            (id,),
972            0x36e18be3a7c6cc70,
973            fidl::encoding::DynamicFlags::FLEXIBLE,
974            _decode,
975        )
976    }
977}
978
979pub struct DeviceEventStream {
980    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
981}
982
983impl std::marker::Unpin for DeviceEventStream {}
984
985impl futures::stream::FusedStream for DeviceEventStream {
986    fn is_terminated(&self) -> bool {
987        self.event_receiver.is_terminated()
988    }
989}
990
991impl futures::Stream for DeviceEventStream {
992    type Item = Result<DeviceEvent, fidl::Error>;
993
994    fn poll_next(
995        mut self: std::pin::Pin<&mut Self>,
996        cx: &mut std::task::Context<'_>,
997    ) -> std::task::Poll<Option<Self::Item>> {
998        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
999            &mut self.event_receiver,
1000            cx
1001        )?) {
1002            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1003            None => std::task::Poll::Ready(None),
1004        }
1005    }
1006}
1007
1008#[derive(Debug)]
1009pub enum DeviceEvent {
1010    #[non_exhaustive]
1011    _UnknownEvent {
1012        /// Ordinal of the event that was sent.
1013        ordinal: u64,
1014    },
1015}
1016
1017impl DeviceEvent {
1018    /// Decodes a message buffer as a [`DeviceEvent`].
1019    fn decode(
1020        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1021    ) -> Result<DeviceEvent, fidl::Error> {
1022        let (bytes, _handles) = buf.split_mut();
1023        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1024        debug_assert_eq!(tx_header.tx_id, 0);
1025        match tx_header.ordinal {
1026            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1027                Ok(DeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1028            }
1029            _ => Err(fidl::Error::UnknownOrdinal {
1030                ordinal: tx_header.ordinal,
1031                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1032            }),
1033        }
1034    }
1035}
1036
1037/// A Stream of incoming requests for fuchsia.hardware.platform.device/Device.
1038pub struct DeviceRequestStream {
1039    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1040    is_terminated: bool,
1041}
1042
1043impl std::marker::Unpin for DeviceRequestStream {}
1044
1045impl futures::stream::FusedStream for DeviceRequestStream {
1046    fn is_terminated(&self) -> bool {
1047        self.is_terminated
1048    }
1049}
1050
1051impl fidl::endpoints::RequestStream for DeviceRequestStream {
1052    type Protocol = DeviceMarker;
1053    type ControlHandle = DeviceControlHandle;
1054
1055    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1056        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1057    }
1058
1059    fn control_handle(&self) -> Self::ControlHandle {
1060        DeviceControlHandle { inner: self.inner.clone() }
1061    }
1062
1063    fn into_inner(
1064        self,
1065    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1066    {
1067        (self.inner, self.is_terminated)
1068    }
1069
1070    fn from_inner(
1071        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1072        is_terminated: bool,
1073    ) -> Self {
1074        Self { inner, is_terminated }
1075    }
1076}
1077
1078impl futures::Stream for DeviceRequestStream {
1079    type Item = Result<DeviceRequest, fidl::Error>;
1080
1081    fn poll_next(
1082        mut self: std::pin::Pin<&mut Self>,
1083        cx: &mut std::task::Context<'_>,
1084    ) -> std::task::Poll<Option<Self::Item>> {
1085        let this = &mut *self;
1086        if this.inner.check_shutdown(cx) {
1087            this.is_terminated = true;
1088            return std::task::Poll::Ready(None);
1089        }
1090        if this.is_terminated {
1091            panic!("polled DeviceRequestStream after completion");
1092        }
1093        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1094            |bytes, handles| {
1095                match this.inner.channel().read_etc(cx, bytes, handles) {
1096                    std::task::Poll::Ready(Ok(())) => {}
1097                    std::task::Poll::Pending => return std::task::Poll::Pending,
1098                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1099                        this.is_terminated = true;
1100                        return std::task::Poll::Ready(None);
1101                    }
1102                    std::task::Poll::Ready(Err(e)) => {
1103                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1104                            e.into(),
1105                        ))));
1106                    }
1107                }
1108
1109                // A message has been received from the channel
1110                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1111
1112                std::task::Poll::Ready(Some(match header.ordinal {
1113                    0x2fe2767f0aeec203 => {
1114                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1115                        let mut req = fidl::new_empty!(
1116                            DeviceGetMmioByIdRequest,
1117                            fidl::encoding::DefaultFuchsiaResourceDialect
1118                        );
1119                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetMmioByIdRequest>(&header, _body_bytes, handles, &mut req)?;
1120                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1121                        Ok(DeviceRequest::GetMmioById {
1122                            index: req.index,
1123
1124                            responder: DeviceGetMmioByIdResponder {
1125                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1126                                tx_id: header.tx_id,
1127                            },
1128                        })
1129                    }
1130                    0x27dc17076e665076 => {
1131                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1132                        let mut req = fidl::new_empty!(
1133                            DeviceGetMmioByNameRequest,
1134                            fidl::encoding::DefaultFuchsiaResourceDialect
1135                        );
1136                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetMmioByNameRequest>(&header, _body_bytes, handles, &mut req)?;
1137                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1138                        Ok(DeviceRequest::GetMmioByName {
1139                            name: req.name,
1140
1141                            responder: DeviceGetMmioByNameResponder {
1142                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1143                                tx_id: header.tx_id,
1144                            },
1145                        })
1146                    }
1147                    0x4af1d7ccf7a4a4bc => {
1148                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1149                        let mut req = fidl::new_empty!(
1150                            DeviceGetInterruptByIdRequest,
1151                            fidl::encoding::DefaultFuchsiaResourceDialect
1152                        );
1153                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetInterruptByIdRequest>(&header, _body_bytes, handles, &mut req)?;
1154                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1155                        Ok(DeviceRequest::GetInterruptById {
1156                            index: req.index,
1157                            flags: req.flags,
1158
1159                            responder: DeviceGetInterruptByIdResponder {
1160                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1161                                tx_id: header.tx_id,
1162                            },
1163                        })
1164                    }
1165                    0x165fbc6619b2b64f => {
1166                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1167                        let mut req = fidl::new_empty!(
1168                            DeviceGetInterruptByNameRequest,
1169                            fidl::encoding::DefaultFuchsiaResourceDialect
1170                        );
1171                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetInterruptByNameRequest>(&header, _body_bytes, handles, &mut req)?;
1172                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1173                        Ok(DeviceRequest::GetInterruptByName {
1174                            name: req.name,
1175                            flags: req.flags,
1176
1177                            responder: DeviceGetInterruptByNameResponder {
1178                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1179                                tx_id: header.tx_id,
1180                            },
1181                        })
1182                    }
1183                    0x7b4518a90bcd5463 => {
1184                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1185                        let mut req = fidl::new_empty!(
1186                            DeviceGetBtiByIdRequest,
1187                            fidl::encoding::DefaultFuchsiaResourceDialect
1188                        );
1189                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBtiByIdRequest>(&header, _body_bytes, handles, &mut req)?;
1190                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1191                        Ok(DeviceRequest::GetBtiById {
1192                            index: req.index,
1193
1194                            responder: DeviceGetBtiByIdResponder {
1195                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1196                                tx_id: header.tx_id,
1197                            },
1198                        })
1199                    }
1200                    0x358f37bd43460531 => {
1201                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1202                        let mut req = fidl::new_empty!(
1203                            DeviceGetBtiByNameRequest,
1204                            fidl::encoding::DefaultFuchsiaResourceDialect
1205                        );
1206                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBtiByNameRequest>(&header, _body_bytes, handles, &mut req)?;
1207                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1208                        Ok(DeviceRequest::GetBtiByName {
1209                            name: req.name,
1210
1211                            responder: DeviceGetBtiByNameResponder {
1212                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1213                                tx_id: header.tx_id,
1214                            },
1215                        })
1216                    }
1217                    0x40e6da56a39e0e34 => {
1218                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1219                        let mut req = fidl::new_empty!(
1220                            DeviceGetSmcByIdRequest,
1221                            fidl::encoding::DefaultFuchsiaResourceDialect
1222                        );
1223                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetSmcByIdRequest>(&header, _body_bytes, handles, &mut req)?;
1224                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1225                        Ok(DeviceRequest::GetSmcById {
1226                            index: req.index,
1227
1228                            responder: DeviceGetSmcByIdResponder {
1229                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1230                                tx_id: header.tx_id,
1231                            },
1232                        })
1233                    }
1234                    0x3e13238c0bba6da2 => {
1235                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1236                        let mut req = fidl::new_empty!(
1237                            DeviceGetSmcByNameRequest,
1238                            fidl::encoding::DefaultFuchsiaResourceDialect
1239                        );
1240                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetSmcByNameRequest>(&header, _body_bytes, handles, &mut req)?;
1241                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1242                        Ok(DeviceRequest::GetSmcByName {
1243                            name: req.name,
1244
1245                            responder: DeviceGetSmcByNameResponder {
1246                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1247                                tx_id: header.tx_id,
1248                            },
1249                        })
1250                    }
1251                    0x8b08024ba9c2587 => {
1252                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1253                        let mut req = fidl::new_empty!(
1254                            fidl::encoding::EmptyPayload,
1255                            fidl::encoding::DefaultFuchsiaResourceDialect
1256                        );
1257                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1258                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1259                        Ok(DeviceRequest::GetPowerConfiguration {
1260                            responder: DeviceGetPowerConfigurationResponder {
1261                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1262                                tx_id: header.tx_id,
1263                            },
1264                        })
1265                    }
1266                    0x9a4e8a63ba682 => {
1267                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1268                        let mut req = fidl::new_empty!(
1269                            fidl::encoding::EmptyPayload,
1270                            fidl::encoding::DefaultFuchsiaResourceDialect
1271                        );
1272                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1273                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1274                        Ok(DeviceRequest::GetNodeDeviceInfo {
1275                            responder: DeviceGetNodeDeviceInfoResponder {
1276                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1277                                tx_id: header.tx_id,
1278                            },
1279                        })
1280                    }
1281                    0x9140d82923eee4b => {
1282                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1283                        let mut req = fidl::new_empty!(
1284                            fidl::encoding::EmptyPayload,
1285                            fidl::encoding::DefaultFuchsiaResourceDialect
1286                        );
1287                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1288                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1289                        Ok(DeviceRequest::GetBoardInfo {
1290                            responder: DeviceGetBoardInfoResponder {
1291                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1292                                tx_id: header.tx_id,
1293                            },
1294                        })
1295                    }
1296                    0x36e18be3a7c6cc70 => {
1297                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1298                        let mut req = fidl::new_empty!(
1299                            DeviceGetMetadataRequest,
1300                            fidl::encoding::DefaultFuchsiaResourceDialect
1301                        );
1302                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetMetadataRequest>(&header, _body_bytes, handles, &mut req)?;
1303                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1304                        Ok(DeviceRequest::GetMetadata {
1305                            id: req.id,
1306
1307                            responder: DeviceGetMetadataResponder {
1308                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1309                                tx_id: header.tx_id,
1310                            },
1311                        })
1312                    }
1313                    _ if header.tx_id == 0
1314                        && header
1315                            .dynamic_flags()
1316                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1317                    {
1318                        Ok(DeviceRequest::_UnknownMethod {
1319                            ordinal: header.ordinal,
1320                            control_handle: DeviceControlHandle { inner: this.inner.clone() },
1321                            method_type: fidl::MethodType::OneWay,
1322                        })
1323                    }
1324                    _ if header
1325                        .dynamic_flags()
1326                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1327                    {
1328                        this.inner.send_framework_err(
1329                            fidl::encoding::FrameworkErr::UnknownMethod,
1330                            header.tx_id,
1331                            header.ordinal,
1332                            header.dynamic_flags(),
1333                            (bytes, handles),
1334                        )?;
1335                        Ok(DeviceRequest::_UnknownMethod {
1336                            ordinal: header.ordinal,
1337                            control_handle: DeviceControlHandle { inner: this.inner.clone() },
1338                            method_type: fidl::MethodType::TwoWay,
1339                        })
1340                    }
1341                    _ => Err(fidl::Error::UnknownOrdinal {
1342                        ordinal: header.ordinal,
1343                        protocol_name:
1344                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1345                    }),
1346                }))
1347            },
1348        )
1349    }
1350}
1351
1352#[derive(Debug)]
1353pub enum DeviceRequest {
1354    /// Returns a memory mapped IO (MMIO) resource for the given |index|.
1355    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
1356    /// mmios.
1357    /// * error `ZX_ERR_INTERNAL` if the retrieved mmio is not valid.
1358    /// * error `ZX_ERR_NOT_FOUND` if the retrieved mmio's base address is NULL.
1359    GetMmioById { index: u32, responder: DeviceGetMmioByIdResponder },
1360    /// Returns a memory mapped IO (MMIO) resource for the given |name|.
1361    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
1362    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
1363    /// * error `ZX_ERR_INTERNAL` if the retrieved mmio is not valid.
1364    /// * error `ZX_ERR_NOT_FOUND` if the retrieved's mmio base address is NULL.
1365    GetMmioByName { name: String, responder: DeviceGetMmioByNameResponder },
1366    /// Returns an interrupt handle for the given |index|.
1367    /// |flags| is forwarded as the |options| parameter to `zx_interrupt_create`.
1368    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
1369    /// interrupts.
1370    /// * error `ZX_ERR_INTERNAL` if the retrieved interrupt is not valid.
1371    GetInterruptById { index: u32, flags: u32, responder: DeviceGetInterruptByIdResponder },
1372    /// Returns an interrupt handle for the given |name|.
1373    /// |flags| is forwarded as the |options| parameter to `zx_interrupt_create`.
1374    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
1375    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
1376    /// * error `ZX_ERR_INTERNAL` if the retrieved interrupt is not valid.
1377    GetInterruptByName { name: String, flags: u32, responder: DeviceGetInterruptByNameResponder },
1378    /// Returns a bus transaction initiator (bti) handle for the given |index|.
1379    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
1380    /// btis.
1381    /// * error `ZX_ERR_INTERNAL` if the retrieved bti is not valid.
1382    GetBtiById { index: u32, responder: DeviceGetBtiByIdResponder },
1383    /// Returns a bus transaction initiator (bti) handle for the given |name|.
1384    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
1385    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
1386    /// * error `ZX_ERR_INTERNAL` if the retrieved bti is not valid.
1387    GetBtiByName { name: String, responder: DeviceGetBtiByNameResponder },
1388    /// Returns a secure monitor call (smc) handle for the given |index|.
1389    /// * error `ZX_ERR_OUT_OF_RANGE` if |index| is equal or greater than the number of
1390    /// smcs.
1391    /// * error `ZX_ERR_INTERNAL` if the retrieved smc is not valid.
1392    GetSmcById { index: u32, responder: DeviceGetSmcByIdResponder },
1393    /// Returns a secure monitor call (smc) handle for the given |name|.
1394    /// * error `ZX_ERR_INVALID_ARGS` if |name| is an empty string.
1395    /// * error `ZX_ERR_OUT_OF_RANGE` if |name| is not found.
1396    /// * error `ZX_ERR_INTERNAL` if the retrieved smc is not valid.
1397    GetSmcByName { name: String, responder: DeviceGetSmcByNameResponder },
1398    /// Returns power configuration for the device the driver has bound to.
1399    GetPowerConfiguration { responder: DeviceGetPowerConfigurationResponder },
1400    /// Returns information about the device corresponding to the node
1401    /// that the driver has bound to.
1402    GetNodeDeviceInfo { responder: DeviceGetNodeDeviceInfoResponder },
1403    /// Return information about the board the device is attached to.
1404    GetBoardInfo { responder: DeviceGetBoardInfoResponder },
1405    /// Returns the metadata associated with the device and |id|.
1406    /// Returns ZX_ERR_NOT_FOUND if the metadata does not exist.
1407    GetMetadata { id: String, responder: DeviceGetMetadataResponder },
1408    /// An interaction was received which does not match any known method.
1409    #[non_exhaustive]
1410    _UnknownMethod {
1411        /// Ordinal of the method that was called.
1412        ordinal: u64,
1413        control_handle: DeviceControlHandle,
1414        method_type: fidl::MethodType,
1415    },
1416}
1417
1418impl DeviceRequest {
1419    #[allow(irrefutable_let_patterns)]
1420    pub fn into_get_mmio_by_id(self) -> Option<(u32, DeviceGetMmioByIdResponder)> {
1421        if let DeviceRequest::GetMmioById { index, responder } = self {
1422            Some((index, responder))
1423        } else {
1424            None
1425        }
1426    }
1427
1428    #[allow(irrefutable_let_patterns)]
1429    pub fn into_get_mmio_by_name(self) -> Option<(String, DeviceGetMmioByNameResponder)> {
1430        if let DeviceRequest::GetMmioByName { name, responder } = self {
1431            Some((name, responder))
1432        } else {
1433            None
1434        }
1435    }
1436
1437    #[allow(irrefutable_let_patterns)]
1438    pub fn into_get_interrupt_by_id(self) -> Option<(u32, u32, DeviceGetInterruptByIdResponder)> {
1439        if let DeviceRequest::GetInterruptById { index, flags, responder } = self {
1440            Some((index, flags, responder))
1441        } else {
1442            None
1443        }
1444    }
1445
1446    #[allow(irrefutable_let_patterns)]
1447    pub fn into_get_interrupt_by_name(
1448        self,
1449    ) -> Option<(String, u32, DeviceGetInterruptByNameResponder)> {
1450        if let DeviceRequest::GetInterruptByName { name, flags, responder } = self {
1451            Some((name, flags, responder))
1452        } else {
1453            None
1454        }
1455    }
1456
1457    #[allow(irrefutable_let_patterns)]
1458    pub fn into_get_bti_by_id(self) -> Option<(u32, DeviceGetBtiByIdResponder)> {
1459        if let DeviceRequest::GetBtiById { index, responder } = self {
1460            Some((index, responder))
1461        } else {
1462            None
1463        }
1464    }
1465
1466    #[allow(irrefutable_let_patterns)]
1467    pub fn into_get_bti_by_name(self) -> Option<(String, DeviceGetBtiByNameResponder)> {
1468        if let DeviceRequest::GetBtiByName { name, responder } = self {
1469            Some((name, responder))
1470        } else {
1471            None
1472        }
1473    }
1474
1475    #[allow(irrefutable_let_patterns)]
1476    pub fn into_get_smc_by_id(self) -> Option<(u32, DeviceGetSmcByIdResponder)> {
1477        if let DeviceRequest::GetSmcById { index, responder } = self {
1478            Some((index, responder))
1479        } else {
1480            None
1481        }
1482    }
1483
1484    #[allow(irrefutable_let_patterns)]
1485    pub fn into_get_smc_by_name(self) -> Option<(String, DeviceGetSmcByNameResponder)> {
1486        if let DeviceRequest::GetSmcByName { name, responder } = self {
1487            Some((name, responder))
1488        } else {
1489            None
1490        }
1491    }
1492
1493    #[allow(irrefutable_let_patterns)]
1494    pub fn into_get_power_configuration(self) -> Option<(DeviceGetPowerConfigurationResponder)> {
1495        if let DeviceRequest::GetPowerConfiguration { responder } = self {
1496            Some((responder))
1497        } else {
1498            None
1499        }
1500    }
1501
1502    #[allow(irrefutable_let_patterns)]
1503    pub fn into_get_node_device_info(self) -> Option<(DeviceGetNodeDeviceInfoResponder)> {
1504        if let DeviceRequest::GetNodeDeviceInfo { responder } = self {
1505            Some((responder))
1506        } else {
1507            None
1508        }
1509    }
1510
1511    #[allow(irrefutable_let_patterns)]
1512    pub fn into_get_board_info(self) -> Option<(DeviceGetBoardInfoResponder)> {
1513        if let DeviceRequest::GetBoardInfo { responder } = self { Some((responder)) } else { None }
1514    }
1515
1516    #[allow(irrefutable_let_patterns)]
1517    pub fn into_get_metadata(self) -> Option<(String, DeviceGetMetadataResponder)> {
1518        if let DeviceRequest::GetMetadata { id, responder } = self {
1519            Some((id, responder))
1520        } else {
1521            None
1522        }
1523    }
1524
1525    /// Name of the method defined in FIDL
1526    pub fn method_name(&self) -> &'static str {
1527        match *self {
1528            DeviceRequest::GetMmioById { .. } => "get_mmio_by_id",
1529            DeviceRequest::GetMmioByName { .. } => "get_mmio_by_name",
1530            DeviceRequest::GetInterruptById { .. } => "get_interrupt_by_id",
1531            DeviceRequest::GetInterruptByName { .. } => "get_interrupt_by_name",
1532            DeviceRequest::GetBtiById { .. } => "get_bti_by_id",
1533            DeviceRequest::GetBtiByName { .. } => "get_bti_by_name",
1534            DeviceRequest::GetSmcById { .. } => "get_smc_by_id",
1535            DeviceRequest::GetSmcByName { .. } => "get_smc_by_name",
1536            DeviceRequest::GetPowerConfiguration { .. } => "get_power_configuration",
1537            DeviceRequest::GetNodeDeviceInfo { .. } => "get_node_device_info",
1538            DeviceRequest::GetBoardInfo { .. } => "get_board_info",
1539            DeviceRequest::GetMetadata { .. } => "get_metadata",
1540            DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1541                "unknown one-way method"
1542            }
1543            DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1544                "unknown two-way method"
1545            }
1546        }
1547    }
1548}
1549
1550#[derive(Debug, Clone)]
1551pub struct DeviceControlHandle {
1552    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1553}
1554
1555impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1556    fn shutdown(&self) {
1557        self.inner.shutdown()
1558    }
1559    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1560        self.inner.shutdown_with_epitaph(status)
1561    }
1562
1563    fn is_closed(&self) -> bool {
1564        self.inner.channel().is_closed()
1565    }
1566    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1567        self.inner.channel().on_closed()
1568    }
1569
1570    #[cfg(target_os = "fuchsia")]
1571    fn signal_peer(
1572        &self,
1573        clear_mask: zx::Signals,
1574        set_mask: zx::Signals,
1575    ) -> Result<(), zx_status::Status> {
1576        use fidl::Peered;
1577        self.inner.channel().signal_peer(clear_mask, set_mask)
1578    }
1579}
1580
1581impl DeviceControlHandle {}
1582
1583#[must_use = "FIDL methods require a response to be sent"]
1584#[derive(Debug)]
1585pub struct DeviceGetMmioByIdResponder {
1586    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1587    tx_id: u32,
1588}
1589
1590/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1591/// if the responder is dropped without sending a response, so that the client
1592/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1593impl std::ops::Drop for DeviceGetMmioByIdResponder {
1594    fn drop(&mut self) {
1595        self.control_handle.shutdown();
1596        // Safety: drops once, never accessed again
1597        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1598    }
1599}
1600
1601impl fidl::endpoints::Responder for DeviceGetMmioByIdResponder {
1602    type ControlHandle = DeviceControlHandle;
1603
1604    fn control_handle(&self) -> &DeviceControlHandle {
1605        &self.control_handle
1606    }
1607
1608    fn drop_without_shutdown(mut self) {
1609        // Safety: drops once, never accessed again due to mem::forget
1610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1611        // Prevent Drop from running (which would shut down the channel)
1612        std::mem::forget(self);
1613    }
1614}
1615
1616impl DeviceGetMmioByIdResponder {
1617    /// Sends a response to the FIDL transaction.
1618    ///
1619    /// Sets the channel to shutdown if an error occurs.
1620    pub fn send(self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1621        let _result = self.send_raw(result);
1622        if _result.is_err() {
1623            self.control_handle.shutdown();
1624        }
1625        self.drop_without_shutdown();
1626        _result
1627    }
1628
1629    /// Similar to "send" but does not shutdown the channel if an error occurs.
1630    pub fn send_no_shutdown_on_err(self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1631        let _result = self.send_raw(result);
1632        self.drop_without_shutdown();
1633        _result
1634    }
1635
1636    fn send_raw(&self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1637        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<Mmio, i32>>(
1638            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1639            self.tx_id,
1640            0x2fe2767f0aeec203,
1641            fidl::encoding::DynamicFlags::FLEXIBLE,
1642        )
1643    }
1644}
1645
1646#[must_use = "FIDL methods require a response to be sent"]
1647#[derive(Debug)]
1648pub struct DeviceGetMmioByNameResponder {
1649    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1650    tx_id: u32,
1651}
1652
1653/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1654/// if the responder is dropped without sending a response, so that the client
1655/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1656impl std::ops::Drop for DeviceGetMmioByNameResponder {
1657    fn drop(&mut self) {
1658        self.control_handle.shutdown();
1659        // Safety: drops once, never accessed again
1660        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1661    }
1662}
1663
1664impl fidl::endpoints::Responder for DeviceGetMmioByNameResponder {
1665    type ControlHandle = DeviceControlHandle;
1666
1667    fn control_handle(&self) -> &DeviceControlHandle {
1668        &self.control_handle
1669    }
1670
1671    fn drop_without_shutdown(mut self) {
1672        // Safety: drops once, never accessed again due to mem::forget
1673        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1674        // Prevent Drop from running (which would shut down the channel)
1675        std::mem::forget(self);
1676    }
1677}
1678
1679impl DeviceGetMmioByNameResponder {
1680    /// Sends a response to the FIDL transaction.
1681    ///
1682    /// Sets the channel to shutdown if an error occurs.
1683    pub fn send(self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1684        let _result = self.send_raw(result);
1685        if _result.is_err() {
1686            self.control_handle.shutdown();
1687        }
1688        self.drop_without_shutdown();
1689        _result
1690    }
1691
1692    /// Similar to "send" but does not shutdown the channel if an error occurs.
1693    pub fn send_no_shutdown_on_err(self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1694        let _result = self.send_raw(result);
1695        self.drop_without_shutdown();
1696        _result
1697    }
1698
1699    fn send_raw(&self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1700        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<Mmio, i32>>(
1701            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1702            self.tx_id,
1703            0x27dc17076e665076,
1704            fidl::encoding::DynamicFlags::FLEXIBLE,
1705        )
1706    }
1707}
1708
1709#[must_use = "FIDL methods require a response to be sent"]
1710#[derive(Debug)]
1711pub struct DeviceGetInterruptByIdResponder {
1712    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1713    tx_id: u32,
1714}
1715
1716/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1717/// if the responder is dropped without sending a response, so that the client
1718/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1719impl std::ops::Drop for DeviceGetInterruptByIdResponder {
1720    fn drop(&mut self) {
1721        self.control_handle.shutdown();
1722        // Safety: drops once, never accessed again
1723        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1724    }
1725}
1726
1727impl fidl::endpoints::Responder for DeviceGetInterruptByIdResponder {
1728    type ControlHandle = DeviceControlHandle;
1729
1730    fn control_handle(&self) -> &DeviceControlHandle {
1731        &self.control_handle
1732    }
1733
1734    fn drop_without_shutdown(mut self) {
1735        // Safety: drops once, never accessed again due to mem::forget
1736        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1737        // Prevent Drop from running (which would shut down the channel)
1738        std::mem::forget(self);
1739    }
1740}
1741
1742impl DeviceGetInterruptByIdResponder {
1743    /// Sends a response to the FIDL transaction.
1744    ///
1745    /// Sets the channel to shutdown if an error occurs.
1746    pub fn send(self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
1747        let _result = self.send_raw(result);
1748        if _result.is_err() {
1749            self.control_handle.shutdown();
1750        }
1751        self.drop_without_shutdown();
1752        _result
1753    }
1754
1755    /// Similar to "send" but does not shutdown the channel if an error occurs.
1756    pub fn send_no_shutdown_on_err(
1757        self,
1758        mut result: Result<fidl::Interrupt, i32>,
1759    ) -> Result<(), fidl::Error> {
1760        let _result = self.send_raw(result);
1761        self.drop_without_shutdown();
1762        _result
1763    }
1764
1765    fn send_raw(&self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
1766        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1767            DeviceGetInterruptByIdResponse,
1768            i32,
1769        >>(
1770            fidl::encoding::FlexibleResult::new(result.map(|irq| (irq,))),
1771            self.tx_id,
1772            0x4af1d7ccf7a4a4bc,
1773            fidl::encoding::DynamicFlags::FLEXIBLE,
1774        )
1775    }
1776}
1777
1778#[must_use = "FIDL methods require a response to be sent"]
1779#[derive(Debug)]
1780pub struct DeviceGetInterruptByNameResponder {
1781    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1782    tx_id: u32,
1783}
1784
1785/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1786/// if the responder is dropped without sending a response, so that the client
1787/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1788impl std::ops::Drop for DeviceGetInterruptByNameResponder {
1789    fn drop(&mut self) {
1790        self.control_handle.shutdown();
1791        // Safety: drops once, never accessed again
1792        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1793    }
1794}
1795
1796impl fidl::endpoints::Responder for DeviceGetInterruptByNameResponder {
1797    type ControlHandle = DeviceControlHandle;
1798
1799    fn control_handle(&self) -> &DeviceControlHandle {
1800        &self.control_handle
1801    }
1802
1803    fn drop_without_shutdown(mut self) {
1804        // Safety: drops once, never accessed again due to mem::forget
1805        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1806        // Prevent Drop from running (which would shut down the channel)
1807        std::mem::forget(self);
1808    }
1809}
1810
1811impl DeviceGetInterruptByNameResponder {
1812    /// Sends a response to the FIDL transaction.
1813    ///
1814    /// Sets the channel to shutdown if an error occurs.
1815    pub fn send(self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
1816        let _result = self.send_raw(result);
1817        if _result.is_err() {
1818            self.control_handle.shutdown();
1819        }
1820        self.drop_without_shutdown();
1821        _result
1822    }
1823
1824    /// Similar to "send" but does not shutdown the channel if an error occurs.
1825    pub fn send_no_shutdown_on_err(
1826        self,
1827        mut result: Result<fidl::Interrupt, i32>,
1828    ) -> Result<(), fidl::Error> {
1829        let _result = self.send_raw(result);
1830        self.drop_without_shutdown();
1831        _result
1832    }
1833
1834    fn send_raw(&self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
1835        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1836            DeviceGetInterruptByNameResponse,
1837            i32,
1838        >>(
1839            fidl::encoding::FlexibleResult::new(result.map(|irq| (irq,))),
1840            self.tx_id,
1841            0x165fbc6619b2b64f,
1842            fidl::encoding::DynamicFlags::FLEXIBLE,
1843        )
1844    }
1845}
1846
1847#[must_use = "FIDL methods require a response to be sent"]
1848#[derive(Debug)]
1849pub struct DeviceGetBtiByIdResponder {
1850    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1851    tx_id: u32,
1852}
1853
1854/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1855/// if the responder is dropped without sending a response, so that the client
1856/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1857impl std::ops::Drop for DeviceGetBtiByIdResponder {
1858    fn drop(&mut self) {
1859        self.control_handle.shutdown();
1860        // Safety: drops once, never accessed again
1861        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1862    }
1863}
1864
1865impl fidl::endpoints::Responder for DeviceGetBtiByIdResponder {
1866    type ControlHandle = DeviceControlHandle;
1867
1868    fn control_handle(&self) -> &DeviceControlHandle {
1869        &self.control_handle
1870    }
1871
1872    fn drop_without_shutdown(mut self) {
1873        // Safety: drops once, never accessed again due to mem::forget
1874        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1875        // Prevent Drop from running (which would shut down the channel)
1876        std::mem::forget(self);
1877    }
1878}
1879
1880impl DeviceGetBtiByIdResponder {
1881    /// Sends a response to the FIDL transaction.
1882    ///
1883    /// Sets the channel to shutdown if an error occurs.
1884    pub fn send(self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
1885        let _result = self.send_raw(result);
1886        if _result.is_err() {
1887            self.control_handle.shutdown();
1888        }
1889        self.drop_without_shutdown();
1890        _result
1891    }
1892
1893    /// Similar to "send" but does not shutdown the channel if an error occurs.
1894    pub fn send_no_shutdown_on_err(
1895        self,
1896        mut result: Result<fidl::Bti, i32>,
1897    ) -> Result<(), fidl::Error> {
1898        let _result = self.send_raw(result);
1899        self.drop_without_shutdown();
1900        _result
1901    }
1902
1903    fn send_raw(&self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
1904        self.control_handle
1905            .inner
1906            .send::<fidl::encoding::FlexibleResultType<DeviceGetBtiByIdResponse, i32>>(
1907                fidl::encoding::FlexibleResult::new(result.map(|bti| (bti,))),
1908                self.tx_id,
1909                0x7b4518a90bcd5463,
1910                fidl::encoding::DynamicFlags::FLEXIBLE,
1911            )
1912    }
1913}
1914
1915#[must_use = "FIDL methods require a response to be sent"]
1916#[derive(Debug)]
1917pub struct DeviceGetBtiByNameResponder {
1918    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1919    tx_id: u32,
1920}
1921
1922/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1923/// if the responder is dropped without sending a response, so that the client
1924/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1925impl std::ops::Drop for DeviceGetBtiByNameResponder {
1926    fn drop(&mut self) {
1927        self.control_handle.shutdown();
1928        // Safety: drops once, never accessed again
1929        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1930    }
1931}
1932
1933impl fidl::endpoints::Responder for DeviceGetBtiByNameResponder {
1934    type ControlHandle = DeviceControlHandle;
1935
1936    fn control_handle(&self) -> &DeviceControlHandle {
1937        &self.control_handle
1938    }
1939
1940    fn drop_without_shutdown(mut self) {
1941        // Safety: drops once, never accessed again due to mem::forget
1942        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1943        // Prevent Drop from running (which would shut down the channel)
1944        std::mem::forget(self);
1945    }
1946}
1947
1948impl DeviceGetBtiByNameResponder {
1949    /// Sends a response to the FIDL transaction.
1950    ///
1951    /// Sets the channel to shutdown if an error occurs.
1952    pub fn send(self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
1953        let _result = self.send_raw(result);
1954        if _result.is_err() {
1955            self.control_handle.shutdown();
1956        }
1957        self.drop_without_shutdown();
1958        _result
1959    }
1960
1961    /// Similar to "send" but does not shutdown the channel if an error occurs.
1962    pub fn send_no_shutdown_on_err(
1963        self,
1964        mut result: Result<fidl::Bti, i32>,
1965    ) -> Result<(), fidl::Error> {
1966        let _result = self.send_raw(result);
1967        self.drop_without_shutdown();
1968        _result
1969    }
1970
1971    fn send_raw(&self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
1972        self.control_handle
1973            .inner
1974            .send::<fidl::encoding::FlexibleResultType<DeviceGetBtiByNameResponse, i32>>(
1975                fidl::encoding::FlexibleResult::new(result.map(|bti| (bti,))),
1976                self.tx_id,
1977                0x358f37bd43460531,
1978                fidl::encoding::DynamicFlags::FLEXIBLE,
1979            )
1980    }
1981}
1982
1983#[must_use = "FIDL methods require a response to be sent"]
1984#[derive(Debug)]
1985pub struct DeviceGetSmcByIdResponder {
1986    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1987    tx_id: u32,
1988}
1989
1990/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1991/// if the responder is dropped without sending a response, so that the client
1992/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1993impl std::ops::Drop for DeviceGetSmcByIdResponder {
1994    fn drop(&mut self) {
1995        self.control_handle.shutdown();
1996        // Safety: drops once, never accessed again
1997        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1998    }
1999}
2000
2001impl fidl::endpoints::Responder for DeviceGetSmcByIdResponder {
2002    type ControlHandle = DeviceControlHandle;
2003
2004    fn control_handle(&self) -> &DeviceControlHandle {
2005        &self.control_handle
2006    }
2007
2008    fn drop_without_shutdown(mut self) {
2009        // Safety: drops once, never accessed again due to mem::forget
2010        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2011        // Prevent Drop from running (which would shut down the channel)
2012        std::mem::forget(self);
2013    }
2014}
2015
2016impl DeviceGetSmcByIdResponder {
2017    /// Sends a response to the FIDL transaction.
2018    ///
2019    /// Sets the channel to shutdown if an error occurs.
2020    pub fn send(self, mut result: Result<fidl::Resource, i32>) -> Result<(), fidl::Error> {
2021        let _result = self.send_raw(result);
2022        if _result.is_err() {
2023            self.control_handle.shutdown();
2024        }
2025        self.drop_without_shutdown();
2026        _result
2027    }
2028
2029    /// Similar to "send" but does not shutdown the channel if an error occurs.
2030    pub fn send_no_shutdown_on_err(
2031        self,
2032        mut result: Result<fidl::Resource, i32>,
2033    ) -> Result<(), fidl::Error> {
2034        let _result = self.send_raw(result);
2035        self.drop_without_shutdown();
2036        _result
2037    }
2038
2039    fn send_raw(&self, mut result: Result<fidl::Resource, i32>) -> Result<(), fidl::Error> {
2040        self.control_handle
2041            .inner
2042            .send::<fidl::encoding::FlexibleResultType<DeviceGetSmcByIdResponse, i32>>(
2043                fidl::encoding::FlexibleResult::new(result.map(|smc| (smc,))),
2044                self.tx_id,
2045                0x40e6da56a39e0e34,
2046                fidl::encoding::DynamicFlags::FLEXIBLE,
2047            )
2048    }
2049}
2050
2051#[must_use = "FIDL methods require a response to be sent"]
2052#[derive(Debug)]
2053pub struct DeviceGetSmcByNameResponder {
2054    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2055    tx_id: u32,
2056}
2057
2058/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2059/// if the responder is dropped without sending a response, so that the client
2060/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2061impl std::ops::Drop for DeviceGetSmcByNameResponder {
2062    fn drop(&mut self) {
2063        self.control_handle.shutdown();
2064        // Safety: drops once, never accessed again
2065        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2066    }
2067}
2068
2069impl fidl::endpoints::Responder for DeviceGetSmcByNameResponder {
2070    type ControlHandle = DeviceControlHandle;
2071
2072    fn control_handle(&self) -> &DeviceControlHandle {
2073        &self.control_handle
2074    }
2075
2076    fn drop_without_shutdown(mut self) {
2077        // Safety: drops once, never accessed again due to mem::forget
2078        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2079        // Prevent Drop from running (which would shut down the channel)
2080        std::mem::forget(self);
2081    }
2082}
2083
2084impl DeviceGetSmcByNameResponder {
2085    /// Sends a response to the FIDL transaction.
2086    ///
2087    /// Sets the channel to shutdown if an error occurs.
2088    pub fn send(self, mut result: Result<fidl::Resource, i32>) -> Result<(), fidl::Error> {
2089        let _result = self.send_raw(result);
2090        if _result.is_err() {
2091            self.control_handle.shutdown();
2092        }
2093        self.drop_without_shutdown();
2094        _result
2095    }
2096
2097    /// Similar to "send" but does not shutdown the channel if an error occurs.
2098    pub fn send_no_shutdown_on_err(
2099        self,
2100        mut result: Result<fidl::Resource, i32>,
2101    ) -> Result<(), fidl::Error> {
2102        let _result = self.send_raw(result);
2103        self.drop_without_shutdown();
2104        _result
2105    }
2106
2107    fn send_raw(&self, mut result: Result<fidl::Resource, i32>) -> Result<(), fidl::Error> {
2108        self.control_handle
2109            .inner
2110            .send::<fidl::encoding::FlexibleResultType<DeviceGetSmcByNameResponse, i32>>(
2111                fidl::encoding::FlexibleResult::new(result.map(|smc| (smc,))),
2112                self.tx_id,
2113                0x3e13238c0bba6da2,
2114                fidl::encoding::DynamicFlags::FLEXIBLE,
2115            )
2116    }
2117}
2118
2119#[must_use = "FIDL methods require a response to be sent"]
2120#[derive(Debug)]
2121pub struct DeviceGetPowerConfigurationResponder {
2122    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2123    tx_id: u32,
2124}
2125
2126/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2127/// if the responder is dropped without sending a response, so that the client
2128/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2129impl std::ops::Drop for DeviceGetPowerConfigurationResponder {
2130    fn drop(&mut self) {
2131        self.control_handle.shutdown();
2132        // Safety: drops once, never accessed again
2133        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2134    }
2135}
2136
2137impl fidl::endpoints::Responder for DeviceGetPowerConfigurationResponder {
2138    type ControlHandle = DeviceControlHandle;
2139
2140    fn control_handle(&self) -> &DeviceControlHandle {
2141        &self.control_handle
2142    }
2143
2144    fn drop_without_shutdown(mut self) {
2145        // Safety: drops once, never accessed again due to mem::forget
2146        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2147        // Prevent Drop from running (which would shut down the channel)
2148        std::mem::forget(self);
2149    }
2150}
2151
2152impl DeviceGetPowerConfigurationResponder {
2153    /// Sends a response to the FIDL transaction.
2154    ///
2155    /// Sets the channel to shutdown if an error occurs.
2156    pub fn send(
2157        self,
2158        mut result: Result<&[fidl_fuchsia_hardware_power::PowerElementConfiguration], i32>,
2159    ) -> Result<(), fidl::Error> {
2160        let _result = self.send_raw(result);
2161        if _result.is_err() {
2162            self.control_handle.shutdown();
2163        }
2164        self.drop_without_shutdown();
2165        _result
2166    }
2167
2168    /// Similar to "send" but does not shutdown the channel if an error occurs.
2169    pub fn send_no_shutdown_on_err(
2170        self,
2171        mut result: Result<&[fidl_fuchsia_hardware_power::PowerElementConfiguration], i32>,
2172    ) -> Result<(), fidl::Error> {
2173        let _result = self.send_raw(result);
2174        self.drop_without_shutdown();
2175        _result
2176    }
2177
2178    fn send_raw(
2179        &self,
2180        mut result: Result<&[fidl_fuchsia_hardware_power::PowerElementConfiguration], i32>,
2181    ) -> Result<(), fidl::Error> {
2182        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2183            DeviceGetPowerConfigurationResponse,
2184            i32,
2185        >>(
2186            fidl::encoding::FlexibleResult::new(result.map(|config| (config,))),
2187            self.tx_id,
2188            0x8b08024ba9c2587,
2189            fidl::encoding::DynamicFlags::FLEXIBLE,
2190        )
2191    }
2192}
2193
2194#[must_use = "FIDL methods require a response to be sent"]
2195#[derive(Debug)]
2196pub struct DeviceGetNodeDeviceInfoResponder {
2197    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2198    tx_id: u32,
2199}
2200
2201/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2202/// if the responder is dropped without sending a response, so that the client
2203/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2204impl std::ops::Drop for DeviceGetNodeDeviceInfoResponder {
2205    fn drop(&mut self) {
2206        self.control_handle.shutdown();
2207        // Safety: drops once, never accessed again
2208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2209    }
2210}
2211
2212impl fidl::endpoints::Responder for DeviceGetNodeDeviceInfoResponder {
2213    type ControlHandle = DeviceControlHandle;
2214
2215    fn control_handle(&self) -> &DeviceControlHandle {
2216        &self.control_handle
2217    }
2218
2219    fn drop_without_shutdown(mut self) {
2220        // Safety: drops once, never accessed again due to mem::forget
2221        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2222        // Prevent Drop from running (which would shut down the channel)
2223        std::mem::forget(self);
2224    }
2225}
2226
2227impl DeviceGetNodeDeviceInfoResponder {
2228    /// Sends a response to the FIDL transaction.
2229    ///
2230    /// Sets the channel to shutdown if an error occurs.
2231    pub fn send(self, mut result: Result<&NodeDeviceInfo, i32>) -> Result<(), fidl::Error> {
2232        let _result = self.send_raw(result);
2233        if _result.is_err() {
2234            self.control_handle.shutdown();
2235        }
2236        self.drop_without_shutdown();
2237        _result
2238    }
2239
2240    /// Similar to "send" but does not shutdown the channel if an error occurs.
2241    pub fn send_no_shutdown_on_err(
2242        self,
2243        mut result: Result<&NodeDeviceInfo, i32>,
2244    ) -> Result<(), fidl::Error> {
2245        let _result = self.send_raw(result);
2246        self.drop_without_shutdown();
2247        _result
2248    }
2249
2250    fn send_raw(&self, mut result: Result<&NodeDeviceInfo, i32>) -> Result<(), fidl::Error> {
2251        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<NodeDeviceInfo, i32>>(
2252            fidl::encoding::FlexibleResult::new(result),
2253            self.tx_id,
2254            0x9a4e8a63ba682,
2255            fidl::encoding::DynamicFlags::FLEXIBLE,
2256        )
2257    }
2258}
2259
2260#[must_use = "FIDL methods require a response to be sent"]
2261#[derive(Debug)]
2262pub struct DeviceGetBoardInfoResponder {
2263    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2264    tx_id: u32,
2265}
2266
2267/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2268/// if the responder is dropped without sending a response, so that the client
2269/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2270impl std::ops::Drop for DeviceGetBoardInfoResponder {
2271    fn drop(&mut self) {
2272        self.control_handle.shutdown();
2273        // Safety: drops once, never accessed again
2274        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2275    }
2276}
2277
2278impl fidl::endpoints::Responder for DeviceGetBoardInfoResponder {
2279    type ControlHandle = DeviceControlHandle;
2280
2281    fn control_handle(&self) -> &DeviceControlHandle {
2282        &self.control_handle
2283    }
2284
2285    fn drop_without_shutdown(mut self) {
2286        // Safety: drops once, never accessed again due to mem::forget
2287        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2288        // Prevent Drop from running (which would shut down the channel)
2289        std::mem::forget(self);
2290    }
2291}
2292
2293impl DeviceGetBoardInfoResponder {
2294    /// Sends a response to the FIDL transaction.
2295    ///
2296    /// Sets the channel to shutdown if an error occurs.
2297    pub fn send(self, mut result: Result<&BoardInfo, i32>) -> Result<(), fidl::Error> {
2298        let _result = self.send_raw(result);
2299        if _result.is_err() {
2300            self.control_handle.shutdown();
2301        }
2302        self.drop_without_shutdown();
2303        _result
2304    }
2305
2306    /// Similar to "send" but does not shutdown the channel if an error occurs.
2307    pub fn send_no_shutdown_on_err(
2308        self,
2309        mut result: Result<&BoardInfo, i32>,
2310    ) -> Result<(), fidl::Error> {
2311        let _result = self.send_raw(result);
2312        self.drop_without_shutdown();
2313        _result
2314    }
2315
2316    fn send_raw(&self, mut result: Result<&BoardInfo, i32>) -> Result<(), fidl::Error> {
2317        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<BoardInfo, i32>>(
2318            fidl::encoding::FlexibleResult::new(result),
2319            self.tx_id,
2320            0x9140d82923eee4b,
2321            fidl::encoding::DynamicFlags::FLEXIBLE,
2322        )
2323    }
2324}
2325
2326#[must_use = "FIDL methods require a response to be sent"]
2327#[derive(Debug)]
2328pub struct DeviceGetMetadataResponder {
2329    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2330    tx_id: u32,
2331}
2332
2333/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2334/// if the responder is dropped without sending a response, so that the client
2335/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2336impl std::ops::Drop for DeviceGetMetadataResponder {
2337    fn drop(&mut self) {
2338        self.control_handle.shutdown();
2339        // Safety: drops once, never accessed again
2340        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2341    }
2342}
2343
2344impl fidl::endpoints::Responder for DeviceGetMetadataResponder {
2345    type ControlHandle = DeviceControlHandle;
2346
2347    fn control_handle(&self) -> &DeviceControlHandle {
2348        &self.control_handle
2349    }
2350
2351    fn drop_without_shutdown(mut self) {
2352        // Safety: drops once, never accessed again due to mem::forget
2353        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2354        // Prevent Drop from running (which would shut down the channel)
2355        std::mem::forget(self);
2356    }
2357}
2358
2359impl DeviceGetMetadataResponder {
2360    /// Sends a response to the FIDL transaction.
2361    ///
2362    /// Sets the channel to shutdown if an error occurs.
2363    pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2364        let _result = self.send_raw(result);
2365        if _result.is_err() {
2366            self.control_handle.shutdown();
2367        }
2368        self.drop_without_shutdown();
2369        _result
2370    }
2371
2372    /// Similar to "send" but does not shutdown the channel if an error occurs.
2373    pub fn send_no_shutdown_on_err(
2374        self,
2375        mut result: Result<&[u8], i32>,
2376    ) -> Result<(), fidl::Error> {
2377        let _result = self.send_raw(result);
2378        self.drop_without_shutdown();
2379        _result
2380    }
2381
2382    fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2383        self.control_handle
2384            .inner
2385            .send::<fidl::encoding::FlexibleResultType<DeviceGetMetadataResponse, i32>>(
2386                fidl::encoding::FlexibleResult::new(result.map(|metadata| (metadata,))),
2387                self.tx_id,
2388                0x36e18be3a7c6cc70,
2389                fidl::encoding::DynamicFlags::FLEXIBLE,
2390            )
2391    }
2392}
2393
2394#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2395pub struct ServiceMarker;
2396
2397#[cfg(target_os = "fuchsia")]
2398impl fidl::endpoints::ServiceMarker for ServiceMarker {
2399    type Proxy = ServiceProxy;
2400    type Request = ServiceRequest;
2401    const SERVICE_NAME: &'static str = "fuchsia.hardware.platform.device.Service";
2402}
2403
2404/// A request for one of the member protocols of Service.
2405///
2406#[cfg(target_os = "fuchsia")]
2407pub enum ServiceRequest {
2408    Device(DeviceRequestStream),
2409}
2410
2411#[cfg(target_os = "fuchsia")]
2412impl fidl::endpoints::ServiceRequest for ServiceRequest {
2413    type Service = ServiceMarker;
2414
2415    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2416        match name {
2417            "device" => Self::Device(
2418                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2419            ),
2420            _ => panic!("no such member protocol name for service Service"),
2421        }
2422    }
2423
2424    fn member_names() -> &'static [&'static str] {
2425        &["device"]
2426    }
2427}
2428#[cfg(target_os = "fuchsia")]
2429pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2430
2431#[cfg(target_os = "fuchsia")]
2432impl fidl::endpoints::ServiceProxy for ServiceProxy {
2433    type Service = ServiceMarker;
2434
2435    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2436        Self(opener)
2437    }
2438}
2439
2440#[cfg(target_os = "fuchsia")]
2441impl ServiceProxy {
2442    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
2443        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2444        self.connect_channel_to_device(server_end)?;
2445        Ok(proxy)
2446    }
2447
2448    /// Like `connect_to_device`, but returns a sync proxy.
2449    /// See [`Self::connect_to_device`] for more details.
2450    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2451        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2452        self.connect_channel_to_device(server_end)?;
2453        Ok(proxy)
2454    }
2455
2456    /// Like `connect_to_device`, but accepts a server end.
2457    /// See [`Self::connect_to_device`] for more details.
2458    pub fn connect_channel_to_device(
2459        &self,
2460        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2461    ) -> Result<(), fidl::Error> {
2462        self.0.open_member("device", server_end.into_channel())
2463    }
2464
2465    pub fn instance_name(&self) -> &str {
2466        self.0.instance_name()
2467    }
2468}
2469
2470mod internal {
2471    use super::*;
2472
2473    impl fidl::encoding::ResourceTypeMarker for DeviceGetBtiByIdResponse {
2474        type Borrowed<'a> = &'a mut Self;
2475        fn take_or_borrow<'a>(
2476            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2477        ) -> Self::Borrowed<'a> {
2478            value
2479        }
2480    }
2481
2482    unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiByIdResponse {
2483        type Owned = Self;
2484
2485        #[inline(always)]
2486        fn inline_align(_context: fidl::encoding::Context) -> usize {
2487            4
2488        }
2489
2490        #[inline(always)]
2491        fn inline_size(_context: fidl::encoding::Context) -> usize {
2492            4
2493        }
2494    }
2495
2496    unsafe impl
2497        fidl::encoding::Encode<
2498            DeviceGetBtiByIdResponse,
2499            fidl::encoding::DefaultFuchsiaResourceDialect,
2500        > for &mut DeviceGetBtiByIdResponse
2501    {
2502        #[inline]
2503        unsafe fn encode(
2504            self,
2505            encoder: &mut fidl::encoding::Encoder<
2506                '_,
2507                fidl::encoding::DefaultFuchsiaResourceDialect,
2508            >,
2509            offset: usize,
2510            _depth: fidl::encoding::Depth,
2511        ) -> fidl::Result<()> {
2512            encoder.debug_check_bounds::<DeviceGetBtiByIdResponse>(offset);
2513            // Delegate to tuple encoding.
2514            fidl::encoding::Encode::<
2515                DeviceGetBtiByIdResponse,
2516                fidl::encoding::DefaultFuchsiaResourceDialect,
2517            >::encode(
2518                (<fidl::encoding::HandleType<
2519                    fidl::Bti,
2520                    { fidl::ObjectType::BTI.into_raw() },
2521                    2147483648,
2522                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2523                    &mut self.bti
2524                ),),
2525                encoder,
2526                offset,
2527                _depth,
2528            )
2529        }
2530    }
2531    unsafe impl<
2532        T0: fidl::encoding::Encode<
2533                fidl::encoding::HandleType<
2534                    fidl::Bti,
2535                    { fidl::ObjectType::BTI.into_raw() },
2536                    2147483648,
2537                >,
2538                fidl::encoding::DefaultFuchsiaResourceDialect,
2539            >,
2540    >
2541        fidl::encoding::Encode<
2542            DeviceGetBtiByIdResponse,
2543            fidl::encoding::DefaultFuchsiaResourceDialect,
2544        > for (T0,)
2545    {
2546        #[inline]
2547        unsafe fn encode(
2548            self,
2549            encoder: &mut fidl::encoding::Encoder<
2550                '_,
2551                fidl::encoding::DefaultFuchsiaResourceDialect,
2552            >,
2553            offset: usize,
2554            depth: fidl::encoding::Depth,
2555        ) -> fidl::Result<()> {
2556            encoder.debug_check_bounds::<DeviceGetBtiByIdResponse>(offset);
2557            // Zero out padding regions. There's no need to apply masks
2558            // because the unmasked parts will be overwritten by fields.
2559            // Write the fields.
2560            self.0.encode(encoder, offset + 0, depth)?;
2561            Ok(())
2562        }
2563    }
2564
2565    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2566        for DeviceGetBtiByIdResponse
2567    {
2568        #[inline(always)]
2569        fn new_empty() -> Self {
2570            Self {
2571                bti: fidl::new_empty!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2572            }
2573        }
2574
2575        #[inline]
2576        unsafe fn decode(
2577            &mut self,
2578            decoder: &mut fidl::encoding::Decoder<
2579                '_,
2580                fidl::encoding::DefaultFuchsiaResourceDialect,
2581            >,
2582            offset: usize,
2583            _depth: fidl::encoding::Depth,
2584        ) -> fidl::Result<()> {
2585            decoder.debug_check_bounds::<Self>(offset);
2586            // Verify that padding bytes are zero.
2587            fidl::decode!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bti, decoder, offset + 0, _depth)?;
2588            Ok(())
2589        }
2590    }
2591
2592    impl fidl::encoding::ResourceTypeMarker for DeviceGetBtiByNameResponse {
2593        type Borrowed<'a> = &'a mut Self;
2594        fn take_or_borrow<'a>(
2595            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2596        ) -> Self::Borrowed<'a> {
2597            value
2598        }
2599    }
2600
2601    unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiByNameResponse {
2602        type Owned = Self;
2603
2604        #[inline(always)]
2605        fn inline_align(_context: fidl::encoding::Context) -> usize {
2606            4
2607        }
2608
2609        #[inline(always)]
2610        fn inline_size(_context: fidl::encoding::Context) -> usize {
2611            4
2612        }
2613    }
2614
2615    unsafe impl
2616        fidl::encoding::Encode<
2617            DeviceGetBtiByNameResponse,
2618            fidl::encoding::DefaultFuchsiaResourceDialect,
2619        > for &mut DeviceGetBtiByNameResponse
2620    {
2621        #[inline]
2622        unsafe fn encode(
2623            self,
2624            encoder: &mut fidl::encoding::Encoder<
2625                '_,
2626                fidl::encoding::DefaultFuchsiaResourceDialect,
2627            >,
2628            offset: usize,
2629            _depth: fidl::encoding::Depth,
2630        ) -> fidl::Result<()> {
2631            encoder.debug_check_bounds::<DeviceGetBtiByNameResponse>(offset);
2632            // Delegate to tuple encoding.
2633            fidl::encoding::Encode::<
2634                DeviceGetBtiByNameResponse,
2635                fidl::encoding::DefaultFuchsiaResourceDialect,
2636            >::encode(
2637                (<fidl::encoding::HandleType<
2638                    fidl::Bti,
2639                    { fidl::ObjectType::BTI.into_raw() },
2640                    2147483648,
2641                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2642                    &mut self.bti
2643                ),),
2644                encoder,
2645                offset,
2646                _depth,
2647            )
2648        }
2649    }
2650    unsafe impl<
2651        T0: fidl::encoding::Encode<
2652                fidl::encoding::HandleType<
2653                    fidl::Bti,
2654                    { fidl::ObjectType::BTI.into_raw() },
2655                    2147483648,
2656                >,
2657                fidl::encoding::DefaultFuchsiaResourceDialect,
2658            >,
2659    >
2660        fidl::encoding::Encode<
2661            DeviceGetBtiByNameResponse,
2662            fidl::encoding::DefaultFuchsiaResourceDialect,
2663        > for (T0,)
2664    {
2665        #[inline]
2666        unsafe fn encode(
2667            self,
2668            encoder: &mut fidl::encoding::Encoder<
2669                '_,
2670                fidl::encoding::DefaultFuchsiaResourceDialect,
2671            >,
2672            offset: usize,
2673            depth: fidl::encoding::Depth,
2674        ) -> fidl::Result<()> {
2675            encoder.debug_check_bounds::<DeviceGetBtiByNameResponse>(offset);
2676            // Zero out padding regions. There's no need to apply masks
2677            // because the unmasked parts will be overwritten by fields.
2678            // Write the fields.
2679            self.0.encode(encoder, offset + 0, depth)?;
2680            Ok(())
2681        }
2682    }
2683
2684    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2685        for DeviceGetBtiByNameResponse
2686    {
2687        #[inline(always)]
2688        fn new_empty() -> Self {
2689            Self {
2690                bti: fidl::new_empty!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2691            }
2692        }
2693
2694        #[inline]
2695        unsafe fn decode(
2696            &mut self,
2697            decoder: &mut fidl::encoding::Decoder<
2698                '_,
2699                fidl::encoding::DefaultFuchsiaResourceDialect,
2700            >,
2701            offset: usize,
2702            _depth: fidl::encoding::Depth,
2703        ) -> fidl::Result<()> {
2704            decoder.debug_check_bounds::<Self>(offset);
2705            // Verify that padding bytes are zero.
2706            fidl::decode!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bti, decoder, offset + 0, _depth)?;
2707            Ok(())
2708        }
2709    }
2710
2711    impl fidl::encoding::ResourceTypeMarker for DeviceGetInterruptByIdResponse {
2712        type Borrowed<'a> = &'a mut Self;
2713        fn take_or_borrow<'a>(
2714            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2715        ) -> Self::Borrowed<'a> {
2716            value
2717        }
2718    }
2719
2720    unsafe impl fidl::encoding::TypeMarker for DeviceGetInterruptByIdResponse {
2721        type Owned = Self;
2722
2723        #[inline(always)]
2724        fn inline_align(_context: fidl::encoding::Context) -> usize {
2725            4
2726        }
2727
2728        #[inline(always)]
2729        fn inline_size(_context: fidl::encoding::Context) -> usize {
2730            4
2731        }
2732    }
2733
2734    unsafe impl
2735        fidl::encoding::Encode<
2736            DeviceGetInterruptByIdResponse,
2737            fidl::encoding::DefaultFuchsiaResourceDialect,
2738        > for &mut DeviceGetInterruptByIdResponse
2739    {
2740        #[inline]
2741        unsafe fn encode(
2742            self,
2743            encoder: &mut fidl::encoding::Encoder<
2744                '_,
2745                fidl::encoding::DefaultFuchsiaResourceDialect,
2746            >,
2747            offset: usize,
2748            _depth: fidl::encoding::Depth,
2749        ) -> fidl::Result<()> {
2750            encoder.debug_check_bounds::<DeviceGetInterruptByIdResponse>(offset);
2751            // Delegate to tuple encoding.
2752            fidl::encoding::Encode::<
2753                DeviceGetInterruptByIdResponse,
2754                fidl::encoding::DefaultFuchsiaResourceDialect,
2755            >::encode(
2756                (<fidl::encoding::HandleType<
2757                    fidl::Interrupt,
2758                    { fidl::ObjectType::INTERRUPT.into_raw() },
2759                    2147483648,
2760                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2761                    &mut self.irq
2762                ),),
2763                encoder,
2764                offset,
2765                _depth,
2766            )
2767        }
2768    }
2769    unsafe impl<
2770        T0: fidl::encoding::Encode<
2771                fidl::encoding::HandleType<
2772                    fidl::Interrupt,
2773                    { fidl::ObjectType::INTERRUPT.into_raw() },
2774                    2147483648,
2775                >,
2776                fidl::encoding::DefaultFuchsiaResourceDialect,
2777            >,
2778    >
2779        fidl::encoding::Encode<
2780            DeviceGetInterruptByIdResponse,
2781            fidl::encoding::DefaultFuchsiaResourceDialect,
2782        > for (T0,)
2783    {
2784        #[inline]
2785        unsafe fn encode(
2786            self,
2787            encoder: &mut fidl::encoding::Encoder<
2788                '_,
2789                fidl::encoding::DefaultFuchsiaResourceDialect,
2790            >,
2791            offset: usize,
2792            depth: fidl::encoding::Depth,
2793        ) -> fidl::Result<()> {
2794            encoder.debug_check_bounds::<DeviceGetInterruptByIdResponse>(offset);
2795            // Zero out padding regions. There's no need to apply masks
2796            // because the unmasked parts will be overwritten by fields.
2797            // Write the fields.
2798            self.0.encode(encoder, offset + 0, depth)?;
2799            Ok(())
2800        }
2801    }
2802
2803    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2804        for DeviceGetInterruptByIdResponse
2805    {
2806        #[inline(always)]
2807        fn new_empty() -> Self {
2808            Self {
2809                irq: fidl::new_empty!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2810            }
2811        }
2812
2813        #[inline]
2814        unsafe fn decode(
2815            &mut self,
2816            decoder: &mut fidl::encoding::Decoder<
2817                '_,
2818                fidl::encoding::DefaultFuchsiaResourceDialect,
2819            >,
2820            offset: usize,
2821            _depth: fidl::encoding::Depth,
2822        ) -> fidl::Result<()> {
2823            decoder.debug_check_bounds::<Self>(offset);
2824            // Verify that padding bytes are zero.
2825            fidl::decode!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.irq, decoder, offset + 0, _depth)?;
2826            Ok(())
2827        }
2828    }
2829
2830    impl fidl::encoding::ResourceTypeMarker for DeviceGetInterruptByNameResponse {
2831        type Borrowed<'a> = &'a mut Self;
2832        fn take_or_borrow<'a>(
2833            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2834        ) -> Self::Borrowed<'a> {
2835            value
2836        }
2837    }
2838
2839    unsafe impl fidl::encoding::TypeMarker for DeviceGetInterruptByNameResponse {
2840        type Owned = Self;
2841
2842        #[inline(always)]
2843        fn inline_align(_context: fidl::encoding::Context) -> usize {
2844            4
2845        }
2846
2847        #[inline(always)]
2848        fn inline_size(_context: fidl::encoding::Context) -> usize {
2849            4
2850        }
2851    }
2852
2853    unsafe impl
2854        fidl::encoding::Encode<
2855            DeviceGetInterruptByNameResponse,
2856            fidl::encoding::DefaultFuchsiaResourceDialect,
2857        > for &mut DeviceGetInterruptByNameResponse
2858    {
2859        #[inline]
2860        unsafe fn encode(
2861            self,
2862            encoder: &mut fidl::encoding::Encoder<
2863                '_,
2864                fidl::encoding::DefaultFuchsiaResourceDialect,
2865            >,
2866            offset: usize,
2867            _depth: fidl::encoding::Depth,
2868        ) -> fidl::Result<()> {
2869            encoder.debug_check_bounds::<DeviceGetInterruptByNameResponse>(offset);
2870            // Delegate to tuple encoding.
2871            fidl::encoding::Encode::<
2872                DeviceGetInterruptByNameResponse,
2873                fidl::encoding::DefaultFuchsiaResourceDialect,
2874            >::encode(
2875                (<fidl::encoding::HandleType<
2876                    fidl::Interrupt,
2877                    { fidl::ObjectType::INTERRUPT.into_raw() },
2878                    2147483648,
2879                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2880                    &mut self.irq
2881                ),),
2882                encoder,
2883                offset,
2884                _depth,
2885            )
2886        }
2887    }
2888    unsafe impl<
2889        T0: fidl::encoding::Encode<
2890                fidl::encoding::HandleType<
2891                    fidl::Interrupt,
2892                    { fidl::ObjectType::INTERRUPT.into_raw() },
2893                    2147483648,
2894                >,
2895                fidl::encoding::DefaultFuchsiaResourceDialect,
2896            >,
2897    >
2898        fidl::encoding::Encode<
2899            DeviceGetInterruptByNameResponse,
2900            fidl::encoding::DefaultFuchsiaResourceDialect,
2901        > for (T0,)
2902    {
2903        #[inline]
2904        unsafe fn encode(
2905            self,
2906            encoder: &mut fidl::encoding::Encoder<
2907                '_,
2908                fidl::encoding::DefaultFuchsiaResourceDialect,
2909            >,
2910            offset: usize,
2911            depth: fidl::encoding::Depth,
2912        ) -> fidl::Result<()> {
2913            encoder.debug_check_bounds::<DeviceGetInterruptByNameResponse>(offset);
2914            // Zero out padding regions. There's no need to apply masks
2915            // because the unmasked parts will be overwritten by fields.
2916            // Write the fields.
2917            self.0.encode(encoder, offset + 0, depth)?;
2918            Ok(())
2919        }
2920    }
2921
2922    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2923        for DeviceGetInterruptByNameResponse
2924    {
2925        #[inline(always)]
2926        fn new_empty() -> Self {
2927            Self {
2928                irq: fidl::new_empty!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2929            }
2930        }
2931
2932        #[inline]
2933        unsafe fn decode(
2934            &mut self,
2935            decoder: &mut fidl::encoding::Decoder<
2936                '_,
2937                fidl::encoding::DefaultFuchsiaResourceDialect,
2938            >,
2939            offset: usize,
2940            _depth: fidl::encoding::Depth,
2941        ) -> fidl::Result<()> {
2942            decoder.debug_check_bounds::<Self>(offset);
2943            // Verify that padding bytes are zero.
2944            fidl::decode!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.irq, decoder, offset + 0, _depth)?;
2945            Ok(())
2946        }
2947    }
2948
2949    impl fidl::encoding::ResourceTypeMarker for DeviceGetSmcByIdResponse {
2950        type Borrowed<'a> = &'a mut Self;
2951        fn take_or_borrow<'a>(
2952            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2953        ) -> Self::Borrowed<'a> {
2954            value
2955        }
2956    }
2957
2958    unsafe impl fidl::encoding::TypeMarker for DeviceGetSmcByIdResponse {
2959        type Owned = Self;
2960
2961        #[inline(always)]
2962        fn inline_align(_context: fidl::encoding::Context) -> usize {
2963            4
2964        }
2965
2966        #[inline(always)]
2967        fn inline_size(_context: fidl::encoding::Context) -> usize {
2968            4
2969        }
2970    }
2971
2972    unsafe impl
2973        fidl::encoding::Encode<
2974            DeviceGetSmcByIdResponse,
2975            fidl::encoding::DefaultFuchsiaResourceDialect,
2976        > for &mut DeviceGetSmcByIdResponse
2977    {
2978        #[inline]
2979        unsafe fn encode(
2980            self,
2981            encoder: &mut fidl::encoding::Encoder<
2982                '_,
2983                fidl::encoding::DefaultFuchsiaResourceDialect,
2984            >,
2985            offset: usize,
2986            _depth: fidl::encoding::Depth,
2987        ) -> fidl::Result<()> {
2988            encoder.debug_check_bounds::<DeviceGetSmcByIdResponse>(offset);
2989            // Delegate to tuple encoding.
2990            fidl::encoding::Encode::<
2991                DeviceGetSmcByIdResponse,
2992                fidl::encoding::DefaultFuchsiaResourceDialect,
2993            >::encode(
2994                (<fidl::encoding::HandleType<
2995                    fidl::Resource,
2996                    { fidl::ObjectType::RESOURCE.into_raw() },
2997                    2147483648,
2998                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2999                    &mut self.smc
3000                ),),
3001                encoder,
3002                offset,
3003                _depth,
3004            )
3005        }
3006    }
3007    unsafe impl<
3008        T0: fidl::encoding::Encode<
3009                fidl::encoding::HandleType<
3010                    fidl::Resource,
3011                    { fidl::ObjectType::RESOURCE.into_raw() },
3012                    2147483648,
3013                >,
3014                fidl::encoding::DefaultFuchsiaResourceDialect,
3015            >,
3016    >
3017        fidl::encoding::Encode<
3018            DeviceGetSmcByIdResponse,
3019            fidl::encoding::DefaultFuchsiaResourceDialect,
3020        > for (T0,)
3021    {
3022        #[inline]
3023        unsafe fn encode(
3024            self,
3025            encoder: &mut fidl::encoding::Encoder<
3026                '_,
3027                fidl::encoding::DefaultFuchsiaResourceDialect,
3028            >,
3029            offset: usize,
3030            depth: fidl::encoding::Depth,
3031        ) -> fidl::Result<()> {
3032            encoder.debug_check_bounds::<DeviceGetSmcByIdResponse>(offset);
3033            // Zero out padding regions. There's no need to apply masks
3034            // because the unmasked parts will be overwritten by fields.
3035            // Write the fields.
3036            self.0.encode(encoder, offset + 0, depth)?;
3037            Ok(())
3038        }
3039    }
3040
3041    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3042        for DeviceGetSmcByIdResponse
3043    {
3044        #[inline(always)]
3045        fn new_empty() -> Self {
3046            Self {
3047                smc: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3048            }
3049        }
3050
3051        #[inline]
3052        unsafe fn decode(
3053            &mut self,
3054            decoder: &mut fidl::encoding::Decoder<
3055                '_,
3056                fidl::encoding::DefaultFuchsiaResourceDialect,
3057            >,
3058            offset: usize,
3059            _depth: fidl::encoding::Depth,
3060        ) -> fidl::Result<()> {
3061            decoder.debug_check_bounds::<Self>(offset);
3062            // Verify that padding bytes are zero.
3063            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.smc, decoder, offset + 0, _depth)?;
3064            Ok(())
3065        }
3066    }
3067
3068    impl fidl::encoding::ResourceTypeMarker for DeviceGetSmcByNameResponse {
3069        type Borrowed<'a> = &'a mut Self;
3070        fn take_or_borrow<'a>(
3071            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3072        ) -> Self::Borrowed<'a> {
3073            value
3074        }
3075    }
3076
3077    unsafe impl fidl::encoding::TypeMarker for DeviceGetSmcByNameResponse {
3078        type Owned = Self;
3079
3080        #[inline(always)]
3081        fn inline_align(_context: fidl::encoding::Context) -> usize {
3082            4
3083        }
3084
3085        #[inline(always)]
3086        fn inline_size(_context: fidl::encoding::Context) -> usize {
3087            4
3088        }
3089    }
3090
3091    unsafe impl
3092        fidl::encoding::Encode<
3093            DeviceGetSmcByNameResponse,
3094            fidl::encoding::DefaultFuchsiaResourceDialect,
3095        > for &mut DeviceGetSmcByNameResponse
3096    {
3097        #[inline]
3098        unsafe fn encode(
3099            self,
3100            encoder: &mut fidl::encoding::Encoder<
3101                '_,
3102                fidl::encoding::DefaultFuchsiaResourceDialect,
3103            >,
3104            offset: usize,
3105            _depth: fidl::encoding::Depth,
3106        ) -> fidl::Result<()> {
3107            encoder.debug_check_bounds::<DeviceGetSmcByNameResponse>(offset);
3108            // Delegate to tuple encoding.
3109            fidl::encoding::Encode::<
3110                DeviceGetSmcByNameResponse,
3111                fidl::encoding::DefaultFuchsiaResourceDialect,
3112            >::encode(
3113                (<fidl::encoding::HandleType<
3114                    fidl::Resource,
3115                    { fidl::ObjectType::RESOURCE.into_raw() },
3116                    2147483648,
3117                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3118                    &mut self.smc
3119                ),),
3120                encoder,
3121                offset,
3122                _depth,
3123            )
3124        }
3125    }
3126    unsafe impl<
3127        T0: fidl::encoding::Encode<
3128                fidl::encoding::HandleType<
3129                    fidl::Resource,
3130                    { fidl::ObjectType::RESOURCE.into_raw() },
3131                    2147483648,
3132                >,
3133                fidl::encoding::DefaultFuchsiaResourceDialect,
3134            >,
3135    >
3136        fidl::encoding::Encode<
3137            DeviceGetSmcByNameResponse,
3138            fidl::encoding::DefaultFuchsiaResourceDialect,
3139        > for (T0,)
3140    {
3141        #[inline]
3142        unsafe fn encode(
3143            self,
3144            encoder: &mut fidl::encoding::Encoder<
3145                '_,
3146                fidl::encoding::DefaultFuchsiaResourceDialect,
3147            >,
3148            offset: usize,
3149            depth: fidl::encoding::Depth,
3150        ) -> fidl::Result<()> {
3151            encoder.debug_check_bounds::<DeviceGetSmcByNameResponse>(offset);
3152            // Zero out padding regions. There's no need to apply masks
3153            // because the unmasked parts will be overwritten by fields.
3154            // Write the fields.
3155            self.0.encode(encoder, offset + 0, depth)?;
3156            Ok(())
3157        }
3158    }
3159
3160    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3161        for DeviceGetSmcByNameResponse
3162    {
3163        #[inline(always)]
3164        fn new_empty() -> Self {
3165            Self {
3166                smc: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3167            }
3168        }
3169
3170        #[inline]
3171        unsafe fn decode(
3172            &mut self,
3173            decoder: &mut fidl::encoding::Decoder<
3174                '_,
3175                fidl::encoding::DefaultFuchsiaResourceDialect,
3176            >,
3177            offset: usize,
3178            _depth: fidl::encoding::Depth,
3179        ) -> fidl::Result<()> {
3180            decoder.debug_check_bounds::<Self>(offset);
3181            // Verify that padding bytes are zero.
3182            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.smc, decoder, offset + 0, _depth)?;
3183            Ok(())
3184        }
3185    }
3186
3187    impl Mmio {
3188        #[inline(always)]
3189        fn max_ordinal_present(&self) -> u64 {
3190            if let Some(_) = self.vmo {
3191                return 3;
3192            }
3193            if let Some(_) = self.size {
3194                return 2;
3195            }
3196            if let Some(_) = self.offset {
3197                return 1;
3198            }
3199            0
3200        }
3201    }
3202
3203    impl fidl::encoding::ResourceTypeMarker for Mmio {
3204        type Borrowed<'a> = &'a mut Self;
3205        fn take_or_borrow<'a>(
3206            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3207        ) -> Self::Borrowed<'a> {
3208            value
3209        }
3210    }
3211
3212    unsafe impl fidl::encoding::TypeMarker for Mmio {
3213        type Owned = Self;
3214
3215        #[inline(always)]
3216        fn inline_align(_context: fidl::encoding::Context) -> usize {
3217            8
3218        }
3219
3220        #[inline(always)]
3221        fn inline_size(_context: fidl::encoding::Context) -> usize {
3222            16
3223        }
3224    }
3225
3226    unsafe impl fidl::encoding::Encode<Mmio, fidl::encoding::DefaultFuchsiaResourceDialect>
3227        for &mut Mmio
3228    {
3229        unsafe fn encode(
3230            self,
3231            encoder: &mut fidl::encoding::Encoder<
3232                '_,
3233                fidl::encoding::DefaultFuchsiaResourceDialect,
3234            >,
3235            offset: usize,
3236            mut depth: fidl::encoding::Depth,
3237        ) -> fidl::Result<()> {
3238            encoder.debug_check_bounds::<Mmio>(offset);
3239            // Vector header
3240            let max_ordinal: u64 = self.max_ordinal_present();
3241            encoder.write_num(max_ordinal, offset);
3242            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3243            // Calling encoder.out_of_line_offset(0) is not allowed.
3244            if max_ordinal == 0 {
3245                return Ok(());
3246            }
3247            depth.increment()?;
3248            let envelope_size = 8;
3249            let bytes_len = max_ordinal as usize * envelope_size;
3250            #[allow(unused_variables)]
3251            let offset = encoder.out_of_line_offset(bytes_len);
3252            let mut _prev_end_offset: usize = 0;
3253            if 1 > max_ordinal {
3254                return Ok(());
3255            }
3256
3257            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3258            // are envelope_size bytes.
3259            let cur_offset: usize = (1 - 1) * envelope_size;
3260
3261            // Zero reserved fields.
3262            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3263
3264            // Safety:
3265            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3266            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3267            //   envelope_size bytes, there is always sufficient room.
3268            fidl::encoding::encode_in_envelope_optional::<
3269                u64,
3270                fidl::encoding::DefaultFuchsiaResourceDialect,
3271            >(
3272                self.offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3273                encoder,
3274                offset + cur_offset,
3275                depth,
3276            )?;
3277
3278            _prev_end_offset = cur_offset + envelope_size;
3279            if 2 > max_ordinal {
3280                return Ok(());
3281            }
3282
3283            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3284            // are envelope_size bytes.
3285            let cur_offset: usize = (2 - 1) * envelope_size;
3286
3287            // Zero reserved fields.
3288            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3289
3290            // Safety:
3291            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3292            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3293            //   envelope_size bytes, there is always sufficient room.
3294            fidl::encoding::encode_in_envelope_optional::<
3295                u64,
3296                fidl::encoding::DefaultFuchsiaResourceDialect,
3297            >(
3298                self.size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3299                encoder,
3300                offset + cur_offset,
3301                depth,
3302            )?;
3303
3304            _prev_end_offset = cur_offset + envelope_size;
3305            if 3 > max_ordinal {
3306                return Ok(());
3307            }
3308
3309            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3310            // are envelope_size bytes.
3311            let cur_offset: usize = (3 - 1) * envelope_size;
3312
3313            // Zero reserved fields.
3314            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3315
3316            // Safety:
3317            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3318            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3319            //   envelope_size bytes, there is always sufficient room.
3320            fidl::encoding::encode_in_envelope_optional::<
3321                fidl::encoding::HandleType<
3322                    fidl::Vmo,
3323                    { fidl::ObjectType::VMO.into_raw() },
3324                    2147483648,
3325                >,
3326                fidl::encoding::DefaultFuchsiaResourceDialect,
3327            >(
3328                self.vmo.as_mut().map(
3329                    <fidl::encoding::HandleType<
3330                        fidl::Vmo,
3331                        { fidl::ObjectType::VMO.into_raw() },
3332                        2147483648,
3333                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3334                ),
3335                encoder,
3336                offset + cur_offset,
3337                depth,
3338            )?;
3339
3340            _prev_end_offset = cur_offset + envelope_size;
3341
3342            Ok(())
3343        }
3344    }
3345
3346    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Mmio {
3347        #[inline(always)]
3348        fn new_empty() -> Self {
3349            Self::default()
3350        }
3351
3352        unsafe fn decode(
3353            &mut self,
3354            decoder: &mut fidl::encoding::Decoder<
3355                '_,
3356                fidl::encoding::DefaultFuchsiaResourceDialect,
3357            >,
3358            offset: usize,
3359            mut depth: fidl::encoding::Depth,
3360        ) -> fidl::Result<()> {
3361            decoder.debug_check_bounds::<Self>(offset);
3362            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3363                None => return Err(fidl::Error::NotNullable),
3364                Some(len) => len,
3365            };
3366            // Calling decoder.out_of_line_offset(0) is not allowed.
3367            if len == 0 {
3368                return Ok(());
3369            };
3370            depth.increment()?;
3371            let envelope_size = 8;
3372            let bytes_len = len * envelope_size;
3373            let offset = decoder.out_of_line_offset(bytes_len)?;
3374            // Decode the envelope for each type.
3375            let mut _next_ordinal_to_read = 0;
3376            let mut next_offset = offset;
3377            let end_offset = offset + bytes_len;
3378            _next_ordinal_to_read += 1;
3379            if next_offset >= end_offset {
3380                return Ok(());
3381            }
3382
3383            // Decode unknown envelopes for gaps in ordinals.
3384            while _next_ordinal_to_read < 1 {
3385                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3386                _next_ordinal_to_read += 1;
3387                next_offset += envelope_size;
3388            }
3389
3390            let next_out_of_line = decoder.next_out_of_line();
3391            let handles_before = decoder.remaining_handles();
3392            if let Some((inlined, num_bytes, num_handles)) =
3393                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3394            {
3395                let member_inline_size =
3396                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3397                if inlined != (member_inline_size <= 4) {
3398                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3399                }
3400                let inner_offset;
3401                let mut inner_depth = depth.clone();
3402                if inlined {
3403                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3404                    inner_offset = next_offset;
3405                } else {
3406                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3407                    inner_depth.increment()?;
3408                }
3409                let val_ref = self.offset.get_or_insert_with(|| {
3410                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3411                });
3412                fidl::decode!(
3413                    u64,
3414                    fidl::encoding::DefaultFuchsiaResourceDialect,
3415                    val_ref,
3416                    decoder,
3417                    inner_offset,
3418                    inner_depth
3419                )?;
3420                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3421                {
3422                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3423                }
3424                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3425                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3426                }
3427            }
3428
3429            next_offset += envelope_size;
3430            _next_ordinal_to_read += 1;
3431            if next_offset >= end_offset {
3432                return Ok(());
3433            }
3434
3435            // Decode unknown envelopes for gaps in ordinals.
3436            while _next_ordinal_to_read < 2 {
3437                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3438                _next_ordinal_to_read += 1;
3439                next_offset += envelope_size;
3440            }
3441
3442            let next_out_of_line = decoder.next_out_of_line();
3443            let handles_before = decoder.remaining_handles();
3444            if let Some((inlined, num_bytes, num_handles)) =
3445                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3446            {
3447                let member_inline_size =
3448                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3449                if inlined != (member_inline_size <= 4) {
3450                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3451                }
3452                let inner_offset;
3453                let mut inner_depth = depth.clone();
3454                if inlined {
3455                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3456                    inner_offset = next_offset;
3457                } else {
3458                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3459                    inner_depth.increment()?;
3460                }
3461                let val_ref = self.size.get_or_insert_with(|| {
3462                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3463                });
3464                fidl::decode!(
3465                    u64,
3466                    fidl::encoding::DefaultFuchsiaResourceDialect,
3467                    val_ref,
3468                    decoder,
3469                    inner_offset,
3470                    inner_depth
3471                )?;
3472                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3473                {
3474                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3475                }
3476                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3477                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3478                }
3479            }
3480
3481            next_offset += envelope_size;
3482            _next_ordinal_to_read += 1;
3483            if next_offset >= end_offset {
3484                return Ok(());
3485            }
3486
3487            // Decode unknown envelopes for gaps in ordinals.
3488            while _next_ordinal_to_read < 3 {
3489                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3490                _next_ordinal_to_read += 1;
3491                next_offset += envelope_size;
3492            }
3493
3494            let next_out_of_line = decoder.next_out_of_line();
3495            let handles_before = decoder.remaining_handles();
3496            if let Some((inlined, num_bytes, num_handles)) =
3497                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3498            {
3499                let member_inline_size = <fidl::encoding::HandleType<
3500                    fidl::Vmo,
3501                    { fidl::ObjectType::VMO.into_raw() },
3502                    2147483648,
3503                > as fidl::encoding::TypeMarker>::inline_size(
3504                    decoder.context
3505                );
3506                if inlined != (member_inline_size <= 4) {
3507                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3508                }
3509                let inner_offset;
3510                let mut inner_depth = depth.clone();
3511                if inlined {
3512                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3513                    inner_offset = next_offset;
3514                } else {
3515                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3516                    inner_depth.increment()?;
3517                }
3518                let val_ref =
3519                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3520                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3521                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3522                {
3523                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3524                }
3525                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3526                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3527                }
3528            }
3529
3530            next_offset += envelope_size;
3531
3532            // Decode the remaining unknown envelopes.
3533            while next_offset < end_offset {
3534                _next_ordinal_to_read += 1;
3535                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3536                next_offset += envelope_size;
3537            }
3538
3539            Ok(())
3540        }
3541    }
3542}