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)]
74pub struct VirtioImage {
75 pub vmo: fidl::Vmo,
76 pub token: Option<fidl::EventPair>,
77 pub info: Vec<u8>,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioImage {}
81
82#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83pub struct VirtioInputStartRequest {
84 pub start_info: StartInfo,
85 pub input_type: InputType,
86}
87
88impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioInputStartRequest {}
89
90#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91pub struct VirtioMagmaStartRequest {
92 pub start_info: StartInfo,
93 pub vmar: fidl::Vmar,
94 pub wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
95}
96
97impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioMagmaStartRequest {}
98
99#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
100pub struct VirtioMemStartRequest {
101 pub start_info: StartInfo,
102 pub region_addr: u64,
103 pub plugged_block_size: u64,
104 pub region_size: u64,
105}
106
107impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioMemStartRequest {}
108
109#[derive(Debug, PartialEq)]
110pub struct VirtioNetStartRequest {
111 pub start_info: StartInfo,
112 pub mac_address: fidl_fuchsia_net::MacAddress,
113 pub enable_bridge: bool,
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioNetStartRequest {}
117
118#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119pub struct VirtioRngStartRequest {
120 pub start_info: StartInfo,
121}
122
123impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioRngStartRequest {}
124
125#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
126pub struct VirtioSoundStartRequest {
127 pub start_info: StartInfo,
128 pub enable_input: bool,
129 pub enable_verbose_logging: bool,
130}
131
132impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioSoundStartRequest {}
133
134#[derive(Debug, PartialEq)]
135pub struct VirtioVsockStartRequest {
136 pub start_info: StartInfo,
137 pub guest_cid: u32,
138 pub listeners: Vec<fidl_fuchsia_virtualization::Listener>,
139}
140
141impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioVsockStartRequest {}
142
143#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
144pub struct VirtioWaylandGetImporterRequest {
145 pub importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
146}
147
148impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
149 for VirtioWaylandGetImporterRequest
150{
151}
152
153#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
154pub struct VirtioWaylandImporterExportImageResponse {
155 pub status: i32,
156 pub image: Option<Box<VirtioImage>>,
157}
158
159impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
160 for VirtioWaylandImporterExportImageResponse
161{
162}
163
164#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
165pub struct VirtioWaylandImporterImportImageRequest {
166 pub image: VirtioImage,
167}
168
169impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
170 for VirtioWaylandImporterImportImageRequest
171{
172}
173
174#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
175pub struct VirtioWaylandStartRequest {
176 pub start_info: StartInfo,
177 pub vmar: fidl::Vmar,
178 pub sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
179 pub scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
180}
181
182impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioWaylandStartRequest {}
183
184#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
185pub struct VirtioWaylandStartWithWaylandServerRequest {
186 pub start_info: StartInfo,
187 pub vmar: fidl::Vmar,
188 pub wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
189 pub sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
190 pub scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
191}
192
193impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
194 for VirtioWaylandStartWithWaylandServerRequest
195{
196}
197
198#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
199pub enum InputType {
200 Keyboard(fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>),
201 Mouse(fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>),
202}
203
204impl InputType {
205 #[inline]
206 pub fn ordinal(&self) -> u64 {
207 match *self {
208 Self::Keyboard(_) => 1,
209 Self::Mouse(_) => 2,
210 }
211 }
212}
213
214impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InputType {}
215
216#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
217pub struct VirtioBalloonMarker;
218
219impl fidl::endpoints::ProtocolMarker for VirtioBalloonMarker {
220 type Proxy = VirtioBalloonProxy;
221 type RequestStream = VirtioBalloonRequestStream;
222 #[cfg(target_os = "fuchsia")]
223 type SynchronousProxy = VirtioBalloonSynchronousProxy;
224
225 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioBalloon";
226}
227impl fidl::endpoints::DiscoverableProtocolMarker for VirtioBalloonMarker {}
228
229pub trait VirtioBalloonProxyInterface: Send + Sync {
230 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
231 fn r#configure_queue(
232 &self,
233 queue: u16,
234 size: u16,
235 desc: u64,
236 avail: u64,
237 used: u64,
238 ) -> Self::ConfigureQueueResponseFut;
239 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
240 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
241 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
242 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
243 fn r#start(&self, start_info: StartInfo) -> Self::StartResponseFut;
244 type GetMemStatsResponseFut: std::future::Future<
245 Output = Result<(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>), fidl::Error>,
246 > + Send;
247 fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut;
248}
249#[derive(Debug)]
250#[cfg(target_os = "fuchsia")]
251pub struct VirtioBalloonSynchronousProxy {
252 client: fidl::client::sync::Client,
253}
254
255#[cfg(target_os = "fuchsia")]
256impl fidl::endpoints::SynchronousProxy for VirtioBalloonSynchronousProxy {
257 type Proxy = VirtioBalloonProxy;
258 type Protocol = VirtioBalloonMarker;
259
260 fn from_channel(inner: fidl::Channel) -> Self {
261 Self::new(inner)
262 }
263
264 fn into_channel(self) -> fidl::Channel {
265 self.client.into_channel()
266 }
267
268 fn as_channel(&self) -> &fidl::Channel {
269 self.client.as_channel()
270 }
271}
272
273#[cfg(target_os = "fuchsia")]
274impl VirtioBalloonSynchronousProxy {
275 pub fn new(channel: fidl::Channel) -> Self {
276 let protocol_name = <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
277 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
278 }
279
280 pub fn into_channel(self) -> fidl::Channel {
281 self.client.into_channel()
282 }
283
284 pub fn wait_for_event(
287 &self,
288 deadline: zx::MonotonicInstant,
289 ) -> Result<VirtioBalloonEvent, fidl::Error> {
290 VirtioBalloonEvent::decode(self.client.wait_for_event(deadline)?)
291 }
292
293 pub fn r#configure_queue(
296 &self,
297 mut queue: u16,
298 mut size: u16,
299 mut desc: u64,
300 mut avail: u64,
301 mut used: u64,
302 ___deadline: zx::MonotonicInstant,
303 ) -> Result<(), fidl::Error> {
304 let _response = self
305 .client
306 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
307 (queue, size, desc, avail, used),
308 0x72b44fb963480b11,
309 fidl::encoding::DynamicFlags::empty(),
310 ___deadline,
311 )?;
312 Ok(_response)
313 }
314
315 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
317 self.client.send::<VirtioDeviceNotifyQueueRequest>(
318 (queue,),
319 0x6e3a61d652499244,
320 fidl::encoding::DynamicFlags::empty(),
321 )
322 }
323
324 pub fn r#ready(
327 &self,
328 mut negotiated_features: u32,
329 ___deadline: zx::MonotonicInstant,
330 ) -> Result<(), fidl::Error> {
331 let _response =
332 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
333 (negotiated_features,),
334 0x45707654f5d23c3f,
335 fidl::encoding::DynamicFlags::empty(),
336 ___deadline,
337 )?;
338 Ok(_response)
339 }
340
341 pub fn r#start(
343 &self,
344 mut start_info: StartInfo,
345 ___deadline: zx::MonotonicInstant,
346 ) -> Result<(), fidl::Error> {
347 let _response =
348 self.client.send_query::<VirtioBalloonStartRequest, fidl::encoding::EmptyPayload>(
349 (&mut start_info,),
350 0x26645282fddf6f46,
351 fidl::encoding::DynamicFlags::empty(),
352 ___deadline,
353 )?;
354 Ok(_response)
355 }
356
357 pub fn r#get_mem_stats(
359 &self,
360 ___deadline: zx::MonotonicInstant,
361 ) -> Result<(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>), fidl::Error> {
362 let _response = self
363 .client
364 .send_query::<fidl::encoding::EmptyPayload, VirtioBalloonGetMemStatsResponse>(
365 (),
366 0x6641f4c296607e24,
367 fidl::encoding::DynamicFlags::empty(),
368 ___deadline,
369 )?;
370 Ok((_response.status, _response.mem_stats))
371 }
372}
373
374#[cfg(target_os = "fuchsia")]
375impl From<VirtioBalloonSynchronousProxy> for zx::Handle {
376 fn from(value: VirtioBalloonSynchronousProxy) -> Self {
377 value.into_channel().into()
378 }
379}
380
381#[cfg(target_os = "fuchsia")]
382impl From<fidl::Channel> for VirtioBalloonSynchronousProxy {
383 fn from(value: fidl::Channel) -> Self {
384 Self::new(value)
385 }
386}
387
388#[derive(Debug, Clone)]
389pub struct VirtioBalloonProxy {
390 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
391}
392
393impl fidl::endpoints::Proxy for VirtioBalloonProxy {
394 type Protocol = VirtioBalloonMarker;
395
396 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
397 Self::new(inner)
398 }
399
400 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
401 self.client.into_channel().map_err(|client| Self { client })
402 }
403
404 fn as_channel(&self) -> &::fidl::AsyncChannel {
405 self.client.as_channel()
406 }
407}
408
409impl VirtioBalloonProxy {
410 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
412 let protocol_name = <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
413 Self { client: fidl::client::Client::new(channel, protocol_name) }
414 }
415
416 pub fn take_event_stream(&self) -> VirtioBalloonEventStream {
422 VirtioBalloonEventStream { event_receiver: self.client.take_event_receiver() }
423 }
424
425 pub fn r#configure_queue(
428 &self,
429 mut queue: u16,
430 mut size: u16,
431 mut desc: u64,
432 mut avail: u64,
433 mut used: u64,
434 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
435 VirtioBalloonProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
436 }
437
438 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
440 VirtioBalloonProxyInterface::r#notify_queue(self, queue)
441 }
442
443 pub fn r#ready(
446 &self,
447 mut negotiated_features: u32,
448 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
449 VirtioBalloonProxyInterface::r#ready(self, negotiated_features)
450 }
451
452 pub fn r#start(
454 &self,
455 mut start_info: StartInfo,
456 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
457 VirtioBalloonProxyInterface::r#start(self, start_info)
458 }
459
460 pub fn r#get_mem_stats(
462 &self,
463 ) -> fidl::client::QueryResponseFut<
464 (i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>),
465 fidl::encoding::DefaultFuchsiaResourceDialect,
466 > {
467 VirtioBalloonProxyInterface::r#get_mem_stats(self)
468 }
469}
470
471impl VirtioBalloonProxyInterface for VirtioBalloonProxy {
472 type ConfigureQueueResponseFut =
473 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
474 fn r#configure_queue(
475 &self,
476 mut queue: u16,
477 mut size: u16,
478 mut desc: u64,
479 mut avail: u64,
480 mut used: u64,
481 ) -> Self::ConfigureQueueResponseFut {
482 fn _decode(
483 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
484 ) -> Result<(), fidl::Error> {
485 let _response = fidl::client::decode_transaction_body::<
486 fidl::encoding::EmptyPayload,
487 fidl::encoding::DefaultFuchsiaResourceDialect,
488 0x72b44fb963480b11,
489 >(_buf?)?;
490 Ok(_response)
491 }
492 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
493 (queue, size, desc, avail, used),
494 0x72b44fb963480b11,
495 fidl::encoding::DynamicFlags::empty(),
496 _decode,
497 )
498 }
499
500 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
501 self.client.send::<VirtioDeviceNotifyQueueRequest>(
502 (queue,),
503 0x6e3a61d652499244,
504 fidl::encoding::DynamicFlags::empty(),
505 )
506 }
507
508 type ReadyResponseFut =
509 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
510 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
511 fn _decode(
512 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
513 ) -> Result<(), fidl::Error> {
514 let _response = fidl::client::decode_transaction_body::<
515 fidl::encoding::EmptyPayload,
516 fidl::encoding::DefaultFuchsiaResourceDialect,
517 0x45707654f5d23c3f,
518 >(_buf?)?;
519 Ok(_response)
520 }
521 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
522 (negotiated_features,),
523 0x45707654f5d23c3f,
524 fidl::encoding::DynamicFlags::empty(),
525 _decode,
526 )
527 }
528
529 type StartResponseFut =
530 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
531 fn r#start(&self, mut start_info: StartInfo) -> Self::StartResponseFut {
532 fn _decode(
533 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
534 ) -> Result<(), fidl::Error> {
535 let _response = fidl::client::decode_transaction_body::<
536 fidl::encoding::EmptyPayload,
537 fidl::encoding::DefaultFuchsiaResourceDialect,
538 0x26645282fddf6f46,
539 >(_buf?)?;
540 Ok(_response)
541 }
542 self.client.send_query_and_decode::<VirtioBalloonStartRequest, ()>(
543 (&mut start_info,),
544 0x26645282fddf6f46,
545 fidl::encoding::DynamicFlags::empty(),
546 _decode,
547 )
548 }
549
550 type GetMemStatsResponseFut = fidl::client::QueryResponseFut<
551 (i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>),
552 fidl::encoding::DefaultFuchsiaResourceDialect,
553 >;
554 fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut {
555 fn _decode(
556 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
557 ) -> Result<(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>), fidl::Error> {
558 let _response = fidl::client::decode_transaction_body::<
559 VirtioBalloonGetMemStatsResponse,
560 fidl::encoding::DefaultFuchsiaResourceDialect,
561 0x6641f4c296607e24,
562 >(_buf?)?;
563 Ok((_response.status, _response.mem_stats))
564 }
565 self.client.send_query_and_decode::<
566 fidl::encoding::EmptyPayload,
567 (i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>),
568 >(
569 (),
570 0x6641f4c296607e24,
571 fidl::encoding::DynamicFlags::empty(),
572 _decode,
573 )
574 }
575}
576
577pub struct VirtioBalloonEventStream {
578 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
579}
580
581impl std::marker::Unpin for VirtioBalloonEventStream {}
582
583impl futures::stream::FusedStream for VirtioBalloonEventStream {
584 fn is_terminated(&self) -> bool {
585 self.event_receiver.is_terminated()
586 }
587}
588
589impl futures::Stream for VirtioBalloonEventStream {
590 type Item = Result<VirtioBalloonEvent, fidl::Error>;
591
592 fn poll_next(
593 mut self: std::pin::Pin<&mut Self>,
594 cx: &mut std::task::Context<'_>,
595 ) -> std::task::Poll<Option<Self::Item>> {
596 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
597 &mut self.event_receiver,
598 cx
599 )?) {
600 Some(buf) => std::task::Poll::Ready(Some(VirtioBalloonEvent::decode(buf))),
601 None => std::task::Poll::Ready(None),
602 }
603 }
604}
605
606#[derive(Debug)]
607pub enum VirtioBalloonEvent {}
608
609impl VirtioBalloonEvent {
610 fn decode(
612 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
613 ) -> Result<VirtioBalloonEvent, fidl::Error> {
614 let (bytes, _handles) = buf.split_mut();
615 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
616 debug_assert_eq!(tx_header.tx_id, 0);
617 match tx_header.ordinal {
618 _ => Err(fidl::Error::UnknownOrdinal {
619 ordinal: tx_header.ordinal,
620 protocol_name: <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
621 }),
622 }
623 }
624}
625
626pub struct VirtioBalloonRequestStream {
628 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
629 is_terminated: bool,
630}
631
632impl std::marker::Unpin for VirtioBalloonRequestStream {}
633
634impl futures::stream::FusedStream for VirtioBalloonRequestStream {
635 fn is_terminated(&self) -> bool {
636 self.is_terminated
637 }
638}
639
640impl fidl::endpoints::RequestStream for VirtioBalloonRequestStream {
641 type Protocol = VirtioBalloonMarker;
642 type ControlHandle = VirtioBalloonControlHandle;
643
644 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
645 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
646 }
647
648 fn control_handle(&self) -> Self::ControlHandle {
649 VirtioBalloonControlHandle { inner: self.inner.clone() }
650 }
651
652 fn into_inner(
653 self,
654 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
655 {
656 (self.inner, self.is_terminated)
657 }
658
659 fn from_inner(
660 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
661 is_terminated: bool,
662 ) -> Self {
663 Self { inner, is_terminated }
664 }
665}
666
667impl futures::Stream for VirtioBalloonRequestStream {
668 type Item = Result<VirtioBalloonRequest, fidl::Error>;
669
670 fn poll_next(
671 mut self: std::pin::Pin<&mut Self>,
672 cx: &mut std::task::Context<'_>,
673 ) -> std::task::Poll<Option<Self::Item>> {
674 let this = &mut *self;
675 if this.inner.check_shutdown(cx) {
676 this.is_terminated = true;
677 return std::task::Poll::Ready(None);
678 }
679 if this.is_terminated {
680 panic!("polled VirtioBalloonRequestStream after completion");
681 }
682 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
683 |bytes, handles| {
684 match this.inner.channel().read_etc(cx, bytes, handles) {
685 std::task::Poll::Ready(Ok(())) => {}
686 std::task::Poll::Pending => return std::task::Poll::Pending,
687 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
688 this.is_terminated = true;
689 return std::task::Poll::Ready(None);
690 }
691 std::task::Poll::Ready(Err(e)) => {
692 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
693 e.into(),
694 ))))
695 }
696 }
697
698 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
700
701 std::task::Poll::Ready(Some(match header.ordinal {
702 0x72b44fb963480b11 => {
703 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
704 let mut req = fidl::new_empty!(
705 VirtioDeviceConfigureQueueRequest,
706 fidl::encoding::DefaultFuchsiaResourceDialect
707 );
708 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
709 let control_handle =
710 VirtioBalloonControlHandle { inner: this.inner.clone() };
711 Ok(VirtioBalloonRequest::ConfigureQueue {
712 queue: req.queue,
713 size: req.size,
714 desc: req.desc,
715 avail: req.avail,
716 used: req.used,
717
718 responder: VirtioBalloonConfigureQueueResponder {
719 control_handle: std::mem::ManuallyDrop::new(control_handle),
720 tx_id: header.tx_id,
721 },
722 })
723 }
724 0x6e3a61d652499244 => {
725 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
726 let mut req = fidl::new_empty!(
727 VirtioDeviceNotifyQueueRequest,
728 fidl::encoding::DefaultFuchsiaResourceDialect
729 );
730 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
731 let control_handle =
732 VirtioBalloonControlHandle { inner: this.inner.clone() };
733 Ok(VirtioBalloonRequest::NotifyQueue { queue: req.queue, control_handle })
734 }
735 0x45707654f5d23c3f => {
736 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
737 let mut req = fidl::new_empty!(
738 VirtioDeviceReadyRequest,
739 fidl::encoding::DefaultFuchsiaResourceDialect
740 );
741 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
742 let control_handle =
743 VirtioBalloonControlHandle { inner: this.inner.clone() };
744 Ok(VirtioBalloonRequest::Ready {
745 negotiated_features: req.negotiated_features,
746
747 responder: VirtioBalloonReadyResponder {
748 control_handle: std::mem::ManuallyDrop::new(control_handle),
749 tx_id: header.tx_id,
750 },
751 })
752 }
753 0x26645282fddf6f46 => {
754 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
755 let mut req = fidl::new_empty!(
756 VirtioBalloonStartRequest,
757 fidl::encoding::DefaultFuchsiaResourceDialect
758 );
759 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioBalloonStartRequest>(&header, _body_bytes, handles, &mut req)?;
760 let control_handle =
761 VirtioBalloonControlHandle { inner: this.inner.clone() };
762 Ok(VirtioBalloonRequest::Start {
763 start_info: req.start_info,
764
765 responder: VirtioBalloonStartResponder {
766 control_handle: std::mem::ManuallyDrop::new(control_handle),
767 tx_id: header.tx_id,
768 },
769 })
770 }
771 0x6641f4c296607e24 => {
772 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
773 let mut req = fidl::new_empty!(
774 fidl::encoding::EmptyPayload,
775 fidl::encoding::DefaultFuchsiaResourceDialect
776 );
777 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
778 let control_handle =
779 VirtioBalloonControlHandle { inner: this.inner.clone() };
780 Ok(VirtioBalloonRequest::GetMemStats {
781 responder: VirtioBalloonGetMemStatsResponder {
782 control_handle: std::mem::ManuallyDrop::new(control_handle),
783 tx_id: header.tx_id,
784 },
785 })
786 }
787 _ => Err(fidl::Error::UnknownOrdinal {
788 ordinal: header.ordinal,
789 protocol_name:
790 <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
791 }),
792 }))
793 },
794 )
795 }
796}
797
798#[derive(Debug)]
799pub enum VirtioBalloonRequest {
800 ConfigureQueue {
803 queue: u16,
804 size: u16,
805 desc: u64,
806 avail: u64,
807 used: u64,
808 responder: VirtioBalloonConfigureQueueResponder,
809 },
810 NotifyQueue { queue: u16, control_handle: VirtioBalloonControlHandle },
812 Ready { negotiated_features: u32, responder: VirtioBalloonReadyResponder },
815 Start { start_info: StartInfo, responder: VirtioBalloonStartResponder },
817 GetMemStats { responder: VirtioBalloonGetMemStatsResponder },
819}
820
821impl VirtioBalloonRequest {
822 #[allow(irrefutable_let_patterns)]
823 pub fn into_configure_queue(
824 self,
825 ) -> Option<(u16, u16, u64, u64, u64, VirtioBalloonConfigureQueueResponder)> {
826 if let VirtioBalloonRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
827 self
828 {
829 Some((queue, size, desc, avail, used, responder))
830 } else {
831 None
832 }
833 }
834
835 #[allow(irrefutable_let_patterns)]
836 pub fn into_notify_queue(self) -> Option<(u16, VirtioBalloonControlHandle)> {
837 if let VirtioBalloonRequest::NotifyQueue { queue, control_handle } = self {
838 Some((queue, control_handle))
839 } else {
840 None
841 }
842 }
843
844 #[allow(irrefutable_let_patterns)]
845 pub fn into_ready(self) -> Option<(u32, VirtioBalloonReadyResponder)> {
846 if let VirtioBalloonRequest::Ready { negotiated_features, responder } = self {
847 Some((negotiated_features, responder))
848 } else {
849 None
850 }
851 }
852
853 #[allow(irrefutable_let_patterns)]
854 pub fn into_start(self) -> Option<(StartInfo, VirtioBalloonStartResponder)> {
855 if let VirtioBalloonRequest::Start { start_info, responder } = self {
856 Some((start_info, responder))
857 } else {
858 None
859 }
860 }
861
862 #[allow(irrefutable_let_patterns)]
863 pub fn into_get_mem_stats(self) -> Option<(VirtioBalloonGetMemStatsResponder)> {
864 if let VirtioBalloonRequest::GetMemStats { responder } = self {
865 Some((responder))
866 } else {
867 None
868 }
869 }
870
871 pub fn method_name(&self) -> &'static str {
873 match *self {
874 VirtioBalloonRequest::ConfigureQueue { .. } => "configure_queue",
875 VirtioBalloonRequest::NotifyQueue { .. } => "notify_queue",
876 VirtioBalloonRequest::Ready { .. } => "ready",
877 VirtioBalloonRequest::Start { .. } => "start",
878 VirtioBalloonRequest::GetMemStats { .. } => "get_mem_stats",
879 }
880 }
881}
882
883#[derive(Debug, Clone)]
884pub struct VirtioBalloonControlHandle {
885 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
886}
887
888impl fidl::endpoints::ControlHandle for VirtioBalloonControlHandle {
889 fn shutdown(&self) {
890 self.inner.shutdown()
891 }
892 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
893 self.inner.shutdown_with_epitaph(status)
894 }
895
896 fn is_closed(&self) -> bool {
897 self.inner.channel().is_closed()
898 }
899 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
900 self.inner.channel().on_closed()
901 }
902
903 #[cfg(target_os = "fuchsia")]
904 fn signal_peer(
905 &self,
906 clear_mask: zx::Signals,
907 set_mask: zx::Signals,
908 ) -> Result<(), zx_status::Status> {
909 use fidl::Peered;
910 self.inner.channel().signal_peer(clear_mask, set_mask)
911 }
912}
913
914impl VirtioBalloonControlHandle {}
915
916#[must_use = "FIDL methods require a response to be sent"]
917#[derive(Debug)]
918pub struct VirtioBalloonConfigureQueueResponder {
919 control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
920 tx_id: u32,
921}
922
923impl std::ops::Drop for VirtioBalloonConfigureQueueResponder {
927 fn drop(&mut self) {
928 self.control_handle.shutdown();
929 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
931 }
932}
933
934impl fidl::endpoints::Responder for VirtioBalloonConfigureQueueResponder {
935 type ControlHandle = VirtioBalloonControlHandle;
936
937 fn control_handle(&self) -> &VirtioBalloonControlHandle {
938 &self.control_handle
939 }
940
941 fn drop_without_shutdown(mut self) {
942 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
944 std::mem::forget(self);
946 }
947}
948
949impl VirtioBalloonConfigureQueueResponder {
950 pub fn send(self) -> Result<(), fidl::Error> {
954 let _result = self.send_raw();
955 if _result.is_err() {
956 self.control_handle.shutdown();
957 }
958 self.drop_without_shutdown();
959 _result
960 }
961
962 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
964 let _result = self.send_raw();
965 self.drop_without_shutdown();
966 _result
967 }
968
969 fn send_raw(&self) -> Result<(), fidl::Error> {
970 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
971 (),
972 self.tx_id,
973 0x72b44fb963480b11,
974 fidl::encoding::DynamicFlags::empty(),
975 )
976 }
977}
978
979#[must_use = "FIDL methods require a response to be sent"]
980#[derive(Debug)]
981pub struct VirtioBalloonReadyResponder {
982 control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
983 tx_id: u32,
984}
985
986impl std::ops::Drop for VirtioBalloonReadyResponder {
990 fn drop(&mut self) {
991 self.control_handle.shutdown();
992 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
994 }
995}
996
997impl fidl::endpoints::Responder for VirtioBalloonReadyResponder {
998 type ControlHandle = VirtioBalloonControlHandle;
999
1000 fn control_handle(&self) -> &VirtioBalloonControlHandle {
1001 &self.control_handle
1002 }
1003
1004 fn drop_without_shutdown(mut self) {
1005 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1007 std::mem::forget(self);
1009 }
1010}
1011
1012impl VirtioBalloonReadyResponder {
1013 pub fn send(self) -> Result<(), fidl::Error> {
1017 let _result = self.send_raw();
1018 if _result.is_err() {
1019 self.control_handle.shutdown();
1020 }
1021 self.drop_without_shutdown();
1022 _result
1023 }
1024
1025 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1027 let _result = self.send_raw();
1028 self.drop_without_shutdown();
1029 _result
1030 }
1031
1032 fn send_raw(&self) -> Result<(), fidl::Error> {
1033 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1034 (),
1035 self.tx_id,
1036 0x45707654f5d23c3f,
1037 fidl::encoding::DynamicFlags::empty(),
1038 )
1039 }
1040}
1041
1042#[must_use = "FIDL methods require a response to be sent"]
1043#[derive(Debug)]
1044pub struct VirtioBalloonStartResponder {
1045 control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
1046 tx_id: u32,
1047}
1048
1049impl std::ops::Drop for VirtioBalloonStartResponder {
1053 fn drop(&mut self) {
1054 self.control_handle.shutdown();
1055 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1057 }
1058}
1059
1060impl fidl::endpoints::Responder for VirtioBalloonStartResponder {
1061 type ControlHandle = VirtioBalloonControlHandle;
1062
1063 fn control_handle(&self) -> &VirtioBalloonControlHandle {
1064 &self.control_handle
1065 }
1066
1067 fn drop_without_shutdown(mut self) {
1068 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1070 std::mem::forget(self);
1072 }
1073}
1074
1075impl VirtioBalloonStartResponder {
1076 pub fn send(self) -> Result<(), fidl::Error> {
1080 let _result = self.send_raw();
1081 if _result.is_err() {
1082 self.control_handle.shutdown();
1083 }
1084 self.drop_without_shutdown();
1085 _result
1086 }
1087
1088 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1090 let _result = self.send_raw();
1091 self.drop_without_shutdown();
1092 _result
1093 }
1094
1095 fn send_raw(&self) -> Result<(), fidl::Error> {
1096 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1097 (),
1098 self.tx_id,
1099 0x26645282fddf6f46,
1100 fidl::encoding::DynamicFlags::empty(),
1101 )
1102 }
1103}
1104
1105#[must_use = "FIDL methods require a response to be sent"]
1106#[derive(Debug)]
1107pub struct VirtioBalloonGetMemStatsResponder {
1108 control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
1109 tx_id: u32,
1110}
1111
1112impl std::ops::Drop for VirtioBalloonGetMemStatsResponder {
1116 fn drop(&mut self) {
1117 self.control_handle.shutdown();
1118 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1120 }
1121}
1122
1123impl fidl::endpoints::Responder for VirtioBalloonGetMemStatsResponder {
1124 type ControlHandle = VirtioBalloonControlHandle;
1125
1126 fn control_handle(&self) -> &VirtioBalloonControlHandle {
1127 &self.control_handle
1128 }
1129
1130 fn drop_without_shutdown(mut self) {
1131 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1133 std::mem::forget(self);
1135 }
1136}
1137
1138impl VirtioBalloonGetMemStatsResponder {
1139 pub fn send(
1143 self,
1144 mut status: i32,
1145 mut mem_stats: Option<&[fidl_fuchsia_virtualization::MemStat]>,
1146 ) -> Result<(), fidl::Error> {
1147 let _result = self.send_raw(status, mem_stats);
1148 if _result.is_err() {
1149 self.control_handle.shutdown();
1150 }
1151 self.drop_without_shutdown();
1152 _result
1153 }
1154
1155 pub fn send_no_shutdown_on_err(
1157 self,
1158 mut status: i32,
1159 mut mem_stats: Option<&[fidl_fuchsia_virtualization::MemStat]>,
1160 ) -> Result<(), fidl::Error> {
1161 let _result = self.send_raw(status, mem_stats);
1162 self.drop_without_shutdown();
1163 _result
1164 }
1165
1166 fn send_raw(
1167 &self,
1168 mut status: i32,
1169 mut mem_stats: Option<&[fidl_fuchsia_virtualization::MemStat]>,
1170 ) -> Result<(), fidl::Error> {
1171 self.control_handle.inner.send::<VirtioBalloonGetMemStatsResponse>(
1172 (status, mem_stats),
1173 self.tx_id,
1174 0x6641f4c296607e24,
1175 fidl::encoding::DynamicFlags::empty(),
1176 )
1177 }
1178}
1179
1180#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1181pub struct VirtioBlockMarker;
1182
1183impl fidl::endpoints::ProtocolMarker for VirtioBlockMarker {
1184 type Proxy = VirtioBlockProxy;
1185 type RequestStream = VirtioBlockRequestStream;
1186 #[cfg(target_os = "fuchsia")]
1187 type SynchronousProxy = VirtioBlockSynchronousProxy;
1188
1189 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioBlock";
1190}
1191impl fidl::endpoints::DiscoverableProtocolMarker for VirtioBlockMarker {}
1192
1193pub trait VirtioBlockProxyInterface: Send + Sync {
1194 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1195 fn r#configure_queue(
1196 &self,
1197 queue: u16,
1198 size: u16,
1199 desc: u64,
1200 avail: u64,
1201 used: u64,
1202 ) -> Self::ConfigureQueueResponseFut;
1203 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
1204 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1205 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
1206 type StartResponseFut: std::future::Future<Output = Result<(u64, u32), fidl::Error>> + Send;
1207 fn r#start(
1208 &self,
1209 start_info: StartInfo,
1210 spec: fidl_fuchsia_virtualization::BlockSpec,
1211 ) -> Self::StartResponseFut;
1212}
1213#[derive(Debug)]
1214#[cfg(target_os = "fuchsia")]
1215pub struct VirtioBlockSynchronousProxy {
1216 client: fidl::client::sync::Client,
1217}
1218
1219#[cfg(target_os = "fuchsia")]
1220impl fidl::endpoints::SynchronousProxy for VirtioBlockSynchronousProxy {
1221 type Proxy = VirtioBlockProxy;
1222 type Protocol = VirtioBlockMarker;
1223
1224 fn from_channel(inner: fidl::Channel) -> Self {
1225 Self::new(inner)
1226 }
1227
1228 fn into_channel(self) -> fidl::Channel {
1229 self.client.into_channel()
1230 }
1231
1232 fn as_channel(&self) -> &fidl::Channel {
1233 self.client.as_channel()
1234 }
1235}
1236
1237#[cfg(target_os = "fuchsia")]
1238impl VirtioBlockSynchronousProxy {
1239 pub fn new(channel: fidl::Channel) -> Self {
1240 let protocol_name = <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1241 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1242 }
1243
1244 pub fn into_channel(self) -> fidl::Channel {
1245 self.client.into_channel()
1246 }
1247
1248 pub fn wait_for_event(
1251 &self,
1252 deadline: zx::MonotonicInstant,
1253 ) -> Result<VirtioBlockEvent, fidl::Error> {
1254 VirtioBlockEvent::decode(self.client.wait_for_event(deadline)?)
1255 }
1256
1257 pub fn r#configure_queue(
1260 &self,
1261 mut queue: u16,
1262 mut size: u16,
1263 mut desc: u64,
1264 mut avail: u64,
1265 mut used: u64,
1266 ___deadline: zx::MonotonicInstant,
1267 ) -> Result<(), fidl::Error> {
1268 let _response = self
1269 .client
1270 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
1271 (queue, size, desc, avail, used),
1272 0x72b44fb963480b11,
1273 fidl::encoding::DynamicFlags::empty(),
1274 ___deadline,
1275 )?;
1276 Ok(_response)
1277 }
1278
1279 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
1281 self.client.send::<VirtioDeviceNotifyQueueRequest>(
1282 (queue,),
1283 0x6e3a61d652499244,
1284 fidl::encoding::DynamicFlags::empty(),
1285 )
1286 }
1287
1288 pub fn r#ready(
1291 &self,
1292 mut negotiated_features: u32,
1293 ___deadline: zx::MonotonicInstant,
1294 ) -> Result<(), fidl::Error> {
1295 let _response =
1296 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
1297 (negotiated_features,),
1298 0x45707654f5d23c3f,
1299 fidl::encoding::DynamicFlags::empty(),
1300 ___deadline,
1301 )?;
1302 Ok(_response)
1303 }
1304
1305 pub fn r#start(
1307 &self,
1308 mut start_info: StartInfo,
1309 mut spec: fidl_fuchsia_virtualization::BlockSpec,
1310 ___deadline: zx::MonotonicInstant,
1311 ) -> Result<(u64, u32), fidl::Error> {
1312 let _response =
1313 self.client.send_query::<VirtioBlockStartRequest, VirtioBlockStartResponse>(
1314 (&mut start_info, &mut spec),
1315 0x5ef6a4b9ce9adcb2,
1316 fidl::encoding::DynamicFlags::empty(),
1317 ___deadline,
1318 )?;
1319 Ok((_response.capacity, _response.block_size))
1320 }
1321}
1322
1323#[cfg(target_os = "fuchsia")]
1324impl From<VirtioBlockSynchronousProxy> for zx::Handle {
1325 fn from(value: VirtioBlockSynchronousProxy) -> Self {
1326 value.into_channel().into()
1327 }
1328}
1329
1330#[cfg(target_os = "fuchsia")]
1331impl From<fidl::Channel> for VirtioBlockSynchronousProxy {
1332 fn from(value: fidl::Channel) -> Self {
1333 Self::new(value)
1334 }
1335}
1336
1337#[derive(Debug, Clone)]
1338pub struct VirtioBlockProxy {
1339 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1340}
1341
1342impl fidl::endpoints::Proxy for VirtioBlockProxy {
1343 type Protocol = VirtioBlockMarker;
1344
1345 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1346 Self::new(inner)
1347 }
1348
1349 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1350 self.client.into_channel().map_err(|client| Self { client })
1351 }
1352
1353 fn as_channel(&self) -> &::fidl::AsyncChannel {
1354 self.client.as_channel()
1355 }
1356}
1357
1358impl VirtioBlockProxy {
1359 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1361 let protocol_name = <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1362 Self { client: fidl::client::Client::new(channel, protocol_name) }
1363 }
1364
1365 pub fn take_event_stream(&self) -> VirtioBlockEventStream {
1371 VirtioBlockEventStream { event_receiver: self.client.take_event_receiver() }
1372 }
1373
1374 pub fn r#configure_queue(
1377 &self,
1378 mut queue: u16,
1379 mut size: u16,
1380 mut desc: u64,
1381 mut avail: u64,
1382 mut used: u64,
1383 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1384 VirtioBlockProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
1385 }
1386
1387 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
1389 VirtioBlockProxyInterface::r#notify_queue(self, queue)
1390 }
1391
1392 pub fn r#ready(
1395 &self,
1396 mut negotiated_features: u32,
1397 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1398 VirtioBlockProxyInterface::r#ready(self, negotiated_features)
1399 }
1400
1401 pub fn r#start(
1403 &self,
1404 mut start_info: StartInfo,
1405 mut spec: fidl_fuchsia_virtualization::BlockSpec,
1406 ) -> fidl::client::QueryResponseFut<(u64, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
1407 {
1408 VirtioBlockProxyInterface::r#start(self, start_info, spec)
1409 }
1410}
1411
1412impl VirtioBlockProxyInterface for VirtioBlockProxy {
1413 type ConfigureQueueResponseFut =
1414 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1415 fn r#configure_queue(
1416 &self,
1417 mut queue: u16,
1418 mut size: u16,
1419 mut desc: u64,
1420 mut avail: u64,
1421 mut used: u64,
1422 ) -> Self::ConfigureQueueResponseFut {
1423 fn _decode(
1424 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1425 ) -> Result<(), fidl::Error> {
1426 let _response = fidl::client::decode_transaction_body::<
1427 fidl::encoding::EmptyPayload,
1428 fidl::encoding::DefaultFuchsiaResourceDialect,
1429 0x72b44fb963480b11,
1430 >(_buf?)?;
1431 Ok(_response)
1432 }
1433 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
1434 (queue, size, desc, avail, used),
1435 0x72b44fb963480b11,
1436 fidl::encoding::DynamicFlags::empty(),
1437 _decode,
1438 )
1439 }
1440
1441 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
1442 self.client.send::<VirtioDeviceNotifyQueueRequest>(
1443 (queue,),
1444 0x6e3a61d652499244,
1445 fidl::encoding::DynamicFlags::empty(),
1446 )
1447 }
1448
1449 type ReadyResponseFut =
1450 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1451 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
1452 fn _decode(
1453 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1454 ) -> Result<(), fidl::Error> {
1455 let _response = fidl::client::decode_transaction_body::<
1456 fidl::encoding::EmptyPayload,
1457 fidl::encoding::DefaultFuchsiaResourceDialect,
1458 0x45707654f5d23c3f,
1459 >(_buf?)?;
1460 Ok(_response)
1461 }
1462 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
1463 (negotiated_features,),
1464 0x45707654f5d23c3f,
1465 fidl::encoding::DynamicFlags::empty(),
1466 _decode,
1467 )
1468 }
1469
1470 type StartResponseFut =
1471 fidl::client::QueryResponseFut<(u64, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
1472 fn r#start(
1473 &self,
1474 mut start_info: StartInfo,
1475 mut spec: fidl_fuchsia_virtualization::BlockSpec,
1476 ) -> Self::StartResponseFut {
1477 fn _decode(
1478 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1479 ) -> Result<(u64, u32), fidl::Error> {
1480 let _response = fidl::client::decode_transaction_body::<
1481 VirtioBlockStartResponse,
1482 fidl::encoding::DefaultFuchsiaResourceDialect,
1483 0x5ef6a4b9ce9adcb2,
1484 >(_buf?)?;
1485 Ok((_response.capacity, _response.block_size))
1486 }
1487 self.client.send_query_and_decode::<VirtioBlockStartRequest, (u64, u32)>(
1488 (&mut start_info, &mut spec),
1489 0x5ef6a4b9ce9adcb2,
1490 fidl::encoding::DynamicFlags::empty(),
1491 _decode,
1492 )
1493 }
1494}
1495
1496pub struct VirtioBlockEventStream {
1497 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1498}
1499
1500impl std::marker::Unpin for VirtioBlockEventStream {}
1501
1502impl futures::stream::FusedStream for VirtioBlockEventStream {
1503 fn is_terminated(&self) -> bool {
1504 self.event_receiver.is_terminated()
1505 }
1506}
1507
1508impl futures::Stream for VirtioBlockEventStream {
1509 type Item = Result<VirtioBlockEvent, fidl::Error>;
1510
1511 fn poll_next(
1512 mut self: std::pin::Pin<&mut Self>,
1513 cx: &mut std::task::Context<'_>,
1514 ) -> std::task::Poll<Option<Self::Item>> {
1515 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1516 &mut self.event_receiver,
1517 cx
1518 )?) {
1519 Some(buf) => std::task::Poll::Ready(Some(VirtioBlockEvent::decode(buf))),
1520 None => std::task::Poll::Ready(None),
1521 }
1522 }
1523}
1524
1525#[derive(Debug)]
1526pub enum VirtioBlockEvent {}
1527
1528impl VirtioBlockEvent {
1529 fn decode(
1531 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1532 ) -> Result<VirtioBlockEvent, fidl::Error> {
1533 let (bytes, _handles) = buf.split_mut();
1534 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1535 debug_assert_eq!(tx_header.tx_id, 0);
1536 match tx_header.ordinal {
1537 _ => Err(fidl::Error::UnknownOrdinal {
1538 ordinal: tx_header.ordinal,
1539 protocol_name: <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1540 }),
1541 }
1542 }
1543}
1544
1545pub struct VirtioBlockRequestStream {
1547 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1548 is_terminated: bool,
1549}
1550
1551impl std::marker::Unpin for VirtioBlockRequestStream {}
1552
1553impl futures::stream::FusedStream for VirtioBlockRequestStream {
1554 fn is_terminated(&self) -> bool {
1555 self.is_terminated
1556 }
1557}
1558
1559impl fidl::endpoints::RequestStream for VirtioBlockRequestStream {
1560 type Protocol = VirtioBlockMarker;
1561 type ControlHandle = VirtioBlockControlHandle;
1562
1563 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1564 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1565 }
1566
1567 fn control_handle(&self) -> Self::ControlHandle {
1568 VirtioBlockControlHandle { inner: self.inner.clone() }
1569 }
1570
1571 fn into_inner(
1572 self,
1573 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1574 {
1575 (self.inner, self.is_terminated)
1576 }
1577
1578 fn from_inner(
1579 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1580 is_terminated: bool,
1581 ) -> Self {
1582 Self { inner, is_terminated }
1583 }
1584}
1585
1586impl futures::Stream for VirtioBlockRequestStream {
1587 type Item = Result<VirtioBlockRequest, fidl::Error>;
1588
1589 fn poll_next(
1590 mut self: std::pin::Pin<&mut Self>,
1591 cx: &mut std::task::Context<'_>,
1592 ) -> std::task::Poll<Option<Self::Item>> {
1593 let this = &mut *self;
1594 if this.inner.check_shutdown(cx) {
1595 this.is_terminated = true;
1596 return std::task::Poll::Ready(None);
1597 }
1598 if this.is_terminated {
1599 panic!("polled VirtioBlockRequestStream after completion");
1600 }
1601 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1602 |bytes, handles| {
1603 match this.inner.channel().read_etc(cx, bytes, handles) {
1604 std::task::Poll::Ready(Ok(())) => {}
1605 std::task::Poll::Pending => return std::task::Poll::Pending,
1606 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1607 this.is_terminated = true;
1608 return std::task::Poll::Ready(None);
1609 }
1610 std::task::Poll::Ready(Err(e)) => {
1611 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1612 e.into(),
1613 ))))
1614 }
1615 }
1616
1617 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1619
1620 std::task::Poll::Ready(Some(match header.ordinal {
1621 0x72b44fb963480b11 => {
1622 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1623 let mut req = fidl::new_empty!(
1624 VirtioDeviceConfigureQueueRequest,
1625 fidl::encoding::DefaultFuchsiaResourceDialect
1626 );
1627 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
1628 let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
1629 Ok(VirtioBlockRequest::ConfigureQueue {
1630 queue: req.queue,
1631 size: req.size,
1632 desc: req.desc,
1633 avail: req.avail,
1634 used: req.used,
1635
1636 responder: VirtioBlockConfigureQueueResponder {
1637 control_handle: std::mem::ManuallyDrop::new(control_handle),
1638 tx_id: header.tx_id,
1639 },
1640 })
1641 }
1642 0x6e3a61d652499244 => {
1643 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1644 let mut req = fidl::new_empty!(
1645 VirtioDeviceNotifyQueueRequest,
1646 fidl::encoding::DefaultFuchsiaResourceDialect
1647 );
1648 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
1649 let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
1650 Ok(VirtioBlockRequest::NotifyQueue { queue: req.queue, control_handle })
1651 }
1652 0x45707654f5d23c3f => {
1653 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1654 let mut req = fidl::new_empty!(
1655 VirtioDeviceReadyRequest,
1656 fidl::encoding::DefaultFuchsiaResourceDialect
1657 );
1658 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
1659 let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
1660 Ok(VirtioBlockRequest::Ready {
1661 negotiated_features: req.negotiated_features,
1662
1663 responder: VirtioBlockReadyResponder {
1664 control_handle: std::mem::ManuallyDrop::new(control_handle),
1665 tx_id: header.tx_id,
1666 },
1667 })
1668 }
1669 0x5ef6a4b9ce9adcb2 => {
1670 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1671 let mut req = fidl::new_empty!(
1672 VirtioBlockStartRequest,
1673 fidl::encoding::DefaultFuchsiaResourceDialect
1674 );
1675 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioBlockStartRequest>(&header, _body_bytes, handles, &mut req)?;
1676 let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
1677 Ok(VirtioBlockRequest::Start {
1678 start_info: req.start_info,
1679 spec: req.spec,
1680
1681 responder: VirtioBlockStartResponder {
1682 control_handle: std::mem::ManuallyDrop::new(control_handle),
1683 tx_id: header.tx_id,
1684 },
1685 })
1686 }
1687 _ => Err(fidl::Error::UnknownOrdinal {
1688 ordinal: header.ordinal,
1689 protocol_name:
1690 <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1691 }),
1692 }))
1693 },
1694 )
1695 }
1696}
1697
1698#[derive(Debug)]
1699pub enum VirtioBlockRequest {
1700 ConfigureQueue {
1703 queue: u16,
1704 size: u16,
1705 desc: u64,
1706 avail: u64,
1707 used: u64,
1708 responder: VirtioBlockConfigureQueueResponder,
1709 },
1710 NotifyQueue { queue: u16, control_handle: VirtioBlockControlHandle },
1712 Ready { negotiated_features: u32, responder: VirtioBlockReadyResponder },
1715 Start {
1717 start_info: StartInfo,
1718 spec: fidl_fuchsia_virtualization::BlockSpec,
1719 responder: VirtioBlockStartResponder,
1720 },
1721}
1722
1723impl VirtioBlockRequest {
1724 #[allow(irrefutable_let_patterns)]
1725 pub fn into_configure_queue(
1726 self,
1727 ) -> Option<(u16, u16, u64, u64, u64, VirtioBlockConfigureQueueResponder)> {
1728 if let VirtioBlockRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
1729 self
1730 {
1731 Some((queue, size, desc, avail, used, responder))
1732 } else {
1733 None
1734 }
1735 }
1736
1737 #[allow(irrefutable_let_patterns)]
1738 pub fn into_notify_queue(self) -> Option<(u16, VirtioBlockControlHandle)> {
1739 if let VirtioBlockRequest::NotifyQueue { queue, control_handle } = self {
1740 Some((queue, control_handle))
1741 } else {
1742 None
1743 }
1744 }
1745
1746 #[allow(irrefutable_let_patterns)]
1747 pub fn into_ready(self) -> Option<(u32, VirtioBlockReadyResponder)> {
1748 if let VirtioBlockRequest::Ready { negotiated_features, responder } = self {
1749 Some((negotiated_features, responder))
1750 } else {
1751 None
1752 }
1753 }
1754
1755 #[allow(irrefutable_let_patterns)]
1756 pub fn into_start(
1757 self,
1758 ) -> Option<(StartInfo, fidl_fuchsia_virtualization::BlockSpec, VirtioBlockStartResponder)>
1759 {
1760 if let VirtioBlockRequest::Start { start_info, spec, responder } = self {
1761 Some((start_info, spec, responder))
1762 } else {
1763 None
1764 }
1765 }
1766
1767 pub fn method_name(&self) -> &'static str {
1769 match *self {
1770 VirtioBlockRequest::ConfigureQueue { .. } => "configure_queue",
1771 VirtioBlockRequest::NotifyQueue { .. } => "notify_queue",
1772 VirtioBlockRequest::Ready { .. } => "ready",
1773 VirtioBlockRequest::Start { .. } => "start",
1774 }
1775 }
1776}
1777
1778#[derive(Debug, Clone)]
1779pub struct VirtioBlockControlHandle {
1780 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1781}
1782
1783impl fidl::endpoints::ControlHandle for VirtioBlockControlHandle {
1784 fn shutdown(&self) {
1785 self.inner.shutdown()
1786 }
1787 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1788 self.inner.shutdown_with_epitaph(status)
1789 }
1790
1791 fn is_closed(&self) -> bool {
1792 self.inner.channel().is_closed()
1793 }
1794 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1795 self.inner.channel().on_closed()
1796 }
1797
1798 #[cfg(target_os = "fuchsia")]
1799 fn signal_peer(
1800 &self,
1801 clear_mask: zx::Signals,
1802 set_mask: zx::Signals,
1803 ) -> Result<(), zx_status::Status> {
1804 use fidl::Peered;
1805 self.inner.channel().signal_peer(clear_mask, set_mask)
1806 }
1807}
1808
1809impl VirtioBlockControlHandle {}
1810
1811#[must_use = "FIDL methods require a response to be sent"]
1812#[derive(Debug)]
1813pub struct VirtioBlockConfigureQueueResponder {
1814 control_handle: std::mem::ManuallyDrop<VirtioBlockControlHandle>,
1815 tx_id: u32,
1816}
1817
1818impl std::ops::Drop for VirtioBlockConfigureQueueResponder {
1822 fn drop(&mut self) {
1823 self.control_handle.shutdown();
1824 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1826 }
1827}
1828
1829impl fidl::endpoints::Responder for VirtioBlockConfigureQueueResponder {
1830 type ControlHandle = VirtioBlockControlHandle;
1831
1832 fn control_handle(&self) -> &VirtioBlockControlHandle {
1833 &self.control_handle
1834 }
1835
1836 fn drop_without_shutdown(mut self) {
1837 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1839 std::mem::forget(self);
1841 }
1842}
1843
1844impl VirtioBlockConfigureQueueResponder {
1845 pub fn send(self) -> Result<(), fidl::Error> {
1849 let _result = self.send_raw();
1850 if _result.is_err() {
1851 self.control_handle.shutdown();
1852 }
1853 self.drop_without_shutdown();
1854 _result
1855 }
1856
1857 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1859 let _result = self.send_raw();
1860 self.drop_without_shutdown();
1861 _result
1862 }
1863
1864 fn send_raw(&self) -> Result<(), fidl::Error> {
1865 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1866 (),
1867 self.tx_id,
1868 0x72b44fb963480b11,
1869 fidl::encoding::DynamicFlags::empty(),
1870 )
1871 }
1872}
1873
1874#[must_use = "FIDL methods require a response to be sent"]
1875#[derive(Debug)]
1876pub struct VirtioBlockReadyResponder {
1877 control_handle: std::mem::ManuallyDrop<VirtioBlockControlHandle>,
1878 tx_id: u32,
1879}
1880
1881impl std::ops::Drop for VirtioBlockReadyResponder {
1885 fn drop(&mut self) {
1886 self.control_handle.shutdown();
1887 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1889 }
1890}
1891
1892impl fidl::endpoints::Responder for VirtioBlockReadyResponder {
1893 type ControlHandle = VirtioBlockControlHandle;
1894
1895 fn control_handle(&self) -> &VirtioBlockControlHandle {
1896 &self.control_handle
1897 }
1898
1899 fn drop_without_shutdown(mut self) {
1900 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1902 std::mem::forget(self);
1904 }
1905}
1906
1907impl VirtioBlockReadyResponder {
1908 pub fn send(self) -> Result<(), fidl::Error> {
1912 let _result = self.send_raw();
1913 if _result.is_err() {
1914 self.control_handle.shutdown();
1915 }
1916 self.drop_without_shutdown();
1917 _result
1918 }
1919
1920 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1922 let _result = self.send_raw();
1923 self.drop_without_shutdown();
1924 _result
1925 }
1926
1927 fn send_raw(&self) -> Result<(), fidl::Error> {
1928 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1929 (),
1930 self.tx_id,
1931 0x45707654f5d23c3f,
1932 fidl::encoding::DynamicFlags::empty(),
1933 )
1934 }
1935}
1936
1937#[must_use = "FIDL methods require a response to be sent"]
1938#[derive(Debug)]
1939pub struct VirtioBlockStartResponder {
1940 control_handle: std::mem::ManuallyDrop<VirtioBlockControlHandle>,
1941 tx_id: u32,
1942}
1943
1944impl std::ops::Drop for VirtioBlockStartResponder {
1948 fn drop(&mut self) {
1949 self.control_handle.shutdown();
1950 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1952 }
1953}
1954
1955impl fidl::endpoints::Responder for VirtioBlockStartResponder {
1956 type ControlHandle = VirtioBlockControlHandle;
1957
1958 fn control_handle(&self) -> &VirtioBlockControlHandle {
1959 &self.control_handle
1960 }
1961
1962 fn drop_without_shutdown(mut self) {
1963 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1965 std::mem::forget(self);
1967 }
1968}
1969
1970impl VirtioBlockStartResponder {
1971 pub fn send(self, mut capacity: u64, mut block_size: u32) -> Result<(), fidl::Error> {
1975 let _result = self.send_raw(capacity, block_size);
1976 if _result.is_err() {
1977 self.control_handle.shutdown();
1978 }
1979 self.drop_without_shutdown();
1980 _result
1981 }
1982
1983 pub fn send_no_shutdown_on_err(
1985 self,
1986 mut capacity: u64,
1987 mut block_size: u32,
1988 ) -> Result<(), fidl::Error> {
1989 let _result = self.send_raw(capacity, block_size);
1990 self.drop_without_shutdown();
1991 _result
1992 }
1993
1994 fn send_raw(&self, mut capacity: u64, mut block_size: u32) -> Result<(), fidl::Error> {
1995 self.control_handle.inner.send::<VirtioBlockStartResponse>(
1996 (capacity, block_size),
1997 self.tx_id,
1998 0x5ef6a4b9ce9adcb2,
1999 fidl::encoding::DynamicFlags::empty(),
2000 )
2001 }
2002}
2003
2004#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2005pub struct VirtioConsoleMarker;
2006
2007impl fidl::endpoints::ProtocolMarker for VirtioConsoleMarker {
2008 type Proxy = VirtioConsoleProxy;
2009 type RequestStream = VirtioConsoleRequestStream;
2010 #[cfg(target_os = "fuchsia")]
2011 type SynchronousProxy = VirtioConsoleSynchronousProxy;
2012
2013 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioConsole";
2014}
2015impl fidl::endpoints::DiscoverableProtocolMarker for VirtioConsoleMarker {}
2016
2017pub trait VirtioConsoleProxyInterface: Send + Sync {
2018 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2019 fn r#configure_queue(
2020 &self,
2021 queue: u16,
2022 size: u16,
2023 desc: u64,
2024 avail: u64,
2025 used: u64,
2026 ) -> Self::ConfigureQueueResponseFut;
2027 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
2028 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2029 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
2030 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2031 fn r#start(&self, start_info: StartInfo, socket: fidl::Socket) -> Self::StartResponseFut;
2032}
2033#[derive(Debug)]
2034#[cfg(target_os = "fuchsia")]
2035pub struct VirtioConsoleSynchronousProxy {
2036 client: fidl::client::sync::Client,
2037}
2038
2039#[cfg(target_os = "fuchsia")]
2040impl fidl::endpoints::SynchronousProxy for VirtioConsoleSynchronousProxy {
2041 type Proxy = VirtioConsoleProxy;
2042 type Protocol = VirtioConsoleMarker;
2043
2044 fn from_channel(inner: fidl::Channel) -> Self {
2045 Self::new(inner)
2046 }
2047
2048 fn into_channel(self) -> fidl::Channel {
2049 self.client.into_channel()
2050 }
2051
2052 fn as_channel(&self) -> &fidl::Channel {
2053 self.client.as_channel()
2054 }
2055}
2056
2057#[cfg(target_os = "fuchsia")]
2058impl VirtioConsoleSynchronousProxy {
2059 pub fn new(channel: fidl::Channel) -> Self {
2060 let protocol_name = <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2061 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2062 }
2063
2064 pub fn into_channel(self) -> fidl::Channel {
2065 self.client.into_channel()
2066 }
2067
2068 pub fn wait_for_event(
2071 &self,
2072 deadline: zx::MonotonicInstant,
2073 ) -> Result<VirtioConsoleEvent, fidl::Error> {
2074 VirtioConsoleEvent::decode(self.client.wait_for_event(deadline)?)
2075 }
2076
2077 pub fn r#configure_queue(
2080 &self,
2081 mut queue: u16,
2082 mut size: u16,
2083 mut desc: u64,
2084 mut avail: u64,
2085 mut used: u64,
2086 ___deadline: zx::MonotonicInstant,
2087 ) -> Result<(), fidl::Error> {
2088 let _response = self
2089 .client
2090 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
2091 (queue, size, desc, avail, used),
2092 0x72b44fb963480b11,
2093 fidl::encoding::DynamicFlags::empty(),
2094 ___deadline,
2095 )?;
2096 Ok(_response)
2097 }
2098
2099 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
2101 self.client.send::<VirtioDeviceNotifyQueueRequest>(
2102 (queue,),
2103 0x6e3a61d652499244,
2104 fidl::encoding::DynamicFlags::empty(),
2105 )
2106 }
2107
2108 pub fn r#ready(
2111 &self,
2112 mut negotiated_features: u32,
2113 ___deadline: zx::MonotonicInstant,
2114 ) -> Result<(), fidl::Error> {
2115 let _response =
2116 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
2117 (negotiated_features,),
2118 0x45707654f5d23c3f,
2119 fidl::encoding::DynamicFlags::empty(),
2120 ___deadline,
2121 )?;
2122 Ok(_response)
2123 }
2124
2125 pub fn r#start(
2127 &self,
2128 mut start_info: StartInfo,
2129 mut socket: fidl::Socket,
2130 ___deadline: zx::MonotonicInstant,
2131 ) -> Result<(), fidl::Error> {
2132 let _response =
2133 self.client.send_query::<VirtioConsoleStartRequest, fidl::encoding::EmptyPayload>(
2134 (&mut start_info, socket),
2135 0x10a6267f2ab7e24c,
2136 fidl::encoding::DynamicFlags::empty(),
2137 ___deadline,
2138 )?;
2139 Ok(_response)
2140 }
2141}
2142
2143#[cfg(target_os = "fuchsia")]
2144impl From<VirtioConsoleSynchronousProxy> for zx::Handle {
2145 fn from(value: VirtioConsoleSynchronousProxy) -> Self {
2146 value.into_channel().into()
2147 }
2148}
2149
2150#[cfg(target_os = "fuchsia")]
2151impl From<fidl::Channel> for VirtioConsoleSynchronousProxy {
2152 fn from(value: fidl::Channel) -> Self {
2153 Self::new(value)
2154 }
2155}
2156
2157#[derive(Debug, Clone)]
2158pub struct VirtioConsoleProxy {
2159 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2160}
2161
2162impl fidl::endpoints::Proxy for VirtioConsoleProxy {
2163 type Protocol = VirtioConsoleMarker;
2164
2165 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2166 Self::new(inner)
2167 }
2168
2169 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2170 self.client.into_channel().map_err(|client| Self { client })
2171 }
2172
2173 fn as_channel(&self) -> &::fidl::AsyncChannel {
2174 self.client.as_channel()
2175 }
2176}
2177
2178impl VirtioConsoleProxy {
2179 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2181 let protocol_name = <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2182 Self { client: fidl::client::Client::new(channel, protocol_name) }
2183 }
2184
2185 pub fn take_event_stream(&self) -> VirtioConsoleEventStream {
2191 VirtioConsoleEventStream { event_receiver: self.client.take_event_receiver() }
2192 }
2193
2194 pub fn r#configure_queue(
2197 &self,
2198 mut queue: u16,
2199 mut size: u16,
2200 mut desc: u64,
2201 mut avail: u64,
2202 mut used: u64,
2203 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2204 VirtioConsoleProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
2205 }
2206
2207 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
2209 VirtioConsoleProxyInterface::r#notify_queue(self, queue)
2210 }
2211
2212 pub fn r#ready(
2215 &self,
2216 mut negotiated_features: u32,
2217 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2218 VirtioConsoleProxyInterface::r#ready(self, negotiated_features)
2219 }
2220
2221 pub fn r#start(
2223 &self,
2224 mut start_info: StartInfo,
2225 mut socket: fidl::Socket,
2226 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2227 VirtioConsoleProxyInterface::r#start(self, start_info, socket)
2228 }
2229}
2230
2231impl VirtioConsoleProxyInterface for VirtioConsoleProxy {
2232 type ConfigureQueueResponseFut =
2233 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2234 fn r#configure_queue(
2235 &self,
2236 mut queue: u16,
2237 mut size: u16,
2238 mut desc: u64,
2239 mut avail: u64,
2240 mut used: u64,
2241 ) -> Self::ConfigureQueueResponseFut {
2242 fn _decode(
2243 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2244 ) -> Result<(), fidl::Error> {
2245 let _response = fidl::client::decode_transaction_body::<
2246 fidl::encoding::EmptyPayload,
2247 fidl::encoding::DefaultFuchsiaResourceDialect,
2248 0x72b44fb963480b11,
2249 >(_buf?)?;
2250 Ok(_response)
2251 }
2252 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
2253 (queue, size, desc, avail, used),
2254 0x72b44fb963480b11,
2255 fidl::encoding::DynamicFlags::empty(),
2256 _decode,
2257 )
2258 }
2259
2260 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
2261 self.client.send::<VirtioDeviceNotifyQueueRequest>(
2262 (queue,),
2263 0x6e3a61d652499244,
2264 fidl::encoding::DynamicFlags::empty(),
2265 )
2266 }
2267
2268 type ReadyResponseFut =
2269 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2270 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
2271 fn _decode(
2272 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2273 ) -> Result<(), fidl::Error> {
2274 let _response = fidl::client::decode_transaction_body::<
2275 fidl::encoding::EmptyPayload,
2276 fidl::encoding::DefaultFuchsiaResourceDialect,
2277 0x45707654f5d23c3f,
2278 >(_buf?)?;
2279 Ok(_response)
2280 }
2281 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
2282 (negotiated_features,),
2283 0x45707654f5d23c3f,
2284 fidl::encoding::DynamicFlags::empty(),
2285 _decode,
2286 )
2287 }
2288
2289 type StartResponseFut =
2290 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2291 fn r#start(
2292 &self,
2293 mut start_info: StartInfo,
2294 mut socket: fidl::Socket,
2295 ) -> Self::StartResponseFut {
2296 fn _decode(
2297 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2298 ) -> Result<(), fidl::Error> {
2299 let _response = fidl::client::decode_transaction_body::<
2300 fidl::encoding::EmptyPayload,
2301 fidl::encoding::DefaultFuchsiaResourceDialect,
2302 0x10a6267f2ab7e24c,
2303 >(_buf?)?;
2304 Ok(_response)
2305 }
2306 self.client.send_query_and_decode::<VirtioConsoleStartRequest, ()>(
2307 (&mut start_info, socket),
2308 0x10a6267f2ab7e24c,
2309 fidl::encoding::DynamicFlags::empty(),
2310 _decode,
2311 )
2312 }
2313}
2314
2315pub struct VirtioConsoleEventStream {
2316 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2317}
2318
2319impl std::marker::Unpin for VirtioConsoleEventStream {}
2320
2321impl futures::stream::FusedStream for VirtioConsoleEventStream {
2322 fn is_terminated(&self) -> bool {
2323 self.event_receiver.is_terminated()
2324 }
2325}
2326
2327impl futures::Stream for VirtioConsoleEventStream {
2328 type Item = Result<VirtioConsoleEvent, fidl::Error>;
2329
2330 fn poll_next(
2331 mut self: std::pin::Pin<&mut Self>,
2332 cx: &mut std::task::Context<'_>,
2333 ) -> std::task::Poll<Option<Self::Item>> {
2334 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2335 &mut self.event_receiver,
2336 cx
2337 )?) {
2338 Some(buf) => std::task::Poll::Ready(Some(VirtioConsoleEvent::decode(buf))),
2339 None => std::task::Poll::Ready(None),
2340 }
2341 }
2342}
2343
2344#[derive(Debug)]
2345pub enum VirtioConsoleEvent {}
2346
2347impl VirtioConsoleEvent {
2348 fn decode(
2350 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2351 ) -> Result<VirtioConsoleEvent, fidl::Error> {
2352 let (bytes, _handles) = buf.split_mut();
2353 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2354 debug_assert_eq!(tx_header.tx_id, 0);
2355 match tx_header.ordinal {
2356 _ => Err(fidl::Error::UnknownOrdinal {
2357 ordinal: tx_header.ordinal,
2358 protocol_name: <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2359 }),
2360 }
2361 }
2362}
2363
2364pub struct VirtioConsoleRequestStream {
2366 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2367 is_terminated: bool,
2368}
2369
2370impl std::marker::Unpin for VirtioConsoleRequestStream {}
2371
2372impl futures::stream::FusedStream for VirtioConsoleRequestStream {
2373 fn is_terminated(&self) -> bool {
2374 self.is_terminated
2375 }
2376}
2377
2378impl fidl::endpoints::RequestStream for VirtioConsoleRequestStream {
2379 type Protocol = VirtioConsoleMarker;
2380 type ControlHandle = VirtioConsoleControlHandle;
2381
2382 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2383 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2384 }
2385
2386 fn control_handle(&self) -> Self::ControlHandle {
2387 VirtioConsoleControlHandle { inner: self.inner.clone() }
2388 }
2389
2390 fn into_inner(
2391 self,
2392 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2393 {
2394 (self.inner, self.is_terminated)
2395 }
2396
2397 fn from_inner(
2398 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2399 is_terminated: bool,
2400 ) -> Self {
2401 Self { inner, is_terminated }
2402 }
2403}
2404
2405impl futures::Stream for VirtioConsoleRequestStream {
2406 type Item = Result<VirtioConsoleRequest, fidl::Error>;
2407
2408 fn poll_next(
2409 mut self: std::pin::Pin<&mut Self>,
2410 cx: &mut std::task::Context<'_>,
2411 ) -> std::task::Poll<Option<Self::Item>> {
2412 let this = &mut *self;
2413 if this.inner.check_shutdown(cx) {
2414 this.is_terminated = true;
2415 return std::task::Poll::Ready(None);
2416 }
2417 if this.is_terminated {
2418 panic!("polled VirtioConsoleRequestStream after completion");
2419 }
2420 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2421 |bytes, handles| {
2422 match this.inner.channel().read_etc(cx, bytes, handles) {
2423 std::task::Poll::Ready(Ok(())) => {}
2424 std::task::Poll::Pending => return std::task::Poll::Pending,
2425 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2426 this.is_terminated = true;
2427 return std::task::Poll::Ready(None);
2428 }
2429 std::task::Poll::Ready(Err(e)) => {
2430 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2431 e.into(),
2432 ))))
2433 }
2434 }
2435
2436 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2438
2439 std::task::Poll::Ready(Some(match header.ordinal {
2440 0x72b44fb963480b11 => {
2441 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2442 let mut req = fidl::new_empty!(
2443 VirtioDeviceConfigureQueueRequest,
2444 fidl::encoding::DefaultFuchsiaResourceDialect
2445 );
2446 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
2447 let control_handle =
2448 VirtioConsoleControlHandle { inner: this.inner.clone() };
2449 Ok(VirtioConsoleRequest::ConfigureQueue {
2450 queue: req.queue,
2451 size: req.size,
2452 desc: req.desc,
2453 avail: req.avail,
2454 used: req.used,
2455
2456 responder: VirtioConsoleConfigureQueueResponder {
2457 control_handle: std::mem::ManuallyDrop::new(control_handle),
2458 tx_id: header.tx_id,
2459 },
2460 })
2461 }
2462 0x6e3a61d652499244 => {
2463 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2464 let mut req = fidl::new_empty!(
2465 VirtioDeviceNotifyQueueRequest,
2466 fidl::encoding::DefaultFuchsiaResourceDialect
2467 );
2468 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
2469 let control_handle =
2470 VirtioConsoleControlHandle { inner: this.inner.clone() };
2471 Ok(VirtioConsoleRequest::NotifyQueue { queue: req.queue, control_handle })
2472 }
2473 0x45707654f5d23c3f => {
2474 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2475 let mut req = fidl::new_empty!(
2476 VirtioDeviceReadyRequest,
2477 fidl::encoding::DefaultFuchsiaResourceDialect
2478 );
2479 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
2480 let control_handle =
2481 VirtioConsoleControlHandle { inner: this.inner.clone() };
2482 Ok(VirtioConsoleRequest::Ready {
2483 negotiated_features: req.negotiated_features,
2484
2485 responder: VirtioConsoleReadyResponder {
2486 control_handle: std::mem::ManuallyDrop::new(control_handle),
2487 tx_id: header.tx_id,
2488 },
2489 })
2490 }
2491 0x10a6267f2ab7e24c => {
2492 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2493 let mut req = fidl::new_empty!(
2494 VirtioConsoleStartRequest,
2495 fidl::encoding::DefaultFuchsiaResourceDialect
2496 );
2497 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioConsoleStartRequest>(&header, _body_bytes, handles, &mut req)?;
2498 let control_handle =
2499 VirtioConsoleControlHandle { inner: this.inner.clone() };
2500 Ok(VirtioConsoleRequest::Start {
2501 start_info: req.start_info,
2502 socket: req.socket,
2503
2504 responder: VirtioConsoleStartResponder {
2505 control_handle: std::mem::ManuallyDrop::new(control_handle),
2506 tx_id: header.tx_id,
2507 },
2508 })
2509 }
2510 _ => Err(fidl::Error::UnknownOrdinal {
2511 ordinal: header.ordinal,
2512 protocol_name:
2513 <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2514 }),
2515 }))
2516 },
2517 )
2518 }
2519}
2520
2521#[derive(Debug)]
2522pub enum VirtioConsoleRequest {
2523 ConfigureQueue {
2526 queue: u16,
2527 size: u16,
2528 desc: u64,
2529 avail: u64,
2530 used: u64,
2531 responder: VirtioConsoleConfigureQueueResponder,
2532 },
2533 NotifyQueue { queue: u16, control_handle: VirtioConsoleControlHandle },
2535 Ready { negotiated_features: u32, responder: VirtioConsoleReadyResponder },
2538 Start { start_info: StartInfo, socket: fidl::Socket, responder: VirtioConsoleStartResponder },
2540}
2541
2542impl VirtioConsoleRequest {
2543 #[allow(irrefutable_let_patterns)]
2544 pub fn into_configure_queue(
2545 self,
2546 ) -> Option<(u16, u16, u64, u64, u64, VirtioConsoleConfigureQueueResponder)> {
2547 if let VirtioConsoleRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
2548 self
2549 {
2550 Some((queue, size, desc, avail, used, responder))
2551 } else {
2552 None
2553 }
2554 }
2555
2556 #[allow(irrefutable_let_patterns)]
2557 pub fn into_notify_queue(self) -> Option<(u16, VirtioConsoleControlHandle)> {
2558 if let VirtioConsoleRequest::NotifyQueue { queue, control_handle } = self {
2559 Some((queue, control_handle))
2560 } else {
2561 None
2562 }
2563 }
2564
2565 #[allow(irrefutable_let_patterns)]
2566 pub fn into_ready(self) -> Option<(u32, VirtioConsoleReadyResponder)> {
2567 if let VirtioConsoleRequest::Ready { negotiated_features, responder } = self {
2568 Some((negotiated_features, responder))
2569 } else {
2570 None
2571 }
2572 }
2573
2574 #[allow(irrefutable_let_patterns)]
2575 pub fn into_start(self) -> Option<(StartInfo, fidl::Socket, VirtioConsoleStartResponder)> {
2576 if let VirtioConsoleRequest::Start { start_info, socket, responder } = self {
2577 Some((start_info, socket, responder))
2578 } else {
2579 None
2580 }
2581 }
2582
2583 pub fn method_name(&self) -> &'static str {
2585 match *self {
2586 VirtioConsoleRequest::ConfigureQueue { .. } => "configure_queue",
2587 VirtioConsoleRequest::NotifyQueue { .. } => "notify_queue",
2588 VirtioConsoleRequest::Ready { .. } => "ready",
2589 VirtioConsoleRequest::Start { .. } => "start",
2590 }
2591 }
2592}
2593
2594#[derive(Debug, Clone)]
2595pub struct VirtioConsoleControlHandle {
2596 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2597}
2598
2599impl fidl::endpoints::ControlHandle for VirtioConsoleControlHandle {
2600 fn shutdown(&self) {
2601 self.inner.shutdown()
2602 }
2603 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2604 self.inner.shutdown_with_epitaph(status)
2605 }
2606
2607 fn is_closed(&self) -> bool {
2608 self.inner.channel().is_closed()
2609 }
2610 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2611 self.inner.channel().on_closed()
2612 }
2613
2614 #[cfg(target_os = "fuchsia")]
2615 fn signal_peer(
2616 &self,
2617 clear_mask: zx::Signals,
2618 set_mask: zx::Signals,
2619 ) -> Result<(), zx_status::Status> {
2620 use fidl::Peered;
2621 self.inner.channel().signal_peer(clear_mask, set_mask)
2622 }
2623}
2624
2625impl VirtioConsoleControlHandle {}
2626
2627#[must_use = "FIDL methods require a response to be sent"]
2628#[derive(Debug)]
2629pub struct VirtioConsoleConfigureQueueResponder {
2630 control_handle: std::mem::ManuallyDrop<VirtioConsoleControlHandle>,
2631 tx_id: u32,
2632}
2633
2634impl std::ops::Drop for VirtioConsoleConfigureQueueResponder {
2638 fn drop(&mut self) {
2639 self.control_handle.shutdown();
2640 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2642 }
2643}
2644
2645impl fidl::endpoints::Responder for VirtioConsoleConfigureQueueResponder {
2646 type ControlHandle = VirtioConsoleControlHandle;
2647
2648 fn control_handle(&self) -> &VirtioConsoleControlHandle {
2649 &self.control_handle
2650 }
2651
2652 fn drop_without_shutdown(mut self) {
2653 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2655 std::mem::forget(self);
2657 }
2658}
2659
2660impl VirtioConsoleConfigureQueueResponder {
2661 pub fn send(self) -> Result<(), fidl::Error> {
2665 let _result = self.send_raw();
2666 if _result.is_err() {
2667 self.control_handle.shutdown();
2668 }
2669 self.drop_without_shutdown();
2670 _result
2671 }
2672
2673 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2675 let _result = self.send_raw();
2676 self.drop_without_shutdown();
2677 _result
2678 }
2679
2680 fn send_raw(&self) -> Result<(), fidl::Error> {
2681 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2682 (),
2683 self.tx_id,
2684 0x72b44fb963480b11,
2685 fidl::encoding::DynamicFlags::empty(),
2686 )
2687 }
2688}
2689
2690#[must_use = "FIDL methods require a response to be sent"]
2691#[derive(Debug)]
2692pub struct VirtioConsoleReadyResponder {
2693 control_handle: std::mem::ManuallyDrop<VirtioConsoleControlHandle>,
2694 tx_id: u32,
2695}
2696
2697impl std::ops::Drop for VirtioConsoleReadyResponder {
2701 fn drop(&mut self) {
2702 self.control_handle.shutdown();
2703 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2705 }
2706}
2707
2708impl fidl::endpoints::Responder for VirtioConsoleReadyResponder {
2709 type ControlHandle = VirtioConsoleControlHandle;
2710
2711 fn control_handle(&self) -> &VirtioConsoleControlHandle {
2712 &self.control_handle
2713 }
2714
2715 fn drop_without_shutdown(mut self) {
2716 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2718 std::mem::forget(self);
2720 }
2721}
2722
2723impl VirtioConsoleReadyResponder {
2724 pub fn send(self) -> Result<(), fidl::Error> {
2728 let _result = self.send_raw();
2729 if _result.is_err() {
2730 self.control_handle.shutdown();
2731 }
2732 self.drop_without_shutdown();
2733 _result
2734 }
2735
2736 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2738 let _result = self.send_raw();
2739 self.drop_without_shutdown();
2740 _result
2741 }
2742
2743 fn send_raw(&self) -> Result<(), fidl::Error> {
2744 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2745 (),
2746 self.tx_id,
2747 0x45707654f5d23c3f,
2748 fidl::encoding::DynamicFlags::empty(),
2749 )
2750 }
2751}
2752
2753#[must_use = "FIDL methods require a response to be sent"]
2754#[derive(Debug)]
2755pub struct VirtioConsoleStartResponder {
2756 control_handle: std::mem::ManuallyDrop<VirtioConsoleControlHandle>,
2757 tx_id: u32,
2758}
2759
2760impl std::ops::Drop for VirtioConsoleStartResponder {
2764 fn drop(&mut self) {
2765 self.control_handle.shutdown();
2766 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2768 }
2769}
2770
2771impl fidl::endpoints::Responder for VirtioConsoleStartResponder {
2772 type ControlHandle = VirtioConsoleControlHandle;
2773
2774 fn control_handle(&self) -> &VirtioConsoleControlHandle {
2775 &self.control_handle
2776 }
2777
2778 fn drop_without_shutdown(mut self) {
2779 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2781 std::mem::forget(self);
2783 }
2784}
2785
2786impl VirtioConsoleStartResponder {
2787 pub fn send(self) -> Result<(), fidl::Error> {
2791 let _result = self.send_raw();
2792 if _result.is_err() {
2793 self.control_handle.shutdown();
2794 }
2795 self.drop_without_shutdown();
2796 _result
2797 }
2798
2799 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2801 let _result = self.send_raw();
2802 self.drop_without_shutdown();
2803 _result
2804 }
2805
2806 fn send_raw(&self) -> Result<(), fidl::Error> {
2807 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2808 (),
2809 self.tx_id,
2810 0x10a6267f2ab7e24c,
2811 fidl::encoding::DynamicFlags::empty(),
2812 )
2813 }
2814}
2815
2816#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2817pub struct VirtioDeviceMarker;
2818
2819impl fidl::endpoints::ProtocolMarker for VirtioDeviceMarker {
2820 type Proxy = VirtioDeviceProxy;
2821 type RequestStream = VirtioDeviceRequestStream;
2822 #[cfg(target_os = "fuchsia")]
2823 type SynchronousProxy = VirtioDeviceSynchronousProxy;
2824
2825 const DEBUG_NAME: &'static str = "(anonymous) VirtioDevice";
2826}
2827
2828pub trait VirtioDeviceProxyInterface: Send + Sync {
2829 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2830 fn r#configure_queue(
2831 &self,
2832 queue: u16,
2833 size: u16,
2834 desc: u64,
2835 avail: u64,
2836 used: u64,
2837 ) -> Self::ConfigureQueueResponseFut;
2838 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
2839 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2840 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
2841}
2842#[derive(Debug)]
2843#[cfg(target_os = "fuchsia")]
2844pub struct VirtioDeviceSynchronousProxy {
2845 client: fidl::client::sync::Client,
2846}
2847
2848#[cfg(target_os = "fuchsia")]
2849impl fidl::endpoints::SynchronousProxy for VirtioDeviceSynchronousProxy {
2850 type Proxy = VirtioDeviceProxy;
2851 type Protocol = VirtioDeviceMarker;
2852
2853 fn from_channel(inner: fidl::Channel) -> Self {
2854 Self::new(inner)
2855 }
2856
2857 fn into_channel(self) -> fidl::Channel {
2858 self.client.into_channel()
2859 }
2860
2861 fn as_channel(&self) -> &fidl::Channel {
2862 self.client.as_channel()
2863 }
2864}
2865
2866#[cfg(target_os = "fuchsia")]
2867impl VirtioDeviceSynchronousProxy {
2868 pub fn new(channel: fidl::Channel) -> Self {
2869 let protocol_name = <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2870 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2871 }
2872
2873 pub fn into_channel(self) -> fidl::Channel {
2874 self.client.into_channel()
2875 }
2876
2877 pub fn wait_for_event(
2880 &self,
2881 deadline: zx::MonotonicInstant,
2882 ) -> Result<VirtioDeviceEvent, fidl::Error> {
2883 VirtioDeviceEvent::decode(self.client.wait_for_event(deadline)?)
2884 }
2885
2886 pub fn r#configure_queue(
2889 &self,
2890 mut queue: u16,
2891 mut size: u16,
2892 mut desc: u64,
2893 mut avail: u64,
2894 mut used: u64,
2895 ___deadline: zx::MonotonicInstant,
2896 ) -> Result<(), fidl::Error> {
2897 let _response = self
2898 .client
2899 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
2900 (queue, size, desc, avail, used),
2901 0x72b44fb963480b11,
2902 fidl::encoding::DynamicFlags::empty(),
2903 ___deadline,
2904 )?;
2905 Ok(_response)
2906 }
2907
2908 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
2910 self.client.send::<VirtioDeviceNotifyQueueRequest>(
2911 (queue,),
2912 0x6e3a61d652499244,
2913 fidl::encoding::DynamicFlags::empty(),
2914 )
2915 }
2916
2917 pub fn r#ready(
2920 &self,
2921 mut negotiated_features: u32,
2922 ___deadline: zx::MonotonicInstant,
2923 ) -> Result<(), fidl::Error> {
2924 let _response =
2925 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
2926 (negotiated_features,),
2927 0x45707654f5d23c3f,
2928 fidl::encoding::DynamicFlags::empty(),
2929 ___deadline,
2930 )?;
2931 Ok(_response)
2932 }
2933}
2934
2935#[cfg(target_os = "fuchsia")]
2936impl From<VirtioDeviceSynchronousProxy> for zx::Handle {
2937 fn from(value: VirtioDeviceSynchronousProxy) -> Self {
2938 value.into_channel().into()
2939 }
2940}
2941
2942#[cfg(target_os = "fuchsia")]
2943impl From<fidl::Channel> for VirtioDeviceSynchronousProxy {
2944 fn from(value: fidl::Channel) -> Self {
2945 Self::new(value)
2946 }
2947}
2948
2949#[derive(Debug, Clone)]
2950pub struct VirtioDeviceProxy {
2951 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2952}
2953
2954impl fidl::endpoints::Proxy for VirtioDeviceProxy {
2955 type Protocol = VirtioDeviceMarker;
2956
2957 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2958 Self::new(inner)
2959 }
2960
2961 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2962 self.client.into_channel().map_err(|client| Self { client })
2963 }
2964
2965 fn as_channel(&self) -> &::fidl::AsyncChannel {
2966 self.client.as_channel()
2967 }
2968}
2969
2970impl VirtioDeviceProxy {
2971 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2973 let protocol_name = <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2974 Self { client: fidl::client::Client::new(channel, protocol_name) }
2975 }
2976
2977 pub fn take_event_stream(&self) -> VirtioDeviceEventStream {
2983 VirtioDeviceEventStream { event_receiver: self.client.take_event_receiver() }
2984 }
2985
2986 pub fn r#configure_queue(
2989 &self,
2990 mut queue: u16,
2991 mut size: u16,
2992 mut desc: u64,
2993 mut avail: u64,
2994 mut used: u64,
2995 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2996 VirtioDeviceProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
2997 }
2998
2999 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
3001 VirtioDeviceProxyInterface::r#notify_queue(self, queue)
3002 }
3003
3004 pub fn r#ready(
3007 &self,
3008 mut negotiated_features: u32,
3009 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3010 VirtioDeviceProxyInterface::r#ready(self, negotiated_features)
3011 }
3012}
3013
3014impl VirtioDeviceProxyInterface for VirtioDeviceProxy {
3015 type ConfigureQueueResponseFut =
3016 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3017 fn r#configure_queue(
3018 &self,
3019 mut queue: u16,
3020 mut size: u16,
3021 mut desc: u64,
3022 mut avail: u64,
3023 mut used: u64,
3024 ) -> Self::ConfigureQueueResponseFut {
3025 fn _decode(
3026 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3027 ) -> Result<(), fidl::Error> {
3028 let _response = fidl::client::decode_transaction_body::<
3029 fidl::encoding::EmptyPayload,
3030 fidl::encoding::DefaultFuchsiaResourceDialect,
3031 0x72b44fb963480b11,
3032 >(_buf?)?;
3033 Ok(_response)
3034 }
3035 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
3036 (queue, size, desc, avail, used),
3037 0x72b44fb963480b11,
3038 fidl::encoding::DynamicFlags::empty(),
3039 _decode,
3040 )
3041 }
3042
3043 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
3044 self.client.send::<VirtioDeviceNotifyQueueRequest>(
3045 (queue,),
3046 0x6e3a61d652499244,
3047 fidl::encoding::DynamicFlags::empty(),
3048 )
3049 }
3050
3051 type ReadyResponseFut =
3052 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3053 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
3054 fn _decode(
3055 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3056 ) -> Result<(), fidl::Error> {
3057 let _response = fidl::client::decode_transaction_body::<
3058 fidl::encoding::EmptyPayload,
3059 fidl::encoding::DefaultFuchsiaResourceDialect,
3060 0x45707654f5d23c3f,
3061 >(_buf?)?;
3062 Ok(_response)
3063 }
3064 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
3065 (negotiated_features,),
3066 0x45707654f5d23c3f,
3067 fidl::encoding::DynamicFlags::empty(),
3068 _decode,
3069 )
3070 }
3071}
3072
3073pub struct VirtioDeviceEventStream {
3074 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3075}
3076
3077impl std::marker::Unpin for VirtioDeviceEventStream {}
3078
3079impl futures::stream::FusedStream for VirtioDeviceEventStream {
3080 fn is_terminated(&self) -> bool {
3081 self.event_receiver.is_terminated()
3082 }
3083}
3084
3085impl futures::Stream for VirtioDeviceEventStream {
3086 type Item = Result<VirtioDeviceEvent, fidl::Error>;
3087
3088 fn poll_next(
3089 mut self: std::pin::Pin<&mut Self>,
3090 cx: &mut std::task::Context<'_>,
3091 ) -> std::task::Poll<Option<Self::Item>> {
3092 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3093 &mut self.event_receiver,
3094 cx
3095 )?) {
3096 Some(buf) => std::task::Poll::Ready(Some(VirtioDeviceEvent::decode(buf))),
3097 None => std::task::Poll::Ready(None),
3098 }
3099 }
3100}
3101
3102#[derive(Debug)]
3103pub enum VirtioDeviceEvent {}
3104
3105impl VirtioDeviceEvent {
3106 fn decode(
3108 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3109 ) -> Result<VirtioDeviceEvent, fidl::Error> {
3110 let (bytes, _handles) = buf.split_mut();
3111 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3112 debug_assert_eq!(tx_header.tx_id, 0);
3113 match tx_header.ordinal {
3114 _ => Err(fidl::Error::UnknownOrdinal {
3115 ordinal: tx_header.ordinal,
3116 protocol_name: <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3117 }),
3118 }
3119 }
3120}
3121
3122pub struct VirtioDeviceRequestStream {
3124 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3125 is_terminated: bool,
3126}
3127
3128impl std::marker::Unpin for VirtioDeviceRequestStream {}
3129
3130impl futures::stream::FusedStream for VirtioDeviceRequestStream {
3131 fn is_terminated(&self) -> bool {
3132 self.is_terminated
3133 }
3134}
3135
3136impl fidl::endpoints::RequestStream for VirtioDeviceRequestStream {
3137 type Protocol = VirtioDeviceMarker;
3138 type ControlHandle = VirtioDeviceControlHandle;
3139
3140 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3141 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3142 }
3143
3144 fn control_handle(&self) -> Self::ControlHandle {
3145 VirtioDeviceControlHandle { inner: self.inner.clone() }
3146 }
3147
3148 fn into_inner(
3149 self,
3150 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3151 {
3152 (self.inner, self.is_terminated)
3153 }
3154
3155 fn from_inner(
3156 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3157 is_terminated: bool,
3158 ) -> Self {
3159 Self { inner, is_terminated }
3160 }
3161}
3162
3163impl futures::Stream for VirtioDeviceRequestStream {
3164 type Item = Result<VirtioDeviceRequest, fidl::Error>;
3165
3166 fn poll_next(
3167 mut self: std::pin::Pin<&mut Self>,
3168 cx: &mut std::task::Context<'_>,
3169 ) -> std::task::Poll<Option<Self::Item>> {
3170 let this = &mut *self;
3171 if this.inner.check_shutdown(cx) {
3172 this.is_terminated = true;
3173 return std::task::Poll::Ready(None);
3174 }
3175 if this.is_terminated {
3176 panic!("polled VirtioDeviceRequestStream after completion");
3177 }
3178 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3179 |bytes, handles| {
3180 match this.inner.channel().read_etc(cx, bytes, handles) {
3181 std::task::Poll::Ready(Ok(())) => {}
3182 std::task::Poll::Pending => return std::task::Poll::Pending,
3183 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3184 this.is_terminated = true;
3185 return std::task::Poll::Ready(None);
3186 }
3187 std::task::Poll::Ready(Err(e)) => {
3188 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3189 e.into(),
3190 ))))
3191 }
3192 }
3193
3194 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3196
3197 std::task::Poll::Ready(Some(match header.ordinal {
3198 0x72b44fb963480b11 => {
3199 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3200 let mut req = fidl::new_empty!(
3201 VirtioDeviceConfigureQueueRequest,
3202 fidl::encoding::DefaultFuchsiaResourceDialect
3203 );
3204 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
3205 let control_handle =
3206 VirtioDeviceControlHandle { inner: this.inner.clone() };
3207 Ok(VirtioDeviceRequest::ConfigureQueue {
3208 queue: req.queue,
3209 size: req.size,
3210 desc: req.desc,
3211 avail: req.avail,
3212 used: req.used,
3213
3214 responder: VirtioDeviceConfigureQueueResponder {
3215 control_handle: std::mem::ManuallyDrop::new(control_handle),
3216 tx_id: header.tx_id,
3217 },
3218 })
3219 }
3220 0x6e3a61d652499244 => {
3221 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3222 let mut req = fidl::new_empty!(
3223 VirtioDeviceNotifyQueueRequest,
3224 fidl::encoding::DefaultFuchsiaResourceDialect
3225 );
3226 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
3227 let control_handle =
3228 VirtioDeviceControlHandle { inner: this.inner.clone() };
3229 Ok(VirtioDeviceRequest::NotifyQueue { queue: req.queue, control_handle })
3230 }
3231 0x45707654f5d23c3f => {
3232 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3233 let mut req = fidl::new_empty!(
3234 VirtioDeviceReadyRequest,
3235 fidl::encoding::DefaultFuchsiaResourceDialect
3236 );
3237 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
3238 let control_handle =
3239 VirtioDeviceControlHandle { inner: this.inner.clone() };
3240 Ok(VirtioDeviceRequest::Ready {
3241 negotiated_features: req.negotiated_features,
3242
3243 responder: VirtioDeviceReadyResponder {
3244 control_handle: std::mem::ManuallyDrop::new(control_handle),
3245 tx_id: header.tx_id,
3246 },
3247 })
3248 }
3249 _ => Err(fidl::Error::UnknownOrdinal {
3250 ordinal: header.ordinal,
3251 protocol_name:
3252 <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3253 }),
3254 }))
3255 },
3256 )
3257 }
3258}
3259
3260#[derive(Debug)]
3261pub enum VirtioDeviceRequest {
3262 ConfigureQueue {
3265 queue: u16,
3266 size: u16,
3267 desc: u64,
3268 avail: u64,
3269 used: u64,
3270 responder: VirtioDeviceConfigureQueueResponder,
3271 },
3272 NotifyQueue { queue: u16, control_handle: VirtioDeviceControlHandle },
3274 Ready { negotiated_features: u32, responder: VirtioDeviceReadyResponder },
3277}
3278
3279impl VirtioDeviceRequest {
3280 #[allow(irrefutable_let_patterns)]
3281 pub fn into_configure_queue(
3282 self,
3283 ) -> Option<(u16, u16, u64, u64, u64, VirtioDeviceConfigureQueueResponder)> {
3284 if let VirtioDeviceRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
3285 self
3286 {
3287 Some((queue, size, desc, avail, used, responder))
3288 } else {
3289 None
3290 }
3291 }
3292
3293 #[allow(irrefutable_let_patterns)]
3294 pub fn into_notify_queue(self) -> Option<(u16, VirtioDeviceControlHandle)> {
3295 if let VirtioDeviceRequest::NotifyQueue { queue, control_handle } = self {
3296 Some((queue, control_handle))
3297 } else {
3298 None
3299 }
3300 }
3301
3302 #[allow(irrefutable_let_patterns)]
3303 pub fn into_ready(self) -> Option<(u32, VirtioDeviceReadyResponder)> {
3304 if let VirtioDeviceRequest::Ready { negotiated_features, responder } = self {
3305 Some((negotiated_features, responder))
3306 } else {
3307 None
3308 }
3309 }
3310
3311 pub fn method_name(&self) -> &'static str {
3313 match *self {
3314 VirtioDeviceRequest::ConfigureQueue { .. } => "configure_queue",
3315 VirtioDeviceRequest::NotifyQueue { .. } => "notify_queue",
3316 VirtioDeviceRequest::Ready { .. } => "ready",
3317 }
3318 }
3319}
3320
3321#[derive(Debug, Clone)]
3322pub struct VirtioDeviceControlHandle {
3323 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3324}
3325
3326impl fidl::endpoints::ControlHandle for VirtioDeviceControlHandle {
3327 fn shutdown(&self) {
3328 self.inner.shutdown()
3329 }
3330 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3331 self.inner.shutdown_with_epitaph(status)
3332 }
3333
3334 fn is_closed(&self) -> bool {
3335 self.inner.channel().is_closed()
3336 }
3337 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3338 self.inner.channel().on_closed()
3339 }
3340
3341 #[cfg(target_os = "fuchsia")]
3342 fn signal_peer(
3343 &self,
3344 clear_mask: zx::Signals,
3345 set_mask: zx::Signals,
3346 ) -> Result<(), zx_status::Status> {
3347 use fidl::Peered;
3348 self.inner.channel().signal_peer(clear_mask, set_mask)
3349 }
3350}
3351
3352impl VirtioDeviceControlHandle {}
3353
3354#[must_use = "FIDL methods require a response to be sent"]
3355#[derive(Debug)]
3356pub struct VirtioDeviceConfigureQueueResponder {
3357 control_handle: std::mem::ManuallyDrop<VirtioDeviceControlHandle>,
3358 tx_id: u32,
3359}
3360
3361impl std::ops::Drop for VirtioDeviceConfigureQueueResponder {
3365 fn drop(&mut self) {
3366 self.control_handle.shutdown();
3367 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3369 }
3370}
3371
3372impl fidl::endpoints::Responder for VirtioDeviceConfigureQueueResponder {
3373 type ControlHandle = VirtioDeviceControlHandle;
3374
3375 fn control_handle(&self) -> &VirtioDeviceControlHandle {
3376 &self.control_handle
3377 }
3378
3379 fn drop_without_shutdown(mut self) {
3380 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3382 std::mem::forget(self);
3384 }
3385}
3386
3387impl VirtioDeviceConfigureQueueResponder {
3388 pub fn send(self) -> Result<(), fidl::Error> {
3392 let _result = self.send_raw();
3393 if _result.is_err() {
3394 self.control_handle.shutdown();
3395 }
3396 self.drop_without_shutdown();
3397 _result
3398 }
3399
3400 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3402 let _result = self.send_raw();
3403 self.drop_without_shutdown();
3404 _result
3405 }
3406
3407 fn send_raw(&self) -> Result<(), fidl::Error> {
3408 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3409 (),
3410 self.tx_id,
3411 0x72b44fb963480b11,
3412 fidl::encoding::DynamicFlags::empty(),
3413 )
3414 }
3415}
3416
3417#[must_use = "FIDL methods require a response to be sent"]
3418#[derive(Debug)]
3419pub struct VirtioDeviceReadyResponder {
3420 control_handle: std::mem::ManuallyDrop<VirtioDeviceControlHandle>,
3421 tx_id: u32,
3422}
3423
3424impl std::ops::Drop for VirtioDeviceReadyResponder {
3428 fn drop(&mut self) {
3429 self.control_handle.shutdown();
3430 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3432 }
3433}
3434
3435impl fidl::endpoints::Responder for VirtioDeviceReadyResponder {
3436 type ControlHandle = VirtioDeviceControlHandle;
3437
3438 fn control_handle(&self) -> &VirtioDeviceControlHandle {
3439 &self.control_handle
3440 }
3441
3442 fn drop_without_shutdown(mut self) {
3443 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3445 std::mem::forget(self);
3447 }
3448}
3449
3450impl VirtioDeviceReadyResponder {
3451 pub fn send(self) -> Result<(), fidl::Error> {
3455 let _result = self.send_raw();
3456 if _result.is_err() {
3457 self.control_handle.shutdown();
3458 }
3459 self.drop_without_shutdown();
3460 _result
3461 }
3462
3463 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3465 let _result = self.send_raw();
3466 self.drop_without_shutdown();
3467 _result
3468 }
3469
3470 fn send_raw(&self) -> Result<(), fidl::Error> {
3471 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3472 (),
3473 self.tx_id,
3474 0x45707654f5d23c3f,
3475 fidl::encoding::DynamicFlags::empty(),
3476 )
3477 }
3478}
3479
3480#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3481pub struct VirtioGpuMarker;
3482
3483impl fidl::endpoints::ProtocolMarker for VirtioGpuMarker {
3484 type Proxy = VirtioGpuProxy;
3485 type RequestStream = VirtioGpuRequestStream;
3486 #[cfg(target_os = "fuchsia")]
3487 type SynchronousProxy = VirtioGpuSynchronousProxy;
3488
3489 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioGpu";
3490}
3491impl fidl::endpoints::DiscoverableProtocolMarker for VirtioGpuMarker {}
3492
3493pub trait VirtioGpuProxyInterface: Send + Sync {
3494 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3495 fn r#configure_queue(
3496 &self,
3497 queue: u16,
3498 size: u16,
3499 desc: u64,
3500 avail: u64,
3501 used: u64,
3502 ) -> Self::ConfigureQueueResponseFut;
3503 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
3504 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3505 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
3506 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3507 fn r#start(
3508 &self,
3509 start_info: StartInfo,
3510 keyboard_listener: Option<
3511 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
3512 >,
3513 mouse_source: Option<
3514 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
3515 >,
3516 ) -> Self::StartResponseFut;
3517}
3518#[derive(Debug)]
3519#[cfg(target_os = "fuchsia")]
3520pub struct VirtioGpuSynchronousProxy {
3521 client: fidl::client::sync::Client,
3522}
3523
3524#[cfg(target_os = "fuchsia")]
3525impl fidl::endpoints::SynchronousProxy for VirtioGpuSynchronousProxy {
3526 type Proxy = VirtioGpuProxy;
3527 type Protocol = VirtioGpuMarker;
3528
3529 fn from_channel(inner: fidl::Channel) -> Self {
3530 Self::new(inner)
3531 }
3532
3533 fn into_channel(self) -> fidl::Channel {
3534 self.client.into_channel()
3535 }
3536
3537 fn as_channel(&self) -> &fidl::Channel {
3538 self.client.as_channel()
3539 }
3540}
3541
3542#[cfg(target_os = "fuchsia")]
3543impl VirtioGpuSynchronousProxy {
3544 pub fn new(channel: fidl::Channel) -> Self {
3545 let protocol_name = <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3546 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3547 }
3548
3549 pub fn into_channel(self) -> fidl::Channel {
3550 self.client.into_channel()
3551 }
3552
3553 pub fn wait_for_event(
3556 &self,
3557 deadline: zx::MonotonicInstant,
3558 ) -> Result<VirtioGpuEvent, fidl::Error> {
3559 VirtioGpuEvent::decode(self.client.wait_for_event(deadline)?)
3560 }
3561
3562 pub fn r#configure_queue(
3565 &self,
3566 mut queue: u16,
3567 mut size: u16,
3568 mut desc: u64,
3569 mut avail: u64,
3570 mut used: u64,
3571 ___deadline: zx::MonotonicInstant,
3572 ) -> Result<(), fidl::Error> {
3573 let _response = self
3574 .client
3575 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
3576 (queue, size, desc, avail, used),
3577 0x72b44fb963480b11,
3578 fidl::encoding::DynamicFlags::empty(),
3579 ___deadline,
3580 )?;
3581 Ok(_response)
3582 }
3583
3584 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
3586 self.client.send::<VirtioDeviceNotifyQueueRequest>(
3587 (queue,),
3588 0x6e3a61d652499244,
3589 fidl::encoding::DynamicFlags::empty(),
3590 )
3591 }
3592
3593 pub fn r#ready(
3596 &self,
3597 mut negotiated_features: u32,
3598 ___deadline: zx::MonotonicInstant,
3599 ) -> Result<(), fidl::Error> {
3600 let _response =
3601 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
3602 (negotiated_features,),
3603 0x45707654f5d23c3f,
3604 fidl::encoding::DynamicFlags::empty(),
3605 ___deadline,
3606 )?;
3607 Ok(_response)
3608 }
3609
3610 pub fn r#start(
3612 &self,
3613 mut start_info: StartInfo,
3614 mut keyboard_listener: Option<
3615 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
3616 >,
3617 mut mouse_source: Option<
3618 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
3619 >,
3620 ___deadline: zx::MonotonicInstant,
3621 ) -> Result<(), fidl::Error> {
3622 let _response =
3623 self.client.send_query::<VirtioGpuStartRequest, fidl::encoding::EmptyPayload>(
3624 (&mut start_info, keyboard_listener, mouse_source),
3625 0x7e81ed410f770c14,
3626 fidl::encoding::DynamicFlags::empty(),
3627 ___deadline,
3628 )?;
3629 Ok(_response)
3630 }
3631}
3632
3633#[cfg(target_os = "fuchsia")]
3634impl From<VirtioGpuSynchronousProxy> for zx::Handle {
3635 fn from(value: VirtioGpuSynchronousProxy) -> Self {
3636 value.into_channel().into()
3637 }
3638}
3639
3640#[cfg(target_os = "fuchsia")]
3641impl From<fidl::Channel> for VirtioGpuSynchronousProxy {
3642 fn from(value: fidl::Channel) -> Self {
3643 Self::new(value)
3644 }
3645}
3646
3647#[derive(Debug, Clone)]
3648pub struct VirtioGpuProxy {
3649 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3650}
3651
3652impl fidl::endpoints::Proxy for VirtioGpuProxy {
3653 type Protocol = VirtioGpuMarker;
3654
3655 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3656 Self::new(inner)
3657 }
3658
3659 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3660 self.client.into_channel().map_err(|client| Self { client })
3661 }
3662
3663 fn as_channel(&self) -> &::fidl::AsyncChannel {
3664 self.client.as_channel()
3665 }
3666}
3667
3668impl VirtioGpuProxy {
3669 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3671 let protocol_name = <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3672 Self { client: fidl::client::Client::new(channel, protocol_name) }
3673 }
3674
3675 pub fn take_event_stream(&self) -> VirtioGpuEventStream {
3681 VirtioGpuEventStream { event_receiver: self.client.take_event_receiver() }
3682 }
3683
3684 pub fn r#configure_queue(
3687 &self,
3688 mut queue: u16,
3689 mut size: u16,
3690 mut desc: u64,
3691 mut avail: u64,
3692 mut used: u64,
3693 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3694 VirtioGpuProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
3695 }
3696
3697 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
3699 VirtioGpuProxyInterface::r#notify_queue(self, queue)
3700 }
3701
3702 pub fn r#ready(
3705 &self,
3706 mut negotiated_features: u32,
3707 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3708 VirtioGpuProxyInterface::r#ready(self, negotiated_features)
3709 }
3710
3711 pub fn r#start(
3713 &self,
3714 mut start_info: StartInfo,
3715 mut keyboard_listener: Option<
3716 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
3717 >,
3718 mut mouse_source: Option<
3719 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
3720 >,
3721 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3722 VirtioGpuProxyInterface::r#start(self, start_info, keyboard_listener, mouse_source)
3723 }
3724}
3725
3726impl VirtioGpuProxyInterface for VirtioGpuProxy {
3727 type ConfigureQueueResponseFut =
3728 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3729 fn r#configure_queue(
3730 &self,
3731 mut queue: u16,
3732 mut size: u16,
3733 mut desc: u64,
3734 mut avail: u64,
3735 mut used: u64,
3736 ) -> Self::ConfigureQueueResponseFut {
3737 fn _decode(
3738 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3739 ) -> Result<(), fidl::Error> {
3740 let _response = fidl::client::decode_transaction_body::<
3741 fidl::encoding::EmptyPayload,
3742 fidl::encoding::DefaultFuchsiaResourceDialect,
3743 0x72b44fb963480b11,
3744 >(_buf?)?;
3745 Ok(_response)
3746 }
3747 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
3748 (queue, size, desc, avail, used),
3749 0x72b44fb963480b11,
3750 fidl::encoding::DynamicFlags::empty(),
3751 _decode,
3752 )
3753 }
3754
3755 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
3756 self.client.send::<VirtioDeviceNotifyQueueRequest>(
3757 (queue,),
3758 0x6e3a61d652499244,
3759 fidl::encoding::DynamicFlags::empty(),
3760 )
3761 }
3762
3763 type ReadyResponseFut =
3764 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3765 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
3766 fn _decode(
3767 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3768 ) -> Result<(), fidl::Error> {
3769 let _response = fidl::client::decode_transaction_body::<
3770 fidl::encoding::EmptyPayload,
3771 fidl::encoding::DefaultFuchsiaResourceDialect,
3772 0x45707654f5d23c3f,
3773 >(_buf?)?;
3774 Ok(_response)
3775 }
3776 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
3777 (negotiated_features,),
3778 0x45707654f5d23c3f,
3779 fidl::encoding::DynamicFlags::empty(),
3780 _decode,
3781 )
3782 }
3783
3784 type StartResponseFut =
3785 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3786 fn r#start(
3787 &self,
3788 mut start_info: StartInfo,
3789 mut keyboard_listener: Option<
3790 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
3791 >,
3792 mut mouse_source: Option<
3793 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
3794 >,
3795 ) -> Self::StartResponseFut {
3796 fn _decode(
3797 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3798 ) -> Result<(), fidl::Error> {
3799 let _response = fidl::client::decode_transaction_body::<
3800 fidl::encoding::EmptyPayload,
3801 fidl::encoding::DefaultFuchsiaResourceDialect,
3802 0x7e81ed410f770c14,
3803 >(_buf?)?;
3804 Ok(_response)
3805 }
3806 self.client.send_query_and_decode::<VirtioGpuStartRequest, ()>(
3807 (&mut start_info, keyboard_listener, mouse_source),
3808 0x7e81ed410f770c14,
3809 fidl::encoding::DynamicFlags::empty(),
3810 _decode,
3811 )
3812 }
3813}
3814
3815pub struct VirtioGpuEventStream {
3816 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3817}
3818
3819impl std::marker::Unpin for VirtioGpuEventStream {}
3820
3821impl futures::stream::FusedStream for VirtioGpuEventStream {
3822 fn is_terminated(&self) -> bool {
3823 self.event_receiver.is_terminated()
3824 }
3825}
3826
3827impl futures::Stream for VirtioGpuEventStream {
3828 type Item = Result<VirtioGpuEvent, fidl::Error>;
3829
3830 fn poll_next(
3831 mut self: std::pin::Pin<&mut Self>,
3832 cx: &mut std::task::Context<'_>,
3833 ) -> std::task::Poll<Option<Self::Item>> {
3834 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3835 &mut self.event_receiver,
3836 cx
3837 )?) {
3838 Some(buf) => std::task::Poll::Ready(Some(VirtioGpuEvent::decode(buf))),
3839 None => std::task::Poll::Ready(None),
3840 }
3841 }
3842}
3843
3844#[derive(Debug)]
3845pub enum VirtioGpuEvent {
3846 OnConfigChanged {},
3847}
3848
3849impl VirtioGpuEvent {
3850 #[allow(irrefutable_let_patterns)]
3851 pub fn into_on_config_changed(self) -> Option<()> {
3852 if let VirtioGpuEvent::OnConfigChanged {} = self {
3853 Some(())
3854 } else {
3855 None
3856 }
3857 }
3858
3859 fn decode(
3861 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3862 ) -> Result<VirtioGpuEvent, fidl::Error> {
3863 let (bytes, _handles) = buf.split_mut();
3864 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3865 debug_assert_eq!(tx_header.tx_id, 0);
3866 match tx_header.ordinal {
3867 0x1555f5b7c8444aa0 => {
3868 let mut out = fidl::new_empty!(
3869 fidl::encoding::EmptyPayload,
3870 fidl::encoding::DefaultFuchsiaResourceDialect
3871 );
3872 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
3873 Ok((VirtioGpuEvent::OnConfigChanged {}))
3874 }
3875 _ => Err(fidl::Error::UnknownOrdinal {
3876 ordinal: tx_header.ordinal,
3877 protocol_name: <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3878 }),
3879 }
3880 }
3881}
3882
3883pub struct VirtioGpuRequestStream {
3885 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3886 is_terminated: bool,
3887}
3888
3889impl std::marker::Unpin for VirtioGpuRequestStream {}
3890
3891impl futures::stream::FusedStream for VirtioGpuRequestStream {
3892 fn is_terminated(&self) -> bool {
3893 self.is_terminated
3894 }
3895}
3896
3897impl fidl::endpoints::RequestStream for VirtioGpuRequestStream {
3898 type Protocol = VirtioGpuMarker;
3899 type ControlHandle = VirtioGpuControlHandle;
3900
3901 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3902 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3903 }
3904
3905 fn control_handle(&self) -> Self::ControlHandle {
3906 VirtioGpuControlHandle { inner: self.inner.clone() }
3907 }
3908
3909 fn into_inner(
3910 self,
3911 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3912 {
3913 (self.inner, self.is_terminated)
3914 }
3915
3916 fn from_inner(
3917 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3918 is_terminated: bool,
3919 ) -> Self {
3920 Self { inner, is_terminated }
3921 }
3922}
3923
3924impl futures::Stream for VirtioGpuRequestStream {
3925 type Item = Result<VirtioGpuRequest, fidl::Error>;
3926
3927 fn poll_next(
3928 mut self: std::pin::Pin<&mut Self>,
3929 cx: &mut std::task::Context<'_>,
3930 ) -> std::task::Poll<Option<Self::Item>> {
3931 let this = &mut *self;
3932 if this.inner.check_shutdown(cx) {
3933 this.is_terminated = true;
3934 return std::task::Poll::Ready(None);
3935 }
3936 if this.is_terminated {
3937 panic!("polled VirtioGpuRequestStream after completion");
3938 }
3939 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3940 |bytes, handles| {
3941 match this.inner.channel().read_etc(cx, bytes, handles) {
3942 std::task::Poll::Ready(Ok(())) => {}
3943 std::task::Poll::Pending => return std::task::Poll::Pending,
3944 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3945 this.is_terminated = true;
3946 return std::task::Poll::Ready(None);
3947 }
3948 std::task::Poll::Ready(Err(e)) => {
3949 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3950 e.into(),
3951 ))))
3952 }
3953 }
3954
3955 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3957
3958 std::task::Poll::Ready(Some(match header.ordinal {
3959 0x72b44fb963480b11 => {
3960 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3961 let mut req = fidl::new_empty!(
3962 VirtioDeviceConfigureQueueRequest,
3963 fidl::encoding::DefaultFuchsiaResourceDialect
3964 );
3965 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
3966 let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
3967 Ok(VirtioGpuRequest::ConfigureQueue {
3968 queue: req.queue,
3969 size: req.size,
3970 desc: req.desc,
3971 avail: req.avail,
3972 used: req.used,
3973
3974 responder: VirtioGpuConfigureQueueResponder {
3975 control_handle: std::mem::ManuallyDrop::new(control_handle),
3976 tx_id: header.tx_id,
3977 },
3978 })
3979 }
3980 0x6e3a61d652499244 => {
3981 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3982 let mut req = fidl::new_empty!(
3983 VirtioDeviceNotifyQueueRequest,
3984 fidl::encoding::DefaultFuchsiaResourceDialect
3985 );
3986 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
3987 let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
3988 Ok(VirtioGpuRequest::NotifyQueue { queue: req.queue, control_handle })
3989 }
3990 0x45707654f5d23c3f => {
3991 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3992 let mut req = fidl::new_empty!(
3993 VirtioDeviceReadyRequest,
3994 fidl::encoding::DefaultFuchsiaResourceDialect
3995 );
3996 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
3997 let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
3998 Ok(VirtioGpuRequest::Ready {
3999 negotiated_features: req.negotiated_features,
4000
4001 responder: VirtioGpuReadyResponder {
4002 control_handle: std::mem::ManuallyDrop::new(control_handle),
4003 tx_id: header.tx_id,
4004 },
4005 })
4006 }
4007 0x7e81ed410f770c14 => {
4008 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4009 let mut req = fidl::new_empty!(
4010 VirtioGpuStartRequest,
4011 fidl::encoding::DefaultFuchsiaResourceDialect
4012 );
4013 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioGpuStartRequest>(&header, _body_bytes, handles, &mut req)?;
4014 let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
4015 Ok(VirtioGpuRequest::Start {
4016 start_info: req.start_info,
4017 keyboard_listener: req.keyboard_listener,
4018 mouse_source: req.mouse_source,
4019
4020 responder: VirtioGpuStartResponder {
4021 control_handle: std::mem::ManuallyDrop::new(control_handle),
4022 tx_id: header.tx_id,
4023 },
4024 })
4025 }
4026 _ => Err(fidl::Error::UnknownOrdinal {
4027 ordinal: header.ordinal,
4028 protocol_name:
4029 <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4030 }),
4031 }))
4032 },
4033 )
4034 }
4035}
4036
4037#[derive(Debug)]
4038pub enum VirtioGpuRequest {
4039 ConfigureQueue {
4042 queue: u16,
4043 size: u16,
4044 desc: u64,
4045 avail: u64,
4046 used: u64,
4047 responder: VirtioGpuConfigureQueueResponder,
4048 },
4049 NotifyQueue { queue: u16, control_handle: VirtioGpuControlHandle },
4051 Ready { negotiated_features: u32, responder: VirtioGpuReadyResponder },
4054 Start {
4056 start_info: StartInfo,
4057 keyboard_listener:
4058 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>>,
4059 mouse_source:
4060 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
4061 responder: VirtioGpuStartResponder,
4062 },
4063}
4064
4065impl VirtioGpuRequest {
4066 #[allow(irrefutable_let_patterns)]
4067 pub fn into_configure_queue(
4068 self,
4069 ) -> Option<(u16, u16, u64, u64, u64, VirtioGpuConfigureQueueResponder)> {
4070 if let VirtioGpuRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
4071 {
4072 Some((queue, size, desc, avail, used, responder))
4073 } else {
4074 None
4075 }
4076 }
4077
4078 #[allow(irrefutable_let_patterns)]
4079 pub fn into_notify_queue(self) -> Option<(u16, VirtioGpuControlHandle)> {
4080 if let VirtioGpuRequest::NotifyQueue { queue, control_handle } = self {
4081 Some((queue, control_handle))
4082 } else {
4083 None
4084 }
4085 }
4086
4087 #[allow(irrefutable_let_patterns)]
4088 pub fn into_ready(self) -> Option<(u32, VirtioGpuReadyResponder)> {
4089 if let VirtioGpuRequest::Ready { negotiated_features, responder } = self {
4090 Some((negotiated_features, responder))
4091 } else {
4092 None
4093 }
4094 }
4095
4096 #[allow(irrefutable_let_patterns)]
4097 pub fn into_start(
4098 self,
4099 ) -> Option<(
4100 StartInfo,
4101 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>>,
4102 Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
4103 VirtioGpuStartResponder,
4104 )> {
4105 if let VirtioGpuRequest::Start { start_info, keyboard_listener, mouse_source, responder } =
4106 self
4107 {
4108 Some((start_info, keyboard_listener, mouse_source, responder))
4109 } else {
4110 None
4111 }
4112 }
4113
4114 pub fn method_name(&self) -> &'static str {
4116 match *self {
4117 VirtioGpuRequest::ConfigureQueue { .. } => "configure_queue",
4118 VirtioGpuRequest::NotifyQueue { .. } => "notify_queue",
4119 VirtioGpuRequest::Ready { .. } => "ready",
4120 VirtioGpuRequest::Start { .. } => "start",
4121 }
4122 }
4123}
4124
4125#[derive(Debug, Clone)]
4126pub struct VirtioGpuControlHandle {
4127 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4128}
4129
4130impl fidl::endpoints::ControlHandle for VirtioGpuControlHandle {
4131 fn shutdown(&self) {
4132 self.inner.shutdown()
4133 }
4134 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4135 self.inner.shutdown_with_epitaph(status)
4136 }
4137
4138 fn is_closed(&self) -> bool {
4139 self.inner.channel().is_closed()
4140 }
4141 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4142 self.inner.channel().on_closed()
4143 }
4144
4145 #[cfg(target_os = "fuchsia")]
4146 fn signal_peer(
4147 &self,
4148 clear_mask: zx::Signals,
4149 set_mask: zx::Signals,
4150 ) -> Result<(), zx_status::Status> {
4151 use fidl::Peered;
4152 self.inner.channel().signal_peer(clear_mask, set_mask)
4153 }
4154}
4155
4156impl VirtioGpuControlHandle {
4157 pub fn send_on_config_changed(&self) -> Result<(), fidl::Error> {
4158 self.inner.send::<fidl::encoding::EmptyPayload>(
4159 (),
4160 0,
4161 0x1555f5b7c8444aa0,
4162 fidl::encoding::DynamicFlags::empty(),
4163 )
4164 }
4165}
4166
4167#[must_use = "FIDL methods require a response to be sent"]
4168#[derive(Debug)]
4169pub struct VirtioGpuConfigureQueueResponder {
4170 control_handle: std::mem::ManuallyDrop<VirtioGpuControlHandle>,
4171 tx_id: u32,
4172}
4173
4174impl std::ops::Drop for VirtioGpuConfigureQueueResponder {
4178 fn drop(&mut self) {
4179 self.control_handle.shutdown();
4180 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4182 }
4183}
4184
4185impl fidl::endpoints::Responder for VirtioGpuConfigureQueueResponder {
4186 type ControlHandle = VirtioGpuControlHandle;
4187
4188 fn control_handle(&self) -> &VirtioGpuControlHandle {
4189 &self.control_handle
4190 }
4191
4192 fn drop_without_shutdown(mut self) {
4193 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4195 std::mem::forget(self);
4197 }
4198}
4199
4200impl VirtioGpuConfigureQueueResponder {
4201 pub fn send(self) -> Result<(), fidl::Error> {
4205 let _result = self.send_raw();
4206 if _result.is_err() {
4207 self.control_handle.shutdown();
4208 }
4209 self.drop_without_shutdown();
4210 _result
4211 }
4212
4213 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4215 let _result = self.send_raw();
4216 self.drop_without_shutdown();
4217 _result
4218 }
4219
4220 fn send_raw(&self) -> Result<(), fidl::Error> {
4221 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4222 (),
4223 self.tx_id,
4224 0x72b44fb963480b11,
4225 fidl::encoding::DynamicFlags::empty(),
4226 )
4227 }
4228}
4229
4230#[must_use = "FIDL methods require a response to be sent"]
4231#[derive(Debug)]
4232pub struct VirtioGpuReadyResponder {
4233 control_handle: std::mem::ManuallyDrop<VirtioGpuControlHandle>,
4234 tx_id: u32,
4235}
4236
4237impl std::ops::Drop for VirtioGpuReadyResponder {
4241 fn drop(&mut self) {
4242 self.control_handle.shutdown();
4243 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4245 }
4246}
4247
4248impl fidl::endpoints::Responder for VirtioGpuReadyResponder {
4249 type ControlHandle = VirtioGpuControlHandle;
4250
4251 fn control_handle(&self) -> &VirtioGpuControlHandle {
4252 &self.control_handle
4253 }
4254
4255 fn drop_without_shutdown(mut self) {
4256 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4258 std::mem::forget(self);
4260 }
4261}
4262
4263impl VirtioGpuReadyResponder {
4264 pub fn send(self) -> Result<(), fidl::Error> {
4268 let _result = self.send_raw();
4269 if _result.is_err() {
4270 self.control_handle.shutdown();
4271 }
4272 self.drop_without_shutdown();
4273 _result
4274 }
4275
4276 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4278 let _result = self.send_raw();
4279 self.drop_without_shutdown();
4280 _result
4281 }
4282
4283 fn send_raw(&self) -> Result<(), fidl::Error> {
4284 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4285 (),
4286 self.tx_id,
4287 0x45707654f5d23c3f,
4288 fidl::encoding::DynamicFlags::empty(),
4289 )
4290 }
4291}
4292
4293#[must_use = "FIDL methods require a response to be sent"]
4294#[derive(Debug)]
4295pub struct VirtioGpuStartResponder {
4296 control_handle: std::mem::ManuallyDrop<VirtioGpuControlHandle>,
4297 tx_id: u32,
4298}
4299
4300impl std::ops::Drop for VirtioGpuStartResponder {
4304 fn drop(&mut self) {
4305 self.control_handle.shutdown();
4306 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4308 }
4309}
4310
4311impl fidl::endpoints::Responder for VirtioGpuStartResponder {
4312 type ControlHandle = VirtioGpuControlHandle;
4313
4314 fn control_handle(&self) -> &VirtioGpuControlHandle {
4315 &self.control_handle
4316 }
4317
4318 fn drop_without_shutdown(mut self) {
4319 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4321 std::mem::forget(self);
4323 }
4324}
4325
4326impl VirtioGpuStartResponder {
4327 pub fn send(self) -> Result<(), fidl::Error> {
4331 let _result = self.send_raw();
4332 if _result.is_err() {
4333 self.control_handle.shutdown();
4334 }
4335 self.drop_without_shutdown();
4336 _result
4337 }
4338
4339 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4341 let _result = self.send_raw();
4342 self.drop_without_shutdown();
4343 _result
4344 }
4345
4346 fn send_raw(&self) -> Result<(), fidl::Error> {
4347 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4348 (),
4349 self.tx_id,
4350 0x7e81ed410f770c14,
4351 fidl::encoding::DynamicFlags::empty(),
4352 )
4353 }
4354}
4355
4356#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4357pub struct VirtioInputMarker;
4358
4359impl fidl::endpoints::ProtocolMarker for VirtioInputMarker {
4360 type Proxy = VirtioInputProxy;
4361 type RequestStream = VirtioInputRequestStream;
4362 #[cfg(target_os = "fuchsia")]
4363 type SynchronousProxy = VirtioInputSynchronousProxy;
4364
4365 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioInput";
4366}
4367impl fidl::endpoints::DiscoverableProtocolMarker for VirtioInputMarker {}
4368
4369pub trait VirtioInputProxyInterface: Send + Sync {
4370 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4371 fn r#configure_queue(
4372 &self,
4373 queue: u16,
4374 size: u16,
4375 desc: u64,
4376 avail: u64,
4377 used: u64,
4378 ) -> Self::ConfigureQueueResponseFut;
4379 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
4380 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4381 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
4382 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4383 fn r#start(&self, start_info: StartInfo, input_type: InputType) -> Self::StartResponseFut;
4384}
4385#[derive(Debug)]
4386#[cfg(target_os = "fuchsia")]
4387pub struct VirtioInputSynchronousProxy {
4388 client: fidl::client::sync::Client,
4389}
4390
4391#[cfg(target_os = "fuchsia")]
4392impl fidl::endpoints::SynchronousProxy for VirtioInputSynchronousProxy {
4393 type Proxy = VirtioInputProxy;
4394 type Protocol = VirtioInputMarker;
4395
4396 fn from_channel(inner: fidl::Channel) -> Self {
4397 Self::new(inner)
4398 }
4399
4400 fn into_channel(self) -> fidl::Channel {
4401 self.client.into_channel()
4402 }
4403
4404 fn as_channel(&self) -> &fidl::Channel {
4405 self.client.as_channel()
4406 }
4407}
4408
4409#[cfg(target_os = "fuchsia")]
4410impl VirtioInputSynchronousProxy {
4411 pub fn new(channel: fidl::Channel) -> Self {
4412 let protocol_name = <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4413 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4414 }
4415
4416 pub fn into_channel(self) -> fidl::Channel {
4417 self.client.into_channel()
4418 }
4419
4420 pub fn wait_for_event(
4423 &self,
4424 deadline: zx::MonotonicInstant,
4425 ) -> Result<VirtioInputEvent, fidl::Error> {
4426 VirtioInputEvent::decode(self.client.wait_for_event(deadline)?)
4427 }
4428
4429 pub fn r#configure_queue(
4432 &self,
4433 mut queue: u16,
4434 mut size: u16,
4435 mut desc: u64,
4436 mut avail: u64,
4437 mut used: u64,
4438 ___deadline: zx::MonotonicInstant,
4439 ) -> Result<(), fidl::Error> {
4440 let _response = self
4441 .client
4442 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
4443 (queue, size, desc, avail, used),
4444 0x72b44fb963480b11,
4445 fidl::encoding::DynamicFlags::empty(),
4446 ___deadline,
4447 )?;
4448 Ok(_response)
4449 }
4450
4451 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
4453 self.client.send::<VirtioDeviceNotifyQueueRequest>(
4454 (queue,),
4455 0x6e3a61d652499244,
4456 fidl::encoding::DynamicFlags::empty(),
4457 )
4458 }
4459
4460 pub fn r#ready(
4463 &self,
4464 mut negotiated_features: u32,
4465 ___deadline: zx::MonotonicInstant,
4466 ) -> Result<(), fidl::Error> {
4467 let _response =
4468 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
4469 (negotiated_features,),
4470 0x45707654f5d23c3f,
4471 fidl::encoding::DynamicFlags::empty(),
4472 ___deadline,
4473 )?;
4474 Ok(_response)
4475 }
4476
4477 pub fn r#start(
4479 &self,
4480 mut start_info: StartInfo,
4481 mut input_type: InputType,
4482 ___deadline: zx::MonotonicInstant,
4483 ) -> Result<(), fidl::Error> {
4484 let _response =
4485 self.client.send_query::<VirtioInputStartRequest, fidl::encoding::EmptyPayload>(
4486 (&mut start_info, &mut input_type),
4487 0x612743931f7f9249,
4488 fidl::encoding::DynamicFlags::empty(),
4489 ___deadline,
4490 )?;
4491 Ok(_response)
4492 }
4493}
4494
4495#[cfg(target_os = "fuchsia")]
4496impl From<VirtioInputSynchronousProxy> for zx::Handle {
4497 fn from(value: VirtioInputSynchronousProxy) -> Self {
4498 value.into_channel().into()
4499 }
4500}
4501
4502#[cfg(target_os = "fuchsia")]
4503impl From<fidl::Channel> for VirtioInputSynchronousProxy {
4504 fn from(value: fidl::Channel) -> Self {
4505 Self::new(value)
4506 }
4507}
4508
4509#[derive(Debug, Clone)]
4510pub struct VirtioInputProxy {
4511 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4512}
4513
4514impl fidl::endpoints::Proxy for VirtioInputProxy {
4515 type Protocol = VirtioInputMarker;
4516
4517 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4518 Self::new(inner)
4519 }
4520
4521 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4522 self.client.into_channel().map_err(|client| Self { client })
4523 }
4524
4525 fn as_channel(&self) -> &::fidl::AsyncChannel {
4526 self.client.as_channel()
4527 }
4528}
4529
4530impl VirtioInputProxy {
4531 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4533 let protocol_name = <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4534 Self { client: fidl::client::Client::new(channel, protocol_name) }
4535 }
4536
4537 pub fn take_event_stream(&self) -> VirtioInputEventStream {
4543 VirtioInputEventStream { event_receiver: self.client.take_event_receiver() }
4544 }
4545
4546 pub fn r#configure_queue(
4549 &self,
4550 mut queue: u16,
4551 mut size: u16,
4552 mut desc: u64,
4553 mut avail: u64,
4554 mut used: u64,
4555 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4556 VirtioInputProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
4557 }
4558
4559 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
4561 VirtioInputProxyInterface::r#notify_queue(self, queue)
4562 }
4563
4564 pub fn r#ready(
4567 &self,
4568 mut negotiated_features: u32,
4569 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4570 VirtioInputProxyInterface::r#ready(self, negotiated_features)
4571 }
4572
4573 pub fn r#start(
4575 &self,
4576 mut start_info: StartInfo,
4577 mut input_type: InputType,
4578 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4579 VirtioInputProxyInterface::r#start(self, start_info, input_type)
4580 }
4581}
4582
4583impl VirtioInputProxyInterface for VirtioInputProxy {
4584 type ConfigureQueueResponseFut =
4585 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4586 fn r#configure_queue(
4587 &self,
4588 mut queue: u16,
4589 mut size: u16,
4590 mut desc: u64,
4591 mut avail: u64,
4592 mut used: u64,
4593 ) -> Self::ConfigureQueueResponseFut {
4594 fn _decode(
4595 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4596 ) -> Result<(), fidl::Error> {
4597 let _response = fidl::client::decode_transaction_body::<
4598 fidl::encoding::EmptyPayload,
4599 fidl::encoding::DefaultFuchsiaResourceDialect,
4600 0x72b44fb963480b11,
4601 >(_buf?)?;
4602 Ok(_response)
4603 }
4604 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
4605 (queue, size, desc, avail, used),
4606 0x72b44fb963480b11,
4607 fidl::encoding::DynamicFlags::empty(),
4608 _decode,
4609 )
4610 }
4611
4612 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
4613 self.client.send::<VirtioDeviceNotifyQueueRequest>(
4614 (queue,),
4615 0x6e3a61d652499244,
4616 fidl::encoding::DynamicFlags::empty(),
4617 )
4618 }
4619
4620 type ReadyResponseFut =
4621 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4622 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
4623 fn _decode(
4624 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4625 ) -> Result<(), fidl::Error> {
4626 let _response = fidl::client::decode_transaction_body::<
4627 fidl::encoding::EmptyPayload,
4628 fidl::encoding::DefaultFuchsiaResourceDialect,
4629 0x45707654f5d23c3f,
4630 >(_buf?)?;
4631 Ok(_response)
4632 }
4633 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
4634 (negotiated_features,),
4635 0x45707654f5d23c3f,
4636 fidl::encoding::DynamicFlags::empty(),
4637 _decode,
4638 )
4639 }
4640
4641 type StartResponseFut =
4642 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4643 fn r#start(
4644 &self,
4645 mut start_info: StartInfo,
4646 mut input_type: InputType,
4647 ) -> Self::StartResponseFut {
4648 fn _decode(
4649 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4650 ) -> Result<(), fidl::Error> {
4651 let _response = fidl::client::decode_transaction_body::<
4652 fidl::encoding::EmptyPayload,
4653 fidl::encoding::DefaultFuchsiaResourceDialect,
4654 0x612743931f7f9249,
4655 >(_buf?)?;
4656 Ok(_response)
4657 }
4658 self.client.send_query_and_decode::<VirtioInputStartRequest, ()>(
4659 (&mut start_info, &mut input_type),
4660 0x612743931f7f9249,
4661 fidl::encoding::DynamicFlags::empty(),
4662 _decode,
4663 )
4664 }
4665}
4666
4667pub struct VirtioInputEventStream {
4668 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4669}
4670
4671impl std::marker::Unpin for VirtioInputEventStream {}
4672
4673impl futures::stream::FusedStream for VirtioInputEventStream {
4674 fn is_terminated(&self) -> bool {
4675 self.event_receiver.is_terminated()
4676 }
4677}
4678
4679impl futures::Stream for VirtioInputEventStream {
4680 type Item = Result<VirtioInputEvent, fidl::Error>;
4681
4682 fn poll_next(
4683 mut self: std::pin::Pin<&mut Self>,
4684 cx: &mut std::task::Context<'_>,
4685 ) -> std::task::Poll<Option<Self::Item>> {
4686 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4687 &mut self.event_receiver,
4688 cx
4689 )?) {
4690 Some(buf) => std::task::Poll::Ready(Some(VirtioInputEvent::decode(buf))),
4691 None => std::task::Poll::Ready(None),
4692 }
4693 }
4694}
4695
4696#[derive(Debug)]
4697pub enum VirtioInputEvent {}
4698
4699impl VirtioInputEvent {
4700 fn decode(
4702 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4703 ) -> Result<VirtioInputEvent, fidl::Error> {
4704 let (bytes, _handles) = buf.split_mut();
4705 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4706 debug_assert_eq!(tx_header.tx_id, 0);
4707 match tx_header.ordinal {
4708 _ => Err(fidl::Error::UnknownOrdinal {
4709 ordinal: tx_header.ordinal,
4710 protocol_name: <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4711 }),
4712 }
4713 }
4714}
4715
4716pub struct VirtioInputRequestStream {
4718 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4719 is_terminated: bool,
4720}
4721
4722impl std::marker::Unpin for VirtioInputRequestStream {}
4723
4724impl futures::stream::FusedStream for VirtioInputRequestStream {
4725 fn is_terminated(&self) -> bool {
4726 self.is_terminated
4727 }
4728}
4729
4730impl fidl::endpoints::RequestStream for VirtioInputRequestStream {
4731 type Protocol = VirtioInputMarker;
4732 type ControlHandle = VirtioInputControlHandle;
4733
4734 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4735 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4736 }
4737
4738 fn control_handle(&self) -> Self::ControlHandle {
4739 VirtioInputControlHandle { inner: self.inner.clone() }
4740 }
4741
4742 fn into_inner(
4743 self,
4744 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4745 {
4746 (self.inner, self.is_terminated)
4747 }
4748
4749 fn from_inner(
4750 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4751 is_terminated: bool,
4752 ) -> Self {
4753 Self { inner, is_terminated }
4754 }
4755}
4756
4757impl futures::Stream for VirtioInputRequestStream {
4758 type Item = Result<VirtioInputRequest, fidl::Error>;
4759
4760 fn poll_next(
4761 mut self: std::pin::Pin<&mut Self>,
4762 cx: &mut std::task::Context<'_>,
4763 ) -> std::task::Poll<Option<Self::Item>> {
4764 let this = &mut *self;
4765 if this.inner.check_shutdown(cx) {
4766 this.is_terminated = true;
4767 return std::task::Poll::Ready(None);
4768 }
4769 if this.is_terminated {
4770 panic!("polled VirtioInputRequestStream after completion");
4771 }
4772 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4773 |bytes, handles| {
4774 match this.inner.channel().read_etc(cx, bytes, handles) {
4775 std::task::Poll::Ready(Ok(())) => {}
4776 std::task::Poll::Pending => return std::task::Poll::Pending,
4777 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4778 this.is_terminated = true;
4779 return std::task::Poll::Ready(None);
4780 }
4781 std::task::Poll::Ready(Err(e)) => {
4782 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4783 e.into(),
4784 ))))
4785 }
4786 }
4787
4788 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4790
4791 std::task::Poll::Ready(Some(match header.ordinal {
4792 0x72b44fb963480b11 => {
4793 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4794 let mut req = fidl::new_empty!(
4795 VirtioDeviceConfigureQueueRequest,
4796 fidl::encoding::DefaultFuchsiaResourceDialect
4797 );
4798 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
4799 let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
4800 Ok(VirtioInputRequest::ConfigureQueue {
4801 queue: req.queue,
4802 size: req.size,
4803 desc: req.desc,
4804 avail: req.avail,
4805 used: req.used,
4806
4807 responder: VirtioInputConfigureQueueResponder {
4808 control_handle: std::mem::ManuallyDrop::new(control_handle),
4809 tx_id: header.tx_id,
4810 },
4811 })
4812 }
4813 0x6e3a61d652499244 => {
4814 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4815 let mut req = fidl::new_empty!(
4816 VirtioDeviceNotifyQueueRequest,
4817 fidl::encoding::DefaultFuchsiaResourceDialect
4818 );
4819 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
4820 let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
4821 Ok(VirtioInputRequest::NotifyQueue { queue: req.queue, control_handle })
4822 }
4823 0x45707654f5d23c3f => {
4824 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4825 let mut req = fidl::new_empty!(
4826 VirtioDeviceReadyRequest,
4827 fidl::encoding::DefaultFuchsiaResourceDialect
4828 );
4829 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
4830 let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
4831 Ok(VirtioInputRequest::Ready {
4832 negotiated_features: req.negotiated_features,
4833
4834 responder: VirtioInputReadyResponder {
4835 control_handle: std::mem::ManuallyDrop::new(control_handle),
4836 tx_id: header.tx_id,
4837 },
4838 })
4839 }
4840 0x612743931f7f9249 => {
4841 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4842 let mut req = fidl::new_empty!(
4843 VirtioInputStartRequest,
4844 fidl::encoding::DefaultFuchsiaResourceDialect
4845 );
4846 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioInputStartRequest>(&header, _body_bytes, handles, &mut req)?;
4847 let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
4848 Ok(VirtioInputRequest::Start {
4849 start_info: req.start_info,
4850 input_type: req.input_type,
4851
4852 responder: VirtioInputStartResponder {
4853 control_handle: std::mem::ManuallyDrop::new(control_handle),
4854 tx_id: header.tx_id,
4855 },
4856 })
4857 }
4858 _ => Err(fidl::Error::UnknownOrdinal {
4859 ordinal: header.ordinal,
4860 protocol_name:
4861 <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4862 }),
4863 }))
4864 },
4865 )
4866 }
4867}
4868
4869#[derive(Debug)]
4870pub enum VirtioInputRequest {
4871 ConfigureQueue {
4874 queue: u16,
4875 size: u16,
4876 desc: u64,
4877 avail: u64,
4878 used: u64,
4879 responder: VirtioInputConfigureQueueResponder,
4880 },
4881 NotifyQueue { queue: u16, control_handle: VirtioInputControlHandle },
4883 Ready { negotiated_features: u32, responder: VirtioInputReadyResponder },
4886 Start { start_info: StartInfo, input_type: InputType, responder: VirtioInputStartResponder },
4888}
4889
4890impl VirtioInputRequest {
4891 #[allow(irrefutable_let_patterns)]
4892 pub fn into_configure_queue(
4893 self,
4894 ) -> Option<(u16, u16, u64, u64, u64, VirtioInputConfigureQueueResponder)> {
4895 if let VirtioInputRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
4896 self
4897 {
4898 Some((queue, size, desc, avail, used, responder))
4899 } else {
4900 None
4901 }
4902 }
4903
4904 #[allow(irrefutable_let_patterns)]
4905 pub fn into_notify_queue(self) -> Option<(u16, VirtioInputControlHandle)> {
4906 if let VirtioInputRequest::NotifyQueue { queue, control_handle } = self {
4907 Some((queue, control_handle))
4908 } else {
4909 None
4910 }
4911 }
4912
4913 #[allow(irrefutable_let_patterns)]
4914 pub fn into_ready(self) -> Option<(u32, VirtioInputReadyResponder)> {
4915 if let VirtioInputRequest::Ready { negotiated_features, responder } = self {
4916 Some((negotiated_features, responder))
4917 } else {
4918 None
4919 }
4920 }
4921
4922 #[allow(irrefutable_let_patterns)]
4923 pub fn into_start(self) -> Option<(StartInfo, InputType, VirtioInputStartResponder)> {
4924 if let VirtioInputRequest::Start { start_info, input_type, responder } = self {
4925 Some((start_info, input_type, responder))
4926 } else {
4927 None
4928 }
4929 }
4930
4931 pub fn method_name(&self) -> &'static str {
4933 match *self {
4934 VirtioInputRequest::ConfigureQueue { .. } => "configure_queue",
4935 VirtioInputRequest::NotifyQueue { .. } => "notify_queue",
4936 VirtioInputRequest::Ready { .. } => "ready",
4937 VirtioInputRequest::Start { .. } => "start",
4938 }
4939 }
4940}
4941
4942#[derive(Debug, Clone)]
4943pub struct VirtioInputControlHandle {
4944 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4945}
4946
4947impl fidl::endpoints::ControlHandle for VirtioInputControlHandle {
4948 fn shutdown(&self) {
4949 self.inner.shutdown()
4950 }
4951 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4952 self.inner.shutdown_with_epitaph(status)
4953 }
4954
4955 fn is_closed(&self) -> bool {
4956 self.inner.channel().is_closed()
4957 }
4958 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4959 self.inner.channel().on_closed()
4960 }
4961
4962 #[cfg(target_os = "fuchsia")]
4963 fn signal_peer(
4964 &self,
4965 clear_mask: zx::Signals,
4966 set_mask: zx::Signals,
4967 ) -> Result<(), zx_status::Status> {
4968 use fidl::Peered;
4969 self.inner.channel().signal_peer(clear_mask, set_mask)
4970 }
4971}
4972
4973impl VirtioInputControlHandle {}
4974
4975#[must_use = "FIDL methods require a response to be sent"]
4976#[derive(Debug)]
4977pub struct VirtioInputConfigureQueueResponder {
4978 control_handle: std::mem::ManuallyDrop<VirtioInputControlHandle>,
4979 tx_id: u32,
4980}
4981
4982impl std::ops::Drop for VirtioInputConfigureQueueResponder {
4986 fn drop(&mut self) {
4987 self.control_handle.shutdown();
4988 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4990 }
4991}
4992
4993impl fidl::endpoints::Responder for VirtioInputConfigureQueueResponder {
4994 type ControlHandle = VirtioInputControlHandle;
4995
4996 fn control_handle(&self) -> &VirtioInputControlHandle {
4997 &self.control_handle
4998 }
4999
5000 fn drop_without_shutdown(mut self) {
5001 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5003 std::mem::forget(self);
5005 }
5006}
5007
5008impl VirtioInputConfigureQueueResponder {
5009 pub fn send(self) -> Result<(), fidl::Error> {
5013 let _result = self.send_raw();
5014 if _result.is_err() {
5015 self.control_handle.shutdown();
5016 }
5017 self.drop_without_shutdown();
5018 _result
5019 }
5020
5021 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5023 let _result = self.send_raw();
5024 self.drop_without_shutdown();
5025 _result
5026 }
5027
5028 fn send_raw(&self) -> Result<(), fidl::Error> {
5029 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5030 (),
5031 self.tx_id,
5032 0x72b44fb963480b11,
5033 fidl::encoding::DynamicFlags::empty(),
5034 )
5035 }
5036}
5037
5038#[must_use = "FIDL methods require a response to be sent"]
5039#[derive(Debug)]
5040pub struct VirtioInputReadyResponder {
5041 control_handle: std::mem::ManuallyDrop<VirtioInputControlHandle>,
5042 tx_id: u32,
5043}
5044
5045impl std::ops::Drop for VirtioInputReadyResponder {
5049 fn drop(&mut self) {
5050 self.control_handle.shutdown();
5051 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5053 }
5054}
5055
5056impl fidl::endpoints::Responder for VirtioInputReadyResponder {
5057 type ControlHandle = VirtioInputControlHandle;
5058
5059 fn control_handle(&self) -> &VirtioInputControlHandle {
5060 &self.control_handle
5061 }
5062
5063 fn drop_without_shutdown(mut self) {
5064 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5066 std::mem::forget(self);
5068 }
5069}
5070
5071impl VirtioInputReadyResponder {
5072 pub fn send(self) -> Result<(), fidl::Error> {
5076 let _result = self.send_raw();
5077 if _result.is_err() {
5078 self.control_handle.shutdown();
5079 }
5080 self.drop_without_shutdown();
5081 _result
5082 }
5083
5084 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5086 let _result = self.send_raw();
5087 self.drop_without_shutdown();
5088 _result
5089 }
5090
5091 fn send_raw(&self) -> Result<(), fidl::Error> {
5092 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5093 (),
5094 self.tx_id,
5095 0x45707654f5d23c3f,
5096 fidl::encoding::DynamicFlags::empty(),
5097 )
5098 }
5099}
5100
5101#[must_use = "FIDL methods require a response to be sent"]
5102#[derive(Debug)]
5103pub struct VirtioInputStartResponder {
5104 control_handle: std::mem::ManuallyDrop<VirtioInputControlHandle>,
5105 tx_id: u32,
5106}
5107
5108impl std::ops::Drop for VirtioInputStartResponder {
5112 fn drop(&mut self) {
5113 self.control_handle.shutdown();
5114 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5116 }
5117}
5118
5119impl fidl::endpoints::Responder for VirtioInputStartResponder {
5120 type ControlHandle = VirtioInputControlHandle;
5121
5122 fn control_handle(&self) -> &VirtioInputControlHandle {
5123 &self.control_handle
5124 }
5125
5126 fn drop_without_shutdown(mut self) {
5127 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5129 std::mem::forget(self);
5131 }
5132}
5133
5134impl VirtioInputStartResponder {
5135 pub fn send(self) -> Result<(), fidl::Error> {
5139 let _result = self.send_raw();
5140 if _result.is_err() {
5141 self.control_handle.shutdown();
5142 }
5143 self.drop_without_shutdown();
5144 _result
5145 }
5146
5147 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5149 let _result = self.send_raw();
5150 self.drop_without_shutdown();
5151 _result
5152 }
5153
5154 fn send_raw(&self) -> Result<(), fidl::Error> {
5155 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5156 (),
5157 self.tx_id,
5158 0x612743931f7f9249,
5159 fidl::encoding::DynamicFlags::empty(),
5160 )
5161 }
5162}
5163
5164#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5165pub struct VirtioMagmaMarker;
5166
5167impl fidl::endpoints::ProtocolMarker for VirtioMagmaMarker {
5168 type Proxy = VirtioMagmaProxy;
5169 type RequestStream = VirtioMagmaRequestStream;
5170 #[cfg(target_os = "fuchsia")]
5171 type SynchronousProxy = VirtioMagmaSynchronousProxy;
5172
5173 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioMagma";
5174}
5175impl fidl::endpoints::DiscoverableProtocolMarker for VirtioMagmaMarker {}
5176
5177pub trait VirtioMagmaProxyInterface: Send + Sync {
5178 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5179 fn r#configure_queue(
5180 &self,
5181 queue: u16,
5182 size: u16,
5183 desc: u64,
5184 avail: u64,
5185 used: u64,
5186 ) -> Self::ConfigureQueueResponseFut;
5187 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
5188 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5189 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
5190 type StartResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
5191 fn r#start(
5192 &self,
5193 start_info: StartInfo,
5194 vmar: fidl::Vmar,
5195 wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
5196 ) -> Self::StartResponseFut;
5197}
5198#[derive(Debug)]
5199#[cfg(target_os = "fuchsia")]
5200pub struct VirtioMagmaSynchronousProxy {
5201 client: fidl::client::sync::Client,
5202}
5203
5204#[cfg(target_os = "fuchsia")]
5205impl fidl::endpoints::SynchronousProxy for VirtioMagmaSynchronousProxy {
5206 type Proxy = VirtioMagmaProxy;
5207 type Protocol = VirtioMagmaMarker;
5208
5209 fn from_channel(inner: fidl::Channel) -> Self {
5210 Self::new(inner)
5211 }
5212
5213 fn into_channel(self) -> fidl::Channel {
5214 self.client.into_channel()
5215 }
5216
5217 fn as_channel(&self) -> &fidl::Channel {
5218 self.client.as_channel()
5219 }
5220}
5221
5222#[cfg(target_os = "fuchsia")]
5223impl VirtioMagmaSynchronousProxy {
5224 pub fn new(channel: fidl::Channel) -> Self {
5225 let protocol_name = <VirtioMagmaMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5226 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5227 }
5228
5229 pub fn into_channel(self) -> fidl::Channel {
5230 self.client.into_channel()
5231 }
5232
5233 pub fn wait_for_event(
5236 &self,
5237 deadline: zx::MonotonicInstant,
5238 ) -> Result<VirtioMagmaEvent, fidl::Error> {
5239 VirtioMagmaEvent::decode(self.client.wait_for_event(deadline)?)
5240 }
5241
5242 pub fn r#configure_queue(
5245 &self,
5246 mut queue: u16,
5247 mut size: u16,
5248 mut desc: u64,
5249 mut avail: u64,
5250 mut used: u64,
5251 ___deadline: zx::MonotonicInstant,
5252 ) -> Result<(), fidl::Error> {
5253 let _response = self
5254 .client
5255 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
5256 (queue, size, desc, avail, used),
5257 0x72b44fb963480b11,
5258 fidl::encoding::DynamicFlags::empty(),
5259 ___deadline,
5260 )?;
5261 Ok(_response)
5262 }
5263
5264 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
5266 self.client.send::<VirtioDeviceNotifyQueueRequest>(
5267 (queue,),
5268 0x6e3a61d652499244,
5269 fidl::encoding::DynamicFlags::empty(),
5270 )
5271 }
5272
5273 pub fn r#ready(
5276 &self,
5277 mut negotiated_features: u32,
5278 ___deadline: zx::MonotonicInstant,
5279 ) -> Result<(), fidl::Error> {
5280 let _response =
5281 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
5282 (negotiated_features,),
5283 0x45707654f5d23c3f,
5284 fidl::encoding::DynamicFlags::empty(),
5285 ___deadline,
5286 )?;
5287 Ok(_response)
5288 }
5289
5290 pub fn r#start(
5292 &self,
5293 mut start_info: StartInfo,
5294 mut vmar: fidl::Vmar,
5295 mut wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
5296 ___deadline: zx::MonotonicInstant,
5297 ) -> Result<i32, fidl::Error> {
5298 let _response =
5299 self.client.send_query::<VirtioMagmaStartRequest, VirtioMagmaStartResponse>(
5300 (&mut start_info, vmar, wayland_importer),
5301 0x6b94e28f73d201e2,
5302 fidl::encoding::DynamicFlags::empty(),
5303 ___deadline,
5304 )?;
5305 Ok(_response.status)
5306 }
5307}
5308
5309#[cfg(target_os = "fuchsia")]
5310impl From<VirtioMagmaSynchronousProxy> for zx::Handle {
5311 fn from(value: VirtioMagmaSynchronousProxy) -> Self {
5312 value.into_channel().into()
5313 }
5314}
5315
5316#[cfg(target_os = "fuchsia")]
5317impl From<fidl::Channel> for VirtioMagmaSynchronousProxy {
5318 fn from(value: fidl::Channel) -> Self {
5319 Self::new(value)
5320 }
5321}
5322
5323#[derive(Debug, Clone)]
5324pub struct VirtioMagmaProxy {
5325 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5326}
5327
5328impl fidl::endpoints::Proxy for VirtioMagmaProxy {
5329 type Protocol = VirtioMagmaMarker;
5330
5331 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5332 Self::new(inner)
5333 }
5334
5335 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5336 self.client.into_channel().map_err(|client| Self { client })
5337 }
5338
5339 fn as_channel(&self) -> &::fidl::AsyncChannel {
5340 self.client.as_channel()
5341 }
5342}
5343
5344impl VirtioMagmaProxy {
5345 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5347 let protocol_name = <VirtioMagmaMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5348 Self { client: fidl::client::Client::new(channel, protocol_name) }
5349 }
5350
5351 pub fn take_event_stream(&self) -> VirtioMagmaEventStream {
5357 VirtioMagmaEventStream { event_receiver: self.client.take_event_receiver() }
5358 }
5359
5360 pub fn r#configure_queue(
5363 &self,
5364 mut queue: u16,
5365 mut size: u16,
5366 mut desc: u64,
5367 mut avail: u64,
5368 mut used: u64,
5369 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5370 VirtioMagmaProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
5371 }
5372
5373 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
5375 VirtioMagmaProxyInterface::r#notify_queue(self, queue)
5376 }
5377
5378 pub fn r#ready(
5381 &self,
5382 mut negotiated_features: u32,
5383 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5384 VirtioMagmaProxyInterface::r#ready(self, negotiated_features)
5385 }
5386
5387 pub fn r#start(
5389 &self,
5390 mut start_info: StartInfo,
5391 mut vmar: fidl::Vmar,
5392 mut wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
5393 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5394 VirtioMagmaProxyInterface::r#start(self, start_info, vmar, wayland_importer)
5395 }
5396}
5397
5398impl VirtioMagmaProxyInterface for VirtioMagmaProxy {
5399 type ConfigureQueueResponseFut =
5400 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5401 fn r#configure_queue(
5402 &self,
5403 mut queue: u16,
5404 mut size: u16,
5405 mut desc: u64,
5406 mut avail: u64,
5407 mut used: u64,
5408 ) -> Self::ConfigureQueueResponseFut {
5409 fn _decode(
5410 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5411 ) -> Result<(), fidl::Error> {
5412 let _response = fidl::client::decode_transaction_body::<
5413 fidl::encoding::EmptyPayload,
5414 fidl::encoding::DefaultFuchsiaResourceDialect,
5415 0x72b44fb963480b11,
5416 >(_buf?)?;
5417 Ok(_response)
5418 }
5419 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
5420 (queue, size, desc, avail, used),
5421 0x72b44fb963480b11,
5422 fidl::encoding::DynamicFlags::empty(),
5423 _decode,
5424 )
5425 }
5426
5427 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
5428 self.client.send::<VirtioDeviceNotifyQueueRequest>(
5429 (queue,),
5430 0x6e3a61d652499244,
5431 fidl::encoding::DynamicFlags::empty(),
5432 )
5433 }
5434
5435 type ReadyResponseFut =
5436 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5437 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
5438 fn _decode(
5439 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5440 ) -> Result<(), fidl::Error> {
5441 let _response = fidl::client::decode_transaction_body::<
5442 fidl::encoding::EmptyPayload,
5443 fidl::encoding::DefaultFuchsiaResourceDialect,
5444 0x45707654f5d23c3f,
5445 >(_buf?)?;
5446 Ok(_response)
5447 }
5448 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
5449 (negotiated_features,),
5450 0x45707654f5d23c3f,
5451 fidl::encoding::DynamicFlags::empty(),
5452 _decode,
5453 )
5454 }
5455
5456 type StartResponseFut =
5457 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5458 fn r#start(
5459 &self,
5460 mut start_info: StartInfo,
5461 mut vmar: fidl::Vmar,
5462 mut wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
5463 ) -> Self::StartResponseFut {
5464 fn _decode(
5465 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5466 ) -> Result<i32, fidl::Error> {
5467 let _response = fidl::client::decode_transaction_body::<
5468 VirtioMagmaStartResponse,
5469 fidl::encoding::DefaultFuchsiaResourceDialect,
5470 0x6b94e28f73d201e2,
5471 >(_buf?)?;
5472 Ok(_response.status)
5473 }
5474 self.client.send_query_and_decode::<VirtioMagmaStartRequest, i32>(
5475 (&mut start_info, vmar, wayland_importer),
5476 0x6b94e28f73d201e2,
5477 fidl::encoding::DynamicFlags::empty(),
5478 _decode,
5479 )
5480 }
5481}
5482
5483pub struct VirtioMagmaEventStream {
5484 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5485}
5486
5487impl std::marker::Unpin for VirtioMagmaEventStream {}
5488
5489impl futures::stream::FusedStream for VirtioMagmaEventStream {
5490 fn is_terminated(&self) -> bool {
5491 self.event_receiver.is_terminated()
5492 }
5493}
5494
5495impl futures::Stream for VirtioMagmaEventStream {
5496 type Item = Result<VirtioMagmaEvent, fidl::Error>;
5497
5498 fn poll_next(
5499 mut self: std::pin::Pin<&mut Self>,
5500 cx: &mut std::task::Context<'_>,
5501 ) -> std::task::Poll<Option<Self::Item>> {
5502 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5503 &mut self.event_receiver,
5504 cx
5505 )?) {
5506 Some(buf) => std::task::Poll::Ready(Some(VirtioMagmaEvent::decode(buf))),
5507 None => std::task::Poll::Ready(None),
5508 }
5509 }
5510}
5511
5512#[derive(Debug)]
5513pub enum VirtioMagmaEvent {}
5514
5515impl VirtioMagmaEvent {
5516 fn decode(
5518 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5519 ) -> Result<VirtioMagmaEvent, fidl::Error> {
5520 let (bytes, _handles) = buf.split_mut();
5521 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5522 debug_assert_eq!(tx_header.tx_id, 0);
5523 match tx_header.ordinal {
5524 _ => Err(fidl::Error::UnknownOrdinal {
5525 ordinal: tx_header.ordinal,
5526 protocol_name: <VirtioMagmaMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5527 }),
5528 }
5529 }
5530}
5531
5532pub struct VirtioMagmaRequestStream {
5534 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5535 is_terminated: bool,
5536}
5537
5538impl std::marker::Unpin for VirtioMagmaRequestStream {}
5539
5540impl futures::stream::FusedStream for VirtioMagmaRequestStream {
5541 fn is_terminated(&self) -> bool {
5542 self.is_terminated
5543 }
5544}
5545
5546impl fidl::endpoints::RequestStream for VirtioMagmaRequestStream {
5547 type Protocol = VirtioMagmaMarker;
5548 type ControlHandle = VirtioMagmaControlHandle;
5549
5550 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5551 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5552 }
5553
5554 fn control_handle(&self) -> Self::ControlHandle {
5555 VirtioMagmaControlHandle { inner: self.inner.clone() }
5556 }
5557
5558 fn into_inner(
5559 self,
5560 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5561 {
5562 (self.inner, self.is_terminated)
5563 }
5564
5565 fn from_inner(
5566 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5567 is_terminated: bool,
5568 ) -> Self {
5569 Self { inner, is_terminated }
5570 }
5571}
5572
5573impl futures::Stream for VirtioMagmaRequestStream {
5574 type Item = Result<VirtioMagmaRequest, fidl::Error>;
5575
5576 fn poll_next(
5577 mut self: std::pin::Pin<&mut Self>,
5578 cx: &mut std::task::Context<'_>,
5579 ) -> std::task::Poll<Option<Self::Item>> {
5580 let this = &mut *self;
5581 if this.inner.check_shutdown(cx) {
5582 this.is_terminated = true;
5583 return std::task::Poll::Ready(None);
5584 }
5585 if this.is_terminated {
5586 panic!("polled VirtioMagmaRequestStream after completion");
5587 }
5588 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5589 |bytes, handles| {
5590 match this.inner.channel().read_etc(cx, bytes, handles) {
5591 std::task::Poll::Ready(Ok(())) => {}
5592 std::task::Poll::Pending => return std::task::Poll::Pending,
5593 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5594 this.is_terminated = true;
5595 return std::task::Poll::Ready(None);
5596 }
5597 std::task::Poll::Ready(Err(e)) => {
5598 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5599 e.into(),
5600 ))))
5601 }
5602 }
5603
5604 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5606
5607 std::task::Poll::Ready(Some(match header.ordinal {
5608 0x72b44fb963480b11 => {
5609 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5610 let mut req = fidl::new_empty!(
5611 VirtioDeviceConfigureQueueRequest,
5612 fidl::encoding::DefaultFuchsiaResourceDialect
5613 );
5614 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
5615 let control_handle = VirtioMagmaControlHandle { inner: this.inner.clone() };
5616 Ok(VirtioMagmaRequest::ConfigureQueue {
5617 queue: req.queue,
5618 size: req.size,
5619 desc: req.desc,
5620 avail: req.avail,
5621 used: req.used,
5622
5623 responder: VirtioMagmaConfigureQueueResponder {
5624 control_handle: std::mem::ManuallyDrop::new(control_handle),
5625 tx_id: header.tx_id,
5626 },
5627 })
5628 }
5629 0x6e3a61d652499244 => {
5630 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5631 let mut req = fidl::new_empty!(
5632 VirtioDeviceNotifyQueueRequest,
5633 fidl::encoding::DefaultFuchsiaResourceDialect
5634 );
5635 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
5636 let control_handle = VirtioMagmaControlHandle { inner: this.inner.clone() };
5637 Ok(VirtioMagmaRequest::NotifyQueue { queue: req.queue, control_handle })
5638 }
5639 0x45707654f5d23c3f => {
5640 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5641 let mut req = fidl::new_empty!(
5642 VirtioDeviceReadyRequest,
5643 fidl::encoding::DefaultFuchsiaResourceDialect
5644 );
5645 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
5646 let control_handle = VirtioMagmaControlHandle { inner: this.inner.clone() };
5647 Ok(VirtioMagmaRequest::Ready {
5648 negotiated_features: req.negotiated_features,
5649
5650 responder: VirtioMagmaReadyResponder {
5651 control_handle: std::mem::ManuallyDrop::new(control_handle),
5652 tx_id: header.tx_id,
5653 },
5654 })
5655 }
5656 0x6b94e28f73d201e2 => {
5657 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5658 let mut req = fidl::new_empty!(
5659 VirtioMagmaStartRequest,
5660 fidl::encoding::DefaultFuchsiaResourceDialect
5661 );
5662 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioMagmaStartRequest>(&header, _body_bytes, handles, &mut req)?;
5663 let control_handle = VirtioMagmaControlHandle { inner: this.inner.clone() };
5664 Ok(VirtioMagmaRequest::Start {
5665 start_info: req.start_info,
5666 vmar: req.vmar,
5667 wayland_importer: req.wayland_importer,
5668
5669 responder: VirtioMagmaStartResponder {
5670 control_handle: std::mem::ManuallyDrop::new(control_handle),
5671 tx_id: header.tx_id,
5672 },
5673 })
5674 }
5675 _ => Err(fidl::Error::UnknownOrdinal {
5676 ordinal: header.ordinal,
5677 protocol_name:
5678 <VirtioMagmaMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5679 }),
5680 }))
5681 },
5682 )
5683 }
5684}
5685
5686#[derive(Debug)]
5687pub enum VirtioMagmaRequest {
5688 ConfigureQueue {
5691 queue: u16,
5692 size: u16,
5693 desc: u64,
5694 avail: u64,
5695 used: u64,
5696 responder: VirtioMagmaConfigureQueueResponder,
5697 },
5698 NotifyQueue { queue: u16, control_handle: VirtioMagmaControlHandle },
5700 Ready { negotiated_features: u32, responder: VirtioMagmaReadyResponder },
5703 Start {
5705 start_info: StartInfo,
5706 vmar: fidl::Vmar,
5707 wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
5708 responder: VirtioMagmaStartResponder,
5709 },
5710}
5711
5712impl VirtioMagmaRequest {
5713 #[allow(irrefutable_let_patterns)]
5714 pub fn into_configure_queue(
5715 self,
5716 ) -> Option<(u16, u16, u64, u64, u64, VirtioMagmaConfigureQueueResponder)> {
5717 if let VirtioMagmaRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
5718 self
5719 {
5720 Some((queue, size, desc, avail, used, responder))
5721 } else {
5722 None
5723 }
5724 }
5725
5726 #[allow(irrefutable_let_patterns)]
5727 pub fn into_notify_queue(self) -> Option<(u16, VirtioMagmaControlHandle)> {
5728 if let VirtioMagmaRequest::NotifyQueue { queue, control_handle } = self {
5729 Some((queue, control_handle))
5730 } else {
5731 None
5732 }
5733 }
5734
5735 #[allow(irrefutable_let_patterns)]
5736 pub fn into_ready(self) -> Option<(u32, VirtioMagmaReadyResponder)> {
5737 if let VirtioMagmaRequest::Ready { negotiated_features, responder } = self {
5738 Some((negotiated_features, responder))
5739 } else {
5740 None
5741 }
5742 }
5743
5744 #[allow(irrefutable_let_patterns)]
5745 pub fn into_start(
5746 self,
5747 ) -> Option<(
5748 StartInfo,
5749 fidl::Vmar,
5750 Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
5751 VirtioMagmaStartResponder,
5752 )> {
5753 if let VirtioMagmaRequest::Start { start_info, vmar, wayland_importer, responder } = self {
5754 Some((start_info, vmar, wayland_importer, responder))
5755 } else {
5756 None
5757 }
5758 }
5759
5760 pub fn method_name(&self) -> &'static str {
5762 match *self {
5763 VirtioMagmaRequest::ConfigureQueue { .. } => "configure_queue",
5764 VirtioMagmaRequest::NotifyQueue { .. } => "notify_queue",
5765 VirtioMagmaRequest::Ready { .. } => "ready",
5766 VirtioMagmaRequest::Start { .. } => "start",
5767 }
5768 }
5769}
5770
5771#[derive(Debug, Clone)]
5772pub struct VirtioMagmaControlHandle {
5773 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5774}
5775
5776impl fidl::endpoints::ControlHandle for VirtioMagmaControlHandle {
5777 fn shutdown(&self) {
5778 self.inner.shutdown()
5779 }
5780 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5781 self.inner.shutdown_with_epitaph(status)
5782 }
5783
5784 fn is_closed(&self) -> bool {
5785 self.inner.channel().is_closed()
5786 }
5787 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5788 self.inner.channel().on_closed()
5789 }
5790
5791 #[cfg(target_os = "fuchsia")]
5792 fn signal_peer(
5793 &self,
5794 clear_mask: zx::Signals,
5795 set_mask: zx::Signals,
5796 ) -> Result<(), zx_status::Status> {
5797 use fidl::Peered;
5798 self.inner.channel().signal_peer(clear_mask, set_mask)
5799 }
5800}
5801
5802impl VirtioMagmaControlHandle {}
5803
5804#[must_use = "FIDL methods require a response to be sent"]
5805#[derive(Debug)]
5806pub struct VirtioMagmaConfigureQueueResponder {
5807 control_handle: std::mem::ManuallyDrop<VirtioMagmaControlHandle>,
5808 tx_id: u32,
5809}
5810
5811impl std::ops::Drop for VirtioMagmaConfigureQueueResponder {
5815 fn drop(&mut self) {
5816 self.control_handle.shutdown();
5817 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5819 }
5820}
5821
5822impl fidl::endpoints::Responder for VirtioMagmaConfigureQueueResponder {
5823 type ControlHandle = VirtioMagmaControlHandle;
5824
5825 fn control_handle(&self) -> &VirtioMagmaControlHandle {
5826 &self.control_handle
5827 }
5828
5829 fn drop_without_shutdown(mut self) {
5830 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5832 std::mem::forget(self);
5834 }
5835}
5836
5837impl VirtioMagmaConfigureQueueResponder {
5838 pub fn send(self) -> Result<(), fidl::Error> {
5842 let _result = self.send_raw();
5843 if _result.is_err() {
5844 self.control_handle.shutdown();
5845 }
5846 self.drop_without_shutdown();
5847 _result
5848 }
5849
5850 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5852 let _result = self.send_raw();
5853 self.drop_without_shutdown();
5854 _result
5855 }
5856
5857 fn send_raw(&self) -> Result<(), fidl::Error> {
5858 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5859 (),
5860 self.tx_id,
5861 0x72b44fb963480b11,
5862 fidl::encoding::DynamicFlags::empty(),
5863 )
5864 }
5865}
5866
5867#[must_use = "FIDL methods require a response to be sent"]
5868#[derive(Debug)]
5869pub struct VirtioMagmaReadyResponder {
5870 control_handle: std::mem::ManuallyDrop<VirtioMagmaControlHandle>,
5871 tx_id: u32,
5872}
5873
5874impl std::ops::Drop for VirtioMagmaReadyResponder {
5878 fn drop(&mut self) {
5879 self.control_handle.shutdown();
5880 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5882 }
5883}
5884
5885impl fidl::endpoints::Responder for VirtioMagmaReadyResponder {
5886 type ControlHandle = VirtioMagmaControlHandle;
5887
5888 fn control_handle(&self) -> &VirtioMagmaControlHandle {
5889 &self.control_handle
5890 }
5891
5892 fn drop_without_shutdown(mut self) {
5893 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5895 std::mem::forget(self);
5897 }
5898}
5899
5900impl VirtioMagmaReadyResponder {
5901 pub fn send(self) -> Result<(), fidl::Error> {
5905 let _result = self.send_raw();
5906 if _result.is_err() {
5907 self.control_handle.shutdown();
5908 }
5909 self.drop_without_shutdown();
5910 _result
5911 }
5912
5913 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5915 let _result = self.send_raw();
5916 self.drop_without_shutdown();
5917 _result
5918 }
5919
5920 fn send_raw(&self) -> Result<(), fidl::Error> {
5921 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5922 (),
5923 self.tx_id,
5924 0x45707654f5d23c3f,
5925 fidl::encoding::DynamicFlags::empty(),
5926 )
5927 }
5928}
5929
5930#[must_use = "FIDL methods require a response to be sent"]
5931#[derive(Debug)]
5932pub struct VirtioMagmaStartResponder {
5933 control_handle: std::mem::ManuallyDrop<VirtioMagmaControlHandle>,
5934 tx_id: u32,
5935}
5936
5937impl std::ops::Drop for VirtioMagmaStartResponder {
5941 fn drop(&mut self) {
5942 self.control_handle.shutdown();
5943 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5945 }
5946}
5947
5948impl fidl::endpoints::Responder for VirtioMagmaStartResponder {
5949 type ControlHandle = VirtioMagmaControlHandle;
5950
5951 fn control_handle(&self) -> &VirtioMagmaControlHandle {
5952 &self.control_handle
5953 }
5954
5955 fn drop_without_shutdown(mut self) {
5956 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5958 std::mem::forget(self);
5960 }
5961}
5962
5963impl VirtioMagmaStartResponder {
5964 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
5968 let _result = self.send_raw(status);
5969 if _result.is_err() {
5970 self.control_handle.shutdown();
5971 }
5972 self.drop_without_shutdown();
5973 _result
5974 }
5975
5976 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
5978 let _result = self.send_raw(status);
5979 self.drop_without_shutdown();
5980 _result
5981 }
5982
5983 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
5984 self.control_handle.inner.send::<VirtioMagmaStartResponse>(
5985 (status,),
5986 self.tx_id,
5987 0x6b94e28f73d201e2,
5988 fidl::encoding::DynamicFlags::empty(),
5989 )
5990 }
5991}
5992
5993#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5994pub struct VirtioMemMarker;
5995
5996impl fidl::endpoints::ProtocolMarker for VirtioMemMarker {
5997 type Proxy = VirtioMemProxy;
5998 type RequestStream = VirtioMemRequestStream;
5999 #[cfg(target_os = "fuchsia")]
6000 type SynchronousProxy = VirtioMemSynchronousProxy;
6001
6002 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioMem";
6003}
6004impl fidl::endpoints::DiscoverableProtocolMarker for VirtioMemMarker {}
6005
6006pub trait VirtioMemProxyInterface: Send + Sync {
6007 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6008 fn r#configure_queue(
6009 &self,
6010 queue: u16,
6011 size: u16,
6012 desc: u64,
6013 avail: u64,
6014 used: u64,
6015 ) -> Self::ConfigureQueueResponseFut;
6016 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
6017 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6018 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
6019 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6020 fn r#start(
6021 &self,
6022 start_info: StartInfo,
6023 region_addr: u64,
6024 plugged_block_size: u64,
6025 region_size: u64,
6026 ) -> Self::StartResponseFut;
6027}
6028#[derive(Debug)]
6029#[cfg(target_os = "fuchsia")]
6030pub struct VirtioMemSynchronousProxy {
6031 client: fidl::client::sync::Client,
6032}
6033
6034#[cfg(target_os = "fuchsia")]
6035impl fidl::endpoints::SynchronousProxy for VirtioMemSynchronousProxy {
6036 type Proxy = VirtioMemProxy;
6037 type Protocol = VirtioMemMarker;
6038
6039 fn from_channel(inner: fidl::Channel) -> Self {
6040 Self::new(inner)
6041 }
6042
6043 fn into_channel(self) -> fidl::Channel {
6044 self.client.into_channel()
6045 }
6046
6047 fn as_channel(&self) -> &fidl::Channel {
6048 self.client.as_channel()
6049 }
6050}
6051
6052#[cfg(target_os = "fuchsia")]
6053impl VirtioMemSynchronousProxy {
6054 pub fn new(channel: fidl::Channel) -> Self {
6055 let protocol_name = <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6056 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6057 }
6058
6059 pub fn into_channel(self) -> fidl::Channel {
6060 self.client.into_channel()
6061 }
6062
6063 pub fn wait_for_event(
6066 &self,
6067 deadline: zx::MonotonicInstant,
6068 ) -> Result<VirtioMemEvent, fidl::Error> {
6069 VirtioMemEvent::decode(self.client.wait_for_event(deadline)?)
6070 }
6071
6072 pub fn r#configure_queue(
6075 &self,
6076 mut queue: u16,
6077 mut size: u16,
6078 mut desc: u64,
6079 mut avail: u64,
6080 mut used: u64,
6081 ___deadline: zx::MonotonicInstant,
6082 ) -> Result<(), fidl::Error> {
6083 let _response = self
6084 .client
6085 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
6086 (queue, size, desc, avail, used),
6087 0x72b44fb963480b11,
6088 fidl::encoding::DynamicFlags::empty(),
6089 ___deadline,
6090 )?;
6091 Ok(_response)
6092 }
6093
6094 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
6096 self.client.send::<VirtioDeviceNotifyQueueRequest>(
6097 (queue,),
6098 0x6e3a61d652499244,
6099 fidl::encoding::DynamicFlags::empty(),
6100 )
6101 }
6102
6103 pub fn r#ready(
6106 &self,
6107 mut negotiated_features: u32,
6108 ___deadline: zx::MonotonicInstant,
6109 ) -> Result<(), fidl::Error> {
6110 let _response =
6111 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
6112 (negotiated_features,),
6113 0x45707654f5d23c3f,
6114 fidl::encoding::DynamicFlags::empty(),
6115 ___deadline,
6116 )?;
6117 Ok(_response)
6118 }
6119
6120 pub fn r#start(
6122 &self,
6123 mut start_info: StartInfo,
6124 mut region_addr: u64,
6125 mut plugged_block_size: u64,
6126 mut region_size: u64,
6127 ___deadline: zx::MonotonicInstant,
6128 ) -> Result<(), fidl::Error> {
6129 let _response =
6130 self.client.send_query::<VirtioMemStartRequest, fidl::encoding::EmptyPayload>(
6131 (&mut start_info, region_addr, plugged_block_size, region_size),
6132 0x66dd64f17fb5223c,
6133 fidl::encoding::DynamicFlags::empty(),
6134 ___deadline,
6135 )?;
6136 Ok(_response)
6137 }
6138}
6139
6140#[cfg(target_os = "fuchsia")]
6141impl From<VirtioMemSynchronousProxy> for zx::Handle {
6142 fn from(value: VirtioMemSynchronousProxy) -> Self {
6143 value.into_channel().into()
6144 }
6145}
6146
6147#[cfg(target_os = "fuchsia")]
6148impl From<fidl::Channel> for VirtioMemSynchronousProxy {
6149 fn from(value: fidl::Channel) -> Self {
6150 Self::new(value)
6151 }
6152}
6153
6154#[derive(Debug, Clone)]
6155pub struct VirtioMemProxy {
6156 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6157}
6158
6159impl fidl::endpoints::Proxy for VirtioMemProxy {
6160 type Protocol = VirtioMemMarker;
6161
6162 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6163 Self::new(inner)
6164 }
6165
6166 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6167 self.client.into_channel().map_err(|client| Self { client })
6168 }
6169
6170 fn as_channel(&self) -> &::fidl::AsyncChannel {
6171 self.client.as_channel()
6172 }
6173}
6174
6175impl VirtioMemProxy {
6176 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6178 let protocol_name = <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6179 Self { client: fidl::client::Client::new(channel, protocol_name) }
6180 }
6181
6182 pub fn take_event_stream(&self) -> VirtioMemEventStream {
6188 VirtioMemEventStream { event_receiver: self.client.take_event_receiver() }
6189 }
6190
6191 pub fn r#configure_queue(
6194 &self,
6195 mut queue: u16,
6196 mut size: u16,
6197 mut desc: u64,
6198 mut avail: u64,
6199 mut used: u64,
6200 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6201 VirtioMemProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
6202 }
6203
6204 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
6206 VirtioMemProxyInterface::r#notify_queue(self, queue)
6207 }
6208
6209 pub fn r#ready(
6212 &self,
6213 mut negotiated_features: u32,
6214 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6215 VirtioMemProxyInterface::r#ready(self, negotiated_features)
6216 }
6217
6218 pub fn r#start(
6220 &self,
6221 mut start_info: StartInfo,
6222 mut region_addr: u64,
6223 mut plugged_block_size: u64,
6224 mut region_size: u64,
6225 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6226 VirtioMemProxyInterface::r#start(
6227 self,
6228 start_info,
6229 region_addr,
6230 plugged_block_size,
6231 region_size,
6232 )
6233 }
6234}
6235
6236impl VirtioMemProxyInterface for VirtioMemProxy {
6237 type ConfigureQueueResponseFut =
6238 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6239 fn r#configure_queue(
6240 &self,
6241 mut queue: u16,
6242 mut size: u16,
6243 mut desc: u64,
6244 mut avail: u64,
6245 mut used: u64,
6246 ) -> Self::ConfigureQueueResponseFut {
6247 fn _decode(
6248 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6249 ) -> Result<(), fidl::Error> {
6250 let _response = fidl::client::decode_transaction_body::<
6251 fidl::encoding::EmptyPayload,
6252 fidl::encoding::DefaultFuchsiaResourceDialect,
6253 0x72b44fb963480b11,
6254 >(_buf?)?;
6255 Ok(_response)
6256 }
6257 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
6258 (queue, size, desc, avail, used),
6259 0x72b44fb963480b11,
6260 fidl::encoding::DynamicFlags::empty(),
6261 _decode,
6262 )
6263 }
6264
6265 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
6266 self.client.send::<VirtioDeviceNotifyQueueRequest>(
6267 (queue,),
6268 0x6e3a61d652499244,
6269 fidl::encoding::DynamicFlags::empty(),
6270 )
6271 }
6272
6273 type ReadyResponseFut =
6274 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6275 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
6276 fn _decode(
6277 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6278 ) -> Result<(), fidl::Error> {
6279 let _response = fidl::client::decode_transaction_body::<
6280 fidl::encoding::EmptyPayload,
6281 fidl::encoding::DefaultFuchsiaResourceDialect,
6282 0x45707654f5d23c3f,
6283 >(_buf?)?;
6284 Ok(_response)
6285 }
6286 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
6287 (negotiated_features,),
6288 0x45707654f5d23c3f,
6289 fidl::encoding::DynamicFlags::empty(),
6290 _decode,
6291 )
6292 }
6293
6294 type StartResponseFut =
6295 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6296 fn r#start(
6297 &self,
6298 mut start_info: StartInfo,
6299 mut region_addr: u64,
6300 mut plugged_block_size: u64,
6301 mut region_size: u64,
6302 ) -> Self::StartResponseFut {
6303 fn _decode(
6304 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6305 ) -> Result<(), fidl::Error> {
6306 let _response = fidl::client::decode_transaction_body::<
6307 fidl::encoding::EmptyPayload,
6308 fidl::encoding::DefaultFuchsiaResourceDialect,
6309 0x66dd64f17fb5223c,
6310 >(_buf?)?;
6311 Ok(_response)
6312 }
6313 self.client.send_query_and_decode::<VirtioMemStartRequest, ()>(
6314 (&mut start_info, region_addr, plugged_block_size, region_size),
6315 0x66dd64f17fb5223c,
6316 fidl::encoding::DynamicFlags::empty(),
6317 _decode,
6318 )
6319 }
6320}
6321
6322pub struct VirtioMemEventStream {
6323 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6324}
6325
6326impl std::marker::Unpin for VirtioMemEventStream {}
6327
6328impl futures::stream::FusedStream for VirtioMemEventStream {
6329 fn is_terminated(&self) -> bool {
6330 self.event_receiver.is_terminated()
6331 }
6332}
6333
6334impl futures::Stream for VirtioMemEventStream {
6335 type Item = Result<VirtioMemEvent, fidl::Error>;
6336
6337 fn poll_next(
6338 mut self: std::pin::Pin<&mut Self>,
6339 cx: &mut std::task::Context<'_>,
6340 ) -> std::task::Poll<Option<Self::Item>> {
6341 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6342 &mut self.event_receiver,
6343 cx
6344 )?) {
6345 Some(buf) => std::task::Poll::Ready(Some(VirtioMemEvent::decode(buf))),
6346 None => std::task::Poll::Ready(None),
6347 }
6348 }
6349}
6350
6351#[derive(Debug)]
6352pub enum VirtioMemEvent {
6353 OnConfigChanged { plugged_size: u64 },
6354}
6355
6356impl VirtioMemEvent {
6357 #[allow(irrefutable_let_patterns)]
6358 pub fn into_on_config_changed(self) -> Option<u64> {
6359 if let VirtioMemEvent::OnConfigChanged { plugged_size } = self {
6360 Some((plugged_size))
6361 } else {
6362 None
6363 }
6364 }
6365
6366 fn decode(
6368 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6369 ) -> Result<VirtioMemEvent, fidl::Error> {
6370 let (bytes, _handles) = buf.split_mut();
6371 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6372 debug_assert_eq!(tx_header.tx_id, 0);
6373 match tx_header.ordinal {
6374 0x73b86d7cc80020b9 => {
6375 let mut out = fidl::new_empty!(
6376 VirtioMemOnConfigChangedRequest,
6377 fidl::encoding::DefaultFuchsiaResourceDialect
6378 );
6379 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioMemOnConfigChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6380 Ok((VirtioMemEvent::OnConfigChanged { plugged_size: out.plugged_size }))
6381 }
6382 _ => Err(fidl::Error::UnknownOrdinal {
6383 ordinal: tx_header.ordinal,
6384 protocol_name: <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6385 }),
6386 }
6387 }
6388}
6389
6390pub struct VirtioMemRequestStream {
6392 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6393 is_terminated: bool,
6394}
6395
6396impl std::marker::Unpin for VirtioMemRequestStream {}
6397
6398impl futures::stream::FusedStream for VirtioMemRequestStream {
6399 fn is_terminated(&self) -> bool {
6400 self.is_terminated
6401 }
6402}
6403
6404impl fidl::endpoints::RequestStream for VirtioMemRequestStream {
6405 type Protocol = VirtioMemMarker;
6406 type ControlHandle = VirtioMemControlHandle;
6407
6408 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6409 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6410 }
6411
6412 fn control_handle(&self) -> Self::ControlHandle {
6413 VirtioMemControlHandle { inner: self.inner.clone() }
6414 }
6415
6416 fn into_inner(
6417 self,
6418 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6419 {
6420 (self.inner, self.is_terminated)
6421 }
6422
6423 fn from_inner(
6424 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6425 is_terminated: bool,
6426 ) -> Self {
6427 Self { inner, is_terminated }
6428 }
6429}
6430
6431impl futures::Stream for VirtioMemRequestStream {
6432 type Item = Result<VirtioMemRequest, fidl::Error>;
6433
6434 fn poll_next(
6435 mut self: std::pin::Pin<&mut Self>,
6436 cx: &mut std::task::Context<'_>,
6437 ) -> std::task::Poll<Option<Self::Item>> {
6438 let this = &mut *self;
6439 if this.inner.check_shutdown(cx) {
6440 this.is_terminated = true;
6441 return std::task::Poll::Ready(None);
6442 }
6443 if this.is_terminated {
6444 panic!("polled VirtioMemRequestStream after completion");
6445 }
6446 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6447 |bytes, handles| {
6448 match this.inner.channel().read_etc(cx, bytes, handles) {
6449 std::task::Poll::Ready(Ok(())) => {}
6450 std::task::Poll::Pending => return std::task::Poll::Pending,
6451 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6452 this.is_terminated = true;
6453 return std::task::Poll::Ready(None);
6454 }
6455 std::task::Poll::Ready(Err(e)) => {
6456 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6457 e.into(),
6458 ))))
6459 }
6460 }
6461
6462 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6464
6465 std::task::Poll::Ready(Some(match header.ordinal {
6466 0x72b44fb963480b11 => {
6467 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6468 let mut req = fidl::new_empty!(
6469 VirtioDeviceConfigureQueueRequest,
6470 fidl::encoding::DefaultFuchsiaResourceDialect
6471 );
6472 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
6473 let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
6474 Ok(VirtioMemRequest::ConfigureQueue {
6475 queue: req.queue,
6476 size: req.size,
6477 desc: req.desc,
6478 avail: req.avail,
6479 used: req.used,
6480
6481 responder: VirtioMemConfigureQueueResponder {
6482 control_handle: std::mem::ManuallyDrop::new(control_handle),
6483 tx_id: header.tx_id,
6484 },
6485 })
6486 }
6487 0x6e3a61d652499244 => {
6488 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6489 let mut req = fidl::new_empty!(
6490 VirtioDeviceNotifyQueueRequest,
6491 fidl::encoding::DefaultFuchsiaResourceDialect
6492 );
6493 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
6494 let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
6495 Ok(VirtioMemRequest::NotifyQueue { queue: req.queue, control_handle })
6496 }
6497 0x45707654f5d23c3f => {
6498 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6499 let mut req = fidl::new_empty!(
6500 VirtioDeviceReadyRequest,
6501 fidl::encoding::DefaultFuchsiaResourceDialect
6502 );
6503 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
6504 let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
6505 Ok(VirtioMemRequest::Ready {
6506 negotiated_features: req.negotiated_features,
6507
6508 responder: VirtioMemReadyResponder {
6509 control_handle: std::mem::ManuallyDrop::new(control_handle),
6510 tx_id: header.tx_id,
6511 },
6512 })
6513 }
6514 0x66dd64f17fb5223c => {
6515 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6516 let mut req = fidl::new_empty!(
6517 VirtioMemStartRequest,
6518 fidl::encoding::DefaultFuchsiaResourceDialect
6519 );
6520 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioMemStartRequest>(&header, _body_bytes, handles, &mut req)?;
6521 let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
6522 Ok(VirtioMemRequest::Start {
6523 start_info: req.start_info,
6524 region_addr: req.region_addr,
6525 plugged_block_size: req.plugged_block_size,
6526 region_size: req.region_size,
6527
6528 responder: VirtioMemStartResponder {
6529 control_handle: std::mem::ManuallyDrop::new(control_handle),
6530 tx_id: header.tx_id,
6531 },
6532 })
6533 }
6534 _ => Err(fidl::Error::UnknownOrdinal {
6535 ordinal: header.ordinal,
6536 protocol_name:
6537 <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6538 }),
6539 }))
6540 },
6541 )
6542 }
6543}
6544
6545#[derive(Debug)]
6546pub enum VirtioMemRequest {
6547 ConfigureQueue {
6550 queue: u16,
6551 size: u16,
6552 desc: u64,
6553 avail: u64,
6554 used: u64,
6555 responder: VirtioMemConfigureQueueResponder,
6556 },
6557 NotifyQueue { queue: u16, control_handle: VirtioMemControlHandle },
6559 Ready { negotiated_features: u32, responder: VirtioMemReadyResponder },
6562 Start {
6564 start_info: StartInfo,
6565 region_addr: u64,
6566 plugged_block_size: u64,
6567 region_size: u64,
6568 responder: VirtioMemStartResponder,
6569 },
6570}
6571
6572impl VirtioMemRequest {
6573 #[allow(irrefutable_let_patterns)]
6574 pub fn into_configure_queue(
6575 self,
6576 ) -> Option<(u16, u16, u64, u64, u64, VirtioMemConfigureQueueResponder)> {
6577 if let VirtioMemRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
6578 {
6579 Some((queue, size, desc, avail, used, responder))
6580 } else {
6581 None
6582 }
6583 }
6584
6585 #[allow(irrefutable_let_patterns)]
6586 pub fn into_notify_queue(self) -> Option<(u16, VirtioMemControlHandle)> {
6587 if let VirtioMemRequest::NotifyQueue { queue, control_handle } = self {
6588 Some((queue, control_handle))
6589 } else {
6590 None
6591 }
6592 }
6593
6594 #[allow(irrefutable_let_patterns)]
6595 pub fn into_ready(self) -> Option<(u32, VirtioMemReadyResponder)> {
6596 if let VirtioMemRequest::Ready { negotiated_features, responder } = self {
6597 Some((negotiated_features, responder))
6598 } else {
6599 None
6600 }
6601 }
6602
6603 #[allow(irrefutable_let_patterns)]
6604 pub fn into_start(self) -> Option<(StartInfo, u64, u64, u64, VirtioMemStartResponder)> {
6605 if let VirtioMemRequest::Start {
6606 start_info,
6607 region_addr,
6608 plugged_block_size,
6609 region_size,
6610 responder,
6611 } = self
6612 {
6613 Some((start_info, region_addr, plugged_block_size, region_size, responder))
6614 } else {
6615 None
6616 }
6617 }
6618
6619 pub fn method_name(&self) -> &'static str {
6621 match *self {
6622 VirtioMemRequest::ConfigureQueue { .. } => "configure_queue",
6623 VirtioMemRequest::NotifyQueue { .. } => "notify_queue",
6624 VirtioMemRequest::Ready { .. } => "ready",
6625 VirtioMemRequest::Start { .. } => "start",
6626 }
6627 }
6628}
6629
6630#[derive(Debug, Clone)]
6631pub struct VirtioMemControlHandle {
6632 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6633}
6634
6635impl fidl::endpoints::ControlHandle for VirtioMemControlHandle {
6636 fn shutdown(&self) {
6637 self.inner.shutdown()
6638 }
6639 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6640 self.inner.shutdown_with_epitaph(status)
6641 }
6642
6643 fn is_closed(&self) -> bool {
6644 self.inner.channel().is_closed()
6645 }
6646 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6647 self.inner.channel().on_closed()
6648 }
6649
6650 #[cfg(target_os = "fuchsia")]
6651 fn signal_peer(
6652 &self,
6653 clear_mask: zx::Signals,
6654 set_mask: zx::Signals,
6655 ) -> Result<(), zx_status::Status> {
6656 use fidl::Peered;
6657 self.inner.channel().signal_peer(clear_mask, set_mask)
6658 }
6659}
6660
6661impl VirtioMemControlHandle {
6662 pub fn send_on_config_changed(&self, mut plugged_size: u64) -> Result<(), fidl::Error> {
6663 self.inner.send::<VirtioMemOnConfigChangedRequest>(
6664 (plugged_size,),
6665 0,
6666 0x73b86d7cc80020b9,
6667 fidl::encoding::DynamicFlags::empty(),
6668 )
6669 }
6670}
6671
6672#[must_use = "FIDL methods require a response to be sent"]
6673#[derive(Debug)]
6674pub struct VirtioMemConfigureQueueResponder {
6675 control_handle: std::mem::ManuallyDrop<VirtioMemControlHandle>,
6676 tx_id: u32,
6677}
6678
6679impl std::ops::Drop for VirtioMemConfigureQueueResponder {
6683 fn drop(&mut self) {
6684 self.control_handle.shutdown();
6685 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6687 }
6688}
6689
6690impl fidl::endpoints::Responder for VirtioMemConfigureQueueResponder {
6691 type ControlHandle = VirtioMemControlHandle;
6692
6693 fn control_handle(&self) -> &VirtioMemControlHandle {
6694 &self.control_handle
6695 }
6696
6697 fn drop_without_shutdown(mut self) {
6698 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6700 std::mem::forget(self);
6702 }
6703}
6704
6705impl VirtioMemConfigureQueueResponder {
6706 pub fn send(self) -> Result<(), fidl::Error> {
6710 let _result = self.send_raw();
6711 if _result.is_err() {
6712 self.control_handle.shutdown();
6713 }
6714 self.drop_without_shutdown();
6715 _result
6716 }
6717
6718 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6720 let _result = self.send_raw();
6721 self.drop_without_shutdown();
6722 _result
6723 }
6724
6725 fn send_raw(&self) -> Result<(), fidl::Error> {
6726 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6727 (),
6728 self.tx_id,
6729 0x72b44fb963480b11,
6730 fidl::encoding::DynamicFlags::empty(),
6731 )
6732 }
6733}
6734
6735#[must_use = "FIDL methods require a response to be sent"]
6736#[derive(Debug)]
6737pub struct VirtioMemReadyResponder {
6738 control_handle: std::mem::ManuallyDrop<VirtioMemControlHandle>,
6739 tx_id: u32,
6740}
6741
6742impl std::ops::Drop for VirtioMemReadyResponder {
6746 fn drop(&mut self) {
6747 self.control_handle.shutdown();
6748 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6750 }
6751}
6752
6753impl fidl::endpoints::Responder for VirtioMemReadyResponder {
6754 type ControlHandle = VirtioMemControlHandle;
6755
6756 fn control_handle(&self) -> &VirtioMemControlHandle {
6757 &self.control_handle
6758 }
6759
6760 fn drop_without_shutdown(mut self) {
6761 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6763 std::mem::forget(self);
6765 }
6766}
6767
6768impl VirtioMemReadyResponder {
6769 pub fn send(self) -> Result<(), fidl::Error> {
6773 let _result = self.send_raw();
6774 if _result.is_err() {
6775 self.control_handle.shutdown();
6776 }
6777 self.drop_without_shutdown();
6778 _result
6779 }
6780
6781 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6783 let _result = self.send_raw();
6784 self.drop_without_shutdown();
6785 _result
6786 }
6787
6788 fn send_raw(&self) -> Result<(), fidl::Error> {
6789 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6790 (),
6791 self.tx_id,
6792 0x45707654f5d23c3f,
6793 fidl::encoding::DynamicFlags::empty(),
6794 )
6795 }
6796}
6797
6798#[must_use = "FIDL methods require a response to be sent"]
6799#[derive(Debug)]
6800pub struct VirtioMemStartResponder {
6801 control_handle: std::mem::ManuallyDrop<VirtioMemControlHandle>,
6802 tx_id: u32,
6803}
6804
6805impl std::ops::Drop for VirtioMemStartResponder {
6809 fn drop(&mut self) {
6810 self.control_handle.shutdown();
6811 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6813 }
6814}
6815
6816impl fidl::endpoints::Responder for VirtioMemStartResponder {
6817 type ControlHandle = VirtioMemControlHandle;
6818
6819 fn control_handle(&self) -> &VirtioMemControlHandle {
6820 &self.control_handle
6821 }
6822
6823 fn drop_without_shutdown(mut self) {
6824 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6826 std::mem::forget(self);
6828 }
6829}
6830
6831impl VirtioMemStartResponder {
6832 pub fn send(self) -> Result<(), fidl::Error> {
6836 let _result = self.send_raw();
6837 if _result.is_err() {
6838 self.control_handle.shutdown();
6839 }
6840 self.drop_without_shutdown();
6841 _result
6842 }
6843
6844 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6846 let _result = self.send_raw();
6847 self.drop_without_shutdown();
6848 _result
6849 }
6850
6851 fn send_raw(&self) -> Result<(), fidl::Error> {
6852 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6853 (),
6854 self.tx_id,
6855 0x66dd64f17fb5223c,
6856 fidl::encoding::DynamicFlags::empty(),
6857 )
6858 }
6859}
6860
6861#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6862pub struct VirtioNetMarker;
6863
6864impl fidl::endpoints::ProtocolMarker for VirtioNetMarker {
6865 type Proxy = VirtioNetProxy;
6866 type RequestStream = VirtioNetRequestStream;
6867 #[cfg(target_os = "fuchsia")]
6868 type SynchronousProxy = VirtioNetSynchronousProxy;
6869
6870 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioNet";
6871}
6872impl fidl::endpoints::DiscoverableProtocolMarker for VirtioNetMarker {}
6873pub type VirtioNetStartResult = Result<(), i32>;
6874
6875pub trait VirtioNetProxyInterface: Send + Sync {
6876 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6877 fn r#configure_queue(
6878 &self,
6879 queue: u16,
6880 size: u16,
6881 desc: u64,
6882 avail: u64,
6883 used: u64,
6884 ) -> Self::ConfigureQueueResponseFut;
6885 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
6886 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6887 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
6888 type StartResponseFut: std::future::Future<Output = Result<VirtioNetStartResult, fidl::Error>>
6889 + Send;
6890 fn r#start(
6891 &self,
6892 start_info: StartInfo,
6893 mac_address: &fidl_fuchsia_net::MacAddress,
6894 enable_bridge: bool,
6895 ) -> Self::StartResponseFut;
6896}
6897#[derive(Debug)]
6898#[cfg(target_os = "fuchsia")]
6899pub struct VirtioNetSynchronousProxy {
6900 client: fidl::client::sync::Client,
6901}
6902
6903#[cfg(target_os = "fuchsia")]
6904impl fidl::endpoints::SynchronousProxy for VirtioNetSynchronousProxy {
6905 type Proxy = VirtioNetProxy;
6906 type Protocol = VirtioNetMarker;
6907
6908 fn from_channel(inner: fidl::Channel) -> Self {
6909 Self::new(inner)
6910 }
6911
6912 fn into_channel(self) -> fidl::Channel {
6913 self.client.into_channel()
6914 }
6915
6916 fn as_channel(&self) -> &fidl::Channel {
6917 self.client.as_channel()
6918 }
6919}
6920
6921#[cfg(target_os = "fuchsia")]
6922impl VirtioNetSynchronousProxy {
6923 pub fn new(channel: fidl::Channel) -> Self {
6924 let protocol_name = <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6925 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6926 }
6927
6928 pub fn into_channel(self) -> fidl::Channel {
6929 self.client.into_channel()
6930 }
6931
6932 pub fn wait_for_event(
6935 &self,
6936 deadline: zx::MonotonicInstant,
6937 ) -> Result<VirtioNetEvent, fidl::Error> {
6938 VirtioNetEvent::decode(self.client.wait_for_event(deadline)?)
6939 }
6940
6941 pub fn r#configure_queue(
6944 &self,
6945 mut queue: u16,
6946 mut size: u16,
6947 mut desc: u64,
6948 mut avail: u64,
6949 mut used: u64,
6950 ___deadline: zx::MonotonicInstant,
6951 ) -> Result<(), fidl::Error> {
6952 let _response = self
6953 .client
6954 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
6955 (queue, size, desc, avail, used),
6956 0x72b44fb963480b11,
6957 fidl::encoding::DynamicFlags::empty(),
6958 ___deadline,
6959 )?;
6960 Ok(_response)
6961 }
6962
6963 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
6965 self.client.send::<VirtioDeviceNotifyQueueRequest>(
6966 (queue,),
6967 0x6e3a61d652499244,
6968 fidl::encoding::DynamicFlags::empty(),
6969 )
6970 }
6971
6972 pub fn r#ready(
6975 &self,
6976 mut negotiated_features: u32,
6977 ___deadline: zx::MonotonicInstant,
6978 ) -> Result<(), fidl::Error> {
6979 let _response =
6980 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
6981 (negotiated_features,),
6982 0x45707654f5d23c3f,
6983 fidl::encoding::DynamicFlags::empty(),
6984 ___deadline,
6985 )?;
6986 Ok(_response)
6987 }
6988
6989 pub fn r#start(
6991 &self,
6992 mut start_info: StartInfo,
6993 mut mac_address: &fidl_fuchsia_net::MacAddress,
6994 mut enable_bridge: bool,
6995 ___deadline: zx::MonotonicInstant,
6996 ) -> Result<VirtioNetStartResult, fidl::Error> {
6997 let _response = self.client.send_query::<
6998 VirtioNetStartRequest,
6999 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7000 >(
7001 (&mut start_info, mac_address, enable_bridge,),
7002 0x795c0b3a8461b3ed,
7003 fidl::encoding::DynamicFlags::empty(),
7004 ___deadline,
7005 )?;
7006 Ok(_response.map(|x| x))
7007 }
7008}
7009
7010#[cfg(target_os = "fuchsia")]
7011impl From<VirtioNetSynchronousProxy> for zx::Handle {
7012 fn from(value: VirtioNetSynchronousProxy) -> Self {
7013 value.into_channel().into()
7014 }
7015}
7016
7017#[cfg(target_os = "fuchsia")]
7018impl From<fidl::Channel> for VirtioNetSynchronousProxy {
7019 fn from(value: fidl::Channel) -> Self {
7020 Self::new(value)
7021 }
7022}
7023
7024#[derive(Debug, Clone)]
7025pub struct VirtioNetProxy {
7026 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7027}
7028
7029impl fidl::endpoints::Proxy for VirtioNetProxy {
7030 type Protocol = VirtioNetMarker;
7031
7032 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7033 Self::new(inner)
7034 }
7035
7036 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7037 self.client.into_channel().map_err(|client| Self { client })
7038 }
7039
7040 fn as_channel(&self) -> &::fidl::AsyncChannel {
7041 self.client.as_channel()
7042 }
7043}
7044
7045impl VirtioNetProxy {
7046 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7048 let protocol_name = <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7049 Self { client: fidl::client::Client::new(channel, protocol_name) }
7050 }
7051
7052 pub fn take_event_stream(&self) -> VirtioNetEventStream {
7058 VirtioNetEventStream { event_receiver: self.client.take_event_receiver() }
7059 }
7060
7061 pub fn r#configure_queue(
7064 &self,
7065 mut queue: u16,
7066 mut size: u16,
7067 mut desc: u64,
7068 mut avail: u64,
7069 mut used: u64,
7070 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7071 VirtioNetProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
7072 }
7073
7074 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7076 VirtioNetProxyInterface::r#notify_queue(self, queue)
7077 }
7078
7079 pub fn r#ready(
7082 &self,
7083 mut negotiated_features: u32,
7084 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7085 VirtioNetProxyInterface::r#ready(self, negotiated_features)
7086 }
7087
7088 pub fn r#start(
7090 &self,
7091 mut start_info: StartInfo,
7092 mut mac_address: &fidl_fuchsia_net::MacAddress,
7093 mut enable_bridge: bool,
7094 ) -> fidl::client::QueryResponseFut<
7095 VirtioNetStartResult,
7096 fidl::encoding::DefaultFuchsiaResourceDialect,
7097 > {
7098 VirtioNetProxyInterface::r#start(self, start_info, mac_address, enable_bridge)
7099 }
7100}
7101
7102impl VirtioNetProxyInterface for VirtioNetProxy {
7103 type ConfigureQueueResponseFut =
7104 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7105 fn r#configure_queue(
7106 &self,
7107 mut queue: u16,
7108 mut size: u16,
7109 mut desc: u64,
7110 mut avail: u64,
7111 mut used: u64,
7112 ) -> Self::ConfigureQueueResponseFut {
7113 fn _decode(
7114 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7115 ) -> Result<(), fidl::Error> {
7116 let _response = fidl::client::decode_transaction_body::<
7117 fidl::encoding::EmptyPayload,
7118 fidl::encoding::DefaultFuchsiaResourceDialect,
7119 0x72b44fb963480b11,
7120 >(_buf?)?;
7121 Ok(_response)
7122 }
7123 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
7124 (queue, size, desc, avail, used),
7125 0x72b44fb963480b11,
7126 fidl::encoding::DynamicFlags::empty(),
7127 _decode,
7128 )
7129 }
7130
7131 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7132 self.client.send::<VirtioDeviceNotifyQueueRequest>(
7133 (queue,),
7134 0x6e3a61d652499244,
7135 fidl::encoding::DynamicFlags::empty(),
7136 )
7137 }
7138
7139 type ReadyResponseFut =
7140 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7141 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
7142 fn _decode(
7143 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7144 ) -> Result<(), fidl::Error> {
7145 let _response = fidl::client::decode_transaction_body::<
7146 fidl::encoding::EmptyPayload,
7147 fidl::encoding::DefaultFuchsiaResourceDialect,
7148 0x45707654f5d23c3f,
7149 >(_buf?)?;
7150 Ok(_response)
7151 }
7152 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
7153 (negotiated_features,),
7154 0x45707654f5d23c3f,
7155 fidl::encoding::DynamicFlags::empty(),
7156 _decode,
7157 )
7158 }
7159
7160 type StartResponseFut = fidl::client::QueryResponseFut<
7161 VirtioNetStartResult,
7162 fidl::encoding::DefaultFuchsiaResourceDialect,
7163 >;
7164 fn r#start(
7165 &self,
7166 mut start_info: StartInfo,
7167 mut mac_address: &fidl_fuchsia_net::MacAddress,
7168 mut enable_bridge: bool,
7169 ) -> Self::StartResponseFut {
7170 fn _decode(
7171 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7172 ) -> Result<VirtioNetStartResult, fidl::Error> {
7173 let _response = fidl::client::decode_transaction_body::<
7174 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7175 fidl::encoding::DefaultFuchsiaResourceDialect,
7176 0x795c0b3a8461b3ed,
7177 >(_buf?)?;
7178 Ok(_response.map(|x| x))
7179 }
7180 self.client.send_query_and_decode::<VirtioNetStartRequest, VirtioNetStartResult>(
7181 (&mut start_info, mac_address, enable_bridge),
7182 0x795c0b3a8461b3ed,
7183 fidl::encoding::DynamicFlags::empty(),
7184 _decode,
7185 )
7186 }
7187}
7188
7189pub struct VirtioNetEventStream {
7190 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7191}
7192
7193impl std::marker::Unpin for VirtioNetEventStream {}
7194
7195impl futures::stream::FusedStream for VirtioNetEventStream {
7196 fn is_terminated(&self) -> bool {
7197 self.event_receiver.is_terminated()
7198 }
7199}
7200
7201impl futures::Stream for VirtioNetEventStream {
7202 type Item = Result<VirtioNetEvent, fidl::Error>;
7203
7204 fn poll_next(
7205 mut self: std::pin::Pin<&mut Self>,
7206 cx: &mut std::task::Context<'_>,
7207 ) -> std::task::Poll<Option<Self::Item>> {
7208 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7209 &mut self.event_receiver,
7210 cx
7211 )?) {
7212 Some(buf) => std::task::Poll::Ready(Some(VirtioNetEvent::decode(buf))),
7213 None => std::task::Poll::Ready(None),
7214 }
7215 }
7216}
7217
7218#[derive(Debug)]
7219pub enum VirtioNetEvent {}
7220
7221impl VirtioNetEvent {
7222 fn decode(
7224 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7225 ) -> Result<VirtioNetEvent, fidl::Error> {
7226 let (bytes, _handles) = buf.split_mut();
7227 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7228 debug_assert_eq!(tx_header.tx_id, 0);
7229 match tx_header.ordinal {
7230 _ => Err(fidl::Error::UnknownOrdinal {
7231 ordinal: tx_header.ordinal,
7232 protocol_name: <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7233 }),
7234 }
7235 }
7236}
7237
7238pub struct VirtioNetRequestStream {
7240 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7241 is_terminated: bool,
7242}
7243
7244impl std::marker::Unpin for VirtioNetRequestStream {}
7245
7246impl futures::stream::FusedStream for VirtioNetRequestStream {
7247 fn is_terminated(&self) -> bool {
7248 self.is_terminated
7249 }
7250}
7251
7252impl fidl::endpoints::RequestStream for VirtioNetRequestStream {
7253 type Protocol = VirtioNetMarker;
7254 type ControlHandle = VirtioNetControlHandle;
7255
7256 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7257 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7258 }
7259
7260 fn control_handle(&self) -> Self::ControlHandle {
7261 VirtioNetControlHandle { inner: self.inner.clone() }
7262 }
7263
7264 fn into_inner(
7265 self,
7266 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7267 {
7268 (self.inner, self.is_terminated)
7269 }
7270
7271 fn from_inner(
7272 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7273 is_terminated: bool,
7274 ) -> Self {
7275 Self { inner, is_terminated }
7276 }
7277}
7278
7279impl futures::Stream for VirtioNetRequestStream {
7280 type Item = Result<VirtioNetRequest, fidl::Error>;
7281
7282 fn poll_next(
7283 mut self: std::pin::Pin<&mut Self>,
7284 cx: &mut std::task::Context<'_>,
7285 ) -> std::task::Poll<Option<Self::Item>> {
7286 let this = &mut *self;
7287 if this.inner.check_shutdown(cx) {
7288 this.is_terminated = true;
7289 return std::task::Poll::Ready(None);
7290 }
7291 if this.is_terminated {
7292 panic!("polled VirtioNetRequestStream after completion");
7293 }
7294 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7295 |bytes, handles| {
7296 match this.inner.channel().read_etc(cx, bytes, handles) {
7297 std::task::Poll::Ready(Ok(())) => {}
7298 std::task::Poll::Pending => return std::task::Poll::Pending,
7299 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7300 this.is_terminated = true;
7301 return std::task::Poll::Ready(None);
7302 }
7303 std::task::Poll::Ready(Err(e)) => {
7304 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7305 e.into(),
7306 ))))
7307 }
7308 }
7309
7310 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7312
7313 std::task::Poll::Ready(Some(match header.ordinal {
7314 0x72b44fb963480b11 => {
7315 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7316 let mut req = fidl::new_empty!(
7317 VirtioDeviceConfigureQueueRequest,
7318 fidl::encoding::DefaultFuchsiaResourceDialect
7319 );
7320 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
7321 let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
7322 Ok(VirtioNetRequest::ConfigureQueue {
7323 queue: req.queue,
7324 size: req.size,
7325 desc: req.desc,
7326 avail: req.avail,
7327 used: req.used,
7328
7329 responder: VirtioNetConfigureQueueResponder {
7330 control_handle: std::mem::ManuallyDrop::new(control_handle),
7331 tx_id: header.tx_id,
7332 },
7333 })
7334 }
7335 0x6e3a61d652499244 => {
7336 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7337 let mut req = fidl::new_empty!(
7338 VirtioDeviceNotifyQueueRequest,
7339 fidl::encoding::DefaultFuchsiaResourceDialect
7340 );
7341 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
7342 let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
7343 Ok(VirtioNetRequest::NotifyQueue { queue: req.queue, control_handle })
7344 }
7345 0x45707654f5d23c3f => {
7346 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7347 let mut req = fidl::new_empty!(
7348 VirtioDeviceReadyRequest,
7349 fidl::encoding::DefaultFuchsiaResourceDialect
7350 );
7351 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
7352 let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
7353 Ok(VirtioNetRequest::Ready {
7354 negotiated_features: req.negotiated_features,
7355
7356 responder: VirtioNetReadyResponder {
7357 control_handle: std::mem::ManuallyDrop::new(control_handle),
7358 tx_id: header.tx_id,
7359 },
7360 })
7361 }
7362 0x795c0b3a8461b3ed => {
7363 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7364 let mut req = fidl::new_empty!(
7365 VirtioNetStartRequest,
7366 fidl::encoding::DefaultFuchsiaResourceDialect
7367 );
7368 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioNetStartRequest>(&header, _body_bytes, handles, &mut req)?;
7369 let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
7370 Ok(VirtioNetRequest::Start {
7371 start_info: req.start_info,
7372 mac_address: req.mac_address,
7373 enable_bridge: req.enable_bridge,
7374
7375 responder: VirtioNetStartResponder {
7376 control_handle: std::mem::ManuallyDrop::new(control_handle),
7377 tx_id: header.tx_id,
7378 },
7379 })
7380 }
7381 _ => Err(fidl::Error::UnknownOrdinal {
7382 ordinal: header.ordinal,
7383 protocol_name:
7384 <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7385 }),
7386 }))
7387 },
7388 )
7389 }
7390}
7391
7392#[derive(Debug)]
7393pub enum VirtioNetRequest {
7394 ConfigureQueue {
7397 queue: u16,
7398 size: u16,
7399 desc: u64,
7400 avail: u64,
7401 used: u64,
7402 responder: VirtioNetConfigureQueueResponder,
7403 },
7404 NotifyQueue { queue: u16, control_handle: VirtioNetControlHandle },
7406 Ready { negotiated_features: u32, responder: VirtioNetReadyResponder },
7409 Start {
7411 start_info: StartInfo,
7412 mac_address: fidl_fuchsia_net::MacAddress,
7413 enable_bridge: bool,
7414 responder: VirtioNetStartResponder,
7415 },
7416}
7417
7418impl VirtioNetRequest {
7419 #[allow(irrefutable_let_patterns)]
7420 pub fn into_configure_queue(
7421 self,
7422 ) -> Option<(u16, u16, u64, u64, u64, VirtioNetConfigureQueueResponder)> {
7423 if let VirtioNetRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
7424 {
7425 Some((queue, size, desc, avail, used, responder))
7426 } else {
7427 None
7428 }
7429 }
7430
7431 #[allow(irrefutable_let_patterns)]
7432 pub fn into_notify_queue(self) -> Option<(u16, VirtioNetControlHandle)> {
7433 if let VirtioNetRequest::NotifyQueue { queue, control_handle } = self {
7434 Some((queue, control_handle))
7435 } else {
7436 None
7437 }
7438 }
7439
7440 #[allow(irrefutable_let_patterns)]
7441 pub fn into_ready(self) -> Option<(u32, VirtioNetReadyResponder)> {
7442 if let VirtioNetRequest::Ready { negotiated_features, responder } = self {
7443 Some((negotiated_features, responder))
7444 } else {
7445 None
7446 }
7447 }
7448
7449 #[allow(irrefutable_let_patterns)]
7450 pub fn into_start(
7451 self,
7452 ) -> Option<(StartInfo, fidl_fuchsia_net::MacAddress, bool, VirtioNetStartResponder)> {
7453 if let VirtioNetRequest::Start { start_info, mac_address, enable_bridge, responder } = self
7454 {
7455 Some((start_info, mac_address, enable_bridge, responder))
7456 } else {
7457 None
7458 }
7459 }
7460
7461 pub fn method_name(&self) -> &'static str {
7463 match *self {
7464 VirtioNetRequest::ConfigureQueue { .. } => "configure_queue",
7465 VirtioNetRequest::NotifyQueue { .. } => "notify_queue",
7466 VirtioNetRequest::Ready { .. } => "ready",
7467 VirtioNetRequest::Start { .. } => "start",
7468 }
7469 }
7470}
7471
7472#[derive(Debug, Clone)]
7473pub struct VirtioNetControlHandle {
7474 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7475}
7476
7477impl fidl::endpoints::ControlHandle for VirtioNetControlHandle {
7478 fn shutdown(&self) {
7479 self.inner.shutdown()
7480 }
7481 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7482 self.inner.shutdown_with_epitaph(status)
7483 }
7484
7485 fn is_closed(&self) -> bool {
7486 self.inner.channel().is_closed()
7487 }
7488 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7489 self.inner.channel().on_closed()
7490 }
7491
7492 #[cfg(target_os = "fuchsia")]
7493 fn signal_peer(
7494 &self,
7495 clear_mask: zx::Signals,
7496 set_mask: zx::Signals,
7497 ) -> Result<(), zx_status::Status> {
7498 use fidl::Peered;
7499 self.inner.channel().signal_peer(clear_mask, set_mask)
7500 }
7501}
7502
7503impl VirtioNetControlHandle {}
7504
7505#[must_use = "FIDL methods require a response to be sent"]
7506#[derive(Debug)]
7507pub struct VirtioNetConfigureQueueResponder {
7508 control_handle: std::mem::ManuallyDrop<VirtioNetControlHandle>,
7509 tx_id: u32,
7510}
7511
7512impl std::ops::Drop for VirtioNetConfigureQueueResponder {
7516 fn drop(&mut self) {
7517 self.control_handle.shutdown();
7518 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7520 }
7521}
7522
7523impl fidl::endpoints::Responder for VirtioNetConfigureQueueResponder {
7524 type ControlHandle = VirtioNetControlHandle;
7525
7526 fn control_handle(&self) -> &VirtioNetControlHandle {
7527 &self.control_handle
7528 }
7529
7530 fn drop_without_shutdown(mut self) {
7531 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7533 std::mem::forget(self);
7535 }
7536}
7537
7538impl VirtioNetConfigureQueueResponder {
7539 pub fn send(self) -> Result<(), fidl::Error> {
7543 let _result = self.send_raw();
7544 if _result.is_err() {
7545 self.control_handle.shutdown();
7546 }
7547 self.drop_without_shutdown();
7548 _result
7549 }
7550
7551 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7553 let _result = self.send_raw();
7554 self.drop_without_shutdown();
7555 _result
7556 }
7557
7558 fn send_raw(&self) -> Result<(), fidl::Error> {
7559 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7560 (),
7561 self.tx_id,
7562 0x72b44fb963480b11,
7563 fidl::encoding::DynamicFlags::empty(),
7564 )
7565 }
7566}
7567
7568#[must_use = "FIDL methods require a response to be sent"]
7569#[derive(Debug)]
7570pub struct VirtioNetReadyResponder {
7571 control_handle: std::mem::ManuallyDrop<VirtioNetControlHandle>,
7572 tx_id: u32,
7573}
7574
7575impl std::ops::Drop for VirtioNetReadyResponder {
7579 fn drop(&mut self) {
7580 self.control_handle.shutdown();
7581 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7583 }
7584}
7585
7586impl fidl::endpoints::Responder for VirtioNetReadyResponder {
7587 type ControlHandle = VirtioNetControlHandle;
7588
7589 fn control_handle(&self) -> &VirtioNetControlHandle {
7590 &self.control_handle
7591 }
7592
7593 fn drop_without_shutdown(mut self) {
7594 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7596 std::mem::forget(self);
7598 }
7599}
7600
7601impl VirtioNetReadyResponder {
7602 pub fn send(self) -> Result<(), fidl::Error> {
7606 let _result = self.send_raw();
7607 if _result.is_err() {
7608 self.control_handle.shutdown();
7609 }
7610 self.drop_without_shutdown();
7611 _result
7612 }
7613
7614 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7616 let _result = self.send_raw();
7617 self.drop_without_shutdown();
7618 _result
7619 }
7620
7621 fn send_raw(&self) -> Result<(), fidl::Error> {
7622 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7623 (),
7624 self.tx_id,
7625 0x45707654f5d23c3f,
7626 fidl::encoding::DynamicFlags::empty(),
7627 )
7628 }
7629}
7630
7631#[must_use = "FIDL methods require a response to be sent"]
7632#[derive(Debug)]
7633pub struct VirtioNetStartResponder {
7634 control_handle: std::mem::ManuallyDrop<VirtioNetControlHandle>,
7635 tx_id: u32,
7636}
7637
7638impl std::ops::Drop for VirtioNetStartResponder {
7642 fn drop(&mut self) {
7643 self.control_handle.shutdown();
7644 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7646 }
7647}
7648
7649impl fidl::endpoints::Responder for VirtioNetStartResponder {
7650 type ControlHandle = VirtioNetControlHandle;
7651
7652 fn control_handle(&self) -> &VirtioNetControlHandle {
7653 &self.control_handle
7654 }
7655
7656 fn drop_without_shutdown(mut self) {
7657 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7659 std::mem::forget(self);
7661 }
7662}
7663
7664impl VirtioNetStartResponder {
7665 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7669 let _result = self.send_raw(result);
7670 if _result.is_err() {
7671 self.control_handle.shutdown();
7672 }
7673 self.drop_without_shutdown();
7674 _result
7675 }
7676
7677 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7679 let _result = self.send_raw(result);
7680 self.drop_without_shutdown();
7681 _result
7682 }
7683
7684 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7685 self.control_handle
7686 .inner
7687 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
7688 result,
7689 self.tx_id,
7690 0x795c0b3a8461b3ed,
7691 fidl::encoding::DynamicFlags::empty(),
7692 )
7693 }
7694}
7695
7696#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7697pub struct VirtioRngMarker;
7698
7699impl fidl::endpoints::ProtocolMarker for VirtioRngMarker {
7700 type Proxy = VirtioRngProxy;
7701 type RequestStream = VirtioRngRequestStream;
7702 #[cfg(target_os = "fuchsia")]
7703 type SynchronousProxy = VirtioRngSynchronousProxy;
7704
7705 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioRng";
7706}
7707impl fidl::endpoints::DiscoverableProtocolMarker for VirtioRngMarker {}
7708
7709pub trait VirtioRngProxyInterface: Send + Sync {
7710 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7711 fn r#configure_queue(
7712 &self,
7713 queue: u16,
7714 size: u16,
7715 desc: u64,
7716 avail: u64,
7717 used: u64,
7718 ) -> Self::ConfigureQueueResponseFut;
7719 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
7720 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7721 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
7722 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7723 fn r#start(&self, start_info: StartInfo) -> Self::StartResponseFut;
7724}
7725#[derive(Debug)]
7726#[cfg(target_os = "fuchsia")]
7727pub struct VirtioRngSynchronousProxy {
7728 client: fidl::client::sync::Client,
7729}
7730
7731#[cfg(target_os = "fuchsia")]
7732impl fidl::endpoints::SynchronousProxy for VirtioRngSynchronousProxy {
7733 type Proxy = VirtioRngProxy;
7734 type Protocol = VirtioRngMarker;
7735
7736 fn from_channel(inner: fidl::Channel) -> Self {
7737 Self::new(inner)
7738 }
7739
7740 fn into_channel(self) -> fidl::Channel {
7741 self.client.into_channel()
7742 }
7743
7744 fn as_channel(&self) -> &fidl::Channel {
7745 self.client.as_channel()
7746 }
7747}
7748
7749#[cfg(target_os = "fuchsia")]
7750impl VirtioRngSynchronousProxy {
7751 pub fn new(channel: fidl::Channel) -> Self {
7752 let protocol_name = <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7753 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7754 }
7755
7756 pub fn into_channel(self) -> fidl::Channel {
7757 self.client.into_channel()
7758 }
7759
7760 pub fn wait_for_event(
7763 &self,
7764 deadline: zx::MonotonicInstant,
7765 ) -> Result<VirtioRngEvent, fidl::Error> {
7766 VirtioRngEvent::decode(self.client.wait_for_event(deadline)?)
7767 }
7768
7769 pub fn r#configure_queue(
7772 &self,
7773 mut queue: u16,
7774 mut size: u16,
7775 mut desc: u64,
7776 mut avail: u64,
7777 mut used: u64,
7778 ___deadline: zx::MonotonicInstant,
7779 ) -> Result<(), fidl::Error> {
7780 let _response = self
7781 .client
7782 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
7783 (queue, size, desc, avail, used),
7784 0x72b44fb963480b11,
7785 fidl::encoding::DynamicFlags::empty(),
7786 ___deadline,
7787 )?;
7788 Ok(_response)
7789 }
7790
7791 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7793 self.client.send::<VirtioDeviceNotifyQueueRequest>(
7794 (queue,),
7795 0x6e3a61d652499244,
7796 fidl::encoding::DynamicFlags::empty(),
7797 )
7798 }
7799
7800 pub fn r#ready(
7803 &self,
7804 mut negotiated_features: u32,
7805 ___deadline: zx::MonotonicInstant,
7806 ) -> Result<(), fidl::Error> {
7807 let _response =
7808 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
7809 (negotiated_features,),
7810 0x45707654f5d23c3f,
7811 fidl::encoding::DynamicFlags::empty(),
7812 ___deadline,
7813 )?;
7814 Ok(_response)
7815 }
7816
7817 pub fn r#start(
7819 &self,
7820 mut start_info: StartInfo,
7821 ___deadline: zx::MonotonicInstant,
7822 ) -> Result<(), fidl::Error> {
7823 let _response =
7824 self.client.send_query::<VirtioRngStartRequest, fidl::encoding::EmptyPayload>(
7825 (&mut start_info,),
7826 0x620b3ed254febc0f,
7827 fidl::encoding::DynamicFlags::empty(),
7828 ___deadline,
7829 )?;
7830 Ok(_response)
7831 }
7832}
7833
7834#[cfg(target_os = "fuchsia")]
7835impl From<VirtioRngSynchronousProxy> for zx::Handle {
7836 fn from(value: VirtioRngSynchronousProxy) -> Self {
7837 value.into_channel().into()
7838 }
7839}
7840
7841#[cfg(target_os = "fuchsia")]
7842impl From<fidl::Channel> for VirtioRngSynchronousProxy {
7843 fn from(value: fidl::Channel) -> Self {
7844 Self::new(value)
7845 }
7846}
7847
7848#[derive(Debug, Clone)]
7849pub struct VirtioRngProxy {
7850 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7851}
7852
7853impl fidl::endpoints::Proxy for VirtioRngProxy {
7854 type Protocol = VirtioRngMarker;
7855
7856 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7857 Self::new(inner)
7858 }
7859
7860 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7861 self.client.into_channel().map_err(|client| Self { client })
7862 }
7863
7864 fn as_channel(&self) -> &::fidl::AsyncChannel {
7865 self.client.as_channel()
7866 }
7867}
7868
7869impl VirtioRngProxy {
7870 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7872 let protocol_name = <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7873 Self { client: fidl::client::Client::new(channel, protocol_name) }
7874 }
7875
7876 pub fn take_event_stream(&self) -> VirtioRngEventStream {
7882 VirtioRngEventStream { event_receiver: self.client.take_event_receiver() }
7883 }
7884
7885 pub fn r#configure_queue(
7888 &self,
7889 mut queue: u16,
7890 mut size: u16,
7891 mut desc: u64,
7892 mut avail: u64,
7893 mut used: u64,
7894 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7895 VirtioRngProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
7896 }
7897
7898 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7900 VirtioRngProxyInterface::r#notify_queue(self, queue)
7901 }
7902
7903 pub fn r#ready(
7906 &self,
7907 mut negotiated_features: u32,
7908 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7909 VirtioRngProxyInterface::r#ready(self, negotiated_features)
7910 }
7911
7912 pub fn r#start(
7914 &self,
7915 mut start_info: StartInfo,
7916 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7917 VirtioRngProxyInterface::r#start(self, start_info)
7918 }
7919}
7920
7921impl VirtioRngProxyInterface for VirtioRngProxy {
7922 type ConfigureQueueResponseFut =
7923 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7924 fn r#configure_queue(
7925 &self,
7926 mut queue: u16,
7927 mut size: u16,
7928 mut desc: u64,
7929 mut avail: u64,
7930 mut used: u64,
7931 ) -> Self::ConfigureQueueResponseFut {
7932 fn _decode(
7933 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7934 ) -> Result<(), fidl::Error> {
7935 let _response = fidl::client::decode_transaction_body::<
7936 fidl::encoding::EmptyPayload,
7937 fidl::encoding::DefaultFuchsiaResourceDialect,
7938 0x72b44fb963480b11,
7939 >(_buf?)?;
7940 Ok(_response)
7941 }
7942 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
7943 (queue, size, desc, avail, used),
7944 0x72b44fb963480b11,
7945 fidl::encoding::DynamicFlags::empty(),
7946 _decode,
7947 )
7948 }
7949
7950 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
7951 self.client.send::<VirtioDeviceNotifyQueueRequest>(
7952 (queue,),
7953 0x6e3a61d652499244,
7954 fidl::encoding::DynamicFlags::empty(),
7955 )
7956 }
7957
7958 type ReadyResponseFut =
7959 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7960 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
7961 fn _decode(
7962 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7963 ) -> Result<(), fidl::Error> {
7964 let _response = fidl::client::decode_transaction_body::<
7965 fidl::encoding::EmptyPayload,
7966 fidl::encoding::DefaultFuchsiaResourceDialect,
7967 0x45707654f5d23c3f,
7968 >(_buf?)?;
7969 Ok(_response)
7970 }
7971 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
7972 (negotiated_features,),
7973 0x45707654f5d23c3f,
7974 fidl::encoding::DynamicFlags::empty(),
7975 _decode,
7976 )
7977 }
7978
7979 type StartResponseFut =
7980 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7981 fn r#start(&self, mut start_info: StartInfo) -> Self::StartResponseFut {
7982 fn _decode(
7983 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7984 ) -> Result<(), fidl::Error> {
7985 let _response = fidl::client::decode_transaction_body::<
7986 fidl::encoding::EmptyPayload,
7987 fidl::encoding::DefaultFuchsiaResourceDialect,
7988 0x620b3ed254febc0f,
7989 >(_buf?)?;
7990 Ok(_response)
7991 }
7992 self.client.send_query_and_decode::<VirtioRngStartRequest, ()>(
7993 (&mut start_info,),
7994 0x620b3ed254febc0f,
7995 fidl::encoding::DynamicFlags::empty(),
7996 _decode,
7997 )
7998 }
7999}
8000
8001pub struct VirtioRngEventStream {
8002 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8003}
8004
8005impl std::marker::Unpin for VirtioRngEventStream {}
8006
8007impl futures::stream::FusedStream for VirtioRngEventStream {
8008 fn is_terminated(&self) -> bool {
8009 self.event_receiver.is_terminated()
8010 }
8011}
8012
8013impl futures::Stream for VirtioRngEventStream {
8014 type Item = Result<VirtioRngEvent, fidl::Error>;
8015
8016 fn poll_next(
8017 mut self: std::pin::Pin<&mut Self>,
8018 cx: &mut std::task::Context<'_>,
8019 ) -> std::task::Poll<Option<Self::Item>> {
8020 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8021 &mut self.event_receiver,
8022 cx
8023 )?) {
8024 Some(buf) => std::task::Poll::Ready(Some(VirtioRngEvent::decode(buf))),
8025 None => std::task::Poll::Ready(None),
8026 }
8027 }
8028}
8029
8030#[derive(Debug)]
8031pub enum VirtioRngEvent {}
8032
8033impl VirtioRngEvent {
8034 fn decode(
8036 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8037 ) -> Result<VirtioRngEvent, fidl::Error> {
8038 let (bytes, _handles) = buf.split_mut();
8039 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8040 debug_assert_eq!(tx_header.tx_id, 0);
8041 match tx_header.ordinal {
8042 _ => Err(fidl::Error::UnknownOrdinal {
8043 ordinal: tx_header.ordinal,
8044 protocol_name: <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8045 }),
8046 }
8047 }
8048}
8049
8050pub struct VirtioRngRequestStream {
8052 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8053 is_terminated: bool,
8054}
8055
8056impl std::marker::Unpin for VirtioRngRequestStream {}
8057
8058impl futures::stream::FusedStream for VirtioRngRequestStream {
8059 fn is_terminated(&self) -> bool {
8060 self.is_terminated
8061 }
8062}
8063
8064impl fidl::endpoints::RequestStream for VirtioRngRequestStream {
8065 type Protocol = VirtioRngMarker;
8066 type ControlHandle = VirtioRngControlHandle;
8067
8068 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8069 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8070 }
8071
8072 fn control_handle(&self) -> Self::ControlHandle {
8073 VirtioRngControlHandle { inner: self.inner.clone() }
8074 }
8075
8076 fn into_inner(
8077 self,
8078 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8079 {
8080 (self.inner, self.is_terminated)
8081 }
8082
8083 fn from_inner(
8084 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8085 is_terminated: bool,
8086 ) -> Self {
8087 Self { inner, is_terminated }
8088 }
8089}
8090
8091impl futures::Stream for VirtioRngRequestStream {
8092 type Item = Result<VirtioRngRequest, fidl::Error>;
8093
8094 fn poll_next(
8095 mut self: std::pin::Pin<&mut Self>,
8096 cx: &mut std::task::Context<'_>,
8097 ) -> std::task::Poll<Option<Self::Item>> {
8098 let this = &mut *self;
8099 if this.inner.check_shutdown(cx) {
8100 this.is_terminated = true;
8101 return std::task::Poll::Ready(None);
8102 }
8103 if this.is_terminated {
8104 panic!("polled VirtioRngRequestStream after completion");
8105 }
8106 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8107 |bytes, handles| {
8108 match this.inner.channel().read_etc(cx, bytes, handles) {
8109 std::task::Poll::Ready(Ok(())) => {}
8110 std::task::Poll::Pending => return std::task::Poll::Pending,
8111 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8112 this.is_terminated = true;
8113 return std::task::Poll::Ready(None);
8114 }
8115 std::task::Poll::Ready(Err(e)) => {
8116 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8117 e.into(),
8118 ))))
8119 }
8120 }
8121
8122 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8124
8125 std::task::Poll::Ready(Some(match header.ordinal {
8126 0x72b44fb963480b11 => {
8127 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8128 let mut req = fidl::new_empty!(
8129 VirtioDeviceConfigureQueueRequest,
8130 fidl::encoding::DefaultFuchsiaResourceDialect
8131 );
8132 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
8133 let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
8134 Ok(VirtioRngRequest::ConfigureQueue {
8135 queue: req.queue,
8136 size: req.size,
8137 desc: req.desc,
8138 avail: req.avail,
8139 used: req.used,
8140
8141 responder: VirtioRngConfigureQueueResponder {
8142 control_handle: std::mem::ManuallyDrop::new(control_handle),
8143 tx_id: header.tx_id,
8144 },
8145 })
8146 }
8147 0x6e3a61d652499244 => {
8148 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8149 let mut req = fidl::new_empty!(
8150 VirtioDeviceNotifyQueueRequest,
8151 fidl::encoding::DefaultFuchsiaResourceDialect
8152 );
8153 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
8154 let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
8155 Ok(VirtioRngRequest::NotifyQueue { queue: req.queue, control_handle })
8156 }
8157 0x45707654f5d23c3f => {
8158 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8159 let mut req = fidl::new_empty!(
8160 VirtioDeviceReadyRequest,
8161 fidl::encoding::DefaultFuchsiaResourceDialect
8162 );
8163 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
8164 let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
8165 Ok(VirtioRngRequest::Ready {
8166 negotiated_features: req.negotiated_features,
8167
8168 responder: VirtioRngReadyResponder {
8169 control_handle: std::mem::ManuallyDrop::new(control_handle),
8170 tx_id: header.tx_id,
8171 },
8172 })
8173 }
8174 0x620b3ed254febc0f => {
8175 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8176 let mut req = fidl::new_empty!(
8177 VirtioRngStartRequest,
8178 fidl::encoding::DefaultFuchsiaResourceDialect
8179 );
8180 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioRngStartRequest>(&header, _body_bytes, handles, &mut req)?;
8181 let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
8182 Ok(VirtioRngRequest::Start {
8183 start_info: req.start_info,
8184
8185 responder: VirtioRngStartResponder {
8186 control_handle: std::mem::ManuallyDrop::new(control_handle),
8187 tx_id: header.tx_id,
8188 },
8189 })
8190 }
8191 _ => Err(fidl::Error::UnknownOrdinal {
8192 ordinal: header.ordinal,
8193 protocol_name:
8194 <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8195 }),
8196 }))
8197 },
8198 )
8199 }
8200}
8201
8202#[derive(Debug)]
8203pub enum VirtioRngRequest {
8204 ConfigureQueue {
8207 queue: u16,
8208 size: u16,
8209 desc: u64,
8210 avail: u64,
8211 used: u64,
8212 responder: VirtioRngConfigureQueueResponder,
8213 },
8214 NotifyQueue { queue: u16, control_handle: VirtioRngControlHandle },
8216 Ready { negotiated_features: u32, responder: VirtioRngReadyResponder },
8219 Start { start_info: StartInfo, responder: VirtioRngStartResponder },
8221}
8222
8223impl VirtioRngRequest {
8224 #[allow(irrefutable_let_patterns)]
8225 pub fn into_configure_queue(
8226 self,
8227 ) -> Option<(u16, u16, u64, u64, u64, VirtioRngConfigureQueueResponder)> {
8228 if let VirtioRngRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
8229 {
8230 Some((queue, size, desc, avail, used, responder))
8231 } else {
8232 None
8233 }
8234 }
8235
8236 #[allow(irrefutable_let_patterns)]
8237 pub fn into_notify_queue(self) -> Option<(u16, VirtioRngControlHandle)> {
8238 if let VirtioRngRequest::NotifyQueue { queue, control_handle } = self {
8239 Some((queue, control_handle))
8240 } else {
8241 None
8242 }
8243 }
8244
8245 #[allow(irrefutable_let_patterns)]
8246 pub fn into_ready(self) -> Option<(u32, VirtioRngReadyResponder)> {
8247 if let VirtioRngRequest::Ready { negotiated_features, responder } = self {
8248 Some((negotiated_features, responder))
8249 } else {
8250 None
8251 }
8252 }
8253
8254 #[allow(irrefutable_let_patterns)]
8255 pub fn into_start(self) -> Option<(StartInfo, VirtioRngStartResponder)> {
8256 if let VirtioRngRequest::Start { start_info, responder } = self {
8257 Some((start_info, responder))
8258 } else {
8259 None
8260 }
8261 }
8262
8263 pub fn method_name(&self) -> &'static str {
8265 match *self {
8266 VirtioRngRequest::ConfigureQueue { .. } => "configure_queue",
8267 VirtioRngRequest::NotifyQueue { .. } => "notify_queue",
8268 VirtioRngRequest::Ready { .. } => "ready",
8269 VirtioRngRequest::Start { .. } => "start",
8270 }
8271 }
8272}
8273
8274#[derive(Debug, Clone)]
8275pub struct VirtioRngControlHandle {
8276 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8277}
8278
8279impl fidl::endpoints::ControlHandle for VirtioRngControlHandle {
8280 fn shutdown(&self) {
8281 self.inner.shutdown()
8282 }
8283 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8284 self.inner.shutdown_with_epitaph(status)
8285 }
8286
8287 fn is_closed(&self) -> bool {
8288 self.inner.channel().is_closed()
8289 }
8290 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8291 self.inner.channel().on_closed()
8292 }
8293
8294 #[cfg(target_os = "fuchsia")]
8295 fn signal_peer(
8296 &self,
8297 clear_mask: zx::Signals,
8298 set_mask: zx::Signals,
8299 ) -> Result<(), zx_status::Status> {
8300 use fidl::Peered;
8301 self.inner.channel().signal_peer(clear_mask, set_mask)
8302 }
8303}
8304
8305impl VirtioRngControlHandle {}
8306
8307#[must_use = "FIDL methods require a response to be sent"]
8308#[derive(Debug)]
8309pub struct VirtioRngConfigureQueueResponder {
8310 control_handle: std::mem::ManuallyDrop<VirtioRngControlHandle>,
8311 tx_id: u32,
8312}
8313
8314impl std::ops::Drop for VirtioRngConfigureQueueResponder {
8318 fn drop(&mut self) {
8319 self.control_handle.shutdown();
8320 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8322 }
8323}
8324
8325impl fidl::endpoints::Responder for VirtioRngConfigureQueueResponder {
8326 type ControlHandle = VirtioRngControlHandle;
8327
8328 fn control_handle(&self) -> &VirtioRngControlHandle {
8329 &self.control_handle
8330 }
8331
8332 fn drop_without_shutdown(mut self) {
8333 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8335 std::mem::forget(self);
8337 }
8338}
8339
8340impl VirtioRngConfigureQueueResponder {
8341 pub fn send(self) -> Result<(), fidl::Error> {
8345 let _result = self.send_raw();
8346 if _result.is_err() {
8347 self.control_handle.shutdown();
8348 }
8349 self.drop_without_shutdown();
8350 _result
8351 }
8352
8353 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8355 let _result = self.send_raw();
8356 self.drop_without_shutdown();
8357 _result
8358 }
8359
8360 fn send_raw(&self) -> Result<(), fidl::Error> {
8361 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8362 (),
8363 self.tx_id,
8364 0x72b44fb963480b11,
8365 fidl::encoding::DynamicFlags::empty(),
8366 )
8367 }
8368}
8369
8370#[must_use = "FIDL methods require a response to be sent"]
8371#[derive(Debug)]
8372pub struct VirtioRngReadyResponder {
8373 control_handle: std::mem::ManuallyDrop<VirtioRngControlHandle>,
8374 tx_id: u32,
8375}
8376
8377impl std::ops::Drop for VirtioRngReadyResponder {
8381 fn drop(&mut self) {
8382 self.control_handle.shutdown();
8383 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8385 }
8386}
8387
8388impl fidl::endpoints::Responder for VirtioRngReadyResponder {
8389 type ControlHandle = VirtioRngControlHandle;
8390
8391 fn control_handle(&self) -> &VirtioRngControlHandle {
8392 &self.control_handle
8393 }
8394
8395 fn drop_without_shutdown(mut self) {
8396 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8398 std::mem::forget(self);
8400 }
8401}
8402
8403impl VirtioRngReadyResponder {
8404 pub fn send(self) -> Result<(), fidl::Error> {
8408 let _result = self.send_raw();
8409 if _result.is_err() {
8410 self.control_handle.shutdown();
8411 }
8412 self.drop_without_shutdown();
8413 _result
8414 }
8415
8416 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8418 let _result = self.send_raw();
8419 self.drop_without_shutdown();
8420 _result
8421 }
8422
8423 fn send_raw(&self) -> Result<(), fidl::Error> {
8424 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8425 (),
8426 self.tx_id,
8427 0x45707654f5d23c3f,
8428 fidl::encoding::DynamicFlags::empty(),
8429 )
8430 }
8431}
8432
8433#[must_use = "FIDL methods require a response to be sent"]
8434#[derive(Debug)]
8435pub struct VirtioRngStartResponder {
8436 control_handle: std::mem::ManuallyDrop<VirtioRngControlHandle>,
8437 tx_id: u32,
8438}
8439
8440impl std::ops::Drop for VirtioRngStartResponder {
8444 fn drop(&mut self) {
8445 self.control_handle.shutdown();
8446 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8448 }
8449}
8450
8451impl fidl::endpoints::Responder for VirtioRngStartResponder {
8452 type ControlHandle = VirtioRngControlHandle;
8453
8454 fn control_handle(&self) -> &VirtioRngControlHandle {
8455 &self.control_handle
8456 }
8457
8458 fn drop_without_shutdown(mut self) {
8459 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8461 std::mem::forget(self);
8463 }
8464}
8465
8466impl VirtioRngStartResponder {
8467 pub fn send(self) -> Result<(), fidl::Error> {
8471 let _result = self.send_raw();
8472 if _result.is_err() {
8473 self.control_handle.shutdown();
8474 }
8475 self.drop_without_shutdown();
8476 _result
8477 }
8478
8479 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8481 let _result = self.send_raw();
8482 self.drop_without_shutdown();
8483 _result
8484 }
8485
8486 fn send_raw(&self) -> Result<(), fidl::Error> {
8487 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8488 (),
8489 self.tx_id,
8490 0x620b3ed254febc0f,
8491 fidl::encoding::DynamicFlags::empty(),
8492 )
8493 }
8494}
8495
8496#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8497pub struct VirtioSoundMarker;
8498
8499impl fidl::endpoints::ProtocolMarker for VirtioSoundMarker {
8500 type Proxy = VirtioSoundProxy;
8501 type RequestStream = VirtioSoundRequestStream;
8502 #[cfg(target_os = "fuchsia")]
8503 type SynchronousProxy = VirtioSoundSynchronousProxy;
8504
8505 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioSound";
8506}
8507impl fidl::endpoints::DiscoverableProtocolMarker for VirtioSoundMarker {}
8508
8509pub trait VirtioSoundProxyInterface: Send + Sync {
8510 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8511 fn r#configure_queue(
8512 &self,
8513 queue: u16,
8514 size: u16,
8515 desc: u64,
8516 avail: u64,
8517 used: u64,
8518 ) -> Self::ConfigureQueueResponseFut;
8519 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
8520 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8521 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
8522 type StartResponseFut: std::future::Future<Output = Result<(u32, u32, u32, u32), fidl::Error>>
8523 + Send;
8524 fn r#start(
8525 &self,
8526 start_info: StartInfo,
8527 enable_input: bool,
8528 enable_verbose_logging: bool,
8529 ) -> Self::StartResponseFut;
8530}
8531#[derive(Debug)]
8532#[cfg(target_os = "fuchsia")]
8533pub struct VirtioSoundSynchronousProxy {
8534 client: fidl::client::sync::Client,
8535}
8536
8537#[cfg(target_os = "fuchsia")]
8538impl fidl::endpoints::SynchronousProxy for VirtioSoundSynchronousProxy {
8539 type Proxy = VirtioSoundProxy;
8540 type Protocol = VirtioSoundMarker;
8541
8542 fn from_channel(inner: fidl::Channel) -> Self {
8543 Self::new(inner)
8544 }
8545
8546 fn into_channel(self) -> fidl::Channel {
8547 self.client.into_channel()
8548 }
8549
8550 fn as_channel(&self) -> &fidl::Channel {
8551 self.client.as_channel()
8552 }
8553}
8554
8555#[cfg(target_os = "fuchsia")]
8556impl VirtioSoundSynchronousProxy {
8557 pub fn new(channel: fidl::Channel) -> Self {
8558 let protocol_name = <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8559 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8560 }
8561
8562 pub fn into_channel(self) -> fidl::Channel {
8563 self.client.into_channel()
8564 }
8565
8566 pub fn wait_for_event(
8569 &self,
8570 deadline: zx::MonotonicInstant,
8571 ) -> Result<VirtioSoundEvent, fidl::Error> {
8572 VirtioSoundEvent::decode(self.client.wait_for_event(deadline)?)
8573 }
8574
8575 pub fn r#configure_queue(
8578 &self,
8579 mut queue: u16,
8580 mut size: u16,
8581 mut desc: u64,
8582 mut avail: u64,
8583 mut used: u64,
8584 ___deadline: zx::MonotonicInstant,
8585 ) -> Result<(), fidl::Error> {
8586 let _response = self
8587 .client
8588 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
8589 (queue, size, desc, avail, used),
8590 0x72b44fb963480b11,
8591 fidl::encoding::DynamicFlags::empty(),
8592 ___deadline,
8593 )?;
8594 Ok(_response)
8595 }
8596
8597 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
8599 self.client.send::<VirtioDeviceNotifyQueueRequest>(
8600 (queue,),
8601 0x6e3a61d652499244,
8602 fidl::encoding::DynamicFlags::empty(),
8603 )
8604 }
8605
8606 pub fn r#ready(
8609 &self,
8610 mut negotiated_features: u32,
8611 ___deadline: zx::MonotonicInstant,
8612 ) -> Result<(), fidl::Error> {
8613 let _response =
8614 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
8615 (negotiated_features,),
8616 0x45707654f5d23c3f,
8617 fidl::encoding::DynamicFlags::empty(),
8618 ___deadline,
8619 )?;
8620 Ok(_response)
8621 }
8622
8623 pub fn r#start(
8634 &self,
8635 mut start_info: StartInfo,
8636 mut enable_input: bool,
8637 mut enable_verbose_logging: bool,
8638 ___deadline: zx::MonotonicInstant,
8639 ) -> Result<(u32, u32, u32, u32), fidl::Error> {
8640 let _response =
8641 self.client.send_query::<VirtioSoundStartRequest, VirtioSoundStartResponse>(
8642 (&mut start_info, enable_input, enable_verbose_logging),
8643 0x2c3a5528c0b92e2d,
8644 fidl::encoding::DynamicFlags::empty(),
8645 ___deadline,
8646 )?;
8647 Ok((_response.features, _response.jacks, _response.streams, _response.chmaps))
8648 }
8649}
8650
8651#[cfg(target_os = "fuchsia")]
8652impl From<VirtioSoundSynchronousProxy> for zx::Handle {
8653 fn from(value: VirtioSoundSynchronousProxy) -> Self {
8654 value.into_channel().into()
8655 }
8656}
8657
8658#[cfg(target_os = "fuchsia")]
8659impl From<fidl::Channel> for VirtioSoundSynchronousProxy {
8660 fn from(value: fidl::Channel) -> Self {
8661 Self::new(value)
8662 }
8663}
8664
8665#[derive(Debug, Clone)]
8666pub struct VirtioSoundProxy {
8667 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8668}
8669
8670impl fidl::endpoints::Proxy for VirtioSoundProxy {
8671 type Protocol = VirtioSoundMarker;
8672
8673 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8674 Self::new(inner)
8675 }
8676
8677 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8678 self.client.into_channel().map_err(|client| Self { client })
8679 }
8680
8681 fn as_channel(&self) -> &::fidl::AsyncChannel {
8682 self.client.as_channel()
8683 }
8684}
8685
8686impl VirtioSoundProxy {
8687 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8689 let protocol_name = <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8690 Self { client: fidl::client::Client::new(channel, protocol_name) }
8691 }
8692
8693 pub fn take_event_stream(&self) -> VirtioSoundEventStream {
8699 VirtioSoundEventStream { event_receiver: self.client.take_event_receiver() }
8700 }
8701
8702 pub fn r#configure_queue(
8705 &self,
8706 mut queue: u16,
8707 mut size: u16,
8708 mut desc: u64,
8709 mut avail: u64,
8710 mut used: u64,
8711 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8712 VirtioSoundProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
8713 }
8714
8715 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
8717 VirtioSoundProxyInterface::r#notify_queue(self, queue)
8718 }
8719
8720 pub fn r#ready(
8723 &self,
8724 mut negotiated_features: u32,
8725 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8726 VirtioSoundProxyInterface::r#ready(self, negotiated_features)
8727 }
8728
8729 pub fn r#start(
8740 &self,
8741 mut start_info: StartInfo,
8742 mut enable_input: bool,
8743 mut enable_verbose_logging: bool,
8744 ) -> fidl::client::QueryResponseFut<
8745 (u32, u32, u32, u32),
8746 fidl::encoding::DefaultFuchsiaResourceDialect,
8747 > {
8748 VirtioSoundProxyInterface::r#start(self, start_info, enable_input, enable_verbose_logging)
8749 }
8750}
8751
8752impl VirtioSoundProxyInterface for VirtioSoundProxy {
8753 type ConfigureQueueResponseFut =
8754 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8755 fn r#configure_queue(
8756 &self,
8757 mut queue: u16,
8758 mut size: u16,
8759 mut desc: u64,
8760 mut avail: u64,
8761 mut used: u64,
8762 ) -> Self::ConfigureQueueResponseFut {
8763 fn _decode(
8764 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8765 ) -> Result<(), fidl::Error> {
8766 let _response = fidl::client::decode_transaction_body::<
8767 fidl::encoding::EmptyPayload,
8768 fidl::encoding::DefaultFuchsiaResourceDialect,
8769 0x72b44fb963480b11,
8770 >(_buf?)?;
8771 Ok(_response)
8772 }
8773 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
8774 (queue, size, desc, avail, used),
8775 0x72b44fb963480b11,
8776 fidl::encoding::DynamicFlags::empty(),
8777 _decode,
8778 )
8779 }
8780
8781 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
8782 self.client.send::<VirtioDeviceNotifyQueueRequest>(
8783 (queue,),
8784 0x6e3a61d652499244,
8785 fidl::encoding::DynamicFlags::empty(),
8786 )
8787 }
8788
8789 type ReadyResponseFut =
8790 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8791 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
8792 fn _decode(
8793 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8794 ) -> Result<(), fidl::Error> {
8795 let _response = fidl::client::decode_transaction_body::<
8796 fidl::encoding::EmptyPayload,
8797 fidl::encoding::DefaultFuchsiaResourceDialect,
8798 0x45707654f5d23c3f,
8799 >(_buf?)?;
8800 Ok(_response)
8801 }
8802 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
8803 (negotiated_features,),
8804 0x45707654f5d23c3f,
8805 fidl::encoding::DynamicFlags::empty(),
8806 _decode,
8807 )
8808 }
8809
8810 type StartResponseFut = fidl::client::QueryResponseFut<
8811 (u32, u32, u32, u32),
8812 fidl::encoding::DefaultFuchsiaResourceDialect,
8813 >;
8814 fn r#start(
8815 &self,
8816 mut start_info: StartInfo,
8817 mut enable_input: bool,
8818 mut enable_verbose_logging: bool,
8819 ) -> Self::StartResponseFut {
8820 fn _decode(
8821 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8822 ) -> Result<(u32, u32, u32, u32), fidl::Error> {
8823 let _response = fidl::client::decode_transaction_body::<
8824 VirtioSoundStartResponse,
8825 fidl::encoding::DefaultFuchsiaResourceDialect,
8826 0x2c3a5528c0b92e2d,
8827 >(_buf?)?;
8828 Ok((_response.features, _response.jacks, _response.streams, _response.chmaps))
8829 }
8830 self.client.send_query_and_decode::<VirtioSoundStartRequest, (u32, u32, u32, u32)>(
8831 (&mut start_info, enable_input, enable_verbose_logging),
8832 0x2c3a5528c0b92e2d,
8833 fidl::encoding::DynamicFlags::empty(),
8834 _decode,
8835 )
8836 }
8837}
8838
8839pub struct VirtioSoundEventStream {
8840 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8841}
8842
8843impl std::marker::Unpin for VirtioSoundEventStream {}
8844
8845impl futures::stream::FusedStream for VirtioSoundEventStream {
8846 fn is_terminated(&self) -> bool {
8847 self.event_receiver.is_terminated()
8848 }
8849}
8850
8851impl futures::Stream for VirtioSoundEventStream {
8852 type Item = Result<VirtioSoundEvent, fidl::Error>;
8853
8854 fn poll_next(
8855 mut self: std::pin::Pin<&mut Self>,
8856 cx: &mut std::task::Context<'_>,
8857 ) -> std::task::Poll<Option<Self::Item>> {
8858 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8859 &mut self.event_receiver,
8860 cx
8861 )?) {
8862 Some(buf) => std::task::Poll::Ready(Some(VirtioSoundEvent::decode(buf))),
8863 None => std::task::Poll::Ready(None),
8864 }
8865 }
8866}
8867
8868#[derive(Debug)]
8869pub enum VirtioSoundEvent {}
8870
8871impl VirtioSoundEvent {
8872 fn decode(
8874 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8875 ) -> Result<VirtioSoundEvent, fidl::Error> {
8876 let (bytes, _handles) = buf.split_mut();
8877 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8878 debug_assert_eq!(tx_header.tx_id, 0);
8879 match tx_header.ordinal {
8880 _ => Err(fidl::Error::UnknownOrdinal {
8881 ordinal: tx_header.ordinal,
8882 protocol_name: <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8883 }),
8884 }
8885 }
8886}
8887
8888pub struct VirtioSoundRequestStream {
8890 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8891 is_terminated: bool,
8892}
8893
8894impl std::marker::Unpin for VirtioSoundRequestStream {}
8895
8896impl futures::stream::FusedStream for VirtioSoundRequestStream {
8897 fn is_terminated(&self) -> bool {
8898 self.is_terminated
8899 }
8900}
8901
8902impl fidl::endpoints::RequestStream for VirtioSoundRequestStream {
8903 type Protocol = VirtioSoundMarker;
8904 type ControlHandle = VirtioSoundControlHandle;
8905
8906 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8907 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8908 }
8909
8910 fn control_handle(&self) -> Self::ControlHandle {
8911 VirtioSoundControlHandle { inner: self.inner.clone() }
8912 }
8913
8914 fn into_inner(
8915 self,
8916 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8917 {
8918 (self.inner, self.is_terminated)
8919 }
8920
8921 fn from_inner(
8922 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8923 is_terminated: bool,
8924 ) -> Self {
8925 Self { inner, is_terminated }
8926 }
8927}
8928
8929impl futures::Stream for VirtioSoundRequestStream {
8930 type Item = Result<VirtioSoundRequest, fidl::Error>;
8931
8932 fn poll_next(
8933 mut self: std::pin::Pin<&mut Self>,
8934 cx: &mut std::task::Context<'_>,
8935 ) -> std::task::Poll<Option<Self::Item>> {
8936 let this = &mut *self;
8937 if this.inner.check_shutdown(cx) {
8938 this.is_terminated = true;
8939 return std::task::Poll::Ready(None);
8940 }
8941 if this.is_terminated {
8942 panic!("polled VirtioSoundRequestStream after completion");
8943 }
8944 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8945 |bytes, handles| {
8946 match this.inner.channel().read_etc(cx, bytes, handles) {
8947 std::task::Poll::Ready(Ok(())) => {}
8948 std::task::Poll::Pending => return std::task::Poll::Pending,
8949 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8950 this.is_terminated = true;
8951 return std::task::Poll::Ready(None);
8952 }
8953 std::task::Poll::Ready(Err(e)) => {
8954 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8955 e.into(),
8956 ))))
8957 }
8958 }
8959
8960 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8962
8963 std::task::Poll::Ready(Some(match header.ordinal {
8964 0x72b44fb963480b11 => {
8965 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8966 let mut req = fidl::new_empty!(
8967 VirtioDeviceConfigureQueueRequest,
8968 fidl::encoding::DefaultFuchsiaResourceDialect
8969 );
8970 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
8971 let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
8972 Ok(VirtioSoundRequest::ConfigureQueue {
8973 queue: req.queue,
8974 size: req.size,
8975 desc: req.desc,
8976 avail: req.avail,
8977 used: req.used,
8978
8979 responder: VirtioSoundConfigureQueueResponder {
8980 control_handle: std::mem::ManuallyDrop::new(control_handle),
8981 tx_id: header.tx_id,
8982 },
8983 })
8984 }
8985 0x6e3a61d652499244 => {
8986 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8987 let mut req = fidl::new_empty!(
8988 VirtioDeviceNotifyQueueRequest,
8989 fidl::encoding::DefaultFuchsiaResourceDialect
8990 );
8991 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
8992 let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
8993 Ok(VirtioSoundRequest::NotifyQueue { queue: req.queue, control_handle })
8994 }
8995 0x45707654f5d23c3f => {
8996 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8997 let mut req = fidl::new_empty!(
8998 VirtioDeviceReadyRequest,
8999 fidl::encoding::DefaultFuchsiaResourceDialect
9000 );
9001 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
9002 let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
9003 Ok(VirtioSoundRequest::Ready {
9004 negotiated_features: req.negotiated_features,
9005
9006 responder: VirtioSoundReadyResponder {
9007 control_handle: std::mem::ManuallyDrop::new(control_handle),
9008 tx_id: header.tx_id,
9009 },
9010 })
9011 }
9012 0x2c3a5528c0b92e2d => {
9013 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9014 let mut req = fidl::new_empty!(
9015 VirtioSoundStartRequest,
9016 fidl::encoding::DefaultFuchsiaResourceDialect
9017 );
9018 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioSoundStartRequest>(&header, _body_bytes, handles, &mut req)?;
9019 let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
9020 Ok(VirtioSoundRequest::Start {
9021 start_info: req.start_info,
9022 enable_input: req.enable_input,
9023 enable_verbose_logging: req.enable_verbose_logging,
9024
9025 responder: VirtioSoundStartResponder {
9026 control_handle: std::mem::ManuallyDrop::new(control_handle),
9027 tx_id: header.tx_id,
9028 },
9029 })
9030 }
9031 _ => Err(fidl::Error::UnknownOrdinal {
9032 ordinal: header.ordinal,
9033 protocol_name:
9034 <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9035 }),
9036 }))
9037 },
9038 )
9039 }
9040}
9041
9042#[derive(Debug)]
9043pub enum VirtioSoundRequest {
9044 ConfigureQueue {
9047 queue: u16,
9048 size: u16,
9049 desc: u64,
9050 avail: u64,
9051 used: u64,
9052 responder: VirtioSoundConfigureQueueResponder,
9053 },
9054 NotifyQueue { queue: u16, control_handle: VirtioSoundControlHandle },
9056 Ready { negotiated_features: u32, responder: VirtioSoundReadyResponder },
9059 Start {
9070 start_info: StartInfo,
9071 enable_input: bool,
9072 enable_verbose_logging: bool,
9073 responder: VirtioSoundStartResponder,
9074 },
9075}
9076
9077impl VirtioSoundRequest {
9078 #[allow(irrefutable_let_patterns)]
9079 pub fn into_configure_queue(
9080 self,
9081 ) -> Option<(u16, u16, u64, u64, u64, VirtioSoundConfigureQueueResponder)> {
9082 if let VirtioSoundRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
9083 self
9084 {
9085 Some((queue, size, desc, avail, used, responder))
9086 } else {
9087 None
9088 }
9089 }
9090
9091 #[allow(irrefutable_let_patterns)]
9092 pub fn into_notify_queue(self) -> Option<(u16, VirtioSoundControlHandle)> {
9093 if let VirtioSoundRequest::NotifyQueue { queue, control_handle } = self {
9094 Some((queue, control_handle))
9095 } else {
9096 None
9097 }
9098 }
9099
9100 #[allow(irrefutable_let_patterns)]
9101 pub fn into_ready(self) -> Option<(u32, VirtioSoundReadyResponder)> {
9102 if let VirtioSoundRequest::Ready { negotiated_features, responder } = self {
9103 Some((negotiated_features, responder))
9104 } else {
9105 None
9106 }
9107 }
9108
9109 #[allow(irrefutable_let_patterns)]
9110 pub fn into_start(self) -> Option<(StartInfo, bool, bool, VirtioSoundStartResponder)> {
9111 if let VirtioSoundRequest::Start {
9112 start_info,
9113 enable_input,
9114 enable_verbose_logging,
9115 responder,
9116 } = self
9117 {
9118 Some((start_info, enable_input, enable_verbose_logging, responder))
9119 } else {
9120 None
9121 }
9122 }
9123
9124 pub fn method_name(&self) -> &'static str {
9126 match *self {
9127 VirtioSoundRequest::ConfigureQueue { .. } => "configure_queue",
9128 VirtioSoundRequest::NotifyQueue { .. } => "notify_queue",
9129 VirtioSoundRequest::Ready { .. } => "ready",
9130 VirtioSoundRequest::Start { .. } => "start",
9131 }
9132 }
9133}
9134
9135#[derive(Debug, Clone)]
9136pub struct VirtioSoundControlHandle {
9137 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9138}
9139
9140impl fidl::endpoints::ControlHandle for VirtioSoundControlHandle {
9141 fn shutdown(&self) {
9142 self.inner.shutdown()
9143 }
9144 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9145 self.inner.shutdown_with_epitaph(status)
9146 }
9147
9148 fn is_closed(&self) -> bool {
9149 self.inner.channel().is_closed()
9150 }
9151 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9152 self.inner.channel().on_closed()
9153 }
9154
9155 #[cfg(target_os = "fuchsia")]
9156 fn signal_peer(
9157 &self,
9158 clear_mask: zx::Signals,
9159 set_mask: zx::Signals,
9160 ) -> Result<(), zx_status::Status> {
9161 use fidl::Peered;
9162 self.inner.channel().signal_peer(clear_mask, set_mask)
9163 }
9164}
9165
9166impl VirtioSoundControlHandle {}
9167
9168#[must_use = "FIDL methods require a response to be sent"]
9169#[derive(Debug)]
9170pub struct VirtioSoundConfigureQueueResponder {
9171 control_handle: std::mem::ManuallyDrop<VirtioSoundControlHandle>,
9172 tx_id: u32,
9173}
9174
9175impl std::ops::Drop for VirtioSoundConfigureQueueResponder {
9179 fn drop(&mut self) {
9180 self.control_handle.shutdown();
9181 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9183 }
9184}
9185
9186impl fidl::endpoints::Responder for VirtioSoundConfigureQueueResponder {
9187 type ControlHandle = VirtioSoundControlHandle;
9188
9189 fn control_handle(&self) -> &VirtioSoundControlHandle {
9190 &self.control_handle
9191 }
9192
9193 fn drop_without_shutdown(mut self) {
9194 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9196 std::mem::forget(self);
9198 }
9199}
9200
9201impl VirtioSoundConfigureQueueResponder {
9202 pub fn send(self) -> Result<(), fidl::Error> {
9206 let _result = self.send_raw();
9207 if _result.is_err() {
9208 self.control_handle.shutdown();
9209 }
9210 self.drop_without_shutdown();
9211 _result
9212 }
9213
9214 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9216 let _result = self.send_raw();
9217 self.drop_without_shutdown();
9218 _result
9219 }
9220
9221 fn send_raw(&self) -> Result<(), fidl::Error> {
9222 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9223 (),
9224 self.tx_id,
9225 0x72b44fb963480b11,
9226 fidl::encoding::DynamicFlags::empty(),
9227 )
9228 }
9229}
9230
9231#[must_use = "FIDL methods require a response to be sent"]
9232#[derive(Debug)]
9233pub struct VirtioSoundReadyResponder {
9234 control_handle: std::mem::ManuallyDrop<VirtioSoundControlHandle>,
9235 tx_id: u32,
9236}
9237
9238impl std::ops::Drop for VirtioSoundReadyResponder {
9242 fn drop(&mut self) {
9243 self.control_handle.shutdown();
9244 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9246 }
9247}
9248
9249impl fidl::endpoints::Responder for VirtioSoundReadyResponder {
9250 type ControlHandle = VirtioSoundControlHandle;
9251
9252 fn control_handle(&self) -> &VirtioSoundControlHandle {
9253 &self.control_handle
9254 }
9255
9256 fn drop_without_shutdown(mut self) {
9257 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9259 std::mem::forget(self);
9261 }
9262}
9263
9264impl VirtioSoundReadyResponder {
9265 pub fn send(self) -> Result<(), fidl::Error> {
9269 let _result = self.send_raw();
9270 if _result.is_err() {
9271 self.control_handle.shutdown();
9272 }
9273 self.drop_without_shutdown();
9274 _result
9275 }
9276
9277 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9279 let _result = self.send_raw();
9280 self.drop_without_shutdown();
9281 _result
9282 }
9283
9284 fn send_raw(&self) -> Result<(), fidl::Error> {
9285 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9286 (),
9287 self.tx_id,
9288 0x45707654f5d23c3f,
9289 fidl::encoding::DynamicFlags::empty(),
9290 )
9291 }
9292}
9293
9294#[must_use = "FIDL methods require a response to be sent"]
9295#[derive(Debug)]
9296pub struct VirtioSoundStartResponder {
9297 control_handle: std::mem::ManuallyDrop<VirtioSoundControlHandle>,
9298 tx_id: u32,
9299}
9300
9301impl std::ops::Drop for VirtioSoundStartResponder {
9305 fn drop(&mut self) {
9306 self.control_handle.shutdown();
9307 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9309 }
9310}
9311
9312impl fidl::endpoints::Responder for VirtioSoundStartResponder {
9313 type ControlHandle = VirtioSoundControlHandle;
9314
9315 fn control_handle(&self) -> &VirtioSoundControlHandle {
9316 &self.control_handle
9317 }
9318
9319 fn drop_without_shutdown(mut self) {
9320 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9322 std::mem::forget(self);
9324 }
9325}
9326
9327impl VirtioSoundStartResponder {
9328 pub fn send(
9332 self,
9333 mut features: u32,
9334 mut jacks: u32,
9335 mut streams: u32,
9336 mut chmaps: u32,
9337 ) -> Result<(), fidl::Error> {
9338 let _result = self.send_raw(features, jacks, streams, chmaps);
9339 if _result.is_err() {
9340 self.control_handle.shutdown();
9341 }
9342 self.drop_without_shutdown();
9343 _result
9344 }
9345
9346 pub fn send_no_shutdown_on_err(
9348 self,
9349 mut features: u32,
9350 mut jacks: u32,
9351 mut streams: u32,
9352 mut chmaps: u32,
9353 ) -> Result<(), fidl::Error> {
9354 let _result = self.send_raw(features, jacks, streams, chmaps);
9355 self.drop_without_shutdown();
9356 _result
9357 }
9358
9359 fn send_raw(
9360 &self,
9361 mut features: u32,
9362 mut jacks: u32,
9363 mut streams: u32,
9364 mut chmaps: u32,
9365 ) -> Result<(), fidl::Error> {
9366 self.control_handle.inner.send::<VirtioSoundStartResponse>(
9367 (features, jacks, streams, chmaps),
9368 self.tx_id,
9369 0x2c3a5528c0b92e2d,
9370 fidl::encoding::DynamicFlags::empty(),
9371 )
9372 }
9373}
9374
9375#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9376pub struct VirtioVsockMarker;
9377
9378impl fidl::endpoints::ProtocolMarker for VirtioVsockMarker {
9379 type Proxy = VirtioVsockProxy;
9380 type RequestStream = VirtioVsockRequestStream;
9381 #[cfg(target_os = "fuchsia")]
9382 type SynchronousProxy = VirtioVsockSynchronousProxy;
9383
9384 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioVsock";
9385}
9386impl fidl::endpoints::DiscoverableProtocolMarker for VirtioVsockMarker {}
9387pub type VirtioVsockStartResult = Result<(), i32>;
9388
9389pub trait VirtioVsockProxyInterface: Send + Sync {
9390 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9391 fn r#configure_queue(
9392 &self,
9393 queue: u16,
9394 size: u16,
9395 desc: u64,
9396 avail: u64,
9397 used: u64,
9398 ) -> Self::ConfigureQueueResponseFut;
9399 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
9400 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9401 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
9402 type StartResponseFut: std::future::Future<Output = Result<VirtioVsockStartResult, fidl::Error>>
9403 + Send;
9404 fn r#start(
9405 &self,
9406 start_info: StartInfo,
9407 guest_cid: u32,
9408 listeners: Vec<fidl_fuchsia_virtualization::Listener>,
9409 ) -> Self::StartResponseFut;
9410}
9411#[derive(Debug)]
9412#[cfg(target_os = "fuchsia")]
9413pub struct VirtioVsockSynchronousProxy {
9414 client: fidl::client::sync::Client,
9415}
9416
9417#[cfg(target_os = "fuchsia")]
9418impl fidl::endpoints::SynchronousProxy for VirtioVsockSynchronousProxy {
9419 type Proxy = VirtioVsockProxy;
9420 type Protocol = VirtioVsockMarker;
9421
9422 fn from_channel(inner: fidl::Channel) -> Self {
9423 Self::new(inner)
9424 }
9425
9426 fn into_channel(self) -> fidl::Channel {
9427 self.client.into_channel()
9428 }
9429
9430 fn as_channel(&self) -> &fidl::Channel {
9431 self.client.as_channel()
9432 }
9433}
9434
9435#[cfg(target_os = "fuchsia")]
9436impl VirtioVsockSynchronousProxy {
9437 pub fn new(channel: fidl::Channel) -> Self {
9438 let protocol_name = <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9439 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9440 }
9441
9442 pub fn into_channel(self) -> fidl::Channel {
9443 self.client.into_channel()
9444 }
9445
9446 pub fn wait_for_event(
9449 &self,
9450 deadline: zx::MonotonicInstant,
9451 ) -> Result<VirtioVsockEvent, fidl::Error> {
9452 VirtioVsockEvent::decode(self.client.wait_for_event(deadline)?)
9453 }
9454
9455 pub fn r#configure_queue(
9458 &self,
9459 mut queue: u16,
9460 mut size: u16,
9461 mut desc: u64,
9462 mut avail: u64,
9463 mut used: u64,
9464 ___deadline: zx::MonotonicInstant,
9465 ) -> Result<(), fidl::Error> {
9466 let _response = self
9467 .client
9468 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
9469 (queue, size, desc, avail, used),
9470 0x72b44fb963480b11,
9471 fidl::encoding::DynamicFlags::empty(),
9472 ___deadline,
9473 )?;
9474 Ok(_response)
9475 }
9476
9477 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
9479 self.client.send::<VirtioDeviceNotifyQueueRequest>(
9480 (queue,),
9481 0x6e3a61d652499244,
9482 fidl::encoding::DynamicFlags::empty(),
9483 )
9484 }
9485
9486 pub fn r#ready(
9489 &self,
9490 mut negotiated_features: u32,
9491 ___deadline: zx::MonotonicInstant,
9492 ) -> Result<(), fidl::Error> {
9493 let _response =
9494 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
9495 (negotiated_features,),
9496 0x45707654f5d23c3f,
9497 fidl::encoding::DynamicFlags::empty(),
9498 ___deadline,
9499 )?;
9500 Ok(_response)
9501 }
9502
9503 pub fn r#start(
9510 &self,
9511 mut start_info: StartInfo,
9512 mut guest_cid: u32,
9513 mut listeners: Vec<fidl_fuchsia_virtualization::Listener>,
9514 ___deadline: zx::MonotonicInstant,
9515 ) -> Result<VirtioVsockStartResult, fidl::Error> {
9516 let _response = self.client.send_query::<
9517 VirtioVsockStartRequest,
9518 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
9519 >(
9520 (&mut start_info, guest_cid, listeners.as_mut(),),
9521 0x56433562cf67ae0f,
9522 fidl::encoding::DynamicFlags::empty(),
9523 ___deadline,
9524 )?;
9525 Ok(_response.map(|x| x))
9526 }
9527}
9528
9529#[cfg(target_os = "fuchsia")]
9530impl From<VirtioVsockSynchronousProxy> for zx::Handle {
9531 fn from(value: VirtioVsockSynchronousProxy) -> Self {
9532 value.into_channel().into()
9533 }
9534}
9535
9536#[cfg(target_os = "fuchsia")]
9537impl From<fidl::Channel> for VirtioVsockSynchronousProxy {
9538 fn from(value: fidl::Channel) -> Self {
9539 Self::new(value)
9540 }
9541}
9542
9543#[derive(Debug, Clone)]
9544pub struct VirtioVsockProxy {
9545 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9546}
9547
9548impl fidl::endpoints::Proxy for VirtioVsockProxy {
9549 type Protocol = VirtioVsockMarker;
9550
9551 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9552 Self::new(inner)
9553 }
9554
9555 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9556 self.client.into_channel().map_err(|client| Self { client })
9557 }
9558
9559 fn as_channel(&self) -> &::fidl::AsyncChannel {
9560 self.client.as_channel()
9561 }
9562}
9563
9564impl VirtioVsockProxy {
9565 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9567 let protocol_name = <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9568 Self { client: fidl::client::Client::new(channel, protocol_name) }
9569 }
9570
9571 pub fn take_event_stream(&self) -> VirtioVsockEventStream {
9577 VirtioVsockEventStream { event_receiver: self.client.take_event_receiver() }
9578 }
9579
9580 pub fn r#configure_queue(
9583 &self,
9584 mut queue: u16,
9585 mut size: u16,
9586 mut desc: u64,
9587 mut avail: u64,
9588 mut used: u64,
9589 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
9590 VirtioVsockProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
9591 }
9592
9593 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
9595 VirtioVsockProxyInterface::r#notify_queue(self, queue)
9596 }
9597
9598 pub fn r#ready(
9601 &self,
9602 mut negotiated_features: u32,
9603 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
9604 VirtioVsockProxyInterface::r#ready(self, negotiated_features)
9605 }
9606
9607 pub fn r#start(
9614 &self,
9615 mut start_info: StartInfo,
9616 mut guest_cid: u32,
9617 mut listeners: Vec<fidl_fuchsia_virtualization::Listener>,
9618 ) -> fidl::client::QueryResponseFut<
9619 VirtioVsockStartResult,
9620 fidl::encoding::DefaultFuchsiaResourceDialect,
9621 > {
9622 VirtioVsockProxyInterface::r#start(self, start_info, guest_cid, listeners)
9623 }
9624}
9625
9626impl VirtioVsockProxyInterface for VirtioVsockProxy {
9627 type ConfigureQueueResponseFut =
9628 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9629 fn r#configure_queue(
9630 &self,
9631 mut queue: u16,
9632 mut size: u16,
9633 mut desc: u64,
9634 mut avail: u64,
9635 mut used: u64,
9636 ) -> Self::ConfigureQueueResponseFut {
9637 fn _decode(
9638 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9639 ) -> Result<(), fidl::Error> {
9640 let _response = fidl::client::decode_transaction_body::<
9641 fidl::encoding::EmptyPayload,
9642 fidl::encoding::DefaultFuchsiaResourceDialect,
9643 0x72b44fb963480b11,
9644 >(_buf?)?;
9645 Ok(_response)
9646 }
9647 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
9648 (queue, size, desc, avail, used),
9649 0x72b44fb963480b11,
9650 fidl::encoding::DynamicFlags::empty(),
9651 _decode,
9652 )
9653 }
9654
9655 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
9656 self.client.send::<VirtioDeviceNotifyQueueRequest>(
9657 (queue,),
9658 0x6e3a61d652499244,
9659 fidl::encoding::DynamicFlags::empty(),
9660 )
9661 }
9662
9663 type ReadyResponseFut =
9664 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9665 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
9666 fn _decode(
9667 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9668 ) -> Result<(), fidl::Error> {
9669 let _response = fidl::client::decode_transaction_body::<
9670 fidl::encoding::EmptyPayload,
9671 fidl::encoding::DefaultFuchsiaResourceDialect,
9672 0x45707654f5d23c3f,
9673 >(_buf?)?;
9674 Ok(_response)
9675 }
9676 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
9677 (negotiated_features,),
9678 0x45707654f5d23c3f,
9679 fidl::encoding::DynamicFlags::empty(),
9680 _decode,
9681 )
9682 }
9683
9684 type StartResponseFut = fidl::client::QueryResponseFut<
9685 VirtioVsockStartResult,
9686 fidl::encoding::DefaultFuchsiaResourceDialect,
9687 >;
9688 fn r#start(
9689 &self,
9690 mut start_info: StartInfo,
9691 mut guest_cid: u32,
9692 mut listeners: Vec<fidl_fuchsia_virtualization::Listener>,
9693 ) -> Self::StartResponseFut {
9694 fn _decode(
9695 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9696 ) -> Result<VirtioVsockStartResult, fidl::Error> {
9697 let _response = fidl::client::decode_transaction_body::<
9698 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
9699 fidl::encoding::DefaultFuchsiaResourceDialect,
9700 0x56433562cf67ae0f,
9701 >(_buf?)?;
9702 Ok(_response.map(|x| x))
9703 }
9704 self.client.send_query_and_decode::<VirtioVsockStartRequest, VirtioVsockStartResult>(
9705 (&mut start_info, guest_cid, listeners.as_mut()),
9706 0x56433562cf67ae0f,
9707 fidl::encoding::DynamicFlags::empty(),
9708 _decode,
9709 )
9710 }
9711}
9712
9713pub struct VirtioVsockEventStream {
9714 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9715}
9716
9717impl std::marker::Unpin for VirtioVsockEventStream {}
9718
9719impl futures::stream::FusedStream for VirtioVsockEventStream {
9720 fn is_terminated(&self) -> bool {
9721 self.event_receiver.is_terminated()
9722 }
9723}
9724
9725impl futures::Stream for VirtioVsockEventStream {
9726 type Item = Result<VirtioVsockEvent, fidl::Error>;
9727
9728 fn poll_next(
9729 mut self: std::pin::Pin<&mut Self>,
9730 cx: &mut std::task::Context<'_>,
9731 ) -> std::task::Poll<Option<Self::Item>> {
9732 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9733 &mut self.event_receiver,
9734 cx
9735 )?) {
9736 Some(buf) => std::task::Poll::Ready(Some(VirtioVsockEvent::decode(buf))),
9737 None => std::task::Poll::Ready(None),
9738 }
9739 }
9740}
9741
9742#[derive(Debug)]
9743pub enum VirtioVsockEvent {}
9744
9745impl VirtioVsockEvent {
9746 fn decode(
9748 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9749 ) -> Result<VirtioVsockEvent, fidl::Error> {
9750 let (bytes, _handles) = buf.split_mut();
9751 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9752 debug_assert_eq!(tx_header.tx_id, 0);
9753 match tx_header.ordinal {
9754 _ => Err(fidl::Error::UnknownOrdinal {
9755 ordinal: tx_header.ordinal,
9756 protocol_name: <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9757 }),
9758 }
9759 }
9760}
9761
9762pub struct VirtioVsockRequestStream {
9764 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9765 is_terminated: bool,
9766}
9767
9768impl std::marker::Unpin for VirtioVsockRequestStream {}
9769
9770impl futures::stream::FusedStream for VirtioVsockRequestStream {
9771 fn is_terminated(&self) -> bool {
9772 self.is_terminated
9773 }
9774}
9775
9776impl fidl::endpoints::RequestStream for VirtioVsockRequestStream {
9777 type Protocol = VirtioVsockMarker;
9778 type ControlHandle = VirtioVsockControlHandle;
9779
9780 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9781 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9782 }
9783
9784 fn control_handle(&self) -> Self::ControlHandle {
9785 VirtioVsockControlHandle { inner: self.inner.clone() }
9786 }
9787
9788 fn into_inner(
9789 self,
9790 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9791 {
9792 (self.inner, self.is_terminated)
9793 }
9794
9795 fn from_inner(
9796 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9797 is_terminated: bool,
9798 ) -> Self {
9799 Self { inner, is_terminated }
9800 }
9801}
9802
9803impl futures::Stream for VirtioVsockRequestStream {
9804 type Item = Result<VirtioVsockRequest, fidl::Error>;
9805
9806 fn poll_next(
9807 mut self: std::pin::Pin<&mut Self>,
9808 cx: &mut std::task::Context<'_>,
9809 ) -> std::task::Poll<Option<Self::Item>> {
9810 let this = &mut *self;
9811 if this.inner.check_shutdown(cx) {
9812 this.is_terminated = true;
9813 return std::task::Poll::Ready(None);
9814 }
9815 if this.is_terminated {
9816 panic!("polled VirtioVsockRequestStream after completion");
9817 }
9818 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9819 |bytes, handles| {
9820 match this.inner.channel().read_etc(cx, bytes, handles) {
9821 std::task::Poll::Ready(Ok(())) => {}
9822 std::task::Poll::Pending => return std::task::Poll::Pending,
9823 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9824 this.is_terminated = true;
9825 return std::task::Poll::Ready(None);
9826 }
9827 std::task::Poll::Ready(Err(e)) => {
9828 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9829 e.into(),
9830 ))))
9831 }
9832 }
9833
9834 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9836
9837 std::task::Poll::Ready(Some(match header.ordinal {
9838 0x72b44fb963480b11 => {
9839 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9840 let mut req = fidl::new_empty!(
9841 VirtioDeviceConfigureQueueRequest,
9842 fidl::encoding::DefaultFuchsiaResourceDialect
9843 );
9844 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
9845 let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
9846 Ok(VirtioVsockRequest::ConfigureQueue {
9847 queue: req.queue,
9848 size: req.size,
9849 desc: req.desc,
9850 avail: req.avail,
9851 used: req.used,
9852
9853 responder: VirtioVsockConfigureQueueResponder {
9854 control_handle: std::mem::ManuallyDrop::new(control_handle),
9855 tx_id: header.tx_id,
9856 },
9857 })
9858 }
9859 0x6e3a61d652499244 => {
9860 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9861 let mut req = fidl::new_empty!(
9862 VirtioDeviceNotifyQueueRequest,
9863 fidl::encoding::DefaultFuchsiaResourceDialect
9864 );
9865 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
9866 let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
9867 Ok(VirtioVsockRequest::NotifyQueue { queue: req.queue, control_handle })
9868 }
9869 0x45707654f5d23c3f => {
9870 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9871 let mut req = fidl::new_empty!(
9872 VirtioDeviceReadyRequest,
9873 fidl::encoding::DefaultFuchsiaResourceDialect
9874 );
9875 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
9876 let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
9877 Ok(VirtioVsockRequest::Ready {
9878 negotiated_features: req.negotiated_features,
9879
9880 responder: VirtioVsockReadyResponder {
9881 control_handle: std::mem::ManuallyDrop::new(control_handle),
9882 tx_id: header.tx_id,
9883 },
9884 })
9885 }
9886 0x56433562cf67ae0f => {
9887 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9888 let mut req = fidl::new_empty!(
9889 VirtioVsockStartRequest,
9890 fidl::encoding::DefaultFuchsiaResourceDialect
9891 );
9892 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioVsockStartRequest>(&header, _body_bytes, handles, &mut req)?;
9893 let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
9894 Ok(VirtioVsockRequest::Start {
9895 start_info: req.start_info,
9896 guest_cid: req.guest_cid,
9897 listeners: req.listeners,
9898
9899 responder: VirtioVsockStartResponder {
9900 control_handle: std::mem::ManuallyDrop::new(control_handle),
9901 tx_id: header.tx_id,
9902 },
9903 })
9904 }
9905 _ => Err(fidl::Error::UnknownOrdinal {
9906 ordinal: header.ordinal,
9907 protocol_name:
9908 <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9909 }),
9910 }))
9911 },
9912 )
9913 }
9914}
9915
9916#[derive(Debug)]
9917pub enum VirtioVsockRequest {
9918 ConfigureQueue {
9921 queue: u16,
9922 size: u16,
9923 desc: u64,
9924 avail: u64,
9925 used: u64,
9926 responder: VirtioVsockConfigureQueueResponder,
9927 },
9928 NotifyQueue { queue: u16, control_handle: VirtioVsockControlHandle },
9930 Ready { negotiated_features: u32, responder: VirtioVsockReadyResponder },
9933 Start {
9940 start_info: StartInfo,
9941 guest_cid: u32,
9942 listeners: Vec<fidl_fuchsia_virtualization::Listener>,
9943 responder: VirtioVsockStartResponder,
9944 },
9945}
9946
9947impl VirtioVsockRequest {
9948 #[allow(irrefutable_let_patterns)]
9949 pub fn into_configure_queue(
9950 self,
9951 ) -> Option<(u16, u16, u64, u64, u64, VirtioVsockConfigureQueueResponder)> {
9952 if let VirtioVsockRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
9953 self
9954 {
9955 Some((queue, size, desc, avail, used, responder))
9956 } else {
9957 None
9958 }
9959 }
9960
9961 #[allow(irrefutable_let_patterns)]
9962 pub fn into_notify_queue(self) -> Option<(u16, VirtioVsockControlHandle)> {
9963 if let VirtioVsockRequest::NotifyQueue { queue, control_handle } = self {
9964 Some((queue, control_handle))
9965 } else {
9966 None
9967 }
9968 }
9969
9970 #[allow(irrefutable_let_patterns)]
9971 pub fn into_ready(self) -> Option<(u32, VirtioVsockReadyResponder)> {
9972 if let VirtioVsockRequest::Ready { negotiated_features, responder } = self {
9973 Some((negotiated_features, responder))
9974 } else {
9975 None
9976 }
9977 }
9978
9979 #[allow(irrefutable_let_patterns)]
9980 pub fn into_start(
9981 self,
9982 ) -> Option<(
9983 StartInfo,
9984 u32,
9985 Vec<fidl_fuchsia_virtualization::Listener>,
9986 VirtioVsockStartResponder,
9987 )> {
9988 if let VirtioVsockRequest::Start { start_info, guest_cid, listeners, responder } = self {
9989 Some((start_info, guest_cid, listeners, responder))
9990 } else {
9991 None
9992 }
9993 }
9994
9995 pub fn method_name(&self) -> &'static str {
9997 match *self {
9998 VirtioVsockRequest::ConfigureQueue { .. } => "configure_queue",
9999 VirtioVsockRequest::NotifyQueue { .. } => "notify_queue",
10000 VirtioVsockRequest::Ready { .. } => "ready",
10001 VirtioVsockRequest::Start { .. } => "start",
10002 }
10003 }
10004}
10005
10006#[derive(Debug, Clone)]
10007pub struct VirtioVsockControlHandle {
10008 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10009}
10010
10011impl fidl::endpoints::ControlHandle for VirtioVsockControlHandle {
10012 fn shutdown(&self) {
10013 self.inner.shutdown()
10014 }
10015 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10016 self.inner.shutdown_with_epitaph(status)
10017 }
10018
10019 fn is_closed(&self) -> bool {
10020 self.inner.channel().is_closed()
10021 }
10022 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10023 self.inner.channel().on_closed()
10024 }
10025
10026 #[cfg(target_os = "fuchsia")]
10027 fn signal_peer(
10028 &self,
10029 clear_mask: zx::Signals,
10030 set_mask: zx::Signals,
10031 ) -> Result<(), zx_status::Status> {
10032 use fidl::Peered;
10033 self.inner.channel().signal_peer(clear_mask, set_mask)
10034 }
10035}
10036
10037impl VirtioVsockControlHandle {}
10038
10039#[must_use = "FIDL methods require a response to be sent"]
10040#[derive(Debug)]
10041pub struct VirtioVsockConfigureQueueResponder {
10042 control_handle: std::mem::ManuallyDrop<VirtioVsockControlHandle>,
10043 tx_id: u32,
10044}
10045
10046impl std::ops::Drop for VirtioVsockConfigureQueueResponder {
10050 fn drop(&mut self) {
10051 self.control_handle.shutdown();
10052 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10054 }
10055}
10056
10057impl fidl::endpoints::Responder for VirtioVsockConfigureQueueResponder {
10058 type ControlHandle = VirtioVsockControlHandle;
10059
10060 fn control_handle(&self) -> &VirtioVsockControlHandle {
10061 &self.control_handle
10062 }
10063
10064 fn drop_without_shutdown(mut self) {
10065 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10067 std::mem::forget(self);
10069 }
10070}
10071
10072impl VirtioVsockConfigureQueueResponder {
10073 pub fn send(self) -> Result<(), fidl::Error> {
10077 let _result = self.send_raw();
10078 if _result.is_err() {
10079 self.control_handle.shutdown();
10080 }
10081 self.drop_without_shutdown();
10082 _result
10083 }
10084
10085 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
10087 let _result = self.send_raw();
10088 self.drop_without_shutdown();
10089 _result
10090 }
10091
10092 fn send_raw(&self) -> Result<(), fidl::Error> {
10093 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
10094 (),
10095 self.tx_id,
10096 0x72b44fb963480b11,
10097 fidl::encoding::DynamicFlags::empty(),
10098 )
10099 }
10100}
10101
10102#[must_use = "FIDL methods require a response to be sent"]
10103#[derive(Debug)]
10104pub struct VirtioVsockReadyResponder {
10105 control_handle: std::mem::ManuallyDrop<VirtioVsockControlHandle>,
10106 tx_id: u32,
10107}
10108
10109impl std::ops::Drop for VirtioVsockReadyResponder {
10113 fn drop(&mut self) {
10114 self.control_handle.shutdown();
10115 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10117 }
10118}
10119
10120impl fidl::endpoints::Responder for VirtioVsockReadyResponder {
10121 type ControlHandle = VirtioVsockControlHandle;
10122
10123 fn control_handle(&self) -> &VirtioVsockControlHandle {
10124 &self.control_handle
10125 }
10126
10127 fn drop_without_shutdown(mut self) {
10128 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10130 std::mem::forget(self);
10132 }
10133}
10134
10135impl VirtioVsockReadyResponder {
10136 pub fn send(self) -> Result<(), fidl::Error> {
10140 let _result = self.send_raw();
10141 if _result.is_err() {
10142 self.control_handle.shutdown();
10143 }
10144 self.drop_without_shutdown();
10145 _result
10146 }
10147
10148 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
10150 let _result = self.send_raw();
10151 self.drop_without_shutdown();
10152 _result
10153 }
10154
10155 fn send_raw(&self) -> Result<(), fidl::Error> {
10156 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
10157 (),
10158 self.tx_id,
10159 0x45707654f5d23c3f,
10160 fidl::encoding::DynamicFlags::empty(),
10161 )
10162 }
10163}
10164
10165#[must_use = "FIDL methods require a response to be sent"]
10166#[derive(Debug)]
10167pub struct VirtioVsockStartResponder {
10168 control_handle: std::mem::ManuallyDrop<VirtioVsockControlHandle>,
10169 tx_id: u32,
10170}
10171
10172impl std::ops::Drop for VirtioVsockStartResponder {
10176 fn drop(&mut self) {
10177 self.control_handle.shutdown();
10178 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10180 }
10181}
10182
10183impl fidl::endpoints::Responder for VirtioVsockStartResponder {
10184 type ControlHandle = VirtioVsockControlHandle;
10185
10186 fn control_handle(&self) -> &VirtioVsockControlHandle {
10187 &self.control_handle
10188 }
10189
10190 fn drop_without_shutdown(mut self) {
10191 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10193 std::mem::forget(self);
10195 }
10196}
10197
10198impl VirtioVsockStartResponder {
10199 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
10203 let _result = self.send_raw(result);
10204 if _result.is_err() {
10205 self.control_handle.shutdown();
10206 }
10207 self.drop_without_shutdown();
10208 _result
10209 }
10210
10211 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
10213 let _result = self.send_raw(result);
10214 self.drop_without_shutdown();
10215 _result
10216 }
10217
10218 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
10219 self.control_handle
10220 .inner
10221 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
10222 result,
10223 self.tx_id,
10224 0x56433562cf67ae0f,
10225 fidl::encoding::DynamicFlags::empty(),
10226 )
10227 }
10228}
10229
10230#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10231pub struct VirtioWaylandMarker;
10232
10233impl fidl::endpoints::ProtocolMarker for VirtioWaylandMarker {
10234 type Proxy = VirtioWaylandProxy;
10235 type RequestStream = VirtioWaylandRequestStream;
10236 #[cfg(target_os = "fuchsia")]
10237 type SynchronousProxy = VirtioWaylandSynchronousProxy;
10238
10239 const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioWayland";
10240}
10241impl fidl::endpoints::DiscoverableProtocolMarker for VirtioWaylandMarker {}
10242
10243pub trait VirtioWaylandProxyInterface: Send + Sync {
10244 type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
10245 fn r#configure_queue(
10246 &self,
10247 queue: u16,
10248 size: u16,
10249 desc: u64,
10250 avail: u64,
10251 used: u64,
10252 ) -> Self::ConfigureQueueResponseFut;
10253 fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
10254 type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
10255 fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
10256 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
10257 fn r#start(
10258 &self,
10259 start_info: StartInfo,
10260 vmar: fidl::Vmar,
10261 sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10262 scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
10263 ) -> Self::StartResponseFut;
10264 type StartWithWaylandServer_ResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
10265 + Send;
10266 fn r#start_with_wayland_server_(
10267 &self,
10268 start_info: StartInfo,
10269 vmar: fidl::Vmar,
10270 wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
10271 sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10272 scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
10273 ) -> Self::StartWithWaylandServer_ResponseFut;
10274 fn r#get_importer(
10275 &self,
10276 importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
10277 ) -> Result<(), fidl::Error>;
10278}
10279#[derive(Debug)]
10280#[cfg(target_os = "fuchsia")]
10281pub struct VirtioWaylandSynchronousProxy {
10282 client: fidl::client::sync::Client,
10283}
10284
10285#[cfg(target_os = "fuchsia")]
10286impl fidl::endpoints::SynchronousProxy for VirtioWaylandSynchronousProxy {
10287 type Proxy = VirtioWaylandProxy;
10288 type Protocol = VirtioWaylandMarker;
10289
10290 fn from_channel(inner: fidl::Channel) -> Self {
10291 Self::new(inner)
10292 }
10293
10294 fn into_channel(self) -> fidl::Channel {
10295 self.client.into_channel()
10296 }
10297
10298 fn as_channel(&self) -> &fidl::Channel {
10299 self.client.as_channel()
10300 }
10301}
10302
10303#[cfg(target_os = "fuchsia")]
10304impl VirtioWaylandSynchronousProxy {
10305 pub fn new(channel: fidl::Channel) -> Self {
10306 let protocol_name = <VirtioWaylandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10307 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10308 }
10309
10310 pub fn into_channel(self) -> fidl::Channel {
10311 self.client.into_channel()
10312 }
10313
10314 pub fn wait_for_event(
10317 &self,
10318 deadline: zx::MonotonicInstant,
10319 ) -> Result<VirtioWaylandEvent, fidl::Error> {
10320 VirtioWaylandEvent::decode(self.client.wait_for_event(deadline)?)
10321 }
10322
10323 pub fn r#configure_queue(
10326 &self,
10327 mut queue: u16,
10328 mut size: u16,
10329 mut desc: u64,
10330 mut avail: u64,
10331 mut used: u64,
10332 ___deadline: zx::MonotonicInstant,
10333 ) -> Result<(), fidl::Error> {
10334 let _response = self
10335 .client
10336 .send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
10337 (queue, size, desc, avail, used),
10338 0x72b44fb963480b11,
10339 fidl::encoding::DynamicFlags::empty(),
10340 ___deadline,
10341 )?;
10342 Ok(_response)
10343 }
10344
10345 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
10347 self.client.send::<VirtioDeviceNotifyQueueRequest>(
10348 (queue,),
10349 0x6e3a61d652499244,
10350 fidl::encoding::DynamicFlags::empty(),
10351 )
10352 }
10353
10354 pub fn r#ready(
10357 &self,
10358 mut negotiated_features: u32,
10359 ___deadline: zx::MonotonicInstant,
10360 ) -> Result<(), fidl::Error> {
10361 let _response =
10362 self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
10363 (negotiated_features,),
10364 0x45707654f5d23c3f,
10365 fidl::encoding::DynamicFlags::empty(),
10366 ___deadline,
10367 )?;
10368 Ok(_response)
10369 }
10370
10371 pub fn r#start(
10373 &self,
10374 mut start_info: StartInfo,
10375 mut vmar: fidl::Vmar,
10376 mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10377 mut scenic_allocator: fidl::endpoints::ClientEnd<
10378 fidl_fuchsia_ui_composition::AllocatorMarker,
10379 >,
10380 ___deadline: zx::MonotonicInstant,
10381 ) -> Result<(), fidl::Error> {
10382 let _response =
10383 self.client.send_query::<VirtioWaylandStartRequest, fidl::encoding::EmptyPayload>(
10384 (&mut start_info, vmar, sysmem_allocator, scenic_allocator),
10385 0x1f60e084e30deee6,
10386 fidl::encoding::DynamicFlags::empty(),
10387 ___deadline,
10388 )?;
10389 Ok(_response)
10390 }
10391
10392 pub fn r#start_with_wayland_server_(
10394 &self,
10395 mut start_info: StartInfo,
10396 mut vmar: fidl::Vmar,
10397 mut wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
10398 mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10399 mut scenic_allocator: fidl::endpoints::ClientEnd<
10400 fidl_fuchsia_ui_composition::AllocatorMarker,
10401 >,
10402 ___deadline: zx::MonotonicInstant,
10403 ) -> Result<(), fidl::Error> {
10404 let _response = self
10405 .client
10406 .send_query::<VirtioWaylandStartWithWaylandServerRequest, fidl::encoding::EmptyPayload>(
10407 (&mut start_info, vmar, wayland_server, sysmem_allocator, scenic_allocator),
10408 0x3f2e38dfb60077e9,
10409 fidl::encoding::DynamicFlags::empty(),
10410 ___deadline,
10411 )?;
10412 Ok(_response)
10413 }
10414
10415 pub fn r#get_importer(
10416 &self,
10417 mut importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
10418 ) -> Result<(), fidl::Error> {
10419 self.client.send::<VirtioWaylandGetImporterRequest>(
10420 (importer,),
10421 0x49d1b3c94767a541,
10422 fidl::encoding::DynamicFlags::empty(),
10423 )
10424 }
10425}
10426
10427#[cfg(target_os = "fuchsia")]
10428impl From<VirtioWaylandSynchronousProxy> for zx::Handle {
10429 fn from(value: VirtioWaylandSynchronousProxy) -> Self {
10430 value.into_channel().into()
10431 }
10432}
10433
10434#[cfg(target_os = "fuchsia")]
10435impl From<fidl::Channel> for VirtioWaylandSynchronousProxy {
10436 fn from(value: fidl::Channel) -> Self {
10437 Self::new(value)
10438 }
10439}
10440
10441#[derive(Debug, Clone)]
10442pub struct VirtioWaylandProxy {
10443 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10444}
10445
10446impl fidl::endpoints::Proxy for VirtioWaylandProxy {
10447 type Protocol = VirtioWaylandMarker;
10448
10449 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10450 Self::new(inner)
10451 }
10452
10453 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10454 self.client.into_channel().map_err(|client| Self { client })
10455 }
10456
10457 fn as_channel(&self) -> &::fidl::AsyncChannel {
10458 self.client.as_channel()
10459 }
10460}
10461
10462impl VirtioWaylandProxy {
10463 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10465 let protocol_name = <VirtioWaylandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10466 Self { client: fidl::client::Client::new(channel, protocol_name) }
10467 }
10468
10469 pub fn take_event_stream(&self) -> VirtioWaylandEventStream {
10475 VirtioWaylandEventStream { event_receiver: self.client.take_event_receiver() }
10476 }
10477
10478 pub fn r#configure_queue(
10481 &self,
10482 mut queue: u16,
10483 mut size: u16,
10484 mut desc: u64,
10485 mut avail: u64,
10486 mut used: u64,
10487 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10488 VirtioWaylandProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
10489 }
10490
10491 pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
10493 VirtioWaylandProxyInterface::r#notify_queue(self, queue)
10494 }
10495
10496 pub fn r#ready(
10499 &self,
10500 mut negotiated_features: u32,
10501 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10502 VirtioWaylandProxyInterface::r#ready(self, negotiated_features)
10503 }
10504
10505 pub fn r#start(
10507 &self,
10508 mut start_info: StartInfo,
10509 mut vmar: fidl::Vmar,
10510 mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10511 mut scenic_allocator: fidl::endpoints::ClientEnd<
10512 fidl_fuchsia_ui_composition::AllocatorMarker,
10513 >,
10514 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10515 VirtioWaylandProxyInterface::r#start(
10516 self,
10517 start_info,
10518 vmar,
10519 sysmem_allocator,
10520 scenic_allocator,
10521 )
10522 }
10523
10524 pub fn r#start_with_wayland_server_(
10526 &self,
10527 mut start_info: StartInfo,
10528 mut vmar: fidl::Vmar,
10529 mut wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
10530 mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10531 mut scenic_allocator: fidl::endpoints::ClientEnd<
10532 fidl_fuchsia_ui_composition::AllocatorMarker,
10533 >,
10534 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10535 VirtioWaylandProxyInterface::r#start_with_wayland_server_(
10536 self,
10537 start_info,
10538 vmar,
10539 wayland_server,
10540 sysmem_allocator,
10541 scenic_allocator,
10542 )
10543 }
10544
10545 pub fn r#get_importer(
10546 &self,
10547 mut importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
10548 ) -> Result<(), fidl::Error> {
10549 VirtioWaylandProxyInterface::r#get_importer(self, importer)
10550 }
10551}
10552
10553impl VirtioWaylandProxyInterface for VirtioWaylandProxy {
10554 type ConfigureQueueResponseFut =
10555 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10556 fn r#configure_queue(
10557 &self,
10558 mut queue: u16,
10559 mut size: u16,
10560 mut desc: u64,
10561 mut avail: u64,
10562 mut used: u64,
10563 ) -> Self::ConfigureQueueResponseFut {
10564 fn _decode(
10565 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10566 ) -> Result<(), fidl::Error> {
10567 let _response = fidl::client::decode_transaction_body::<
10568 fidl::encoding::EmptyPayload,
10569 fidl::encoding::DefaultFuchsiaResourceDialect,
10570 0x72b44fb963480b11,
10571 >(_buf?)?;
10572 Ok(_response)
10573 }
10574 self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
10575 (queue, size, desc, avail, used),
10576 0x72b44fb963480b11,
10577 fidl::encoding::DynamicFlags::empty(),
10578 _decode,
10579 )
10580 }
10581
10582 fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
10583 self.client.send::<VirtioDeviceNotifyQueueRequest>(
10584 (queue,),
10585 0x6e3a61d652499244,
10586 fidl::encoding::DynamicFlags::empty(),
10587 )
10588 }
10589
10590 type ReadyResponseFut =
10591 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10592 fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
10593 fn _decode(
10594 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10595 ) -> Result<(), fidl::Error> {
10596 let _response = fidl::client::decode_transaction_body::<
10597 fidl::encoding::EmptyPayload,
10598 fidl::encoding::DefaultFuchsiaResourceDialect,
10599 0x45707654f5d23c3f,
10600 >(_buf?)?;
10601 Ok(_response)
10602 }
10603 self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
10604 (negotiated_features,),
10605 0x45707654f5d23c3f,
10606 fidl::encoding::DynamicFlags::empty(),
10607 _decode,
10608 )
10609 }
10610
10611 type StartResponseFut =
10612 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10613 fn r#start(
10614 &self,
10615 mut start_info: StartInfo,
10616 mut vmar: fidl::Vmar,
10617 mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10618 mut scenic_allocator: fidl::endpoints::ClientEnd<
10619 fidl_fuchsia_ui_composition::AllocatorMarker,
10620 >,
10621 ) -> Self::StartResponseFut {
10622 fn _decode(
10623 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10624 ) -> Result<(), fidl::Error> {
10625 let _response = fidl::client::decode_transaction_body::<
10626 fidl::encoding::EmptyPayload,
10627 fidl::encoding::DefaultFuchsiaResourceDialect,
10628 0x1f60e084e30deee6,
10629 >(_buf?)?;
10630 Ok(_response)
10631 }
10632 self.client.send_query_and_decode::<VirtioWaylandStartRequest, ()>(
10633 (&mut start_info, vmar, sysmem_allocator, scenic_allocator),
10634 0x1f60e084e30deee6,
10635 fidl::encoding::DynamicFlags::empty(),
10636 _decode,
10637 )
10638 }
10639
10640 type StartWithWaylandServer_ResponseFut =
10641 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10642 fn r#start_with_wayland_server_(
10643 &self,
10644 mut start_info: StartInfo,
10645 mut vmar: fidl::Vmar,
10646 mut wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
10647 mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10648 mut scenic_allocator: fidl::endpoints::ClientEnd<
10649 fidl_fuchsia_ui_composition::AllocatorMarker,
10650 >,
10651 ) -> Self::StartWithWaylandServer_ResponseFut {
10652 fn _decode(
10653 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10654 ) -> Result<(), fidl::Error> {
10655 let _response = fidl::client::decode_transaction_body::<
10656 fidl::encoding::EmptyPayload,
10657 fidl::encoding::DefaultFuchsiaResourceDialect,
10658 0x3f2e38dfb60077e9,
10659 >(_buf?)?;
10660 Ok(_response)
10661 }
10662 self.client.send_query_and_decode::<VirtioWaylandStartWithWaylandServerRequest, ()>(
10663 (&mut start_info, vmar, wayland_server, sysmem_allocator, scenic_allocator),
10664 0x3f2e38dfb60077e9,
10665 fidl::encoding::DynamicFlags::empty(),
10666 _decode,
10667 )
10668 }
10669
10670 fn r#get_importer(
10671 &self,
10672 mut importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
10673 ) -> Result<(), fidl::Error> {
10674 self.client.send::<VirtioWaylandGetImporterRequest>(
10675 (importer,),
10676 0x49d1b3c94767a541,
10677 fidl::encoding::DynamicFlags::empty(),
10678 )
10679 }
10680}
10681
10682pub struct VirtioWaylandEventStream {
10683 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10684}
10685
10686impl std::marker::Unpin for VirtioWaylandEventStream {}
10687
10688impl futures::stream::FusedStream for VirtioWaylandEventStream {
10689 fn is_terminated(&self) -> bool {
10690 self.event_receiver.is_terminated()
10691 }
10692}
10693
10694impl futures::Stream for VirtioWaylandEventStream {
10695 type Item = Result<VirtioWaylandEvent, fidl::Error>;
10696
10697 fn poll_next(
10698 mut self: std::pin::Pin<&mut Self>,
10699 cx: &mut std::task::Context<'_>,
10700 ) -> std::task::Poll<Option<Self::Item>> {
10701 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10702 &mut self.event_receiver,
10703 cx
10704 )?) {
10705 Some(buf) => std::task::Poll::Ready(Some(VirtioWaylandEvent::decode(buf))),
10706 None => std::task::Poll::Ready(None),
10707 }
10708 }
10709}
10710
10711#[derive(Debug)]
10712pub enum VirtioWaylandEvent {}
10713
10714impl VirtioWaylandEvent {
10715 fn decode(
10717 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10718 ) -> Result<VirtioWaylandEvent, fidl::Error> {
10719 let (bytes, _handles) = buf.split_mut();
10720 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10721 debug_assert_eq!(tx_header.tx_id, 0);
10722 match tx_header.ordinal {
10723 _ => Err(fidl::Error::UnknownOrdinal {
10724 ordinal: tx_header.ordinal,
10725 protocol_name: <VirtioWaylandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10726 }),
10727 }
10728 }
10729}
10730
10731pub struct VirtioWaylandRequestStream {
10733 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10734 is_terminated: bool,
10735}
10736
10737impl std::marker::Unpin for VirtioWaylandRequestStream {}
10738
10739impl futures::stream::FusedStream for VirtioWaylandRequestStream {
10740 fn is_terminated(&self) -> bool {
10741 self.is_terminated
10742 }
10743}
10744
10745impl fidl::endpoints::RequestStream for VirtioWaylandRequestStream {
10746 type Protocol = VirtioWaylandMarker;
10747 type ControlHandle = VirtioWaylandControlHandle;
10748
10749 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10750 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10751 }
10752
10753 fn control_handle(&self) -> Self::ControlHandle {
10754 VirtioWaylandControlHandle { inner: self.inner.clone() }
10755 }
10756
10757 fn into_inner(
10758 self,
10759 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10760 {
10761 (self.inner, self.is_terminated)
10762 }
10763
10764 fn from_inner(
10765 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10766 is_terminated: bool,
10767 ) -> Self {
10768 Self { inner, is_terminated }
10769 }
10770}
10771
10772impl futures::Stream for VirtioWaylandRequestStream {
10773 type Item = Result<VirtioWaylandRequest, fidl::Error>;
10774
10775 fn poll_next(
10776 mut self: std::pin::Pin<&mut Self>,
10777 cx: &mut std::task::Context<'_>,
10778 ) -> std::task::Poll<Option<Self::Item>> {
10779 let this = &mut *self;
10780 if this.inner.check_shutdown(cx) {
10781 this.is_terminated = true;
10782 return std::task::Poll::Ready(None);
10783 }
10784 if this.is_terminated {
10785 panic!("polled VirtioWaylandRequestStream after completion");
10786 }
10787 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10788 |bytes, handles| {
10789 match this.inner.channel().read_etc(cx, bytes, handles) {
10790 std::task::Poll::Ready(Ok(())) => {}
10791 std::task::Poll::Pending => return std::task::Poll::Pending,
10792 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10793 this.is_terminated = true;
10794 return std::task::Poll::Ready(None);
10795 }
10796 std::task::Poll::Ready(Err(e)) => {
10797 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10798 e.into(),
10799 ))))
10800 }
10801 }
10802
10803 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10805
10806 std::task::Poll::Ready(Some(match header.ordinal {
10807 0x72b44fb963480b11 => {
10808 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10809 let mut req = fidl::new_empty!(
10810 VirtioDeviceConfigureQueueRequest,
10811 fidl::encoding::DefaultFuchsiaResourceDialect
10812 );
10813 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
10814 let control_handle =
10815 VirtioWaylandControlHandle { inner: this.inner.clone() };
10816 Ok(VirtioWaylandRequest::ConfigureQueue {
10817 queue: req.queue,
10818 size: req.size,
10819 desc: req.desc,
10820 avail: req.avail,
10821 used: req.used,
10822
10823 responder: VirtioWaylandConfigureQueueResponder {
10824 control_handle: std::mem::ManuallyDrop::new(control_handle),
10825 tx_id: header.tx_id,
10826 },
10827 })
10828 }
10829 0x6e3a61d652499244 => {
10830 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10831 let mut req = fidl::new_empty!(
10832 VirtioDeviceNotifyQueueRequest,
10833 fidl::encoding::DefaultFuchsiaResourceDialect
10834 );
10835 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
10836 let control_handle =
10837 VirtioWaylandControlHandle { inner: this.inner.clone() };
10838 Ok(VirtioWaylandRequest::NotifyQueue { queue: req.queue, control_handle })
10839 }
10840 0x45707654f5d23c3f => {
10841 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10842 let mut req = fidl::new_empty!(
10843 VirtioDeviceReadyRequest,
10844 fidl::encoding::DefaultFuchsiaResourceDialect
10845 );
10846 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
10847 let control_handle =
10848 VirtioWaylandControlHandle { inner: this.inner.clone() };
10849 Ok(VirtioWaylandRequest::Ready {
10850 negotiated_features: req.negotiated_features,
10851
10852 responder: VirtioWaylandReadyResponder {
10853 control_handle: std::mem::ManuallyDrop::new(control_handle),
10854 tx_id: header.tx_id,
10855 },
10856 })
10857 }
10858 0x1f60e084e30deee6 => {
10859 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10860 let mut req = fidl::new_empty!(
10861 VirtioWaylandStartRequest,
10862 fidl::encoding::DefaultFuchsiaResourceDialect
10863 );
10864 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandStartRequest>(&header, _body_bytes, handles, &mut req)?;
10865 let control_handle =
10866 VirtioWaylandControlHandle { inner: this.inner.clone() };
10867 Ok(VirtioWaylandRequest::Start {
10868 start_info: req.start_info,
10869 vmar: req.vmar,
10870 sysmem_allocator: req.sysmem_allocator,
10871 scenic_allocator: req.scenic_allocator,
10872
10873 responder: VirtioWaylandStartResponder {
10874 control_handle: std::mem::ManuallyDrop::new(control_handle),
10875 tx_id: header.tx_id,
10876 },
10877 })
10878 }
10879 0x3f2e38dfb60077e9 => {
10880 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10881 let mut req = fidl::new_empty!(
10882 VirtioWaylandStartWithWaylandServerRequest,
10883 fidl::encoding::DefaultFuchsiaResourceDialect
10884 );
10885 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandStartWithWaylandServerRequest>(&header, _body_bytes, handles, &mut req)?;
10886 let control_handle =
10887 VirtioWaylandControlHandle { inner: this.inner.clone() };
10888 Ok(VirtioWaylandRequest::StartWithWaylandServer_ {
10889 start_info: req.start_info,
10890 vmar: req.vmar,
10891 wayland_server: req.wayland_server,
10892 sysmem_allocator: req.sysmem_allocator,
10893 scenic_allocator: req.scenic_allocator,
10894
10895 responder: VirtioWaylandStartWithWaylandServer_Responder {
10896 control_handle: std::mem::ManuallyDrop::new(control_handle),
10897 tx_id: header.tx_id,
10898 },
10899 })
10900 }
10901 0x49d1b3c94767a541 => {
10902 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10903 let mut req = fidl::new_empty!(
10904 VirtioWaylandGetImporterRequest,
10905 fidl::encoding::DefaultFuchsiaResourceDialect
10906 );
10907 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandGetImporterRequest>(&header, _body_bytes, handles, &mut req)?;
10908 let control_handle =
10909 VirtioWaylandControlHandle { inner: this.inner.clone() };
10910 Ok(VirtioWaylandRequest::GetImporter {
10911 importer: req.importer,
10912
10913 control_handle,
10914 })
10915 }
10916 _ => Err(fidl::Error::UnknownOrdinal {
10917 ordinal: header.ordinal,
10918 protocol_name:
10919 <VirtioWaylandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10920 }),
10921 }))
10922 },
10923 )
10924 }
10925}
10926
10927#[derive(Debug)]
10928pub enum VirtioWaylandRequest {
10929 ConfigureQueue {
10932 queue: u16,
10933 size: u16,
10934 desc: u64,
10935 avail: u64,
10936 used: u64,
10937 responder: VirtioWaylandConfigureQueueResponder,
10938 },
10939 NotifyQueue { queue: u16, control_handle: VirtioWaylandControlHandle },
10941 Ready { negotiated_features: u32, responder: VirtioWaylandReadyResponder },
10944 Start {
10946 start_info: StartInfo,
10947 vmar: fidl::Vmar,
10948 sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10949 scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
10950 responder: VirtioWaylandStartResponder,
10951 },
10952 StartWithWaylandServer_ {
10954 start_info: StartInfo,
10955 vmar: fidl::Vmar,
10956 wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
10957 sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
10958 scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
10959 responder: VirtioWaylandStartWithWaylandServer_Responder,
10960 },
10961 GetImporter {
10962 importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
10963 control_handle: VirtioWaylandControlHandle,
10964 },
10965}
10966
10967impl VirtioWaylandRequest {
10968 #[allow(irrefutable_let_patterns)]
10969 pub fn into_configure_queue(
10970 self,
10971 ) -> Option<(u16, u16, u64, u64, u64, VirtioWaylandConfigureQueueResponder)> {
10972 if let VirtioWaylandRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
10973 self
10974 {
10975 Some((queue, size, desc, avail, used, responder))
10976 } else {
10977 None
10978 }
10979 }
10980
10981 #[allow(irrefutable_let_patterns)]
10982 pub fn into_notify_queue(self) -> Option<(u16, VirtioWaylandControlHandle)> {
10983 if let VirtioWaylandRequest::NotifyQueue { queue, control_handle } = self {
10984 Some((queue, control_handle))
10985 } else {
10986 None
10987 }
10988 }
10989
10990 #[allow(irrefutable_let_patterns)]
10991 pub fn into_ready(self) -> Option<(u32, VirtioWaylandReadyResponder)> {
10992 if let VirtioWaylandRequest::Ready { negotiated_features, responder } = self {
10993 Some((negotiated_features, responder))
10994 } else {
10995 None
10996 }
10997 }
10998
10999 #[allow(irrefutable_let_patterns)]
11000 pub fn into_start(
11001 self,
11002 ) -> Option<(
11003 StartInfo,
11004 fidl::Vmar,
11005 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
11006 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
11007 VirtioWaylandStartResponder,
11008 )> {
11009 if let VirtioWaylandRequest::Start {
11010 start_info,
11011 vmar,
11012 sysmem_allocator,
11013 scenic_allocator,
11014 responder,
11015 } = self
11016 {
11017 Some((start_info, vmar, sysmem_allocator, scenic_allocator, responder))
11018 } else {
11019 None
11020 }
11021 }
11022
11023 #[allow(irrefutable_let_patterns)]
11024 pub fn into_start_with_wayland_server_(
11025 self,
11026 ) -> Option<(
11027 StartInfo,
11028 fidl::Vmar,
11029 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
11030 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
11031 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
11032 VirtioWaylandStartWithWaylandServer_Responder,
11033 )> {
11034 if let VirtioWaylandRequest::StartWithWaylandServer_ {
11035 start_info,
11036 vmar,
11037 wayland_server,
11038 sysmem_allocator,
11039 scenic_allocator,
11040 responder,
11041 } = self
11042 {
11043 Some((start_info, vmar, wayland_server, sysmem_allocator, scenic_allocator, responder))
11044 } else {
11045 None
11046 }
11047 }
11048
11049 #[allow(irrefutable_let_patterns)]
11050 pub fn into_get_importer(
11051 self,
11052 ) -> Option<(fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>, VirtioWaylandControlHandle)>
11053 {
11054 if let VirtioWaylandRequest::GetImporter { importer, control_handle } = self {
11055 Some((importer, control_handle))
11056 } else {
11057 None
11058 }
11059 }
11060
11061 pub fn method_name(&self) -> &'static str {
11063 match *self {
11064 VirtioWaylandRequest::ConfigureQueue { .. } => "configure_queue",
11065 VirtioWaylandRequest::NotifyQueue { .. } => "notify_queue",
11066 VirtioWaylandRequest::Ready { .. } => "ready",
11067 VirtioWaylandRequest::Start { .. } => "start",
11068 VirtioWaylandRequest::StartWithWaylandServer_ { .. } => "start_with_wayland_server_",
11069 VirtioWaylandRequest::GetImporter { .. } => "get_importer",
11070 }
11071 }
11072}
11073
11074#[derive(Debug, Clone)]
11075pub struct VirtioWaylandControlHandle {
11076 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11077}
11078
11079impl fidl::endpoints::ControlHandle for VirtioWaylandControlHandle {
11080 fn shutdown(&self) {
11081 self.inner.shutdown()
11082 }
11083 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11084 self.inner.shutdown_with_epitaph(status)
11085 }
11086
11087 fn is_closed(&self) -> bool {
11088 self.inner.channel().is_closed()
11089 }
11090 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11091 self.inner.channel().on_closed()
11092 }
11093
11094 #[cfg(target_os = "fuchsia")]
11095 fn signal_peer(
11096 &self,
11097 clear_mask: zx::Signals,
11098 set_mask: zx::Signals,
11099 ) -> Result<(), zx_status::Status> {
11100 use fidl::Peered;
11101 self.inner.channel().signal_peer(clear_mask, set_mask)
11102 }
11103}
11104
11105impl VirtioWaylandControlHandle {}
11106
11107#[must_use = "FIDL methods require a response to be sent"]
11108#[derive(Debug)]
11109pub struct VirtioWaylandConfigureQueueResponder {
11110 control_handle: std::mem::ManuallyDrop<VirtioWaylandControlHandle>,
11111 tx_id: u32,
11112}
11113
11114impl std::ops::Drop for VirtioWaylandConfigureQueueResponder {
11118 fn drop(&mut self) {
11119 self.control_handle.shutdown();
11120 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11122 }
11123}
11124
11125impl fidl::endpoints::Responder for VirtioWaylandConfigureQueueResponder {
11126 type ControlHandle = VirtioWaylandControlHandle;
11127
11128 fn control_handle(&self) -> &VirtioWaylandControlHandle {
11129 &self.control_handle
11130 }
11131
11132 fn drop_without_shutdown(mut self) {
11133 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11135 std::mem::forget(self);
11137 }
11138}
11139
11140impl VirtioWaylandConfigureQueueResponder {
11141 pub fn send(self) -> Result<(), fidl::Error> {
11145 let _result = self.send_raw();
11146 if _result.is_err() {
11147 self.control_handle.shutdown();
11148 }
11149 self.drop_without_shutdown();
11150 _result
11151 }
11152
11153 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11155 let _result = self.send_raw();
11156 self.drop_without_shutdown();
11157 _result
11158 }
11159
11160 fn send_raw(&self) -> Result<(), fidl::Error> {
11161 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11162 (),
11163 self.tx_id,
11164 0x72b44fb963480b11,
11165 fidl::encoding::DynamicFlags::empty(),
11166 )
11167 }
11168}
11169
11170#[must_use = "FIDL methods require a response to be sent"]
11171#[derive(Debug)]
11172pub struct VirtioWaylandReadyResponder {
11173 control_handle: std::mem::ManuallyDrop<VirtioWaylandControlHandle>,
11174 tx_id: u32,
11175}
11176
11177impl std::ops::Drop for VirtioWaylandReadyResponder {
11181 fn drop(&mut self) {
11182 self.control_handle.shutdown();
11183 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11185 }
11186}
11187
11188impl fidl::endpoints::Responder for VirtioWaylandReadyResponder {
11189 type ControlHandle = VirtioWaylandControlHandle;
11190
11191 fn control_handle(&self) -> &VirtioWaylandControlHandle {
11192 &self.control_handle
11193 }
11194
11195 fn drop_without_shutdown(mut self) {
11196 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11198 std::mem::forget(self);
11200 }
11201}
11202
11203impl VirtioWaylandReadyResponder {
11204 pub fn send(self) -> Result<(), fidl::Error> {
11208 let _result = self.send_raw();
11209 if _result.is_err() {
11210 self.control_handle.shutdown();
11211 }
11212 self.drop_without_shutdown();
11213 _result
11214 }
11215
11216 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11218 let _result = self.send_raw();
11219 self.drop_without_shutdown();
11220 _result
11221 }
11222
11223 fn send_raw(&self) -> Result<(), fidl::Error> {
11224 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11225 (),
11226 self.tx_id,
11227 0x45707654f5d23c3f,
11228 fidl::encoding::DynamicFlags::empty(),
11229 )
11230 }
11231}
11232
11233#[must_use = "FIDL methods require a response to be sent"]
11234#[derive(Debug)]
11235pub struct VirtioWaylandStartResponder {
11236 control_handle: std::mem::ManuallyDrop<VirtioWaylandControlHandle>,
11237 tx_id: u32,
11238}
11239
11240impl std::ops::Drop for VirtioWaylandStartResponder {
11244 fn drop(&mut self) {
11245 self.control_handle.shutdown();
11246 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11248 }
11249}
11250
11251impl fidl::endpoints::Responder for VirtioWaylandStartResponder {
11252 type ControlHandle = VirtioWaylandControlHandle;
11253
11254 fn control_handle(&self) -> &VirtioWaylandControlHandle {
11255 &self.control_handle
11256 }
11257
11258 fn drop_without_shutdown(mut self) {
11259 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11261 std::mem::forget(self);
11263 }
11264}
11265
11266impl VirtioWaylandStartResponder {
11267 pub fn send(self) -> Result<(), fidl::Error> {
11271 let _result = self.send_raw();
11272 if _result.is_err() {
11273 self.control_handle.shutdown();
11274 }
11275 self.drop_without_shutdown();
11276 _result
11277 }
11278
11279 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11281 let _result = self.send_raw();
11282 self.drop_without_shutdown();
11283 _result
11284 }
11285
11286 fn send_raw(&self) -> Result<(), fidl::Error> {
11287 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11288 (),
11289 self.tx_id,
11290 0x1f60e084e30deee6,
11291 fidl::encoding::DynamicFlags::empty(),
11292 )
11293 }
11294}
11295
11296#[must_use = "FIDL methods require a response to be sent"]
11297#[derive(Debug)]
11298pub struct VirtioWaylandStartWithWaylandServer_Responder {
11299 control_handle: std::mem::ManuallyDrop<VirtioWaylandControlHandle>,
11300 tx_id: u32,
11301}
11302
11303impl std::ops::Drop for VirtioWaylandStartWithWaylandServer_Responder {
11307 fn drop(&mut self) {
11308 self.control_handle.shutdown();
11309 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11311 }
11312}
11313
11314impl fidl::endpoints::Responder for VirtioWaylandStartWithWaylandServer_Responder {
11315 type ControlHandle = VirtioWaylandControlHandle;
11316
11317 fn control_handle(&self) -> &VirtioWaylandControlHandle {
11318 &self.control_handle
11319 }
11320
11321 fn drop_without_shutdown(mut self) {
11322 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11324 std::mem::forget(self);
11326 }
11327}
11328
11329impl VirtioWaylandStartWithWaylandServer_Responder {
11330 pub fn send(self) -> Result<(), fidl::Error> {
11334 let _result = self.send_raw();
11335 if _result.is_err() {
11336 self.control_handle.shutdown();
11337 }
11338 self.drop_without_shutdown();
11339 _result
11340 }
11341
11342 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11344 let _result = self.send_raw();
11345 self.drop_without_shutdown();
11346 _result
11347 }
11348
11349 fn send_raw(&self) -> Result<(), fidl::Error> {
11350 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11351 (),
11352 self.tx_id,
11353 0x3f2e38dfb60077e9,
11354 fidl::encoding::DynamicFlags::empty(),
11355 )
11356 }
11357}
11358
11359#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11360pub struct VirtioWaylandImporterMarker;
11361
11362impl fidl::endpoints::ProtocolMarker for VirtioWaylandImporterMarker {
11363 type Proxy = VirtioWaylandImporterProxy;
11364 type RequestStream = VirtioWaylandImporterRequestStream;
11365 #[cfg(target_os = "fuchsia")]
11366 type SynchronousProxy = VirtioWaylandImporterSynchronousProxy;
11367
11368 const DEBUG_NAME: &'static str = "(anonymous) VirtioWaylandImporter";
11369}
11370
11371pub trait VirtioWaylandImporterProxyInterface: Send + Sync {
11372 type ImportImageResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
11373 fn r#import_image(&self, image: VirtioImage) -> Self::ImportImageResponseFut;
11374 type ExportImageResponseFut: std::future::Future<Output = Result<(i32, Option<Box<VirtioImage>>), fidl::Error>>
11375 + Send;
11376 fn r#export_image(&self, vfd_id: u32) -> Self::ExportImageResponseFut;
11377}
11378#[derive(Debug)]
11379#[cfg(target_os = "fuchsia")]
11380pub struct VirtioWaylandImporterSynchronousProxy {
11381 client: fidl::client::sync::Client,
11382}
11383
11384#[cfg(target_os = "fuchsia")]
11385impl fidl::endpoints::SynchronousProxy for VirtioWaylandImporterSynchronousProxy {
11386 type Proxy = VirtioWaylandImporterProxy;
11387 type Protocol = VirtioWaylandImporterMarker;
11388
11389 fn from_channel(inner: fidl::Channel) -> Self {
11390 Self::new(inner)
11391 }
11392
11393 fn into_channel(self) -> fidl::Channel {
11394 self.client.into_channel()
11395 }
11396
11397 fn as_channel(&self) -> &fidl::Channel {
11398 self.client.as_channel()
11399 }
11400}
11401
11402#[cfg(target_os = "fuchsia")]
11403impl VirtioWaylandImporterSynchronousProxy {
11404 pub fn new(channel: fidl::Channel) -> Self {
11405 let protocol_name =
11406 <VirtioWaylandImporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11407 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
11408 }
11409
11410 pub fn into_channel(self) -> fidl::Channel {
11411 self.client.into_channel()
11412 }
11413
11414 pub fn wait_for_event(
11417 &self,
11418 deadline: zx::MonotonicInstant,
11419 ) -> Result<VirtioWaylandImporterEvent, fidl::Error> {
11420 VirtioWaylandImporterEvent::decode(self.client.wait_for_event(deadline)?)
11421 }
11422
11423 pub fn r#import_image(
11424 &self,
11425 mut image: VirtioImage,
11426 ___deadline: zx::MonotonicInstant,
11427 ) -> Result<u32, fidl::Error> {
11428 let _response = self.client.send_query::<
11429 VirtioWaylandImporterImportImageRequest,
11430 VirtioWaylandImporterImportImageResponse,
11431 >(
11432 (&mut image,),
11433 0x3f8f3f75c34de5c,
11434 fidl::encoding::DynamicFlags::empty(),
11435 ___deadline,
11436 )?;
11437 Ok(_response.vfd_id)
11438 }
11439
11440 pub fn r#export_image(
11441 &self,
11442 mut vfd_id: u32,
11443 ___deadline: zx::MonotonicInstant,
11444 ) -> Result<(i32, Option<Box<VirtioImage>>), fidl::Error> {
11445 let _response = self.client.send_query::<
11446 VirtioWaylandImporterExportImageRequest,
11447 VirtioWaylandImporterExportImageResponse,
11448 >(
11449 (vfd_id,),
11450 0x25a33daa7c0307c4,
11451 fidl::encoding::DynamicFlags::empty(),
11452 ___deadline,
11453 )?;
11454 Ok((_response.status, _response.image))
11455 }
11456}
11457
11458#[cfg(target_os = "fuchsia")]
11459impl From<VirtioWaylandImporterSynchronousProxy> for zx::Handle {
11460 fn from(value: VirtioWaylandImporterSynchronousProxy) -> Self {
11461 value.into_channel().into()
11462 }
11463}
11464
11465#[cfg(target_os = "fuchsia")]
11466impl From<fidl::Channel> for VirtioWaylandImporterSynchronousProxy {
11467 fn from(value: fidl::Channel) -> Self {
11468 Self::new(value)
11469 }
11470}
11471
11472#[derive(Debug, Clone)]
11473pub struct VirtioWaylandImporterProxy {
11474 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11475}
11476
11477impl fidl::endpoints::Proxy for VirtioWaylandImporterProxy {
11478 type Protocol = VirtioWaylandImporterMarker;
11479
11480 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11481 Self::new(inner)
11482 }
11483
11484 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11485 self.client.into_channel().map_err(|client| Self { client })
11486 }
11487
11488 fn as_channel(&self) -> &::fidl::AsyncChannel {
11489 self.client.as_channel()
11490 }
11491}
11492
11493impl VirtioWaylandImporterProxy {
11494 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11496 let protocol_name =
11497 <VirtioWaylandImporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11498 Self { client: fidl::client::Client::new(channel, protocol_name) }
11499 }
11500
11501 pub fn take_event_stream(&self) -> VirtioWaylandImporterEventStream {
11507 VirtioWaylandImporterEventStream { event_receiver: self.client.take_event_receiver() }
11508 }
11509
11510 pub fn r#import_image(
11511 &self,
11512 mut image: VirtioImage,
11513 ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
11514 VirtioWaylandImporterProxyInterface::r#import_image(self, image)
11515 }
11516
11517 pub fn r#export_image(
11518 &self,
11519 mut vfd_id: u32,
11520 ) -> fidl::client::QueryResponseFut<
11521 (i32, Option<Box<VirtioImage>>),
11522 fidl::encoding::DefaultFuchsiaResourceDialect,
11523 > {
11524 VirtioWaylandImporterProxyInterface::r#export_image(self, vfd_id)
11525 }
11526}
11527
11528impl VirtioWaylandImporterProxyInterface for VirtioWaylandImporterProxy {
11529 type ImportImageResponseFut =
11530 fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
11531 fn r#import_image(&self, mut image: VirtioImage) -> Self::ImportImageResponseFut {
11532 fn _decode(
11533 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11534 ) -> Result<u32, fidl::Error> {
11535 let _response = fidl::client::decode_transaction_body::<
11536 VirtioWaylandImporterImportImageResponse,
11537 fidl::encoding::DefaultFuchsiaResourceDialect,
11538 0x3f8f3f75c34de5c,
11539 >(_buf?)?;
11540 Ok(_response.vfd_id)
11541 }
11542 self.client.send_query_and_decode::<VirtioWaylandImporterImportImageRequest, u32>(
11543 (&mut image,),
11544 0x3f8f3f75c34de5c,
11545 fidl::encoding::DynamicFlags::empty(),
11546 _decode,
11547 )
11548 }
11549
11550 type ExportImageResponseFut = fidl::client::QueryResponseFut<
11551 (i32, Option<Box<VirtioImage>>),
11552 fidl::encoding::DefaultFuchsiaResourceDialect,
11553 >;
11554 fn r#export_image(&self, mut vfd_id: u32) -> Self::ExportImageResponseFut {
11555 fn _decode(
11556 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11557 ) -> Result<(i32, Option<Box<VirtioImage>>), fidl::Error> {
11558 let _response = fidl::client::decode_transaction_body::<
11559 VirtioWaylandImporterExportImageResponse,
11560 fidl::encoding::DefaultFuchsiaResourceDialect,
11561 0x25a33daa7c0307c4,
11562 >(_buf?)?;
11563 Ok((_response.status, _response.image))
11564 }
11565 self.client.send_query_and_decode::<
11566 VirtioWaylandImporterExportImageRequest,
11567 (i32, Option<Box<VirtioImage>>),
11568 >(
11569 (vfd_id,),
11570 0x25a33daa7c0307c4,
11571 fidl::encoding::DynamicFlags::empty(),
11572 _decode,
11573 )
11574 }
11575}
11576
11577pub struct VirtioWaylandImporterEventStream {
11578 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11579}
11580
11581impl std::marker::Unpin for VirtioWaylandImporterEventStream {}
11582
11583impl futures::stream::FusedStream for VirtioWaylandImporterEventStream {
11584 fn is_terminated(&self) -> bool {
11585 self.event_receiver.is_terminated()
11586 }
11587}
11588
11589impl futures::Stream for VirtioWaylandImporterEventStream {
11590 type Item = Result<VirtioWaylandImporterEvent, fidl::Error>;
11591
11592 fn poll_next(
11593 mut self: std::pin::Pin<&mut Self>,
11594 cx: &mut std::task::Context<'_>,
11595 ) -> std::task::Poll<Option<Self::Item>> {
11596 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11597 &mut self.event_receiver,
11598 cx
11599 )?) {
11600 Some(buf) => std::task::Poll::Ready(Some(VirtioWaylandImporterEvent::decode(buf))),
11601 None => std::task::Poll::Ready(None),
11602 }
11603 }
11604}
11605
11606#[derive(Debug)]
11607pub enum VirtioWaylandImporterEvent {}
11608
11609impl VirtioWaylandImporterEvent {
11610 fn decode(
11612 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11613 ) -> Result<VirtioWaylandImporterEvent, fidl::Error> {
11614 let (bytes, _handles) = buf.split_mut();
11615 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11616 debug_assert_eq!(tx_header.tx_id, 0);
11617 match tx_header.ordinal {
11618 _ => Err(fidl::Error::UnknownOrdinal {
11619 ordinal: tx_header.ordinal,
11620 protocol_name:
11621 <VirtioWaylandImporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11622 }),
11623 }
11624 }
11625}
11626
11627pub struct VirtioWaylandImporterRequestStream {
11629 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11630 is_terminated: bool,
11631}
11632
11633impl std::marker::Unpin for VirtioWaylandImporterRequestStream {}
11634
11635impl futures::stream::FusedStream for VirtioWaylandImporterRequestStream {
11636 fn is_terminated(&self) -> bool {
11637 self.is_terminated
11638 }
11639}
11640
11641impl fidl::endpoints::RequestStream for VirtioWaylandImporterRequestStream {
11642 type Protocol = VirtioWaylandImporterMarker;
11643 type ControlHandle = VirtioWaylandImporterControlHandle;
11644
11645 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11646 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11647 }
11648
11649 fn control_handle(&self) -> Self::ControlHandle {
11650 VirtioWaylandImporterControlHandle { inner: self.inner.clone() }
11651 }
11652
11653 fn into_inner(
11654 self,
11655 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11656 {
11657 (self.inner, self.is_terminated)
11658 }
11659
11660 fn from_inner(
11661 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11662 is_terminated: bool,
11663 ) -> Self {
11664 Self { inner, is_terminated }
11665 }
11666}
11667
11668impl futures::Stream for VirtioWaylandImporterRequestStream {
11669 type Item = Result<VirtioWaylandImporterRequest, fidl::Error>;
11670
11671 fn poll_next(
11672 mut self: std::pin::Pin<&mut Self>,
11673 cx: &mut std::task::Context<'_>,
11674 ) -> std::task::Poll<Option<Self::Item>> {
11675 let this = &mut *self;
11676 if this.inner.check_shutdown(cx) {
11677 this.is_terminated = true;
11678 return std::task::Poll::Ready(None);
11679 }
11680 if this.is_terminated {
11681 panic!("polled VirtioWaylandImporterRequestStream after completion");
11682 }
11683 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11684 |bytes, handles| {
11685 match this.inner.channel().read_etc(cx, bytes, handles) {
11686 std::task::Poll::Ready(Ok(())) => {}
11687 std::task::Poll::Pending => return std::task::Poll::Pending,
11688 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11689 this.is_terminated = true;
11690 return std::task::Poll::Ready(None);
11691 }
11692 std::task::Poll::Ready(Err(e)) => {
11693 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11694 e.into(),
11695 ))))
11696 }
11697 }
11698
11699 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11701
11702 std::task::Poll::Ready(Some(match header.ordinal {
11703 0x3f8f3f75c34de5c => {
11704 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11705 let mut req = fidl::new_empty!(VirtioWaylandImporterImportImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
11706 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandImporterImportImageRequest>(&header, _body_bytes, handles, &mut req)?;
11707 let control_handle = VirtioWaylandImporterControlHandle {
11708 inner: this.inner.clone(),
11709 };
11710 Ok(VirtioWaylandImporterRequest::ImportImage {image: req.image,
11711
11712 responder: VirtioWaylandImporterImportImageResponder {
11713 control_handle: std::mem::ManuallyDrop::new(control_handle),
11714 tx_id: header.tx_id,
11715 },
11716 })
11717 }
11718 0x25a33daa7c0307c4 => {
11719 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11720 let mut req = fidl::new_empty!(VirtioWaylandImporterExportImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
11721 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandImporterExportImageRequest>(&header, _body_bytes, handles, &mut req)?;
11722 let control_handle = VirtioWaylandImporterControlHandle {
11723 inner: this.inner.clone(),
11724 };
11725 Ok(VirtioWaylandImporterRequest::ExportImage {vfd_id: req.vfd_id,
11726
11727 responder: VirtioWaylandImporterExportImageResponder {
11728 control_handle: std::mem::ManuallyDrop::new(control_handle),
11729 tx_id: header.tx_id,
11730 },
11731 })
11732 }
11733 _ => Err(fidl::Error::UnknownOrdinal {
11734 ordinal: header.ordinal,
11735 protocol_name: <VirtioWaylandImporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11736 }),
11737 }))
11738 },
11739 )
11740 }
11741}
11742
11743#[derive(Debug)]
11744pub enum VirtioWaylandImporterRequest {
11745 ImportImage { image: VirtioImage, responder: VirtioWaylandImporterImportImageResponder },
11746 ExportImage { vfd_id: u32, responder: VirtioWaylandImporterExportImageResponder },
11747}
11748
11749impl VirtioWaylandImporterRequest {
11750 #[allow(irrefutable_let_patterns)]
11751 pub fn into_import_image(
11752 self,
11753 ) -> Option<(VirtioImage, VirtioWaylandImporterImportImageResponder)> {
11754 if let VirtioWaylandImporterRequest::ImportImage { image, responder } = self {
11755 Some((image, responder))
11756 } else {
11757 None
11758 }
11759 }
11760
11761 #[allow(irrefutable_let_patterns)]
11762 pub fn into_export_image(self) -> Option<(u32, VirtioWaylandImporterExportImageResponder)> {
11763 if let VirtioWaylandImporterRequest::ExportImage { vfd_id, responder } = self {
11764 Some((vfd_id, responder))
11765 } else {
11766 None
11767 }
11768 }
11769
11770 pub fn method_name(&self) -> &'static str {
11772 match *self {
11773 VirtioWaylandImporterRequest::ImportImage { .. } => "import_image",
11774 VirtioWaylandImporterRequest::ExportImage { .. } => "export_image",
11775 }
11776 }
11777}
11778
11779#[derive(Debug, Clone)]
11780pub struct VirtioWaylandImporterControlHandle {
11781 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11782}
11783
11784impl fidl::endpoints::ControlHandle for VirtioWaylandImporterControlHandle {
11785 fn shutdown(&self) {
11786 self.inner.shutdown()
11787 }
11788 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11789 self.inner.shutdown_with_epitaph(status)
11790 }
11791
11792 fn is_closed(&self) -> bool {
11793 self.inner.channel().is_closed()
11794 }
11795 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11796 self.inner.channel().on_closed()
11797 }
11798
11799 #[cfg(target_os = "fuchsia")]
11800 fn signal_peer(
11801 &self,
11802 clear_mask: zx::Signals,
11803 set_mask: zx::Signals,
11804 ) -> Result<(), zx_status::Status> {
11805 use fidl::Peered;
11806 self.inner.channel().signal_peer(clear_mask, set_mask)
11807 }
11808}
11809
11810impl VirtioWaylandImporterControlHandle {}
11811
11812#[must_use = "FIDL methods require a response to be sent"]
11813#[derive(Debug)]
11814pub struct VirtioWaylandImporterImportImageResponder {
11815 control_handle: std::mem::ManuallyDrop<VirtioWaylandImporterControlHandle>,
11816 tx_id: u32,
11817}
11818
11819impl std::ops::Drop for VirtioWaylandImporterImportImageResponder {
11823 fn drop(&mut self) {
11824 self.control_handle.shutdown();
11825 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11827 }
11828}
11829
11830impl fidl::endpoints::Responder for VirtioWaylandImporterImportImageResponder {
11831 type ControlHandle = VirtioWaylandImporterControlHandle;
11832
11833 fn control_handle(&self) -> &VirtioWaylandImporterControlHandle {
11834 &self.control_handle
11835 }
11836
11837 fn drop_without_shutdown(mut self) {
11838 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11840 std::mem::forget(self);
11842 }
11843}
11844
11845impl VirtioWaylandImporterImportImageResponder {
11846 pub fn send(self, mut vfd_id: u32) -> Result<(), fidl::Error> {
11850 let _result = self.send_raw(vfd_id);
11851 if _result.is_err() {
11852 self.control_handle.shutdown();
11853 }
11854 self.drop_without_shutdown();
11855 _result
11856 }
11857
11858 pub fn send_no_shutdown_on_err(self, mut vfd_id: u32) -> Result<(), fidl::Error> {
11860 let _result = self.send_raw(vfd_id);
11861 self.drop_without_shutdown();
11862 _result
11863 }
11864
11865 fn send_raw(&self, mut vfd_id: u32) -> Result<(), fidl::Error> {
11866 self.control_handle.inner.send::<VirtioWaylandImporterImportImageResponse>(
11867 (vfd_id,),
11868 self.tx_id,
11869 0x3f8f3f75c34de5c,
11870 fidl::encoding::DynamicFlags::empty(),
11871 )
11872 }
11873}
11874
11875#[must_use = "FIDL methods require a response to be sent"]
11876#[derive(Debug)]
11877pub struct VirtioWaylandImporterExportImageResponder {
11878 control_handle: std::mem::ManuallyDrop<VirtioWaylandImporterControlHandle>,
11879 tx_id: u32,
11880}
11881
11882impl std::ops::Drop for VirtioWaylandImporterExportImageResponder {
11886 fn drop(&mut self) {
11887 self.control_handle.shutdown();
11888 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11890 }
11891}
11892
11893impl fidl::endpoints::Responder for VirtioWaylandImporterExportImageResponder {
11894 type ControlHandle = VirtioWaylandImporterControlHandle;
11895
11896 fn control_handle(&self) -> &VirtioWaylandImporterControlHandle {
11897 &self.control_handle
11898 }
11899
11900 fn drop_without_shutdown(mut self) {
11901 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11903 std::mem::forget(self);
11905 }
11906}
11907
11908impl VirtioWaylandImporterExportImageResponder {
11909 pub fn send(self, mut status: i32, mut image: Option<VirtioImage>) -> Result<(), fidl::Error> {
11913 let _result = self.send_raw(status, image);
11914 if _result.is_err() {
11915 self.control_handle.shutdown();
11916 }
11917 self.drop_without_shutdown();
11918 _result
11919 }
11920
11921 pub fn send_no_shutdown_on_err(
11923 self,
11924 mut status: i32,
11925 mut image: Option<VirtioImage>,
11926 ) -> Result<(), fidl::Error> {
11927 let _result = self.send_raw(status, image);
11928 self.drop_without_shutdown();
11929 _result
11930 }
11931
11932 fn send_raw(&self, mut status: i32, mut image: Option<VirtioImage>) -> Result<(), fidl::Error> {
11933 self.control_handle.inner.send::<VirtioWaylandImporterExportImageResponse>(
11934 (status, image.as_mut()),
11935 self.tx_id,
11936 0x25a33daa7c0307c4,
11937 fidl::encoding::DynamicFlags::empty(),
11938 )
11939 }
11940}
11941
11942mod internal {
11943 use super::*;
11944
11945 impl fidl::encoding::ResourceTypeMarker for StartInfo {
11946 type Borrowed<'a> = &'a mut Self;
11947 fn take_or_borrow<'a>(
11948 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11949 ) -> Self::Borrowed<'a> {
11950 value
11951 }
11952 }
11953
11954 unsafe impl fidl::encoding::TypeMarker for StartInfo {
11955 type Owned = Self;
11956
11957 #[inline(always)]
11958 fn inline_align(_context: fidl::encoding::Context) -> usize {
11959 8
11960 }
11961
11962 #[inline(always)]
11963 fn inline_size(_context: fidl::encoding::Context) -> usize {
11964 32
11965 }
11966 }
11967
11968 unsafe impl fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
11969 for &mut StartInfo
11970 {
11971 #[inline]
11972 unsafe fn encode(
11973 self,
11974 encoder: &mut fidl::encoding::Encoder<
11975 '_,
11976 fidl::encoding::DefaultFuchsiaResourceDialect,
11977 >,
11978 offset: usize,
11979 _depth: fidl::encoding::Depth,
11980 ) -> fidl::Result<()> {
11981 encoder.debug_check_bounds::<StartInfo>(offset);
11982 fidl::encoding::Encode::<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11984 (
11985 <Trap as fidl::encoding::ValueTypeMarker>::borrow(&self.trap),
11986 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Guest, { fidl::ObjectType::GUEST.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
11987 <fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.event),
11988 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmo),
11989 ),
11990 encoder, offset, _depth
11991 )
11992 }
11993 }
11994 unsafe impl<
11995 T0: fidl::encoding::Encode<Trap, fidl::encoding::DefaultFuchsiaResourceDialect>,
11996 T1: fidl::encoding::Encode<
11997 fidl::encoding::Optional<
11998 fidl::encoding::HandleType<
11999 fidl::Guest,
12000 { fidl::ObjectType::GUEST.into_raw() },
12001 2147483648,
12002 >,
12003 >,
12004 fidl::encoding::DefaultFuchsiaResourceDialect,
12005 >,
12006 T2: fidl::encoding::Encode<
12007 fidl::encoding::HandleType<
12008 fidl::Event,
12009 { fidl::ObjectType::EVENT.into_raw() },
12010 2147483648,
12011 >,
12012 fidl::encoding::DefaultFuchsiaResourceDialect,
12013 >,
12014 T3: fidl::encoding::Encode<
12015 fidl::encoding::HandleType<
12016 fidl::Vmo,
12017 { fidl::ObjectType::VMO.into_raw() },
12018 2147483648,
12019 >,
12020 fidl::encoding::DefaultFuchsiaResourceDialect,
12021 >,
12022 > fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
12023 for (T0, T1, T2, T3)
12024 {
12025 #[inline]
12026 unsafe fn encode(
12027 self,
12028 encoder: &mut fidl::encoding::Encoder<
12029 '_,
12030 fidl::encoding::DefaultFuchsiaResourceDialect,
12031 >,
12032 offset: usize,
12033 depth: fidl::encoding::Depth,
12034 ) -> fidl::Result<()> {
12035 encoder.debug_check_bounds::<StartInfo>(offset);
12036 unsafe {
12039 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
12040 (ptr as *mut u64).write_unaligned(0);
12041 }
12042 self.0.encode(encoder, offset + 0, depth)?;
12044 self.1.encode(encoder, offset + 16, depth)?;
12045 self.2.encode(encoder, offset + 20, depth)?;
12046 self.3.encode(encoder, offset + 24, depth)?;
12047 Ok(())
12048 }
12049 }
12050
12051 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for StartInfo {
12052 #[inline(always)]
12053 fn new_empty() -> Self {
12054 Self {
12055 trap: fidl::new_empty!(Trap, fidl::encoding::DefaultFuchsiaResourceDialect),
12056 guest: fidl::new_empty!(
12057 fidl::encoding::Optional<
12058 fidl::encoding::HandleType<
12059 fidl::Guest,
12060 { fidl::ObjectType::GUEST.into_raw() },
12061 2147483648,
12062 >,
12063 >,
12064 fidl::encoding::DefaultFuchsiaResourceDialect
12065 ),
12066 event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12067 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12068 }
12069 }
12070
12071 #[inline]
12072 unsafe fn decode(
12073 &mut self,
12074 decoder: &mut fidl::encoding::Decoder<
12075 '_,
12076 fidl::encoding::DefaultFuchsiaResourceDialect,
12077 >,
12078 offset: usize,
12079 _depth: fidl::encoding::Depth,
12080 ) -> fidl::Result<()> {
12081 decoder.debug_check_bounds::<Self>(offset);
12082 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
12084 let padval = unsafe { (ptr as *const u64).read_unaligned() };
12085 let mask = 0xffffffff00000000u64;
12086 let maskedval = padval & mask;
12087 if maskedval != 0 {
12088 return Err(fidl::Error::NonZeroPadding {
12089 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
12090 });
12091 }
12092 fidl::decode!(
12093 Trap,
12094 fidl::encoding::DefaultFuchsiaResourceDialect,
12095 &mut self.trap,
12096 decoder,
12097 offset + 0,
12098 _depth
12099 )?;
12100 fidl::decode!(
12101 fidl::encoding::Optional<
12102 fidl::encoding::HandleType<
12103 fidl::Guest,
12104 { fidl::ObjectType::GUEST.into_raw() },
12105 2147483648,
12106 >,
12107 >,
12108 fidl::encoding::DefaultFuchsiaResourceDialect,
12109 &mut self.guest,
12110 decoder,
12111 offset + 16,
12112 _depth
12113 )?;
12114 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 20, _depth)?;
12115 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 24, _depth)?;
12116 Ok(())
12117 }
12118 }
12119
12120 impl fidl::encoding::ResourceTypeMarker for VirtioBalloonStartRequest {
12121 type Borrowed<'a> = &'a mut Self;
12122 fn take_or_borrow<'a>(
12123 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12124 ) -> Self::Borrowed<'a> {
12125 value
12126 }
12127 }
12128
12129 unsafe impl fidl::encoding::TypeMarker for VirtioBalloonStartRequest {
12130 type Owned = Self;
12131
12132 #[inline(always)]
12133 fn inline_align(_context: fidl::encoding::Context) -> usize {
12134 8
12135 }
12136
12137 #[inline(always)]
12138 fn inline_size(_context: fidl::encoding::Context) -> usize {
12139 32
12140 }
12141 }
12142
12143 unsafe impl
12144 fidl::encoding::Encode<
12145 VirtioBalloonStartRequest,
12146 fidl::encoding::DefaultFuchsiaResourceDialect,
12147 > for &mut VirtioBalloonStartRequest
12148 {
12149 #[inline]
12150 unsafe fn encode(
12151 self,
12152 encoder: &mut fidl::encoding::Encoder<
12153 '_,
12154 fidl::encoding::DefaultFuchsiaResourceDialect,
12155 >,
12156 offset: usize,
12157 _depth: fidl::encoding::Depth,
12158 ) -> fidl::Result<()> {
12159 encoder.debug_check_bounds::<VirtioBalloonStartRequest>(offset);
12160 fidl::encoding::Encode::<
12162 VirtioBalloonStartRequest,
12163 fidl::encoding::DefaultFuchsiaResourceDialect,
12164 >::encode(
12165 (<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12166 &mut self.start_info,
12167 ),),
12168 encoder,
12169 offset,
12170 _depth,
12171 )
12172 }
12173 }
12174 unsafe impl<T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>>
12175 fidl::encoding::Encode<
12176 VirtioBalloonStartRequest,
12177 fidl::encoding::DefaultFuchsiaResourceDialect,
12178 > for (T0,)
12179 {
12180 #[inline]
12181 unsafe fn encode(
12182 self,
12183 encoder: &mut fidl::encoding::Encoder<
12184 '_,
12185 fidl::encoding::DefaultFuchsiaResourceDialect,
12186 >,
12187 offset: usize,
12188 depth: fidl::encoding::Depth,
12189 ) -> fidl::Result<()> {
12190 encoder.debug_check_bounds::<VirtioBalloonStartRequest>(offset);
12191 self.0.encode(encoder, offset + 0, depth)?;
12195 Ok(())
12196 }
12197 }
12198
12199 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12200 for VirtioBalloonStartRequest
12201 {
12202 #[inline(always)]
12203 fn new_empty() -> Self {
12204 Self {
12205 start_info: fidl::new_empty!(
12206 StartInfo,
12207 fidl::encoding::DefaultFuchsiaResourceDialect
12208 ),
12209 }
12210 }
12211
12212 #[inline]
12213 unsafe fn decode(
12214 &mut self,
12215 decoder: &mut fidl::encoding::Decoder<
12216 '_,
12217 fidl::encoding::DefaultFuchsiaResourceDialect,
12218 >,
12219 offset: usize,
12220 _depth: fidl::encoding::Depth,
12221 ) -> fidl::Result<()> {
12222 decoder.debug_check_bounds::<Self>(offset);
12223 fidl::decode!(
12225 StartInfo,
12226 fidl::encoding::DefaultFuchsiaResourceDialect,
12227 &mut self.start_info,
12228 decoder,
12229 offset + 0,
12230 _depth
12231 )?;
12232 Ok(())
12233 }
12234 }
12235
12236 impl fidl::encoding::ResourceTypeMarker for VirtioBlockStartRequest {
12237 type Borrowed<'a> = &'a mut Self;
12238 fn take_or_borrow<'a>(
12239 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12240 ) -> Self::Borrowed<'a> {
12241 value
12242 }
12243 }
12244
12245 unsafe impl fidl::encoding::TypeMarker for VirtioBlockStartRequest {
12246 type Owned = Self;
12247
12248 #[inline(always)]
12249 fn inline_align(_context: fidl::encoding::Context) -> usize {
12250 8
12251 }
12252
12253 #[inline(always)]
12254 fn inline_size(_context: fidl::encoding::Context) -> usize {
12255 72
12256 }
12257 }
12258
12259 unsafe impl
12260 fidl::encoding::Encode<
12261 VirtioBlockStartRequest,
12262 fidl::encoding::DefaultFuchsiaResourceDialect,
12263 > for &mut VirtioBlockStartRequest
12264 {
12265 #[inline]
12266 unsafe fn encode(
12267 self,
12268 encoder: &mut fidl::encoding::Encoder<
12269 '_,
12270 fidl::encoding::DefaultFuchsiaResourceDialect,
12271 >,
12272 offset: usize,
12273 _depth: fidl::encoding::Depth,
12274 ) -> fidl::Result<()> {
12275 encoder.debug_check_bounds::<VirtioBlockStartRequest>(offset);
12276 fidl::encoding::Encode::<VirtioBlockStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12278 (
12279 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.start_info),
12280 <fidl_fuchsia_virtualization::BlockSpec as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.spec),
12281 ),
12282 encoder, offset, _depth
12283 )
12284 }
12285 }
12286 unsafe impl<
12287 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
12288 T1: fidl::encoding::Encode<
12289 fidl_fuchsia_virtualization::BlockSpec,
12290 fidl::encoding::DefaultFuchsiaResourceDialect,
12291 >,
12292 >
12293 fidl::encoding::Encode<
12294 VirtioBlockStartRequest,
12295 fidl::encoding::DefaultFuchsiaResourceDialect,
12296 > for (T0, T1)
12297 {
12298 #[inline]
12299 unsafe fn encode(
12300 self,
12301 encoder: &mut fidl::encoding::Encoder<
12302 '_,
12303 fidl::encoding::DefaultFuchsiaResourceDialect,
12304 >,
12305 offset: usize,
12306 depth: fidl::encoding::Depth,
12307 ) -> fidl::Result<()> {
12308 encoder.debug_check_bounds::<VirtioBlockStartRequest>(offset);
12309 self.0.encode(encoder, offset + 0, depth)?;
12313 self.1.encode(encoder, offset + 32, depth)?;
12314 Ok(())
12315 }
12316 }
12317
12318 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12319 for VirtioBlockStartRequest
12320 {
12321 #[inline(always)]
12322 fn new_empty() -> Self {
12323 Self {
12324 start_info: fidl::new_empty!(
12325 StartInfo,
12326 fidl::encoding::DefaultFuchsiaResourceDialect
12327 ),
12328 spec: fidl::new_empty!(
12329 fidl_fuchsia_virtualization::BlockSpec,
12330 fidl::encoding::DefaultFuchsiaResourceDialect
12331 ),
12332 }
12333 }
12334
12335 #[inline]
12336 unsafe fn decode(
12337 &mut self,
12338 decoder: &mut fidl::encoding::Decoder<
12339 '_,
12340 fidl::encoding::DefaultFuchsiaResourceDialect,
12341 >,
12342 offset: usize,
12343 _depth: fidl::encoding::Depth,
12344 ) -> fidl::Result<()> {
12345 decoder.debug_check_bounds::<Self>(offset);
12346 fidl::decode!(
12348 StartInfo,
12349 fidl::encoding::DefaultFuchsiaResourceDialect,
12350 &mut self.start_info,
12351 decoder,
12352 offset + 0,
12353 _depth
12354 )?;
12355 fidl::decode!(
12356 fidl_fuchsia_virtualization::BlockSpec,
12357 fidl::encoding::DefaultFuchsiaResourceDialect,
12358 &mut self.spec,
12359 decoder,
12360 offset + 32,
12361 _depth
12362 )?;
12363 Ok(())
12364 }
12365 }
12366
12367 impl fidl::encoding::ResourceTypeMarker for VirtioConsoleStartRequest {
12368 type Borrowed<'a> = &'a mut Self;
12369 fn take_or_borrow<'a>(
12370 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12371 ) -> Self::Borrowed<'a> {
12372 value
12373 }
12374 }
12375
12376 unsafe impl fidl::encoding::TypeMarker for VirtioConsoleStartRequest {
12377 type Owned = Self;
12378
12379 #[inline(always)]
12380 fn inline_align(_context: fidl::encoding::Context) -> usize {
12381 8
12382 }
12383
12384 #[inline(always)]
12385 fn inline_size(_context: fidl::encoding::Context) -> usize {
12386 40
12387 }
12388 }
12389
12390 unsafe impl
12391 fidl::encoding::Encode<
12392 VirtioConsoleStartRequest,
12393 fidl::encoding::DefaultFuchsiaResourceDialect,
12394 > for &mut VirtioConsoleStartRequest
12395 {
12396 #[inline]
12397 unsafe fn encode(
12398 self,
12399 encoder: &mut fidl::encoding::Encoder<
12400 '_,
12401 fidl::encoding::DefaultFuchsiaResourceDialect,
12402 >,
12403 offset: usize,
12404 _depth: fidl::encoding::Depth,
12405 ) -> fidl::Result<()> {
12406 encoder.debug_check_bounds::<VirtioConsoleStartRequest>(offset);
12407 fidl::encoding::Encode::<
12409 VirtioConsoleStartRequest,
12410 fidl::encoding::DefaultFuchsiaResourceDialect,
12411 >::encode(
12412 (
12413 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12414 &mut self.start_info,
12415 ),
12416 <fidl::encoding::HandleType<
12417 fidl::Socket,
12418 { fidl::ObjectType::SOCKET.into_raw() },
12419 2147483648,
12420 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12421 &mut self.socket
12422 ),
12423 ),
12424 encoder,
12425 offset,
12426 _depth,
12427 )
12428 }
12429 }
12430 unsafe impl<
12431 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
12432 T1: fidl::encoding::Encode<
12433 fidl::encoding::HandleType<
12434 fidl::Socket,
12435 { fidl::ObjectType::SOCKET.into_raw() },
12436 2147483648,
12437 >,
12438 fidl::encoding::DefaultFuchsiaResourceDialect,
12439 >,
12440 >
12441 fidl::encoding::Encode<
12442 VirtioConsoleStartRequest,
12443 fidl::encoding::DefaultFuchsiaResourceDialect,
12444 > for (T0, T1)
12445 {
12446 #[inline]
12447 unsafe fn encode(
12448 self,
12449 encoder: &mut fidl::encoding::Encoder<
12450 '_,
12451 fidl::encoding::DefaultFuchsiaResourceDialect,
12452 >,
12453 offset: usize,
12454 depth: fidl::encoding::Depth,
12455 ) -> fidl::Result<()> {
12456 encoder.debug_check_bounds::<VirtioConsoleStartRequest>(offset);
12457 unsafe {
12460 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
12461 (ptr as *mut u64).write_unaligned(0);
12462 }
12463 self.0.encode(encoder, offset + 0, depth)?;
12465 self.1.encode(encoder, offset + 32, depth)?;
12466 Ok(())
12467 }
12468 }
12469
12470 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12471 for VirtioConsoleStartRequest
12472 {
12473 #[inline(always)]
12474 fn new_empty() -> Self {
12475 Self {
12476 start_info: fidl::new_empty!(
12477 StartInfo,
12478 fidl::encoding::DefaultFuchsiaResourceDialect
12479 ),
12480 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12481 }
12482 }
12483
12484 #[inline]
12485 unsafe fn decode(
12486 &mut self,
12487 decoder: &mut fidl::encoding::Decoder<
12488 '_,
12489 fidl::encoding::DefaultFuchsiaResourceDialect,
12490 >,
12491 offset: usize,
12492 _depth: fidl::encoding::Depth,
12493 ) -> fidl::Result<()> {
12494 decoder.debug_check_bounds::<Self>(offset);
12495 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
12497 let padval = unsafe { (ptr as *const u64).read_unaligned() };
12498 let mask = 0xffffffff00000000u64;
12499 let maskedval = padval & mask;
12500 if maskedval != 0 {
12501 return Err(fidl::Error::NonZeroPadding {
12502 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
12503 });
12504 }
12505 fidl::decode!(
12506 StartInfo,
12507 fidl::encoding::DefaultFuchsiaResourceDialect,
12508 &mut self.start_info,
12509 decoder,
12510 offset + 0,
12511 _depth
12512 )?;
12513 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 32, _depth)?;
12514 Ok(())
12515 }
12516 }
12517
12518 impl fidl::encoding::ResourceTypeMarker for VirtioGpuStartRequest {
12519 type Borrowed<'a> = &'a mut Self;
12520 fn take_or_borrow<'a>(
12521 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12522 ) -> Self::Borrowed<'a> {
12523 value
12524 }
12525 }
12526
12527 unsafe impl fidl::encoding::TypeMarker for VirtioGpuStartRequest {
12528 type Owned = Self;
12529
12530 #[inline(always)]
12531 fn inline_align(_context: fidl::encoding::Context) -> usize {
12532 8
12533 }
12534
12535 #[inline(always)]
12536 fn inline_size(_context: fidl::encoding::Context) -> usize {
12537 40
12538 }
12539 }
12540
12541 unsafe impl
12542 fidl::encoding::Encode<VirtioGpuStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
12543 for &mut VirtioGpuStartRequest
12544 {
12545 #[inline]
12546 unsafe fn encode(
12547 self,
12548 encoder: &mut fidl::encoding::Encoder<
12549 '_,
12550 fidl::encoding::DefaultFuchsiaResourceDialect,
12551 >,
12552 offset: usize,
12553 _depth: fidl::encoding::Depth,
12554 ) -> fidl::Result<()> {
12555 encoder.debug_check_bounds::<VirtioGpuStartRequest>(offset);
12556 fidl::encoding::Encode::<
12558 VirtioGpuStartRequest,
12559 fidl::encoding::DefaultFuchsiaResourceDialect,
12560 >::encode(
12561 (
12562 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12563 &mut self.start_info,
12564 ),
12565 <fidl::encoding::Optional<
12566 fidl::encoding::Endpoint<
12567 fidl::endpoints::ClientEnd<
12568 fidl_fuchsia_ui_input3::KeyboardListenerMarker,
12569 >,
12570 >,
12571 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12572 &mut self.keyboard_listener,
12573 ),
12574 <fidl::encoding::Optional<
12575 fidl::encoding::Endpoint<
12576 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
12577 >,
12578 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12579 &mut self.mouse_source,
12580 ),
12581 ),
12582 encoder,
12583 offset,
12584 _depth,
12585 )
12586 }
12587 }
12588 unsafe impl<
12589 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
12590 T1: fidl::encoding::Encode<
12591 fidl::encoding::Optional<
12592 fidl::encoding::Endpoint<
12593 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
12594 >,
12595 >,
12596 fidl::encoding::DefaultFuchsiaResourceDialect,
12597 >,
12598 T2: fidl::encoding::Encode<
12599 fidl::encoding::Optional<
12600 fidl::encoding::Endpoint<
12601 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
12602 >,
12603 >,
12604 fidl::encoding::DefaultFuchsiaResourceDialect,
12605 >,
12606 >
12607 fidl::encoding::Encode<VirtioGpuStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
12608 for (T0, T1, T2)
12609 {
12610 #[inline]
12611 unsafe fn encode(
12612 self,
12613 encoder: &mut fidl::encoding::Encoder<
12614 '_,
12615 fidl::encoding::DefaultFuchsiaResourceDialect,
12616 >,
12617 offset: usize,
12618 depth: fidl::encoding::Depth,
12619 ) -> fidl::Result<()> {
12620 encoder.debug_check_bounds::<VirtioGpuStartRequest>(offset);
12621 self.0.encode(encoder, offset + 0, depth)?;
12625 self.1.encode(encoder, offset + 32, depth)?;
12626 self.2.encode(encoder, offset + 36, depth)?;
12627 Ok(())
12628 }
12629 }
12630
12631 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12632 for VirtioGpuStartRequest
12633 {
12634 #[inline(always)]
12635 fn new_empty() -> Self {
12636 Self {
12637 start_info: fidl::new_empty!(
12638 StartInfo,
12639 fidl::encoding::DefaultFuchsiaResourceDialect
12640 ),
12641 keyboard_listener: fidl::new_empty!(
12642 fidl::encoding::Optional<
12643 fidl::encoding::Endpoint<
12644 fidl::endpoints::ClientEnd<
12645 fidl_fuchsia_ui_input3::KeyboardListenerMarker,
12646 >,
12647 >,
12648 >,
12649 fidl::encoding::DefaultFuchsiaResourceDialect
12650 ),
12651 mouse_source: fidl::new_empty!(
12652 fidl::encoding::Optional<
12653 fidl::encoding::Endpoint<
12654 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
12655 >,
12656 >,
12657 fidl::encoding::DefaultFuchsiaResourceDialect
12658 ),
12659 }
12660 }
12661
12662 #[inline]
12663 unsafe fn decode(
12664 &mut self,
12665 decoder: &mut fidl::encoding::Decoder<
12666 '_,
12667 fidl::encoding::DefaultFuchsiaResourceDialect,
12668 >,
12669 offset: usize,
12670 _depth: fidl::encoding::Depth,
12671 ) -> fidl::Result<()> {
12672 decoder.debug_check_bounds::<Self>(offset);
12673 fidl::decode!(
12675 StartInfo,
12676 fidl::encoding::DefaultFuchsiaResourceDialect,
12677 &mut self.start_info,
12678 decoder,
12679 offset + 0,
12680 _depth
12681 )?;
12682 fidl::decode!(
12683 fidl::encoding::Optional<
12684 fidl::encoding::Endpoint<
12685 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
12686 >,
12687 >,
12688 fidl::encoding::DefaultFuchsiaResourceDialect,
12689 &mut self.keyboard_listener,
12690 decoder,
12691 offset + 32,
12692 _depth
12693 )?;
12694 fidl::decode!(
12695 fidl::encoding::Optional<
12696 fidl::encoding::Endpoint<
12697 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
12698 >,
12699 >,
12700 fidl::encoding::DefaultFuchsiaResourceDialect,
12701 &mut self.mouse_source,
12702 decoder,
12703 offset + 36,
12704 _depth
12705 )?;
12706 Ok(())
12707 }
12708 }
12709
12710 impl fidl::encoding::ResourceTypeMarker for VirtioImage {
12711 type Borrowed<'a> = &'a mut Self;
12712 fn take_or_borrow<'a>(
12713 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12714 ) -> Self::Borrowed<'a> {
12715 value
12716 }
12717 }
12718
12719 unsafe impl fidl::encoding::TypeMarker for VirtioImage {
12720 type Owned = Self;
12721
12722 #[inline(always)]
12723 fn inline_align(_context: fidl::encoding::Context) -> usize {
12724 8
12725 }
12726
12727 #[inline(always)]
12728 fn inline_size(_context: fidl::encoding::Context) -> usize {
12729 24
12730 }
12731 }
12732
12733 unsafe impl fidl::encoding::Encode<VirtioImage, fidl::encoding::DefaultFuchsiaResourceDialect>
12734 for &mut VirtioImage
12735 {
12736 #[inline]
12737 unsafe fn encode(
12738 self,
12739 encoder: &mut fidl::encoding::Encoder<
12740 '_,
12741 fidl::encoding::DefaultFuchsiaResourceDialect,
12742 >,
12743 offset: usize,
12744 _depth: fidl::encoding::Depth,
12745 ) -> fidl::Result<()> {
12746 encoder.debug_check_bounds::<VirtioImage>(offset);
12747 fidl::encoding::Encode::<VirtioImage, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12749 (
12750 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmo),
12751 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
12752 <fidl::encoding::Vector<u8, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
12753 ),
12754 encoder, offset, _depth
12755 )
12756 }
12757 }
12758 unsafe impl<
12759 T0: fidl::encoding::Encode<
12760 fidl::encoding::HandleType<
12761 fidl::Vmo,
12762 { fidl::ObjectType::VMO.into_raw() },
12763 2147483648,
12764 >,
12765 fidl::encoding::DefaultFuchsiaResourceDialect,
12766 >,
12767 T1: fidl::encoding::Encode<
12768 fidl::encoding::Optional<
12769 fidl::encoding::HandleType<
12770 fidl::EventPair,
12771 { fidl::ObjectType::EVENTPAIR.into_raw() },
12772 2147483648,
12773 >,
12774 >,
12775 fidl::encoding::DefaultFuchsiaResourceDialect,
12776 >,
12777 T2: fidl::encoding::Encode<
12778 fidl::encoding::Vector<u8, 128>,
12779 fidl::encoding::DefaultFuchsiaResourceDialect,
12780 >,
12781 > fidl::encoding::Encode<VirtioImage, fidl::encoding::DefaultFuchsiaResourceDialect>
12782 for (T0, T1, T2)
12783 {
12784 #[inline]
12785 unsafe fn encode(
12786 self,
12787 encoder: &mut fidl::encoding::Encoder<
12788 '_,
12789 fidl::encoding::DefaultFuchsiaResourceDialect,
12790 >,
12791 offset: usize,
12792 depth: fidl::encoding::Depth,
12793 ) -> fidl::Result<()> {
12794 encoder.debug_check_bounds::<VirtioImage>(offset);
12795 self.0.encode(encoder, offset + 0, depth)?;
12799 self.1.encode(encoder, offset + 4, depth)?;
12800 self.2.encode(encoder, offset + 8, depth)?;
12801 Ok(())
12802 }
12803 }
12804
12805 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioImage {
12806 #[inline(always)]
12807 fn new_empty() -> Self {
12808 Self {
12809 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12810 token: fidl::new_empty!(
12811 fidl::encoding::Optional<
12812 fidl::encoding::HandleType<
12813 fidl::EventPair,
12814 { fidl::ObjectType::EVENTPAIR.into_raw() },
12815 2147483648,
12816 >,
12817 >,
12818 fidl::encoding::DefaultFuchsiaResourceDialect
12819 ),
12820 info: fidl::new_empty!(fidl::encoding::Vector<u8, 128>, fidl::encoding::DefaultFuchsiaResourceDialect),
12821 }
12822 }
12823
12824 #[inline]
12825 unsafe fn decode(
12826 &mut self,
12827 decoder: &mut fidl::encoding::Decoder<
12828 '_,
12829 fidl::encoding::DefaultFuchsiaResourceDialect,
12830 >,
12831 offset: usize,
12832 _depth: fidl::encoding::Depth,
12833 ) -> fidl::Result<()> {
12834 decoder.debug_check_bounds::<Self>(offset);
12835 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
12837 fidl::decode!(
12838 fidl::encoding::Optional<
12839 fidl::encoding::HandleType<
12840 fidl::EventPair,
12841 { fidl::ObjectType::EVENTPAIR.into_raw() },
12842 2147483648,
12843 >,
12844 >,
12845 fidl::encoding::DefaultFuchsiaResourceDialect,
12846 &mut self.token,
12847 decoder,
12848 offset + 4,
12849 _depth
12850 )?;
12851 fidl::decode!(fidl::encoding::Vector<u8, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.info, decoder, offset + 8, _depth)?;
12852 Ok(())
12853 }
12854 }
12855
12856 impl fidl::encoding::ResourceTypeMarker for VirtioInputStartRequest {
12857 type Borrowed<'a> = &'a mut Self;
12858 fn take_or_borrow<'a>(
12859 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12860 ) -> Self::Borrowed<'a> {
12861 value
12862 }
12863 }
12864
12865 unsafe impl fidl::encoding::TypeMarker for VirtioInputStartRequest {
12866 type Owned = Self;
12867
12868 #[inline(always)]
12869 fn inline_align(_context: fidl::encoding::Context) -> usize {
12870 8
12871 }
12872
12873 #[inline(always)]
12874 fn inline_size(_context: fidl::encoding::Context) -> usize {
12875 48
12876 }
12877 }
12878
12879 unsafe impl
12880 fidl::encoding::Encode<
12881 VirtioInputStartRequest,
12882 fidl::encoding::DefaultFuchsiaResourceDialect,
12883 > for &mut VirtioInputStartRequest
12884 {
12885 #[inline]
12886 unsafe fn encode(
12887 self,
12888 encoder: &mut fidl::encoding::Encoder<
12889 '_,
12890 fidl::encoding::DefaultFuchsiaResourceDialect,
12891 >,
12892 offset: usize,
12893 _depth: fidl::encoding::Depth,
12894 ) -> fidl::Result<()> {
12895 encoder.debug_check_bounds::<VirtioInputStartRequest>(offset);
12896 fidl::encoding::Encode::<
12898 VirtioInputStartRequest,
12899 fidl::encoding::DefaultFuchsiaResourceDialect,
12900 >::encode(
12901 (
12902 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12903 &mut self.start_info,
12904 ),
12905 <InputType as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12906 &mut self.input_type,
12907 ),
12908 ),
12909 encoder,
12910 offset,
12911 _depth,
12912 )
12913 }
12914 }
12915 unsafe impl<
12916 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
12917 T1: fidl::encoding::Encode<InputType, fidl::encoding::DefaultFuchsiaResourceDialect>,
12918 >
12919 fidl::encoding::Encode<
12920 VirtioInputStartRequest,
12921 fidl::encoding::DefaultFuchsiaResourceDialect,
12922 > for (T0, T1)
12923 {
12924 #[inline]
12925 unsafe fn encode(
12926 self,
12927 encoder: &mut fidl::encoding::Encoder<
12928 '_,
12929 fidl::encoding::DefaultFuchsiaResourceDialect,
12930 >,
12931 offset: usize,
12932 depth: fidl::encoding::Depth,
12933 ) -> fidl::Result<()> {
12934 encoder.debug_check_bounds::<VirtioInputStartRequest>(offset);
12935 self.0.encode(encoder, offset + 0, depth)?;
12939 self.1.encode(encoder, offset + 32, depth)?;
12940 Ok(())
12941 }
12942 }
12943
12944 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12945 for VirtioInputStartRequest
12946 {
12947 #[inline(always)]
12948 fn new_empty() -> Self {
12949 Self {
12950 start_info: fidl::new_empty!(
12951 StartInfo,
12952 fidl::encoding::DefaultFuchsiaResourceDialect
12953 ),
12954 input_type: fidl::new_empty!(
12955 InputType,
12956 fidl::encoding::DefaultFuchsiaResourceDialect
12957 ),
12958 }
12959 }
12960
12961 #[inline]
12962 unsafe fn decode(
12963 &mut self,
12964 decoder: &mut fidl::encoding::Decoder<
12965 '_,
12966 fidl::encoding::DefaultFuchsiaResourceDialect,
12967 >,
12968 offset: usize,
12969 _depth: fidl::encoding::Depth,
12970 ) -> fidl::Result<()> {
12971 decoder.debug_check_bounds::<Self>(offset);
12972 fidl::decode!(
12974 StartInfo,
12975 fidl::encoding::DefaultFuchsiaResourceDialect,
12976 &mut self.start_info,
12977 decoder,
12978 offset + 0,
12979 _depth
12980 )?;
12981 fidl::decode!(
12982 InputType,
12983 fidl::encoding::DefaultFuchsiaResourceDialect,
12984 &mut self.input_type,
12985 decoder,
12986 offset + 32,
12987 _depth
12988 )?;
12989 Ok(())
12990 }
12991 }
12992
12993 impl fidl::encoding::ResourceTypeMarker for VirtioMagmaStartRequest {
12994 type Borrowed<'a> = &'a mut Self;
12995 fn take_or_borrow<'a>(
12996 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12997 ) -> Self::Borrowed<'a> {
12998 value
12999 }
13000 }
13001
13002 unsafe impl fidl::encoding::TypeMarker for VirtioMagmaStartRequest {
13003 type Owned = Self;
13004
13005 #[inline(always)]
13006 fn inline_align(_context: fidl::encoding::Context) -> usize {
13007 8
13008 }
13009
13010 #[inline(always)]
13011 fn inline_size(_context: fidl::encoding::Context) -> usize {
13012 40
13013 }
13014 }
13015
13016 unsafe impl
13017 fidl::encoding::Encode<
13018 VirtioMagmaStartRequest,
13019 fidl::encoding::DefaultFuchsiaResourceDialect,
13020 > for &mut VirtioMagmaStartRequest
13021 {
13022 #[inline]
13023 unsafe fn encode(
13024 self,
13025 encoder: &mut fidl::encoding::Encoder<
13026 '_,
13027 fidl::encoding::DefaultFuchsiaResourceDialect,
13028 >,
13029 offset: usize,
13030 _depth: fidl::encoding::Depth,
13031 ) -> fidl::Result<()> {
13032 encoder.debug_check_bounds::<VirtioMagmaStartRequest>(offset);
13033 fidl::encoding::Encode::<
13035 VirtioMagmaStartRequest,
13036 fidl::encoding::DefaultFuchsiaResourceDialect,
13037 >::encode(
13038 (
13039 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13040 &mut self.start_info,
13041 ),
13042 <fidl::encoding::HandleType<
13043 fidl::Vmar,
13044 { fidl::ObjectType::VMAR.into_raw() },
13045 2147483648,
13046 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13047 &mut self.vmar
13048 ),
13049 <fidl::encoding::Optional<
13050 fidl::encoding::Endpoint<
13051 fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>,
13052 >,
13053 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13054 &mut self.wayland_importer,
13055 ),
13056 ),
13057 encoder,
13058 offset,
13059 _depth,
13060 )
13061 }
13062 }
13063 unsafe impl<
13064 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
13065 T1: fidl::encoding::Encode<
13066 fidl::encoding::HandleType<
13067 fidl::Vmar,
13068 { fidl::ObjectType::VMAR.into_raw() },
13069 2147483648,
13070 >,
13071 fidl::encoding::DefaultFuchsiaResourceDialect,
13072 >,
13073 T2: fidl::encoding::Encode<
13074 fidl::encoding::Optional<
13075 fidl::encoding::Endpoint<
13076 fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>,
13077 >,
13078 >,
13079 fidl::encoding::DefaultFuchsiaResourceDialect,
13080 >,
13081 >
13082 fidl::encoding::Encode<
13083 VirtioMagmaStartRequest,
13084 fidl::encoding::DefaultFuchsiaResourceDialect,
13085 > for (T0, T1, T2)
13086 {
13087 #[inline]
13088 unsafe fn encode(
13089 self,
13090 encoder: &mut fidl::encoding::Encoder<
13091 '_,
13092 fidl::encoding::DefaultFuchsiaResourceDialect,
13093 >,
13094 offset: usize,
13095 depth: fidl::encoding::Depth,
13096 ) -> fidl::Result<()> {
13097 encoder.debug_check_bounds::<VirtioMagmaStartRequest>(offset);
13098 self.0.encode(encoder, offset + 0, depth)?;
13102 self.1.encode(encoder, offset + 32, depth)?;
13103 self.2.encode(encoder, offset + 36, depth)?;
13104 Ok(())
13105 }
13106 }
13107
13108 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13109 for VirtioMagmaStartRequest
13110 {
13111 #[inline(always)]
13112 fn new_empty() -> Self {
13113 Self {
13114 start_info: fidl::new_empty!(
13115 StartInfo,
13116 fidl::encoding::DefaultFuchsiaResourceDialect
13117 ),
13118 vmar: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13119 wayland_importer: fidl::new_empty!(
13120 fidl::encoding::Optional<
13121 fidl::encoding::Endpoint<
13122 fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>,
13123 >,
13124 >,
13125 fidl::encoding::DefaultFuchsiaResourceDialect
13126 ),
13127 }
13128 }
13129
13130 #[inline]
13131 unsafe fn decode(
13132 &mut self,
13133 decoder: &mut fidl::encoding::Decoder<
13134 '_,
13135 fidl::encoding::DefaultFuchsiaResourceDialect,
13136 >,
13137 offset: usize,
13138 _depth: fidl::encoding::Depth,
13139 ) -> fidl::Result<()> {
13140 decoder.debug_check_bounds::<Self>(offset);
13141 fidl::decode!(
13143 StartInfo,
13144 fidl::encoding::DefaultFuchsiaResourceDialect,
13145 &mut self.start_info,
13146 decoder,
13147 offset + 0,
13148 _depth
13149 )?;
13150 fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar, decoder, offset + 32, _depth)?;
13151 fidl::decode!(
13152 fidl::encoding::Optional<
13153 fidl::encoding::Endpoint<
13154 fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>,
13155 >,
13156 >,
13157 fidl::encoding::DefaultFuchsiaResourceDialect,
13158 &mut self.wayland_importer,
13159 decoder,
13160 offset + 36,
13161 _depth
13162 )?;
13163 Ok(())
13164 }
13165 }
13166
13167 impl fidl::encoding::ResourceTypeMarker for VirtioMemStartRequest {
13168 type Borrowed<'a> = &'a mut Self;
13169 fn take_or_borrow<'a>(
13170 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13171 ) -> Self::Borrowed<'a> {
13172 value
13173 }
13174 }
13175
13176 unsafe impl fidl::encoding::TypeMarker for VirtioMemStartRequest {
13177 type Owned = Self;
13178
13179 #[inline(always)]
13180 fn inline_align(_context: fidl::encoding::Context) -> usize {
13181 8
13182 }
13183
13184 #[inline(always)]
13185 fn inline_size(_context: fidl::encoding::Context) -> usize {
13186 56
13187 }
13188 }
13189
13190 unsafe impl
13191 fidl::encoding::Encode<VirtioMemStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13192 for &mut VirtioMemStartRequest
13193 {
13194 #[inline]
13195 unsafe fn encode(
13196 self,
13197 encoder: &mut fidl::encoding::Encoder<
13198 '_,
13199 fidl::encoding::DefaultFuchsiaResourceDialect,
13200 >,
13201 offset: usize,
13202 _depth: fidl::encoding::Depth,
13203 ) -> fidl::Result<()> {
13204 encoder.debug_check_bounds::<VirtioMemStartRequest>(offset);
13205 fidl::encoding::Encode::<
13207 VirtioMemStartRequest,
13208 fidl::encoding::DefaultFuchsiaResourceDialect,
13209 >::encode(
13210 (
13211 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13212 &mut self.start_info,
13213 ),
13214 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.region_addr),
13215 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.plugged_block_size),
13216 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.region_size),
13217 ),
13218 encoder,
13219 offset,
13220 _depth,
13221 )
13222 }
13223 }
13224 unsafe impl<
13225 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
13226 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
13227 T2: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
13228 T3: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
13229 >
13230 fidl::encoding::Encode<VirtioMemStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13231 for (T0, T1, T2, T3)
13232 {
13233 #[inline]
13234 unsafe fn encode(
13235 self,
13236 encoder: &mut fidl::encoding::Encoder<
13237 '_,
13238 fidl::encoding::DefaultFuchsiaResourceDialect,
13239 >,
13240 offset: usize,
13241 depth: fidl::encoding::Depth,
13242 ) -> fidl::Result<()> {
13243 encoder.debug_check_bounds::<VirtioMemStartRequest>(offset);
13244 self.0.encode(encoder, offset + 0, depth)?;
13248 self.1.encode(encoder, offset + 32, depth)?;
13249 self.2.encode(encoder, offset + 40, depth)?;
13250 self.3.encode(encoder, offset + 48, depth)?;
13251 Ok(())
13252 }
13253 }
13254
13255 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13256 for VirtioMemStartRequest
13257 {
13258 #[inline(always)]
13259 fn new_empty() -> Self {
13260 Self {
13261 start_info: fidl::new_empty!(
13262 StartInfo,
13263 fidl::encoding::DefaultFuchsiaResourceDialect
13264 ),
13265 region_addr: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
13266 plugged_block_size: fidl::new_empty!(
13267 u64,
13268 fidl::encoding::DefaultFuchsiaResourceDialect
13269 ),
13270 region_size: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
13271 }
13272 }
13273
13274 #[inline]
13275 unsafe fn decode(
13276 &mut self,
13277 decoder: &mut fidl::encoding::Decoder<
13278 '_,
13279 fidl::encoding::DefaultFuchsiaResourceDialect,
13280 >,
13281 offset: usize,
13282 _depth: fidl::encoding::Depth,
13283 ) -> fidl::Result<()> {
13284 decoder.debug_check_bounds::<Self>(offset);
13285 fidl::decode!(
13287 StartInfo,
13288 fidl::encoding::DefaultFuchsiaResourceDialect,
13289 &mut self.start_info,
13290 decoder,
13291 offset + 0,
13292 _depth
13293 )?;
13294 fidl::decode!(
13295 u64,
13296 fidl::encoding::DefaultFuchsiaResourceDialect,
13297 &mut self.region_addr,
13298 decoder,
13299 offset + 32,
13300 _depth
13301 )?;
13302 fidl::decode!(
13303 u64,
13304 fidl::encoding::DefaultFuchsiaResourceDialect,
13305 &mut self.plugged_block_size,
13306 decoder,
13307 offset + 40,
13308 _depth
13309 )?;
13310 fidl::decode!(
13311 u64,
13312 fidl::encoding::DefaultFuchsiaResourceDialect,
13313 &mut self.region_size,
13314 decoder,
13315 offset + 48,
13316 _depth
13317 )?;
13318 Ok(())
13319 }
13320 }
13321
13322 impl fidl::encoding::ResourceTypeMarker for VirtioNetStartRequest {
13323 type Borrowed<'a> = &'a mut Self;
13324 fn take_or_borrow<'a>(
13325 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13326 ) -> Self::Borrowed<'a> {
13327 value
13328 }
13329 }
13330
13331 unsafe impl fidl::encoding::TypeMarker for VirtioNetStartRequest {
13332 type Owned = Self;
13333
13334 #[inline(always)]
13335 fn inline_align(_context: fidl::encoding::Context) -> usize {
13336 8
13337 }
13338
13339 #[inline(always)]
13340 fn inline_size(_context: fidl::encoding::Context) -> usize {
13341 40
13342 }
13343 }
13344
13345 unsafe impl
13346 fidl::encoding::Encode<VirtioNetStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13347 for &mut VirtioNetStartRequest
13348 {
13349 #[inline]
13350 unsafe fn encode(
13351 self,
13352 encoder: &mut fidl::encoding::Encoder<
13353 '_,
13354 fidl::encoding::DefaultFuchsiaResourceDialect,
13355 >,
13356 offset: usize,
13357 _depth: fidl::encoding::Depth,
13358 ) -> fidl::Result<()> {
13359 encoder.debug_check_bounds::<VirtioNetStartRequest>(offset);
13360 fidl::encoding::Encode::<
13362 VirtioNetStartRequest,
13363 fidl::encoding::DefaultFuchsiaResourceDialect,
13364 >::encode(
13365 (
13366 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13367 &mut self.start_info,
13368 ),
13369 <fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
13370 &self.mac_address,
13371 ),
13372 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_bridge),
13373 ),
13374 encoder,
13375 offset,
13376 _depth,
13377 )
13378 }
13379 }
13380 unsafe impl<
13381 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
13382 T1: fidl::encoding::Encode<
13383 fidl_fuchsia_net::MacAddress,
13384 fidl::encoding::DefaultFuchsiaResourceDialect,
13385 >,
13386 T2: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
13387 >
13388 fidl::encoding::Encode<VirtioNetStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13389 for (T0, T1, T2)
13390 {
13391 #[inline]
13392 unsafe fn encode(
13393 self,
13394 encoder: &mut fidl::encoding::Encoder<
13395 '_,
13396 fidl::encoding::DefaultFuchsiaResourceDialect,
13397 >,
13398 offset: usize,
13399 depth: fidl::encoding::Depth,
13400 ) -> fidl::Result<()> {
13401 encoder.debug_check_bounds::<VirtioNetStartRequest>(offset);
13402 unsafe {
13405 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
13406 (ptr as *mut u64).write_unaligned(0);
13407 }
13408 self.0.encode(encoder, offset + 0, depth)?;
13410 self.1.encode(encoder, offset + 32, depth)?;
13411 self.2.encode(encoder, offset + 38, depth)?;
13412 Ok(())
13413 }
13414 }
13415
13416 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13417 for VirtioNetStartRequest
13418 {
13419 #[inline(always)]
13420 fn new_empty() -> Self {
13421 Self {
13422 start_info: fidl::new_empty!(
13423 StartInfo,
13424 fidl::encoding::DefaultFuchsiaResourceDialect
13425 ),
13426 mac_address: fidl::new_empty!(
13427 fidl_fuchsia_net::MacAddress,
13428 fidl::encoding::DefaultFuchsiaResourceDialect
13429 ),
13430 enable_bridge: fidl::new_empty!(
13431 bool,
13432 fidl::encoding::DefaultFuchsiaResourceDialect
13433 ),
13434 }
13435 }
13436
13437 #[inline]
13438 unsafe fn decode(
13439 &mut self,
13440 decoder: &mut fidl::encoding::Decoder<
13441 '_,
13442 fidl::encoding::DefaultFuchsiaResourceDialect,
13443 >,
13444 offset: usize,
13445 _depth: fidl::encoding::Depth,
13446 ) -> fidl::Result<()> {
13447 decoder.debug_check_bounds::<Self>(offset);
13448 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
13450 let padval = unsafe { (ptr as *const u64).read_unaligned() };
13451 let mask = 0xff00000000000000u64;
13452 let maskedval = padval & mask;
13453 if maskedval != 0 {
13454 return Err(fidl::Error::NonZeroPadding {
13455 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13456 });
13457 }
13458 fidl::decode!(
13459 StartInfo,
13460 fidl::encoding::DefaultFuchsiaResourceDialect,
13461 &mut self.start_info,
13462 decoder,
13463 offset + 0,
13464 _depth
13465 )?;
13466 fidl::decode!(
13467 fidl_fuchsia_net::MacAddress,
13468 fidl::encoding::DefaultFuchsiaResourceDialect,
13469 &mut self.mac_address,
13470 decoder,
13471 offset + 32,
13472 _depth
13473 )?;
13474 fidl::decode!(
13475 bool,
13476 fidl::encoding::DefaultFuchsiaResourceDialect,
13477 &mut self.enable_bridge,
13478 decoder,
13479 offset + 38,
13480 _depth
13481 )?;
13482 Ok(())
13483 }
13484 }
13485
13486 impl fidl::encoding::ResourceTypeMarker for VirtioRngStartRequest {
13487 type Borrowed<'a> = &'a mut Self;
13488 fn take_or_borrow<'a>(
13489 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13490 ) -> Self::Borrowed<'a> {
13491 value
13492 }
13493 }
13494
13495 unsafe impl fidl::encoding::TypeMarker for VirtioRngStartRequest {
13496 type Owned = Self;
13497
13498 #[inline(always)]
13499 fn inline_align(_context: fidl::encoding::Context) -> usize {
13500 8
13501 }
13502
13503 #[inline(always)]
13504 fn inline_size(_context: fidl::encoding::Context) -> usize {
13505 32
13506 }
13507 }
13508
13509 unsafe impl
13510 fidl::encoding::Encode<VirtioRngStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13511 for &mut VirtioRngStartRequest
13512 {
13513 #[inline]
13514 unsafe fn encode(
13515 self,
13516 encoder: &mut fidl::encoding::Encoder<
13517 '_,
13518 fidl::encoding::DefaultFuchsiaResourceDialect,
13519 >,
13520 offset: usize,
13521 _depth: fidl::encoding::Depth,
13522 ) -> fidl::Result<()> {
13523 encoder.debug_check_bounds::<VirtioRngStartRequest>(offset);
13524 fidl::encoding::Encode::<
13526 VirtioRngStartRequest,
13527 fidl::encoding::DefaultFuchsiaResourceDialect,
13528 >::encode(
13529 (<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13530 &mut self.start_info,
13531 ),),
13532 encoder,
13533 offset,
13534 _depth,
13535 )
13536 }
13537 }
13538 unsafe impl<T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>>
13539 fidl::encoding::Encode<VirtioRngStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13540 for (T0,)
13541 {
13542 #[inline]
13543 unsafe fn encode(
13544 self,
13545 encoder: &mut fidl::encoding::Encoder<
13546 '_,
13547 fidl::encoding::DefaultFuchsiaResourceDialect,
13548 >,
13549 offset: usize,
13550 depth: fidl::encoding::Depth,
13551 ) -> fidl::Result<()> {
13552 encoder.debug_check_bounds::<VirtioRngStartRequest>(offset);
13553 self.0.encode(encoder, offset + 0, depth)?;
13557 Ok(())
13558 }
13559 }
13560
13561 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13562 for VirtioRngStartRequest
13563 {
13564 #[inline(always)]
13565 fn new_empty() -> Self {
13566 Self {
13567 start_info: fidl::new_empty!(
13568 StartInfo,
13569 fidl::encoding::DefaultFuchsiaResourceDialect
13570 ),
13571 }
13572 }
13573
13574 #[inline]
13575 unsafe fn decode(
13576 &mut self,
13577 decoder: &mut fidl::encoding::Decoder<
13578 '_,
13579 fidl::encoding::DefaultFuchsiaResourceDialect,
13580 >,
13581 offset: usize,
13582 _depth: fidl::encoding::Depth,
13583 ) -> fidl::Result<()> {
13584 decoder.debug_check_bounds::<Self>(offset);
13585 fidl::decode!(
13587 StartInfo,
13588 fidl::encoding::DefaultFuchsiaResourceDialect,
13589 &mut self.start_info,
13590 decoder,
13591 offset + 0,
13592 _depth
13593 )?;
13594 Ok(())
13595 }
13596 }
13597
13598 impl fidl::encoding::ResourceTypeMarker for VirtioSoundStartRequest {
13599 type Borrowed<'a> = &'a mut Self;
13600 fn take_or_borrow<'a>(
13601 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13602 ) -> Self::Borrowed<'a> {
13603 value
13604 }
13605 }
13606
13607 unsafe impl fidl::encoding::TypeMarker for VirtioSoundStartRequest {
13608 type Owned = Self;
13609
13610 #[inline(always)]
13611 fn inline_align(_context: fidl::encoding::Context) -> usize {
13612 8
13613 }
13614
13615 #[inline(always)]
13616 fn inline_size(_context: fidl::encoding::Context) -> usize {
13617 40
13618 }
13619 }
13620
13621 unsafe impl
13622 fidl::encoding::Encode<
13623 VirtioSoundStartRequest,
13624 fidl::encoding::DefaultFuchsiaResourceDialect,
13625 > for &mut VirtioSoundStartRequest
13626 {
13627 #[inline]
13628 unsafe fn encode(
13629 self,
13630 encoder: &mut fidl::encoding::Encoder<
13631 '_,
13632 fidl::encoding::DefaultFuchsiaResourceDialect,
13633 >,
13634 offset: usize,
13635 _depth: fidl::encoding::Depth,
13636 ) -> fidl::Result<()> {
13637 encoder.debug_check_bounds::<VirtioSoundStartRequest>(offset);
13638 fidl::encoding::Encode::<
13640 VirtioSoundStartRequest,
13641 fidl::encoding::DefaultFuchsiaResourceDialect,
13642 >::encode(
13643 (
13644 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13645 &mut self.start_info,
13646 ),
13647 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_input),
13648 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_verbose_logging),
13649 ),
13650 encoder,
13651 offset,
13652 _depth,
13653 )
13654 }
13655 }
13656 unsafe impl<
13657 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
13658 T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
13659 T2: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
13660 >
13661 fidl::encoding::Encode<
13662 VirtioSoundStartRequest,
13663 fidl::encoding::DefaultFuchsiaResourceDialect,
13664 > for (T0, T1, T2)
13665 {
13666 #[inline]
13667 unsafe fn encode(
13668 self,
13669 encoder: &mut fidl::encoding::Encoder<
13670 '_,
13671 fidl::encoding::DefaultFuchsiaResourceDialect,
13672 >,
13673 offset: usize,
13674 depth: fidl::encoding::Depth,
13675 ) -> fidl::Result<()> {
13676 encoder.debug_check_bounds::<VirtioSoundStartRequest>(offset);
13677 unsafe {
13680 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
13681 (ptr as *mut u64).write_unaligned(0);
13682 }
13683 self.0.encode(encoder, offset + 0, depth)?;
13685 self.1.encode(encoder, offset + 32, depth)?;
13686 self.2.encode(encoder, offset + 33, depth)?;
13687 Ok(())
13688 }
13689 }
13690
13691 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13692 for VirtioSoundStartRequest
13693 {
13694 #[inline(always)]
13695 fn new_empty() -> Self {
13696 Self {
13697 start_info: fidl::new_empty!(
13698 StartInfo,
13699 fidl::encoding::DefaultFuchsiaResourceDialect
13700 ),
13701 enable_input: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
13702 enable_verbose_logging: fidl::new_empty!(
13703 bool,
13704 fidl::encoding::DefaultFuchsiaResourceDialect
13705 ),
13706 }
13707 }
13708
13709 #[inline]
13710 unsafe fn decode(
13711 &mut self,
13712 decoder: &mut fidl::encoding::Decoder<
13713 '_,
13714 fidl::encoding::DefaultFuchsiaResourceDialect,
13715 >,
13716 offset: usize,
13717 _depth: fidl::encoding::Depth,
13718 ) -> fidl::Result<()> {
13719 decoder.debug_check_bounds::<Self>(offset);
13720 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
13722 let padval = unsafe { (ptr as *const u64).read_unaligned() };
13723 let mask = 0xffffffffffff0000u64;
13724 let maskedval = padval & mask;
13725 if maskedval != 0 {
13726 return Err(fidl::Error::NonZeroPadding {
13727 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13728 });
13729 }
13730 fidl::decode!(
13731 StartInfo,
13732 fidl::encoding::DefaultFuchsiaResourceDialect,
13733 &mut self.start_info,
13734 decoder,
13735 offset + 0,
13736 _depth
13737 )?;
13738 fidl::decode!(
13739 bool,
13740 fidl::encoding::DefaultFuchsiaResourceDialect,
13741 &mut self.enable_input,
13742 decoder,
13743 offset + 32,
13744 _depth
13745 )?;
13746 fidl::decode!(
13747 bool,
13748 fidl::encoding::DefaultFuchsiaResourceDialect,
13749 &mut self.enable_verbose_logging,
13750 decoder,
13751 offset + 33,
13752 _depth
13753 )?;
13754 Ok(())
13755 }
13756 }
13757
13758 impl fidl::encoding::ResourceTypeMarker for VirtioVsockStartRequest {
13759 type Borrowed<'a> = &'a mut Self;
13760 fn take_or_borrow<'a>(
13761 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13762 ) -> Self::Borrowed<'a> {
13763 value
13764 }
13765 }
13766
13767 unsafe impl fidl::encoding::TypeMarker for VirtioVsockStartRequest {
13768 type Owned = Self;
13769
13770 #[inline(always)]
13771 fn inline_align(_context: fidl::encoding::Context) -> usize {
13772 8
13773 }
13774
13775 #[inline(always)]
13776 fn inline_size(_context: fidl::encoding::Context) -> usize {
13777 56
13778 }
13779 }
13780
13781 unsafe impl
13782 fidl::encoding::Encode<
13783 VirtioVsockStartRequest,
13784 fidl::encoding::DefaultFuchsiaResourceDialect,
13785 > for &mut VirtioVsockStartRequest
13786 {
13787 #[inline]
13788 unsafe fn encode(
13789 self,
13790 encoder: &mut fidl::encoding::Encoder<
13791 '_,
13792 fidl::encoding::DefaultFuchsiaResourceDialect,
13793 >,
13794 offset: usize,
13795 _depth: fidl::encoding::Depth,
13796 ) -> fidl::Result<()> {
13797 encoder.debug_check_bounds::<VirtioVsockStartRequest>(offset);
13798 fidl::encoding::Encode::<VirtioVsockStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13800 (
13801 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.start_info),
13802 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_cid),
13803 <fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listeners),
13804 ),
13805 encoder, offset, _depth
13806 )
13807 }
13808 }
13809 unsafe impl<
13810 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
13811 T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
13812 T2: fidl::encoding::Encode<
13813 fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener>,
13814 fidl::encoding::DefaultFuchsiaResourceDialect,
13815 >,
13816 >
13817 fidl::encoding::Encode<
13818 VirtioVsockStartRequest,
13819 fidl::encoding::DefaultFuchsiaResourceDialect,
13820 > for (T0, T1, T2)
13821 {
13822 #[inline]
13823 unsafe fn encode(
13824 self,
13825 encoder: &mut fidl::encoding::Encoder<
13826 '_,
13827 fidl::encoding::DefaultFuchsiaResourceDialect,
13828 >,
13829 offset: usize,
13830 depth: fidl::encoding::Depth,
13831 ) -> fidl::Result<()> {
13832 encoder.debug_check_bounds::<VirtioVsockStartRequest>(offset);
13833 unsafe {
13836 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
13837 (ptr as *mut u64).write_unaligned(0);
13838 }
13839 self.0.encode(encoder, offset + 0, depth)?;
13841 self.1.encode(encoder, offset + 32, depth)?;
13842 self.2.encode(encoder, offset + 40, depth)?;
13843 Ok(())
13844 }
13845 }
13846
13847 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13848 for VirtioVsockStartRequest
13849 {
13850 #[inline(always)]
13851 fn new_empty() -> Self {
13852 Self {
13853 start_info: fidl::new_empty!(
13854 StartInfo,
13855 fidl::encoding::DefaultFuchsiaResourceDialect
13856 ),
13857 guest_cid: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
13858 listeners: fidl::new_empty!(
13859 fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener>,
13860 fidl::encoding::DefaultFuchsiaResourceDialect
13861 ),
13862 }
13863 }
13864
13865 #[inline]
13866 unsafe fn decode(
13867 &mut self,
13868 decoder: &mut fidl::encoding::Decoder<
13869 '_,
13870 fidl::encoding::DefaultFuchsiaResourceDialect,
13871 >,
13872 offset: usize,
13873 _depth: fidl::encoding::Depth,
13874 ) -> fidl::Result<()> {
13875 decoder.debug_check_bounds::<Self>(offset);
13876 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
13878 let padval = unsafe { (ptr as *const u64).read_unaligned() };
13879 let mask = 0xffffffff00000000u64;
13880 let maskedval = padval & mask;
13881 if maskedval != 0 {
13882 return Err(fidl::Error::NonZeroPadding {
13883 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13884 });
13885 }
13886 fidl::decode!(
13887 StartInfo,
13888 fidl::encoding::DefaultFuchsiaResourceDialect,
13889 &mut self.start_info,
13890 decoder,
13891 offset + 0,
13892 _depth
13893 )?;
13894 fidl::decode!(
13895 u32,
13896 fidl::encoding::DefaultFuchsiaResourceDialect,
13897 &mut self.guest_cid,
13898 decoder,
13899 offset + 32,
13900 _depth
13901 )?;
13902 fidl::decode!(
13903 fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener>,
13904 fidl::encoding::DefaultFuchsiaResourceDialect,
13905 &mut self.listeners,
13906 decoder,
13907 offset + 40,
13908 _depth
13909 )?;
13910 Ok(())
13911 }
13912 }
13913
13914 impl fidl::encoding::ResourceTypeMarker for VirtioWaylandGetImporterRequest {
13915 type Borrowed<'a> = &'a mut Self;
13916 fn take_or_borrow<'a>(
13917 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13918 ) -> Self::Borrowed<'a> {
13919 value
13920 }
13921 }
13922
13923 unsafe impl fidl::encoding::TypeMarker for VirtioWaylandGetImporterRequest {
13924 type Owned = Self;
13925
13926 #[inline(always)]
13927 fn inline_align(_context: fidl::encoding::Context) -> usize {
13928 4
13929 }
13930
13931 #[inline(always)]
13932 fn inline_size(_context: fidl::encoding::Context) -> usize {
13933 4
13934 }
13935 }
13936
13937 unsafe impl
13938 fidl::encoding::Encode<
13939 VirtioWaylandGetImporterRequest,
13940 fidl::encoding::DefaultFuchsiaResourceDialect,
13941 > for &mut VirtioWaylandGetImporterRequest
13942 {
13943 #[inline]
13944 unsafe fn encode(
13945 self,
13946 encoder: &mut fidl::encoding::Encoder<
13947 '_,
13948 fidl::encoding::DefaultFuchsiaResourceDialect,
13949 >,
13950 offset: usize,
13951 _depth: fidl::encoding::Depth,
13952 ) -> fidl::Result<()> {
13953 encoder.debug_check_bounds::<VirtioWaylandGetImporterRequest>(offset);
13954 fidl::encoding::Encode::<
13956 VirtioWaylandGetImporterRequest,
13957 fidl::encoding::DefaultFuchsiaResourceDialect,
13958 >::encode(
13959 (
13960 <fidl::encoding::Endpoint<
13961 fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
13962 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13963 &mut self.importer
13964 ),
13965 ),
13966 encoder,
13967 offset,
13968 _depth,
13969 )
13970 }
13971 }
13972 unsafe impl<
13973 T0: fidl::encoding::Encode<
13974 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>>,
13975 fidl::encoding::DefaultFuchsiaResourceDialect,
13976 >,
13977 >
13978 fidl::encoding::Encode<
13979 VirtioWaylandGetImporterRequest,
13980 fidl::encoding::DefaultFuchsiaResourceDialect,
13981 > for (T0,)
13982 {
13983 #[inline]
13984 unsafe fn encode(
13985 self,
13986 encoder: &mut fidl::encoding::Encoder<
13987 '_,
13988 fidl::encoding::DefaultFuchsiaResourceDialect,
13989 >,
13990 offset: usize,
13991 depth: fidl::encoding::Depth,
13992 ) -> fidl::Result<()> {
13993 encoder.debug_check_bounds::<VirtioWaylandGetImporterRequest>(offset);
13994 self.0.encode(encoder, offset + 0, depth)?;
13998 Ok(())
13999 }
14000 }
14001
14002 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14003 for VirtioWaylandGetImporterRequest
14004 {
14005 #[inline(always)]
14006 fn new_empty() -> Self {
14007 Self {
14008 importer: fidl::new_empty!(
14009 fidl::encoding::Endpoint<
14010 fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
14011 >,
14012 fidl::encoding::DefaultFuchsiaResourceDialect
14013 ),
14014 }
14015 }
14016
14017 #[inline]
14018 unsafe fn decode(
14019 &mut self,
14020 decoder: &mut fidl::encoding::Decoder<
14021 '_,
14022 fidl::encoding::DefaultFuchsiaResourceDialect,
14023 >,
14024 offset: usize,
14025 _depth: fidl::encoding::Depth,
14026 ) -> fidl::Result<()> {
14027 decoder.debug_check_bounds::<Self>(offset);
14028 fidl::decode!(
14030 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>>,
14031 fidl::encoding::DefaultFuchsiaResourceDialect,
14032 &mut self.importer,
14033 decoder,
14034 offset + 0,
14035 _depth
14036 )?;
14037 Ok(())
14038 }
14039 }
14040
14041 impl fidl::encoding::ResourceTypeMarker for VirtioWaylandImporterExportImageResponse {
14042 type Borrowed<'a> = &'a mut Self;
14043 fn take_or_borrow<'a>(
14044 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14045 ) -> Self::Borrowed<'a> {
14046 value
14047 }
14048 }
14049
14050 unsafe impl fidl::encoding::TypeMarker for VirtioWaylandImporterExportImageResponse {
14051 type Owned = Self;
14052
14053 #[inline(always)]
14054 fn inline_align(_context: fidl::encoding::Context) -> usize {
14055 8
14056 }
14057
14058 #[inline(always)]
14059 fn inline_size(_context: fidl::encoding::Context) -> usize {
14060 16
14061 }
14062 }
14063
14064 unsafe impl
14065 fidl::encoding::Encode<
14066 VirtioWaylandImporterExportImageResponse,
14067 fidl::encoding::DefaultFuchsiaResourceDialect,
14068 > for &mut VirtioWaylandImporterExportImageResponse
14069 {
14070 #[inline]
14071 unsafe fn encode(
14072 self,
14073 encoder: &mut fidl::encoding::Encoder<
14074 '_,
14075 fidl::encoding::DefaultFuchsiaResourceDialect,
14076 >,
14077 offset: usize,
14078 _depth: fidl::encoding::Depth,
14079 ) -> fidl::Result<()> {
14080 encoder.debug_check_bounds::<VirtioWaylandImporterExportImageResponse>(offset);
14081 fidl::encoding::Encode::<VirtioWaylandImporterExportImageResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14083 (
14084 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
14085 <fidl::encoding::Boxed<VirtioImage> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.image),
14086 ),
14087 encoder, offset, _depth
14088 )
14089 }
14090 }
14091 unsafe impl<
14092 T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
14093 T1: fidl::encoding::Encode<
14094 fidl::encoding::Boxed<VirtioImage>,
14095 fidl::encoding::DefaultFuchsiaResourceDialect,
14096 >,
14097 >
14098 fidl::encoding::Encode<
14099 VirtioWaylandImporterExportImageResponse,
14100 fidl::encoding::DefaultFuchsiaResourceDialect,
14101 > for (T0, T1)
14102 {
14103 #[inline]
14104 unsafe fn encode(
14105 self,
14106 encoder: &mut fidl::encoding::Encoder<
14107 '_,
14108 fidl::encoding::DefaultFuchsiaResourceDialect,
14109 >,
14110 offset: usize,
14111 depth: fidl::encoding::Depth,
14112 ) -> fidl::Result<()> {
14113 encoder.debug_check_bounds::<VirtioWaylandImporterExportImageResponse>(offset);
14114 unsafe {
14117 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
14118 (ptr as *mut u64).write_unaligned(0);
14119 }
14120 self.0.encode(encoder, offset + 0, depth)?;
14122 self.1.encode(encoder, offset + 8, depth)?;
14123 Ok(())
14124 }
14125 }
14126
14127 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14128 for VirtioWaylandImporterExportImageResponse
14129 {
14130 #[inline(always)]
14131 fn new_empty() -> Self {
14132 Self {
14133 status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
14134 image: fidl::new_empty!(
14135 fidl::encoding::Boxed<VirtioImage>,
14136 fidl::encoding::DefaultFuchsiaResourceDialect
14137 ),
14138 }
14139 }
14140
14141 #[inline]
14142 unsafe fn decode(
14143 &mut self,
14144 decoder: &mut fidl::encoding::Decoder<
14145 '_,
14146 fidl::encoding::DefaultFuchsiaResourceDialect,
14147 >,
14148 offset: usize,
14149 _depth: fidl::encoding::Depth,
14150 ) -> fidl::Result<()> {
14151 decoder.debug_check_bounds::<Self>(offset);
14152 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
14154 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14155 let mask = 0xffffffff00000000u64;
14156 let maskedval = padval & mask;
14157 if maskedval != 0 {
14158 return Err(fidl::Error::NonZeroPadding {
14159 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
14160 });
14161 }
14162 fidl::decode!(
14163 i32,
14164 fidl::encoding::DefaultFuchsiaResourceDialect,
14165 &mut self.status,
14166 decoder,
14167 offset + 0,
14168 _depth
14169 )?;
14170 fidl::decode!(
14171 fidl::encoding::Boxed<VirtioImage>,
14172 fidl::encoding::DefaultFuchsiaResourceDialect,
14173 &mut self.image,
14174 decoder,
14175 offset + 8,
14176 _depth
14177 )?;
14178 Ok(())
14179 }
14180 }
14181
14182 impl fidl::encoding::ResourceTypeMarker for VirtioWaylandImporterImportImageRequest {
14183 type Borrowed<'a> = &'a mut Self;
14184 fn take_or_borrow<'a>(
14185 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14186 ) -> Self::Borrowed<'a> {
14187 value
14188 }
14189 }
14190
14191 unsafe impl fidl::encoding::TypeMarker for VirtioWaylandImporterImportImageRequest {
14192 type Owned = Self;
14193
14194 #[inline(always)]
14195 fn inline_align(_context: fidl::encoding::Context) -> usize {
14196 8
14197 }
14198
14199 #[inline(always)]
14200 fn inline_size(_context: fidl::encoding::Context) -> usize {
14201 24
14202 }
14203 }
14204
14205 unsafe impl
14206 fidl::encoding::Encode<
14207 VirtioWaylandImporterImportImageRequest,
14208 fidl::encoding::DefaultFuchsiaResourceDialect,
14209 > for &mut VirtioWaylandImporterImportImageRequest
14210 {
14211 #[inline]
14212 unsafe fn encode(
14213 self,
14214 encoder: &mut fidl::encoding::Encoder<
14215 '_,
14216 fidl::encoding::DefaultFuchsiaResourceDialect,
14217 >,
14218 offset: usize,
14219 _depth: fidl::encoding::Depth,
14220 ) -> fidl::Result<()> {
14221 encoder.debug_check_bounds::<VirtioWaylandImporterImportImageRequest>(offset);
14222 fidl::encoding::Encode::<
14224 VirtioWaylandImporterImportImageRequest,
14225 fidl::encoding::DefaultFuchsiaResourceDialect,
14226 >::encode(
14227 (<VirtioImage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14228 &mut self.image,
14229 ),),
14230 encoder,
14231 offset,
14232 _depth,
14233 )
14234 }
14235 }
14236 unsafe impl<
14237 T0: fidl::encoding::Encode<VirtioImage, fidl::encoding::DefaultFuchsiaResourceDialect>,
14238 >
14239 fidl::encoding::Encode<
14240 VirtioWaylandImporterImportImageRequest,
14241 fidl::encoding::DefaultFuchsiaResourceDialect,
14242 > for (T0,)
14243 {
14244 #[inline]
14245 unsafe fn encode(
14246 self,
14247 encoder: &mut fidl::encoding::Encoder<
14248 '_,
14249 fidl::encoding::DefaultFuchsiaResourceDialect,
14250 >,
14251 offset: usize,
14252 depth: fidl::encoding::Depth,
14253 ) -> fidl::Result<()> {
14254 encoder.debug_check_bounds::<VirtioWaylandImporterImportImageRequest>(offset);
14255 self.0.encode(encoder, offset + 0, depth)?;
14259 Ok(())
14260 }
14261 }
14262
14263 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14264 for VirtioWaylandImporterImportImageRequest
14265 {
14266 #[inline(always)]
14267 fn new_empty() -> Self {
14268 Self {
14269 image: fidl::new_empty!(VirtioImage, fidl::encoding::DefaultFuchsiaResourceDialect),
14270 }
14271 }
14272
14273 #[inline]
14274 unsafe fn decode(
14275 &mut self,
14276 decoder: &mut fidl::encoding::Decoder<
14277 '_,
14278 fidl::encoding::DefaultFuchsiaResourceDialect,
14279 >,
14280 offset: usize,
14281 _depth: fidl::encoding::Depth,
14282 ) -> fidl::Result<()> {
14283 decoder.debug_check_bounds::<Self>(offset);
14284 fidl::decode!(
14286 VirtioImage,
14287 fidl::encoding::DefaultFuchsiaResourceDialect,
14288 &mut self.image,
14289 decoder,
14290 offset + 0,
14291 _depth
14292 )?;
14293 Ok(())
14294 }
14295 }
14296
14297 impl fidl::encoding::ResourceTypeMarker for VirtioWaylandStartRequest {
14298 type Borrowed<'a> = &'a mut Self;
14299 fn take_or_borrow<'a>(
14300 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14301 ) -> Self::Borrowed<'a> {
14302 value
14303 }
14304 }
14305
14306 unsafe impl fidl::encoding::TypeMarker for VirtioWaylandStartRequest {
14307 type Owned = Self;
14308
14309 #[inline(always)]
14310 fn inline_align(_context: fidl::encoding::Context) -> usize {
14311 8
14312 }
14313
14314 #[inline(always)]
14315 fn inline_size(_context: fidl::encoding::Context) -> usize {
14316 48
14317 }
14318 }
14319
14320 unsafe impl
14321 fidl::encoding::Encode<
14322 VirtioWaylandStartRequest,
14323 fidl::encoding::DefaultFuchsiaResourceDialect,
14324 > for &mut VirtioWaylandStartRequest
14325 {
14326 #[inline]
14327 unsafe fn encode(
14328 self,
14329 encoder: &mut fidl::encoding::Encoder<
14330 '_,
14331 fidl::encoding::DefaultFuchsiaResourceDialect,
14332 >,
14333 offset: usize,
14334 _depth: fidl::encoding::Depth,
14335 ) -> fidl::Result<()> {
14336 encoder.debug_check_bounds::<VirtioWaylandStartRequest>(offset);
14337 fidl::encoding::Encode::<
14339 VirtioWaylandStartRequest,
14340 fidl::encoding::DefaultFuchsiaResourceDialect,
14341 >::encode(
14342 (
14343 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14344 &mut self.start_info,
14345 ),
14346 <fidl::encoding::HandleType<
14347 fidl::Vmar,
14348 { fidl::ObjectType::VMAR.into_raw() },
14349 2147483648,
14350 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14351 &mut self.vmar
14352 ),
14353 <fidl::encoding::Endpoint<
14354 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
14355 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14356 &mut self.sysmem_allocator,
14357 ),
14358 <fidl::encoding::Endpoint<
14359 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
14360 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14361 &mut self.scenic_allocator,
14362 ),
14363 ),
14364 encoder,
14365 offset,
14366 _depth,
14367 )
14368 }
14369 }
14370 unsafe impl<
14371 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
14372 T1: fidl::encoding::Encode<
14373 fidl::encoding::HandleType<
14374 fidl::Vmar,
14375 { fidl::ObjectType::VMAR.into_raw() },
14376 2147483648,
14377 >,
14378 fidl::encoding::DefaultFuchsiaResourceDialect,
14379 >,
14380 T2: fidl::encoding::Encode<
14381 fidl::encoding::Endpoint<
14382 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
14383 >,
14384 fidl::encoding::DefaultFuchsiaResourceDialect,
14385 >,
14386 T3: fidl::encoding::Encode<
14387 fidl::encoding::Endpoint<
14388 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
14389 >,
14390 fidl::encoding::DefaultFuchsiaResourceDialect,
14391 >,
14392 >
14393 fidl::encoding::Encode<
14394 VirtioWaylandStartRequest,
14395 fidl::encoding::DefaultFuchsiaResourceDialect,
14396 > for (T0, T1, T2, T3)
14397 {
14398 #[inline]
14399 unsafe fn encode(
14400 self,
14401 encoder: &mut fidl::encoding::Encoder<
14402 '_,
14403 fidl::encoding::DefaultFuchsiaResourceDialect,
14404 >,
14405 offset: usize,
14406 depth: fidl::encoding::Depth,
14407 ) -> fidl::Result<()> {
14408 encoder.debug_check_bounds::<VirtioWaylandStartRequest>(offset);
14409 unsafe {
14412 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
14413 (ptr as *mut u64).write_unaligned(0);
14414 }
14415 self.0.encode(encoder, offset + 0, depth)?;
14417 self.1.encode(encoder, offset + 32, depth)?;
14418 self.2.encode(encoder, offset + 36, depth)?;
14419 self.3.encode(encoder, offset + 40, depth)?;
14420 Ok(())
14421 }
14422 }
14423
14424 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14425 for VirtioWaylandStartRequest
14426 {
14427 #[inline(always)]
14428 fn new_empty() -> Self {
14429 Self {
14430 start_info: fidl::new_empty!(
14431 StartInfo,
14432 fidl::encoding::DefaultFuchsiaResourceDialect
14433 ),
14434 vmar: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14435 sysmem_allocator: fidl::new_empty!(
14436 fidl::encoding::Endpoint<
14437 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
14438 >,
14439 fidl::encoding::DefaultFuchsiaResourceDialect
14440 ),
14441 scenic_allocator: fidl::new_empty!(
14442 fidl::encoding::Endpoint<
14443 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
14444 >,
14445 fidl::encoding::DefaultFuchsiaResourceDialect
14446 ),
14447 }
14448 }
14449
14450 #[inline]
14451 unsafe fn decode(
14452 &mut self,
14453 decoder: &mut fidl::encoding::Decoder<
14454 '_,
14455 fidl::encoding::DefaultFuchsiaResourceDialect,
14456 >,
14457 offset: usize,
14458 _depth: fidl::encoding::Depth,
14459 ) -> fidl::Result<()> {
14460 decoder.debug_check_bounds::<Self>(offset);
14461 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
14463 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14464 let mask = 0xffffffff00000000u64;
14465 let maskedval = padval & mask;
14466 if maskedval != 0 {
14467 return Err(fidl::Error::NonZeroPadding {
14468 padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
14469 });
14470 }
14471 fidl::decode!(
14472 StartInfo,
14473 fidl::encoding::DefaultFuchsiaResourceDialect,
14474 &mut self.start_info,
14475 decoder,
14476 offset + 0,
14477 _depth
14478 )?;
14479 fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar, decoder, offset + 32, _depth)?;
14480 fidl::decode!(
14481 fidl::encoding::Endpoint<
14482 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
14483 >,
14484 fidl::encoding::DefaultFuchsiaResourceDialect,
14485 &mut self.sysmem_allocator,
14486 decoder,
14487 offset + 36,
14488 _depth
14489 )?;
14490 fidl::decode!(
14491 fidl::encoding::Endpoint<
14492 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
14493 >,
14494 fidl::encoding::DefaultFuchsiaResourceDialect,
14495 &mut self.scenic_allocator,
14496 decoder,
14497 offset + 40,
14498 _depth
14499 )?;
14500 Ok(())
14501 }
14502 }
14503
14504 impl fidl::encoding::ResourceTypeMarker for VirtioWaylandStartWithWaylandServerRequest {
14505 type Borrowed<'a> = &'a mut Self;
14506 fn take_or_borrow<'a>(
14507 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14508 ) -> Self::Borrowed<'a> {
14509 value
14510 }
14511 }
14512
14513 unsafe impl fidl::encoding::TypeMarker for VirtioWaylandStartWithWaylandServerRequest {
14514 type Owned = Self;
14515
14516 #[inline(always)]
14517 fn inline_align(_context: fidl::encoding::Context) -> usize {
14518 8
14519 }
14520
14521 #[inline(always)]
14522 fn inline_size(_context: fidl::encoding::Context) -> usize {
14523 48
14524 }
14525 }
14526
14527 unsafe impl
14528 fidl::encoding::Encode<
14529 VirtioWaylandStartWithWaylandServerRequest,
14530 fidl::encoding::DefaultFuchsiaResourceDialect,
14531 > for &mut VirtioWaylandStartWithWaylandServerRequest
14532 {
14533 #[inline]
14534 unsafe fn encode(
14535 self,
14536 encoder: &mut fidl::encoding::Encoder<
14537 '_,
14538 fidl::encoding::DefaultFuchsiaResourceDialect,
14539 >,
14540 offset: usize,
14541 _depth: fidl::encoding::Depth,
14542 ) -> fidl::Result<()> {
14543 encoder.debug_check_bounds::<VirtioWaylandStartWithWaylandServerRequest>(offset);
14544 fidl::encoding::Encode::<
14546 VirtioWaylandStartWithWaylandServerRequest,
14547 fidl::encoding::DefaultFuchsiaResourceDialect,
14548 >::encode(
14549 (
14550 <StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14551 &mut self.start_info,
14552 ),
14553 <fidl::encoding::HandleType<
14554 fidl::Vmar,
14555 { fidl::ObjectType::VMAR.into_raw() },
14556 2147483648,
14557 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14558 &mut self.vmar
14559 ),
14560 <fidl::encoding::Optional<
14561 fidl::encoding::Endpoint<
14562 fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
14563 >,
14564 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14565 &mut self.wayland_server,
14566 ),
14567 <fidl::encoding::Endpoint<
14568 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
14569 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14570 &mut self.sysmem_allocator,
14571 ),
14572 <fidl::encoding::Endpoint<
14573 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
14574 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14575 &mut self.scenic_allocator,
14576 ),
14577 ),
14578 encoder,
14579 offset,
14580 _depth,
14581 )
14582 }
14583 }
14584 unsafe impl<
14585 T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
14586 T1: fidl::encoding::Encode<
14587 fidl::encoding::HandleType<
14588 fidl::Vmar,
14589 { fidl::ObjectType::VMAR.into_raw() },
14590 2147483648,
14591 >,
14592 fidl::encoding::DefaultFuchsiaResourceDialect,
14593 >,
14594 T2: fidl::encoding::Encode<
14595 fidl::encoding::Optional<
14596 fidl::encoding::Endpoint<
14597 fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
14598 >,
14599 >,
14600 fidl::encoding::DefaultFuchsiaResourceDialect,
14601 >,
14602 T3: fidl::encoding::Encode<
14603 fidl::encoding::Endpoint<
14604 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
14605 >,
14606 fidl::encoding::DefaultFuchsiaResourceDialect,
14607 >,
14608 T4: fidl::encoding::Encode<
14609 fidl::encoding::Endpoint<
14610 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
14611 >,
14612 fidl::encoding::DefaultFuchsiaResourceDialect,
14613 >,
14614 >
14615 fidl::encoding::Encode<
14616 VirtioWaylandStartWithWaylandServerRequest,
14617 fidl::encoding::DefaultFuchsiaResourceDialect,
14618 > for (T0, T1, T2, T3, T4)
14619 {
14620 #[inline]
14621 unsafe fn encode(
14622 self,
14623 encoder: &mut fidl::encoding::Encoder<
14624 '_,
14625 fidl::encoding::DefaultFuchsiaResourceDialect,
14626 >,
14627 offset: usize,
14628 depth: fidl::encoding::Depth,
14629 ) -> fidl::Result<()> {
14630 encoder.debug_check_bounds::<VirtioWaylandStartWithWaylandServerRequest>(offset);
14631 self.0.encode(encoder, offset + 0, depth)?;
14635 self.1.encode(encoder, offset + 32, depth)?;
14636 self.2.encode(encoder, offset + 36, depth)?;
14637 self.3.encode(encoder, offset + 40, depth)?;
14638 self.4.encode(encoder, offset + 44, depth)?;
14639 Ok(())
14640 }
14641 }
14642
14643 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14644 for VirtioWaylandStartWithWaylandServerRequest
14645 {
14646 #[inline(always)]
14647 fn new_empty() -> Self {
14648 Self {
14649 start_info: fidl::new_empty!(
14650 StartInfo,
14651 fidl::encoding::DefaultFuchsiaResourceDialect
14652 ),
14653 vmar: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14654 wayland_server: fidl::new_empty!(
14655 fidl::encoding::Optional<
14656 fidl::encoding::Endpoint<
14657 fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
14658 >,
14659 >,
14660 fidl::encoding::DefaultFuchsiaResourceDialect
14661 ),
14662 sysmem_allocator: fidl::new_empty!(
14663 fidl::encoding::Endpoint<
14664 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
14665 >,
14666 fidl::encoding::DefaultFuchsiaResourceDialect
14667 ),
14668 scenic_allocator: fidl::new_empty!(
14669 fidl::encoding::Endpoint<
14670 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
14671 >,
14672 fidl::encoding::DefaultFuchsiaResourceDialect
14673 ),
14674 }
14675 }
14676
14677 #[inline]
14678 unsafe fn decode(
14679 &mut self,
14680 decoder: &mut fidl::encoding::Decoder<
14681 '_,
14682 fidl::encoding::DefaultFuchsiaResourceDialect,
14683 >,
14684 offset: usize,
14685 _depth: fidl::encoding::Depth,
14686 ) -> fidl::Result<()> {
14687 decoder.debug_check_bounds::<Self>(offset);
14688 fidl::decode!(
14690 StartInfo,
14691 fidl::encoding::DefaultFuchsiaResourceDialect,
14692 &mut self.start_info,
14693 decoder,
14694 offset + 0,
14695 _depth
14696 )?;
14697 fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar, decoder, offset + 32, _depth)?;
14698 fidl::decode!(
14699 fidl::encoding::Optional<
14700 fidl::encoding::Endpoint<
14701 fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
14702 >,
14703 >,
14704 fidl::encoding::DefaultFuchsiaResourceDialect,
14705 &mut self.wayland_server,
14706 decoder,
14707 offset + 36,
14708 _depth
14709 )?;
14710 fidl::decode!(
14711 fidl::encoding::Endpoint<
14712 fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
14713 >,
14714 fidl::encoding::DefaultFuchsiaResourceDialect,
14715 &mut self.sysmem_allocator,
14716 decoder,
14717 offset + 40,
14718 _depth
14719 )?;
14720 fidl::decode!(
14721 fidl::encoding::Endpoint<
14722 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
14723 >,
14724 fidl::encoding::DefaultFuchsiaResourceDialect,
14725 &mut self.scenic_allocator,
14726 decoder,
14727 offset + 44,
14728 _depth
14729 )?;
14730 Ok(())
14731 }
14732 }
14733
14734 impl fidl::encoding::ResourceTypeMarker for InputType {
14735 type Borrowed<'a> = &'a mut Self;
14736 fn take_or_borrow<'a>(
14737 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14738 ) -> Self::Borrowed<'a> {
14739 value
14740 }
14741 }
14742
14743 unsafe impl fidl::encoding::TypeMarker for InputType {
14744 type Owned = Self;
14745
14746 #[inline(always)]
14747 fn inline_align(_context: fidl::encoding::Context) -> usize {
14748 8
14749 }
14750
14751 #[inline(always)]
14752 fn inline_size(_context: fidl::encoding::Context) -> usize {
14753 16
14754 }
14755 }
14756
14757 unsafe impl fidl::encoding::Encode<InputType, fidl::encoding::DefaultFuchsiaResourceDialect>
14758 for &mut InputType
14759 {
14760 #[inline]
14761 unsafe fn encode(
14762 self,
14763 encoder: &mut fidl::encoding::Encoder<
14764 '_,
14765 fidl::encoding::DefaultFuchsiaResourceDialect,
14766 >,
14767 offset: usize,
14768 _depth: fidl::encoding::Depth,
14769 ) -> fidl::Result<()> {
14770 encoder.debug_check_bounds::<InputType>(offset);
14771 encoder.write_num::<u64>(self.ordinal(), offset);
14772 match self {
14773 InputType::Keyboard(ref mut val) => fidl::encoding::encode_in_envelope::<
14774 fidl::encoding::Endpoint<
14775 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
14776 >,
14777 fidl::encoding::DefaultFuchsiaResourceDialect,
14778 >(
14779 <fidl::encoding::Endpoint<
14780 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
14781 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14782 val
14783 ),
14784 encoder,
14785 offset + 8,
14786 _depth,
14787 ),
14788 InputType::Mouse(ref mut val) => fidl::encoding::encode_in_envelope::<
14789 fidl::encoding::Endpoint<
14790 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14791 >,
14792 fidl::encoding::DefaultFuchsiaResourceDialect,
14793 >(
14794 <fidl::encoding::Endpoint<
14795 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14796 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14797 val
14798 ),
14799 encoder,
14800 offset + 8,
14801 _depth,
14802 ),
14803 }
14804 }
14805 }
14806
14807 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for InputType {
14808 #[inline(always)]
14809 fn new_empty() -> Self {
14810 Self::Keyboard(fidl::new_empty!(
14811 fidl::encoding::Endpoint<
14812 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
14813 >,
14814 fidl::encoding::DefaultFuchsiaResourceDialect
14815 ))
14816 }
14817
14818 #[inline]
14819 unsafe fn decode(
14820 &mut self,
14821 decoder: &mut fidl::encoding::Decoder<
14822 '_,
14823 fidl::encoding::DefaultFuchsiaResourceDialect,
14824 >,
14825 offset: usize,
14826 mut depth: fidl::encoding::Depth,
14827 ) -> fidl::Result<()> {
14828 decoder.debug_check_bounds::<Self>(offset);
14829 #[allow(unused_variables)]
14830 let next_out_of_line = decoder.next_out_of_line();
14831 let handles_before = decoder.remaining_handles();
14832 let (ordinal, inlined, num_bytes, num_handles) =
14833 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
14834
14835 let member_inline_size = match ordinal {
14836 1 => <fidl::encoding::Endpoint<
14837 fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
14838 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
14839 2 => <fidl::encoding::Endpoint<
14840 fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
14841 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
14842 _ => return Err(fidl::Error::UnknownUnionTag),
14843 };
14844
14845 if inlined != (member_inline_size <= 4) {
14846 return Err(fidl::Error::InvalidInlineBitInEnvelope);
14847 }
14848 let _inner_offset;
14849 if inlined {
14850 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
14851 _inner_offset = offset + 8;
14852 } else {
14853 depth.increment()?;
14854 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14855 }
14856 match ordinal {
14857 1 => {
14858 #[allow(irrefutable_let_patterns)]
14859 if let InputType::Keyboard(_) = self {
14860 } else {
14862 *self = InputType::Keyboard(fidl::new_empty!(
14864 fidl::encoding::Endpoint<
14865 fidl::endpoints::ServerEnd<
14866 fidl_fuchsia_ui_input3::KeyboardListenerMarker,
14867 >,
14868 >,
14869 fidl::encoding::DefaultFuchsiaResourceDialect
14870 ));
14871 }
14872 #[allow(irrefutable_let_patterns)]
14873 if let InputType::Keyboard(ref mut val) = self {
14874 fidl::decode!(
14875 fidl::encoding::Endpoint<
14876 fidl::endpoints::ServerEnd<
14877 fidl_fuchsia_ui_input3::KeyboardListenerMarker,
14878 >,
14879 >,
14880 fidl::encoding::DefaultFuchsiaResourceDialect,
14881 val,
14882 decoder,
14883 _inner_offset,
14884 depth
14885 )?;
14886 } else {
14887 unreachable!()
14888 }
14889 }
14890 2 => {
14891 #[allow(irrefutable_let_patterns)]
14892 if let InputType::Mouse(_) = self {
14893 } else {
14895 *self = InputType::Mouse(fidl::new_empty!(
14897 fidl::encoding::Endpoint<
14898 fidl::endpoints::ClientEnd<
14899 fidl_fuchsia_ui_pointer::MouseSourceMarker,
14900 >,
14901 >,
14902 fidl::encoding::DefaultFuchsiaResourceDialect
14903 ));
14904 }
14905 #[allow(irrefutable_let_patterns)]
14906 if let InputType::Mouse(ref mut val) = self {
14907 fidl::decode!(
14908 fidl::encoding::Endpoint<
14909 fidl::endpoints::ClientEnd<
14910 fidl_fuchsia_ui_pointer::MouseSourceMarker,
14911 >,
14912 >,
14913 fidl::encoding::DefaultFuchsiaResourceDialect,
14914 val,
14915 decoder,
14916 _inner_offset,
14917 depth
14918 )?;
14919 } else {
14920 unreachable!()
14921 }
14922 }
14923 ordinal => panic!("unexpected ordinal {:?}", ordinal),
14924 }
14925 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
14926 return Err(fidl::Error::InvalidNumBytesInEnvelope);
14927 }
14928 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14929 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14930 }
14931 Ok(())
14932 }
14933 }
14934}