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