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