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