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