fidl_fuchsia_hardware_platform_device/
fidl_fuchsia_hardware_platform_device.rs

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