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_netemul_guest_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ControllerCreateGuestRequest {
16 pub name: String,
17 pub network: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
18 pub mac: Option<Box<fidl_fuchsia_net::MacAddress>>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22 for ControllerCreateGuestRequest
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct ControllerCreateGuestResponse {
28 pub s: fidl::endpoints::ClientEnd<GuestMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for ControllerCreateGuestResponse
33{
34}
35
36#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
37pub struct ControllerMarker;
38
39impl fidl::endpoints::ProtocolMarker for ControllerMarker {
40 type Proxy = ControllerProxy;
41 type RequestStream = ControllerRequestStream;
42 #[cfg(target_os = "fuchsia")]
43 type SynchronousProxy = ControllerSynchronousProxy;
44
45 const DEBUG_NAME: &'static str = "fuchsia.netemul.guest.Controller";
46}
47impl fidl::endpoints::DiscoverableProtocolMarker for ControllerMarker {}
48pub type ControllerCreateGuestResult =
49 Result<fidl::endpoints::ClientEnd<GuestMarker>, ControllerCreateGuestError>;
50
51pub trait ControllerProxyInterface: Send + Sync {
52 type CreateGuestResponseFut: std::future::Future<Output = Result<ControllerCreateGuestResult, fidl::Error>>
53 + Send;
54 fn r#create_guest(
55 &self,
56 name: &str,
57 network: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
58 mac: Option<&fidl_fuchsia_net::MacAddress>,
59 ) -> Self::CreateGuestResponseFut;
60}
61#[derive(Debug)]
62#[cfg(target_os = "fuchsia")]
63pub struct ControllerSynchronousProxy {
64 client: fidl::client::sync::Client,
65}
66
67#[cfg(target_os = "fuchsia")]
68impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
69 type Proxy = ControllerProxy;
70 type Protocol = ControllerMarker;
71
72 fn from_channel(inner: fidl::Channel) -> Self {
73 Self::new(inner)
74 }
75
76 fn into_channel(self) -> fidl::Channel {
77 self.client.into_channel()
78 }
79
80 fn as_channel(&self) -> &fidl::Channel {
81 self.client.as_channel()
82 }
83}
84
85#[cfg(target_os = "fuchsia")]
86impl ControllerSynchronousProxy {
87 pub fn new(channel: fidl::Channel) -> Self {
88 Self { client: fidl::client::sync::Client::new(channel) }
89 }
90
91 pub fn into_channel(self) -> fidl::Channel {
92 self.client.into_channel()
93 }
94
95 pub fn wait_for_event(
98 &self,
99 deadline: zx::MonotonicInstant,
100 ) -> Result<ControllerEvent, fidl::Error> {
101 ControllerEvent::decode(self.client.wait_for_event::<ControllerMarker>(deadline)?)
102 }
103
104 pub fn r#create_guest(
118 &self,
119 mut name: &str,
120 mut network: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
121 mut mac: Option<&fidl_fuchsia_net::MacAddress>,
122 ___deadline: zx::MonotonicInstant,
123 ) -> Result<ControllerCreateGuestResult, fidl::Error> {
124 let _response =
125 self.client.send_query::<ControllerCreateGuestRequest, fidl::encoding::ResultType<
126 ControllerCreateGuestResponse,
127 ControllerCreateGuestError,
128 >, ControllerMarker>(
129 (name, network, mac),
130 0x5c49cf5272f818c0,
131 fidl::encoding::DynamicFlags::empty(),
132 ___deadline,
133 )?;
134 Ok(_response.map(|x| x.s))
135 }
136}
137
138#[cfg(target_os = "fuchsia")]
139impl From<ControllerSynchronousProxy> for zx::NullableHandle {
140 fn from(value: ControllerSynchronousProxy) -> Self {
141 value.into_channel().into()
142 }
143}
144
145#[cfg(target_os = "fuchsia")]
146impl From<fidl::Channel> for ControllerSynchronousProxy {
147 fn from(value: fidl::Channel) -> Self {
148 Self::new(value)
149 }
150}
151
152#[cfg(target_os = "fuchsia")]
153impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
154 type Protocol = ControllerMarker;
155
156 fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
157 Self::new(value.into_channel())
158 }
159}
160
161#[derive(Debug, Clone)]
162pub struct ControllerProxy {
163 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
164}
165
166impl fidl::endpoints::Proxy for ControllerProxy {
167 type Protocol = ControllerMarker;
168
169 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
170 Self::new(inner)
171 }
172
173 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
174 self.client.into_channel().map_err(|client| Self { client })
175 }
176
177 fn as_channel(&self) -> &::fidl::AsyncChannel {
178 self.client.as_channel()
179 }
180}
181
182impl ControllerProxy {
183 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
185 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
186 Self { client: fidl::client::Client::new(channel, protocol_name) }
187 }
188
189 pub fn take_event_stream(&self) -> ControllerEventStream {
195 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
196 }
197
198 pub fn r#create_guest(
212 &self,
213 mut name: &str,
214 mut network: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
215 mut mac: Option<&fidl_fuchsia_net::MacAddress>,
216 ) -> fidl::client::QueryResponseFut<
217 ControllerCreateGuestResult,
218 fidl::encoding::DefaultFuchsiaResourceDialect,
219 > {
220 ControllerProxyInterface::r#create_guest(self, name, network, mac)
221 }
222}
223
224impl ControllerProxyInterface for ControllerProxy {
225 type CreateGuestResponseFut = fidl::client::QueryResponseFut<
226 ControllerCreateGuestResult,
227 fidl::encoding::DefaultFuchsiaResourceDialect,
228 >;
229 fn r#create_guest(
230 &self,
231 mut name: &str,
232 mut network: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
233 mut mac: Option<&fidl_fuchsia_net::MacAddress>,
234 ) -> Self::CreateGuestResponseFut {
235 fn _decode(
236 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
237 ) -> Result<ControllerCreateGuestResult, fidl::Error> {
238 let _response = fidl::client::decode_transaction_body::<
239 fidl::encoding::ResultType<
240 ControllerCreateGuestResponse,
241 ControllerCreateGuestError,
242 >,
243 fidl::encoding::DefaultFuchsiaResourceDialect,
244 0x5c49cf5272f818c0,
245 >(_buf?)?;
246 Ok(_response.map(|x| x.s))
247 }
248 self.client
249 .send_query_and_decode::<ControllerCreateGuestRequest, ControllerCreateGuestResult>(
250 (name, network, mac),
251 0x5c49cf5272f818c0,
252 fidl::encoding::DynamicFlags::empty(),
253 _decode,
254 )
255 }
256}
257
258pub struct ControllerEventStream {
259 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
260}
261
262impl std::marker::Unpin for ControllerEventStream {}
263
264impl futures::stream::FusedStream for ControllerEventStream {
265 fn is_terminated(&self) -> bool {
266 self.event_receiver.is_terminated()
267 }
268}
269
270impl futures::Stream for ControllerEventStream {
271 type Item = Result<ControllerEvent, fidl::Error>;
272
273 fn poll_next(
274 mut self: std::pin::Pin<&mut Self>,
275 cx: &mut std::task::Context<'_>,
276 ) -> std::task::Poll<Option<Self::Item>> {
277 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
278 &mut self.event_receiver,
279 cx
280 )?) {
281 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
282 None => std::task::Poll::Ready(None),
283 }
284 }
285}
286
287#[derive(Debug)]
288pub enum ControllerEvent {}
289
290impl ControllerEvent {
291 fn decode(
293 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
294 ) -> Result<ControllerEvent, fidl::Error> {
295 let (bytes, _handles) = buf.split_mut();
296 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
297 debug_assert_eq!(tx_header.tx_id, 0);
298 match tx_header.ordinal {
299 _ => Err(fidl::Error::UnknownOrdinal {
300 ordinal: tx_header.ordinal,
301 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
302 }),
303 }
304 }
305}
306
307pub struct ControllerRequestStream {
309 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
310 is_terminated: bool,
311}
312
313impl std::marker::Unpin for ControllerRequestStream {}
314
315impl futures::stream::FusedStream for ControllerRequestStream {
316 fn is_terminated(&self) -> bool {
317 self.is_terminated
318 }
319}
320
321impl fidl::endpoints::RequestStream for ControllerRequestStream {
322 type Protocol = ControllerMarker;
323 type ControlHandle = ControllerControlHandle;
324
325 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
326 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
327 }
328
329 fn control_handle(&self) -> Self::ControlHandle {
330 ControllerControlHandle { inner: self.inner.clone() }
331 }
332
333 fn into_inner(
334 self,
335 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
336 {
337 (self.inner, self.is_terminated)
338 }
339
340 fn from_inner(
341 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
342 is_terminated: bool,
343 ) -> Self {
344 Self { inner, is_terminated }
345 }
346}
347
348impl futures::Stream for ControllerRequestStream {
349 type Item = Result<ControllerRequest, fidl::Error>;
350
351 fn poll_next(
352 mut self: std::pin::Pin<&mut Self>,
353 cx: &mut std::task::Context<'_>,
354 ) -> std::task::Poll<Option<Self::Item>> {
355 let this = &mut *self;
356 if this.inner.check_shutdown(cx) {
357 this.is_terminated = true;
358 return std::task::Poll::Ready(None);
359 }
360 if this.is_terminated {
361 panic!("polled ControllerRequestStream after completion");
362 }
363 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
364 |bytes, handles| {
365 match this.inner.channel().read_etc(cx, bytes, handles) {
366 std::task::Poll::Ready(Ok(())) => {}
367 std::task::Poll::Pending => return std::task::Poll::Pending,
368 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
369 this.is_terminated = true;
370 return std::task::Poll::Ready(None);
371 }
372 std::task::Poll::Ready(Err(e)) => {
373 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
374 e.into(),
375 ))));
376 }
377 }
378
379 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
381
382 std::task::Poll::Ready(Some(match header.ordinal {
383 0x5c49cf5272f818c0 => {
384 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
385 let mut req = fidl::new_empty!(
386 ControllerCreateGuestRequest,
387 fidl::encoding::DefaultFuchsiaResourceDialect
388 );
389 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerCreateGuestRequest>(&header, _body_bytes, handles, &mut req)?;
390 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
391 Ok(ControllerRequest::CreateGuest {
392 name: req.name,
393 network: req.network,
394 mac: req.mac,
395
396 responder: ControllerCreateGuestResponder {
397 control_handle: std::mem::ManuallyDrop::new(control_handle),
398 tx_id: header.tx_id,
399 },
400 })
401 }
402 _ => Err(fidl::Error::UnknownOrdinal {
403 ordinal: header.ordinal,
404 protocol_name:
405 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
406 }),
407 }))
408 },
409 )
410 }
411}
412
413#[derive(Debug)]
415pub enum ControllerRequest {
416 CreateGuest {
430 name: String,
431 network: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
432 mac: Option<Box<fidl_fuchsia_net::MacAddress>>,
433 responder: ControllerCreateGuestResponder,
434 },
435}
436
437impl ControllerRequest {
438 #[allow(irrefutable_let_patterns)]
439 pub fn into_create_guest(
440 self,
441 ) -> Option<(
442 String,
443 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
444 Option<Box<fidl_fuchsia_net::MacAddress>>,
445 ControllerCreateGuestResponder,
446 )> {
447 if let ControllerRequest::CreateGuest { name, network, mac, responder } = self {
448 Some((name, network, mac, responder))
449 } else {
450 None
451 }
452 }
453
454 pub fn method_name(&self) -> &'static str {
456 match *self {
457 ControllerRequest::CreateGuest { .. } => "create_guest",
458 }
459 }
460}
461
462#[derive(Debug, Clone)]
463pub struct ControllerControlHandle {
464 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
465}
466
467impl ControllerControlHandle {
468 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
469 self.inner.shutdown_with_epitaph(status.into())
470 }
471}
472
473impl fidl::endpoints::ControlHandle for ControllerControlHandle {
474 fn shutdown(&self) {
475 self.inner.shutdown()
476 }
477
478 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
479 self.inner.shutdown_with_epitaph(status)
480 }
481
482 fn is_closed(&self) -> bool {
483 self.inner.channel().is_closed()
484 }
485 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
486 self.inner.channel().on_closed()
487 }
488
489 #[cfg(target_os = "fuchsia")]
490 fn signal_peer(
491 &self,
492 clear_mask: zx::Signals,
493 set_mask: zx::Signals,
494 ) -> Result<(), zx_status::Status> {
495 use fidl::Peered;
496 self.inner.channel().signal_peer(clear_mask, set_mask)
497 }
498}
499
500impl ControllerControlHandle {}
501
502#[must_use = "FIDL methods require a response to be sent"]
503#[derive(Debug)]
504pub struct ControllerCreateGuestResponder {
505 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
506 tx_id: u32,
507}
508
509impl std::ops::Drop for ControllerCreateGuestResponder {
513 fn drop(&mut self) {
514 self.control_handle.shutdown();
515 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
517 }
518}
519
520impl fidl::endpoints::Responder for ControllerCreateGuestResponder {
521 type ControlHandle = ControllerControlHandle;
522
523 fn control_handle(&self) -> &ControllerControlHandle {
524 &self.control_handle
525 }
526
527 fn drop_without_shutdown(mut self) {
528 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
530 std::mem::forget(self);
532 }
533}
534
535impl ControllerCreateGuestResponder {
536 pub fn send(
540 self,
541 mut result: Result<fidl::endpoints::ClientEnd<GuestMarker>, ControllerCreateGuestError>,
542 ) -> Result<(), fidl::Error> {
543 let _result = self.send_raw(result);
544 if _result.is_err() {
545 self.control_handle.shutdown();
546 }
547 self.drop_without_shutdown();
548 _result
549 }
550
551 pub fn send_no_shutdown_on_err(
553 self,
554 mut result: Result<fidl::endpoints::ClientEnd<GuestMarker>, ControllerCreateGuestError>,
555 ) -> Result<(), fidl::Error> {
556 let _result = self.send_raw(result);
557 self.drop_without_shutdown();
558 _result
559 }
560
561 fn send_raw(
562 &self,
563 mut result: Result<fidl::endpoints::ClientEnd<GuestMarker>, ControllerCreateGuestError>,
564 ) -> Result<(), fidl::Error> {
565 self.control_handle.inner.send::<fidl::encoding::ResultType<
566 ControllerCreateGuestResponse,
567 ControllerCreateGuestError,
568 >>(
569 result.map(|s| (s,)),
570 self.tx_id,
571 0x5c49cf5272f818c0,
572 fidl::encoding::DynamicFlags::empty(),
573 )
574 }
575}
576
577#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
578pub struct GuestMarker;
579
580impl fidl::endpoints::ProtocolMarker for GuestMarker {
581 type Proxy = GuestProxy;
582 type RequestStream = GuestRequestStream;
583 #[cfg(target_os = "fuchsia")]
584 type SynchronousProxy = GuestSynchronousProxy;
585
586 const DEBUG_NAME: &'static str = "(anonymous) Guest";
587}
588
589pub trait GuestProxyInterface: Send + Sync {
590 type PutFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
591 fn r#put_file(
592 &self,
593 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
594 remote_path: &str,
595 ) -> Self::PutFileResponseFut;
596 type GetFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
597 fn r#get_file(
598 &self,
599 remote_path: &str,
600 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
601 ) -> Self::GetFileResponseFut;
602 fn r#execute_command(
603 &self,
604 command: &str,
605 env: &[fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable],
606 stdin: Option<fidl::Socket>,
607 stdout: Option<fidl::Socket>,
608 stderr: Option<fidl::Socket>,
609 command_listener: fidl::endpoints::ServerEnd<
610 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
611 >,
612 ) -> Result<(), fidl::Error>;
613 type ShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
614 fn r#shutdown(&self) -> Self::ShutdownResponseFut;
615}
616#[derive(Debug)]
617#[cfg(target_os = "fuchsia")]
618pub struct GuestSynchronousProxy {
619 client: fidl::client::sync::Client,
620}
621
622#[cfg(target_os = "fuchsia")]
623impl fidl::endpoints::SynchronousProxy for GuestSynchronousProxy {
624 type Proxy = GuestProxy;
625 type Protocol = GuestMarker;
626
627 fn from_channel(inner: fidl::Channel) -> Self {
628 Self::new(inner)
629 }
630
631 fn into_channel(self) -> fidl::Channel {
632 self.client.into_channel()
633 }
634
635 fn as_channel(&self) -> &fidl::Channel {
636 self.client.as_channel()
637 }
638}
639
640#[cfg(target_os = "fuchsia")]
641impl GuestSynchronousProxy {
642 pub fn new(channel: fidl::Channel) -> Self {
643 Self { client: fidl::client::sync::Client::new(channel) }
644 }
645
646 pub fn into_channel(self) -> fidl::Channel {
647 self.client.into_channel()
648 }
649
650 pub fn wait_for_event(
653 &self,
654 deadline: zx::MonotonicInstant,
655 ) -> Result<GuestEvent, fidl::Error> {
656 GuestEvent::decode(self.client.wait_for_event::<GuestMarker>(deadline)?)
657 }
658
659 pub fn r#put_file(
662 &self,
663 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
664 mut remote_path: &str,
665 ___deadline: zx::MonotonicInstant,
666 ) -> Result<i32, fidl::Error> {
667 let _response = self.client.send_query::<
668 fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileRequest,
669 fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileResponse,
670 GuestMarker,
671 >(
672 (local_file, remote_path,),
673 0x223bc20da4a7cddd,
674 fidl::encoding::DynamicFlags::empty(),
675 ___deadline,
676 )?;
677 Ok(_response.status)
678 }
679
680 pub fn r#get_file(
683 &self,
684 mut remote_path: &str,
685 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
686 ___deadline: zx::MonotonicInstant,
687 ) -> Result<i32, fidl::Error> {
688 let _response = self.client.send_query::<
689 fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileRequest,
690 fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileResponse,
691 GuestMarker,
692 >(
693 (remote_path, local_file,),
694 0x7696bea472ca0f2d,
695 fidl::encoding::DynamicFlags::empty(),
696 ___deadline,
697 )?;
698 Ok(_response.status)
699 }
700
701 pub fn r#execute_command(
704 &self,
705 mut command: &str,
706 mut env: &[fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable],
707 mut stdin: Option<fidl::Socket>,
708 mut stdout: Option<fidl::Socket>,
709 mut stderr: Option<fidl::Socket>,
710 mut command_listener: fidl::endpoints::ServerEnd<
711 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
712 >,
713 ) -> Result<(), fidl::Error> {
714 self.client.send::<fidl_fuchsia_virtualization_guest_interaction::InteractionExecuteCommandRequest>(
715 (command, env, stdin, stdout, stderr, command_listener,),
716 0x612641220a1556d8,
717 fidl::encoding::DynamicFlags::empty(),
718 )
719 }
720
721 pub fn r#shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
724 let _response = self
725 .client
726 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload, GuestMarker>(
727 (),
728 0x287e71d61642d1cc,
729 fidl::encoding::DynamicFlags::empty(),
730 ___deadline,
731 )?;
732 Ok(_response)
733 }
734}
735
736#[cfg(target_os = "fuchsia")]
737impl From<GuestSynchronousProxy> for zx::NullableHandle {
738 fn from(value: GuestSynchronousProxy) -> Self {
739 value.into_channel().into()
740 }
741}
742
743#[cfg(target_os = "fuchsia")]
744impl From<fidl::Channel> for GuestSynchronousProxy {
745 fn from(value: fidl::Channel) -> Self {
746 Self::new(value)
747 }
748}
749
750#[cfg(target_os = "fuchsia")]
751impl fidl::endpoints::FromClient for GuestSynchronousProxy {
752 type Protocol = GuestMarker;
753
754 fn from_client(value: fidl::endpoints::ClientEnd<GuestMarker>) -> Self {
755 Self::new(value.into_channel())
756 }
757}
758
759#[derive(Debug, Clone)]
760pub struct GuestProxy {
761 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
762}
763
764impl fidl::endpoints::Proxy for GuestProxy {
765 type Protocol = GuestMarker;
766
767 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
768 Self::new(inner)
769 }
770
771 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
772 self.client.into_channel().map_err(|client| Self { client })
773 }
774
775 fn as_channel(&self) -> &::fidl::AsyncChannel {
776 self.client.as_channel()
777 }
778}
779
780impl GuestProxy {
781 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
783 let protocol_name = <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
784 Self { client: fidl::client::Client::new(channel, protocol_name) }
785 }
786
787 pub fn take_event_stream(&self) -> GuestEventStream {
793 GuestEventStream { event_receiver: self.client.take_event_receiver() }
794 }
795
796 pub fn r#put_file(
799 &self,
800 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
801 mut remote_path: &str,
802 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
803 GuestProxyInterface::r#put_file(self, local_file, remote_path)
804 }
805
806 pub fn r#get_file(
809 &self,
810 mut remote_path: &str,
811 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
812 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
813 GuestProxyInterface::r#get_file(self, remote_path, local_file)
814 }
815
816 pub fn r#execute_command(
819 &self,
820 mut command: &str,
821 mut env: &[fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable],
822 mut stdin: Option<fidl::Socket>,
823 mut stdout: Option<fidl::Socket>,
824 mut stderr: Option<fidl::Socket>,
825 mut command_listener: fidl::endpoints::ServerEnd<
826 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
827 >,
828 ) -> Result<(), fidl::Error> {
829 GuestProxyInterface::r#execute_command(
830 self,
831 command,
832 env,
833 stdin,
834 stdout,
835 stderr,
836 command_listener,
837 )
838 }
839
840 pub fn r#shutdown(
843 &self,
844 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
845 GuestProxyInterface::r#shutdown(self)
846 }
847}
848
849impl GuestProxyInterface for GuestProxy {
850 type PutFileResponseFut =
851 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
852 fn r#put_file(
853 &self,
854 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
855 mut remote_path: &str,
856 ) -> Self::PutFileResponseFut {
857 fn _decode(
858 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
859 ) -> Result<i32, fidl::Error> {
860 let _response = fidl::client::decode_transaction_body::<
861 fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileResponse,
862 fidl::encoding::DefaultFuchsiaResourceDialect,
863 0x223bc20da4a7cddd,
864 >(_buf?)?;
865 Ok(_response.status)
866 }
867 self.client.send_query_and_decode::<
868 fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileRequest,
869 i32,
870 >(
871 (local_file, remote_path,),
872 0x223bc20da4a7cddd,
873 fidl::encoding::DynamicFlags::empty(),
874 _decode,
875 )
876 }
877
878 type GetFileResponseFut =
879 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
880 fn r#get_file(
881 &self,
882 mut remote_path: &str,
883 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
884 ) -> Self::GetFileResponseFut {
885 fn _decode(
886 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
887 ) -> Result<i32, fidl::Error> {
888 let _response = fidl::client::decode_transaction_body::<
889 fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileResponse,
890 fidl::encoding::DefaultFuchsiaResourceDialect,
891 0x7696bea472ca0f2d,
892 >(_buf?)?;
893 Ok(_response.status)
894 }
895 self.client.send_query_and_decode::<
896 fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileRequest,
897 i32,
898 >(
899 (remote_path, local_file,),
900 0x7696bea472ca0f2d,
901 fidl::encoding::DynamicFlags::empty(),
902 _decode,
903 )
904 }
905
906 fn r#execute_command(
907 &self,
908 mut command: &str,
909 mut env: &[fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable],
910 mut stdin: Option<fidl::Socket>,
911 mut stdout: Option<fidl::Socket>,
912 mut stderr: Option<fidl::Socket>,
913 mut command_listener: fidl::endpoints::ServerEnd<
914 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
915 >,
916 ) -> Result<(), fidl::Error> {
917 self.client.send::<fidl_fuchsia_virtualization_guest_interaction::InteractionExecuteCommandRequest>(
918 (command, env, stdin, stdout, stderr, command_listener,),
919 0x612641220a1556d8,
920 fidl::encoding::DynamicFlags::empty(),
921 )
922 }
923
924 type ShutdownResponseFut =
925 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
926 fn r#shutdown(&self) -> Self::ShutdownResponseFut {
927 fn _decode(
928 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
929 ) -> Result<(), fidl::Error> {
930 let _response = fidl::client::decode_transaction_body::<
931 fidl::encoding::EmptyPayload,
932 fidl::encoding::DefaultFuchsiaResourceDialect,
933 0x287e71d61642d1cc,
934 >(_buf?)?;
935 Ok(_response)
936 }
937 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
938 (),
939 0x287e71d61642d1cc,
940 fidl::encoding::DynamicFlags::empty(),
941 _decode,
942 )
943 }
944}
945
946pub struct GuestEventStream {
947 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
948}
949
950impl std::marker::Unpin for GuestEventStream {}
951
952impl futures::stream::FusedStream for GuestEventStream {
953 fn is_terminated(&self) -> bool {
954 self.event_receiver.is_terminated()
955 }
956}
957
958impl futures::Stream for GuestEventStream {
959 type Item = Result<GuestEvent, fidl::Error>;
960
961 fn poll_next(
962 mut self: std::pin::Pin<&mut Self>,
963 cx: &mut std::task::Context<'_>,
964 ) -> std::task::Poll<Option<Self::Item>> {
965 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
966 &mut self.event_receiver,
967 cx
968 )?) {
969 Some(buf) => std::task::Poll::Ready(Some(GuestEvent::decode(buf))),
970 None => std::task::Poll::Ready(None),
971 }
972 }
973}
974
975#[derive(Debug)]
976pub enum GuestEvent {}
977
978impl GuestEvent {
979 fn decode(
981 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
982 ) -> Result<GuestEvent, fidl::Error> {
983 let (bytes, _handles) = buf.split_mut();
984 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
985 debug_assert_eq!(tx_header.tx_id, 0);
986 match tx_header.ordinal {
987 _ => Err(fidl::Error::UnknownOrdinal {
988 ordinal: tx_header.ordinal,
989 protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
990 }),
991 }
992 }
993}
994
995pub struct GuestRequestStream {
997 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
998 is_terminated: bool,
999}
1000
1001impl std::marker::Unpin for GuestRequestStream {}
1002
1003impl futures::stream::FusedStream for GuestRequestStream {
1004 fn is_terminated(&self) -> bool {
1005 self.is_terminated
1006 }
1007}
1008
1009impl fidl::endpoints::RequestStream for GuestRequestStream {
1010 type Protocol = GuestMarker;
1011 type ControlHandle = GuestControlHandle;
1012
1013 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1014 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1015 }
1016
1017 fn control_handle(&self) -> Self::ControlHandle {
1018 GuestControlHandle { inner: self.inner.clone() }
1019 }
1020
1021 fn into_inner(
1022 self,
1023 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1024 {
1025 (self.inner, self.is_terminated)
1026 }
1027
1028 fn from_inner(
1029 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1030 is_terminated: bool,
1031 ) -> Self {
1032 Self { inner, is_terminated }
1033 }
1034}
1035
1036impl futures::Stream for GuestRequestStream {
1037 type Item = Result<GuestRequest, fidl::Error>;
1038
1039 fn poll_next(
1040 mut self: std::pin::Pin<&mut Self>,
1041 cx: &mut std::task::Context<'_>,
1042 ) -> std::task::Poll<Option<Self::Item>> {
1043 let this = &mut *self;
1044 if this.inner.check_shutdown(cx) {
1045 this.is_terminated = true;
1046 return std::task::Poll::Ready(None);
1047 }
1048 if this.is_terminated {
1049 panic!("polled GuestRequestStream after completion");
1050 }
1051 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1052 |bytes, handles| {
1053 match this.inner.channel().read_etc(cx, bytes, handles) {
1054 std::task::Poll::Ready(Ok(())) => {}
1055 std::task::Poll::Pending => return std::task::Poll::Pending,
1056 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1057 this.is_terminated = true;
1058 return std::task::Poll::Ready(None);
1059 }
1060 std::task::Poll::Ready(Err(e)) => {
1061 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1062 e.into(),
1063 ))));
1064 }
1065 }
1066
1067 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1069
1070 std::task::Poll::Ready(Some(match header.ordinal {
1071 0x223bc20da4a7cddd => {
1072 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1073 let mut req = fidl::new_empty!(fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1074 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileRequest>(&header, _body_bytes, handles, &mut req)?;
1075 let control_handle = GuestControlHandle { inner: this.inner.clone() };
1076 Ok(GuestRequest::PutFile {
1077 local_file: req.local_file,
1078 remote_path: req.remote_path,
1079
1080 responder: GuestPutFileResponder {
1081 control_handle: std::mem::ManuallyDrop::new(control_handle),
1082 tx_id: header.tx_id,
1083 },
1084 })
1085 }
1086 0x7696bea472ca0f2d => {
1087 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1088 let mut req = fidl::new_empty!(fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1089 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileRequest>(&header, _body_bytes, handles, &mut req)?;
1090 let control_handle = GuestControlHandle { inner: this.inner.clone() };
1091 Ok(GuestRequest::GetFile {
1092 remote_path: req.remote_path,
1093 local_file: req.local_file,
1094
1095 responder: GuestGetFileResponder {
1096 control_handle: std::mem::ManuallyDrop::new(control_handle),
1097 tx_id: header.tx_id,
1098 },
1099 })
1100 }
1101 0x612641220a1556d8 => {
1102 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1103 let mut req = fidl::new_empty!(fidl_fuchsia_virtualization_guest_interaction::InteractionExecuteCommandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1104 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_virtualization_guest_interaction::InteractionExecuteCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1105 let control_handle = GuestControlHandle { inner: this.inner.clone() };
1106 Ok(GuestRequest::ExecuteCommand {
1107 command: req.command,
1108 env: req.env,
1109 stdin: req.stdin,
1110 stdout: req.stdout,
1111 stderr: req.stderr,
1112 command_listener: req.command_listener,
1113
1114 control_handle,
1115 })
1116 }
1117 0x287e71d61642d1cc => {
1118 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1119 let mut req = fidl::new_empty!(
1120 fidl::encoding::EmptyPayload,
1121 fidl::encoding::DefaultFuchsiaResourceDialect
1122 );
1123 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1124 let control_handle = GuestControlHandle { inner: this.inner.clone() };
1125 Ok(GuestRequest::Shutdown {
1126 responder: GuestShutdownResponder {
1127 control_handle: std::mem::ManuallyDrop::new(control_handle),
1128 tx_id: header.tx_id,
1129 },
1130 })
1131 }
1132 _ => Err(fidl::Error::UnknownOrdinal {
1133 ordinal: header.ordinal,
1134 protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1135 }),
1136 }))
1137 },
1138 )
1139 }
1140}
1141
1142#[derive(Debug)]
1151pub enum GuestRequest {
1152 PutFile {
1155 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1156 remote_path: String,
1157 responder: GuestPutFileResponder,
1158 },
1159 GetFile {
1162 remote_path: String,
1163 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1164 responder: GuestGetFileResponder,
1165 },
1166 ExecuteCommand {
1169 command: String,
1170 env: Vec<fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable>,
1171 stdin: Option<fidl::Socket>,
1172 stdout: Option<fidl::Socket>,
1173 stderr: Option<fidl::Socket>,
1174 command_listener: fidl::endpoints::ServerEnd<
1175 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
1176 >,
1177 control_handle: GuestControlHandle,
1178 },
1179 Shutdown { responder: GuestShutdownResponder },
1182}
1183
1184impl GuestRequest {
1185 #[allow(irrefutable_let_patterns)]
1186 pub fn into_put_file(
1187 self,
1188 ) -> Option<(
1189 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1190 String,
1191 GuestPutFileResponder,
1192 )> {
1193 if let GuestRequest::PutFile { local_file, remote_path, responder } = self {
1194 Some((local_file, remote_path, responder))
1195 } else {
1196 None
1197 }
1198 }
1199
1200 #[allow(irrefutable_let_patterns)]
1201 pub fn into_get_file(
1202 self,
1203 ) -> Option<(
1204 String,
1205 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1206 GuestGetFileResponder,
1207 )> {
1208 if let GuestRequest::GetFile { remote_path, local_file, responder } = self {
1209 Some((remote_path, local_file, responder))
1210 } else {
1211 None
1212 }
1213 }
1214
1215 #[allow(irrefutable_let_patterns)]
1216 pub fn into_execute_command(
1217 self,
1218 ) -> Option<(
1219 String,
1220 Vec<fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable>,
1221 Option<fidl::Socket>,
1222 Option<fidl::Socket>,
1223 Option<fidl::Socket>,
1224 fidl::endpoints::ServerEnd<
1225 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
1226 >,
1227 GuestControlHandle,
1228 )> {
1229 if let GuestRequest::ExecuteCommand {
1230 command,
1231 env,
1232 stdin,
1233 stdout,
1234 stderr,
1235 command_listener,
1236 control_handle,
1237 } = self
1238 {
1239 Some((command, env, stdin, stdout, stderr, command_listener, control_handle))
1240 } else {
1241 None
1242 }
1243 }
1244
1245 #[allow(irrefutable_let_patterns)]
1246 pub fn into_shutdown(self) -> Option<(GuestShutdownResponder)> {
1247 if let GuestRequest::Shutdown { responder } = self { Some((responder)) } else { None }
1248 }
1249
1250 pub fn method_name(&self) -> &'static str {
1252 match *self {
1253 GuestRequest::PutFile { .. } => "put_file",
1254 GuestRequest::GetFile { .. } => "get_file",
1255 GuestRequest::ExecuteCommand { .. } => "execute_command",
1256 GuestRequest::Shutdown { .. } => "shutdown",
1257 }
1258 }
1259}
1260
1261#[derive(Debug, Clone)]
1262pub struct GuestControlHandle {
1263 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1264}
1265
1266impl GuestControlHandle {
1267 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1268 self.inner.shutdown_with_epitaph(status.into())
1269 }
1270}
1271
1272impl fidl::endpoints::ControlHandle for GuestControlHandle {
1273 fn shutdown(&self) {
1274 self.inner.shutdown()
1275 }
1276
1277 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1278 self.inner.shutdown_with_epitaph(status)
1279 }
1280
1281 fn is_closed(&self) -> bool {
1282 self.inner.channel().is_closed()
1283 }
1284 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1285 self.inner.channel().on_closed()
1286 }
1287
1288 #[cfg(target_os = "fuchsia")]
1289 fn signal_peer(
1290 &self,
1291 clear_mask: zx::Signals,
1292 set_mask: zx::Signals,
1293 ) -> Result<(), zx_status::Status> {
1294 use fidl::Peered;
1295 self.inner.channel().signal_peer(clear_mask, set_mask)
1296 }
1297}
1298
1299impl GuestControlHandle {}
1300
1301#[must_use = "FIDL methods require a response to be sent"]
1302#[derive(Debug)]
1303pub struct GuestPutFileResponder {
1304 control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
1305 tx_id: u32,
1306}
1307
1308impl std::ops::Drop for GuestPutFileResponder {
1312 fn drop(&mut self) {
1313 self.control_handle.shutdown();
1314 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1316 }
1317}
1318
1319impl fidl::endpoints::Responder for GuestPutFileResponder {
1320 type ControlHandle = GuestControlHandle;
1321
1322 fn control_handle(&self) -> &GuestControlHandle {
1323 &self.control_handle
1324 }
1325
1326 fn drop_without_shutdown(mut self) {
1327 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1329 std::mem::forget(self);
1331 }
1332}
1333
1334impl GuestPutFileResponder {
1335 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1339 let _result = self.send_raw(status);
1340 if _result.is_err() {
1341 self.control_handle.shutdown();
1342 }
1343 self.drop_without_shutdown();
1344 _result
1345 }
1346
1347 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1349 let _result = self.send_raw(status);
1350 self.drop_without_shutdown();
1351 _result
1352 }
1353
1354 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1355 self.control_handle
1356 .inner
1357 .send::<fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileResponse>(
1358 (status,),
1359 self.tx_id,
1360 0x223bc20da4a7cddd,
1361 fidl::encoding::DynamicFlags::empty(),
1362 )
1363 }
1364}
1365
1366#[must_use = "FIDL methods require a response to be sent"]
1367#[derive(Debug)]
1368pub struct GuestGetFileResponder {
1369 control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
1370 tx_id: u32,
1371}
1372
1373impl std::ops::Drop for GuestGetFileResponder {
1377 fn drop(&mut self) {
1378 self.control_handle.shutdown();
1379 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1381 }
1382}
1383
1384impl fidl::endpoints::Responder for GuestGetFileResponder {
1385 type ControlHandle = GuestControlHandle;
1386
1387 fn control_handle(&self) -> &GuestControlHandle {
1388 &self.control_handle
1389 }
1390
1391 fn drop_without_shutdown(mut self) {
1392 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1394 std::mem::forget(self);
1396 }
1397}
1398
1399impl GuestGetFileResponder {
1400 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1404 let _result = self.send_raw(status);
1405 if _result.is_err() {
1406 self.control_handle.shutdown();
1407 }
1408 self.drop_without_shutdown();
1409 _result
1410 }
1411
1412 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1414 let _result = self.send_raw(status);
1415 self.drop_without_shutdown();
1416 _result
1417 }
1418
1419 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1420 self.control_handle
1421 .inner
1422 .send::<fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileResponse>(
1423 (status,),
1424 self.tx_id,
1425 0x7696bea472ca0f2d,
1426 fidl::encoding::DynamicFlags::empty(),
1427 )
1428 }
1429}
1430
1431#[must_use = "FIDL methods require a response to be sent"]
1432#[derive(Debug)]
1433pub struct GuestShutdownResponder {
1434 control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
1435 tx_id: u32,
1436}
1437
1438impl std::ops::Drop for GuestShutdownResponder {
1442 fn drop(&mut self) {
1443 self.control_handle.shutdown();
1444 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1446 }
1447}
1448
1449impl fidl::endpoints::Responder for GuestShutdownResponder {
1450 type ControlHandle = GuestControlHandle;
1451
1452 fn control_handle(&self) -> &GuestControlHandle {
1453 &self.control_handle
1454 }
1455
1456 fn drop_without_shutdown(mut self) {
1457 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1459 std::mem::forget(self);
1461 }
1462}
1463
1464impl GuestShutdownResponder {
1465 pub fn send(self) -> Result<(), fidl::Error> {
1469 let _result = self.send_raw();
1470 if _result.is_err() {
1471 self.control_handle.shutdown();
1472 }
1473 self.drop_without_shutdown();
1474 _result
1475 }
1476
1477 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1479 let _result = self.send_raw();
1480 self.drop_without_shutdown();
1481 _result
1482 }
1483
1484 fn send_raw(&self) -> Result<(), fidl::Error> {
1485 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1486 (),
1487 self.tx_id,
1488 0x287e71d61642d1cc,
1489 fidl::encoding::DynamicFlags::empty(),
1490 )
1491 }
1492}
1493
1494mod internal {
1495 use super::*;
1496
1497 impl fidl::encoding::ResourceTypeMarker for ControllerCreateGuestRequest {
1498 type Borrowed<'a> = &'a mut Self;
1499 fn take_or_borrow<'a>(
1500 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1501 ) -> Self::Borrowed<'a> {
1502 value
1503 }
1504 }
1505
1506 unsafe impl fidl::encoding::TypeMarker for ControllerCreateGuestRequest {
1507 type Owned = Self;
1508
1509 #[inline(always)]
1510 fn inline_align(_context: fidl::encoding::Context) -> usize {
1511 8
1512 }
1513
1514 #[inline(always)]
1515 fn inline_size(_context: fidl::encoding::Context) -> usize {
1516 32
1517 }
1518 }
1519
1520 unsafe impl
1521 fidl::encoding::Encode<
1522 ControllerCreateGuestRequest,
1523 fidl::encoding::DefaultFuchsiaResourceDialect,
1524 > for &mut ControllerCreateGuestRequest
1525 {
1526 #[inline]
1527 unsafe fn encode(
1528 self,
1529 encoder: &mut fidl::encoding::Encoder<
1530 '_,
1531 fidl::encoding::DefaultFuchsiaResourceDialect,
1532 >,
1533 offset: usize,
1534 _depth: fidl::encoding::Depth,
1535 ) -> fidl::Result<()> {
1536 encoder.debug_check_bounds::<ControllerCreateGuestRequest>(offset);
1537 fidl::encoding::Encode::<ControllerCreateGuestRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1539 (
1540 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1541 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.network),
1542 <fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
1543 ),
1544 encoder, offset, _depth
1545 )
1546 }
1547 }
1548 unsafe impl<
1549 T0: fidl::encoding::Encode<
1550 fidl::encoding::BoundedString<32>,
1551 fidl::encoding::DefaultFuchsiaResourceDialect,
1552 >,
1553 T1: fidl::encoding::Encode<
1554 fidl::encoding::Endpoint<
1555 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
1556 >,
1557 fidl::encoding::DefaultFuchsiaResourceDialect,
1558 >,
1559 T2: fidl::encoding::Encode<
1560 fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>,
1561 fidl::encoding::DefaultFuchsiaResourceDialect,
1562 >,
1563 >
1564 fidl::encoding::Encode<
1565 ControllerCreateGuestRequest,
1566 fidl::encoding::DefaultFuchsiaResourceDialect,
1567 > for (T0, T1, T2)
1568 {
1569 #[inline]
1570 unsafe fn encode(
1571 self,
1572 encoder: &mut fidl::encoding::Encoder<
1573 '_,
1574 fidl::encoding::DefaultFuchsiaResourceDialect,
1575 >,
1576 offset: usize,
1577 depth: fidl::encoding::Depth,
1578 ) -> fidl::Result<()> {
1579 encoder.debug_check_bounds::<ControllerCreateGuestRequest>(offset);
1580 unsafe {
1583 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1584 (ptr as *mut u64).write_unaligned(0);
1585 }
1586 self.0.encode(encoder, offset + 0, depth)?;
1588 self.1.encode(encoder, offset + 16, depth)?;
1589 self.2.encode(encoder, offset + 24, depth)?;
1590 Ok(())
1591 }
1592 }
1593
1594 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1595 for ControllerCreateGuestRequest
1596 {
1597 #[inline(always)]
1598 fn new_empty() -> Self {
1599 Self {
1600 name: fidl::new_empty!(
1601 fidl::encoding::BoundedString<32>,
1602 fidl::encoding::DefaultFuchsiaResourceDialect
1603 ),
1604 network: fidl::new_empty!(
1605 fidl::encoding::Endpoint<
1606 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
1607 >,
1608 fidl::encoding::DefaultFuchsiaResourceDialect
1609 ),
1610 mac: fidl::new_empty!(
1611 fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>,
1612 fidl::encoding::DefaultFuchsiaResourceDialect
1613 ),
1614 }
1615 }
1616
1617 #[inline]
1618 unsafe fn decode(
1619 &mut self,
1620 decoder: &mut fidl::encoding::Decoder<
1621 '_,
1622 fidl::encoding::DefaultFuchsiaResourceDialect,
1623 >,
1624 offset: usize,
1625 _depth: fidl::encoding::Depth,
1626 ) -> fidl::Result<()> {
1627 decoder.debug_check_bounds::<Self>(offset);
1628 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1630 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1631 let mask = 0xffffffff00000000u64;
1632 let maskedval = padval & mask;
1633 if maskedval != 0 {
1634 return Err(fidl::Error::NonZeroPadding {
1635 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1636 });
1637 }
1638 fidl::decode!(
1639 fidl::encoding::BoundedString<32>,
1640 fidl::encoding::DefaultFuchsiaResourceDialect,
1641 &mut self.name,
1642 decoder,
1643 offset + 0,
1644 _depth
1645 )?;
1646 fidl::decode!(
1647 fidl::encoding::Endpoint<
1648 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
1649 >,
1650 fidl::encoding::DefaultFuchsiaResourceDialect,
1651 &mut self.network,
1652 decoder,
1653 offset + 16,
1654 _depth
1655 )?;
1656 fidl::decode!(
1657 fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>,
1658 fidl::encoding::DefaultFuchsiaResourceDialect,
1659 &mut self.mac,
1660 decoder,
1661 offset + 24,
1662 _depth
1663 )?;
1664 Ok(())
1665 }
1666 }
1667
1668 impl fidl::encoding::ResourceTypeMarker for ControllerCreateGuestResponse {
1669 type Borrowed<'a> = &'a mut Self;
1670 fn take_or_borrow<'a>(
1671 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1672 ) -> Self::Borrowed<'a> {
1673 value
1674 }
1675 }
1676
1677 unsafe impl fidl::encoding::TypeMarker for ControllerCreateGuestResponse {
1678 type Owned = Self;
1679
1680 #[inline(always)]
1681 fn inline_align(_context: fidl::encoding::Context) -> usize {
1682 4
1683 }
1684
1685 #[inline(always)]
1686 fn inline_size(_context: fidl::encoding::Context) -> usize {
1687 4
1688 }
1689 }
1690
1691 unsafe impl
1692 fidl::encoding::Encode<
1693 ControllerCreateGuestResponse,
1694 fidl::encoding::DefaultFuchsiaResourceDialect,
1695 > for &mut ControllerCreateGuestResponse
1696 {
1697 #[inline]
1698 unsafe fn encode(
1699 self,
1700 encoder: &mut fidl::encoding::Encoder<
1701 '_,
1702 fidl::encoding::DefaultFuchsiaResourceDialect,
1703 >,
1704 offset: usize,
1705 _depth: fidl::encoding::Depth,
1706 ) -> fidl::Result<()> {
1707 encoder.debug_check_bounds::<ControllerCreateGuestResponse>(offset);
1708 fidl::encoding::Encode::<ControllerCreateGuestResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1710 (
1711 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.s),
1712 ),
1713 encoder, offset, _depth
1714 )
1715 }
1716 }
1717 unsafe impl<
1718 T0: fidl::encoding::Encode<
1719 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<GuestMarker>>,
1720 fidl::encoding::DefaultFuchsiaResourceDialect,
1721 >,
1722 >
1723 fidl::encoding::Encode<
1724 ControllerCreateGuestResponse,
1725 fidl::encoding::DefaultFuchsiaResourceDialect,
1726 > for (T0,)
1727 {
1728 #[inline]
1729 unsafe fn encode(
1730 self,
1731 encoder: &mut fidl::encoding::Encoder<
1732 '_,
1733 fidl::encoding::DefaultFuchsiaResourceDialect,
1734 >,
1735 offset: usize,
1736 depth: fidl::encoding::Depth,
1737 ) -> fidl::Result<()> {
1738 encoder.debug_check_bounds::<ControllerCreateGuestResponse>(offset);
1739 self.0.encode(encoder, offset + 0, depth)?;
1743 Ok(())
1744 }
1745 }
1746
1747 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1748 for ControllerCreateGuestResponse
1749 {
1750 #[inline(always)]
1751 fn new_empty() -> Self {
1752 Self {
1753 s: fidl::new_empty!(
1754 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<GuestMarker>>,
1755 fidl::encoding::DefaultFuchsiaResourceDialect
1756 ),
1757 }
1758 }
1759
1760 #[inline]
1761 unsafe fn decode(
1762 &mut self,
1763 decoder: &mut fidl::encoding::Decoder<
1764 '_,
1765 fidl::encoding::DefaultFuchsiaResourceDialect,
1766 >,
1767 offset: usize,
1768 _depth: fidl::encoding::Depth,
1769 ) -> fidl::Result<()> {
1770 decoder.debug_check_bounds::<Self>(offset);
1771 fidl::decode!(
1773 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<GuestMarker>>,
1774 fidl::encoding::DefaultFuchsiaResourceDialect,
1775 &mut self.s,
1776 decoder,
1777 offset + 0,
1778 _depth
1779 )?;
1780 Ok(())
1781 }
1782 }
1783}