Skip to main content

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