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_virtualization_hardware__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct StartInfo {
17 pub trap: Trap,
20 pub guest: Option<fidl::Guest>,
23 pub event: fidl::Event,
29 pub vmo: fidl::Vmo,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StartInfo {}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct VirtioBalloonStartRequest {
37 pub start_info: StartInfo,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioBalloonStartRequest {}
41
42#[derive(Debug, PartialEq)]
43pub struct VirtioBlockStartRequest {
44 pub start_info: StartInfo,
45 pub spec: fidl_fuchsia_virtualization::BlockSpec,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioBlockStartRequest {}
49
50#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
51pub struct VirtioConsoleStartRequest {
52 pub start_info: StartInfo,
53 pub socket: fidl::Socket,
54}
55
56impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioConsoleStartRequest {}
57
58#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
59pub struct VirtioGpuStartRequest {
60 pub start_info: StartInfo,
61 pub keyboard_listener:
62 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>>,
63 pub mouse_source:
64 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
65}
66
67impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioGpuStartRequest {}
68
69#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct VirtioInputStartRequest {
71 pub start_info: StartInfo,
72 pub input_type: InputType,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioInputStartRequest {}
76
77#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78pub struct VirtioMemStartRequest {
79 pub start_info: StartInfo,
80 pub region_addr: u64,
81 pub plugged_block_size: u64,
82 pub region_size: u64,
83}
84
85impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioMemStartRequest {}
86
87#[derive(Debug, PartialEq)]
88pub struct VirtioNetStartRequest {
89 pub start_info: StartInfo,
90 pub mac_address: fidl_fuchsia_net::MacAddress,
91 pub enable_bridge: bool,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioNetStartRequest {}
95
96#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97pub struct VirtioRngStartRequest {
98 pub start_info: StartInfo,
99}
100
101impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioRngStartRequest {}
102
103#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
104pub struct VirtioSoundStartRequest {
105 pub start_info: StartInfo,
106 pub enable_input: bool,
107 pub enable_verbose_logging: bool,
108}
109
110impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioSoundStartRequest {}
111
112#[derive(Debug, PartialEq)]
113pub struct VirtioVsockStartRequest {
114 pub start_info: StartInfo,
115 pub guest_cid: u32,
116 pub listeners: Vec<fidl_fuchsia_virtualization::Listener>,
117}
118
119impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioVsockStartRequest {}
120
121#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
122pub enum InputType {
123 Keyboard(fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>),
124 Mouse(fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>),
125}
126
127impl InputType {
128 #[inline]
129 pub fn ordinal(&self) -> u64 {
130 match *self {
131 Self::Keyboard(_) => 1,
132 Self::Mouse(_) => 2,
133 }
134 }
135}
136
137impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InputType {}
138
139#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
140pub struct VirtioBalloonMarker;
141
142impl fidl::endpoints::ProtocolMarker for VirtioBalloonMarker {
143 type Proxy = VirtioBalloonProxy;
144 type RequestStream = VirtioBalloonRequestStream;
145 #[cfg(target_os = "fuchsia")]
146 type SynchronousProxy = VirtioBalloonSynchronousProxy;
147
148 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioBalloon";
149}
150impl fidl::endpoints::DiscoverableProtocolMarker for VirtioBalloonMarker {}
151
152pub trait VirtioBalloonProxyInterface: Send + Sync {
153 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
154 fn r#configure_queue(
155 &self,
156 queue: u16,
157 size: u16,
158 desc: u64,
159 avail: u64,
160 used: u64,
161 ) -> Self::ConfigureQueueResponseFut;
162 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
163 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
164 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
165 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
166 fn r#start(&self, start_info: StartInfo) -> Self::StartResponseFut;
167 type GetMemStatsResponseFut: std::future::Future<
168 Output = Result<(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>), fidl::Error>,
169 > + Send;
170 fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut;
171}
172#[derive(Debug)]
173#[cfg(target_os = "fuchsia")]
174pub struct VirtioBalloonSynchronousProxy {
175 client: fidl::client::sync::Client,
176}
177
178#[cfg(target_os = "fuchsia")]
179impl fidl::endpoints::SynchronousProxy for VirtioBalloonSynchronousProxy {
180 type Proxy = VirtioBalloonProxy;
181 type Protocol = VirtioBalloonMarker;
182
183 fn from_channel(inner: fidl::Channel) -> Self {
184 Self::new(inner)
185 }
186
187 fn into_channel(self) -> fidl::Channel {
188 self.client.into_channel()
189 }
190
191 fn as_channel(&self) -> &fidl::Channel {
192 self.client.as_channel()
193 }
194}
195
196#[cfg(target_os = "fuchsia")]
197impl VirtioBalloonSynchronousProxy {
198 pub fn new(channel: fidl::Channel) -> Self {
199 let protocol_name = <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
200 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
201 }
202
203 pub fn into_channel(self) -> fidl::Channel {
204 self.client.into_channel()
205 }
206
207 pub fn wait_for_event(
210 &self,
211 deadline: zx::MonotonicInstant,
212 ) -> Result<VirtioBalloonEvent, fidl::Error> {
213 VirtioBalloonEvent::decode(self.client.wait_for_event(deadline)?)
214 }
215
216 pub fn r#configure_queue(
219 &self,
220 mut queue: u16,
221 mut size: u16,
222 mut desc: u64,
223 mut avail: u64,
224 mut used: u64,
225 ___deadline: zx::MonotonicInstant,
226 ) -> Result<(), fidl::Error> {
227 let _response = self
228 .client
229 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
230 (queue, size, desc, avail, used),
231 0x72b44fb963480b11,
232 fidl::encoding::DynamicFlags::empty(),
233 ___deadline,
234 )?;
235 Ok(_response)
236 }
237
238 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
240 self.client.send::<VirtioDeviceNotifyQueueRequest>(
241 (queue,),
242 0x6e3a61d652499244,
243 fidl::encoding::DynamicFlags::empty(),
244 )
245 }
246
247 pub fn r#ready(
250 &self,
251 mut negotiated_features: u32,
252 ___deadline: zx::MonotonicInstant,
253 ) -> Result<(), fidl::Error> {
254 let _response =
255 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
256 (negotiated_features,),
257 0x45707654f5d23c3f,
258 fidl::encoding::DynamicFlags::empty(),
259 ___deadline,
260 )?;
261 Ok(_response)
262 }
263
264 pub fn r#start(
266 &self,
267 mut start_info: StartInfo,
268 ___deadline: zx::MonotonicInstant,
269 ) -> Result<(), fidl::Error> {
270 let _response =
271 self.client.send_query::<VirtioBalloonStartRequest, fidl::encoding::EmptyPayload>(
272 (&mut start_info,),
273 0x26645282fddf6f46,
274 fidl::encoding::DynamicFlags::empty(),
275 ___deadline,
276 )?;
277 Ok(_response)
278 }
279
280 pub fn r#get_mem_stats(
282 &self,
283 ___deadline: zx::MonotonicInstant,
284 ) -> Result<(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>), fidl::Error> {
285 let _response = self
286 .client
287 .send_query::<fidl::encoding::EmptyPayload, VirtioBalloonGetMemStatsResponse>(
288 (),
289 0x6641f4c296607e24,
290 fidl::encoding::DynamicFlags::empty(),
291 ___deadline,
292 )?;
293 Ok((_response.status, _response.mem_stats))
294 }
295}
296
297#[cfg(target_os = "fuchsia")]
298impl From<VirtioBalloonSynchronousProxy> for zx::Handle {
299 fn from(value: VirtioBalloonSynchronousProxy) -> Self {
300 value.into_channel().into()
301 }
302}
303
304#[cfg(target_os = "fuchsia")]
305impl From<fidl::Channel> for VirtioBalloonSynchronousProxy {
306 fn from(value: fidl::Channel) -> Self {
307 Self::new(value)
308 }
309}
310
311#[cfg(target_os = "fuchsia")]
312impl fidl::endpoints::FromClient for VirtioBalloonSynchronousProxy {
313 type Protocol = VirtioBalloonMarker;
314
315 fn from_client(value: fidl::endpoints::ClientEnd<VirtioBalloonMarker>) -> Self {
316 Self::new(value.into_channel())
317 }
318}
319
320#[derive(Debug, Clone)]
321pub struct VirtioBalloonProxy {
322 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
323}
324
325impl fidl::endpoints::Proxy for VirtioBalloonProxy {
326 type Protocol = VirtioBalloonMarker;
327
328 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
329 Self::new(inner)
330 }
331
332 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
333 self.client.into_channel().map_err(|client| Self { client })
334 }
335
336 fn as_channel(&self) -> &::fidl::AsyncChannel {
337 self.client.as_channel()
338 }
339}
340
341impl VirtioBalloonProxy {
342 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
344 let protocol_name = <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
345 Self { client: fidl::client::Client::new(channel, protocol_name) }
346 }
347
348 pub fn take_event_stream(&self) -> VirtioBalloonEventStream {
354 VirtioBalloonEventStream { event_receiver: self.client.take_event_receiver() }
355 }
356
357 pub fn r#configure_queue(
360 &self,
361 mut queue: u16,
362 mut size: u16,
363 mut desc: u64,
364 mut avail: u64,
365 mut used: u64,
366 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
367 VirtioBalloonProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
368 }
369
370 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
372 VirtioBalloonProxyInterface::r#notify_queue(self, queue)
373 }
374
375 pub fn r#ready(
378 &self,
379 mut negotiated_features: u32,
380 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
381 VirtioBalloonProxyInterface::r#ready(self, negotiated_features)
382 }
383
384 pub fn r#start(
386 &self,
387 mut start_info: StartInfo,
388 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
389 VirtioBalloonProxyInterface::r#start(self, start_info)
390 }
391
392 pub fn r#get_mem_stats(
394 &self,
395 ) -> fidl::client::QueryResponseFut<
396 (i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>),
397 fidl::encoding::DefaultFuchsiaResourceDialect,
398 > {
399 VirtioBalloonProxyInterface::r#get_mem_stats(self)
400 }
401}
402
403impl VirtioBalloonProxyInterface for VirtioBalloonProxy {
404 type ConfigureQueueResponseFut =
405 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
406 fn r#configure_queue(
407 &self,
408 mut queue: u16,
409 mut size: u16,
410 mut desc: u64,
411 mut avail: u64,
412 mut used: u64,
413 ) -> Self::ConfigureQueueResponseFut {
414 fn _decode(
415 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
416 ) -> Result<(), fidl::Error> {
417 let _response = fidl::client::decode_transaction_body::<
418 fidl::encoding::EmptyPayload,
419 fidl::encoding::DefaultFuchsiaResourceDialect,
420 0x72b44fb963480b11,
421 >(_buf?)?;
422 Ok(_response)
423 }
424 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
425 (queue, size, desc, avail, used),
426 0x72b44fb963480b11,
427 fidl::encoding::DynamicFlags::empty(),
428 _decode,
429 )
430 }
431
432 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
433 self.client.send::<VirtioDeviceNotifyQueueRequest>(
434 (queue,),
435 0x6e3a61d652499244,
436 fidl::encoding::DynamicFlags::empty(),
437 )
438 }
439
440 type ReadyResponseFut =
441 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
442 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
443 fn _decode(
444 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
445 ) -> Result<(), fidl::Error> {
446 let _response = fidl::client::decode_transaction_body::<
447 fidl::encoding::EmptyPayload,
448 fidl::encoding::DefaultFuchsiaResourceDialect,
449 0x45707654f5d23c3f,
450 >(_buf?)?;
451 Ok(_response)
452 }
453 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
454 (negotiated_features,),
455 0x45707654f5d23c3f,
456 fidl::encoding::DynamicFlags::empty(),
457 _decode,
458 )
459 }
460
461 type StartResponseFut =
462 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
463 fn r#start(&self, mut start_info: StartInfo) -> Self::StartResponseFut {
464 fn _decode(
465 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
466 ) -> Result<(), fidl::Error> {
467 let _response = fidl::client::decode_transaction_body::<
468 fidl::encoding::EmptyPayload,
469 fidl::encoding::DefaultFuchsiaResourceDialect,
470 0x26645282fddf6f46,
471 >(_buf?)?;
472 Ok(_response)
473 }
474 self.client.send_query_and_decode::<VirtioBalloonStartRequest, ()>(
475 (&mut start_info,),
476 0x26645282fddf6f46,
477 fidl::encoding::DynamicFlags::empty(),
478 _decode,
479 )
480 }
481
482 type GetMemStatsResponseFut = fidl::client::QueryResponseFut<
483 (i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>),
484 fidl::encoding::DefaultFuchsiaResourceDialect,
485 >;
486 fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut {
487 fn _decode(
488 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
489 ) -> Result<(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>), fidl::Error> {
490 let _response = fidl::client::decode_transaction_body::<
491 VirtioBalloonGetMemStatsResponse,
492 fidl::encoding::DefaultFuchsiaResourceDialect,
493 0x6641f4c296607e24,
494 >(_buf?)?;
495 Ok((_response.status, _response.mem_stats))
496 }
497 self.client.send_query_and_decode::<
498 fidl::encoding::EmptyPayload,
499 (i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>),
500 >(
501 (),
502 0x6641f4c296607e24,
503 fidl::encoding::DynamicFlags::empty(),
504 _decode,
505 )
506 }
507}
508
509pub struct VirtioBalloonEventStream {
510 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
511}
512
513impl std::marker::Unpin for VirtioBalloonEventStream {}
514
515impl futures::stream::FusedStream for VirtioBalloonEventStream {
516 fn is_terminated(&self) -> bool {
517 self.event_receiver.is_terminated()
518 }
519}
520
521impl futures::Stream for VirtioBalloonEventStream {
522 type Item = Result<VirtioBalloonEvent, fidl::Error>;
523
524 fn poll_next(
525 mut self: std::pin::Pin<&mut Self>,
526 cx: &mut std::task::Context<'_>,
527 ) -> std::task::Poll<Option<Self::Item>> {
528 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
529 &mut self.event_receiver,
530 cx
531 )?) {
532 Some(buf) => std::task::Poll::Ready(Some(VirtioBalloonEvent::decode(buf))),
533 None => std::task::Poll::Ready(None),
534 }
535 }
536}
537
538#[derive(Debug)]
539pub enum VirtioBalloonEvent {}
540
541impl VirtioBalloonEvent {
542 fn decode(
544 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
545 ) -> Result<VirtioBalloonEvent, fidl::Error> {
546 let (bytes, _handles) = buf.split_mut();
547 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
548 debug_assert_eq!(tx_header.tx_id, 0);
549 match tx_header.ordinal {
550 _ => Err(fidl::Error::UnknownOrdinal {
551 ordinal: tx_header.ordinal,
552 protocol_name: <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
553 }),
554 }
555 }
556}
557
558pub struct VirtioBalloonRequestStream {
560 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
561 is_terminated: bool,
562}
563
564impl std::marker::Unpin for VirtioBalloonRequestStream {}
565
566impl futures::stream::FusedStream for VirtioBalloonRequestStream {
567 fn is_terminated(&self) -> bool {
568 self.is_terminated
569 }
570}
571
572impl fidl::endpoints::RequestStream for VirtioBalloonRequestStream {
573 type Protocol = VirtioBalloonMarker;
574 type ControlHandle = VirtioBalloonControlHandle;
575
576 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
577 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
578 }
579
580 fn control_handle(&self) -> Self::ControlHandle {
581 VirtioBalloonControlHandle { inner: self.inner.clone() }
582 }
583
584 fn into_inner(
585 self,
586 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
587 {
588 (self.inner, self.is_terminated)
589 }
590
591 fn from_inner(
592 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
593 is_terminated: bool,
594 ) -> Self {
595 Self { inner, is_terminated }
596 }
597}
598
599impl futures::Stream for VirtioBalloonRequestStream {
600 type Item = Result<VirtioBalloonRequest, fidl::Error>;
601
602 fn poll_next(
603 mut self: std::pin::Pin<&mut Self>,
604 cx: &mut std::task::Context<'_>,
605 ) -> std::task::Poll<Option<Self::Item>> {
606 let this = &mut *self;
607 if this.inner.check_shutdown(cx) {
608 this.is_terminated = true;
609 return std::task::Poll::Ready(None);
610 }
611 if this.is_terminated {
612 panic!("polled VirtioBalloonRequestStream after completion");
613 }
614 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
615 |bytes, handles| {
616 match this.inner.channel().read_etc(cx, bytes, handles) {
617 std::task::Poll::Ready(Ok(())) => {}
618 std::task::Poll::Pending => return std::task::Poll::Pending,
619 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
620 this.is_terminated = true;
621 return std::task::Poll::Ready(None);
622 }
623 std::task::Poll::Ready(Err(e)) => {
624 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
625 e.into(),
626 ))));
627 }
628 }
629
630 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
632
633 std::task::Poll::Ready(Some(match header.ordinal {
634 0x72b44fb963480b11 => {
635 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
636 let mut req = fidl::new_empty!(
637 VirtioDeviceConfigureQueueRequest,
638 fidl::encoding::DefaultFuchsiaResourceDialect
639 );
640 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
641 let control_handle =
642 VirtioBalloonControlHandle { inner: this.inner.clone() };
643 Ok(VirtioBalloonRequest::ConfigureQueue {
644 queue: req.queue,
645 size: req.size,
646 desc: req.desc,
647 avail: req.avail,
648 used: req.used,
649
650 responder: VirtioBalloonConfigureQueueResponder {
651 control_handle: std::mem::ManuallyDrop::new(control_handle),
652 tx_id: header.tx_id,
653 },
654 })
655 }
656 0x6e3a61d652499244 => {
657 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
658 let mut req = fidl::new_empty!(
659 VirtioDeviceNotifyQueueRequest,
660 fidl::encoding::DefaultFuchsiaResourceDialect
661 );
662 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
663 let control_handle =
664 VirtioBalloonControlHandle { inner: this.inner.clone() };
665 Ok(VirtioBalloonRequest::NotifyQueue { queue: req.queue, control_handle })
666 }
667 0x45707654f5d23c3f => {
668 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
669 let mut req = fidl::new_empty!(
670 VirtioDeviceReadyRequest,
671 fidl::encoding::DefaultFuchsiaResourceDialect
672 );
673 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
674 let control_handle =
675 VirtioBalloonControlHandle { inner: this.inner.clone() };
676 Ok(VirtioBalloonRequest::Ready {
677 negotiated_features: req.negotiated_features,
678
679 responder: VirtioBalloonReadyResponder {
680 control_handle: std::mem::ManuallyDrop::new(control_handle),
681 tx_id: header.tx_id,
682 },
683 })
684 }
685 0x26645282fddf6f46 => {
686 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
687 let mut req = fidl::new_empty!(
688 VirtioBalloonStartRequest,
689 fidl::encoding::DefaultFuchsiaResourceDialect
690 );
691 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioBalloonStartRequest>(&header, _body_bytes, handles, &mut req)?;
692 let control_handle =
693 VirtioBalloonControlHandle { inner: this.inner.clone() };
694 Ok(VirtioBalloonRequest::Start {
695 start_info: req.start_info,
696
697 responder: VirtioBalloonStartResponder {
698 control_handle: std::mem::ManuallyDrop::new(control_handle),
699 tx_id: header.tx_id,
700 },
701 })
702 }
703 0x6641f4c296607e24 => {
704 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
705 let mut req = fidl::new_empty!(
706 fidl::encoding::EmptyPayload,
707 fidl::encoding::DefaultFuchsiaResourceDialect
708 );
709 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
710 let control_handle =
711 VirtioBalloonControlHandle { inner: this.inner.clone() };
712 Ok(VirtioBalloonRequest::GetMemStats {
713 responder: VirtioBalloonGetMemStatsResponder {
714 control_handle: std::mem::ManuallyDrop::new(control_handle),
715 tx_id: header.tx_id,
716 },
717 })
718 }
719 _ => Err(fidl::Error::UnknownOrdinal {
720 ordinal: header.ordinal,
721 protocol_name:
722 <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
723 }),
724 }))
725 },
726 )
727 }
728}
729
730#[derive(Debug)]
731pub enum VirtioBalloonRequest {
732 ConfigureQueue {
735 queue: u16,
736 size: u16,
737 desc: u64,
738 avail: u64,
739 used: u64,
740 responder: VirtioBalloonConfigureQueueResponder,
741 },
742 NotifyQueue { queue: u16, control_handle: VirtioBalloonControlHandle },
744 Ready { negotiated_features: u32, responder: VirtioBalloonReadyResponder },
747 Start { start_info: StartInfo, responder: VirtioBalloonStartResponder },
749 GetMemStats { responder: VirtioBalloonGetMemStatsResponder },
751}
752
753impl VirtioBalloonRequest {
754 #[allow(irrefutable_let_patterns)]
755 pub fn into_configure_queue(
756 self,
757 ) -> Option<(u16, u16, u64, u64, u64, VirtioBalloonConfigureQueueResponder)> {
758 if let VirtioBalloonRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
759 self
760 {
761 Some((queue, size, desc, avail, used, responder))
762 } else {
763 None
764 }
765 }
766
767 #[allow(irrefutable_let_patterns)]
768 pub fn into_notify_queue(self) -> Option<(u16, VirtioBalloonControlHandle)> {
769 if let VirtioBalloonRequest::NotifyQueue { queue, control_handle } = self {
770 Some((queue, control_handle))
771 } else {
772 None
773 }
774 }
775
776 #[allow(irrefutable_let_patterns)]
777 pub fn into_ready(self) -> Option<(u32, VirtioBalloonReadyResponder)> {
778 if let VirtioBalloonRequest::Ready { negotiated_features, responder } = self {
779 Some((negotiated_features, responder))
780 } else {
781 None
782 }
783 }
784
785 #[allow(irrefutable_let_patterns)]
786 pub fn into_start(self) -> Option<(StartInfo, VirtioBalloonStartResponder)> {
787 if let VirtioBalloonRequest::Start { start_info, responder } = self {
788 Some((start_info, responder))
789 } else {
790 None
791 }
792 }
793
794 #[allow(irrefutable_let_patterns)]
795 pub fn into_get_mem_stats(self) -> Option<(VirtioBalloonGetMemStatsResponder)> {
796 if let VirtioBalloonRequest::GetMemStats { responder } = self {
797 Some((responder))
798 } else {
799 None
800 }
801 }
802
803 pub fn method_name(&self) -> &'static str {
805 match *self {
806 VirtioBalloonRequest::ConfigureQueue { .. } => "configure_queue",
807 VirtioBalloonRequest::NotifyQueue { .. } => "notify_queue",
808 VirtioBalloonRequest::Ready { .. } => "ready",
809 VirtioBalloonRequest::Start { .. } => "start",
810 VirtioBalloonRequest::GetMemStats { .. } => "get_mem_stats",
811 }
812 }
813}
814
815#[derive(Debug, Clone)]
816pub struct VirtioBalloonControlHandle {
817 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
818}
819
820impl fidl::endpoints::ControlHandle for VirtioBalloonControlHandle {
821 fn shutdown(&self) {
822 self.inner.shutdown()
823 }
824 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
825 self.inner.shutdown_with_epitaph(status)
826 }
827
828 fn is_closed(&self) -> bool {
829 self.inner.channel().is_closed()
830 }
831 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
832 self.inner.channel().on_closed()
833 }
834
835 #[cfg(target_os = "fuchsia")]
836 fn signal_peer(
837 &self,
838 clear_mask: zx::Signals,
839 set_mask: zx::Signals,
840 ) -> Result<(), zx_status::Status> {
841 use fidl::Peered;
842 self.inner.channel().signal_peer(clear_mask, set_mask)
843 }
844}
845
846impl VirtioBalloonControlHandle {}
847
848#[must_use = "FIDL methods require a response to be sent"]
849#[derive(Debug)]
850pub struct VirtioBalloonConfigureQueueResponder {
851 control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
852 tx_id: u32,
853}
854
855impl std::ops::Drop for VirtioBalloonConfigureQueueResponder {
859 fn drop(&mut self) {
860 self.control_handle.shutdown();
861 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
863 }
864}
865
866impl fidl::endpoints::Responder for VirtioBalloonConfigureQueueResponder {
867 type ControlHandle = VirtioBalloonControlHandle;
868
869 fn control_handle(&self) -> &VirtioBalloonControlHandle {
870 &self.control_handle
871 }
872
873 fn drop_without_shutdown(mut self) {
874 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
876 std::mem::forget(self);
878 }
879}
880
881impl VirtioBalloonConfigureQueueResponder {
882 pub fn send(self) -> Result<(), fidl::Error> {
886 let _result = self.send_raw();
887 if _result.is_err() {
888 self.control_handle.shutdown();
889 }
890 self.drop_without_shutdown();
891 _result
892 }
893
894 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
896 let _result = self.send_raw();
897 self.drop_without_shutdown();
898 _result
899 }
900
901 fn send_raw(&self) -> Result<(), fidl::Error> {
902 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
903 (),
904 self.tx_id,
905 0x72b44fb963480b11,
906 fidl::encoding::DynamicFlags::empty(),
907 )
908 }
909}
910
911#[must_use = "FIDL methods require a response to be sent"]
912#[derive(Debug)]
913pub struct VirtioBalloonReadyResponder {
914 control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
915 tx_id: u32,
916}
917
918impl std::ops::Drop for VirtioBalloonReadyResponder {
922 fn drop(&mut self) {
923 self.control_handle.shutdown();
924 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
926 }
927}
928
929impl fidl::endpoints::Responder for VirtioBalloonReadyResponder {
930 type ControlHandle = VirtioBalloonControlHandle;
931
932 fn control_handle(&self) -> &VirtioBalloonControlHandle {
933 &self.control_handle
934 }
935
936 fn drop_without_shutdown(mut self) {
937 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
939 std::mem::forget(self);
941 }
942}
943
944impl VirtioBalloonReadyResponder {
945 pub fn send(self) -> Result<(), fidl::Error> {
949 let _result = self.send_raw();
950 if _result.is_err() {
951 self.control_handle.shutdown();
952 }
953 self.drop_without_shutdown();
954 _result
955 }
956
957 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
959 let _result = self.send_raw();
960 self.drop_without_shutdown();
961 _result
962 }
963
964 fn send_raw(&self) -> Result<(), fidl::Error> {
965 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
966 (),
967 self.tx_id,
968 0x45707654f5d23c3f,
969 fidl::encoding::DynamicFlags::empty(),
970 )
971 }
972}
973
974#[must_use = "FIDL methods require a response to be sent"]
975#[derive(Debug)]
976pub struct VirtioBalloonStartResponder {
977 control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
978 tx_id: u32,
979}
980
981impl std::ops::Drop for VirtioBalloonStartResponder {
985 fn drop(&mut self) {
986 self.control_handle.shutdown();
987 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
989 }
990}
991
992impl fidl::endpoints::Responder for VirtioBalloonStartResponder {
993 type ControlHandle = VirtioBalloonControlHandle;
994
995 fn control_handle(&self) -> &VirtioBalloonControlHandle {
996 &self.control_handle
997 }
998
999 fn drop_without_shutdown(mut self) {
1000 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1002 std::mem::forget(self);
1004 }
1005}
1006
1007impl VirtioBalloonStartResponder {
1008 pub fn send(self) -> Result<(), fidl::Error> {
1012 let _result = self.send_raw();
1013 if _result.is_err() {
1014 self.control_handle.shutdown();
1015 }
1016 self.drop_without_shutdown();
1017 _result
1018 }
1019
1020 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1022 let _result = self.send_raw();
1023 self.drop_without_shutdown();
1024 _result
1025 }
1026
1027 fn send_raw(&self) -> Result<(), fidl::Error> {
1028 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1029 (),
1030 self.tx_id,
1031 0x26645282fddf6f46,
1032 fidl::encoding::DynamicFlags::empty(),
1033 )
1034 }
1035}
1036
1037#[must_use = "FIDL methods require a response to be sent"]
1038#[derive(Debug)]
1039pub struct VirtioBalloonGetMemStatsResponder {
1040 control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
1041 tx_id: u32,
1042}
1043
1044impl std::ops::Drop for VirtioBalloonGetMemStatsResponder {
1048 fn drop(&mut self) {
1049 self.control_handle.shutdown();
1050 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1052 }
1053}
1054
1055impl fidl::endpoints::Responder for VirtioBalloonGetMemStatsResponder {
1056 type ControlHandle = VirtioBalloonControlHandle;
1057
1058 fn control_handle(&self) -> &VirtioBalloonControlHandle {
1059 &self.control_handle
1060 }
1061
1062 fn drop_without_shutdown(mut self) {
1063 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1065 std::mem::forget(self);
1067 }
1068}
1069
1070impl VirtioBalloonGetMemStatsResponder {
1071 pub fn send(
1075 self,
1076 mut status: i32,
1077 mut mem_stats: Option<&[fidl_fuchsia_virtualization::MemStat]>,
1078 ) -> Result<(), fidl::Error> {
1079 let _result = self.send_raw(status, mem_stats);
1080 if _result.is_err() {
1081 self.control_handle.shutdown();
1082 }
1083 self.drop_without_shutdown();
1084 _result
1085 }
1086
1087 pub fn send_no_shutdown_on_err(
1089 self,
1090 mut status: i32,
1091 mut mem_stats: Option<&[fidl_fuchsia_virtualization::MemStat]>,
1092 ) -> Result<(), fidl::Error> {
1093 let _result = self.send_raw(status, mem_stats);
1094 self.drop_without_shutdown();
1095 _result
1096 }
1097
1098 fn send_raw(
1099 &self,
1100 mut status: i32,
1101 mut mem_stats: Option<&[fidl_fuchsia_virtualization::MemStat]>,
1102 ) -> Result<(), fidl::Error> {
1103 self.control_handle.inner.send::<VirtioBalloonGetMemStatsResponse>(
1104 (status, mem_stats),
1105 self.tx_id,
1106 0x6641f4c296607e24,
1107 fidl::encoding::DynamicFlags::empty(),
1108 )
1109 }
1110}
1111
1112#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1113pub struct VirtioBlockMarker;
1114
1115impl fidl::endpoints::ProtocolMarker for VirtioBlockMarker {
1116 type Proxy = VirtioBlockProxy;
1117 type RequestStream = VirtioBlockRequestStream;
1118 #[cfg(target_os = "fuchsia")]
1119 type SynchronousProxy = VirtioBlockSynchronousProxy;
1120
1121 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioBlock";
1122}
1123impl fidl::endpoints::DiscoverableProtocolMarker for VirtioBlockMarker {}
1124
1125pub trait VirtioBlockProxyInterface: Send + Sync {
1126 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1127 fn r#configure_queue(
1128 &self,
1129 queue: u16,
1130 size: u16,
1131 desc: u64,
1132 avail: u64,
1133 used: u64,
1134 ) -> Self::ConfigureQueueResponseFut;
1135 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
1136 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1137 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
1138 type StartResponseFut: std::future::Future<Output = Result<(u64, u32), fidl::Error>> + Send;
1139 fn r#start(
1140 &self,
1141 start_info: StartInfo,
1142 spec: fidl_fuchsia_virtualization::BlockSpec,
1143 ) -> Self::StartResponseFut;
1144}
1145#[derive(Debug)]
1146#[cfg(target_os = "fuchsia")]
1147pub struct VirtioBlockSynchronousProxy {
1148 client: fidl::client::sync::Client,
1149}
1150
1151#[cfg(target_os = "fuchsia")]
1152impl fidl::endpoints::SynchronousProxy for VirtioBlockSynchronousProxy {
1153 type Proxy = VirtioBlockProxy;
1154 type Protocol = VirtioBlockMarker;
1155
1156 fn from_channel(inner: fidl::Channel) -> Self {
1157 Self::new(inner)
1158 }
1159
1160 fn into_channel(self) -> fidl::Channel {
1161 self.client.into_channel()
1162 }
1163
1164 fn as_channel(&self) -> &fidl::Channel {
1165 self.client.as_channel()
1166 }
1167}
1168
1169#[cfg(target_os = "fuchsia")]
1170impl VirtioBlockSynchronousProxy {
1171 pub fn new(channel: fidl::Channel) -> Self {
1172 let protocol_name = <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1173 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1174 }
1175
1176 pub fn into_channel(self) -> fidl::Channel {
1177 self.client.into_channel()
1178 }
1179
1180 pub fn wait_for_event(
1183 &self,
1184 deadline: zx::MonotonicInstant,
1185 ) -> Result<VirtioBlockEvent, fidl::Error> {
1186 VirtioBlockEvent::decode(self.client.wait_for_event(deadline)?)
1187 }
1188
1189 pub fn r#configure_queue(
1192 &self,
1193 mut queue: u16,
1194 mut size: u16,
1195 mut desc: u64,
1196 mut avail: u64,
1197 mut used: u64,
1198 ___deadline: zx::MonotonicInstant,
1199 ) -> Result<(), fidl::Error> {
1200 let _response = self
1201 .client
1202 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
1203 (queue, size, desc, avail, used),
1204 0x72b44fb963480b11,
1205 fidl::encoding::DynamicFlags::empty(),
1206 ___deadline,
1207 )?;
1208 Ok(_response)
1209 }
1210
1211 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
1213 self.client.send::<VirtioDeviceNotifyQueueRequest>(
1214 (queue,),
1215 0x6e3a61d652499244,
1216 fidl::encoding::DynamicFlags::empty(),
1217 )
1218 }
1219
1220 pub fn r#ready(
1223 &self,
1224 mut negotiated_features: u32,
1225 ___deadline: zx::MonotonicInstant,
1226 ) -> Result<(), fidl::Error> {
1227 let _response =
1228 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
1229 (negotiated_features,),
1230 0x45707654f5d23c3f,
1231 fidl::encoding::DynamicFlags::empty(),
1232 ___deadline,
1233 )?;
1234 Ok(_response)
1235 }
1236
1237 pub fn r#start(
1239 &self,
1240 mut start_info: StartInfo,
1241 mut spec: fidl_fuchsia_virtualization::BlockSpec,
1242 ___deadline: zx::MonotonicInstant,
1243 ) -> Result<(u64, u32), fidl::Error> {
1244 let _response =
1245 self.client.send_query::<VirtioBlockStartRequest, VirtioBlockStartResponse>(
1246 (&mut start_info, &mut spec),
1247 0x5ef6a4b9ce9adcb2,
1248 fidl::encoding::DynamicFlags::empty(),
1249 ___deadline,
1250 )?;
1251 Ok((_response.capacity, _response.block_size))
1252 }
1253}
1254
1255#[cfg(target_os = "fuchsia")]
1256impl From<VirtioBlockSynchronousProxy> for zx::Handle {
1257 fn from(value: VirtioBlockSynchronousProxy) -> Self {
1258 value.into_channel().into()
1259 }
1260}
1261
1262#[cfg(target_os = "fuchsia")]
1263impl From<fidl::Channel> for VirtioBlockSynchronousProxy {
1264 fn from(value: fidl::Channel) -> Self {
1265 Self::new(value)
1266 }
1267}
1268
1269#[cfg(target_os = "fuchsia")]
1270impl fidl::endpoints::FromClient for VirtioBlockSynchronousProxy {
1271 type Protocol = VirtioBlockMarker;
1272
1273 fn from_client(value: fidl::endpoints::ClientEnd<VirtioBlockMarker>) -> Self {
1274 Self::new(value.into_channel())
1275 }
1276}
1277
1278#[derive(Debug, Clone)]
1279pub struct VirtioBlockProxy {
1280 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1281}
1282
1283impl fidl::endpoints::Proxy for VirtioBlockProxy {
1284 type Protocol = VirtioBlockMarker;
1285
1286 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1287 Self::new(inner)
1288 }
1289
1290 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1291 self.client.into_channel().map_err(|client| Self { client })
1292 }
1293
1294 fn as_channel(&self) -> &::fidl::AsyncChannel {
1295 self.client.as_channel()
1296 }
1297}
1298
1299impl VirtioBlockProxy {
1300 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1302 let protocol_name = <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1303 Self { client: fidl::client::Client::new(channel, protocol_name) }
1304 }
1305
1306 pub fn take_event_stream(&self) -> VirtioBlockEventStream {
1312 VirtioBlockEventStream { event_receiver: self.client.take_event_receiver() }
1313 }
1314
1315 pub fn r#configure_queue(
1318 &self,
1319 mut queue: u16,
1320 mut size: u16,
1321 mut desc: u64,
1322 mut avail: u64,
1323 mut used: u64,
1324 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1325 VirtioBlockProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
1326 }
1327
1328 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
1330 VirtioBlockProxyInterface::r#notify_queue(self, queue)
1331 }
1332
1333 pub fn r#ready(
1336 &self,
1337 mut negotiated_features: u32,
1338 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1339 VirtioBlockProxyInterface::r#ready(self, negotiated_features)
1340 }
1341
1342 pub fn r#start(
1344 &self,
1345 mut start_info: StartInfo,
1346 mut spec: fidl_fuchsia_virtualization::BlockSpec,
1347 ) -> fidl::client::QueryResponseFut<(u64, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
1348 {
1349 VirtioBlockProxyInterface::r#start(self, start_info, spec)
1350 }
1351}
1352
1353impl VirtioBlockProxyInterface for VirtioBlockProxy {
1354 type ConfigureQueueResponseFut =
1355 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1356 fn r#configure_queue(
1357 &self,
1358 mut queue: u16,
1359 mut size: u16,
1360 mut desc: u64,
1361 mut avail: u64,
1362 mut used: u64,
1363 ) -> Self::ConfigureQueueResponseFut {
1364 fn _decode(
1365 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1366 ) -> Result<(), fidl::Error> {
1367 let _response = fidl::client::decode_transaction_body::<
1368 fidl::encoding::EmptyPayload,
1369 fidl::encoding::DefaultFuchsiaResourceDialect,
1370 0x72b44fb963480b11,
1371 >(_buf?)?;
1372 Ok(_response)
1373 }
1374 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
1375 (queue, size, desc, avail, used),
1376 0x72b44fb963480b11,
1377 fidl::encoding::DynamicFlags::empty(),
1378 _decode,
1379 )
1380 }
1381
1382 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
1383 self.client.send::<VirtioDeviceNotifyQueueRequest>(
1384 (queue,),
1385 0x6e3a61d652499244,
1386 fidl::encoding::DynamicFlags::empty(),
1387 )
1388 }
1389
1390 type ReadyResponseFut =
1391 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1392 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
1393 fn _decode(
1394 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1395 ) -> Result<(), fidl::Error> {
1396 let _response = fidl::client::decode_transaction_body::<
1397 fidl::encoding::EmptyPayload,
1398 fidl::encoding::DefaultFuchsiaResourceDialect,
1399 0x45707654f5d23c3f,
1400 >(_buf?)?;
1401 Ok(_response)
1402 }
1403 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
1404 (negotiated_features,),
1405 0x45707654f5d23c3f,
1406 fidl::encoding::DynamicFlags::empty(),
1407 _decode,
1408 )
1409 }
1410
1411 type StartResponseFut =
1412 fidl::client::QueryResponseFut<(u64, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
1413 fn r#start(
1414 &self,
1415 mut start_info: StartInfo,
1416 mut spec: fidl_fuchsia_virtualization::BlockSpec,
1417 ) -> Self::StartResponseFut {
1418 fn _decode(
1419 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1420 ) -> Result<(u64, u32), fidl::Error> {
1421 let _response = fidl::client::decode_transaction_body::<
1422 VirtioBlockStartResponse,
1423 fidl::encoding::DefaultFuchsiaResourceDialect,
1424 0x5ef6a4b9ce9adcb2,
1425 >(_buf?)?;
1426 Ok((_response.capacity, _response.block_size))
1427 }
1428 self.client.send_query_and_decode::<VirtioBlockStartRequest, (u64, u32)>(
1429 (&mut start_info, &mut spec),
1430 0x5ef6a4b9ce9adcb2,
1431 fidl::encoding::DynamicFlags::empty(),
1432 _decode,
1433 )
1434 }
1435}
1436
1437pub struct VirtioBlockEventStream {
1438 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1439}
1440
1441impl std::marker::Unpin for VirtioBlockEventStream {}
1442
1443impl futures::stream::FusedStream for VirtioBlockEventStream {
1444 fn is_terminated(&self) -> bool {
1445 self.event_receiver.is_terminated()
1446 }
1447}
1448
1449impl futures::Stream for VirtioBlockEventStream {
1450 type Item = Result<VirtioBlockEvent, fidl::Error>;
1451
1452 fn poll_next(
1453 mut self: std::pin::Pin<&mut Self>,
1454 cx: &mut std::task::Context<'_>,
1455 ) -> std::task::Poll<Option<Self::Item>> {
1456 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1457 &mut self.event_receiver,
1458 cx
1459 )?) {
1460 Some(buf) => std::task::Poll::Ready(Some(VirtioBlockEvent::decode(buf))),
1461 None => std::task::Poll::Ready(None),
1462 }
1463 }
1464}
1465
1466#[derive(Debug)]
1467pub enum VirtioBlockEvent {}
1468
1469impl VirtioBlockEvent {
1470 fn decode(
1472 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1473 ) -> Result<VirtioBlockEvent, fidl::Error> {
1474 let (bytes, _handles) = buf.split_mut();
1475 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1476 debug_assert_eq!(tx_header.tx_id, 0);
1477 match tx_header.ordinal {
1478 _ => Err(fidl::Error::UnknownOrdinal {
1479 ordinal: tx_header.ordinal,
1480 protocol_name: <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1481 }),
1482 }
1483 }
1484}
1485
1486pub struct VirtioBlockRequestStream {
1488 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1489 is_terminated: bool,
1490}
1491
1492impl std::marker::Unpin for VirtioBlockRequestStream {}
1493
1494impl futures::stream::FusedStream for VirtioBlockRequestStream {
1495 fn is_terminated(&self) -> bool {
1496 self.is_terminated
1497 }
1498}
1499
1500impl fidl::endpoints::RequestStream for VirtioBlockRequestStream {
1501 type Protocol = VirtioBlockMarker;
1502 type ControlHandle = VirtioBlockControlHandle;
1503
1504 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1505 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1506 }
1507
1508 fn control_handle(&self) -> Self::ControlHandle {
1509 VirtioBlockControlHandle { inner: self.inner.clone() }
1510 }
1511
1512 fn into_inner(
1513 self,
1514 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1515 {
1516 (self.inner, self.is_terminated)
1517 }
1518
1519 fn from_inner(
1520 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1521 is_terminated: bool,
1522 ) -> Self {
1523 Self { inner, is_terminated }
1524 }
1525}
1526
1527impl futures::Stream for VirtioBlockRequestStream {
1528 type Item = Result<VirtioBlockRequest, fidl::Error>;
1529
1530 fn poll_next(
1531 mut self: std::pin::Pin<&mut Self>,
1532 cx: &mut std::task::Context<'_>,
1533 ) -> std::task::Poll<Option<Self::Item>> {
1534 let this = &mut *self;
1535 if this.inner.check_shutdown(cx) {
1536 this.is_terminated = true;
1537 return std::task::Poll::Ready(None);
1538 }
1539 if this.is_terminated {
1540 panic!("polled VirtioBlockRequestStream after completion");
1541 }
1542 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1543 |bytes, handles| {
1544 match this.inner.channel().read_etc(cx, bytes, handles) {
1545 std::task::Poll::Ready(Ok(())) => {}
1546 std::task::Poll::Pending => return std::task::Poll::Pending,
1547 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1548 this.is_terminated = true;
1549 return std::task::Poll::Ready(None);
1550 }
1551 std::task::Poll::Ready(Err(e)) => {
1552 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1553 e.into(),
1554 ))));
1555 }
1556 }
1557
1558 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1560
1561 std::task::Poll::Ready(Some(match header.ordinal {
1562 0x72b44fb963480b11 => {
1563 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1564 let mut req = fidl::new_empty!(
1565 VirtioDeviceConfigureQueueRequest,
1566 fidl::encoding::DefaultFuchsiaResourceDialect
1567 );
1568 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
1569 let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
1570 Ok(VirtioBlockRequest::ConfigureQueue {
1571 queue: req.queue,
1572 size: req.size,
1573 desc: req.desc,
1574 avail: req.avail,
1575 used: req.used,
1576
1577 responder: VirtioBlockConfigureQueueResponder {
1578 control_handle: std::mem::ManuallyDrop::new(control_handle),
1579 tx_id: header.tx_id,
1580 },
1581 })
1582 }
1583 0x6e3a61d652499244 => {
1584 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1585 let mut req = fidl::new_empty!(
1586 VirtioDeviceNotifyQueueRequest,
1587 fidl::encoding::DefaultFuchsiaResourceDialect
1588 );
1589 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
1590 let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
1591 Ok(VirtioBlockRequest::NotifyQueue { queue: req.queue, control_handle })
1592 }
1593 0x45707654f5d23c3f => {
1594 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1595 let mut req = fidl::new_empty!(
1596 VirtioDeviceReadyRequest,
1597 fidl::encoding::DefaultFuchsiaResourceDialect
1598 );
1599 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
1600 let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
1601 Ok(VirtioBlockRequest::Ready {
1602 negotiated_features: req.negotiated_features,
1603
1604 responder: VirtioBlockReadyResponder {
1605 control_handle: std::mem::ManuallyDrop::new(control_handle),
1606 tx_id: header.tx_id,
1607 },
1608 })
1609 }
1610 0x5ef6a4b9ce9adcb2 => {
1611 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1612 let mut req = fidl::new_empty!(
1613 VirtioBlockStartRequest,
1614 fidl::encoding::DefaultFuchsiaResourceDialect
1615 );
1616 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioBlockStartRequest>(&header, _body_bytes, handles, &mut req)?;
1617 let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
1618 Ok(VirtioBlockRequest::Start {
1619 start_info: req.start_info,
1620 spec: req.spec,
1621
1622 responder: VirtioBlockStartResponder {
1623 control_handle: std::mem::ManuallyDrop::new(control_handle),
1624 tx_id: header.tx_id,
1625 },
1626 })
1627 }
1628 _ => Err(fidl::Error::UnknownOrdinal {
1629 ordinal: header.ordinal,
1630 protocol_name:
1631 <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1632 }),
1633 }))
1634 },
1635 )
1636 }
1637}
1638
1639#[derive(Debug)]
1640pub enum VirtioBlockRequest {
1641 ConfigureQueue {
1644 queue: u16,
1645 size: u16,
1646 desc: u64,
1647 avail: u64,
1648 used: u64,
1649 responder: VirtioBlockConfigureQueueResponder,
1650 },
1651 NotifyQueue { queue: u16, control_handle: VirtioBlockControlHandle },
1653 Ready { negotiated_features: u32, responder: VirtioBlockReadyResponder },
1656 Start {
1658 start_info: StartInfo,
1659 spec: fidl_fuchsia_virtualization::BlockSpec,
1660 responder: VirtioBlockStartResponder,
1661 },
1662}
1663
1664impl VirtioBlockRequest {
1665 #[allow(irrefutable_let_patterns)]
1666 pub fn into_configure_queue(
1667 self,
1668 ) -> Option<(u16, u16, u64, u64, u64, VirtioBlockConfigureQueueResponder)> {
1669 if let VirtioBlockRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
1670 self
1671 {
1672 Some((queue, size, desc, avail, used, responder))
1673 } else {
1674 None
1675 }
1676 }
1677
1678 #[allow(irrefutable_let_patterns)]
1679 pub fn into_notify_queue(self) -> Option<(u16, VirtioBlockControlHandle)> {
1680 if let VirtioBlockRequest::NotifyQueue { queue, control_handle } = self {
1681 Some((queue, control_handle))
1682 } else {
1683 None
1684 }
1685 }
1686
1687 #[allow(irrefutable_let_patterns)]
1688 pub fn into_ready(self) -> Option<(u32, VirtioBlockReadyResponder)> {
1689 if let VirtioBlockRequest::Ready { negotiated_features, responder } = self {
1690 Some((negotiated_features, responder))
1691 } else {
1692 None
1693 }
1694 }
1695
1696 #[allow(irrefutable_let_patterns)]
1697 pub fn into_start(
1698 self,
1699 ) -> Option<(StartInfo, fidl_fuchsia_virtualization::BlockSpec, VirtioBlockStartResponder)>
1700 {
1701 if let VirtioBlockRequest::Start { start_info, spec, responder } = self {
1702 Some((start_info, spec, responder))
1703 } else {
1704 None
1705 }
1706 }
1707
1708 pub fn method_name(&self) -> &'static str {
1710 match *self {
1711 VirtioBlockRequest::ConfigureQueue { .. } => "configure_queue",
1712 VirtioBlockRequest::NotifyQueue { .. } => "notify_queue",
1713 VirtioBlockRequest::Ready { .. } => "ready",
1714 VirtioBlockRequest::Start { .. } => "start",
1715 }
1716 }
1717}
1718
1719#[derive(Debug, Clone)]
1720pub struct VirtioBlockControlHandle {
1721 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1722}
1723
1724impl fidl::endpoints::ControlHandle for VirtioBlockControlHandle {
1725 fn shutdown(&self) {
1726 self.inner.shutdown()
1727 }
1728 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1729 self.inner.shutdown_with_epitaph(status)
1730 }
1731
1732 fn is_closed(&self) -> bool {
1733 self.inner.channel().is_closed()
1734 }
1735 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1736 self.inner.channel().on_closed()
1737 }
1738
1739 #[cfg(target_os = "fuchsia")]
1740 fn signal_peer(
1741 &self,
1742 clear_mask: zx::Signals,
1743 set_mask: zx::Signals,
1744 ) -> Result<(), zx_status::Status> {
1745 use fidl::Peered;
1746 self.inner.channel().signal_peer(clear_mask, set_mask)
1747 }
1748}
1749
1750impl VirtioBlockControlHandle {}
1751
1752#[must_use = "FIDL methods require a response to be sent"]
1753#[derive(Debug)]
1754pub struct VirtioBlockConfigureQueueResponder {
1755 control_handle: std::mem::ManuallyDrop<VirtioBlockControlHandle>,
1756 tx_id: u32,
1757}
1758
1759impl std::ops::Drop for VirtioBlockConfigureQueueResponder {
1763 fn drop(&mut self) {
1764 self.control_handle.shutdown();
1765 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1767 }
1768}
1769
1770impl fidl::endpoints::Responder for VirtioBlockConfigureQueueResponder {
1771 type ControlHandle = VirtioBlockControlHandle;
1772
1773 fn control_handle(&self) -> &VirtioBlockControlHandle {
1774 &self.control_handle
1775 }
1776
1777 fn drop_without_shutdown(mut self) {
1778 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1780 std::mem::forget(self);
1782 }
1783}
1784
1785impl VirtioBlockConfigureQueueResponder {
1786 pub fn send(self) -> Result<(), fidl::Error> {
1790 let _result = self.send_raw();
1791 if _result.is_err() {
1792 self.control_handle.shutdown();
1793 }
1794 self.drop_without_shutdown();
1795 _result
1796 }
1797
1798 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1800 let _result = self.send_raw();
1801 self.drop_without_shutdown();
1802 _result
1803 }
1804
1805 fn send_raw(&self) -> Result<(), fidl::Error> {
1806 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1807 (),
1808 self.tx_id,
1809 0x72b44fb963480b11,
1810 fidl::encoding::DynamicFlags::empty(),
1811 )
1812 }
1813}
1814
1815#[must_use = "FIDL methods require a response to be sent"]
1816#[derive(Debug)]
1817pub struct VirtioBlockReadyResponder {
1818 control_handle: std::mem::ManuallyDrop<VirtioBlockControlHandle>,
1819 tx_id: u32,
1820}
1821
1822impl std::ops::Drop for VirtioBlockReadyResponder {
1826 fn drop(&mut self) {
1827 self.control_handle.shutdown();
1828 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1830 }
1831}
1832
1833impl fidl::endpoints::Responder for VirtioBlockReadyResponder {
1834 type ControlHandle = VirtioBlockControlHandle;
1835
1836 fn control_handle(&self) -> &VirtioBlockControlHandle {
1837 &self.control_handle
1838 }
1839
1840 fn drop_without_shutdown(mut self) {
1841 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1843 std::mem::forget(self);
1845 }
1846}
1847
1848impl VirtioBlockReadyResponder {
1849 pub fn send(self) -> Result<(), fidl::Error> {
1853 let _result = self.send_raw();
1854 if _result.is_err() {
1855 self.control_handle.shutdown();
1856 }
1857 self.drop_without_shutdown();
1858 _result
1859 }
1860
1861 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1863 let _result = self.send_raw();
1864 self.drop_without_shutdown();
1865 _result
1866 }
1867
1868 fn send_raw(&self) -> Result<(), fidl::Error> {
1869 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1870 (),
1871 self.tx_id,
1872 0x45707654f5d23c3f,
1873 fidl::encoding::DynamicFlags::empty(),
1874 )
1875 }
1876}
1877
1878#[must_use = "FIDL methods require a response to be sent"]
1879#[derive(Debug)]
1880pub struct VirtioBlockStartResponder {
1881 control_handle: std::mem::ManuallyDrop<VirtioBlockControlHandle>,
1882 tx_id: u32,
1883}
1884
1885impl std::ops::Drop for VirtioBlockStartResponder {
1889 fn drop(&mut self) {
1890 self.control_handle.shutdown();
1891 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1893 }
1894}
1895
1896impl fidl::endpoints::Responder for VirtioBlockStartResponder {
1897 type ControlHandle = VirtioBlockControlHandle;
1898
1899 fn control_handle(&self) -> &VirtioBlockControlHandle {
1900 &self.control_handle
1901 }
1902
1903 fn drop_without_shutdown(mut self) {
1904 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1906 std::mem::forget(self);
1908 }
1909}
1910
1911impl VirtioBlockStartResponder {
1912 pub fn send(self, mut capacity: u64, mut block_size: u32) -> Result<(), fidl::Error> {
1916 let _result = self.send_raw(capacity, block_size);
1917 if _result.is_err() {
1918 self.control_handle.shutdown();
1919 }
1920 self.drop_without_shutdown();
1921 _result
1922 }
1923
1924 pub fn send_no_shutdown_on_err(
1926 self,
1927 mut capacity: u64,
1928 mut block_size: u32,
1929 ) -> Result<(), fidl::Error> {
1930 let _result = self.send_raw(capacity, block_size);
1931 self.drop_without_shutdown();
1932 _result
1933 }
1934
1935 fn send_raw(&self, mut capacity: u64, mut block_size: u32) -> Result<(), fidl::Error> {
1936 self.control_handle.inner.send::<VirtioBlockStartResponse>(
1937 (capacity, block_size),
1938 self.tx_id,
1939 0x5ef6a4b9ce9adcb2,
1940 fidl::encoding::DynamicFlags::empty(),
1941 )
1942 }
1943}
1944
1945#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1946pub struct VirtioConsoleMarker;
1947
1948impl fidl::endpoints::ProtocolMarker for VirtioConsoleMarker {
1949 type Proxy = VirtioConsoleProxy;
1950 type RequestStream = VirtioConsoleRequestStream;
1951 #[cfg(target_os = "fuchsia")]
1952 type SynchronousProxy = VirtioConsoleSynchronousProxy;
1953
1954 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioConsole";
1955}
1956impl fidl::endpoints::DiscoverableProtocolMarker for VirtioConsoleMarker {}
1957
1958pub trait VirtioConsoleProxyInterface: Send + Sync {
1959 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1960 fn r#configure_queue(
1961 &self,
1962 queue: u16,
1963 size: u16,
1964 desc: u64,
1965 avail: u64,
1966 used: u64,
1967 ) -> Self::ConfigureQueueResponseFut;
1968 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
1969 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1970 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
1971 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1972 fn r#start(&self, start_info: StartInfo, socket: fidl::Socket) -> Self::StartResponseFut;
1973}
1974#[derive(Debug)]
1975#[cfg(target_os = "fuchsia")]
1976pub struct VirtioConsoleSynchronousProxy {
1977 client: fidl::client::sync::Client,
1978}
1979
1980#[cfg(target_os = "fuchsia")]
1981impl fidl::endpoints::SynchronousProxy for VirtioConsoleSynchronousProxy {
1982 type Proxy = VirtioConsoleProxy;
1983 type Protocol = VirtioConsoleMarker;
1984
1985 fn from_channel(inner: fidl::Channel) -> Self {
1986 Self::new(inner)
1987 }
1988
1989 fn into_channel(self) -> fidl::Channel {
1990 self.client.into_channel()
1991 }
1992
1993 fn as_channel(&self) -> &fidl::Channel {
1994 self.client.as_channel()
1995 }
1996}
1997
1998#[cfg(target_os = "fuchsia")]
1999impl VirtioConsoleSynchronousProxy {
2000 pub fn new(channel: fidl::Channel) -> Self {
2001 let protocol_name = <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2002 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2003 }
2004
2005 pub fn into_channel(self) -> fidl::Channel {
2006 self.client.into_channel()
2007 }
2008
2009 pub fn wait_for_event(
2012 &self,
2013 deadline: zx::MonotonicInstant,
2014 ) -> Result<VirtioConsoleEvent, fidl::Error> {
2015 VirtioConsoleEvent::decode(self.client.wait_for_event(deadline)?)
2016 }
2017
2018 pub fn r#configure_queue(
2021 &self,
2022 mut queue: u16,
2023 mut size: u16,
2024 mut desc: u64,
2025 mut avail: u64,
2026 mut used: u64,
2027 ___deadline: zx::MonotonicInstant,
2028 ) -> Result<(), fidl::Error> {
2029 let _response = self
2030 .client
2031 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
2032 (queue, size, desc, avail, used),
2033 0x72b44fb963480b11,
2034 fidl::encoding::DynamicFlags::empty(),
2035 ___deadline,
2036 )?;
2037 Ok(_response)
2038 }
2039
2040 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
2042 self.client.send::<VirtioDeviceNotifyQueueRequest>(
2043 (queue,),
2044 0x6e3a61d652499244,
2045 fidl::encoding::DynamicFlags::empty(),
2046 )
2047 }
2048
2049 pub fn r#ready(
2052 &self,
2053 mut negotiated_features: u32,
2054 ___deadline: zx::MonotonicInstant,
2055 ) -> Result<(), fidl::Error> {
2056 let _response =
2057 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
2058 (negotiated_features,),
2059 0x45707654f5d23c3f,
2060 fidl::encoding::DynamicFlags::empty(),
2061 ___deadline,
2062 )?;
2063 Ok(_response)
2064 }
2065
2066 pub fn r#start(
2068 &self,
2069 mut start_info: StartInfo,
2070 mut socket: fidl::Socket,
2071 ___deadline: zx::MonotonicInstant,
2072 ) -> Result<(), fidl::Error> {
2073 let _response =
2074 self.client.send_query::<VirtioConsoleStartRequest, fidl::encoding::EmptyPayload>(
2075 (&mut start_info, socket),
2076 0x10a6267f2ab7e24c,
2077 fidl::encoding::DynamicFlags::empty(),
2078 ___deadline,
2079 )?;
2080 Ok(_response)
2081 }
2082}
2083
2084#[cfg(target_os = "fuchsia")]
2085impl From<VirtioConsoleSynchronousProxy> for zx::Handle {
2086 fn from(value: VirtioConsoleSynchronousProxy) -> Self {
2087 value.into_channel().into()
2088 }
2089}
2090
2091#[cfg(target_os = "fuchsia")]
2092impl From<fidl::Channel> for VirtioConsoleSynchronousProxy {
2093 fn from(value: fidl::Channel) -> Self {
2094 Self::new(value)
2095 }
2096}
2097
2098#[cfg(target_os = "fuchsia")]
2099impl fidl::endpoints::FromClient for VirtioConsoleSynchronousProxy {
2100 type Protocol = VirtioConsoleMarker;
2101
2102 fn from_client(value: fidl::endpoints::ClientEnd<VirtioConsoleMarker>) -> Self {
2103 Self::new(value.into_channel())
2104 }
2105}
2106
2107#[derive(Debug, Clone)]
2108pub struct VirtioConsoleProxy {
2109 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2110}
2111
2112impl fidl::endpoints::Proxy for VirtioConsoleProxy {
2113 type Protocol = VirtioConsoleMarker;
2114
2115 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2116 Self::new(inner)
2117 }
2118
2119 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2120 self.client.into_channel().map_err(|client| Self { client })
2121 }
2122
2123 fn as_channel(&self) -> &::fidl::AsyncChannel {
2124 self.client.as_channel()
2125 }
2126}
2127
2128impl VirtioConsoleProxy {
2129 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2131 let protocol_name = <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2132 Self { client: fidl::client::Client::new(channel, protocol_name) }
2133 }
2134
2135 pub fn take_event_stream(&self) -> VirtioConsoleEventStream {
2141 VirtioConsoleEventStream { event_receiver: self.client.take_event_receiver() }
2142 }
2143
2144 pub fn r#configure_queue(
2147 &self,
2148 mut queue: u16,
2149 mut size: u16,
2150 mut desc: u64,
2151 mut avail: u64,
2152 mut used: u64,
2153 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2154 VirtioConsoleProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
2155 }
2156
2157 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
2159 VirtioConsoleProxyInterface::r#notify_queue(self, queue)
2160 }
2161
2162 pub fn r#ready(
2165 &self,
2166 mut negotiated_features: u32,
2167 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2168 VirtioConsoleProxyInterface::r#ready(self, negotiated_features)
2169 }
2170
2171 pub fn r#start(
2173 &self,
2174 mut start_info: StartInfo,
2175 mut socket: fidl::Socket,
2176 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2177 VirtioConsoleProxyInterface::r#start(self, start_info, socket)
2178 }
2179}
2180
2181impl VirtioConsoleProxyInterface for VirtioConsoleProxy {
2182 type ConfigureQueueResponseFut =
2183 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2184 fn r#configure_queue(
2185 &self,
2186 mut queue: u16,
2187 mut size: u16,
2188 mut desc: u64,
2189 mut avail: u64,
2190 mut used: u64,
2191 ) -> Self::ConfigureQueueResponseFut {
2192 fn _decode(
2193 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2194 ) -> Result<(), fidl::Error> {
2195 let _response = fidl::client::decode_transaction_body::<
2196 fidl::encoding::EmptyPayload,
2197 fidl::encoding::DefaultFuchsiaResourceDialect,
2198 0x72b44fb963480b11,
2199 >(_buf?)?;
2200 Ok(_response)
2201 }
2202 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
2203 (queue, size, desc, avail, used),
2204 0x72b44fb963480b11,
2205 fidl::encoding::DynamicFlags::empty(),
2206 _decode,
2207 )
2208 }
2209
2210 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
2211 self.client.send::<VirtioDeviceNotifyQueueRequest>(
2212 (queue,),
2213 0x6e3a61d652499244,
2214 fidl::encoding::DynamicFlags::empty(),
2215 )
2216 }
2217
2218 type ReadyResponseFut =
2219 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2220 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
2221 fn _decode(
2222 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2223 ) -> Result<(), fidl::Error> {
2224 let _response = fidl::client::decode_transaction_body::<
2225 fidl::encoding::EmptyPayload,
2226 fidl::encoding::DefaultFuchsiaResourceDialect,
2227 0x45707654f5d23c3f,
2228 >(_buf?)?;
2229 Ok(_response)
2230 }
2231 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
2232 (negotiated_features,),
2233 0x45707654f5d23c3f,
2234 fidl::encoding::DynamicFlags::empty(),
2235 _decode,
2236 )
2237 }
2238
2239 type StartResponseFut =
2240 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2241 fn r#start(
2242 &self,
2243 mut start_info: StartInfo,
2244 mut socket: fidl::Socket,
2245 ) -> Self::StartResponseFut {
2246 fn _decode(
2247 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2248 ) -> Result<(), fidl::Error> {
2249 let _response = fidl::client::decode_transaction_body::<
2250 fidl::encoding::EmptyPayload,
2251 fidl::encoding::DefaultFuchsiaResourceDialect,
2252 0x10a6267f2ab7e24c,
2253 >(_buf?)?;
2254 Ok(_response)
2255 }
2256 self.client.send_query_and_decode::<VirtioConsoleStartRequest, ()>(
2257 (&mut start_info, socket),
2258 0x10a6267f2ab7e24c,
2259 fidl::encoding::DynamicFlags::empty(),
2260 _decode,
2261 )
2262 }
2263}
2264
2265pub struct VirtioConsoleEventStream {
2266 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2267}
2268
2269impl std::marker::Unpin for VirtioConsoleEventStream {}
2270
2271impl futures::stream::FusedStream for VirtioConsoleEventStream {
2272 fn is_terminated(&self) -> bool {
2273 self.event_receiver.is_terminated()
2274 }
2275}
2276
2277impl futures::Stream for VirtioConsoleEventStream {
2278 type Item = Result<VirtioConsoleEvent, fidl::Error>;
2279
2280 fn poll_next(
2281 mut self: std::pin::Pin<&mut Self>,
2282 cx: &mut std::task::Context<'_>,
2283 ) -> std::task::Poll<Option<Self::Item>> {
2284 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2285 &mut self.event_receiver,
2286 cx
2287 )?) {
2288 Some(buf) => std::task::Poll::Ready(Some(VirtioConsoleEvent::decode(buf))),
2289 None => std::task::Poll::Ready(None),
2290 }
2291 }
2292}
2293
2294#[derive(Debug)]
2295pub enum VirtioConsoleEvent {}
2296
2297impl VirtioConsoleEvent {
2298 fn decode(
2300 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2301 ) -> Result<VirtioConsoleEvent, fidl::Error> {
2302 let (bytes, _handles) = buf.split_mut();
2303 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2304 debug_assert_eq!(tx_header.tx_id, 0);
2305 match tx_header.ordinal {
2306 _ => Err(fidl::Error::UnknownOrdinal {
2307 ordinal: tx_header.ordinal,
2308 protocol_name: <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2309 }),
2310 }
2311 }
2312}
2313
2314pub struct VirtioConsoleRequestStream {
2316 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2317 is_terminated: bool,
2318}
2319
2320impl std::marker::Unpin for VirtioConsoleRequestStream {}
2321
2322impl futures::stream::FusedStream for VirtioConsoleRequestStream {
2323 fn is_terminated(&self) -> bool {
2324 self.is_terminated
2325 }
2326}
2327
2328impl fidl::endpoints::RequestStream for VirtioConsoleRequestStream {
2329 type Protocol = VirtioConsoleMarker;
2330 type ControlHandle = VirtioConsoleControlHandle;
2331
2332 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2333 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2334 }
2335
2336 fn control_handle(&self) -> Self::ControlHandle {
2337 VirtioConsoleControlHandle { inner: self.inner.clone() }
2338 }
2339
2340 fn into_inner(
2341 self,
2342 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2343 {
2344 (self.inner, self.is_terminated)
2345 }
2346
2347 fn from_inner(
2348 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2349 is_terminated: bool,
2350 ) -> Self {
2351 Self { inner, is_terminated }
2352 }
2353}
2354
2355impl futures::Stream for VirtioConsoleRequestStream {
2356 type Item = Result<VirtioConsoleRequest, fidl::Error>;
2357
2358 fn poll_next(
2359 mut self: std::pin::Pin<&mut Self>,
2360 cx: &mut std::task::Context<'_>,
2361 ) -> std::task::Poll<Option<Self::Item>> {
2362 let this = &mut *self;
2363 if this.inner.check_shutdown(cx) {
2364 this.is_terminated = true;
2365 return std::task::Poll::Ready(None);
2366 }
2367 if this.is_terminated {
2368 panic!("polled VirtioConsoleRequestStream after completion");
2369 }
2370 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2371 |bytes, handles| {
2372 match this.inner.channel().read_etc(cx, bytes, handles) {
2373 std::task::Poll::Ready(Ok(())) => {}
2374 std::task::Poll::Pending => return std::task::Poll::Pending,
2375 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2376 this.is_terminated = true;
2377 return std::task::Poll::Ready(None);
2378 }
2379 std::task::Poll::Ready(Err(e)) => {
2380 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2381 e.into(),
2382 ))));
2383 }
2384 }
2385
2386 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2388
2389 std::task::Poll::Ready(Some(match header.ordinal {
2390 0x72b44fb963480b11 => {
2391 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2392 let mut req = fidl::new_empty!(
2393 VirtioDeviceConfigureQueueRequest,
2394 fidl::encoding::DefaultFuchsiaResourceDialect
2395 );
2396 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
2397 let control_handle =
2398 VirtioConsoleControlHandle { inner: this.inner.clone() };
2399 Ok(VirtioConsoleRequest::ConfigureQueue {
2400 queue: req.queue,
2401 size: req.size,
2402 desc: req.desc,
2403 avail: req.avail,
2404 used: req.used,
2405
2406 responder: VirtioConsoleConfigureQueueResponder {
2407 control_handle: std::mem::ManuallyDrop::new(control_handle),
2408 tx_id: header.tx_id,
2409 },
2410 })
2411 }
2412 0x6e3a61d652499244 => {
2413 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2414 let mut req = fidl::new_empty!(
2415 VirtioDeviceNotifyQueueRequest,
2416 fidl::encoding::DefaultFuchsiaResourceDialect
2417 );
2418 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
2419 let control_handle =
2420 VirtioConsoleControlHandle { inner: this.inner.clone() };
2421 Ok(VirtioConsoleRequest::NotifyQueue { queue: req.queue, control_handle })
2422 }
2423 0x45707654f5d23c3f => {
2424 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2425 let mut req = fidl::new_empty!(
2426 VirtioDeviceReadyRequest,
2427 fidl::encoding::DefaultFuchsiaResourceDialect
2428 );
2429 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
2430 let control_handle =
2431 VirtioConsoleControlHandle { inner: this.inner.clone() };
2432 Ok(VirtioConsoleRequest::Ready {
2433 negotiated_features: req.negotiated_features,
2434
2435 responder: VirtioConsoleReadyResponder {
2436 control_handle: std::mem::ManuallyDrop::new(control_handle),
2437 tx_id: header.tx_id,
2438 },
2439 })
2440 }
2441 0x10a6267f2ab7e24c => {
2442 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2443 let mut req = fidl::new_empty!(
2444 VirtioConsoleStartRequest,
2445 fidl::encoding::DefaultFuchsiaResourceDialect
2446 );
2447 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioConsoleStartRequest>(&header, _body_bytes, handles, &mut req)?;
2448 let control_handle =
2449 VirtioConsoleControlHandle { inner: this.inner.clone() };
2450 Ok(VirtioConsoleRequest::Start {
2451 start_info: req.start_info,
2452 socket: req.socket,
2453
2454 responder: VirtioConsoleStartResponder {
2455 control_handle: std::mem::ManuallyDrop::new(control_handle),
2456 tx_id: header.tx_id,
2457 },
2458 })
2459 }
2460 _ => Err(fidl::Error::UnknownOrdinal {
2461 ordinal: header.ordinal,
2462 protocol_name:
2463 <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2464 }),
2465 }))
2466 },
2467 )
2468 }
2469}
2470
2471#[derive(Debug)]
2472pub enum VirtioConsoleRequest {
2473 ConfigureQueue {
2476 queue: u16,
2477 size: u16,
2478 desc: u64,
2479 avail: u64,
2480 used: u64,
2481 responder: VirtioConsoleConfigureQueueResponder,
2482 },
2483 NotifyQueue { queue: u16, control_handle: VirtioConsoleControlHandle },
2485 Ready { negotiated_features: u32, responder: VirtioConsoleReadyResponder },
2488 Start { start_info: StartInfo, socket: fidl::Socket, responder: VirtioConsoleStartResponder },
2490}
2491
2492impl VirtioConsoleRequest {
2493 #[allow(irrefutable_let_patterns)]
2494 pub fn into_configure_queue(
2495 self,
2496 ) -> Option<(u16, u16, u64, u64, u64, VirtioConsoleConfigureQueueResponder)> {
2497 if let VirtioConsoleRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
2498 self
2499 {
2500 Some((queue, size, desc, avail, used, responder))
2501 } else {
2502 None
2503 }
2504 }
2505
2506 #[allow(irrefutable_let_patterns)]
2507 pub fn into_notify_queue(self) -> Option<(u16, VirtioConsoleControlHandle)> {
2508 if let VirtioConsoleRequest::NotifyQueue { queue, control_handle } = self {
2509 Some((queue, control_handle))
2510 } else {
2511 None
2512 }
2513 }
2514
2515 #[allow(irrefutable_let_patterns)]
2516 pub fn into_ready(self) -> Option<(u32, VirtioConsoleReadyResponder)> {
2517 if let VirtioConsoleRequest::Ready { negotiated_features, responder } = self {
2518 Some((negotiated_features, responder))
2519 } else {
2520 None
2521 }
2522 }
2523
2524 #[allow(irrefutable_let_patterns)]
2525 pub fn into_start(self) -> Option<(StartInfo, fidl::Socket, VirtioConsoleStartResponder)> {
2526 if let VirtioConsoleRequest::Start { start_info, socket, responder } = self {
2527 Some((start_info, socket, responder))
2528 } else {
2529 None
2530 }
2531 }
2532
2533 pub fn method_name(&self) -> &'static str {
2535 match *self {
2536 VirtioConsoleRequest::ConfigureQueue { .. } => "configure_queue",
2537 VirtioConsoleRequest::NotifyQueue { .. } => "notify_queue",
2538 VirtioConsoleRequest::Ready { .. } => "ready",
2539 VirtioConsoleRequest::Start { .. } => "start",
2540 }
2541 }
2542}
2543
2544#[derive(Debug, Clone)]
2545pub struct VirtioConsoleControlHandle {
2546 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2547}
2548
2549impl fidl::endpoints::ControlHandle for VirtioConsoleControlHandle {
2550 fn shutdown(&self) {
2551 self.inner.shutdown()
2552 }
2553 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2554 self.inner.shutdown_with_epitaph(status)
2555 }
2556
2557 fn is_closed(&self) -> bool {
2558 self.inner.channel().is_closed()
2559 }
2560 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2561 self.inner.channel().on_closed()
2562 }
2563
2564 #[cfg(target_os = "fuchsia")]
2565 fn signal_peer(
2566 &self,
2567 clear_mask: zx::Signals,
2568 set_mask: zx::Signals,
2569 ) -> Result<(), zx_status::Status> {
2570 use fidl::Peered;
2571 self.inner.channel().signal_peer(clear_mask, set_mask)
2572 }
2573}
2574
2575impl VirtioConsoleControlHandle {}
2576
2577#[must_use = "FIDL methods require a response to be sent"]
2578#[derive(Debug)]
2579pub struct VirtioConsoleConfigureQueueResponder {
2580 control_handle: std::mem::ManuallyDrop<VirtioConsoleControlHandle>,
2581 tx_id: u32,
2582}
2583
2584impl std::ops::Drop for VirtioConsoleConfigureQueueResponder {
2588 fn drop(&mut self) {
2589 self.control_handle.shutdown();
2590 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2592 }
2593}
2594
2595impl fidl::endpoints::Responder for VirtioConsoleConfigureQueueResponder {
2596 type ControlHandle = VirtioConsoleControlHandle;
2597
2598 fn control_handle(&self) -> &VirtioConsoleControlHandle {
2599 &self.control_handle
2600 }
2601
2602 fn drop_without_shutdown(mut self) {
2603 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2605 std::mem::forget(self);
2607 }
2608}
2609
2610impl VirtioConsoleConfigureQueueResponder {
2611 pub fn send(self) -> Result<(), fidl::Error> {
2615 let _result = self.send_raw();
2616 if _result.is_err() {
2617 self.control_handle.shutdown();
2618 }
2619 self.drop_without_shutdown();
2620 _result
2621 }
2622
2623 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2625 let _result = self.send_raw();
2626 self.drop_without_shutdown();
2627 _result
2628 }
2629
2630 fn send_raw(&self) -> Result<(), fidl::Error> {
2631 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2632 (),
2633 self.tx_id,
2634 0x72b44fb963480b11,
2635 fidl::encoding::DynamicFlags::empty(),
2636 )
2637 }
2638}
2639
2640#[must_use = "FIDL methods require a response to be sent"]
2641#[derive(Debug)]
2642pub struct VirtioConsoleReadyResponder {
2643 control_handle: std::mem::ManuallyDrop<VirtioConsoleControlHandle>,
2644 tx_id: u32,
2645}
2646
2647impl std::ops::Drop for VirtioConsoleReadyResponder {
2651 fn drop(&mut self) {
2652 self.control_handle.shutdown();
2653 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2655 }
2656}
2657
2658impl fidl::endpoints::Responder for VirtioConsoleReadyResponder {
2659 type ControlHandle = VirtioConsoleControlHandle;
2660
2661 fn control_handle(&self) -> &VirtioConsoleControlHandle {
2662 &self.control_handle
2663 }
2664
2665 fn drop_without_shutdown(mut self) {
2666 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2668 std::mem::forget(self);
2670 }
2671}
2672
2673impl VirtioConsoleReadyResponder {
2674 pub fn send(self) -> Result<(), fidl::Error> {
2678 let _result = self.send_raw();
2679 if _result.is_err() {
2680 self.control_handle.shutdown();
2681 }
2682 self.drop_without_shutdown();
2683 _result
2684 }
2685
2686 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2688 let _result = self.send_raw();
2689 self.drop_without_shutdown();
2690 _result
2691 }
2692
2693 fn send_raw(&self) -> Result<(), fidl::Error> {
2694 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2695 (),
2696 self.tx_id,
2697 0x45707654f5d23c3f,
2698 fidl::encoding::DynamicFlags::empty(),
2699 )
2700 }
2701}
2702
2703#[must_use = "FIDL methods require a response to be sent"]
2704#[derive(Debug)]
2705pub struct VirtioConsoleStartResponder {
2706 control_handle: std::mem::ManuallyDrop<VirtioConsoleControlHandle>,
2707 tx_id: u32,
2708}
2709
2710impl std::ops::Drop for VirtioConsoleStartResponder {
2714 fn drop(&mut self) {
2715 self.control_handle.shutdown();
2716 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2718 }
2719}
2720
2721impl fidl::endpoints::Responder for VirtioConsoleStartResponder {
2722 type ControlHandle = VirtioConsoleControlHandle;
2723
2724 fn control_handle(&self) -> &VirtioConsoleControlHandle {
2725 &self.control_handle
2726 }
2727
2728 fn drop_without_shutdown(mut self) {
2729 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2731 std::mem::forget(self);
2733 }
2734}
2735
2736impl VirtioConsoleStartResponder {
2737 pub fn send(self) -> Result<(), fidl::Error> {
2741 let _result = self.send_raw();
2742 if _result.is_err() {
2743 self.control_handle.shutdown();
2744 }
2745 self.drop_without_shutdown();
2746 _result
2747 }
2748
2749 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2751 let _result = self.send_raw();
2752 self.drop_without_shutdown();
2753 _result
2754 }
2755
2756 fn send_raw(&self) -> Result<(), fidl::Error> {
2757 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2758 (),
2759 self.tx_id,
2760 0x10a6267f2ab7e24c,
2761 fidl::encoding::DynamicFlags::empty(),
2762 )
2763 }
2764}
2765
2766#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2767pub struct VirtioDeviceMarker;
2768
2769impl fidl::endpoints::ProtocolMarker for VirtioDeviceMarker {
2770 type Proxy = VirtioDeviceProxy;
2771 type RequestStream = VirtioDeviceRequestStream;
2772 #[cfg(target_os = "fuchsia")]
2773 type SynchronousProxy = VirtioDeviceSynchronousProxy;
2774
2775 const DEBUG_NAME: &'static str = "(anonymous) VirtioDevice";
2776}
2777
2778pub trait VirtioDeviceProxyInterface: Send + Sync {
2779 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2780 fn r#configure_queue(
2781 &self,
2782 queue: u16,
2783 size: u16,
2784 desc: u64,
2785 avail: u64,
2786 used: u64,
2787 ) -> Self::ConfigureQueueResponseFut;
2788 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
2789 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2790 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
2791}
2792#[derive(Debug)]
2793#[cfg(target_os = "fuchsia")]
2794pub struct VirtioDeviceSynchronousProxy {
2795 client: fidl::client::sync::Client,
2796}
2797
2798#[cfg(target_os = "fuchsia")]
2799impl fidl::endpoints::SynchronousProxy for VirtioDeviceSynchronousProxy {
2800 type Proxy = VirtioDeviceProxy;
2801 type Protocol = VirtioDeviceMarker;
2802
2803 fn from_channel(inner: fidl::Channel) -> Self {
2804 Self::new(inner)
2805 }
2806
2807 fn into_channel(self) -> fidl::Channel {
2808 self.client.into_channel()
2809 }
2810
2811 fn as_channel(&self) -> &fidl::Channel {
2812 self.client.as_channel()
2813 }
2814}
2815
2816#[cfg(target_os = "fuchsia")]
2817impl VirtioDeviceSynchronousProxy {
2818 pub fn new(channel: fidl::Channel) -> Self {
2819 let protocol_name = <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2820 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2821 }
2822
2823 pub fn into_channel(self) -> fidl::Channel {
2824 self.client.into_channel()
2825 }
2826
2827 pub fn wait_for_event(
2830 &self,
2831 deadline: zx::MonotonicInstant,
2832 ) -> Result<VirtioDeviceEvent, fidl::Error> {
2833 VirtioDeviceEvent::decode(self.client.wait_for_event(deadline)?)
2834 }
2835
2836 pub fn r#configure_queue(
2839 &self,
2840 mut queue: u16,
2841 mut size: u16,
2842 mut desc: u64,
2843 mut avail: u64,
2844 mut used: u64,
2845 ___deadline: zx::MonotonicInstant,
2846 ) -> Result<(), fidl::Error> {
2847 let _response = self
2848 .client
2849 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
2850 (queue, size, desc, avail, used),
2851 0x72b44fb963480b11,
2852 fidl::encoding::DynamicFlags::empty(),
2853 ___deadline,
2854 )?;
2855 Ok(_response)
2856 }
2857
2858 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
2860 self.client.send::<VirtioDeviceNotifyQueueRequest>(
2861 (queue,),
2862 0x6e3a61d652499244,
2863 fidl::encoding::DynamicFlags::empty(),
2864 )
2865 }
2866
2867 pub fn r#ready(
2870 &self,
2871 mut negotiated_features: u32,
2872 ___deadline: zx::MonotonicInstant,
2873 ) -> Result<(), fidl::Error> {
2874 let _response =
2875 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
2876 (negotiated_features,),
2877 0x45707654f5d23c3f,
2878 fidl::encoding::DynamicFlags::empty(),
2879 ___deadline,
2880 )?;
2881 Ok(_response)
2882 }
2883}
2884
2885#[cfg(target_os = "fuchsia")]
2886impl From<VirtioDeviceSynchronousProxy> for zx::Handle {
2887 fn from(value: VirtioDeviceSynchronousProxy) -> Self {
2888 value.into_channel().into()
2889 }
2890}
2891
2892#[cfg(target_os = "fuchsia")]
2893impl From<fidl::Channel> for VirtioDeviceSynchronousProxy {
2894 fn from(value: fidl::Channel) -> Self {
2895 Self::new(value)
2896 }
2897}
2898
2899#[cfg(target_os = "fuchsia")]
2900impl fidl::endpoints::FromClient for VirtioDeviceSynchronousProxy {
2901 type Protocol = VirtioDeviceMarker;
2902
2903 fn from_client(value: fidl::endpoints::ClientEnd<VirtioDeviceMarker>) -> Self {
2904 Self::new(value.into_channel())
2905 }
2906}
2907
2908#[derive(Debug, Clone)]
2909pub struct VirtioDeviceProxy {
2910 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2911}
2912
2913impl fidl::endpoints::Proxy for VirtioDeviceProxy {
2914 type Protocol = VirtioDeviceMarker;
2915
2916 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2917 Self::new(inner)
2918 }
2919
2920 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2921 self.client.into_channel().map_err(|client| Self { client })
2922 }
2923
2924 fn as_channel(&self) -> &::fidl::AsyncChannel {
2925 self.client.as_channel()
2926 }
2927}
2928
2929impl VirtioDeviceProxy {
2930 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2932 let protocol_name = <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2933 Self { client: fidl::client::Client::new(channel, protocol_name) }
2934 }
2935
2936 pub fn take_event_stream(&self) -> VirtioDeviceEventStream {
2942 VirtioDeviceEventStream { event_receiver: self.client.take_event_receiver() }
2943 }
2944
2945 pub fn r#configure_queue(
2948 &self,
2949 mut queue: u16,
2950 mut size: u16,
2951 mut desc: u64,
2952 mut avail: u64,
2953 mut used: u64,
2954 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2955 VirtioDeviceProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
2956 }
2957
2958 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
2960 VirtioDeviceProxyInterface::r#notify_queue(self, queue)
2961 }
2962
2963 pub fn r#ready(
2966 &self,
2967 mut negotiated_features: u32,
2968 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2969 VirtioDeviceProxyInterface::r#ready(self, negotiated_features)
2970 }
2971}
2972
2973impl VirtioDeviceProxyInterface for VirtioDeviceProxy {
2974 type ConfigureQueueResponseFut =
2975 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2976 fn r#configure_queue(
2977 &self,
2978 mut queue: u16,
2979 mut size: u16,
2980 mut desc: u64,
2981 mut avail: u64,
2982 mut used: u64,
2983 ) -> Self::ConfigureQueueResponseFut {
2984 fn _decode(
2985 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2986 ) -> Result<(), fidl::Error> {
2987 let _response = fidl::client::decode_transaction_body::<
2988 fidl::encoding::EmptyPayload,
2989 fidl::encoding::DefaultFuchsiaResourceDialect,
2990 0x72b44fb963480b11,
2991 >(_buf?)?;
2992 Ok(_response)
2993 }
2994 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
2995 (queue, size, desc, avail, used),
2996 0x72b44fb963480b11,
2997 fidl::encoding::DynamicFlags::empty(),
2998 _decode,
2999 )
3000 }
3001
3002 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
3003 self.client.send::<VirtioDeviceNotifyQueueRequest>(
3004 (queue,),
3005 0x6e3a61d652499244,
3006 fidl::encoding::DynamicFlags::empty(),
3007 )
3008 }
3009
3010 type ReadyResponseFut =
3011 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3012 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
3013 fn _decode(
3014 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3015 ) -> Result<(), fidl::Error> {
3016 let _response = fidl::client::decode_transaction_body::<
3017 fidl::encoding::EmptyPayload,
3018 fidl::encoding::DefaultFuchsiaResourceDialect,
3019 0x45707654f5d23c3f,
3020 >(_buf?)?;
3021 Ok(_response)
3022 }
3023 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
3024 (negotiated_features,),
3025 0x45707654f5d23c3f,
3026 fidl::encoding::DynamicFlags::empty(),
3027 _decode,
3028 )
3029 }
3030}
3031
3032pub struct VirtioDeviceEventStream {
3033 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3034}
3035
3036impl std::marker::Unpin for VirtioDeviceEventStream {}
3037
3038impl futures::stream::FusedStream for VirtioDeviceEventStream {
3039 fn is_terminated(&self) -> bool {
3040 self.event_receiver.is_terminated()
3041 }
3042}
3043
3044impl futures::Stream for VirtioDeviceEventStream {
3045 type Item = Result<VirtioDeviceEvent, fidl::Error>;
3046
3047 fn poll_next(
3048 mut self: std::pin::Pin<&mut Self>,
3049 cx: &mut std::task::Context<'_>,
3050 ) -> std::task::Poll<Option<Self::Item>> {
3051 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3052 &mut self.event_receiver,
3053 cx
3054 )?) {
3055 Some(buf) => std::task::Poll::Ready(Some(VirtioDeviceEvent::decode(buf))),
3056 None => std::task::Poll::Ready(None),
3057 }
3058 }
3059}
3060
3061#[derive(Debug)]
3062pub enum VirtioDeviceEvent {}
3063
3064impl VirtioDeviceEvent {
3065 fn decode(
3067 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3068 ) -> Result<VirtioDeviceEvent, fidl::Error> {
3069 let (bytes, _handles) = buf.split_mut();
3070 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3071 debug_assert_eq!(tx_header.tx_id, 0);
3072 match tx_header.ordinal {
3073 _ => Err(fidl::Error::UnknownOrdinal {
3074 ordinal: tx_header.ordinal,
3075 protocol_name: <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3076 }),
3077 }
3078 }
3079}
3080
3081pub struct VirtioDeviceRequestStream {
3083 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3084 is_terminated: bool,
3085}
3086
3087impl std::marker::Unpin for VirtioDeviceRequestStream {}
3088
3089impl futures::stream::FusedStream for VirtioDeviceRequestStream {
3090 fn is_terminated(&self) -> bool {
3091 self.is_terminated
3092 }
3093}
3094
3095impl fidl::endpoints::RequestStream for VirtioDeviceRequestStream {
3096 type Protocol = VirtioDeviceMarker;
3097 type ControlHandle = VirtioDeviceControlHandle;
3098
3099 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3100 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3101 }
3102
3103 fn control_handle(&self) -> Self::ControlHandle {
3104 VirtioDeviceControlHandle { inner: self.inner.clone() }
3105 }
3106
3107 fn into_inner(
3108 self,
3109 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3110 {
3111 (self.inner, self.is_terminated)
3112 }
3113
3114 fn from_inner(
3115 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3116 is_terminated: bool,
3117 ) -> Self {
3118 Self { inner, is_terminated }
3119 }
3120}
3121
3122impl futures::Stream for VirtioDeviceRequestStream {
3123 type Item = Result<VirtioDeviceRequest, fidl::Error>;
3124
3125 fn poll_next(
3126 mut self: std::pin::Pin<&mut Self>,
3127 cx: &mut std::task::Context<'_>,
3128 ) -> std::task::Poll<Option<Self::Item>> {
3129 let this = &mut *self;
3130 if this.inner.check_shutdown(cx) {
3131 this.is_terminated = true;
3132 return std::task::Poll::Ready(None);
3133 }
3134 if this.is_terminated {
3135 panic!("polled VirtioDeviceRequestStream after completion");
3136 }
3137 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3138 |bytes, handles| {
3139 match this.inner.channel().read_etc(cx, bytes, handles) {
3140 std::task::Poll::Ready(Ok(())) => {}
3141 std::task::Poll::Pending => return std::task::Poll::Pending,
3142 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3143 this.is_terminated = true;
3144 return std::task::Poll::Ready(None);
3145 }
3146 std::task::Poll::Ready(Err(e)) => {
3147 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3148 e.into(),
3149 ))));
3150 }
3151 }
3152
3153 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3155
3156 std::task::Poll::Ready(Some(match header.ordinal {
3157 0x72b44fb963480b11 => {
3158 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3159 let mut req = fidl::new_empty!(
3160 VirtioDeviceConfigureQueueRequest,
3161 fidl::encoding::DefaultFuchsiaResourceDialect
3162 );
3163 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
3164 let control_handle =
3165 VirtioDeviceControlHandle { inner: this.inner.clone() };
3166 Ok(VirtioDeviceRequest::ConfigureQueue {
3167 queue: req.queue,
3168 size: req.size,
3169 desc: req.desc,
3170 avail: req.avail,
3171 used: req.used,
3172
3173 responder: VirtioDeviceConfigureQueueResponder {
3174 control_handle: std::mem::ManuallyDrop::new(control_handle),
3175 tx_id: header.tx_id,
3176 },
3177 })
3178 }
3179 0x6e3a61d652499244 => {
3180 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3181 let mut req = fidl::new_empty!(
3182 VirtioDeviceNotifyQueueRequest,
3183 fidl::encoding::DefaultFuchsiaResourceDialect
3184 );
3185 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
3186 let control_handle =
3187 VirtioDeviceControlHandle { inner: this.inner.clone() };
3188 Ok(VirtioDeviceRequest::NotifyQueue { queue: req.queue, control_handle })
3189 }
3190 0x45707654f5d23c3f => {
3191 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3192 let mut req = fidl::new_empty!(
3193 VirtioDeviceReadyRequest,
3194 fidl::encoding::DefaultFuchsiaResourceDialect
3195 );
3196 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
3197 let control_handle =
3198 VirtioDeviceControlHandle { inner: this.inner.clone() };
3199 Ok(VirtioDeviceRequest::Ready {
3200 negotiated_features: req.negotiated_features,
3201
3202 responder: VirtioDeviceReadyResponder {
3203 control_handle: std::mem::ManuallyDrop::new(control_handle),
3204 tx_id: header.tx_id,
3205 },
3206 })
3207 }
3208 _ => Err(fidl::Error::UnknownOrdinal {
3209 ordinal: header.ordinal,
3210 protocol_name:
3211 <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3212 }),
3213 }))
3214 },
3215 )
3216 }
3217}
3218
3219#[derive(Debug)]
3220pub enum VirtioDeviceRequest {
3221 ConfigureQueue {
3224 queue: u16,
3225 size: u16,
3226 desc: u64,
3227 avail: u64,
3228 used: u64,
3229 responder: VirtioDeviceConfigureQueueResponder,
3230 },
3231 NotifyQueue { queue: u16, control_handle: VirtioDeviceControlHandle },
3233 Ready { negotiated_features: u32, responder: VirtioDeviceReadyResponder },
3236}
3237
3238impl VirtioDeviceRequest {
3239 #[allow(irrefutable_let_patterns)]
3240 pub fn into_configure_queue(
3241 self,
3242 ) -> Option<(u16, u16, u64, u64, u64, VirtioDeviceConfigureQueueResponder)> {
3243 if let VirtioDeviceRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
3244 self
3245 {
3246 Some((queue, size, desc, avail, used, responder))
3247 } else {
3248 None
3249 }
3250 }
3251
3252 #[allow(irrefutable_let_patterns)]
3253 pub fn into_notify_queue(self) -> Option<(u16, VirtioDeviceControlHandle)> {
3254 if let VirtioDeviceRequest::NotifyQueue { queue, control_handle } = self {
3255 Some((queue, control_handle))
3256 } else {
3257 None
3258 }
3259 }
3260
3261 #[allow(irrefutable_let_patterns)]
3262 pub fn into_ready(self) -> Option<(u32, VirtioDeviceReadyResponder)> {
3263 if let VirtioDeviceRequest::Ready { negotiated_features, responder } = self {
3264 Some((negotiated_features, responder))
3265 } else {
3266 None
3267 }
3268 }
3269
3270 pub fn method_name(&self) -> &'static str {
3272 match *self {
3273 VirtioDeviceRequest::ConfigureQueue { .. } => "configure_queue",
3274 VirtioDeviceRequest::NotifyQueue { .. } => "notify_queue",
3275 VirtioDeviceRequest::Ready { .. } => "ready",
3276 }
3277 }
3278}
3279
3280#[derive(Debug, Clone)]
3281pub struct VirtioDeviceControlHandle {
3282 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3283}
3284
3285impl fidl::endpoints::ControlHandle for VirtioDeviceControlHandle {
3286 fn shutdown(&self) {
3287 self.inner.shutdown()
3288 }
3289 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3290 self.inner.shutdown_with_epitaph(status)
3291 }
3292
3293 fn is_closed(&self) -> bool {
3294 self.inner.channel().is_closed()
3295 }
3296 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3297 self.inner.channel().on_closed()
3298 }
3299
3300 #[cfg(target_os = "fuchsia")]
3301 fn signal_peer(
3302 &self,
3303 clear_mask: zx::Signals,
3304 set_mask: zx::Signals,
3305 ) -> Result<(), zx_status::Status> {
3306 use fidl::Peered;
3307 self.inner.channel().signal_peer(clear_mask, set_mask)
3308 }
3309}
3310
3311impl VirtioDeviceControlHandle {}
3312
3313#[must_use = "FIDL methods require a response to be sent"]
3314#[derive(Debug)]
3315pub struct VirtioDeviceConfigureQueueResponder {
3316 control_handle: std::mem::ManuallyDrop<VirtioDeviceControlHandle>,
3317 tx_id: u32,
3318}
3319
3320impl std::ops::Drop for VirtioDeviceConfigureQueueResponder {
3324 fn drop(&mut self) {
3325 self.control_handle.shutdown();
3326 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3328 }
3329}
3330
3331impl fidl::endpoints::Responder for VirtioDeviceConfigureQueueResponder {
3332 type ControlHandle = VirtioDeviceControlHandle;
3333
3334 fn control_handle(&self) -> &VirtioDeviceControlHandle {
3335 &self.control_handle
3336 }
3337
3338 fn drop_without_shutdown(mut self) {
3339 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3341 std::mem::forget(self);
3343 }
3344}
3345
3346impl VirtioDeviceConfigureQueueResponder {
3347 pub fn send(self) -> Result<(), fidl::Error> {
3351 let _result = self.send_raw();
3352 if _result.is_err() {
3353 self.control_handle.shutdown();
3354 }
3355 self.drop_without_shutdown();
3356 _result
3357 }
3358
3359 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3361 let _result = self.send_raw();
3362 self.drop_without_shutdown();
3363 _result
3364 }
3365
3366 fn send_raw(&self) -> Result<(), fidl::Error> {
3367 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3368 (),
3369 self.tx_id,
3370 0x72b44fb963480b11,
3371 fidl::encoding::DynamicFlags::empty(),
3372 )
3373 }
3374}
3375
3376#[must_use = "FIDL methods require a response to be sent"]
3377#[derive(Debug)]
3378pub struct VirtioDeviceReadyResponder {
3379 control_handle: std::mem::ManuallyDrop<VirtioDeviceControlHandle>,
3380 tx_id: u32,
3381}
3382
3383impl std::ops::Drop for VirtioDeviceReadyResponder {
3387 fn drop(&mut self) {
3388 self.control_handle.shutdown();
3389 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3391 }
3392}
3393
3394impl fidl::endpoints::Responder for VirtioDeviceReadyResponder {
3395 type ControlHandle = VirtioDeviceControlHandle;
3396
3397 fn control_handle(&self) -> &VirtioDeviceControlHandle {
3398 &self.control_handle
3399 }
3400
3401 fn drop_without_shutdown(mut self) {
3402 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3404 std::mem::forget(self);
3406 }
3407}
3408
3409impl VirtioDeviceReadyResponder {
3410 pub fn send(self) -> Result<(), fidl::Error> {
3414 let _result = self.send_raw();
3415 if _result.is_err() {
3416 self.control_handle.shutdown();
3417 }
3418 self.drop_without_shutdown();
3419 _result
3420 }
3421
3422 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3424 let _result = self.send_raw();
3425 self.drop_without_shutdown();
3426 _result
3427 }
3428
3429 fn send_raw(&self) -> Result<(), fidl::Error> {
3430 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3431 (),
3432 self.tx_id,
3433 0x45707654f5d23c3f,
3434 fidl::encoding::DynamicFlags::empty(),
3435 )
3436 }
3437}
3438
3439#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3440pub struct VirtioGpuMarker;
3441
3442impl fidl::endpoints::ProtocolMarker for VirtioGpuMarker {
3443 type Proxy = VirtioGpuProxy;
3444 type RequestStream = VirtioGpuRequestStream;
3445 #[cfg(target_os = "fuchsia")]
3446 type SynchronousProxy = VirtioGpuSynchronousProxy;
3447
3448 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioGpu";
3449}
3450impl fidl::endpoints::DiscoverableProtocolMarker for VirtioGpuMarker {}
3451
3452pub trait VirtioGpuProxyInterface: Send + Sync {
3453 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3454 fn r#configure_queue(
3455 &self,
3456 queue: u16,
3457 size: u16,
3458 desc: u64,
3459 avail: u64,
3460 used: u64,
3461 ) -> Self::ConfigureQueueResponseFut;
3462 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
3463 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3464 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
3465 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3466 fn r#start(
3467 &self,
3468 start_info: StartInfo,
3469 keyboard_listener: Option<
3470 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
3471 >,
3472 mouse_source: Option<
3473 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
3474 >,
3475 ) -> Self::StartResponseFut;
3476}
3477#[derive(Debug)]
3478#[cfg(target_os = "fuchsia")]
3479pub struct VirtioGpuSynchronousProxy {
3480 client: fidl::client::sync::Client,
3481}
3482
3483#[cfg(target_os = "fuchsia")]
3484impl fidl::endpoints::SynchronousProxy for VirtioGpuSynchronousProxy {
3485 type Proxy = VirtioGpuProxy;
3486 type Protocol = VirtioGpuMarker;
3487
3488 fn from_channel(inner: fidl::Channel) -> Self {
3489 Self::new(inner)
3490 }
3491
3492 fn into_channel(self) -> fidl::Channel {
3493 self.client.into_channel()
3494 }
3495
3496 fn as_channel(&self) -> &fidl::Channel {
3497 self.client.as_channel()
3498 }
3499}
3500
3501#[cfg(target_os = "fuchsia")]
3502impl VirtioGpuSynchronousProxy {
3503 pub fn new(channel: fidl::Channel) -> Self {
3504 let protocol_name = <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3505 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3506 }
3507
3508 pub fn into_channel(self) -> fidl::Channel {
3509 self.client.into_channel()
3510 }
3511
3512 pub fn wait_for_event(
3515 &self,
3516 deadline: zx::MonotonicInstant,
3517 ) -> Result<VirtioGpuEvent, fidl::Error> {
3518 VirtioGpuEvent::decode(self.client.wait_for_event(deadline)?)
3519 }
3520
3521 pub fn r#configure_queue(
3524 &self,
3525 mut queue: u16,
3526 mut size: u16,
3527 mut desc: u64,
3528 mut avail: u64,
3529 mut used: u64,
3530 ___deadline: zx::MonotonicInstant,
3531 ) -> Result<(), fidl::Error> {
3532 let _response = self
3533 .client
3534 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
3535 (queue, size, desc, avail, used),
3536 0x72b44fb963480b11,
3537 fidl::encoding::DynamicFlags::empty(),
3538 ___deadline,
3539 )?;
3540 Ok(_response)
3541 }
3542
3543 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
3545 self.client.send::<VirtioDeviceNotifyQueueRequest>(
3546 (queue,),
3547 0x6e3a61d652499244,
3548 fidl::encoding::DynamicFlags::empty(),
3549 )
3550 }
3551
3552 pub fn r#ready(
3555 &self,
3556 mut negotiated_features: u32,
3557 ___deadline: zx::MonotonicInstant,
3558 ) -> Result<(), fidl::Error> {
3559 let _response =
3560 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
3561 (negotiated_features,),
3562 0x45707654f5d23c3f,
3563 fidl::encoding::DynamicFlags::empty(),
3564 ___deadline,
3565 )?;
3566 Ok(_response)
3567 }
3568
3569 pub fn r#start(
3571 &self,
3572 mut start_info: StartInfo,
3573 mut keyboard_listener: Option<
3574 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
3575 >,
3576 mut mouse_source: Option<
3577 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
3578 >,
3579 ___deadline: zx::MonotonicInstant,
3580 ) -> Result<(), fidl::Error> {
3581 let _response =
3582 self.client.send_query::<VirtioGpuStartRequest, fidl::encoding::EmptyPayload>(
3583 (&mut start_info, keyboard_listener, mouse_source),
3584 0x7e81ed410f770c14,
3585 fidl::encoding::DynamicFlags::empty(),
3586 ___deadline,
3587 )?;
3588 Ok(_response)
3589 }
3590}
3591
3592#[cfg(target_os = "fuchsia")]
3593impl From<VirtioGpuSynchronousProxy> for zx::Handle {
3594 fn from(value: VirtioGpuSynchronousProxy) -> Self {
3595 value.into_channel().into()
3596 }
3597}
3598
3599#[cfg(target_os = "fuchsia")]
3600impl From<fidl::Channel> for VirtioGpuSynchronousProxy {
3601 fn from(value: fidl::Channel) -> Self {
3602 Self::new(value)
3603 }
3604}
3605
3606#[cfg(target_os = "fuchsia")]
3607impl fidl::endpoints::FromClient for VirtioGpuSynchronousProxy {
3608 type Protocol = VirtioGpuMarker;
3609
3610 fn from_client(value: fidl::endpoints::ClientEnd<VirtioGpuMarker>) -> Self {
3611 Self::new(value.into_channel())
3612 }
3613}
3614
3615#[derive(Debug, Clone)]
3616pub struct VirtioGpuProxy {
3617 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3618}
3619
3620impl fidl::endpoints::Proxy for VirtioGpuProxy {
3621 type Protocol = VirtioGpuMarker;
3622
3623 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3624 Self::new(inner)
3625 }
3626
3627 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3628 self.client.into_channel().map_err(|client| Self { client })
3629 }
3630
3631 fn as_channel(&self) -> &::fidl::AsyncChannel {
3632 self.client.as_channel()
3633 }
3634}
3635
3636impl VirtioGpuProxy {
3637 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3639 let protocol_name = <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3640 Self { client: fidl::client::Client::new(channel, protocol_name) }
3641 }
3642
3643 pub fn take_event_stream(&self) -> VirtioGpuEventStream {
3649 VirtioGpuEventStream { event_receiver: self.client.take_event_receiver() }
3650 }
3651
3652 pub fn r#configure_queue(
3655 &self,
3656 mut queue: u16,
3657 mut size: u16,
3658 mut desc: u64,
3659 mut avail: u64,
3660 mut used: u64,
3661 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3662 VirtioGpuProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
3663 }
3664
3665 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
3667 VirtioGpuProxyInterface::r#notify_queue(self, queue)
3668 }
3669
3670 pub fn r#ready(
3673 &self,
3674 mut negotiated_features: u32,
3675 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3676 VirtioGpuProxyInterface::r#ready(self, negotiated_features)
3677 }
3678
3679 pub fn r#start(
3681 &self,
3682 mut start_info: StartInfo,
3683 mut keyboard_listener: Option<
3684 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
3685 >,
3686 mut mouse_source: Option<
3687 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
3688 >,
3689 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3690 VirtioGpuProxyInterface::r#start(self, start_info, keyboard_listener, mouse_source)
3691 }
3692}
3693
3694impl VirtioGpuProxyInterface for VirtioGpuProxy {
3695 type ConfigureQueueResponseFut =
3696 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3697 fn r#configure_queue(
3698 &self,
3699 mut queue: u16,
3700 mut size: u16,
3701 mut desc: u64,
3702 mut avail: u64,
3703 mut used: u64,
3704 ) -> Self::ConfigureQueueResponseFut {
3705 fn _decode(
3706 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3707 ) -> Result<(), fidl::Error> {
3708 let _response = fidl::client::decode_transaction_body::<
3709 fidl::encoding::EmptyPayload,
3710 fidl::encoding::DefaultFuchsiaResourceDialect,
3711 0x72b44fb963480b11,
3712 >(_buf?)?;
3713 Ok(_response)
3714 }
3715 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
3716 (queue, size, desc, avail, used),
3717 0x72b44fb963480b11,
3718 fidl::encoding::DynamicFlags::empty(),
3719 _decode,
3720 )
3721 }
3722
3723 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
3724 self.client.send::<VirtioDeviceNotifyQueueRequest>(
3725 (queue,),
3726 0x6e3a61d652499244,
3727 fidl::encoding::DynamicFlags::empty(),
3728 )
3729 }
3730
3731 type ReadyResponseFut =
3732 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3733 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
3734 fn _decode(
3735 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3736 ) -> Result<(), fidl::Error> {
3737 let _response = fidl::client::decode_transaction_body::<
3738 fidl::encoding::EmptyPayload,
3739 fidl::encoding::DefaultFuchsiaResourceDialect,
3740 0x45707654f5d23c3f,
3741 >(_buf?)?;
3742 Ok(_response)
3743 }
3744 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
3745 (negotiated_features,),
3746 0x45707654f5d23c3f,
3747 fidl::encoding::DynamicFlags::empty(),
3748 _decode,
3749 )
3750 }
3751
3752 type StartResponseFut =
3753 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3754 fn r#start(
3755 &self,
3756 mut start_info: StartInfo,
3757 mut keyboard_listener: Option<
3758 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
3759 >,
3760 mut mouse_source: Option<
3761 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
3762 >,
3763 ) -> Self::StartResponseFut {
3764 fn _decode(
3765 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3766 ) -> Result<(), fidl::Error> {
3767 let _response = fidl::client::decode_transaction_body::<
3768 fidl::encoding::EmptyPayload,
3769 fidl::encoding::DefaultFuchsiaResourceDialect,
3770 0x7e81ed410f770c14,
3771 >(_buf?)?;
3772 Ok(_response)
3773 }
3774 self.client.send_query_and_decode::<VirtioGpuStartRequest, ()>(
3775 (&mut start_info, keyboard_listener, mouse_source),
3776 0x7e81ed410f770c14,
3777 fidl::encoding::DynamicFlags::empty(),
3778 _decode,
3779 )
3780 }
3781}
3782
3783pub struct VirtioGpuEventStream {
3784 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3785}
3786
3787impl std::marker::Unpin for VirtioGpuEventStream {}
3788
3789impl futures::stream::FusedStream for VirtioGpuEventStream {
3790 fn is_terminated(&self) -> bool {
3791 self.event_receiver.is_terminated()
3792 }
3793}
3794
3795impl futures::Stream for VirtioGpuEventStream {
3796 type Item = Result<VirtioGpuEvent, fidl::Error>;
3797
3798 fn poll_next(
3799 mut self: std::pin::Pin<&mut Self>,
3800 cx: &mut std::task::Context<'_>,
3801 ) -> std::task::Poll<Option<Self::Item>> {
3802 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3803 &mut self.event_receiver,
3804 cx
3805 )?) {
3806 Some(buf) => std::task::Poll::Ready(Some(VirtioGpuEvent::decode(buf))),
3807 None => std::task::Poll::Ready(None),
3808 }
3809 }
3810}
3811
3812#[derive(Debug)]
3813pub enum VirtioGpuEvent {
3814 OnConfigChanged {},
3815}
3816
3817impl VirtioGpuEvent {
3818 #[allow(irrefutable_let_patterns)]
3819 pub fn into_on_config_changed(self) -> Option<()> {
3820 if let VirtioGpuEvent::OnConfigChanged {} = self { Some(()) } else { None }
3821 }
3822
3823 fn decode(
3825 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3826 ) -> Result<VirtioGpuEvent, fidl::Error> {
3827 let (bytes, _handles) = buf.split_mut();
3828 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3829 debug_assert_eq!(tx_header.tx_id, 0);
3830 match tx_header.ordinal {
3831 0x1555f5b7c8444aa0 => {
3832 let mut out = fidl::new_empty!(
3833 fidl::encoding::EmptyPayload,
3834 fidl::encoding::DefaultFuchsiaResourceDialect
3835 );
3836 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
3837 Ok((VirtioGpuEvent::OnConfigChanged {}))
3838 }
3839 _ => Err(fidl::Error::UnknownOrdinal {
3840 ordinal: tx_header.ordinal,
3841 protocol_name: <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3842 }),
3843 }
3844 }
3845}
3846
3847pub struct VirtioGpuRequestStream {
3849 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3850 is_terminated: bool,
3851}
3852
3853impl std::marker::Unpin for VirtioGpuRequestStream {}
3854
3855impl futures::stream::FusedStream for VirtioGpuRequestStream {
3856 fn is_terminated(&self) -> bool {
3857 self.is_terminated
3858 }
3859}
3860
3861impl fidl::endpoints::RequestStream for VirtioGpuRequestStream {
3862 type Protocol = VirtioGpuMarker;
3863 type ControlHandle = VirtioGpuControlHandle;
3864
3865 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3866 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3867 }
3868
3869 fn control_handle(&self) -> Self::ControlHandle {
3870 VirtioGpuControlHandle { inner: self.inner.clone() }
3871 }
3872
3873 fn into_inner(
3874 self,
3875 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3876 {
3877 (self.inner, self.is_terminated)
3878 }
3879
3880 fn from_inner(
3881 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3882 is_terminated: bool,
3883 ) -> Self {
3884 Self { inner, is_terminated }
3885 }
3886}
3887
3888impl futures::Stream for VirtioGpuRequestStream {
3889 type Item = Result<VirtioGpuRequest, fidl::Error>;
3890
3891 fn poll_next(
3892 mut self: std::pin::Pin<&mut Self>,
3893 cx: &mut std::task::Context<'_>,
3894 ) -> std::task::Poll<Option<Self::Item>> {
3895 let this = &mut *self;
3896 if this.inner.check_shutdown(cx) {
3897 this.is_terminated = true;
3898 return std::task::Poll::Ready(None);
3899 }
3900 if this.is_terminated {
3901 panic!("polled VirtioGpuRequestStream after completion");
3902 }
3903 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3904 |bytes, handles| {
3905 match this.inner.channel().read_etc(cx, bytes, handles) {
3906 std::task::Poll::Ready(Ok(())) => {}
3907 std::task::Poll::Pending => return std::task::Poll::Pending,
3908 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3909 this.is_terminated = true;
3910 return std::task::Poll::Ready(None);
3911 }
3912 std::task::Poll::Ready(Err(e)) => {
3913 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3914 e.into(),
3915 ))));
3916 }
3917 }
3918
3919 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3921
3922 std::task::Poll::Ready(Some(match header.ordinal {
3923 0x72b44fb963480b11 => {
3924 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3925 let mut req = fidl::new_empty!(
3926 VirtioDeviceConfigureQueueRequest,
3927 fidl::encoding::DefaultFuchsiaResourceDialect
3928 );
3929 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
3930 let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
3931 Ok(VirtioGpuRequest::ConfigureQueue {
3932 queue: req.queue,
3933 size: req.size,
3934 desc: req.desc,
3935 avail: req.avail,
3936 used: req.used,
3937
3938 responder: VirtioGpuConfigureQueueResponder {
3939 control_handle: std::mem::ManuallyDrop::new(control_handle),
3940 tx_id: header.tx_id,
3941 },
3942 })
3943 }
3944 0x6e3a61d652499244 => {
3945 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3946 let mut req = fidl::new_empty!(
3947 VirtioDeviceNotifyQueueRequest,
3948 fidl::encoding::DefaultFuchsiaResourceDialect
3949 );
3950 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
3951 let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
3952 Ok(VirtioGpuRequest::NotifyQueue { queue: req.queue, control_handle })
3953 }
3954 0x45707654f5d23c3f => {
3955 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3956 let mut req = fidl::new_empty!(
3957 VirtioDeviceReadyRequest,
3958 fidl::encoding::DefaultFuchsiaResourceDialect
3959 );
3960 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
3961 let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
3962 Ok(VirtioGpuRequest::Ready {
3963 negotiated_features: req.negotiated_features,
3964
3965 responder: VirtioGpuReadyResponder {
3966 control_handle: std::mem::ManuallyDrop::new(control_handle),
3967 tx_id: header.tx_id,
3968 },
3969 })
3970 }
3971 0x7e81ed410f770c14 => {
3972 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3973 let mut req = fidl::new_empty!(
3974 VirtioGpuStartRequest,
3975 fidl::encoding::DefaultFuchsiaResourceDialect
3976 );
3977 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioGpuStartRequest>(&header, _body_bytes, handles, &mut req)?;
3978 let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
3979 Ok(VirtioGpuRequest::Start {
3980 start_info: req.start_info,
3981 keyboard_listener: req.keyboard_listener,
3982 mouse_source: req.mouse_source,
3983
3984 responder: VirtioGpuStartResponder {
3985 control_handle: std::mem::ManuallyDrop::new(control_handle),
3986 tx_id: header.tx_id,
3987 },
3988 })
3989 }
3990 _ => Err(fidl::Error::UnknownOrdinal {
3991 ordinal: header.ordinal,
3992 protocol_name:
3993 <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3994 }),
3995 }))
3996 },
3997 )
3998 }
3999}
4000
4001#[derive(Debug)]
4002pub enum VirtioGpuRequest {
4003 ConfigureQueue {
4006 queue: u16,
4007 size: u16,
4008 desc: u64,
4009 avail: u64,
4010 used: u64,
4011 responder: VirtioGpuConfigureQueueResponder,
4012 },
4013 NotifyQueue { queue: u16, control_handle: VirtioGpuControlHandle },
4015 Ready { negotiated_features: u32, responder: VirtioGpuReadyResponder },
4018 Start {
4020 start_info: StartInfo,
4021 keyboard_listener:
4022 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>>,
4023 mouse_source:
4024 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
4025 responder: VirtioGpuStartResponder,
4026 },
4027}
4028
4029impl VirtioGpuRequest {
4030 #[allow(irrefutable_let_patterns)]
4031 pub fn into_configure_queue(
4032 self,
4033 ) -> Option<(u16, u16, u64, u64, u64, VirtioGpuConfigureQueueResponder)> {
4034 if let VirtioGpuRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
4035 {
4036 Some((queue, size, desc, avail, used, responder))
4037 } else {
4038 None
4039 }
4040 }
4041
4042 #[allow(irrefutable_let_patterns)]
4043 pub fn into_notify_queue(self) -> Option<(u16, VirtioGpuControlHandle)> {
4044 if let VirtioGpuRequest::NotifyQueue { queue, control_handle } = self {
4045 Some((queue, control_handle))
4046 } else {
4047 None
4048 }
4049 }
4050
4051 #[allow(irrefutable_let_patterns)]
4052 pub fn into_ready(self) -> Option<(u32, VirtioGpuReadyResponder)> {
4053 if let VirtioGpuRequest::Ready { negotiated_features, responder } = self {
4054 Some((negotiated_features, responder))
4055 } else {
4056 None
4057 }
4058 }
4059
4060 #[allow(irrefutable_let_patterns)]
4061 pub fn into_start(
4062 self,
4063 ) -> Option<(
4064 StartInfo,
4065 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>>,
4066 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
4067 VirtioGpuStartResponder,
4068 )> {
4069 if let VirtioGpuRequest::Start { start_info, keyboard_listener, mouse_source, responder } =
4070 self
4071 {
4072 Some((start_info, keyboard_listener, mouse_source, responder))
4073 } else {
4074 None
4075 }
4076 }
4077
4078 pub fn method_name(&self) -> &'static str {
4080 match *self {
4081 VirtioGpuRequest::ConfigureQueue { .. } => "configure_queue",
4082 VirtioGpuRequest::NotifyQueue { .. } => "notify_queue",
4083 VirtioGpuRequest::Ready { .. } => "ready",
4084 VirtioGpuRequest::Start { .. } => "start",
4085 }
4086 }
4087}
4088
4089#[derive(Debug, Clone)]
4090pub struct VirtioGpuControlHandle {
4091 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4092}
4093
4094impl fidl::endpoints::ControlHandle for VirtioGpuControlHandle {
4095 fn shutdown(&self) {
4096 self.inner.shutdown()
4097 }
4098 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4099 self.inner.shutdown_with_epitaph(status)
4100 }
4101
4102 fn is_closed(&self) -> bool {
4103 self.inner.channel().is_closed()
4104 }
4105 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4106 self.inner.channel().on_closed()
4107 }
4108
4109 #[cfg(target_os = "fuchsia")]
4110 fn signal_peer(
4111 &self,
4112 clear_mask: zx::Signals,
4113 set_mask: zx::Signals,
4114 ) -> Result<(), zx_status::Status> {
4115 use fidl::Peered;
4116 self.inner.channel().signal_peer(clear_mask, set_mask)
4117 }
4118}
4119
4120impl VirtioGpuControlHandle {
4121 pub fn send_on_config_changed(&self) -> Result<(), fidl::Error> {
4122 self.inner.send::<fidl::encoding::EmptyPayload>(
4123 (),
4124 0,
4125 0x1555f5b7c8444aa0,
4126 fidl::encoding::DynamicFlags::empty(),
4127 )
4128 }
4129}
4130
4131#[must_use = "FIDL methods require a response to be sent"]
4132#[derive(Debug)]
4133pub struct VirtioGpuConfigureQueueResponder {
4134 control_handle: std::mem::ManuallyDrop<VirtioGpuControlHandle>,
4135 tx_id: u32,
4136}
4137
4138impl std::ops::Drop for VirtioGpuConfigureQueueResponder {
4142 fn drop(&mut self) {
4143 self.control_handle.shutdown();
4144 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4146 }
4147}
4148
4149impl fidl::endpoints::Responder for VirtioGpuConfigureQueueResponder {
4150 type ControlHandle = VirtioGpuControlHandle;
4151
4152 fn control_handle(&self) -> &VirtioGpuControlHandle {
4153 &self.control_handle
4154 }
4155
4156 fn drop_without_shutdown(mut self) {
4157 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4159 std::mem::forget(self);
4161 }
4162}
4163
4164impl VirtioGpuConfigureQueueResponder {
4165 pub fn send(self) -> Result<(), fidl::Error> {
4169 let _result = self.send_raw();
4170 if _result.is_err() {
4171 self.control_handle.shutdown();
4172 }
4173 self.drop_without_shutdown();
4174 _result
4175 }
4176
4177 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4179 let _result = self.send_raw();
4180 self.drop_without_shutdown();
4181 _result
4182 }
4183
4184 fn send_raw(&self) -> Result<(), fidl::Error> {
4185 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4186 (),
4187 self.tx_id,
4188 0x72b44fb963480b11,
4189 fidl::encoding::DynamicFlags::empty(),
4190 )
4191 }
4192}
4193
4194#[must_use = "FIDL methods require a response to be sent"]
4195#[derive(Debug)]
4196pub struct VirtioGpuReadyResponder {
4197 control_handle: std::mem::ManuallyDrop<VirtioGpuControlHandle>,
4198 tx_id: u32,
4199}
4200
4201impl std::ops::Drop for VirtioGpuReadyResponder {
4205 fn drop(&mut self) {
4206 self.control_handle.shutdown();
4207 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4209 }
4210}
4211
4212impl fidl::endpoints::Responder for VirtioGpuReadyResponder {
4213 type ControlHandle = VirtioGpuControlHandle;
4214
4215 fn control_handle(&self) -> &VirtioGpuControlHandle {
4216 &self.control_handle
4217 }
4218
4219 fn drop_without_shutdown(mut self) {
4220 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4222 std::mem::forget(self);
4224 }
4225}
4226
4227impl VirtioGpuReadyResponder {
4228 pub fn send(self) -> Result<(), fidl::Error> {
4232 let _result = self.send_raw();
4233 if _result.is_err() {
4234 self.control_handle.shutdown();
4235 }
4236 self.drop_without_shutdown();
4237 _result
4238 }
4239
4240 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4242 let _result = self.send_raw();
4243 self.drop_without_shutdown();
4244 _result
4245 }
4246
4247 fn send_raw(&self) -> Result<(), fidl::Error> {
4248 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4249 (),
4250 self.tx_id,
4251 0x45707654f5d23c3f,
4252 fidl::encoding::DynamicFlags::empty(),
4253 )
4254 }
4255}
4256
4257#[must_use = "FIDL methods require a response to be sent"]
4258#[derive(Debug)]
4259pub struct VirtioGpuStartResponder {
4260 control_handle: std::mem::ManuallyDrop<VirtioGpuControlHandle>,
4261 tx_id: u32,
4262}
4263
4264impl std::ops::Drop for VirtioGpuStartResponder {
4268 fn drop(&mut self) {
4269 self.control_handle.shutdown();
4270 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4272 }
4273}
4274
4275impl fidl::endpoints::Responder for VirtioGpuStartResponder {
4276 type ControlHandle = VirtioGpuControlHandle;
4277
4278 fn control_handle(&self) -> &VirtioGpuControlHandle {
4279 &self.control_handle
4280 }
4281
4282 fn drop_without_shutdown(mut self) {
4283 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4285 std::mem::forget(self);
4287 }
4288}
4289
4290impl VirtioGpuStartResponder {
4291 pub fn send(self) -> Result<(), fidl::Error> {
4295 let _result = self.send_raw();
4296 if _result.is_err() {
4297 self.control_handle.shutdown();
4298 }
4299 self.drop_without_shutdown();
4300 _result
4301 }
4302
4303 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4305 let _result = self.send_raw();
4306 self.drop_without_shutdown();
4307 _result
4308 }
4309
4310 fn send_raw(&self) -> Result<(), fidl::Error> {
4311 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4312 (),
4313 self.tx_id,
4314 0x7e81ed410f770c14,
4315 fidl::encoding::DynamicFlags::empty(),
4316 )
4317 }
4318}
4319
4320#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4321pub struct VirtioInputMarker;
4322
4323impl fidl::endpoints::ProtocolMarker for VirtioInputMarker {
4324 type Proxy = VirtioInputProxy;
4325 type RequestStream = VirtioInputRequestStream;
4326 #[cfg(target_os = "fuchsia")]
4327 type SynchronousProxy = VirtioInputSynchronousProxy;
4328
4329 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioInput";
4330}
4331impl fidl::endpoints::DiscoverableProtocolMarker for VirtioInputMarker {}
4332
4333pub trait VirtioInputProxyInterface: Send + Sync {
4334 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4335 fn r#configure_queue(
4336 &self,
4337 queue: u16,
4338 size: u16,
4339 desc: u64,
4340 avail: u64,
4341 used: u64,
4342 ) -> Self::ConfigureQueueResponseFut;
4343 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
4344 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4345 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
4346 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4347 fn r#start(&self, start_info: StartInfo, input_type: InputType) -> Self::StartResponseFut;
4348}
4349#[derive(Debug)]
4350#[cfg(target_os = "fuchsia")]
4351pub struct VirtioInputSynchronousProxy {
4352 client: fidl::client::sync::Client,
4353}
4354
4355#[cfg(target_os = "fuchsia")]
4356impl fidl::endpoints::SynchronousProxy for VirtioInputSynchronousProxy {
4357 type Proxy = VirtioInputProxy;
4358 type Protocol = VirtioInputMarker;
4359
4360 fn from_channel(inner: fidl::Channel) -> Self {
4361 Self::new(inner)
4362 }
4363
4364 fn into_channel(self) -> fidl::Channel {
4365 self.client.into_channel()
4366 }
4367
4368 fn as_channel(&self) -> &fidl::Channel {
4369 self.client.as_channel()
4370 }
4371}
4372
4373#[cfg(target_os = "fuchsia")]
4374impl VirtioInputSynchronousProxy {
4375 pub fn new(channel: fidl::Channel) -> Self {
4376 let protocol_name = <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4377 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4378 }
4379
4380 pub fn into_channel(self) -> fidl::Channel {
4381 self.client.into_channel()
4382 }
4383
4384 pub fn wait_for_event(
4387 &self,
4388 deadline: zx::MonotonicInstant,
4389 ) -> Result<VirtioInputEvent, fidl::Error> {
4390 VirtioInputEvent::decode(self.client.wait_for_event(deadline)?)
4391 }
4392
4393 pub fn r#configure_queue(
4396 &self,
4397 mut queue: u16,
4398 mut size: u16,
4399 mut desc: u64,
4400 mut avail: u64,
4401 mut used: u64,
4402 ___deadline: zx::MonotonicInstant,
4403 ) -> Result<(), fidl::Error> {
4404 let _response = self
4405 .client
4406 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
4407 (queue, size, desc, avail, used),
4408 0x72b44fb963480b11,
4409 fidl::encoding::DynamicFlags::empty(),
4410 ___deadline,
4411 )?;
4412 Ok(_response)
4413 }
4414
4415 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
4417 self.client.send::<VirtioDeviceNotifyQueueRequest>(
4418 (queue,),
4419 0x6e3a61d652499244,
4420 fidl::encoding::DynamicFlags::empty(),
4421 )
4422 }
4423
4424 pub fn r#ready(
4427 &self,
4428 mut negotiated_features: u32,
4429 ___deadline: zx::MonotonicInstant,
4430 ) -> Result<(), fidl::Error> {
4431 let _response =
4432 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
4433 (negotiated_features,),
4434 0x45707654f5d23c3f,
4435 fidl::encoding::DynamicFlags::empty(),
4436 ___deadline,
4437 )?;
4438 Ok(_response)
4439 }
4440
4441 pub fn r#start(
4443 &self,
4444 mut start_info: StartInfo,
4445 mut input_type: InputType,
4446 ___deadline: zx::MonotonicInstant,
4447 ) -> Result<(), fidl::Error> {
4448 let _response =
4449 self.client.send_query::<VirtioInputStartRequest, fidl::encoding::EmptyPayload>(
4450 (&mut start_info, &mut input_type),
4451 0x612743931f7f9249,
4452 fidl::encoding::DynamicFlags::empty(),
4453 ___deadline,
4454 )?;
4455 Ok(_response)
4456 }
4457}
4458
4459#[cfg(target_os = "fuchsia")]
4460impl From<VirtioInputSynchronousProxy> for zx::Handle {
4461 fn from(value: VirtioInputSynchronousProxy) -> Self {
4462 value.into_channel().into()
4463 }
4464}
4465
4466#[cfg(target_os = "fuchsia")]
4467impl From<fidl::Channel> for VirtioInputSynchronousProxy {
4468 fn from(value: fidl::Channel) -> Self {
4469 Self::new(value)
4470 }
4471}
4472
4473#[cfg(target_os = "fuchsia")]
4474impl fidl::endpoints::FromClient for VirtioInputSynchronousProxy {
4475 type Protocol = VirtioInputMarker;
4476
4477 fn from_client(value: fidl::endpoints::ClientEnd<VirtioInputMarker>) -> Self {
4478 Self::new(value.into_channel())
4479 }
4480}
4481
4482#[derive(Debug, Clone)]
4483pub struct VirtioInputProxy {
4484 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4485}
4486
4487impl fidl::endpoints::Proxy for VirtioInputProxy {
4488 type Protocol = VirtioInputMarker;
4489
4490 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4491 Self::new(inner)
4492 }
4493
4494 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4495 self.client.into_channel().map_err(|client| Self { client })
4496 }
4497
4498 fn as_channel(&self) -> &::fidl::AsyncChannel {
4499 self.client.as_channel()
4500 }
4501}
4502
4503impl VirtioInputProxy {
4504 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4506 let protocol_name = <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4507 Self { client: fidl::client::Client::new(channel, protocol_name) }
4508 }
4509
4510 pub fn take_event_stream(&self) -> VirtioInputEventStream {
4516 VirtioInputEventStream { event_receiver: self.client.take_event_receiver() }
4517 }
4518
4519 pub fn r#configure_queue(
4522 &self,
4523 mut queue: u16,
4524 mut size: u16,
4525 mut desc: u64,
4526 mut avail: u64,
4527 mut used: u64,
4528 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4529 VirtioInputProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
4530 }
4531
4532 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
4534 VirtioInputProxyInterface::r#notify_queue(self, queue)
4535 }
4536
4537 pub fn r#ready(
4540 &self,
4541 mut negotiated_features: u32,
4542 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4543 VirtioInputProxyInterface::r#ready(self, negotiated_features)
4544 }
4545
4546 pub fn r#start(
4548 &self,
4549 mut start_info: StartInfo,
4550 mut input_type: InputType,
4551 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4552 VirtioInputProxyInterface::r#start(self, start_info, input_type)
4553 }
4554}
4555
4556impl VirtioInputProxyInterface for VirtioInputProxy {
4557 type ConfigureQueueResponseFut =
4558 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4559 fn r#configure_queue(
4560 &self,
4561 mut queue: u16,
4562 mut size: u16,
4563 mut desc: u64,
4564 mut avail: u64,
4565 mut used: u64,
4566 ) -> Self::ConfigureQueueResponseFut {
4567 fn _decode(
4568 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4569 ) -> Result<(), fidl::Error> {
4570 let _response = fidl::client::decode_transaction_body::<
4571 fidl::encoding::EmptyPayload,
4572 fidl::encoding::DefaultFuchsiaResourceDialect,
4573 0x72b44fb963480b11,
4574 >(_buf?)?;
4575 Ok(_response)
4576 }
4577 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
4578 (queue, size, desc, avail, used),
4579 0x72b44fb963480b11,
4580 fidl::encoding::DynamicFlags::empty(),
4581 _decode,
4582 )
4583 }
4584
4585 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
4586 self.client.send::<VirtioDeviceNotifyQueueRequest>(
4587 (queue,),
4588 0x6e3a61d652499244,
4589 fidl::encoding::DynamicFlags::empty(),
4590 )
4591 }
4592
4593 type ReadyResponseFut =
4594 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4595 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
4596 fn _decode(
4597 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4598 ) -> Result<(), fidl::Error> {
4599 let _response = fidl::client::decode_transaction_body::<
4600 fidl::encoding::EmptyPayload,
4601 fidl::encoding::DefaultFuchsiaResourceDialect,
4602 0x45707654f5d23c3f,
4603 >(_buf?)?;
4604 Ok(_response)
4605 }
4606 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
4607 (negotiated_features,),
4608 0x45707654f5d23c3f,
4609 fidl::encoding::DynamicFlags::empty(),
4610 _decode,
4611 )
4612 }
4613
4614 type StartResponseFut =
4615 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4616 fn r#start(
4617 &self,
4618 mut start_info: StartInfo,
4619 mut input_type: InputType,
4620 ) -> Self::StartResponseFut {
4621 fn _decode(
4622 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4623 ) -> Result<(), fidl::Error> {
4624 let _response = fidl::client::decode_transaction_body::<
4625 fidl::encoding::EmptyPayload,
4626 fidl::encoding::DefaultFuchsiaResourceDialect,
4627 0x612743931f7f9249,
4628 >(_buf?)?;
4629 Ok(_response)
4630 }
4631 self.client.send_query_and_decode::<VirtioInputStartRequest, ()>(
4632 (&mut start_info, &mut input_type),
4633 0x612743931f7f9249,
4634 fidl::encoding::DynamicFlags::empty(),
4635 _decode,
4636 )
4637 }
4638}
4639
4640pub struct VirtioInputEventStream {
4641 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4642}
4643
4644impl std::marker::Unpin for VirtioInputEventStream {}
4645
4646impl futures::stream::FusedStream for VirtioInputEventStream {
4647 fn is_terminated(&self) -> bool {
4648 self.event_receiver.is_terminated()
4649 }
4650}
4651
4652impl futures::Stream for VirtioInputEventStream {
4653 type Item = Result<VirtioInputEvent, fidl::Error>;
4654
4655 fn poll_next(
4656 mut self: std::pin::Pin<&mut Self>,
4657 cx: &mut std::task::Context<'_>,
4658 ) -> std::task::Poll<Option<Self::Item>> {
4659 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4660 &mut self.event_receiver,
4661 cx
4662 )?) {
4663 Some(buf) => std::task::Poll::Ready(Some(VirtioInputEvent::decode(buf))),
4664 None => std::task::Poll::Ready(None),
4665 }
4666 }
4667}
4668
4669#[derive(Debug)]
4670pub enum VirtioInputEvent {}
4671
4672impl VirtioInputEvent {
4673 fn decode(
4675 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4676 ) -> Result<VirtioInputEvent, fidl::Error> {
4677 let (bytes, _handles) = buf.split_mut();
4678 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4679 debug_assert_eq!(tx_header.tx_id, 0);
4680 match tx_header.ordinal {
4681 _ => Err(fidl::Error::UnknownOrdinal {
4682 ordinal: tx_header.ordinal,
4683 protocol_name: <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4684 }),
4685 }
4686 }
4687}
4688
4689pub struct VirtioInputRequestStream {
4691 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4692 is_terminated: bool,
4693}
4694
4695impl std::marker::Unpin for VirtioInputRequestStream {}
4696
4697impl futures::stream::FusedStream for VirtioInputRequestStream {
4698 fn is_terminated(&self) -> bool {
4699 self.is_terminated
4700 }
4701}
4702
4703impl fidl::endpoints::RequestStream for VirtioInputRequestStream {
4704 type Protocol = VirtioInputMarker;
4705 type ControlHandle = VirtioInputControlHandle;
4706
4707 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4708 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4709 }
4710
4711 fn control_handle(&self) -> Self::ControlHandle {
4712 VirtioInputControlHandle { inner: self.inner.clone() }
4713 }
4714
4715 fn into_inner(
4716 self,
4717 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4718 {
4719 (self.inner, self.is_terminated)
4720 }
4721
4722 fn from_inner(
4723 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4724 is_terminated: bool,
4725 ) -> Self {
4726 Self { inner, is_terminated }
4727 }
4728}
4729
4730impl futures::Stream for VirtioInputRequestStream {
4731 type Item = Result<VirtioInputRequest, fidl::Error>;
4732
4733 fn poll_next(
4734 mut self: std::pin::Pin<&mut Self>,
4735 cx: &mut std::task::Context<'_>,
4736 ) -> std::task::Poll<Option<Self::Item>> {
4737 let this = &mut *self;
4738 if this.inner.check_shutdown(cx) {
4739 this.is_terminated = true;
4740 return std::task::Poll::Ready(None);
4741 }
4742 if this.is_terminated {
4743 panic!("polled VirtioInputRequestStream after completion");
4744 }
4745 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4746 |bytes, handles| {
4747 match this.inner.channel().read_etc(cx, bytes, handles) {
4748 std::task::Poll::Ready(Ok(())) => {}
4749 std::task::Poll::Pending => return std::task::Poll::Pending,
4750 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4751 this.is_terminated = true;
4752 return std::task::Poll::Ready(None);
4753 }
4754 std::task::Poll::Ready(Err(e)) => {
4755 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4756 e.into(),
4757 ))));
4758 }
4759 }
4760
4761 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4763
4764 std::task::Poll::Ready(Some(match header.ordinal {
4765 0x72b44fb963480b11 => {
4766 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4767 let mut req = fidl::new_empty!(
4768 VirtioDeviceConfigureQueueRequest,
4769 fidl::encoding::DefaultFuchsiaResourceDialect
4770 );
4771 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
4772 let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
4773 Ok(VirtioInputRequest::ConfigureQueue {
4774 queue: req.queue,
4775 size: req.size,
4776 desc: req.desc,
4777 avail: req.avail,
4778 used: req.used,
4779
4780 responder: VirtioInputConfigureQueueResponder {
4781 control_handle: std::mem::ManuallyDrop::new(control_handle),
4782 tx_id: header.tx_id,
4783 },
4784 })
4785 }
4786 0x6e3a61d652499244 => {
4787 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4788 let mut req = fidl::new_empty!(
4789 VirtioDeviceNotifyQueueRequest,
4790 fidl::encoding::DefaultFuchsiaResourceDialect
4791 );
4792 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
4793 let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
4794 Ok(VirtioInputRequest::NotifyQueue { queue: req.queue, control_handle })
4795 }
4796 0x45707654f5d23c3f => {
4797 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4798 let mut req = fidl::new_empty!(
4799 VirtioDeviceReadyRequest,
4800 fidl::encoding::DefaultFuchsiaResourceDialect
4801 );
4802 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
4803 let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
4804 Ok(VirtioInputRequest::Ready {
4805 negotiated_features: req.negotiated_features,
4806
4807 responder: VirtioInputReadyResponder {
4808 control_handle: std::mem::ManuallyDrop::new(control_handle),
4809 tx_id: header.tx_id,
4810 },
4811 })
4812 }
4813 0x612743931f7f9249 => {
4814 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4815 let mut req = fidl::new_empty!(
4816 VirtioInputStartRequest,
4817 fidl::encoding::DefaultFuchsiaResourceDialect
4818 );
4819 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioInputStartRequest>(&header, _body_bytes, handles, &mut req)?;
4820 let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
4821 Ok(VirtioInputRequest::Start {
4822 start_info: req.start_info,
4823 input_type: req.input_type,
4824
4825 responder: VirtioInputStartResponder {
4826 control_handle: std::mem::ManuallyDrop::new(control_handle),
4827 tx_id: header.tx_id,
4828 },
4829 })
4830 }
4831 _ => Err(fidl::Error::UnknownOrdinal {
4832 ordinal: header.ordinal,
4833 protocol_name:
4834 <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4835 }),
4836 }))
4837 },
4838 )
4839 }
4840}
4841
4842#[derive(Debug)]
4843pub enum VirtioInputRequest {
4844 ConfigureQueue {
4847 queue: u16,
4848 size: u16,
4849 desc: u64,
4850 avail: u64,
4851 used: u64,
4852 responder: VirtioInputConfigureQueueResponder,
4853 },
4854 NotifyQueue { queue: u16, control_handle: VirtioInputControlHandle },
4856 Ready { negotiated_features: u32, responder: VirtioInputReadyResponder },
4859 Start { start_info: StartInfo, input_type: InputType, responder: VirtioInputStartResponder },
4861}
4862
4863impl VirtioInputRequest {
4864 #[allow(irrefutable_let_patterns)]
4865 pub fn into_configure_queue(
4866 self,
4867 ) -> Option<(u16, u16, u64, u64, u64, VirtioInputConfigureQueueResponder)> {
4868 if let VirtioInputRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
4869 self
4870 {
4871 Some((queue, size, desc, avail, used, responder))
4872 } else {
4873 None
4874 }
4875 }
4876
4877 #[allow(irrefutable_let_patterns)]
4878 pub fn into_notify_queue(self) -> Option<(u16, VirtioInputControlHandle)> {
4879 if let VirtioInputRequest::NotifyQueue { queue, control_handle } = self {
4880 Some((queue, control_handle))
4881 } else {
4882 None
4883 }
4884 }
4885
4886 #[allow(irrefutable_let_patterns)]
4887 pub fn into_ready(self) -> Option<(u32, VirtioInputReadyResponder)> {
4888 if let VirtioInputRequest::Ready { negotiated_features, responder } = self {
4889 Some((negotiated_features, responder))
4890 } else {
4891 None
4892 }
4893 }
4894
4895 #[allow(irrefutable_let_patterns)]
4896 pub fn into_start(self) -> Option<(StartInfo, InputType, VirtioInputStartResponder)> {
4897 if let VirtioInputRequest::Start { start_info, input_type, responder } = self {
4898 Some((start_info, input_type, responder))
4899 } else {
4900 None
4901 }
4902 }
4903
4904 pub fn method_name(&self) -> &'static str {
4906 match *self {
4907 VirtioInputRequest::ConfigureQueue { .. } => "configure_queue",
4908 VirtioInputRequest::NotifyQueue { .. } => "notify_queue",
4909 VirtioInputRequest::Ready { .. } => "ready",
4910 VirtioInputRequest::Start { .. } => "start",
4911 }
4912 }
4913}
4914
4915#[derive(Debug, Clone)]
4916pub struct VirtioInputControlHandle {
4917 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4918}
4919
4920impl fidl::endpoints::ControlHandle for VirtioInputControlHandle {
4921 fn shutdown(&self) {
4922 self.inner.shutdown()
4923 }
4924 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4925 self.inner.shutdown_with_epitaph(status)
4926 }
4927
4928 fn is_closed(&self) -> bool {
4929 self.inner.channel().is_closed()
4930 }
4931 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4932 self.inner.channel().on_closed()
4933 }
4934
4935 #[cfg(target_os = "fuchsia")]
4936 fn signal_peer(
4937 &self,
4938 clear_mask: zx::Signals,
4939 set_mask: zx::Signals,
4940 ) -> Result<(), zx_status::Status> {
4941 use fidl::Peered;
4942 self.inner.channel().signal_peer(clear_mask, set_mask)
4943 }
4944}
4945
4946impl VirtioInputControlHandle {}
4947
4948#[must_use = "FIDL methods require a response to be sent"]
4949#[derive(Debug)]
4950pub struct VirtioInputConfigureQueueResponder {
4951 control_handle: std::mem::ManuallyDrop<VirtioInputControlHandle>,
4952 tx_id: u32,
4953}
4954
4955impl std::ops::Drop for VirtioInputConfigureQueueResponder {
4959 fn drop(&mut self) {
4960 self.control_handle.shutdown();
4961 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4963 }
4964}
4965
4966impl fidl::endpoints::Responder for VirtioInputConfigureQueueResponder {
4967 type ControlHandle = VirtioInputControlHandle;
4968
4969 fn control_handle(&self) -> &VirtioInputControlHandle {
4970 &self.control_handle
4971 }
4972
4973 fn drop_without_shutdown(mut self) {
4974 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4976 std::mem::forget(self);
4978 }
4979}
4980
4981impl VirtioInputConfigureQueueResponder {
4982 pub fn send(self) -> Result<(), fidl::Error> {
4986 let _result = self.send_raw();
4987 if _result.is_err() {
4988 self.control_handle.shutdown();
4989 }
4990 self.drop_without_shutdown();
4991 _result
4992 }
4993
4994 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4996 let _result = self.send_raw();
4997 self.drop_without_shutdown();
4998 _result
4999 }
5000
5001 fn send_raw(&self) -> Result<(), fidl::Error> {
5002 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5003 (),
5004 self.tx_id,
5005 0x72b44fb963480b11,
5006 fidl::encoding::DynamicFlags::empty(),
5007 )
5008 }
5009}
5010
5011#[must_use = "FIDL methods require a response to be sent"]
5012#[derive(Debug)]
5013pub struct VirtioInputReadyResponder {
5014 control_handle: std::mem::ManuallyDrop<VirtioInputControlHandle>,
5015 tx_id: u32,
5016}
5017
5018impl std::ops::Drop for VirtioInputReadyResponder {
5022 fn drop(&mut self) {
5023 self.control_handle.shutdown();
5024 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5026 }
5027}
5028
5029impl fidl::endpoints::Responder for VirtioInputReadyResponder {
5030 type ControlHandle = VirtioInputControlHandle;
5031
5032 fn control_handle(&self) -> &VirtioInputControlHandle {
5033 &self.control_handle
5034 }
5035
5036 fn drop_without_shutdown(mut self) {
5037 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5039 std::mem::forget(self);
5041 }
5042}
5043
5044impl VirtioInputReadyResponder {
5045 pub fn send(self) -> Result<(), fidl::Error> {
5049 let _result = self.send_raw();
5050 if _result.is_err() {
5051 self.control_handle.shutdown();
5052 }
5053 self.drop_without_shutdown();
5054 _result
5055 }
5056
5057 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5059 let _result = self.send_raw();
5060 self.drop_without_shutdown();
5061 _result
5062 }
5063
5064 fn send_raw(&self) -> Result<(), fidl::Error> {
5065 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5066 (),
5067 self.tx_id,
5068 0x45707654f5d23c3f,
5069 fidl::encoding::DynamicFlags::empty(),
5070 )
5071 }
5072}
5073
5074#[must_use = "FIDL methods require a response to be sent"]
5075#[derive(Debug)]
5076pub struct VirtioInputStartResponder {
5077 control_handle: std::mem::ManuallyDrop<VirtioInputControlHandle>,
5078 tx_id: u32,
5079}
5080
5081impl std::ops::Drop for VirtioInputStartResponder {
5085 fn drop(&mut self) {
5086 self.control_handle.shutdown();
5087 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5089 }
5090}
5091
5092impl fidl::endpoints::Responder for VirtioInputStartResponder {
5093 type ControlHandle = VirtioInputControlHandle;
5094
5095 fn control_handle(&self) -> &VirtioInputControlHandle {
5096 &self.control_handle
5097 }
5098
5099 fn drop_without_shutdown(mut self) {
5100 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5102 std::mem::forget(self);
5104 }
5105}
5106
5107impl VirtioInputStartResponder {
5108 pub fn send(self) -> Result<(), fidl::Error> {
5112 let _result = self.send_raw();
5113 if _result.is_err() {
5114 self.control_handle.shutdown();
5115 }
5116 self.drop_without_shutdown();
5117 _result
5118 }
5119
5120 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5122 let _result = self.send_raw();
5123 self.drop_without_shutdown();
5124 _result
5125 }
5126
5127 fn send_raw(&self) -> Result<(), fidl::Error> {
5128 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5129 (),
5130 self.tx_id,
5131 0x612743931f7f9249,
5132 fidl::encoding::DynamicFlags::empty(),
5133 )
5134 }
5135}
5136
5137#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5138pub struct VirtioMemMarker;
5139
5140impl fidl::endpoints::ProtocolMarker for VirtioMemMarker {
5141 type Proxy = VirtioMemProxy;
5142 type RequestStream = VirtioMemRequestStream;
5143 #[cfg(target_os = "fuchsia")]
5144 type SynchronousProxy = VirtioMemSynchronousProxy;
5145
5146 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioMem";
5147}
5148impl fidl::endpoints::DiscoverableProtocolMarker for VirtioMemMarker {}
5149
5150pub trait VirtioMemProxyInterface: Send + Sync {
5151 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5152 fn r#configure_queue(
5153 &self,
5154 queue: u16,
5155 size: u16,
5156 desc: u64,
5157 avail: u64,
5158 used: u64,
5159 ) -> Self::ConfigureQueueResponseFut;
5160 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
5161 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5162 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
5163 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5164 fn r#start(
5165 &self,
5166 start_info: StartInfo,
5167 region_addr: u64,
5168 plugged_block_size: u64,
5169 region_size: u64,
5170 ) -> Self::StartResponseFut;
5171}
5172#[derive(Debug)]
5173#[cfg(target_os = "fuchsia")]
5174pub struct VirtioMemSynchronousProxy {
5175 client: fidl::client::sync::Client,
5176}
5177
5178#[cfg(target_os = "fuchsia")]
5179impl fidl::endpoints::SynchronousProxy for VirtioMemSynchronousProxy {
5180 type Proxy = VirtioMemProxy;
5181 type Protocol = VirtioMemMarker;
5182
5183 fn from_channel(inner: fidl::Channel) -> Self {
5184 Self::new(inner)
5185 }
5186
5187 fn into_channel(self) -> fidl::Channel {
5188 self.client.into_channel()
5189 }
5190
5191 fn as_channel(&self) -> &fidl::Channel {
5192 self.client.as_channel()
5193 }
5194}
5195
5196#[cfg(target_os = "fuchsia")]
5197impl VirtioMemSynchronousProxy {
5198 pub fn new(channel: fidl::Channel) -> Self {
5199 let protocol_name = <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5200 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5201 }
5202
5203 pub fn into_channel(self) -> fidl::Channel {
5204 self.client.into_channel()
5205 }
5206
5207 pub fn wait_for_event(
5210 &self,
5211 deadline: zx::MonotonicInstant,
5212 ) -> Result<VirtioMemEvent, fidl::Error> {
5213 VirtioMemEvent::decode(self.client.wait_for_event(deadline)?)
5214 }
5215
5216 pub fn r#configure_queue(
5219 &self,
5220 mut queue: u16,
5221 mut size: u16,
5222 mut desc: u64,
5223 mut avail: u64,
5224 mut used: u64,
5225 ___deadline: zx::MonotonicInstant,
5226 ) -> Result<(), fidl::Error> {
5227 let _response = self
5228 .client
5229 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
5230 (queue, size, desc, avail, used),
5231 0x72b44fb963480b11,
5232 fidl::encoding::DynamicFlags::empty(),
5233 ___deadline,
5234 )?;
5235 Ok(_response)
5236 }
5237
5238 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
5240 self.client.send::<VirtioDeviceNotifyQueueRequest>(
5241 (queue,),
5242 0x6e3a61d652499244,
5243 fidl::encoding::DynamicFlags::empty(),
5244 )
5245 }
5246
5247 pub fn r#ready(
5250 &self,
5251 mut negotiated_features: u32,
5252 ___deadline: zx::MonotonicInstant,
5253 ) -> Result<(), fidl::Error> {
5254 let _response =
5255 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
5256 (negotiated_features,),
5257 0x45707654f5d23c3f,
5258 fidl::encoding::DynamicFlags::empty(),
5259 ___deadline,
5260 )?;
5261 Ok(_response)
5262 }
5263
5264 pub fn r#start(
5266 &self,
5267 mut start_info: StartInfo,
5268 mut region_addr: u64,
5269 mut plugged_block_size: u64,
5270 mut region_size: u64,
5271 ___deadline: zx::MonotonicInstant,
5272 ) -> Result<(), fidl::Error> {
5273 let _response =
5274 self.client.send_query::<VirtioMemStartRequest, fidl::encoding::EmptyPayload>(
5275 (&mut start_info, region_addr, plugged_block_size, region_size),
5276 0x66dd64f17fb5223c,
5277 fidl::encoding::DynamicFlags::empty(),
5278 ___deadline,
5279 )?;
5280 Ok(_response)
5281 }
5282}
5283
5284#[cfg(target_os = "fuchsia")]
5285impl From<VirtioMemSynchronousProxy> for zx::Handle {
5286 fn from(value: VirtioMemSynchronousProxy) -> Self {
5287 value.into_channel().into()
5288 }
5289}
5290
5291#[cfg(target_os = "fuchsia")]
5292impl From<fidl::Channel> for VirtioMemSynchronousProxy {
5293 fn from(value: fidl::Channel) -> Self {
5294 Self::new(value)
5295 }
5296}
5297
5298#[cfg(target_os = "fuchsia")]
5299impl fidl::endpoints::FromClient for VirtioMemSynchronousProxy {
5300 type Protocol = VirtioMemMarker;
5301
5302 fn from_client(value: fidl::endpoints::ClientEnd<VirtioMemMarker>) -> Self {
5303 Self::new(value.into_channel())
5304 }
5305}
5306
5307#[derive(Debug, Clone)]
5308pub struct VirtioMemProxy {
5309 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5310}
5311
5312impl fidl::endpoints::Proxy for VirtioMemProxy {
5313 type Protocol = VirtioMemMarker;
5314
5315 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5316 Self::new(inner)
5317 }
5318
5319 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5320 self.client.into_channel().map_err(|client| Self { client })
5321 }
5322
5323 fn as_channel(&self) -> &::fidl::AsyncChannel {
5324 self.client.as_channel()
5325 }
5326}
5327
5328impl VirtioMemProxy {
5329 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5331 let protocol_name = <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5332 Self { client: fidl::client::Client::new(channel, protocol_name) }
5333 }
5334
5335 pub fn take_event_stream(&self) -> VirtioMemEventStream {
5341 VirtioMemEventStream { event_receiver: self.client.take_event_receiver() }
5342 }
5343
5344 pub fn r#configure_queue(
5347 &self,
5348 mut queue: u16,
5349 mut size: u16,
5350 mut desc: u64,
5351 mut avail: u64,
5352 mut used: u64,
5353 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5354 VirtioMemProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
5355 }
5356
5357 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
5359 VirtioMemProxyInterface::r#notify_queue(self, queue)
5360 }
5361
5362 pub fn r#ready(
5365 &self,
5366 mut negotiated_features: u32,
5367 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5368 VirtioMemProxyInterface::r#ready(self, negotiated_features)
5369 }
5370
5371 pub fn r#start(
5373 &self,
5374 mut start_info: StartInfo,
5375 mut region_addr: u64,
5376 mut plugged_block_size: u64,
5377 mut region_size: u64,
5378 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5379 VirtioMemProxyInterface::r#start(
5380 self,
5381 start_info,
5382 region_addr,
5383 plugged_block_size,
5384 region_size,
5385 )
5386 }
5387}
5388
5389impl VirtioMemProxyInterface for VirtioMemProxy {
5390 type ConfigureQueueResponseFut =
5391 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5392 fn r#configure_queue(
5393 &self,
5394 mut queue: u16,
5395 mut size: u16,
5396 mut desc: u64,
5397 mut avail: u64,
5398 mut used: u64,
5399 ) -> Self::ConfigureQueueResponseFut {
5400 fn _decode(
5401 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5402 ) -> Result<(), fidl::Error> {
5403 let _response = fidl::client::decode_transaction_body::<
5404 fidl::encoding::EmptyPayload,
5405 fidl::encoding::DefaultFuchsiaResourceDialect,
5406 0x72b44fb963480b11,
5407 >(_buf?)?;
5408 Ok(_response)
5409 }
5410 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
5411 (queue, size, desc, avail, used),
5412 0x72b44fb963480b11,
5413 fidl::encoding::DynamicFlags::empty(),
5414 _decode,
5415 )
5416 }
5417
5418 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
5419 self.client.send::<VirtioDeviceNotifyQueueRequest>(
5420 (queue,),
5421 0x6e3a61d652499244,
5422 fidl::encoding::DynamicFlags::empty(),
5423 )
5424 }
5425
5426 type ReadyResponseFut =
5427 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5428 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
5429 fn _decode(
5430 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5431 ) -> Result<(), fidl::Error> {
5432 let _response = fidl::client::decode_transaction_body::<
5433 fidl::encoding::EmptyPayload,
5434 fidl::encoding::DefaultFuchsiaResourceDialect,
5435 0x45707654f5d23c3f,
5436 >(_buf?)?;
5437 Ok(_response)
5438 }
5439 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
5440 (negotiated_features,),
5441 0x45707654f5d23c3f,
5442 fidl::encoding::DynamicFlags::empty(),
5443 _decode,
5444 )
5445 }
5446
5447 type StartResponseFut =
5448 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5449 fn r#start(
5450 &self,
5451 mut start_info: StartInfo,
5452 mut region_addr: u64,
5453 mut plugged_block_size: u64,
5454 mut region_size: u64,
5455 ) -> Self::StartResponseFut {
5456 fn _decode(
5457 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5458 ) -> Result<(), fidl::Error> {
5459 let _response = fidl::client::decode_transaction_body::<
5460 fidl::encoding::EmptyPayload,
5461 fidl::encoding::DefaultFuchsiaResourceDialect,
5462 0x66dd64f17fb5223c,
5463 >(_buf?)?;
5464 Ok(_response)
5465 }
5466 self.client.send_query_and_decode::<VirtioMemStartRequest, ()>(
5467 (&mut start_info, region_addr, plugged_block_size, region_size),
5468 0x66dd64f17fb5223c,
5469 fidl::encoding::DynamicFlags::empty(),
5470 _decode,
5471 )
5472 }
5473}
5474
5475pub struct VirtioMemEventStream {
5476 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5477}
5478
5479impl std::marker::Unpin for VirtioMemEventStream {}
5480
5481impl futures::stream::FusedStream for VirtioMemEventStream {
5482 fn is_terminated(&self) -> bool {
5483 self.event_receiver.is_terminated()
5484 }
5485}
5486
5487impl futures::Stream for VirtioMemEventStream {
5488 type Item = Result<VirtioMemEvent, fidl::Error>;
5489
5490 fn poll_next(
5491 mut self: std::pin::Pin<&mut Self>,
5492 cx: &mut std::task::Context<'_>,
5493 ) -> std::task::Poll<Option<Self::Item>> {
5494 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5495 &mut self.event_receiver,
5496 cx
5497 )?) {
5498 Some(buf) => std::task::Poll::Ready(Some(VirtioMemEvent::decode(buf))),
5499 None => std::task::Poll::Ready(None),
5500 }
5501 }
5502}
5503
5504#[derive(Debug)]
5505pub enum VirtioMemEvent {
5506 OnConfigChanged { plugged_size: u64 },
5507}
5508
5509impl VirtioMemEvent {
5510 #[allow(irrefutable_let_patterns)]
5511 pub fn into_on_config_changed(self) -> Option<u64> {
5512 if let VirtioMemEvent::OnConfigChanged { plugged_size } = self {
5513 Some((plugged_size))
5514 } else {
5515 None
5516 }
5517 }
5518
5519 fn decode(
5521 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5522 ) -> Result<VirtioMemEvent, fidl::Error> {
5523 let (bytes, _handles) = buf.split_mut();
5524 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5525 debug_assert_eq!(tx_header.tx_id, 0);
5526 match tx_header.ordinal {
5527 0x73b86d7cc80020b9 => {
5528 let mut out = fidl::new_empty!(
5529 VirtioMemOnConfigChangedRequest,
5530 fidl::encoding::DefaultFuchsiaResourceDialect
5531 );
5532 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioMemOnConfigChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
5533 Ok((VirtioMemEvent::OnConfigChanged { plugged_size: out.plugged_size }))
5534 }
5535 _ => Err(fidl::Error::UnknownOrdinal {
5536 ordinal: tx_header.ordinal,
5537 protocol_name: <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5538 }),
5539 }
5540 }
5541}
5542
5543pub struct VirtioMemRequestStream {
5545 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5546 is_terminated: bool,
5547}
5548
5549impl std::marker::Unpin for VirtioMemRequestStream {}
5550
5551impl futures::stream::FusedStream for VirtioMemRequestStream {
5552 fn is_terminated(&self) -> bool {
5553 self.is_terminated
5554 }
5555}
5556
5557impl fidl::endpoints::RequestStream for VirtioMemRequestStream {
5558 type Protocol = VirtioMemMarker;
5559 type ControlHandle = VirtioMemControlHandle;
5560
5561 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5562 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5563 }
5564
5565 fn control_handle(&self) -> Self::ControlHandle {
5566 VirtioMemControlHandle { inner: self.inner.clone() }
5567 }
5568
5569 fn into_inner(
5570 self,
5571 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5572 {
5573 (self.inner, self.is_terminated)
5574 }
5575
5576 fn from_inner(
5577 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5578 is_terminated: bool,
5579 ) -> Self {
5580 Self { inner, is_terminated }
5581 }
5582}
5583
5584impl futures::Stream for VirtioMemRequestStream {
5585 type Item = Result<VirtioMemRequest, fidl::Error>;
5586
5587 fn poll_next(
5588 mut self: std::pin::Pin<&mut Self>,
5589 cx: &mut std::task::Context<'_>,
5590 ) -> std::task::Poll<Option<Self::Item>> {
5591 let this = &mut *self;
5592 if this.inner.check_shutdown(cx) {
5593 this.is_terminated = true;
5594 return std::task::Poll::Ready(None);
5595 }
5596 if this.is_terminated {
5597 panic!("polled VirtioMemRequestStream after completion");
5598 }
5599 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5600 |bytes, handles| {
5601 match this.inner.channel().read_etc(cx, bytes, handles) {
5602 std::task::Poll::Ready(Ok(())) => {}
5603 std::task::Poll::Pending => return std::task::Poll::Pending,
5604 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5605 this.is_terminated = true;
5606 return std::task::Poll::Ready(None);
5607 }
5608 std::task::Poll::Ready(Err(e)) => {
5609 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5610 e.into(),
5611 ))));
5612 }
5613 }
5614
5615 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5617
5618 std::task::Poll::Ready(Some(match header.ordinal {
5619 0x72b44fb963480b11 => {
5620 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5621 let mut req = fidl::new_empty!(
5622 VirtioDeviceConfigureQueueRequest,
5623 fidl::encoding::DefaultFuchsiaResourceDialect
5624 );
5625 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
5626 let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
5627 Ok(VirtioMemRequest::ConfigureQueue {
5628 queue: req.queue,
5629 size: req.size,
5630 desc: req.desc,
5631 avail: req.avail,
5632 used: req.used,
5633
5634 responder: VirtioMemConfigureQueueResponder {
5635 control_handle: std::mem::ManuallyDrop::new(control_handle),
5636 tx_id: header.tx_id,
5637 },
5638 })
5639 }
5640 0x6e3a61d652499244 => {
5641 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5642 let mut req = fidl::new_empty!(
5643 VirtioDeviceNotifyQueueRequest,
5644 fidl::encoding::DefaultFuchsiaResourceDialect
5645 );
5646 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
5647 let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
5648 Ok(VirtioMemRequest::NotifyQueue { queue: req.queue, control_handle })
5649 }
5650 0x45707654f5d23c3f => {
5651 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5652 let mut req = fidl::new_empty!(
5653 VirtioDeviceReadyRequest,
5654 fidl::encoding::DefaultFuchsiaResourceDialect
5655 );
5656 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
5657 let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
5658 Ok(VirtioMemRequest::Ready {
5659 negotiated_features: req.negotiated_features,
5660
5661 responder: VirtioMemReadyResponder {
5662 control_handle: std::mem::ManuallyDrop::new(control_handle),
5663 tx_id: header.tx_id,
5664 },
5665 })
5666 }
5667 0x66dd64f17fb5223c => {
5668 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5669 let mut req = fidl::new_empty!(
5670 VirtioMemStartRequest,
5671 fidl::encoding::DefaultFuchsiaResourceDialect
5672 );
5673 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioMemStartRequest>(&header, _body_bytes, handles, &mut req)?;
5674 let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
5675 Ok(VirtioMemRequest::Start {
5676 start_info: req.start_info,
5677 region_addr: req.region_addr,
5678 plugged_block_size: req.plugged_block_size,
5679 region_size: req.region_size,
5680
5681 responder: VirtioMemStartResponder {
5682 control_handle: std::mem::ManuallyDrop::new(control_handle),
5683 tx_id: header.tx_id,
5684 },
5685 })
5686 }
5687 _ => Err(fidl::Error::UnknownOrdinal {
5688 ordinal: header.ordinal,
5689 protocol_name:
5690 <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5691 }),
5692 }))
5693 },
5694 )
5695 }
5696}
5697
5698#[derive(Debug)]
5699pub enum VirtioMemRequest {
5700 ConfigureQueue {
5703 queue: u16,
5704 size: u16,
5705 desc: u64,
5706 avail: u64,
5707 used: u64,
5708 responder: VirtioMemConfigureQueueResponder,
5709 },
5710 NotifyQueue { queue: u16, control_handle: VirtioMemControlHandle },
5712 Ready { negotiated_features: u32, responder: VirtioMemReadyResponder },
5715 Start {
5717 start_info: StartInfo,
5718 region_addr: u64,
5719 plugged_block_size: u64,
5720 region_size: u64,
5721 responder: VirtioMemStartResponder,
5722 },
5723}
5724
5725impl VirtioMemRequest {
5726 #[allow(irrefutable_let_patterns)]
5727 pub fn into_configure_queue(
5728 self,
5729 ) -> Option<(u16, u16, u64, u64, u64, VirtioMemConfigureQueueResponder)> {
5730 if let VirtioMemRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
5731 {
5732 Some((queue, size, desc, avail, used, responder))
5733 } else {
5734 None
5735 }
5736 }
5737
5738 #[allow(irrefutable_let_patterns)]
5739 pub fn into_notify_queue(self) -> Option<(u16, VirtioMemControlHandle)> {
5740 if let VirtioMemRequest::NotifyQueue { queue, control_handle } = self {
5741 Some((queue, control_handle))
5742 } else {
5743 None
5744 }
5745 }
5746
5747 #[allow(irrefutable_let_patterns)]
5748 pub fn into_ready(self) -> Option<(u32, VirtioMemReadyResponder)> {
5749 if let VirtioMemRequest::Ready { negotiated_features, responder } = self {
5750 Some((negotiated_features, responder))
5751 } else {
5752 None
5753 }
5754 }
5755
5756 #[allow(irrefutable_let_patterns)]
5757 pub fn into_start(self) -> Option<(StartInfo, u64, u64, u64, VirtioMemStartResponder)> {
5758 if let VirtioMemRequest::Start {
5759 start_info,
5760 region_addr,
5761 plugged_block_size,
5762 region_size,
5763 responder,
5764 } = self
5765 {
5766 Some((start_info, region_addr, plugged_block_size, region_size, responder))
5767 } else {
5768 None
5769 }
5770 }
5771
5772 pub fn method_name(&self) -> &'static str {
5774 match *self {
5775 VirtioMemRequest::ConfigureQueue { .. } => "configure_queue",
5776 VirtioMemRequest::NotifyQueue { .. } => "notify_queue",
5777 VirtioMemRequest::Ready { .. } => "ready",
5778 VirtioMemRequest::Start { .. } => "start",
5779 }
5780 }
5781}
5782
5783#[derive(Debug, Clone)]
5784pub struct VirtioMemControlHandle {
5785 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5786}
5787
5788impl fidl::endpoints::ControlHandle for VirtioMemControlHandle {
5789 fn shutdown(&self) {
5790 self.inner.shutdown()
5791 }
5792 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5793 self.inner.shutdown_with_epitaph(status)
5794 }
5795
5796 fn is_closed(&self) -> bool {
5797 self.inner.channel().is_closed()
5798 }
5799 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5800 self.inner.channel().on_closed()
5801 }
5802
5803 #[cfg(target_os = "fuchsia")]
5804 fn signal_peer(
5805 &self,
5806 clear_mask: zx::Signals,
5807 set_mask: zx::Signals,
5808 ) -> Result<(), zx_status::Status> {
5809 use fidl::Peered;
5810 self.inner.channel().signal_peer(clear_mask, set_mask)
5811 }
5812}
5813
5814impl VirtioMemControlHandle {
5815 pub fn send_on_config_changed(&self, mut plugged_size: u64) -> Result<(), fidl::Error> {
5816 self.inner.send::<VirtioMemOnConfigChangedRequest>(
5817 (plugged_size,),
5818 0,
5819 0x73b86d7cc80020b9,
5820 fidl::encoding::DynamicFlags::empty(),
5821 )
5822 }
5823}
5824
5825#[must_use = "FIDL methods require a response to be sent"]
5826#[derive(Debug)]
5827pub struct VirtioMemConfigureQueueResponder {
5828 control_handle: std::mem::ManuallyDrop<VirtioMemControlHandle>,
5829 tx_id: u32,
5830}
5831
5832impl std::ops::Drop for VirtioMemConfigureQueueResponder {
5836 fn drop(&mut self) {
5837 self.control_handle.shutdown();
5838 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5840 }
5841}
5842
5843impl fidl::endpoints::Responder for VirtioMemConfigureQueueResponder {
5844 type ControlHandle = VirtioMemControlHandle;
5845
5846 fn control_handle(&self) -> &VirtioMemControlHandle {
5847 &self.control_handle
5848 }
5849
5850 fn drop_without_shutdown(mut self) {
5851 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5853 std::mem::forget(self);
5855 }
5856}
5857
5858impl VirtioMemConfigureQueueResponder {
5859 pub fn send(self) -> Result<(), fidl::Error> {
5863 let _result = self.send_raw();
5864 if _result.is_err() {
5865 self.control_handle.shutdown();
5866 }
5867 self.drop_without_shutdown();
5868 _result
5869 }
5870
5871 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5873 let _result = self.send_raw();
5874 self.drop_without_shutdown();
5875 _result
5876 }
5877
5878 fn send_raw(&self) -> Result<(), fidl::Error> {
5879 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5880 (),
5881 self.tx_id,
5882 0x72b44fb963480b11,
5883 fidl::encoding::DynamicFlags::empty(),
5884 )
5885 }
5886}
5887
5888#[must_use = "FIDL methods require a response to be sent"]
5889#[derive(Debug)]
5890pub struct VirtioMemReadyResponder {
5891 control_handle: std::mem::ManuallyDrop<VirtioMemControlHandle>,
5892 tx_id: u32,
5893}
5894
5895impl std::ops::Drop for VirtioMemReadyResponder {
5899 fn drop(&mut self) {
5900 self.control_handle.shutdown();
5901 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5903 }
5904}
5905
5906impl fidl::endpoints::Responder for VirtioMemReadyResponder {
5907 type ControlHandle = VirtioMemControlHandle;
5908
5909 fn control_handle(&self) -> &VirtioMemControlHandle {
5910 &self.control_handle
5911 }
5912
5913 fn drop_without_shutdown(mut self) {
5914 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5916 std::mem::forget(self);
5918 }
5919}
5920
5921impl VirtioMemReadyResponder {
5922 pub fn send(self) -> Result<(), fidl::Error> {
5926 let _result = self.send_raw();
5927 if _result.is_err() {
5928 self.control_handle.shutdown();
5929 }
5930 self.drop_without_shutdown();
5931 _result
5932 }
5933
5934 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5936 let _result = self.send_raw();
5937 self.drop_without_shutdown();
5938 _result
5939 }
5940
5941 fn send_raw(&self) -> Result<(), fidl::Error> {
5942 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5943 (),
5944 self.tx_id,
5945 0x45707654f5d23c3f,
5946 fidl::encoding::DynamicFlags::empty(),
5947 )
5948 }
5949}
5950
5951#[must_use = "FIDL methods require a response to be sent"]
5952#[derive(Debug)]
5953pub struct VirtioMemStartResponder {
5954 control_handle: std::mem::ManuallyDrop<VirtioMemControlHandle>,
5955 tx_id: u32,
5956}
5957
5958impl std::ops::Drop for VirtioMemStartResponder {
5962 fn drop(&mut self) {
5963 self.control_handle.shutdown();
5964 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5966 }
5967}
5968
5969impl fidl::endpoints::Responder for VirtioMemStartResponder {
5970 type ControlHandle = VirtioMemControlHandle;
5971
5972 fn control_handle(&self) -> &VirtioMemControlHandle {
5973 &self.control_handle
5974 }
5975
5976 fn drop_without_shutdown(mut self) {
5977 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5979 std::mem::forget(self);
5981 }
5982}
5983
5984impl VirtioMemStartResponder {
5985 pub fn send(self) -> Result<(), fidl::Error> {
5989 let _result = self.send_raw();
5990 if _result.is_err() {
5991 self.control_handle.shutdown();
5992 }
5993 self.drop_without_shutdown();
5994 _result
5995 }
5996
5997 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5999 let _result = self.send_raw();
6000 self.drop_without_shutdown();
6001 _result
6002 }
6003
6004 fn send_raw(&self) -> Result<(), fidl::Error> {
6005 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6006 (),
6007 self.tx_id,
6008 0x66dd64f17fb5223c,
6009 fidl::encoding::DynamicFlags::empty(),
6010 )
6011 }
6012}
6013
6014#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6015pub struct VirtioNetMarker;
6016
6017impl fidl::endpoints::ProtocolMarker for VirtioNetMarker {
6018 type Proxy = VirtioNetProxy;
6019 type RequestStream = VirtioNetRequestStream;
6020 #[cfg(target_os = "fuchsia")]
6021 type SynchronousProxy = VirtioNetSynchronousProxy;
6022
6023 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioNet";
6024}
6025impl fidl::endpoints::DiscoverableProtocolMarker for VirtioNetMarker {}
6026pub type VirtioNetStartResult = Result<(), i32>;
6027
6028pub trait VirtioNetProxyInterface: Send + Sync {
6029 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6030 fn r#configure_queue(
6031 &self,
6032 queue: u16,
6033 size: u16,
6034 desc: u64,
6035 avail: u64,
6036 used: u64,
6037 ) -> Self::ConfigureQueueResponseFut;
6038 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
6039 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6040 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
6041 type StartResponseFut: std::future::Future<Output = Result<VirtioNetStartResult, fidl::Error>>
6042 + Send;
6043 fn r#start(
6044 &self,
6045 start_info: StartInfo,
6046 mac_address: &fidl_fuchsia_net::MacAddress,
6047 enable_bridge: bool,
6048 ) -> Self::StartResponseFut;
6049}
6050#[derive(Debug)]
6051#[cfg(target_os = "fuchsia")]
6052pub struct VirtioNetSynchronousProxy {
6053 client: fidl::client::sync::Client,
6054}
6055
6056#[cfg(target_os = "fuchsia")]
6057impl fidl::endpoints::SynchronousProxy for VirtioNetSynchronousProxy {
6058 type Proxy = VirtioNetProxy;
6059 type Protocol = VirtioNetMarker;
6060
6061 fn from_channel(inner: fidl::Channel) -> Self {
6062 Self::new(inner)
6063 }
6064
6065 fn into_channel(self) -> fidl::Channel {
6066 self.client.into_channel()
6067 }
6068
6069 fn as_channel(&self) -> &fidl::Channel {
6070 self.client.as_channel()
6071 }
6072}
6073
6074#[cfg(target_os = "fuchsia")]
6075impl VirtioNetSynchronousProxy {
6076 pub fn new(channel: fidl::Channel) -> Self {
6077 let protocol_name = <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6078 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6079 }
6080
6081 pub fn into_channel(self) -> fidl::Channel {
6082 self.client.into_channel()
6083 }
6084
6085 pub fn wait_for_event(
6088 &self,
6089 deadline: zx::MonotonicInstant,
6090 ) -> Result<VirtioNetEvent, fidl::Error> {
6091 VirtioNetEvent::decode(self.client.wait_for_event(deadline)?)
6092 }
6093
6094 pub fn r#configure_queue(
6097 &self,
6098 mut queue: u16,
6099 mut size: u16,
6100 mut desc: u64,
6101 mut avail: u64,
6102 mut used: u64,
6103 ___deadline: zx::MonotonicInstant,
6104 ) -> Result<(), fidl::Error> {
6105 let _response = self
6106 .client
6107 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
6108 (queue, size, desc, avail, used),
6109 0x72b44fb963480b11,
6110 fidl::encoding::DynamicFlags::empty(),
6111 ___deadline,
6112 )?;
6113 Ok(_response)
6114 }
6115
6116 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
6118 self.client.send::<VirtioDeviceNotifyQueueRequest>(
6119 (queue,),
6120 0x6e3a61d652499244,
6121 fidl::encoding::DynamicFlags::empty(),
6122 )
6123 }
6124
6125 pub fn r#ready(
6128 &self,
6129 mut negotiated_features: u32,
6130 ___deadline: zx::MonotonicInstant,
6131 ) -> Result<(), fidl::Error> {
6132 let _response =
6133 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
6134 (negotiated_features,),
6135 0x45707654f5d23c3f,
6136 fidl::encoding::DynamicFlags::empty(),
6137 ___deadline,
6138 )?;
6139 Ok(_response)
6140 }
6141
6142 pub fn r#start(
6144 &self,
6145 mut start_info: StartInfo,
6146 mut mac_address: &fidl_fuchsia_net::MacAddress,
6147 mut enable_bridge: bool,
6148 ___deadline: zx::MonotonicInstant,
6149 ) -> Result<VirtioNetStartResult, fidl::Error> {
6150 let _response = self.client.send_query::<
6151 VirtioNetStartRequest,
6152 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6153 >(
6154 (&mut start_info, mac_address, enable_bridge,),
6155 0x795c0b3a8461b3ed,
6156 fidl::encoding::DynamicFlags::empty(),
6157 ___deadline,
6158 )?;
6159 Ok(_response.map(|x| x))
6160 }
6161}
6162
6163#[cfg(target_os = "fuchsia")]
6164impl From<VirtioNetSynchronousProxy> for zx::Handle {
6165 fn from(value: VirtioNetSynchronousProxy) -> Self {
6166 value.into_channel().into()
6167 }
6168}
6169
6170#[cfg(target_os = "fuchsia")]
6171impl From<fidl::Channel> for VirtioNetSynchronousProxy {
6172 fn from(value: fidl::Channel) -> Self {
6173 Self::new(value)
6174 }
6175}
6176
6177#[cfg(target_os = "fuchsia")]
6178impl fidl::endpoints::FromClient for VirtioNetSynchronousProxy {
6179 type Protocol = VirtioNetMarker;
6180
6181 fn from_client(value: fidl::endpoints::ClientEnd<VirtioNetMarker>) -> Self {
6182 Self::new(value.into_channel())
6183 }
6184}
6185
6186#[derive(Debug, Clone)]
6187pub struct VirtioNetProxy {
6188 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6189}
6190
6191impl fidl::endpoints::Proxy for VirtioNetProxy {
6192 type Protocol = VirtioNetMarker;
6193
6194 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6195 Self::new(inner)
6196 }
6197
6198 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6199 self.client.into_channel().map_err(|client| Self { client })
6200 }
6201
6202 fn as_channel(&self) -> &::fidl::AsyncChannel {
6203 self.client.as_channel()
6204 }
6205}
6206
6207impl VirtioNetProxy {
6208 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6210 let protocol_name = <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6211 Self { client: fidl::client::Client::new(channel, protocol_name) }
6212 }
6213
6214 pub fn take_event_stream(&self) -> VirtioNetEventStream {
6220 VirtioNetEventStream { event_receiver: self.client.take_event_receiver() }
6221 }
6222
6223 pub fn r#configure_queue(
6226 &self,
6227 mut queue: u16,
6228 mut size: u16,
6229 mut desc: u64,
6230 mut avail: u64,
6231 mut used: u64,
6232 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6233 VirtioNetProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
6234 }
6235
6236 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
6238 VirtioNetProxyInterface::r#notify_queue(self, queue)
6239 }
6240
6241 pub fn r#ready(
6244 &self,
6245 mut negotiated_features: u32,
6246 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6247 VirtioNetProxyInterface::r#ready(self, negotiated_features)
6248 }
6249
6250 pub fn r#start(
6252 &self,
6253 mut start_info: StartInfo,
6254 mut mac_address: &fidl_fuchsia_net::MacAddress,
6255 mut enable_bridge: bool,
6256 ) -> fidl::client::QueryResponseFut<
6257 VirtioNetStartResult,
6258 fidl::encoding::DefaultFuchsiaResourceDialect,
6259 > {
6260 VirtioNetProxyInterface::r#start(self, start_info, mac_address, enable_bridge)
6261 }
6262}
6263
6264impl VirtioNetProxyInterface for VirtioNetProxy {
6265 type ConfigureQueueResponseFut =
6266 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6267 fn r#configure_queue(
6268 &self,
6269 mut queue: u16,
6270 mut size: u16,
6271 mut desc: u64,
6272 mut avail: u64,
6273 mut used: u64,
6274 ) -> Self::ConfigureQueueResponseFut {
6275 fn _decode(
6276 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6277 ) -> Result<(), fidl::Error> {
6278 let _response = fidl::client::decode_transaction_body::<
6279 fidl::encoding::EmptyPayload,
6280 fidl::encoding::DefaultFuchsiaResourceDialect,
6281 0x72b44fb963480b11,
6282 >(_buf?)?;
6283 Ok(_response)
6284 }
6285 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
6286 (queue, size, desc, avail, used),
6287 0x72b44fb963480b11,
6288 fidl::encoding::DynamicFlags::empty(),
6289 _decode,
6290 )
6291 }
6292
6293 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
6294 self.client.send::<VirtioDeviceNotifyQueueRequest>(
6295 (queue,),
6296 0x6e3a61d652499244,
6297 fidl::encoding::DynamicFlags::empty(),
6298 )
6299 }
6300
6301 type ReadyResponseFut =
6302 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6303 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
6304 fn _decode(
6305 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6306 ) -> Result<(), fidl::Error> {
6307 let _response = fidl::client::decode_transaction_body::<
6308 fidl::encoding::EmptyPayload,
6309 fidl::encoding::DefaultFuchsiaResourceDialect,
6310 0x45707654f5d23c3f,
6311 >(_buf?)?;
6312 Ok(_response)
6313 }
6314 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
6315 (negotiated_features,),
6316 0x45707654f5d23c3f,
6317 fidl::encoding::DynamicFlags::empty(),
6318 _decode,
6319 )
6320 }
6321
6322 type StartResponseFut = fidl::client::QueryResponseFut<
6323 VirtioNetStartResult,
6324 fidl::encoding::DefaultFuchsiaResourceDialect,
6325 >;
6326 fn r#start(
6327 &self,
6328 mut start_info: StartInfo,
6329 mut mac_address: &fidl_fuchsia_net::MacAddress,
6330 mut enable_bridge: bool,
6331 ) -> Self::StartResponseFut {
6332 fn _decode(
6333 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6334 ) -> Result<VirtioNetStartResult, fidl::Error> {
6335 let _response = fidl::client::decode_transaction_body::<
6336 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
6337 fidl::encoding::DefaultFuchsiaResourceDialect,
6338 0x795c0b3a8461b3ed,
6339 >(_buf?)?;
6340 Ok(_response.map(|x| x))
6341 }
6342 self.client.send_query_and_decode::<VirtioNetStartRequest, VirtioNetStartResult>(
6343 (&mut start_info, mac_address, enable_bridge),
6344 0x795c0b3a8461b3ed,
6345 fidl::encoding::DynamicFlags::empty(),
6346 _decode,
6347 )
6348 }
6349}
6350
6351pub struct VirtioNetEventStream {
6352 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6353}
6354
6355impl std::marker::Unpin for VirtioNetEventStream {}
6356
6357impl futures::stream::FusedStream for VirtioNetEventStream {
6358 fn is_terminated(&self) -> bool {
6359 self.event_receiver.is_terminated()
6360 }
6361}
6362
6363impl futures::Stream for VirtioNetEventStream {
6364 type Item = Result<VirtioNetEvent, fidl::Error>;
6365
6366 fn poll_next(
6367 mut self: std::pin::Pin<&mut Self>,
6368 cx: &mut std::task::Context<'_>,
6369 ) -> std::task::Poll<Option<Self::Item>> {
6370 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6371 &mut self.event_receiver,
6372 cx
6373 )?) {
6374 Some(buf) => std::task::Poll::Ready(Some(VirtioNetEvent::decode(buf))),
6375 None => std::task::Poll::Ready(None),
6376 }
6377 }
6378}
6379
6380#[derive(Debug)]
6381pub enum VirtioNetEvent {}
6382
6383impl VirtioNetEvent {
6384 fn decode(
6386 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6387 ) -> Result<VirtioNetEvent, fidl::Error> {
6388 let (bytes, _handles) = buf.split_mut();
6389 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6390 debug_assert_eq!(tx_header.tx_id, 0);
6391 match tx_header.ordinal {
6392 _ => Err(fidl::Error::UnknownOrdinal {
6393 ordinal: tx_header.ordinal,
6394 protocol_name: <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6395 }),
6396 }
6397 }
6398}
6399
6400pub struct VirtioNetRequestStream {
6402 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6403 is_terminated: bool,
6404}
6405
6406impl std::marker::Unpin for VirtioNetRequestStream {}
6407
6408impl futures::stream::FusedStream for VirtioNetRequestStream {
6409 fn is_terminated(&self) -> bool {
6410 self.is_terminated
6411 }
6412}
6413
6414impl fidl::endpoints::RequestStream for VirtioNetRequestStream {
6415 type Protocol = VirtioNetMarker;
6416 type ControlHandle = VirtioNetControlHandle;
6417
6418 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6419 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6420 }
6421
6422 fn control_handle(&self) -> Self::ControlHandle {
6423 VirtioNetControlHandle { inner: self.inner.clone() }
6424 }
6425
6426 fn into_inner(
6427 self,
6428 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6429 {
6430 (self.inner, self.is_terminated)
6431 }
6432
6433 fn from_inner(
6434 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6435 is_terminated: bool,
6436 ) -> Self {
6437 Self { inner, is_terminated }
6438 }
6439}
6440
6441impl futures::Stream for VirtioNetRequestStream {
6442 type Item = Result<VirtioNetRequest, fidl::Error>;
6443
6444 fn poll_next(
6445 mut self: std::pin::Pin<&mut Self>,
6446 cx: &mut std::task::Context<'_>,
6447 ) -> std::task::Poll<Option<Self::Item>> {
6448 let this = &mut *self;
6449 if this.inner.check_shutdown(cx) {
6450 this.is_terminated = true;
6451 return std::task::Poll::Ready(None);
6452 }
6453 if this.is_terminated {
6454 panic!("polled VirtioNetRequestStream after completion");
6455 }
6456 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6457 |bytes, handles| {
6458 match this.inner.channel().read_etc(cx, bytes, handles) {
6459 std::task::Poll::Ready(Ok(())) => {}
6460 std::task::Poll::Pending => return std::task::Poll::Pending,
6461 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6462 this.is_terminated = true;
6463 return std::task::Poll::Ready(None);
6464 }
6465 std::task::Poll::Ready(Err(e)) => {
6466 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6467 e.into(),
6468 ))));
6469 }
6470 }
6471
6472 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6474
6475 std::task::Poll::Ready(Some(match header.ordinal {
6476 0x72b44fb963480b11 => {
6477 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6478 let mut req = fidl::new_empty!(
6479 VirtioDeviceConfigureQueueRequest,
6480 fidl::encoding::DefaultFuchsiaResourceDialect
6481 );
6482 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
6483 let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
6484 Ok(VirtioNetRequest::ConfigureQueue {
6485 queue: req.queue,
6486 size: req.size,
6487 desc: req.desc,
6488 avail: req.avail,
6489 used: req.used,
6490
6491 responder: VirtioNetConfigureQueueResponder {
6492 control_handle: std::mem::ManuallyDrop::new(control_handle),
6493 tx_id: header.tx_id,
6494 },
6495 })
6496 }
6497 0x6e3a61d652499244 => {
6498 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6499 let mut req = fidl::new_empty!(
6500 VirtioDeviceNotifyQueueRequest,
6501 fidl::encoding::DefaultFuchsiaResourceDialect
6502 );
6503 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
6504 let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
6505 Ok(VirtioNetRequest::NotifyQueue { queue: req.queue, control_handle })
6506 }
6507 0x45707654f5d23c3f => {
6508 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6509 let mut req = fidl::new_empty!(
6510 VirtioDeviceReadyRequest,
6511 fidl::encoding::DefaultFuchsiaResourceDialect
6512 );
6513 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
6514 let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
6515 Ok(VirtioNetRequest::Ready {
6516 negotiated_features: req.negotiated_features,
6517
6518 responder: VirtioNetReadyResponder {
6519 control_handle: std::mem::ManuallyDrop::new(control_handle),
6520 tx_id: header.tx_id,
6521 },
6522 })
6523 }
6524 0x795c0b3a8461b3ed => {
6525 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6526 let mut req = fidl::new_empty!(
6527 VirtioNetStartRequest,
6528 fidl::encoding::DefaultFuchsiaResourceDialect
6529 );
6530 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioNetStartRequest>(&header, _body_bytes, handles, &mut req)?;
6531 let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
6532 Ok(VirtioNetRequest::Start {
6533 start_info: req.start_info,
6534 mac_address: req.mac_address,
6535 enable_bridge: req.enable_bridge,
6536
6537 responder: VirtioNetStartResponder {
6538 control_handle: std::mem::ManuallyDrop::new(control_handle),
6539 tx_id: header.tx_id,
6540 },
6541 })
6542 }
6543 _ => Err(fidl::Error::UnknownOrdinal {
6544 ordinal: header.ordinal,
6545 protocol_name:
6546 <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6547 }),
6548 }))
6549 },
6550 )
6551 }
6552}
6553
6554#[derive(Debug)]
6555pub enum VirtioNetRequest {
6556 ConfigureQueue {
6559 queue: u16,
6560 size: u16,
6561 desc: u64,
6562 avail: u64,
6563 used: u64,
6564 responder: VirtioNetConfigureQueueResponder,
6565 },
6566 NotifyQueue { queue: u16, control_handle: VirtioNetControlHandle },
6568 Ready { negotiated_features: u32, responder: VirtioNetReadyResponder },
6571 Start {
6573 start_info: StartInfo,
6574 mac_address: fidl_fuchsia_net::MacAddress,
6575 enable_bridge: bool,
6576 responder: VirtioNetStartResponder,
6577 },
6578}
6579
6580impl VirtioNetRequest {
6581 #[allow(irrefutable_let_patterns)]
6582 pub fn into_configure_queue(
6583 self,
6584 ) -> Option<(u16, u16, u64, u64, u64, VirtioNetConfigureQueueResponder)> {
6585 if let VirtioNetRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
6586 {
6587 Some((queue, size, desc, avail, used, responder))
6588 } else {
6589 None
6590 }
6591 }
6592
6593 #[allow(irrefutable_let_patterns)]
6594 pub fn into_notify_queue(self) -> Option<(u16, VirtioNetControlHandle)> {
6595 if let VirtioNetRequest::NotifyQueue { queue, control_handle } = self {
6596 Some((queue, control_handle))
6597 } else {
6598 None
6599 }
6600 }
6601
6602 #[allow(irrefutable_let_patterns)]
6603 pub fn into_ready(self) -> Option<(u32, VirtioNetReadyResponder)> {
6604 if let VirtioNetRequest::Ready { negotiated_features, responder } = self {
6605 Some((negotiated_features, responder))
6606 } else {
6607 None
6608 }
6609 }
6610
6611 #[allow(irrefutable_let_patterns)]
6612 pub fn into_start(
6613 self,
6614 ) -> Option<(StartInfo, fidl_fuchsia_net::MacAddress, bool, VirtioNetStartResponder)> {
6615 if let VirtioNetRequest::Start { start_info, mac_address, enable_bridge, responder } = self
6616 {
6617 Some((start_info, mac_address, enable_bridge, responder))
6618 } else {
6619 None
6620 }
6621 }
6622
6623 pub fn method_name(&self) -> &'static str {
6625 match *self {
6626 VirtioNetRequest::ConfigureQueue { .. } => "configure_queue",
6627 VirtioNetRequest::NotifyQueue { .. } => "notify_queue",
6628 VirtioNetRequest::Ready { .. } => "ready",
6629 VirtioNetRequest::Start { .. } => "start",
6630 }
6631 }
6632}
6633
6634#[derive(Debug, Clone)]
6635pub struct VirtioNetControlHandle {
6636 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6637}
6638
6639impl fidl::endpoints::ControlHandle for VirtioNetControlHandle {
6640 fn shutdown(&self) {
6641 self.inner.shutdown()
6642 }
6643 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6644 self.inner.shutdown_with_epitaph(status)
6645 }
6646
6647 fn is_closed(&self) -> bool {
6648 self.inner.channel().is_closed()
6649 }
6650 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6651 self.inner.channel().on_closed()
6652 }
6653
6654 #[cfg(target_os = "fuchsia")]
6655 fn signal_peer(
6656 &self,
6657 clear_mask: zx::Signals,
6658 set_mask: zx::Signals,
6659 ) -> Result<(), zx_status::Status> {
6660 use fidl::Peered;
6661 self.inner.channel().signal_peer(clear_mask, set_mask)
6662 }
6663}
6664
6665impl VirtioNetControlHandle {}
6666
6667#[must_use = "FIDL methods require a response to be sent"]
6668#[derive(Debug)]
6669pub struct VirtioNetConfigureQueueResponder {
6670 control_handle: std::mem::ManuallyDrop<VirtioNetControlHandle>,
6671 tx_id: u32,
6672}
6673
6674impl std::ops::Drop for VirtioNetConfigureQueueResponder {
6678 fn drop(&mut self) {
6679 self.control_handle.shutdown();
6680 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6682 }
6683}
6684
6685impl fidl::endpoints::Responder for VirtioNetConfigureQueueResponder {
6686 type ControlHandle = VirtioNetControlHandle;
6687
6688 fn control_handle(&self) -> &VirtioNetControlHandle {
6689 &self.control_handle
6690 }
6691
6692 fn drop_without_shutdown(mut self) {
6693 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6695 std::mem::forget(self);
6697 }
6698}
6699
6700impl VirtioNetConfigureQueueResponder {
6701 pub fn send(self) -> Result<(), fidl::Error> {
6705 let _result = self.send_raw();
6706 if _result.is_err() {
6707 self.control_handle.shutdown();
6708 }
6709 self.drop_without_shutdown();
6710 _result
6711 }
6712
6713 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6715 let _result = self.send_raw();
6716 self.drop_without_shutdown();
6717 _result
6718 }
6719
6720 fn send_raw(&self) -> Result<(), fidl::Error> {
6721 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6722 (),
6723 self.tx_id,
6724 0x72b44fb963480b11,
6725 fidl::encoding::DynamicFlags::empty(),
6726 )
6727 }
6728}
6729
6730#[must_use = "FIDL methods require a response to be sent"]
6731#[derive(Debug)]
6732pub struct VirtioNetReadyResponder {
6733 control_handle: std::mem::ManuallyDrop<VirtioNetControlHandle>,
6734 tx_id: u32,
6735}
6736
6737impl std::ops::Drop for VirtioNetReadyResponder {
6741 fn drop(&mut self) {
6742 self.control_handle.shutdown();
6743 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6745 }
6746}
6747
6748impl fidl::endpoints::Responder for VirtioNetReadyResponder {
6749 type ControlHandle = VirtioNetControlHandle;
6750
6751 fn control_handle(&self) -> &VirtioNetControlHandle {
6752 &self.control_handle
6753 }
6754
6755 fn drop_without_shutdown(mut self) {
6756 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6758 std::mem::forget(self);
6760 }
6761}
6762
6763impl VirtioNetReadyResponder {
6764 pub fn send(self) -> Result<(), fidl::Error> {
6768 let _result = self.send_raw();
6769 if _result.is_err() {
6770 self.control_handle.shutdown();
6771 }
6772 self.drop_without_shutdown();
6773 _result
6774 }
6775
6776 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6778 let _result = self.send_raw();
6779 self.drop_without_shutdown();
6780 _result
6781 }
6782
6783 fn send_raw(&self) -> Result<(), fidl::Error> {
6784 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6785 (),
6786 self.tx_id,
6787 0x45707654f5d23c3f,
6788 fidl::encoding::DynamicFlags::empty(),
6789 )
6790 }
6791}
6792
6793#[must_use = "FIDL methods require a response to be sent"]
6794#[derive(Debug)]
6795pub struct VirtioNetStartResponder {
6796 control_handle: std::mem::ManuallyDrop<VirtioNetControlHandle>,
6797 tx_id: u32,
6798}
6799
6800impl std::ops::Drop for VirtioNetStartResponder {
6804 fn drop(&mut self) {
6805 self.control_handle.shutdown();
6806 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6808 }
6809}
6810
6811impl fidl::endpoints::Responder for VirtioNetStartResponder {
6812 type ControlHandle = VirtioNetControlHandle;
6813
6814 fn control_handle(&self) -> &VirtioNetControlHandle {
6815 &self.control_handle
6816 }
6817
6818 fn drop_without_shutdown(mut self) {
6819 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6821 std::mem::forget(self);
6823 }
6824}
6825
6826impl VirtioNetStartResponder {
6827 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6831 let _result = self.send_raw(result);
6832 if _result.is_err() {
6833 self.control_handle.shutdown();
6834 }
6835 self.drop_without_shutdown();
6836 _result
6837 }
6838
6839 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6841 let _result = self.send_raw(result);
6842 self.drop_without_shutdown();
6843 _result
6844 }
6845
6846 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6847 self.control_handle
6848 .inner
6849 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6850 result,
6851 self.tx_id,
6852 0x795c0b3a8461b3ed,
6853 fidl::encoding::DynamicFlags::empty(),
6854 )
6855 }
6856}
6857
6858#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6859pub struct VirtioRngMarker;
6860
6861impl fidl::endpoints::ProtocolMarker for VirtioRngMarker {
6862 type Proxy = VirtioRngProxy;
6863 type RequestStream = VirtioRngRequestStream;
6864 #[cfg(target_os = "fuchsia")]
6865 type SynchronousProxy = VirtioRngSynchronousProxy;
6866
6867 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioRng";
6868}
6869impl fidl::endpoints::DiscoverableProtocolMarker for VirtioRngMarker {}
6870
6871pub trait VirtioRngProxyInterface: Send + Sync {
6872 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6873 fn r#configure_queue(
6874 &self,
6875 queue: u16,
6876 size: u16,
6877 desc: u64,
6878 avail: u64,
6879 used: u64,
6880 ) -> Self::ConfigureQueueResponseFut;
6881 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
6882 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6883 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
6884 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6885 fn r#start(&self, start_info: StartInfo) -> Self::StartResponseFut;
6886}
6887#[derive(Debug)]
6888#[cfg(target_os = "fuchsia")]
6889pub struct VirtioRngSynchronousProxy {
6890 client: fidl::client::sync::Client,
6891}
6892
6893#[cfg(target_os = "fuchsia")]
6894impl fidl::endpoints::SynchronousProxy for VirtioRngSynchronousProxy {
6895 type Proxy = VirtioRngProxy;
6896 type Protocol = VirtioRngMarker;
6897
6898 fn from_channel(inner: fidl::Channel) -> Self {
6899 Self::new(inner)
6900 }
6901
6902 fn into_channel(self) -> fidl::Channel {
6903 self.client.into_channel()
6904 }
6905
6906 fn as_channel(&self) -> &fidl::Channel {
6907 self.client.as_channel()
6908 }
6909}
6910
6911#[cfg(target_os = "fuchsia")]
6912impl VirtioRngSynchronousProxy {
6913 pub fn new(channel: fidl::Channel) -> Self {
6914 let protocol_name = <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6915 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6916 }
6917
6918 pub fn into_channel(self) -> fidl::Channel {
6919 self.client.into_channel()
6920 }
6921
6922 pub fn wait_for_event(
6925 &self,
6926 deadline: zx::MonotonicInstant,
6927 ) -> Result<VirtioRngEvent, fidl::Error> {
6928 VirtioRngEvent::decode(self.client.wait_for_event(deadline)?)
6929 }
6930
6931 pub fn r#configure_queue(
6934 &self,
6935 mut queue: u16,
6936 mut size: u16,
6937 mut desc: u64,
6938 mut avail: u64,
6939 mut used: u64,
6940 ___deadline: zx::MonotonicInstant,
6941 ) -> Result<(), fidl::Error> {
6942 let _response = self
6943 .client
6944 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
6945 (queue, size, desc, avail, used),
6946 0x72b44fb963480b11,
6947 fidl::encoding::DynamicFlags::empty(),
6948 ___deadline,
6949 )?;
6950 Ok(_response)
6951 }
6952
6953 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
6955 self.client.send::<VirtioDeviceNotifyQueueRequest>(
6956 (queue,),
6957 0x6e3a61d652499244,
6958 fidl::encoding::DynamicFlags::empty(),
6959 )
6960 }
6961
6962 pub fn r#ready(
6965 &self,
6966 mut negotiated_features: u32,
6967 ___deadline: zx::MonotonicInstant,
6968 ) -> Result<(), fidl::Error> {
6969 let _response =
6970 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
6971 (negotiated_features,),
6972 0x45707654f5d23c3f,
6973 fidl::encoding::DynamicFlags::empty(),
6974 ___deadline,
6975 )?;
6976 Ok(_response)
6977 }
6978
6979 pub fn r#start(
6981 &self,
6982 mut start_info: StartInfo,
6983 ___deadline: zx::MonotonicInstant,
6984 ) -> Result<(), fidl::Error> {
6985 let _response =
6986 self.client.send_query::<VirtioRngStartRequest, fidl::encoding::EmptyPayload>(
6987 (&mut start_info,),
6988 0x620b3ed254febc0f,
6989 fidl::encoding::DynamicFlags::empty(),
6990 ___deadline,
6991 )?;
6992 Ok(_response)
6993 }
6994}
6995
6996#[cfg(target_os = "fuchsia")]
6997impl From<VirtioRngSynchronousProxy> for zx::Handle {
6998 fn from(value: VirtioRngSynchronousProxy) -> Self {
6999 value.into_channel().into()
7000 }
7001}
7002
7003#[cfg(target_os = "fuchsia")]
7004impl From<fidl::Channel> for VirtioRngSynchronousProxy {
7005 fn from(value: fidl::Channel) -> Self {
7006 Self::new(value)
7007 }
7008}
7009
7010#[cfg(target_os = "fuchsia")]
7011impl fidl::endpoints::FromClient for VirtioRngSynchronousProxy {
7012 type Protocol = VirtioRngMarker;
7013
7014 fn from_client(value: fidl::endpoints::ClientEnd<VirtioRngMarker>) -> Self {
7015 Self::new(value.into_channel())
7016 }
7017}
7018
7019#[derive(Debug, Clone)]
7020pub struct VirtioRngProxy {
7021 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7022}
7023
7024impl fidl::endpoints::Proxy for VirtioRngProxy {
7025 type Protocol = VirtioRngMarker;
7026
7027 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7028 Self::new(inner)
7029 }
7030
7031 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7032 self.client.into_channel().map_err(|client| Self { client })
7033 }
7034
7035 fn as_channel(&self) -> &::fidl::AsyncChannel {
7036 self.client.as_channel()
7037 }
7038}
7039
7040impl VirtioRngProxy {
7041 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7043 let protocol_name = <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7044 Self { client: fidl::client::Client::new(channel, protocol_name) }
7045 }
7046
7047 pub fn take_event_stream(&self) -> VirtioRngEventStream {
7053 VirtioRngEventStream { event_receiver: self.client.take_event_receiver() }
7054 }
7055
7056 pub fn r#configure_queue(
7059 &self,
7060 mut queue: u16,
7061 mut size: u16,
7062 mut desc: u64,
7063 mut avail: u64,
7064 mut used: u64,
7065 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7066 VirtioRngProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
7067 }
7068
7069 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7071 VirtioRngProxyInterface::r#notify_queue(self, queue)
7072 }
7073
7074 pub fn r#ready(
7077 &self,
7078 mut negotiated_features: u32,
7079 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7080 VirtioRngProxyInterface::r#ready(self, negotiated_features)
7081 }
7082
7083 pub fn r#start(
7085 &self,
7086 mut start_info: StartInfo,
7087 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7088 VirtioRngProxyInterface::r#start(self, start_info)
7089 }
7090}
7091
7092impl VirtioRngProxyInterface for VirtioRngProxy {
7093 type ConfigureQueueResponseFut =
7094 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7095 fn r#configure_queue(
7096 &self,
7097 mut queue: u16,
7098 mut size: u16,
7099 mut desc: u64,
7100 mut avail: u64,
7101 mut used: u64,
7102 ) -> Self::ConfigureQueueResponseFut {
7103 fn _decode(
7104 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7105 ) -> Result<(), fidl::Error> {
7106 let _response = fidl::client::decode_transaction_body::<
7107 fidl::encoding::EmptyPayload,
7108 fidl::encoding::DefaultFuchsiaResourceDialect,
7109 0x72b44fb963480b11,
7110 >(_buf?)?;
7111 Ok(_response)
7112 }
7113 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
7114 (queue, size, desc, avail, used),
7115 0x72b44fb963480b11,
7116 fidl::encoding::DynamicFlags::empty(),
7117 _decode,
7118 )
7119 }
7120
7121 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7122 self.client.send::<VirtioDeviceNotifyQueueRequest>(
7123 (queue,),
7124 0x6e3a61d652499244,
7125 fidl::encoding::DynamicFlags::empty(),
7126 )
7127 }
7128
7129 type ReadyResponseFut =
7130 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7131 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
7132 fn _decode(
7133 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7134 ) -> Result<(), fidl::Error> {
7135 let _response = fidl::client::decode_transaction_body::<
7136 fidl::encoding::EmptyPayload,
7137 fidl::encoding::DefaultFuchsiaResourceDialect,
7138 0x45707654f5d23c3f,
7139 >(_buf?)?;
7140 Ok(_response)
7141 }
7142 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
7143 (negotiated_features,),
7144 0x45707654f5d23c3f,
7145 fidl::encoding::DynamicFlags::empty(),
7146 _decode,
7147 )
7148 }
7149
7150 type StartResponseFut =
7151 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7152 fn r#start(&self, mut start_info: StartInfo) -> Self::StartResponseFut {
7153 fn _decode(
7154 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7155 ) -> Result<(), fidl::Error> {
7156 let _response = fidl::client::decode_transaction_body::<
7157 fidl::encoding::EmptyPayload,
7158 fidl::encoding::DefaultFuchsiaResourceDialect,
7159 0x620b3ed254febc0f,
7160 >(_buf?)?;
7161 Ok(_response)
7162 }
7163 self.client.send_query_and_decode::<VirtioRngStartRequest, ()>(
7164 (&mut start_info,),
7165 0x620b3ed254febc0f,
7166 fidl::encoding::DynamicFlags::empty(),
7167 _decode,
7168 )
7169 }
7170}
7171
7172pub struct VirtioRngEventStream {
7173 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7174}
7175
7176impl std::marker::Unpin for VirtioRngEventStream {}
7177
7178impl futures::stream::FusedStream for VirtioRngEventStream {
7179 fn is_terminated(&self) -> bool {
7180 self.event_receiver.is_terminated()
7181 }
7182}
7183
7184impl futures::Stream for VirtioRngEventStream {
7185 type Item = Result<VirtioRngEvent, fidl::Error>;
7186
7187 fn poll_next(
7188 mut self: std::pin::Pin<&mut Self>,
7189 cx: &mut std::task::Context<'_>,
7190 ) -> std::task::Poll<Option<Self::Item>> {
7191 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7192 &mut self.event_receiver,
7193 cx
7194 )?) {
7195 Some(buf) => std::task::Poll::Ready(Some(VirtioRngEvent::decode(buf))),
7196 None => std::task::Poll::Ready(None),
7197 }
7198 }
7199}
7200
7201#[derive(Debug)]
7202pub enum VirtioRngEvent {}
7203
7204impl VirtioRngEvent {
7205 fn decode(
7207 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7208 ) -> Result<VirtioRngEvent, fidl::Error> {
7209 let (bytes, _handles) = buf.split_mut();
7210 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7211 debug_assert_eq!(tx_header.tx_id, 0);
7212 match tx_header.ordinal {
7213 _ => Err(fidl::Error::UnknownOrdinal {
7214 ordinal: tx_header.ordinal,
7215 protocol_name: <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7216 }),
7217 }
7218 }
7219}
7220
7221pub struct VirtioRngRequestStream {
7223 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7224 is_terminated: bool,
7225}
7226
7227impl std::marker::Unpin for VirtioRngRequestStream {}
7228
7229impl futures::stream::FusedStream for VirtioRngRequestStream {
7230 fn is_terminated(&self) -> bool {
7231 self.is_terminated
7232 }
7233}
7234
7235impl fidl::endpoints::RequestStream for VirtioRngRequestStream {
7236 type Protocol = VirtioRngMarker;
7237 type ControlHandle = VirtioRngControlHandle;
7238
7239 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7240 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7241 }
7242
7243 fn control_handle(&self) -> Self::ControlHandle {
7244 VirtioRngControlHandle { inner: self.inner.clone() }
7245 }
7246
7247 fn into_inner(
7248 self,
7249 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7250 {
7251 (self.inner, self.is_terminated)
7252 }
7253
7254 fn from_inner(
7255 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7256 is_terminated: bool,
7257 ) -> Self {
7258 Self { inner, is_terminated }
7259 }
7260}
7261
7262impl futures::Stream for VirtioRngRequestStream {
7263 type Item = Result<VirtioRngRequest, fidl::Error>;
7264
7265 fn poll_next(
7266 mut self: std::pin::Pin<&mut Self>,
7267 cx: &mut std::task::Context<'_>,
7268 ) -> std::task::Poll<Option<Self::Item>> {
7269 let this = &mut *self;
7270 if this.inner.check_shutdown(cx) {
7271 this.is_terminated = true;
7272 return std::task::Poll::Ready(None);
7273 }
7274 if this.is_terminated {
7275 panic!("polled VirtioRngRequestStream after completion");
7276 }
7277 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7278 |bytes, handles| {
7279 match this.inner.channel().read_etc(cx, bytes, handles) {
7280 std::task::Poll::Ready(Ok(())) => {}
7281 std::task::Poll::Pending => return std::task::Poll::Pending,
7282 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7283 this.is_terminated = true;
7284 return std::task::Poll::Ready(None);
7285 }
7286 std::task::Poll::Ready(Err(e)) => {
7287 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7288 e.into(),
7289 ))));
7290 }
7291 }
7292
7293 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7295
7296 std::task::Poll::Ready(Some(match header.ordinal {
7297 0x72b44fb963480b11 => {
7298 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7299 let mut req = fidl::new_empty!(
7300 VirtioDeviceConfigureQueueRequest,
7301 fidl::encoding::DefaultFuchsiaResourceDialect
7302 );
7303 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
7304 let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
7305 Ok(VirtioRngRequest::ConfigureQueue {
7306 queue: req.queue,
7307 size: req.size,
7308 desc: req.desc,
7309 avail: req.avail,
7310 used: req.used,
7311
7312 responder: VirtioRngConfigureQueueResponder {
7313 control_handle: std::mem::ManuallyDrop::new(control_handle),
7314 tx_id: header.tx_id,
7315 },
7316 })
7317 }
7318 0x6e3a61d652499244 => {
7319 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7320 let mut req = fidl::new_empty!(
7321 VirtioDeviceNotifyQueueRequest,
7322 fidl::encoding::DefaultFuchsiaResourceDialect
7323 );
7324 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
7325 let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
7326 Ok(VirtioRngRequest::NotifyQueue { queue: req.queue, control_handle })
7327 }
7328 0x45707654f5d23c3f => {
7329 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7330 let mut req = fidl::new_empty!(
7331 VirtioDeviceReadyRequest,
7332 fidl::encoding::DefaultFuchsiaResourceDialect
7333 );
7334 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
7335 let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
7336 Ok(VirtioRngRequest::Ready {
7337 negotiated_features: req.negotiated_features,
7338
7339 responder: VirtioRngReadyResponder {
7340 control_handle: std::mem::ManuallyDrop::new(control_handle),
7341 tx_id: header.tx_id,
7342 },
7343 })
7344 }
7345 0x620b3ed254febc0f => {
7346 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7347 let mut req = fidl::new_empty!(
7348 VirtioRngStartRequest,
7349 fidl::encoding::DefaultFuchsiaResourceDialect
7350 );
7351 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioRngStartRequest>(&header, _body_bytes, handles, &mut req)?;
7352 let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
7353 Ok(VirtioRngRequest::Start {
7354 start_info: req.start_info,
7355
7356 responder: VirtioRngStartResponder {
7357 control_handle: std::mem::ManuallyDrop::new(control_handle),
7358 tx_id: header.tx_id,
7359 },
7360 })
7361 }
7362 _ => Err(fidl::Error::UnknownOrdinal {
7363 ordinal: header.ordinal,
7364 protocol_name:
7365 <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7366 }),
7367 }))
7368 },
7369 )
7370 }
7371}
7372
7373#[derive(Debug)]
7374pub enum VirtioRngRequest {
7375 ConfigureQueue {
7378 queue: u16,
7379 size: u16,
7380 desc: u64,
7381 avail: u64,
7382 used: u64,
7383 responder: VirtioRngConfigureQueueResponder,
7384 },
7385 NotifyQueue { queue: u16, control_handle: VirtioRngControlHandle },
7387 Ready { negotiated_features: u32, responder: VirtioRngReadyResponder },
7390 Start { start_info: StartInfo, responder: VirtioRngStartResponder },
7392}
7393
7394impl VirtioRngRequest {
7395 #[allow(irrefutable_let_patterns)]
7396 pub fn into_configure_queue(
7397 self,
7398 ) -> Option<(u16, u16, u64, u64, u64, VirtioRngConfigureQueueResponder)> {
7399 if let VirtioRngRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
7400 {
7401 Some((queue, size, desc, avail, used, responder))
7402 } else {
7403 None
7404 }
7405 }
7406
7407 #[allow(irrefutable_let_patterns)]
7408 pub fn into_notify_queue(self) -> Option<(u16, VirtioRngControlHandle)> {
7409 if let VirtioRngRequest::NotifyQueue { queue, control_handle } = self {
7410 Some((queue, control_handle))
7411 } else {
7412 None
7413 }
7414 }
7415
7416 #[allow(irrefutable_let_patterns)]
7417 pub fn into_ready(self) -> Option<(u32, VirtioRngReadyResponder)> {
7418 if let VirtioRngRequest::Ready { negotiated_features, responder } = self {
7419 Some((negotiated_features, responder))
7420 } else {
7421 None
7422 }
7423 }
7424
7425 #[allow(irrefutable_let_patterns)]
7426 pub fn into_start(self) -> Option<(StartInfo, VirtioRngStartResponder)> {
7427 if let VirtioRngRequest::Start { start_info, responder } = self {
7428 Some((start_info, responder))
7429 } else {
7430 None
7431 }
7432 }
7433
7434 pub fn method_name(&self) -> &'static str {
7436 match *self {
7437 VirtioRngRequest::ConfigureQueue { .. } => "configure_queue",
7438 VirtioRngRequest::NotifyQueue { .. } => "notify_queue",
7439 VirtioRngRequest::Ready { .. } => "ready",
7440 VirtioRngRequest::Start { .. } => "start",
7441 }
7442 }
7443}
7444
7445#[derive(Debug, Clone)]
7446pub struct VirtioRngControlHandle {
7447 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7448}
7449
7450impl fidl::endpoints::ControlHandle for VirtioRngControlHandle {
7451 fn shutdown(&self) {
7452 self.inner.shutdown()
7453 }
7454 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7455 self.inner.shutdown_with_epitaph(status)
7456 }
7457
7458 fn is_closed(&self) -> bool {
7459 self.inner.channel().is_closed()
7460 }
7461 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7462 self.inner.channel().on_closed()
7463 }
7464
7465 #[cfg(target_os = "fuchsia")]
7466 fn signal_peer(
7467 &self,
7468 clear_mask: zx::Signals,
7469 set_mask: zx::Signals,
7470 ) -> Result<(), zx_status::Status> {
7471 use fidl::Peered;
7472 self.inner.channel().signal_peer(clear_mask, set_mask)
7473 }
7474}
7475
7476impl VirtioRngControlHandle {}
7477
7478#[must_use = "FIDL methods require a response to be sent"]
7479#[derive(Debug)]
7480pub struct VirtioRngConfigureQueueResponder {
7481 control_handle: std::mem::ManuallyDrop<VirtioRngControlHandle>,
7482 tx_id: u32,
7483}
7484
7485impl std::ops::Drop for VirtioRngConfigureQueueResponder {
7489 fn drop(&mut self) {
7490 self.control_handle.shutdown();
7491 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7493 }
7494}
7495
7496impl fidl::endpoints::Responder for VirtioRngConfigureQueueResponder {
7497 type ControlHandle = VirtioRngControlHandle;
7498
7499 fn control_handle(&self) -> &VirtioRngControlHandle {
7500 &self.control_handle
7501 }
7502
7503 fn drop_without_shutdown(mut self) {
7504 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7506 std::mem::forget(self);
7508 }
7509}
7510
7511impl VirtioRngConfigureQueueResponder {
7512 pub fn send(self) -> Result<(), fidl::Error> {
7516 let _result = self.send_raw();
7517 if _result.is_err() {
7518 self.control_handle.shutdown();
7519 }
7520 self.drop_without_shutdown();
7521 _result
7522 }
7523
7524 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7526 let _result = self.send_raw();
7527 self.drop_without_shutdown();
7528 _result
7529 }
7530
7531 fn send_raw(&self) -> Result<(), fidl::Error> {
7532 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7533 (),
7534 self.tx_id,
7535 0x72b44fb963480b11,
7536 fidl::encoding::DynamicFlags::empty(),
7537 )
7538 }
7539}
7540
7541#[must_use = "FIDL methods require a response to be sent"]
7542#[derive(Debug)]
7543pub struct VirtioRngReadyResponder {
7544 control_handle: std::mem::ManuallyDrop<VirtioRngControlHandle>,
7545 tx_id: u32,
7546}
7547
7548impl std::ops::Drop for VirtioRngReadyResponder {
7552 fn drop(&mut self) {
7553 self.control_handle.shutdown();
7554 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7556 }
7557}
7558
7559impl fidl::endpoints::Responder for VirtioRngReadyResponder {
7560 type ControlHandle = VirtioRngControlHandle;
7561
7562 fn control_handle(&self) -> &VirtioRngControlHandle {
7563 &self.control_handle
7564 }
7565
7566 fn drop_without_shutdown(mut self) {
7567 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7569 std::mem::forget(self);
7571 }
7572}
7573
7574impl VirtioRngReadyResponder {
7575 pub fn send(self) -> Result<(), fidl::Error> {
7579 let _result = self.send_raw();
7580 if _result.is_err() {
7581 self.control_handle.shutdown();
7582 }
7583 self.drop_without_shutdown();
7584 _result
7585 }
7586
7587 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7589 let _result = self.send_raw();
7590 self.drop_without_shutdown();
7591 _result
7592 }
7593
7594 fn send_raw(&self) -> Result<(), fidl::Error> {
7595 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7596 (),
7597 self.tx_id,
7598 0x45707654f5d23c3f,
7599 fidl::encoding::DynamicFlags::empty(),
7600 )
7601 }
7602}
7603
7604#[must_use = "FIDL methods require a response to be sent"]
7605#[derive(Debug)]
7606pub struct VirtioRngStartResponder {
7607 control_handle: std::mem::ManuallyDrop<VirtioRngControlHandle>,
7608 tx_id: u32,
7609}
7610
7611impl std::ops::Drop for VirtioRngStartResponder {
7615 fn drop(&mut self) {
7616 self.control_handle.shutdown();
7617 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7619 }
7620}
7621
7622impl fidl::endpoints::Responder for VirtioRngStartResponder {
7623 type ControlHandle = VirtioRngControlHandle;
7624
7625 fn control_handle(&self) -> &VirtioRngControlHandle {
7626 &self.control_handle
7627 }
7628
7629 fn drop_without_shutdown(mut self) {
7630 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7632 std::mem::forget(self);
7634 }
7635}
7636
7637impl VirtioRngStartResponder {
7638 pub fn send(self) -> Result<(), fidl::Error> {
7642 let _result = self.send_raw();
7643 if _result.is_err() {
7644 self.control_handle.shutdown();
7645 }
7646 self.drop_without_shutdown();
7647 _result
7648 }
7649
7650 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7652 let _result = self.send_raw();
7653 self.drop_without_shutdown();
7654 _result
7655 }
7656
7657 fn send_raw(&self) -> Result<(), fidl::Error> {
7658 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7659 (),
7660 self.tx_id,
7661 0x620b3ed254febc0f,
7662 fidl::encoding::DynamicFlags::empty(),
7663 )
7664 }
7665}
7666
7667#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7668pub struct VirtioSoundMarker;
7669
7670impl fidl::endpoints::ProtocolMarker for VirtioSoundMarker {
7671 type Proxy = VirtioSoundProxy;
7672 type RequestStream = VirtioSoundRequestStream;
7673 #[cfg(target_os = "fuchsia")]
7674 type SynchronousProxy = VirtioSoundSynchronousProxy;
7675
7676 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioSound";
7677}
7678impl fidl::endpoints::DiscoverableProtocolMarker for VirtioSoundMarker {}
7679
7680pub trait VirtioSoundProxyInterface: Send + Sync {
7681 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7682 fn r#configure_queue(
7683 &self,
7684 queue: u16,
7685 size: u16,
7686 desc: u64,
7687 avail: u64,
7688 used: u64,
7689 ) -> Self::ConfigureQueueResponseFut;
7690 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
7691 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7692 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
7693 type StartResponseFut: std::future::Future<Output = Result<(u32, u32, u32, u32), fidl::Error>>
7694 + Send;
7695 fn r#start(
7696 &self,
7697 start_info: StartInfo,
7698 enable_input: bool,
7699 enable_verbose_logging: bool,
7700 ) -> Self::StartResponseFut;
7701}
7702#[derive(Debug)]
7703#[cfg(target_os = "fuchsia")]
7704pub struct VirtioSoundSynchronousProxy {
7705 client: fidl::client::sync::Client,
7706}
7707
7708#[cfg(target_os = "fuchsia")]
7709impl fidl::endpoints::SynchronousProxy for VirtioSoundSynchronousProxy {
7710 type Proxy = VirtioSoundProxy;
7711 type Protocol = VirtioSoundMarker;
7712
7713 fn from_channel(inner: fidl::Channel) -> Self {
7714 Self::new(inner)
7715 }
7716
7717 fn into_channel(self) -> fidl::Channel {
7718 self.client.into_channel()
7719 }
7720
7721 fn as_channel(&self) -> &fidl::Channel {
7722 self.client.as_channel()
7723 }
7724}
7725
7726#[cfg(target_os = "fuchsia")]
7727impl VirtioSoundSynchronousProxy {
7728 pub fn new(channel: fidl::Channel) -> Self {
7729 let protocol_name = <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7730 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7731 }
7732
7733 pub fn into_channel(self) -> fidl::Channel {
7734 self.client.into_channel()
7735 }
7736
7737 pub fn wait_for_event(
7740 &self,
7741 deadline: zx::MonotonicInstant,
7742 ) -> Result<VirtioSoundEvent, fidl::Error> {
7743 VirtioSoundEvent::decode(self.client.wait_for_event(deadline)?)
7744 }
7745
7746 pub fn r#configure_queue(
7749 &self,
7750 mut queue: u16,
7751 mut size: u16,
7752 mut desc: u64,
7753 mut avail: u64,
7754 mut used: u64,
7755 ___deadline: zx::MonotonicInstant,
7756 ) -> Result<(), fidl::Error> {
7757 let _response = self
7758 .client
7759 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
7760 (queue, size, desc, avail, used),
7761 0x72b44fb963480b11,
7762 fidl::encoding::DynamicFlags::empty(),
7763 ___deadline,
7764 )?;
7765 Ok(_response)
7766 }
7767
7768 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7770 self.client.send::<VirtioDeviceNotifyQueueRequest>(
7771 (queue,),
7772 0x6e3a61d652499244,
7773 fidl::encoding::DynamicFlags::empty(),
7774 )
7775 }
7776
7777 pub fn r#ready(
7780 &self,
7781 mut negotiated_features: u32,
7782 ___deadline: zx::MonotonicInstant,
7783 ) -> Result<(), fidl::Error> {
7784 let _response =
7785 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
7786 (negotiated_features,),
7787 0x45707654f5d23c3f,
7788 fidl::encoding::DynamicFlags::empty(),
7789 ___deadline,
7790 )?;
7791 Ok(_response)
7792 }
7793
7794 pub fn r#start(
7805 &self,
7806 mut start_info: StartInfo,
7807 mut enable_input: bool,
7808 mut enable_verbose_logging: bool,
7809 ___deadline: zx::MonotonicInstant,
7810 ) -> Result<(u32, u32, u32, u32), fidl::Error> {
7811 let _response =
7812 self.client.send_query::<VirtioSoundStartRequest, VirtioSoundStartResponse>(
7813 (&mut start_info, enable_input, enable_verbose_logging),
7814 0x2c3a5528c0b92e2d,
7815 fidl::encoding::DynamicFlags::empty(),
7816 ___deadline,
7817 )?;
7818 Ok((_response.features, _response.jacks, _response.streams, _response.chmaps))
7819 }
7820}
7821
7822#[cfg(target_os = "fuchsia")]
7823impl From<VirtioSoundSynchronousProxy> for zx::Handle {
7824 fn from(value: VirtioSoundSynchronousProxy) -> Self {
7825 value.into_channel().into()
7826 }
7827}
7828
7829#[cfg(target_os = "fuchsia")]
7830impl From<fidl::Channel> for VirtioSoundSynchronousProxy {
7831 fn from(value: fidl::Channel) -> Self {
7832 Self::new(value)
7833 }
7834}
7835
7836#[cfg(target_os = "fuchsia")]
7837impl fidl::endpoints::FromClient for VirtioSoundSynchronousProxy {
7838 type Protocol = VirtioSoundMarker;
7839
7840 fn from_client(value: fidl::endpoints::ClientEnd<VirtioSoundMarker>) -> Self {
7841 Self::new(value.into_channel())
7842 }
7843}
7844
7845#[derive(Debug, Clone)]
7846pub struct VirtioSoundProxy {
7847 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7848}
7849
7850impl fidl::endpoints::Proxy for VirtioSoundProxy {
7851 type Protocol = VirtioSoundMarker;
7852
7853 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7854 Self::new(inner)
7855 }
7856
7857 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7858 self.client.into_channel().map_err(|client| Self { client })
7859 }
7860
7861 fn as_channel(&self) -> &::fidl::AsyncChannel {
7862 self.client.as_channel()
7863 }
7864}
7865
7866impl VirtioSoundProxy {
7867 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7869 let protocol_name = <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7870 Self { client: fidl::client::Client::new(channel, protocol_name) }
7871 }
7872
7873 pub fn take_event_stream(&self) -> VirtioSoundEventStream {
7879 VirtioSoundEventStream { event_receiver: self.client.take_event_receiver() }
7880 }
7881
7882 pub fn r#configure_queue(
7885 &self,
7886 mut queue: u16,
7887 mut size: u16,
7888 mut desc: u64,
7889 mut avail: u64,
7890 mut used: u64,
7891 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7892 VirtioSoundProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
7893 }
7894
7895 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7897 VirtioSoundProxyInterface::r#notify_queue(self, queue)
7898 }
7899
7900 pub fn r#ready(
7903 &self,
7904 mut negotiated_features: u32,
7905 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7906 VirtioSoundProxyInterface::r#ready(self, negotiated_features)
7907 }
7908
7909 pub fn r#start(
7920 &self,
7921 mut start_info: StartInfo,
7922 mut enable_input: bool,
7923 mut enable_verbose_logging: bool,
7924 ) -> fidl::client::QueryResponseFut<
7925 (u32, u32, u32, u32),
7926 fidl::encoding::DefaultFuchsiaResourceDialect,
7927 > {
7928 VirtioSoundProxyInterface::r#start(self, start_info, enable_input, enable_verbose_logging)
7929 }
7930}
7931
7932impl VirtioSoundProxyInterface for VirtioSoundProxy {
7933 type ConfigureQueueResponseFut =
7934 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7935 fn r#configure_queue(
7936 &self,
7937 mut queue: u16,
7938 mut size: u16,
7939 mut desc: u64,
7940 mut avail: u64,
7941 mut used: u64,
7942 ) -> Self::ConfigureQueueResponseFut {
7943 fn _decode(
7944 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7945 ) -> Result<(), fidl::Error> {
7946 let _response = fidl::client::decode_transaction_body::<
7947 fidl::encoding::EmptyPayload,
7948 fidl::encoding::DefaultFuchsiaResourceDialect,
7949 0x72b44fb963480b11,
7950 >(_buf?)?;
7951 Ok(_response)
7952 }
7953 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
7954 (queue, size, desc, avail, used),
7955 0x72b44fb963480b11,
7956 fidl::encoding::DynamicFlags::empty(),
7957 _decode,
7958 )
7959 }
7960
7961 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7962 self.client.send::<VirtioDeviceNotifyQueueRequest>(
7963 (queue,),
7964 0x6e3a61d652499244,
7965 fidl::encoding::DynamicFlags::empty(),
7966 )
7967 }
7968
7969 type ReadyResponseFut =
7970 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7971 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
7972 fn _decode(
7973 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7974 ) -> Result<(), fidl::Error> {
7975 let _response = fidl::client::decode_transaction_body::<
7976 fidl::encoding::EmptyPayload,
7977 fidl::encoding::DefaultFuchsiaResourceDialect,
7978 0x45707654f5d23c3f,
7979 >(_buf?)?;
7980 Ok(_response)
7981 }
7982 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
7983 (negotiated_features,),
7984 0x45707654f5d23c3f,
7985 fidl::encoding::DynamicFlags::empty(),
7986 _decode,
7987 )
7988 }
7989
7990 type StartResponseFut = fidl::client::QueryResponseFut<
7991 (u32, u32, u32, u32),
7992 fidl::encoding::DefaultFuchsiaResourceDialect,
7993 >;
7994 fn r#start(
7995 &self,
7996 mut start_info: StartInfo,
7997 mut enable_input: bool,
7998 mut enable_verbose_logging: bool,
7999 ) -> Self::StartResponseFut {
8000 fn _decode(
8001 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8002 ) -> Result<(u32, u32, u32, u32), fidl::Error> {
8003 let _response = fidl::client::decode_transaction_body::<
8004 VirtioSoundStartResponse,
8005 fidl::encoding::DefaultFuchsiaResourceDialect,
8006 0x2c3a5528c0b92e2d,
8007 >(_buf?)?;
8008 Ok((_response.features, _response.jacks, _response.streams, _response.chmaps))
8009 }
8010 self.client.send_query_and_decode::<VirtioSoundStartRequest, (u32, u32, u32, u32)>(
8011 (&mut start_info, enable_input, enable_verbose_logging),
8012 0x2c3a5528c0b92e2d,
8013 fidl::encoding::DynamicFlags::empty(),
8014 _decode,
8015 )
8016 }
8017}
8018
8019pub struct VirtioSoundEventStream {
8020 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8021}
8022
8023impl std::marker::Unpin for VirtioSoundEventStream {}
8024
8025impl futures::stream::FusedStream for VirtioSoundEventStream {
8026 fn is_terminated(&self) -> bool {
8027 self.event_receiver.is_terminated()
8028 }
8029}
8030
8031impl futures::Stream for VirtioSoundEventStream {
8032 type Item = Result<VirtioSoundEvent, fidl::Error>;
8033
8034 fn poll_next(
8035 mut self: std::pin::Pin<&mut Self>,
8036 cx: &mut std::task::Context<'_>,
8037 ) -> std::task::Poll<Option<Self::Item>> {
8038 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8039 &mut self.event_receiver,
8040 cx
8041 )?) {
8042 Some(buf) => std::task::Poll::Ready(Some(VirtioSoundEvent::decode(buf))),
8043 None => std::task::Poll::Ready(None),
8044 }
8045 }
8046}
8047
8048#[derive(Debug)]
8049pub enum VirtioSoundEvent {}
8050
8051impl VirtioSoundEvent {
8052 fn decode(
8054 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8055 ) -> Result<VirtioSoundEvent, fidl::Error> {
8056 let (bytes, _handles) = buf.split_mut();
8057 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8058 debug_assert_eq!(tx_header.tx_id, 0);
8059 match tx_header.ordinal {
8060 _ => Err(fidl::Error::UnknownOrdinal {
8061 ordinal: tx_header.ordinal,
8062 protocol_name: <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8063 }),
8064 }
8065 }
8066}
8067
8068pub struct VirtioSoundRequestStream {
8070 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8071 is_terminated: bool,
8072}
8073
8074impl std::marker::Unpin for VirtioSoundRequestStream {}
8075
8076impl futures::stream::FusedStream for VirtioSoundRequestStream {
8077 fn is_terminated(&self) -> bool {
8078 self.is_terminated
8079 }
8080}
8081
8082impl fidl::endpoints::RequestStream for VirtioSoundRequestStream {
8083 type Protocol = VirtioSoundMarker;
8084 type ControlHandle = VirtioSoundControlHandle;
8085
8086 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8087 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8088 }
8089
8090 fn control_handle(&self) -> Self::ControlHandle {
8091 VirtioSoundControlHandle { inner: self.inner.clone() }
8092 }
8093
8094 fn into_inner(
8095 self,
8096 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8097 {
8098 (self.inner, self.is_terminated)
8099 }
8100
8101 fn from_inner(
8102 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8103 is_terminated: bool,
8104 ) -> Self {
8105 Self { inner, is_terminated }
8106 }
8107}
8108
8109impl futures::Stream for VirtioSoundRequestStream {
8110 type Item = Result<VirtioSoundRequest, fidl::Error>;
8111
8112 fn poll_next(
8113 mut self: std::pin::Pin<&mut Self>,
8114 cx: &mut std::task::Context<'_>,
8115 ) -> std::task::Poll<Option<Self::Item>> {
8116 let this = &mut *self;
8117 if this.inner.check_shutdown(cx) {
8118 this.is_terminated = true;
8119 return std::task::Poll::Ready(None);
8120 }
8121 if this.is_terminated {
8122 panic!("polled VirtioSoundRequestStream after completion");
8123 }
8124 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8125 |bytes, handles| {
8126 match this.inner.channel().read_etc(cx, bytes, handles) {
8127 std::task::Poll::Ready(Ok(())) => {}
8128 std::task::Poll::Pending => return std::task::Poll::Pending,
8129 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8130 this.is_terminated = true;
8131 return std::task::Poll::Ready(None);
8132 }
8133 std::task::Poll::Ready(Err(e)) => {
8134 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8135 e.into(),
8136 ))));
8137 }
8138 }
8139
8140 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8142
8143 std::task::Poll::Ready(Some(match header.ordinal {
8144 0x72b44fb963480b11 => {
8145 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8146 let mut req = fidl::new_empty!(
8147 VirtioDeviceConfigureQueueRequest,
8148 fidl::encoding::DefaultFuchsiaResourceDialect
8149 );
8150 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
8151 let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
8152 Ok(VirtioSoundRequest::ConfigureQueue {
8153 queue: req.queue,
8154 size: req.size,
8155 desc: req.desc,
8156 avail: req.avail,
8157 used: req.used,
8158
8159 responder: VirtioSoundConfigureQueueResponder {
8160 control_handle: std::mem::ManuallyDrop::new(control_handle),
8161 tx_id: header.tx_id,
8162 },
8163 })
8164 }
8165 0x6e3a61d652499244 => {
8166 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8167 let mut req = fidl::new_empty!(
8168 VirtioDeviceNotifyQueueRequest,
8169 fidl::encoding::DefaultFuchsiaResourceDialect
8170 );
8171 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
8172 let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
8173 Ok(VirtioSoundRequest::NotifyQueue { queue: req.queue, control_handle })
8174 }
8175 0x45707654f5d23c3f => {
8176 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8177 let mut req = fidl::new_empty!(
8178 VirtioDeviceReadyRequest,
8179 fidl::encoding::DefaultFuchsiaResourceDialect
8180 );
8181 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
8182 let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
8183 Ok(VirtioSoundRequest::Ready {
8184 negotiated_features: req.negotiated_features,
8185
8186 responder: VirtioSoundReadyResponder {
8187 control_handle: std::mem::ManuallyDrop::new(control_handle),
8188 tx_id: header.tx_id,
8189 },
8190 })
8191 }
8192 0x2c3a5528c0b92e2d => {
8193 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8194 let mut req = fidl::new_empty!(
8195 VirtioSoundStartRequest,
8196 fidl::encoding::DefaultFuchsiaResourceDialect
8197 );
8198 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioSoundStartRequest>(&header, _body_bytes, handles, &mut req)?;
8199 let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
8200 Ok(VirtioSoundRequest::Start {
8201 start_info: req.start_info,
8202 enable_input: req.enable_input,
8203 enable_verbose_logging: req.enable_verbose_logging,
8204
8205 responder: VirtioSoundStartResponder {
8206 control_handle: std::mem::ManuallyDrop::new(control_handle),
8207 tx_id: header.tx_id,
8208 },
8209 })
8210 }
8211 _ => Err(fidl::Error::UnknownOrdinal {
8212 ordinal: header.ordinal,
8213 protocol_name:
8214 <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8215 }),
8216 }))
8217 },
8218 )
8219 }
8220}
8221
8222#[derive(Debug)]
8223pub enum VirtioSoundRequest {
8224 ConfigureQueue {
8227 queue: u16,
8228 size: u16,
8229 desc: u64,
8230 avail: u64,
8231 used: u64,
8232 responder: VirtioSoundConfigureQueueResponder,
8233 },
8234 NotifyQueue { queue: u16, control_handle: VirtioSoundControlHandle },
8236 Ready { negotiated_features: u32, responder: VirtioSoundReadyResponder },
8239 Start {
8250 start_info: StartInfo,
8251 enable_input: bool,
8252 enable_verbose_logging: bool,
8253 responder: VirtioSoundStartResponder,
8254 },
8255}
8256
8257impl VirtioSoundRequest {
8258 #[allow(irrefutable_let_patterns)]
8259 pub fn into_configure_queue(
8260 self,
8261 ) -> Option<(u16, u16, u64, u64, u64, VirtioSoundConfigureQueueResponder)> {
8262 if let VirtioSoundRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
8263 self
8264 {
8265 Some((queue, size, desc, avail, used, responder))
8266 } else {
8267 None
8268 }
8269 }
8270
8271 #[allow(irrefutable_let_patterns)]
8272 pub fn into_notify_queue(self) -> Option<(u16, VirtioSoundControlHandle)> {
8273 if let VirtioSoundRequest::NotifyQueue { queue, control_handle } = self {
8274 Some((queue, control_handle))
8275 } else {
8276 None
8277 }
8278 }
8279
8280 #[allow(irrefutable_let_patterns)]
8281 pub fn into_ready(self) -> Option<(u32, VirtioSoundReadyResponder)> {
8282 if let VirtioSoundRequest::Ready { negotiated_features, responder } = self {
8283 Some((negotiated_features, responder))
8284 } else {
8285 None
8286 }
8287 }
8288
8289 #[allow(irrefutable_let_patterns)]
8290 pub fn into_start(self) -> Option<(StartInfo, bool, bool, VirtioSoundStartResponder)> {
8291 if let VirtioSoundRequest::Start {
8292 start_info,
8293 enable_input,
8294 enable_verbose_logging,
8295 responder,
8296 } = self
8297 {
8298 Some((start_info, enable_input, enable_verbose_logging, responder))
8299 } else {
8300 None
8301 }
8302 }
8303
8304 pub fn method_name(&self) -> &'static str {
8306 match *self {
8307 VirtioSoundRequest::ConfigureQueue { .. } => "configure_queue",
8308 VirtioSoundRequest::NotifyQueue { .. } => "notify_queue",
8309 VirtioSoundRequest::Ready { .. } => "ready",
8310 VirtioSoundRequest::Start { .. } => "start",
8311 }
8312 }
8313}
8314
8315#[derive(Debug, Clone)]
8316pub struct VirtioSoundControlHandle {
8317 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8318}
8319
8320impl fidl::endpoints::ControlHandle for VirtioSoundControlHandle {
8321 fn shutdown(&self) {
8322 self.inner.shutdown()
8323 }
8324 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8325 self.inner.shutdown_with_epitaph(status)
8326 }
8327
8328 fn is_closed(&self) -> bool {
8329 self.inner.channel().is_closed()
8330 }
8331 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8332 self.inner.channel().on_closed()
8333 }
8334
8335 #[cfg(target_os = "fuchsia")]
8336 fn signal_peer(
8337 &self,
8338 clear_mask: zx::Signals,
8339 set_mask: zx::Signals,
8340 ) -> Result<(), zx_status::Status> {
8341 use fidl::Peered;
8342 self.inner.channel().signal_peer(clear_mask, set_mask)
8343 }
8344}
8345
8346impl VirtioSoundControlHandle {}
8347
8348#[must_use = "FIDL methods require a response to be sent"]
8349#[derive(Debug)]
8350pub struct VirtioSoundConfigureQueueResponder {
8351 control_handle: std::mem::ManuallyDrop<VirtioSoundControlHandle>,
8352 tx_id: u32,
8353}
8354
8355impl std::ops::Drop for VirtioSoundConfigureQueueResponder {
8359 fn drop(&mut self) {
8360 self.control_handle.shutdown();
8361 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8363 }
8364}
8365
8366impl fidl::endpoints::Responder for VirtioSoundConfigureQueueResponder {
8367 type ControlHandle = VirtioSoundControlHandle;
8368
8369 fn control_handle(&self) -> &VirtioSoundControlHandle {
8370 &self.control_handle
8371 }
8372
8373 fn drop_without_shutdown(mut self) {
8374 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8376 std::mem::forget(self);
8378 }
8379}
8380
8381impl VirtioSoundConfigureQueueResponder {
8382 pub fn send(self) -> Result<(), fidl::Error> {
8386 let _result = self.send_raw();
8387 if _result.is_err() {
8388 self.control_handle.shutdown();
8389 }
8390 self.drop_without_shutdown();
8391 _result
8392 }
8393
8394 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8396 let _result = self.send_raw();
8397 self.drop_without_shutdown();
8398 _result
8399 }
8400
8401 fn send_raw(&self) -> Result<(), fidl::Error> {
8402 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8403 (),
8404 self.tx_id,
8405 0x72b44fb963480b11,
8406 fidl::encoding::DynamicFlags::empty(),
8407 )
8408 }
8409}
8410
8411#[must_use = "FIDL methods require a response to be sent"]
8412#[derive(Debug)]
8413pub struct VirtioSoundReadyResponder {
8414 control_handle: std::mem::ManuallyDrop<VirtioSoundControlHandle>,
8415 tx_id: u32,
8416}
8417
8418impl std::ops::Drop for VirtioSoundReadyResponder {
8422 fn drop(&mut self) {
8423 self.control_handle.shutdown();
8424 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8426 }
8427}
8428
8429impl fidl::endpoints::Responder for VirtioSoundReadyResponder {
8430 type ControlHandle = VirtioSoundControlHandle;
8431
8432 fn control_handle(&self) -> &VirtioSoundControlHandle {
8433 &self.control_handle
8434 }
8435
8436 fn drop_without_shutdown(mut self) {
8437 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8439 std::mem::forget(self);
8441 }
8442}
8443
8444impl VirtioSoundReadyResponder {
8445 pub fn send(self) -> Result<(), fidl::Error> {
8449 let _result = self.send_raw();
8450 if _result.is_err() {
8451 self.control_handle.shutdown();
8452 }
8453 self.drop_without_shutdown();
8454 _result
8455 }
8456
8457 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8459 let _result = self.send_raw();
8460 self.drop_without_shutdown();
8461 _result
8462 }
8463
8464 fn send_raw(&self) -> Result<(), fidl::Error> {
8465 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8466 (),
8467 self.tx_id,
8468 0x45707654f5d23c3f,
8469 fidl::encoding::DynamicFlags::empty(),
8470 )
8471 }
8472}
8473
8474#[must_use = "FIDL methods require a response to be sent"]
8475#[derive(Debug)]
8476pub struct VirtioSoundStartResponder {
8477 control_handle: std::mem::ManuallyDrop<VirtioSoundControlHandle>,
8478 tx_id: u32,
8479}
8480
8481impl std::ops::Drop for VirtioSoundStartResponder {
8485 fn drop(&mut self) {
8486 self.control_handle.shutdown();
8487 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8489 }
8490}
8491
8492impl fidl::endpoints::Responder for VirtioSoundStartResponder {
8493 type ControlHandle = VirtioSoundControlHandle;
8494
8495 fn control_handle(&self) -> &VirtioSoundControlHandle {
8496 &self.control_handle
8497 }
8498
8499 fn drop_without_shutdown(mut self) {
8500 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8502 std::mem::forget(self);
8504 }
8505}
8506
8507impl VirtioSoundStartResponder {
8508 pub fn send(
8512 self,
8513 mut features: u32,
8514 mut jacks: u32,
8515 mut streams: u32,
8516 mut chmaps: u32,
8517 ) -> Result<(), fidl::Error> {
8518 let _result = self.send_raw(features, jacks, streams, chmaps);
8519 if _result.is_err() {
8520 self.control_handle.shutdown();
8521 }
8522 self.drop_without_shutdown();
8523 _result
8524 }
8525
8526 pub fn send_no_shutdown_on_err(
8528 self,
8529 mut features: u32,
8530 mut jacks: u32,
8531 mut streams: u32,
8532 mut chmaps: u32,
8533 ) -> Result<(), fidl::Error> {
8534 let _result = self.send_raw(features, jacks, streams, chmaps);
8535 self.drop_without_shutdown();
8536 _result
8537 }
8538
8539 fn send_raw(
8540 &self,
8541 mut features: u32,
8542 mut jacks: u32,
8543 mut streams: u32,
8544 mut chmaps: u32,
8545 ) -> Result<(), fidl::Error> {
8546 self.control_handle.inner.send::<VirtioSoundStartResponse>(
8547 (features, jacks, streams, chmaps),
8548 self.tx_id,
8549 0x2c3a5528c0b92e2d,
8550 fidl::encoding::DynamicFlags::empty(),
8551 )
8552 }
8553}
8554
8555#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8556pub struct VirtioVsockMarker;
8557
8558impl fidl::endpoints::ProtocolMarker for VirtioVsockMarker {
8559 type Proxy = VirtioVsockProxy;
8560 type RequestStream = VirtioVsockRequestStream;
8561 #[cfg(target_os = "fuchsia")]
8562 type SynchronousProxy = VirtioVsockSynchronousProxy;
8563
8564 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioVsock";
8565}
8566impl fidl::endpoints::DiscoverableProtocolMarker for VirtioVsockMarker {}
8567pub type VirtioVsockStartResult = Result<(), i32>;
8568
8569pub trait VirtioVsockProxyInterface: Send + Sync {
8570 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8571 fn r#configure_queue(
8572 &self,
8573 queue: u16,
8574 size: u16,
8575 desc: u64,
8576 avail: u64,
8577 used: u64,
8578 ) -> Self::ConfigureQueueResponseFut;
8579 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
8580 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8581 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
8582 type StartResponseFut: std::future::Future<Output = Result<VirtioVsockStartResult, fidl::Error>>
8583 + Send;
8584 fn r#start(
8585 &self,
8586 start_info: StartInfo,
8587 guest_cid: u32,
8588 listeners: Vec<fidl_fuchsia_virtualization::Listener>,
8589 ) -> Self::StartResponseFut;
8590}
8591#[derive(Debug)]
8592#[cfg(target_os = "fuchsia")]
8593pub struct VirtioVsockSynchronousProxy {
8594 client: fidl::client::sync::Client,
8595}
8596
8597#[cfg(target_os = "fuchsia")]
8598impl fidl::endpoints::SynchronousProxy for VirtioVsockSynchronousProxy {
8599 type Proxy = VirtioVsockProxy;
8600 type Protocol = VirtioVsockMarker;
8601
8602 fn from_channel(inner: fidl::Channel) -> Self {
8603 Self::new(inner)
8604 }
8605
8606 fn into_channel(self) -> fidl::Channel {
8607 self.client.into_channel()
8608 }
8609
8610 fn as_channel(&self) -> &fidl::Channel {
8611 self.client.as_channel()
8612 }
8613}
8614
8615#[cfg(target_os = "fuchsia")]
8616impl VirtioVsockSynchronousProxy {
8617 pub fn new(channel: fidl::Channel) -> Self {
8618 let protocol_name = <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8619 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8620 }
8621
8622 pub fn into_channel(self) -> fidl::Channel {
8623 self.client.into_channel()
8624 }
8625
8626 pub fn wait_for_event(
8629 &self,
8630 deadline: zx::MonotonicInstant,
8631 ) -> Result<VirtioVsockEvent, fidl::Error> {
8632 VirtioVsockEvent::decode(self.client.wait_for_event(deadline)?)
8633 }
8634
8635 pub fn r#configure_queue(
8638 &self,
8639 mut queue: u16,
8640 mut size: u16,
8641 mut desc: u64,
8642 mut avail: u64,
8643 mut used: u64,
8644 ___deadline: zx::MonotonicInstant,
8645 ) -> Result<(), fidl::Error> {
8646 let _response = self
8647 .client
8648 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
8649 (queue, size, desc, avail, used),
8650 0x72b44fb963480b11,
8651 fidl::encoding::DynamicFlags::empty(),
8652 ___deadline,
8653 )?;
8654 Ok(_response)
8655 }
8656
8657 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
8659 self.client.send::<VirtioDeviceNotifyQueueRequest>(
8660 (queue,),
8661 0x6e3a61d652499244,
8662 fidl::encoding::DynamicFlags::empty(),
8663 )
8664 }
8665
8666 pub fn r#ready(
8669 &self,
8670 mut negotiated_features: u32,
8671 ___deadline: zx::MonotonicInstant,
8672 ) -> Result<(), fidl::Error> {
8673 let _response =
8674 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
8675 (negotiated_features,),
8676 0x45707654f5d23c3f,
8677 fidl::encoding::DynamicFlags::empty(),
8678 ___deadline,
8679 )?;
8680 Ok(_response)
8681 }
8682
8683 pub fn r#start(
8690 &self,
8691 mut start_info: StartInfo,
8692 mut guest_cid: u32,
8693 mut listeners: Vec<fidl_fuchsia_virtualization::Listener>,
8694 ___deadline: zx::MonotonicInstant,
8695 ) -> Result<VirtioVsockStartResult, fidl::Error> {
8696 let _response = self.client.send_query::<
8697 VirtioVsockStartRequest,
8698 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
8699 >(
8700 (&mut start_info, guest_cid, listeners.as_mut(),),
8701 0x56433562cf67ae0f,
8702 fidl::encoding::DynamicFlags::empty(),
8703 ___deadline,
8704 )?;
8705 Ok(_response.map(|x| x))
8706 }
8707}
8708
8709#[cfg(target_os = "fuchsia")]
8710impl From<VirtioVsockSynchronousProxy> for zx::Handle {
8711 fn from(value: VirtioVsockSynchronousProxy) -> Self {
8712 value.into_channel().into()
8713 }
8714}
8715
8716#[cfg(target_os = "fuchsia")]
8717impl From<fidl::Channel> for VirtioVsockSynchronousProxy {
8718 fn from(value: fidl::Channel) -> Self {
8719 Self::new(value)
8720 }
8721}
8722
8723#[cfg(target_os = "fuchsia")]
8724impl fidl::endpoints::FromClient for VirtioVsockSynchronousProxy {
8725 type Protocol = VirtioVsockMarker;
8726
8727 fn from_client(value: fidl::endpoints::ClientEnd<VirtioVsockMarker>) -> Self {
8728 Self::new(value.into_channel())
8729 }
8730}
8731
8732#[derive(Debug, Clone)]
8733pub struct VirtioVsockProxy {
8734 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8735}
8736
8737impl fidl::endpoints::Proxy for VirtioVsockProxy {
8738 type Protocol = VirtioVsockMarker;
8739
8740 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8741 Self::new(inner)
8742 }
8743
8744 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8745 self.client.into_channel().map_err(|client| Self { client })
8746 }
8747
8748 fn as_channel(&self) -> &::fidl::AsyncChannel {
8749 self.client.as_channel()
8750 }
8751}
8752
8753impl VirtioVsockProxy {
8754 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8756 let protocol_name = <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8757 Self { client: fidl::client::Client::new(channel, protocol_name) }
8758 }
8759
8760 pub fn take_event_stream(&self) -> VirtioVsockEventStream {
8766 VirtioVsockEventStream { event_receiver: self.client.take_event_receiver() }
8767 }
8768
8769 pub fn r#configure_queue(
8772 &self,
8773 mut queue: u16,
8774 mut size: u16,
8775 mut desc: u64,
8776 mut avail: u64,
8777 mut used: u64,
8778 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8779 VirtioVsockProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
8780 }
8781
8782 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
8784 VirtioVsockProxyInterface::r#notify_queue(self, queue)
8785 }
8786
8787 pub fn r#ready(
8790 &self,
8791 mut negotiated_features: u32,
8792 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8793 VirtioVsockProxyInterface::r#ready(self, negotiated_features)
8794 }
8795
8796 pub fn r#start(
8803 &self,
8804 mut start_info: StartInfo,
8805 mut guest_cid: u32,
8806 mut listeners: Vec<fidl_fuchsia_virtualization::Listener>,
8807 ) -> fidl::client::QueryResponseFut<
8808 VirtioVsockStartResult,
8809 fidl::encoding::DefaultFuchsiaResourceDialect,
8810 > {
8811 VirtioVsockProxyInterface::r#start(self, start_info, guest_cid, listeners)
8812 }
8813}
8814
8815impl VirtioVsockProxyInterface for VirtioVsockProxy {
8816 type ConfigureQueueResponseFut =
8817 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8818 fn r#configure_queue(
8819 &self,
8820 mut queue: u16,
8821 mut size: u16,
8822 mut desc: u64,
8823 mut avail: u64,
8824 mut used: u64,
8825 ) -> Self::ConfigureQueueResponseFut {
8826 fn _decode(
8827 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8828 ) -> Result<(), fidl::Error> {
8829 let _response = fidl::client::decode_transaction_body::<
8830 fidl::encoding::EmptyPayload,
8831 fidl::encoding::DefaultFuchsiaResourceDialect,
8832 0x72b44fb963480b11,
8833 >(_buf?)?;
8834 Ok(_response)
8835 }
8836 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
8837 (queue, size, desc, avail, used),
8838 0x72b44fb963480b11,
8839 fidl::encoding::DynamicFlags::empty(),
8840 _decode,
8841 )
8842 }
8843
8844 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
8845 self.client.send::<VirtioDeviceNotifyQueueRequest>(
8846 (queue,),
8847 0x6e3a61d652499244,
8848 fidl::encoding::DynamicFlags::empty(),
8849 )
8850 }
8851
8852 type ReadyResponseFut =
8853 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8854 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
8855 fn _decode(
8856 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8857 ) -> Result<(), fidl::Error> {
8858 let _response = fidl::client::decode_transaction_body::<
8859 fidl::encoding::EmptyPayload,
8860 fidl::encoding::DefaultFuchsiaResourceDialect,
8861 0x45707654f5d23c3f,
8862 >(_buf?)?;
8863 Ok(_response)
8864 }
8865 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
8866 (negotiated_features,),
8867 0x45707654f5d23c3f,
8868 fidl::encoding::DynamicFlags::empty(),
8869 _decode,
8870 )
8871 }
8872
8873 type StartResponseFut = fidl::client::QueryResponseFut<
8874 VirtioVsockStartResult,
8875 fidl::encoding::DefaultFuchsiaResourceDialect,
8876 >;
8877 fn r#start(
8878 &self,
8879 mut start_info: StartInfo,
8880 mut guest_cid: u32,
8881 mut listeners: Vec<fidl_fuchsia_virtualization::Listener>,
8882 ) -> Self::StartResponseFut {
8883 fn _decode(
8884 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8885 ) -> Result<VirtioVsockStartResult, fidl::Error> {
8886 let _response = fidl::client::decode_transaction_body::<
8887 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
8888 fidl::encoding::DefaultFuchsiaResourceDialect,
8889 0x56433562cf67ae0f,
8890 >(_buf?)?;
8891 Ok(_response.map(|x| x))
8892 }
8893 self.client.send_query_and_decode::<VirtioVsockStartRequest, VirtioVsockStartResult>(
8894 (&mut start_info, guest_cid, listeners.as_mut()),
8895 0x56433562cf67ae0f,
8896 fidl::encoding::DynamicFlags::empty(),
8897 _decode,
8898 )
8899 }
8900}
8901
8902pub struct VirtioVsockEventStream {
8903 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8904}
8905
8906impl std::marker::Unpin for VirtioVsockEventStream {}
8907
8908impl futures::stream::FusedStream for VirtioVsockEventStream {
8909 fn is_terminated(&self) -> bool {
8910 self.event_receiver.is_terminated()
8911 }
8912}
8913
8914impl futures::Stream for VirtioVsockEventStream {
8915 type Item = Result<VirtioVsockEvent, fidl::Error>;
8916
8917 fn poll_next(
8918 mut self: std::pin::Pin<&mut Self>,
8919 cx: &mut std::task::Context<'_>,
8920 ) -> std::task::Poll<Option<Self::Item>> {
8921 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8922 &mut self.event_receiver,
8923 cx
8924 )?) {
8925 Some(buf) => std::task::Poll::Ready(Some(VirtioVsockEvent::decode(buf))),
8926 None => std::task::Poll::Ready(None),
8927 }
8928 }
8929}
8930
8931#[derive(Debug)]
8932pub enum VirtioVsockEvent {}
8933
8934impl VirtioVsockEvent {
8935 fn decode(
8937 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8938 ) -> Result<VirtioVsockEvent, fidl::Error> {
8939 let (bytes, _handles) = buf.split_mut();
8940 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8941 debug_assert_eq!(tx_header.tx_id, 0);
8942 match tx_header.ordinal {
8943 _ => Err(fidl::Error::UnknownOrdinal {
8944 ordinal: tx_header.ordinal,
8945 protocol_name: <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8946 }),
8947 }
8948 }
8949}
8950
8951pub struct VirtioVsockRequestStream {
8953 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8954 is_terminated: bool,
8955}
8956
8957impl std::marker::Unpin for VirtioVsockRequestStream {}
8958
8959impl futures::stream::FusedStream for VirtioVsockRequestStream {
8960 fn is_terminated(&self) -> bool {
8961 self.is_terminated
8962 }
8963}
8964
8965impl fidl::endpoints::RequestStream for VirtioVsockRequestStream {
8966 type Protocol = VirtioVsockMarker;
8967 type ControlHandle = VirtioVsockControlHandle;
8968
8969 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8970 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8971 }
8972
8973 fn control_handle(&self) -> Self::ControlHandle {
8974 VirtioVsockControlHandle { inner: self.inner.clone() }
8975 }
8976
8977 fn into_inner(
8978 self,
8979 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8980 {
8981 (self.inner, self.is_terminated)
8982 }
8983
8984 fn from_inner(
8985 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8986 is_terminated: bool,
8987 ) -> Self {
8988 Self { inner, is_terminated }
8989 }
8990}
8991
8992impl futures::Stream for VirtioVsockRequestStream {
8993 type Item = Result<VirtioVsockRequest, fidl::Error>;
8994
8995 fn poll_next(
8996 mut self: std::pin::Pin<&mut Self>,
8997 cx: &mut std::task::Context<'_>,
8998 ) -> std::task::Poll<Option<Self::Item>> {
8999 let this = &mut *self;
9000 if this.inner.check_shutdown(cx) {
9001 this.is_terminated = true;
9002 return std::task::Poll::Ready(None);
9003 }
9004 if this.is_terminated {
9005 panic!("polled VirtioVsockRequestStream after completion");
9006 }
9007 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9008 |bytes, handles| {
9009 match this.inner.channel().read_etc(cx, bytes, handles) {
9010 std::task::Poll::Ready(Ok(())) => {}
9011 std::task::Poll::Pending => return std::task::Poll::Pending,
9012 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9013 this.is_terminated = true;
9014 return std::task::Poll::Ready(None);
9015 }
9016 std::task::Poll::Ready(Err(e)) => {
9017 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9018 e.into(),
9019 ))));
9020 }
9021 }
9022
9023 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9025
9026 std::task::Poll::Ready(Some(match header.ordinal {
9027 0x72b44fb963480b11 => {
9028 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9029 let mut req = fidl::new_empty!(
9030 VirtioDeviceConfigureQueueRequest,
9031 fidl::encoding::DefaultFuchsiaResourceDialect
9032 );
9033 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
9034 let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
9035 Ok(VirtioVsockRequest::ConfigureQueue {
9036 queue: req.queue,
9037 size: req.size,
9038 desc: req.desc,
9039 avail: req.avail,
9040 used: req.used,
9041
9042 responder: VirtioVsockConfigureQueueResponder {
9043 control_handle: std::mem::ManuallyDrop::new(control_handle),
9044 tx_id: header.tx_id,
9045 },
9046 })
9047 }
9048 0x6e3a61d652499244 => {
9049 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9050 let mut req = fidl::new_empty!(
9051 VirtioDeviceNotifyQueueRequest,
9052 fidl::encoding::DefaultFuchsiaResourceDialect
9053 );
9054 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
9055 let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
9056 Ok(VirtioVsockRequest::NotifyQueue { queue: req.queue, control_handle })
9057 }
9058 0x45707654f5d23c3f => {
9059 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9060 let mut req = fidl::new_empty!(
9061 VirtioDeviceReadyRequest,
9062 fidl::encoding::DefaultFuchsiaResourceDialect
9063 );
9064 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
9065 let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
9066 Ok(VirtioVsockRequest::Ready {
9067 negotiated_features: req.negotiated_features,
9068
9069 responder: VirtioVsockReadyResponder {
9070 control_handle: std::mem::ManuallyDrop::new(control_handle),
9071 tx_id: header.tx_id,
9072 },
9073 })
9074 }
9075 0x56433562cf67ae0f => {
9076 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9077 let mut req = fidl::new_empty!(
9078 VirtioVsockStartRequest,
9079 fidl::encoding::DefaultFuchsiaResourceDialect
9080 );
9081 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioVsockStartRequest>(&header, _body_bytes, handles, &mut req)?;
9082 let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
9083 Ok(VirtioVsockRequest::Start {
9084 start_info: req.start_info,
9085 guest_cid: req.guest_cid,
9086 listeners: req.listeners,
9087
9088 responder: VirtioVsockStartResponder {
9089 control_handle: std::mem::ManuallyDrop::new(control_handle),
9090 tx_id: header.tx_id,
9091 },
9092 })
9093 }
9094 _ => Err(fidl::Error::UnknownOrdinal {
9095 ordinal: header.ordinal,
9096 protocol_name:
9097 <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9098 }),
9099 }))
9100 },
9101 )
9102 }
9103}
9104
9105#[derive(Debug)]
9106pub enum VirtioVsockRequest {
9107 ConfigureQueue {
9110 queue: u16,
9111 size: u16,
9112 desc: u64,
9113 avail: u64,
9114 used: u64,
9115 responder: VirtioVsockConfigureQueueResponder,
9116 },
9117 NotifyQueue { queue: u16, control_handle: VirtioVsockControlHandle },
9119 Ready { negotiated_features: u32, responder: VirtioVsockReadyResponder },
9122 Start {
9129 start_info: StartInfo,
9130 guest_cid: u32,
9131 listeners: Vec<fidl_fuchsia_virtualization::Listener>,
9132 responder: VirtioVsockStartResponder,
9133 },
9134}
9135
9136impl VirtioVsockRequest {
9137 #[allow(irrefutable_let_patterns)]
9138 pub fn into_configure_queue(
9139 self,
9140 ) -> Option<(u16, u16, u64, u64, u64, VirtioVsockConfigureQueueResponder)> {
9141 if let VirtioVsockRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
9142 self
9143 {
9144 Some((queue, size, desc, avail, used, responder))
9145 } else {
9146 None
9147 }
9148 }
9149
9150 #[allow(irrefutable_let_patterns)]
9151 pub fn into_notify_queue(self) -> Option<(u16, VirtioVsockControlHandle)> {
9152 if let VirtioVsockRequest::NotifyQueue { queue, control_handle } = self {
9153 Some((queue, control_handle))
9154 } else {
9155 None
9156 }
9157 }
9158
9159 #[allow(irrefutable_let_patterns)]
9160 pub fn into_ready(self) -> Option<(u32, VirtioVsockReadyResponder)> {
9161 if let VirtioVsockRequest::Ready { negotiated_features, responder } = self {
9162 Some((negotiated_features, responder))
9163 } else {
9164 None
9165 }
9166 }
9167
9168 #[allow(irrefutable_let_patterns)]
9169 pub fn into_start(
9170 self,
9171 ) -> Option<(
9172 StartInfo,
9173 u32,
9174 Vec<fidl_fuchsia_virtualization::Listener>,
9175 VirtioVsockStartResponder,
9176 )> {
9177 if let VirtioVsockRequest::Start { start_info, guest_cid, listeners, responder } = self {
9178 Some((start_info, guest_cid, listeners, responder))
9179 } else {
9180 None
9181 }
9182 }
9183
9184 pub fn method_name(&self) -> &'static str {
9186 match *self {
9187 VirtioVsockRequest::ConfigureQueue { .. } => "configure_queue",
9188 VirtioVsockRequest::NotifyQueue { .. } => "notify_queue",
9189 VirtioVsockRequest::Ready { .. } => "ready",
9190 VirtioVsockRequest::Start { .. } => "start",
9191 }
9192 }
9193}
9194
9195#[derive(Debug, Clone)]
9196pub struct VirtioVsockControlHandle {
9197 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9198}
9199
9200impl fidl::endpoints::ControlHandle for VirtioVsockControlHandle {
9201 fn shutdown(&self) {
9202 self.inner.shutdown()
9203 }
9204 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9205 self.inner.shutdown_with_epitaph(status)
9206 }
9207
9208 fn is_closed(&self) -> bool {
9209 self.inner.channel().is_closed()
9210 }
9211 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9212 self.inner.channel().on_closed()
9213 }
9214
9215 #[cfg(target_os = "fuchsia")]
9216 fn signal_peer(
9217 &self,
9218 clear_mask: zx::Signals,
9219 set_mask: zx::Signals,
9220 ) -> Result<(), zx_status::Status> {
9221 use fidl::Peered;
9222 self.inner.channel().signal_peer(clear_mask, set_mask)
9223 }
9224}
9225
9226impl VirtioVsockControlHandle {}
9227
9228#[must_use = "FIDL methods require a response to be sent"]
9229#[derive(Debug)]
9230pub struct VirtioVsockConfigureQueueResponder {
9231 control_handle: std::mem::ManuallyDrop<VirtioVsockControlHandle>,
9232 tx_id: u32,
9233}
9234
9235impl std::ops::Drop for VirtioVsockConfigureQueueResponder {
9239 fn drop(&mut self) {
9240 self.control_handle.shutdown();
9241 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9243 }
9244}
9245
9246impl fidl::endpoints::Responder for VirtioVsockConfigureQueueResponder {
9247 type ControlHandle = VirtioVsockControlHandle;
9248
9249 fn control_handle(&self) -> &VirtioVsockControlHandle {
9250 &self.control_handle
9251 }
9252
9253 fn drop_without_shutdown(mut self) {
9254 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9256 std::mem::forget(self);
9258 }
9259}
9260
9261impl VirtioVsockConfigureQueueResponder {
9262 pub fn send(self) -> Result<(), fidl::Error> {
9266 let _result = self.send_raw();
9267 if _result.is_err() {
9268 self.control_handle.shutdown();
9269 }
9270 self.drop_without_shutdown();
9271 _result
9272 }
9273
9274 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9276 let _result = self.send_raw();
9277 self.drop_without_shutdown();
9278 _result
9279 }
9280
9281 fn send_raw(&self) -> Result<(), fidl::Error> {
9282 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9283 (),
9284 self.tx_id,
9285 0x72b44fb963480b11,
9286 fidl::encoding::DynamicFlags::empty(),
9287 )
9288 }
9289}
9290
9291#[must_use = "FIDL methods require a response to be sent"]
9292#[derive(Debug)]
9293pub struct VirtioVsockReadyResponder {
9294 control_handle: std::mem::ManuallyDrop<VirtioVsockControlHandle>,
9295 tx_id: u32,
9296}
9297
9298impl std::ops::Drop for VirtioVsockReadyResponder {
9302 fn drop(&mut self) {
9303 self.control_handle.shutdown();
9304 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9306 }
9307}
9308
9309impl fidl::endpoints::Responder for VirtioVsockReadyResponder {
9310 type ControlHandle = VirtioVsockControlHandle;
9311
9312 fn control_handle(&self) -> &VirtioVsockControlHandle {
9313 &self.control_handle
9314 }
9315
9316 fn drop_without_shutdown(mut self) {
9317 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9319 std::mem::forget(self);
9321 }
9322}
9323
9324impl VirtioVsockReadyResponder {
9325 pub fn send(self) -> Result<(), fidl::Error> {
9329 let _result = self.send_raw();
9330 if _result.is_err() {
9331 self.control_handle.shutdown();
9332 }
9333 self.drop_without_shutdown();
9334 _result
9335 }
9336
9337 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9339 let _result = self.send_raw();
9340 self.drop_without_shutdown();
9341 _result
9342 }
9343
9344 fn send_raw(&self) -> Result<(), fidl::Error> {
9345 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9346 (),
9347 self.tx_id,
9348 0x45707654f5d23c3f,
9349 fidl::encoding::DynamicFlags::empty(),
9350 )
9351 }
9352}
9353
9354#[must_use = "FIDL methods require a response to be sent"]
9355#[derive(Debug)]
9356pub struct VirtioVsockStartResponder {
9357 control_handle: std::mem::ManuallyDrop<VirtioVsockControlHandle>,
9358 tx_id: u32,
9359}
9360
9361impl std::ops::Drop for VirtioVsockStartResponder {
9365 fn drop(&mut self) {
9366 self.control_handle.shutdown();
9367 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9369 }
9370}
9371
9372impl fidl::endpoints::Responder for VirtioVsockStartResponder {
9373 type ControlHandle = VirtioVsockControlHandle;
9374
9375 fn control_handle(&self) -> &VirtioVsockControlHandle {
9376 &self.control_handle
9377 }
9378
9379 fn drop_without_shutdown(mut self) {
9380 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9382 std::mem::forget(self);
9384 }
9385}
9386
9387impl VirtioVsockStartResponder {
9388 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9392 let _result = self.send_raw(result);
9393 if _result.is_err() {
9394 self.control_handle.shutdown();
9395 }
9396 self.drop_without_shutdown();
9397 _result
9398 }
9399
9400 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9402 let _result = self.send_raw(result);
9403 self.drop_without_shutdown();
9404 _result
9405 }
9406
9407 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9408 self.control_handle
9409 .inner
9410 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
9411 result,
9412 self.tx_id,
9413 0x56433562cf67ae0f,
9414 fidl::encoding::DynamicFlags::empty(),
9415 )
9416 }
9417}
9418
9419mod internal {
9420 use super::*;
9421
9422 impl fidl::encoding::ResourceTypeMarker for StartInfo {
9423 type Borrowed<'a> = &'a mut Self;
9424 fn take_or_borrow<'a>(
9425 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9426 ) -> Self::Borrowed<'a> {
9427 value
9428 }
9429 }
9430
9431 unsafe impl fidl::encoding::TypeMarker for StartInfo {
9432 type Owned = Self;
9433
9434 #[inline(always)]
9435 fn inline_align(_context: fidl::encoding::Context) -> usize {
9436 8
9437 }
9438
9439 #[inline(always)]
9440 fn inline_size(_context: fidl::encoding::Context) -> usize {
9441 32
9442 }
9443 }
9444
9445 unsafe impl fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
9446 for &mut StartInfo
9447 {
9448 #[inline]
9449 unsafe fn encode(
9450 self,
9451 encoder: &mut fidl::encoding::Encoder<
9452 '_,
9453 fidl::encoding::DefaultFuchsiaResourceDialect,
9454 >,
9455 offset: usize,
9456 _depth: fidl::encoding::Depth,
9457 ) -> fidl::Result<()> {
9458 encoder.debug_check_bounds::<StartInfo>(offset);
9459 fidl::encoding::Encode::<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9461 (
9462 <Trap as fidl::encoding::ValueTypeMarker>::borrow(&self.trap),
9463 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Guest, { fidl::ObjectType::GUEST.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
9464 <fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.event),
9465 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmo),
9466 ),
9467 encoder, offset, _depth
9468 )
9469 }
9470 }
9471 unsafe impl<
9472 T0: fidl::encoding::Encode<Trap, fidl::encoding::DefaultFuchsiaResourceDialect>,
9473 T1: fidl::encoding::Encode<
9474 fidl::encoding::Optional<
9475 fidl::encoding::HandleType<
9476 fidl::Guest,
9477 { fidl::ObjectType::GUEST.into_raw() },
9478 2147483648,
9479 >,
9480 >,
9481 fidl::encoding::DefaultFuchsiaResourceDialect,
9482 >,
9483 T2: fidl::encoding::Encode<
9484 fidl::encoding::HandleType<
9485 fidl::Event,
9486 { fidl::ObjectType::EVENT.into_raw() },
9487 2147483648,
9488 >,
9489 fidl::encoding::DefaultFuchsiaResourceDialect,
9490 >,
9491 T3: fidl::encoding::Encode<
9492 fidl::encoding::HandleType<
9493 fidl::Vmo,
9494 { fidl::ObjectType::VMO.into_raw() },
9495 2147483648,
9496 >,
9497 fidl::encoding::DefaultFuchsiaResourceDialect,
9498 >,
9499 > fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
9500 for (T0, T1, T2, T3)
9501 {
9502 #[inline]
9503 unsafe fn encode(
9504 self,
9505 encoder: &mut fidl::encoding::Encoder<
9506 '_,
9507 fidl::encoding::DefaultFuchsiaResourceDialect,
9508 >,
9509 offset: usize,
9510 depth: fidl::encoding::Depth,
9511 ) -> fidl::Result<()> {
9512 encoder.debug_check_bounds::<StartInfo>(offset);
9513 unsafe {
9516 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
9517 (ptr as *mut u64).write_unaligned(0);
9518 }
9519 self.0.encode(encoder, offset + 0, depth)?;
9521 self.1.encode(encoder, offset + 16, depth)?;
9522 self.2.encode(encoder, offset + 20, depth)?;
9523 self.3.encode(encoder, offset + 24, depth)?;
9524 Ok(())
9525 }
9526 }
9527
9528 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for StartInfo {
9529 #[inline(always)]
9530 fn new_empty() -> Self {
9531 Self {
9532 trap: fidl::new_empty!(Trap, fidl::encoding::DefaultFuchsiaResourceDialect),
9533 guest: fidl::new_empty!(
9534 fidl::encoding::Optional<
9535 fidl::encoding::HandleType<
9536 fidl::Guest,
9537 { fidl::ObjectType::GUEST.into_raw() },
9538 2147483648,
9539 >,
9540 >,
9541 fidl::encoding::DefaultFuchsiaResourceDialect
9542 ),
9543 event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9544 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9545 }
9546 }
9547
9548 #[inline]
9549 unsafe fn decode(
9550 &mut self,
9551 decoder: &mut fidl::encoding::Decoder<
9552 '_,
9553 fidl::encoding::DefaultFuchsiaResourceDialect,
9554 >,
9555 offset: usize,
9556 _depth: fidl::encoding::Depth,
9557 ) -> fidl::Result<()> {
9558 decoder.debug_check_bounds::<Self>(offset);
9559 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
9561 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9562 let mask = 0xffffffff00000000u64;
9563 let maskedval = padval & mask;
9564 if maskedval != 0 {
9565 return Err(fidl::Error::NonZeroPadding {
9566 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
9567 });
9568 }
9569 fidl::decode!(
9570 Trap,
9571 fidl::encoding::DefaultFuchsiaResourceDialect,
9572 &mut self.trap,
9573 decoder,
9574 offset + 0,
9575 _depth
9576 )?;
9577 fidl::decode!(
9578 fidl::encoding::Optional<
9579 fidl::encoding::HandleType<
9580 fidl::Guest,
9581 { fidl::ObjectType::GUEST.into_raw() },
9582 2147483648,
9583 >,
9584 >,
9585 fidl::encoding::DefaultFuchsiaResourceDialect,
9586 &mut self.guest,
9587 decoder,
9588 offset + 16,
9589 _depth
9590 )?;
9591 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 20, _depth)?;
9592 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 24, _depth)?;
9593 Ok(())
9594 }
9595 }
9596
9597 impl fidl::encoding::ResourceTypeMarker for VirtioBalloonStartRequest {
9598 type Borrowed<'a> = &'a mut Self;
9599 fn take_or_borrow<'a>(
9600 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9601 ) -> Self::Borrowed<'a> {
9602 value
9603 }
9604 }
9605
9606 unsafe impl fidl::encoding::TypeMarker for VirtioBalloonStartRequest {
9607 type Owned = Self;
9608
9609 #[inline(always)]
9610 fn inline_align(_context: fidl::encoding::Context) -> usize {
9611 8
9612 }
9613
9614 #[inline(always)]
9615 fn inline_size(_context: fidl::encoding::Context) -> usize {
9616 32
9617 }
9618 }
9619
9620 unsafe impl
9621 fidl::encoding::Encode<
9622 VirtioBalloonStartRequest,
9623 fidl::encoding::DefaultFuchsiaResourceDialect,
9624 > for &mut VirtioBalloonStartRequest
9625 {
9626 #[inline]
9627 unsafe fn encode(
9628 self,
9629 encoder: &mut fidl::encoding::Encoder<
9630 '_,
9631 fidl::encoding::DefaultFuchsiaResourceDialect,
9632 >,
9633 offset: usize,
9634 _depth: fidl::encoding::Depth,
9635 ) -> fidl::Result<()> {
9636 encoder.debug_check_bounds::<VirtioBalloonStartRequest>(offset);
9637 fidl::encoding::Encode::<
9639 VirtioBalloonStartRequest,
9640 fidl::encoding::DefaultFuchsiaResourceDialect,
9641 >::encode(
9642 (<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9643 &mut self.start_info,
9644 ),),
9645 encoder,
9646 offset,
9647 _depth,
9648 )
9649 }
9650 }
9651 unsafe impl<
9652 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
9653 >
9654 fidl::encoding::Encode<
9655 VirtioBalloonStartRequest,
9656 fidl::encoding::DefaultFuchsiaResourceDialect,
9657 > for (T0,)
9658 {
9659 #[inline]
9660 unsafe fn encode(
9661 self,
9662 encoder: &mut fidl::encoding::Encoder<
9663 '_,
9664 fidl::encoding::DefaultFuchsiaResourceDialect,
9665 >,
9666 offset: usize,
9667 depth: fidl::encoding::Depth,
9668 ) -> fidl::Result<()> {
9669 encoder.debug_check_bounds::<VirtioBalloonStartRequest>(offset);
9670 self.0.encode(encoder, offset + 0, depth)?;
9674 Ok(())
9675 }
9676 }
9677
9678 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9679 for VirtioBalloonStartRequest
9680 {
9681 #[inline(always)]
9682 fn new_empty() -> Self {
9683 Self {
9684 start_info: fidl::new_empty!(
9685 StartInfo,
9686 fidl::encoding::DefaultFuchsiaResourceDialect
9687 ),
9688 }
9689 }
9690
9691 #[inline]
9692 unsafe fn decode(
9693 &mut self,
9694 decoder: &mut fidl::encoding::Decoder<
9695 '_,
9696 fidl::encoding::DefaultFuchsiaResourceDialect,
9697 >,
9698 offset: usize,
9699 _depth: fidl::encoding::Depth,
9700 ) -> fidl::Result<()> {
9701 decoder.debug_check_bounds::<Self>(offset);
9702 fidl::decode!(
9704 StartInfo,
9705 fidl::encoding::DefaultFuchsiaResourceDialect,
9706 &mut self.start_info,
9707 decoder,
9708 offset + 0,
9709 _depth
9710 )?;
9711 Ok(())
9712 }
9713 }
9714
9715 impl fidl::encoding::ResourceTypeMarker for VirtioBlockStartRequest {
9716 type Borrowed<'a> = &'a mut Self;
9717 fn take_or_borrow<'a>(
9718 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9719 ) -> Self::Borrowed<'a> {
9720 value
9721 }
9722 }
9723
9724 unsafe impl fidl::encoding::TypeMarker for VirtioBlockStartRequest {
9725 type Owned = Self;
9726
9727 #[inline(always)]
9728 fn inline_align(_context: fidl::encoding::Context) -> usize {
9729 8
9730 }
9731
9732 #[inline(always)]
9733 fn inline_size(_context: fidl::encoding::Context) -> usize {
9734 72
9735 }
9736 }
9737
9738 unsafe impl
9739 fidl::encoding::Encode<
9740 VirtioBlockStartRequest,
9741 fidl::encoding::DefaultFuchsiaResourceDialect,
9742 > for &mut VirtioBlockStartRequest
9743 {
9744 #[inline]
9745 unsafe fn encode(
9746 self,
9747 encoder: &mut fidl::encoding::Encoder<
9748 '_,
9749 fidl::encoding::DefaultFuchsiaResourceDialect,
9750 >,
9751 offset: usize,
9752 _depth: fidl::encoding::Depth,
9753 ) -> fidl::Result<()> {
9754 encoder.debug_check_bounds::<VirtioBlockStartRequest>(offset);
9755 fidl::encoding::Encode::<VirtioBlockStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9757 (
9758 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.start_info),
9759 <fidl_fuchsia_virtualization::BlockSpec as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.spec),
9760 ),
9761 encoder, offset, _depth
9762 )
9763 }
9764 }
9765 unsafe impl<
9766 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
9767 T1: fidl::encoding::Encode<
9768 fidl_fuchsia_virtualization::BlockSpec,
9769 fidl::encoding::DefaultFuchsiaResourceDialect,
9770 >,
9771 >
9772 fidl::encoding::Encode<
9773 VirtioBlockStartRequest,
9774 fidl::encoding::DefaultFuchsiaResourceDialect,
9775 > for (T0, T1)
9776 {
9777 #[inline]
9778 unsafe fn encode(
9779 self,
9780 encoder: &mut fidl::encoding::Encoder<
9781 '_,
9782 fidl::encoding::DefaultFuchsiaResourceDialect,
9783 >,
9784 offset: usize,
9785 depth: fidl::encoding::Depth,
9786 ) -> fidl::Result<()> {
9787 encoder.debug_check_bounds::<VirtioBlockStartRequest>(offset);
9788 self.0.encode(encoder, offset + 0, depth)?;
9792 self.1.encode(encoder, offset + 32, depth)?;
9793 Ok(())
9794 }
9795 }
9796
9797 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9798 for VirtioBlockStartRequest
9799 {
9800 #[inline(always)]
9801 fn new_empty() -> Self {
9802 Self {
9803 start_info: fidl::new_empty!(
9804 StartInfo,
9805 fidl::encoding::DefaultFuchsiaResourceDialect
9806 ),
9807 spec: fidl::new_empty!(
9808 fidl_fuchsia_virtualization::BlockSpec,
9809 fidl::encoding::DefaultFuchsiaResourceDialect
9810 ),
9811 }
9812 }
9813
9814 #[inline]
9815 unsafe fn decode(
9816 &mut self,
9817 decoder: &mut fidl::encoding::Decoder<
9818 '_,
9819 fidl::encoding::DefaultFuchsiaResourceDialect,
9820 >,
9821 offset: usize,
9822 _depth: fidl::encoding::Depth,
9823 ) -> fidl::Result<()> {
9824 decoder.debug_check_bounds::<Self>(offset);
9825 fidl::decode!(
9827 StartInfo,
9828 fidl::encoding::DefaultFuchsiaResourceDialect,
9829 &mut self.start_info,
9830 decoder,
9831 offset + 0,
9832 _depth
9833 )?;
9834 fidl::decode!(
9835 fidl_fuchsia_virtualization::BlockSpec,
9836 fidl::encoding::DefaultFuchsiaResourceDialect,
9837 &mut self.spec,
9838 decoder,
9839 offset + 32,
9840 _depth
9841 )?;
9842 Ok(())
9843 }
9844 }
9845
9846 impl fidl::encoding::ResourceTypeMarker for VirtioConsoleStartRequest {
9847 type Borrowed<'a> = &'a mut Self;
9848 fn take_or_borrow<'a>(
9849 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9850 ) -> Self::Borrowed<'a> {
9851 value
9852 }
9853 }
9854
9855 unsafe impl fidl::encoding::TypeMarker for VirtioConsoleStartRequest {
9856 type Owned = Self;
9857
9858 #[inline(always)]
9859 fn inline_align(_context: fidl::encoding::Context) -> usize {
9860 8
9861 }
9862
9863 #[inline(always)]
9864 fn inline_size(_context: fidl::encoding::Context) -> usize {
9865 40
9866 }
9867 }
9868
9869 unsafe impl
9870 fidl::encoding::Encode<
9871 VirtioConsoleStartRequest,
9872 fidl::encoding::DefaultFuchsiaResourceDialect,
9873 > for &mut VirtioConsoleStartRequest
9874 {
9875 #[inline]
9876 unsafe fn encode(
9877 self,
9878 encoder: &mut fidl::encoding::Encoder<
9879 '_,
9880 fidl::encoding::DefaultFuchsiaResourceDialect,
9881 >,
9882 offset: usize,
9883 _depth: fidl::encoding::Depth,
9884 ) -> fidl::Result<()> {
9885 encoder.debug_check_bounds::<VirtioConsoleStartRequest>(offset);
9886 fidl::encoding::Encode::<
9888 VirtioConsoleStartRequest,
9889 fidl::encoding::DefaultFuchsiaResourceDialect,
9890 >::encode(
9891 (
9892 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9893 &mut self.start_info,
9894 ),
9895 <fidl::encoding::HandleType<
9896 fidl::Socket,
9897 { fidl::ObjectType::SOCKET.into_raw() },
9898 2147483648,
9899 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9900 &mut self.socket
9901 ),
9902 ),
9903 encoder,
9904 offset,
9905 _depth,
9906 )
9907 }
9908 }
9909 unsafe impl<
9910 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
9911 T1: fidl::encoding::Encode<
9912 fidl::encoding::HandleType<
9913 fidl::Socket,
9914 { fidl::ObjectType::SOCKET.into_raw() },
9915 2147483648,
9916 >,
9917 fidl::encoding::DefaultFuchsiaResourceDialect,
9918 >,
9919 >
9920 fidl::encoding::Encode<
9921 VirtioConsoleStartRequest,
9922 fidl::encoding::DefaultFuchsiaResourceDialect,
9923 > for (T0, T1)
9924 {
9925 #[inline]
9926 unsafe fn encode(
9927 self,
9928 encoder: &mut fidl::encoding::Encoder<
9929 '_,
9930 fidl::encoding::DefaultFuchsiaResourceDialect,
9931 >,
9932 offset: usize,
9933 depth: fidl::encoding::Depth,
9934 ) -> fidl::Result<()> {
9935 encoder.debug_check_bounds::<VirtioConsoleStartRequest>(offset);
9936 unsafe {
9939 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9940 (ptr as *mut u64).write_unaligned(0);
9941 }
9942 self.0.encode(encoder, offset + 0, depth)?;
9944 self.1.encode(encoder, offset + 32, depth)?;
9945 Ok(())
9946 }
9947 }
9948
9949 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9950 for VirtioConsoleStartRequest
9951 {
9952 #[inline(always)]
9953 fn new_empty() -> Self {
9954 Self {
9955 start_info: fidl::new_empty!(
9956 StartInfo,
9957 fidl::encoding::DefaultFuchsiaResourceDialect
9958 ),
9959 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9960 }
9961 }
9962
9963 #[inline]
9964 unsafe fn decode(
9965 &mut self,
9966 decoder: &mut fidl::encoding::Decoder<
9967 '_,
9968 fidl::encoding::DefaultFuchsiaResourceDialect,
9969 >,
9970 offset: usize,
9971 _depth: fidl::encoding::Depth,
9972 ) -> fidl::Result<()> {
9973 decoder.debug_check_bounds::<Self>(offset);
9974 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9976 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9977 let mask = 0xffffffff00000000u64;
9978 let maskedval = padval & mask;
9979 if maskedval != 0 {
9980 return Err(fidl::Error::NonZeroPadding {
9981 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9982 });
9983 }
9984 fidl::decode!(
9985 StartInfo,
9986 fidl::encoding::DefaultFuchsiaResourceDialect,
9987 &mut self.start_info,
9988 decoder,
9989 offset + 0,
9990 _depth
9991 )?;
9992 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 32, _depth)?;
9993 Ok(())
9994 }
9995 }
9996
9997 impl fidl::encoding::ResourceTypeMarker for VirtioGpuStartRequest {
9998 type Borrowed<'a> = &'a mut Self;
9999 fn take_or_borrow<'a>(
10000 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10001 ) -> Self::Borrowed<'a> {
10002 value
10003 }
10004 }
10005
10006 unsafe impl fidl::encoding::TypeMarker for VirtioGpuStartRequest {
10007 type Owned = Self;
10008
10009 #[inline(always)]
10010 fn inline_align(_context: fidl::encoding::Context) -> usize {
10011 8
10012 }
10013
10014 #[inline(always)]
10015 fn inline_size(_context: fidl::encoding::Context) -> usize {
10016 40
10017 }
10018 }
10019
10020 unsafe impl
10021 fidl::encoding::Encode<VirtioGpuStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10022 for &mut VirtioGpuStartRequest
10023 {
10024 #[inline]
10025 unsafe fn encode(
10026 self,
10027 encoder: &mut fidl::encoding::Encoder<
10028 '_,
10029 fidl::encoding::DefaultFuchsiaResourceDialect,
10030 >,
10031 offset: usize,
10032 _depth: fidl::encoding::Depth,
10033 ) -> fidl::Result<()> {
10034 encoder.debug_check_bounds::<VirtioGpuStartRequest>(offset);
10035 fidl::encoding::Encode::<
10037 VirtioGpuStartRequest,
10038 fidl::encoding::DefaultFuchsiaResourceDialect,
10039 >::encode(
10040 (
10041 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10042 &mut self.start_info,
10043 ),
10044 <fidl::encoding::Optional<
10045 fidl::encoding::Endpoint<
10046 fidl::endpoints::ClientEnd<
10047 fidl_fuchsia_ui_input3::KeyboardListenerMarker,
10048 >,
10049 >,
10050 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10051 &mut self.keyboard_listener,
10052 ),
10053 <fidl::encoding::Optional<
10054 fidl::encoding::Endpoint<
10055 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
10056 >,
10057 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10058 &mut self.mouse_source,
10059 ),
10060 ),
10061 encoder,
10062 offset,
10063 _depth,
10064 )
10065 }
10066 }
10067 unsafe impl<
10068 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
10069 T1: fidl::encoding::Encode<
10070 fidl::encoding::Optional<
10071 fidl::encoding::Endpoint<
10072 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
10073 >,
10074 >,
10075 fidl::encoding::DefaultFuchsiaResourceDialect,
10076 >,
10077 T2: fidl::encoding::Encode<
10078 fidl::encoding::Optional<
10079 fidl::encoding::Endpoint<
10080 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
10081 >,
10082 >,
10083 fidl::encoding::DefaultFuchsiaResourceDialect,
10084 >,
10085 >
10086 fidl::encoding::Encode<VirtioGpuStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10087 for (T0, T1, T2)
10088 {
10089 #[inline]
10090 unsafe fn encode(
10091 self,
10092 encoder: &mut fidl::encoding::Encoder<
10093 '_,
10094 fidl::encoding::DefaultFuchsiaResourceDialect,
10095 >,
10096 offset: usize,
10097 depth: fidl::encoding::Depth,
10098 ) -> fidl::Result<()> {
10099 encoder.debug_check_bounds::<VirtioGpuStartRequest>(offset);
10100 self.0.encode(encoder, offset + 0, depth)?;
10104 self.1.encode(encoder, offset + 32, depth)?;
10105 self.2.encode(encoder, offset + 36, depth)?;
10106 Ok(())
10107 }
10108 }
10109
10110 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10111 for VirtioGpuStartRequest
10112 {
10113 #[inline(always)]
10114 fn new_empty() -> Self {
10115 Self {
10116 start_info: fidl::new_empty!(
10117 StartInfo,
10118 fidl::encoding::DefaultFuchsiaResourceDialect
10119 ),
10120 keyboard_listener: fidl::new_empty!(
10121 fidl::encoding::Optional<
10122 fidl::encoding::Endpoint<
10123 fidl::endpoints::ClientEnd<
10124 fidl_fuchsia_ui_input3::KeyboardListenerMarker,
10125 >,
10126 >,
10127 >,
10128 fidl::encoding::DefaultFuchsiaResourceDialect
10129 ),
10130 mouse_source: fidl::new_empty!(
10131 fidl::encoding::Optional<
10132 fidl::encoding::Endpoint<
10133 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
10134 >,
10135 >,
10136 fidl::encoding::DefaultFuchsiaResourceDialect
10137 ),
10138 }
10139 }
10140
10141 #[inline]
10142 unsafe fn decode(
10143 &mut self,
10144 decoder: &mut fidl::encoding::Decoder<
10145 '_,
10146 fidl::encoding::DefaultFuchsiaResourceDialect,
10147 >,
10148 offset: usize,
10149 _depth: fidl::encoding::Depth,
10150 ) -> fidl::Result<()> {
10151 decoder.debug_check_bounds::<Self>(offset);
10152 fidl::decode!(
10154 StartInfo,
10155 fidl::encoding::DefaultFuchsiaResourceDialect,
10156 &mut self.start_info,
10157 decoder,
10158 offset + 0,
10159 _depth
10160 )?;
10161 fidl::decode!(
10162 fidl::encoding::Optional<
10163 fidl::encoding::Endpoint<
10164 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
10165 >,
10166 >,
10167 fidl::encoding::DefaultFuchsiaResourceDialect,
10168 &mut self.keyboard_listener,
10169 decoder,
10170 offset + 32,
10171 _depth
10172 )?;
10173 fidl::decode!(
10174 fidl::encoding::Optional<
10175 fidl::encoding::Endpoint<
10176 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
10177 >,
10178 >,
10179 fidl::encoding::DefaultFuchsiaResourceDialect,
10180 &mut self.mouse_source,
10181 decoder,
10182 offset + 36,
10183 _depth
10184 )?;
10185 Ok(())
10186 }
10187 }
10188
10189 impl fidl::encoding::ResourceTypeMarker for VirtioInputStartRequest {
10190 type Borrowed<'a> = &'a mut Self;
10191 fn take_or_borrow<'a>(
10192 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10193 ) -> Self::Borrowed<'a> {
10194 value
10195 }
10196 }
10197
10198 unsafe impl fidl::encoding::TypeMarker for VirtioInputStartRequest {
10199 type Owned = Self;
10200
10201 #[inline(always)]
10202 fn inline_align(_context: fidl::encoding::Context) -> usize {
10203 8
10204 }
10205
10206 #[inline(always)]
10207 fn inline_size(_context: fidl::encoding::Context) -> usize {
10208 48
10209 }
10210 }
10211
10212 unsafe impl
10213 fidl::encoding::Encode<
10214 VirtioInputStartRequest,
10215 fidl::encoding::DefaultFuchsiaResourceDialect,
10216 > for &mut VirtioInputStartRequest
10217 {
10218 #[inline]
10219 unsafe fn encode(
10220 self,
10221 encoder: &mut fidl::encoding::Encoder<
10222 '_,
10223 fidl::encoding::DefaultFuchsiaResourceDialect,
10224 >,
10225 offset: usize,
10226 _depth: fidl::encoding::Depth,
10227 ) -> fidl::Result<()> {
10228 encoder.debug_check_bounds::<VirtioInputStartRequest>(offset);
10229 fidl::encoding::Encode::<
10231 VirtioInputStartRequest,
10232 fidl::encoding::DefaultFuchsiaResourceDialect,
10233 >::encode(
10234 (
10235 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10236 &mut self.start_info,
10237 ),
10238 <InputType as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10239 &mut self.input_type,
10240 ),
10241 ),
10242 encoder,
10243 offset,
10244 _depth,
10245 )
10246 }
10247 }
10248 unsafe impl<
10249 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
10250 T1: fidl::encoding::Encode<InputType, fidl::encoding::DefaultFuchsiaResourceDialect>,
10251 >
10252 fidl::encoding::Encode<
10253 VirtioInputStartRequest,
10254 fidl::encoding::DefaultFuchsiaResourceDialect,
10255 > for (T0, T1)
10256 {
10257 #[inline]
10258 unsafe fn encode(
10259 self,
10260 encoder: &mut fidl::encoding::Encoder<
10261 '_,
10262 fidl::encoding::DefaultFuchsiaResourceDialect,
10263 >,
10264 offset: usize,
10265 depth: fidl::encoding::Depth,
10266 ) -> fidl::Result<()> {
10267 encoder.debug_check_bounds::<VirtioInputStartRequest>(offset);
10268 self.0.encode(encoder, offset + 0, depth)?;
10272 self.1.encode(encoder, offset + 32, depth)?;
10273 Ok(())
10274 }
10275 }
10276
10277 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10278 for VirtioInputStartRequest
10279 {
10280 #[inline(always)]
10281 fn new_empty() -> Self {
10282 Self {
10283 start_info: fidl::new_empty!(
10284 StartInfo,
10285 fidl::encoding::DefaultFuchsiaResourceDialect
10286 ),
10287 input_type: fidl::new_empty!(
10288 InputType,
10289 fidl::encoding::DefaultFuchsiaResourceDialect
10290 ),
10291 }
10292 }
10293
10294 #[inline]
10295 unsafe fn decode(
10296 &mut self,
10297 decoder: &mut fidl::encoding::Decoder<
10298 '_,
10299 fidl::encoding::DefaultFuchsiaResourceDialect,
10300 >,
10301 offset: usize,
10302 _depth: fidl::encoding::Depth,
10303 ) -> fidl::Result<()> {
10304 decoder.debug_check_bounds::<Self>(offset);
10305 fidl::decode!(
10307 StartInfo,
10308 fidl::encoding::DefaultFuchsiaResourceDialect,
10309 &mut self.start_info,
10310 decoder,
10311 offset + 0,
10312 _depth
10313 )?;
10314 fidl::decode!(
10315 InputType,
10316 fidl::encoding::DefaultFuchsiaResourceDialect,
10317 &mut self.input_type,
10318 decoder,
10319 offset + 32,
10320 _depth
10321 )?;
10322 Ok(())
10323 }
10324 }
10325
10326 impl fidl::encoding::ResourceTypeMarker for VirtioMemStartRequest {
10327 type Borrowed<'a> = &'a mut Self;
10328 fn take_or_borrow<'a>(
10329 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10330 ) -> Self::Borrowed<'a> {
10331 value
10332 }
10333 }
10334
10335 unsafe impl fidl::encoding::TypeMarker for VirtioMemStartRequest {
10336 type Owned = Self;
10337
10338 #[inline(always)]
10339 fn inline_align(_context: fidl::encoding::Context) -> usize {
10340 8
10341 }
10342
10343 #[inline(always)]
10344 fn inline_size(_context: fidl::encoding::Context) -> usize {
10345 56
10346 }
10347 }
10348
10349 unsafe impl
10350 fidl::encoding::Encode<VirtioMemStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10351 for &mut VirtioMemStartRequest
10352 {
10353 #[inline]
10354 unsafe fn encode(
10355 self,
10356 encoder: &mut fidl::encoding::Encoder<
10357 '_,
10358 fidl::encoding::DefaultFuchsiaResourceDialect,
10359 >,
10360 offset: usize,
10361 _depth: fidl::encoding::Depth,
10362 ) -> fidl::Result<()> {
10363 encoder.debug_check_bounds::<VirtioMemStartRequest>(offset);
10364 fidl::encoding::Encode::<
10366 VirtioMemStartRequest,
10367 fidl::encoding::DefaultFuchsiaResourceDialect,
10368 >::encode(
10369 (
10370 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10371 &mut self.start_info,
10372 ),
10373 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.region_addr),
10374 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.plugged_block_size),
10375 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.region_size),
10376 ),
10377 encoder,
10378 offset,
10379 _depth,
10380 )
10381 }
10382 }
10383 unsafe impl<
10384 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
10385 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
10386 T2: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
10387 T3: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
10388 >
10389 fidl::encoding::Encode<VirtioMemStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10390 for (T0, T1, T2, T3)
10391 {
10392 #[inline]
10393 unsafe fn encode(
10394 self,
10395 encoder: &mut fidl::encoding::Encoder<
10396 '_,
10397 fidl::encoding::DefaultFuchsiaResourceDialect,
10398 >,
10399 offset: usize,
10400 depth: fidl::encoding::Depth,
10401 ) -> fidl::Result<()> {
10402 encoder.debug_check_bounds::<VirtioMemStartRequest>(offset);
10403 self.0.encode(encoder, offset + 0, depth)?;
10407 self.1.encode(encoder, offset + 32, depth)?;
10408 self.2.encode(encoder, offset + 40, depth)?;
10409 self.3.encode(encoder, offset + 48, depth)?;
10410 Ok(())
10411 }
10412 }
10413
10414 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10415 for VirtioMemStartRequest
10416 {
10417 #[inline(always)]
10418 fn new_empty() -> Self {
10419 Self {
10420 start_info: fidl::new_empty!(
10421 StartInfo,
10422 fidl::encoding::DefaultFuchsiaResourceDialect
10423 ),
10424 region_addr: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
10425 plugged_block_size: fidl::new_empty!(
10426 u64,
10427 fidl::encoding::DefaultFuchsiaResourceDialect
10428 ),
10429 region_size: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
10430 }
10431 }
10432
10433 #[inline]
10434 unsafe fn decode(
10435 &mut self,
10436 decoder: &mut fidl::encoding::Decoder<
10437 '_,
10438 fidl::encoding::DefaultFuchsiaResourceDialect,
10439 >,
10440 offset: usize,
10441 _depth: fidl::encoding::Depth,
10442 ) -> fidl::Result<()> {
10443 decoder.debug_check_bounds::<Self>(offset);
10444 fidl::decode!(
10446 StartInfo,
10447 fidl::encoding::DefaultFuchsiaResourceDialect,
10448 &mut self.start_info,
10449 decoder,
10450 offset + 0,
10451 _depth
10452 )?;
10453 fidl::decode!(
10454 u64,
10455 fidl::encoding::DefaultFuchsiaResourceDialect,
10456 &mut self.region_addr,
10457 decoder,
10458 offset + 32,
10459 _depth
10460 )?;
10461 fidl::decode!(
10462 u64,
10463 fidl::encoding::DefaultFuchsiaResourceDialect,
10464 &mut self.plugged_block_size,
10465 decoder,
10466 offset + 40,
10467 _depth
10468 )?;
10469 fidl::decode!(
10470 u64,
10471 fidl::encoding::DefaultFuchsiaResourceDialect,
10472 &mut self.region_size,
10473 decoder,
10474 offset + 48,
10475 _depth
10476 )?;
10477 Ok(())
10478 }
10479 }
10480
10481 impl fidl::encoding::ResourceTypeMarker for VirtioNetStartRequest {
10482 type Borrowed<'a> = &'a mut Self;
10483 fn take_or_borrow<'a>(
10484 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10485 ) -> Self::Borrowed<'a> {
10486 value
10487 }
10488 }
10489
10490 unsafe impl fidl::encoding::TypeMarker for VirtioNetStartRequest {
10491 type Owned = Self;
10492
10493 #[inline(always)]
10494 fn inline_align(_context: fidl::encoding::Context) -> usize {
10495 8
10496 }
10497
10498 #[inline(always)]
10499 fn inline_size(_context: fidl::encoding::Context) -> usize {
10500 40
10501 }
10502 }
10503
10504 unsafe impl
10505 fidl::encoding::Encode<VirtioNetStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10506 for &mut VirtioNetStartRequest
10507 {
10508 #[inline]
10509 unsafe fn encode(
10510 self,
10511 encoder: &mut fidl::encoding::Encoder<
10512 '_,
10513 fidl::encoding::DefaultFuchsiaResourceDialect,
10514 >,
10515 offset: usize,
10516 _depth: fidl::encoding::Depth,
10517 ) -> fidl::Result<()> {
10518 encoder.debug_check_bounds::<VirtioNetStartRequest>(offset);
10519 fidl::encoding::Encode::<
10521 VirtioNetStartRequest,
10522 fidl::encoding::DefaultFuchsiaResourceDialect,
10523 >::encode(
10524 (
10525 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10526 &mut self.start_info,
10527 ),
10528 <fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
10529 &self.mac_address,
10530 ),
10531 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_bridge),
10532 ),
10533 encoder,
10534 offset,
10535 _depth,
10536 )
10537 }
10538 }
10539 unsafe impl<
10540 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
10541 T1: fidl::encoding::Encode<
10542 fidl_fuchsia_net::MacAddress,
10543 fidl::encoding::DefaultFuchsiaResourceDialect,
10544 >,
10545 T2: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
10546 >
10547 fidl::encoding::Encode<VirtioNetStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10548 for (T0, T1, T2)
10549 {
10550 #[inline]
10551 unsafe fn encode(
10552 self,
10553 encoder: &mut fidl::encoding::Encoder<
10554 '_,
10555 fidl::encoding::DefaultFuchsiaResourceDialect,
10556 >,
10557 offset: usize,
10558 depth: fidl::encoding::Depth,
10559 ) -> fidl::Result<()> {
10560 encoder.debug_check_bounds::<VirtioNetStartRequest>(offset);
10561 unsafe {
10564 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10565 (ptr as *mut u64).write_unaligned(0);
10566 }
10567 self.0.encode(encoder, offset + 0, depth)?;
10569 self.1.encode(encoder, offset + 32, depth)?;
10570 self.2.encode(encoder, offset + 38, depth)?;
10571 Ok(())
10572 }
10573 }
10574
10575 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10576 for VirtioNetStartRequest
10577 {
10578 #[inline(always)]
10579 fn new_empty() -> Self {
10580 Self {
10581 start_info: fidl::new_empty!(
10582 StartInfo,
10583 fidl::encoding::DefaultFuchsiaResourceDialect
10584 ),
10585 mac_address: fidl::new_empty!(
10586 fidl_fuchsia_net::MacAddress,
10587 fidl::encoding::DefaultFuchsiaResourceDialect
10588 ),
10589 enable_bridge: fidl::new_empty!(
10590 bool,
10591 fidl::encoding::DefaultFuchsiaResourceDialect
10592 ),
10593 }
10594 }
10595
10596 #[inline]
10597 unsafe fn decode(
10598 &mut self,
10599 decoder: &mut fidl::encoding::Decoder<
10600 '_,
10601 fidl::encoding::DefaultFuchsiaResourceDialect,
10602 >,
10603 offset: usize,
10604 _depth: fidl::encoding::Depth,
10605 ) -> fidl::Result<()> {
10606 decoder.debug_check_bounds::<Self>(offset);
10607 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10609 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10610 let mask = 0xff00000000000000u64;
10611 let maskedval = padval & mask;
10612 if maskedval != 0 {
10613 return Err(fidl::Error::NonZeroPadding {
10614 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10615 });
10616 }
10617 fidl::decode!(
10618 StartInfo,
10619 fidl::encoding::DefaultFuchsiaResourceDialect,
10620 &mut self.start_info,
10621 decoder,
10622 offset + 0,
10623 _depth
10624 )?;
10625 fidl::decode!(
10626 fidl_fuchsia_net::MacAddress,
10627 fidl::encoding::DefaultFuchsiaResourceDialect,
10628 &mut self.mac_address,
10629 decoder,
10630 offset + 32,
10631 _depth
10632 )?;
10633 fidl::decode!(
10634 bool,
10635 fidl::encoding::DefaultFuchsiaResourceDialect,
10636 &mut self.enable_bridge,
10637 decoder,
10638 offset + 38,
10639 _depth
10640 )?;
10641 Ok(())
10642 }
10643 }
10644
10645 impl fidl::encoding::ResourceTypeMarker for VirtioRngStartRequest {
10646 type Borrowed<'a> = &'a mut Self;
10647 fn take_or_borrow<'a>(
10648 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10649 ) -> Self::Borrowed<'a> {
10650 value
10651 }
10652 }
10653
10654 unsafe impl fidl::encoding::TypeMarker for VirtioRngStartRequest {
10655 type Owned = Self;
10656
10657 #[inline(always)]
10658 fn inline_align(_context: fidl::encoding::Context) -> usize {
10659 8
10660 }
10661
10662 #[inline(always)]
10663 fn inline_size(_context: fidl::encoding::Context) -> usize {
10664 32
10665 }
10666 }
10667
10668 unsafe impl
10669 fidl::encoding::Encode<VirtioRngStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10670 for &mut VirtioRngStartRequest
10671 {
10672 #[inline]
10673 unsafe fn encode(
10674 self,
10675 encoder: &mut fidl::encoding::Encoder<
10676 '_,
10677 fidl::encoding::DefaultFuchsiaResourceDialect,
10678 >,
10679 offset: usize,
10680 _depth: fidl::encoding::Depth,
10681 ) -> fidl::Result<()> {
10682 encoder.debug_check_bounds::<VirtioRngStartRequest>(offset);
10683 fidl::encoding::Encode::<
10685 VirtioRngStartRequest,
10686 fidl::encoding::DefaultFuchsiaResourceDialect,
10687 >::encode(
10688 (<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10689 &mut self.start_info,
10690 ),),
10691 encoder,
10692 offset,
10693 _depth,
10694 )
10695 }
10696 }
10697 unsafe impl<
10698 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
10699 >
10700 fidl::encoding::Encode<VirtioRngStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10701 for (T0,)
10702 {
10703 #[inline]
10704 unsafe fn encode(
10705 self,
10706 encoder: &mut fidl::encoding::Encoder<
10707 '_,
10708 fidl::encoding::DefaultFuchsiaResourceDialect,
10709 >,
10710 offset: usize,
10711 depth: fidl::encoding::Depth,
10712 ) -> fidl::Result<()> {
10713 encoder.debug_check_bounds::<VirtioRngStartRequest>(offset);
10714 self.0.encode(encoder, offset + 0, depth)?;
10718 Ok(())
10719 }
10720 }
10721
10722 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10723 for VirtioRngStartRequest
10724 {
10725 #[inline(always)]
10726 fn new_empty() -> Self {
10727 Self {
10728 start_info: fidl::new_empty!(
10729 StartInfo,
10730 fidl::encoding::DefaultFuchsiaResourceDialect
10731 ),
10732 }
10733 }
10734
10735 #[inline]
10736 unsafe fn decode(
10737 &mut self,
10738 decoder: &mut fidl::encoding::Decoder<
10739 '_,
10740 fidl::encoding::DefaultFuchsiaResourceDialect,
10741 >,
10742 offset: usize,
10743 _depth: fidl::encoding::Depth,
10744 ) -> fidl::Result<()> {
10745 decoder.debug_check_bounds::<Self>(offset);
10746 fidl::decode!(
10748 StartInfo,
10749 fidl::encoding::DefaultFuchsiaResourceDialect,
10750 &mut self.start_info,
10751 decoder,
10752 offset + 0,
10753 _depth
10754 )?;
10755 Ok(())
10756 }
10757 }
10758
10759 impl fidl::encoding::ResourceTypeMarker for VirtioSoundStartRequest {
10760 type Borrowed<'a> = &'a mut Self;
10761 fn take_or_borrow<'a>(
10762 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10763 ) -> Self::Borrowed<'a> {
10764 value
10765 }
10766 }
10767
10768 unsafe impl fidl::encoding::TypeMarker for VirtioSoundStartRequest {
10769 type Owned = Self;
10770
10771 #[inline(always)]
10772 fn inline_align(_context: fidl::encoding::Context) -> usize {
10773 8
10774 }
10775
10776 #[inline(always)]
10777 fn inline_size(_context: fidl::encoding::Context) -> usize {
10778 40
10779 }
10780 }
10781
10782 unsafe impl
10783 fidl::encoding::Encode<
10784 VirtioSoundStartRequest,
10785 fidl::encoding::DefaultFuchsiaResourceDialect,
10786 > for &mut VirtioSoundStartRequest
10787 {
10788 #[inline]
10789 unsafe fn encode(
10790 self,
10791 encoder: &mut fidl::encoding::Encoder<
10792 '_,
10793 fidl::encoding::DefaultFuchsiaResourceDialect,
10794 >,
10795 offset: usize,
10796 _depth: fidl::encoding::Depth,
10797 ) -> fidl::Result<()> {
10798 encoder.debug_check_bounds::<VirtioSoundStartRequest>(offset);
10799 fidl::encoding::Encode::<
10801 VirtioSoundStartRequest,
10802 fidl::encoding::DefaultFuchsiaResourceDialect,
10803 >::encode(
10804 (
10805 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10806 &mut self.start_info,
10807 ),
10808 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_input),
10809 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_verbose_logging),
10810 ),
10811 encoder,
10812 offset,
10813 _depth,
10814 )
10815 }
10816 }
10817 unsafe impl<
10818 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
10819 T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
10820 T2: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
10821 >
10822 fidl::encoding::Encode<
10823 VirtioSoundStartRequest,
10824 fidl::encoding::DefaultFuchsiaResourceDialect,
10825 > for (T0, T1, T2)
10826 {
10827 #[inline]
10828 unsafe fn encode(
10829 self,
10830 encoder: &mut fidl::encoding::Encoder<
10831 '_,
10832 fidl::encoding::DefaultFuchsiaResourceDialect,
10833 >,
10834 offset: usize,
10835 depth: fidl::encoding::Depth,
10836 ) -> fidl::Result<()> {
10837 encoder.debug_check_bounds::<VirtioSoundStartRequest>(offset);
10838 unsafe {
10841 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10842 (ptr as *mut u64).write_unaligned(0);
10843 }
10844 self.0.encode(encoder, offset + 0, depth)?;
10846 self.1.encode(encoder, offset + 32, depth)?;
10847 self.2.encode(encoder, offset + 33, depth)?;
10848 Ok(())
10849 }
10850 }
10851
10852 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10853 for VirtioSoundStartRequest
10854 {
10855 #[inline(always)]
10856 fn new_empty() -> Self {
10857 Self {
10858 start_info: fidl::new_empty!(
10859 StartInfo,
10860 fidl::encoding::DefaultFuchsiaResourceDialect
10861 ),
10862 enable_input: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
10863 enable_verbose_logging: fidl::new_empty!(
10864 bool,
10865 fidl::encoding::DefaultFuchsiaResourceDialect
10866 ),
10867 }
10868 }
10869
10870 #[inline]
10871 unsafe fn decode(
10872 &mut self,
10873 decoder: &mut fidl::encoding::Decoder<
10874 '_,
10875 fidl::encoding::DefaultFuchsiaResourceDialect,
10876 >,
10877 offset: usize,
10878 _depth: fidl::encoding::Depth,
10879 ) -> fidl::Result<()> {
10880 decoder.debug_check_bounds::<Self>(offset);
10881 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10883 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10884 let mask = 0xffffffffffff0000u64;
10885 let maskedval = padval & mask;
10886 if maskedval != 0 {
10887 return Err(fidl::Error::NonZeroPadding {
10888 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10889 });
10890 }
10891 fidl::decode!(
10892 StartInfo,
10893 fidl::encoding::DefaultFuchsiaResourceDialect,
10894 &mut self.start_info,
10895 decoder,
10896 offset + 0,
10897 _depth
10898 )?;
10899 fidl::decode!(
10900 bool,
10901 fidl::encoding::DefaultFuchsiaResourceDialect,
10902 &mut self.enable_input,
10903 decoder,
10904 offset + 32,
10905 _depth
10906 )?;
10907 fidl::decode!(
10908 bool,
10909 fidl::encoding::DefaultFuchsiaResourceDialect,
10910 &mut self.enable_verbose_logging,
10911 decoder,
10912 offset + 33,
10913 _depth
10914 )?;
10915 Ok(())
10916 }
10917 }
10918
10919 impl fidl::encoding::ResourceTypeMarker for VirtioVsockStartRequest {
10920 type Borrowed<'a> = &'a mut Self;
10921 fn take_or_borrow<'a>(
10922 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10923 ) -> Self::Borrowed<'a> {
10924 value
10925 }
10926 }
10927
10928 unsafe impl fidl::encoding::TypeMarker for VirtioVsockStartRequest {
10929 type Owned = Self;
10930
10931 #[inline(always)]
10932 fn inline_align(_context: fidl::encoding::Context) -> usize {
10933 8
10934 }
10935
10936 #[inline(always)]
10937 fn inline_size(_context: fidl::encoding::Context) -> usize {
10938 56
10939 }
10940 }
10941
10942 unsafe impl
10943 fidl::encoding::Encode<
10944 VirtioVsockStartRequest,
10945 fidl::encoding::DefaultFuchsiaResourceDialect,
10946 > for &mut VirtioVsockStartRequest
10947 {
10948 #[inline]
10949 unsafe fn encode(
10950 self,
10951 encoder: &mut fidl::encoding::Encoder<
10952 '_,
10953 fidl::encoding::DefaultFuchsiaResourceDialect,
10954 >,
10955 offset: usize,
10956 _depth: fidl::encoding::Depth,
10957 ) -> fidl::Result<()> {
10958 encoder.debug_check_bounds::<VirtioVsockStartRequest>(offset);
10959 fidl::encoding::Encode::<VirtioVsockStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10961 (
10962 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.start_info),
10963 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_cid),
10964 <fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listeners),
10965 ),
10966 encoder, offset, _depth
10967 )
10968 }
10969 }
10970 unsafe impl<
10971 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
10972 T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
10973 T2: fidl::encoding::Encode<
10974 fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener>,
10975 fidl::encoding::DefaultFuchsiaResourceDialect,
10976 >,
10977 >
10978 fidl::encoding::Encode<
10979 VirtioVsockStartRequest,
10980 fidl::encoding::DefaultFuchsiaResourceDialect,
10981 > for (T0, T1, T2)
10982 {
10983 #[inline]
10984 unsafe fn encode(
10985 self,
10986 encoder: &mut fidl::encoding::Encoder<
10987 '_,
10988 fidl::encoding::DefaultFuchsiaResourceDialect,
10989 >,
10990 offset: usize,
10991 depth: fidl::encoding::Depth,
10992 ) -> fidl::Result<()> {
10993 encoder.debug_check_bounds::<VirtioVsockStartRequest>(offset);
10994 unsafe {
10997 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10998 (ptr as *mut u64).write_unaligned(0);
10999 }
11000 self.0.encode(encoder, offset + 0, depth)?;
11002 self.1.encode(encoder, offset + 32, depth)?;
11003 self.2.encode(encoder, offset + 40, depth)?;
11004 Ok(())
11005 }
11006 }
11007
11008 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11009 for VirtioVsockStartRequest
11010 {
11011 #[inline(always)]
11012 fn new_empty() -> Self {
11013 Self {
11014 start_info: fidl::new_empty!(
11015 StartInfo,
11016 fidl::encoding::DefaultFuchsiaResourceDialect
11017 ),
11018 guest_cid: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11019 listeners: fidl::new_empty!(
11020 fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener>,
11021 fidl::encoding::DefaultFuchsiaResourceDialect
11022 ),
11023 }
11024 }
11025
11026 #[inline]
11027 unsafe fn decode(
11028 &mut self,
11029 decoder: &mut fidl::encoding::Decoder<
11030 '_,
11031 fidl::encoding::DefaultFuchsiaResourceDialect,
11032 >,
11033 offset: usize,
11034 _depth: fidl::encoding::Depth,
11035 ) -> fidl::Result<()> {
11036 decoder.debug_check_bounds::<Self>(offset);
11037 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
11039 let padval = unsafe { (ptr as *const u64).read_unaligned() };
11040 let mask = 0xffffffff00000000u64;
11041 let maskedval = padval & mask;
11042 if maskedval != 0 {
11043 return Err(fidl::Error::NonZeroPadding {
11044 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
11045 });
11046 }
11047 fidl::decode!(
11048 StartInfo,
11049 fidl::encoding::DefaultFuchsiaResourceDialect,
11050 &mut self.start_info,
11051 decoder,
11052 offset + 0,
11053 _depth
11054 )?;
11055 fidl::decode!(
11056 u32,
11057 fidl::encoding::DefaultFuchsiaResourceDialect,
11058 &mut self.guest_cid,
11059 decoder,
11060 offset + 32,
11061 _depth
11062 )?;
11063 fidl::decode!(
11064 fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener>,
11065 fidl::encoding::DefaultFuchsiaResourceDialect,
11066 &mut self.listeners,
11067 decoder,
11068 offset + 40,
11069 _depth
11070 )?;
11071 Ok(())
11072 }
11073 }
11074
11075 impl fidl::encoding::ResourceTypeMarker for InputType {
11076 type Borrowed<'a> = &'a mut Self;
11077 fn take_or_borrow<'a>(
11078 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11079 ) -> Self::Borrowed<'a> {
11080 value
11081 }
11082 }
11083
11084 unsafe impl fidl::encoding::TypeMarker for InputType {
11085 type Owned = Self;
11086
11087 #[inline(always)]
11088 fn inline_align(_context: fidl::encoding::Context) -> usize {
11089 8
11090 }
11091
11092 #[inline(always)]
11093 fn inline_size(_context: fidl::encoding::Context) -> usize {
11094 16
11095 }
11096 }
11097
11098 unsafe impl fidl::encoding::Encode<InputType, fidl::encoding::DefaultFuchsiaResourceDialect>
11099 for &mut InputType
11100 {
11101 #[inline]
11102 unsafe fn encode(
11103 self,
11104 encoder: &mut fidl::encoding::Encoder<
11105 '_,
11106 fidl::encoding::DefaultFuchsiaResourceDialect,
11107 >,
11108 offset: usize,
11109 _depth: fidl::encoding::Depth,
11110 ) -> fidl::Result<()> {
11111 encoder.debug_check_bounds::<InputType>(offset);
11112 encoder.write_num::<u64>(self.ordinal(), offset);
11113 match self {
11114 InputType::Keyboard(ref mut val) => fidl::encoding::encode_in_envelope::<
11115 fidl::encoding::Endpoint<
11116 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
11117 >,
11118 fidl::encoding::DefaultFuchsiaResourceDialect,
11119 >(
11120 <fidl::encoding::Endpoint<
11121 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
11122 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11123 val
11124 ),
11125 encoder,
11126 offset + 8,
11127 _depth,
11128 ),
11129 InputType::Mouse(ref mut val) => fidl::encoding::encode_in_envelope::<
11130 fidl::encoding::Endpoint<
11131 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
11132 >,
11133 fidl::encoding::DefaultFuchsiaResourceDialect,
11134 >(
11135 <fidl::encoding::Endpoint<
11136 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
11137 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11138 val
11139 ),
11140 encoder,
11141 offset + 8,
11142 _depth,
11143 ),
11144 }
11145 }
11146 }
11147
11148 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for InputType {
11149 #[inline(always)]
11150 fn new_empty() -> Self {
11151 Self::Keyboard(fidl::new_empty!(
11152 fidl::encoding::Endpoint<
11153 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
11154 >,
11155 fidl::encoding::DefaultFuchsiaResourceDialect
11156 ))
11157 }
11158
11159 #[inline]
11160 unsafe fn decode(
11161 &mut self,
11162 decoder: &mut fidl::encoding::Decoder<
11163 '_,
11164 fidl::encoding::DefaultFuchsiaResourceDialect,
11165 >,
11166 offset: usize,
11167 mut depth: fidl::encoding::Depth,
11168 ) -> fidl::Result<()> {
11169 decoder.debug_check_bounds::<Self>(offset);
11170 #[allow(unused_variables)]
11171 let next_out_of_line = decoder.next_out_of_line();
11172 let handles_before = decoder.remaining_handles();
11173 let (ordinal, inlined, num_bytes, num_handles) =
11174 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
11175
11176 let member_inline_size = match ordinal {
11177 1 => <fidl::encoding::Endpoint<
11178 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
11179 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11180 2 => <fidl::encoding::Endpoint<
11181 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
11182 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11183 _ => return Err(fidl::Error::UnknownUnionTag),
11184 };
11185
11186 if inlined != (member_inline_size <= 4) {
11187 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11188 }
11189 let _inner_offset;
11190 if inlined {
11191 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
11192 _inner_offset = offset + 8;
11193 } else {
11194 depth.increment()?;
11195 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11196 }
11197 match ordinal {
11198 1 => {
11199 #[allow(irrefutable_let_patterns)]
11200 if let InputType::Keyboard(_) = self {
11201 } else {
11203 *self = InputType::Keyboard(fidl::new_empty!(
11205 fidl::encoding::Endpoint<
11206 fidl::endpoints::ServerEnd<
11207 fidl_fuchsia_ui_input3::KeyboardListenerMarker,
11208 >,
11209 >,
11210 fidl::encoding::DefaultFuchsiaResourceDialect
11211 ));
11212 }
11213 #[allow(irrefutable_let_patterns)]
11214 if let InputType::Keyboard(ref mut val) = self {
11215 fidl::decode!(
11216 fidl::encoding::Endpoint<
11217 fidl::endpoints::ServerEnd<
11218 fidl_fuchsia_ui_input3::KeyboardListenerMarker,
11219 >,
11220 >,
11221 fidl::encoding::DefaultFuchsiaResourceDialect,
11222 val,
11223 decoder,
11224 _inner_offset,
11225 depth
11226 )?;
11227 } else {
11228 unreachable!()
11229 }
11230 }
11231 2 => {
11232 #[allow(irrefutable_let_patterns)]
11233 if let InputType::Mouse(_) = self {
11234 } else {
11236 *self = InputType::Mouse(fidl::new_empty!(
11238 fidl::encoding::Endpoint<
11239 fidl::endpoints::ClientEnd<
11240 fidl_fuchsia_ui_pointer::MouseSourceMarker,
11241 >,
11242 >,
11243 fidl::encoding::DefaultFuchsiaResourceDialect
11244 ));
11245 }
11246 #[allow(irrefutable_let_patterns)]
11247 if let InputType::Mouse(ref mut val) = self {
11248 fidl::decode!(
11249 fidl::encoding::Endpoint<
11250 fidl::endpoints::ClientEnd<
11251 fidl_fuchsia_ui_pointer::MouseSourceMarker,
11252 >,
11253 >,
11254 fidl::encoding::DefaultFuchsiaResourceDialect,
11255 val,
11256 decoder,
11257 _inner_offset,
11258 depth
11259 )?;
11260 } else {
11261 unreachable!()
11262 }
11263 }
11264 ordinal => panic!("unexpected ordinal {:?}", ordinal),
11265 }
11266 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
11267 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11268 }
11269 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11270 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11271 }
11272 Ok(())
11273 }
11274 }
11275}