1#![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#[derive(Debug, PartialEq)]
16pub struct Bar {
17 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#[macro_export]
69macro_rules! BarResultUnknown {
70 () => {
71 _
72 };
73}
74
75impl 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 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 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 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 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#[derive(Debug, Clone)]
263pub struct BusProxy {
264 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
265}
266
267impl fidl::endpoints::Proxy for BusProxy {
268 type Protocol = BusMarker;
269
270 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
271 Self::new(inner)
272 }
273
274 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
275 self.client.into_channel().map_err(|client| Self { client })
276 }
277
278 fn as_channel(&self) -> &::fidl::AsyncChannel {
279 self.client.as_channel()
280 }
281}
282
283impl BusProxy {
284 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
286 let protocol_name = <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
287 Self { client: fidl::client::Client::new(channel, protocol_name) }
288 }
289
290 pub fn take_event_stream(&self) -> BusEventStream {
296 BusEventStream { event_receiver: self.client.take_event_receiver() }
297 }
298
299 pub fn r#get_host_bridge_info(
301 &self,
302 ) -> fidl::client::QueryResponseFut<HostBridgeInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
303 {
304 BusProxyInterface::r#get_host_bridge_info(self)
305 }
306
307 pub fn r#get_devices(
309 &self,
310 ) -> fidl::client::QueryResponseFut<Vec<PciDevice>, fidl::encoding::DefaultFuchsiaResourceDialect>
311 {
312 BusProxyInterface::r#get_devices(self)
313 }
314
315 pub fn r#read_bar(
330 &self,
331 mut device: &Address,
332 mut bar_id: u8,
333 mut offset: u64,
334 mut size: u64,
335 ) -> fidl::client::QueryResponseFut<
336 BusReadBarResult,
337 fidl::encoding::DefaultFuchsiaResourceDialect,
338 > {
339 BusProxyInterface::r#read_bar(self, device, bar_id, offset, size)
340 }
341}
342
343impl BusProxyInterface for BusProxy {
344 type GetHostBridgeInfoResponseFut = fidl::client::QueryResponseFut<
345 HostBridgeInfo,
346 fidl::encoding::DefaultFuchsiaResourceDialect,
347 >;
348 fn r#get_host_bridge_info(&self) -> Self::GetHostBridgeInfoResponseFut {
349 fn _decode(
350 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
351 ) -> Result<HostBridgeInfo, fidl::Error> {
352 let _response = fidl::client::decode_transaction_body::<
353 BusGetHostBridgeInfoResponse,
354 fidl::encoding::DefaultFuchsiaResourceDialect,
355 0x39f0b21bcd8c065d,
356 >(_buf?)?;
357 Ok(_response.info)
358 }
359 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HostBridgeInfo>(
360 (),
361 0x39f0b21bcd8c065d,
362 fidl::encoding::DynamicFlags::empty(),
363 _decode,
364 )
365 }
366
367 type GetDevicesResponseFut = fidl::client::QueryResponseFut<
368 Vec<PciDevice>,
369 fidl::encoding::DefaultFuchsiaResourceDialect,
370 >;
371 fn r#get_devices(&self) -> Self::GetDevicesResponseFut {
372 fn _decode(
373 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
374 ) -> Result<Vec<PciDevice>, fidl::Error> {
375 let _response = fidl::client::decode_transaction_body::<
376 BusGetDevicesResponse,
377 fidl::encoding::DefaultFuchsiaResourceDialect,
378 0x2b39a32926007c92,
379 >(_buf?)?;
380 Ok(_response.devices)
381 }
382 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<PciDevice>>(
383 (),
384 0x2b39a32926007c92,
385 fidl::encoding::DynamicFlags::empty(),
386 _decode,
387 )
388 }
389
390 type ReadBarResponseFut = fidl::client::QueryResponseFut<
391 BusReadBarResult,
392 fidl::encoding::DefaultFuchsiaResourceDialect,
393 >;
394 fn r#read_bar(
395 &self,
396 mut device: &Address,
397 mut bar_id: u8,
398 mut offset: u64,
399 mut size: u64,
400 ) -> Self::ReadBarResponseFut {
401 fn _decode(
402 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
403 ) -> Result<BusReadBarResult, fidl::Error> {
404 let _response = fidl::client::decode_transaction_body::<
405 fidl::encoding::ResultType<BusReadBarResponse, i32>,
406 fidl::encoding::DefaultFuchsiaResourceDialect,
407 0x798f39b0dfdc4860,
408 >(_buf?)?;
409 Ok(_response.map(|x| x.buffer))
410 }
411 self.client.send_query_and_decode::<BusReadBarRequest, BusReadBarResult>(
412 (device, bar_id, offset, size),
413 0x798f39b0dfdc4860,
414 fidl::encoding::DynamicFlags::empty(),
415 _decode,
416 )
417 }
418}
419
420pub struct BusEventStream {
421 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
422}
423
424impl std::marker::Unpin for BusEventStream {}
425
426impl futures::stream::FusedStream for BusEventStream {
427 fn is_terminated(&self) -> bool {
428 self.event_receiver.is_terminated()
429 }
430}
431
432impl futures::Stream for BusEventStream {
433 type Item = Result<BusEvent, fidl::Error>;
434
435 fn poll_next(
436 mut self: std::pin::Pin<&mut Self>,
437 cx: &mut std::task::Context<'_>,
438 ) -> std::task::Poll<Option<Self::Item>> {
439 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
440 &mut self.event_receiver,
441 cx
442 )?) {
443 Some(buf) => std::task::Poll::Ready(Some(BusEvent::decode(buf))),
444 None => std::task::Poll::Ready(None),
445 }
446 }
447}
448
449#[derive(Debug)]
450pub enum BusEvent {}
451
452impl BusEvent {
453 fn decode(
455 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
456 ) -> Result<BusEvent, fidl::Error> {
457 let (bytes, _handles) = buf.split_mut();
458 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
459 debug_assert_eq!(tx_header.tx_id, 0);
460 match tx_header.ordinal {
461 _ => Err(fidl::Error::UnknownOrdinal {
462 ordinal: tx_header.ordinal,
463 protocol_name: <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
464 }),
465 }
466 }
467}
468
469pub struct BusRequestStream {
471 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
472 is_terminated: bool,
473}
474
475impl std::marker::Unpin for BusRequestStream {}
476
477impl futures::stream::FusedStream for BusRequestStream {
478 fn is_terminated(&self) -> bool {
479 self.is_terminated
480 }
481}
482
483impl fidl::endpoints::RequestStream for BusRequestStream {
484 type Protocol = BusMarker;
485 type ControlHandle = BusControlHandle;
486
487 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
488 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
489 }
490
491 fn control_handle(&self) -> Self::ControlHandle {
492 BusControlHandle { inner: self.inner.clone() }
493 }
494
495 fn into_inner(
496 self,
497 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
498 {
499 (self.inner, self.is_terminated)
500 }
501
502 fn from_inner(
503 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
504 is_terminated: bool,
505 ) -> Self {
506 Self { inner, is_terminated }
507 }
508}
509
510impl futures::Stream for BusRequestStream {
511 type Item = Result<BusRequest, fidl::Error>;
512
513 fn poll_next(
514 mut self: std::pin::Pin<&mut Self>,
515 cx: &mut std::task::Context<'_>,
516 ) -> std::task::Poll<Option<Self::Item>> {
517 let this = &mut *self;
518 if this.inner.check_shutdown(cx) {
519 this.is_terminated = true;
520 return std::task::Poll::Ready(None);
521 }
522 if this.is_terminated {
523 panic!("polled BusRequestStream after completion");
524 }
525 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
526 |bytes, handles| {
527 match this.inner.channel().read_etc(cx, bytes, handles) {
528 std::task::Poll::Ready(Ok(())) => {}
529 std::task::Poll::Pending => return std::task::Poll::Pending,
530 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
531 this.is_terminated = true;
532 return std::task::Poll::Ready(None);
533 }
534 std::task::Poll::Ready(Err(e)) => {
535 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
536 e.into(),
537 ))))
538 }
539 }
540
541 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
543
544 std::task::Poll::Ready(Some(match header.ordinal {
545 0x39f0b21bcd8c065d => {
546 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
547 let mut req = fidl::new_empty!(
548 fidl::encoding::EmptyPayload,
549 fidl::encoding::DefaultFuchsiaResourceDialect
550 );
551 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
552 let control_handle = BusControlHandle { inner: this.inner.clone() };
553 Ok(BusRequest::GetHostBridgeInfo {
554 responder: BusGetHostBridgeInfoResponder {
555 control_handle: std::mem::ManuallyDrop::new(control_handle),
556 tx_id: header.tx_id,
557 },
558 })
559 }
560 0x2b39a32926007c92 => {
561 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
562 let mut req = fidl::new_empty!(
563 fidl::encoding::EmptyPayload,
564 fidl::encoding::DefaultFuchsiaResourceDialect
565 );
566 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
567 let control_handle = BusControlHandle { inner: this.inner.clone() };
568 Ok(BusRequest::GetDevices {
569 responder: BusGetDevicesResponder {
570 control_handle: std::mem::ManuallyDrop::new(control_handle),
571 tx_id: header.tx_id,
572 },
573 })
574 }
575 0x798f39b0dfdc4860 => {
576 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
577 let mut req = fidl::new_empty!(
578 BusReadBarRequest,
579 fidl::encoding::DefaultFuchsiaResourceDialect
580 );
581 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BusReadBarRequest>(&header, _body_bytes, handles, &mut req)?;
582 let control_handle = BusControlHandle { inner: this.inner.clone() };
583 Ok(BusRequest::ReadBar {
584 device: req.device,
585 bar_id: req.bar_id,
586 offset: req.offset,
587 size: req.size,
588
589 responder: BusReadBarResponder {
590 control_handle: std::mem::ManuallyDrop::new(control_handle),
591 tx_id: header.tx_id,
592 },
593 })
594 }
595 _ => Err(fidl::Error::UnknownOrdinal {
596 ordinal: header.ordinal,
597 protocol_name: <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
598 }),
599 }))
600 },
601 )
602 }
603}
604
605#[derive(Debug)]
608pub enum BusRequest {
609 GetHostBridgeInfo { responder: BusGetHostBridgeInfoResponder },
611 GetDevices { responder: BusGetDevicesResponder },
613 ReadBar { device: Address, bar_id: u8, offset: u64, size: u64, responder: BusReadBarResponder },
628}
629
630impl BusRequest {
631 #[allow(irrefutable_let_patterns)]
632 pub fn into_get_host_bridge_info(self) -> Option<(BusGetHostBridgeInfoResponder)> {
633 if let BusRequest::GetHostBridgeInfo { responder } = self {
634 Some((responder))
635 } else {
636 None
637 }
638 }
639
640 #[allow(irrefutable_let_patterns)]
641 pub fn into_get_devices(self) -> Option<(BusGetDevicesResponder)> {
642 if let BusRequest::GetDevices { responder } = self {
643 Some((responder))
644 } else {
645 None
646 }
647 }
648
649 #[allow(irrefutable_let_patterns)]
650 pub fn into_read_bar(self) -> Option<(Address, u8, u64, u64, BusReadBarResponder)> {
651 if let BusRequest::ReadBar { device, bar_id, offset, size, responder } = self {
652 Some((device, bar_id, offset, size, responder))
653 } else {
654 None
655 }
656 }
657
658 pub fn method_name(&self) -> &'static str {
660 match *self {
661 BusRequest::GetHostBridgeInfo { .. } => "get_host_bridge_info",
662 BusRequest::GetDevices { .. } => "get_devices",
663 BusRequest::ReadBar { .. } => "read_bar",
664 }
665 }
666}
667
668#[derive(Debug, Clone)]
669pub struct BusControlHandle {
670 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
671}
672
673impl fidl::endpoints::ControlHandle for BusControlHandle {
674 fn shutdown(&self) {
675 self.inner.shutdown()
676 }
677 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
678 self.inner.shutdown_with_epitaph(status)
679 }
680
681 fn is_closed(&self) -> bool {
682 self.inner.channel().is_closed()
683 }
684 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
685 self.inner.channel().on_closed()
686 }
687
688 #[cfg(target_os = "fuchsia")]
689 fn signal_peer(
690 &self,
691 clear_mask: zx::Signals,
692 set_mask: zx::Signals,
693 ) -> Result<(), zx_status::Status> {
694 use fidl::Peered;
695 self.inner.channel().signal_peer(clear_mask, set_mask)
696 }
697}
698
699impl BusControlHandle {}
700
701#[must_use = "FIDL methods require a response to be sent"]
702#[derive(Debug)]
703pub struct BusGetHostBridgeInfoResponder {
704 control_handle: std::mem::ManuallyDrop<BusControlHandle>,
705 tx_id: u32,
706}
707
708impl std::ops::Drop for BusGetHostBridgeInfoResponder {
712 fn drop(&mut self) {
713 self.control_handle.shutdown();
714 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
716 }
717}
718
719impl fidl::endpoints::Responder for BusGetHostBridgeInfoResponder {
720 type ControlHandle = BusControlHandle;
721
722 fn control_handle(&self) -> &BusControlHandle {
723 &self.control_handle
724 }
725
726 fn drop_without_shutdown(mut self) {
727 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
729 std::mem::forget(self);
731 }
732}
733
734impl BusGetHostBridgeInfoResponder {
735 pub fn send(self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
739 let _result = self.send_raw(info);
740 if _result.is_err() {
741 self.control_handle.shutdown();
742 }
743 self.drop_without_shutdown();
744 _result
745 }
746
747 pub fn send_no_shutdown_on_err(self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
749 let _result = self.send_raw(info);
750 self.drop_without_shutdown();
751 _result
752 }
753
754 fn send_raw(&self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
755 self.control_handle.inner.send::<BusGetHostBridgeInfoResponse>(
756 (info,),
757 self.tx_id,
758 0x39f0b21bcd8c065d,
759 fidl::encoding::DynamicFlags::empty(),
760 )
761 }
762}
763
764#[must_use = "FIDL methods require a response to be sent"]
765#[derive(Debug)]
766pub struct BusGetDevicesResponder {
767 control_handle: std::mem::ManuallyDrop<BusControlHandle>,
768 tx_id: u32,
769}
770
771impl std::ops::Drop for BusGetDevicesResponder {
775 fn drop(&mut self) {
776 self.control_handle.shutdown();
777 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
779 }
780}
781
782impl fidl::endpoints::Responder for BusGetDevicesResponder {
783 type ControlHandle = BusControlHandle;
784
785 fn control_handle(&self) -> &BusControlHandle {
786 &self.control_handle
787 }
788
789 fn drop_without_shutdown(mut self) {
790 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
792 std::mem::forget(self);
794 }
795}
796
797impl BusGetDevicesResponder {
798 pub fn send(self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
802 let _result = self.send_raw(devices);
803 if _result.is_err() {
804 self.control_handle.shutdown();
805 }
806 self.drop_without_shutdown();
807 _result
808 }
809
810 pub fn send_no_shutdown_on_err(self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
812 let _result = self.send_raw(devices);
813 self.drop_without_shutdown();
814 _result
815 }
816
817 fn send_raw(&self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
818 self.control_handle.inner.send::<BusGetDevicesResponse>(
819 (devices,),
820 self.tx_id,
821 0x2b39a32926007c92,
822 fidl::encoding::DynamicFlags::empty(),
823 )
824 }
825}
826
827#[must_use = "FIDL methods require a response to be sent"]
828#[derive(Debug)]
829pub struct BusReadBarResponder {
830 control_handle: std::mem::ManuallyDrop<BusControlHandle>,
831 tx_id: u32,
832}
833
834impl std::ops::Drop for BusReadBarResponder {
838 fn drop(&mut self) {
839 self.control_handle.shutdown();
840 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
842 }
843}
844
845impl fidl::endpoints::Responder for BusReadBarResponder {
846 type ControlHandle = BusControlHandle;
847
848 fn control_handle(&self) -> &BusControlHandle {
849 &self.control_handle
850 }
851
852 fn drop_without_shutdown(mut self) {
853 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
855 std::mem::forget(self);
857 }
858}
859
860impl BusReadBarResponder {
861 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
865 let _result = self.send_raw(result);
866 if _result.is_err() {
867 self.control_handle.shutdown();
868 }
869 self.drop_without_shutdown();
870 _result
871 }
872
873 pub fn send_no_shutdown_on_err(
875 self,
876 mut result: Result<&[u8], i32>,
877 ) -> Result<(), fidl::Error> {
878 let _result = self.send_raw(result);
879 self.drop_without_shutdown();
880 _result
881 }
882
883 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
884 self.control_handle.inner.send::<fidl::encoding::ResultType<BusReadBarResponse, i32>>(
885 result.map(|buffer| (buffer,)),
886 self.tx_id,
887 0x798f39b0dfdc4860,
888 fidl::encoding::DynamicFlags::empty(),
889 )
890 }
891}
892
893#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
894pub struct DeviceMarker;
895
896impl fidl::endpoints::ProtocolMarker for DeviceMarker {
897 type Proxy = DeviceProxy;
898 type RequestStream = DeviceRequestStream;
899 #[cfg(target_os = "fuchsia")]
900 type SynchronousProxy = DeviceSynchronousProxy;
901
902 const DEBUG_NAME: &'static str = "fuchsia.hardware.pci.Device";
903}
904impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
905pub type DeviceGetBarResult = Result<Bar, i32>;
906pub type DeviceSetBusMasteringResult = Result<(), i32>;
907pub type DeviceResetDeviceResult = Result<(), i32>;
908pub type DeviceAckInterruptResult = Result<(), i32>;
909pub type DeviceMapInterruptResult = Result<fidl::Interrupt, i32>;
910pub type DeviceSetInterruptModeResult = Result<(), i32>;
911pub type DeviceReadConfig8Result = Result<u8, i32>;
912pub type DeviceReadConfig16Result = Result<u16, i32>;
913pub type DeviceReadConfig32Result = Result<u32, i32>;
914pub type DeviceWriteConfig8Result = Result<(), i32>;
915pub type DeviceWriteConfig16Result = Result<(), i32>;
916pub type DeviceWriteConfig32Result = Result<(), i32>;
917pub type DeviceGetBtiResult = Result<fidl::Bti, i32>;
918
919pub trait DeviceProxyInterface: Send + Sync {
920 type GetDeviceInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>>
921 + Send;
922 fn r#get_device_info(&self) -> Self::GetDeviceInfoResponseFut;
923 type GetBarResponseFut: std::future::Future<Output = Result<DeviceGetBarResult, fidl::Error>>
924 + Send;
925 fn r#get_bar(&self, bar_id: u32) -> Self::GetBarResponseFut;
926 type SetBusMasteringResponseFut: std::future::Future<Output = Result<DeviceSetBusMasteringResult, fidl::Error>>
927 + Send;
928 fn r#set_bus_mastering(&self, enabled: bool) -> Self::SetBusMasteringResponseFut;
929 type ResetDeviceResponseFut: std::future::Future<Output = Result<DeviceResetDeviceResult, fidl::Error>>
930 + Send;
931 fn r#reset_device(&self) -> Self::ResetDeviceResponseFut;
932 type AckInterruptResponseFut: std::future::Future<Output = Result<DeviceAckInterruptResult, fidl::Error>>
933 + Send;
934 fn r#ack_interrupt(&self) -> Self::AckInterruptResponseFut;
935 type MapInterruptResponseFut: std::future::Future<Output = Result<DeviceMapInterruptResult, fidl::Error>>
936 + Send;
937 fn r#map_interrupt(&self, which_irq: u32) -> Self::MapInterruptResponseFut;
938 type GetInterruptModesResponseFut: std::future::Future<Output = Result<InterruptModes, fidl::Error>>
939 + Send;
940 fn r#get_interrupt_modes(&self) -> Self::GetInterruptModesResponseFut;
941 type SetInterruptModeResponseFut: std::future::Future<Output = Result<DeviceSetInterruptModeResult, fidl::Error>>
942 + Send;
943 fn r#set_interrupt_mode(
944 &self,
945 mode: InterruptMode,
946 requested_irq_count: u32,
947 ) -> Self::SetInterruptModeResponseFut;
948 type ReadConfig8ResponseFut: std::future::Future<Output = Result<DeviceReadConfig8Result, fidl::Error>>
949 + Send;
950 fn r#read_config8(&self, offset: u16) -> Self::ReadConfig8ResponseFut;
951 type ReadConfig16ResponseFut: std::future::Future<Output = Result<DeviceReadConfig16Result, fidl::Error>>
952 + Send;
953 fn r#read_config16(&self, offset: u16) -> Self::ReadConfig16ResponseFut;
954 type ReadConfig32ResponseFut: std::future::Future<Output = Result<DeviceReadConfig32Result, fidl::Error>>
955 + Send;
956 fn r#read_config32(&self, offset: u16) -> Self::ReadConfig32ResponseFut;
957 type WriteConfig8ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig8Result, fidl::Error>>
958 + Send;
959 fn r#write_config8(&self, offset: u16, value: u8) -> Self::WriteConfig8ResponseFut;
960 type WriteConfig16ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig16Result, fidl::Error>>
961 + Send;
962 fn r#write_config16(&self, offset: u16, value: u16) -> Self::WriteConfig16ResponseFut;
963 type WriteConfig32ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig32Result, fidl::Error>>
964 + Send;
965 fn r#write_config32(&self, offset: u16, value: u32) -> Self::WriteConfig32ResponseFut;
966 type GetCapabilitiesResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>>
967 + Send;
968 fn r#get_capabilities(&self, id: CapabilityId) -> Self::GetCapabilitiesResponseFut;
969 type GetExtendedCapabilitiesResponseFut: std::future::Future<Output = Result<Vec<u16>, fidl::Error>>
970 + Send;
971 fn r#get_extended_capabilities(
972 &self,
973 id: ExtendedCapabilityId,
974 ) -> Self::GetExtendedCapabilitiesResponseFut;
975 type GetBtiResponseFut: std::future::Future<Output = Result<DeviceGetBtiResult, fidl::Error>>
976 + Send;
977 fn r#get_bti(&self, index: u32) -> Self::GetBtiResponseFut;
978}
979#[derive(Debug)]
980#[cfg(target_os = "fuchsia")]
981pub struct DeviceSynchronousProxy {
982 client: fidl::client::sync::Client,
983}
984
985#[cfg(target_os = "fuchsia")]
986impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
987 type Proxy = DeviceProxy;
988 type Protocol = DeviceMarker;
989
990 fn from_channel(inner: fidl::Channel) -> Self {
991 Self::new(inner)
992 }
993
994 fn into_channel(self) -> fidl::Channel {
995 self.client.into_channel()
996 }
997
998 fn as_channel(&self) -> &fidl::Channel {
999 self.client.as_channel()
1000 }
1001}
1002
1003#[cfg(target_os = "fuchsia")]
1004impl DeviceSynchronousProxy {
1005 pub fn new(channel: fidl::Channel) -> Self {
1006 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1007 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1008 }
1009
1010 pub fn into_channel(self) -> fidl::Channel {
1011 self.client.into_channel()
1012 }
1013
1014 pub fn wait_for_event(
1017 &self,
1018 deadline: zx::MonotonicInstant,
1019 ) -> Result<DeviceEvent, fidl::Error> {
1020 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
1021 }
1022
1023 pub fn r#get_device_info(
1025 &self,
1026 ___deadline: zx::MonotonicInstant,
1027 ) -> Result<DeviceInfo, fidl::Error> {
1028 let _response =
1029 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceInfoResponse>(
1030 (),
1031 0x5599d144d4329916,
1032 fidl::encoding::DynamicFlags::empty(),
1033 ___deadline,
1034 )?;
1035 Ok(_response.info)
1036 }
1037
1038 pub fn r#get_bar(
1052 &self,
1053 mut bar_id: u32,
1054 ___deadline: zx::MonotonicInstant,
1055 ) -> Result<DeviceGetBarResult, fidl::Error> {
1056 let _response = self.client.send_query::<
1057 DeviceGetBarRequest,
1058 fidl::encoding::ResultType<DeviceGetBarResponse, i32>,
1059 >(
1060 (bar_id,),
1061 0x6b2683f6fbbff679,
1062 fidl::encoding::DynamicFlags::empty(),
1063 ___deadline,
1064 )?;
1065 Ok(_response.map(|x| x.result))
1066 }
1067
1068 pub fn r#set_bus_mastering(
1076 &self,
1077 mut enabled: bool,
1078 ___deadline: zx::MonotonicInstant,
1079 ) -> Result<DeviceSetBusMasteringResult, fidl::Error> {
1080 let _response = self.client.send_query::<
1081 DeviceSetBusMasteringRequest,
1082 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1083 >(
1084 (enabled,),
1085 0x3421e9e030211003,
1086 fidl::encoding::DynamicFlags::empty(),
1087 ___deadline,
1088 )?;
1089 Ok(_response.map(|x| x))
1090 }
1091
1092 pub fn r#reset_device(
1103 &self,
1104 ___deadline: zx::MonotonicInstant,
1105 ) -> Result<DeviceResetDeviceResult, fidl::Error> {
1106 let _response = self.client.send_query::<
1107 fidl::encoding::EmptyPayload,
1108 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1109 >(
1110 (),
1111 0x3c5b7579bb6f8b9f,
1112 fidl::encoding::DynamicFlags::empty(),
1113 ___deadline,
1114 )?;
1115 Ok(_response.map(|x| x))
1116 }
1117
1118 pub fn r#ack_interrupt(
1125 &self,
1126 ___deadline: zx::MonotonicInstant,
1127 ) -> Result<DeviceAckInterruptResult, fidl::Error> {
1128 let _response = self.client.send_query::<
1129 fidl::encoding::EmptyPayload,
1130 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1131 >(
1132 (),
1133 0x70742f64692d5a6b,
1134 fidl::encoding::DynamicFlags::empty(),
1135 ___deadline,
1136 )?;
1137 Ok(_response.map(|x| x))
1138 }
1139
1140 pub fn r#map_interrupt(
1159 &self,
1160 mut which_irq: u32,
1161 ___deadline: zx::MonotonicInstant,
1162 ) -> Result<DeviceMapInterruptResult, fidl::Error> {
1163 let _response = self.client.send_query::<
1164 DeviceMapInterruptRequest,
1165 fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>,
1166 >(
1167 (which_irq,),
1168 0x25eeff9d34a1fa13,
1169 fidl::encoding::DynamicFlags::empty(),
1170 ___deadline,
1171 )?;
1172 Ok(_response.map(|x| x.interrupt))
1173 }
1174
1175 pub fn r#get_interrupt_modes(
1177 &self,
1178 ___deadline: zx::MonotonicInstant,
1179 ) -> Result<InterruptModes, fidl::Error> {
1180 let _response = self
1181 .client
1182 .send_query::<fidl::encoding::EmptyPayload, DeviceGetInterruptModesResponse>(
1183 (),
1184 0x93f4cd8f79e9f4a,
1185 fidl::encoding::DynamicFlags::empty(),
1186 ___deadline,
1187 )?;
1188 Ok(_response.modes)
1189 }
1190
1191 pub fn r#set_interrupt_mode(
1205 &self,
1206 mut mode: InterruptMode,
1207 mut requested_irq_count: u32,
1208 ___deadline: zx::MonotonicInstant,
1209 ) -> Result<DeviceSetInterruptModeResult, fidl::Error> {
1210 let _response = self.client.send_query::<
1211 DeviceSetInterruptModeRequest,
1212 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1213 >(
1214 (mode, requested_irq_count,),
1215 0x85bebad3eb24866,
1216 fidl::encoding::DynamicFlags::empty(),
1217 ___deadline,
1218 )?;
1219 Ok(_response.map(|x| x))
1220 }
1221
1222 pub fn r#read_config8(
1232 &self,
1233 mut offset: u16,
1234 ___deadline: zx::MonotonicInstant,
1235 ) -> Result<DeviceReadConfig8Result, fidl::Error> {
1236 let _response = self.client.send_query::<
1237 DeviceReadConfig8Request,
1238 fidl::encoding::ResultType<DeviceReadConfig8Response, i32>,
1239 >(
1240 (offset,),
1241 0x28f9eb9e6dadda1c,
1242 fidl::encoding::DynamicFlags::empty(),
1243 ___deadline,
1244 )?;
1245 Ok(_response.map(|x| x.value))
1246 }
1247
1248 pub fn r#read_config16(
1258 &self,
1259 mut offset: u16,
1260 ___deadline: zx::MonotonicInstant,
1261 ) -> Result<DeviceReadConfig16Result, fidl::Error> {
1262 let _response = self.client.send_query::<
1263 DeviceReadConfig16Request,
1264 fidl::encoding::ResultType<DeviceReadConfig16Response, i32>,
1265 >(
1266 (offset,),
1267 0x3bcda6171a3270bb,
1268 fidl::encoding::DynamicFlags::empty(),
1269 ___deadline,
1270 )?;
1271 Ok(_response.map(|x| x.value))
1272 }
1273
1274 pub fn r#read_config32(
1284 &self,
1285 mut offset: u16,
1286 ___deadline: zx::MonotonicInstant,
1287 ) -> Result<DeviceReadConfig32Result, fidl::Error> {
1288 let _response = self.client.send_query::<
1289 DeviceReadConfig32Request,
1290 fidl::encoding::ResultType<DeviceReadConfig32Response, i32>,
1291 >(
1292 (offset,),
1293 0x55357535402f7507,
1294 fidl::encoding::DynamicFlags::empty(),
1295 ___deadline,
1296 )?;
1297 Ok(_response.map(|x| x.value))
1298 }
1299
1300 pub fn r#write_config8(
1313 &self,
1314 mut offset: u16,
1315 mut value: u8,
1316 ___deadline: zx::MonotonicInstant,
1317 ) -> Result<DeviceWriteConfig8Result, fidl::Error> {
1318 let _response = self.client.send_query::<
1319 DeviceWriteConfig8Request,
1320 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1321 >(
1322 (offset, value,),
1323 0x49a0719e1433cff,
1324 fidl::encoding::DynamicFlags::empty(),
1325 ___deadline,
1326 )?;
1327 Ok(_response.map(|x| x))
1328 }
1329
1330 pub fn r#write_config16(
1343 &self,
1344 mut offset: u16,
1345 mut value: u16,
1346 ___deadline: zx::MonotonicInstant,
1347 ) -> Result<DeviceWriteConfig16Result, fidl::Error> {
1348 let _response = self.client.send_query::<
1349 DeviceWriteConfig16Request,
1350 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1351 >(
1352 (offset, value,),
1353 0x3e30bf13f1c07eff,
1354 fidl::encoding::DynamicFlags::empty(),
1355 ___deadline,
1356 )?;
1357 Ok(_response.map(|x| x))
1358 }
1359
1360 pub fn r#write_config32(
1373 &self,
1374 mut offset: u16,
1375 mut value: u32,
1376 ___deadline: zx::MonotonicInstant,
1377 ) -> Result<DeviceWriteConfig32Result, fidl::Error> {
1378 let _response = self.client.send_query::<
1379 DeviceWriteConfig32Request,
1380 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1381 >(
1382 (offset, value,),
1383 0x161584e5199b388,
1384 fidl::encoding::DynamicFlags::empty(),
1385 ___deadline,
1386 )?;
1387 Ok(_response.map(|x| x))
1388 }
1389
1390 pub fn r#get_capabilities(
1397 &self,
1398 mut id: CapabilityId,
1399 ___deadline: zx::MonotonicInstant,
1400 ) -> Result<Vec<u8>, fidl::Error> {
1401 let _response =
1402 self.client.send_query::<DeviceGetCapabilitiesRequest, DeviceGetCapabilitiesResponse>(
1403 (id,),
1404 0x3a050fde46f3ba0f,
1405 fidl::encoding::DynamicFlags::empty(),
1406 ___deadline,
1407 )?;
1408 Ok(_response.offsets)
1409 }
1410
1411 pub fn r#get_extended_capabilities(
1418 &self,
1419 mut id: ExtendedCapabilityId,
1420 ___deadline: zx::MonotonicInstant,
1421 ) -> Result<Vec<u16>, fidl::Error> {
1422 let _response = self.client.send_query::<
1423 DeviceGetExtendedCapabilitiesRequest,
1424 DeviceGetExtendedCapabilitiesResponse,
1425 >(
1426 (id,),
1427 0xb8573efcaae0c39,
1428 fidl::encoding::DynamicFlags::empty(),
1429 ___deadline,
1430 )?;
1431 Ok(_response.offsets)
1432 }
1433
1434 pub fn r#get_bti(
1442 &self,
1443 mut index: u32,
1444 ___deadline: zx::MonotonicInstant,
1445 ) -> Result<DeviceGetBtiResult, fidl::Error> {
1446 let _response = self.client.send_query::<
1447 DeviceGetBtiRequest,
1448 fidl::encoding::ResultType<DeviceGetBtiResponse, i32>,
1449 >(
1450 (index,),
1451 0x5e4fe9efb12d9ee3,
1452 fidl::encoding::DynamicFlags::empty(),
1453 ___deadline,
1454 )?;
1455 Ok(_response.map(|x| x.bti))
1456 }
1457}
1458
1459#[cfg(target_os = "fuchsia")]
1460impl From<DeviceSynchronousProxy> for zx::Handle {
1461 fn from(value: DeviceSynchronousProxy) -> Self {
1462 value.into_channel().into()
1463 }
1464}
1465
1466#[cfg(target_os = "fuchsia")]
1467impl From<fidl::Channel> for DeviceSynchronousProxy {
1468 fn from(value: fidl::Channel) -> Self {
1469 Self::new(value)
1470 }
1471}
1472
1473#[derive(Debug, Clone)]
1474pub struct DeviceProxy {
1475 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1476}
1477
1478impl fidl::endpoints::Proxy for DeviceProxy {
1479 type Protocol = DeviceMarker;
1480
1481 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1482 Self::new(inner)
1483 }
1484
1485 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1486 self.client.into_channel().map_err(|client| Self { client })
1487 }
1488
1489 fn as_channel(&self) -> &::fidl::AsyncChannel {
1490 self.client.as_channel()
1491 }
1492}
1493
1494impl DeviceProxy {
1495 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1497 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1498 Self { client: fidl::client::Client::new(channel, protocol_name) }
1499 }
1500
1501 pub fn take_event_stream(&self) -> DeviceEventStream {
1507 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
1508 }
1509
1510 pub fn r#get_device_info(
1512 &self,
1513 ) -> fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1514 {
1515 DeviceProxyInterface::r#get_device_info(self)
1516 }
1517
1518 pub fn r#get_bar(
1532 &self,
1533 mut bar_id: u32,
1534 ) -> fidl::client::QueryResponseFut<
1535 DeviceGetBarResult,
1536 fidl::encoding::DefaultFuchsiaResourceDialect,
1537 > {
1538 DeviceProxyInterface::r#get_bar(self, bar_id)
1539 }
1540
1541 pub fn r#set_bus_mastering(
1549 &self,
1550 mut enabled: bool,
1551 ) -> fidl::client::QueryResponseFut<
1552 DeviceSetBusMasteringResult,
1553 fidl::encoding::DefaultFuchsiaResourceDialect,
1554 > {
1555 DeviceProxyInterface::r#set_bus_mastering(self, enabled)
1556 }
1557
1558 pub fn r#reset_device(
1569 &self,
1570 ) -> fidl::client::QueryResponseFut<
1571 DeviceResetDeviceResult,
1572 fidl::encoding::DefaultFuchsiaResourceDialect,
1573 > {
1574 DeviceProxyInterface::r#reset_device(self)
1575 }
1576
1577 pub fn r#ack_interrupt(
1584 &self,
1585 ) -> fidl::client::QueryResponseFut<
1586 DeviceAckInterruptResult,
1587 fidl::encoding::DefaultFuchsiaResourceDialect,
1588 > {
1589 DeviceProxyInterface::r#ack_interrupt(self)
1590 }
1591
1592 pub fn r#map_interrupt(
1611 &self,
1612 mut which_irq: u32,
1613 ) -> fidl::client::QueryResponseFut<
1614 DeviceMapInterruptResult,
1615 fidl::encoding::DefaultFuchsiaResourceDialect,
1616 > {
1617 DeviceProxyInterface::r#map_interrupt(self, which_irq)
1618 }
1619
1620 pub fn r#get_interrupt_modes(
1622 &self,
1623 ) -> fidl::client::QueryResponseFut<InterruptModes, fidl::encoding::DefaultFuchsiaResourceDialect>
1624 {
1625 DeviceProxyInterface::r#get_interrupt_modes(self)
1626 }
1627
1628 pub fn r#set_interrupt_mode(
1642 &self,
1643 mut mode: InterruptMode,
1644 mut requested_irq_count: u32,
1645 ) -> fidl::client::QueryResponseFut<
1646 DeviceSetInterruptModeResult,
1647 fidl::encoding::DefaultFuchsiaResourceDialect,
1648 > {
1649 DeviceProxyInterface::r#set_interrupt_mode(self, mode, requested_irq_count)
1650 }
1651
1652 pub fn r#read_config8(
1662 &self,
1663 mut offset: u16,
1664 ) -> fidl::client::QueryResponseFut<
1665 DeviceReadConfig8Result,
1666 fidl::encoding::DefaultFuchsiaResourceDialect,
1667 > {
1668 DeviceProxyInterface::r#read_config8(self, offset)
1669 }
1670
1671 pub fn r#read_config16(
1681 &self,
1682 mut offset: u16,
1683 ) -> fidl::client::QueryResponseFut<
1684 DeviceReadConfig16Result,
1685 fidl::encoding::DefaultFuchsiaResourceDialect,
1686 > {
1687 DeviceProxyInterface::r#read_config16(self, offset)
1688 }
1689
1690 pub fn r#read_config32(
1700 &self,
1701 mut offset: u16,
1702 ) -> fidl::client::QueryResponseFut<
1703 DeviceReadConfig32Result,
1704 fidl::encoding::DefaultFuchsiaResourceDialect,
1705 > {
1706 DeviceProxyInterface::r#read_config32(self, offset)
1707 }
1708
1709 pub fn r#write_config8(
1722 &self,
1723 mut offset: u16,
1724 mut value: u8,
1725 ) -> fidl::client::QueryResponseFut<
1726 DeviceWriteConfig8Result,
1727 fidl::encoding::DefaultFuchsiaResourceDialect,
1728 > {
1729 DeviceProxyInterface::r#write_config8(self, offset, value)
1730 }
1731
1732 pub fn r#write_config16(
1745 &self,
1746 mut offset: u16,
1747 mut value: u16,
1748 ) -> fidl::client::QueryResponseFut<
1749 DeviceWriteConfig16Result,
1750 fidl::encoding::DefaultFuchsiaResourceDialect,
1751 > {
1752 DeviceProxyInterface::r#write_config16(self, offset, value)
1753 }
1754
1755 pub fn r#write_config32(
1768 &self,
1769 mut offset: u16,
1770 mut value: u32,
1771 ) -> fidl::client::QueryResponseFut<
1772 DeviceWriteConfig32Result,
1773 fidl::encoding::DefaultFuchsiaResourceDialect,
1774 > {
1775 DeviceProxyInterface::r#write_config32(self, offset, value)
1776 }
1777
1778 pub fn r#get_capabilities(
1785 &self,
1786 mut id: CapabilityId,
1787 ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
1788 {
1789 DeviceProxyInterface::r#get_capabilities(self, id)
1790 }
1791
1792 pub fn r#get_extended_capabilities(
1799 &self,
1800 mut id: ExtendedCapabilityId,
1801 ) -> fidl::client::QueryResponseFut<Vec<u16>, fidl::encoding::DefaultFuchsiaResourceDialect>
1802 {
1803 DeviceProxyInterface::r#get_extended_capabilities(self, id)
1804 }
1805
1806 pub fn r#get_bti(
1814 &self,
1815 mut index: u32,
1816 ) -> fidl::client::QueryResponseFut<
1817 DeviceGetBtiResult,
1818 fidl::encoding::DefaultFuchsiaResourceDialect,
1819 > {
1820 DeviceProxyInterface::r#get_bti(self, index)
1821 }
1822}
1823
1824impl DeviceProxyInterface for DeviceProxy {
1825 type GetDeviceInfoResponseFut =
1826 fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
1827 fn r#get_device_info(&self) -> Self::GetDeviceInfoResponseFut {
1828 fn _decode(
1829 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1830 ) -> Result<DeviceInfo, fidl::Error> {
1831 let _response = fidl::client::decode_transaction_body::<
1832 DeviceGetDeviceInfoResponse,
1833 fidl::encoding::DefaultFuchsiaResourceDialect,
1834 0x5599d144d4329916,
1835 >(_buf?)?;
1836 Ok(_response.info)
1837 }
1838 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
1839 (),
1840 0x5599d144d4329916,
1841 fidl::encoding::DynamicFlags::empty(),
1842 _decode,
1843 )
1844 }
1845
1846 type GetBarResponseFut = fidl::client::QueryResponseFut<
1847 DeviceGetBarResult,
1848 fidl::encoding::DefaultFuchsiaResourceDialect,
1849 >;
1850 fn r#get_bar(&self, mut bar_id: u32) -> Self::GetBarResponseFut {
1851 fn _decode(
1852 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1853 ) -> Result<DeviceGetBarResult, fidl::Error> {
1854 let _response = fidl::client::decode_transaction_body::<
1855 fidl::encoding::ResultType<DeviceGetBarResponse, i32>,
1856 fidl::encoding::DefaultFuchsiaResourceDialect,
1857 0x6b2683f6fbbff679,
1858 >(_buf?)?;
1859 Ok(_response.map(|x| x.result))
1860 }
1861 self.client.send_query_and_decode::<DeviceGetBarRequest, DeviceGetBarResult>(
1862 (bar_id,),
1863 0x6b2683f6fbbff679,
1864 fidl::encoding::DynamicFlags::empty(),
1865 _decode,
1866 )
1867 }
1868
1869 type SetBusMasteringResponseFut = fidl::client::QueryResponseFut<
1870 DeviceSetBusMasteringResult,
1871 fidl::encoding::DefaultFuchsiaResourceDialect,
1872 >;
1873 fn r#set_bus_mastering(&self, mut enabled: bool) -> Self::SetBusMasteringResponseFut {
1874 fn _decode(
1875 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1876 ) -> Result<DeviceSetBusMasteringResult, fidl::Error> {
1877 let _response = fidl::client::decode_transaction_body::<
1878 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1879 fidl::encoding::DefaultFuchsiaResourceDialect,
1880 0x3421e9e030211003,
1881 >(_buf?)?;
1882 Ok(_response.map(|x| x))
1883 }
1884 self.client
1885 .send_query_and_decode::<DeviceSetBusMasteringRequest, DeviceSetBusMasteringResult>(
1886 (enabled,),
1887 0x3421e9e030211003,
1888 fidl::encoding::DynamicFlags::empty(),
1889 _decode,
1890 )
1891 }
1892
1893 type ResetDeviceResponseFut = fidl::client::QueryResponseFut<
1894 DeviceResetDeviceResult,
1895 fidl::encoding::DefaultFuchsiaResourceDialect,
1896 >;
1897 fn r#reset_device(&self) -> Self::ResetDeviceResponseFut {
1898 fn _decode(
1899 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1900 ) -> Result<DeviceResetDeviceResult, fidl::Error> {
1901 let _response = fidl::client::decode_transaction_body::<
1902 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1903 fidl::encoding::DefaultFuchsiaResourceDialect,
1904 0x3c5b7579bb6f8b9f,
1905 >(_buf?)?;
1906 Ok(_response.map(|x| x))
1907 }
1908 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceResetDeviceResult>(
1909 (),
1910 0x3c5b7579bb6f8b9f,
1911 fidl::encoding::DynamicFlags::empty(),
1912 _decode,
1913 )
1914 }
1915
1916 type AckInterruptResponseFut = fidl::client::QueryResponseFut<
1917 DeviceAckInterruptResult,
1918 fidl::encoding::DefaultFuchsiaResourceDialect,
1919 >;
1920 fn r#ack_interrupt(&self) -> Self::AckInterruptResponseFut {
1921 fn _decode(
1922 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1923 ) -> Result<DeviceAckInterruptResult, fidl::Error> {
1924 let _response = fidl::client::decode_transaction_body::<
1925 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1926 fidl::encoding::DefaultFuchsiaResourceDialect,
1927 0x70742f64692d5a6b,
1928 >(_buf?)?;
1929 Ok(_response.map(|x| x))
1930 }
1931 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceAckInterruptResult>(
1932 (),
1933 0x70742f64692d5a6b,
1934 fidl::encoding::DynamicFlags::empty(),
1935 _decode,
1936 )
1937 }
1938
1939 type MapInterruptResponseFut = fidl::client::QueryResponseFut<
1940 DeviceMapInterruptResult,
1941 fidl::encoding::DefaultFuchsiaResourceDialect,
1942 >;
1943 fn r#map_interrupt(&self, mut which_irq: u32) -> Self::MapInterruptResponseFut {
1944 fn _decode(
1945 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1946 ) -> Result<DeviceMapInterruptResult, fidl::Error> {
1947 let _response = fidl::client::decode_transaction_body::<
1948 fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>,
1949 fidl::encoding::DefaultFuchsiaResourceDialect,
1950 0x25eeff9d34a1fa13,
1951 >(_buf?)?;
1952 Ok(_response.map(|x| x.interrupt))
1953 }
1954 self.client.send_query_and_decode::<DeviceMapInterruptRequest, DeviceMapInterruptResult>(
1955 (which_irq,),
1956 0x25eeff9d34a1fa13,
1957 fidl::encoding::DynamicFlags::empty(),
1958 _decode,
1959 )
1960 }
1961
1962 type GetInterruptModesResponseFut = fidl::client::QueryResponseFut<
1963 InterruptModes,
1964 fidl::encoding::DefaultFuchsiaResourceDialect,
1965 >;
1966 fn r#get_interrupt_modes(&self) -> Self::GetInterruptModesResponseFut {
1967 fn _decode(
1968 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1969 ) -> Result<InterruptModes, fidl::Error> {
1970 let _response = fidl::client::decode_transaction_body::<
1971 DeviceGetInterruptModesResponse,
1972 fidl::encoding::DefaultFuchsiaResourceDialect,
1973 0x93f4cd8f79e9f4a,
1974 >(_buf?)?;
1975 Ok(_response.modes)
1976 }
1977 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InterruptModes>(
1978 (),
1979 0x93f4cd8f79e9f4a,
1980 fidl::encoding::DynamicFlags::empty(),
1981 _decode,
1982 )
1983 }
1984
1985 type SetInterruptModeResponseFut = fidl::client::QueryResponseFut<
1986 DeviceSetInterruptModeResult,
1987 fidl::encoding::DefaultFuchsiaResourceDialect,
1988 >;
1989 fn r#set_interrupt_mode(
1990 &self,
1991 mut mode: InterruptMode,
1992 mut requested_irq_count: u32,
1993 ) -> Self::SetInterruptModeResponseFut {
1994 fn _decode(
1995 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1996 ) -> Result<DeviceSetInterruptModeResult, fidl::Error> {
1997 let _response = fidl::client::decode_transaction_body::<
1998 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1999 fidl::encoding::DefaultFuchsiaResourceDialect,
2000 0x85bebad3eb24866,
2001 >(_buf?)?;
2002 Ok(_response.map(|x| x))
2003 }
2004 self.client
2005 .send_query_and_decode::<DeviceSetInterruptModeRequest, DeviceSetInterruptModeResult>(
2006 (mode, requested_irq_count),
2007 0x85bebad3eb24866,
2008 fidl::encoding::DynamicFlags::empty(),
2009 _decode,
2010 )
2011 }
2012
2013 type ReadConfig8ResponseFut = fidl::client::QueryResponseFut<
2014 DeviceReadConfig8Result,
2015 fidl::encoding::DefaultFuchsiaResourceDialect,
2016 >;
2017 fn r#read_config8(&self, mut offset: u16) -> Self::ReadConfig8ResponseFut {
2018 fn _decode(
2019 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2020 ) -> Result<DeviceReadConfig8Result, fidl::Error> {
2021 let _response = fidl::client::decode_transaction_body::<
2022 fidl::encoding::ResultType<DeviceReadConfig8Response, i32>,
2023 fidl::encoding::DefaultFuchsiaResourceDialect,
2024 0x28f9eb9e6dadda1c,
2025 >(_buf?)?;
2026 Ok(_response.map(|x| x.value))
2027 }
2028 self.client.send_query_and_decode::<DeviceReadConfig8Request, DeviceReadConfig8Result>(
2029 (offset,),
2030 0x28f9eb9e6dadda1c,
2031 fidl::encoding::DynamicFlags::empty(),
2032 _decode,
2033 )
2034 }
2035
2036 type ReadConfig16ResponseFut = fidl::client::QueryResponseFut<
2037 DeviceReadConfig16Result,
2038 fidl::encoding::DefaultFuchsiaResourceDialect,
2039 >;
2040 fn r#read_config16(&self, mut offset: u16) -> Self::ReadConfig16ResponseFut {
2041 fn _decode(
2042 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2043 ) -> Result<DeviceReadConfig16Result, fidl::Error> {
2044 let _response = fidl::client::decode_transaction_body::<
2045 fidl::encoding::ResultType<DeviceReadConfig16Response, i32>,
2046 fidl::encoding::DefaultFuchsiaResourceDialect,
2047 0x3bcda6171a3270bb,
2048 >(_buf?)?;
2049 Ok(_response.map(|x| x.value))
2050 }
2051 self.client.send_query_and_decode::<DeviceReadConfig16Request, DeviceReadConfig16Result>(
2052 (offset,),
2053 0x3bcda6171a3270bb,
2054 fidl::encoding::DynamicFlags::empty(),
2055 _decode,
2056 )
2057 }
2058
2059 type ReadConfig32ResponseFut = fidl::client::QueryResponseFut<
2060 DeviceReadConfig32Result,
2061 fidl::encoding::DefaultFuchsiaResourceDialect,
2062 >;
2063 fn r#read_config32(&self, mut offset: u16) -> Self::ReadConfig32ResponseFut {
2064 fn _decode(
2065 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2066 ) -> Result<DeviceReadConfig32Result, fidl::Error> {
2067 let _response = fidl::client::decode_transaction_body::<
2068 fidl::encoding::ResultType<DeviceReadConfig32Response, i32>,
2069 fidl::encoding::DefaultFuchsiaResourceDialect,
2070 0x55357535402f7507,
2071 >(_buf?)?;
2072 Ok(_response.map(|x| x.value))
2073 }
2074 self.client.send_query_and_decode::<DeviceReadConfig32Request, DeviceReadConfig32Result>(
2075 (offset,),
2076 0x55357535402f7507,
2077 fidl::encoding::DynamicFlags::empty(),
2078 _decode,
2079 )
2080 }
2081
2082 type WriteConfig8ResponseFut = fidl::client::QueryResponseFut<
2083 DeviceWriteConfig8Result,
2084 fidl::encoding::DefaultFuchsiaResourceDialect,
2085 >;
2086 fn r#write_config8(&self, mut offset: u16, mut value: u8) -> Self::WriteConfig8ResponseFut {
2087 fn _decode(
2088 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2089 ) -> Result<DeviceWriteConfig8Result, fidl::Error> {
2090 let _response = fidl::client::decode_transaction_body::<
2091 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2092 fidl::encoding::DefaultFuchsiaResourceDialect,
2093 0x49a0719e1433cff,
2094 >(_buf?)?;
2095 Ok(_response.map(|x| x))
2096 }
2097 self.client.send_query_and_decode::<DeviceWriteConfig8Request, DeviceWriteConfig8Result>(
2098 (offset, value),
2099 0x49a0719e1433cff,
2100 fidl::encoding::DynamicFlags::empty(),
2101 _decode,
2102 )
2103 }
2104
2105 type WriteConfig16ResponseFut = fidl::client::QueryResponseFut<
2106 DeviceWriteConfig16Result,
2107 fidl::encoding::DefaultFuchsiaResourceDialect,
2108 >;
2109 fn r#write_config16(&self, mut offset: u16, mut value: u16) -> Self::WriteConfig16ResponseFut {
2110 fn _decode(
2111 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2112 ) -> Result<DeviceWriteConfig16Result, fidl::Error> {
2113 let _response = fidl::client::decode_transaction_body::<
2114 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2115 fidl::encoding::DefaultFuchsiaResourceDialect,
2116 0x3e30bf13f1c07eff,
2117 >(_buf?)?;
2118 Ok(_response.map(|x| x))
2119 }
2120 self.client.send_query_and_decode::<DeviceWriteConfig16Request, DeviceWriteConfig16Result>(
2121 (offset, value),
2122 0x3e30bf13f1c07eff,
2123 fidl::encoding::DynamicFlags::empty(),
2124 _decode,
2125 )
2126 }
2127
2128 type WriteConfig32ResponseFut = fidl::client::QueryResponseFut<
2129 DeviceWriteConfig32Result,
2130 fidl::encoding::DefaultFuchsiaResourceDialect,
2131 >;
2132 fn r#write_config32(&self, mut offset: u16, mut value: u32) -> Self::WriteConfig32ResponseFut {
2133 fn _decode(
2134 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2135 ) -> Result<DeviceWriteConfig32Result, fidl::Error> {
2136 let _response = fidl::client::decode_transaction_body::<
2137 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2138 fidl::encoding::DefaultFuchsiaResourceDialect,
2139 0x161584e5199b388,
2140 >(_buf?)?;
2141 Ok(_response.map(|x| x))
2142 }
2143 self.client.send_query_and_decode::<DeviceWriteConfig32Request, DeviceWriteConfig32Result>(
2144 (offset, value),
2145 0x161584e5199b388,
2146 fidl::encoding::DynamicFlags::empty(),
2147 _decode,
2148 )
2149 }
2150
2151 type GetCapabilitiesResponseFut =
2152 fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2153 fn r#get_capabilities(&self, mut id: CapabilityId) -> Self::GetCapabilitiesResponseFut {
2154 fn _decode(
2155 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2156 ) -> Result<Vec<u8>, fidl::Error> {
2157 let _response = fidl::client::decode_transaction_body::<
2158 DeviceGetCapabilitiesResponse,
2159 fidl::encoding::DefaultFuchsiaResourceDialect,
2160 0x3a050fde46f3ba0f,
2161 >(_buf?)?;
2162 Ok(_response.offsets)
2163 }
2164 self.client.send_query_and_decode::<DeviceGetCapabilitiesRequest, Vec<u8>>(
2165 (id,),
2166 0x3a050fde46f3ba0f,
2167 fidl::encoding::DynamicFlags::empty(),
2168 _decode,
2169 )
2170 }
2171
2172 type GetExtendedCapabilitiesResponseFut =
2173 fidl::client::QueryResponseFut<Vec<u16>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2174 fn r#get_extended_capabilities(
2175 &self,
2176 mut id: ExtendedCapabilityId,
2177 ) -> Self::GetExtendedCapabilitiesResponseFut {
2178 fn _decode(
2179 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2180 ) -> Result<Vec<u16>, fidl::Error> {
2181 let _response = fidl::client::decode_transaction_body::<
2182 DeviceGetExtendedCapabilitiesResponse,
2183 fidl::encoding::DefaultFuchsiaResourceDialect,
2184 0xb8573efcaae0c39,
2185 >(_buf?)?;
2186 Ok(_response.offsets)
2187 }
2188 self.client.send_query_and_decode::<DeviceGetExtendedCapabilitiesRequest, Vec<u16>>(
2189 (id,),
2190 0xb8573efcaae0c39,
2191 fidl::encoding::DynamicFlags::empty(),
2192 _decode,
2193 )
2194 }
2195
2196 type GetBtiResponseFut = fidl::client::QueryResponseFut<
2197 DeviceGetBtiResult,
2198 fidl::encoding::DefaultFuchsiaResourceDialect,
2199 >;
2200 fn r#get_bti(&self, mut index: u32) -> Self::GetBtiResponseFut {
2201 fn _decode(
2202 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2203 ) -> Result<DeviceGetBtiResult, fidl::Error> {
2204 let _response = fidl::client::decode_transaction_body::<
2205 fidl::encoding::ResultType<DeviceGetBtiResponse, i32>,
2206 fidl::encoding::DefaultFuchsiaResourceDialect,
2207 0x5e4fe9efb12d9ee3,
2208 >(_buf?)?;
2209 Ok(_response.map(|x| x.bti))
2210 }
2211 self.client.send_query_and_decode::<DeviceGetBtiRequest, DeviceGetBtiResult>(
2212 (index,),
2213 0x5e4fe9efb12d9ee3,
2214 fidl::encoding::DynamicFlags::empty(),
2215 _decode,
2216 )
2217 }
2218}
2219
2220pub struct DeviceEventStream {
2221 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2222}
2223
2224impl std::marker::Unpin for DeviceEventStream {}
2225
2226impl futures::stream::FusedStream for DeviceEventStream {
2227 fn is_terminated(&self) -> bool {
2228 self.event_receiver.is_terminated()
2229 }
2230}
2231
2232impl futures::Stream for DeviceEventStream {
2233 type Item = Result<DeviceEvent, fidl::Error>;
2234
2235 fn poll_next(
2236 mut self: std::pin::Pin<&mut Self>,
2237 cx: &mut std::task::Context<'_>,
2238 ) -> std::task::Poll<Option<Self::Item>> {
2239 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2240 &mut self.event_receiver,
2241 cx
2242 )?) {
2243 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
2244 None => std::task::Poll::Ready(None),
2245 }
2246 }
2247}
2248
2249#[derive(Debug)]
2250pub enum DeviceEvent {}
2251
2252impl DeviceEvent {
2253 fn decode(
2255 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2256 ) -> Result<DeviceEvent, fidl::Error> {
2257 let (bytes, _handles) = buf.split_mut();
2258 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2259 debug_assert_eq!(tx_header.tx_id, 0);
2260 match tx_header.ordinal {
2261 _ => Err(fidl::Error::UnknownOrdinal {
2262 ordinal: tx_header.ordinal,
2263 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2264 }),
2265 }
2266 }
2267}
2268
2269pub struct DeviceRequestStream {
2271 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2272 is_terminated: bool,
2273}
2274
2275impl std::marker::Unpin for DeviceRequestStream {}
2276
2277impl futures::stream::FusedStream for DeviceRequestStream {
2278 fn is_terminated(&self) -> bool {
2279 self.is_terminated
2280 }
2281}
2282
2283impl fidl::endpoints::RequestStream for DeviceRequestStream {
2284 type Protocol = DeviceMarker;
2285 type ControlHandle = DeviceControlHandle;
2286
2287 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2288 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2289 }
2290
2291 fn control_handle(&self) -> Self::ControlHandle {
2292 DeviceControlHandle { inner: self.inner.clone() }
2293 }
2294
2295 fn into_inner(
2296 self,
2297 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2298 {
2299 (self.inner, self.is_terminated)
2300 }
2301
2302 fn from_inner(
2303 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2304 is_terminated: bool,
2305 ) -> Self {
2306 Self { inner, is_terminated }
2307 }
2308}
2309
2310impl futures::Stream for DeviceRequestStream {
2311 type Item = Result<DeviceRequest, fidl::Error>;
2312
2313 fn poll_next(
2314 mut self: std::pin::Pin<&mut Self>,
2315 cx: &mut std::task::Context<'_>,
2316 ) -> std::task::Poll<Option<Self::Item>> {
2317 let this = &mut *self;
2318 if this.inner.check_shutdown(cx) {
2319 this.is_terminated = true;
2320 return std::task::Poll::Ready(None);
2321 }
2322 if this.is_terminated {
2323 panic!("polled DeviceRequestStream after completion");
2324 }
2325 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2326 |bytes, handles| {
2327 match this.inner.channel().read_etc(cx, bytes, handles) {
2328 std::task::Poll::Ready(Ok(())) => {}
2329 std::task::Poll::Pending => return std::task::Poll::Pending,
2330 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2331 this.is_terminated = true;
2332 return std::task::Poll::Ready(None);
2333 }
2334 std::task::Poll::Ready(Err(e)) => {
2335 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2336 e.into(),
2337 ))))
2338 }
2339 }
2340
2341 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2343
2344 std::task::Poll::Ready(Some(match header.ordinal {
2345 0x5599d144d4329916 => {
2346 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2347 let mut req = fidl::new_empty!(
2348 fidl::encoding::EmptyPayload,
2349 fidl::encoding::DefaultFuchsiaResourceDialect
2350 );
2351 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2352 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2353 Ok(DeviceRequest::GetDeviceInfo {
2354 responder: DeviceGetDeviceInfoResponder {
2355 control_handle: std::mem::ManuallyDrop::new(control_handle),
2356 tx_id: header.tx_id,
2357 },
2358 })
2359 }
2360 0x6b2683f6fbbff679 => {
2361 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2362 let mut req = fidl::new_empty!(
2363 DeviceGetBarRequest,
2364 fidl::encoding::DefaultFuchsiaResourceDialect
2365 );
2366 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBarRequest>(&header, _body_bytes, handles, &mut req)?;
2367 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2368 Ok(DeviceRequest::GetBar {
2369 bar_id: req.bar_id,
2370
2371 responder: DeviceGetBarResponder {
2372 control_handle: std::mem::ManuallyDrop::new(control_handle),
2373 tx_id: header.tx_id,
2374 },
2375 })
2376 }
2377 0x3421e9e030211003 => {
2378 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2379 let mut req = fidl::new_empty!(
2380 DeviceSetBusMasteringRequest,
2381 fidl::encoding::DefaultFuchsiaResourceDialect
2382 );
2383 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetBusMasteringRequest>(&header, _body_bytes, handles, &mut req)?;
2384 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2385 Ok(DeviceRequest::SetBusMastering {
2386 enabled: req.enabled,
2387
2388 responder: DeviceSetBusMasteringResponder {
2389 control_handle: std::mem::ManuallyDrop::new(control_handle),
2390 tx_id: header.tx_id,
2391 },
2392 })
2393 }
2394 0x3c5b7579bb6f8b9f => {
2395 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2396 let mut req = fidl::new_empty!(
2397 fidl::encoding::EmptyPayload,
2398 fidl::encoding::DefaultFuchsiaResourceDialect
2399 );
2400 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2401 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2402 Ok(DeviceRequest::ResetDevice {
2403 responder: DeviceResetDeviceResponder {
2404 control_handle: std::mem::ManuallyDrop::new(control_handle),
2405 tx_id: header.tx_id,
2406 },
2407 })
2408 }
2409 0x70742f64692d5a6b => {
2410 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2411 let mut req = fidl::new_empty!(
2412 fidl::encoding::EmptyPayload,
2413 fidl::encoding::DefaultFuchsiaResourceDialect
2414 );
2415 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2416 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2417 Ok(DeviceRequest::AckInterrupt {
2418 responder: DeviceAckInterruptResponder {
2419 control_handle: std::mem::ManuallyDrop::new(control_handle),
2420 tx_id: header.tx_id,
2421 },
2422 })
2423 }
2424 0x25eeff9d34a1fa13 => {
2425 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2426 let mut req = fidl::new_empty!(
2427 DeviceMapInterruptRequest,
2428 fidl::encoding::DefaultFuchsiaResourceDialect
2429 );
2430 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceMapInterruptRequest>(&header, _body_bytes, handles, &mut req)?;
2431 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2432 Ok(DeviceRequest::MapInterrupt {
2433 which_irq: req.which_irq,
2434
2435 responder: DeviceMapInterruptResponder {
2436 control_handle: std::mem::ManuallyDrop::new(control_handle),
2437 tx_id: header.tx_id,
2438 },
2439 })
2440 }
2441 0x93f4cd8f79e9f4a => {
2442 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2443 let mut req = fidl::new_empty!(
2444 fidl::encoding::EmptyPayload,
2445 fidl::encoding::DefaultFuchsiaResourceDialect
2446 );
2447 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2448 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2449 Ok(DeviceRequest::GetInterruptModes {
2450 responder: DeviceGetInterruptModesResponder {
2451 control_handle: std::mem::ManuallyDrop::new(control_handle),
2452 tx_id: header.tx_id,
2453 },
2454 })
2455 }
2456 0x85bebad3eb24866 => {
2457 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2458 let mut req = fidl::new_empty!(
2459 DeviceSetInterruptModeRequest,
2460 fidl::encoding::DefaultFuchsiaResourceDialect
2461 );
2462 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetInterruptModeRequest>(&header, _body_bytes, handles, &mut req)?;
2463 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2464 Ok(DeviceRequest::SetInterruptMode {
2465 mode: req.mode,
2466 requested_irq_count: req.requested_irq_count,
2467
2468 responder: DeviceSetInterruptModeResponder {
2469 control_handle: std::mem::ManuallyDrop::new(control_handle),
2470 tx_id: header.tx_id,
2471 },
2472 })
2473 }
2474 0x28f9eb9e6dadda1c => {
2475 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2476 let mut req = fidl::new_empty!(
2477 DeviceReadConfig8Request,
2478 fidl::encoding::DefaultFuchsiaResourceDialect
2479 );
2480 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig8Request>(&header, _body_bytes, handles, &mut req)?;
2481 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2482 Ok(DeviceRequest::ReadConfig8 {
2483 offset: req.offset,
2484
2485 responder: DeviceReadConfig8Responder {
2486 control_handle: std::mem::ManuallyDrop::new(control_handle),
2487 tx_id: header.tx_id,
2488 },
2489 })
2490 }
2491 0x3bcda6171a3270bb => {
2492 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2493 let mut req = fidl::new_empty!(
2494 DeviceReadConfig16Request,
2495 fidl::encoding::DefaultFuchsiaResourceDialect
2496 );
2497 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig16Request>(&header, _body_bytes, handles, &mut req)?;
2498 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2499 Ok(DeviceRequest::ReadConfig16 {
2500 offset: req.offset,
2501
2502 responder: DeviceReadConfig16Responder {
2503 control_handle: std::mem::ManuallyDrop::new(control_handle),
2504 tx_id: header.tx_id,
2505 },
2506 })
2507 }
2508 0x55357535402f7507 => {
2509 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2510 let mut req = fidl::new_empty!(
2511 DeviceReadConfig32Request,
2512 fidl::encoding::DefaultFuchsiaResourceDialect
2513 );
2514 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig32Request>(&header, _body_bytes, handles, &mut req)?;
2515 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2516 Ok(DeviceRequest::ReadConfig32 {
2517 offset: req.offset,
2518
2519 responder: DeviceReadConfig32Responder {
2520 control_handle: std::mem::ManuallyDrop::new(control_handle),
2521 tx_id: header.tx_id,
2522 },
2523 })
2524 }
2525 0x49a0719e1433cff => {
2526 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2527 let mut req = fidl::new_empty!(
2528 DeviceWriteConfig8Request,
2529 fidl::encoding::DefaultFuchsiaResourceDialect
2530 );
2531 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig8Request>(&header, _body_bytes, handles, &mut req)?;
2532 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2533 Ok(DeviceRequest::WriteConfig8 {
2534 offset: req.offset,
2535 value: req.value,
2536
2537 responder: DeviceWriteConfig8Responder {
2538 control_handle: std::mem::ManuallyDrop::new(control_handle),
2539 tx_id: header.tx_id,
2540 },
2541 })
2542 }
2543 0x3e30bf13f1c07eff => {
2544 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2545 let mut req = fidl::new_empty!(
2546 DeviceWriteConfig16Request,
2547 fidl::encoding::DefaultFuchsiaResourceDialect
2548 );
2549 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig16Request>(&header, _body_bytes, handles, &mut req)?;
2550 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2551 Ok(DeviceRequest::WriteConfig16 {
2552 offset: req.offset,
2553 value: req.value,
2554
2555 responder: DeviceWriteConfig16Responder {
2556 control_handle: std::mem::ManuallyDrop::new(control_handle),
2557 tx_id: header.tx_id,
2558 },
2559 })
2560 }
2561 0x161584e5199b388 => {
2562 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2563 let mut req = fidl::new_empty!(
2564 DeviceWriteConfig32Request,
2565 fidl::encoding::DefaultFuchsiaResourceDialect
2566 );
2567 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig32Request>(&header, _body_bytes, handles, &mut req)?;
2568 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2569 Ok(DeviceRequest::WriteConfig32 {
2570 offset: req.offset,
2571 value: req.value,
2572
2573 responder: DeviceWriteConfig32Responder {
2574 control_handle: std::mem::ManuallyDrop::new(control_handle),
2575 tx_id: header.tx_id,
2576 },
2577 })
2578 }
2579 0x3a050fde46f3ba0f => {
2580 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2581 let mut req = fidl::new_empty!(
2582 DeviceGetCapabilitiesRequest,
2583 fidl::encoding::DefaultFuchsiaResourceDialect
2584 );
2585 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetCapabilitiesRequest>(&header, _body_bytes, handles, &mut req)?;
2586 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2587 Ok(DeviceRequest::GetCapabilities {
2588 id: req.id,
2589
2590 responder: DeviceGetCapabilitiesResponder {
2591 control_handle: std::mem::ManuallyDrop::new(control_handle),
2592 tx_id: header.tx_id,
2593 },
2594 })
2595 }
2596 0xb8573efcaae0c39 => {
2597 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2598 let mut req = fidl::new_empty!(
2599 DeviceGetExtendedCapabilitiesRequest,
2600 fidl::encoding::DefaultFuchsiaResourceDialect
2601 );
2602 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetExtendedCapabilitiesRequest>(&header, _body_bytes, handles, &mut req)?;
2603 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2604 Ok(DeviceRequest::GetExtendedCapabilities {
2605 id: req.id,
2606
2607 responder: DeviceGetExtendedCapabilitiesResponder {
2608 control_handle: std::mem::ManuallyDrop::new(control_handle),
2609 tx_id: header.tx_id,
2610 },
2611 })
2612 }
2613 0x5e4fe9efb12d9ee3 => {
2614 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2615 let mut req = fidl::new_empty!(
2616 DeviceGetBtiRequest,
2617 fidl::encoding::DefaultFuchsiaResourceDialect
2618 );
2619 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBtiRequest>(&header, _body_bytes, handles, &mut req)?;
2620 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2621 Ok(DeviceRequest::GetBti {
2622 index: req.index,
2623
2624 responder: DeviceGetBtiResponder {
2625 control_handle: std::mem::ManuallyDrop::new(control_handle),
2626 tx_id: header.tx_id,
2627 },
2628 })
2629 }
2630 _ => Err(fidl::Error::UnknownOrdinal {
2631 ordinal: header.ordinal,
2632 protocol_name:
2633 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2634 }),
2635 }))
2636 },
2637 )
2638 }
2639}
2640
2641#[derive(Debug)]
2642pub enum DeviceRequest {
2643 GetDeviceInfo { responder: DeviceGetDeviceInfoResponder },
2645 GetBar { bar_id: u32, responder: DeviceGetBarResponder },
2659 SetBusMastering { enabled: bool, responder: DeviceSetBusMasteringResponder },
2667 ResetDevice { responder: DeviceResetDeviceResponder },
2678 AckInterrupt { responder: DeviceAckInterruptResponder },
2685 MapInterrupt { which_irq: u32, responder: DeviceMapInterruptResponder },
2704 GetInterruptModes { responder: DeviceGetInterruptModesResponder },
2706 SetInterruptMode {
2720 mode: InterruptMode,
2721 requested_irq_count: u32,
2722 responder: DeviceSetInterruptModeResponder,
2723 },
2724 ReadConfig8 { offset: u16, responder: DeviceReadConfig8Responder },
2734 ReadConfig16 { offset: u16, responder: DeviceReadConfig16Responder },
2744 ReadConfig32 { offset: u16, responder: DeviceReadConfig32Responder },
2754 WriteConfig8 { offset: u16, value: u8, responder: DeviceWriteConfig8Responder },
2767 WriteConfig16 { offset: u16, value: u16, responder: DeviceWriteConfig16Responder },
2780 WriteConfig32 { offset: u16, value: u32, responder: DeviceWriteConfig32Responder },
2793 GetCapabilities { id: CapabilityId, responder: DeviceGetCapabilitiesResponder },
2800 GetExtendedCapabilities {
2807 id: ExtendedCapabilityId,
2808 responder: DeviceGetExtendedCapabilitiesResponder,
2809 },
2810 GetBti { index: u32, responder: DeviceGetBtiResponder },
2818}
2819
2820impl DeviceRequest {
2821 #[allow(irrefutable_let_patterns)]
2822 pub fn into_get_device_info(self) -> Option<(DeviceGetDeviceInfoResponder)> {
2823 if let DeviceRequest::GetDeviceInfo { responder } = self {
2824 Some((responder))
2825 } else {
2826 None
2827 }
2828 }
2829
2830 #[allow(irrefutable_let_patterns)]
2831 pub fn into_get_bar(self) -> Option<(u32, DeviceGetBarResponder)> {
2832 if let DeviceRequest::GetBar { bar_id, responder } = self {
2833 Some((bar_id, responder))
2834 } else {
2835 None
2836 }
2837 }
2838
2839 #[allow(irrefutable_let_patterns)]
2840 pub fn into_set_bus_mastering(self) -> Option<(bool, DeviceSetBusMasteringResponder)> {
2841 if let DeviceRequest::SetBusMastering { enabled, responder } = self {
2842 Some((enabled, responder))
2843 } else {
2844 None
2845 }
2846 }
2847
2848 #[allow(irrefutable_let_patterns)]
2849 pub fn into_reset_device(self) -> Option<(DeviceResetDeviceResponder)> {
2850 if let DeviceRequest::ResetDevice { responder } = self {
2851 Some((responder))
2852 } else {
2853 None
2854 }
2855 }
2856
2857 #[allow(irrefutable_let_patterns)]
2858 pub fn into_ack_interrupt(self) -> Option<(DeviceAckInterruptResponder)> {
2859 if let DeviceRequest::AckInterrupt { responder } = self {
2860 Some((responder))
2861 } else {
2862 None
2863 }
2864 }
2865
2866 #[allow(irrefutable_let_patterns)]
2867 pub fn into_map_interrupt(self) -> Option<(u32, DeviceMapInterruptResponder)> {
2868 if let DeviceRequest::MapInterrupt { which_irq, responder } = self {
2869 Some((which_irq, responder))
2870 } else {
2871 None
2872 }
2873 }
2874
2875 #[allow(irrefutable_let_patterns)]
2876 pub fn into_get_interrupt_modes(self) -> Option<(DeviceGetInterruptModesResponder)> {
2877 if let DeviceRequest::GetInterruptModes { responder } = self {
2878 Some((responder))
2879 } else {
2880 None
2881 }
2882 }
2883
2884 #[allow(irrefutable_let_patterns)]
2885 pub fn into_set_interrupt_mode(
2886 self,
2887 ) -> Option<(InterruptMode, u32, DeviceSetInterruptModeResponder)> {
2888 if let DeviceRequest::SetInterruptMode { mode, requested_irq_count, responder } = self {
2889 Some((mode, requested_irq_count, responder))
2890 } else {
2891 None
2892 }
2893 }
2894
2895 #[allow(irrefutable_let_patterns)]
2896 pub fn into_read_config8(self) -> Option<(u16, DeviceReadConfig8Responder)> {
2897 if let DeviceRequest::ReadConfig8 { offset, responder } = self {
2898 Some((offset, responder))
2899 } else {
2900 None
2901 }
2902 }
2903
2904 #[allow(irrefutable_let_patterns)]
2905 pub fn into_read_config16(self) -> Option<(u16, DeviceReadConfig16Responder)> {
2906 if let DeviceRequest::ReadConfig16 { offset, responder } = self {
2907 Some((offset, responder))
2908 } else {
2909 None
2910 }
2911 }
2912
2913 #[allow(irrefutable_let_patterns)]
2914 pub fn into_read_config32(self) -> Option<(u16, DeviceReadConfig32Responder)> {
2915 if let DeviceRequest::ReadConfig32 { offset, responder } = self {
2916 Some((offset, responder))
2917 } else {
2918 None
2919 }
2920 }
2921
2922 #[allow(irrefutable_let_patterns)]
2923 pub fn into_write_config8(self) -> Option<(u16, u8, DeviceWriteConfig8Responder)> {
2924 if let DeviceRequest::WriteConfig8 { offset, value, responder } = self {
2925 Some((offset, value, responder))
2926 } else {
2927 None
2928 }
2929 }
2930
2931 #[allow(irrefutable_let_patterns)]
2932 pub fn into_write_config16(self) -> Option<(u16, u16, DeviceWriteConfig16Responder)> {
2933 if let DeviceRequest::WriteConfig16 { offset, value, responder } = self {
2934 Some((offset, value, responder))
2935 } else {
2936 None
2937 }
2938 }
2939
2940 #[allow(irrefutable_let_patterns)]
2941 pub fn into_write_config32(self) -> Option<(u16, u32, DeviceWriteConfig32Responder)> {
2942 if let DeviceRequest::WriteConfig32 { 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_get_capabilities(self) -> Option<(CapabilityId, DeviceGetCapabilitiesResponder)> {
2951 if let DeviceRequest::GetCapabilities { id, responder } = self {
2952 Some((id, responder))
2953 } else {
2954 None
2955 }
2956 }
2957
2958 #[allow(irrefutable_let_patterns)]
2959 pub fn into_get_extended_capabilities(
2960 self,
2961 ) -> Option<(ExtendedCapabilityId, DeviceGetExtendedCapabilitiesResponder)> {
2962 if let DeviceRequest::GetExtendedCapabilities { id, responder } = self {
2963 Some((id, responder))
2964 } else {
2965 None
2966 }
2967 }
2968
2969 #[allow(irrefutable_let_patterns)]
2970 pub fn into_get_bti(self) -> Option<(u32, DeviceGetBtiResponder)> {
2971 if let DeviceRequest::GetBti { index, responder } = self {
2972 Some((index, responder))
2973 } else {
2974 None
2975 }
2976 }
2977
2978 pub fn method_name(&self) -> &'static str {
2980 match *self {
2981 DeviceRequest::GetDeviceInfo { .. } => "get_device_info",
2982 DeviceRequest::GetBar { .. } => "get_bar",
2983 DeviceRequest::SetBusMastering { .. } => "set_bus_mastering",
2984 DeviceRequest::ResetDevice { .. } => "reset_device",
2985 DeviceRequest::AckInterrupt { .. } => "ack_interrupt",
2986 DeviceRequest::MapInterrupt { .. } => "map_interrupt",
2987 DeviceRequest::GetInterruptModes { .. } => "get_interrupt_modes",
2988 DeviceRequest::SetInterruptMode { .. } => "set_interrupt_mode",
2989 DeviceRequest::ReadConfig8 { .. } => "read_config8",
2990 DeviceRequest::ReadConfig16 { .. } => "read_config16",
2991 DeviceRequest::ReadConfig32 { .. } => "read_config32",
2992 DeviceRequest::WriteConfig8 { .. } => "write_config8",
2993 DeviceRequest::WriteConfig16 { .. } => "write_config16",
2994 DeviceRequest::WriteConfig32 { .. } => "write_config32",
2995 DeviceRequest::GetCapabilities { .. } => "get_capabilities",
2996 DeviceRequest::GetExtendedCapabilities { .. } => "get_extended_capabilities",
2997 DeviceRequest::GetBti { .. } => "get_bti",
2998 }
2999 }
3000}
3001
3002#[derive(Debug, Clone)]
3003pub struct DeviceControlHandle {
3004 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3005}
3006
3007impl fidl::endpoints::ControlHandle for DeviceControlHandle {
3008 fn shutdown(&self) {
3009 self.inner.shutdown()
3010 }
3011 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3012 self.inner.shutdown_with_epitaph(status)
3013 }
3014
3015 fn is_closed(&self) -> bool {
3016 self.inner.channel().is_closed()
3017 }
3018 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3019 self.inner.channel().on_closed()
3020 }
3021
3022 #[cfg(target_os = "fuchsia")]
3023 fn signal_peer(
3024 &self,
3025 clear_mask: zx::Signals,
3026 set_mask: zx::Signals,
3027 ) -> Result<(), zx_status::Status> {
3028 use fidl::Peered;
3029 self.inner.channel().signal_peer(clear_mask, set_mask)
3030 }
3031}
3032
3033impl DeviceControlHandle {}
3034
3035#[must_use = "FIDL methods require a response to be sent"]
3036#[derive(Debug)]
3037pub struct DeviceGetDeviceInfoResponder {
3038 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3039 tx_id: u32,
3040}
3041
3042impl std::ops::Drop for DeviceGetDeviceInfoResponder {
3046 fn drop(&mut self) {
3047 self.control_handle.shutdown();
3048 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3050 }
3051}
3052
3053impl fidl::endpoints::Responder for DeviceGetDeviceInfoResponder {
3054 type ControlHandle = DeviceControlHandle;
3055
3056 fn control_handle(&self) -> &DeviceControlHandle {
3057 &self.control_handle
3058 }
3059
3060 fn drop_without_shutdown(mut self) {
3061 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3063 std::mem::forget(self);
3065 }
3066}
3067
3068impl DeviceGetDeviceInfoResponder {
3069 pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
3073 let _result = self.send_raw(info);
3074 if _result.is_err() {
3075 self.control_handle.shutdown();
3076 }
3077 self.drop_without_shutdown();
3078 _result
3079 }
3080
3081 pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
3083 let _result = self.send_raw(info);
3084 self.drop_without_shutdown();
3085 _result
3086 }
3087
3088 fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
3089 self.control_handle.inner.send::<DeviceGetDeviceInfoResponse>(
3090 (info,),
3091 self.tx_id,
3092 0x5599d144d4329916,
3093 fidl::encoding::DynamicFlags::empty(),
3094 )
3095 }
3096}
3097
3098#[must_use = "FIDL methods require a response to be sent"]
3099#[derive(Debug)]
3100pub struct DeviceGetBarResponder {
3101 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3102 tx_id: u32,
3103}
3104
3105impl std::ops::Drop for DeviceGetBarResponder {
3109 fn drop(&mut self) {
3110 self.control_handle.shutdown();
3111 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3113 }
3114}
3115
3116impl fidl::endpoints::Responder for DeviceGetBarResponder {
3117 type ControlHandle = DeviceControlHandle;
3118
3119 fn control_handle(&self) -> &DeviceControlHandle {
3120 &self.control_handle
3121 }
3122
3123 fn drop_without_shutdown(mut self) {
3124 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3126 std::mem::forget(self);
3128 }
3129}
3130
3131impl DeviceGetBarResponder {
3132 pub fn send(self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
3136 let _result = self.send_raw(result);
3137 if _result.is_err() {
3138 self.control_handle.shutdown();
3139 }
3140 self.drop_without_shutdown();
3141 _result
3142 }
3143
3144 pub fn send_no_shutdown_on_err(self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
3146 let _result = self.send_raw(result);
3147 self.drop_without_shutdown();
3148 _result
3149 }
3150
3151 fn send_raw(&self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
3152 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetBarResponse, i32>>(
3153 result.as_mut().map_err(|e| *e).map(|result| (result,)),
3154 self.tx_id,
3155 0x6b2683f6fbbff679,
3156 fidl::encoding::DynamicFlags::empty(),
3157 )
3158 }
3159}
3160
3161#[must_use = "FIDL methods require a response to be sent"]
3162#[derive(Debug)]
3163pub struct DeviceSetBusMasteringResponder {
3164 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3165 tx_id: u32,
3166}
3167
3168impl std::ops::Drop for DeviceSetBusMasteringResponder {
3172 fn drop(&mut self) {
3173 self.control_handle.shutdown();
3174 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3176 }
3177}
3178
3179impl fidl::endpoints::Responder for DeviceSetBusMasteringResponder {
3180 type ControlHandle = DeviceControlHandle;
3181
3182 fn control_handle(&self) -> &DeviceControlHandle {
3183 &self.control_handle
3184 }
3185
3186 fn drop_without_shutdown(mut self) {
3187 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3189 std::mem::forget(self);
3191 }
3192}
3193
3194impl DeviceSetBusMasteringResponder {
3195 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3199 let _result = self.send_raw(result);
3200 if _result.is_err() {
3201 self.control_handle.shutdown();
3202 }
3203 self.drop_without_shutdown();
3204 _result
3205 }
3206
3207 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3209 let _result = self.send_raw(result);
3210 self.drop_without_shutdown();
3211 _result
3212 }
3213
3214 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3215 self.control_handle
3216 .inner
3217 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3218 result,
3219 self.tx_id,
3220 0x3421e9e030211003,
3221 fidl::encoding::DynamicFlags::empty(),
3222 )
3223 }
3224}
3225
3226#[must_use = "FIDL methods require a response to be sent"]
3227#[derive(Debug)]
3228pub struct DeviceResetDeviceResponder {
3229 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3230 tx_id: u32,
3231}
3232
3233impl std::ops::Drop for DeviceResetDeviceResponder {
3237 fn drop(&mut self) {
3238 self.control_handle.shutdown();
3239 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3241 }
3242}
3243
3244impl fidl::endpoints::Responder for DeviceResetDeviceResponder {
3245 type ControlHandle = DeviceControlHandle;
3246
3247 fn control_handle(&self) -> &DeviceControlHandle {
3248 &self.control_handle
3249 }
3250
3251 fn drop_without_shutdown(mut self) {
3252 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3254 std::mem::forget(self);
3256 }
3257}
3258
3259impl DeviceResetDeviceResponder {
3260 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3264 let _result = self.send_raw(result);
3265 if _result.is_err() {
3266 self.control_handle.shutdown();
3267 }
3268 self.drop_without_shutdown();
3269 _result
3270 }
3271
3272 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3274 let _result = self.send_raw(result);
3275 self.drop_without_shutdown();
3276 _result
3277 }
3278
3279 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3280 self.control_handle
3281 .inner
3282 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3283 result,
3284 self.tx_id,
3285 0x3c5b7579bb6f8b9f,
3286 fidl::encoding::DynamicFlags::empty(),
3287 )
3288 }
3289}
3290
3291#[must_use = "FIDL methods require a response to be sent"]
3292#[derive(Debug)]
3293pub struct DeviceAckInterruptResponder {
3294 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3295 tx_id: u32,
3296}
3297
3298impl std::ops::Drop for DeviceAckInterruptResponder {
3302 fn drop(&mut self) {
3303 self.control_handle.shutdown();
3304 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3306 }
3307}
3308
3309impl fidl::endpoints::Responder for DeviceAckInterruptResponder {
3310 type ControlHandle = DeviceControlHandle;
3311
3312 fn control_handle(&self) -> &DeviceControlHandle {
3313 &self.control_handle
3314 }
3315
3316 fn drop_without_shutdown(mut self) {
3317 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3319 std::mem::forget(self);
3321 }
3322}
3323
3324impl DeviceAckInterruptResponder {
3325 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3329 let _result = self.send_raw(result);
3330 if _result.is_err() {
3331 self.control_handle.shutdown();
3332 }
3333 self.drop_without_shutdown();
3334 _result
3335 }
3336
3337 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3339 let _result = self.send_raw(result);
3340 self.drop_without_shutdown();
3341 _result
3342 }
3343
3344 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3345 self.control_handle
3346 .inner
3347 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3348 result,
3349 self.tx_id,
3350 0x70742f64692d5a6b,
3351 fidl::encoding::DynamicFlags::empty(),
3352 )
3353 }
3354}
3355
3356#[must_use = "FIDL methods require a response to be sent"]
3357#[derive(Debug)]
3358pub struct DeviceMapInterruptResponder {
3359 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3360 tx_id: u32,
3361}
3362
3363impl std::ops::Drop for DeviceMapInterruptResponder {
3367 fn drop(&mut self) {
3368 self.control_handle.shutdown();
3369 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3371 }
3372}
3373
3374impl fidl::endpoints::Responder for DeviceMapInterruptResponder {
3375 type ControlHandle = DeviceControlHandle;
3376
3377 fn control_handle(&self) -> &DeviceControlHandle {
3378 &self.control_handle
3379 }
3380
3381 fn drop_without_shutdown(mut self) {
3382 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3384 std::mem::forget(self);
3386 }
3387}
3388
3389impl DeviceMapInterruptResponder {
3390 pub fn send(self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
3394 let _result = self.send_raw(result);
3395 if _result.is_err() {
3396 self.control_handle.shutdown();
3397 }
3398 self.drop_without_shutdown();
3399 _result
3400 }
3401
3402 pub fn send_no_shutdown_on_err(
3404 self,
3405 mut result: Result<fidl::Interrupt, i32>,
3406 ) -> Result<(), fidl::Error> {
3407 let _result = self.send_raw(result);
3408 self.drop_without_shutdown();
3409 _result
3410 }
3411
3412 fn send_raw(&self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
3413 self.control_handle
3414 .inner
3415 .send::<fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>>(
3416 result.map(|interrupt| (interrupt,)),
3417 self.tx_id,
3418 0x25eeff9d34a1fa13,
3419 fidl::encoding::DynamicFlags::empty(),
3420 )
3421 }
3422}
3423
3424#[must_use = "FIDL methods require a response to be sent"]
3425#[derive(Debug)]
3426pub struct DeviceGetInterruptModesResponder {
3427 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3428 tx_id: u32,
3429}
3430
3431impl std::ops::Drop for DeviceGetInterruptModesResponder {
3435 fn drop(&mut self) {
3436 self.control_handle.shutdown();
3437 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3439 }
3440}
3441
3442impl fidl::endpoints::Responder for DeviceGetInterruptModesResponder {
3443 type ControlHandle = DeviceControlHandle;
3444
3445 fn control_handle(&self) -> &DeviceControlHandle {
3446 &self.control_handle
3447 }
3448
3449 fn drop_without_shutdown(mut self) {
3450 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3452 std::mem::forget(self);
3454 }
3455}
3456
3457impl DeviceGetInterruptModesResponder {
3458 pub fn send(self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
3462 let _result = self.send_raw(modes);
3463 if _result.is_err() {
3464 self.control_handle.shutdown();
3465 }
3466 self.drop_without_shutdown();
3467 _result
3468 }
3469
3470 pub fn send_no_shutdown_on_err(self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
3472 let _result = self.send_raw(modes);
3473 self.drop_without_shutdown();
3474 _result
3475 }
3476
3477 fn send_raw(&self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
3478 self.control_handle.inner.send::<DeviceGetInterruptModesResponse>(
3479 (modes,),
3480 self.tx_id,
3481 0x93f4cd8f79e9f4a,
3482 fidl::encoding::DynamicFlags::empty(),
3483 )
3484 }
3485}
3486
3487#[must_use = "FIDL methods require a response to be sent"]
3488#[derive(Debug)]
3489pub struct DeviceSetInterruptModeResponder {
3490 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3491 tx_id: u32,
3492}
3493
3494impl std::ops::Drop for DeviceSetInterruptModeResponder {
3498 fn drop(&mut self) {
3499 self.control_handle.shutdown();
3500 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3502 }
3503}
3504
3505impl fidl::endpoints::Responder for DeviceSetInterruptModeResponder {
3506 type ControlHandle = DeviceControlHandle;
3507
3508 fn control_handle(&self) -> &DeviceControlHandle {
3509 &self.control_handle
3510 }
3511
3512 fn drop_without_shutdown(mut self) {
3513 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3515 std::mem::forget(self);
3517 }
3518}
3519
3520impl DeviceSetInterruptModeResponder {
3521 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3525 let _result = self.send_raw(result);
3526 if _result.is_err() {
3527 self.control_handle.shutdown();
3528 }
3529 self.drop_without_shutdown();
3530 _result
3531 }
3532
3533 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3535 let _result = self.send_raw(result);
3536 self.drop_without_shutdown();
3537 _result
3538 }
3539
3540 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3541 self.control_handle
3542 .inner
3543 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3544 result,
3545 self.tx_id,
3546 0x85bebad3eb24866,
3547 fidl::encoding::DynamicFlags::empty(),
3548 )
3549 }
3550}
3551
3552#[must_use = "FIDL methods require a response to be sent"]
3553#[derive(Debug)]
3554pub struct DeviceReadConfig8Responder {
3555 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3556 tx_id: u32,
3557}
3558
3559impl std::ops::Drop for DeviceReadConfig8Responder {
3563 fn drop(&mut self) {
3564 self.control_handle.shutdown();
3565 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3567 }
3568}
3569
3570impl fidl::endpoints::Responder for DeviceReadConfig8Responder {
3571 type ControlHandle = DeviceControlHandle;
3572
3573 fn control_handle(&self) -> &DeviceControlHandle {
3574 &self.control_handle
3575 }
3576
3577 fn drop_without_shutdown(mut self) {
3578 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3580 std::mem::forget(self);
3582 }
3583}
3584
3585impl DeviceReadConfig8Responder {
3586 pub fn send(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
3590 let _result = self.send_raw(result);
3591 if _result.is_err() {
3592 self.control_handle.shutdown();
3593 }
3594 self.drop_without_shutdown();
3595 _result
3596 }
3597
3598 pub fn send_no_shutdown_on_err(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
3600 let _result = self.send_raw(result);
3601 self.drop_without_shutdown();
3602 _result
3603 }
3604
3605 fn send_raw(&self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
3606 self.control_handle
3607 .inner
3608 .send::<fidl::encoding::ResultType<DeviceReadConfig8Response, i32>>(
3609 result.map(|value| (value,)),
3610 self.tx_id,
3611 0x28f9eb9e6dadda1c,
3612 fidl::encoding::DynamicFlags::empty(),
3613 )
3614 }
3615}
3616
3617#[must_use = "FIDL methods require a response to be sent"]
3618#[derive(Debug)]
3619pub struct DeviceReadConfig16Responder {
3620 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3621 tx_id: u32,
3622}
3623
3624impl std::ops::Drop for DeviceReadConfig16Responder {
3628 fn drop(&mut self) {
3629 self.control_handle.shutdown();
3630 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3632 }
3633}
3634
3635impl fidl::endpoints::Responder for DeviceReadConfig16Responder {
3636 type ControlHandle = DeviceControlHandle;
3637
3638 fn control_handle(&self) -> &DeviceControlHandle {
3639 &self.control_handle
3640 }
3641
3642 fn drop_without_shutdown(mut self) {
3643 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3645 std::mem::forget(self);
3647 }
3648}
3649
3650impl DeviceReadConfig16Responder {
3651 pub fn send(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
3655 let _result = self.send_raw(result);
3656 if _result.is_err() {
3657 self.control_handle.shutdown();
3658 }
3659 self.drop_without_shutdown();
3660 _result
3661 }
3662
3663 pub fn send_no_shutdown_on_err(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
3665 let _result = self.send_raw(result);
3666 self.drop_without_shutdown();
3667 _result
3668 }
3669
3670 fn send_raw(&self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
3671 self.control_handle
3672 .inner
3673 .send::<fidl::encoding::ResultType<DeviceReadConfig16Response, i32>>(
3674 result.map(|value| (value,)),
3675 self.tx_id,
3676 0x3bcda6171a3270bb,
3677 fidl::encoding::DynamicFlags::empty(),
3678 )
3679 }
3680}
3681
3682#[must_use = "FIDL methods require a response to be sent"]
3683#[derive(Debug)]
3684pub struct DeviceReadConfig32Responder {
3685 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3686 tx_id: u32,
3687}
3688
3689impl std::ops::Drop for DeviceReadConfig32Responder {
3693 fn drop(&mut self) {
3694 self.control_handle.shutdown();
3695 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3697 }
3698}
3699
3700impl fidl::endpoints::Responder for DeviceReadConfig32Responder {
3701 type ControlHandle = DeviceControlHandle;
3702
3703 fn control_handle(&self) -> &DeviceControlHandle {
3704 &self.control_handle
3705 }
3706
3707 fn drop_without_shutdown(mut self) {
3708 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3710 std::mem::forget(self);
3712 }
3713}
3714
3715impl DeviceReadConfig32Responder {
3716 pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
3720 let _result = self.send_raw(result);
3721 if _result.is_err() {
3722 self.control_handle.shutdown();
3723 }
3724 self.drop_without_shutdown();
3725 _result
3726 }
3727
3728 pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
3730 let _result = self.send_raw(result);
3731 self.drop_without_shutdown();
3732 _result
3733 }
3734
3735 fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
3736 self.control_handle
3737 .inner
3738 .send::<fidl::encoding::ResultType<DeviceReadConfig32Response, i32>>(
3739 result.map(|value| (value,)),
3740 self.tx_id,
3741 0x55357535402f7507,
3742 fidl::encoding::DynamicFlags::empty(),
3743 )
3744 }
3745}
3746
3747#[must_use = "FIDL methods require a response to be sent"]
3748#[derive(Debug)]
3749pub struct DeviceWriteConfig8Responder {
3750 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3751 tx_id: u32,
3752}
3753
3754impl std::ops::Drop for DeviceWriteConfig8Responder {
3758 fn drop(&mut self) {
3759 self.control_handle.shutdown();
3760 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3762 }
3763}
3764
3765impl fidl::endpoints::Responder for DeviceWriteConfig8Responder {
3766 type ControlHandle = DeviceControlHandle;
3767
3768 fn control_handle(&self) -> &DeviceControlHandle {
3769 &self.control_handle
3770 }
3771
3772 fn drop_without_shutdown(mut self) {
3773 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3775 std::mem::forget(self);
3777 }
3778}
3779
3780impl DeviceWriteConfig8Responder {
3781 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3785 let _result = self.send_raw(result);
3786 if _result.is_err() {
3787 self.control_handle.shutdown();
3788 }
3789 self.drop_without_shutdown();
3790 _result
3791 }
3792
3793 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3795 let _result = self.send_raw(result);
3796 self.drop_without_shutdown();
3797 _result
3798 }
3799
3800 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3801 self.control_handle
3802 .inner
3803 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3804 result,
3805 self.tx_id,
3806 0x49a0719e1433cff,
3807 fidl::encoding::DynamicFlags::empty(),
3808 )
3809 }
3810}
3811
3812#[must_use = "FIDL methods require a response to be sent"]
3813#[derive(Debug)]
3814pub struct DeviceWriteConfig16Responder {
3815 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3816 tx_id: u32,
3817}
3818
3819impl std::ops::Drop for DeviceWriteConfig16Responder {
3823 fn drop(&mut self) {
3824 self.control_handle.shutdown();
3825 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3827 }
3828}
3829
3830impl fidl::endpoints::Responder for DeviceWriteConfig16Responder {
3831 type ControlHandle = DeviceControlHandle;
3832
3833 fn control_handle(&self) -> &DeviceControlHandle {
3834 &self.control_handle
3835 }
3836
3837 fn drop_without_shutdown(mut self) {
3838 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3840 std::mem::forget(self);
3842 }
3843}
3844
3845impl DeviceWriteConfig16Responder {
3846 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3850 let _result = self.send_raw(result);
3851 if _result.is_err() {
3852 self.control_handle.shutdown();
3853 }
3854 self.drop_without_shutdown();
3855 _result
3856 }
3857
3858 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3860 let _result = self.send_raw(result);
3861 self.drop_without_shutdown();
3862 _result
3863 }
3864
3865 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3866 self.control_handle
3867 .inner
3868 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3869 result,
3870 self.tx_id,
3871 0x3e30bf13f1c07eff,
3872 fidl::encoding::DynamicFlags::empty(),
3873 )
3874 }
3875}
3876
3877#[must_use = "FIDL methods require a response to be sent"]
3878#[derive(Debug)]
3879pub struct DeviceWriteConfig32Responder {
3880 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3881 tx_id: u32,
3882}
3883
3884impl std::ops::Drop for DeviceWriteConfig32Responder {
3888 fn drop(&mut self) {
3889 self.control_handle.shutdown();
3890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3892 }
3893}
3894
3895impl fidl::endpoints::Responder for DeviceWriteConfig32Responder {
3896 type ControlHandle = DeviceControlHandle;
3897
3898 fn control_handle(&self) -> &DeviceControlHandle {
3899 &self.control_handle
3900 }
3901
3902 fn drop_without_shutdown(mut self) {
3903 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3905 std::mem::forget(self);
3907 }
3908}
3909
3910impl DeviceWriteConfig32Responder {
3911 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3915 let _result = self.send_raw(result);
3916 if _result.is_err() {
3917 self.control_handle.shutdown();
3918 }
3919 self.drop_without_shutdown();
3920 _result
3921 }
3922
3923 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3925 let _result = self.send_raw(result);
3926 self.drop_without_shutdown();
3927 _result
3928 }
3929
3930 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3931 self.control_handle
3932 .inner
3933 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3934 result,
3935 self.tx_id,
3936 0x161584e5199b388,
3937 fidl::encoding::DynamicFlags::empty(),
3938 )
3939 }
3940}
3941
3942#[must_use = "FIDL methods require a response to be sent"]
3943#[derive(Debug)]
3944pub struct DeviceGetCapabilitiesResponder {
3945 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
3946 tx_id: u32,
3947}
3948
3949impl std::ops::Drop for DeviceGetCapabilitiesResponder {
3953 fn drop(&mut self) {
3954 self.control_handle.shutdown();
3955 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3957 }
3958}
3959
3960impl fidl::endpoints::Responder for DeviceGetCapabilitiesResponder {
3961 type ControlHandle = DeviceControlHandle;
3962
3963 fn control_handle(&self) -> &DeviceControlHandle {
3964 &self.control_handle
3965 }
3966
3967 fn drop_without_shutdown(mut self) {
3968 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3970 std::mem::forget(self);
3972 }
3973}
3974
3975impl DeviceGetCapabilitiesResponder {
3976 pub fn send(self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
3980 let _result = self.send_raw(offsets);
3981 if _result.is_err() {
3982 self.control_handle.shutdown();
3983 }
3984 self.drop_without_shutdown();
3985 _result
3986 }
3987
3988 pub fn send_no_shutdown_on_err(self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
3990 let _result = self.send_raw(offsets);
3991 self.drop_without_shutdown();
3992 _result
3993 }
3994
3995 fn send_raw(&self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
3996 self.control_handle.inner.send::<DeviceGetCapabilitiesResponse>(
3997 (offsets,),
3998 self.tx_id,
3999 0x3a050fde46f3ba0f,
4000 fidl::encoding::DynamicFlags::empty(),
4001 )
4002 }
4003}
4004
4005#[must_use = "FIDL methods require a response to be sent"]
4006#[derive(Debug)]
4007pub struct DeviceGetExtendedCapabilitiesResponder {
4008 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4009 tx_id: u32,
4010}
4011
4012impl std::ops::Drop for DeviceGetExtendedCapabilitiesResponder {
4016 fn drop(&mut self) {
4017 self.control_handle.shutdown();
4018 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4020 }
4021}
4022
4023impl fidl::endpoints::Responder for DeviceGetExtendedCapabilitiesResponder {
4024 type ControlHandle = DeviceControlHandle;
4025
4026 fn control_handle(&self) -> &DeviceControlHandle {
4027 &self.control_handle
4028 }
4029
4030 fn drop_without_shutdown(mut self) {
4031 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4033 std::mem::forget(self);
4035 }
4036}
4037
4038impl DeviceGetExtendedCapabilitiesResponder {
4039 pub fn send(self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
4043 let _result = self.send_raw(offsets);
4044 if _result.is_err() {
4045 self.control_handle.shutdown();
4046 }
4047 self.drop_without_shutdown();
4048 _result
4049 }
4050
4051 pub fn send_no_shutdown_on_err(self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
4053 let _result = self.send_raw(offsets);
4054 self.drop_without_shutdown();
4055 _result
4056 }
4057
4058 fn send_raw(&self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
4059 self.control_handle.inner.send::<DeviceGetExtendedCapabilitiesResponse>(
4060 (offsets,),
4061 self.tx_id,
4062 0xb8573efcaae0c39,
4063 fidl::encoding::DynamicFlags::empty(),
4064 )
4065 }
4066}
4067
4068#[must_use = "FIDL methods require a response to be sent"]
4069#[derive(Debug)]
4070pub struct DeviceGetBtiResponder {
4071 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4072 tx_id: u32,
4073}
4074
4075impl std::ops::Drop for DeviceGetBtiResponder {
4079 fn drop(&mut self) {
4080 self.control_handle.shutdown();
4081 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4083 }
4084}
4085
4086impl fidl::endpoints::Responder for DeviceGetBtiResponder {
4087 type ControlHandle = DeviceControlHandle;
4088
4089 fn control_handle(&self) -> &DeviceControlHandle {
4090 &self.control_handle
4091 }
4092
4093 fn drop_without_shutdown(mut self) {
4094 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4096 std::mem::forget(self);
4098 }
4099}
4100
4101impl DeviceGetBtiResponder {
4102 pub fn send(self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
4106 let _result = self.send_raw(result);
4107 if _result.is_err() {
4108 self.control_handle.shutdown();
4109 }
4110 self.drop_without_shutdown();
4111 _result
4112 }
4113
4114 pub fn send_no_shutdown_on_err(
4116 self,
4117 mut result: Result<fidl::Bti, i32>,
4118 ) -> Result<(), fidl::Error> {
4119 let _result = self.send_raw(result);
4120 self.drop_without_shutdown();
4121 _result
4122 }
4123
4124 fn send_raw(&self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
4125 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetBtiResponse, i32>>(
4126 result.map(|bti| (bti,)),
4127 self.tx_id,
4128 0x5e4fe9efb12d9ee3,
4129 fidl::encoding::DynamicFlags::empty(),
4130 )
4131 }
4132}
4133
4134#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4135pub struct ServiceMarker;
4136
4137#[cfg(target_os = "fuchsia")]
4138impl fidl::endpoints::ServiceMarker for ServiceMarker {
4139 type Proxy = ServiceProxy;
4140 type Request = ServiceRequest;
4141 const SERVICE_NAME: &'static str = "fuchsia.hardware.pci.Service";
4142}
4143
4144#[cfg(target_os = "fuchsia")]
4147pub enum ServiceRequest {
4148 Device(DeviceRequestStream),
4149}
4150
4151#[cfg(target_os = "fuchsia")]
4152impl fidl::endpoints::ServiceRequest for ServiceRequest {
4153 type Service = ServiceMarker;
4154
4155 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
4156 match name {
4157 "device" => Self::Device(
4158 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
4159 ),
4160 _ => panic!("no such member protocol name for service Service"),
4161 }
4162 }
4163
4164 fn member_names() -> &'static [&'static str] {
4165 &["device"]
4166 }
4167}
4168#[cfg(target_os = "fuchsia")]
4169pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
4170
4171#[cfg(target_os = "fuchsia")]
4172impl fidl::endpoints::ServiceProxy for ServiceProxy {
4173 type Service = ServiceMarker;
4174
4175 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
4176 Self(opener)
4177 }
4178}
4179
4180#[cfg(target_os = "fuchsia")]
4181impl ServiceProxy {
4182 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
4183 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
4184 self.connect_channel_to_device(server_end)?;
4185 Ok(proxy)
4186 }
4187
4188 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
4191 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
4192 self.connect_channel_to_device(server_end)?;
4193 Ok(proxy)
4194 }
4195
4196 pub fn connect_channel_to_device(
4199 &self,
4200 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
4201 ) -> Result<(), fidl::Error> {
4202 self.0.open_member("device", server_end.into_channel())
4203 }
4204
4205 pub fn instance_name(&self) -> &str {
4206 self.0.instance_name()
4207 }
4208}
4209
4210mod internal {
4211 use super::*;
4212
4213 impl fidl::encoding::ResourceTypeMarker for Bar {
4214 type Borrowed<'a> = &'a mut Self;
4215 fn take_or_borrow<'a>(
4216 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4217 ) -> Self::Borrowed<'a> {
4218 value
4219 }
4220 }
4221
4222 unsafe impl fidl::encoding::TypeMarker for Bar {
4223 type Owned = Self;
4224
4225 #[inline(always)]
4226 fn inline_align(_context: fidl::encoding::Context) -> usize {
4227 8
4228 }
4229
4230 #[inline(always)]
4231 fn inline_size(_context: fidl::encoding::Context) -> usize {
4232 32
4233 }
4234 }
4235
4236 unsafe impl fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>
4237 for &mut Bar
4238 {
4239 #[inline]
4240 unsafe fn encode(
4241 self,
4242 encoder: &mut fidl::encoding::Encoder<
4243 '_,
4244 fidl::encoding::DefaultFuchsiaResourceDialect,
4245 >,
4246 offset: usize,
4247 _depth: fidl::encoding::Depth,
4248 ) -> fidl::Result<()> {
4249 encoder.debug_check_bounds::<Bar>(offset);
4250 fidl::encoding::Encode::<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4252 (
4253 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.bar_id),
4254 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
4255 <BarResult as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4256 &mut self.result,
4257 ),
4258 ),
4259 encoder,
4260 offset,
4261 _depth,
4262 )
4263 }
4264 }
4265 unsafe impl<
4266 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
4267 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4268 T2: fidl::encoding::Encode<BarResult, fidl::encoding::DefaultFuchsiaResourceDialect>,
4269 > fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>
4270 for (T0, T1, T2)
4271 {
4272 #[inline]
4273 unsafe fn encode(
4274 self,
4275 encoder: &mut fidl::encoding::Encoder<
4276 '_,
4277 fidl::encoding::DefaultFuchsiaResourceDialect,
4278 >,
4279 offset: usize,
4280 depth: fidl::encoding::Depth,
4281 ) -> fidl::Result<()> {
4282 encoder.debug_check_bounds::<Bar>(offset);
4283 unsafe {
4286 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4287 (ptr as *mut u64).write_unaligned(0);
4288 }
4289 self.0.encode(encoder, offset + 0, depth)?;
4291 self.1.encode(encoder, offset + 8, depth)?;
4292 self.2.encode(encoder, offset + 16, depth)?;
4293 Ok(())
4294 }
4295 }
4296
4297 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Bar {
4298 #[inline(always)]
4299 fn new_empty() -> Self {
4300 Self {
4301 bar_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
4302 size: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
4303 result: fidl::new_empty!(BarResult, fidl::encoding::DefaultFuchsiaResourceDialect),
4304 }
4305 }
4306
4307 #[inline]
4308 unsafe fn decode(
4309 &mut self,
4310 decoder: &mut fidl::encoding::Decoder<
4311 '_,
4312 fidl::encoding::DefaultFuchsiaResourceDialect,
4313 >,
4314 offset: usize,
4315 _depth: fidl::encoding::Depth,
4316 ) -> fidl::Result<()> {
4317 decoder.debug_check_bounds::<Self>(offset);
4318 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4320 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4321 let mask = 0xffffffff00000000u64;
4322 let maskedval = padval & mask;
4323 if maskedval != 0 {
4324 return Err(fidl::Error::NonZeroPadding {
4325 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4326 });
4327 }
4328 fidl::decode!(
4329 u32,
4330 fidl::encoding::DefaultFuchsiaResourceDialect,
4331 &mut self.bar_id,
4332 decoder,
4333 offset + 0,
4334 _depth
4335 )?;
4336 fidl::decode!(
4337 u64,
4338 fidl::encoding::DefaultFuchsiaResourceDialect,
4339 &mut self.size,
4340 decoder,
4341 offset + 8,
4342 _depth
4343 )?;
4344 fidl::decode!(
4345 BarResult,
4346 fidl::encoding::DefaultFuchsiaResourceDialect,
4347 &mut self.result,
4348 decoder,
4349 offset + 16,
4350 _depth
4351 )?;
4352 Ok(())
4353 }
4354 }
4355
4356 impl fidl::encoding::ResourceTypeMarker for DeviceGetBarResponse {
4357 type Borrowed<'a> = &'a mut Self;
4358 fn take_or_borrow<'a>(
4359 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4360 ) -> Self::Borrowed<'a> {
4361 value
4362 }
4363 }
4364
4365 unsafe impl fidl::encoding::TypeMarker for DeviceGetBarResponse {
4366 type Owned = Self;
4367
4368 #[inline(always)]
4369 fn inline_align(_context: fidl::encoding::Context) -> usize {
4370 8
4371 }
4372
4373 #[inline(always)]
4374 fn inline_size(_context: fidl::encoding::Context) -> usize {
4375 32
4376 }
4377 }
4378
4379 unsafe impl
4380 fidl::encoding::Encode<DeviceGetBarResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
4381 for &mut DeviceGetBarResponse
4382 {
4383 #[inline]
4384 unsafe fn encode(
4385 self,
4386 encoder: &mut fidl::encoding::Encoder<
4387 '_,
4388 fidl::encoding::DefaultFuchsiaResourceDialect,
4389 >,
4390 offset: usize,
4391 _depth: fidl::encoding::Depth,
4392 ) -> fidl::Result<()> {
4393 encoder.debug_check_bounds::<DeviceGetBarResponse>(offset);
4394 fidl::encoding::Encode::<
4396 DeviceGetBarResponse,
4397 fidl::encoding::DefaultFuchsiaResourceDialect,
4398 >::encode(
4399 (<Bar as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result),),
4400 encoder,
4401 offset,
4402 _depth,
4403 )
4404 }
4405 }
4406 unsafe impl<T0: fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>>
4407 fidl::encoding::Encode<DeviceGetBarResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
4408 for (T0,)
4409 {
4410 #[inline]
4411 unsafe fn encode(
4412 self,
4413 encoder: &mut fidl::encoding::Encoder<
4414 '_,
4415 fidl::encoding::DefaultFuchsiaResourceDialect,
4416 >,
4417 offset: usize,
4418 depth: fidl::encoding::Depth,
4419 ) -> fidl::Result<()> {
4420 encoder.debug_check_bounds::<DeviceGetBarResponse>(offset);
4421 self.0.encode(encoder, offset + 0, depth)?;
4425 Ok(())
4426 }
4427 }
4428
4429 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4430 for DeviceGetBarResponse
4431 {
4432 #[inline(always)]
4433 fn new_empty() -> Self {
4434 Self { result: fidl::new_empty!(Bar, fidl::encoding::DefaultFuchsiaResourceDialect) }
4435 }
4436
4437 #[inline]
4438 unsafe fn decode(
4439 &mut self,
4440 decoder: &mut fidl::encoding::Decoder<
4441 '_,
4442 fidl::encoding::DefaultFuchsiaResourceDialect,
4443 >,
4444 offset: usize,
4445 _depth: fidl::encoding::Depth,
4446 ) -> fidl::Result<()> {
4447 decoder.debug_check_bounds::<Self>(offset);
4448 fidl::decode!(
4450 Bar,
4451 fidl::encoding::DefaultFuchsiaResourceDialect,
4452 &mut self.result,
4453 decoder,
4454 offset + 0,
4455 _depth
4456 )?;
4457 Ok(())
4458 }
4459 }
4460
4461 impl fidl::encoding::ResourceTypeMarker for DeviceGetBtiResponse {
4462 type Borrowed<'a> = &'a mut Self;
4463 fn take_or_borrow<'a>(
4464 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4465 ) -> Self::Borrowed<'a> {
4466 value
4467 }
4468 }
4469
4470 unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiResponse {
4471 type Owned = Self;
4472
4473 #[inline(always)]
4474 fn inline_align(_context: fidl::encoding::Context) -> usize {
4475 4
4476 }
4477
4478 #[inline(always)]
4479 fn inline_size(_context: fidl::encoding::Context) -> usize {
4480 4
4481 }
4482 }
4483
4484 unsafe impl
4485 fidl::encoding::Encode<DeviceGetBtiResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
4486 for &mut DeviceGetBtiResponse
4487 {
4488 #[inline]
4489 unsafe fn encode(
4490 self,
4491 encoder: &mut fidl::encoding::Encoder<
4492 '_,
4493 fidl::encoding::DefaultFuchsiaResourceDialect,
4494 >,
4495 offset: usize,
4496 _depth: fidl::encoding::Depth,
4497 ) -> fidl::Result<()> {
4498 encoder.debug_check_bounds::<DeviceGetBtiResponse>(offset);
4499 fidl::encoding::Encode::<
4501 DeviceGetBtiResponse,
4502 fidl::encoding::DefaultFuchsiaResourceDialect,
4503 >::encode(
4504 (<fidl::encoding::HandleType<
4505 fidl::Bti,
4506 { fidl::ObjectType::BTI.into_raw() },
4507 2147483648,
4508 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4509 &mut self.bti
4510 ),),
4511 encoder,
4512 offset,
4513 _depth,
4514 )
4515 }
4516 }
4517 unsafe impl<
4518 T0: fidl::encoding::Encode<
4519 fidl::encoding::HandleType<
4520 fidl::Bti,
4521 { fidl::ObjectType::BTI.into_raw() },
4522 2147483648,
4523 >,
4524 fidl::encoding::DefaultFuchsiaResourceDialect,
4525 >,
4526 >
4527 fidl::encoding::Encode<DeviceGetBtiResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
4528 for (T0,)
4529 {
4530 #[inline]
4531 unsafe fn encode(
4532 self,
4533 encoder: &mut fidl::encoding::Encoder<
4534 '_,
4535 fidl::encoding::DefaultFuchsiaResourceDialect,
4536 >,
4537 offset: usize,
4538 depth: fidl::encoding::Depth,
4539 ) -> fidl::Result<()> {
4540 encoder.debug_check_bounds::<DeviceGetBtiResponse>(offset);
4541 self.0.encode(encoder, offset + 0, depth)?;
4545 Ok(())
4546 }
4547 }
4548
4549 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4550 for DeviceGetBtiResponse
4551 {
4552 #[inline(always)]
4553 fn new_empty() -> Self {
4554 Self {
4555 bti: fidl::new_empty!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4556 }
4557 }
4558
4559 #[inline]
4560 unsafe fn decode(
4561 &mut self,
4562 decoder: &mut fidl::encoding::Decoder<
4563 '_,
4564 fidl::encoding::DefaultFuchsiaResourceDialect,
4565 >,
4566 offset: usize,
4567 _depth: fidl::encoding::Depth,
4568 ) -> fidl::Result<()> {
4569 decoder.debug_check_bounds::<Self>(offset);
4570 fidl::decode!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bti, decoder, offset + 0, _depth)?;
4572 Ok(())
4573 }
4574 }
4575
4576 impl fidl::encoding::ResourceTypeMarker for DeviceMapInterruptResponse {
4577 type Borrowed<'a> = &'a mut Self;
4578 fn take_or_borrow<'a>(
4579 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4580 ) -> Self::Borrowed<'a> {
4581 value
4582 }
4583 }
4584
4585 unsafe impl fidl::encoding::TypeMarker for DeviceMapInterruptResponse {
4586 type Owned = Self;
4587
4588 #[inline(always)]
4589 fn inline_align(_context: fidl::encoding::Context) -> usize {
4590 4
4591 }
4592
4593 #[inline(always)]
4594 fn inline_size(_context: fidl::encoding::Context) -> usize {
4595 4
4596 }
4597 }
4598
4599 unsafe impl
4600 fidl::encoding::Encode<
4601 DeviceMapInterruptResponse,
4602 fidl::encoding::DefaultFuchsiaResourceDialect,
4603 > for &mut DeviceMapInterruptResponse
4604 {
4605 #[inline]
4606 unsafe fn encode(
4607 self,
4608 encoder: &mut fidl::encoding::Encoder<
4609 '_,
4610 fidl::encoding::DefaultFuchsiaResourceDialect,
4611 >,
4612 offset: usize,
4613 _depth: fidl::encoding::Depth,
4614 ) -> fidl::Result<()> {
4615 encoder.debug_check_bounds::<DeviceMapInterruptResponse>(offset);
4616 fidl::encoding::Encode::<
4618 DeviceMapInterruptResponse,
4619 fidl::encoding::DefaultFuchsiaResourceDialect,
4620 >::encode(
4621 (<fidl::encoding::HandleType<
4622 fidl::Interrupt,
4623 { fidl::ObjectType::INTERRUPT.into_raw() },
4624 2147483648,
4625 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4626 &mut self.interrupt
4627 ),),
4628 encoder,
4629 offset,
4630 _depth,
4631 )
4632 }
4633 }
4634 unsafe impl<
4635 T0: fidl::encoding::Encode<
4636 fidl::encoding::HandleType<
4637 fidl::Interrupt,
4638 { fidl::ObjectType::INTERRUPT.into_raw() },
4639 2147483648,
4640 >,
4641 fidl::encoding::DefaultFuchsiaResourceDialect,
4642 >,
4643 >
4644 fidl::encoding::Encode<
4645 DeviceMapInterruptResponse,
4646 fidl::encoding::DefaultFuchsiaResourceDialect,
4647 > for (T0,)
4648 {
4649 #[inline]
4650 unsafe fn encode(
4651 self,
4652 encoder: &mut fidl::encoding::Encoder<
4653 '_,
4654 fidl::encoding::DefaultFuchsiaResourceDialect,
4655 >,
4656 offset: usize,
4657 depth: fidl::encoding::Depth,
4658 ) -> fidl::Result<()> {
4659 encoder.debug_check_bounds::<DeviceMapInterruptResponse>(offset);
4660 self.0.encode(encoder, offset + 0, depth)?;
4664 Ok(())
4665 }
4666 }
4667
4668 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4669 for DeviceMapInterruptResponse
4670 {
4671 #[inline(always)]
4672 fn new_empty() -> Self {
4673 Self {
4674 interrupt: fidl::new_empty!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4675 }
4676 }
4677
4678 #[inline]
4679 unsafe fn decode(
4680 &mut self,
4681 decoder: &mut fidl::encoding::Decoder<
4682 '_,
4683 fidl::encoding::DefaultFuchsiaResourceDialect,
4684 >,
4685 offset: usize,
4686 _depth: fidl::encoding::Depth,
4687 ) -> fidl::Result<()> {
4688 decoder.debug_check_bounds::<Self>(offset);
4689 fidl::decode!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.interrupt, decoder, offset + 0, _depth)?;
4691 Ok(())
4692 }
4693 }
4694
4695 impl fidl::encoding::ResourceTypeMarker for IoBar {
4696 type Borrowed<'a> = &'a mut Self;
4697 fn take_or_borrow<'a>(
4698 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4699 ) -> Self::Borrowed<'a> {
4700 value
4701 }
4702 }
4703
4704 unsafe impl fidl::encoding::TypeMarker for IoBar {
4705 type Owned = Self;
4706
4707 #[inline(always)]
4708 fn inline_align(_context: fidl::encoding::Context) -> usize {
4709 8
4710 }
4711
4712 #[inline(always)]
4713 fn inline_size(_context: fidl::encoding::Context) -> usize {
4714 16
4715 }
4716 }
4717
4718 unsafe impl fidl::encoding::Encode<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>
4719 for &mut IoBar
4720 {
4721 #[inline]
4722 unsafe fn encode(
4723 self,
4724 encoder: &mut fidl::encoding::Encoder<
4725 '_,
4726 fidl::encoding::DefaultFuchsiaResourceDialect,
4727 >,
4728 offset: usize,
4729 _depth: fidl::encoding::Depth,
4730 ) -> fidl::Result<()> {
4731 encoder.debug_check_bounds::<IoBar>(offset);
4732 fidl::encoding::Encode::<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4734 (
4735 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
4736 <fidl::encoding::HandleType<
4737 fidl::Resource,
4738 { fidl::ObjectType::RESOURCE.into_raw() },
4739 2147483648,
4740 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4741 &mut self.resource
4742 ),
4743 ),
4744 encoder,
4745 offset,
4746 _depth,
4747 )
4748 }
4749 }
4750 unsafe impl<
4751 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4752 T1: fidl::encoding::Encode<
4753 fidl::encoding::HandleType<
4754 fidl::Resource,
4755 { fidl::ObjectType::RESOURCE.into_raw() },
4756 2147483648,
4757 >,
4758 fidl::encoding::DefaultFuchsiaResourceDialect,
4759 >,
4760 > fidl::encoding::Encode<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>
4761 for (T0, T1)
4762 {
4763 #[inline]
4764 unsafe fn encode(
4765 self,
4766 encoder: &mut fidl::encoding::Encoder<
4767 '_,
4768 fidl::encoding::DefaultFuchsiaResourceDialect,
4769 >,
4770 offset: usize,
4771 depth: fidl::encoding::Depth,
4772 ) -> fidl::Result<()> {
4773 encoder.debug_check_bounds::<IoBar>(offset);
4774 unsafe {
4777 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4778 (ptr as *mut u64).write_unaligned(0);
4779 }
4780 self.0.encode(encoder, offset + 0, depth)?;
4782 self.1.encode(encoder, offset + 8, depth)?;
4783 Ok(())
4784 }
4785 }
4786
4787 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for IoBar {
4788 #[inline(always)]
4789 fn new_empty() -> Self {
4790 Self {
4791 address: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
4792 resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4793 }
4794 }
4795
4796 #[inline]
4797 unsafe fn decode(
4798 &mut self,
4799 decoder: &mut fidl::encoding::Decoder<
4800 '_,
4801 fidl::encoding::DefaultFuchsiaResourceDialect,
4802 >,
4803 offset: usize,
4804 _depth: fidl::encoding::Depth,
4805 ) -> fidl::Result<()> {
4806 decoder.debug_check_bounds::<Self>(offset);
4807 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4809 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4810 let mask = 0xffffffff00000000u64;
4811 let maskedval = padval & mask;
4812 if maskedval != 0 {
4813 return Err(fidl::Error::NonZeroPadding {
4814 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4815 });
4816 }
4817 fidl::decode!(
4818 u64,
4819 fidl::encoding::DefaultFuchsiaResourceDialect,
4820 &mut self.address,
4821 decoder,
4822 offset + 0,
4823 _depth
4824 )?;
4825 fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 8, _depth)?;
4826 Ok(())
4827 }
4828 }
4829
4830 impl fidl::encoding::ResourceTypeMarker for BarResult {
4831 type Borrowed<'a> = &'a mut Self;
4832 fn take_or_borrow<'a>(
4833 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4834 ) -> Self::Borrowed<'a> {
4835 value
4836 }
4837 }
4838
4839 unsafe impl fidl::encoding::TypeMarker for BarResult {
4840 type Owned = Self;
4841
4842 #[inline(always)]
4843 fn inline_align(_context: fidl::encoding::Context) -> usize {
4844 8
4845 }
4846
4847 #[inline(always)]
4848 fn inline_size(_context: fidl::encoding::Context) -> usize {
4849 16
4850 }
4851 }
4852
4853 unsafe impl fidl::encoding::Encode<BarResult, fidl::encoding::DefaultFuchsiaResourceDialect>
4854 for &mut BarResult
4855 {
4856 #[inline]
4857 unsafe fn encode(
4858 self,
4859 encoder: &mut fidl::encoding::Encoder<
4860 '_,
4861 fidl::encoding::DefaultFuchsiaResourceDialect,
4862 >,
4863 offset: usize,
4864 _depth: fidl::encoding::Depth,
4865 ) -> fidl::Result<()> {
4866 encoder.debug_check_bounds::<BarResult>(offset);
4867 encoder.write_num::<u64>(self.ordinal(), offset);
4868 match self {
4869 BarResult::Io(ref mut val) => fidl::encoding::encode_in_envelope::<
4870 IoBar,
4871 fidl::encoding::DefaultFuchsiaResourceDialect,
4872 >(
4873 <IoBar as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
4874 encoder,
4875 offset + 8,
4876 _depth,
4877 ),
4878 BarResult::Vmo(ref mut val) => fidl::encoding::encode_in_envelope::<
4879 fidl::encoding::HandleType<
4880 fidl::Vmo,
4881 { fidl::ObjectType::VMO.into_raw() },
4882 2147483648,
4883 >,
4884 fidl::encoding::DefaultFuchsiaResourceDialect,
4885 >(
4886 <fidl::encoding::HandleType<
4887 fidl::Vmo,
4888 { fidl::ObjectType::VMO.into_raw() },
4889 2147483648,
4890 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4891 val
4892 ),
4893 encoder,
4894 offset + 8,
4895 _depth,
4896 ),
4897 BarResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4898 }
4899 }
4900 }
4901
4902 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BarResult {
4903 #[inline(always)]
4904 fn new_empty() -> Self {
4905 Self::__SourceBreaking { unknown_ordinal: 0 }
4906 }
4907
4908 #[inline]
4909 unsafe fn decode(
4910 &mut self,
4911 decoder: &mut fidl::encoding::Decoder<
4912 '_,
4913 fidl::encoding::DefaultFuchsiaResourceDialect,
4914 >,
4915 offset: usize,
4916 mut depth: fidl::encoding::Depth,
4917 ) -> fidl::Result<()> {
4918 decoder.debug_check_bounds::<Self>(offset);
4919 #[allow(unused_variables)]
4920 let next_out_of_line = decoder.next_out_of_line();
4921 let handles_before = decoder.remaining_handles();
4922 let (ordinal, inlined, num_bytes, num_handles) =
4923 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4924
4925 let member_inline_size = match ordinal {
4926 1 => <IoBar as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4927 2 => <fidl::encoding::HandleType<
4928 fidl::Vmo,
4929 { fidl::ObjectType::VMO.into_raw() },
4930 2147483648,
4931 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4932 0 => return Err(fidl::Error::UnknownUnionTag),
4933 _ => num_bytes as usize,
4934 };
4935
4936 if inlined != (member_inline_size <= 4) {
4937 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4938 }
4939 let _inner_offset;
4940 if inlined {
4941 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4942 _inner_offset = offset + 8;
4943 } else {
4944 depth.increment()?;
4945 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4946 }
4947 match ordinal {
4948 1 => {
4949 #[allow(irrefutable_let_patterns)]
4950 if let BarResult::Io(_) = self {
4951 } else {
4953 *self = BarResult::Io(fidl::new_empty!(
4955 IoBar,
4956 fidl::encoding::DefaultFuchsiaResourceDialect
4957 ));
4958 }
4959 #[allow(irrefutable_let_patterns)]
4960 if let BarResult::Io(ref mut val) = self {
4961 fidl::decode!(
4962 IoBar,
4963 fidl::encoding::DefaultFuchsiaResourceDialect,
4964 val,
4965 decoder,
4966 _inner_offset,
4967 depth
4968 )?;
4969 } else {
4970 unreachable!()
4971 }
4972 }
4973 2 => {
4974 #[allow(irrefutable_let_patterns)]
4975 if let BarResult::Vmo(_) = self {
4976 } else {
4978 *self = BarResult::Vmo(
4980 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4981 );
4982 }
4983 #[allow(irrefutable_let_patterns)]
4984 if let BarResult::Vmo(ref mut val) = self {
4985 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
4986 } else {
4987 unreachable!()
4988 }
4989 }
4990 #[allow(deprecated)]
4991 ordinal => {
4992 for _ in 0..num_handles {
4993 decoder.drop_next_handle()?;
4994 }
4995 *self = BarResult::__SourceBreaking { unknown_ordinal: ordinal };
4996 }
4997 }
4998 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4999 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5000 }
5001 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5002 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5003 }
5004 Ok(())
5005 }
5006 }
5007}