1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_virtualization_guest_interaction__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DiscoveryGetGuestRequest {
16 pub realm_name: Option<String>,
17 pub guest_name: String,
18 pub guest: fidl::endpoints::ServerEnd<InteractionMarker>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DiscoveryGetGuestRequest {}
22
23#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub struct InteractionExecuteCommandRequest {
25 pub command: String,
26 pub env: Vec<EnvironmentVariable>,
27 pub stdin: Option<fidl::Socket>,
28 pub stdout: Option<fidl::Socket>,
29 pub stderr: Option<fidl::Socket>,
30 pub command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34 for InteractionExecuteCommandRequest
35{
36}
37
38#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39pub struct InteractionGetFileRequest {
40 pub remote_path: String,
41 pub local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InteractionGetFileRequest {}
45
46#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct InteractionPutFileRequest {
48 pub local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
49 pub remote_path: String,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InteractionPutFileRequest {}
53
54#[derive(Debug, PartialEq)]
55pub struct InteractiveGuestStartRequest {
56 pub guest_type: GuestType,
57 pub name: String,
58 pub guest_config: fidl_fuchsia_virtualization::GuestConfig,
59}
60
61impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
62 for InteractiveGuestStartRequest
63{
64}
65
66#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
67pub struct CommandListenerMarker;
68
69impl fidl::endpoints::ProtocolMarker for CommandListenerMarker {
70 type Proxy = CommandListenerProxy;
71 type RequestStream = CommandListenerRequestStream;
72 #[cfg(target_os = "fuchsia")]
73 type SynchronousProxy = CommandListenerSynchronousProxy;
74
75 const DEBUG_NAME: &'static str = "(anonymous) CommandListener";
76}
77
78pub trait CommandListenerProxyInterface: Send + Sync {}
79#[derive(Debug)]
80#[cfg(target_os = "fuchsia")]
81pub struct CommandListenerSynchronousProxy {
82 client: fidl::client::sync::Client,
83}
84
85#[cfg(target_os = "fuchsia")]
86impl fidl::endpoints::SynchronousProxy for CommandListenerSynchronousProxy {
87 type Proxy = CommandListenerProxy;
88 type Protocol = CommandListenerMarker;
89
90 fn from_channel(inner: fidl::Channel) -> Self {
91 Self::new(inner)
92 }
93
94 fn into_channel(self) -> fidl::Channel {
95 self.client.into_channel()
96 }
97
98 fn as_channel(&self) -> &fidl::Channel {
99 self.client.as_channel()
100 }
101}
102
103#[cfg(target_os = "fuchsia")]
104impl CommandListenerSynchronousProxy {
105 pub fn new(channel: fidl::Channel) -> Self {
106 Self { client: fidl::client::sync::Client::new(channel) }
107 }
108
109 pub fn into_channel(self) -> fidl::Channel {
110 self.client.into_channel()
111 }
112
113 pub fn wait_for_event(
116 &self,
117 deadline: zx::MonotonicInstant,
118 ) -> Result<CommandListenerEvent, fidl::Error> {
119 CommandListenerEvent::decode(self.client.wait_for_event::<CommandListenerMarker>(deadline)?)
120 }
121}
122
123#[cfg(target_os = "fuchsia")]
124impl From<CommandListenerSynchronousProxy> for zx::NullableHandle {
125 fn from(value: CommandListenerSynchronousProxy) -> Self {
126 value.into_channel().into()
127 }
128}
129
130#[cfg(target_os = "fuchsia")]
131impl From<fidl::Channel> for CommandListenerSynchronousProxy {
132 fn from(value: fidl::Channel) -> Self {
133 Self::new(value)
134 }
135}
136
137#[cfg(target_os = "fuchsia")]
138impl fidl::endpoints::FromClient for CommandListenerSynchronousProxy {
139 type Protocol = CommandListenerMarker;
140
141 fn from_client(value: fidl::endpoints::ClientEnd<CommandListenerMarker>) -> Self {
142 Self::new(value.into_channel())
143 }
144}
145
146#[derive(Debug, Clone)]
147pub struct CommandListenerProxy {
148 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
149}
150
151impl fidl::endpoints::Proxy for CommandListenerProxy {
152 type Protocol = CommandListenerMarker;
153
154 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
155 Self::new(inner)
156 }
157
158 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
159 self.client.into_channel().map_err(|client| Self { client })
160 }
161
162 fn as_channel(&self) -> &::fidl::AsyncChannel {
163 self.client.as_channel()
164 }
165}
166
167impl CommandListenerProxy {
168 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
170 let protocol_name = <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
171 Self { client: fidl::client::Client::new(channel, protocol_name) }
172 }
173
174 pub fn take_event_stream(&self) -> CommandListenerEventStream {
180 CommandListenerEventStream { event_receiver: self.client.take_event_receiver() }
181 }
182}
183
184impl CommandListenerProxyInterface for CommandListenerProxy {}
185
186pub struct CommandListenerEventStream {
187 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
188}
189
190impl std::marker::Unpin for CommandListenerEventStream {}
191
192impl futures::stream::FusedStream for CommandListenerEventStream {
193 fn is_terminated(&self) -> bool {
194 self.event_receiver.is_terminated()
195 }
196}
197
198impl futures::Stream for CommandListenerEventStream {
199 type Item = Result<CommandListenerEvent, fidl::Error>;
200
201 fn poll_next(
202 mut self: std::pin::Pin<&mut Self>,
203 cx: &mut std::task::Context<'_>,
204 ) -> std::task::Poll<Option<Self::Item>> {
205 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
206 &mut self.event_receiver,
207 cx
208 )?) {
209 Some(buf) => std::task::Poll::Ready(Some(CommandListenerEvent::decode(buf))),
210 None => std::task::Poll::Ready(None),
211 }
212 }
213}
214
215#[derive(Debug)]
216pub enum CommandListenerEvent {
217 OnStarted { status: i32 },
218 OnTerminated { status: i32, return_code: i32 },
219}
220
221impl CommandListenerEvent {
222 #[allow(irrefutable_let_patterns)]
223 pub fn into_on_started(self) -> Option<i32> {
224 if let CommandListenerEvent::OnStarted { status } = self { Some((status)) } else { None }
225 }
226 #[allow(irrefutable_let_patterns)]
227 pub fn into_on_terminated(self) -> Option<(i32, i32)> {
228 if let CommandListenerEvent::OnTerminated { status, return_code } = self {
229 Some((status, return_code))
230 } else {
231 None
232 }
233 }
234
235 fn decode(
237 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
238 ) -> Result<CommandListenerEvent, fidl::Error> {
239 let (bytes, _handles) = buf.split_mut();
240 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
241 debug_assert_eq!(tx_header.tx_id, 0);
242 match tx_header.ordinal {
243 0x3a3693a7e54a5f09 => {
244 let mut out = fidl::new_empty!(
245 CommandListenerOnStartedRequest,
246 fidl::encoding::DefaultFuchsiaResourceDialect
247 );
248 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommandListenerOnStartedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
249 Ok((CommandListenerEvent::OnStarted { status: out.status }))
250 }
251 0x5a08413bdea2446a => {
252 let mut out = fidl::new_empty!(
253 CommandListenerOnTerminatedRequest,
254 fidl::encoding::DefaultFuchsiaResourceDialect
255 );
256 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommandListenerOnTerminatedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
257 Ok((CommandListenerEvent::OnTerminated {
258 status: out.status,
259 return_code: out.return_code,
260 }))
261 }
262 _ => Err(fidl::Error::UnknownOrdinal {
263 ordinal: tx_header.ordinal,
264 protocol_name:
265 <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
266 }),
267 }
268 }
269}
270
271pub struct CommandListenerRequestStream {
273 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
274 is_terminated: bool,
275}
276
277impl std::marker::Unpin for CommandListenerRequestStream {}
278
279impl futures::stream::FusedStream for CommandListenerRequestStream {
280 fn is_terminated(&self) -> bool {
281 self.is_terminated
282 }
283}
284
285impl fidl::endpoints::RequestStream for CommandListenerRequestStream {
286 type Protocol = CommandListenerMarker;
287 type ControlHandle = CommandListenerControlHandle;
288
289 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
290 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
291 }
292
293 fn control_handle(&self) -> Self::ControlHandle {
294 CommandListenerControlHandle { inner: self.inner.clone() }
295 }
296
297 fn into_inner(
298 self,
299 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
300 {
301 (self.inner, self.is_terminated)
302 }
303
304 fn from_inner(
305 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
306 is_terminated: bool,
307 ) -> Self {
308 Self { inner, is_terminated }
309 }
310}
311
312impl futures::Stream for CommandListenerRequestStream {
313 type Item = Result<CommandListenerRequest, fidl::Error>;
314
315 fn poll_next(
316 mut self: std::pin::Pin<&mut Self>,
317 cx: &mut std::task::Context<'_>,
318 ) -> std::task::Poll<Option<Self::Item>> {
319 let this = &mut *self;
320 if this.inner.check_shutdown(cx) {
321 this.is_terminated = true;
322 return std::task::Poll::Ready(None);
323 }
324 if this.is_terminated {
325 panic!("polled CommandListenerRequestStream after completion");
326 }
327 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
328 |bytes, handles| {
329 match this.inner.channel().read_etc(cx, bytes, handles) {
330 std::task::Poll::Ready(Ok(())) => {}
331 std::task::Poll::Pending => return std::task::Poll::Pending,
332 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
333 this.is_terminated = true;
334 return std::task::Poll::Ready(None);
335 }
336 std::task::Poll::Ready(Err(e)) => {
337 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
338 e.into(),
339 ))));
340 }
341 }
342
343 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
345
346 std::task::Poll::Ready(Some(match header.ordinal {
347 _ => Err(fidl::Error::UnknownOrdinal {
348 ordinal: header.ordinal,
349 protocol_name:
350 <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
351 }),
352 }))
353 },
354 )
355 }
356}
357
358#[derive(Debug)]
359pub enum CommandListenerRequest {}
360
361impl CommandListenerRequest {
362 pub fn method_name(&self) -> &'static str {
364 match *self {}
365 }
366}
367
368#[derive(Debug, Clone)]
369pub struct CommandListenerControlHandle {
370 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
371}
372
373impl fidl::endpoints::ControlHandle for CommandListenerControlHandle {
374 fn shutdown(&self) {
375 self.inner.shutdown()
376 }
377
378 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
379 self.inner.shutdown_with_epitaph(status)
380 }
381
382 fn is_closed(&self) -> bool {
383 self.inner.channel().is_closed()
384 }
385 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
386 self.inner.channel().on_closed()
387 }
388
389 #[cfg(target_os = "fuchsia")]
390 fn signal_peer(
391 &self,
392 clear_mask: zx::Signals,
393 set_mask: zx::Signals,
394 ) -> Result<(), zx_status::Status> {
395 use fidl::Peered;
396 self.inner.channel().signal_peer(clear_mask, set_mask)
397 }
398}
399
400impl CommandListenerControlHandle {
401 pub fn send_on_started(&self, mut status: i32) -> Result<(), fidl::Error> {
402 self.inner.send::<CommandListenerOnStartedRequest>(
403 (status,),
404 0,
405 0x3a3693a7e54a5f09,
406 fidl::encoding::DynamicFlags::empty(),
407 )
408 }
409
410 pub fn send_on_terminated(
411 &self,
412 mut status: i32,
413 mut return_code: i32,
414 ) -> Result<(), fidl::Error> {
415 self.inner.send::<CommandListenerOnTerminatedRequest>(
416 (status, return_code),
417 0,
418 0x5a08413bdea2446a,
419 fidl::encoding::DynamicFlags::empty(),
420 )
421 }
422}
423
424#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
425pub struct DiscoveryMarker;
426
427impl fidl::endpoints::ProtocolMarker for DiscoveryMarker {
428 type Proxy = DiscoveryProxy;
429 type RequestStream = DiscoveryRequestStream;
430 #[cfg(target_os = "fuchsia")]
431 type SynchronousProxy = DiscoverySynchronousProxy;
432
433 const DEBUG_NAME: &'static str = "fuchsia.virtualization.guest.interaction.Discovery";
434}
435impl fidl::endpoints::DiscoverableProtocolMarker for DiscoveryMarker {}
436
437pub trait DiscoveryProxyInterface: Send + Sync {
438 fn r#get_guest(
439 &self,
440 realm_name: Option<&str>,
441 guest_name: &str,
442 guest: fidl::endpoints::ServerEnd<InteractionMarker>,
443 ) -> Result<(), fidl::Error>;
444}
445#[derive(Debug)]
446#[cfg(target_os = "fuchsia")]
447pub struct DiscoverySynchronousProxy {
448 client: fidl::client::sync::Client,
449}
450
451#[cfg(target_os = "fuchsia")]
452impl fidl::endpoints::SynchronousProxy for DiscoverySynchronousProxy {
453 type Proxy = DiscoveryProxy;
454 type Protocol = DiscoveryMarker;
455
456 fn from_channel(inner: fidl::Channel) -> Self {
457 Self::new(inner)
458 }
459
460 fn into_channel(self) -> fidl::Channel {
461 self.client.into_channel()
462 }
463
464 fn as_channel(&self) -> &fidl::Channel {
465 self.client.as_channel()
466 }
467}
468
469#[cfg(target_os = "fuchsia")]
470impl DiscoverySynchronousProxy {
471 pub fn new(channel: fidl::Channel) -> Self {
472 Self { client: fidl::client::sync::Client::new(channel) }
473 }
474
475 pub fn into_channel(self) -> fidl::Channel {
476 self.client.into_channel()
477 }
478
479 pub fn wait_for_event(
482 &self,
483 deadline: zx::MonotonicInstant,
484 ) -> Result<DiscoveryEvent, fidl::Error> {
485 DiscoveryEvent::decode(self.client.wait_for_event::<DiscoveryMarker>(deadline)?)
486 }
487
488 pub fn r#get_guest(
492 &self,
493 mut realm_name: Option<&str>,
494 mut guest_name: &str,
495 mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
496 ) -> Result<(), fidl::Error> {
497 self.client.send::<DiscoveryGetGuestRequest>(
498 (realm_name, guest_name, guest),
499 0x60538587bdd80a32,
500 fidl::encoding::DynamicFlags::empty(),
501 )
502 }
503}
504
505#[cfg(target_os = "fuchsia")]
506impl From<DiscoverySynchronousProxy> for zx::NullableHandle {
507 fn from(value: DiscoverySynchronousProxy) -> Self {
508 value.into_channel().into()
509 }
510}
511
512#[cfg(target_os = "fuchsia")]
513impl From<fidl::Channel> for DiscoverySynchronousProxy {
514 fn from(value: fidl::Channel) -> Self {
515 Self::new(value)
516 }
517}
518
519#[cfg(target_os = "fuchsia")]
520impl fidl::endpoints::FromClient for DiscoverySynchronousProxy {
521 type Protocol = DiscoveryMarker;
522
523 fn from_client(value: fidl::endpoints::ClientEnd<DiscoveryMarker>) -> Self {
524 Self::new(value.into_channel())
525 }
526}
527
528#[derive(Debug, Clone)]
529pub struct DiscoveryProxy {
530 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
531}
532
533impl fidl::endpoints::Proxy for DiscoveryProxy {
534 type Protocol = DiscoveryMarker;
535
536 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
537 Self::new(inner)
538 }
539
540 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
541 self.client.into_channel().map_err(|client| Self { client })
542 }
543
544 fn as_channel(&self) -> &::fidl::AsyncChannel {
545 self.client.as_channel()
546 }
547}
548
549impl DiscoveryProxy {
550 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
552 let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
553 Self { client: fidl::client::Client::new(channel, protocol_name) }
554 }
555
556 pub fn take_event_stream(&self) -> DiscoveryEventStream {
562 DiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
563 }
564
565 pub fn r#get_guest(
569 &self,
570 mut realm_name: Option<&str>,
571 mut guest_name: &str,
572 mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
573 ) -> Result<(), fidl::Error> {
574 DiscoveryProxyInterface::r#get_guest(self, realm_name, guest_name, guest)
575 }
576}
577
578impl DiscoveryProxyInterface for DiscoveryProxy {
579 fn r#get_guest(
580 &self,
581 mut realm_name: Option<&str>,
582 mut guest_name: &str,
583 mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
584 ) -> Result<(), fidl::Error> {
585 self.client.send::<DiscoveryGetGuestRequest>(
586 (realm_name, guest_name, guest),
587 0x60538587bdd80a32,
588 fidl::encoding::DynamicFlags::empty(),
589 )
590 }
591}
592
593pub struct DiscoveryEventStream {
594 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
595}
596
597impl std::marker::Unpin for DiscoveryEventStream {}
598
599impl futures::stream::FusedStream for DiscoveryEventStream {
600 fn is_terminated(&self) -> bool {
601 self.event_receiver.is_terminated()
602 }
603}
604
605impl futures::Stream for DiscoveryEventStream {
606 type Item = Result<DiscoveryEvent, fidl::Error>;
607
608 fn poll_next(
609 mut self: std::pin::Pin<&mut Self>,
610 cx: &mut std::task::Context<'_>,
611 ) -> std::task::Poll<Option<Self::Item>> {
612 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
613 &mut self.event_receiver,
614 cx
615 )?) {
616 Some(buf) => std::task::Poll::Ready(Some(DiscoveryEvent::decode(buf))),
617 None => std::task::Poll::Ready(None),
618 }
619 }
620}
621
622#[derive(Debug)]
623pub enum DiscoveryEvent {}
624
625impl DiscoveryEvent {
626 fn decode(
628 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
629 ) -> Result<DiscoveryEvent, fidl::Error> {
630 let (bytes, _handles) = buf.split_mut();
631 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
632 debug_assert_eq!(tx_header.tx_id, 0);
633 match tx_header.ordinal {
634 _ => Err(fidl::Error::UnknownOrdinal {
635 ordinal: tx_header.ordinal,
636 protocol_name: <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
637 }),
638 }
639 }
640}
641
642pub struct DiscoveryRequestStream {
644 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
645 is_terminated: bool,
646}
647
648impl std::marker::Unpin for DiscoveryRequestStream {}
649
650impl futures::stream::FusedStream for DiscoveryRequestStream {
651 fn is_terminated(&self) -> bool {
652 self.is_terminated
653 }
654}
655
656impl fidl::endpoints::RequestStream for DiscoveryRequestStream {
657 type Protocol = DiscoveryMarker;
658 type ControlHandle = DiscoveryControlHandle;
659
660 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
661 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
662 }
663
664 fn control_handle(&self) -> Self::ControlHandle {
665 DiscoveryControlHandle { inner: self.inner.clone() }
666 }
667
668 fn into_inner(
669 self,
670 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
671 {
672 (self.inner, self.is_terminated)
673 }
674
675 fn from_inner(
676 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
677 is_terminated: bool,
678 ) -> Self {
679 Self { inner, is_terminated }
680 }
681}
682
683impl futures::Stream for DiscoveryRequestStream {
684 type Item = Result<DiscoveryRequest, fidl::Error>;
685
686 fn poll_next(
687 mut self: std::pin::Pin<&mut Self>,
688 cx: &mut std::task::Context<'_>,
689 ) -> std::task::Poll<Option<Self::Item>> {
690 let this = &mut *self;
691 if this.inner.check_shutdown(cx) {
692 this.is_terminated = true;
693 return std::task::Poll::Ready(None);
694 }
695 if this.is_terminated {
696 panic!("polled DiscoveryRequestStream after completion");
697 }
698 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
699 |bytes, handles| {
700 match this.inner.channel().read_etc(cx, bytes, handles) {
701 std::task::Poll::Ready(Ok(())) => {}
702 std::task::Poll::Pending => return std::task::Poll::Pending,
703 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
704 this.is_terminated = true;
705 return std::task::Poll::Ready(None);
706 }
707 std::task::Poll::Ready(Err(e)) => {
708 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
709 e.into(),
710 ))));
711 }
712 }
713
714 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
716
717 std::task::Poll::Ready(Some(match header.ordinal {
718 0x60538587bdd80a32 => {
719 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
720 let mut req = fidl::new_empty!(
721 DiscoveryGetGuestRequest,
722 fidl::encoding::DefaultFuchsiaResourceDialect
723 );
724 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryGetGuestRequest>(&header, _body_bytes, handles, &mut req)?;
725 let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
726 Ok(DiscoveryRequest::GetGuest {
727 realm_name: req.realm_name,
728 guest_name: req.guest_name,
729 guest: req.guest,
730
731 control_handle,
732 })
733 }
734 _ => Err(fidl::Error::UnknownOrdinal {
735 ordinal: header.ordinal,
736 protocol_name:
737 <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
738 }),
739 }))
740 },
741 )
742 }
743}
744
745#[derive(Debug)]
747pub enum DiscoveryRequest {
748 GetGuest {
752 realm_name: Option<String>,
753 guest_name: String,
754 guest: fidl::endpoints::ServerEnd<InteractionMarker>,
755 control_handle: DiscoveryControlHandle,
756 },
757}
758
759impl DiscoveryRequest {
760 #[allow(irrefutable_let_patterns)]
761 pub fn into_get_guest(
762 self,
763 ) -> Option<(
764 Option<String>,
765 String,
766 fidl::endpoints::ServerEnd<InteractionMarker>,
767 DiscoveryControlHandle,
768 )> {
769 if let DiscoveryRequest::GetGuest { realm_name, guest_name, guest, control_handle } = self {
770 Some((realm_name, guest_name, guest, control_handle))
771 } else {
772 None
773 }
774 }
775
776 pub fn method_name(&self) -> &'static str {
778 match *self {
779 DiscoveryRequest::GetGuest { .. } => "get_guest",
780 }
781 }
782}
783
784#[derive(Debug, Clone)]
785pub struct DiscoveryControlHandle {
786 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
787}
788
789impl fidl::endpoints::ControlHandle for DiscoveryControlHandle {
790 fn shutdown(&self) {
791 self.inner.shutdown()
792 }
793
794 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
795 self.inner.shutdown_with_epitaph(status)
796 }
797
798 fn is_closed(&self) -> bool {
799 self.inner.channel().is_closed()
800 }
801 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
802 self.inner.channel().on_closed()
803 }
804
805 #[cfg(target_os = "fuchsia")]
806 fn signal_peer(
807 &self,
808 clear_mask: zx::Signals,
809 set_mask: zx::Signals,
810 ) -> Result<(), zx_status::Status> {
811 use fidl::Peered;
812 self.inner.channel().signal_peer(clear_mask, set_mask)
813 }
814}
815
816impl DiscoveryControlHandle {}
817
818#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
819pub struct InteractionMarker;
820
821impl fidl::endpoints::ProtocolMarker for InteractionMarker {
822 type Proxy = InteractionProxy;
823 type RequestStream = InteractionRequestStream;
824 #[cfg(target_os = "fuchsia")]
825 type SynchronousProxy = InteractionSynchronousProxy;
826
827 const DEBUG_NAME: &'static str = "(anonymous) Interaction";
828}
829
830pub trait InteractionProxyInterface: Send + Sync {
831 type PutFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
832 fn r#put_file(
833 &self,
834 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
835 remote_path: &str,
836 ) -> Self::PutFileResponseFut;
837 type GetFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
838 fn r#get_file(
839 &self,
840 remote_path: &str,
841 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
842 ) -> Self::GetFileResponseFut;
843 fn r#execute_command(
844 &self,
845 command: &str,
846 env: &[EnvironmentVariable],
847 stdin: Option<fidl::Socket>,
848 stdout: Option<fidl::Socket>,
849 stderr: Option<fidl::Socket>,
850 command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
851 ) -> Result<(), fidl::Error>;
852}
853#[derive(Debug)]
854#[cfg(target_os = "fuchsia")]
855pub struct InteractionSynchronousProxy {
856 client: fidl::client::sync::Client,
857}
858
859#[cfg(target_os = "fuchsia")]
860impl fidl::endpoints::SynchronousProxy for InteractionSynchronousProxy {
861 type Proxy = InteractionProxy;
862 type Protocol = InteractionMarker;
863
864 fn from_channel(inner: fidl::Channel) -> Self {
865 Self::new(inner)
866 }
867
868 fn into_channel(self) -> fidl::Channel {
869 self.client.into_channel()
870 }
871
872 fn as_channel(&self) -> &fidl::Channel {
873 self.client.as_channel()
874 }
875}
876
877#[cfg(target_os = "fuchsia")]
878impl InteractionSynchronousProxy {
879 pub fn new(channel: fidl::Channel) -> Self {
880 Self { client: fidl::client::sync::Client::new(channel) }
881 }
882
883 pub fn into_channel(self) -> fidl::Channel {
884 self.client.into_channel()
885 }
886
887 pub fn wait_for_event(
890 &self,
891 deadline: zx::MonotonicInstant,
892 ) -> Result<InteractionEvent, fidl::Error> {
893 InteractionEvent::decode(self.client.wait_for_event::<InteractionMarker>(deadline)?)
894 }
895
896 pub fn r#put_file(
899 &self,
900 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
901 mut remote_path: &str,
902 ___deadline: zx::MonotonicInstant,
903 ) -> Result<i32, fidl::Error> {
904 let _response = self
905 .client
906 .send_query::<InteractionPutFileRequest, InteractionPutFileResponse, InteractionMarker>(
907 (local_file, remote_path),
908 0x223bc20da4a7cddd,
909 fidl::encoding::DynamicFlags::empty(),
910 ___deadline,
911 )?;
912 Ok(_response.status)
913 }
914
915 pub fn r#get_file(
918 &self,
919 mut remote_path: &str,
920 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
921 ___deadline: zx::MonotonicInstant,
922 ) -> Result<i32, fidl::Error> {
923 let _response = self
924 .client
925 .send_query::<InteractionGetFileRequest, InteractionGetFileResponse, InteractionMarker>(
926 (remote_path, local_file),
927 0x7696bea472ca0f2d,
928 fidl::encoding::DynamicFlags::empty(),
929 ___deadline,
930 )?;
931 Ok(_response.status)
932 }
933
934 pub fn r#execute_command(
937 &self,
938 mut command: &str,
939 mut env: &[EnvironmentVariable],
940 mut stdin: Option<fidl::Socket>,
941 mut stdout: Option<fidl::Socket>,
942 mut stderr: Option<fidl::Socket>,
943 mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
944 ) -> Result<(), fidl::Error> {
945 self.client.send::<InteractionExecuteCommandRequest>(
946 (command, env, stdin, stdout, stderr, command_listener),
947 0x612641220a1556d8,
948 fidl::encoding::DynamicFlags::empty(),
949 )
950 }
951}
952
953#[cfg(target_os = "fuchsia")]
954impl From<InteractionSynchronousProxy> for zx::NullableHandle {
955 fn from(value: InteractionSynchronousProxy) -> Self {
956 value.into_channel().into()
957 }
958}
959
960#[cfg(target_os = "fuchsia")]
961impl From<fidl::Channel> for InteractionSynchronousProxy {
962 fn from(value: fidl::Channel) -> Self {
963 Self::new(value)
964 }
965}
966
967#[cfg(target_os = "fuchsia")]
968impl fidl::endpoints::FromClient for InteractionSynchronousProxy {
969 type Protocol = InteractionMarker;
970
971 fn from_client(value: fidl::endpoints::ClientEnd<InteractionMarker>) -> Self {
972 Self::new(value.into_channel())
973 }
974}
975
976#[derive(Debug, Clone)]
977pub struct InteractionProxy {
978 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
979}
980
981impl fidl::endpoints::Proxy for InteractionProxy {
982 type Protocol = InteractionMarker;
983
984 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
985 Self::new(inner)
986 }
987
988 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
989 self.client.into_channel().map_err(|client| Self { client })
990 }
991
992 fn as_channel(&self) -> &::fidl::AsyncChannel {
993 self.client.as_channel()
994 }
995}
996
997impl InteractionProxy {
998 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1000 let protocol_name = <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1001 Self { client: fidl::client::Client::new(channel, protocol_name) }
1002 }
1003
1004 pub fn take_event_stream(&self) -> InteractionEventStream {
1010 InteractionEventStream { event_receiver: self.client.take_event_receiver() }
1011 }
1012
1013 pub fn r#put_file(
1016 &self,
1017 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1018 mut remote_path: &str,
1019 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1020 InteractionProxyInterface::r#put_file(self, local_file, remote_path)
1021 }
1022
1023 pub fn r#get_file(
1026 &self,
1027 mut remote_path: &str,
1028 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1029 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1030 InteractionProxyInterface::r#get_file(self, remote_path, local_file)
1031 }
1032
1033 pub fn r#execute_command(
1036 &self,
1037 mut command: &str,
1038 mut env: &[EnvironmentVariable],
1039 mut stdin: Option<fidl::Socket>,
1040 mut stdout: Option<fidl::Socket>,
1041 mut stderr: Option<fidl::Socket>,
1042 mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1043 ) -> Result<(), fidl::Error> {
1044 InteractionProxyInterface::r#execute_command(
1045 self,
1046 command,
1047 env,
1048 stdin,
1049 stdout,
1050 stderr,
1051 command_listener,
1052 )
1053 }
1054}
1055
1056impl InteractionProxyInterface for InteractionProxy {
1057 type PutFileResponseFut =
1058 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1059 fn r#put_file(
1060 &self,
1061 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1062 mut remote_path: &str,
1063 ) -> Self::PutFileResponseFut {
1064 fn _decode(
1065 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1066 ) -> Result<i32, fidl::Error> {
1067 let _response = fidl::client::decode_transaction_body::<
1068 InteractionPutFileResponse,
1069 fidl::encoding::DefaultFuchsiaResourceDialect,
1070 0x223bc20da4a7cddd,
1071 >(_buf?)?;
1072 Ok(_response.status)
1073 }
1074 self.client.send_query_and_decode::<InteractionPutFileRequest, i32>(
1075 (local_file, remote_path),
1076 0x223bc20da4a7cddd,
1077 fidl::encoding::DynamicFlags::empty(),
1078 _decode,
1079 )
1080 }
1081
1082 type GetFileResponseFut =
1083 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1084 fn r#get_file(
1085 &self,
1086 mut remote_path: &str,
1087 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1088 ) -> Self::GetFileResponseFut {
1089 fn _decode(
1090 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1091 ) -> Result<i32, fidl::Error> {
1092 let _response = fidl::client::decode_transaction_body::<
1093 InteractionGetFileResponse,
1094 fidl::encoding::DefaultFuchsiaResourceDialect,
1095 0x7696bea472ca0f2d,
1096 >(_buf?)?;
1097 Ok(_response.status)
1098 }
1099 self.client.send_query_and_decode::<InteractionGetFileRequest, i32>(
1100 (remote_path, local_file),
1101 0x7696bea472ca0f2d,
1102 fidl::encoding::DynamicFlags::empty(),
1103 _decode,
1104 )
1105 }
1106
1107 fn r#execute_command(
1108 &self,
1109 mut command: &str,
1110 mut env: &[EnvironmentVariable],
1111 mut stdin: Option<fidl::Socket>,
1112 mut stdout: Option<fidl::Socket>,
1113 mut stderr: Option<fidl::Socket>,
1114 mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1115 ) -> Result<(), fidl::Error> {
1116 self.client.send::<InteractionExecuteCommandRequest>(
1117 (command, env, stdin, stdout, stderr, command_listener),
1118 0x612641220a1556d8,
1119 fidl::encoding::DynamicFlags::empty(),
1120 )
1121 }
1122}
1123
1124pub struct InteractionEventStream {
1125 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1126}
1127
1128impl std::marker::Unpin for InteractionEventStream {}
1129
1130impl futures::stream::FusedStream for InteractionEventStream {
1131 fn is_terminated(&self) -> bool {
1132 self.event_receiver.is_terminated()
1133 }
1134}
1135
1136impl futures::Stream for InteractionEventStream {
1137 type Item = Result<InteractionEvent, fidl::Error>;
1138
1139 fn poll_next(
1140 mut self: std::pin::Pin<&mut Self>,
1141 cx: &mut std::task::Context<'_>,
1142 ) -> std::task::Poll<Option<Self::Item>> {
1143 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1144 &mut self.event_receiver,
1145 cx
1146 )?) {
1147 Some(buf) => std::task::Poll::Ready(Some(InteractionEvent::decode(buf))),
1148 None => std::task::Poll::Ready(None),
1149 }
1150 }
1151}
1152
1153#[derive(Debug)]
1154pub enum InteractionEvent {}
1155
1156impl InteractionEvent {
1157 fn decode(
1159 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1160 ) -> Result<InteractionEvent, fidl::Error> {
1161 let (bytes, _handles) = buf.split_mut();
1162 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1163 debug_assert_eq!(tx_header.tx_id, 0);
1164 match tx_header.ordinal {
1165 _ => Err(fidl::Error::UnknownOrdinal {
1166 ordinal: tx_header.ordinal,
1167 protocol_name: <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1168 }),
1169 }
1170 }
1171}
1172
1173pub struct InteractionRequestStream {
1175 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1176 is_terminated: bool,
1177}
1178
1179impl std::marker::Unpin for InteractionRequestStream {}
1180
1181impl futures::stream::FusedStream for InteractionRequestStream {
1182 fn is_terminated(&self) -> bool {
1183 self.is_terminated
1184 }
1185}
1186
1187impl fidl::endpoints::RequestStream for InteractionRequestStream {
1188 type Protocol = InteractionMarker;
1189 type ControlHandle = InteractionControlHandle;
1190
1191 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1192 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1193 }
1194
1195 fn control_handle(&self) -> Self::ControlHandle {
1196 InteractionControlHandle { inner: self.inner.clone() }
1197 }
1198
1199 fn into_inner(
1200 self,
1201 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1202 {
1203 (self.inner, self.is_terminated)
1204 }
1205
1206 fn from_inner(
1207 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1208 is_terminated: bool,
1209 ) -> Self {
1210 Self { inner, is_terminated }
1211 }
1212}
1213
1214impl futures::Stream for InteractionRequestStream {
1215 type Item = Result<InteractionRequest, fidl::Error>;
1216
1217 fn poll_next(
1218 mut self: std::pin::Pin<&mut Self>,
1219 cx: &mut std::task::Context<'_>,
1220 ) -> std::task::Poll<Option<Self::Item>> {
1221 let this = &mut *self;
1222 if this.inner.check_shutdown(cx) {
1223 this.is_terminated = true;
1224 return std::task::Poll::Ready(None);
1225 }
1226 if this.is_terminated {
1227 panic!("polled InteractionRequestStream after completion");
1228 }
1229 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1230 |bytes, handles| {
1231 match this.inner.channel().read_etc(cx, bytes, handles) {
1232 std::task::Poll::Ready(Ok(())) => {}
1233 std::task::Poll::Pending => return std::task::Poll::Pending,
1234 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1235 this.is_terminated = true;
1236 return std::task::Poll::Ready(None);
1237 }
1238 std::task::Poll::Ready(Err(e)) => {
1239 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1240 e.into(),
1241 ))));
1242 }
1243 }
1244
1245 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1247
1248 std::task::Poll::Ready(Some(match header.ordinal {
1249 0x223bc20da4a7cddd => {
1250 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1251 let mut req = fidl::new_empty!(
1252 InteractionPutFileRequest,
1253 fidl::encoding::DefaultFuchsiaResourceDialect
1254 );
1255 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionPutFileRequest>(&header, _body_bytes, handles, &mut req)?;
1256 let control_handle = InteractionControlHandle { inner: this.inner.clone() };
1257 Ok(InteractionRequest::PutFile {
1258 local_file: req.local_file,
1259 remote_path: req.remote_path,
1260
1261 responder: InteractionPutFileResponder {
1262 control_handle: std::mem::ManuallyDrop::new(control_handle),
1263 tx_id: header.tx_id,
1264 },
1265 })
1266 }
1267 0x7696bea472ca0f2d => {
1268 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1269 let mut req = fidl::new_empty!(
1270 InteractionGetFileRequest,
1271 fidl::encoding::DefaultFuchsiaResourceDialect
1272 );
1273 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionGetFileRequest>(&header, _body_bytes, handles, &mut req)?;
1274 let control_handle = InteractionControlHandle { inner: this.inner.clone() };
1275 Ok(InteractionRequest::GetFile {
1276 remote_path: req.remote_path,
1277 local_file: req.local_file,
1278
1279 responder: InteractionGetFileResponder {
1280 control_handle: std::mem::ManuallyDrop::new(control_handle),
1281 tx_id: header.tx_id,
1282 },
1283 })
1284 }
1285 0x612641220a1556d8 => {
1286 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1287 let mut req = fidl::new_empty!(
1288 InteractionExecuteCommandRequest,
1289 fidl::encoding::DefaultFuchsiaResourceDialect
1290 );
1291 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionExecuteCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1292 let control_handle = InteractionControlHandle { inner: this.inner.clone() };
1293 Ok(InteractionRequest::ExecuteCommand {
1294 command: req.command,
1295 env: req.env,
1296 stdin: req.stdin,
1297 stdout: req.stdout,
1298 stderr: req.stderr,
1299 command_listener: req.command_listener,
1300
1301 control_handle,
1302 })
1303 }
1304 _ => Err(fidl::Error::UnknownOrdinal {
1305 ordinal: header.ordinal,
1306 protocol_name:
1307 <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1308 }),
1309 }))
1310 },
1311 )
1312 }
1313}
1314
1315#[derive(Debug)]
1316pub enum InteractionRequest {
1317 PutFile {
1320 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1321 remote_path: String,
1322 responder: InteractionPutFileResponder,
1323 },
1324 GetFile {
1327 remote_path: String,
1328 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1329 responder: InteractionGetFileResponder,
1330 },
1331 ExecuteCommand {
1334 command: String,
1335 env: Vec<EnvironmentVariable>,
1336 stdin: Option<fidl::Socket>,
1337 stdout: Option<fidl::Socket>,
1338 stderr: Option<fidl::Socket>,
1339 command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1340 control_handle: InteractionControlHandle,
1341 },
1342}
1343
1344impl InteractionRequest {
1345 #[allow(irrefutable_let_patterns)]
1346 pub fn into_put_file(
1347 self,
1348 ) -> Option<(
1349 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1350 String,
1351 InteractionPutFileResponder,
1352 )> {
1353 if let InteractionRequest::PutFile { local_file, remote_path, responder } = self {
1354 Some((local_file, remote_path, responder))
1355 } else {
1356 None
1357 }
1358 }
1359
1360 #[allow(irrefutable_let_patterns)]
1361 pub fn into_get_file(
1362 self,
1363 ) -> Option<(
1364 String,
1365 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1366 InteractionGetFileResponder,
1367 )> {
1368 if let InteractionRequest::GetFile { remote_path, local_file, responder } = self {
1369 Some((remote_path, local_file, responder))
1370 } else {
1371 None
1372 }
1373 }
1374
1375 #[allow(irrefutable_let_patterns)]
1376 pub fn into_execute_command(
1377 self,
1378 ) -> Option<(
1379 String,
1380 Vec<EnvironmentVariable>,
1381 Option<fidl::Socket>,
1382 Option<fidl::Socket>,
1383 Option<fidl::Socket>,
1384 fidl::endpoints::ServerEnd<CommandListenerMarker>,
1385 InteractionControlHandle,
1386 )> {
1387 if let InteractionRequest::ExecuteCommand {
1388 command,
1389 env,
1390 stdin,
1391 stdout,
1392 stderr,
1393 command_listener,
1394 control_handle,
1395 } = self
1396 {
1397 Some((command, env, stdin, stdout, stderr, command_listener, control_handle))
1398 } else {
1399 None
1400 }
1401 }
1402
1403 pub fn method_name(&self) -> &'static str {
1405 match *self {
1406 InteractionRequest::PutFile { .. } => "put_file",
1407 InteractionRequest::GetFile { .. } => "get_file",
1408 InteractionRequest::ExecuteCommand { .. } => "execute_command",
1409 }
1410 }
1411}
1412
1413#[derive(Debug, Clone)]
1414pub struct InteractionControlHandle {
1415 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1416}
1417
1418impl fidl::endpoints::ControlHandle for InteractionControlHandle {
1419 fn shutdown(&self) {
1420 self.inner.shutdown()
1421 }
1422
1423 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1424 self.inner.shutdown_with_epitaph(status)
1425 }
1426
1427 fn is_closed(&self) -> bool {
1428 self.inner.channel().is_closed()
1429 }
1430 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1431 self.inner.channel().on_closed()
1432 }
1433
1434 #[cfg(target_os = "fuchsia")]
1435 fn signal_peer(
1436 &self,
1437 clear_mask: zx::Signals,
1438 set_mask: zx::Signals,
1439 ) -> Result<(), zx_status::Status> {
1440 use fidl::Peered;
1441 self.inner.channel().signal_peer(clear_mask, set_mask)
1442 }
1443}
1444
1445impl InteractionControlHandle {}
1446
1447#[must_use = "FIDL methods require a response to be sent"]
1448#[derive(Debug)]
1449pub struct InteractionPutFileResponder {
1450 control_handle: std::mem::ManuallyDrop<InteractionControlHandle>,
1451 tx_id: u32,
1452}
1453
1454impl std::ops::Drop for InteractionPutFileResponder {
1458 fn drop(&mut self) {
1459 self.control_handle.shutdown();
1460 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1462 }
1463}
1464
1465impl fidl::endpoints::Responder for InteractionPutFileResponder {
1466 type ControlHandle = InteractionControlHandle;
1467
1468 fn control_handle(&self) -> &InteractionControlHandle {
1469 &self.control_handle
1470 }
1471
1472 fn drop_without_shutdown(mut self) {
1473 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1475 std::mem::forget(self);
1477 }
1478}
1479
1480impl InteractionPutFileResponder {
1481 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1485 let _result = self.send_raw(status);
1486 if _result.is_err() {
1487 self.control_handle.shutdown();
1488 }
1489 self.drop_without_shutdown();
1490 _result
1491 }
1492
1493 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1495 let _result = self.send_raw(status);
1496 self.drop_without_shutdown();
1497 _result
1498 }
1499
1500 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1501 self.control_handle.inner.send::<InteractionPutFileResponse>(
1502 (status,),
1503 self.tx_id,
1504 0x223bc20da4a7cddd,
1505 fidl::encoding::DynamicFlags::empty(),
1506 )
1507 }
1508}
1509
1510#[must_use = "FIDL methods require a response to be sent"]
1511#[derive(Debug)]
1512pub struct InteractionGetFileResponder {
1513 control_handle: std::mem::ManuallyDrop<InteractionControlHandle>,
1514 tx_id: u32,
1515}
1516
1517impl std::ops::Drop for InteractionGetFileResponder {
1521 fn drop(&mut self) {
1522 self.control_handle.shutdown();
1523 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1525 }
1526}
1527
1528impl fidl::endpoints::Responder for InteractionGetFileResponder {
1529 type ControlHandle = InteractionControlHandle;
1530
1531 fn control_handle(&self) -> &InteractionControlHandle {
1532 &self.control_handle
1533 }
1534
1535 fn drop_without_shutdown(mut self) {
1536 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1538 std::mem::forget(self);
1540 }
1541}
1542
1543impl InteractionGetFileResponder {
1544 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1548 let _result = self.send_raw(status);
1549 if _result.is_err() {
1550 self.control_handle.shutdown();
1551 }
1552 self.drop_without_shutdown();
1553 _result
1554 }
1555
1556 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1558 let _result = self.send_raw(status);
1559 self.drop_without_shutdown();
1560 _result
1561 }
1562
1563 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1564 self.control_handle.inner.send::<InteractionGetFileResponse>(
1565 (status,),
1566 self.tx_id,
1567 0x7696bea472ca0f2d,
1568 fidl::encoding::DynamicFlags::empty(),
1569 )
1570 }
1571}
1572
1573#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1574pub struct InteractiveGuestMarker;
1575
1576impl fidl::endpoints::ProtocolMarker for InteractiveGuestMarker {
1577 type Proxy = InteractiveGuestProxy;
1578 type RequestStream = InteractiveGuestRequestStream;
1579 #[cfg(target_os = "fuchsia")]
1580 type SynchronousProxy = InteractiveGuestSynchronousProxy;
1581
1582 const DEBUG_NAME: &'static str = "fuchsia.virtualization.guest.interaction.InteractiveGuest";
1583}
1584impl fidl::endpoints::DiscoverableProtocolMarker for InteractiveGuestMarker {}
1585
1586pub trait InteractiveGuestProxyInterface: Send + Sync {
1587 type PutFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1588 fn r#put_file(
1589 &self,
1590 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1591 remote_path: &str,
1592 ) -> Self::PutFileResponseFut;
1593 type GetFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1594 fn r#get_file(
1595 &self,
1596 remote_path: &str,
1597 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1598 ) -> Self::GetFileResponseFut;
1599 fn r#execute_command(
1600 &self,
1601 command: &str,
1602 env: &[EnvironmentVariable],
1603 stdin: Option<fidl::Socket>,
1604 stdout: Option<fidl::Socket>,
1605 stderr: Option<fidl::Socket>,
1606 command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1607 ) -> Result<(), fidl::Error>;
1608 type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1609 fn r#start(
1610 &self,
1611 guest_type: GuestType,
1612 name: &str,
1613 guest_config: fidl_fuchsia_virtualization::GuestConfig,
1614 ) -> Self::StartResponseFut;
1615 type ShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1616 fn r#shutdown(&self) -> Self::ShutdownResponseFut;
1617}
1618#[derive(Debug)]
1619#[cfg(target_os = "fuchsia")]
1620pub struct InteractiveGuestSynchronousProxy {
1621 client: fidl::client::sync::Client,
1622}
1623
1624#[cfg(target_os = "fuchsia")]
1625impl fidl::endpoints::SynchronousProxy for InteractiveGuestSynchronousProxy {
1626 type Proxy = InteractiveGuestProxy;
1627 type Protocol = InteractiveGuestMarker;
1628
1629 fn from_channel(inner: fidl::Channel) -> Self {
1630 Self::new(inner)
1631 }
1632
1633 fn into_channel(self) -> fidl::Channel {
1634 self.client.into_channel()
1635 }
1636
1637 fn as_channel(&self) -> &fidl::Channel {
1638 self.client.as_channel()
1639 }
1640}
1641
1642#[cfg(target_os = "fuchsia")]
1643impl InteractiveGuestSynchronousProxy {
1644 pub fn new(channel: fidl::Channel) -> Self {
1645 Self { client: fidl::client::sync::Client::new(channel) }
1646 }
1647
1648 pub fn into_channel(self) -> fidl::Channel {
1649 self.client.into_channel()
1650 }
1651
1652 pub fn wait_for_event(
1655 &self,
1656 deadline: zx::MonotonicInstant,
1657 ) -> Result<InteractiveGuestEvent, fidl::Error> {
1658 InteractiveGuestEvent::decode(
1659 self.client.wait_for_event::<InteractiveGuestMarker>(deadline)?,
1660 )
1661 }
1662
1663 pub fn r#put_file(
1666 &self,
1667 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1668 mut remote_path: &str,
1669 ___deadline: zx::MonotonicInstant,
1670 ) -> Result<i32, fidl::Error> {
1671 let _response = self.client.send_query::<
1672 InteractionPutFileRequest,
1673 InteractionPutFileResponse,
1674 InteractiveGuestMarker,
1675 >(
1676 (local_file, remote_path,),
1677 0x223bc20da4a7cddd,
1678 fidl::encoding::DynamicFlags::empty(),
1679 ___deadline,
1680 )?;
1681 Ok(_response.status)
1682 }
1683
1684 pub fn r#get_file(
1687 &self,
1688 mut remote_path: &str,
1689 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1690 ___deadline: zx::MonotonicInstant,
1691 ) -> Result<i32, fidl::Error> {
1692 let _response = self.client.send_query::<
1693 InteractionGetFileRequest,
1694 InteractionGetFileResponse,
1695 InteractiveGuestMarker,
1696 >(
1697 (remote_path, local_file,),
1698 0x7696bea472ca0f2d,
1699 fidl::encoding::DynamicFlags::empty(),
1700 ___deadline,
1701 )?;
1702 Ok(_response.status)
1703 }
1704
1705 pub fn r#execute_command(
1708 &self,
1709 mut command: &str,
1710 mut env: &[EnvironmentVariable],
1711 mut stdin: Option<fidl::Socket>,
1712 mut stdout: Option<fidl::Socket>,
1713 mut stderr: Option<fidl::Socket>,
1714 mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1715 ) -> Result<(), fidl::Error> {
1716 self.client.send::<InteractionExecuteCommandRequest>(
1717 (command, env, stdin, stdout, stderr, command_listener),
1718 0x612641220a1556d8,
1719 fidl::encoding::DynamicFlags::empty(),
1720 )
1721 }
1722
1723 pub fn r#start(
1724 &self,
1725 mut guest_type: GuestType,
1726 mut name: &str,
1727 mut guest_config: fidl_fuchsia_virtualization::GuestConfig,
1728 ___deadline: zx::MonotonicInstant,
1729 ) -> Result<(), fidl::Error> {
1730 let _response = self.client.send_query::<
1731 InteractiveGuestStartRequest,
1732 fidl::encoding::EmptyPayload,
1733 InteractiveGuestMarker,
1734 >(
1735 (guest_type, name, &mut guest_config,),
1736 0x1e0e391a2e0b9ed0,
1737 fidl::encoding::DynamicFlags::empty(),
1738 ___deadline,
1739 )?;
1740 Ok(_response)
1741 }
1742
1743 pub fn r#shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1744 let _response = self.client.send_query::<
1745 fidl::encoding::EmptyPayload,
1746 fidl::encoding::EmptyPayload,
1747 InteractiveGuestMarker,
1748 >(
1749 (),
1750 0x17019f7511bae997,
1751 fidl::encoding::DynamicFlags::empty(),
1752 ___deadline,
1753 )?;
1754 Ok(_response)
1755 }
1756}
1757
1758#[cfg(target_os = "fuchsia")]
1759impl From<InteractiveGuestSynchronousProxy> for zx::NullableHandle {
1760 fn from(value: InteractiveGuestSynchronousProxy) -> Self {
1761 value.into_channel().into()
1762 }
1763}
1764
1765#[cfg(target_os = "fuchsia")]
1766impl From<fidl::Channel> for InteractiveGuestSynchronousProxy {
1767 fn from(value: fidl::Channel) -> Self {
1768 Self::new(value)
1769 }
1770}
1771
1772#[cfg(target_os = "fuchsia")]
1773impl fidl::endpoints::FromClient for InteractiveGuestSynchronousProxy {
1774 type Protocol = InteractiveGuestMarker;
1775
1776 fn from_client(value: fidl::endpoints::ClientEnd<InteractiveGuestMarker>) -> Self {
1777 Self::new(value.into_channel())
1778 }
1779}
1780
1781#[derive(Debug, Clone)]
1782pub struct InteractiveGuestProxy {
1783 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1784}
1785
1786impl fidl::endpoints::Proxy for InteractiveGuestProxy {
1787 type Protocol = InteractiveGuestMarker;
1788
1789 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1790 Self::new(inner)
1791 }
1792
1793 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1794 self.client.into_channel().map_err(|client| Self { client })
1795 }
1796
1797 fn as_channel(&self) -> &::fidl::AsyncChannel {
1798 self.client.as_channel()
1799 }
1800}
1801
1802impl InteractiveGuestProxy {
1803 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1805 let protocol_name = <InteractiveGuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1806 Self { client: fidl::client::Client::new(channel, protocol_name) }
1807 }
1808
1809 pub fn take_event_stream(&self) -> InteractiveGuestEventStream {
1815 InteractiveGuestEventStream { event_receiver: self.client.take_event_receiver() }
1816 }
1817
1818 pub fn r#put_file(
1821 &self,
1822 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1823 mut remote_path: &str,
1824 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1825 InteractiveGuestProxyInterface::r#put_file(self, local_file, remote_path)
1826 }
1827
1828 pub fn r#get_file(
1831 &self,
1832 mut remote_path: &str,
1833 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1834 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1835 InteractiveGuestProxyInterface::r#get_file(self, remote_path, local_file)
1836 }
1837
1838 pub fn r#execute_command(
1841 &self,
1842 mut command: &str,
1843 mut env: &[EnvironmentVariable],
1844 mut stdin: Option<fidl::Socket>,
1845 mut stdout: Option<fidl::Socket>,
1846 mut stderr: Option<fidl::Socket>,
1847 mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1848 ) -> Result<(), fidl::Error> {
1849 InteractiveGuestProxyInterface::r#execute_command(
1850 self,
1851 command,
1852 env,
1853 stdin,
1854 stdout,
1855 stderr,
1856 command_listener,
1857 )
1858 }
1859
1860 pub fn r#start(
1861 &self,
1862 mut guest_type: GuestType,
1863 mut name: &str,
1864 mut guest_config: fidl_fuchsia_virtualization::GuestConfig,
1865 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1866 InteractiveGuestProxyInterface::r#start(self, guest_type, name, guest_config)
1867 }
1868
1869 pub fn r#shutdown(
1870 &self,
1871 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1872 InteractiveGuestProxyInterface::r#shutdown(self)
1873 }
1874}
1875
1876impl InteractiveGuestProxyInterface for InteractiveGuestProxy {
1877 type PutFileResponseFut =
1878 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1879 fn r#put_file(
1880 &self,
1881 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1882 mut remote_path: &str,
1883 ) -> Self::PutFileResponseFut {
1884 fn _decode(
1885 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1886 ) -> Result<i32, fidl::Error> {
1887 let _response = fidl::client::decode_transaction_body::<
1888 InteractionPutFileResponse,
1889 fidl::encoding::DefaultFuchsiaResourceDialect,
1890 0x223bc20da4a7cddd,
1891 >(_buf?)?;
1892 Ok(_response.status)
1893 }
1894 self.client.send_query_and_decode::<InteractionPutFileRequest, i32>(
1895 (local_file, remote_path),
1896 0x223bc20da4a7cddd,
1897 fidl::encoding::DynamicFlags::empty(),
1898 _decode,
1899 )
1900 }
1901
1902 type GetFileResponseFut =
1903 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1904 fn r#get_file(
1905 &self,
1906 mut remote_path: &str,
1907 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1908 ) -> Self::GetFileResponseFut {
1909 fn _decode(
1910 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1911 ) -> Result<i32, fidl::Error> {
1912 let _response = fidl::client::decode_transaction_body::<
1913 InteractionGetFileResponse,
1914 fidl::encoding::DefaultFuchsiaResourceDialect,
1915 0x7696bea472ca0f2d,
1916 >(_buf?)?;
1917 Ok(_response.status)
1918 }
1919 self.client.send_query_and_decode::<InteractionGetFileRequest, i32>(
1920 (remote_path, local_file),
1921 0x7696bea472ca0f2d,
1922 fidl::encoding::DynamicFlags::empty(),
1923 _decode,
1924 )
1925 }
1926
1927 fn r#execute_command(
1928 &self,
1929 mut command: &str,
1930 mut env: &[EnvironmentVariable],
1931 mut stdin: Option<fidl::Socket>,
1932 mut stdout: Option<fidl::Socket>,
1933 mut stderr: Option<fidl::Socket>,
1934 mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1935 ) -> Result<(), fidl::Error> {
1936 self.client.send::<InteractionExecuteCommandRequest>(
1937 (command, env, stdin, stdout, stderr, command_listener),
1938 0x612641220a1556d8,
1939 fidl::encoding::DynamicFlags::empty(),
1940 )
1941 }
1942
1943 type StartResponseFut =
1944 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1945 fn r#start(
1946 &self,
1947 mut guest_type: GuestType,
1948 mut name: &str,
1949 mut guest_config: fidl_fuchsia_virtualization::GuestConfig,
1950 ) -> Self::StartResponseFut {
1951 fn _decode(
1952 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1953 ) -> Result<(), fidl::Error> {
1954 let _response = fidl::client::decode_transaction_body::<
1955 fidl::encoding::EmptyPayload,
1956 fidl::encoding::DefaultFuchsiaResourceDialect,
1957 0x1e0e391a2e0b9ed0,
1958 >(_buf?)?;
1959 Ok(_response)
1960 }
1961 self.client.send_query_and_decode::<InteractiveGuestStartRequest, ()>(
1962 (guest_type, name, &mut guest_config),
1963 0x1e0e391a2e0b9ed0,
1964 fidl::encoding::DynamicFlags::empty(),
1965 _decode,
1966 )
1967 }
1968
1969 type ShutdownResponseFut =
1970 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1971 fn r#shutdown(&self) -> Self::ShutdownResponseFut {
1972 fn _decode(
1973 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1974 ) -> Result<(), fidl::Error> {
1975 let _response = fidl::client::decode_transaction_body::<
1976 fidl::encoding::EmptyPayload,
1977 fidl::encoding::DefaultFuchsiaResourceDialect,
1978 0x17019f7511bae997,
1979 >(_buf?)?;
1980 Ok(_response)
1981 }
1982 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1983 (),
1984 0x17019f7511bae997,
1985 fidl::encoding::DynamicFlags::empty(),
1986 _decode,
1987 )
1988 }
1989}
1990
1991pub struct InteractiveGuestEventStream {
1992 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1993}
1994
1995impl std::marker::Unpin for InteractiveGuestEventStream {}
1996
1997impl futures::stream::FusedStream for InteractiveGuestEventStream {
1998 fn is_terminated(&self) -> bool {
1999 self.event_receiver.is_terminated()
2000 }
2001}
2002
2003impl futures::Stream for InteractiveGuestEventStream {
2004 type Item = Result<InteractiveGuestEvent, fidl::Error>;
2005
2006 fn poll_next(
2007 mut self: std::pin::Pin<&mut Self>,
2008 cx: &mut std::task::Context<'_>,
2009 ) -> std::task::Poll<Option<Self::Item>> {
2010 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2011 &mut self.event_receiver,
2012 cx
2013 )?) {
2014 Some(buf) => std::task::Poll::Ready(Some(InteractiveGuestEvent::decode(buf))),
2015 None => std::task::Poll::Ready(None),
2016 }
2017 }
2018}
2019
2020#[derive(Debug)]
2021pub enum InteractiveGuestEvent {}
2022
2023impl InteractiveGuestEvent {
2024 fn decode(
2026 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2027 ) -> Result<InteractiveGuestEvent, fidl::Error> {
2028 let (bytes, _handles) = buf.split_mut();
2029 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2030 debug_assert_eq!(tx_header.tx_id, 0);
2031 match tx_header.ordinal {
2032 _ => Err(fidl::Error::UnknownOrdinal {
2033 ordinal: tx_header.ordinal,
2034 protocol_name:
2035 <InteractiveGuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2036 }),
2037 }
2038 }
2039}
2040
2041pub struct InteractiveGuestRequestStream {
2043 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2044 is_terminated: bool,
2045}
2046
2047impl std::marker::Unpin for InteractiveGuestRequestStream {}
2048
2049impl futures::stream::FusedStream for InteractiveGuestRequestStream {
2050 fn is_terminated(&self) -> bool {
2051 self.is_terminated
2052 }
2053}
2054
2055impl fidl::endpoints::RequestStream for InteractiveGuestRequestStream {
2056 type Protocol = InteractiveGuestMarker;
2057 type ControlHandle = InteractiveGuestControlHandle;
2058
2059 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2060 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2061 }
2062
2063 fn control_handle(&self) -> Self::ControlHandle {
2064 InteractiveGuestControlHandle { inner: self.inner.clone() }
2065 }
2066
2067 fn into_inner(
2068 self,
2069 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2070 {
2071 (self.inner, self.is_terminated)
2072 }
2073
2074 fn from_inner(
2075 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2076 is_terminated: bool,
2077 ) -> Self {
2078 Self { inner, is_terminated }
2079 }
2080}
2081
2082impl futures::Stream for InteractiveGuestRequestStream {
2083 type Item = Result<InteractiveGuestRequest, fidl::Error>;
2084
2085 fn poll_next(
2086 mut self: std::pin::Pin<&mut Self>,
2087 cx: &mut std::task::Context<'_>,
2088 ) -> std::task::Poll<Option<Self::Item>> {
2089 let this = &mut *self;
2090 if this.inner.check_shutdown(cx) {
2091 this.is_terminated = true;
2092 return std::task::Poll::Ready(None);
2093 }
2094 if this.is_terminated {
2095 panic!("polled InteractiveGuestRequestStream after completion");
2096 }
2097 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2098 |bytes, handles| {
2099 match this.inner.channel().read_etc(cx, bytes, handles) {
2100 std::task::Poll::Ready(Ok(())) => {}
2101 std::task::Poll::Pending => return std::task::Poll::Pending,
2102 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2103 this.is_terminated = true;
2104 return std::task::Poll::Ready(None);
2105 }
2106 std::task::Poll::Ready(Err(e)) => {
2107 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2108 e.into(),
2109 ))));
2110 }
2111 }
2112
2113 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2115
2116 std::task::Poll::Ready(Some(match header.ordinal {
2117 0x223bc20da4a7cddd => {
2118 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2119 let mut req = fidl::new_empty!(
2120 InteractionPutFileRequest,
2121 fidl::encoding::DefaultFuchsiaResourceDialect
2122 );
2123 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionPutFileRequest>(&header, _body_bytes, handles, &mut req)?;
2124 let control_handle =
2125 InteractiveGuestControlHandle { inner: this.inner.clone() };
2126 Ok(InteractiveGuestRequest::PutFile {
2127 local_file: req.local_file,
2128 remote_path: req.remote_path,
2129
2130 responder: InteractiveGuestPutFileResponder {
2131 control_handle: std::mem::ManuallyDrop::new(control_handle),
2132 tx_id: header.tx_id,
2133 },
2134 })
2135 }
2136 0x7696bea472ca0f2d => {
2137 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2138 let mut req = fidl::new_empty!(
2139 InteractionGetFileRequest,
2140 fidl::encoding::DefaultFuchsiaResourceDialect
2141 );
2142 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionGetFileRequest>(&header, _body_bytes, handles, &mut req)?;
2143 let control_handle =
2144 InteractiveGuestControlHandle { inner: this.inner.clone() };
2145 Ok(InteractiveGuestRequest::GetFile {
2146 remote_path: req.remote_path,
2147 local_file: req.local_file,
2148
2149 responder: InteractiveGuestGetFileResponder {
2150 control_handle: std::mem::ManuallyDrop::new(control_handle),
2151 tx_id: header.tx_id,
2152 },
2153 })
2154 }
2155 0x612641220a1556d8 => {
2156 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2157 let mut req = fidl::new_empty!(
2158 InteractionExecuteCommandRequest,
2159 fidl::encoding::DefaultFuchsiaResourceDialect
2160 );
2161 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionExecuteCommandRequest>(&header, _body_bytes, handles, &mut req)?;
2162 let control_handle =
2163 InteractiveGuestControlHandle { inner: this.inner.clone() };
2164 Ok(InteractiveGuestRequest::ExecuteCommand {
2165 command: req.command,
2166 env: req.env,
2167 stdin: req.stdin,
2168 stdout: req.stdout,
2169 stderr: req.stderr,
2170 command_listener: req.command_listener,
2171
2172 control_handle,
2173 })
2174 }
2175 0x1e0e391a2e0b9ed0 => {
2176 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2177 let mut req = fidl::new_empty!(
2178 InteractiveGuestStartRequest,
2179 fidl::encoding::DefaultFuchsiaResourceDialect
2180 );
2181 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractiveGuestStartRequest>(&header, _body_bytes, handles, &mut req)?;
2182 let control_handle =
2183 InteractiveGuestControlHandle { inner: this.inner.clone() };
2184 Ok(InteractiveGuestRequest::Start {
2185 guest_type: req.guest_type,
2186 name: req.name,
2187 guest_config: req.guest_config,
2188
2189 responder: InteractiveGuestStartResponder {
2190 control_handle: std::mem::ManuallyDrop::new(control_handle),
2191 tx_id: header.tx_id,
2192 },
2193 })
2194 }
2195 0x17019f7511bae997 => {
2196 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2197 let mut req = fidl::new_empty!(
2198 fidl::encoding::EmptyPayload,
2199 fidl::encoding::DefaultFuchsiaResourceDialect
2200 );
2201 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2202 let control_handle =
2203 InteractiveGuestControlHandle { inner: this.inner.clone() };
2204 Ok(InteractiveGuestRequest::Shutdown {
2205 responder: InteractiveGuestShutdownResponder {
2206 control_handle: std::mem::ManuallyDrop::new(control_handle),
2207 tx_id: header.tx_id,
2208 },
2209 })
2210 }
2211 _ => Err(fidl::Error::UnknownOrdinal {
2212 ordinal: header.ordinal,
2213 protocol_name:
2214 <InteractiveGuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2215 }),
2216 }))
2217 },
2218 )
2219 }
2220}
2221
2222#[derive(Debug)]
2227pub enum InteractiveGuestRequest {
2228 PutFile {
2231 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
2232 remote_path: String,
2233 responder: InteractiveGuestPutFileResponder,
2234 },
2235 GetFile {
2238 remote_path: String,
2239 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
2240 responder: InteractiveGuestGetFileResponder,
2241 },
2242 ExecuteCommand {
2245 command: String,
2246 env: Vec<EnvironmentVariable>,
2247 stdin: Option<fidl::Socket>,
2248 stdout: Option<fidl::Socket>,
2249 stderr: Option<fidl::Socket>,
2250 command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
2251 control_handle: InteractiveGuestControlHandle,
2252 },
2253 Start {
2254 guest_type: GuestType,
2255 name: String,
2256 guest_config: fidl_fuchsia_virtualization::GuestConfig,
2257 responder: InteractiveGuestStartResponder,
2258 },
2259 Shutdown {
2260 responder: InteractiveGuestShutdownResponder,
2261 },
2262}
2263
2264impl InteractiveGuestRequest {
2265 #[allow(irrefutable_let_patterns)]
2266 pub fn into_put_file(
2267 self,
2268 ) -> Option<(
2269 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
2270 String,
2271 InteractiveGuestPutFileResponder,
2272 )> {
2273 if let InteractiveGuestRequest::PutFile { local_file, remote_path, responder } = self {
2274 Some((local_file, remote_path, responder))
2275 } else {
2276 None
2277 }
2278 }
2279
2280 #[allow(irrefutable_let_patterns)]
2281 pub fn into_get_file(
2282 self,
2283 ) -> Option<(
2284 String,
2285 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
2286 InteractiveGuestGetFileResponder,
2287 )> {
2288 if let InteractiveGuestRequest::GetFile { remote_path, local_file, responder } = self {
2289 Some((remote_path, local_file, responder))
2290 } else {
2291 None
2292 }
2293 }
2294
2295 #[allow(irrefutable_let_patterns)]
2296 pub fn into_execute_command(
2297 self,
2298 ) -> Option<(
2299 String,
2300 Vec<EnvironmentVariable>,
2301 Option<fidl::Socket>,
2302 Option<fidl::Socket>,
2303 Option<fidl::Socket>,
2304 fidl::endpoints::ServerEnd<CommandListenerMarker>,
2305 InteractiveGuestControlHandle,
2306 )> {
2307 if let InteractiveGuestRequest::ExecuteCommand {
2308 command,
2309 env,
2310 stdin,
2311 stdout,
2312 stderr,
2313 command_listener,
2314 control_handle,
2315 } = self
2316 {
2317 Some((command, env, stdin, stdout, stderr, command_listener, control_handle))
2318 } else {
2319 None
2320 }
2321 }
2322
2323 #[allow(irrefutable_let_patterns)]
2324 pub fn into_start(
2325 self,
2326 ) -> Option<(
2327 GuestType,
2328 String,
2329 fidl_fuchsia_virtualization::GuestConfig,
2330 InteractiveGuestStartResponder,
2331 )> {
2332 if let InteractiveGuestRequest::Start { guest_type, name, guest_config, responder } = self {
2333 Some((guest_type, name, guest_config, responder))
2334 } else {
2335 None
2336 }
2337 }
2338
2339 #[allow(irrefutable_let_patterns)]
2340 pub fn into_shutdown(self) -> Option<(InteractiveGuestShutdownResponder)> {
2341 if let InteractiveGuestRequest::Shutdown { responder } = self {
2342 Some((responder))
2343 } else {
2344 None
2345 }
2346 }
2347
2348 pub fn method_name(&self) -> &'static str {
2350 match *self {
2351 InteractiveGuestRequest::PutFile { .. } => "put_file",
2352 InteractiveGuestRequest::GetFile { .. } => "get_file",
2353 InteractiveGuestRequest::ExecuteCommand { .. } => "execute_command",
2354 InteractiveGuestRequest::Start { .. } => "start",
2355 InteractiveGuestRequest::Shutdown { .. } => "shutdown",
2356 }
2357 }
2358}
2359
2360#[derive(Debug, Clone)]
2361pub struct InteractiveGuestControlHandle {
2362 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2363}
2364
2365impl fidl::endpoints::ControlHandle for InteractiveGuestControlHandle {
2366 fn shutdown(&self) {
2367 self.inner.shutdown()
2368 }
2369
2370 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2371 self.inner.shutdown_with_epitaph(status)
2372 }
2373
2374 fn is_closed(&self) -> bool {
2375 self.inner.channel().is_closed()
2376 }
2377 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2378 self.inner.channel().on_closed()
2379 }
2380
2381 #[cfg(target_os = "fuchsia")]
2382 fn signal_peer(
2383 &self,
2384 clear_mask: zx::Signals,
2385 set_mask: zx::Signals,
2386 ) -> Result<(), zx_status::Status> {
2387 use fidl::Peered;
2388 self.inner.channel().signal_peer(clear_mask, set_mask)
2389 }
2390}
2391
2392impl InteractiveGuestControlHandle {}
2393
2394#[must_use = "FIDL methods require a response to be sent"]
2395#[derive(Debug)]
2396pub struct InteractiveGuestPutFileResponder {
2397 control_handle: std::mem::ManuallyDrop<InteractiveGuestControlHandle>,
2398 tx_id: u32,
2399}
2400
2401impl std::ops::Drop for InteractiveGuestPutFileResponder {
2405 fn drop(&mut self) {
2406 self.control_handle.shutdown();
2407 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2409 }
2410}
2411
2412impl fidl::endpoints::Responder for InteractiveGuestPutFileResponder {
2413 type ControlHandle = InteractiveGuestControlHandle;
2414
2415 fn control_handle(&self) -> &InteractiveGuestControlHandle {
2416 &self.control_handle
2417 }
2418
2419 fn drop_without_shutdown(mut self) {
2420 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2422 std::mem::forget(self);
2424 }
2425}
2426
2427impl InteractiveGuestPutFileResponder {
2428 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2432 let _result = self.send_raw(status);
2433 if _result.is_err() {
2434 self.control_handle.shutdown();
2435 }
2436 self.drop_without_shutdown();
2437 _result
2438 }
2439
2440 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2442 let _result = self.send_raw(status);
2443 self.drop_without_shutdown();
2444 _result
2445 }
2446
2447 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2448 self.control_handle.inner.send::<InteractionPutFileResponse>(
2449 (status,),
2450 self.tx_id,
2451 0x223bc20da4a7cddd,
2452 fidl::encoding::DynamicFlags::empty(),
2453 )
2454 }
2455}
2456
2457#[must_use = "FIDL methods require a response to be sent"]
2458#[derive(Debug)]
2459pub struct InteractiveGuestGetFileResponder {
2460 control_handle: std::mem::ManuallyDrop<InteractiveGuestControlHandle>,
2461 tx_id: u32,
2462}
2463
2464impl std::ops::Drop for InteractiveGuestGetFileResponder {
2468 fn drop(&mut self) {
2469 self.control_handle.shutdown();
2470 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2472 }
2473}
2474
2475impl fidl::endpoints::Responder for InteractiveGuestGetFileResponder {
2476 type ControlHandle = InteractiveGuestControlHandle;
2477
2478 fn control_handle(&self) -> &InteractiveGuestControlHandle {
2479 &self.control_handle
2480 }
2481
2482 fn drop_without_shutdown(mut self) {
2483 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2485 std::mem::forget(self);
2487 }
2488}
2489
2490impl InteractiveGuestGetFileResponder {
2491 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2495 let _result = self.send_raw(status);
2496 if _result.is_err() {
2497 self.control_handle.shutdown();
2498 }
2499 self.drop_without_shutdown();
2500 _result
2501 }
2502
2503 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2505 let _result = self.send_raw(status);
2506 self.drop_without_shutdown();
2507 _result
2508 }
2509
2510 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2511 self.control_handle.inner.send::<InteractionGetFileResponse>(
2512 (status,),
2513 self.tx_id,
2514 0x7696bea472ca0f2d,
2515 fidl::encoding::DynamicFlags::empty(),
2516 )
2517 }
2518}
2519
2520#[must_use = "FIDL methods require a response to be sent"]
2521#[derive(Debug)]
2522pub struct InteractiveGuestStartResponder {
2523 control_handle: std::mem::ManuallyDrop<InteractiveGuestControlHandle>,
2524 tx_id: u32,
2525}
2526
2527impl std::ops::Drop for InteractiveGuestStartResponder {
2531 fn drop(&mut self) {
2532 self.control_handle.shutdown();
2533 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2535 }
2536}
2537
2538impl fidl::endpoints::Responder for InteractiveGuestStartResponder {
2539 type ControlHandle = InteractiveGuestControlHandle;
2540
2541 fn control_handle(&self) -> &InteractiveGuestControlHandle {
2542 &self.control_handle
2543 }
2544
2545 fn drop_without_shutdown(mut self) {
2546 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2548 std::mem::forget(self);
2550 }
2551}
2552
2553impl InteractiveGuestStartResponder {
2554 pub fn send(self) -> Result<(), fidl::Error> {
2558 let _result = self.send_raw();
2559 if _result.is_err() {
2560 self.control_handle.shutdown();
2561 }
2562 self.drop_without_shutdown();
2563 _result
2564 }
2565
2566 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2568 let _result = self.send_raw();
2569 self.drop_without_shutdown();
2570 _result
2571 }
2572
2573 fn send_raw(&self) -> Result<(), fidl::Error> {
2574 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2575 (),
2576 self.tx_id,
2577 0x1e0e391a2e0b9ed0,
2578 fidl::encoding::DynamicFlags::empty(),
2579 )
2580 }
2581}
2582
2583#[must_use = "FIDL methods require a response to be sent"]
2584#[derive(Debug)]
2585pub struct InteractiveGuestShutdownResponder {
2586 control_handle: std::mem::ManuallyDrop<InteractiveGuestControlHandle>,
2587 tx_id: u32,
2588}
2589
2590impl std::ops::Drop for InteractiveGuestShutdownResponder {
2594 fn drop(&mut self) {
2595 self.control_handle.shutdown();
2596 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2598 }
2599}
2600
2601impl fidl::endpoints::Responder for InteractiveGuestShutdownResponder {
2602 type ControlHandle = InteractiveGuestControlHandle;
2603
2604 fn control_handle(&self) -> &InteractiveGuestControlHandle {
2605 &self.control_handle
2606 }
2607
2608 fn drop_without_shutdown(mut self) {
2609 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2611 std::mem::forget(self);
2613 }
2614}
2615
2616impl InteractiveGuestShutdownResponder {
2617 pub fn send(self) -> Result<(), fidl::Error> {
2621 let _result = self.send_raw();
2622 if _result.is_err() {
2623 self.control_handle.shutdown();
2624 }
2625 self.drop_without_shutdown();
2626 _result
2627 }
2628
2629 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2631 let _result = self.send_raw();
2632 self.drop_without_shutdown();
2633 _result
2634 }
2635
2636 fn send_raw(&self) -> Result<(), fidl::Error> {
2637 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2638 (),
2639 self.tx_id,
2640 0x17019f7511bae997,
2641 fidl::encoding::DynamicFlags::empty(),
2642 )
2643 }
2644}
2645
2646mod internal {
2647 use super::*;
2648
2649 impl fidl::encoding::ResourceTypeMarker for DiscoveryGetGuestRequest {
2650 type Borrowed<'a> = &'a mut Self;
2651 fn take_or_borrow<'a>(
2652 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2653 ) -> Self::Borrowed<'a> {
2654 value
2655 }
2656 }
2657
2658 unsafe impl fidl::encoding::TypeMarker for DiscoveryGetGuestRequest {
2659 type Owned = Self;
2660
2661 #[inline(always)]
2662 fn inline_align(_context: fidl::encoding::Context) -> usize {
2663 8
2664 }
2665
2666 #[inline(always)]
2667 fn inline_size(_context: fidl::encoding::Context) -> usize {
2668 40
2669 }
2670 }
2671
2672 unsafe impl
2673 fidl::encoding::Encode<
2674 DiscoveryGetGuestRequest,
2675 fidl::encoding::DefaultFuchsiaResourceDialect,
2676 > for &mut DiscoveryGetGuestRequest
2677 {
2678 #[inline]
2679 unsafe fn encode(
2680 self,
2681 encoder: &mut fidl::encoding::Encoder<
2682 '_,
2683 fidl::encoding::DefaultFuchsiaResourceDialect,
2684 >,
2685 offset: usize,
2686 _depth: fidl::encoding::Depth,
2687 ) -> fidl::Result<()> {
2688 encoder.debug_check_bounds::<DiscoveryGetGuestRequest>(offset);
2689 fidl::encoding::Encode::<DiscoveryGetGuestRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2691 (
2692 <fidl::encoding::Optional<fidl::encoding::BoundedString<1024>> as fidl::encoding::ValueTypeMarker>::borrow(&self.realm_name),
2693 <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_name),
2694 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
2695 ),
2696 encoder, offset, _depth
2697 )
2698 }
2699 }
2700 unsafe impl<
2701 T0: fidl::encoding::Encode<
2702 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
2703 fidl::encoding::DefaultFuchsiaResourceDialect,
2704 >,
2705 T1: fidl::encoding::Encode<
2706 fidl::encoding::BoundedString<1024>,
2707 fidl::encoding::DefaultFuchsiaResourceDialect,
2708 >,
2709 T2: fidl::encoding::Encode<
2710 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
2711 fidl::encoding::DefaultFuchsiaResourceDialect,
2712 >,
2713 >
2714 fidl::encoding::Encode<
2715 DiscoveryGetGuestRequest,
2716 fidl::encoding::DefaultFuchsiaResourceDialect,
2717 > for (T0, T1, T2)
2718 {
2719 #[inline]
2720 unsafe fn encode(
2721 self,
2722 encoder: &mut fidl::encoding::Encoder<
2723 '_,
2724 fidl::encoding::DefaultFuchsiaResourceDialect,
2725 >,
2726 offset: usize,
2727 depth: fidl::encoding::Depth,
2728 ) -> fidl::Result<()> {
2729 encoder.debug_check_bounds::<DiscoveryGetGuestRequest>(offset);
2730 unsafe {
2733 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2734 (ptr as *mut u64).write_unaligned(0);
2735 }
2736 self.0.encode(encoder, offset + 0, depth)?;
2738 self.1.encode(encoder, offset + 16, depth)?;
2739 self.2.encode(encoder, offset + 32, depth)?;
2740 Ok(())
2741 }
2742 }
2743
2744 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2745 for DiscoveryGetGuestRequest
2746 {
2747 #[inline(always)]
2748 fn new_empty() -> Self {
2749 Self {
2750 realm_name: fidl::new_empty!(
2751 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
2752 fidl::encoding::DefaultFuchsiaResourceDialect
2753 ),
2754 guest_name: fidl::new_empty!(
2755 fidl::encoding::BoundedString<1024>,
2756 fidl::encoding::DefaultFuchsiaResourceDialect
2757 ),
2758 guest: fidl::new_empty!(
2759 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
2760 fidl::encoding::DefaultFuchsiaResourceDialect
2761 ),
2762 }
2763 }
2764
2765 #[inline]
2766 unsafe fn decode(
2767 &mut self,
2768 decoder: &mut fidl::encoding::Decoder<
2769 '_,
2770 fidl::encoding::DefaultFuchsiaResourceDialect,
2771 >,
2772 offset: usize,
2773 _depth: fidl::encoding::Depth,
2774 ) -> fidl::Result<()> {
2775 decoder.debug_check_bounds::<Self>(offset);
2776 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2778 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2779 let mask = 0xffffffff00000000u64;
2780 let maskedval = padval & mask;
2781 if maskedval != 0 {
2782 return Err(fidl::Error::NonZeroPadding {
2783 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2784 });
2785 }
2786 fidl::decode!(
2787 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
2788 fidl::encoding::DefaultFuchsiaResourceDialect,
2789 &mut self.realm_name,
2790 decoder,
2791 offset + 0,
2792 _depth
2793 )?;
2794 fidl::decode!(
2795 fidl::encoding::BoundedString<1024>,
2796 fidl::encoding::DefaultFuchsiaResourceDialect,
2797 &mut self.guest_name,
2798 decoder,
2799 offset + 16,
2800 _depth
2801 )?;
2802 fidl::decode!(
2803 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
2804 fidl::encoding::DefaultFuchsiaResourceDialect,
2805 &mut self.guest,
2806 decoder,
2807 offset + 32,
2808 _depth
2809 )?;
2810 Ok(())
2811 }
2812 }
2813
2814 impl fidl::encoding::ResourceTypeMarker for InteractionExecuteCommandRequest {
2815 type Borrowed<'a> = &'a mut Self;
2816 fn take_or_borrow<'a>(
2817 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2818 ) -> Self::Borrowed<'a> {
2819 value
2820 }
2821 }
2822
2823 unsafe impl fidl::encoding::TypeMarker for InteractionExecuteCommandRequest {
2824 type Owned = Self;
2825
2826 #[inline(always)]
2827 fn inline_align(_context: fidl::encoding::Context) -> usize {
2828 8
2829 }
2830
2831 #[inline(always)]
2832 fn inline_size(_context: fidl::encoding::Context) -> usize {
2833 48
2834 }
2835 }
2836
2837 unsafe impl
2838 fidl::encoding::Encode<
2839 InteractionExecuteCommandRequest,
2840 fidl::encoding::DefaultFuchsiaResourceDialect,
2841 > for &mut InteractionExecuteCommandRequest
2842 {
2843 #[inline]
2844 unsafe fn encode(
2845 self,
2846 encoder: &mut fidl::encoding::Encoder<
2847 '_,
2848 fidl::encoding::DefaultFuchsiaResourceDialect,
2849 >,
2850 offset: usize,
2851 _depth: fidl::encoding::Depth,
2852 ) -> fidl::Result<()> {
2853 encoder.debug_check_bounds::<InteractionExecuteCommandRequest>(offset);
2854 fidl::encoding::Encode::<InteractionExecuteCommandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2856 (
2857 <fidl::encoding::BoundedString<8192> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
2858 <fidl::encoding::Vector<EnvironmentVariable, 1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.env),
2859 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdin),
2860 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdout),
2861 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stderr),
2862 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.command_listener),
2863 ),
2864 encoder, offset, _depth
2865 )
2866 }
2867 }
2868 unsafe impl<
2869 T0: fidl::encoding::Encode<
2870 fidl::encoding::BoundedString<8192>,
2871 fidl::encoding::DefaultFuchsiaResourceDialect,
2872 >,
2873 T1: fidl::encoding::Encode<
2874 fidl::encoding::Vector<EnvironmentVariable, 1024>,
2875 fidl::encoding::DefaultFuchsiaResourceDialect,
2876 >,
2877 T2: fidl::encoding::Encode<
2878 fidl::encoding::Optional<
2879 fidl::encoding::HandleType<
2880 fidl::Socket,
2881 { fidl::ObjectType::SOCKET.into_raw() },
2882 2147483648,
2883 >,
2884 >,
2885 fidl::encoding::DefaultFuchsiaResourceDialect,
2886 >,
2887 T3: fidl::encoding::Encode<
2888 fidl::encoding::Optional<
2889 fidl::encoding::HandleType<
2890 fidl::Socket,
2891 { fidl::ObjectType::SOCKET.into_raw() },
2892 2147483648,
2893 >,
2894 >,
2895 fidl::encoding::DefaultFuchsiaResourceDialect,
2896 >,
2897 T4: fidl::encoding::Encode<
2898 fidl::encoding::Optional<
2899 fidl::encoding::HandleType<
2900 fidl::Socket,
2901 { fidl::ObjectType::SOCKET.into_raw() },
2902 2147483648,
2903 >,
2904 >,
2905 fidl::encoding::DefaultFuchsiaResourceDialect,
2906 >,
2907 T5: fidl::encoding::Encode<
2908 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
2909 fidl::encoding::DefaultFuchsiaResourceDialect,
2910 >,
2911 >
2912 fidl::encoding::Encode<
2913 InteractionExecuteCommandRequest,
2914 fidl::encoding::DefaultFuchsiaResourceDialect,
2915 > for (T0, T1, T2, T3, T4, T5)
2916 {
2917 #[inline]
2918 unsafe fn encode(
2919 self,
2920 encoder: &mut fidl::encoding::Encoder<
2921 '_,
2922 fidl::encoding::DefaultFuchsiaResourceDialect,
2923 >,
2924 offset: usize,
2925 depth: fidl::encoding::Depth,
2926 ) -> fidl::Result<()> {
2927 encoder.debug_check_bounds::<InteractionExecuteCommandRequest>(offset);
2928 self.0.encode(encoder, offset + 0, depth)?;
2932 self.1.encode(encoder, offset + 16, depth)?;
2933 self.2.encode(encoder, offset + 32, depth)?;
2934 self.3.encode(encoder, offset + 36, depth)?;
2935 self.4.encode(encoder, offset + 40, depth)?;
2936 self.5.encode(encoder, offset + 44, depth)?;
2937 Ok(())
2938 }
2939 }
2940
2941 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2942 for InteractionExecuteCommandRequest
2943 {
2944 #[inline(always)]
2945 fn new_empty() -> Self {
2946 Self {
2947 command: fidl::new_empty!(
2948 fidl::encoding::BoundedString<8192>,
2949 fidl::encoding::DefaultFuchsiaResourceDialect
2950 ),
2951 env: fidl::new_empty!(fidl::encoding::Vector<EnvironmentVariable, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect),
2952 stdin: fidl::new_empty!(
2953 fidl::encoding::Optional<
2954 fidl::encoding::HandleType<
2955 fidl::Socket,
2956 { fidl::ObjectType::SOCKET.into_raw() },
2957 2147483648,
2958 >,
2959 >,
2960 fidl::encoding::DefaultFuchsiaResourceDialect
2961 ),
2962 stdout: fidl::new_empty!(
2963 fidl::encoding::Optional<
2964 fidl::encoding::HandleType<
2965 fidl::Socket,
2966 { fidl::ObjectType::SOCKET.into_raw() },
2967 2147483648,
2968 >,
2969 >,
2970 fidl::encoding::DefaultFuchsiaResourceDialect
2971 ),
2972 stderr: fidl::new_empty!(
2973 fidl::encoding::Optional<
2974 fidl::encoding::HandleType<
2975 fidl::Socket,
2976 { fidl::ObjectType::SOCKET.into_raw() },
2977 2147483648,
2978 >,
2979 >,
2980 fidl::encoding::DefaultFuchsiaResourceDialect
2981 ),
2982 command_listener: fidl::new_empty!(
2983 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
2984 fidl::encoding::DefaultFuchsiaResourceDialect
2985 ),
2986 }
2987 }
2988
2989 #[inline]
2990 unsafe fn decode(
2991 &mut self,
2992 decoder: &mut fidl::encoding::Decoder<
2993 '_,
2994 fidl::encoding::DefaultFuchsiaResourceDialect,
2995 >,
2996 offset: usize,
2997 _depth: fidl::encoding::Depth,
2998 ) -> fidl::Result<()> {
2999 decoder.debug_check_bounds::<Self>(offset);
3000 fidl::decode!(
3002 fidl::encoding::BoundedString<8192>,
3003 fidl::encoding::DefaultFuchsiaResourceDialect,
3004 &mut self.command,
3005 decoder,
3006 offset + 0,
3007 _depth
3008 )?;
3009 fidl::decode!(fidl::encoding::Vector<EnvironmentVariable, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.env, decoder, offset + 16, _depth)?;
3010 fidl::decode!(
3011 fidl::encoding::Optional<
3012 fidl::encoding::HandleType<
3013 fidl::Socket,
3014 { fidl::ObjectType::SOCKET.into_raw() },
3015 2147483648,
3016 >,
3017 >,
3018 fidl::encoding::DefaultFuchsiaResourceDialect,
3019 &mut self.stdin,
3020 decoder,
3021 offset + 32,
3022 _depth
3023 )?;
3024 fidl::decode!(
3025 fidl::encoding::Optional<
3026 fidl::encoding::HandleType<
3027 fidl::Socket,
3028 { fidl::ObjectType::SOCKET.into_raw() },
3029 2147483648,
3030 >,
3031 >,
3032 fidl::encoding::DefaultFuchsiaResourceDialect,
3033 &mut self.stdout,
3034 decoder,
3035 offset + 36,
3036 _depth
3037 )?;
3038 fidl::decode!(
3039 fidl::encoding::Optional<
3040 fidl::encoding::HandleType<
3041 fidl::Socket,
3042 { fidl::ObjectType::SOCKET.into_raw() },
3043 2147483648,
3044 >,
3045 >,
3046 fidl::encoding::DefaultFuchsiaResourceDialect,
3047 &mut self.stderr,
3048 decoder,
3049 offset + 40,
3050 _depth
3051 )?;
3052 fidl::decode!(
3053 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
3054 fidl::encoding::DefaultFuchsiaResourceDialect,
3055 &mut self.command_listener,
3056 decoder,
3057 offset + 44,
3058 _depth
3059 )?;
3060 Ok(())
3061 }
3062 }
3063
3064 impl fidl::encoding::ResourceTypeMarker for InteractionGetFileRequest {
3065 type Borrowed<'a> = &'a mut Self;
3066 fn take_or_borrow<'a>(
3067 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3068 ) -> Self::Borrowed<'a> {
3069 value
3070 }
3071 }
3072
3073 unsafe impl fidl::encoding::TypeMarker for InteractionGetFileRequest {
3074 type Owned = Self;
3075
3076 #[inline(always)]
3077 fn inline_align(_context: fidl::encoding::Context) -> usize {
3078 8
3079 }
3080
3081 #[inline(always)]
3082 fn inline_size(_context: fidl::encoding::Context) -> usize {
3083 24
3084 }
3085 }
3086
3087 unsafe impl
3088 fidl::encoding::Encode<
3089 InteractionGetFileRequest,
3090 fidl::encoding::DefaultFuchsiaResourceDialect,
3091 > for &mut InteractionGetFileRequest
3092 {
3093 #[inline]
3094 unsafe fn encode(
3095 self,
3096 encoder: &mut fidl::encoding::Encoder<
3097 '_,
3098 fidl::encoding::DefaultFuchsiaResourceDialect,
3099 >,
3100 offset: usize,
3101 _depth: fidl::encoding::Depth,
3102 ) -> fidl::Result<()> {
3103 encoder.debug_check_bounds::<InteractionGetFileRequest>(offset);
3104 fidl::encoding::Encode::<InteractionGetFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3106 (
3107 <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_path),
3108 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.local_file),
3109 ),
3110 encoder, offset, _depth
3111 )
3112 }
3113 }
3114 unsafe impl<
3115 T0: fidl::encoding::Encode<
3116 fidl::encoding::BoundedString<1024>,
3117 fidl::encoding::DefaultFuchsiaResourceDialect,
3118 >,
3119 T1: fidl::encoding::Encode<
3120 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
3121 fidl::encoding::DefaultFuchsiaResourceDialect,
3122 >,
3123 >
3124 fidl::encoding::Encode<
3125 InteractionGetFileRequest,
3126 fidl::encoding::DefaultFuchsiaResourceDialect,
3127 > for (T0, T1)
3128 {
3129 #[inline]
3130 unsafe fn encode(
3131 self,
3132 encoder: &mut fidl::encoding::Encoder<
3133 '_,
3134 fidl::encoding::DefaultFuchsiaResourceDialect,
3135 >,
3136 offset: usize,
3137 depth: fidl::encoding::Depth,
3138 ) -> fidl::Result<()> {
3139 encoder.debug_check_bounds::<InteractionGetFileRequest>(offset);
3140 unsafe {
3143 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3144 (ptr as *mut u64).write_unaligned(0);
3145 }
3146 self.0.encode(encoder, offset + 0, depth)?;
3148 self.1.encode(encoder, offset + 16, depth)?;
3149 Ok(())
3150 }
3151 }
3152
3153 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3154 for InteractionGetFileRequest
3155 {
3156 #[inline(always)]
3157 fn new_empty() -> Self {
3158 Self {
3159 remote_path: fidl::new_empty!(
3160 fidl::encoding::BoundedString<1024>,
3161 fidl::encoding::DefaultFuchsiaResourceDialect
3162 ),
3163 local_file: fidl::new_empty!(
3164 fidl::encoding::Endpoint<
3165 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
3166 >,
3167 fidl::encoding::DefaultFuchsiaResourceDialect
3168 ),
3169 }
3170 }
3171
3172 #[inline]
3173 unsafe fn decode(
3174 &mut self,
3175 decoder: &mut fidl::encoding::Decoder<
3176 '_,
3177 fidl::encoding::DefaultFuchsiaResourceDialect,
3178 >,
3179 offset: usize,
3180 _depth: fidl::encoding::Depth,
3181 ) -> fidl::Result<()> {
3182 decoder.debug_check_bounds::<Self>(offset);
3183 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3185 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3186 let mask = 0xffffffff00000000u64;
3187 let maskedval = padval & mask;
3188 if maskedval != 0 {
3189 return Err(fidl::Error::NonZeroPadding {
3190 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3191 });
3192 }
3193 fidl::decode!(
3194 fidl::encoding::BoundedString<1024>,
3195 fidl::encoding::DefaultFuchsiaResourceDialect,
3196 &mut self.remote_path,
3197 decoder,
3198 offset + 0,
3199 _depth
3200 )?;
3201 fidl::decode!(
3202 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
3203 fidl::encoding::DefaultFuchsiaResourceDialect,
3204 &mut self.local_file,
3205 decoder,
3206 offset + 16,
3207 _depth
3208 )?;
3209 Ok(())
3210 }
3211 }
3212
3213 impl fidl::encoding::ResourceTypeMarker for InteractionPutFileRequest {
3214 type Borrowed<'a> = &'a mut Self;
3215 fn take_or_borrow<'a>(
3216 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3217 ) -> Self::Borrowed<'a> {
3218 value
3219 }
3220 }
3221
3222 unsafe impl fidl::encoding::TypeMarker for InteractionPutFileRequest {
3223 type Owned = Self;
3224
3225 #[inline(always)]
3226 fn inline_align(_context: fidl::encoding::Context) -> usize {
3227 8
3228 }
3229
3230 #[inline(always)]
3231 fn inline_size(_context: fidl::encoding::Context) -> usize {
3232 24
3233 }
3234 }
3235
3236 unsafe impl
3237 fidl::encoding::Encode<
3238 InteractionPutFileRequest,
3239 fidl::encoding::DefaultFuchsiaResourceDialect,
3240 > for &mut InteractionPutFileRequest
3241 {
3242 #[inline]
3243 unsafe fn encode(
3244 self,
3245 encoder: &mut fidl::encoding::Encoder<
3246 '_,
3247 fidl::encoding::DefaultFuchsiaResourceDialect,
3248 >,
3249 offset: usize,
3250 _depth: fidl::encoding::Depth,
3251 ) -> fidl::Result<()> {
3252 encoder.debug_check_bounds::<InteractionPutFileRequest>(offset);
3253 fidl::encoding::Encode::<InteractionPutFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3255 (
3256 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.local_file),
3257 <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_path),
3258 ),
3259 encoder, offset, _depth
3260 )
3261 }
3262 }
3263 unsafe impl<
3264 T0: fidl::encoding::Encode<
3265 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
3266 fidl::encoding::DefaultFuchsiaResourceDialect,
3267 >,
3268 T1: fidl::encoding::Encode<
3269 fidl::encoding::BoundedString<1024>,
3270 fidl::encoding::DefaultFuchsiaResourceDialect,
3271 >,
3272 >
3273 fidl::encoding::Encode<
3274 InteractionPutFileRequest,
3275 fidl::encoding::DefaultFuchsiaResourceDialect,
3276 > for (T0, T1)
3277 {
3278 #[inline]
3279 unsafe fn encode(
3280 self,
3281 encoder: &mut fidl::encoding::Encoder<
3282 '_,
3283 fidl::encoding::DefaultFuchsiaResourceDialect,
3284 >,
3285 offset: usize,
3286 depth: fidl::encoding::Depth,
3287 ) -> fidl::Result<()> {
3288 encoder.debug_check_bounds::<InteractionPutFileRequest>(offset);
3289 unsafe {
3292 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3293 (ptr as *mut u64).write_unaligned(0);
3294 }
3295 self.0.encode(encoder, offset + 0, depth)?;
3297 self.1.encode(encoder, offset + 8, depth)?;
3298 Ok(())
3299 }
3300 }
3301
3302 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3303 for InteractionPutFileRequest
3304 {
3305 #[inline(always)]
3306 fn new_empty() -> Self {
3307 Self {
3308 local_file: fidl::new_empty!(
3309 fidl::encoding::Endpoint<
3310 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
3311 >,
3312 fidl::encoding::DefaultFuchsiaResourceDialect
3313 ),
3314 remote_path: fidl::new_empty!(
3315 fidl::encoding::BoundedString<1024>,
3316 fidl::encoding::DefaultFuchsiaResourceDialect
3317 ),
3318 }
3319 }
3320
3321 #[inline]
3322 unsafe fn decode(
3323 &mut self,
3324 decoder: &mut fidl::encoding::Decoder<
3325 '_,
3326 fidl::encoding::DefaultFuchsiaResourceDialect,
3327 >,
3328 offset: usize,
3329 _depth: fidl::encoding::Depth,
3330 ) -> fidl::Result<()> {
3331 decoder.debug_check_bounds::<Self>(offset);
3332 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3334 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3335 let mask = 0xffffffff00000000u64;
3336 let maskedval = padval & mask;
3337 if maskedval != 0 {
3338 return Err(fidl::Error::NonZeroPadding {
3339 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3340 });
3341 }
3342 fidl::decode!(
3343 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
3344 fidl::encoding::DefaultFuchsiaResourceDialect,
3345 &mut self.local_file,
3346 decoder,
3347 offset + 0,
3348 _depth
3349 )?;
3350 fidl::decode!(
3351 fidl::encoding::BoundedString<1024>,
3352 fidl::encoding::DefaultFuchsiaResourceDialect,
3353 &mut self.remote_path,
3354 decoder,
3355 offset + 8,
3356 _depth
3357 )?;
3358 Ok(())
3359 }
3360 }
3361
3362 impl fidl::encoding::ResourceTypeMarker for InteractiveGuestStartRequest {
3363 type Borrowed<'a> = &'a mut Self;
3364 fn take_or_borrow<'a>(
3365 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3366 ) -> Self::Borrowed<'a> {
3367 value
3368 }
3369 }
3370
3371 unsafe impl fidl::encoding::TypeMarker for InteractiveGuestStartRequest {
3372 type Owned = Self;
3373
3374 #[inline(always)]
3375 fn inline_align(_context: fidl::encoding::Context) -> usize {
3376 8
3377 }
3378
3379 #[inline(always)]
3380 fn inline_size(_context: fidl::encoding::Context) -> usize {
3381 40
3382 }
3383 }
3384
3385 unsafe impl
3386 fidl::encoding::Encode<
3387 InteractiveGuestStartRequest,
3388 fidl::encoding::DefaultFuchsiaResourceDialect,
3389 > for &mut InteractiveGuestStartRequest
3390 {
3391 #[inline]
3392 unsafe fn encode(
3393 self,
3394 encoder: &mut fidl::encoding::Encoder<
3395 '_,
3396 fidl::encoding::DefaultFuchsiaResourceDialect,
3397 >,
3398 offset: usize,
3399 _depth: fidl::encoding::Depth,
3400 ) -> fidl::Result<()> {
3401 encoder.debug_check_bounds::<InteractiveGuestStartRequest>(offset);
3402 fidl::encoding::Encode::<InteractiveGuestStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3404 (
3405 <GuestType as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_type),
3406 <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
3407 <fidl_fuchsia_virtualization::GuestConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest_config),
3408 ),
3409 encoder, offset, _depth
3410 )
3411 }
3412 }
3413 unsafe impl<
3414 T0: fidl::encoding::Encode<GuestType, fidl::encoding::DefaultFuchsiaResourceDialect>,
3415 T1: fidl::encoding::Encode<
3416 fidl::encoding::BoundedString<1024>,
3417 fidl::encoding::DefaultFuchsiaResourceDialect,
3418 >,
3419 T2: fidl::encoding::Encode<
3420 fidl_fuchsia_virtualization::GuestConfig,
3421 fidl::encoding::DefaultFuchsiaResourceDialect,
3422 >,
3423 >
3424 fidl::encoding::Encode<
3425 InteractiveGuestStartRequest,
3426 fidl::encoding::DefaultFuchsiaResourceDialect,
3427 > for (T0, T1, T2)
3428 {
3429 #[inline]
3430 unsafe fn encode(
3431 self,
3432 encoder: &mut fidl::encoding::Encoder<
3433 '_,
3434 fidl::encoding::DefaultFuchsiaResourceDialect,
3435 >,
3436 offset: usize,
3437 depth: fidl::encoding::Depth,
3438 ) -> fidl::Result<()> {
3439 encoder.debug_check_bounds::<InteractiveGuestStartRequest>(offset);
3440 unsafe {
3443 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3444 (ptr as *mut u64).write_unaligned(0);
3445 }
3446 self.0.encode(encoder, offset + 0, depth)?;
3448 self.1.encode(encoder, offset + 8, depth)?;
3449 self.2.encode(encoder, offset + 24, depth)?;
3450 Ok(())
3451 }
3452 }
3453
3454 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3455 for InteractiveGuestStartRequest
3456 {
3457 #[inline(always)]
3458 fn new_empty() -> Self {
3459 Self {
3460 guest_type: fidl::new_empty!(
3461 GuestType,
3462 fidl::encoding::DefaultFuchsiaResourceDialect
3463 ),
3464 name: fidl::new_empty!(
3465 fidl::encoding::BoundedString<1024>,
3466 fidl::encoding::DefaultFuchsiaResourceDialect
3467 ),
3468 guest_config: fidl::new_empty!(
3469 fidl_fuchsia_virtualization::GuestConfig,
3470 fidl::encoding::DefaultFuchsiaResourceDialect
3471 ),
3472 }
3473 }
3474
3475 #[inline]
3476 unsafe fn decode(
3477 &mut self,
3478 decoder: &mut fidl::encoding::Decoder<
3479 '_,
3480 fidl::encoding::DefaultFuchsiaResourceDialect,
3481 >,
3482 offset: usize,
3483 _depth: fidl::encoding::Depth,
3484 ) -> fidl::Result<()> {
3485 decoder.debug_check_bounds::<Self>(offset);
3486 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3488 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3489 let mask = 0xffffffff00000000u64;
3490 let maskedval = padval & mask;
3491 if maskedval != 0 {
3492 return Err(fidl::Error::NonZeroPadding {
3493 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3494 });
3495 }
3496 fidl::decode!(
3497 GuestType,
3498 fidl::encoding::DefaultFuchsiaResourceDialect,
3499 &mut self.guest_type,
3500 decoder,
3501 offset + 0,
3502 _depth
3503 )?;
3504 fidl::decode!(
3505 fidl::encoding::BoundedString<1024>,
3506 fidl::encoding::DefaultFuchsiaResourceDialect,
3507 &mut self.name,
3508 decoder,
3509 offset + 8,
3510 _depth
3511 )?;
3512 fidl::decode!(
3513 fidl_fuchsia_virtualization::GuestConfig,
3514 fidl::encoding::DefaultFuchsiaResourceDialect,
3515 &mut self.guest_config,
3516 decoder,
3517 offset + 24,
3518 _depth
3519 )?;
3520 Ok(())
3521 }
3522 }
3523}