fidl_fuchsia_hardware_pci/
fidl_fuchsia_hardware_pci.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_pci__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14/// Describes and provides access to a given Base Address Register for the device.
15#[derive(Debug, PartialEq)]
16pub struct Bar {
17    /// The BAR id, [0-5).
18    pub bar_id: u32,
19    pub size: u64,
20    pub result: BarResult,
21}
22
23impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Bar {}
24
25#[derive(Debug, PartialEq)]
26pub struct DeviceGetBarResponse {
27    pub result: Bar,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetBarResponse {}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct DeviceGetBtiResponse {
34    pub bti: fidl::Bti,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetBtiResponse {}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct DeviceMapInterruptResponse {
41    pub interrupt: fidl::Interrupt,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45    for DeviceMapInterruptResponse
46{
47}
48
49#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct IoBar {
51    pub address: u64,
52    pub resource: fidl::Resource,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IoBar {}
56
57#[derive(Debug)]
58pub enum BarResult {
59    Io(IoBar),
60    Vmo(fidl::Vmo),
61    #[doc(hidden)]
62    __SourceBreaking {
63        unknown_ordinal: u64,
64    },
65}
66
67/// Pattern that matches an unknown `BarResult` member.
68#[macro_export]
69macro_rules! BarResultUnknown {
70    () => {
71        _
72    };
73}
74
75// Custom PartialEq so that unknown variants are not equal to themselves.
76impl PartialEq for BarResult {
77    fn eq(&self, other: &Self) -> bool {
78        match (self, other) {
79            (Self::Io(x), Self::Io(y)) => *x == *y,
80            (Self::Vmo(x), Self::Vmo(y)) => *x == *y,
81            _ => false,
82        }
83    }
84}
85
86impl BarResult {
87    #[inline]
88    pub fn ordinal(&self) -> u64 {
89        match *self {
90            Self::Io(_) => 1,
91            Self::Vmo(_) => 2,
92            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
93        }
94    }
95
96    #[inline]
97    pub fn unknown_variant_for_testing() -> Self {
98        Self::__SourceBreaking { unknown_ordinal: 0 }
99    }
100
101    #[inline]
102    pub fn is_unknown(&self) -> bool {
103        match self {
104            Self::__SourceBreaking { .. } => true,
105            _ => false,
106        }
107    }
108}
109
110impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BarResult {}
111
112#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
113pub struct BusMarker;
114
115impl fidl::endpoints::ProtocolMarker for BusMarker {
116    type Proxy = BusProxy;
117    type RequestStream = BusRequestStream;
118    #[cfg(target_os = "fuchsia")]
119    type SynchronousProxy = BusSynchronousProxy;
120
121    const DEBUG_NAME: &'static str = "fuchsia.hardware.pci.Bus";
122}
123impl fidl::endpoints::DiscoverableProtocolMarker for BusMarker {}
124pub type BusReadBarResult = Result<Vec<u8>, i32>;
125
126pub trait BusProxyInterface: Send + Sync {
127    type GetHostBridgeInfoResponseFut: std::future::Future<Output = Result<HostBridgeInfo, fidl::Error>>
128        + Send;
129    fn r#get_host_bridge_info(&self) -> Self::GetHostBridgeInfoResponseFut;
130    type GetDevicesResponseFut: std::future::Future<Output = Result<Vec<PciDevice>, fidl::Error>>
131        + Send;
132    fn r#get_devices(&self) -> Self::GetDevicesResponseFut;
133    type ReadBarResponseFut: std::future::Future<Output = Result<BusReadBarResult, fidl::Error>>
134        + Send;
135    fn r#read_bar(
136        &self,
137        device: &Address,
138        bar_id: u8,
139        offset: u64,
140        size: u64,
141    ) -> Self::ReadBarResponseFut;
142}
143#[derive(Debug)]
144#[cfg(target_os = "fuchsia")]
145pub struct BusSynchronousProxy {
146    client: fidl::client::sync::Client,
147}
148
149#[cfg(target_os = "fuchsia")]
150impl fidl::endpoints::SynchronousProxy for BusSynchronousProxy {
151    type Proxy = BusProxy;
152    type Protocol = BusMarker;
153
154    fn from_channel(inner: fidl::Channel) -> Self {
155        Self::new(inner)
156    }
157
158    fn into_channel(self) -> fidl::Channel {
159        self.client.into_channel()
160    }
161
162    fn as_channel(&self) -> &fidl::Channel {
163        self.client.as_channel()
164    }
165}
166
167#[cfg(target_os = "fuchsia")]
168impl BusSynchronousProxy {
169    pub fn new(channel: fidl::Channel) -> Self {
170        let protocol_name = <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
171        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
172    }
173
174    pub fn into_channel(self) -> fidl::Channel {
175        self.client.into_channel()
176    }
177
178    /// Waits until an event arrives and returns it. It is safe for other
179    /// threads to make concurrent requests while waiting for an event.
180    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<BusEvent, fidl::Error> {
181        BusEvent::decode(self.client.wait_for_event(deadline)?)
182    }
183
184    /// Retrieve information about the segment group and buses covered by a Bus.
185    pub fn r#get_host_bridge_info(
186        &self,
187        ___deadline: zx::MonotonicInstant,
188    ) -> Result<HostBridgeInfo, fidl::Error> {
189        let _response =
190            self.client.send_query::<fidl::encoding::EmptyPayload, BusGetHostBridgeInfoResponse>(
191                (),
192                0x39f0b21bcd8c065d,
193                fidl::encoding::DynamicFlags::empty(),
194                ___deadline,
195            )?;
196        Ok(_response.info)
197    }
198
199    /// Retrieve all Devices on the Bus.
200    pub fn r#get_devices(
201        &self,
202        ___deadline: zx::MonotonicInstant,
203    ) -> Result<Vec<PciDevice>, fidl::Error> {
204        let _response =
205            self.client.send_query::<fidl::encoding::EmptyPayload, BusGetDevicesResponse>(
206                (),
207                0x2b39a32926007c92,
208                fidl::encoding::DynamicFlags::empty(),
209                ___deadline,
210            )?;
211        Ok(_response.devices)
212    }
213
214    /// Read from a Device's base address register (BAR). The BAR must be an MMIO type.
215    ///
216    /// Parameters
217    /// |device|: The address of the device to read from.
218    /// |bar_id|: The ID of the BAR to read.
219    /// |offset|: The offset, in bytes, to start the read (default: 0 bytes).
220    /// |size|: The size of the read (default: 128 bytes). The max size for a
221    /// read is |READBAR_MAX_SIZE|.
222    ///
223    /// Errors:
224    /// |ZX_ERR_NOT_FOUND|: |device| was not found, or |bar_id| did not exist in |device|.
225    /// |ZX_ERR_INVALID_ARGS|: |bar_id| is invalid,  or offset / size combined
226    /// are invalid for the given BAR's size.
227    /// |ZX_ERR_NOT_SUPPORTED|: The BAR specified by |bar_id| is not an MMIO BAR.
228    pub fn r#read_bar(
229        &self,
230        mut device: &Address,
231        mut bar_id: u8,
232        mut offset: u64,
233        mut size: u64,
234        ___deadline: zx::MonotonicInstant,
235    ) -> Result<BusReadBarResult, fidl::Error> {
236        let _response = self
237            .client
238            .send_query::<BusReadBarRequest, fidl::encoding::ResultType<BusReadBarResponse, i32>>(
239                (device, bar_id, offset, size),
240                0x798f39b0dfdc4860,
241                fidl::encoding::DynamicFlags::empty(),
242                ___deadline,
243            )?;
244        Ok(_response.map(|x| x.buffer))
245    }
246}
247
248#[cfg(target_os = "fuchsia")]
249impl From<BusSynchronousProxy> for zx::Handle {
250    fn from(value: BusSynchronousProxy) -> Self {
251        value.into_channel().into()
252    }
253}
254
255#[cfg(target_os = "fuchsia")]
256impl From<fidl::Channel> for BusSynchronousProxy {
257    fn from(value: fidl::Channel) -> Self {
258        Self::new(value)
259    }
260}
261
262#[cfg(target_os = "fuchsia")]
263impl fidl::endpoints::FromClient for BusSynchronousProxy {
264    type Protocol = BusMarker;
265
266    fn from_client(value: fidl::endpoints::ClientEnd<BusMarker>) -> Self {
267        Self::new(value.into_channel())
268    }
269}
270
271#[derive(Debug, Clone)]
272pub struct BusProxy {
273    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
274}
275
276impl fidl::endpoints::Proxy for BusProxy {
277    type Protocol = BusMarker;
278
279    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
280        Self::new(inner)
281    }
282
283    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
284        self.client.into_channel().map_err(|client| Self { client })
285    }
286
287    fn as_channel(&self) -> &::fidl::AsyncChannel {
288        self.client.as_channel()
289    }
290}
291
292impl BusProxy {
293    /// Create a new Proxy for fuchsia.hardware.pci/Bus.
294    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
295        let protocol_name = <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
296        Self { client: fidl::client::Client::new(channel, protocol_name) }
297    }
298
299    /// Get a Stream of events from the remote end of the protocol.
300    ///
301    /// # Panics
302    ///
303    /// Panics if the event stream was already taken.
304    pub fn take_event_stream(&self) -> BusEventStream {
305        BusEventStream { event_receiver: self.client.take_event_receiver() }
306    }
307
308    /// Retrieve information about the segment group and buses covered by a Bus.
309    pub fn r#get_host_bridge_info(
310        &self,
311    ) -> fidl::client::QueryResponseFut<HostBridgeInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
312    {
313        BusProxyInterface::r#get_host_bridge_info(self)
314    }
315
316    /// Retrieve all Devices on the Bus.
317    pub fn r#get_devices(
318        &self,
319    ) -> fidl::client::QueryResponseFut<Vec<PciDevice>, fidl::encoding::DefaultFuchsiaResourceDialect>
320    {
321        BusProxyInterface::r#get_devices(self)
322    }
323
324    /// Read from a Device's base address register (BAR). The BAR must be an MMIO type.
325    ///
326    /// Parameters
327    /// |device|: The address of the device to read from.
328    /// |bar_id|: The ID of the BAR to read.
329    /// |offset|: The offset, in bytes, to start the read (default: 0 bytes).
330    /// |size|: The size of the read (default: 128 bytes). The max size for a
331    /// read is |READBAR_MAX_SIZE|.
332    ///
333    /// Errors:
334    /// |ZX_ERR_NOT_FOUND|: |device| was not found, or |bar_id| did not exist in |device|.
335    /// |ZX_ERR_INVALID_ARGS|: |bar_id| is invalid,  or offset / size combined
336    /// are invalid for the given BAR's size.
337    /// |ZX_ERR_NOT_SUPPORTED|: The BAR specified by |bar_id| is not an MMIO BAR.
338    pub fn r#read_bar(
339        &self,
340        mut device: &Address,
341        mut bar_id: u8,
342        mut offset: u64,
343        mut size: u64,
344    ) -> fidl::client::QueryResponseFut<
345        BusReadBarResult,
346        fidl::encoding::DefaultFuchsiaResourceDialect,
347    > {
348        BusProxyInterface::r#read_bar(self, device, bar_id, offset, size)
349    }
350}
351
352impl BusProxyInterface for BusProxy {
353    type GetHostBridgeInfoResponseFut = fidl::client::QueryResponseFut<
354        HostBridgeInfo,
355        fidl::encoding::DefaultFuchsiaResourceDialect,
356    >;
357    fn r#get_host_bridge_info(&self) -> Self::GetHostBridgeInfoResponseFut {
358        fn _decode(
359            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
360        ) -> Result<HostBridgeInfo, fidl::Error> {
361            let _response = fidl::client::decode_transaction_body::<
362                BusGetHostBridgeInfoResponse,
363                fidl::encoding::DefaultFuchsiaResourceDialect,
364                0x39f0b21bcd8c065d,
365            >(_buf?)?;
366            Ok(_response.info)
367        }
368        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HostBridgeInfo>(
369            (),
370            0x39f0b21bcd8c065d,
371            fidl::encoding::DynamicFlags::empty(),
372            _decode,
373        )
374    }
375
376    type GetDevicesResponseFut = fidl::client::QueryResponseFut<
377        Vec<PciDevice>,
378        fidl::encoding::DefaultFuchsiaResourceDialect,
379    >;
380    fn r#get_devices(&self) -> Self::GetDevicesResponseFut {
381        fn _decode(
382            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
383        ) -> Result<Vec<PciDevice>, fidl::Error> {
384            let _response = fidl::client::decode_transaction_body::<
385                BusGetDevicesResponse,
386                fidl::encoding::DefaultFuchsiaResourceDialect,
387                0x2b39a32926007c92,
388            >(_buf?)?;
389            Ok(_response.devices)
390        }
391        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<PciDevice>>(
392            (),
393            0x2b39a32926007c92,
394            fidl::encoding::DynamicFlags::empty(),
395            _decode,
396        )
397    }
398
399    type ReadBarResponseFut = fidl::client::QueryResponseFut<
400        BusReadBarResult,
401        fidl::encoding::DefaultFuchsiaResourceDialect,
402    >;
403    fn r#read_bar(
404        &self,
405        mut device: &Address,
406        mut bar_id: u8,
407        mut offset: u64,
408        mut size: u64,
409    ) -> Self::ReadBarResponseFut {
410        fn _decode(
411            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
412        ) -> Result<BusReadBarResult, fidl::Error> {
413            let _response = fidl::client::decode_transaction_body::<
414                fidl::encoding::ResultType<BusReadBarResponse, i32>,
415                fidl::encoding::DefaultFuchsiaResourceDialect,
416                0x798f39b0dfdc4860,
417            >(_buf?)?;
418            Ok(_response.map(|x| x.buffer))
419        }
420        self.client.send_query_and_decode::<BusReadBarRequest, BusReadBarResult>(
421            (device, bar_id, offset, size),
422            0x798f39b0dfdc4860,
423            fidl::encoding::DynamicFlags::empty(),
424            _decode,
425        )
426    }
427}
428
429pub struct BusEventStream {
430    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
431}
432
433impl std::marker::Unpin for BusEventStream {}
434
435impl futures::stream::FusedStream for BusEventStream {
436    fn is_terminated(&self) -> bool {
437        self.event_receiver.is_terminated()
438    }
439}
440
441impl futures::Stream for BusEventStream {
442    type Item = Result<BusEvent, fidl::Error>;
443
444    fn poll_next(
445        mut self: std::pin::Pin<&mut Self>,
446        cx: &mut std::task::Context<'_>,
447    ) -> std::task::Poll<Option<Self::Item>> {
448        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
449            &mut self.event_receiver,
450            cx
451        )?) {
452            Some(buf) => std::task::Poll::Ready(Some(BusEvent::decode(buf))),
453            None => std::task::Poll::Ready(None),
454        }
455    }
456}
457
458#[derive(Debug)]
459pub enum BusEvent {}
460
461impl BusEvent {
462    /// Decodes a message buffer as a [`BusEvent`].
463    fn decode(
464        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
465    ) -> Result<BusEvent, fidl::Error> {
466        let (bytes, _handles) = buf.split_mut();
467        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
468        debug_assert_eq!(tx_header.tx_id, 0);
469        match tx_header.ordinal {
470            _ => Err(fidl::Error::UnknownOrdinal {
471                ordinal: tx_header.ordinal,
472                protocol_name: <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
473            }),
474        }
475    }
476}
477
478/// A Stream of incoming requests for fuchsia.hardware.pci/Bus.
479pub struct BusRequestStream {
480    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
481    is_terminated: bool,
482}
483
484impl std::marker::Unpin for BusRequestStream {}
485
486impl futures::stream::FusedStream for BusRequestStream {
487    fn is_terminated(&self) -> bool {
488        self.is_terminated
489    }
490}
491
492impl fidl::endpoints::RequestStream for BusRequestStream {
493    type Protocol = BusMarker;
494    type ControlHandle = BusControlHandle;
495
496    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
497        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
498    }
499
500    fn control_handle(&self) -> Self::ControlHandle {
501        BusControlHandle { inner: self.inner.clone() }
502    }
503
504    fn into_inner(
505        self,
506    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
507    {
508        (self.inner, self.is_terminated)
509    }
510
511    fn from_inner(
512        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
513        is_terminated: bool,
514    ) -> Self {
515        Self { inner, is_terminated }
516    }
517}
518
519impl futures::Stream for BusRequestStream {
520    type Item = Result<BusRequest, fidl::Error>;
521
522    fn poll_next(
523        mut self: std::pin::Pin<&mut Self>,
524        cx: &mut std::task::Context<'_>,
525    ) -> std::task::Poll<Option<Self::Item>> {
526        let this = &mut *self;
527        if this.inner.check_shutdown(cx) {
528            this.is_terminated = true;
529            return std::task::Poll::Ready(None);
530        }
531        if this.is_terminated {
532            panic!("polled BusRequestStream after completion");
533        }
534        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
535            |bytes, handles| {
536                match this.inner.channel().read_etc(cx, bytes, handles) {
537                    std::task::Poll::Ready(Ok(())) => {}
538                    std::task::Poll::Pending => return std::task::Poll::Pending,
539                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
540                        this.is_terminated = true;
541                        return std::task::Poll::Ready(None);
542                    }
543                    std::task::Poll::Ready(Err(e)) => {
544                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
545                            e.into(),
546                        ))))
547                    }
548                }
549
550                // A message has been received from the channel
551                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
552
553                std::task::Poll::Ready(Some(match header.ordinal {
554                    0x39f0b21bcd8c065d => {
555                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
556                        let mut req = fidl::new_empty!(
557                            fidl::encoding::EmptyPayload,
558                            fidl::encoding::DefaultFuchsiaResourceDialect
559                        );
560                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
561                        let control_handle = BusControlHandle { inner: this.inner.clone() };
562                        Ok(BusRequest::GetHostBridgeInfo {
563                            responder: BusGetHostBridgeInfoResponder {
564                                control_handle: std::mem::ManuallyDrop::new(control_handle),
565                                tx_id: header.tx_id,
566                            },
567                        })
568                    }
569                    0x2b39a32926007c92 => {
570                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
571                        let mut req = fidl::new_empty!(
572                            fidl::encoding::EmptyPayload,
573                            fidl::encoding::DefaultFuchsiaResourceDialect
574                        );
575                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
576                        let control_handle = BusControlHandle { inner: this.inner.clone() };
577                        Ok(BusRequest::GetDevices {
578                            responder: BusGetDevicesResponder {
579                                control_handle: std::mem::ManuallyDrop::new(control_handle),
580                                tx_id: header.tx_id,
581                            },
582                        })
583                    }
584                    0x798f39b0dfdc4860 => {
585                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
586                        let mut req = fidl::new_empty!(
587                            BusReadBarRequest,
588                            fidl::encoding::DefaultFuchsiaResourceDialect
589                        );
590                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BusReadBarRequest>(&header, _body_bytes, handles, &mut req)?;
591                        let control_handle = BusControlHandle { inner: this.inner.clone() };
592                        Ok(BusRequest::ReadBar {
593                            device: req.device,
594                            bar_id: req.bar_id,
595                            offset: req.offset,
596                            size: req.size,
597
598                            responder: BusReadBarResponder {
599                                control_handle: std::mem::ManuallyDrop::new(control_handle),
600                                tx_id: header.tx_id,
601                            },
602                        })
603                    }
604                    _ => Err(fidl::Error::UnknownOrdinal {
605                        ordinal: header.ordinal,
606                        protocol_name: <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
607                    }),
608                }))
609            },
610        )
611    }
612}
613
614/// The Bus protocol provides information about PCI device children on the PCI
615/// providing the service.
616#[derive(Debug)]
617pub enum BusRequest {
618    /// Retrieve information about the segment group and buses covered by a Bus.
619    GetHostBridgeInfo { responder: BusGetHostBridgeInfoResponder },
620    /// Retrieve all Devices on the Bus.
621    GetDevices { responder: BusGetDevicesResponder },
622    /// Read from a Device's base address register (BAR). The BAR must be an MMIO type.
623    ///
624    /// Parameters
625    /// |device|: The address of the device to read from.
626    /// |bar_id|: The ID of the BAR to read.
627    /// |offset|: The offset, in bytes, to start the read (default: 0 bytes).
628    /// |size|: The size of the read (default: 128 bytes). The max size for a
629    /// read is |READBAR_MAX_SIZE|.
630    ///
631    /// Errors:
632    /// |ZX_ERR_NOT_FOUND|: |device| was not found, or |bar_id| did not exist in |device|.
633    /// |ZX_ERR_INVALID_ARGS|: |bar_id| is invalid,  or offset / size combined
634    /// are invalid for the given BAR's size.
635    /// |ZX_ERR_NOT_SUPPORTED|: The BAR specified by |bar_id| is not an MMIO BAR.
636    ReadBar { device: Address, bar_id: u8, offset: u64, size: u64, responder: BusReadBarResponder },
637}
638
639impl BusRequest {
640    #[allow(irrefutable_let_patterns)]
641    pub fn into_get_host_bridge_info(self) -> Option<(BusGetHostBridgeInfoResponder)> {
642        if let BusRequest::GetHostBridgeInfo { responder } = self {
643            Some((responder))
644        } else {
645            None
646        }
647    }
648
649    #[allow(irrefutable_let_patterns)]
650    pub fn into_get_devices(self) -> Option<(BusGetDevicesResponder)> {
651        if let BusRequest::GetDevices { responder } = self {
652            Some((responder))
653        } else {
654            None
655        }
656    }
657
658    #[allow(irrefutable_let_patterns)]
659    pub fn into_read_bar(self) -> Option<(Address, u8, u64, u64, BusReadBarResponder)> {
660        if let BusRequest::ReadBar { device, bar_id, offset, size, responder } = self {
661            Some((device, bar_id, offset, size, responder))
662        } else {
663            None
664        }
665    }
666
667    /// Name of the method defined in FIDL
668    pub fn method_name(&self) -> &'static str {
669        match *self {
670            BusRequest::GetHostBridgeInfo { .. } => "get_host_bridge_info",
671            BusRequest::GetDevices { .. } => "get_devices",
672            BusRequest::ReadBar { .. } => "read_bar",
673        }
674    }
675}
676
677#[derive(Debug, Clone)]
678pub struct BusControlHandle {
679    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
680}
681
682impl fidl::endpoints::ControlHandle for BusControlHandle {
683    fn shutdown(&self) {
684        self.inner.shutdown()
685    }
686    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
687        self.inner.shutdown_with_epitaph(status)
688    }
689
690    fn is_closed(&self) -> bool {
691        self.inner.channel().is_closed()
692    }
693    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
694        self.inner.channel().on_closed()
695    }
696
697    #[cfg(target_os = "fuchsia")]
698    fn signal_peer(
699        &self,
700        clear_mask: zx::Signals,
701        set_mask: zx::Signals,
702    ) -> Result<(), zx_status::Status> {
703        use fidl::Peered;
704        self.inner.channel().signal_peer(clear_mask, set_mask)
705    }
706}
707
708impl BusControlHandle {}
709
710#[must_use = "FIDL methods require a response to be sent"]
711#[derive(Debug)]
712pub struct BusGetHostBridgeInfoResponder {
713    control_handle: std::mem::ManuallyDrop<BusControlHandle>,
714    tx_id: u32,
715}
716
717/// Set the the channel to be shutdown (see [`BusControlHandle::shutdown`])
718/// if the responder is dropped without sending a response, so that the client
719/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
720impl std::ops::Drop for BusGetHostBridgeInfoResponder {
721    fn drop(&mut self) {
722        self.control_handle.shutdown();
723        // Safety: drops once, never accessed again
724        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
725    }
726}
727
728impl fidl::endpoints::Responder for BusGetHostBridgeInfoResponder {
729    type ControlHandle = BusControlHandle;
730
731    fn control_handle(&self) -> &BusControlHandle {
732        &self.control_handle
733    }
734
735    fn drop_without_shutdown(mut self) {
736        // Safety: drops once, never accessed again due to mem::forget
737        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
738        // Prevent Drop from running (which would shut down the channel)
739        std::mem::forget(self);
740    }
741}
742
743impl BusGetHostBridgeInfoResponder {
744    /// Sends a response to the FIDL transaction.
745    ///
746    /// Sets the channel to shutdown if an error occurs.
747    pub fn send(self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
748        let _result = self.send_raw(info);
749        if _result.is_err() {
750            self.control_handle.shutdown();
751        }
752        self.drop_without_shutdown();
753        _result
754    }
755
756    /// Similar to "send" but does not shutdown the channel if an error occurs.
757    pub fn send_no_shutdown_on_err(self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
758        let _result = self.send_raw(info);
759        self.drop_without_shutdown();
760        _result
761    }
762
763    fn send_raw(&self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
764        self.control_handle.inner.send::<BusGetHostBridgeInfoResponse>(
765            (info,),
766            self.tx_id,
767            0x39f0b21bcd8c065d,
768            fidl::encoding::DynamicFlags::empty(),
769        )
770    }
771}
772
773#[must_use = "FIDL methods require a response to be sent"]
774#[derive(Debug)]
775pub struct BusGetDevicesResponder {
776    control_handle: std::mem::ManuallyDrop<BusControlHandle>,
777    tx_id: u32,
778}
779
780/// Set the the channel to be shutdown (see [`BusControlHandle::shutdown`])
781/// if the responder is dropped without sending a response, so that the client
782/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
783impl std::ops::Drop for BusGetDevicesResponder {
784    fn drop(&mut self) {
785        self.control_handle.shutdown();
786        // Safety: drops once, never accessed again
787        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
788    }
789}
790
791impl fidl::endpoints::Responder for BusGetDevicesResponder {
792    type ControlHandle = BusControlHandle;
793
794    fn control_handle(&self) -> &BusControlHandle {
795        &self.control_handle
796    }
797
798    fn drop_without_shutdown(mut self) {
799        // Safety: drops once, never accessed again due to mem::forget
800        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
801        // Prevent Drop from running (which would shut down the channel)
802        std::mem::forget(self);
803    }
804}
805
806impl BusGetDevicesResponder {
807    /// Sends a response to the FIDL transaction.
808    ///
809    /// Sets the channel to shutdown if an error occurs.
810    pub fn send(self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
811        let _result = self.send_raw(devices);
812        if _result.is_err() {
813            self.control_handle.shutdown();
814        }
815        self.drop_without_shutdown();
816        _result
817    }
818
819    /// Similar to "send" but does not shutdown the channel if an error occurs.
820    pub fn send_no_shutdown_on_err(self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
821        let _result = self.send_raw(devices);
822        self.drop_without_shutdown();
823        _result
824    }
825
826    fn send_raw(&self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
827        self.control_handle.inner.send::<BusGetDevicesResponse>(
828            (devices,),
829            self.tx_id,
830            0x2b39a32926007c92,
831            fidl::encoding::DynamicFlags::empty(),
832        )
833    }
834}
835
836#[must_use = "FIDL methods require a response to be sent"]
837#[derive(Debug)]
838pub struct BusReadBarResponder {
839    control_handle: std::mem::ManuallyDrop<BusControlHandle>,
840    tx_id: u32,
841}
842
843/// Set the the channel to be shutdown (see [`BusControlHandle::shutdown`])
844/// if the responder is dropped without sending a response, so that the client
845/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
846impl std::ops::Drop for BusReadBarResponder {
847    fn drop(&mut self) {
848        self.control_handle.shutdown();
849        // Safety: drops once, never accessed again
850        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
851    }
852}
853
854impl fidl::endpoints::Responder for BusReadBarResponder {
855    type ControlHandle = BusControlHandle;
856
857    fn control_handle(&self) -> &BusControlHandle {
858        &self.control_handle
859    }
860
861    fn drop_without_shutdown(mut self) {
862        // Safety: drops once, never accessed again due to mem::forget
863        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
864        // Prevent Drop from running (which would shut down the channel)
865        std::mem::forget(self);
866    }
867}
868
869impl BusReadBarResponder {
870    /// Sends a response to the FIDL transaction.
871    ///
872    /// Sets the channel to shutdown if an error occurs.
873    pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
874        let _result = self.send_raw(result);
875        if _result.is_err() {
876            self.control_handle.shutdown();
877        }
878        self.drop_without_shutdown();
879        _result
880    }
881
882    /// Similar to "send" but does not shutdown the channel if an error occurs.
883    pub fn send_no_shutdown_on_err(
884        self,
885        mut result: Result<&[u8], i32>,
886    ) -> Result<(), fidl::Error> {
887        let _result = self.send_raw(result);
888        self.drop_without_shutdown();
889        _result
890    }
891
892    fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
893        self.control_handle.inner.send::<fidl::encoding::ResultType<BusReadBarResponse, i32>>(
894            result.map(|buffer| (buffer,)),
895            self.tx_id,
896            0x798f39b0dfdc4860,
897            fidl::encoding::DynamicFlags::empty(),
898        )
899    }
900}
901
902#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
903pub struct DeviceMarker;
904
905impl fidl::endpoints::ProtocolMarker for DeviceMarker {
906    type Proxy = DeviceProxy;
907    type RequestStream = DeviceRequestStream;
908    #[cfg(target_os = "fuchsia")]
909    type SynchronousProxy = DeviceSynchronousProxy;
910
911    const DEBUG_NAME: &'static str = "fuchsia.hardware.pci.Device";
912}
913impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
914pub type DeviceGetBarResult = Result<Bar, i32>;
915pub type DeviceSetBusMasteringResult = Result<(), i32>;
916pub type DeviceResetDeviceResult = Result<(), i32>;
917pub type DeviceAckInterruptResult = Result<(), i32>;
918pub type DeviceMapInterruptResult = Result<fidl::Interrupt, i32>;
919pub type DeviceSetInterruptModeResult = Result<(), i32>;
920pub type DeviceReadConfig8Result = Result<u8, i32>;
921pub type DeviceReadConfig16Result = Result<u16, i32>;
922pub type DeviceReadConfig32Result = Result<u32, i32>;
923pub type DeviceWriteConfig8Result = Result<(), i32>;
924pub type DeviceWriteConfig16Result = Result<(), i32>;
925pub type DeviceWriteConfig32Result = Result<(), i32>;
926pub type DeviceGetBtiResult = Result<fidl::Bti, i32>;
927
928pub trait DeviceProxyInterface: Send + Sync {
929    type GetDeviceInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>>
930        + Send;
931    fn r#get_device_info(&self) -> Self::GetDeviceInfoResponseFut;
932    type GetBarResponseFut: std::future::Future<Output = Result<DeviceGetBarResult, fidl::Error>>
933        + Send;
934    fn r#get_bar(&self, bar_id: u32) -> Self::GetBarResponseFut;
935    type SetBusMasteringResponseFut: std::future::Future<Output = Result<DeviceSetBusMasteringResult, fidl::Error>>
936        + Send;
937    fn r#set_bus_mastering(&self, enabled: bool) -> Self::SetBusMasteringResponseFut;
938    type ResetDeviceResponseFut: std::future::Future<Output = Result<DeviceResetDeviceResult, fidl::Error>>
939        + Send;
940    fn r#reset_device(&self) -> Self::ResetDeviceResponseFut;
941    type AckInterruptResponseFut: std::future::Future<Output = Result<DeviceAckInterruptResult, fidl::Error>>
942        + Send;
943    fn r#ack_interrupt(&self) -> Self::AckInterruptResponseFut;
944    type MapInterruptResponseFut: std::future::Future<Output = Result<DeviceMapInterruptResult, fidl::Error>>
945        + Send;
946    fn r#map_interrupt(&self, which_irq: u32) -> Self::MapInterruptResponseFut;
947    type GetInterruptModesResponseFut: std::future::Future<Output = Result<InterruptModes, fidl::Error>>
948        + Send;
949    fn r#get_interrupt_modes(&self) -> Self::GetInterruptModesResponseFut;
950    type SetInterruptModeResponseFut: std::future::Future<Output = Result<DeviceSetInterruptModeResult, fidl::Error>>
951        + Send;
952    fn r#set_interrupt_mode(
953        &self,
954        mode: InterruptMode,
955        requested_irq_count: u32,
956    ) -> Self::SetInterruptModeResponseFut;
957    type ReadConfig8ResponseFut: std::future::Future<Output = Result<DeviceReadConfig8Result, fidl::Error>>
958        + Send;
959    fn r#read_config8(&self, offset: u16) -> Self::ReadConfig8ResponseFut;
960    type ReadConfig16ResponseFut: std::future::Future<Output = Result<DeviceReadConfig16Result, fidl::Error>>
961        + Send;
962    fn r#read_config16(&self, offset: u16) -> Self::ReadConfig16ResponseFut;
963    type ReadConfig32ResponseFut: std::future::Future<Output = Result<DeviceReadConfig32Result, fidl::Error>>
964        + Send;
965    fn r#read_config32(&self, offset: u16) -> Self::ReadConfig32ResponseFut;
966    type WriteConfig8ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig8Result, fidl::Error>>
967        + Send;
968    fn r#write_config8(&self, offset: u16, value: u8) -> Self::WriteConfig8ResponseFut;
969    type WriteConfig16ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig16Result, fidl::Error>>
970        + Send;
971    fn r#write_config16(&self, offset: u16, value: u16) -> Self::WriteConfig16ResponseFut;
972    type WriteConfig32ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig32Result, fidl::Error>>
973        + Send;
974    fn r#write_config32(&self, offset: u16, value: u32) -> Self::WriteConfig32ResponseFut;
975    type GetCapabilitiesResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>>
976        + Send;
977    fn r#get_capabilities(&self, id: CapabilityId) -> Self::GetCapabilitiesResponseFut;
978    type GetExtendedCapabilitiesResponseFut: std::future::Future<Output = Result<Vec<u16>, fidl::Error>>
979        + Send;
980    fn r#get_extended_capabilities(
981        &self,
982        id: ExtendedCapabilityId,
983    ) -> Self::GetExtendedCapabilitiesResponseFut;
984    type GetBtiResponseFut: std::future::Future<Output = Result<DeviceGetBtiResult, fidl::Error>>
985        + Send;
986    fn r#get_bti(&self, index: u32) -> Self::GetBtiResponseFut;
987}
988#[derive(Debug)]
989#[cfg(target_os = "fuchsia")]
990pub struct DeviceSynchronousProxy {
991    client: fidl::client::sync::Client,
992}
993
994#[cfg(target_os = "fuchsia")]
995impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
996    type Proxy = DeviceProxy;
997    type Protocol = DeviceMarker;
998
999    fn from_channel(inner: fidl::Channel) -> Self {
1000        Self::new(inner)
1001    }
1002
1003    fn into_channel(self) -> fidl::Channel {
1004        self.client.into_channel()
1005    }
1006
1007    fn as_channel(&self) -> &fidl::Channel {
1008        self.client.as_channel()
1009    }
1010}
1011
1012#[cfg(target_os = "fuchsia")]
1013impl DeviceSynchronousProxy {
1014    pub fn new(channel: fidl::Channel) -> Self {
1015        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1016        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1017    }
1018
1019    pub fn into_channel(self) -> fidl::Channel {
1020        self.client.into_channel()
1021    }
1022
1023    /// Waits until an event arrives and returns it. It is safe for other
1024    /// threads to make concurrent requests while waiting for an event.
1025    pub fn wait_for_event(
1026        &self,
1027        deadline: zx::MonotonicInstant,
1028    ) -> Result<DeviceEvent, fidl::Error> {
1029        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
1030    }
1031
1032    /// Returns a structure containing device information from the configuration header.
1033    pub fn r#get_device_info(
1034        &self,
1035        ___deadline: zx::MonotonicInstant,
1036    ) -> Result<DeviceInfo, fidl::Error> {
1037        let _response =
1038            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceInfoResponse>(
1039                (),
1040                0x5599d144d4329916,
1041                fidl::encoding::DynamicFlags::empty(),
1042                ___deadline,
1043            )?;
1044        Ok(_response.info)
1045    }
1046
1047    /// Retrieves information for a specified Base Address Register (BAR). If the BAR contains
1048    /// MSI-X capability tables then an attempt will be made to return an MMIO region excluding
1049    /// those tables, if possible. Otherwise, an error will be returned.
1050    ///
1051    /// Parameters:
1052    /// |bar_id|: The id of the BAR being requested. Valid range is [0, 6).
1053    ///
1054    /// Errors:
1055    /// |ZX_ERR_ACCESS_DENIED|: The specified BAR does not have a driver-accessible region due to
1056    /// the presence of MSI-X tables. To use MSI-X see the |SetInterruptMode| method.
1057    /// |ZX_ERR_INTERNAL|: A bus driver error has occurred.
1058    /// |ZX_ERR_INVALID_ARGS|: The |bar_id| specified is outside of the acceptable range.
1059    /// |ZX_ERR_NOT_FOUND|: The specified |bar_id| does not exist for this device.
1060    pub fn r#get_bar(
1061        &self,
1062        mut bar_id: u32,
1063        ___deadline: zx::MonotonicInstant,
1064    ) -> Result<DeviceGetBarResult, fidl::Error> {
1065        let _response = self.client.send_query::<
1066            DeviceGetBarRequest,
1067            fidl::encoding::ResultType<DeviceGetBarResponse, i32>,
1068        >(
1069            (bar_id,),
1070            0x6b2683f6fbbff679,
1071            fidl::encoding::DynamicFlags::empty(),
1072            ___deadline,
1073        )?;
1074        Ok(_response.map(|x| x.result))
1075    }
1076
1077    /// Enables or disables the bus mastering capability for the device.
1078    ///
1079    /// Parameters:
1080    /// |enable|: true to enable bus mastering, false to disable.
1081    ///
1082    /// Errors:
1083    /// |ZX_ERR_BAD_STATE|: Method was called while the device is disabled.
1084    pub fn r#set_bus_mastering(
1085        &self,
1086        mut enabled: bool,
1087        ___deadline: zx::MonotonicInstant,
1088    ) -> Result<DeviceSetBusMasteringResult, fidl::Error> {
1089        let _response = self.client.send_query::<
1090            DeviceSetBusMasteringRequest,
1091            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1092        >(
1093            (enabled,),
1094            0x3421e9e030211003,
1095            fidl::encoding::DynamicFlags::empty(),
1096            ___deadline,
1097        )?;
1098        Ok(_response.map(|x| x))
1099    }
1100
1101    /// Initiates a function level reset for the device. This is a synchronous
1102    /// operation that will not return ontil the reset is complete. Interrupt
1103    /// operation of the device must be disabled before initiating a reset.
1104    ///
1105    /// Errors:
1106    /// |ZX_ERR_BAD_STATE|: Interrupts were not disabled before calling |ResetDevice|.
1107    /// |ZX_ERR_NOT_SUPPORTED|: The device does not support reset.
1108    /// |ZX_ERR_TIMED_OUT|: The device did not complete its reset in the
1109    /// expected amount of time and is presumed to no longer be operating
1110    /// properly.
1111    pub fn r#reset_device(
1112        &self,
1113        ___deadline: zx::MonotonicInstant,
1114    ) -> Result<DeviceResetDeviceResult, fidl::Error> {
1115        let _response = self.client.send_query::<
1116            fidl::encoding::EmptyPayload,
1117            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1118        >(
1119            (),
1120            0x3c5b7579bb6f8b9f,
1121            fidl::encoding::DynamicFlags::empty(),
1122            ___deadline,
1123        )?;
1124        Ok(_response.map(|x| x))
1125    }
1126
1127    /// Alerts the bus driver to deassert the raised legacy interrupt so that it
1128    /// may be waited on again. Only used if |SetInterruptMode| was called with
1129    /// |PCI_INTERRUPT_MODE_LEGACY|.
1130    ///
1131    /// Errors:
1132    /// |ZX_ERR_BAD_STATE|: device is not configured to use the Legacy interrupt mode.
1133    pub fn r#ack_interrupt(
1134        &self,
1135        ___deadline: zx::MonotonicInstant,
1136    ) -> Result<DeviceAckInterruptResult, fidl::Error> {
1137        let _response = self.client.send_query::<
1138            fidl::encoding::EmptyPayload,
1139            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1140        >(
1141            (),
1142            0x70742f64692d5a6b,
1143            fidl::encoding::DynamicFlags::empty(),
1144            ___deadline,
1145        )?;
1146        Ok(_response.map(|x| x))
1147    }
1148
1149    /// Maps a device's interrupt to a zx:interrupt. The device's interrupt mode
1150    /// must already be configured with |SetInterruptMode|, and |which_irq| must
1151    /// be >= to the number of interrupts reported for that interrupt mode by
1152    /// |GetInterruptModes|. A Legacy interrupt may be mapped multiple times,
1153    /// but the handles will point to the same interrupt object. MSI & MSI-X
1154    /// interrupts may only have one outstanding mapping at a time per
1155    /// interrupt. Outstanding MSI & MSI-X interrupt handles must be closed
1156    /// before attempting to change the interrupt mode in a subsequent call to
1157    /// |SetInterruptMode|.
1158    ///
1159    /// Parameters:
1160    /// |which_irq|: The id of the interrupt to map.
1161    ///
1162    /// Errors:
1163    /// |ZX_ERR_ALREADY_BOUND|: The interrupt specified by |which_irq| is
1164    /// already mapped to a valid handle.
1165    /// |ZX_ERR_BAD_STATE|: interrupts are currently disabled for the device.
1166    /// |ZX_ERR_INVALID_ARGS|: |which_irq| is invalid for the mode.
1167    pub fn r#map_interrupt(
1168        &self,
1169        mut which_irq: u32,
1170        ___deadline: zx::MonotonicInstant,
1171    ) -> Result<DeviceMapInterruptResult, fidl::Error> {
1172        let _response = self.client.send_query::<
1173            DeviceMapInterruptRequest,
1174            fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>,
1175        >(
1176            (which_irq,),
1177            0x25eeff9d34a1fa13,
1178            fidl::encoding::DynamicFlags::empty(),
1179            ___deadline,
1180        )?;
1181        Ok(_response.map(|x| x.interrupt))
1182    }
1183
1184    /// Returns the supported interrupt modes for a device.
1185    pub fn r#get_interrupt_modes(
1186        &self,
1187        ___deadline: zx::MonotonicInstant,
1188    ) -> Result<InterruptModes, fidl::Error> {
1189        let _response = self
1190            .client
1191            .send_query::<fidl::encoding::EmptyPayload, DeviceGetInterruptModesResponse>(
1192                (),
1193                0x93f4cd8f79e9f4a,
1194                fidl::encoding::DynamicFlags::empty(),
1195                ___deadline,
1196            )?;
1197        Ok(_response.modes)
1198    }
1199
1200    /// Configures the interrupt mode for a device. When changing from one
1201    /// interrupt mode to another the driver must ensure existing interrupt
1202    /// handles are closed beforehand.
1203    ///
1204    /// Parameters:
1205    /// |mode|: The |InterruptMode| to request from the bus driver.
1206    /// |requested_irq_count|: The number of interrupts requested.
1207    ///
1208    /// Errors:
1209    /// |ZX_ERR_BAD_STATE|: The driver attempted to change interrupt mode while
1210    /// existing handles to mapped MSIs exist.
1211    /// |ZX_ERR_INVALID_ARGS|: |requested_irq_count| is 0.
1212    /// |ZX_ERR_NOT_SUPPORTED|: The provided |mode| is not supported, or invalid.
1213    pub fn r#set_interrupt_mode(
1214        &self,
1215        mut mode: InterruptMode,
1216        mut requested_irq_count: u32,
1217        ___deadline: zx::MonotonicInstant,
1218    ) -> Result<DeviceSetInterruptModeResult, fidl::Error> {
1219        let _response = self.client.send_query::<
1220            DeviceSetInterruptModeRequest,
1221            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1222        >(
1223            (mode, requested_irq_count,),
1224            0x85bebad3eb24866,
1225            fidl::encoding::DynamicFlags::empty(),
1226            ___deadline,
1227        )?;
1228        Ok(_response.map(|x| x))
1229    }
1230
1231    /// Reads a byte from the device's configuration space. |Offset| must be
1232    /// within [0x0, 0xFF] if PCI, or [0x0, 0xFFF) if PCIe. In most cases a
1233    /// device will be PCIe.
1234    ///
1235    /// Parameters:
1236    /// |offset|: The offset into the device's configuration space to read.
1237    ///
1238    /// Errors:
1239    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1240    pub fn r#read_config8(
1241        &self,
1242        mut offset: u16,
1243        ___deadline: zx::MonotonicInstant,
1244    ) -> Result<DeviceReadConfig8Result, fidl::Error> {
1245        let _response = self.client.send_query::<
1246            DeviceReadConfig8Request,
1247            fidl::encoding::ResultType<DeviceReadConfig8Response, i32>,
1248        >(
1249            (offset,),
1250            0x28f9eb9e6dadda1c,
1251            fidl::encoding::DynamicFlags::empty(),
1252            ___deadline,
1253        )?;
1254        Ok(_response.map(|x| x.value))
1255    }
1256
1257    /// Reads two bytes from the device's configuration space. |Offset| must be
1258    /// within [0x0, 0xFE] if PCI, or [0x0, 0xFFE] if PCIe. In most cases a
1259    /// device will be PCIe.
1260    ///
1261    /// Parameters:
1262    /// |offset|: The offset into the device's configuration space to read.
1263    ///
1264    /// Errors:
1265    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1266    pub fn r#read_config16(
1267        &self,
1268        mut offset: u16,
1269        ___deadline: zx::MonotonicInstant,
1270    ) -> Result<DeviceReadConfig16Result, fidl::Error> {
1271        let _response = self.client.send_query::<
1272            DeviceReadConfig16Request,
1273            fidl::encoding::ResultType<DeviceReadConfig16Response, i32>,
1274        >(
1275            (offset,),
1276            0x3bcda6171a3270bb,
1277            fidl::encoding::DynamicFlags::empty(),
1278            ___deadline,
1279        )?;
1280        Ok(_response.map(|x| x.value))
1281    }
1282
1283    /// Reads four bytes from the device's configuration space. |Offset| must be
1284    /// within [0x0, 0xFC] if PCI, or [0x0, 0xFFC] if PCIe. In most cases a
1285    /// device will be PCIe.
1286    ///
1287    /// Parameters:
1288    /// |offset|: The offset into the device's configuration space to read.
1289    ///
1290    /// Errors:
1291    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1292    pub fn r#read_config32(
1293        &self,
1294        mut offset: u16,
1295        ___deadline: zx::MonotonicInstant,
1296    ) -> Result<DeviceReadConfig32Result, fidl::Error> {
1297        let _response = self.client.send_query::<
1298            DeviceReadConfig32Request,
1299            fidl::encoding::ResultType<DeviceReadConfig32Response, i32>,
1300        >(
1301            (offset,),
1302            0x55357535402f7507,
1303            fidl::encoding::DynamicFlags::empty(),
1304            ___deadline,
1305        )?;
1306        Ok(_response.map(|x| x.value))
1307    }
1308
1309    /// Writes a byte to the device's configuration space. The acceptable
1310    /// ranges of |offset| for writes are [0x40, 0xFF] if PCI, or [0x40,
1311    /// 0xFFF] if PCIe. For most purposes a device will be PCIe.
1312    ///
1313    ///
1314    /// Parameters
1315    /// |offset|: The offset into the device's configuration space to read.
1316    /// |value|: The value to write.
1317    ///
1318    /// Errors:
1319    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
1320    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1321    pub fn r#write_config8(
1322        &self,
1323        mut offset: u16,
1324        mut value: u8,
1325        ___deadline: zx::MonotonicInstant,
1326    ) -> Result<DeviceWriteConfig8Result, fidl::Error> {
1327        let _response = self.client.send_query::<
1328            DeviceWriteConfig8Request,
1329            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1330        >(
1331            (offset, value,),
1332            0x49a0719e1433cff,
1333            fidl::encoding::DynamicFlags::empty(),
1334            ___deadline,
1335        )?;
1336        Ok(_response.map(|x| x))
1337    }
1338
1339    /// Writes two bytes to the device's configuration space. The acceptable
1340    /// ranges of |offset| for writes are [0x40, 0xFE] if PCI, or [0x40,
1341    /// 0xFFE] if PCIe. For most purposes a device will be PCIe.
1342    ///
1343    ///
1344    /// Parameters
1345    /// |offset|: The offset into the device's configuration space to read.
1346    /// |value|: The value to write.
1347    ///
1348    /// Errors:
1349    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
1350    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1351    pub fn r#write_config16(
1352        &self,
1353        mut offset: u16,
1354        mut value: u16,
1355        ___deadline: zx::MonotonicInstant,
1356    ) -> Result<DeviceWriteConfig16Result, fidl::Error> {
1357        let _response = self.client.send_query::<
1358            DeviceWriteConfig16Request,
1359            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1360        >(
1361            (offset, value,),
1362            0x3e30bf13f1c07eff,
1363            fidl::encoding::DynamicFlags::empty(),
1364            ___deadline,
1365        )?;
1366        Ok(_response.map(|x| x))
1367    }
1368
1369    /// Writes four bytes to the device's configuration space. The acceptable
1370    /// ranges of |offset| for writes are [0x40, 0xFC] if PCI, or [0x40,
1371    /// 0xFFC] if PCIe. For most purposes a device will be PCIe.
1372    ///
1373    ///
1374    /// Parameters
1375    /// |offset|: The offset into the device's configuration space to read.
1376    /// |value|: The value to write.
1377    ///
1378    /// Errors:
1379    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
1380    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1381    pub fn r#write_config32(
1382        &self,
1383        mut offset: u16,
1384        mut value: u32,
1385        ___deadline: zx::MonotonicInstant,
1386    ) -> Result<DeviceWriteConfig32Result, fidl::Error> {
1387        let _response = self.client.send_query::<
1388            DeviceWriteConfig32Request,
1389            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1390        >(
1391            (offset, value,),
1392            0x161584e5199b388,
1393            fidl::encoding::DynamicFlags::empty(),
1394            ___deadline,
1395        )?;
1396        Ok(_response.map(|x| x))
1397    }
1398
1399    /// Returns a vector of offsets in configuration space corresponding to
1400    /// capabilities matching the provided capability |id|.  If no corresponding
1401    /// match is found then the vector will be empty.
1402    ///
1403    /// Parameters:
1404    /// |id|: the capability id to search for.
1405    pub fn r#get_capabilities(
1406        &self,
1407        mut id: CapabilityId,
1408        ___deadline: zx::MonotonicInstant,
1409    ) -> Result<Vec<u8>, fidl::Error> {
1410        let _response =
1411            self.client.send_query::<DeviceGetCapabilitiesRequest, DeviceGetCapabilitiesResponse>(
1412                (id,),
1413                0x3a050fde46f3ba0f,
1414                fidl::encoding::DynamicFlags::empty(),
1415                ___deadline,
1416            )?;
1417        Ok(_response.offsets)
1418    }
1419
1420    /// Returns a vector of offsets in configuration space corresponding to
1421    /// extended capabilities matching the provided extended capability |id|.
1422    /// If no corresponding match is found then the vector will be empty.
1423    ///
1424    /// Parameters:
1425    /// |id|: the capability id to search for
1426    pub fn r#get_extended_capabilities(
1427        &self,
1428        mut id: ExtendedCapabilityId,
1429        ___deadline: zx::MonotonicInstant,
1430    ) -> Result<Vec<u16>, fidl::Error> {
1431        let _response = self.client.send_query::<
1432            DeviceGetExtendedCapabilitiesRequest,
1433            DeviceGetExtendedCapabilitiesResponse,
1434        >(
1435            (id,),
1436            0xb8573efcaae0c39,
1437            fidl::encoding::DynamicFlags::empty(),
1438            ___deadline,
1439        )?;
1440        Ok(_response.offsets)
1441    }
1442
1443    /// Returns the Bus Transaction Intiator (BTI) at a given index for the device.
1444    ///
1445    /// Parameters:
1446    /// |index|: the BTI to request.
1447    ///
1448    /// Errors:
1449    /// |ZX_ERR_OUT_OF_RANGE|: |index| was not 0.
1450    pub fn r#get_bti(
1451        &self,
1452        mut index: u32,
1453        ___deadline: zx::MonotonicInstant,
1454    ) -> Result<DeviceGetBtiResult, fidl::Error> {
1455        let _response = self.client.send_query::<
1456            DeviceGetBtiRequest,
1457            fidl::encoding::ResultType<DeviceGetBtiResponse, i32>,
1458        >(
1459            (index,),
1460            0x5e4fe9efb12d9ee3,
1461            fidl::encoding::DynamicFlags::empty(),
1462            ___deadline,
1463        )?;
1464        Ok(_response.map(|x| x.bti))
1465    }
1466}
1467
1468#[cfg(target_os = "fuchsia")]
1469impl From<DeviceSynchronousProxy> for zx::Handle {
1470    fn from(value: DeviceSynchronousProxy) -> Self {
1471        value.into_channel().into()
1472    }
1473}
1474
1475#[cfg(target_os = "fuchsia")]
1476impl From<fidl::Channel> for DeviceSynchronousProxy {
1477    fn from(value: fidl::Channel) -> Self {
1478        Self::new(value)
1479    }
1480}
1481
1482#[cfg(target_os = "fuchsia")]
1483impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
1484    type Protocol = DeviceMarker;
1485
1486    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
1487        Self::new(value.into_channel())
1488    }
1489}
1490
1491#[derive(Debug, Clone)]
1492pub struct DeviceProxy {
1493    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1494}
1495
1496impl fidl::endpoints::Proxy for DeviceProxy {
1497    type Protocol = DeviceMarker;
1498
1499    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1500        Self::new(inner)
1501    }
1502
1503    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1504        self.client.into_channel().map_err(|client| Self { client })
1505    }
1506
1507    fn as_channel(&self) -> &::fidl::AsyncChannel {
1508        self.client.as_channel()
1509    }
1510}
1511
1512impl DeviceProxy {
1513    /// Create a new Proxy for fuchsia.hardware.pci/Device.
1514    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1515        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1516        Self { client: fidl::client::Client::new(channel, protocol_name) }
1517    }
1518
1519    /// Get a Stream of events from the remote end of the protocol.
1520    ///
1521    /// # Panics
1522    ///
1523    /// Panics if the event stream was already taken.
1524    pub fn take_event_stream(&self) -> DeviceEventStream {
1525        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
1526    }
1527
1528    /// Returns a structure containing device information from the configuration header.
1529    pub fn r#get_device_info(
1530        &self,
1531    ) -> fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1532    {
1533        DeviceProxyInterface::r#get_device_info(self)
1534    }
1535
1536    /// Retrieves information for a specified Base Address Register (BAR). If the BAR contains
1537    /// MSI-X capability tables then an attempt will be made to return an MMIO region excluding
1538    /// those tables, if possible. Otherwise, an error will be returned.
1539    ///
1540    /// Parameters:
1541    /// |bar_id|: The id of the BAR being requested. Valid range is [0, 6).
1542    ///
1543    /// Errors:
1544    /// |ZX_ERR_ACCESS_DENIED|: The specified BAR does not have a driver-accessible region due to
1545    /// the presence of MSI-X tables. To use MSI-X see the |SetInterruptMode| method.
1546    /// |ZX_ERR_INTERNAL|: A bus driver error has occurred.
1547    /// |ZX_ERR_INVALID_ARGS|: The |bar_id| specified is outside of the acceptable range.
1548    /// |ZX_ERR_NOT_FOUND|: The specified |bar_id| does not exist for this device.
1549    pub fn r#get_bar(
1550        &self,
1551        mut bar_id: u32,
1552    ) -> fidl::client::QueryResponseFut<
1553        DeviceGetBarResult,
1554        fidl::encoding::DefaultFuchsiaResourceDialect,
1555    > {
1556        DeviceProxyInterface::r#get_bar(self, bar_id)
1557    }
1558
1559    /// Enables or disables the bus mastering capability for the device.
1560    ///
1561    /// Parameters:
1562    /// |enable|: true to enable bus mastering, false to disable.
1563    ///
1564    /// Errors:
1565    /// |ZX_ERR_BAD_STATE|: Method was called while the device is disabled.
1566    pub fn r#set_bus_mastering(
1567        &self,
1568        mut enabled: bool,
1569    ) -> fidl::client::QueryResponseFut<
1570        DeviceSetBusMasteringResult,
1571        fidl::encoding::DefaultFuchsiaResourceDialect,
1572    > {
1573        DeviceProxyInterface::r#set_bus_mastering(self, enabled)
1574    }
1575
1576    /// Initiates a function level reset for the device. This is a synchronous
1577    /// operation that will not return ontil the reset is complete. Interrupt
1578    /// operation of the device must be disabled before initiating a reset.
1579    ///
1580    /// Errors:
1581    /// |ZX_ERR_BAD_STATE|: Interrupts were not disabled before calling |ResetDevice|.
1582    /// |ZX_ERR_NOT_SUPPORTED|: The device does not support reset.
1583    /// |ZX_ERR_TIMED_OUT|: The device did not complete its reset in the
1584    /// expected amount of time and is presumed to no longer be operating
1585    /// properly.
1586    pub fn r#reset_device(
1587        &self,
1588    ) -> fidl::client::QueryResponseFut<
1589        DeviceResetDeviceResult,
1590        fidl::encoding::DefaultFuchsiaResourceDialect,
1591    > {
1592        DeviceProxyInterface::r#reset_device(self)
1593    }
1594
1595    /// Alerts the bus driver to deassert the raised legacy interrupt so that it
1596    /// may be waited on again. Only used if |SetInterruptMode| was called with
1597    /// |PCI_INTERRUPT_MODE_LEGACY|.
1598    ///
1599    /// Errors:
1600    /// |ZX_ERR_BAD_STATE|: device is not configured to use the Legacy interrupt mode.
1601    pub fn r#ack_interrupt(
1602        &self,
1603    ) -> fidl::client::QueryResponseFut<
1604        DeviceAckInterruptResult,
1605        fidl::encoding::DefaultFuchsiaResourceDialect,
1606    > {
1607        DeviceProxyInterface::r#ack_interrupt(self)
1608    }
1609
1610    /// Maps a device's interrupt to a zx:interrupt. The device's interrupt mode
1611    /// must already be configured with |SetInterruptMode|, and |which_irq| must
1612    /// be >= to the number of interrupts reported for that interrupt mode by
1613    /// |GetInterruptModes|. A Legacy interrupt may be mapped multiple times,
1614    /// but the handles will point to the same interrupt object. MSI & MSI-X
1615    /// interrupts may only have one outstanding mapping at a time per
1616    /// interrupt. Outstanding MSI & MSI-X interrupt handles must be closed
1617    /// before attempting to change the interrupt mode in a subsequent call to
1618    /// |SetInterruptMode|.
1619    ///
1620    /// Parameters:
1621    /// |which_irq|: The id of the interrupt to map.
1622    ///
1623    /// Errors:
1624    /// |ZX_ERR_ALREADY_BOUND|: The interrupt specified by |which_irq| is
1625    /// already mapped to a valid handle.
1626    /// |ZX_ERR_BAD_STATE|: interrupts are currently disabled for the device.
1627    /// |ZX_ERR_INVALID_ARGS|: |which_irq| is invalid for the mode.
1628    pub fn r#map_interrupt(
1629        &self,
1630        mut which_irq: u32,
1631    ) -> fidl::client::QueryResponseFut<
1632        DeviceMapInterruptResult,
1633        fidl::encoding::DefaultFuchsiaResourceDialect,
1634    > {
1635        DeviceProxyInterface::r#map_interrupt(self, which_irq)
1636    }
1637
1638    /// Returns the supported interrupt modes for a device.
1639    pub fn r#get_interrupt_modes(
1640        &self,
1641    ) -> fidl::client::QueryResponseFut<InterruptModes, fidl::encoding::DefaultFuchsiaResourceDialect>
1642    {
1643        DeviceProxyInterface::r#get_interrupt_modes(self)
1644    }
1645
1646    /// Configures the interrupt mode for a device. When changing from one
1647    /// interrupt mode to another the driver must ensure existing interrupt
1648    /// handles are closed beforehand.
1649    ///
1650    /// Parameters:
1651    /// |mode|: The |InterruptMode| to request from the bus driver.
1652    /// |requested_irq_count|: The number of interrupts requested.
1653    ///
1654    /// Errors:
1655    /// |ZX_ERR_BAD_STATE|: The driver attempted to change interrupt mode while
1656    /// existing handles to mapped MSIs exist.
1657    /// |ZX_ERR_INVALID_ARGS|: |requested_irq_count| is 0.
1658    /// |ZX_ERR_NOT_SUPPORTED|: The provided |mode| is not supported, or invalid.
1659    pub fn r#set_interrupt_mode(
1660        &self,
1661        mut mode: InterruptMode,
1662        mut requested_irq_count: u32,
1663    ) -> fidl::client::QueryResponseFut<
1664        DeviceSetInterruptModeResult,
1665        fidl::encoding::DefaultFuchsiaResourceDialect,
1666    > {
1667        DeviceProxyInterface::r#set_interrupt_mode(self, mode, requested_irq_count)
1668    }
1669
1670    /// Reads a byte from the device's configuration space. |Offset| must be
1671    /// within [0x0, 0xFF] if PCI, or [0x0, 0xFFF) if PCIe. In most cases a
1672    /// device will be PCIe.
1673    ///
1674    /// Parameters:
1675    /// |offset|: The offset into the device's configuration space to read.
1676    ///
1677    /// Errors:
1678    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1679    pub fn r#read_config8(
1680        &self,
1681        mut offset: u16,
1682    ) -> fidl::client::QueryResponseFut<
1683        DeviceReadConfig8Result,
1684        fidl::encoding::DefaultFuchsiaResourceDialect,
1685    > {
1686        DeviceProxyInterface::r#read_config8(self, offset)
1687    }
1688
1689    /// Reads two bytes from the device's configuration space. |Offset| must be
1690    /// within [0x0, 0xFE] if PCI, or [0x0, 0xFFE] if PCIe. In most cases a
1691    /// device will be PCIe.
1692    ///
1693    /// Parameters:
1694    /// |offset|: The offset into the device's configuration space to read.
1695    ///
1696    /// Errors:
1697    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1698    pub fn r#read_config16(
1699        &self,
1700        mut offset: u16,
1701    ) -> fidl::client::QueryResponseFut<
1702        DeviceReadConfig16Result,
1703        fidl::encoding::DefaultFuchsiaResourceDialect,
1704    > {
1705        DeviceProxyInterface::r#read_config16(self, offset)
1706    }
1707
1708    /// Reads four bytes from the device's configuration space. |Offset| must be
1709    /// within [0x0, 0xFC] if PCI, or [0x0, 0xFFC] if PCIe. In most cases a
1710    /// device will be PCIe.
1711    ///
1712    /// Parameters:
1713    /// |offset|: The offset into the device's configuration space to read.
1714    ///
1715    /// Errors:
1716    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1717    pub fn r#read_config32(
1718        &self,
1719        mut offset: u16,
1720    ) -> fidl::client::QueryResponseFut<
1721        DeviceReadConfig32Result,
1722        fidl::encoding::DefaultFuchsiaResourceDialect,
1723    > {
1724        DeviceProxyInterface::r#read_config32(self, offset)
1725    }
1726
1727    /// Writes a byte to the device's configuration space. The acceptable
1728    /// ranges of |offset| for writes are [0x40, 0xFF] if PCI, or [0x40,
1729    /// 0xFFF] if PCIe. For most purposes a device will be PCIe.
1730    ///
1731    ///
1732    /// Parameters
1733    /// |offset|: The offset into the device's configuration space to read.
1734    /// |value|: The value to write.
1735    ///
1736    /// Errors:
1737    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
1738    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1739    pub fn r#write_config8(
1740        &self,
1741        mut offset: u16,
1742        mut value: u8,
1743    ) -> fidl::client::QueryResponseFut<
1744        DeviceWriteConfig8Result,
1745        fidl::encoding::DefaultFuchsiaResourceDialect,
1746    > {
1747        DeviceProxyInterface::r#write_config8(self, offset, value)
1748    }
1749
1750    /// Writes two bytes to the device's configuration space. The acceptable
1751    /// ranges of |offset| for writes are [0x40, 0xFE] if PCI, or [0x40,
1752    /// 0xFFE] if PCIe. For most purposes a device will be PCIe.
1753    ///
1754    ///
1755    /// Parameters
1756    /// |offset|: The offset into the device's configuration space to read.
1757    /// |value|: The value to write.
1758    ///
1759    /// Errors:
1760    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
1761    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1762    pub fn r#write_config16(
1763        &self,
1764        mut offset: u16,
1765        mut value: u16,
1766    ) -> fidl::client::QueryResponseFut<
1767        DeviceWriteConfig16Result,
1768        fidl::encoding::DefaultFuchsiaResourceDialect,
1769    > {
1770        DeviceProxyInterface::r#write_config16(self, offset, value)
1771    }
1772
1773    /// Writes four bytes to the device's configuration space. The acceptable
1774    /// ranges of |offset| for writes are [0x40, 0xFC] if PCI, or [0x40,
1775    /// 0xFFC] if PCIe. For most purposes a device will be PCIe.
1776    ///
1777    ///
1778    /// Parameters
1779    /// |offset|: The offset into the device's configuration space to read.
1780    /// |value|: The value to write.
1781    ///
1782    /// Errors:
1783    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
1784    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
1785    pub fn r#write_config32(
1786        &self,
1787        mut offset: u16,
1788        mut value: u32,
1789    ) -> fidl::client::QueryResponseFut<
1790        DeviceWriteConfig32Result,
1791        fidl::encoding::DefaultFuchsiaResourceDialect,
1792    > {
1793        DeviceProxyInterface::r#write_config32(self, offset, value)
1794    }
1795
1796    /// Returns a vector of offsets in configuration space corresponding to
1797    /// capabilities matching the provided capability |id|.  If no corresponding
1798    /// match is found then the vector will be empty.
1799    ///
1800    /// Parameters:
1801    /// |id|: the capability id to search for.
1802    pub fn r#get_capabilities(
1803        &self,
1804        mut id: CapabilityId,
1805    ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
1806    {
1807        DeviceProxyInterface::r#get_capabilities(self, id)
1808    }
1809
1810    /// Returns a vector of offsets in configuration space corresponding to
1811    /// extended capabilities matching the provided extended capability |id|.
1812    /// If no corresponding match is found then the vector will be empty.
1813    ///
1814    /// Parameters:
1815    /// |id|: the capability id to search for
1816    pub fn r#get_extended_capabilities(
1817        &self,
1818        mut id: ExtendedCapabilityId,
1819    ) -> fidl::client::QueryResponseFut<Vec<u16>, fidl::encoding::DefaultFuchsiaResourceDialect>
1820    {
1821        DeviceProxyInterface::r#get_extended_capabilities(self, id)
1822    }
1823
1824    /// Returns the Bus Transaction Intiator (BTI) at a given index for the device.
1825    ///
1826    /// Parameters:
1827    /// |index|: the BTI to request.
1828    ///
1829    /// Errors:
1830    /// |ZX_ERR_OUT_OF_RANGE|: |index| was not 0.
1831    pub fn r#get_bti(
1832        &self,
1833        mut index: u32,
1834    ) -> fidl::client::QueryResponseFut<
1835        DeviceGetBtiResult,
1836        fidl::encoding::DefaultFuchsiaResourceDialect,
1837    > {
1838        DeviceProxyInterface::r#get_bti(self, index)
1839    }
1840}
1841
1842impl DeviceProxyInterface for DeviceProxy {
1843    type GetDeviceInfoResponseFut =
1844        fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
1845    fn r#get_device_info(&self) -> Self::GetDeviceInfoResponseFut {
1846        fn _decode(
1847            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1848        ) -> Result<DeviceInfo, fidl::Error> {
1849            let _response = fidl::client::decode_transaction_body::<
1850                DeviceGetDeviceInfoResponse,
1851                fidl::encoding::DefaultFuchsiaResourceDialect,
1852                0x5599d144d4329916,
1853            >(_buf?)?;
1854            Ok(_response.info)
1855        }
1856        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
1857            (),
1858            0x5599d144d4329916,
1859            fidl::encoding::DynamicFlags::empty(),
1860            _decode,
1861        )
1862    }
1863
1864    type GetBarResponseFut = fidl::client::QueryResponseFut<
1865        DeviceGetBarResult,
1866        fidl::encoding::DefaultFuchsiaResourceDialect,
1867    >;
1868    fn r#get_bar(&self, mut bar_id: u32) -> Self::GetBarResponseFut {
1869        fn _decode(
1870            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1871        ) -> Result<DeviceGetBarResult, fidl::Error> {
1872            let _response = fidl::client::decode_transaction_body::<
1873                fidl::encoding::ResultType<DeviceGetBarResponse, i32>,
1874                fidl::encoding::DefaultFuchsiaResourceDialect,
1875                0x6b2683f6fbbff679,
1876            >(_buf?)?;
1877            Ok(_response.map(|x| x.result))
1878        }
1879        self.client.send_query_and_decode::<DeviceGetBarRequest, DeviceGetBarResult>(
1880            (bar_id,),
1881            0x6b2683f6fbbff679,
1882            fidl::encoding::DynamicFlags::empty(),
1883            _decode,
1884        )
1885    }
1886
1887    type SetBusMasteringResponseFut = fidl::client::QueryResponseFut<
1888        DeviceSetBusMasteringResult,
1889        fidl::encoding::DefaultFuchsiaResourceDialect,
1890    >;
1891    fn r#set_bus_mastering(&self, mut enabled: bool) -> Self::SetBusMasteringResponseFut {
1892        fn _decode(
1893            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1894        ) -> Result<DeviceSetBusMasteringResult, fidl::Error> {
1895            let _response = fidl::client::decode_transaction_body::<
1896                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1897                fidl::encoding::DefaultFuchsiaResourceDialect,
1898                0x3421e9e030211003,
1899            >(_buf?)?;
1900            Ok(_response.map(|x| x))
1901        }
1902        self.client
1903            .send_query_and_decode::<DeviceSetBusMasteringRequest, DeviceSetBusMasteringResult>(
1904                (enabled,),
1905                0x3421e9e030211003,
1906                fidl::encoding::DynamicFlags::empty(),
1907                _decode,
1908            )
1909    }
1910
1911    type ResetDeviceResponseFut = fidl::client::QueryResponseFut<
1912        DeviceResetDeviceResult,
1913        fidl::encoding::DefaultFuchsiaResourceDialect,
1914    >;
1915    fn r#reset_device(&self) -> Self::ResetDeviceResponseFut {
1916        fn _decode(
1917            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1918        ) -> Result<DeviceResetDeviceResult, fidl::Error> {
1919            let _response = fidl::client::decode_transaction_body::<
1920                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1921                fidl::encoding::DefaultFuchsiaResourceDialect,
1922                0x3c5b7579bb6f8b9f,
1923            >(_buf?)?;
1924            Ok(_response.map(|x| x))
1925        }
1926        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceResetDeviceResult>(
1927            (),
1928            0x3c5b7579bb6f8b9f,
1929            fidl::encoding::DynamicFlags::empty(),
1930            _decode,
1931        )
1932    }
1933
1934    type AckInterruptResponseFut = fidl::client::QueryResponseFut<
1935        DeviceAckInterruptResult,
1936        fidl::encoding::DefaultFuchsiaResourceDialect,
1937    >;
1938    fn r#ack_interrupt(&self) -> Self::AckInterruptResponseFut {
1939        fn _decode(
1940            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1941        ) -> Result<DeviceAckInterruptResult, fidl::Error> {
1942            let _response = fidl::client::decode_transaction_body::<
1943                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1944                fidl::encoding::DefaultFuchsiaResourceDialect,
1945                0x70742f64692d5a6b,
1946            >(_buf?)?;
1947            Ok(_response.map(|x| x))
1948        }
1949        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceAckInterruptResult>(
1950            (),
1951            0x70742f64692d5a6b,
1952            fidl::encoding::DynamicFlags::empty(),
1953            _decode,
1954        )
1955    }
1956
1957    type MapInterruptResponseFut = fidl::client::QueryResponseFut<
1958        DeviceMapInterruptResult,
1959        fidl::encoding::DefaultFuchsiaResourceDialect,
1960    >;
1961    fn r#map_interrupt(&self, mut which_irq: u32) -> Self::MapInterruptResponseFut {
1962        fn _decode(
1963            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1964        ) -> Result<DeviceMapInterruptResult, fidl::Error> {
1965            let _response = fidl::client::decode_transaction_body::<
1966                fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>,
1967                fidl::encoding::DefaultFuchsiaResourceDialect,
1968                0x25eeff9d34a1fa13,
1969            >(_buf?)?;
1970            Ok(_response.map(|x| x.interrupt))
1971        }
1972        self.client.send_query_and_decode::<DeviceMapInterruptRequest, DeviceMapInterruptResult>(
1973            (which_irq,),
1974            0x25eeff9d34a1fa13,
1975            fidl::encoding::DynamicFlags::empty(),
1976            _decode,
1977        )
1978    }
1979
1980    type GetInterruptModesResponseFut = fidl::client::QueryResponseFut<
1981        InterruptModes,
1982        fidl::encoding::DefaultFuchsiaResourceDialect,
1983    >;
1984    fn r#get_interrupt_modes(&self) -> Self::GetInterruptModesResponseFut {
1985        fn _decode(
1986            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1987        ) -> Result<InterruptModes, fidl::Error> {
1988            let _response = fidl::client::decode_transaction_body::<
1989                DeviceGetInterruptModesResponse,
1990                fidl::encoding::DefaultFuchsiaResourceDialect,
1991                0x93f4cd8f79e9f4a,
1992            >(_buf?)?;
1993            Ok(_response.modes)
1994        }
1995        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InterruptModes>(
1996            (),
1997            0x93f4cd8f79e9f4a,
1998            fidl::encoding::DynamicFlags::empty(),
1999            _decode,
2000        )
2001    }
2002
2003    type SetInterruptModeResponseFut = fidl::client::QueryResponseFut<
2004        DeviceSetInterruptModeResult,
2005        fidl::encoding::DefaultFuchsiaResourceDialect,
2006    >;
2007    fn r#set_interrupt_mode(
2008        &self,
2009        mut mode: InterruptMode,
2010        mut requested_irq_count: u32,
2011    ) -> Self::SetInterruptModeResponseFut {
2012        fn _decode(
2013            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2014        ) -> Result<DeviceSetInterruptModeResult, fidl::Error> {
2015            let _response = fidl::client::decode_transaction_body::<
2016                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2017                fidl::encoding::DefaultFuchsiaResourceDialect,
2018                0x85bebad3eb24866,
2019            >(_buf?)?;
2020            Ok(_response.map(|x| x))
2021        }
2022        self.client
2023            .send_query_and_decode::<DeviceSetInterruptModeRequest, DeviceSetInterruptModeResult>(
2024                (mode, requested_irq_count),
2025                0x85bebad3eb24866,
2026                fidl::encoding::DynamicFlags::empty(),
2027                _decode,
2028            )
2029    }
2030
2031    type ReadConfig8ResponseFut = fidl::client::QueryResponseFut<
2032        DeviceReadConfig8Result,
2033        fidl::encoding::DefaultFuchsiaResourceDialect,
2034    >;
2035    fn r#read_config8(&self, mut offset: u16) -> Self::ReadConfig8ResponseFut {
2036        fn _decode(
2037            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2038        ) -> Result<DeviceReadConfig8Result, fidl::Error> {
2039            let _response = fidl::client::decode_transaction_body::<
2040                fidl::encoding::ResultType<DeviceReadConfig8Response, i32>,
2041                fidl::encoding::DefaultFuchsiaResourceDialect,
2042                0x28f9eb9e6dadda1c,
2043            >(_buf?)?;
2044            Ok(_response.map(|x| x.value))
2045        }
2046        self.client.send_query_and_decode::<DeviceReadConfig8Request, DeviceReadConfig8Result>(
2047            (offset,),
2048            0x28f9eb9e6dadda1c,
2049            fidl::encoding::DynamicFlags::empty(),
2050            _decode,
2051        )
2052    }
2053
2054    type ReadConfig16ResponseFut = fidl::client::QueryResponseFut<
2055        DeviceReadConfig16Result,
2056        fidl::encoding::DefaultFuchsiaResourceDialect,
2057    >;
2058    fn r#read_config16(&self, mut offset: u16) -> Self::ReadConfig16ResponseFut {
2059        fn _decode(
2060            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2061        ) -> Result<DeviceReadConfig16Result, fidl::Error> {
2062            let _response = fidl::client::decode_transaction_body::<
2063                fidl::encoding::ResultType<DeviceReadConfig16Response, i32>,
2064                fidl::encoding::DefaultFuchsiaResourceDialect,
2065                0x3bcda6171a3270bb,
2066            >(_buf?)?;
2067            Ok(_response.map(|x| x.value))
2068        }
2069        self.client.send_query_and_decode::<DeviceReadConfig16Request, DeviceReadConfig16Result>(
2070            (offset,),
2071            0x3bcda6171a3270bb,
2072            fidl::encoding::DynamicFlags::empty(),
2073            _decode,
2074        )
2075    }
2076
2077    type ReadConfig32ResponseFut = fidl::client::QueryResponseFut<
2078        DeviceReadConfig32Result,
2079        fidl::encoding::DefaultFuchsiaResourceDialect,
2080    >;
2081    fn r#read_config32(&self, mut offset: u16) -> Self::ReadConfig32ResponseFut {
2082        fn _decode(
2083            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2084        ) -> Result<DeviceReadConfig32Result, fidl::Error> {
2085            let _response = fidl::client::decode_transaction_body::<
2086                fidl::encoding::ResultType<DeviceReadConfig32Response, i32>,
2087                fidl::encoding::DefaultFuchsiaResourceDialect,
2088                0x55357535402f7507,
2089            >(_buf?)?;
2090            Ok(_response.map(|x| x.value))
2091        }
2092        self.client.send_query_and_decode::<DeviceReadConfig32Request, DeviceReadConfig32Result>(
2093            (offset,),
2094            0x55357535402f7507,
2095            fidl::encoding::DynamicFlags::empty(),
2096            _decode,
2097        )
2098    }
2099
2100    type WriteConfig8ResponseFut = fidl::client::QueryResponseFut<
2101        DeviceWriteConfig8Result,
2102        fidl::encoding::DefaultFuchsiaResourceDialect,
2103    >;
2104    fn r#write_config8(&self, mut offset: u16, mut value: u8) -> Self::WriteConfig8ResponseFut {
2105        fn _decode(
2106            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2107        ) -> Result<DeviceWriteConfig8Result, fidl::Error> {
2108            let _response = fidl::client::decode_transaction_body::<
2109                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2110                fidl::encoding::DefaultFuchsiaResourceDialect,
2111                0x49a0719e1433cff,
2112            >(_buf?)?;
2113            Ok(_response.map(|x| x))
2114        }
2115        self.client.send_query_and_decode::<DeviceWriteConfig8Request, DeviceWriteConfig8Result>(
2116            (offset, value),
2117            0x49a0719e1433cff,
2118            fidl::encoding::DynamicFlags::empty(),
2119            _decode,
2120        )
2121    }
2122
2123    type WriteConfig16ResponseFut = fidl::client::QueryResponseFut<
2124        DeviceWriteConfig16Result,
2125        fidl::encoding::DefaultFuchsiaResourceDialect,
2126    >;
2127    fn r#write_config16(&self, mut offset: u16, mut value: u16) -> Self::WriteConfig16ResponseFut {
2128        fn _decode(
2129            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2130        ) -> Result<DeviceWriteConfig16Result, fidl::Error> {
2131            let _response = fidl::client::decode_transaction_body::<
2132                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2133                fidl::encoding::DefaultFuchsiaResourceDialect,
2134                0x3e30bf13f1c07eff,
2135            >(_buf?)?;
2136            Ok(_response.map(|x| x))
2137        }
2138        self.client.send_query_and_decode::<DeviceWriteConfig16Request, DeviceWriteConfig16Result>(
2139            (offset, value),
2140            0x3e30bf13f1c07eff,
2141            fidl::encoding::DynamicFlags::empty(),
2142            _decode,
2143        )
2144    }
2145
2146    type WriteConfig32ResponseFut = fidl::client::QueryResponseFut<
2147        DeviceWriteConfig32Result,
2148        fidl::encoding::DefaultFuchsiaResourceDialect,
2149    >;
2150    fn r#write_config32(&self, mut offset: u16, mut value: u32) -> Self::WriteConfig32ResponseFut {
2151        fn _decode(
2152            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2153        ) -> Result<DeviceWriteConfig32Result, fidl::Error> {
2154            let _response = fidl::client::decode_transaction_body::<
2155                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2156                fidl::encoding::DefaultFuchsiaResourceDialect,
2157                0x161584e5199b388,
2158            >(_buf?)?;
2159            Ok(_response.map(|x| x))
2160        }
2161        self.client.send_query_and_decode::<DeviceWriteConfig32Request, DeviceWriteConfig32Result>(
2162            (offset, value),
2163            0x161584e5199b388,
2164            fidl::encoding::DynamicFlags::empty(),
2165            _decode,
2166        )
2167    }
2168
2169    type GetCapabilitiesResponseFut =
2170        fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2171    fn r#get_capabilities(&self, mut id: CapabilityId) -> Self::GetCapabilitiesResponseFut {
2172        fn _decode(
2173            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2174        ) -> Result<Vec<u8>, fidl::Error> {
2175            let _response = fidl::client::decode_transaction_body::<
2176                DeviceGetCapabilitiesResponse,
2177                fidl::encoding::DefaultFuchsiaResourceDialect,
2178                0x3a050fde46f3ba0f,
2179            >(_buf?)?;
2180            Ok(_response.offsets)
2181        }
2182        self.client.send_query_and_decode::<DeviceGetCapabilitiesRequest, Vec<u8>>(
2183            (id,),
2184            0x3a050fde46f3ba0f,
2185            fidl::encoding::DynamicFlags::empty(),
2186            _decode,
2187        )
2188    }
2189
2190    type GetExtendedCapabilitiesResponseFut =
2191        fidl::client::QueryResponseFut<Vec<u16>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2192    fn r#get_extended_capabilities(
2193        &self,
2194        mut id: ExtendedCapabilityId,
2195    ) -> Self::GetExtendedCapabilitiesResponseFut {
2196        fn _decode(
2197            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2198        ) -> Result<Vec<u16>, fidl::Error> {
2199            let _response = fidl::client::decode_transaction_body::<
2200                DeviceGetExtendedCapabilitiesResponse,
2201                fidl::encoding::DefaultFuchsiaResourceDialect,
2202                0xb8573efcaae0c39,
2203            >(_buf?)?;
2204            Ok(_response.offsets)
2205        }
2206        self.client.send_query_and_decode::<DeviceGetExtendedCapabilitiesRequest, Vec<u16>>(
2207            (id,),
2208            0xb8573efcaae0c39,
2209            fidl::encoding::DynamicFlags::empty(),
2210            _decode,
2211        )
2212    }
2213
2214    type GetBtiResponseFut = fidl::client::QueryResponseFut<
2215        DeviceGetBtiResult,
2216        fidl::encoding::DefaultFuchsiaResourceDialect,
2217    >;
2218    fn r#get_bti(&self, mut index: u32) -> Self::GetBtiResponseFut {
2219        fn _decode(
2220            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2221        ) -> Result<DeviceGetBtiResult, fidl::Error> {
2222            let _response = fidl::client::decode_transaction_body::<
2223                fidl::encoding::ResultType<DeviceGetBtiResponse, i32>,
2224                fidl::encoding::DefaultFuchsiaResourceDialect,
2225                0x5e4fe9efb12d9ee3,
2226            >(_buf?)?;
2227            Ok(_response.map(|x| x.bti))
2228        }
2229        self.client.send_query_and_decode::<DeviceGetBtiRequest, DeviceGetBtiResult>(
2230            (index,),
2231            0x5e4fe9efb12d9ee3,
2232            fidl::encoding::DynamicFlags::empty(),
2233            _decode,
2234        )
2235    }
2236}
2237
2238pub struct DeviceEventStream {
2239    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2240}
2241
2242impl std::marker::Unpin for DeviceEventStream {}
2243
2244impl futures::stream::FusedStream for DeviceEventStream {
2245    fn is_terminated(&self) -> bool {
2246        self.event_receiver.is_terminated()
2247    }
2248}
2249
2250impl futures::Stream for DeviceEventStream {
2251    type Item = Result<DeviceEvent, fidl::Error>;
2252
2253    fn poll_next(
2254        mut self: std::pin::Pin<&mut Self>,
2255        cx: &mut std::task::Context<'_>,
2256    ) -> std::task::Poll<Option<Self::Item>> {
2257        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2258            &mut self.event_receiver,
2259            cx
2260        )?) {
2261            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
2262            None => std::task::Poll::Ready(None),
2263        }
2264    }
2265}
2266
2267#[derive(Debug)]
2268pub enum DeviceEvent {}
2269
2270impl DeviceEvent {
2271    /// Decodes a message buffer as a [`DeviceEvent`].
2272    fn decode(
2273        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2274    ) -> Result<DeviceEvent, fidl::Error> {
2275        let (bytes, _handles) = buf.split_mut();
2276        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2277        debug_assert_eq!(tx_header.tx_id, 0);
2278        match tx_header.ordinal {
2279            _ => Err(fidl::Error::UnknownOrdinal {
2280                ordinal: tx_header.ordinal,
2281                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2282            }),
2283        }
2284    }
2285}
2286
2287/// A Stream of incoming requests for fuchsia.hardware.pci/Device.
2288pub struct DeviceRequestStream {
2289    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2290    is_terminated: bool,
2291}
2292
2293impl std::marker::Unpin for DeviceRequestStream {}
2294
2295impl futures::stream::FusedStream for DeviceRequestStream {
2296    fn is_terminated(&self) -> bool {
2297        self.is_terminated
2298    }
2299}
2300
2301impl fidl::endpoints::RequestStream for DeviceRequestStream {
2302    type Protocol = DeviceMarker;
2303    type ControlHandle = DeviceControlHandle;
2304
2305    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2306        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2307    }
2308
2309    fn control_handle(&self) -> Self::ControlHandle {
2310        DeviceControlHandle { inner: self.inner.clone() }
2311    }
2312
2313    fn into_inner(
2314        self,
2315    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2316    {
2317        (self.inner, self.is_terminated)
2318    }
2319
2320    fn from_inner(
2321        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2322        is_terminated: bool,
2323    ) -> Self {
2324        Self { inner, is_terminated }
2325    }
2326}
2327
2328impl futures::Stream for DeviceRequestStream {
2329    type Item = Result<DeviceRequest, fidl::Error>;
2330
2331    fn poll_next(
2332        mut self: std::pin::Pin<&mut Self>,
2333        cx: &mut std::task::Context<'_>,
2334    ) -> std::task::Poll<Option<Self::Item>> {
2335        let this = &mut *self;
2336        if this.inner.check_shutdown(cx) {
2337            this.is_terminated = true;
2338            return std::task::Poll::Ready(None);
2339        }
2340        if this.is_terminated {
2341            panic!("polled DeviceRequestStream after completion");
2342        }
2343        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2344            |bytes, handles| {
2345                match this.inner.channel().read_etc(cx, bytes, handles) {
2346                    std::task::Poll::Ready(Ok(())) => {}
2347                    std::task::Poll::Pending => return std::task::Poll::Pending,
2348                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2349                        this.is_terminated = true;
2350                        return std::task::Poll::Ready(None);
2351                    }
2352                    std::task::Poll::Ready(Err(e)) => {
2353                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2354                            e.into(),
2355                        ))))
2356                    }
2357                }
2358
2359                // A message has been received from the channel
2360                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2361
2362                std::task::Poll::Ready(Some(match header.ordinal {
2363                    0x5599d144d4329916 => {
2364                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2365                        let mut req = fidl::new_empty!(
2366                            fidl::encoding::EmptyPayload,
2367                            fidl::encoding::DefaultFuchsiaResourceDialect
2368                        );
2369                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2370                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2371                        Ok(DeviceRequest::GetDeviceInfo {
2372                            responder: DeviceGetDeviceInfoResponder {
2373                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2374                                tx_id: header.tx_id,
2375                            },
2376                        })
2377                    }
2378                    0x6b2683f6fbbff679 => {
2379                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2380                        let mut req = fidl::new_empty!(
2381                            DeviceGetBarRequest,
2382                            fidl::encoding::DefaultFuchsiaResourceDialect
2383                        );
2384                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBarRequest>(&header, _body_bytes, handles, &mut req)?;
2385                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2386                        Ok(DeviceRequest::GetBar {
2387                            bar_id: req.bar_id,
2388
2389                            responder: DeviceGetBarResponder {
2390                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2391                                tx_id: header.tx_id,
2392                            },
2393                        })
2394                    }
2395                    0x3421e9e030211003 => {
2396                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2397                        let mut req = fidl::new_empty!(
2398                            DeviceSetBusMasteringRequest,
2399                            fidl::encoding::DefaultFuchsiaResourceDialect
2400                        );
2401                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetBusMasteringRequest>(&header, _body_bytes, handles, &mut req)?;
2402                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2403                        Ok(DeviceRequest::SetBusMastering {
2404                            enabled: req.enabled,
2405
2406                            responder: DeviceSetBusMasteringResponder {
2407                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2408                                tx_id: header.tx_id,
2409                            },
2410                        })
2411                    }
2412                    0x3c5b7579bb6f8b9f => {
2413                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2414                        let mut req = fidl::new_empty!(
2415                            fidl::encoding::EmptyPayload,
2416                            fidl::encoding::DefaultFuchsiaResourceDialect
2417                        );
2418                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2419                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2420                        Ok(DeviceRequest::ResetDevice {
2421                            responder: DeviceResetDeviceResponder {
2422                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2423                                tx_id: header.tx_id,
2424                            },
2425                        })
2426                    }
2427                    0x70742f64692d5a6b => {
2428                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2429                        let mut req = fidl::new_empty!(
2430                            fidl::encoding::EmptyPayload,
2431                            fidl::encoding::DefaultFuchsiaResourceDialect
2432                        );
2433                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2434                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2435                        Ok(DeviceRequest::AckInterrupt {
2436                            responder: DeviceAckInterruptResponder {
2437                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2438                                tx_id: header.tx_id,
2439                            },
2440                        })
2441                    }
2442                    0x25eeff9d34a1fa13 => {
2443                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2444                        let mut req = fidl::new_empty!(
2445                            DeviceMapInterruptRequest,
2446                            fidl::encoding::DefaultFuchsiaResourceDialect
2447                        );
2448                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceMapInterruptRequest>(&header, _body_bytes, handles, &mut req)?;
2449                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2450                        Ok(DeviceRequest::MapInterrupt {
2451                            which_irq: req.which_irq,
2452
2453                            responder: DeviceMapInterruptResponder {
2454                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2455                                tx_id: header.tx_id,
2456                            },
2457                        })
2458                    }
2459                    0x93f4cd8f79e9f4a => {
2460                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2461                        let mut req = fidl::new_empty!(
2462                            fidl::encoding::EmptyPayload,
2463                            fidl::encoding::DefaultFuchsiaResourceDialect
2464                        );
2465                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2466                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2467                        Ok(DeviceRequest::GetInterruptModes {
2468                            responder: DeviceGetInterruptModesResponder {
2469                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2470                                tx_id: header.tx_id,
2471                            },
2472                        })
2473                    }
2474                    0x85bebad3eb24866 => {
2475                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2476                        let mut req = fidl::new_empty!(
2477                            DeviceSetInterruptModeRequest,
2478                            fidl::encoding::DefaultFuchsiaResourceDialect
2479                        );
2480                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetInterruptModeRequest>(&header, _body_bytes, handles, &mut req)?;
2481                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2482                        Ok(DeviceRequest::SetInterruptMode {
2483                            mode: req.mode,
2484                            requested_irq_count: req.requested_irq_count,
2485
2486                            responder: DeviceSetInterruptModeResponder {
2487                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2488                                tx_id: header.tx_id,
2489                            },
2490                        })
2491                    }
2492                    0x28f9eb9e6dadda1c => {
2493                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2494                        let mut req = fidl::new_empty!(
2495                            DeviceReadConfig8Request,
2496                            fidl::encoding::DefaultFuchsiaResourceDialect
2497                        );
2498                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig8Request>(&header, _body_bytes, handles, &mut req)?;
2499                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2500                        Ok(DeviceRequest::ReadConfig8 {
2501                            offset: req.offset,
2502
2503                            responder: DeviceReadConfig8Responder {
2504                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2505                                tx_id: header.tx_id,
2506                            },
2507                        })
2508                    }
2509                    0x3bcda6171a3270bb => {
2510                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2511                        let mut req = fidl::new_empty!(
2512                            DeviceReadConfig16Request,
2513                            fidl::encoding::DefaultFuchsiaResourceDialect
2514                        );
2515                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig16Request>(&header, _body_bytes, handles, &mut req)?;
2516                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2517                        Ok(DeviceRequest::ReadConfig16 {
2518                            offset: req.offset,
2519
2520                            responder: DeviceReadConfig16Responder {
2521                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2522                                tx_id: header.tx_id,
2523                            },
2524                        })
2525                    }
2526                    0x55357535402f7507 => {
2527                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2528                        let mut req = fidl::new_empty!(
2529                            DeviceReadConfig32Request,
2530                            fidl::encoding::DefaultFuchsiaResourceDialect
2531                        );
2532                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig32Request>(&header, _body_bytes, handles, &mut req)?;
2533                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2534                        Ok(DeviceRequest::ReadConfig32 {
2535                            offset: req.offset,
2536
2537                            responder: DeviceReadConfig32Responder {
2538                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2539                                tx_id: header.tx_id,
2540                            },
2541                        })
2542                    }
2543                    0x49a0719e1433cff => {
2544                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2545                        let mut req = fidl::new_empty!(
2546                            DeviceWriteConfig8Request,
2547                            fidl::encoding::DefaultFuchsiaResourceDialect
2548                        );
2549                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig8Request>(&header, _body_bytes, handles, &mut req)?;
2550                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2551                        Ok(DeviceRequest::WriteConfig8 {
2552                            offset: req.offset,
2553                            value: req.value,
2554
2555                            responder: DeviceWriteConfig8Responder {
2556                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2557                                tx_id: header.tx_id,
2558                            },
2559                        })
2560                    }
2561                    0x3e30bf13f1c07eff => {
2562                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2563                        let mut req = fidl::new_empty!(
2564                            DeviceWriteConfig16Request,
2565                            fidl::encoding::DefaultFuchsiaResourceDialect
2566                        );
2567                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig16Request>(&header, _body_bytes, handles, &mut req)?;
2568                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2569                        Ok(DeviceRequest::WriteConfig16 {
2570                            offset: req.offset,
2571                            value: req.value,
2572
2573                            responder: DeviceWriteConfig16Responder {
2574                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2575                                tx_id: header.tx_id,
2576                            },
2577                        })
2578                    }
2579                    0x161584e5199b388 => {
2580                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2581                        let mut req = fidl::new_empty!(
2582                            DeviceWriteConfig32Request,
2583                            fidl::encoding::DefaultFuchsiaResourceDialect
2584                        );
2585                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig32Request>(&header, _body_bytes, handles, &mut req)?;
2586                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2587                        Ok(DeviceRequest::WriteConfig32 {
2588                            offset: req.offset,
2589                            value: req.value,
2590
2591                            responder: DeviceWriteConfig32Responder {
2592                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2593                                tx_id: header.tx_id,
2594                            },
2595                        })
2596                    }
2597                    0x3a050fde46f3ba0f => {
2598                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2599                        let mut req = fidl::new_empty!(
2600                            DeviceGetCapabilitiesRequest,
2601                            fidl::encoding::DefaultFuchsiaResourceDialect
2602                        );
2603                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetCapabilitiesRequest>(&header, _body_bytes, handles, &mut req)?;
2604                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2605                        Ok(DeviceRequest::GetCapabilities {
2606                            id: req.id,
2607
2608                            responder: DeviceGetCapabilitiesResponder {
2609                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2610                                tx_id: header.tx_id,
2611                            },
2612                        })
2613                    }
2614                    0xb8573efcaae0c39 => {
2615                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2616                        let mut req = fidl::new_empty!(
2617                            DeviceGetExtendedCapabilitiesRequest,
2618                            fidl::encoding::DefaultFuchsiaResourceDialect
2619                        );
2620                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetExtendedCapabilitiesRequest>(&header, _body_bytes, handles, &mut req)?;
2621                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2622                        Ok(DeviceRequest::GetExtendedCapabilities {
2623                            id: req.id,
2624
2625                            responder: DeviceGetExtendedCapabilitiesResponder {
2626                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2627                                tx_id: header.tx_id,
2628                            },
2629                        })
2630                    }
2631                    0x5e4fe9efb12d9ee3 => {
2632                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2633                        let mut req = fidl::new_empty!(
2634                            DeviceGetBtiRequest,
2635                            fidl::encoding::DefaultFuchsiaResourceDialect
2636                        );
2637                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBtiRequest>(&header, _body_bytes, handles, &mut req)?;
2638                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2639                        Ok(DeviceRequest::GetBti {
2640                            index: req.index,
2641
2642                            responder: DeviceGetBtiResponder {
2643                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2644                                tx_id: header.tx_id,
2645                            },
2646                        })
2647                    }
2648                    _ => Err(fidl::Error::UnknownOrdinal {
2649                        ordinal: header.ordinal,
2650                        protocol_name:
2651                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2652                    }),
2653                }))
2654            },
2655        )
2656    }
2657}
2658
2659#[derive(Debug)]
2660pub enum DeviceRequest {
2661    /// Returns a structure containing device information from the configuration header.
2662    GetDeviceInfo { responder: DeviceGetDeviceInfoResponder },
2663    /// Retrieves information for a specified Base Address Register (BAR). If the BAR contains
2664    /// MSI-X capability tables then an attempt will be made to return an MMIO region excluding
2665    /// those tables, if possible. Otherwise, an error will be returned.
2666    ///
2667    /// Parameters:
2668    /// |bar_id|: The id of the BAR being requested. Valid range is [0, 6).
2669    ///
2670    /// Errors:
2671    /// |ZX_ERR_ACCESS_DENIED|: The specified BAR does not have a driver-accessible region due to
2672    /// the presence of MSI-X tables. To use MSI-X see the |SetInterruptMode| method.
2673    /// |ZX_ERR_INTERNAL|: A bus driver error has occurred.
2674    /// |ZX_ERR_INVALID_ARGS|: The |bar_id| specified is outside of the acceptable range.
2675    /// |ZX_ERR_NOT_FOUND|: The specified |bar_id| does not exist for this device.
2676    GetBar { bar_id: u32, responder: DeviceGetBarResponder },
2677    /// Enables or disables the bus mastering capability for the device.
2678    ///
2679    /// Parameters:
2680    /// |enable|: true to enable bus mastering, false to disable.
2681    ///
2682    /// Errors:
2683    /// |ZX_ERR_BAD_STATE|: Method was called while the device is disabled.
2684    SetBusMastering { enabled: bool, responder: DeviceSetBusMasteringResponder },
2685    /// Initiates a function level reset for the device. This is a synchronous
2686    /// operation that will not return ontil the reset is complete. Interrupt
2687    /// operation of the device must be disabled before initiating a reset.
2688    ///
2689    /// Errors:
2690    /// |ZX_ERR_BAD_STATE|: Interrupts were not disabled before calling |ResetDevice|.
2691    /// |ZX_ERR_NOT_SUPPORTED|: The device does not support reset.
2692    /// |ZX_ERR_TIMED_OUT|: The device did not complete its reset in the
2693    /// expected amount of time and is presumed to no longer be operating
2694    /// properly.
2695    ResetDevice { responder: DeviceResetDeviceResponder },
2696    /// Alerts the bus driver to deassert the raised legacy interrupt so that it
2697    /// may be waited on again. Only used if |SetInterruptMode| was called with
2698    /// |PCI_INTERRUPT_MODE_LEGACY|.
2699    ///
2700    /// Errors:
2701    /// |ZX_ERR_BAD_STATE|: device is not configured to use the Legacy interrupt mode.
2702    AckInterrupt { responder: DeviceAckInterruptResponder },
2703    /// Maps a device's interrupt to a zx:interrupt. The device's interrupt mode
2704    /// must already be configured with |SetInterruptMode|, and |which_irq| must
2705    /// be >= to the number of interrupts reported for that interrupt mode by
2706    /// |GetInterruptModes|. A Legacy interrupt may be mapped multiple times,
2707    /// but the handles will point to the same interrupt object. MSI & MSI-X
2708    /// interrupts may only have one outstanding mapping at a time per
2709    /// interrupt. Outstanding MSI & MSI-X interrupt handles must be closed
2710    /// before attempting to change the interrupt mode in a subsequent call to
2711    /// |SetInterruptMode|.
2712    ///
2713    /// Parameters:
2714    /// |which_irq|: The id of the interrupt to map.
2715    ///
2716    /// Errors:
2717    /// |ZX_ERR_ALREADY_BOUND|: The interrupt specified by |which_irq| is
2718    /// already mapped to a valid handle.
2719    /// |ZX_ERR_BAD_STATE|: interrupts are currently disabled for the device.
2720    /// |ZX_ERR_INVALID_ARGS|: |which_irq| is invalid for the mode.
2721    MapInterrupt { which_irq: u32, responder: DeviceMapInterruptResponder },
2722    /// Returns the supported interrupt modes for a device.
2723    GetInterruptModes { responder: DeviceGetInterruptModesResponder },
2724    /// Configures the interrupt mode for a device. When changing from one
2725    /// interrupt mode to another the driver must ensure existing interrupt
2726    /// handles are closed beforehand.
2727    ///
2728    /// Parameters:
2729    /// |mode|: The |InterruptMode| to request from the bus driver.
2730    /// |requested_irq_count|: The number of interrupts requested.
2731    ///
2732    /// Errors:
2733    /// |ZX_ERR_BAD_STATE|: The driver attempted to change interrupt mode while
2734    /// existing handles to mapped MSIs exist.
2735    /// |ZX_ERR_INVALID_ARGS|: |requested_irq_count| is 0.
2736    /// |ZX_ERR_NOT_SUPPORTED|: The provided |mode| is not supported, or invalid.
2737    SetInterruptMode {
2738        mode: InterruptMode,
2739        requested_irq_count: u32,
2740        responder: DeviceSetInterruptModeResponder,
2741    },
2742    /// Reads a byte from the device's configuration space. |Offset| must be
2743    /// within [0x0, 0xFF] if PCI, or [0x0, 0xFFF) if PCIe. In most cases a
2744    /// device will be PCIe.
2745    ///
2746    /// Parameters:
2747    /// |offset|: The offset into the device's configuration space to read.
2748    ///
2749    /// Errors:
2750    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2751    ReadConfig8 { offset: u16, responder: DeviceReadConfig8Responder },
2752    /// Reads two bytes from the device's configuration space. |Offset| must be
2753    /// within [0x0, 0xFE] if PCI, or [0x0, 0xFFE] if PCIe. In most cases a
2754    /// device will be PCIe.
2755    ///
2756    /// Parameters:
2757    /// |offset|: The offset into the device's configuration space to read.
2758    ///
2759    /// Errors:
2760    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2761    ReadConfig16 { offset: u16, responder: DeviceReadConfig16Responder },
2762    /// Reads four bytes from the device's configuration space. |Offset| must be
2763    /// within [0x0, 0xFC] if PCI, or [0x0, 0xFFC] if PCIe. In most cases a
2764    /// device will be PCIe.
2765    ///
2766    /// Parameters:
2767    /// |offset|: The offset into the device's configuration space to read.
2768    ///
2769    /// Errors:
2770    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2771    ReadConfig32 { offset: u16, responder: DeviceReadConfig32Responder },
2772    /// Writes a byte to the device's configuration space. The acceptable
2773    /// ranges of |offset| for writes are [0x40, 0xFF] if PCI, or [0x40,
2774    /// 0xFFF] if PCIe. For most purposes a device will be PCIe.
2775    ///
2776    ///
2777    /// Parameters
2778    /// |offset|: The offset into the device's configuration space to read.
2779    /// |value|: The value to write.
2780    ///
2781    /// Errors:
2782    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
2783    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2784    WriteConfig8 { offset: u16, value: u8, responder: DeviceWriteConfig8Responder },
2785    /// Writes two bytes to the device's configuration space. The acceptable
2786    /// ranges of |offset| for writes are [0x40, 0xFE] if PCI, or [0x40,
2787    /// 0xFFE] if PCIe. For most purposes a device will be PCIe.
2788    ///
2789    ///
2790    /// Parameters
2791    /// |offset|: The offset into the device's configuration space to read.
2792    /// |value|: The value to write.
2793    ///
2794    /// Errors:
2795    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
2796    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2797    WriteConfig16 { offset: u16, value: u16, responder: DeviceWriteConfig16Responder },
2798    /// Writes four bytes to the device's configuration space. The acceptable
2799    /// ranges of |offset| for writes are [0x40, 0xFC] if PCI, or [0x40,
2800    /// 0xFFC] if PCIe. For most purposes a device will be PCIe.
2801    ///
2802    ///
2803    /// Parameters
2804    /// |offset|: The offset into the device's configuration space to read.
2805    /// |value|: The value to write.
2806    ///
2807    /// Errors:
2808    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
2809    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2810    WriteConfig32 { offset: u16, value: u32, responder: DeviceWriteConfig32Responder },
2811    /// Returns a vector of offsets in configuration space corresponding to
2812    /// capabilities matching the provided capability |id|.  If no corresponding
2813    /// match is found then the vector will be empty.
2814    ///
2815    /// Parameters:
2816    /// |id|: the capability id to search for.
2817    GetCapabilities { id: CapabilityId, responder: DeviceGetCapabilitiesResponder },
2818    /// Returns a vector of offsets in configuration space corresponding to
2819    /// extended capabilities matching the provided extended capability |id|.
2820    /// If no corresponding match is found then the vector will be empty.
2821    ///
2822    /// Parameters:
2823    /// |id|: the capability id to search for
2824    GetExtendedCapabilities {
2825        id: ExtendedCapabilityId,
2826        responder: DeviceGetExtendedCapabilitiesResponder,
2827    },
2828    /// Returns the Bus Transaction Intiator (BTI) at a given index for the device.
2829    ///
2830    /// Parameters:
2831    /// |index|: the BTI to request.
2832    ///
2833    /// Errors:
2834    /// |ZX_ERR_OUT_OF_RANGE|: |index| was not 0.
2835    GetBti { index: u32, responder: DeviceGetBtiResponder },
2836}
2837
2838impl DeviceRequest {
2839    #[allow(irrefutable_let_patterns)]
2840    pub fn into_get_device_info(self) -> Option<(DeviceGetDeviceInfoResponder)> {
2841        if let DeviceRequest::GetDeviceInfo { responder } = self {
2842            Some((responder))
2843        } else {
2844            None
2845        }
2846    }
2847
2848    #[allow(irrefutable_let_patterns)]
2849    pub fn into_get_bar(self) -> Option<(u32, DeviceGetBarResponder)> {
2850        if let DeviceRequest::GetBar { bar_id, responder } = self {
2851            Some((bar_id, responder))
2852        } else {
2853            None
2854        }
2855    }
2856
2857    #[allow(irrefutable_let_patterns)]
2858    pub fn into_set_bus_mastering(self) -> Option<(bool, DeviceSetBusMasteringResponder)> {
2859        if let DeviceRequest::SetBusMastering { enabled, responder } = self {
2860            Some((enabled, responder))
2861        } else {
2862            None
2863        }
2864    }
2865
2866    #[allow(irrefutable_let_patterns)]
2867    pub fn into_reset_device(self) -> Option<(DeviceResetDeviceResponder)> {
2868        if let DeviceRequest::ResetDevice { responder } = self {
2869            Some((responder))
2870        } else {
2871            None
2872        }
2873    }
2874
2875    #[allow(irrefutable_let_patterns)]
2876    pub fn into_ack_interrupt(self) -> Option<(DeviceAckInterruptResponder)> {
2877        if let DeviceRequest::AckInterrupt { responder } = self {
2878            Some((responder))
2879        } else {
2880            None
2881        }
2882    }
2883
2884    #[allow(irrefutable_let_patterns)]
2885    pub fn into_map_interrupt(self) -> Option<(u32, DeviceMapInterruptResponder)> {
2886        if let DeviceRequest::MapInterrupt { which_irq, responder } = self {
2887            Some((which_irq, responder))
2888        } else {
2889            None
2890        }
2891    }
2892
2893    #[allow(irrefutable_let_patterns)]
2894    pub fn into_get_interrupt_modes(self) -> Option<(DeviceGetInterruptModesResponder)> {
2895        if let DeviceRequest::GetInterruptModes { responder } = self {
2896            Some((responder))
2897        } else {
2898            None
2899        }
2900    }
2901
2902    #[allow(irrefutable_let_patterns)]
2903    pub fn into_set_interrupt_mode(
2904        self,
2905    ) -> Option<(InterruptMode, u32, DeviceSetInterruptModeResponder)> {
2906        if let DeviceRequest::SetInterruptMode { mode, requested_irq_count, responder } = self {
2907            Some((mode, requested_irq_count, responder))
2908        } else {
2909            None
2910        }
2911    }
2912
2913    #[allow(irrefutable_let_patterns)]
2914    pub fn into_read_config8(self) -> Option<(u16, DeviceReadConfig8Responder)> {
2915        if let DeviceRequest::ReadConfig8 { offset, responder } = self {
2916            Some((offset, responder))
2917        } else {
2918            None
2919        }
2920    }
2921
2922    #[allow(irrefutable_let_patterns)]
2923    pub fn into_read_config16(self) -> Option<(u16, DeviceReadConfig16Responder)> {
2924        if let DeviceRequest::ReadConfig16 { offset, responder } = self {
2925            Some((offset, responder))
2926        } else {
2927            None
2928        }
2929    }
2930
2931    #[allow(irrefutable_let_patterns)]
2932    pub fn into_read_config32(self) -> Option<(u16, DeviceReadConfig32Responder)> {
2933        if let DeviceRequest::ReadConfig32 { offset, responder } = self {
2934            Some((offset, responder))
2935        } else {
2936            None
2937        }
2938    }
2939
2940    #[allow(irrefutable_let_patterns)]
2941    pub fn into_write_config8(self) -> Option<(u16, u8, DeviceWriteConfig8Responder)> {
2942        if let DeviceRequest::WriteConfig8 { offset, value, responder } = self {
2943            Some((offset, value, responder))
2944        } else {
2945            None
2946        }
2947    }
2948
2949    #[allow(irrefutable_let_patterns)]
2950    pub fn into_write_config16(self) -> Option<(u16, u16, DeviceWriteConfig16Responder)> {
2951        if let DeviceRequest::WriteConfig16 { offset, value, responder } = self {
2952            Some((offset, value, responder))
2953        } else {
2954            None
2955        }
2956    }
2957
2958    #[allow(irrefutable_let_patterns)]
2959    pub fn into_write_config32(self) -> Option<(u16, u32, DeviceWriteConfig32Responder)> {
2960        if let DeviceRequest::WriteConfig32 { offset, value, responder } = self {
2961            Some((offset, value, responder))
2962        } else {
2963            None
2964        }
2965    }
2966
2967    #[allow(irrefutable_let_patterns)]
2968    pub fn into_get_capabilities(self) -> Option<(CapabilityId, DeviceGetCapabilitiesResponder)> {
2969        if let DeviceRequest::GetCapabilities { id, responder } = self {
2970            Some((id, responder))
2971        } else {
2972            None
2973        }
2974    }
2975
2976    #[allow(irrefutable_let_patterns)]
2977    pub fn into_get_extended_capabilities(
2978        self,
2979    ) -> Option<(ExtendedCapabilityId, DeviceGetExtendedCapabilitiesResponder)> {
2980        if let DeviceRequest::GetExtendedCapabilities { id, responder } = self {
2981            Some((id, responder))
2982        } else {
2983            None
2984        }
2985    }
2986
2987    #[allow(irrefutable_let_patterns)]
2988    pub fn into_get_bti(self) -> Option<(u32, DeviceGetBtiResponder)> {
2989        if let DeviceRequest::GetBti { index, responder } = self {
2990            Some((index, responder))
2991        } else {
2992            None
2993        }
2994    }
2995
2996    /// Name of the method defined in FIDL
2997    pub fn method_name(&self) -> &'static str {
2998        match *self {
2999            DeviceRequest::GetDeviceInfo { .. } => "get_device_info",
3000            DeviceRequest::GetBar { .. } => "get_bar",
3001            DeviceRequest::SetBusMastering { .. } => "set_bus_mastering",
3002            DeviceRequest::ResetDevice { .. } => "reset_device",
3003            DeviceRequest::AckInterrupt { .. } => "ack_interrupt",
3004            DeviceRequest::MapInterrupt { .. } => "map_interrupt",
3005            DeviceRequest::GetInterruptModes { .. } => "get_interrupt_modes",
3006            DeviceRequest::SetInterruptMode { .. } => "set_interrupt_mode",
3007            DeviceRequest::ReadConfig8 { .. } => "read_config8",
3008            DeviceRequest::ReadConfig16 { .. } => "read_config16",
3009            DeviceRequest::ReadConfig32 { .. } => "read_config32",
3010            DeviceRequest::WriteConfig8 { .. } => "write_config8",
3011            DeviceRequest::WriteConfig16 { .. } => "write_config16",
3012            DeviceRequest::WriteConfig32 { .. } => "write_config32",
3013            DeviceRequest::GetCapabilities { .. } => "get_capabilities",
3014            DeviceRequest::GetExtendedCapabilities { .. } => "get_extended_capabilities",
3015            DeviceRequest::GetBti { .. } => "get_bti",
3016        }
3017    }
3018}
3019
3020#[derive(Debug, Clone)]
3021pub struct DeviceControlHandle {
3022    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3023}
3024
3025impl fidl::endpoints::ControlHandle for DeviceControlHandle {
3026    fn shutdown(&self) {
3027        self.inner.shutdown()
3028    }
3029    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3030        self.inner.shutdown_with_epitaph(status)
3031    }
3032
3033    fn is_closed(&self) -> bool {
3034        self.inner.channel().is_closed()
3035    }
3036    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3037        self.inner.channel().on_closed()
3038    }
3039
3040    #[cfg(target_os = "fuchsia")]
3041    fn signal_peer(
3042        &self,
3043        clear_mask: zx::Signals,
3044        set_mask: zx::Signals,
3045    ) -> Result<(), zx_status::Status> {
3046        use fidl::Peered;
3047        self.inner.channel().signal_peer(clear_mask, set_mask)
3048    }
3049}
3050
3051impl DeviceControlHandle {}
3052
3053#[must_use = "FIDL methods require a response to be sent"]
3054#[derive(Debug)]
3055pub struct DeviceGetDeviceInfoResponder {
3056    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3057    tx_id: u32,
3058}
3059
3060/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3061/// if the responder is dropped without sending a response, so that the client
3062/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3063impl std::ops::Drop for DeviceGetDeviceInfoResponder {
3064    fn drop(&mut self) {
3065        self.control_handle.shutdown();
3066        // Safety: drops once, never accessed again
3067        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3068    }
3069}
3070
3071impl fidl::endpoints::Responder for DeviceGetDeviceInfoResponder {
3072    type ControlHandle = DeviceControlHandle;
3073
3074    fn control_handle(&self) -> &DeviceControlHandle {
3075        &self.control_handle
3076    }
3077
3078    fn drop_without_shutdown(mut self) {
3079        // Safety: drops once, never accessed again due to mem::forget
3080        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3081        // Prevent Drop from running (which would shut down the channel)
3082        std::mem::forget(self);
3083    }
3084}
3085
3086impl DeviceGetDeviceInfoResponder {
3087    /// Sends a response to the FIDL transaction.
3088    ///
3089    /// Sets the channel to shutdown if an error occurs.
3090    pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
3091        let _result = self.send_raw(info);
3092        if _result.is_err() {
3093            self.control_handle.shutdown();
3094        }
3095        self.drop_without_shutdown();
3096        _result
3097    }
3098
3099    /// Similar to "send" but does not shutdown the channel if an error occurs.
3100    pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
3101        let _result = self.send_raw(info);
3102        self.drop_without_shutdown();
3103        _result
3104    }
3105
3106    fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
3107        self.control_handle.inner.send::<DeviceGetDeviceInfoResponse>(
3108            (info,),
3109            self.tx_id,
3110            0x5599d144d4329916,
3111            fidl::encoding::DynamicFlags::empty(),
3112        )
3113    }
3114}
3115
3116#[must_use = "FIDL methods require a response to be sent"]
3117#[derive(Debug)]
3118pub struct DeviceGetBarResponder {
3119    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3120    tx_id: u32,
3121}
3122
3123/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3124/// if the responder is dropped without sending a response, so that the client
3125/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3126impl std::ops::Drop for DeviceGetBarResponder {
3127    fn drop(&mut self) {
3128        self.control_handle.shutdown();
3129        // Safety: drops once, never accessed again
3130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3131    }
3132}
3133
3134impl fidl::endpoints::Responder for DeviceGetBarResponder {
3135    type ControlHandle = DeviceControlHandle;
3136
3137    fn control_handle(&self) -> &DeviceControlHandle {
3138        &self.control_handle
3139    }
3140
3141    fn drop_without_shutdown(mut self) {
3142        // Safety: drops once, never accessed again due to mem::forget
3143        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3144        // Prevent Drop from running (which would shut down the channel)
3145        std::mem::forget(self);
3146    }
3147}
3148
3149impl DeviceGetBarResponder {
3150    /// Sends a response to the FIDL transaction.
3151    ///
3152    /// Sets the channel to shutdown if an error occurs.
3153    pub fn send(self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
3154        let _result = self.send_raw(result);
3155        if _result.is_err() {
3156            self.control_handle.shutdown();
3157        }
3158        self.drop_without_shutdown();
3159        _result
3160    }
3161
3162    /// Similar to "send" but does not shutdown the channel if an error occurs.
3163    pub fn send_no_shutdown_on_err(self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
3164        let _result = self.send_raw(result);
3165        self.drop_without_shutdown();
3166        _result
3167    }
3168
3169    fn send_raw(&self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
3170        self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetBarResponse, i32>>(
3171            result.as_mut().map_err(|e| *e).map(|result| (result,)),
3172            self.tx_id,
3173            0x6b2683f6fbbff679,
3174            fidl::encoding::DynamicFlags::empty(),
3175        )
3176    }
3177}
3178
3179#[must_use = "FIDL methods require a response to be sent"]
3180#[derive(Debug)]
3181pub struct DeviceSetBusMasteringResponder {
3182    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3183    tx_id: u32,
3184}
3185
3186/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3187/// if the responder is dropped without sending a response, so that the client
3188/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3189impl std::ops::Drop for DeviceSetBusMasteringResponder {
3190    fn drop(&mut self) {
3191        self.control_handle.shutdown();
3192        // Safety: drops once, never accessed again
3193        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3194    }
3195}
3196
3197impl fidl::endpoints::Responder for DeviceSetBusMasteringResponder {
3198    type ControlHandle = DeviceControlHandle;
3199
3200    fn control_handle(&self) -> &DeviceControlHandle {
3201        &self.control_handle
3202    }
3203
3204    fn drop_without_shutdown(mut self) {
3205        // Safety: drops once, never accessed again due to mem::forget
3206        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3207        // Prevent Drop from running (which would shut down the channel)
3208        std::mem::forget(self);
3209    }
3210}
3211
3212impl DeviceSetBusMasteringResponder {
3213    /// Sends a response to the FIDL transaction.
3214    ///
3215    /// Sets the channel to shutdown if an error occurs.
3216    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3217        let _result = self.send_raw(result);
3218        if _result.is_err() {
3219            self.control_handle.shutdown();
3220        }
3221        self.drop_without_shutdown();
3222        _result
3223    }
3224
3225    /// Similar to "send" but does not shutdown the channel if an error occurs.
3226    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3227        let _result = self.send_raw(result);
3228        self.drop_without_shutdown();
3229        _result
3230    }
3231
3232    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3233        self.control_handle
3234            .inner
3235            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3236                result,
3237                self.tx_id,
3238                0x3421e9e030211003,
3239                fidl::encoding::DynamicFlags::empty(),
3240            )
3241    }
3242}
3243
3244#[must_use = "FIDL methods require a response to be sent"]
3245#[derive(Debug)]
3246pub struct DeviceResetDeviceResponder {
3247    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3248    tx_id: u32,
3249}
3250
3251/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3252/// if the responder is dropped without sending a response, so that the client
3253/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3254impl std::ops::Drop for DeviceResetDeviceResponder {
3255    fn drop(&mut self) {
3256        self.control_handle.shutdown();
3257        // Safety: drops once, never accessed again
3258        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3259    }
3260}
3261
3262impl fidl::endpoints::Responder for DeviceResetDeviceResponder {
3263    type ControlHandle = DeviceControlHandle;
3264
3265    fn control_handle(&self) -> &DeviceControlHandle {
3266        &self.control_handle
3267    }
3268
3269    fn drop_without_shutdown(mut self) {
3270        // Safety: drops once, never accessed again due to mem::forget
3271        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3272        // Prevent Drop from running (which would shut down the channel)
3273        std::mem::forget(self);
3274    }
3275}
3276
3277impl DeviceResetDeviceResponder {
3278    /// Sends a response to the FIDL transaction.
3279    ///
3280    /// Sets the channel to shutdown if an error occurs.
3281    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3282        let _result = self.send_raw(result);
3283        if _result.is_err() {
3284            self.control_handle.shutdown();
3285        }
3286        self.drop_without_shutdown();
3287        _result
3288    }
3289
3290    /// Similar to "send" but does not shutdown the channel if an error occurs.
3291    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3292        let _result = self.send_raw(result);
3293        self.drop_without_shutdown();
3294        _result
3295    }
3296
3297    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3298        self.control_handle
3299            .inner
3300            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3301                result,
3302                self.tx_id,
3303                0x3c5b7579bb6f8b9f,
3304                fidl::encoding::DynamicFlags::empty(),
3305            )
3306    }
3307}
3308
3309#[must_use = "FIDL methods require a response to be sent"]
3310#[derive(Debug)]
3311pub struct DeviceAckInterruptResponder {
3312    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3313    tx_id: u32,
3314}
3315
3316/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3317/// if the responder is dropped without sending a response, so that the client
3318/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3319impl std::ops::Drop for DeviceAckInterruptResponder {
3320    fn drop(&mut self) {
3321        self.control_handle.shutdown();
3322        // Safety: drops once, never accessed again
3323        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3324    }
3325}
3326
3327impl fidl::endpoints::Responder for DeviceAckInterruptResponder {
3328    type ControlHandle = DeviceControlHandle;
3329
3330    fn control_handle(&self) -> &DeviceControlHandle {
3331        &self.control_handle
3332    }
3333
3334    fn drop_without_shutdown(mut self) {
3335        // Safety: drops once, never accessed again due to mem::forget
3336        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3337        // Prevent Drop from running (which would shut down the channel)
3338        std::mem::forget(self);
3339    }
3340}
3341
3342impl DeviceAckInterruptResponder {
3343    /// Sends a response to the FIDL transaction.
3344    ///
3345    /// Sets the channel to shutdown if an error occurs.
3346    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3347        let _result = self.send_raw(result);
3348        if _result.is_err() {
3349            self.control_handle.shutdown();
3350        }
3351        self.drop_without_shutdown();
3352        _result
3353    }
3354
3355    /// Similar to "send" but does not shutdown the channel if an error occurs.
3356    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3357        let _result = self.send_raw(result);
3358        self.drop_without_shutdown();
3359        _result
3360    }
3361
3362    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3363        self.control_handle
3364            .inner
3365            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3366                result,
3367                self.tx_id,
3368                0x70742f64692d5a6b,
3369                fidl::encoding::DynamicFlags::empty(),
3370            )
3371    }
3372}
3373
3374#[must_use = "FIDL methods require a response to be sent"]
3375#[derive(Debug)]
3376pub struct DeviceMapInterruptResponder {
3377    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3378    tx_id: u32,
3379}
3380
3381/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3382/// if the responder is dropped without sending a response, so that the client
3383/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3384impl std::ops::Drop for DeviceMapInterruptResponder {
3385    fn drop(&mut self) {
3386        self.control_handle.shutdown();
3387        // Safety: drops once, never accessed again
3388        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3389    }
3390}
3391
3392impl fidl::endpoints::Responder for DeviceMapInterruptResponder {
3393    type ControlHandle = DeviceControlHandle;
3394
3395    fn control_handle(&self) -> &DeviceControlHandle {
3396        &self.control_handle
3397    }
3398
3399    fn drop_without_shutdown(mut self) {
3400        // Safety: drops once, never accessed again due to mem::forget
3401        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3402        // Prevent Drop from running (which would shut down the channel)
3403        std::mem::forget(self);
3404    }
3405}
3406
3407impl DeviceMapInterruptResponder {
3408    /// Sends a response to the FIDL transaction.
3409    ///
3410    /// Sets the channel to shutdown if an error occurs.
3411    pub fn send(self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
3412        let _result = self.send_raw(result);
3413        if _result.is_err() {
3414            self.control_handle.shutdown();
3415        }
3416        self.drop_without_shutdown();
3417        _result
3418    }
3419
3420    /// Similar to "send" but does not shutdown the channel if an error occurs.
3421    pub fn send_no_shutdown_on_err(
3422        self,
3423        mut result: Result<fidl::Interrupt, i32>,
3424    ) -> Result<(), fidl::Error> {
3425        let _result = self.send_raw(result);
3426        self.drop_without_shutdown();
3427        _result
3428    }
3429
3430    fn send_raw(&self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
3431        self.control_handle
3432            .inner
3433            .send::<fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>>(
3434                result.map(|interrupt| (interrupt,)),
3435                self.tx_id,
3436                0x25eeff9d34a1fa13,
3437                fidl::encoding::DynamicFlags::empty(),
3438            )
3439    }
3440}
3441
3442#[must_use = "FIDL methods require a response to be sent"]
3443#[derive(Debug)]
3444pub struct DeviceGetInterruptModesResponder {
3445    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3446    tx_id: u32,
3447}
3448
3449/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3450/// if the responder is dropped without sending a response, so that the client
3451/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3452impl std::ops::Drop for DeviceGetInterruptModesResponder {
3453    fn drop(&mut self) {
3454        self.control_handle.shutdown();
3455        // Safety: drops once, never accessed again
3456        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3457    }
3458}
3459
3460impl fidl::endpoints::Responder for DeviceGetInterruptModesResponder {
3461    type ControlHandle = DeviceControlHandle;
3462
3463    fn control_handle(&self) -> &DeviceControlHandle {
3464        &self.control_handle
3465    }
3466
3467    fn drop_without_shutdown(mut self) {
3468        // Safety: drops once, never accessed again due to mem::forget
3469        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3470        // Prevent Drop from running (which would shut down the channel)
3471        std::mem::forget(self);
3472    }
3473}
3474
3475impl DeviceGetInterruptModesResponder {
3476    /// Sends a response to the FIDL transaction.
3477    ///
3478    /// Sets the channel to shutdown if an error occurs.
3479    pub fn send(self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
3480        let _result = self.send_raw(modes);
3481        if _result.is_err() {
3482            self.control_handle.shutdown();
3483        }
3484        self.drop_without_shutdown();
3485        _result
3486    }
3487
3488    /// Similar to "send" but does not shutdown the channel if an error occurs.
3489    pub fn send_no_shutdown_on_err(self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
3490        let _result = self.send_raw(modes);
3491        self.drop_without_shutdown();
3492        _result
3493    }
3494
3495    fn send_raw(&self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
3496        self.control_handle.inner.send::<DeviceGetInterruptModesResponse>(
3497            (modes,),
3498            self.tx_id,
3499            0x93f4cd8f79e9f4a,
3500            fidl::encoding::DynamicFlags::empty(),
3501        )
3502    }
3503}
3504
3505#[must_use = "FIDL methods require a response to be sent"]
3506#[derive(Debug)]
3507pub struct DeviceSetInterruptModeResponder {
3508    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3509    tx_id: u32,
3510}
3511
3512/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3513/// if the responder is dropped without sending a response, so that the client
3514/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3515impl std::ops::Drop for DeviceSetInterruptModeResponder {
3516    fn drop(&mut self) {
3517        self.control_handle.shutdown();
3518        // Safety: drops once, never accessed again
3519        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3520    }
3521}
3522
3523impl fidl::endpoints::Responder for DeviceSetInterruptModeResponder {
3524    type ControlHandle = DeviceControlHandle;
3525
3526    fn control_handle(&self) -> &DeviceControlHandle {
3527        &self.control_handle
3528    }
3529
3530    fn drop_without_shutdown(mut self) {
3531        // Safety: drops once, never accessed again due to mem::forget
3532        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3533        // Prevent Drop from running (which would shut down the channel)
3534        std::mem::forget(self);
3535    }
3536}
3537
3538impl DeviceSetInterruptModeResponder {
3539    /// Sends a response to the FIDL transaction.
3540    ///
3541    /// Sets the channel to shutdown if an error occurs.
3542    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3543        let _result = self.send_raw(result);
3544        if _result.is_err() {
3545            self.control_handle.shutdown();
3546        }
3547        self.drop_without_shutdown();
3548        _result
3549    }
3550
3551    /// Similar to "send" but does not shutdown the channel if an error occurs.
3552    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3553        let _result = self.send_raw(result);
3554        self.drop_without_shutdown();
3555        _result
3556    }
3557
3558    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3559        self.control_handle
3560            .inner
3561            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3562                result,
3563                self.tx_id,
3564                0x85bebad3eb24866,
3565                fidl::encoding::DynamicFlags::empty(),
3566            )
3567    }
3568}
3569
3570#[must_use = "FIDL methods require a response to be sent"]
3571#[derive(Debug)]
3572pub struct DeviceReadConfig8Responder {
3573    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3574    tx_id: u32,
3575}
3576
3577/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3578/// if the responder is dropped without sending a response, so that the client
3579/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3580impl std::ops::Drop for DeviceReadConfig8Responder {
3581    fn drop(&mut self) {
3582        self.control_handle.shutdown();
3583        // Safety: drops once, never accessed again
3584        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3585    }
3586}
3587
3588impl fidl::endpoints::Responder for DeviceReadConfig8Responder {
3589    type ControlHandle = DeviceControlHandle;
3590
3591    fn control_handle(&self) -> &DeviceControlHandle {
3592        &self.control_handle
3593    }
3594
3595    fn drop_without_shutdown(mut self) {
3596        // Safety: drops once, never accessed again due to mem::forget
3597        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3598        // Prevent Drop from running (which would shut down the channel)
3599        std::mem::forget(self);
3600    }
3601}
3602
3603impl DeviceReadConfig8Responder {
3604    /// Sends a response to the FIDL transaction.
3605    ///
3606    /// Sets the channel to shutdown if an error occurs.
3607    pub fn send(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
3608        let _result = self.send_raw(result);
3609        if _result.is_err() {
3610            self.control_handle.shutdown();
3611        }
3612        self.drop_without_shutdown();
3613        _result
3614    }
3615
3616    /// Similar to "send" but does not shutdown the channel if an error occurs.
3617    pub fn send_no_shutdown_on_err(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
3618        let _result = self.send_raw(result);
3619        self.drop_without_shutdown();
3620        _result
3621    }
3622
3623    fn send_raw(&self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
3624        self.control_handle
3625            .inner
3626            .send::<fidl::encoding::ResultType<DeviceReadConfig8Response, i32>>(
3627                result.map(|value| (value,)),
3628                self.tx_id,
3629                0x28f9eb9e6dadda1c,
3630                fidl::encoding::DynamicFlags::empty(),
3631            )
3632    }
3633}
3634
3635#[must_use = "FIDL methods require a response to be sent"]
3636#[derive(Debug)]
3637pub struct DeviceReadConfig16Responder {
3638    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3639    tx_id: u32,
3640}
3641
3642/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3643/// if the responder is dropped without sending a response, so that the client
3644/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3645impl std::ops::Drop for DeviceReadConfig16Responder {
3646    fn drop(&mut self) {
3647        self.control_handle.shutdown();
3648        // Safety: drops once, never accessed again
3649        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3650    }
3651}
3652
3653impl fidl::endpoints::Responder for DeviceReadConfig16Responder {
3654    type ControlHandle = DeviceControlHandle;
3655
3656    fn control_handle(&self) -> &DeviceControlHandle {
3657        &self.control_handle
3658    }
3659
3660    fn drop_without_shutdown(mut self) {
3661        // Safety: drops once, never accessed again due to mem::forget
3662        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3663        // Prevent Drop from running (which would shut down the channel)
3664        std::mem::forget(self);
3665    }
3666}
3667
3668impl DeviceReadConfig16Responder {
3669    /// Sends a response to the FIDL transaction.
3670    ///
3671    /// Sets the channel to shutdown if an error occurs.
3672    pub fn send(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
3673        let _result = self.send_raw(result);
3674        if _result.is_err() {
3675            self.control_handle.shutdown();
3676        }
3677        self.drop_without_shutdown();
3678        _result
3679    }
3680
3681    /// Similar to "send" but does not shutdown the channel if an error occurs.
3682    pub fn send_no_shutdown_on_err(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
3683        let _result = self.send_raw(result);
3684        self.drop_without_shutdown();
3685        _result
3686    }
3687
3688    fn send_raw(&self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
3689        self.control_handle
3690            .inner
3691            .send::<fidl::encoding::ResultType<DeviceReadConfig16Response, i32>>(
3692                result.map(|value| (value,)),
3693                self.tx_id,
3694                0x3bcda6171a3270bb,
3695                fidl::encoding::DynamicFlags::empty(),
3696            )
3697    }
3698}
3699
3700#[must_use = "FIDL methods require a response to be sent"]
3701#[derive(Debug)]
3702pub struct DeviceReadConfig32Responder {
3703    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3704    tx_id: u32,
3705}
3706
3707/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3708/// if the responder is dropped without sending a response, so that the client
3709/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3710impl std::ops::Drop for DeviceReadConfig32Responder {
3711    fn drop(&mut self) {
3712        self.control_handle.shutdown();
3713        // Safety: drops once, never accessed again
3714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3715    }
3716}
3717
3718impl fidl::endpoints::Responder for DeviceReadConfig32Responder {
3719    type ControlHandle = DeviceControlHandle;
3720
3721    fn control_handle(&self) -> &DeviceControlHandle {
3722        &self.control_handle
3723    }
3724
3725    fn drop_without_shutdown(mut self) {
3726        // Safety: drops once, never accessed again due to mem::forget
3727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3728        // Prevent Drop from running (which would shut down the channel)
3729        std::mem::forget(self);
3730    }
3731}
3732
3733impl DeviceReadConfig32Responder {
3734    /// Sends a response to the FIDL transaction.
3735    ///
3736    /// Sets the channel to shutdown if an error occurs.
3737    pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
3738        let _result = self.send_raw(result);
3739        if _result.is_err() {
3740            self.control_handle.shutdown();
3741        }
3742        self.drop_without_shutdown();
3743        _result
3744    }
3745
3746    /// Similar to "send" but does not shutdown the channel if an error occurs.
3747    pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
3748        let _result = self.send_raw(result);
3749        self.drop_without_shutdown();
3750        _result
3751    }
3752
3753    fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
3754        self.control_handle
3755            .inner
3756            .send::<fidl::encoding::ResultType<DeviceReadConfig32Response, i32>>(
3757                result.map(|value| (value,)),
3758                self.tx_id,
3759                0x55357535402f7507,
3760                fidl::encoding::DynamicFlags::empty(),
3761            )
3762    }
3763}
3764
3765#[must_use = "FIDL methods require a response to be sent"]
3766#[derive(Debug)]
3767pub struct DeviceWriteConfig8Responder {
3768    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3769    tx_id: u32,
3770}
3771
3772/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3773/// if the responder is dropped without sending a response, so that the client
3774/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3775impl std::ops::Drop for DeviceWriteConfig8Responder {
3776    fn drop(&mut self) {
3777        self.control_handle.shutdown();
3778        // Safety: drops once, never accessed again
3779        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3780    }
3781}
3782
3783impl fidl::endpoints::Responder for DeviceWriteConfig8Responder {
3784    type ControlHandle = DeviceControlHandle;
3785
3786    fn control_handle(&self) -> &DeviceControlHandle {
3787        &self.control_handle
3788    }
3789
3790    fn drop_without_shutdown(mut self) {
3791        // Safety: drops once, never accessed again due to mem::forget
3792        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3793        // Prevent Drop from running (which would shut down the channel)
3794        std::mem::forget(self);
3795    }
3796}
3797
3798impl DeviceWriteConfig8Responder {
3799    /// Sends a response to the FIDL transaction.
3800    ///
3801    /// Sets the channel to shutdown if an error occurs.
3802    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3803        let _result = self.send_raw(result);
3804        if _result.is_err() {
3805            self.control_handle.shutdown();
3806        }
3807        self.drop_without_shutdown();
3808        _result
3809    }
3810
3811    /// Similar to "send" but does not shutdown the channel if an error occurs.
3812    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3813        let _result = self.send_raw(result);
3814        self.drop_without_shutdown();
3815        _result
3816    }
3817
3818    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3819        self.control_handle
3820            .inner
3821            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3822                result,
3823                self.tx_id,
3824                0x49a0719e1433cff,
3825                fidl::encoding::DynamicFlags::empty(),
3826            )
3827    }
3828}
3829
3830#[must_use = "FIDL methods require a response to be sent"]
3831#[derive(Debug)]
3832pub struct DeviceWriteConfig16Responder {
3833    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3834    tx_id: u32,
3835}
3836
3837/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3838/// if the responder is dropped without sending a response, so that the client
3839/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3840impl std::ops::Drop for DeviceWriteConfig16Responder {
3841    fn drop(&mut self) {
3842        self.control_handle.shutdown();
3843        // Safety: drops once, never accessed again
3844        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3845    }
3846}
3847
3848impl fidl::endpoints::Responder for DeviceWriteConfig16Responder {
3849    type ControlHandle = DeviceControlHandle;
3850
3851    fn control_handle(&self) -> &DeviceControlHandle {
3852        &self.control_handle
3853    }
3854
3855    fn drop_without_shutdown(mut self) {
3856        // Safety: drops once, never accessed again due to mem::forget
3857        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3858        // Prevent Drop from running (which would shut down the channel)
3859        std::mem::forget(self);
3860    }
3861}
3862
3863impl DeviceWriteConfig16Responder {
3864    /// Sends a response to the FIDL transaction.
3865    ///
3866    /// Sets the channel to shutdown if an error occurs.
3867    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3868        let _result = self.send_raw(result);
3869        if _result.is_err() {
3870            self.control_handle.shutdown();
3871        }
3872        self.drop_without_shutdown();
3873        _result
3874    }
3875
3876    /// Similar to "send" but does not shutdown the channel if an error occurs.
3877    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3878        let _result = self.send_raw(result);
3879        self.drop_without_shutdown();
3880        _result
3881    }
3882
3883    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3884        self.control_handle
3885            .inner
3886            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3887                result,
3888                self.tx_id,
3889                0x3e30bf13f1c07eff,
3890                fidl::encoding::DynamicFlags::empty(),
3891            )
3892    }
3893}
3894
3895#[must_use = "FIDL methods require a response to be sent"]
3896#[derive(Debug)]
3897pub struct DeviceWriteConfig32Responder {
3898    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3899    tx_id: u32,
3900}
3901
3902/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3903/// if the responder is dropped without sending a response, so that the client
3904/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3905impl std::ops::Drop for DeviceWriteConfig32Responder {
3906    fn drop(&mut self) {
3907        self.control_handle.shutdown();
3908        // Safety: drops once, never accessed again
3909        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3910    }
3911}
3912
3913impl fidl::endpoints::Responder for DeviceWriteConfig32Responder {
3914    type ControlHandle = DeviceControlHandle;
3915
3916    fn control_handle(&self) -> &DeviceControlHandle {
3917        &self.control_handle
3918    }
3919
3920    fn drop_without_shutdown(mut self) {
3921        // Safety: drops once, never accessed again due to mem::forget
3922        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3923        // Prevent Drop from running (which would shut down the channel)
3924        std::mem::forget(self);
3925    }
3926}
3927
3928impl DeviceWriteConfig32Responder {
3929    /// Sends a response to the FIDL transaction.
3930    ///
3931    /// Sets the channel to shutdown if an error occurs.
3932    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3933        let _result = self.send_raw(result);
3934        if _result.is_err() {
3935            self.control_handle.shutdown();
3936        }
3937        self.drop_without_shutdown();
3938        _result
3939    }
3940
3941    /// Similar to "send" but does not shutdown the channel if an error occurs.
3942    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3943        let _result = self.send_raw(result);
3944        self.drop_without_shutdown();
3945        _result
3946    }
3947
3948    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3949        self.control_handle
3950            .inner
3951            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3952                result,
3953                self.tx_id,
3954                0x161584e5199b388,
3955                fidl::encoding::DynamicFlags::empty(),
3956            )
3957    }
3958}
3959
3960#[must_use = "FIDL methods require a response to be sent"]
3961#[derive(Debug)]
3962pub struct DeviceGetCapabilitiesResponder {
3963    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3964    tx_id: u32,
3965}
3966
3967/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
3968/// if the responder is dropped without sending a response, so that the client
3969/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3970impl std::ops::Drop for DeviceGetCapabilitiesResponder {
3971    fn drop(&mut self) {
3972        self.control_handle.shutdown();
3973        // Safety: drops once, never accessed again
3974        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3975    }
3976}
3977
3978impl fidl::endpoints::Responder for DeviceGetCapabilitiesResponder {
3979    type ControlHandle = DeviceControlHandle;
3980
3981    fn control_handle(&self) -> &DeviceControlHandle {
3982        &self.control_handle
3983    }
3984
3985    fn drop_without_shutdown(mut self) {
3986        // Safety: drops once, never accessed again due to mem::forget
3987        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3988        // Prevent Drop from running (which would shut down the channel)
3989        std::mem::forget(self);
3990    }
3991}
3992
3993impl DeviceGetCapabilitiesResponder {
3994    /// Sends a response to the FIDL transaction.
3995    ///
3996    /// Sets the channel to shutdown if an error occurs.
3997    pub fn send(self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
3998        let _result = self.send_raw(offsets);
3999        if _result.is_err() {
4000            self.control_handle.shutdown();
4001        }
4002        self.drop_without_shutdown();
4003        _result
4004    }
4005
4006    /// Similar to "send" but does not shutdown the channel if an error occurs.
4007    pub fn send_no_shutdown_on_err(self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
4008        let _result = self.send_raw(offsets);
4009        self.drop_without_shutdown();
4010        _result
4011    }
4012
4013    fn send_raw(&self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
4014        self.control_handle.inner.send::<DeviceGetCapabilitiesResponse>(
4015            (offsets,),
4016            self.tx_id,
4017            0x3a050fde46f3ba0f,
4018            fidl::encoding::DynamicFlags::empty(),
4019        )
4020    }
4021}
4022
4023#[must_use = "FIDL methods require a response to be sent"]
4024#[derive(Debug)]
4025pub struct DeviceGetExtendedCapabilitiesResponder {
4026    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4027    tx_id: u32,
4028}
4029
4030/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4031/// if the responder is dropped without sending a response, so that the client
4032/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4033impl std::ops::Drop for DeviceGetExtendedCapabilitiesResponder {
4034    fn drop(&mut self) {
4035        self.control_handle.shutdown();
4036        // Safety: drops once, never accessed again
4037        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4038    }
4039}
4040
4041impl fidl::endpoints::Responder for DeviceGetExtendedCapabilitiesResponder {
4042    type ControlHandle = DeviceControlHandle;
4043
4044    fn control_handle(&self) -> &DeviceControlHandle {
4045        &self.control_handle
4046    }
4047
4048    fn drop_without_shutdown(mut self) {
4049        // Safety: drops once, never accessed again due to mem::forget
4050        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4051        // Prevent Drop from running (which would shut down the channel)
4052        std::mem::forget(self);
4053    }
4054}
4055
4056impl DeviceGetExtendedCapabilitiesResponder {
4057    /// Sends a response to the FIDL transaction.
4058    ///
4059    /// Sets the channel to shutdown if an error occurs.
4060    pub fn send(self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
4061        let _result = self.send_raw(offsets);
4062        if _result.is_err() {
4063            self.control_handle.shutdown();
4064        }
4065        self.drop_without_shutdown();
4066        _result
4067    }
4068
4069    /// Similar to "send" but does not shutdown the channel if an error occurs.
4070    pub fn send_no_shutdown_on_err(self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
4071        let _result = self.send_raw(offsets);
4072        self.drop_without_shutdown();
4073        _result
4074    }
4075
4076    fn send_raw(&self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
4077        self.control_handle.inner.send::<DeviceGetExtendedCapabilitiesResponse>(
4078            (offsets,),
4079            self.tx_id,
4080            0xb8573efcaae0c39,
4081            fidl::encoding::DynamicFlags::empty(),
4082        )
4083    }
4084}
4085
4086#[must_use = "FIDL methods require a response to be sent"]
4087#[derive(Debug)]
4088pub struct DeviceGetBtiResponder {
4089    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4090    tx_id: u32,
4091}
4092
4093/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4094/// if the responder is dropped without sending a response, so that the client
4095/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4096impl std::ops::Drop for DeviceGetBtiResponder {
4097    fn drop(&mut self) {
4098        self.control_handle.shutdown();
4099        // Safety: drops once, never accessed again
4100        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4101    }
4102}
4103
4104impl fidl::endpoints::Responder for DeviceGetBtiResponder {
4105    type ControlHandle = DeviceControlHandle;
4106
4107    fn control_handle(&self) -> &DeviceControlHandle {
4108        &self.control_handle
4109    }
4110
4111    fn drop_without_shutdown(mut self) {
4112        // Safety: drops once, never accessed again due to mem::forget
4113        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4114        // Prevent Drop from running (which would shut down the channel)
4115        std::mem::forget(self);
4116    }
4117}
4118
4119impl DeviceGetBtiResponder {
4120    /// Sends a response to the FIDL transaction.
4121    ///
4122    /// Sets the channel to shutdown if an error occurs.
4123    pub fn send(self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
4124        let _result = self.send_raw(result);
4125        if _result.is_err() {
4126            self.control_handle.shutdown();
4127        }
4128        self.drop_without_shutdown();
4129        _result
4130    }
4131
4132    /// Similar to "send" but does not shutdown the channel if an error occurs.
4133    pub fn send_no_shutdown_on_err(
4134        self,
4135        mut result: Result<fidl::Bti, i32>,
4136    ) -> Result<(), fidl::Error> {
4137        let _result = self.send_raw(result);
4138        self.drop_without_shutdown();
4139        _result
4140    }
4141
4142    fn send_raw(&self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
4143        self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetBtiResponse, i32>>(
4144            result.map(|bti| (bti,)),
4145            self.tx_id,
4146            0x5e4fe9efb12d9ee3,
4147            fidl::encoding::DynamicFlags::empty(),
4148        )
4149    }
4150}
4151
4152#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4153pub struct ServiceMarker;
4154
4155#[cfg(target_os = "fuchsia")]
4156impl fidl::endpoints::ServiceMarker for ServiceMarker {
4157    type Proxy = ServiceProxy;
4158    type Request = ServiceRequest;
4159    const SERVICE_NAME: &'static str = "fuchsia.hardware.pci.Service";
4160}
4161
4162/// A request for one of the member protocols of Service.
4163///
4164#[cfg(target_os = "fuchsia")]
4165pub enum ServiceRequest {
4166    Device(DeviceRequestStream),
4167}
4168
4169#[cfg(target_os = "fuchsia")]
4170impl fidl::endpoints::ServiceRequest for ServiceRequest {
4171    type Service = ServiceMarker;
4172
4173    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
4174        match name {
4175            "device" => Self::Device(
4176                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
4177            ),
4178            _ => panic!("no such member protocol name for service Service"),
4179        }
4180    }
4181
4182    fn member_names() -> &'static [&'static str] {
4183        &["device"]
4184    }
4185}
4186#[cfg(target_os = "fuchsia")]
4187pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
4188
4189#[cfg(target_os = "fuchsia")]
4190impl fidl::endpoints::ServiceProxy for ServiceProxy {
4191    type Service = ServiceMarker;
4192
4193    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
4194        Self(opener)
4195    }
4196}
4197
4198#[cfg(target_os = "fuchsia")]
4199impl ServiceProxy {
4200    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
4201        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
4202        self.connect_channel_to_device(server_end)?;
4203        Ok(proxy)
4204    }
4205
4206    /// Like `connect_to_device`, but returns a sync proxy.
4207    /// See [`Self::connect_to_device`] for more details.
4208    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
4209        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
4210        self.connect_channel_to_device(server_end)?;
4211        Ok(proxy)
4212    }
4213
4214    /// Like `connect_to_device`, but accepts a server end.
4215    /// See [`Self::connect_to_device`] for more details.
4216    pub fn connect_channel_to_device(
4217        &self,
4218        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
4219    ) -> Result<(), fidl::Error> {
4220        self.0.open_member("device", server_end.into_channel())
4221    }
4222
4223    pub fn instance_name(&self) -> &str {
4224        self.0.instance_name()
4225    }
4226}
4227
4228mod internal {
4229    use super::*;
4230
4231    impl fidl::encoding::ResourceTypeMarker for Bar {
4232        type Borrowed<'a> = &'a mut Self;
4233        fn take_or_borrow<'a>(
4234            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4235        ) -> Self::Borrowed<'a> {
4236            value
4237        }
4238    }
4239
4240    unsafe impl fidl::encoding::TypeMarker for Bar {
4241        type Owned = Self;
4242
4243        #[inline(always)]
4244        fn inline_align(_context: fidl::encoding::Context) -> usize {
4245            8
4246        }
4247
4248        #[inline(always)]
4249        fn inline_size(_context: fidl::encoding::Context) -> usize {
4250            32
4251        }
4252    }
4253
4254    unsafe impl fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>
4255        for &mut Bar
4256    {
4257        #[inline]
4258        unsafe fn encode(
4259            self,
4260            encoder: &mut fidl::encoding::Encoder<
4261                '_,
4262                fidl::encoding::DefaultFuchsiaResourceDialect,
4263            >,
4264            offset: usize,
4265            _depth: fidl::encoding::Depth,
4266        ) -> fidl::Result<()> {
4267            encoder.debug_check_bounds::<Bar>(offset);
4268            // Delegate to tuple encoding.
4269            fidl::encoding::Encode::<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4270                (
4271                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.bar_id),
4272                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
4273                    <BarResult as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4274                        &mut self.result,
4275                    ),
4276                ),
4277                encoder,
4278                offset,
4279                _depth,
4280            )
4281        }
4282    }
4283    unsafe impl<
4284            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
4285            T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4286            T2: fidl::encoding::Encode<BarResult, fidl::encoding::DefaultFuchsiaResourceDialect>,
4287        > fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>
4288        for (T0, T1, T2)
4289    {
4290        #[inline]
4291        unsafe fn encode(
4292            self,
4293            encoder: &mut fidl::encoding::Encoder<
4294                '_,
4295                fidl::encoding::DefaultFuchsiaResourceDialect,
4296            >,
4297            offset: usize,
4298            depth: fidl::encoding::Depth,
4299        ) -> fidl::Result<()> {
4300            encoder.debug_check_bounds::<Bar>(offset);
4301            // Zero out padding regions. There's no need to apply masks
4302            // because the unmasked parts will be overwritten by fields.
4303            unsafe {
4304                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4305                (ptr as *mut u64).write_unaligned(0);
4306            }
4307            // Write the fields.
4308            self.0.encode(encoder, offset + 0, depth)?;
4309            self.1.encode(encoder, offset + 8, depth)?;
4310            self.2.encode(encoder, offset + 16, depth)?;
4311            Ok(())
4312        }
4313    }
4314
4315    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Bar {
4316        #[inline(always)]
4317        fn new_empty() -> Self {
4318            Self {
4319                bar_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
4320                size: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
4321                result: fidl::new_empty!(BarResult, fidl::encoding::DefaultFuchsiaResourceDialect),
4322            }
4323        }
4324
4325        #[inline]
4326        unsafe fn decode(
4327            &mut self,
4328            decoder: &mut fidl::encoding::Decoder<
4329                '_,
4330                fidl::encoding::DefaultFuchsiaResourceDialect,
4331            >,
4332            offset: usize,
4333            _depth: fidl::encoding::Depth,
4334        ) -> fidl::Result<()> {
4335            decoder.debug_check_bounds::<Self>(offset);
4336            // Verify that padding bytes are zero.
4337            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4338            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4339            let mask = 0xffffffff00000000u64;
4340            let maskedval = padval & mask;
4341            if maskedval != 0 {
4342                return Err(fidl::Error::NonZeroPadding {
4343                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4344                });
4345            }
4346            fidl::decode!(
4347                u32,
4348                fidl::encoding::DefaultFuchsiaResourceDialect,
4349                &mut self.bar_id,
4350                decoder,
4351                offset + 0,
4352                _depth
4353            )?;
4354            fidl::decode!(
4355                u64,
4356                fidl::encoding::DefaultFuchsiaResourceDialect,
4357                &mut self.size,
4358                decoder,
4359                offset + 8,
4360                _depth
4361            )?;
4362            fidl::decode!(
4363                BarResult,
4364                fidl::encoding::DefaultFuchsiaResourceDialect,
4365                &mut self.result,
4366                decoder,
4367                offset + 16,
4368                _depth
4369            )?;
4370            Ok(())
4371        }
4372    }
4373
4374    impl fidl::encoding::ResourceTypeMarker for DeviceGetBarResponse {
4375        type Borrowed<'a> = &'a mut Self;
4376        fn take_or_borrow<'a>(
4377            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4378        ) -> Self::Borrowed<'a> {
4379            value
4380        }
4381    }
4382
4383    unsafe impl fidl::encoding::TypeMarker for DeviceGetBarResponse {
4384        type Owned = Self;
4385
4386        #[inline(always)]
4387        fn inline_align(_context: fidl::encoding::Context) -> usize {
4388            8
4389        }
4390
4391        #[inline(always)]
4392        fn inline_size(_context: fidl::encoding::Context) -> usize {
4393            32
4394        }
4395    }
4396
4397    unsafe impl
4398        fidl::encoding::Encode<DeviceGetBarResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
4399        for &mut DeviceGetBarResponse
4400    {
4401        #[inline]
4402        unsafe fn encode(
4403            self,
4404            encoder: &mut fidl::encoding::Encoder<
4405                '_,
4406                fidl::encoding::DefaultFuchsiaResourceDialect,
4407            >,
4408            offset: usize,
4409            _depth: fidl::encoding::Depth,
4410        ) -> fidl::Result<()> {
4411            encoder.debug_check_bounds::<DeviceGetBarResponse>(offset);
4412            // Delegate to tuple encoding.
4413            fidl::encoding::Encode::<
4414                DeviceGetBarResponse,
4415                fidl::encoding::DefaultFuchsiaResourceDialect,
4416            >::encode(
4417                (<Bar as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result),),
4418                encoder,
4419                offset,
4420                _depth,
4421            )
4422        }
4423    }
4424    unsafe impl<T0: fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>>
4425        fidl::encoding::Encode<DeviceGetBarResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
4426        for (T0,)
4427    {
4428        #[inline]
4429        unsafe fn encode(
4430            self,
4431            encoder: &mut fidl::encoding::Encoder<
4432                '_,
4433                fidl::encoding::DefaultFuchsiaResourceDialect,
4434            >,
4435            offset: usize,
4436            depth: fidl::encoding::Depth,
4437        ) -> fidl::Result<()> {
4438            encoder.debug_check_bounds::<DeviceGetBarResponse>(offset);
4439            // Zero out padding regions. There's no need to apply masks
4440            // because the unmasked parts will be overwritten by fields.
4441            // Write the fields.
4442            self.0.encode(encoder, offset + 0, depth)?;
4443            Ok(())
4444        }
4445    }
4446
4447    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4448        for DeviceGetBarResponse
4449    {
4450        #[inline(always)]
4451        fn new_empty() -> Self {
4452            Self { result: fidl::new_empty!(Bar, fidl::encoding::DefaultFuchsiaResourceDialect) }
4453        }
4454
4455        #[inline]
4456        unsafe fn decode(
4457            &mut self,
4458            decoder: &mut fidl::encoding::Decoder<
4459                '_,
4460                fidl::encoding::DefaultFuchsiaResourceDialect,
4461            >,
4462            offset: usize,
4463            _depth: fidl::encoding::Depth,
4464        ) -> fidl::Result<()> {
4465            decoder.debug_check_bounds::<Self>(offset);
4466            // Verify that padding bytes are zero.
4467            fidl::decode!(
4468                Bar,
4469                fidl::encoding::DefaultFuchsiaResourceDialect,
4470                &mut self.result,
4471                decoder,
4472                offset + 0,
4473                _depth
4474            )?;
4475            Ok(())
4476        }
4477    }
4478
4479    impl fidl::encoding::ResourceTypeMarker for DeviceGetBtiResponse {
4480        type Borrowed<'a> = &'a mut Self;
4481        fn take_or_borrow<'a>(
4482            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4483        ) -> Self::Borrowed<'a> {
4484            value
4485        }
4486    }
4487
4488    unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiResponse {
4489        type Owned = Self;
4490
4491        #[inline(always)]
4492        fn inline_align(_context: fidl::encoding::Context) -> usize {
4493            4
4494        }
4495
4496        #[inline(always)]
4497        fn inline_size(_context: fidl::encoding::Context) -> usize {
4498            4
4499        }
4500    }
4501
4502    unsafe impl
4503        fidl::encoding::Encode<DeviceGetBtiResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
4504        for &mut DeviceGetBtiResponse
4505    {
4506        #[inline]
4507        unsafe fn encode(
4508            self,
4509            encoder: &mut fidl::encoding::Encoder<
4510                '_,
4511                fidl::encoding::DefaultFuchsiaResourceDialect,
4512            >,
4513            offset: usize,
4514            _depth: fidl::encoding::Depth,
4515        ) -> fidl::Result<()> {
4516            encoder.debug_check_bounds::<DeviceGetBtiResponse>(offset);
4517            // Delegate to tuple encoding.
4518            fidl::encoding::Encode::<
4519                DeviceGetBtiResponse,
4520                fidl::encoding::DefaultFuchsiaResourceDialect,
4521            >::encode(
4522                (<fidl::encoding::HandleType<
4523                    fidl::Bti,
4524                    { fidl::ObjectType::BTI.into_raw() },
4525                    2147483648,
4526                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4527                    &mut self.bti
4528                ),),
4529                encoder,
4530                offset,
4531                _depth,
4532            )
4533        }
4534    }
4535    unsafe impl<
4536            T0: fidl::encoding::Encode<
4537                fidl::encoding::HandleType<
4538                    fidl::Bti,
4539                    { fidl::ObjectType::BTI.into_raw() },
4540                    2147483648,
4541                >,
4542                fidl::encoding::DefaultFuchsiaResourceDialect,
4543            >,
4544        >
4545        fidl::encoding::Encode<DeviceGetBtiResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
4546        for (T0,)
4547    {
4548        #[inline]
4549        unsafe fn encode(
4550            self,
4551            encoder: &mut fidl::encoding::Encoder<
4552                '_,
4553                fidl::encoding::DefaultFuchsiaResourceDialect,
4554            >,
4555            offset: usize,
4556            depth: fidl::encoding::Depth,
4557        ) -> fidl::Result<()> {
4558            encoder.debug_check_bounds::<DeviceGetBtiResponse>(offset);
4559            // Zero out padding regions. There's no need to apply masks
4560            // because the unmasked parts will be overwritten by fields.
4561            // Write the fields.
4562            self.0.encode(encoder, offset + 0, depth)?;
4563            Ok(())
4564        }
4565    }
4566
4567    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4568        for DeviceGetBtiResponse
4569    {
4570        #[inline(always)]
4571        fn new_empty() -> Self {
4572            Self {
4573                bti: fidl::new_empty!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4574            }
4575        }
4576
4577        #[inline]
4578        unsafe fn decode(
4579            &mut self,
4580            decoder: &mut fidl::encoding::Decoder<
4581                '_,
4582                fidl::encoding::DefaultFuchsiaResourceDialect,
4583            >,
4584            offset: usize,
4585            _depth: fidl::encoding::Depth,
4586        ) -> fidl::Result<()> {
4587            decoder.debug_check_bounds::<Self>(offset);
4588            // Verify that padding bytes are zero.
4589            fidl::decode!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bti, decoder, offset + 0, _depth)?;
4590            Ok(())
4591        }
4592    }
4593
4594    impl fidl::encoding::ResourceTypeMarker for DeviceMapInterruptResponse {
4595        type Borrowed<'a> = &'a mut Self;
4596        fn take_or_borrow<'a>(
4597            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4598        ) -> Self::Borrowed<'a> {
4599            value
4600        }
4601    }
4602
4603    unsafe impl fidl::encoding::TypeMarker for DeviceMapInterruptResponse {
4604        type Owned = Self;
4605
4606        #[inline(always)]
4607        fn inline_align(_context: fidl::encoding::Context) -> usize {
4608            4
4609        }
4610
4611        #[inline(always)]
4612        fn inline_size(_context: fidl::encoding::Context) -> usize {
4613            4
4614        }
4615    }
4616
4617    unsafe impl
4618        fidl::encoding::Encode<
4619            DeviceMapInterruptResponse,
4620            fidl::encoding::DefaultFuchsiaResourceDialect,
4621        > for &mut DeviceMapInterruptResponse
4622    {
4623        #[inline]
4624        unsafe fn encode(
4625            self,
4626            encoder: &mut fidl::encoding::Encoder<
4627                '_,
4628                fidl::encoding::DefaultFuchsiaResourceDialect,
4629            >,
4630            offset: usize,
4631            _depth: fidl::encoding::Depth,
4632        ) -> fidl::Result<()> {
4633            encoder.debug_check_bounds::<DeviceMapInterruptResponse>(offset);
4634            // Delegate to tuple encoding.
4635            fidl::encoding::Encode::<
4636                DeviceMapInterruptResponse,
4637                fidl::encoding::DefaultFuchsiaResourceDialect,
4638            >::encode(
4639                (<fidl::encoding::HandleType<
4640                    fidl::Interrupt,
4641                    { fidl::ObjectType::INTERRUPT.into_raw() },
4642                    2147483648,
4643                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4644                    &mut self.interrupt
4645                ),),
4646                encoder,
4647                offset,
4648                _depth,
4649            )
4650        }
4651    }
4652    unsafe impl<
4653            T0: fidl::encoding::Encode<
4654                fidl::encoding::HandleType<
4655                    fidl::Interrupt,
4656                    { fidl::ObjectType::INTERRUPT.into_raw() },
4657                    2147483648,
4658                >,
4659                fidl::encoding::DefaultFuchsiaResourceDialect,
4660            >,
4661        >
4662        fidl::encoding::Encode<
4663            DeviceMapInterruptResponse,
4664            fidl::encoding::DefaultFuchsiaResourceDialect,
4665        > for (T0,)
4666    {
4667        #[inline]
4668        unsafe fn encode(
4669            self,
4670            encoder: &mut fidl::encoding::Encoder<
4671                '_,
4672                fidl::encoding::DefaultFuchsiaResourceDialect,
4673            >,
4674            offset: usize,
4675            depth: fidl::encoding::Depth,
4676        ) -> fidl::Result<()> {
4677            encoder.debug_check_bounds::<DeviceMapInterruptResponse>(offset);
4678            // Zero out padding regions. There's no need to apply masks
4679            // because the unmasked parts will be overwritten by fields.
4680            // Write the fields.
4681            self.0.encode(encoder, offset + 0, depth)?;
4682            Ok(())
4683        }
4684    }
4685
4686    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4687        for DeviceMapInterruptResponse
4688    {
4689        #[inline(always)]
4690        fn new_empty() -> Self {
4691            Self {
4692                interrupt: fidl::new_empty!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4693            }
4694        }
4695
4696        #[inline]
4697        unsafe fn decode(
4698            &mut self,
4699            decoder: &mut fidl::encoding::Decoder<
4700                '_,
4701                fidl::encoding::DefaultFuchsiaResourceDialect,
4702            >,
4703            offset: usize,
4704            _depth: fidl::encoding::Depth,
4705        ) -> fidl::Result<()> {
4706            decoder.debug_check_bounds::<Self>(offset);
4707            // Verify that padding bytes are zero.
4708            fidl::decode!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.interrupt, decoder, offset + 0, _depth)?;
4709            Ok(())
4710        }
4711    }
4712
4713    impl fidl::encoding::ResourceTypeMarker for IoBar {
4714        type Borrowed<'a> = &'a mut Self;
4715        fn take_or_borrow<'a>(
4716            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4717        ) -> Self::Borrowed<'a> {
4718            value
4719        }
4720    }
4721
4722    unsafe impl fidl::encoding::TypeMarker for IoBar {
4723        type Owned = Self;
4724
4725        #[inline(always)]
4726        fn inline_align(_context: fidl::encoding::Context) -> usize {
4727            8
4728        }
4729
4730        #[inline(always)]
4731        fn inline_size(_context: fidl::encoding::Context) -> usize {
4732            16
4733        }
4734    }
4735
4736    unsafe impl fidl::encoding::Encode<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>
4737        for &mut IoBar
4738    {
4739        #[inline]
4740        unsafe fn encode(
4741            self,
4742            encoder: &mut fidl::encoding::Encoder<
4743                '_,
4744                fidl::encoding::DefaultFuchsiaResourceDialect,
4745            >,
4746            offset: usize,
4747            _depth: fidl::encoding::Depth,
4748        ) -> fidl::Result<()> {
4749            encoder.debug_check_bounds::<IoBar>(offset);
4750            // Delegate to tuple encoding.
4751            fidl::encoding::Encode::<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4752                (
4753                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
4754                    <fidl::encoding::HandleType<
4755                        fidl::Resource,
4756                        { fidl::ObjectType::RESOURCE.into_raw() },
4757                        2147483648,
4758                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4759                        &mut self.resource
4760                    ),
4761                ),
4762                encoder,
4763                offset,
4764                _depth,
4765            )
4766        }
4767    }
4768    unsafe impl<
4769            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4770            T1: fidl::encoding::Encode<
4771                fidl::encoding::HandleType<
4772                    fidl::Resource,
4773                    { fidl::ObjectType::RESOURCE.into_raw() },
4774                    2147483648,
4775                >,
4776                fidl::encoding::DefaultFuchsiaResourceDialect,
4777            >,
4778        > fidl::encoding::Encode<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>
4779        for (T0, T1)
4780    {
4781        #[inline]
4782        unsafe fn encode(
4783            self,
4784            encoder: &mut fidl::encoding::Encoder<
4785                '_,
4786                fidl::encoding::DefaultFuchsiaResourceDialect,
4787            >,
4788            offset: usize,
4789            depth: fidl::encoding::Depth,
4790        ) -> fidl::Result<()> {
4791            encoder.debug_check_bounds::<IoBar>(offset);
4792            // Zero out padding regions. There's no need to apply masks
4793            // because the unmasked parts will be overwritten by fields.
4794            unsafe {
4795                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4796                (ptr as *mut u64).write_unaligned(0);
4797            }
4798            // Write the fields.
4799            self.0.encode(encoder, offset + 0, depth)?;
4800            self.1.encode(encoder, offset + 8, depth)?;
4801            Ok(())
4802        }
4803    }
4804
4805    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for IoBar {
4806        #[inline(always)]
4807        fn new_empty() -> Self {
4808            Self {
4809                address: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
4810                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4811            }
4812        }
4813
4814        #[inline]
4815        unsafe fn decode(
4816            &mut self,
4817            decoder: &mut fidl::encoding::Decoder<
4818                '_,
4819                fidl::encoding::DefaultFuchsiaResourceDialect,
4820            >,
4821            offset: usize,
4822            _depth: fidl::encoding::Depth,
4823        ) -> fidl::Result<()> {
4824            decoder.debug_check_bounds::<Self>(offset);
4825            // Verify that padding bytes are zero.
4826            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4827            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4828            let mask = 0xffffffff00000000u64;
4829            let maskedval = padval & mask;
4830            if maskedval != 0 {
4831                return Err(fidl::Error::NonZeroPadding {
4832                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4833                });
4834            }
4835            fidl::decode!(
4836                u64,
4837                fidl::encoding::DefaultFuchsiaResourceDialect,
4838                &mut self.address,
4839                decoder,
4840                offset + 0,
4841                _depth
4842            )?;
4843            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 8, _depth)?;
4844            Ok(())
4845        }
4846    }
4847
4848    impl fidl::encoding::ResourceTypeMarker for BarResult {
4849        type Borrowed<'a> = &'a mut Self;
4850        fn take_or_borrow<'a>(
4851            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4852        ) -> Self::Borrowed<'a> {
4853            value
4854        }
4855    }
4856
4857    unsafe impl fidl::encoding::TypeMarker for BarResult {
4858        type Owned = Self;
4859
4860        #[inline(always)]
4861        fn inline_align(_context: fidl::encoding::Context) -> usize {
4862            8
4863        }
4864
4865        #[inline(always)]
4866        fn inline_size(_context: fidl::encoding::Context) -> usize {
4867            16
4868        }
4869    }
4870
4871    unsafe impl fidl::encoding::Encode<BarResult, fidl::encoding::DefaultFuchsiaResourceDialect>
4872        for &mut BarResult
4873    {
4874        #[inline]
4875        unsafe fn encode(
4876            self,
4877            encoder: &mut fidl::encoding::Encoder<
4878                '_,
4879                fidl::encoding::DefaultFuchsiaResourceDialect,
4880            >,
4881            offset: usize,
4882            _depth: fidl::encoding::Depth,
4883        ) -> fidl::Result<()> {
4884            encoder.debug_check_bounds::<BarResult>(offset);
4885            encoder.write_num::<u64>(self.ordinal(), offset);
4886            match self {
4887                BarResult::Io(ref mut val) => fidl::encoding::encode_in_envelope::<
4888                    IoBar,
4889                    fidl::encoding::DefaultFuchsiaResourceDialect,
4890                >(
4891                    <IoBar as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
4892                    encoder,
4893                    offset + 8,
4894                    _depth,
4895                ),
4896                BarResult::Vmo(ref mut val) => fidl::encoding::encode_in_envelope::<
4897                    fidl::encoding::HandleType<
4898                        fidl::Vmo,
4899                        { fidl::ObjectType::VMO.into_raw() },
4900                        2147483648,
4901                    >,
4902                    fidl::encoding::DefaultFuchsiaResourceDialect,
4903                >(
4904                    <fidl::encoding::HandleType<
4905                        fidl::Vmo,
4906                        { fidl::ObjectType::VMO.into_raw() },
4907                        2147483648,
4908                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4909                        val
4910                    ),
4911                    encoder,
4912                    offset + 8,
4913                    _depth,
4914                ),
4915                BarResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4916            }
4917        }
4918    }
4919
4920    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BarResult {
4921        #[inline(always)]
4922        fn new_empty() -> Self {
4923            Self::__SourceBreaking { unknown_ordinal: 0 }
4924        }
4925
4926        #[inline]
4927        unsafe fn decode(
4928            &mut self,
4929            decoder: &mut fidl::encoding::Decoder<
4930                '_,
4931                fidl::encoding::DefaultFuchsiaResourceDialect,
4932            >,
4933            offset: usize,
4934            mut depth: fidl::encoding::Depth,
4935        ) -> fidl::Result<()> {
4936            decoder.debug_check_bounds::<Self>(offset);
4937            #[allow(unused_variables)]
4938            let next_out_of_line = decoder.next_out_of_line();
4939            let handles_before = decoder.remaining_handles();
4940            let (ordinal, inlined, num_bytes, num_handles) =
4941                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4942
4943            let member_inline_size = match ordinal {
4944                1 => <IoBar as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4945                2 => <fidl::encoding::HandleType<
4946                    fidl::Vmo,
4947                    { fidl::ObjectType::VMO.into_raw() },
4948                    2147483648,
4949                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4950                0 => return Err(fidl::Error::UnknownUnionTag),
4951                _ => num_bytes as usize,
4952            };
4953
4954            if inlined != (member_inline_size <= 4) {
4955                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4956            }
4957            let _inner_offset;
4958            if inlined {
4959                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4960                _inner_offset = offset + 8;
4961            } else {
4962                depth.increment()?;
4963                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4964            }
4965            match ordinal {
4966                1 => {
4967                    #[allow(irrefutable_let_patterns)]
4968                    if let BarResult::Io(_) = self {
4969                        // Do nothing, read the value into the object
4970                    } else {
4971                        // Initialize `self` to the right variant
4972                        *self = BarResult::Io(fidl::new_empty!(
4973                            IoBar,
4974                            fidl::encoding::DefaultFuchsiaResourceDialect
4975                        ));
4976                    }
4977                    #[allow(irrefutable_let_patterns)]
4978                    if let BarResult::Io(ref mut val) = self {
4979                        fidl::decode!(
4980                            IoBar,
4981                            fidl::encoding::DefaultFuchsiaResourceDialect,
4982                            val,
4983                            decoder,
4984                            _inner_offset,
4985                            depth
4986                        )?;
4987                    } else {
4988                        unreachable!()
4989                    }
4990                }
4991                2 => {
4992                    #[allow(irrefutable_let_patterns)]
4993                    if let BarResult::Vmo(_) = self {
4994                        // Do nothing, read the value into the object
4995                    } else {
4996                        // Initialize `self` to the right variant
4997                        *self = BarResult::Vmo(
4998                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4999                        );
5000                    }
5001                    #[allow(irrefutable_let_patterns)]
5002                    if let BarResult::Vmo(ref mut val) = self {
5003                        fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
5004                    } else {
5005                        unreachable!()
5006                    }
5007                }
5008                #[allow(deprecated)]
5009                ordinal => {
5010                    for _ in 0..num_handles {
5011                        decoder.drop_next_handle()?;
5012                    }
5013                    *self = BarResult::__SourceBreaking { unknown_ordinal: ordinal };
5014                }
5015            }
5016            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5017                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5018            }
5019            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5020                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5021            }
5022            Ok(())
5023        }
5024    }
5025}