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