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 fidl::endpoints::ControlHandle for ControllerControlHandle {
468 fn shutdown(&self) {
469 self.inner.shutdown()
470 }
471
472 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
473 self.inner.shutdown_with_epitaph(status)
474 }
475
476 fn is_closed(&self) -> bool {
477 self.inner.channel().is_closed()
478 }
479 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
480 self.inner.channel().on_closed()
481 }
482
483 #[cfg(target_os = "fuchsia")]
484 fn signal_peer(
485 &self,
486 clear_mask: zx::Signals,
487 set_mask: zx::Signals,
488 ) -> Result<(), zx_status::Status> {
489 use fidl::Peered;
490 self.inner.channel().signal_peer(clear_mask, set_mask)
491 }
492}
493
494impl ControllerControlHandle {}
495
496#[must_use = "FIDL methods require a response to be sent"]
497#[derive(Debug)]
498pub struct ControllerCreateGuestResponder {
499 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
500 tx_id: u32,
501}
502
503impl std::ops::Drop for ControllerCreateGuestResponder {
507 fn drop(&mut self) {
508 self.control_handle.shutdown();
509 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
511 }
512}
513
514impl fidl::endpoints::Responder for ControllerCreateGuestResponder {
515 type ControlHandle = ControllerControlHandle;
516
517 fn control_handle(&self) -> &ControllerControlHandle {
518 &self.control_handle
519 }
520
521 fn drop_without_shutdown(mut self) {
522 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
524 std::mem::forget(self);
526 }
527}
528
529impl ControllerCreateGuestResponder {
530 pub fn send(
534 self,
535 mut result: Result<fidl::endpoints::ClientEnd<GuestMarker>, ControllerCreateGuestError>,
536 ) -> Result<(), fidl::Error> {
537 let _result = self.send_raw(result);
538 if _result.is_err() {
539 self.control_handle.shutdown();
540 }
541 self.drop_without_shutdown();
542 _result
543 }
544
545 pub fn send_no_shutdown_on_err(
547 self,
548 mut result: Result<fidl::endpoints::ClientEnd<GuestMarker>, ControllerCreateGuestError>,
549 ) -> Result<(), fidl::Error> {
550 let _result = self.send_raw(result);
551 self.drop_without_shutdown();
552 _result
553 }
554
555 fn send_raw(
556 &self,
557 mut result: Result<fidl::endpoints::ClientEnd<GuestMarker>, ControllerCreateGuestError>,
558 ) -> Result<(), fidl::Error> {
559 self.control_handle.inner.send::<fidl::encoding::ResultType<
560 ControllerCreateGuestResponse,
561 ControllerCreateGuestError,
562 >>(
563 result.map(|s| (s,)),
564 self.tx_id,
565 0x5c49cf5272f818c0,
566 fidl::encoding::DynamicFlags::empty(),
567 )
568 }
569}
570
571#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
572pub struct GuestMarker;
573
574impl fidl::endpoints::ProtocolMarker for GuestMarker {
575 type Proxy = GuestProxy;
576 type RequestStream = GuestRequestStream;
577 #[cfg(target_os = "fuchsia")]
578 type SynchronousProxy = GuestSynchronousProxy;
579
580 const DEBUG_NAME: &'static str = "(anonymous) Guest";
581}
582
583pub trait GuestProxyInterface: Send + Sync {
584 type PutFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
585 fn r#put_file(
586 &self,
587 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
588 remote_path: &str,
589 ) -> Self::PutFileResponseFut;
590 type GetFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
591 fn r#get_file(
592 &self,
593 remote_path: &str,
594 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
595 ) -> Self::GetFileResponseFut;
596 fn r#execute_command(
597 &self,
598 command: &str,
599 env: &[fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable],
600 stdin: Option<fidl::Socket>,
601 stdout: Option<fidl::Socket>,
602 stderr: Option<fidl::Socket>,
603 command_listener: fidl::endpoints::ServerEnd<
604 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
605 >,
606 ) -> Result<(), fidl::Error>;
607 type ShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
608 fn r#shutdown(&self) -> Self::ShutdownResponseFut;
609}
610#[derive(Debug)]
611#[cfg(target_os = "fuchsia")]
612pub struct GuestSynchronousProxy {
613 client: fidl::client::sync::Client,
614}
615
616#[cfg(target_os = "fuchsia")]
617impl fidl::endpoints::SynchronousProxy for GuestSynchronousProxy {
618 type Proxy = GuestProxy;
619 type Protocol = GuestMarker;
620
621 fn from_channel(inner: fidl::Channel) -> Self {
622 Self::new(inner)
623 }
624
625 fn into_channel(self) -> fidl::Channel {
626 self.client.into_channel()
627 }
628
629 fn as_channel(&self) -> &fidl::Channel {
630 self.client.as_channel()
631 }
632}
633
634#[cfg(target_os = "fuchsia")]
635impl GuestSynchronousProxy {
636 pub fn new(channel: fidl::Channel) -> Self {
637 Self { client: fidl::client::sync::Client::new(channel) }
638 }
639
640 pub fn into_channel(self) -> fidl::Channel {
641 self.client.into_channel()
642 }
643
644 pub fn wait_for_event(
647 &self,
648 deadline: zx::MonotonicInstant,
649 ) -> Result<GuestEvent, fidl::Error> {
650 GuestEvent::decode(self.client.wait_for_event::<GuestMarker>(deadline)?)
651 }
652
653 pub fn r#put_file(
656 &self,
657 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
658 mut remote_path: &str,
659 ___deadline: zx::MonotonicInstant,
660 ) -> Result<i32, fidl::Error> {
661 let _response = self.client.send_query::<
662 fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileRequest,
663 fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileResponse,
664 GuestMarker,
665 >(
666 (local_file, remote_path,),
667 0x223bc20da4a7cddd,
668 fidl::encoding::DynamicFlags::empty(),
669 ___deadline,
670 )?;
671 Ok(_response.status)
672 }
673
674 pub fn r#get_file(
677 &self,
678 mut remote_path: &str,
679 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
680 ___deadline: zx::MonotonicInstant,
681 ) -> Result<i32, fidl::Error> {
682 let _response = self.client.send_query::<
683 fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileRequest,
684 fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileResponse,
685 GuestMarker,
686 >(
687 (remote_path, local_file,),
688 0x7696bea472ca0f2d,
689 fidl::encoding::DynamicFlags::empty(),
690 ___deadline,
691 )?;
692 Ok(_response.status)
693 }
694
695 pub fn r#execute_command(
698 &self,
699 mut command: &str,
700 mut env: &[fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable],
701 mut stdin: Option<fidl::Socket>,
702 mut stdout: Option<fidl::Socket>,
703 mut stderr: Option<fidl::Socket>,
704 mut command_listener: fidl::endpoints::ServerEnd<
705 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
706 >,
707 ) -> Result<(), fidl::Error> {
708 self.client.send::<fidl_fuchsia_virtualization_guest_interaction::InteractionExecuteCommandRequest>(
709 (command, env, stdin, stdout, stderr, command_listener,),
710 0x612641220a1556d8,
711 fidl::encoding::DynamicFlags::empty(),
712 )
713 }
714
715 pub fn r#shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
718 let _response = self
719 .client
720 .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload, GuestMarker>(
721 (),
722 0x287e71d61642d1cc,
723 fidl::encoding::DynamicFlags::empty(),
724 ___deadline,
725 )?;
726 Ok(_response)
727 }
728}
729
730#[cfg(target_os = "fuchsia")]
731impl From<GuestSynchronousProxy> for zx::NullableHandle {
732 fn from(value: GuestSynchronousProxy) -> Self {
733 value.into_channel().into()
734 }
735}
736
737#[cfg(target_os = "fuchsia")]
738impl From<fidl::Channel> for GuestSynchronousProxy {
739 fn from(value: fidl::Channel) -> Self {
740 Self::new(value)
741 }
742}
743
744#[cfg(target_os = "fuchsia")]
745impl fidl::endpoints::FromClient for GuestSynchronousProxy {
746 type Protocol = GuestMarker;
747
748 fn from_client(value: fidl::endpoints::ClientEnd<GuestMarker>) -> Self {
749 Self::new(value.into_channel())
750 }
751}
752
753#[derive(Debug, Clone)]
754pub struct GuestProxy {
755 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
756}
757
758impl fidl::endpoints::Proxy for GuestProxy {
759 type Protocol = GuestMarker;
760
761 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
762 Self::new(inner)
763 }
764
765 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
766 self.client.into_channel().map_err(|client| Self { client })
767 }
768
769 fn as_channel(&self) -> &::fidl::AsyncChannel {
770 self.client.as_channel()
771 }
772}
773
774impl GuestProxy {
775 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
777 let protocol_name = <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
778 Self { client: fidl::client::Client::new(channel, protocol_name) }
779 }
780
781 pub fn take_event_stream(&self) -> GuestEventStream {
787 GuestEventStream { event_receiver: self.client.take_event_receiver() }
788 }
789
790 pub fn r#put_file(
793 &self,
794 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
795 mut remote_path: &str,
796 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
797 GuestProxyInterface::r#put_file(self, local_file, remote_path)
798 }
799
800 pub fn r#get_file(
803 &self,
804 mut remote_path: &str,
805 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
806 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
807 GuestProxyInterface::r#get_file(self, remote_path, local_file)
808 }
809
810 pub fn r#execute_command(
813 &self,
814 mut command: &str,
815 mut env: &[fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable],
816 mut stdin: Option<fidl::Socket>,
817 mut stdout: Option<fidl::Socket>,
818 mut stderr: Option<fidl::Socket>,
819 mut command_listener: fidl::endpoints::ServerEnd<
820 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
821 >,
822 ) -> Result<(), fidl::Error> {
823 GuestProxyInterface::r#execute_command(
824 self,
825 command,
826 env,
827 stdin,
828 stdout,
829 stderr,
830 command_listener,
831 )
832 }
833
834 pub fn r#shutdown(
837 &self,
838 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
839 GuestProxyInterface::r#shutdown(self)
840 }
841}
842
843impl GuestProxyInterface for GuestProxy {
844 type PutFileResponseFut =
845 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
846 fn r#put_file(
847 &self,
848 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
849 mut remote_path: &str,
850 ) -> Self::PutFileResponseFut {
851 fn _decode(
852 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
853 ) -> Result<i32, fidl::Error> {
854 let _response = fidl::client::decode_transaction_body::<
855 fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileResponse,
856 fidl::encoding::DefaultFuchsiaResourceDialect,
857 0x223bc20da4a7cddd,
858 >(_buf?)?;
859 Ok(_response.status)
860 }
861 self.client.send_query_and_decode::<
862 fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileRequest,
863 i32,
864 >(
865 (local_file, remote_path,),
866 0x223bc20da4a7cddd,
867 fidl::encoding::DynamicFlags::empty(),
868 _decode,
869 )
870 }
871
872 type GetFileResponseFut =
873 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
874 fn r#get_file(
875 &self,
876 mut remote_path: &str,
877 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
878 ) -> Self::GetFileResponseFut {
879 fn _decode(
880 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
881 ) -> Result<i32, fidl::Error> {
882 let _response = fidl::client::decode_transaction_body::<
883 fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileResponse,
884 fidl::encoding::DefaultFuchsiaResourceDialect,
885 0x7696bea472ca0f2d,
886 >(_buf?)?;
887 Ok(_response.status)
888 }
889 self.client.send_query_and_decode::<
890 fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileRequest,
891 i32,
892 >(
893 (remote_path, local_file,),
894 0x7696bea472ca0f2d,
895 fidl::encoding::DynamicFlags::empty(),
896 _decode,
897 )
898 }
899
900 fn r#execute_command(
901 &self,
902 mut command: &str,
903 mut env: &[fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable],
904 mut stdin: Option<fidl::Socket>,
905 mut stdout: Option<fidl::Socket>,
906 mut stderr: Option<fidl::Socket>,
907 mut command_listener: fidl::endpoints::ServerEnd<
908 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
909 >,
910 ) -> Result<(), fidl::Error> {
911 self.client.send::<fidl_fuchsia_virtualization_guest_interaction::InteractionExecuteCommandRequest>(
912 (command, env, stdin, stdout, stderr, command_listener,),
913 0x612641220a1556d8,
914 fidl::encoding::DynamicFlags::empty(),
915 )
916 }
917
918 type ShutdownResponseFut =
919 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
920 fn r#shutdown(&self) -> Self::ShutdownResponseFut {
921 fn _decode(
922 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
923 ) -> Result<(), fidl::Error> {
924 let _response = fidl::client::decode_transaction_body::<
925 fidl::encoding::EmptyPayload,
926 fidl::encoding::DefaultFuchsiaResourceDialect,
927 0x287e71d61642d1cc,
928 >(_buf?)?;
929 Ok(_response)
930 }
931 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
932 (),
933 0x287e71d61642d1cc,
934 fidl::encoding::DynamicFlags::empty(),
935 _decode,
936 )
937 }
938}
939
940pub struct GuestEventStream {
941 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
942}
943
944impl std::marker::Unpin for GuestEventStream {}
945
946impl futures::stream::FusedStream for GuestEventStream {
947 fn is_terminated(&self) -> bool {
948 self.event_receiver.is_terminated()
949 }
950}
951
952impl futures::Stream for GuestEventStream {
953 type Item = Result<GuestEvent, fidl::Error>;
954
955 fn poll_next(
956 mut self: std::pin::Pin<&mut Self>,
957 cx: &mut std::task::Context<'_>,
958 ) -> std::task::Poll<Option<Self::Item>> {
959 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
960 &mut self.event_receiver,
961 cx
962 )?) {
963 Some(buf) => std::task::Poll::Ready(Some(GuestEvent::decode(buf))),
964 None => std::task::Poll::Ready(None),
965 }
966 }
967}
968
969#[derive(Debug)]
970pub enum GuestEvent {}
971
972impl GuestEvent {
973 fn decode(
975 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
976 ) -> Result<GuestEvent, fidl::Error> {
977 let (bytes, _handles) = buf.split_mut();
978 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
979 debug_assert_eq!(tx_header.tx_id, 0);
980 match tx_header.ordinal {
981 _ => Err(fidl::Error::UnknownOrdinal {
982 ordinal: tx_header.ordinal,
983 protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
984 }),
985 }
986 }
987}
988
989pub struct GuestRequestStream {
991 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
992 is_terminated: bool,
993}
994
995impl std::marker::Unpin for GuestRequestStream {}
996
997impl futures::stream::FusedStream for GuestRequestStream {
998 fn is_terminated(&self) -> bool {
999 self.is_terminated
1000 }
1001}
1002
1003impl fidl::endpoints::RequestStream for GuestRequestStream {
1004 type Protocol = GuestMarker;
1005 type ControlHandle = GuestControlHandle;
1006
1007 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1008 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1009 }
1010
1011 fn control_handle(&self) -> Self::ControlHandle {
1012 GuestControlHandle { inner: self.inner.clone() }
1013 }
1014
1015 fn into_inner(
1016 self,
1017 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1018 {
1019 (self.inner, self.is_terminated)
1020 }
1021
1022 fn from_inner(
1023 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1024 is_terminated: bool,
1025 ) -> Self {
1026 Self { inner, is_terminated }
1027 }
1028}
1029
1030impl futures::Stream for GuestRequestStream {
1031 type Item = Result<GuestRequest, fidl::Error>;
1032
1033 fn poll_next(
1034 mut self: std::pin::Pin<&mut Self>,
1035 cx: &mut std::task::Context<'_>,
1036 ) -> std::task::Poll<Option<Self::Item>> {
1037 let this = &mut *self;
1038 if this.inner.check_shutdown(cx) {
1039 this.is_terminated = true;
1040 return std::task::Poll::Ready(None);
1041 }
1042 if this.is_terminated {
1043 panic!("polled GuestRequestStream after completion");
1044 }
1045 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1046 |bytes, handles| {
1047 match this.inner.channel().read_etc(cx, bytes, handles) {
1048 std::task::Poll::Ready(Ok(())) => {}
1049 std::task::Poll::Pending => return std::task::Poll::Pending,
1050 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1051 this.is_terminated = true;
1052 return std::task::Poll::Ready(None);
1053 }
1054 std::task::Poll::Ready(Err(e)) => {
1055 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1056 e.into(),
1057 ))));
1058 }
1059 }
1060
1061 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1063
1064 std::task::Poll::Ready(Some(match header.ordinal {
1065 0x223bc20da4a7cddd => {
1066 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1067 let mut req = fidl::new_empty!(fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1068 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileRequest>(&header, _body_bytes, handles, &mut req)?;
1069 let control_handle = GuestControlHandle { inner: this.inner.clone() };
1070 Ok(GuestRequest::PutFile {
1071 local_file: req.local_file,
1072 remote_path: req.remote_path,
1073
1074 responder: GuestPutFileResponder {
1075 control_handle: std::mem::ManuallyDrop::new(control_handle),
1076 tx_id: header.tx_id,
1077 },
1078 })
1079 }
1080 0x7696bea472ca0f2d => {
1081 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1082 let mut req = fidl::new_empty!(fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1083 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileRequest>(&header, _body_bytes, handles, &mut req)?;
1084 let control_handle = GuestControlHandle { inner: this.inner.clone() };
1085 Ok(GuestRequest::GetFile {
1086 remote_path: req.remote_path,
1087 local_file: req.local_file,
1088
1089 responder: GuestGetFileResponder {
1090 control_handle: std::mem::ManuallyDrop::new(control_handle),
1091 tx_id: header.tx_id,
1092 },
1093 })
1094 }
1095 0x612641220a1556d8 => {
1096 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1097 let mut req = fidl::new_empty!(fidl_fuchsia_virtualization_guest_interaction::InteractionExecuteCommandRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1098 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_virtualization_guest_interaction::InteractionExecuteCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1099 let control_handle = GuestControlHandle { inner: this.inner.clone() };
1100 Ok(GuestRequest::ExecuteCommand {
1101 command: req.command,
1102 env: req.env,
1103 stdin: req.stdin,
1104 stdout: req.stdout,
1105 stderr: req.stderr,
1106 command_listener: req.command_listener,
1107
1108 control_handle,
1109 })
1110 }
1111 0x287e71d61642d1cc => {
1112 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1113 let mut req = fidl::new_empty!(
1114 fidl::encoding::EmptyPayload,
1115 fidl::encoding::DefaultFuchsiaResourceDialect
1116 );
1117 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1118 let control_handle = GuestControlHandle { inner: this.inner.clone() };
1119 Ok(GuestRequest::Shutdown {
1120 responder: GuestShutdownResponder {
1121 control_handle: std::mem::ManuallyDrop::new(control_handle),
1122 tx_id: header.tx_id,
1123 },
1124 })
1125 }
1126 _ => Err(fidl::Error::UnknownOrdinal {
1127 ordinal: header.ordinal,
1128 protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1129 }),
1130 }))
1131 },
1132 )
1133 }
1134}
1135
1136#[derive(Debug)]
1145pub enum GuestRequest {
1146 PutFile {
1149 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1150 remote_path: String,
1151 responder: GuestPutFileResponder,
1152 },
1153 GetFile {
1156 remote_path: String,
1157 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1158 responder: GuestGetFileResponder,
1159 },
1160 ExecuteCommand {
1163 command: String,
1164 env: Vec<fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable>,
1165 stdin: Option<fidl::Socket>,
1166 stdout: Option<fidl::Socket>,
1167 stderr: Option<fidl::Socket>,
1168 command_listener: fidl::endpoints::ServerEnd<
1169 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
1170 >,
1171 control_handle: GuestControlHandle,
1172 },
1173 Shutdown { responder: GuestShutdownResponder },
1176}
1177
1178impl GuestRequest {
1179 #[allow(irrefutable_let_patterns)]
1180 pub fn into_put_file(
1181 self,
1182 ) -> Option<(
1183 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1184 String,
1185 GuestPutFileResponder,
1186 )> {
1187 if let GuestRequest::PutFile { local_file, remote_path, responder } = self {
1188 Some((local_file, remote_path, responder))
1189 } else {
1190 None
1191 }
1192 }
1193
1194 #[allow(irrefutable_let_patterns)]
1195 pub fn into_get_file(
1196 self,
1197 ) -> Option<(
1198 String,
1199 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1200 GuestGetFileResponder,
1201 )> {
1202 if let GuestRequest::GetFile { remote_path, local_file, responder } = self {
1203 Some((remote_path, local_file, responder))
1204 } else {
1205 None
1206 }
1207 }
1208
1209 #[allow(irrefutable_let_patterns)]
1210 pub fn into_execute_command(
1211 self,
1212 ) -> Option<(
1213 String,
1214 Vec<fidl_fuchsia_virtualization_guest_interaction::EnvironmentVariable>,
1215 Option<fidl::Socket>,
1216 Option<fidl::Socket>,
1217 Option<fidl::Socket>,
1218 fidl::endpoints::ServerEnd<
1219 fidl_fuchsia_virtualization_guest_interaction::CommandListenerMarker,
1220 >,
1221 GuestControlHandle,
1222 )> {
1223 if let GuestRequest::ExecuteCommand {
1224 command,
1225 env,
1226 stdin,
1227 stdout,
1228 stderr,
1229 command_listener,
1230 control_handle,
1231 } = self
1232 {
1233 Some((command, env, stdin, stdout, stderr, command_listener, control_handle))
1234 } else {
1235 None
1236 }
1237 }
1238
1239 #[allow(irrefutable_let_patterns)]
1240 pub fn into_shutdown(self) -> Option<(GuestShutdownResponder)> {
1241 if let GuestRequest::Shutdown { responder } = self { Some((responder)) } else { None }
1242 }
1243
1244 pub fn method_name(&self) -> &'static str {
1246 match *self {
1247 GuestRequest::PutFile { .. } => "put_file",
1248 GuestRequest::GetFile { .. } => "get_file",
1249 GuestRequest::ExecuteCommand { .. } => "execute_command",
1250 GuestRequest::Shutdown { .. } => "shutdown",
1251 }
1252 }
1253}
1254
1255#[derive(Debug, Clone)]
1256pub struct GuestControlHandle {
1257 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1258}
1259
1260impl fidl::endpoints::ControlHandle for GuestControlHandle {
1261 fn shutdown(&self) {
1262 self.inner.shutdown()
1263 }
1264
1265 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1266 self.inner.shutdown_with_epitaph(status)
1267 }
1268
1269 fn is_closed(&self) -> bool {
1270 self.inner.channel().is_closed()
1271 }
1272 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1273 self.inner.channel().on_closed()
1274 }
1275
1276 #[cfg(target_os = "fuchsia")]
1277 fn signal_peer(
1278 &self,
1279 clear_mask: zx::Signals,
1280 set_mask: zx::Signals,
1281 ) -> Result<(), zx_status::Status> {
1282 use fidl::Peered;
1283 self.inner.channel().signal_peer(clear_mask, set_mask)
1284 }
1285}
1286
1287impl GuestControlHandle {}
1288
1289#[must_use = "FIDL methods require a response to be sent"]
1290#[derive(Debug)]
1291pub struct GuestPutFileResponder {
1292 control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
1293 tx_id: u32,
1294}
1295
1296impl std::ops::Drop for GuestPutFileResponder {
1300 fn drop(&mut self) {
1301 self.control_handle.shutdown();
1302 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1304 }
1305}
1306
1307impl fidl::endpoints::Responder for GuestPutFileResponder {
1308 type ControlHandle = GuestControlHandle;
1309
1310 fn control_handle(&self) -> &GuestControlHandle {
1311 &self.control_handle
1312 }
1313
1314 fn drop_without_shutdown(mut self) {
1315 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1317 std::mem::forget(self);
1319 }
1320}
1321
1322impl GuestPutFileResponder {
1323 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1327 let _result = self.send_raw(status);
1328 if _result.is_err() {
1329 self.control_handle.shutdown();
1330 }
1331 self.drop_without_shutdown();
1332 _result
1333 }
1334
1335 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1337 let _result = self.send_raw(status);
1338 self.drop_without_shutdown();
1339 _result
1340 }
1341
1342 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1343 self.control_handle
1344 .inner
1345 .send::<fidl_fuchsia_virtualization_guest_interaction::InteractionPutFileResponse>(
1346 (status,),
1347 self.tx_id,
1348 0x223bc20da4a7cddd,
1349 fidl::encoding::DynamicFlags::empty(),
1350 )
1351 }
1352}
1353
1354#[must_use = "FIDL methods require a response to be sent"]
1355#[derive(Debug)]
1356pub struct GuestGetFileResponder {
1357 control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
1358 tx_id: u32,
1359}
1360
1361impl std::ops::Drop for GuestGetFileResponder {
1365 fn drop(&mut self) {
1366 self.control_handle.shutdown();
1367 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1369 }
1370}
1371
1372impl fidl::endpoints::Responder for GuestGetFileResponder {
1373 type ControlHandle = GuestControlHandle;
1374
1375 fn control_handle(&self) -> &GuestControlHandle {
1376 &self.control_handle
1377 }
1378
1379 fn drop_without_shutdown(mut self) {
1380 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1382 std::mem::forget(self);
1384 }
1385}
1386
1387impl GuestGetFileResponder {
1388 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1392 let _result = self.send_raw(status);
1393 if _result.is_err() {
1394 self.control_handle.shutdown();
1395 }
1396 self.drop_without_shutdown();
1397 _result
1398 }
1399
1400 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1402 let _result = self.send_raw(status);
1403 self.drop_without_shutdown();
1404 _result
1405 }
1406
1407 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1408 self.control_handle
1409 .inner
1410 .send::<fidl_fuchsia_virtualization_guest_interaction::InteractionGetFileResponse>(
1411 (status,),
1412 self.tx_id,
1413 0x7696bea472ca0f2d,
1414 fidl::encoding::DynamicFlags::empty(),
1415 )
1416 }
1417}
1418
1419#[must_use = "FIDL methods require a response to be sent"]
1420#[derive(Debug)]
1421pub struct GuestShutdownResponder {
1422 control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
1423 tx_id: u32,
1424}
1425
1426impl std::ops::Drop for GuestShutdownResponder {
1430 fn drop(&mut self) {
1431 self.control_handle.shutdown();
1432 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1434 }
1435}
1436
1437impl fidl::endpoints::Responder for GuestShutdownResponder {
1438 type ControlHandle = GuestControlHandle;
1439
1440 fn control_handle(&self) -> &GuestControlHandle {
1441 &self.control_handle
1442 }
1443
1444 fn drop_without_shutdown(mut self) {
1445 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1447 std::mem::forget(self);
1449 }
1450}
1451
1452impl GuestShutdownResponder {
1453 pub fn send(self) -> Result<(), fidl::Error> {
1457 let _result = self.send_raw();
1458 if _result.is_err() {
1459 self.control_handle.shutdown();
1460 }
1461 self.drop_without_shutdown();
1462 _result
1463 }
1464
1465 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1467 let _result = self.send_raw();
1468 self.drop_without_shutdown();
1469 _result
1470 }
1471
1472 fn send_raw(&self) -> Result<(), fidl::Error> {
1473 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1474 (),
1475 self.tx_id,
1476 0x287e71d61642d1cc,
1477 fidl::encoding::DynamicFlags::empty(),
1478 )
1479 }
1480}
1481
1482mod internal {
1483 use super::*;
1484
1485 impl fidl::encoding::ResourceTypeMarker for ControllerCreateGuestRequest {
1486 type Borrowed<'a> = &'a mut Self;
1487 fn take_or_borrow<'a>(
1488 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1489 ) -> Self::Borrowed<'a> {
1490 value
1491 }
1492 }
1493
1494 unsafe impl fidl::encoding::TypeMarker for ControllerCreateGuestRequest {
1495 type Owned = Self;
1496
1497 #[inline(always)]
1498 fn inline_align(_context: fidl::encoding::Context) -> usize {
1499 8
1500 }
1501
1502 #[inline(always)]
1503 fn inline_size(_context: fidl::encoding::Context) -> usize {
1504 32
1505 }
1506 }
1507
1508 unsafe impl
1509 fidl::encoding::Encode<
1510 ControllerCreateGuestRequest,
1511 fidl::encoding::DefaultFuchsiaResourceDialect,
1512 > for &mut ControllerCreateGuestRequest
1513 {
1514 #[inline]
1515 unsafe fn encode(
1516 self,
1517 encoder: &mut fidl::encoding::Encoder<
1518 '_,
1519 fidl::encoding::DefaultFuchsiaResourceDialect,
1520 >,
1521 offset: usize,
1522 _depth: fidl::encoding::Depth,
1523 ) -> fidl::Result<()> {
1524 encoder.debug_check_bounds::<ControllerCreateGuestRequest>(offset);
1525 fidl::encoding::Encode::<ControllerCreateGuestRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1527 (
1528 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1529 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.network),
1530 <fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
1531 ),
1532 encoder, offset, _depth
1533 )
1534 }
1535 }
1536 unsafe impl<
1537 T0: fidl::encoding::Encode<
1538 fidl::encoding::BoundedString<32>,
1539 fidl::encoding::DefaultFuchsiaResourceDialect,
1540 >,
1541 T1: fidl::encoding::Encode<
1542 fidl::encoding::Endpoint<
1543 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
1544 >,
1545 fidl::encoding::DefaultFuchsiaResourceDialect,
1546 >,
1547 T2: fidl::encoding::Encode<
1548 fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>,
1549 fidl::encoding::DefaultFuchsiaResourceDialect,
1550 >,
1551 >
1552 fidl::encoding::Encode<
1553 ControllerCreateGuestRequest,
1554 fidl::encoding::DefaultFuchsiaResourceDialect,
1555 > for (T0, T1, T2)
1556 {
1557 #[inline]
1558 unsafe fn encode(
1559 self,
1560 encoder: &mut fidl::encoding::Encoder<
1561 '_,
1562 fidl::encoding::DefaultFuchsiaResourceDialect,
1563 >,
1564 offset: usize,
1565 depth: fidl::encoding::Depth,
1566 ) -> fidl::Result<()> {
1567 encoder.debug_check_bounds::<ControllerCreateGuestRequest>(offset);
1568 unsafe {
1571 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1572 (ptr as *mut u64).write_unaligned(0);
1573 }
1574 self.0.encode(encoder, offset + 0, depth)?;
1576 self.1.encode(encoder, offset + 16, depth)?;
1577 self.2.encode(encoder, offset + 24, depth)?;
1578 Ok(())
1579 }
1580 }
1581
1582 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1583 for ControllerCreateGuestRequest
1584 {
1585 #[inline(always)]
1586 fn new_empty() -> Self {
1587 Self {
1588 name: fidl::new_empty!(
1589 fidl::encoding::BoundedString<32>,
1590 fidl::encoding::DefaultFuchsiaResourceDialect
1591 ),
1592 network: fidl::new_empty!(
1593 fidl::encoding::Endpoint<
1594 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
1595 >,
1596 fidl::encoding::DefaultFuchsiaResourceDialect
1597 ),
1598 mac: fidl::new_empty!(
1599 fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>,
1600 fidl::encoding::DefaultFuchsiaResourceDialect
1601 ),
1602 }
1603 }
1604
1605 #[inline]
1606 unsafe fn decode(
1607 &mut self,
1608 decoder: &mut fidl::encoding::Decoder<
1609 '_,
1610 fidl::encoding::DefaultFuchsiaResourceDialect,
1611 >,
1612 offset: usize,
1613 _depth: fidl::encoding::Depth,
1614 ) -> fidl::Result<()> {
1615 decoder.debug_check_bounds::<Self>(offset);
1616 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1618 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1619 let mask = 0xffffffff00000000u64;
1620 let maskedval = padval & mask;
1621 if maskedval != 0 {
1622 return Err(fidl::Error::NonZeroPadding {
1623 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1624 });
1625 }
1626 fidl::decode!(
1627 fidl::encoding::BoundedString<32>,
1628 fidl::encoding::DefaultFuchsiaResourceDialect,
1629 &mut self.name,
1630 decoder,
1631 offset + 0,
1632 _depth
1633 )?;
1634 fidl::decode!(
1635 fidl::encoding::Endpoint<
1636 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::NetworkMarker>,
1637 >,
1638 fidl::encoding::DefaultFuchsiaResourceDialect,
1639 &mut self.network,
1640 decoder,
1641 offset + 16,
1642 _depth
1643 )?;
1644 fidl::decode!(
1645 fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>,
1646 fidl::encoding::DefaultFuchsiaResourceDialect,
1647 &mut self.mac,
1648 decoder,
1649 offset + 24,
1650 _depth
1651 )?;
1652 Ok(())
1653 }
1654 }
1655
1656 impl fidl::encoding::ResourceTypeMarker for ControllerCreateGuestResponse {
1657 type Borrowed<'a> = &'a mut Self;
1658 fn take_or_borrow<'a>(
1659 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1660 ) -> Self::Borrowed<'a> {
1661 value
1662 }
1663 }
1664
1665 unsafe impl fidl::encoding::TypeMarker for ControllerCreateGuestResponse {
1666 type Owned = Self;
1667
1668 #[inline(always)]
1669 fn inline_align(_context: fidl::encoding::Context) -> usize {
1670 4
1671 }
1672
1673 #[inline(always)]
1674 fn inline_size(_context: fidl::encoding::Context) -> usize {
1675 4
1676 }
1677 }
1678
1679 unsafe impl
1680 fidl::encoding::Encode<
1681 ControllerCreateGuestResponse,
1682 fidl::encoding::DefaultFuchsiaResourceDialect,
1683 > for &mut ControllerCreateGuestResponse
1684 {
1685 #[inline]
1686 unsafe fn encode(
1687 self,
1688 encoder: &mut fidl::encoding::Encoder<
1689 '_,
1690 fidl::encoding::DefaultFuchsiaResourceDialect,
1691 >,
1692 offset: usize,
1693 _depth: fidl::encoding::Depth,
1694 ) -> fidl::Result<()> {
1695 encoder.debug_check_bounds::<ControllerCreateGuestResponse>(offset);
1696 fidl::encoding::Encode::<ControllerCreateGuestResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1698 (
1699 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.s),
1700 ),
1701 encoder, offset, _depth
1702 )
1703 }
1704 }
1705 unsafe impl<
1706 T0: fidl::encoding::Encode<
1707 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<GuestMarker>>,
1708 fidl::encoding::DefaultFuchsiaResourceDialect,
1709 >,
1710 >
1711 fidl::encoding::Encode<
1712 ControllerCreateGuestResponse,
1713 fidl::encoding::DefaultFuchsiaResourceDialect,
1714 > for (T0,)
1715 {
1716 #[inline]
1717 unsafe fn encode(
1718 self,
1719 encoder: &mut fidl::encoding::Encoder<
1720 '_,
1721 fidl::encoding::DefaultFuchsiaResourceDialect,
1722 >,
1723 offset: usize,
1724 depth: fidl::encoding::Depth,
1725 ) -> fidl::Result<()> {
1726 encoder.debug_check_bounds::<ControllerCreateGuestResponse>(offset);
1727 self.0.encode(encoder, offset + 0, depth)?;
1731 Ok(())
1732 }
1733 }
1734
1735 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1736 for ControllerCreateGuestResponse
1737 {
1738 #[inline(always)]
1739 fn new_empty() -> Self {
1740 Self {
1741 s: fidl::new_empty!(
1742 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<GuestMarker>>,
1743 fidl::encoding::DefaultFuchsiaResourceDialect
1744 ),
1745 }
1746 }
1747
1748 #[inline]
1749 unsafe fn decode(
1750 &mut self,
1751 decoder: &mut fidl::encoding::Decoder<
1752 '_,
1753 fidl::encoding::DefaultFuchsiaResourceDialect,
1754 >,
1755 offset: usize,
1756 _depth: fidl::encoding::Depth,
1757 ) -> fidl::Result<()> {
1758 decoder.debug_check_bounds::<Self>(offset);
1759 fidl::decode!(
1761 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<GuestMarker>>,
1762 fidl::encoding::DefaultFuchsiaResourceDialect,
1763 &mut self.s,
1764 decoder,
1765 offset + 0,
1766 _depth
1767 )?;
1768 Ok(())
1769 }
1770 }
1771}