fidl_fuchsia_virtualization_guest_interaction/
fidl_fuchsia_virtualization_guest_interaction.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
55pub struct CommandListenerMarker;
56
57impl fidl::endpoints::ProtocolMarker for CommandListenerMarker {
58    type Proxy = CommandListenerProxy;
59    type RequestStream = CommandListenerRequestStream;
60    #[cfg(target_os = "fuchsia")]
61    type SynchronousProxy = CommandListenerSynchronousProxy;
62
63    const DEBUG_NAME: &'static str = "(anonymous) CommandListener";
64}
65
66pub trait CommandListenerProxyInterface: Send + Sync {}
67#[derive(Debug)]
68#[cfg(target_os = "fuchsia")]
69pub struct CommandListenerSynchronousProxy {
70    client: fidl::client::sync::Client,
71}
72
73#[cfg(target_os = "fuchsia")]
74impl fidl::endpoints::SynchronousProxy for CommandListenerSynchronousProxy {
75    type Proxy = CommandListenerProxy;
76    type Protocol = CommandListenerMarker;
77
78    fn from_channel(inner: fidl::Channel) -> Self {
79        Self::new(inner)
80    }
81
82    fn into_channel(self) -> fidl::Channel {
83        self.client.into_channel()
84    }
85
86    fn as_channel(&self) -> &fidl::Channel {
87        self.client.as_channel()
88    }
89}
90
91#[cfg(target_os = "fuchsia")]
92impl CommandListenerSynchronousProxy {
93    pub fn new(channel: fidl::Channel) -> Self {
94        let protocol_name = <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
95        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
96    }
97
98    pub fn into_channel(self) -> fidl::Channel {
99        self.client.into_channel()
100    }
101
102    /// Waits until an event arrives and returns it. It is safe for other
103    /// threads to make concurrent requests while waiting for an event.
104    pub fn wait_for_event(
105        &self,
106        deadline: zx::MonotonicInstant,
107    ) -> Result<CommandListenerEvent, fidl::Error> {
108        CommandListenerEvent::decode(self.client.wait_for_event(deadline)?)
109    }
110}
111
112#[derive(Debug, Clone)]
113pub struct CommandListenerProxy {
114    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
115}
116
117impl fidl::endpoints::Proxy for CommandListenerProxy {
118    type Protocol = CommandListenerMarker;
119
120    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
121        Self::new(inner)
122    }
123
124    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
125        self.client.into_channel().map_err(|client| Self { client })
126    }
127
128    fn as_channel(&self) -> &::fidl::AsyncChannel {
129        self.client.as_channel()
130    }
131}
132
133impl CommandListenerProxy {
134    /// Create a new Proxy for fuchsia.virtualization.guest.interaction/CommandListener.
135    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
136        let protocol_name = <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
137        Self { client: fidl::client::Client::new(channel, protocol_name) }
138    }
139
140    /// Get a Stream of events from the remote end of the protocol.
141    ///
142    /// # Panics
143    ///
144    /// Panics if the event stream was already taken.
145    pub fn take_event_stream(&self) -> CommandListenerEventStream {
146        CommandListenerEventStream { event_receiver: self.client.take_event_receiver() }
147    }
148}
149
150impl CommandListenerProxyInterface for CommandListenerProxy {}
151
152pub struct CommandListenerEventStream {
153    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
154}
155
156impl std::marker::Unpin for CommandListenerEventStream {}
157
158impl futures::stream::FusedStream for CommandListenerEventStream {
159    fn is_terminated(&self) -> bool {
160        self.event_receiver.is_terminated()
161    }
162}
163
164impl futures::Stream for CommandListenerEventStream {
165    type Item = Result<CommandListenerEvent, fidl::Error>;
166
167    fn poll_next(
168        mut self: std::pin::Pin<&mut Self>,
169        cx: &mut std::task::Context<'_>,
170    ) -> std::task::Poll<Option<Self::Item>> {
171        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
172            &mut self.event_receiver,
173            cx
174        )?) {
175            Some(buf) => std::task::Poll::Ready(Some(CommandListenerEvent::decode(buf))),
176            None => std::task::Poll::Ready(None),
177        }
178    }
179}
180
181#[derive(Debug)]
182pub enum CommandListenerEvent {
183    OnStarted { status: i32 },
184    OnTerminated { status: i32, return_code: i32 },
185}
186
187impl CommandListenerEvent {
188    #[allow(irrefutable_let_patterns)]
189    pub fn into_on_started(self) -> Option<i32> {
190        if let CommandListenerEvent::OnStarted { status } = self {
191            Some((status))
192        } else {
193            None
194        }
195    }
196    #[allow(irrefutable_let_patterns)]
197    pub fn into_on_terminated(self) -> Option<(i32, i32)> {
198        if let CommandListenerEvent::OnTerminated { status, return_code } = self {
199            Some((status, return_code))
200        } else {
201            None
202        }
203    }
204
205    /// Decodes a message buffer as a [`CommandListenerEvent`].
206    fn decode(
207        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
208    ) -> Result<CommandListenerEvent, fidl::Error> {
209        let (bytes, _handles) = buf.split_mut();
210        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
211        debug_assert_eq!(tx_header.tx_id, 0);
212        match tx_header.ordinal {
213            0x3a3693a7e54a5f09 => {
214                let mut out = fidl::new_empty!(
215                    CommandListenerOnStartedRequest,
216                    fidl::encoding::DefaultFuchsiaResourceDialect
217                );
218                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommandListenerOnStartedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
219                Ok((CommandListenerEvent::OnStarted { status: out.status }))
220            }
221            0x5a08413bdea2446a => {
222                let mut out = fidl::new_empty!(
223                    CommandListenerOnTerminatedRequest,
224                    fidl::encoding::DefaultFuchsiaResourceDialect
225                );
226                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommandListenerOnTerminatedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
227                Ok((CommandListenerEvent::OnTerminated {
228                    status: out.status,
229                    return_code: out.return_code,
230                }))
231            }
232            _ => Err(fidl::Error::UnknownOrdinal {
233                ordinal: tx_header.ordinal,
234                protocol_name:
235                    <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
236            }),
237        }
238    }
239}
240
241/// A Stream of incoming requests for fuchsia.virtualization.guest.interaction/CommandListener.
242pub struct CommandListenerRequestStream {
243    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
244    is_terminated: bool,
245}
246
247impl std::marker::Unpin for CommandListenerRequestStream {}
248
249impl futures::stream::FusedStream for CommandListenerRequestStream {
250    fn is_terminated(&self) -> bool {
251        self.is_terminated
252    }
253}
254
255impl fidl::endpoints::RequestStream for CommandListenerRequestStream {
256    type Protocol = CommandListenerMarker;
257    type ControlHandle = CommandListenerControlHandle;
258
259    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
260        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
261    }
262
263    fn control_handle(&self) -> Self::ControlHandle {
264        CommandListenerControlHandle { inner: self.inner.clone() }
265    }
266
267    fn into_inner(
268        self,
269    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
270    {
271        (self.inner, self.is_terminated)
272    }
273
274    fn from_inner(
275        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
276        is_terminated: bool,
277    ) -> Self {
278        Self { inner, is_terminated }
279    }
280}
281
282impl futures::Stream for CommandListenerRequestStream {
283    type Item = Result<CommandListenerRequest, fidl::Error>;
284
285    fn poll_next(
286        mut self: std::pin::Pin<&mut Self>,
287        cx: &mut std::task::Context<'_>,
288    ) -> std::task::Poll<Option<Self::Item>> {
289        let this = &mut *self;
290        if this.inner.check_shutdown(cx) {
291            this.is_terminated = true;
292            return std::task::Poll::Ready(None);
293        }
294        if this.is_terminated {
295            panic!("polled CommandListenerRequestStream after completion");
296        }
297        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
298            |bytes, handles| {
299                match this.inner.channel().read_etc(cx, bytes, handles) {
300                    std::task::Poll::Ready(Ok(())) => {}
301                    std::task::Poll::Pending => return std::task::Poll::Pending,
302                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
303                        this.is_terminated = true;
304                        return std::task::Poll::Ready(None);
305                    }
306                    std::task::Poll::Ready(Err(e)) => {
307                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
308                            e.into(),
309                        ))))
310                    }
311                }
312
313                // A message has been received from the channel
314                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
315
316                std::task::Poll::Ready(Some(match header.ordinal {
317                    _ => Err(fidl::Error::UnknownOrdinal {
318                        ordinal: header.ordinal,
319                        protocol_name:
320                            <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
321                    }),
322                }))
323            },
324        )
325    }
326}
327
328#[derive(Debug)]
329pub enum CommandListenerRequest {}
330
331impl CommandListenerRequest {
332    /// Name of the method defined in FIDL
333    pub fn method_name(&self) -> &'static str {
334        match *self {}
335    }
336}
337
338#[derive(Debug, Clone)]
339pub struct CommandListenerControlHandle {
340    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
341}
342
343impl fidl::endpoints::ControlHandle for CommandListenerControlHandle {
344    fn shutdown(&self) {
345        self.inner.shutdown()
346    }
347    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
348        self.inner.shutdown_with_epitaph(status)
349    }
350
351    fn is_closed(&self) -> bool {
352        self.inner.channel().is_closed()
353    }
354    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
355        self.inner.channel().on_closed()
356    }
357
358    #[cfg(target_os = "fuchsia")]
359    fn signal_peer(
360        &self,
361        clear_mask: zx::Signals,
362        set_mask: zx::Signals,
363    ) -> Result<(), zx_status::Status> {
364        use fidl::Peered;
365        self.inner.channel().signal_peer(clear_mask, set_mask)
366    }
367}
368
369impl CommandListenerControlHandle {
370    pub fn send_on_started(&self, mut status: i32) -> Result<(), fidl::Error> {
371        self.inner.send::<CommandListenerOnStartedRequest>(
372            (status,),
373            0,
374            0x3a3693a7e54a5f09,
375            fidl::encoding::DynamicFlags::empty(),
376        )
377    }
378
379    pub fn send_on_terminated(
380        &self,
381        mut status: i32,
382        mut return_code: i32,
383    ) -> Result<(), fidl::Error> {
384        self.inner.send::<CommandListenerOnTerminatedRequest>(
385            (status, return_code),
386            0,
387            0x5a08413bdea2446a,
388            fidl::encoding::DynamicFlags::empty(),
389        )
390    }
391}
392
393#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
394pub struct DiscoveryMarker;
395
396impl fidl::endpoints::ProtocolMarker for DiscoveryMarker {
397    type Proxy = DiscoveryProxy;
398    type RequestStream = DiscoveryRequestStream;
399    #[cfg(target_os = "fuchsia")]
400    type SynchronousProxy = DiscoverySynchronousProxy;
401
402    const DEBUG_NAME: &'static str = "fuchsia.virtualization.guest.interaction.Discovery";
403}
404impl fidl::endpoints::DiscoverableProtocolMarker for DiscoveryMarker {}
405
406pub trait DiscoveryProxyInterface: Send + Sync {
407    fn r#get_guest(
408        &self,
409        realm_name: Option<&str>,
410        guest_name: &str,
411        guest: fidl::endpoints::ServerEnd<InteractionMarker>,
412    ) -> Result<(), fidl::Error>;
413}
414#[derive(Debug)]
415#[cfg(target_os = "fuchsia")]
416pub struct DiscoverySynchronousProxy {
417    client: fidl::client::sync::Client,
418}
419
420#[cfg(target_os = "fuchsia")]
421impl fidl::endpoints::SynchronousProxy for DiscoverySynchronousProxy {
422    type Proxy = DiscoveryProxy;
423    type Protocol = DiscoveryMarker;
424
425    fn from_channel(inner: fidl::Channel) -> Self {
426        Self::new(inner)
427    }
428
429    fn into_channel(self) -> fidl::Channel {
430        self.client.into_channel()
431    }
432
433    fn as_channel(&self) -> &fidl::Channel {
434        self.client.as_channel()
435    }
436}
437
438#[cfg(target_os = "fuchsia")]
439impl DiscoverySynchronousProxy {
440    pub fn new(channel: fidl::Channel) -> Self {
441        let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
442        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
443    }
444
445    pub fn into_channel(self) -> fidl::Channel {
446        self.client.into_channel()
447    }
448
449    /// Waits until an event arrives and returns it. It is safe for other
450    /// threads to make concurrent requests while waiting for an event.
451    pub fn wait_for_event(
452        &self,
453        deadline: zx::MonotonicInstant,
454    ) -> Result<DiscoveryEvent, fidl::Error> {
455        DiscoveryEvent::decode(self.client.wait_for_event(deadline)?)
456    }
457
458    /// Finds the guest VM specified by realm name/guest name pair and connects to it to enable
459    /// file transfers and execution of commands.  If `realm_name` is null, `DEFAULT_REALM` is
460    /// used instead.
461    pub fn r#get_guest(
462        &self,
463        mut realm_name: Option<&str>,
464        mut guest_name: &str,
465        mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
466    ) -> Result<(), fidl::Error> {
467        self.client.send::<DiscoveryGetGuestRequest>(
468            (realm_name, guest_name, guest),
469            0x60538587bdd80a32,
470            fidl::encoding::DynamicFlags::empty(),
471        )
472    }
473}
474
475#[derive(Debug, Clone)]
476pub struct DiscoveryProxy {
477    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
478}
479
480impl fidl::endpoints::Proxy for DiscoveryProxy {
481    type Protocol = DiscoveryMarker;
482
483    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
484        Self::new(inner)
485    }
486
487    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
488        self.client.into_channel().map_err(|client| Self { client })
489    }
490
491    fn as_channel(&self) -> &::fidl::AsyncChannel {
492        self.client.as_channel()
493    }
494}
495
496impl DiscoveryProxy {
497    /// Create a new Proxy for fuchsia.virtualization.guest.interaction/Discovery.
498    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
499        let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
500        Self { client: fidl::client::Client::new(channel, protocol_name) }
501    }
502
503    /// Get a Stream of events from the remote end of the protocol.
504    ///
505    /// # Panics
506    ///
507    /// Panics if the event stream was already taken.
508    pub fn take_event_stream(&self) -> DiscoveryEventStream {
509        DiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
510    }
511
512    /// Finds the guest VM specified by realm name/guest name pair and connects to it to enable
513    /// file transfers and execution of commands.  If `realm_name` is null, `DEFAULT_REALM` is
514    /// used instead.
515    pub fn r#get_guest(
516        &self,
517        mut realm_name: Option<&str>,
518        mut guest_name: &str,
519        mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
520    ) -> Result<(), fidl::Error> {
521        DiscoveryProxyInterface::r#get_guest(self, realm_name, guest_name, guest)
522    }
523}
524
525impl DiscoveryProxyInterface for DiscoveryProxy {
526    fn r#get_guest(
527        &self,
528        mut realm_name: Option<&str>,
529        mut guest_name: &str,
530        mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
531    ) -> Result<(), fidl::Error> {
532        self.client.send::<DiscoveryGetGuestRequest>(
533            (realm_name, guest_name, guest),
534            0x60538587bdd80a32,
535            fidl::encoding::DynamicFlags::empty(),
536        )
537    }
538}
539
540pub struct DiscoveryEventStream {
541    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
542}
543
544impl std::marker::Unpin for DiscoveryEventStream {}
545
546impl futures::stream::FusedStream for DiscoveryEventStream {
547    fn is_terminated(&self) -> bool {
548        self.event_receiver.is_terminated()
549    }
550}
551
552impl futures::Stream for DiscoveryEventStream {
553    type Item = Result<DiscoveryEvent, fidl::Error>;
554
555    fn poll_next(
556        mut self: std::pin::Pin<&mut Self>,
557        cx: &mut std::task::Context<'_>,
558    ) -> std::task::Poll<Option<Self::Item>> {
559        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
560            &mut self.event_receiver,
561            cx
562        )?) {
563            Some(buf) => std::task::Poll::Ready(Some(DiscoveryEvent::decode(buf))),
564            None => std::task::Poll::Ready(None),
565        }
566    }
567}
568
569#[derive(Debug)]
570pub enum DiscoveryEvent {}
571
572impl DiscoveryEvent {
573    /// Decodes a message buffer as a [`DiscoveryEvent`].
574    fn decode(
575        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
576    ) -> Result<DiscoveryEvent, fidl::Error> {
577        let (bytes, _handles) = buf.split_mut();
578        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
579        debug_assert_eq!(tx_header.tx_id, 0);
580        match tx_header.ordinal {
581            _ => Err(fidl::Error::UnknownOrdinal {
582                ordinal: tx_header.ordinal,
583                protocol_name: <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
584            }),
585        }
586    }
587}
588
589/// A Stream of incoming requests for fuchsia.virtualization.guest.interaction/Discovery.
590pub struct DiscoveryRequestStream {
591    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
592    is_terminated: bool,
593}
594
595impl std::marker::Unpin for DiscoveryRequestStream {}
596
597impl futures::stream::FusedStream for DiscoveryRequestStream {
598    fn is_terminated(&self) -> bool {
599        self.is_terminated
600    }
601}
602
603impl fidl::endpoints::RequestStream for DiscoveryRequestStream {
604    type Protocol = DiscoveryMarker;
605    type ControlHandle = DiscoveryControlHandle;
606
607    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
608        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
609    }
610
611    fn control_handle(&self) -> Self::ControlHandle {
612        DiscoveryControlHandle { inner: self.inner.clone() }
613    }
614
615    fn into_inner(
616        self,
617    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
618    {
619        (self.inner, self.is_terminated)
620    }
621
622    fn from_inner(
623        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
624        is_terminated: bool,
625    ) -> Self {
626        Self { inner, is_terminated }
627    }
628}
629
630impl futures::Stream for DiscoveryRequestStream {
631    type Item = Result<DiscoveryRequest, fidl::Error>;
632
633    fn poll_next(
634        mut self: std::pin::Pin<&mut Self>,
635        cx: &mut std::task::Context<'_>,
636    ) -> std::task::Poll<Option<Self::Item>> {
637        let this = &mut *self;
638        if this.inner.check_shutdown(cx) {
639            this.is_terminated = true;
640            return std::task::Poll::Ready(None);
641        }
642        if this.is_terminated {
643            panic!("polled DiscoveryRequestStream after completion");
644        }
645        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
646            |bytes, handles| {
647                match this.inner.channel().read_etc(cx, bytes, handles) {
648                    std::task::Poll::Ready(Ok(())) => {}
649                    std::task::Poll::Pending => return std::task::Poll::Pending,
650                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
651                        this.is_terminated = true;
652                        return std::task::Poll::Ready(None);
653                    }
654                    std::task::Poll::Ready(Err(e)) => {
655                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
656                            e.into(),
657                        ))))
658                    }
659                }
660
661                // A message has been received from the channel
662                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
663
664                std::task::Poll::Ready(Some(match header.ordinal {
665                    0x60538587bdd80a32 => {
666                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
667                        let mut req = fidl::new_empty!(
668                            DiscoveryGetGuestRequest,
669                            fidl::encoding::DefaultFuchsiaResourceDialect
670                        );
671                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryGetGuestRequest>(&header, _body_bytes, handles, &mut req)?;
672                        let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
673                        Ok(DiscoveryRequest::GetGuest {
674                            realm_name: req.realm_name,
675                            guest_name: req.guest_name,
676                            guest: req.guest,
677
678                            control_handle,
679                        })
680                    }
681                    _ => Err(fidl::Error::UnknownOrdinal {
682                        ordinal: header.ordinal,
683                        protocol_name:
684                            <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
685                    }),
686                }))
687            },
688        )
689    }
690}
691
692/// Enables discovery of guest VM's for control in tests.
693#[derive(Debug)]
694pub enum DiscoveryRequest {
695    /// Finds the guest VM specified by realm name/guest name pair and connects to it to enable
696    /// file transfers and execution of commands.  If `realm_name` is null, `DEFAULT_REALM` is
697    /// used instead.
698    GetGuest {
699        realm_name: Option<String>,
700        guest_name: String,
701        guest: fidl::endpoints::ServerEnd<InteractionMarker>,
702        control_handle: DiscoveryControlHandle,
703    },
704}
705
706impl DiscoveryRequest {
707    #[allow(irrefutable_let_patterns)]
708    pub fn into_get_guest(
709        self,
710    ) -> Option<(
711        Option<String>,
712        String,
713        fidl::endpoints::ServerEnd<InteractionMarker>,
714        DiscoveryControlHandle,
715    )> {
716        if let DiscoveryRequest::GetGuest { realm_name, guest_name, guest, control_handle } = self {
717            Some((realm_name, guest_name, guest, control_handle))
718        } else {
719            None
720        }
721    }
722
723    /// Name of the method defined in FIDL
724    pub fn method_name(&self) -> &'static str {
725        match *self {
726            DiscoveryRequest::GetGuest { .. } => "get_guest",
727        }
728    }
729}
730
731#[derive(Debug, Clone)]
732pub struct DiscoveryControlHandle {
733    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
734}
735
736impl fidl::endpoints::ControlHandle for DiscoveryControlHandle {
737    fn shutdown(&self) {
738        self.inner.shutdown()
739    }
740    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
741        self.inner.shutdown_with_epitaph(status)
742    }
743
744    fn is_closed(&self) -> bool {
745        self.inner.channel().is_closed()
746    }
747    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
748        self.inner.channel().on_closed()
749    }
750
751    #[cfg(target_os = "fuchsia")]
752    fn signal_peer(
753        &self,
754        clear_mask: zx::Signals,
755        set_mask: zx::Signals,
756    ) -> Result<(), zx_status::Status> {
757        use fidl::Peered;
758        self.inner.channel().signal_peer(clear_mask, set_mask)
759    }
760}
761
762impl DiscoveryControlHandle {}
763
764#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
765pub struct InteractionMarker;
766
767impl fidl::endpoints::ProtocolMarker for InteractionMarker {
768    type Proxy = InteractionProxy;
769    type RequestStream = InteractionRequestStream;
770    #[cfg(target_os = "fuchsia")]
771    type SynchronousProxy = InteractionSynchronousProxy;
772
773    const DEBUG_NAME: &'static str = "(anonymous) Interaction";
774}
775
776pub trait InteractionProxyInterface: Send + Sync {
777    type PutFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
778    fn r#put_file(
779        &self,
780        local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
781        remote_path: &str,
782    ) -> Self::PutFileResponseFut;
783    type GetFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
784    fn r#get_file(
785        &self,
786        remote_path: &str,
787        local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
788    ) -> Self::GetFileResponseFut;
789    fn r#execute_command(
790        &self,
791        command: &str,
792        env: &[EnvironmentVariable],
793        stdin: Option<fidl::Socket>,
794        stdout: Option<fidl::Socket>,
795        stderr: Option<fidl::Socket>,
796        command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
797    ) -> Result<(), fidl::Error>;
798}
799#[derive(Debug)]
800#[cfg(target_os = "fuchsia")]
801pub struct InteractionSynchronousProxy {
802    client: fidl::client::sync::Client,
803}
804
805#[cfg(target_os = "fuchsia")]
806impl fidl::endpoints::SynchronousProxy for InteractionSynchronousProxy {
807    type Proxy = InteractionProxy;
808    type Protocol = InteractionMarker;
809
810    fn from_channel(inner: fidl::Channel) -> Self {
811        Self::new(inner)
812    }
813
814    fn into_channel(self) -> fidl::Channel {
815        self.client.into_channel()
816    }
817
818    fn as_channel(&self) -> &fidl::Channel {
819        self.client.as_channel()
820    }
821}
822
823#[cfg(target_os = "fuchsia")]
824impl InteractionSynchronousProxy {
825    pub fn new(channel: fidl::Channel) -> Self {
826        let protocol_name = <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
827        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
828    }
829
830    pub fn into_channel(self) -> fidl::Channel {
831        self.client.into_channel()
832    }
833
834    /// Waits until an event arrives and returns it. It is safe for other
835    /// threads to make concurrent requests while waiting for an event.
836    pub fn wait_for_event(
837        &self,
838        deadline: zx::MonotonicInstant,
839    ) -> Result<InteractionEvent, fidl::Error> {
840        InteractionEvent::decode(self.client.wait_for_event(deadline)?)
841    }
842
843    /// Take a local file from the Fuchsia host and transfer it to a destination
844    /// location on the guest under test.
845    pub fn r#put_file(
846        &self,
847        mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
848        mut remote_path: &str,
849        ___deadline: zx::MonotonicInstant,
850    ) -> Result<i32, fidl::Error> {
851        let _response =
852            self.client.send_query::<InteractionPutFileRequest, InteractionPutFileResponse>(
853                (local_file, remote_path),
854                0x223bc20da4a7cddd,
855                fidl::encoding::DynamicFlags::empty(),
856                ___deadline,
857            )?;
858        Ok(_response.status)
859    }
860
861    /// Pull a file from the guest under test and copy it to the specified
862    /// location on the Fuchsia host.
863    pub fn r#get_file(
864        &self,
865        mut remote_path: &str,
866        mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
867        ___deadline: zx::MonotonicInstant,
868    ) -> Result<i32, fidl::Error> {
869        let _response =
870            self.client.send_query::<InteractionGetFileRequest, InteractionGetFileResponse>(
871                (remote_path, local_file),
872                0x7696bea472ca0f2d,
873                fidl::encoding::DynamicFlags::empty(),
874                ___deadline,
875            )?;
876        Ok(_response.status)
877    }
878
879    /// Execute command on the guest under test and return the resulting output,
880    /// error, and return code.
881    pub fn r#execute_command(
882        &self,
883        mut command: &str,
884        mut env: &[EnvironmentVariable],
885        mut stdin: Option<fidl::Socket>,
886        mut stdout: Option<fidl::Socket>,
887        mut stderr: Option<fidl::Socket>,
888        mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
889    ) -> Result<(), fidl::Error> {
890        self.client.send::<InteractionExecuteCommandRequest>(
891            (command, env, stdin, stdout, stderr, command_listener),
892            0x612641220a1556d8,
893            fidl::encoding::DynamicFlags::empty(),
894        )
895    }
896}
897
898#[derive(Debug, Clone)]
899pub struct InteractionProxy {
900    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
901}
902
903impl fidl::endpoints::Proxy for InteractionProxy {
904    type Protocol = InteractionMarker;
905
906    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
907        Self::new(inner)
908    }
909
910    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
911        self.client.into_channel().map_err(|client| Self { client })
912    }
913
914    fn as_channel(&self) -> &::fidl::AsyncChannel {
915        self.client.as_channel()
916    }
917}
918
919impl InteractionProxy {
920    /// Create a new Proxy for fuchsia.virtualization.guest.interaction/Interaction.
921    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
922        let protocol_name = <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
923        Self { client: fidl::client::Client::new(channel, protocol_name) }
924    }
925
926    /// Get a Stream of events from the remote end of the protocol.
927    ///
928    /// # Panics
929    ///
930    /// Panics if the event stream was already taken.
931    pub fn take_event_stream(&self) -> InteractionEventStream {
932        InteractionEventStream { event_receiver: self.client.take_event_receiver() }
933    }
934
935    /// Take a local file from the Fuchsia host and transfer it to a destination
936    /// location on the guest under test.
937    pub fn r#put_file(
938        &self,
939        mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
940        mut remote_path: &str,
941    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
942        InteractionProxyInterface::r#put_file(self, local_file, remote_path)
943    }
944
945    /// Pull a file from the guest under test and copy it to the specified
946    /// location on the Fuchsia host.
947    pub fn r#get_file(
948        &self,
949        mut remote_path: &str,
950        mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
951    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
952        InteractionProxyInterface::r#get_file(self, remote_path, local_file)
953    }
954
955    /// Execute command on the guest under test and return the resulting output,
956    /// error, and return code.
957    pub fn r#execute_command(
958        &self,
959        mut command: &str,
960        mut env: &[EnvironmentVariable],
961        mut stdin: Option<fidl::Socket>,
962        mut stdout: Option<fidl::Socket>,
963        mut stderr: Option<fidl::Socket>,
964        mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
965    ) -> Result<(), fidl::Error> {
966        InteractionProxyInterface::r#execute_command(
967            self,
968            command,
969            env,
970            stdin,
971            stdout,
972            stderr,
973            command_listener,
974        )
975    }
976}
977
978impl InteractionProxyInterface for InteractionProxy {
979    type PutFileResponseFut =
980        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
981    fn r#put_file(
982        &self,
983        mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
984        mut remote_path: &str,
985    ) -> Self::PutFileResponseFut {
986        fn _decode(
987            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
988        ) -> Result<i32, fidl::Error> {
989            let _response = fidl::client::decode_transaction_body::<
990                InteractionPutFileResponse,
991                fidl::encoding::DefaultFuchsiaResourceDialect,
992                0x223bc20da4a7cddd,
993            >(_buf?)?;
994            Ok(_response.status)
995        }
996        self.client.send_query_and_decode::<InteractionPutFileRequest, i32>(
997            (local_file, remote_path),
998            0x223bc20da4a7cddd,
999            fidl::encoding::DynamicFlags::empty(),
1000            _decode,
1001        )
1002    }
1003
1004    type GetFileResponseFut =
1005        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1006    fn r#get_file(
1007        &self,
1008        mut remote_path: &str,
1009        mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1010    ) -> Self::GetFileResponseFut {
1011        fn _decode(
1012            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1013        ) -> Result<i32, fidl::Error> {
1014            let _response = fidl::client::decode_transaction_body::<
1015                InteractionGetFileResponse,
1016                fidl::encoding::DefaultFuchsiaResourceDialect,
1017                0x7696bea472ca0f2d,
1018            >(_buf?)?;
1019            Ok(_response.status)
1020        }
1021        self.client.send_query_and_decode::<InteractionGetFileRequest, i32>(
1022            (remote_path, local_file),
1023            0x7696bea472ca0f2d,
1024            fidl::encoding::DynamicFlags::empty(),
1025            _decode,
1026        )
1027    }
1028
1029    fn r#execute_command(
1030        &self,
1031        mut command: &str,
1032        mut env: &[EnvironmentVariable],
1033        mut stdin: Option<fidl::Socket>,
1034        mut stdout: Option<fidl::Socket>,
1035        mut stderr: Option<fidl::Socket>,
1036        mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1037    ) -> Result<(), fidl::Error> {
1038        self.client.send::<InteractionExecuteCommandRequest>(
1039            (command, env, stdin, stdout, stderr, command_listener),
1040            0x612641220a1556d8,
1041            fidl::encoding::DynamicFlags::empty(),
1042        )
1043    }
1044}
1045
1046pub struct InteractionEventStream {
1047    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1048}
1049
1050impl std::marker::Unpin for InteractionEventStream {}
1051
1052impl futures::stream::FusedStream for InteractionEventStream {
1053    fn is_terminated(&self) -> bool {
1054        self.event_receiver.is_terminated()
1055    }
1056}
1057
1058impl futures::Stream for InteractionEventStream {
1059    type Item = Result<InteractionEvent, fidl::Error>;
1060
1061    fn poll_next(
1062        mut self: std::pin::Pin<&mut Self>,
1063        cx: &mut std::task::Context<'_>,
1064    ) -> std::task::Poll<Option<Self::Item>> {
1065        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1066            &mut self.event_receiver,
1067            cx
1068        )?) {
1069            Some(buf) => std::task::Poll::Ready(Some(InteractionEvent::decode(buf))),
1070            None => std::task::Poll::Ready(None),
1071        }
1072    }
1073}
1074
1075#[derive(Debug)]
1076pub enum InteractionEvent {}
1077
1078impl InteractionEvent {
1079    /// Decodes a message buffer as a [`InteractionEvent`].
1080    fn decode(
1081        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1082    ) -> Result<InteractionEvent, fidl::Error> {
1083        let (bytes, _handles) = buf.split_mut();
1084        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1085        debug_assert_eq!(tx_header.tx_id, 0);
1086        match tx_header.ordinal {
1087            _ => Err(fidl::Error::UnknownOrdinal {
1088                ordinal: tx_header.ordinal,
1089                protocol_name: <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1090            }),
1091        }
1092    }
1093}
1094
1095/// A Stream of incoming requests for fuchsia.virtualization.guest.interaction/Interaction.
1096pub struct InteractionRequestStream {
1097    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1098    is_terminated: bool,
1099}
1100
1101impl std::marker::Unpin for InteractionRequestStream {}
1102
1103impl futures::stream::FusedStream for InteractionRequestStream {
1104    fn is_terminated(&self) -> bool {
1105        self.is_terminated
1106    }
1107}
1108
1109impl fidl::endpoints::RequestStream for InteractionRequestStream {
1110    type Protocol = InteractionMarker;
1111    type ControlHandle = InteractionControlHandle;
1112
1113    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1114        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1115    }
1116
1117    fn control_handle(&self) -> Self::ControlHandle {
1118        InteractionControlHandle { inner: self.inner.clone() }
1119    }
1120
1121    fn into_inner(
1122        self,
1123    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1124    {
1125        (self.inner, self.is_terminated)
1126    }
1127
1128    fn from_inner(
1129        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1130        is_terminated: bool,
1131    ) -> Self {
1132        Self { inner, is_terminated }
1133    }
1134}
1135
1136impl futures::Stream for InteractionRequestStream {
1137    type Item = Result<InteractionRequest, 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        let this = &mut *self;
1144        if this.inner.check_shutdown(cx) {
1145            this.is_terminated = true;
1146            return std::task::Poll::Ready(None);
1147        }
1148        if this.is_terminated {
1149            panic!("polled InteractionRequestStream after completion");
1150        }
1151        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1152            |bytes, handles| {
1153                match this.inner.channel().read_etc(cx, bytes, handles) {
1154                    std::task::Poll::Ready(Ok(())) => {}
1155                    std::task::Poll::Pending => return std::task::Poll::Pending,
1156                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1157                        this.is_terminated = true;
1158                        return std::task::Poll::Ready(None);
1159                    }
1160                    std::task::Poll::Ready(Err(e)) => {
1161                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1162                            e.into(),
1163                        ))))
1164                    }
1165                }
1166
1167                // A message has been received from the channel
1168                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1169
1170                std::task::Poll::Ready(Some(match header.ordinal {
1171                    0x223bc20da4a7cddd => {
1172                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1173                        let mut req = fidl::new_empty!(
1174                            InteractionPutFileRequest,
1175                            fidl::encoding::DefaultFuchsiaResourceDialect
1176                        );
1177                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionPutFileRequest>(&header, _body_bytes, handles, &mut req)?;
1178                        let control_handle = InteractionControlHandle { inner: this.inner.clone() };
1179                        Ok(InteractionRequest::PutFile {
1180                            local_file: req.local_file,
1181                            remote_path: req.remote_path,
1182
1183                            responder: InteractionPutFileResponder {
1184                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1185                                tx_id: header.tx_id,
1186                            },
1187                        })
1188                    }
1189                    0x7696bea472ca0f2d => {
1190                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1191                        let mut req = fidl::new_empty!(
1192                            InteractionGetFileRequest,
1193                            fidl::encoding::DefaultFuchsiaResourceDialect
1194                        );
1195                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionGetFileRequest>(&header, _body_bytes, handles, &mut req)?;
1196                        let control_handle = InteractionControlHandle { inner: this.inner.clone() };
1197                        Ok(InteractionRequest::GetFile {
1198                            remote_path: req.remote_path,
1199                            local_file: req.local_file,
1200
1201                            responder: InteractionGetFileResponder {
1202                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1203                                tx_id: header.tx_id,
1204                            },
1205                        })
1206                    }
1207                    0x612641220a1556d8 => {
1208                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1209                        let mut req = fidl::new_empty!(
1210                            InteractionExecuteCommandRequest,
1211                            fidl::encoding::DefaultFuchsiaResourceDialect
1212                        );
1213                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionExecuteCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1214                        let control_handle = InteractionControlHandle { inner: this.inner.clone() };
1215                        Ok(InteractionRequest::ExecuteCommand {
1216                            command: req.command,
1217                            env: req.env,
1218                            stdin: req.stdin,
1219                            stdout: req.stdout,
1220                            stderr: req.stderr,
1221                            command_listener: req.command_listener,
1222
1223                            control_handle,
1224                        })
1225                    }
1226                    _ => Err(fidl::Error::UnknownOrdinal {
1227                        ordinal: header.ordinal,
1228                        protocol_name:
1229                            <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1230                    }),
1231                }))
1232            },
1233        )
1234    }
1235}
1236
1237#[derive(Debug)]
1238pub enum InteractionRequest {
1239    /// Take a local file from the Fuchsia host and transfer it to a destination
1240    /// location on the guest under test.
1241    PutFile {
1242        local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1243        remote_path: String,
1244        responder: InteractionPutFileResponder,
1245    },
1246    /// Pull a file from the guest under test and copy it to the specified
1247    /// location on the Fuchsia host.
1248    GetFile {
1249        remote_path: String,
1250        local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1251        responder: InteractionGetFileResponder,
1252    },
1253    /// Execute command on the guest under test and return the resulting output,
1254    /// error, and return code.
1255    ExecuteCommand {
1256        command: String,
1257        env: Vec<EnvironmentVariable>,
1258        stdin: Option<fidl::Socket>,
1259        stdout: Option<fidl::Socket>,
1260        stderr: Option<fidl::Socket>,
1261        command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1262        control_handle: InteractionControlHandle,
1263    },
1264}
1265
1266impl InteractionRequest {
1267    #[allow(irrefutable_let_patterns)]
1268    pub fn into_put_file(
1269        self,
1270    ) -> Option<(
1271        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1272        String,
1273        InteractionPutFileResponder,
1274    )> {
1275        if let InteractionRequest::PutFile { local_file, remote_path, responder } = self {
1276            Some((local_file, remote_path, responder))
1277        } else {
1278            None
1279        }
1280    }
1281
1282    #[allow(irrefutable_let_patterns)]
1283    pub fn into_get_file(
1284        self,
1285    ) -> Option<(
1286        String,
1287        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1288        InteractionGetFileResponder,
1289    )> {
1290        if let InteractionRequest::GetFile { remote_path, local_file, responder } = self {
1291            Some((remote_path, local_file, responder))
1292        } else {
1293            None
1294        }
1295    }
1296
1297    #[allow(irrefutable_let_patterns)]
1298    pub fn into_execute_command(
1299        self,
1300    ) -> Option<(
1301        String,
1302        Vec<EnvironmentVariable>,
1303        Option<fidl::Socket>,
1304        Option<fidl::Socket>,
1305        Option<fidl::Socket>,
1306        fidl::endpoints::ServerEnd<CommandListenerMarker>,
1307        InteractionControlHandle,
1308    )> {
1309        if let InteractionRequest::ExecuteCommand {
1310            command,
1311            env,
1312            stdin,
1313            stdout,
1314            stderr,
1315            command_listener,
1316            control_handle,
1317        } = self
1318        {
1319            Some((command, env, stdin, stdout, stderr, command_listener, control_handle))
1320        } else {
1321            None
1322        }
1323    }
1324
1325    /// Name of the method defined in FIDL
1326    pub fn method_name(&self) -> &'static str {
1327        match *self {
1328            InteractionRequest::PutFile { .. } => "put_file",
1329            InteractionRequest::GetFile { .. } => "get_file",
1330            InteractionRequest::ExecuteCommand { .. } => "execute_command",
1331        }
1332    }
1333}
1334
1335#[derive(Debug, Clone)]
1336pub struct InteractionControlHandle {
1337    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1338}
1339
1340impl fidl::endpoints::ControlHandle for InteractionControlHandle {
1341    fn shutdown(&self) {
1342        self.inner.shutdown()
1343    }
1344    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1345        self.inner.shutdown_with_epitaph(status)
1346    }
1347
1348    fn is_closed(&self) -> bool {
1349        self.inner.channel().is_closed()
1350    }
1351    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1352        self.inner.channel().on_closed()
1353    }
1354
1355    #[cfg(target_os = "fuchsia")]
1356    fn signal_peer(
1357        &self,
1358        clear_mask: zx::Signals,
1359        set_mask: zx::Signals,
1360    ) -> Result<(), zx_status::Status> {
1361        use fidl::Peered;
1362        self.inner.channel().signal_peer(clear_mask, set_mask)
1363    }
1364}
1365
1366impl InteractionControlHandle {}
1367
1368#[must_use = "FIDL methods require a response to be sent"]
1369#[derive(Debug)]
1370pub struct InteractionPutFileResponder {
1371    control_handle: std::mem::ManuallyDrop<InteractionControlHandle>,
1372    tx_id: u32,
1373}
1374
1375/// Set the the channel to be shutdown (see [`InteractionControlHandle::shutdown`])
1376/// if the responder is dropped without sending a response, so that the client
1377/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1378impl std::ops::Drop for InteractionPutFileResponder {
1379    fn drop(&mut self) {
1380        self.control_handle.shutdown();
1381        // Safety: drops once, never accessed again
1382        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1383    }
1384}
1385
1386impl fidl::endpoints::Responder for InteractionPutFileResponder {
1387    type ControlHandle = InteractionControlHandle;
1388
1389    fn control_handle(&self) -> &InteractionControlHandle {
1390        &self.control_handle
1391    }
1392
1393    fn drop_without_shutdown(mut self) {
1394        // Safety: drops once, never accessed again due to mem::forget
1395        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1396        // Prevent Drop from running (which would shut down the channel)
1397        std::mem::forget(self);
1398    }
1399}
1400
1401impl InteractionPutFileResponder {
1402    /// Sends a response to the FIDL transaction.
1403    ///
1404    /// Sets the channel to shutdown if an error occurs.
1405    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1406        let _result = self.send_raw(status);
1407        if _result.is_err() {
1408            self.control_handle.shutdown();
1409        }
1410        self.drop_without_shutdown();
1411        _result
1412    }
1413
1414    /// Similar to "send" but does not shutdown the channel if an error occurs.
1415    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1416        let _result = self.send_raw(status);
1417        self.drop_without_shutdown();
1418        _result
1419    }
1420
1421    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1422        self.control_handle.inner.send::<InteractionPutFileResponse>(
1423            (status,),
1424            self.tx_id,
1425            0x223bc20da4a7cddd,
1426            fidl::encoding::DynamicFlags::empty(),
1427        )
1428    }
1429}
1430
1431#[must_use = "FIDL methods require a response to be sent"]
1432#[derive(Debug)]
1433pub struct InteractionGetFileResponder {
1434    control_handle: std::mem::ManuallyDrop<InteractionControlHandle>,
1435    tx_id: u32,
1436}
1437
1438/// Set the the channel to be shutdown (see [`InteractionControlHandle::shutdown`])
1439/// if the responder is dropped without sending a response, so that the client
1440/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1441impl std::ops::Drop for InteractionGetFileResponder {
1442    fn drop(&mut self) {
1443        self.control_handle.shutdown();
1444        // Safety: drops once, never accessed again
1445        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1446    }
1447}
1448
1449impl fidl::endpoints::Responder for InteractionGetFileResponder {
1450    type ControlHandle = InteractionControlHandle;
1451
1452    fn control_handle(&self) -> &InteractionControlHandle {
1453        &self.control_handle
1454    }
1455
1456    fn drop_without_shutdown(mut self) {
1457        // Safety: drops once, never accessed again due to mem::forget
1458        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1459        // Prevent Drop from running (which would shut down the channel)
1460        std::mem::forget(self);
1461    }
1462}
1463
1464impl InteractionGetFileResponder {
1465    /// Sends a response to the FIDL transaction.
1466    ///
1467    /// Sets the channel to shutdown if an error occurs.
1468    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1469        let _result = self.send_raw(status);
1470        if _result.is_err() {
1471            self.control_handle.shutdown();
1472        }
1473        self.drop_without_shutdown();
1474        _result
1475    }
1476
1477    /// Similar to "send" but does not shutdown the channel if an error occurs.
1478    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1479        let _result = self.send_raw(status);
1480        self.drop_without_shutdown();
1481        _result
1482    }
1483
1484    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1485        self.control_handle.inner.send::<InteractionGetFileResponse>(
1486            (status,),
1487            self.tx_id,
1488            0x7696bea472ca0f2d,
1489            fidl::encoding::DynamicFlags::empty(),
1490        )
1491    }
1492}
1493
1494mod internal {
1495    use super::*;
1496
1497    impl fidl::encoding::ResourceTypeMarker for DiscoveryGetGuestRequest {
1498        type Borrowed<'a> = &'a mut Self;
1499        fn take_or_borrow<'a>(
1500            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1501        ) -> Self::Borrowed<'a> {
1502            value
1503        }
1504    }
1505
1506    unsafe impl fidl::encoding::TypeMarker for DiscoveryGetGuestRequest {
1507        type Owned = Self;
1508
1509        #[inline(always)]
1510        fn inline_align(_context: fidl::encoding::Context) -> usize {
1511            8
1512        }
1513
1514        #[inline(always)]
1515        fn inline_size(_context: fidl::encoding::Context) -> usize {
1516            40
1517        }
1518    }
1519
1520    unsafe impl
1521        fidl::encoding::Encode<
1522            DiscoveryGetGuestRequest,
1523            fidl::encoding::DefaultFuchsiaResourceDialect,
1524        > for &mut DiscoveryGetGuestRequest
1525    {
1526        #[inline]
1527        unsafe fn encode(
1528            self,
1529            encoder: &mut fidl::encoding::Encoder<
1530                '_,
1531                fidl::encoding::DefaultFuchsiaResourceDialect,
1532            >,
1533            offset: usize,
1534            _depth: fidl::encoding::Depth,
1535        ) -> fidl::Result<()> {
1536            encoder.debug_check_bounds::<DiscoveryGetGuestRequest>(offset);
1537            // Delegate to tuple encoding.
1538            fidl::encoding::Encode::<DiscoveryGetGuestRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1539                (
1540                    <fidl::encoding::Optional<fidl::encoding::BoundedString<1024>> as fidl::encoding::ValueTypeMarker>::borrow(&self.realm_name),
1541                    <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_name),
1542                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
1543                ),
1544                encoder, offset, _depth
1545            )
1546        }
1547    }
1548    unsafe impl<
1549            T0: fidl::encoding::Encode<
1550                fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
1551                fidl::encoding::DefaultFuchsiaResourceDialect,
1552            >,
1553            T1: fidl::encoding::Encode<
1554                fidl::encoding::BoundedString<1024>,
1555                fidl::encoding::DefaultFuchsiaResourceDialect,
1556            >,
1557            T2: fidl::encoding::Encode<
1558                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
1559                fidl::encoding::DefaultFuchsiaResourceDialect,
1560            >,
1561        >
1562        fidl::encoding::Encode<
1563            DiscoveryGetGuestRequest,
1564            fidl::encoding::DefaultFuchsiaResourceDialect,
1565        > for (T0, T1, T2)
1566    {
1567        #[inline]
1568        unsafe fn encode(
1569            self,
1570            encoder: &mut fidl::encoding::Encoder<
1571                '_,
1572                fidl::encoding::DefaultFuchsiaResourceDialect,
1573            >,
1574            offset: usize,
1575            depth: fidl::encoding::Depth,
1576        ) -> fidl::Result<()> {
1577            encoder.debug_check_bounds::<DiscoveryGetGuestRequest>(offset);
1578            // Zero out padding regions. There's no need to apply masks
1579            // because the unmasked parts will be overwritten by fields.
1580            unsafe {
1581                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
1582                (ptr as *mut u64).write_unaligned(0);
1583            }
1584            // Write the fields.
1585            self.0.encode(encoder, offset + 0, depth)?;
1586            self.1.encode(encoder, offset + 16, depth)?;
1587            self.2.encode(encoder, offset + 32, depth)?;
1588            Ok(())
1589        }
1590    }
1591
1592    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1593        for DiscoveryGetGuestRequest
1594    {
1595        #[inline(always)]
1596        fn new_empty() -> Self {
1597            Self {
1598                realm_name: fidl::new_empty!(
1599                    fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
1600                    fidl::encoding::DefaultFuchsiaResourceDialect
1601                ),
1602                guest_name: fidl::new_empty!(
1603                    fidl::encoding::BoundedString<1024>,
1604                    fidl::encoding::DefaultFuchsiaResourceDialect
1605                ),
1606                guest: fidl::new_empty!(
1607                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
1608                    fidl::encoding::DefaultFuchsiaResourceDialect
1609                ),
1610            }
1611        }
1612
1613        #[inline]
1614        unsafe fn decode(
1615            &mut self,
1616            decoder: &mut fidl::encoding::Decoder<
1617                '_,
1618                fidl::encoding::DefaultFuchsiaResourceDialect,
1619            >,
1620            offset: usize,
1621            _depth: fidl::encoding::Depth,
1622        ) -> fidl::Result<()> {
1623            decoder.debug_check_bounds::<Self>(offset);
1624            // Verify that padding bytes are zero.
1625            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
1626            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1627            let mask = 0xffffffff00000000u64;
1628            let maskedval = padval & mask;
1629            if maskedval != 0 {
1630                return Err(fidl::Error::NonZeroPadding {
1631                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
1632                });
1633            }
1634            fidl::decode!(
1635                fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
1636                fidl::encoding::DefaultFuchsiaResourceDialect,
1637                &mut self.realm_name,
1638                decoder,
1639                offset + 0,
1640                _depth
1641            )?;
1642            fidl::decode!(
1643                fidl::encoding::BoundedString<1024>,
1644                fidl::encoding::DefaultFuchsiaResourceDialect,
1645                &mut self.guest_name,
1646                decoder,
1647                offset + 16,
1648                _depth
1649            )?;
1650            fidl::decode!(
1651                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
1652                fidl::encoding::DefaultFuchsiaResourceDialect,
1653                &mut self.guest,
1654                decoder,
1655                offset + 32,
1656                _depth
1657            )?;
1658            Ok(())
1659        }
1660    }
1661
1662    impl fidl::encoding::ResourceTypeMarker for InteractionExecuteCommandRequest {
1663        type Borrowed<'a> = &'a mut Self;
1664        fn take_or_borrow<'a>(
1665            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1666        ) -> Self::Borrowed<'a> {
1667            value
1668        }
1669    }
1670
1671    unsafe impl fidl::encoding::TypeMarker for InteractionExecuteCommandRequest {
1672        type Owned = Self;
1673
1674        #[inline(always)]
1675        fn inline_align(_context: fidl::encoding::Context) -> usize {
1676            8
1677        }
1678
1679        #[inline(always)]
1680        fn inline_size(_context: fidl::encoding::Context) -> usize {
1681            48
1682        }
1683    }
1684
1685    unsafe impl
1686        fidl::encoding::Encode<
1687            InteractionExecuteCommandRequest,
1688            fidl::encoding::DefaultFuchsiaResourceDialect,
1689        > for &mut InteractionExecuteCommandRequest
1690    {
1691        #[inline]
1692        unsafe fn encode(
1693            self,
1694            encoder: &mut fidl::encoding::Encoder<
1695                '_,
1696                fidl::encoding::DefaultFuchsiaResourceDialect,
1697            >,
1698            offset: usize,
1699            _depth: fidl::encoding::Depth,
1700        ) -> fidl::Result<()> {
1701            encoder.debug_check_bounds::<InteractionExecuteCommandRequest>(offset);
1702            // Delegate to tuple encoding.
1703            fidl::encoding::Encode::<InteractionExecuteCommandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1704                (
1705                    <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
1706                    <fidl::encoding::Vector<EnvironmentVariable, 1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.env),
1707                    <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdin),
1708                    <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdout),
1709                    <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stderr),
1710                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.command_listener),
1711                ),
1712                encoder, offset, _depth
1713            )
1714        }
1715    }
1716    unsafe impl<
1717            T0: fidl::encoding::Encode<
1718                fidl::encoding::BoundedString<1024>,
1719                fidl::encoding::DefaultFuchsiaResourceDialect,
1720            >,
1721            T1: fidl::encoding::Encode<
1722                fidl::encoding::Vector<EnvironmentVariable, 1024>,
1723                fidl::encoding::DefaultFuchsiaResourceDialect,
1724            >,
1725            T2: fidl::encoding::Encode<
1726                fidl::encoding::Optional<
1727                    fidl::encoding::HandleType<
1728                        fidl::Socket,
1729                        { fidl::ObjectType::SOCKET.into_raw() },
1730                        2147483648,
1731                    >,
1732                >,
1733                fidl::encoding::DefaultFuchsiaResourceDialect,
1734            >,
1735            T3: fidl::encoding::Encode<
1736                fidl::encoding::Optional<
1737                    fidl::encoding::HandleType<
1738                        fidl::Socket,
1739                        { fidl::ObjectType::SOCKET.into_raw() },
1740                        2147483648,
1741                    >,
1742                >,
1743                fidl::encoding::DefaultFuchsiaResourceDialect,
1744            >,
1745            T4: fidl::encoding::Encode<
1746                fidl::encoding::Optional<
1747                    fidl::encoding::HandleType<
1748                        fidl::Socket,
1749                        { fidl::ObjectType::SOCKET.into_raw() },
1750                        2147483648,
1751                    >,
1752                >,
1753                fidl::encoding::DefaultFuchsiaResourceDialect,
1754            >,
1755            T5: fidl::encoding::Encode<
1756                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
1757                fidl::encoding::DefaultFuchsiaResourceDialect,
1758            >,
1759        >
1760        fidl::encoding::Encode<
1761            InteractionExecuteCommandRequest,
1762            fidl::encoding::DefaultFuchsiaResourceDialect,
1763        > for (T0, T1, T2, T3, T4, T5)
1764    {
1765        #[inline]
1766        unsafe fn encode(
1767            self,
1768            encoder: &mut fidl::encoding::Encoder<
1769                '_,
1770                fidl::encoding::DefaultFuchsiaResourceDialect,
1771            >,
1772            offset: usize,
1773            depth: fidl::encoding::Depth,
1774        ) -> fidl::Result<()> {
1775            encoder.debug_check_bounds::<InteractionExecuteCommandRequest>(offset);
1776            // Zero out padding regions. There's no need to apply masks
1777            // because the unmasked parts will be overwritten by fields.
1778            // Write the fields.
1779            self.0.encode(encoder, offset + 0, depth)?;
1780            self.1.encode(encoder, offset + 16, depth)?;
1781            self.2.encode(encoder, offset + 32, depth)?;
1782            self.3.encode(encoder, offset + 36, depth)?;
1783            self.4.encode(encoder, offset + 40, depth)?;
1784            self.5.encode(encoder, offset + 44, depth)?;
1785            Ok(())
1786        }
1787    }
1788
1789    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1790        for InteractionExecuteCommandRequest
1791    {
1792        #[inline(always)]
1793        fn new_empty() -> Self {
1794            Self {
1795                command: fidl::new_empty!(
1796                    fidl::encoding::BoundedString<1024>,
1797                    fidl::encoding::DefaultFuchsiaResourceDialect
1798                ),
1799                env: fidl::new_empty!(fidl::encoding::Vector<EnvironmentVariable, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect),
1800                stdin: fidl::new_empty!(
1801                    fidl::encoding::Optional<
1802                        fidl::encoding::HandleType<
1803                            fidl::Socket,
1804                            { fidl::ObjectType::SOCKET.into_raw() },
1805                            2147483648,
1806                        >,
1807                    >,
1808                    fidl::encoding::DefaultFuchsiaResourceDialect
1809                ),
1810                stdout: fidl::new_empty!(
1811                    fidl::encoding::Optional<
1812                        fidl::encoding::HandleType<
1813                            fidl::Socket,
1814                            { fidl::ObjectType::SOCKET.into_raw() },
1815                            2147483648,
1816                        >,
1817                    >,
1818                    fidl::encoding::DefaultFuchsiaResourceDialect
1819                ),
1820                stderr: fidl::new_empty!(
1821                    fidl::encoding::Optional<
1822                        fidl::encoding::HandleType<
1823                            fidl::Socket,
1824                            { fidl::ObjectType::SOCKET.into_raw() },
1825                            2147483648,
1826                        >,
1827                    >,
1828                    fidl::encoding::DefaultFuchsiaResourceDialect
1829                ),
1830                command_listener: fidl::new_empty!(
1831                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
1832                    fidl::encoding::DefaultFuchsiaResourceDialect
1833                ),
1834            }
1835        }
1836
1837        #[inline]
1838        unsafe fn decode(
1839            &mut self,
1840            decoder: &mut fidl::encoding::Decoder<
1841                '_,
1842                fidl::encoding::DefaultFuchsiaResourceDialect,
1843            >,
1844            offset: usize,
1845            _depth: fidl::encoding::Depth,
1846        ) -> fidl::Result<()> {
1847            decoder.debug_check_bounds::<Self>(offset);
1848            // Verify that padding bytes are zero.
1849            fidl::decode!(
1850                fidl::encoding::BoundedString<1024>,
1851                fidl::encoding::DefaultFuchsiaResourceDialect,
1852                &mut self.command,
1853                decoder,
1854                offset + 0,
1855                _depth
1856            )?;
1857            fidl::decode!(fidl::encoding::Vector<EnvironmentVariable, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.env, decoder, offset + 16, _depth)?;
1858            fidl::decode!(
1859                fidl::encoding::Optional<
1860                    fidl::encoding::HandleType<
1861                        fidl::Socket,
1862                        { fidl::ObjectType::SOCKET.into_raw() },
1863                        2147483648,
1864                    >,
1865                >,
1866                fidl::encoding::DefaultFuchsiaResourceDialect,
1867                &mut self.stdin,
1868                decoder,
1869                offset + 32,
1870                _depth
1871            )?;
1872            fidl::decode!(
1873                fidl::encoding::Optional<
1874                    fidl::encoding::HandleType<
1875                        fidl::Socket,
1876                        { fidl::ObjectType::SOCKET.into_raw() },
1877                        2147483648,
1878                    >,
1879                >,
1880                fidl::encoding::DefaultFuchsiaResourceDialect,
1881                &mut self.stdout,
1882                decoder,
1883                offset + 36,
1884                _depth
1885            )?;
1886            fidl::decode!(
1887                fidl::encoding::Optional<
1888                    fidl::encoding::HandleType<
1889                        fidl::Socket,
1890                        { fidl::ObjectType::SOCKET.into_raw() },
1891                        2147483648,
1892                    >,
1893                >,
1894                fidl::encoding::DefaultFuchsiaResourceDialect,
1895                &mut self.stderr,
1896                decoder,
1897                offset + 40,
1898                _depth
1899            )?;
1900            fidl::decode!(
1901                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
1902                fidl::encoding::DefaultFuchsiaResourceDialect,
1903                &mut self.command_listener,
1904                decoder,
1905                offset + 44,
1906                _depth
1907            )?;
1908            Ok(())
1909        }
1910    }
1911
1912    impl fidl::encoding::ResourceTypeMarker for InteractionGetFileRequest {
1913        type Borrowed<'a> = &'a mut Self;
1914        fn take_or_borrow<'a>(
1915            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1916        ) -> Self::Borrowed<'a> {
1917            value
1918        }
1919    }
1920
1921    unsafe impl fidl::encoding::TypeMarker for InteractionGetFileRequest {
1922        type Owned = Self;
1923
1924        #[inline(always)]
1925        fn inline_align(_context: fidl::encoding::Context) -> usize {
1926            8
1927        }
1928
1929        #[inline(always)]
1930        fn inline_size(_context: fidl::encoding::Context) -> usize {
1931            24
1932        }
1933    }
1934
1935    unsafe impl
1936        fidl::encoding::Encode<
1937            InteractionGetFileRequest,
1938            fidl::encoding::DefaultFuchsiaResourceDialect,
1939        > for &mut InteractionGetFileRequest
1940    {
1941        #[inline]
1942        unsafe fn encode(
1943            self,
1944            encoder: &mut fidl::encoding::Encoder<
1945                '_,
1946                fidl::encoding::DefaultFuchsiaResourceDialect,
1947            >,
1948            offset: usize,
1949            _depth: fidl::encoding::Depth,
1950        ) -> fidl::Result<()> {
1951            encoder.debug_check_bounds::<InteractionGetFileRequest>(offset);
1952            // Delegate to tuple encoding.
1953            fidl::encoding::Encode::<InteractionGetFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1954                (
1955                    <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_path),
1956                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.local_file),
1957                ),
1958                encoder, offset, _depth
1959            )
1960        }
1961    }
1962    unsafe impl<
1963            T0: fidl::encoding::Encode<
1964                fidl::encoding::BoundedString<1024>,
1965                fidl::encoding::DefaultFuchsiaResourceDialect,
1966            >,
1967            T1: fidl::encoding::Encode<
1968                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
1969                fidl::encoding::DefaultFuchsiaResourceDialect,
1970            >,
1971        >
1972        fidl::encoding::Encode<
1973            InteractionGetFileRequest,
1974            fidl::encoding::DefaultFuchsiaResourceDialect,
1975        > for (T0, T1)
1976    {
1977        #[inline]
1978        unsafe fn encode(
1979            self,
1980            encoder: &mut fidl::encoding::Encoder<
1981                '_,
1982                fidl::encoding::DefaultFuchsiaResourceDialect,
1983            >,
1984            offset: usize,
1985            depth: fidl::encoding::Depth,
1986        ) -> fidl::Result<()> {
1987            encoder.debug_check_bounds::<InteractionGetFileRequest>(offset);
1988            // Zero out padding regions. There's no need to apply masks
1989            // because the unmasked parts will be overwritten by fields.
1990            unsafe {
1991                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1992                (ptr as *mut u64).write_unaligned(0);
1993            }
1994            // Write the fields.
1995            self.0.encode(encoder, offset + 0, depth)?;
1996            self.1.encode(encoder, offset + 16, depth)?;
1997            Ok(())
1998        }
1999    }
2000
2001    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2002        for InteractionGetFileRequest
2003    {
2004        #[inline(always)]
2005        fn new_empty() -> Self {
2006            Self {
2007                remote_path: fidl::new_empty!(
2008                    fidl::encoding::BoundedString<1024>,
2009                    fidl::encoding::DefaultFuchsiaResourceDialect
2010                ),
2011                local_file: fidl::new_empty!(
2012                    fidl::encoding::Endpoint<
2013                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
2014                    >,
2015                    fidl::encoding::DefaultFuchsiaResourceDialect
2016                ),
2017            }
2018        }
2019
2020        #[inline]
2021        unsafe fn decode(
2022            &mut self,
2023            decoder: &mut fidl::encoding::Decoder<
2024                '_,
2025                fidl::encoding::DefaultFuchsiaResourceDialect,
2026            >,
2027            offset: usize,
2028            _depth: fidl::encoding::Depth,
2029        ) -> fidl::Result<()> {
2030            decoder.debug_check_bounds::<Self>(offset);
2031            // Verify that padding bytes are zero.
2032            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2033            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2034            let mask = 0xffffffff00000000u64;
2035            let maskedval = padval & mask;
2036            if maskedval != 0 {
2037                return Err(fidl::Error::NonZeroPadding {
2038                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2039                });
2040            }
2041            fidl::decode!(
2042                fidl::encoding::BoundedString<1024>,
2043                fidl::encoding::DefaultFuchsiaResourceDialect,
2044                &mut self.remote_path,
2045                decoder,
2046                offset + 0,
2047                _depth
2048            )?;
2049            fidl::decode!(
2050                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
2051                fidl::encoding::DefaultFuchsiaResourceDialect,
2052                &mut self.local_file,
2053                decoder,
2054                offset + 16,
2055                _depth
2056            )?;
2057            Ok(())
2058        }
2059    }
2060
2061    impl fidl::encoding::ResourceTypeMarker for InteractionPutFileRequest {
2062        type Borrowed<'a> = &'a mut Self;
2063        fn take_or_borrow<'a>(
2064            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2065        ) -> Self::Borrowed<'a> {
2066            value
2067        }
2068    }
2069
2070    unsafe impl fidl::encoding::TypeMarker for InteractionPutFileRequest {
2071        type Owned = Self;
2072
2073        #[inline(always)]
2074        fn inline_align(_context: fidl::encoding::Context) -> usize {
2075            8
2076        }
2077
2078        #[inline(always)]
2079        fn inline_size(_context: fidl::encoding::Context) -> usize {
2080            24
2081        }
2082    }
2083
2084    unsafe impl
2085        fidl::encoding::Encode<
2086            InteractionPutFileRequest,
2087            fidl::encoding::DefaultFuchsiaResourceDialect,
2088        > for &mut InteractionPutFileRequest
2089    {
2090        #[inline]
2091        unsafe fn encode(
2092            self,
2093            encoder: &mut fidl::encoding::Encoder<
2094                '_,
2095                fidl::encoding::DefaultFuchsiaResourceDialect,
2096            >,
2097            offset: usize,
2098            _depth: fidl::encoding::Depth,
2099        ) -> fidl::Result<()> {
2100            encoder.debug_check_bounds::<InteractionPutFileRequest>(offset);
2101            // Delegate to tuple encoding.
2102            fidl::encoding::Encode::<InteractionPutFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2103                (
2104                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.local_file),
2105                    <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_path),
2106                ),
2107                encoder, offset, _depth
2108            )
2109        }
2110    }
2111    unsafe impl<
2112            T0: fidl::encoding::Encode<
2113                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
2114                fidl::encoding::DefaultFuchsiaResourceDialect,
2115            >,
2116            T1: fidl::encoding::Encode<
2117                fidl::encoding::BoundedString<1024>,
2118                fidl::encoding::DefaultFuchsiaResourceDialect,
2119            >,
2120        >
2121        fidl::encoding::Encode<
2122            InteractionPutFileRequest,
2123            fidl::encoding::DefaultFuchsiaResourceDialect,
2124        > for (T0, T1)
2125    {
2126        #[inline]
2127        unsafe fn encode(
2128            self,
2129            encoder: &mut fidl::encoding::Encoder<
2130                '_,
2131                fidl::encoding::DefaultFuchsiaResourceDialect,
2132            >,
2133            offset: usize,
2134            depth: fidl::encoding::Depth,
2135        ) -> fidl::Result<()> {
2136            encoder.debug_check_bounds::<InteractionPutFileRequest>(offset);
2137            // Zero out padding regions. There's no need to apply masks
2138            // because the unmasked parts will be overwritten by fields.
2139            unsafe {
2140                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2141                (ptr as *mut u64).write_unaligned(0);
2142            }
2143            // Write the fields.
2144            self.0.encode(encoder, offset + 0, depth)?;
2145            self.1.encode(encoder, offset + 8, depth)?;
2146            Ok(())
2147        }
2148    }
2149
2150    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2151        for InteractionPutFileRequest
2152    {
2153        #[inline(always)]
2154        fn new_empty() -> Self {
2155            Self {
2156                local_file: fidl::new_empty!(
2157                    fidl::encoding::Endpoint<
2158                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
2159                    >,
2160                    fidl::encoding::DefaultFuchsiaResourceDialect
2161                ),
2162                remote_path: fidl::new_empty!(
2163                    fidl::encoding::BoundedString<1024>,
2164                    fidl::encoding::DefaultFuchsiaResourceDialect
2165                ),
2166            }
2167        }
2168
2169        #[inline]
2170        unsafe fn decode(
2171            &mut self,
2172            decoder: &mut fidl::encoding::Decoder<
2173                '_,
2174                fidl::encoding::DefaultFuchsiaResourceDialect,
2175            >,
2176            offset: usize,
2177            _depth: fidl::encoding::Depth,
2178        ) -> fidl::Result<()> {
2179            decoder.debug_check_bounds::<Self>(offset);
2180            // Verify that padding bytes are zero.
2181            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2182            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2183            let mask = 0xffffffff00000000u64;
2184            let maskedval = padval & mask;
2185            if maskedval != 0 {
2186                return Err(fidl::Error::NonZeroPadding {
2187                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2188                });
2189            }
2190            fidl::decode!(
2191                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
2192                fidl::encoding::DefaultFuchsiaResourceDialect,
2193                &mut self.local_file,
2194                decoder,
2195                offset + 0,
2196                _depth
2197            )?;
2198            fidl::decode!(
2199                fidl::encoding::BoundedString<1024>,
2200                fidl::encoding::DefaultFuchsiaResourceDialect,
2201                &mut self.remote_path,
2202                decoder,
2203                offset + 8,
2204                _depth
2205            )?;
2206            Ok(())
2207        }
2208    }
2209}