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 DeviceControlHandle {
1568    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1569        self.inner.shutdown_with_epitaph(status.into())
1570    }
1571}
1572
1573impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1574    fn shutdown(&self) {
1575        self.inner.shutdown()
1576    }
1577
1578    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1579        self.inner.shutdown_with_epitaph(status)
1580    }
1581
1582    fn is_closed(&self) -> bool {
1583        self.inner.channel().is_closed()
1584    }
1585    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1586        self.inner.channel().on_closed()
1587    }
1588
1589    #[cfg(target_os = "fuchsia")]
1590    fn signal_peer(
1591        &self,
1592        clear_mask: zx::Signals,
1593        set_mask: zx::Signals,
1594    ) -> Result<(), zx_status::Status> {
1595        use fidl::Peered;
1596        self.inner.channel().signal_peer(clear_mask, set_mask)
1597    }
1598}
1599
1600impl DeviceControlHandle {}
1601
1602#[must_use = "FIDL methods require a response to be sent"]
1603#[derive(Debug)]
1604pub struct DeviceGetMmioByIdResponder {
1605    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1606    tx_id: u32,
1607}
1608
1609/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1610/// if the responder is dropped without sending a response, so that the client
1611/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1612impl std::ops::Drop for DeviceGetMmioByIdResponder {
1613    fn drop(&mut self) {
1614        self.control_handle.shutdown();
1615        // Safety: drops once, never accessed again
1616        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1617    }
1618}
1619
1620impl fidl::endpoints::Responder for DeviceGetMmioByIdResponder {
1621    type ControlHandle = DeviceControlHandle;
1622
1623    fn control_handle(&self) -> &DeviceControlHandle {
1624        &self.control_handle
1625    }
1626
1627    fn drop_without_shutdown(mut self) {
1628        // Safety: drops once, never accessed again due to mem::forget
1629        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1630        // Prevent Drop from running (which would shut down the channel)
1631        std::mem::forget(self);
1632    }
1633}
1634
1635impl DeviceGetMmioByIdResponder {
1636    /// Sends a response to the FIDL transaction.
1637    ///
1638    /// Sets the channel to shutdown if an error occurs.
1639    pub fn send(self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1640        let _result = self.send_raw(result);
1641        if _result.is_err() {
1642            self.control_handle.shutdown();
1643        }
1644        self.drop_without_shutdown();
1645        _result
1646    }
1647
1648    /// Similar to "send" but does not shutdown the channel if an error occurs.
1649    pub fn send_no_shutdown_on_err(self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1650        let _result = self.send_raw(result);
1651        self.drop_without_shutdown();
1652        _result
1653    }
1654
1655    fn send_raw(&self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1656        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<Mmio, i32>>(
1657            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1658            self.tx_id,
1659            0x2fe2767f0aeec203,
1660            fidl::encoding::DynamicFlags::FLEXIBLE,
1661        )
1662    }
1663}
1664
1665#[must_use = "FIDL methods require a response to be sent"]
1666#[derive(Debug)]
1667pub struct DeviceGetMmioByNameResponder {
1668    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1669    tx_id: u32,
1670}
1671
1672/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1673/// if the responder is dropped without sending a response, so that the client
1674/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1675impl std::ops::Drop for DeviceGetMmioByNameResponder {
1676    fn drop(&mut self) {
1677        self.control_handle.shutdown();
1678        // Safety: drops once, never accessed again
1679        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1680    }
1681}
1682
1683impl fidl::endpoints::Responder for DeviceGetMmioByNameResponder {
1684    type ControlHandle = DeviceControlHandle;
1685
1686    fn control_handle(&self) -> &DeviceControlHandle {
1687        &self.control_handle
1688    }
1689
1690    fn drop_without_shutdown(mut self) {
1691        // Safety: drops once, never accessed again due to mem::forget
1692        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1693        // Prevent Drop from running (which would shut down the channel)
1694        std::mem::forget(self);
1695    }
1696}
1697
1698impl DeviceGetMmioByNameResponder {
1699    /// Sends a response to the FIDL transaction.
1700    ///
1701    /// Sets the channel to shutdown if an error occurs.
1702    pub fn send(self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1703        let _result = self.send_raw(result);
1704        if _result.is_err() {
1705            self.control_handle.shutdown();
1706        }
1707        self.drop_without_shutdown();
1708        _result
1709    }
1710
1711    /// Similar to "send" but does not shutdown the channel if an error occurs.
1712    pub fn send_no_shutdown_on_err(self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1713        let _result = self.send_raw(result);
1714        self.drop_without_shutdown();
1715        _result
1716    }
1717
1718    fn send_raw(&self, mut result: Result<Mmio, i32>) -> Result<(), fidl::Error> {
1719        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<Mmio, i32>>(
1720            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1721            self.tx_id,
1722            0x27dc17076e665076,
1723            fidl::encoding::DynamicFlags::FLEXIBLE,
1724        )
1725    }
1726}
1727
1728#[must_use = "FIDL methods require a response to be sent"]
1729#[derive(Debug)]
1730pub struct DeviceGetInterruptByIdResponder {
1731    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1732    tx_id: u32,
1733}
1734
1735/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1736/// if the responder is dropped without sending a response, so that the client
1737/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1738impl std::ops::Drop for DeviceGetInterruptByIdResponder {
1739    fn drop(&mut self) {
1740        self.control_handle.shutdown();
1741        // Safety: drops once, never accessed again
1742        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1743    }
1744}
1745
1746impl fidl::endpoints::Responder for DeviceGetInterruptByIdResponder {
1747    type ControlHandle = DeviceControlHandle;
1748
1749    fn control_handle(&self) -> &DeviceControlHandle {
1750        &self.control_handle
1751    }
1752
1753    fn drop_without_shutdown(mut self) {
1754        // Safety: drops once, never accessed again due to mem::forget
1755        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1756        // Prevent Drop from running (which would shut down the channel)
1757        std::mem::forget(self);
1758    }
1759}
1760
1761impl DeviceGetInterruptByIdResponder {
1762    /// Sends a response to the FIDL transaction.
1763    ///
1764    /// Sets the channel to shutdown if an error occurs.
1765    pub fn send(self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
1766        let _result = self.send_raw(result);
1767        if _result.is_err() {
1768            self.control_handle.shutdown();
1769        }
1770        self.drop_without_shutdown();
1771        _result
1772    }
1773
1774    /// Similar to "send" but does not shutdown the channel if an error occurs.
1775    pub fn send_no_shutdown_on_err(
1776        self,
1777        mut result: Result<fidl::Interrupt, i32>,
1778    ) -> Result<(), fidl::Error> {
1779        let _result = self.send_raw(result);
1780        self.drop_without_shutdown();
1781        _result
1782    }
1783
1784    fn send_raw(&self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
1785        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1786            DeviceGetInterruptByIdResponse,
1787            i32,
1788        >>(
1789            fidl::encoding::FlexibleResult::new(result.map(|irq| (irq,))),
1790            self.tx_id,
1791            0x4af1d7ccf7a4a4bc,
1792            fidl::encoding::DynamicFlags::FLEXIBLE,
1793        )
1794    }
1795}
1796
1797#[must_use = "FIDL methods require a response to be sent"]
1798#[derive(Debug)]
1799pub struct DeviceGetInterruptByNameResponder {
1800    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1801    tx_id: u32,
1802}
1803
1804/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1805/// if the responder is dropped without sending a response, so that the client
1806/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1807impl std::ops::Drop for DeviceGetInterruptByNameResponder {
1808    fn drop(&mut self) {
1809        self.control_handle.shutdown();
1810        // Safety: drops once, never accessed again
1811        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1812    }
1813}
1814
1815impl fidl::endpoints::Responder for DeviceGetInterruptByNameResponder {
1816    type ControlHandle = DeviceControlHandle;
1817
1818    fn control_handle(&self) -> &DeviceControlHandle {
1819        &self.control_handle
1820    }
1821
1822    fn drop_without_shutdown(mut self) {
1823        // Safety: drops once, never accessed again due to mem::forget
1824        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1825        // Prevent Drop from running (which would shut down the channel)
1826        std::mem::forget(self);
1827    }
1828}
1829
1830impl DeviceGetInterruptByNameResponder {
1831    /// Sends a response to the FIDL transaction.
1832    ///
1833    /// Sets the channel to shutdown if an error occurs.
1834    pub fn send(self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
1835        let _result = self.send_raw(result);
1836        if _result.is_err() {
1837            self.control_handle.shutdown();
1838        }
1839        self.drop_without_shutdown();
1840        _result
1841    }
1842
1843    /// Similar to "send" but does not shutdown the channel if an error occurs.
1844    pub fn send_no_shutdown_on_err(
1845        self,
1846        mut result: Result<fidl::Interrupt, i32>,
1847    ) -> Result<(), fidl::Error> {
1848        let _result = self.send_raw(result);
1849        self.drop_without_shutdown();
1850        _result
1851    }
1852
1853    fn send_raw(&self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
1854        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1855            DeviceGetInterruptByNameResponse,
1856            i32,
1857        >>(
1858            fidl::encoding::FlexibleResult::new(result.map(|irq| (irq,))),
1859            self.tx_id,
1860            0x165fbc6619b2b64f,
1861            fidl::encoding::DynamicFlags::FLEXIBLE,
1862        )
1863    }
1864}
1865
1866#[must_use = "FIDL methods require a response to be sent"]
1867#[derive(Debug)]
1868pub struct DeviceGetBtiByIdResponder {
1869    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1870    tx_id: u32,
1871}
1872
1873/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1874/// if the responder is dropped without sending a response, so that the client
1875/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1876impl std::ops::Drop for DeviceGetBtiByIdResponder {
1877    fn drop(&mut self) {
1878        self.control_handle.shutdown();
1879        // Safety: drops once, never accessed again
1880        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1881    }
1882}
1883
1884impl fidl::endpoints::Responder for DeviceGetBtiByIdResponder {
1885    type ControlHandle = DeviceControlHandle;
1886
1887    fn control_handle(&self) -> &DeviceControlHandle {
1888        &self.control_handle
1889    }
1890
1891    fn drop_without_shutdown(mut self) {
1892        // Safety: drops once, never accessed again due to mem::forget
1893        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1894        // Prevent Drop from running (which would shut down the channel)
1895        std::mem::forget(self);
1896    }
1897}
1898
1899impl DeviceGetBtiByIdResponder {
1900    /// Sends a response to the FIDL transaction.
1901    ///
1902    /// Sets the channel to shutdown if an error occurs.
1903    pub fn send(self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
1904        let _result = self.send_raw(result);
1905        if _result.is_err() {
1906            self.control_handle.shutdown();
1907        }
1908        self.drop_without_shutdown();
1909        _result
1910    }
1911
1912    /// Similar to "send" but does not shutdown the channel if an error occurs.
1913    pub fn send_no_shutdown_on_err(
1914        self,
1915        mut result: Result<fidl::Bti, i32>,
1916    ) -> Result<(), fidl::Error> {
1917        let _result = self.send_raw(result);
1918        self.drop_without_shutdown();
1919        _result
1920    }
1921
1922    fn send_raw(&self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
1923        self.control_handle
1924            .inner
1925            .send::<fidl::encoding::FlexibleResultType<DeviceGetBtiByIdResponse, i32>>(
1926                fidl::encoding::FlexibleResult::new(result.map(|bti| (bti,))),
1927                self.tx_id,
1928                0x7b4518a90bcd5463,
1929                fidl::encoding::DynamicFlags::FLEXIBLE,
1930            )
1931    }
1932}
1933
1934#[must_use = "FIDL methods require a response to be sent"]
1935#[derive(Debug)]
1936pub struct DeviceGetBtiByNameResponder {
1937    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1938    tx_id: u32,
1939}
1940
1941/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1942/// if the responder is dropped without sending a response, so that the client
1943/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1944impl std::ops::Drop for DeviceGetBtiByNameResponder {
1945    fn drop(&mut self) {
1946        self.control_handle.shutdown();
1947        // Safety: drops once, never accessed again
1948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1949    }
1950}
1951
1952impl fidl::endpoints::Responder for DeviceGetBtiByNameResponder {
1953    type ControlHandle = DeviceControlHandle;
1954
1955    fn control_handle(&self) -> &DeviceControlHandle {
1956        &self.control_handle
1957    }
1958
1959    fn drop_without_shutdown(mut self) {
1960        // Safety: drops once, never accessed again due to mem::forget
1961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1962        // Prevent Drop from running (which would shut down the channel)
1963        std::mem::forget(self);
1964    }
1965}
1966
1967impl DeviceGetBtiByNameResponder {
1968    /// Sends a response to the FIDL transaction.
1969    ///
1970    /// Sets the channel to shutdown if an error occurs.
1971    pub fn send(self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
1972        let _result = self.send_raw(result);
1973        if _result.is_err() {
1974            self.control_handle.shutdown();
1975        }
1976        self.drop_without_shutdown();
1977        _result
1978    }
1979
1980    /// Similar to "send" but does not shutdown the channel if an error occurs.
1981    pub fn send_no_shutdown_on_err(
1982        self,
1983        mut result: Result<fidl::Bti, i32>,
1984    ) -> Result<(), fidl::Error> {
1985        let _result = self.send_raw(result);
1986        self.drop_without_shutdown();
1987        _result
1988    }
1989
1990    fn send_raw(&self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
1991        self.control_handle
1992            .inner
1993            .send::<fidl::encoding::FlexibleResultType<DeviceGetBtiByNameResponse, i32>>(
1994                fidl::encoding::FlexibleResult::new(result.map(|bti| (bti,))),
1995                self.tx_id,
1996                0x358f37bd43460531,
1997                fidl::encoding::DynamicFlags::FLEXIBLE,
1998            )
1999    }
2000}
2001
2002#[must_use = "FIDL methods require a response to be sent"]
2003#[derive(Debug)]
2004pub struct DeviceGetSmcByIdResponder {
2005    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2006    tx_id: u32,
2007}
2008
2009/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2010/// if the responder is dropped without sending a response, so that the client
2011/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2012impl std::ops::Drop for DeviceGetSmcByIdResponder {
2013    fn drop(&mut self) {
2014        self.control_handle.shutdown();
2015        // Safety: drops once, never accessed again
2016        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2017    }
2018}
2019
2020impl fidl::endpoints::Responder for DeviceGetSmcByIdResponder {
2021    type ControlHandle = DeviceControlHandle;
2022
2023    fn control_handle(&self) -> &DeviceControlHandle {
2024        &self.control_handle
2025    }
2026
2027    fn drop_without_shutdown(mut self) {
2028        // Safety: drops once, never accessed again due to mem::forget
2029        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2030        // Prevent Drop from running (which would shut down the channel)
2031        std::mem::forget(self);
2032    }
2033}
2034
2035impl DeviceGetSmcByIdResponder {
2036    /// Sends a response to the FIDL transaction.
2037    ///
2038    /// Sets the channel to shutdown if an error occurs.
2039    pub fn send(self, mut result: Result<fidl::Resource, i32>) -> Result<(), fidl::Error> {
2040        let _result = self.send_raw(result);
2041        if _result.is_err() {
2042            self.control_handle.shutdown();
2043        }
2044        self.drop_without_shutdown();
2045        _result
2046    }
2047
2048    /// Similar to "send" but does not shutdown the channel if an error occurs.
2049    pub fn send_no_shutdown_on_err(
2050        self,
2051        mut result: Result<fidl::Resource, i32>,
2052    ) -> Result<(), fidl::Error> {
2053        let _result = self.send_raw(result);
2054        self.drop_without_shutdown();
2055        _result
2056    }
2057
2058    fn send_raw(&self, mut result: Result<fidl::Resource, i32>) -> Result<(), fidl::Error> {
2059        self.control_handle
2060            .inner
2061            .send::<fidl::encoding::FlexibleResultType<DeviceGetSmcByIdResponse, i32>>(
2062                fidl::encoding::FlexibleResult::new(result.map(|smc| (smc,))),
2063                self.tx_id,
2064                0x40e6da56a39e0e34,
2065                fidl::encoding::DynamicFlags::FLEXIBLE,
2066            )
2067    }
2068}
2069
2070#[must_use = "FIDL methods require a response to be sent"]
2071#[derive(Debug)]
2072pub struct DeviceGetSmcByNameResponder {
2073    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2074    tx_id: u32,
2075}
2076
2077/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2078/// if the responder is dropped without sending a response, so that the client
2079/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2080impl std::ops::Drop for DeviceGetSmcByNameResponder {
2081    fn drop(&mut self) {
2082        self.control_handle.shutdown();
2083        // Safety: drops once, never accessed again
2084        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2085    }
2086}
2087
2088impl fidl::endpoints::Responder for DeviceGetSmcByNameResponder {
2089    type ControlHandle = DeviceControlHandle;
2090
2091    fn control_handle(&self) -> &DeviceControlHandle {
2092        &self.control_handle
2093    }
2094
2095    fn drop_without_shutdown(mut self) {
2096        // Safety: drops once, never accessed again due to mem::forget
2097        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2098        // Prevent Drop from running (which would shut down the channel)
2099        std::mem::forget(self);
2100    }
2101}
2102
2103impl DeviceGetSmcByNameResponder {
2104    /// Sends a response to the FIDL transaction.
2105    ///
2106    /// Sets the channel to shutdown if an error occurs.
2107    pub fn send(self, mut result: Result<fidl::Resource, i32>) -> Result<(), fidl::Error> {
2108        let _result = self.send_raw(result);
2109        if _result.is_err() {
2110            self.control_handle.shutdown();
2111        }
2112        self.drop_without_shutdown();
2113        _result
2114    }
2115
2116    /// Similar to "send" but does not shutdown the channel if an error occurs.
2117    pub fn send_no_shutdown_on_err(
2118        self,
2119        mut result: Result<fidl::Resource, i32>,
2120    ) -> Result<(), fidl::Error> {
2121        let _result = self.send_raw(result);
2122        self.drop_without_shutdown();
2123        _result
2124    }
2125
2126    fn send_raw(&self, mut result: Result<fidl::Resource, i32>) -> Result<(), fidl::Error> {
2127        self.control_handle
2128            .inner
2129            .send::<fidl::encoding::FlexibleResultType<DeviceGetSmcByNameResponse, i32>>(
2130                fidl::encoding::FlexibleResult::new(result.map(|smc| (smc,))),
2131                self.tx_id,
2132                0x3e13238c0bba6da2,
2133                fidl::encoding::DynamicFlags::FLEXIBLE,
2134            )
2135    }
2136}
2137
2138#[must_use = "FIDL methods require a response to be sent"]
2139#[derive(Debug)]
2140pub struct DeviceGetPowerConfigurationResponder {
2141    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2142    tx_id: u32,
2143}
2144
2145/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2146/// if the responder is dropped without sending a response, so that the client
2147/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2148impl std::ops::Drop for DeviceGetPowerConfigurationResponder {
2149    fn drop(&mut self) {
2150        self.control_handle.shutdown();
2151        // Safety: drops once, never accessed again
2152        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2153    }
2154}
2155
2156impl fidl::endpoints::Responder for DeviceGetPowerConfigurationResponder {
2157    type ControlHandle = DeviceControlHandle;
2158
2159    fn control_handle(&self) -> &DeviceControlHandle {
2160        &self.control_handle
2161    }
2162
2163    fn drop_without_shutdown(mut self) {
2164        // Safety: drops once, never accessed again due to mem::forget
2165        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2166        // Prevent Drop from running (which would shut down the channel)
2167        std::mem::forget(self);
2168    }
2169}
2170
2171impl DeviceGetPowerConfigurationResponder {
2172    /// Sends a response to the FIDL transaction.
2173    ///
2174    /// Sets the channel to shutdown if an error occurs.
2175    pub fn send(
2176        self,
2177        mut result: Result<&[fidl_fuchsia_hardware_power::PowerElementConfiguration], i32>,
2178    ) -> Result<(), fidl::Error> {
2179        let _result = self.send_raw(result);
2180        if _result.is_err() {
2181            self.control_handle.shutdown();
2182        }
2183        self.drop_without_shutdown();
2184        _result
2185    }
2186
2187    /// Similar to "send" but does not shutdown the channel if an error occurs.
2188    pub fn send_no_shutdown_on_err(
2189        self,
2190        mut result: Result<&[fidl_fuchsia_hardware_power::PowerElementConfiguration], i32>,
2191    ) -> Result<(), fidl::Error> {
2192        let _result = self.send_raw(result);
2193        self.drop_without_shutdown();
2194        _result
2195    }
2196
2197    fn send_raw(
2198        &self,
2199        mut result: Result<&[fidl_fuchsia_hardware_power::PowerElementConfiguration], i32>,
2200    ) -> Result<(), fidl::Error> {
2201        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2202            DeviceGetPowerConfigurationResponse,
2203            i32,
2204        >>(
2205            fidl::encoding::FlexibleResult::new(result.map(|config| (config,))),
2206            self.tx_id,
2207            0x8b08024ba9c2587,
2208            fidl::encoding::DynamicFlags::FLEXIBLE,
2209        )
2210    }
2211}
2212
2213#[must_use = "FIDL methods require a response to be sent"]
2214#[derive(Debug)]
2215pub struct DeviceGetNodeDeviceInfoResponder {
2216    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2217    tx_id: u32,
2218}
2219
2220/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2221/// if the responder is dropped without sending a response, so that the client
2222/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2223impl std::ops::Drop for DeviceGetNodeDeviceInfoResponder {
2224    fn drop(&mut self) {
2225        self.control_handle.shutdown();
2226        // Safety: drops once, never accessed again
2227        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2228    }
2229}
2230
2231impl fidl::endpoints::Responder for DeviceGetNodeDeviceInfoResponder {
2232    type ControlHandle = DeviceControlHandle;
2233
2234    fn control_handle(&self) -> &DeviceControlHandle {
2235        &self.control_handle
2236    }
2237
2238    fn drop_without_shutdown(mut self) {
2239        // Safety: drops once, never accessed again due to mem::forget
2240        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2241        // Prevent Drop from running (which would shut down the channel)
2242        std::mem::forget(self);
2243    }
2244}
2245
2246impl DeviceGetNodeDeviceInfoResponder {
2247    /// Sends a response to the FIDL transaction.
2248    ///
2249    /// Sets the channel to shutdown if an error occurs.
2250    pub fn send(self, mut result: Result<&NodeDeviceInfo, i32>) -> Result<(), fidl::Error> {
2251        let _result = self.send_raw(result);
2252        if _result.is_err() {
2253            self.control_handle.shutdown();
2254        }
2255        self.drop_without_shutdown();
2256        _result
2257    }
2258
2259    /// Similar to "send" but does not shutdown the channel if an error occurs.
2260    pub fn send_no_shutdown_on_err(
2261        self,
2262        mut result: Result<&NodeDeviceInfo, i32>,
2263    ) -> Result<(), fidl::Error> {
2264        let _result = self.send_raw(result);
2265        self.drop_without_shutdown();
2266        _result
2267    }
2268
2269    fn send_raw(&self, mut result: Result<&NodeDeviceInfo, i32>) -> Result<(), fidl::Error> {
2270        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<NodeDeviceInfo, i32>>(
2271            fidl::encoding::FlexibleResult::new(result),
2272            self.tx_id,
2273            0x9a4e8a63ba682,
2274            fidl::encoding::DynamicFlags::FLEXIBLE,
2275        )
2276    }
2277}
2278
2279#[must_use = "FIDL methods require a response to be sent"]
2280#[derive(Debug)]
2281pub struct DeviceGetBoardInfoResponder {
2282    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2283    tx_id: u32,
2284}
2285
2286/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2287/// if the responder is dropped without sending a response, so that the client
2288/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2289impl std::ops::Drop for DeviceGetBoardInfoResponder {
2290    fn drop(&mut self) {
2291        self.control_handle.shutdown();
2292        // Safety: drops once, never accessed again
2293        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2294    }
2295}
2296
2297impl fidl::endpoints::Responder for DeviceGetBoardInfoResponder {
2298    type ControlHandle = DeviceControlHandle;
2299
2300    fn control_handle(&self) -> &DeviceControlHandle {
2301        &self.control_handle
2302    }
2303
2304    fn drop_without_shutdown(mut self) {
2305        // Safety: drops once, never accessed again due to mem::forget
2306        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2307        // Prevent Drop from running (which would shut down the channel)
2308        std::mem::forget(self);
2309    }
2310}
2311
2312impl DeviceGetBoardInfoResponder {
2313    /// Sends a response to the FIDL transaction.
2314    ///
2315    /// Sets the channel to shutdown if an error occurs.
2316    pub fn send(self, mut result: Result<&BoardInfo, i32>) -> Result<(), fidl::Error> {
2317        let _result = self.send_raw(result);
2318        if _result.is_err() {
2319            self.control_handle.shutdown();
2320        }
2321        self.drop_without_shutdown();
2322        _result
2323    }
2324
2325    /// Similar to "send" but does not shutdown the channel if an error occurs.
2326    pub fn send_no_shutdown_on_err(
2327        self,
2328        mut result: Result<&BoardInfo, i32>,
2329    ) -> Result<(), fidl::Error> {
2330        let _result = self.send_raw(result);
2331        self.drop_without_shutdown();
2332        _result
2333    }
2334
2335    fn send_raw(&self, mut result: Result<&BoardInfo, i32>) -> Result<(), fidl::Error> {
2336        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<BoardInfo, i32>>(
2337            fidl::encoding::FlexibleResult::new(result),
2338            self.tx_id,
2339            0x9140d82923eee4b,
2340            fidl::encoding::DynamicFlags::FLEXIBLE,
2341        )
2342    }
2343}
2344
2345#[must_use = "FIDL methods require a response to be sent"]
2346#[derive(Debug)]
2347pub struct DeviceGetMetadataResponder {
2348    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2349    tx_id: u32,
2350}
2351
2352/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2353/// if the responder is dropped without sending a response, so that the client
2354/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2355impl std::ops::Drop for DeviceGetMetadataResponder {
2356    fn drop(&mut self) {
2357        self.control_handle.shutdown();
2358        // Safety: drops once, never accessed again
2359        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2360    }
2361}
2362
2363impl fidl::endpoints::Responder for DeviceGetMetadataResponder {
2364    type ControlHandle = DeviceControlHandle;
2365
2366    fn control_handle(&self) -> &DeviceControlHandle {
2367        &self.control_handle
2368    }
2369
2370    fn drop_without_shutdown(mut self) {
2371        // Safety: drops once, never accessed again due to mem::forget
2372        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2373        // Prevent Drop from running (which would shut down the channel)
2374        std::mem::forget(self);
2375    }
2376}
2377
2378impl DeviceGetMetadataResponder {
2379    /// Sends a response to the FIDL transaction.
2380    ///
2381    /// Sets the channel to shutdown if an error occurs.
2382    pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2383        let _result = self.send_raw(result);
2384        if _result.is_err() {
2385            self.control_handle.shutdown();
2386        }
2387        self.drop_without_shutdown();
2388        _result
2389    }
2390
2391    /// Similar to "send" but does not shutdown the channel if an error occurs.
2392    pub fn send_no_shutdown_on_err(
2393        self,
2394        mut result: Result<&[u8], i32>,
2395    ) -> Result<(), fidl::Error> {
2396        let _result = self.send_raw(result);
2397        self.drop_without_shutdown();
2398        _result
2399    }
2400
2401    fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2402        self.control_handle
2403            .inner
2404            .send::<fidl::encoding::FlexibleResultType<DeviceGetMetadataResponse, i32>>(
2405                fidl::encoding::FlexibleResult::new(result.map(|metadata| (metadata,))),
2406                self.tx_id,
2407                0x36e18be3a7c6cc70,
2408                fidl::encoding::DynamicFlags::FLEXIBLE,
2409            )
2410    }
2411}
2412
2413#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2414pub struct ServiceMarker;
2415
2416#[cfg(target_os = "fuchsia")]
2417impl fidl::endpoints::ServiceMarker for ServiceMarker {
2418    type Proxy = ServiceProxy;
2419    type Request = ServiceRequest;
2420    const SERVICE_NAME: &'static str = "fuchsia.hardware.platform.device.Service";
2421}
2422
2423/// A request for one of the member protocols of Service.
2424///
2425#[cfg(target_os = "fuchsia")]
2426pub enum ServiceRequest {
2427    Device(DeviceRequestStream),
2428}
2429
2430#[cfg(target_os = "fuchsia")]
2431impl fidl::endpoints::ServiceRequest for ServiceRequest {
2432    type Service = ServiceMarker;
2433
2434    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2435        match name {
2436            "device" => Self::Device(
2437                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2438            ),
2439            _ => panic!("no such member protocol name for service Service"),
2440        }
2441    }
2442
2443    fn member_names() -> &'static [&'static str] {
2444        &["device"]
2445    }
2446}
2447#[cfg(target_os = "fuchsia")]
2448pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2449
2450#[cfg(target_os = "fuchsia")]
2451impl fidl::endpoints::ServiceProxy for ServiceProxy {
2452    type Service = ServiceMarker;
2453
2454    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2455        Self(opener)
2456    }
2457}
2458
2459#[cfg(target_os = "fuchsia")]
2460impl ServiceProxy {
2461    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
2462        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2463        self.connect_channel_to_device(server_end)?;
2464        Ok(proxy)
2465    }
2466
2467    /// Like `connect_to_device`, but returns a sync proxy.
2468    /// See [`Self::connect_to_device`] for more details.
2469    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2470        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2471        self.connect_channel_to_device(server_end)?;
2472        Ok(proxy)
2473    }
2474
2475    /// Like `connect_to_device`, but accepts a server end.
2476    /// See [`Self::connect_to_device`] for more details.
2477    pub fn connect_channel_to_device(
2478        &self,
2479        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2480    ) -> Result<(), fidl::Error> {
2481        self.0.open_member("device", server_end.into_channel())
2482    }
2483
2484    pub fn instance_name(&self) -> &str {
2485        self.0.instance_name()
2486    }
2487}
2488
2489mod internal {
2490    use super::*;
2491
2492    impl fidl::encoding::ResourceTypeMarker for DeviceGetBtiByIdResponse {
2493        type Borrowed<'a> = &'a mut Self;
2494        fn take_or_borrow<'a>(
2495            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2496        ) -> Self::Borrowed<'a> {
2497            value
2498        }
2499    }
2500
2501    unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiByIdResponse {
2502        type Owned = Self;
2503
2504        #[inline(always)]
2505        fn inline_align(_context: fidl::encoding::Context) -> usize {
2506            4
2507        }
2508
2509        #[inline(always)]
2510        fn inline_size(_context: fidl::encoding::Context) -> usize {
2511            4
2512        }
2513    }
2514
2515    unsafe impl
2516        fidl::encoding::Encode<
2517            DeviceGetBtiByIdResponse,
2518            fidl::encoding::DefaultFuchsiaResourceDialect,
2519        > for &mut DeviceGetBtiByIdResponse
2520    {
2521        #[inline]
2522        unsafe fn encode(
2523            self,
2524            encoder: &mut fidl::encoding::Encoder<
2525                '_,
2526                fidl::encoding::DefaultFuchsiaResourceDialect,
2527            >,
2528            offset: usize,
2529            _depth: fidl::encoding::Depth,
2530        ) -> fidl::Result<()> {
2531            encoder.debug_check_bounds::<DeviceGetBtiByIdResponse>(offset);
2532            // Delegate to tuple encoding.
2533            fidl::encoding::Encode::<
2534                DeviceGetBtiByIdResponse,
2535                fidl::encoding::DefaultFuchsiaResourceDialect,
2536            >::encode(
2537                (<fidl::encoding::HandleType<
2538                    fidl::Bti,
2539                    { fidl::ObjectType::BTI.into_raw() },
2540                    2147483648,
2541                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2542                    &mut self.bti
2543                ),),
2544                encoder,
2545                offset,
2546                _depth,
2547            )
2548        }
2549    }
2550    unsafe impl<
2551        T0: fidl::encoding::Encode<
2552                fidl::encoding::HandleType<
2553                    fidl::Bti,
2554                    { fidl::ObjectType::BTI.into_raw() },
2555                    2147483648,
2556                >,
2557                fidl::encoding::DefaultFuchsiaResourceDialect,
2558            >,
2559    >
2560        fidl::encoding::Encode<
2561            DeviceGetBtiByIdResponse,
2562            fidl::encoding::DefaultFuchsiaResourceDialect,
2563        > for (T0,)
2564    {
2565        #[inline]
2566        unsafe fn encode(
2567            self,
2568            encoder: &mut fidl::encoding::Encoder<
2569                '_,
2570                fidl::encoding::DefaultFuchsiaResourceDialect,
2571            >,
2572            offset: usize,
2573            depth: fidl::encoding::Depth,
2574        ) -> fidl::Result<()> {
2575            encoder.debug_check_bounds::<DeviceGetBtiByIdResponse>(offset);
2576            // Zero out padding regions. There's no need to apply masks
2577            // because the unmasked parts will be overwritten by fields.
2578            // Write the fields.
2579            self.0.encode(encoder, offset + 0, depth)?;
2580            Ok(())
2581        }
2582    }
2583
2584    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2585        for DeviceGetBtiByIdResponse
2586    {
2587        #[inline(always)]
2588        fn new_empty() -> Self {
2589            Self {
2590                bti: fidl::new_empty!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2591            }
2592        }
2593
2594        #[inline]
2595        unsafe fn decode(
2596            &mut self,
2597            decoder: &mut fidl::encoding::Decoder<
2598                '_,
2599                fidl::encoding::DefaultFuchsiaResourceDialect,
2600            >,
2601            offset: usize,
2602            _depth: fidl::encoding::Depth,
2603        ) -> fidl::Result<()> {
2604            decoder.debug_check_bounds::<Self>(offset);
2605            // Verify that padding bytes are zero.
2606            fidl::decode!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bti, decoder, offset + 0, _depth)?;
2607            Ok(())
2608        }
2609    }
2610
2611    impl fidl::encoding::ResourceTypeMarker for DeviceGetBtiByNameResponse {
2612        type Borrowed<'a> = &'a mut Self;
2613        fn take_or_borrow<'a>(
2614            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2615        ) -> Self::Borrowed<'a> {
2616            value
2617        }
2618    }
2619
2620    unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiByNameResponse {
2621        type Owned = Self;
2622
2623        #[inline(always)]
2624        fn inline_align(_context: fidl::encoding::Context) -> usize {
2625            4
2626        }
2627
2628        #[inline(always)]
2629        fn inline_size(_context: fidl::encoding::Context) -> usize {
2630            4
2631        }
2632    }
2633
2634    unsafe impl
2635        fidl::encoding::Encode<
2636            DeviceGetBtiByNameResponse,
2637            fidl::encoding::DefaultFuchsiaResourceDialect,
2638        > for &mut DeviceGetBtiByNameResponse
2639    {
2640        #[inline]
2641        unsafe fn encode(
2642            self,
2643            encoder: &mut fidl::encoding::Encoder<
2644                '_,
2645                fidl::encoding::DefaultFuchsiaResourceDialect,
2646            >,
2647            offset: usize,
2648            _depth: fidl::encoding::Depth,
2649        ) -> fidl::Result<()> {
2650            encoder.debug_check_bounds::<DeviceGetBtiByNameResponse>(offset);
2651            // Delegate to tuple encoding.
2652            fidl::encoding::Encode::<
2653                DeviceGetBtiByNameResponse,
2654                fidl::encoding::DefaultFuchsiaResourceDialect,
2655            >::encode(
2656                (<fidl::encoding::HandleType<
2657                    fidl::Bti,
2658                    { fidl::ObjectType::BTI.into_raw() },
2659                    2147483648,
2660                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2661                    &mut self.bti
2662                ),),
2663                encoder,
2664                offset,
2665                _depth,
2666            )
2667        }
2668    }
2669    unsafe impl<
2670        T0: fidl::encoding::Encode<
2671                fidl::encoding::HandleType<
2672                    fidl::Bti,
2673                    { fidl::ObjectType::BTI.into_raw() },
2674                    2147483648,
2675                >,
2676                fidl::encoding::DefaultFuchsiaResourceDialect,
2677            >,
2678    >
2679        fidl::encoding::Encode<
2680            DeviceGetBtiByNameResponse,
2681            fidl::encoding::DefaultFuchsiaResourceDialect,
2682        > for (T0,)
2683    {
2684        #[inline]
2685        unsafe fn encode(
2686            self,
2687            encoder: &mut fidl::encoding::Encoder<
2688                '_,
2689                fidl::encoding::DefaultFuchsiaResourceDialect,
2690            >,
2691            offset: usize,
2692            depth: fidl::encoding::Depth,
2693        ) -> fidl::Result<()> {
2694            encoder.debug_check_bounds::<DeviceGetBtiByNameResponse>(offset);
2695            // Zero out padding regions. There's no need to apply masks
2696            // because the unmasked parts will be overwritten by fields.
2697            // Write the fields.
2698            self.0.encode(encoder, offset + 0, depth)?;
2699            Ok(())
2700        }
2701    }
2702
2703    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2704        for DeviceGetBtiByNameResponse
2705    {
2706        #[inline(always)]
2707        fn new_empty() -> Self {
2708            Self {
2709                bti: fidl::new_empty!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2710            }
2711        }
2712
2713        #[inline]
2714        unsafe fn decode(
2715            &mut self,
2716            decoder: &mut fidl::encoding::Decoder<
2717                '_,
2718                fidl::encoding::DefaultFuchsiaResourceDialect,
2719            >,
2720            offset: usize,
2721            _depth: fidl::encoding::Depth,
2722        ) -> fidl::Result<()> {
2723            decoder.debug_check_bounds::<Self>(offset);
2724            // Verify that padding bytes are zero.
2725            fidl::decode!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bti, decoder, offset + 0, _depth)?;
2726            Ok(())
2727        }
2728    }
2729
2730    impl fidl::encoding::ResourceTypeMarker for DeviceGetInterruptByIdResponse {
2731        type Borrowed<'a> = &'a mut Self;
2732        fn take_or_borrow<'a>(
2733            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2734        ) -> Self::Borrowed<'a> {
2735            value
2736        }
2737    }
2738
2739    unsafe impl fidl::encoding::TypeMarker for DeviceGetInterruptByIdResponse {
2740        type Owned = Self;
2741
2742        #[inline(always)]
2743        fn inline_align(_context: fidl::encoding::Context) -> usize {
2744            4
2745        }
2746
2747        #[inline(always)]
2748        fn inline_size(_context: fidl::encoding::Context) -> usize {
2749            4
2750        }
2751    }
2752
2753    unsafe impl
2754        fidl::encoding::Encode<
2755            DeviceGetInterruptByIdResponse,
2756            fidl::encoding::DefaultFuchsiaResourceDialect,
2757        > for &mut DeviceGetInterruptByIdResponse
2758    {
2759        #[inline]
2760        unsafe fn encode(
2761            self,
2762            encoder: &mut fidl::encoding::Encoder<
2763                '_,
2764                fidl::encoding::DefaultFuchsiaResourceDialect,
2765            >,
2766            offset: usize,
2767            _depth: fidl::encoding::Depth,
2768        ) -> fidl::Result<()> {
2769            encoder.debug_check_bounds::<DeviceGetInterruptByIdResponse>(offset);
2770            // Delegate to tuple encoding.
2771            fidl::encoding::Encode::<
2772                DeviceGetInterruptByIdResponse,
2773                fidl::encoding::DefaultFuchsiaResourceDialect,
2774            >::encode(
2775                (<fidl::encoding::HandleType<
2776                    fidl::Interrupt,
2777                    { fidl::ObjectType::INTERRUPT.into_raw() },
2778                    2147483648,
2779                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2780                    &mut self.irq
2781                ),),
2782                encoder,
2783                offset,
2784                _depth,
2785            )
2786        }
2787    }
2788    unsafe impl<
2789        T0: fidl::encoding::Encode<
2790                fidl::encoding::HandleType<
2791                    fidl::Interrupt,
2792                    { fidl::ObjectType::INTERRUPT.into_raw() },
2793                    2147483648,
2794                >,
2795                fidl::encoding::DefaultFuchsiaResourceDialect,
2796            >,
2797    >
2798        fidl::encoding::Encode<
2799            DeviceGetInterruptByIdResponse,
2800            fidl::encoding::DefaultFuchsiaResourceDialect,
2801        > for (T0,)
2802    {
2803        #[inline]
2804        unsafe fn encode(
2805            self,
2806            encoder: &mut fidl::encoding::Encoder<
2807                '_,
2808                fidl::encoding::DefaultFuchsiaResourceDialect,
2809            >,
2810            offset: usize,
2811            depth: fidl::encoding::Depth,
2812        ) -> fidl::Result<()> {
2813            encoder.debug_check_bounds::<DeviceGetInterruptByIdResponse>(offset);
2814            // Zero out padding regions. There's no need to apply masks
2815            // because the unmasked parts will be overwritten by fields.
2816            // Write the fields.
2817            self.0.encode(encoder, offset + 0, depth)?;
2818            Ok(())
2819        }
2820    }
2821
2822    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2823        for DeviceGetInterruptByIdResponse
2824    {
2825        #[inline(always)]
2826        fn new_empty() -> Self {
2827            Self {
2828                irq: fidl::new_empty!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2829            }
2830        }
2831
2832        #[inline]
2833        unsafe fn decode(
2834            &mut self,
2835            decoder: &mut fidl::encoding::Decoder<
2836                '_,
2837                fidl::encoding::DefaultFuchsiaResourceDialect,
2838            >,
2839            offset: usize,
2840            _depth: fidl::encoding::Depth,
2841        ) -> fidl::Result<()> {
2842            decoder.debug_check_bounds::<Self>(offset);
2843            // Verify that padding bytes are zero.
2844            fidl::decode!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.irq, decoder, offset + 0, _depth)?;
2845            Ok(())
2846        }
2847    }
2848
2849    impl fidl::encoding::ResourceTypeMarker for DeviceGetInterruptByNameResponse {
2850        type Borrowed<'a> = &'a mut Self;
2851        fn take_or_borrow<'a>(
2852            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2853        ) -> Self::Borrowed<'a> {
2854            value
2855        }
2856    }
2857
2858    unsafe impl fidl::encoding::TypeMarker for DeviceGetInterruptByNameResponse {
2859        type Owned = Self;
2860
2861        #[inline(always)]
2862        fn inline_align(_context: fidl::encoding::Context) -> usize {
2863            4
2864        }
2865
2866        #[inline(always)]
2867        fn inline_size(_context: fidl::encoding::Context) -> usize {
2868            4
2869        }
2870    }
2871
2872    unsafe impl
2873        fidl::encoding::Encode<
2874            DeviceGetInterruptByNameResponse,
2875            fidl::encoding::DefaultFuchsiaResourceDialect,
2876        > for &mut DeviceGetInterruptByNameResponse
2877    {
2878        #[inline]
2879        unsafe fn encode(
2880            self,
2881            encoder: &mut fidl::encoding::Encoder<
2882                '_,
2883                fidl::encoding::DefaultFuchsiaResourceDialect,
2884            >,
2885            offset: usize,
2886            _depth: fidl::encoding::Depth,
2887        ) -> fidl::Result<()> {
2888            encoder.debug_check_bounds::<DeviceGetInterruptByNameResponse>(offset);
2889            // Delegate to tuple encoding.
2890            fidl::encoding::Encode::<
2891                DeviceGetInterruptByNameResponse,
2892                fidl::encoding::DefaultFuchsiaResourceDialect,
2893            >::encode(
2894                (<fidl::encoding::HandleType<
2895                    fidl::Interrupt,
2896                    { fidl::ObjectType::INTERRUPT.into_raw() },
2897                    2147483648,
2898                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2899                    &mut self.irq
2900                ),),
2901                encoder,
2902                offset,
2903                _depth,
2904            )
2905        }
2906    }
2907    unsafe impl<
2908        T0: fidl::encoding::Encode<
2909                fidl::encoding::HandleType<
2910                    fidl::Interrupt,
2911                    { fidl::ObjectType::INTERRUPT.into_raw() },
2912                    2147483648,
2913                >,
2914                fidl::encoding::DefaultFuchsiaResourceDialect,
2915            >,
2916    >
2917        fidl::encoding::Encode<
2918            DeviceGetInterruptByNameResponse,
2919            fidl::encoding::DefaultFuchsiaResourceDialect,
2920        > for (T0,)
2921    {
2922        #[inline]
2923        unsafe fn encode(
2924            self,
2925            encoder: &mut fidl::encoding::Encoder<
2926                '_,
2927                fidl::encoding::DefaultFuchsiaResourceDialect,
2928            >,
2929            offset: usize,
2930            depth: fidl::encoding::Depth,
2931        ) -> fidl::Result<()> {
2932            encoder.debug_check_bounds::<DeviceGetInterruptByNameResponse>(offset);
2933            // Zero out padding regions. There's no need to apply masks
2934            // because the unmasked parts will be overwritten by fields.
2935            // Write the fields.
2936            self.0.encode(encoder, offset + 0, depth)?;
2937            Ok(())
2938        }
2939    }
2940
2941    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2942        for DeviceGetInterruptByNameResponse
2943    {
2944        #[inline(always)]
2945        fn new_empty() -> Self {
2946            Self {
2947                irq: fidl::new_empty!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2948            }
2949        }
2950
2951        #[inline]
2952        unsafe fn decode(
2953            &mut self,
2954            decoder: &mut fidl::encoding::Decoder<
2955                '_,
2956                fidl::encoding::DefaultFuchsiaResourceDialect,
2957            >,
2958            offset: usize,
2959            _depth: fidl::encoding::Depth,
2960        ) -> fidl::Result<()> {
2961            decoder.debug_check_bounds::<Self>(offset);
2962            // Verify that padding bytes are zero.
2963            fidl::decode!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.irq, decoder, offset + 0, _depth)?;
2964            Ok(())
2965        }
2966    }
2967
2968    impl fidl::encoding::ResourceTypeMarker for DeviceGetSmcByIdResponse {
2969        type Borrowed<'a> = &'a mut Self;
2970        fn take_or_borrow<'a>(
2971            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2972        ) -> Self::Borrowed<'a> {
2973            value
2974        }
2975    }
2976
2977    unsafe impl fidl::encoding::TypeMarker for DeviceGetSmcByIdResponse {
2978        type Owned = Self;
2979
2980        #[inline(always)]
2981        fn inline_align(_context: fidl::encoding::Context) -> usize {
2982            4
2983        }
2984
2985        #[inline(always)]
2986        fn inline_size(_context: fidl::encoding::Context) -> usize {
2987            4
2988        }
2989    }
2990
2991    unsafe impl
2992        fidl::encoding::Encode<
2993            DeviceGetSmcByIdResponse,
2994            fidl::encoding::DefaultFuchsiaResourceDialect,
2995        > for &mut DeviceGetSmcByIdResponse
2996    {
2997        #[inline]
2998        unsafe fn encode(
2999            self,
3000            encoder: &mut fidl::encoding::Encoder<
3001                '_,
3002                fidl::encoding::DefaultFuchsiaResourceDialect,
3003            >,
3004            offset: usize,
3005            _depth: fidl::encoding::Depth,
3006        ) -> fidl::Result<()> {
3007            encoder.debug_check_bounds::<DeviceGetSmcByIdResponse>(offset);
3008            // Delegate to tuple encoding.
3009            fidl::encoding::Encode::<
3010                DeviceGetSmcByIdResponse,
3011                fidl::encoding::DefaultFuchsiaResourceDialect,
3012            >::encode(
3013                (<fidl::encoding::HandleType<
3014                    fidl::Resource,
3015                    { fidl::ObjectType::RESOURCE.into_raw() },
3016                    2147483648,
3017                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3018                    &mut self.smc
3019                ),),
3020                encoder,
3021                offset,
3022                _depth,
3023            )
3024        }
3025    }
3026    unsafe impl<
3027        T0: fidl::encoding::Encode<
3028                fidl::encoding::HandleType<
3029                    fidl::Resource,
3030                    { fidl::ObjectType::RESOURCE.into_raw() },
3031                    2147483648,
3032                >,
3033                fidl::encoding::DefaultFuchsiaResourceDialect,
3034            >,
3035    >
3036        fidl::encoding::Encode<
3037            DeviceGetSmcByIdResponse,
3038            fidl::encoding::DefaultFuchsiaResourceDialect,
3039        > for (T0,)
3040    {
3041        #[inline]
3042        unsafe fn encode(
3043            self,
3044            encoder: &mut fidl::encoding::Encoder<
3045                '_,
3046                fidl::encoding::DefaultFuchsiaResourceDialect,
3047            >,
3048            offset: usize,
3049            depth: fidl::encoding::Depth,
3050        ) -> fidl::Result<()> {
3051            encoder.debug_check_bounds::<DeviceGetSmcByIdResponse>(offset);
3052            // Zero out padding regions. There's no need to apply masks
3053            // because the unmasked parts will be overwritten by fields.
3054            // Write the fields.
3055            self.0.encode(encoder, offset + 0, depth)?;
3056            Ok(())
3057        }
3058    }
3059
3060    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3061        for DeviceGetSmcByIdResponse
3062    {
3063        #[inline(always)]
3064        fn new_empty() -> Self {
3065            Self {
3066                smc: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3067            }
3068        }
3069
3070        #[inline]
3071        unsafe fn decode(
3072            &mut self,
3073            decoder: &mut fidl::encoding::Decoder<
3074                '_,
3075                fidl::encoding::DefaultFuchsiaResourceDialect,
3076            >,
3077            offset: usize,
3078            _depth: fidl::encoding::Depth,
3079        ) -> fidl::Result<()> {
3080            decoder.debug_check_bounds::<Self>(offset);
3081            // Verify that padding bytes are zero.
3082            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.smc, decoder, offset + 0, _depth)?;
3083            Ok(())
3084        }
3085    }
3086
3087    impl fidl::encoding::ResourceTypeMarker for DeviceGetSmcByNameResponse {
3088        type Borrowed<'a> = &'a mut Self;
3089        fn take_or_borrow<'a>(
3090            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3091        ) -> Self::Borrowed<'a> {
3092            value
3093        }
3094    }
3095
3096    unsafe impl fidl::encoding::TypeMarker for DeviceGetSmcByNameResponse {
3097        type Owned = Self;
3098
3099        #[inline(always)]
3100        fn inline_align(_context: fidl::encoding::Context) -> usize {
3101            4
3102        }
3103
3104        #[inline(always)]
3105        fn inline_size(_context: fidl::encoding::Context) -> usize {
3106            4
3107        }
3108    }
3109
3110    unsafe impl
3111        fidl::encoding::Encode<
3112            DeviceGetSmcByNameResponse,
3113            fidl::encoding::DefaultFuchsiaResourceDialect,
3114        > for &mut DeviceGetSmcByNameResponse
3115    {
3116        #[inline]
3117        unsafe fn encode(
3118            self,
3119            encoder: &mut fidl::encoding::Encoder<
3120                '_,
3121                fidl::encoding::DefaultFuchsiaResourceDialect,
3122            >,
3123            offset: usize,
3124            _depth: fidl::encoding::Depth,
3125        ) -> fidl::Result<()> {
3126            encoder.debug_check_bounds::<DeviceGetSmcByNameResponse>(offset);
3127            // Delegate to tuple encoding.
3128            fidl::encoding::Encode::<
3129                DeviceGetSmcByNameResponse,
3130                fidl::encoding::DefaultFuchsiaResourceDialect,
3131            >::encode(
3132                (<fidl::encoding::HandleType<
3133                    fidl::Resource,
3134                    { fidl::ObjectType::RESOURCE.into_raw() },
3135                    2147483648,
3136                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3137                    &mut self.smc
3138                ),),
3139                encoder,
3140                offset,
3141                _depth,
3142            )
3143        }
3144    }
3145    unsafe impl<
3146        T0: fidl::encoding::Encode<
3147                fidl::encoding::HandleType<
3148                    fidl::Resource,
3149                    { fidl::ObjectType::RESOURCE.into_raw() },
3150                    2147483648,
3151                >,
3152                fidl::encoding::DefaultFuchsiaResourceDialect,
3153            >,
3154    >
3155        fidl::encoding::Encode<
3156            DeviceGetSmcByNameResponse,
3157            fidl::encoding::DefaultFuchsiaResourceDialect,
3158        > for (T0,)
3159    {
3160        #[inline]
3161        unsafe fn encode(
3162            self,
3163            encoder: &mut fidl::encoding::Encoder<
3164                '_,
3165                fidl::encoding::DefaultFuchsiaResourceDialect,
3166            >,
3167            offset: usize,
3168            depth: fidl::encoding::Depth,
3169        ) -> fidl::Result<()> {
3170            encoder.debug_check_bounds::<DeviceGetSmcByNameResponse>(offset);
3171            // Zero out padding regions. There's no need to apply masks
3172            // because the unmasked parts will be overwritten by fields.
3173            // Write the fields.
3174            self.0.encode(encoder, offset + 0, depth)?;
3175            Ok(())
3176        }
3177    }
3178
3179    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3180        for DeviceGetSmcByNameResponse
3181    {
3182        #[inline(always)]
3183        fn new_empty() -> Self {
3184            Self {
3185                smc: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3186            }
3187        }
3188
3189        #[inline]
3190        unsafe fn decode(
3191            &mut self,
3192            decoder: &mut fidl::encoding::Decoder<
3193                '_,
3194                fidl::encoding::DefaultFuchsiaResourceDialect,
3195            >,
3196            offset: usize,
3197            _depth: fidl::encoding::Depth,
3198        ) -> fidl::Result<()> {
3199            decoder.debug_check_bounds::<Self>(offset);
3200            // Verify that padding bytes are zero.
3201            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.smc, decoder, offset + 0, _depth)?;
3202            Ok(())
3203        }
3204    }
3205
3206    impl Mmio {
3207        #[inline(always)]
3208        fn max_ordinal_present(&self) -> u64 {
3209            if let Some(_) = self.vmo {
3210                return 3;
3211            }
3212            if let Some(_) = self.size {
3213                return 2;
3214            }
3215            if let Some(_) = self.offset {
3216                return 1;
3217            }
3218            0
3219        }
3220    }
3221
3222    impl fidl::encoding::ResourceTypeMarker for Mmio {
3223        type Borrowed<'a> = &'a mut Self;
3224        fn take_or_borrow<'a>(
3225            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3226        ) -> Self::Borrowed<'a> {
3227            value
3228        }
3229    }
3230
3231    unsafe impl fidl::encoding::TypeMarker for Mmio {
3232        type Owned = Self;
3233
3234        #[inline(always)]
3235        fn inline_align(_context: fidl::encoding::Context) -> usize {
3236            8
3237        }
3238
3239        #[inline(always)]
3240        fn inline_size(_context: fidl::encoding::Context) -> usize {
3241            16
3242        }
3243    }
3244
3245    unsafe impl fidl::encoding::Encode<Mmio, fidl::encoding::DefaultFuchsiaResourceDialect>
3246        for &mut Mmio
3247    {
3248        unsafe fn encode(
3249            self,
3250            encoder: &mut fidl::encoding::Encoder<
3251                '_,
3252                fidl::encoding::DefaultFuchsiaResourceDialect,
3253            >,
3254            offset: usize,
3255            mut depth: fidl::encoding::Depth,
3256        ) -> fidl::Result<()> {
3257            encoder.debug_check_bounds::<Mmio>(offset);
3258            // Vector header
3259            let max_ordinal: u64 = self.max_ordinal_present();
3260            encoder.write_num(max_ordinal, offset);
3261            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3262            // Calling encoder.out_of_line_offset(0) is not allowed.
3263            if max_ordinal == 0 {
3264                return Ok(());
3265            }
3266            depth.increment()?;
3267            let envelope_size = 8;
3268            let bytes_len = max_ordinal as usize * envelope_size;
3269            #[allow(unused_variables)]
3270            let offset = encoder.out_of_line_offset(bytes_len);
3271            let mut _prev_end_offset: usize = 0;
3272            if 1 > max_ordinal {
3273                return Ok(());
3274            }
3275
3276            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3277            // are envelope_size bytes.
3278            let cur_offset: usize = (1 - 1) * envelope_size;
3279
3280            // Zero reserved fields.
3281            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3282
3283            // Safety:
3284            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3285            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3286            //   envelope_size bytes, there is always sufficient room.
3287            fidl::encoding::encode_in_envelope_optional::<
3288                u64,
3289                fidl::encoding::DefaultFuchsiaResourceDialect,
3290            >(
3291                self.offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3292                encoder,
3293                offset + cur_offset,
3294                depth,
3295            )?;
3296
3297            _prev_end_offset = cur_offset + envelope_size;
3298            if 2 > max_ordinal {
3299                return Ok(());
3300            }
3301
3302            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3303            // are envelope_size bytes.
3304            let cur_offset: usize = (2 - 1) * envelope_size;
3305
3306            // Zero reserved fields.
3307            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3308
3309            // Safety:
3310            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3311            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3312            //   envelope_size bytes, there is always sufficient room.
3313            fidl::encoding::encode_in_envelope_optional::<
3314                u64,
3315                fidl::encoding::DefaultFuchsiaResourceDialect,
3316            >(
3317                self.size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3318                encoder,
3319                offset + cur_offset,
3320                depth,
3321            )?;
3322
3323            _prev_end_offset = cur_offset + envelope_size;
3324            if 3 > max_ordinal {
3325                return Ok(());
3326            }
3327
3328            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3329            // are envelope_size bytes.
3330            let cur_offset: usize = (3 - 1) * envelope_size;
3331
3332            // Zero reserved fields.
3333            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3334
3335            // Safety:
3336            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3337            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3338            //   envelope_size bytes, there is always sufficient room.
3339            fidl::encoding::encode_in_envelope_optional::<
3340                fidl::encoding::HandleType<
3341                    fidl::Vmo,
3342                    { fidl::ObjectType::VMO.into_raw() },
3343                    2147483648,
3344                >,
3345                fidl::encoding::DefaultFuchsiaResourceDialect,
3346            >(
3347                self.vmo.as_mut().map(
3348                    <fidl::encoding::HandleType<
3349                        fidl::Vmo,
3350                        { fidl::ObjectType::VMO.into_raw() },
3351                        2147483648,
3352                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3353                ),
3354                encoder,
3355                offset + cur_offset,
3356                depth,
3357            )?;
3358
3359            _prev_end_offset = cur_offset + envelope_size;
3360
3361            Ok(())
3362        }
3363    }
3364
3365    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Mmio {
3366        #[inline(always)]
3367        fn new_empty() -> Self {
3368            Self::default()
3369        }
3370
3371        unsafe fn decode(
3372            &mut self,
3373            decoder: &mut fidl::encoding::Decoder<
3374                '_,
3375                fidl::encoding::DefaultFuchsiaResourceDialect,
3376            >,
3377            offset: usize,
3378            mut depth: fidl::encoding::Depth,
3379        ) -> fidl::Result<()> {
3380            decoder.debug_check_bounds::<Self>(offset);
3381            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3382                None => return Err(fidl::Error::NotNullable),
3383                Some(len) => len,
3384            };
3385            // Calling decoder.out_of_line_offset(0) is not allowed.
3386            if len == 0 {
3387                return Ok(());
3388            };
3389            depth.increment()?;
3390            let envelope_size = 8;
3391            let bytes_len = len * envelope_size;
3392            let offset = decoder.out_of_line_offset(bytes_len)?;
3393            // Decode the envelope for each type.
3394            let mut _next_ordinal_to_read = 0;
3395            let mut next_offset = offset;
3396            let end_offset = offset + bytes_len;
3397            _next_ordinal_to_read += 1;
3398            if next_offset >= end_offset {
3399                return Ok(());
3400            }
3401
3402            // Decode unknown envelopes for gaps in ordinals.
3403            while _next_ordinal_to_read < 1 {
3404                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3405                _next_ordinal_to_read += 1;
3406                next_offset += envelope_size;
3407            }
3408
3409            let next_out_of_line = decoder.next_out_of_line();
3410            let handles_before = decoder.remaining_handles();
3411            if let Some((inlined, num_bytes, num_handles)) =
3412                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3413            {
3414                let member_inline_size =
3415                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3416                if inlined != (member_inline_size <= 4) {
3417                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3418                }
3419                let inner_offset;
3420                let mut inner_depth = depth.clone();
3421                if inlined {
3422                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3423                    inner_offset = next_offset;
3424                } else {
3425                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3426                    inner_depth.increment()?;
3427                }
3428                let val_ref = self.offset.get_or_insert_with(|| {
3429                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3430                });
3431                fidl::decode!(
3432                    u64,
3433                    fidl::encoding::DefaultFuchsiaResourceDialect,
3434                    val_ref,
3435                    decoder,
3436                    inner_offset,
3437                    inner_depth
3438                )?;
3439                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3440                {
3441                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3442                }
3443                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3444                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3445                }
3446            }
3447
3448            next_offset += envelope_size;
3449            _next_ordinal_to_read += 1;
3450            if next_offset >= end_offset {
3451                return Ok(());
3452            }
3453
3454            // Decode unknown envelopes for gaps in ordinals.
3455            while _next_ordinal_to_read < 2 {
3456                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3457                _next_ordinal_to_read += 1;
3458                next_offset += envelope_size;
3459            }
3460
3461            let next_out_of_line = decoder.next_out_of_line();
3462            let handles_before = decoder.remaining_handles();
3463            if let Some((inlined, num_bytes, num_handles)) =
3464                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3465            {
3466                let member_inline_size =
3467                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3468                if inlined != (member_inline_size <= 4) {
3469                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3470                }
3471                let inner_offset;
3472                let mut inner_depth = depth.clone();
3473                if inlined {
3474                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3475                    inner_offset = next_offset;
3476                } else {
3477                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3478                    inner_depth.increment()?;
3479                }
3480                let val_ref = self.size.get_or_insert_with(|| {
3481                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3482                });
3483                fidl::decode!(
3484                    u64,
3485                    fidl::encoding::DefaultFuchsiaResourceDialect,
3486                    val_ref,
3487                    decoder,
3488                    inner_offset,
3489                    inner_depth
3490                )?;
3491                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3492                {
3493                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3494                }
3495                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3496                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3497                }
3498            }
3499
3500            next_offset += envelope_size;
3501            _next_ordinal_to_read += 1;
3502            if next_offset >= end_offset {
3503                return Ok(());
3504            }
3505
3506            // Decode unknown envelopes for gaps in ordinals.
3507            while _next_ordinal_to_read < 3 {
3508                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3509                _next_ordinal_to_read += 1;
3510                next_offset += envelope_size;
3511            }
3512
3513            let next_out_of_line = decoder.next_out_of_line();
3514            let handles_before = decoder.remaining_handles();
3515            if let Some((inlined, num_bytes, num_handles)) =
3516                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3517            {
3518                let member_inline_size = <fidl::encoding::HandleType<
3519                    fidl::Vmo,
3520                    { fidl::ObjectType::VMO.into_raw() },
3521                    2147483648,
3522                > as fidl::encoding::TypeMarker>::inline_size(
3523                    decoder.context
3524                );
3525                if inlined != (member_inline_size <= 4) {
3526                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3527                }
3528                let inner_offset;
3529                let mut inner_depth = depth.clone();
3530                if inlined {
3531                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3532                    inner_offset = next_offset;
3533                } else {
3534                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3535                    inner_depth.increment()?;
3536                }
3537                let val_ref =
3538                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3539                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3540                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3541                {
3542                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3543                }
3544                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3545                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3546                }
3547            }
3548
3549            next_offset += envelope_size;
3550
3551            // Decode the remaining unknown envelopes.
3552            while next_offset < end_offset {
3553                _next_ordinal_to_read += 1;
3554                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3555                next_offset += envelope_size;
3556            }
3557
3558            Ok(())
3559        }
3560    }
3561}