Skip to main content

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