1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_virtualization_guest_interaction__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DiscoveryGetGuestRequest {
16 pub realm_name: Option<String>,
17 pub guest_name: String,
18 pub guest: fidl::endpoints::ServerEnd<InteractionMarker>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DiscoveryGetGuestRequest {}
22
23#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub struct InteractionExecuteCommandRequest {
25 pub command: String,
26 pub env: Vec<EnvironmentVariable>,
27 pub stdin: Option<fidl::Socket>,
28 pub stdout: Option<fidl::Socket>,
29 pub stderr: Option<fidl::Socket>,
30 pub command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34 for InteractionExecuteCommandRequest
35{
36}
37
38#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
39pub struct InteractionGetFileRequest {
40 pub remote_path: String,
41 pub local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InteractionGetFileRequest {}
45
46#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct InteractionPutFileRequest {
48 pub local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
49 pub remote_path: String,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InteractionPutFileRequest {}
53
54#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
55pub struct CommandListenerMarker;
56
57impl fidl::endpoints::ProtocolMarker for CommandListenerMarker {
58 type Proxy = CommandListenerProxy;
59 type RequestStream = CommandListenerRequestStream;
60 #[cfg(target_os = "fuchsia")]
61 type SynchronousProxy = CommandListenerSynchronousProxy;
62
63 const DEBUG_NAME: &'static str = "(anonymous) CommandListener";
64}
65
66pub trait CommandListenerProxyInterface: Send + Sync {}
67#[derive(Debug)]
68#[cfg(target_os = "fuchsia")]
69pub struct CommandListenerSynchronousProxy {
70 client: fidl::client::sync::Client,
71}
72
73#[cfg(target_os = "fuchsia")]
74impl fidl::endpoints::SynchronousProxy for CommandListenerSynchronousProxy {
75 type Proxy = CommandListenerProxy;
76 type Protocol = CommandListenerMarker;
77
78 fn from_channel(inner: fidl::Channel) -> Self {
79 Self::new(inner)
80 }
81
82 fn into_channel(self) -> fidl::Channel {
83 self.client.into_channel()
84 }
85
86 fn as_channel(&self) -> &fidl::Channel {
87 self.client.as_channel()
88 }
89}
90
91#[cfg(target_os = "fuchsia")]
92impl CommandListenerSynchronousProxy {
93 pub fn new(channel: fidl::Channel) -> Self {
94 let protocol_name = <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
95 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
96 }
97
98 pub fn into_channel(self) -> fidl::Channel {
99 self.client.into_channel()
100 }
101
102 pub fn wait_for_event(
105 &self,
106 deadline: zx::MonotonicInstant,
107 ) -> Result<CommandListenerEvent, fidl::Error> {
108 CommandListenerEvent::decode(self.client.wait_for_event(deadline)?)
109 }
110}
111
112#[cfg(target_os = "fuchsia")]
113impl From<CommandListenerSynchronousProxy> for zx::Handle {
114 fn from(value: CommandListenerSynchronousProxy) -> Self {
115 value.into_channel().into()
116 }
117}
118
119#[cfg(target_os = "fuchsia")]
120impl From<fidl::Channel> for CommandListenerSynchronousProxy {
121 fn from(value: fidl::Channel) -> Self {
122 Self::new(value)
123 }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl fidl::endpoints::FromClient for CommandListenerSynchronousProxy {
128 type Protocol = CommandListenerMarker;
129
130 fn from_client(value: fidl::endpoints::ClientEnd<CommandListenerMarker>) -> Self {
131 Self::new(value.into_channel())
132 }
133}
134
135#[derive(Debug, Clone)]
136pub struct CommandListenerProxy {
137 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
138}
139
140impl fidl::endpoints::Proxy for CommandListenerProxy {
141 type Protocol = CommandListenerMarker;
142
143 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
144 Self::new(inner)
145 }
146
147 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
148 self.client.into_channel().map_err(|client| Self { client })
149 }
150
151 fn as_channel(&self) -> &::fidl::AsyncChannel {
152 self.client.as_channel()
153 }
154}
155
156impl CommandListenerProxy {
157 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
159 let protocol_name = <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
160 Self { client: fidl::client::Client::new(channel, protocol_name) }
161 }
162
163 pub fn take_event_stream(&self) -> CommandListenerEventStream {
169 CommandListenerEventStream { event_receiver: self.client.take_event_receiver() }
170 }
171}
172
173impl CommandListenerProxyInterface for CommandListenerProxy {}
174
175pub struct CommandListenerEventStream {
176 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
177}
178
179impl std::marker::Unpin for CommandListenerEventStream {}
180
181impl futures::stream::FusedStream for CommandListenerEventStream {
182 fn is_terminated(&self) -> bool {
183 self.event_receiver.is_terminated()
184 }
185}
186
187impl futures::Stream for CommandListenerEventStream {
188 type Item = Result<CommandListenerEvent, fidl::Error>;
189
190 fn poll_next(
191 mut self: std::pin::Pin<&mut Self>,
192 cx: &mut std::task::Context<'_>,
193 ) -> std::task::Poll<Option<Self::Item>> {
194 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
195 &mut self.event_receiver,
196 cx
197 )?) {
198 Some(buf) => std::task::Poll::Ready(Some(CommandListenerEvent::decode(buf))),
199 None => std::task::Poll::Ready(None),
200 }
201 }
202}
203
204#[derive(Debug)]
205pub enum CommandListenerEvent {
206 OnStarted { status: i32 },
207 OnTerminated { status: i32, return_code: i32 },
208}
209
210impl CommandListenerEvent {
211 #[allow(irrefutable_let_patterns)]
212 pub fn into_on_started(self) -> Option<i32> {
213 if let CommandListenerEvent::OnStarted { status } = self {
214 Some((status))
215 } else {
216 None
217 }
218 }
219 #[allow(irrefutable_let_patterns)]
220 pub fn into_on_terminated(self) -> Option<(i32, i32)> {
221 if let CommandListenerEvent::OnTerminated { status, return_code } = self {
222 Some((status, return_code))
223 } else {
224 None
225 }
226 }
227
228 fn decode(
230 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
231 ) -> Result<CommandListenerEvent, fidl::Error> {
232 let (bytes, _handles) = buf.split_mut();
233 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
234 debug_assert_eq!(tx_header.tx_id, 0);
235 match tx_header.ordinal {
236 0x3a3693a7e54a5f09 => {
237 let mut out = fidl::new_empty!(
238 CommandListenerOnStartedRequest,
239 fidl::encoding::DefaultFuchsiaResourceDialect
240 );
241 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommandListenerOnStartedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
242 Ok((CommandListenerEvent::OnStarted { status: out.status }))
243 }
244 0x5a08413bdea2446a => {
245 let mut out = fidl::new_empty!(
246 CommandListenerOnTerminatedRequest,
247 fidl::encoding::DefaultFuchsiaResourceDialect
248 );
249 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommandListenerOnTerminatedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
250 Ok((CommandListenerEvent::OnTerminated {
251 status: out.status,
252 return_code: out.return_code,
253 }))
254 }
255 _ => Err(fidl::Error::UnknownOrdinal {
256 ordinal: tx_header.ordinal,
257 protocol_name:
258 <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
259 }),
260 }
261 }
262}
263
264pub struct CommandListenerRequestStream {
266 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
267 is_terminated: bool,
268}
269
270impl std::marker::Unpin for CommandListenerRequestStream {}
271
272impl futures::stream::FusedStream for CommandListenerRequestStream {
273 fn is_terminated(&self) -> bool {
274 self.is_terminated
275 }
276}
277
278impl fidl::endpoints::RequestStream for CommandListenerRequestStream {
279 type Protocol = CommandListenerMarker;
280 type ControlHandle = CommandListenerControlHandle;
281
282 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
283 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
284 }
285
286 fn control_handle(&self) -> Self::ControlHandle {
287 CommandListenerControlHandle { inner: self.inner.clone() }
288 }
289
290 fn into_inner(
291 self,
292 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
293 {
294 (self.inner, self.is_terminated)
295 }
296
297 fn from_inner(
298 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
299 is_terminated: bool,
300 ) -> Self {
301 Self { inner, is_terminated }
302 }
303}
304
305impl futures::Stream for CommandListenerRequestStream {
306 type Item = Result<CommandListenerRequest, fidl::Error>;
307
308 fn poll_next(
309 mut self: std::pin::Pin<&mut Self>,
310 cx: &mut std::task::Context<'_>,
311 ) -> std::task::Poll<Option<Self::Item>> {
312 let this = &mut *self;
313 if this.inner.check_shutdown(cx) {
314 this.is_terminated = true;
315 return std::task::Poll::Ready(None);
316 }
317 if this.is_terminated {
318 panic!("polled CommandListenerRequestStream after completion");
319 }
320 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
321 |bytes, handles| {
322 match this.inner.channel().read_etc(cx, bytes, handles) {
323 std::task::Poll::Ready(Ok(())) => {}
324 std::task::Poll::Pending => return std::task::Poll::Pending,
325 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
326 this.is_terminated = true;
327 return std::task::Poll::Ready(None);
328 }
329 std::task::Poll::Ready(Err(e)) => {
330 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
331 e.into(),
332 ))))
333 }
334 }
335
336 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
338
339 std::task::Poll::Ready(Some(match header.ordinal {
340 _ => Err(fidl::Error::UnknownOrdinal {
341 ordinal: header.ordinal,
342 protocol_name:
343 <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
344 }),
345 }))
346 },
347 )
348 }
349}
350
351#[derive(Debug)]
352pub enum CommandListenerRequest {}
353
354impl CommandListenerRequest {
355 pub fn method_name(&self) -> &'static str {
357 match *self {}
358 }
359}
360
361#[derive(Debug, Clone)]
362pub struct CommandListenerControlHandle {
363 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
364}
365
366impl fidl::endpoints::ControlHandle for CommandListenerControlHandle {
367 fn shutdown(&self) {
368 self.inner.shutdown()
369 }
370 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
371 self.inner.shutdown_with_epitaph(status)
372 }
373
374 fn is_closed(&self) -> bool {
375 self.inner.channel().is_closed()
376 }
377 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
378 self.inner.channel().on_closed()
379 }
380
381 #[cfg(target_os = "fuchsia")]
382 fn signal_peer(
383 &self,
384 clear_mask: zx::Signals,
385 set_mask: zx::Signals,
386 ) -> Result<(), zx_status::Status> {
387 use fidl::Peered;
388 self.inner.channel().signal_peer(clear_mask, set_mask)
389 }
390}
391
392impl CommandListenerControlHandle {
393 pub fn send_on_started(&self, mut status: i32) -> Result<(), fidl::Error> {
394 self.inner.send::<CommandListenerOnStartedRequest>(
395 (status,),
396 0,
397 0x3a3693a7e54a5f09,
398 fidl::encoding::DynamicFlags::empty(),
399 )
400 }
401
402 pub fn send_on_terminated(
403 &self,
404 mut status: i32,
405 mut return_code: i32,
406 ) -> Result<(), fidl::Error> {
407 self.inner.send::<CommandListenerOnTerminatedRequest>(
408 (status, return_code),
409 0,
410 0x5a08413bdea2446a,
411 fidl::encoding::DynamicFlags::empty(),
412 )
413 }
414}
415
416#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
417pub struct DiscoveryMarker;
418
419impl fidl::endpoints::ProtocolMarker for DiscoveryMarker {
420 type Proxy = DiscoveryProxy;
421 type RequestStream = DiscoveryRequestStream;
422 #[cfg(target_os = "fuchsia")]
423 type SynchronousProxy = DiscoverySynchronousProxy;
424
425 const DEBUG_NAME: &'static str = "fuchsia.virtualization.guest.interaction.Discovery";
426}
427impl fidl::endpoints::DiscoverableProtocolMarker for DiscoveryMarker {}
428
429pub trait DiscoveryProxyInterface: Send + Sync {
430 fn r#get_guest(
431 &self,
432 realm_name: Option<&str>,
433 guest_name: &str,
434 guest: fidl::endpoints::ServerEnd<InteractionMarker>,
435 ) -> Result<(), fidl::Error>;
436}
437#[derive(Debug)]
438#[cfg(target_os = "fuchsia")]
439pub struct DiscoverySynchronousProxy {
440 client: fidl::client::sync::Client,
441}
442
443#[cfg(target_os = "fuchsia")]
444impl fidl::endpoints::SynchronousProxy for DiscoverySynchronousProxy {
445 type Proxy = DiscoveryProxy;
446 type Protocol = DiscoveryMarker;
447
448 fn from_channel(inner: fidl::Channel) -> Self {
449 Self::new(inner)
450 }
451
452 fn into_channel(self) -> fidl::Channel {
453 self.client.into_channel()
454 }
455
456 fn as_channel(&self) -> &fidl::Channel {
457 self.client.as_channel()
458 }
459}
460
461#[cfg(target_os = "fuchsia")]
462impl DiscoverySynchronousProxy {
463 pub fn new(channel: fidl::Channel) -> Self {
464 let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
465 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
466 }
467
468 pub fn into_channel(self) -> fidl::Channel {
469 self.client.into_channel()
470 }
471
472 pub fn wait_for_event(
475 &self,
476 deadline: zx::MonotonicInstant,
477 ) -> Result<DiscoveryEvent, fidl::Error> {
478 DiscoveryEvent::decode(self.client.wait_for_event(deadline)?)
479 }
480
481 pub fn r#get_guest(
485 &self,
486 mut realm_name: Option<&str>,
487 mut guest_name: &str,
488 mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
489 ) -> Result<(), fidl::Error> {
490 self.client.send::<DiscoveryGetGuestRequest>(
491 (realm_name, guest_name, guest),
492 0x60538587bdd80a32,
493 fidl::encoding::DynamicFlags::empty(),
494 )
495 }
496}
497
498#[cfg(target_os = "fuchsia")]
499impl From<DiscoverySynchronousProxy> for zx::Handle {
500 fn from(value: DiscoverySynchronousProxy) -> Self {
501 value.into_channel().into()
502 }
503}
504
505#[cfg(target_os = "fuchsia")]
506impl From<fidl::Channel> for DiscoverySynchronousProxy {
507 fn from(value: fidl::Channel) -> Self {
508 Self::new(value)
509 }
510}
511
512#[cfg(target_os = "fuchsia")]
513impl fidl::endpoints::FromClient for DiscoverySynchronousProxy {
514 type Protocol = DiscoveryMarker;
515
516 fn from_client(value: fidl::endpoints::ClientEnd<DiscoveryMarker>) -> Self {
517 Self::new(value.into_channel())
518 }
519}
520
521#[derive(Debug, Clone)]
522pub struct DiscoveryProxy {
523 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
524}
525
526impl fidl::endpoints::Proxy for DiscoveryProxy {
527 type Protocol = DiscoveryMarker;
528
529 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
530 Self::new(inner)
531 }
532
533 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
534 self.client.into_channel().map_err(|client| Self { client })
535 }
536
537 fn as_channel(&self) -> &::fidl::AsyncChannel {
538 self.client.as_channel()
539 }
540}
541
542impl DiscoveryProxy {
543 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
545 let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
546 Self { client: fidl::client::Client::new(channel, protocol_name) }
547 }
548
549 pub fn take_event_stream(&self) -> DiscoveryEventStream {
555 DiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
556 }
557
558 pub fn r#get_guest(
562 &self,
563 mut realm_name: Option<&str>,
564 mut guest_name: &str,
565 mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
566 ) -> Result<(), fidl::Error> {
567 DiscoveryProxyInterface::r#get_guest(self, realm_name, guest_name, guest)
568 }
569}
570
571impl DiscoveryProxyInterface for DiscoveryProxy {
572 fn r#get_guest(
573 &self,
574 mut realm_name: Option<&str>,
575 mut guest_name: &str,
576 mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
577 ) -> Result<(), fidl::Error> {
578 self.client.send::<DiscoveryGetGuestRequest>(
579 (realm_name, guest_name, guest),
580 0x60538587bdd80a32,
581 fidl::encoding::DynamicFlags::empty(),
582 )
583 }
584}
585
586pub struct DiscoveryEventStream {
587 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
588}
589
590impl std::marker::Unpin for DiscoveryEventStream {}
591
592impl futures::stream::FusedStream for DiscoveryEventStream {
593 fn is_terminated(&self) -> bool {
594 self.event_receiver.is_terminated()
595 }
596}
597
598impl futures::Stream for DiscoveryEventStream {
599 type Item = Result<DiscoveryEvent, fidl::Error>;
600
601 fn poll_next(
602 mut self: std::pin::Pin<&mut Self>,
603 cx: &mut std::task::Context<'_>,
604 ) -> std::task::Poll<Option<Self::Item>> {
605 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
606 &mut self.event_receiver,
607 cx
608 )?) {
609 Some(buf) => std::task::Poll::Ready(Some(DiscoveryEvent::decode(buf))),
610 None => std::task::Poll::Ready(None),
611 }
612 }
613}
614
615#[derive(Debug)]
616pub enum DiscoveryEvent {}
617
618impl DiscoveryEvent {
619 fn decode(
621 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
622 ) -> Result<DiscoveryEvent, fidl::Error> {
623 let (bytes, _handles) = buf.split_mut();
624 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
625 debug_assert_eq!(tx_header.tx_id, 0);
626 match tx_header.ordinal {
627 _ => Err(fidl::Error::UnknownOrdinal {
628 ordinal: tx_header.ordinal,
629 protocol_name: <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
630 }),
631 }
632 }
633}
634
635pub struct DiscoveryRequestStream {
637 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
638 is_terminated: bool,
639}
640
641impl std::marker::Unpin for DiscoveryRequestStream {}
642
643impl futures::stream::FusedStream for DiscoveryRequestStream {
644 fn is_terminated(&self) -> bool {
645 self.is_terminated
646 }
647}
648
649impl fidl::endpoints::RequestStream for DiscoveryRequestStream {
650 type Protocol = DiscoveryMarker;
651 type ControlHandle = DiscoveryControlHandle;
652
653 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
654 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
655 }
656
657 fn control_handle(&self) -> Self::ControlHandle {
658 DiscoveryControlHandle { inner: self.inner.clone() }
659 }
660
661 fn into_inner(
662 self,
663 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
664 {
665 (self.inner, self.is_terminated)
666 }
667
668 fn from_inner(
669 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
670 is_terminated: bool,
671 ) -> Self {
672 Self { inner, is_terminated }
673 }
674}
675
676impl futures::Stream for DiscoveryRequestStream {
677 type Item = Result<DiscoveryRequest, fidl::Error>;
678
679 fn poll_next(
680 mut self: std::pin::Pin<&mut Self>,
681 cx: &mut std::task::Context<'_>,
682 ) -> std::task::Poll<Option<Self::Item>> {
683 let this = &mut *self;
684 if this.inner.check_shutdown(cx) {
685 this.is_terminated = true;
686 return std::task::Poll::Ready(None);
687 }
688 if this.is_terminated {
689 panic!("polled DiscoveryRequestStream after completion");
690 }
691 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
692 |bytes, handles| {
693 match this.inner.channel().read_etc(cx, bytes, handles) {
694 std::task::Poll::Ready(Ok(())) => {}
695 std::task::Poll::Pending => return std::task::Poll::Pending,
696 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
697 this.is_terminated = true;
698 return std::task::Poll::Ready(None);
699 }
700 std::task::Poll::Ready(Err(e)) => {
701 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
702 e.into(),
703 ))))
704 }
705 }
706
707 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
709
710 std::task::Poll::Ready(Some(match header.ordinal {
711 0x60538587bdd80a32 => {
712 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
713 let mut req = fidl::new_empty!(
714 DiscoveryGetGuestRequest,
715 fidl::encoding::DefaultFuchsiaResourceDialect
716 );
717 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryGetGuestRequest>(&header, _body_bytes, handles, &mut req)?;
718 let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
719 Ok(DiscoveryRequest::GetGuest {
720 realm_name: req.realm_name,
721 guest_name: req.guest_name,
722 guest: req.guest,
723
724 control_handle,
725 })
726 }
727 _ => Err(fidl::Error::UnknownOrdinal {
728 ordinal: header.ordinal,
729 protocol_name:
730 <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
731 }),
732 }))
733 },
734 )
735 }
736}
737
738#[derive(Debug)]
740pub enum DiscoveryRequest {
741 GetGuest {
745 realm_name: Option<String>,
746 guest_name: String,
747 guest: fidl::endpoints::ServerEnd<InteractionMarker>,
748 control_handle: DiscoveryControlHandle,
749 },
750}
751
752impl DiscoveryRequest {
753 #[allow(irrefutable_let_patterns)]
754 pub fn into_get_guest(
755 self,
756 ) -> Option<(
757 Option<String>,
758 String,
759 fidl::endpoints::ServerEnd<InteractionMarker>,
760 DiscoveryControlHandle,
761 )> {
762 if let DiscoveryRequest::GetGuest { realm_name, guest_name, guest, control_handle } = self {
763 Some((realm_name, guest_name, guest, control_handle))
764 } else {
765 None
766 }
767 }
768
769 pub fn method_name(&self) -> &'static str {
771 match *self {
772 DiscoveryRequest::GetGuest { .. } => "get_guest",
773 }
774 }
775}
776
777#[derive(Debug, Clone)]
778pub struct DiscoveryControlHandle {
779 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
780}
781
782impl fidl::endpoints::ControlHandle for DiscoveryControlHandle {
783 fn shutdown(&self) {
784 self.inner.shutdown()
785 }
786 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
787 self.inner.shutdown_with_epitaph(status)
788 }
789
790 fn is_closed(&self) -> bool {
791 self.inner.channel().is_closed()
792 }
793 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
794 self.inner.channel().on_closed()
795 }
796
797 #[cfg(target_os = "fuchsia")]
798 fn signal_peer(
799 &self,
800 clear_mask: zx::Signals,
801 set_mask: zx::Signals,
802 ) -> Result<(), zx_status::Status> {
803 use fidl::Peered;
804 self.inner.channel().signal_peer(clear_mask, set_mask)
805 }
806}
807
808impl DiscoveryControlHandle {}
809
810#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
811pub struct InteractionMarker;
812
813impl fidl::endpoints::ProtocolMarker for InteractionMarker {
814 type Proxy = InteractionProxy;
815 type RequestStream = InteractionRequestStream;
816 #[cfg(target_os = "fuchsia")]
817 type SynchronousProxy = InteractionSynchronousProxy;
818
819 const DEBUG_NAME: &'static str = "(anonymous) Interaction";
820}
821
822pub trait InteractionProxyInterface: Send + Sync {
823 type PutFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
824 fn r#put_file(
825 &self,
826 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
827 remote_path: &str,
828 ) -> Self::PutFileResponseFut;
829 type GetFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
830 fn r#get_file(
831 &self,
832 remote_path: &str,
833 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
834 ) -> Self::GetFileResponseFut;
835 fn r#execute_command(
836 &self,
837 command: &str,
838 env: &[EnvironmentVariable],
839 stdin: Option<fidl::Socket>,
840 stdout: Option<fidl::Socket>,
841 stderr: Option<fidl::Socket>,
842 command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
843 ) -> Result<(), fidl::Error>;
844}
845#[derive(Debug)]
846#[cfg(target_os = "fuchsia")]
847pub struct InteractionSynchronousProxy {
848 client: fidl::client::sync::Client,
849}
850
851#[cfg(target_os = "fuchsia")]
852impl fidl::endpoints::SynchronousProxy for InteractionSynchronousProxy {
853 type Proxy = InteractionProxy;
854 type Protocol = InteractionMarker;
855
856 fn from_channel(inner: fidl::Channel) -> Self {
857 Self::new(inner)
858 }
859
860 fn into_channel(self) -> fidl::Channel {
861 self.client.into_channel()
862 }
863
864 fn as_channel(&self) -> &fidl::Channel {
865 self.client.as_channel()
866 }
867}
868
869#[cfg(target_os = "fuchsia")]
870impl InteractionSynchronousProxy {
871 pub fn new(channel: fidl::Channel) -> Self {
872 let protocol_name = <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
873 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
874 }
875
876 pub fn into_channel(self) -> fidl::Channel {
877 self.client.into_channel()
878 }
879
880 pub fn wait_for_event(
883 &self,
884 deadline: zx::MonotonicInstant,
885 ) -> Result<InteractionEvent, fidl::Error> {
886 InteractionEvent::decode(self.client.wait_for_event(deadline)?)
887 }
888
889 pub fn r#put_file(
892 &self,
893 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
894 mut remote_path: &str,
895 ___deadline: zx::MonotonicInstant,
896 ) -> Result<i32, fidl::Error> {
897 let _response =
898 self.client.send_query::<InteractionPutFileRequest, InteractionPutFileResponse>(
899 (local_file, remote_path),
900 0x223bc20da4a7cddd,
901 fidl::encoding::DynamicFlags::empty(),
902 ___deadline,
903 )?;
904 Ok(_response.status)
905 }
906
907 pub fn r#get_file(
910 &self,
911 mut remote_path: &str,
912 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
913 ___deadline: zx::MonotonicInstant,
914 ) -> Result<i32, fidl::Error> {
915 let _response =
916 self.client.send_query::<InteractionGetFileRequest, InteractionGetFileResponse>(
917 (remote_path, local_file),
918 0x7696bea472ca0f2d,
919 fidl::encoding::DynamicFlags::empty(),
920 ___deadline,
921 )?;
922 Ok(_response.status)
923 }
924
925 pub fn r#execute_command(
928 &self,
929 mut command: &str,
930 mut env: &[EnvironmentVariable],
931 mut stdin: Option<fidl::Socket>,
932 mut stdout: Option<fidl::Socket>,
933 mut stderr: Option<fidl::Socket>,
934 mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
935 ) -> Result<(), fidl::Error> {
936 self.client.send::<InteractionExecuteCommandRequest>(
937 (command, env, stdin, stdout, stderr, command_listener),
938 0x612641220a1556d8,
939 fidl::encoding::DynamicFlags::empty(),
940 )
941 }
942}
943
944#[cfg(target_os = "fuchsia")]
945impl From<InteractionSynchronousProxy> for zx::Handle {
946 fn from(value: InteractionSynchronousProxy) -> Self {
947 value.into_channel().into()
948 }
949}
950
951#[cfg(target_os = "fuchsia")]
952impl From<fidl::Channel> for InteractionSynchronousProxy {
953 fn from(value: fidl::Channel) -> Self {
954 Self::new(value)
955 }
956}
957
958#[cfg(target_os = "fuchsia")]
959impl fidl::endpoints::FromClient for InteractionSynchronousProxy {
960 type Protocol = InteractionMarker;
961
962 fn from_client(value: fidl::endpoints::ClientEnd<InteractionMarker>) -> Self {
963 Self::new(value.into_channel())
964 }
965}
966
967#[derive(Debug, Clone)]
968pub struct InteractionProxy {
969 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
970}
971
972impl fidl::endpoints::Proxy for InteractionProxy {
973 type Protocol = InteractionMarker;
974
975 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
976 Self::new(inner)
977 }
978
979 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
980 self.client.into_channel().map_err(|client| Self { client })
981 }
982
983 fn as_channel(&self) -> &::fidl::AsyncChannel {
984 self.client.as_channel()
985 }
986}
987
988impl InteractionProxy {
989 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
991 let protocol_name = <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
992 Self { client: fidl::client::Client::new(channel, protocol_name) }
993 }
994
995 pub fn take_event_stream(&self) -> InteractionEventStream {
1001 InteractionEventStream { event_receiver: self.client.take_event_receiver() }
1002 }
1003
1004 pub fn r#put_file(
1007 &self,
1008 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1009 mut remote_path: &str,
1010 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1011 InteractionProxyInterface::r#put_file(self, local_file, remote_path)
1012 }
1013
1014 pub fn r#get_file(
1017 &self,
1018 mut remote_path: &str,
1019 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1020 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1021 InteractionProxyInterface::r#get_file(self, remote_path, local_file)
1022 }
1023
1024 pub fn r#execute_command(
1027 &self,
1028 mut command: &str,
1029 mut env: &[EnvironmentVariable],
1030 mut stdin: Option<fidl::Socket>,
1031 mut stdout: Option<fidl::Socket>,
1032 mut stderr: Option<fidl::Socket>,
1033 mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1034 ) -> Result<(), fidl::Error> {
1035 InteractionProxyInterface::r#execute_command(
1036 self,
1037 command,
1038 env,
1039 stdin,
1040 stdout,
1041 stderr,
1042 command_listener,
1043 )
1044 }
1045}
1046
1047impl InteractionProxyInterface for InteractionProxy {
1048 type PutFileResponseFut =
1049 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1050 fn r#put_file(
1051 &self,
1052 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1053 mut remote_path: &str,
1054 ) -> Self::PutFileResponseFut {
1055 fn _decode(
1056 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1057 ) -> Result<i32, fidl::Error> {
1058 let _response = fidl::client::decode_transaction_body::<
1059 InteractionPutFileResponse,
1060 fidl::encoding::DefaultFuchsiaResourceDialect,
1061 0x223bc20da4a7cddd,
1062 >(_buf?)?;
1063 Ok(_response.status)
1064 }
1065 self.client.send_query_and_decode::<InteractionPutFileRequest, i32>(
1066 (local_file, remote_path),
1067 0x223bc20da4a7cddd,
1068 fidl::encoding::DynamicFlags::empty(),
1069 _decode,
1070 )
1071 }
1072
1073 type GetFileResponseFut =
1074 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1075 fn r#get_file(
1076 &self,
1077 mut remote_path: &str,
1078 mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1079 ) -> Self::GetFileResponseFut {
1080 fn _decode(
1081 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1082 ) -> Result<i32, fidl::Error> {
1083 let _response = fidl::client::decode_transaction_body::<
1084 InteractionGetFileResponse,
1085 fidl::encoding::DefaultFuchsiaResourceDialect,
1086 0x7696bea472ca0f2d,
1087 >(_buf?)?;
1088 Ok(_response.status)
1089 }
1090 self.client.send_query_and_decode::<InteractionGetFileRequest, i32>(
1091 (remote_path, local_file),
1092 0x7696bea472ca0f2d,
1093 fidl::encoding::DynamicFlags::empty(),
1094 _decode,
1095 )
1096 }
1097
1098 fn r#execute_command(
1099 &self,
1100 mut command: &str,
1101 mut env: &[EnvironmentVariable],
1102 mut stdin: Option<fidl::Socket>,
1103 mut stdout: Option<fidl::Socket>,
1104 mut stderr: Option<fidl::Socket>,
1105 mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1106 ) -> Result<(), fidl::Error> {
1107 self.client.send::<InteractionExecuteCommandRequest>(
1108 (command, env, stdin, stdout, stderr, command_listener),
1109 0x612641220a1556d8,
1110 fidl::encoding::DynamicFlags::empty(),
1111 )
1112 }
1113}
1114
1115pub struct InteractionEventStream {
1116 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1117}
1118
1119impl std::marker::Unpin for InteractionEventStream {}
1120
1121impl futures::stream::FusedStream for InteractionEventStream {
1122 fn is_terminated(&self) -> bool {
1123 self.event_receiver.is_terminated()
1124 }
1125}
1126
1127impl futures::Stream for InteractionEventStream {
1128 type Item = Result<InteractionEvent, fidl::Error>;
1129
1130 fn poll_next(
1131 mut self: std::pin::Pin<&mut Self>,
1132 cx: &mut std::task::Context<'_>,
1133 ) -> std::task::Poll<Option<Self::Item>> {
1134 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1135 &mut self.event_receiver,
1136 cx
1137 )?) {
1138 Some(buf) => std::task::Poll::Ready(Some(InteractionEvent::decode(buf))),
1139 None => std::task::Poll::Ready(None),
1140 }
1141 }
1142}
1143
1144#[derive(Debug)]
1145pub enum InteractionEvent {}
1146
1147impl InteractionEvent {
1148 fn decode(
1150 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1151 ) -> Result<InteractionEvent, fidl::Error> {
1152 let (bytes, _handles) = buf.split_mut();
1153 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1154 debug_assert_eq!(tx_header.tx_id, 0);
1155 match tx_header.ordinal {
1156 _ => Err(fidl::Error::UnknownOrdinal {
1157 ordinal: tx_header.ordinal,
1158 protocol_name: <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1159 }),
1160 }
1161 }
1162}
1163
1164pub struct InteractionRequestStream {
1166 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1167 is_terminated: bool,
1168}
1169
1170impl std::marker::Unpin for InteractionRequestStream {}
1171
1172impl futures::stream::FusedStream for InteractionRequestStream {
1173 fn is_terminated(&self) -> bool {
1174 self.is_terminated
1175 }
1176}
1177
1178impl fidl::endpoints::RequestStream for InteractionRequestStream {
1179 type Protocol = InteractionMarker;
1180 type ControlHandle = InteractionControlHandle;
1181
1182 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1183 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1184 }
1185
1186 fn control_handle(&self) -> Self::ControlHandle {
1187 InteractionControlHandle { inner: self.inner.clone() }
1188 }
1189
1190 fn into_inner(
1191 self,
1192 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1193 {
1194 (self.inner, self.is_terminated)
1195 }
1196
1197 fn from_inner(
1198 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1199 is_terminated: bool,
1200 ) -> Self {
1201 Self { inner, is_terminated }
1202 }
1203}
1204
1205impl futures::Stream for InteractionRequestStream {
1206 type Item = Result<InteractionRequest, fidl::Error>;
1207
1208 fn poll_next(
1209 mut self: std::pin::Pin<&mut Self>,
1210 cx: &mut std::task::Context<'_>,
1211 ) -> std::task::Poll<Option<Self::Item>> {
1212 let this = &mut *self;
1213 if this.inner.check_shutdown(cx) {
1214 this.is_terminated = true;
1215 return std::task::Poll::Ready(None);
1216 }
1217 if this.is_terminated {
1218 panic!("polled InteractionRequestStream after completion");
1219 }
1220 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1221 |bytes, handles| {
1222 match this.inner.channel().read_etc(cx, bytes, handles) {
1223 std::task::Poll::Ready(Ok(())) => {}
1224 std::task::Poll::Pending => return std::task::Poll::Pending,
1225 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1226 this.is_terminated = true;
1227 return std::task::Poll::Ready(None);
1228 }
1229 std::task::Poll::Ready(Err(e)) => {
1230 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1231 e.into(),
1232 ))))
1233 }
1234 }
1235
1236 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1238
1239 std::task::Poll::Ready(Some(match header.ordinal {
1240 0x223bc20da4a7cddd => {
1241 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1242 let mut req = fidl::new_empty!(
1243 InteractionPutFileRequest,
1244 fidl::encoding::DefaultFuchsiaResourceDialect
1245 );
1246 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionPutFileRequest>(&header, _body_bytes, handles, &mut req)?;
1247 let control_handle = InteractionControlHandle { inner: this.inner.clone() };
1248 Ok(InteractionRequest::PutFile {
1249 local_file: req.local_file,
1250 remote_path: req.remote_path,
1251
1252 responder: InteractionPutFileResponder {
1253 control_handle: std::mem::ManuallyDrop::new(control_handle),
1254 tx_id: header.tx_id,
1255 },
1256 })
1257 }
1258 0x7696bea472ca0f2d => {
1259 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1260 let mut req = fidl::new_empty!(
1261 InteractionGetFileRequest,
1262 fidl::encoding::DefaultFuchsiaResourceDialect
1263 );
1264 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionGetFileRequest>(&header, _body_bytes, handles, &mut req)?;
1265 let control_handle = InteractionControlHandle { inner: this.inner.clone() };
1266 Ok(InteractionRequest::GetFile {
1267 remote_path: req.remote_path,
1268 local_file: req.local_file,
1269
1270 responder: InteractionGetFileResponder {
1271 control_handle: std::mem::ManuallyDrop::new(control_handle),
1272 tx_id: header.tx_id,
1273 },
1274 })
1275 }
1276 0x612641220a1556d8 => {
1277 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1278 let mut req = fidl::new_empty!(
1279 InteractionExecuteCommandRequest,
1280 fidl::encoding::DefaultFuchsiaResourceDialect
1281 );
1282 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionExecuteCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1283 let control_handle = InteractionControlHandle { inner: this.inner.clone() };
1284 Ok(InteractionRequest::ExecuteCommand {
1285 command: req.command,
1286 env: req.env,
1287 stdin: req.stdin,
1288 stdout: req.stdout,
1289 stderr: req.stderr,
1290 command_listener: req.command_listener,
1291
1292 control_handle,
1293 })
1294 }
1295 _ => Err(fidl::Error::UnknownOrdinal {
1296 ordinal: header.ordinal,
1297 protocol_name:
1298 <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1299 }),
1300 }))
1301 },
1302 )
1303 }
1304}
1305
1306#[derive(Debug)]
1307pub enum InteractionRequest {
1308 PutFile {
1311 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1312 remote_path: String,
1313 responder: InteractionPutFileResponder,
1314 },
1315 GetFile {
1318 remote_path: String,
1319 local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1320 responder: InteractionGetFileResponder,
1321 },
1322 ExecuteCommand {
1325 command: String,
1326 env: Vec<EnvironmentVariable>,
1327 stdin: Option<fidl::Socket>,
1328 stdout: Option<fidl::Socket>,
1329 stderr: Option<fidl::Socket>,
1330 command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
1331 control_handle: InteractionControlHandle,
1332 },
1333}
1334
1335impl InteractionRequest {
1336 #[allow(irrefutable_let_patterns)]
1337 pub fn into_put_file(
1338 self,
1339 ) -> Option<(
1340 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1341 String,
1342 InteractionPutFileResponder,
1343 )> {
1344 if let InteractionRequest::PutFile { local_file, remote_path, responder } = self {
1345 Some((local_file, remote_path, responder))
1346 } else {
1347 None
1348 }
1349 }
1350
1351 #[allow(irrefutable_let_patterns)]
1352 pub fn into_get_file(
1353 self,
1354 ) -> Option<(
1355 String,
1356 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1357 InteractionGetFileResponder,
1358 )> {
1359 if let InteractionRequest::GetFile { remote_path, local_file, responder } = self {
1360 Some((remote_path, local_file, responder))
1361 } else {
1362 None
1363 }
1364 }
1365
1366 #[allow(irrefutable_let_patterns)]
1367 pub fn into_execute_command(
1368 self,
1369 ) -> Option<(
1370 String,
1371 Vec<EnvironmentVariable>,
1372 Option<fidl::Socket>,
1373 Option<fidl::Socket>,
1374 Option<fidl::Socket>,
1375 fidl::endpoints::ServerEnd<CommandListenerMarker>,
1376 InteractionControlHandle,
1377 )> {
1378 if let InteractionRequest::ExecuteCommand {
1379 command,
1380 env,
1381 stdin,
1382 stdout,
1383 stderr,
1384 command_listener,
1385 control_handle,
1386 } = self
1387 {
1388 Some((command, env, stdin, stdout, stderr, command_listener, control_handle))
1389 } else {
1390 None
1391 }
1392 }
1393
1394 pub fn method_name(&self) -> &'static str {
1396 match *self {
1397 InteractionRequest::PutFile { .. } => "put_file",
1398 InteractionRequest::GetFile { .. } => "get_file",
1399 InteractionRequest::ExecuteCommand { .. } => "execute_command",
1400 }
1401 }
1402}
1403
1404#[derive(Debug, Clone)]
1405pub struct InteractionControlHandle {
1406 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1407}
1408
1409impl fidl::endpoints::ControlHandle for InteractionControlHandle {
1410 fn shutdown(&self) {
1411 self.inner.shutdown()
1412 }
1413 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1414 self.inner.shutdown_with_epitaph(status)
1415 }
1416
1417 fn is_closed(&self) -> bool {
1418 self.inner.channel().is_closed()
1419 }
1420 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1421 self.inner.channel().on_closed()
1422 }
1423
1424 #[cfg(target_os = "fuchsia")]
1425 fn signal_peer(
1426 &self,
1427 clear_mask: zx::Signals,
1428 set_mask: zx::Signals,
1429 ) -> Result<(), zx_status::Status> {
1430 use fidl::Peered;
1431 self.inner.channel().signal_peer(clear_mask, set_mask)
1432 }
1433}
1434
1435impl InteractionControlHandle {}
1436
1437#[must_use = "FIDL methods require a response to be sent"]
1438#[derive(Debug)]
1439pub struct InteractionPutFileResponder {
1440 control_handle: std::mem::ManuallyDrop<InteractionControlHandle>,
1441 tx_id: u32,
1442}
1443
1444impl std::ops::Drop for InteractionPutFileResponder {
1448 fn drop(&mut self) {
1449 self.control_handle.shutdown();
1450 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1452 }
1453}
1454
1455impl fidl::endpoints::Responder for InteractionPutFileResponder {
1456 type ControlHandle = InteractionControlHandle;
1457
1458 fn control_handle(&self) -> &InteractionControlHandle {
1459 &self.control_handle
1460 }
1461
1462 fn drop_without_shutdown(mut self) {
1463 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1465 std::mem::forget(self);
1467 }
1468}
1469
1470impl InteractionPutFileResponder {
1471 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1475 let _result = self.send_raw(status);
1476 if _result.is_err() {
1477 self.control_handle.shutdown();
1478 }
1479 self.drop_without_shutdown();
1480 _result
1481 }
1482
1483 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1485 let _result = self.send_raw(status);
1486 self.drop_without_shutdown();
1487 _result
1488 }
1489
1490 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1491 self.control_handle.inner.send::<InteractionPutFileResponse>(
1492 (status,),
1493 self.tx_id,
1494 0x223bc20da4a7cddd,
1495 fidl::encoding::DynamicFlags::empty(),
1496 )
1497 }
1498}
1499
1500#[must_use = "FIDL methods require a response to be sent"]
1501#[derive(Debug)]
1502pub struct InteractionGetFileResponder {
1503 control_handle: std::mem::ManuallyDrop<InteractionControlHandle>,
1504 tx_id: u32,
1505}
1506
1507impl std::ops::Drop for InteractionGetFileResponder {
1511 fn drop(&mut self) {
1512 self.control_handle.shutdown();
1513 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1515 }
1516}
1517
1518impl fidl::endpoints::Responder for InteractionGetFileResponder {
1519 type ControlHandle = InteractionControlHandle;
1520
1521 fn control_handle(&self) -> &InteractionControlHandle {
1522 &self.control_handle
1523 }
1524
1525 fn drop_without_shutdown(mut self) {
1526 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1528 std::mem::forget(self);
1530 }
1531}
1532
1533impl InteractionGetFileResponder {
1534 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1538 let _result = self.send_raw(status);
1539 if _result.is_err() {
1540 self.control_handle.shutdown();
1541 }
1542 self.drop_without_shutdown();
1543 _result
1544 }
1545
1546 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1548 let _result = self.send_raw(status);
1549 self.drop_without_shutdown();
1550 _result
1551 }
1552
1553 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1554 self.control_handle.inner.send::<InteractionGetFileResponse>(
1555 (status,),
1556 self.tx_id,
1557 0x7696bea472ca0f2d,
1558 fidl::encoding::DynamicFlags::empty(),
1559 )
1560 }
1561}
1562
1563mod internal {
1564 use super::*;
1565
1566 impl fidl::encoding::ResourceTypeMarker for DiscoveryGetGuestRequest {
1567 type Borrowed<'a> = &'a mut Self;
1568 fn take_or_borrow<'a>(
1569 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1570 ) -> Self::Borrowed<'a> {
1571 value
1572 }
1573 }
1574
1575 unsafe impl fidl::encoding::TypeMarker for DiscoveryGetGuestRequest {
1576 type Owned = Self;
1577
1578 #[inline(always)]
1579 fn inline_align(_context: fidl::encoding::Context) -> usize {
1580 8
1581 }
1582
1583 #[inline(always)]
1584 fn inline_size(_context: fidl::encoding::Context) -> usize {
1585 40
1586 }
1587 }
1588
1589 unsafe impl
1590 fidl::encoding::Encode<
1591 DiscoveryGetGuestRequest,
1592 fidl::encoding::DefaultFuchsiaResourceDialect,
1593 > for &mut DiscoveryGetGuestRequest
1594 {
1595 #[inline]
1596 unsafe fn encode(
1597 self,
1598 encoder: &mut fidl::encoding::Encoder<
1599 '_,
1600 fidl::encoding::DefaultFuchsiaResourceDialect,
1601 >,
1602 offset: usize,
1603 _depth: fidl::encoding::Depth,
1604 ) -> fidl::Result<()> {
1605 encoder.debug_check_bounds::<DiscoveryGetGuestRequest>(offset);
1606 fidl::encoding::Encode::<DiscoveryGetGuestRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1608 (
1609 <fidl::encoding::Optional<fidl::encoding::BoundedString<1024>> as fidl::encoding::ValueTypeMarker>::borrow(&self.realm_name),
1610 <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_name),
1611 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
1612 ),
1613 encoder, offset, _depth
1614 )
1615 }
1616 }
1617 unsafe impl<
1618 T0: fidl::encoding::Encode<
1619 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
1620 fidl::encoding::DefaultFuchsiaResourceDialect,
1621 >,
1622 T1: fidl::encoding::Encode<
1623 fidl::encoding::BoundedString<1024>,
1624 fidl::encoding::DefaultFuchsiaResourceDialect,
1625 >,
1626 T2: fidl::encoding::Encode<
1627 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
1628 fidl::encoding::DefaultFuchsiaResourceDialect,
1629 >,
1630 >
1631 fidl::encoding::Encode<
1632 DiscoveryGetGuestRequest,
1633 fidl::encoding::DefaultFuchsiaResourceDialect,
1634 > for (T0, T1, T2)
1635 {
1636 #[inline]
1637 unsafe fn encode(
1638 self,
1639 encoder: &mut fidl::encoding::Encoder<
1640 '_,
1641 fidl::encoding::DefaultFuchsiaResourceDialect,
1642 >,
1643 offset: usize,
1644 depth: fidl::encoding::Depth,
1645 ) -> fidl::Result<()> {
1646 encoder.debug_check_bounds::<DiscoveryGetGuestRequest>(offset);
1647 unsafe {
1650 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
1651 (ptr as *mut u64).write_unaligned(0);
1652 }
1653 self.0.encode(encoder, offset + 0, depth)?;
1655 self.1.encode(encoder, offset + 16, depth)?;
1656 self.2.encode(encoder, offset + 32, depth)?;
1657 Ok(())
1658 }
1659 }
1660
1661 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1662 for DiscoveryGetGuestRequest
1663 {
1664 #[inline(always)]
1665 fn new_empty() -> Self {
1666 Self {
1667 realm_name: fidl::new_empty!(
1668 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
1669 fidl::encoding::DefaultFuchsiaResourceDialect
1670 ),
1671 guest_name: fidl::new_empty!(
1672 fidl::encoding::BoundedString<1024>,
1673 fidl::encoding::DefaultFuchsiaResourceDialect
1674 ),
1675 guest: fidl::new_empty!(
1676 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
1677 fidl::encoding::DefaultFuchsiaResourceDialect
1678 ),
1679 }
1680 }
1681
1682 #[inline]
1683 unsafe fn decode(
1684 &mut self,
1685 decoder: &mut fidl::encoding::Decoder<
1686 '_,
1687 fidl::encoding::DefaultFuchsiaResourceDialect,
1688 >,
1689 offset: usize,
1690 _depth: fidl::encoding::Depth,
1691 ) -> fidl::Result<()> {
1692 decoder.debug_check_bounds::<Self>(offset);
1693 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
1695 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1696 let mask = 0xffffffff00000000u64;
1697 let maskedval = padval & mask;
1698 if maskedval != 0 {
1699 return Err(fidl::Error::NonZeroPadding {
1700 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
1701 });
1702 }
1703 fidl::decode!(
1704 fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
1705 fidl::encoding::DefaultFuchsiaResourceDialect,
1706 &mut self.realm_name,
1707 decoder,
1708 offset + 0,
1709 _depth
1710 )?;
1711 fidl::decode!(
1712 fidl::encoding::BoundedString<1024>,
1713 fidl::encoding::DefaultFuchsiaResourceDialect,
1714 &mut self.guest_name,
1715 decoder,
1716 offset + 16,
1717 _depth
1718 )?;
1719 fidl::decode!(
1720 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
1721 fidl::encoding::DefaultFuchsiaResourceDialect,
1722 &mut self.guest,
1723 decoder,
1724 offset + 32,
1725 _depth
1726 )?;
1727 Ok(())
1728 }
1729 }
1730
1731 impl fidl::encoding::ResourceTypeMarker for InteractionExecuteCommandRequest {
1732 type Borrowed<'a> = &'a mut Self;
1733 fn take_or_borrow<'a>(
1734 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1735 ) -> Self::Borrowed<'a> {
1736 value
1737 }
1738 }
1739
1740 unsafe impl fidl::encoding::TypeMarker for InteractionExecuteCommandRequest {
1741 type Owned = Self;
1742
1743 #[inline(always)]
1744 fn inline_align(_context: fidl::encoding::Context) -> usize {
1745 8
1746 }
1747
1748 #[inline(always)]
1749 fn inline_size(_context: fidl::encoding::Context) -> usize {
1750 48
1751 }
1752 }
1753
1754 unsafe impl
1755 fidl::encoding::Encode<
1756 InteractionExecuteCommandRequest,
1757 fidl::encoding::DefaultFuchsiaResourceDialect,
1758 > for &mut InteractionExecuteCommandRequest
1759 {
1760 #[inline]
1761 unsafe fn encode(
1762 self,
1763 encoder: &mut fidl::encoding::Encoder<
1764 '_,
1765 fidl::encoding::DefaultFuchsiaResourceDialect,
1766 >,
1767 offset: usize,
1768 _depth: fidl::encoding::Depth,
1769 ) -> fidl::Result<()> {
1770 encoder.debug_check_bounds::<InteractionExecuteCommandRequest>(offset);
1771 fidl::encoding::Encode::<InteractionExecuteCommandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1773 (
1774 <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
1775 <fidl::encoding::Vector<EnvironmentVariable, 1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.env),
1776 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdin),
1777 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdout),
1778 <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stderr),
1779 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.command_listener),
1780 ),
1781 encoder, offset, _depth
1782 )
1783 }
1784 }
1785 unsafe impl<
1786 T0: fidl::encoding::Encode<
1787 fidl::encoding::BoundedString<1024>,
1788 fidl::encoding::DefaultFuchsiaResourceDialect,
1789 >,
1790 T1: fidl::encoding::Encode<
1791 fidl::encoding::Vector<EnvironmentVariable, 1024>,
1792 fidl::encoding::DefaultFuchsiaResourceDialect,
1793 >,
1794 T2: fidl::encoding::Encode<
1795 fidl::encoding::Optional<
1796 fidl::encoding::HandleType<
1797 fidl::Socket,
1798 { fidl::ObjectType::SOCKET.into_raw() },
1799 2147483648,
1800 >,
1801 >,
1802 fidl::encoding::DefaultFuchsiaResourceDialect,
1803 >,
1804 T3: fidl::encoding::Encode<
1805 fidl::encoding::Optional<
1806 fidl::encoding::HandleType<
1807 fidl::Socket,
1808 { fidl::ObjectType::SOCKET.into_raw() },
1809 2147483648,
1810 >,
1811 >,
1812 fidl::encoding::DefaultFuchsiaResourceDialect,
1813 >,
1814 T4: fidl::encoding::Encode<
1815 fidl::encoding::Optional<
1816 fidl::encoding::HandleType<
1817 fidl::Socket,
1818 { fidl::ObjectType::SOCKET.into_raw() },
1819 2147483648,
1820 >,
1821 >,
1822 fidl::encoding::DefaultFuchsiaResourceDialect,
1823 >,
1824 T5: fidl::encoding::Encode<
1825 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
1826 fidl::encoding::DefaultFuchsiaResourceDialect,
1827 >,
1828 >
1829 fidl::encoding::Encode<
1830 InteractionExecuteCommandRequest,
1831 fidl::encoding::DefaultFuchsiaResourceDialect,
1832 > for (T0, T1, T2, T3, T4, T5)
1833 {
1834 #[inline]
1835 unsafe fn encode(
1836 self,
1837 encoder: &mut fidl::encoding::Encoder<
1838 '_,
1839 fidl::encoding::DefaultFuchsiaResourceDialect,
1840 >,
1841 offset: usize,
1842 depth: fidl::encoding::Depth,
1843 ) -> fidl::Result<()> {
1844 encoder.debug_check_bounds::<InteractionExecuteCommandRequest>(offset);
1845 self.0.encode(encoder, offset + 0, depth)?;
1849 self.1.encode(encoder, offset + 16, depth)?;
1850 self.2.encode(encoder, offset + 32, depth)?;
1851 self.3.encode(encoder, offset + 36, depth)?;
1852 self.4.encode(encoder, offset + 40, depth)?;
1853 self.5.encode(encoder, offset + 44, depth)?;
1854 Ok(())
1855 }
1856 }
1857
1858 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1859 for InteractionExecuteCommandRequest
1860 {
1861 #[inline(always)]
1862 fn new_empty() -> Self {
1863 Self {
1864 command: fidl::new_empty!(
1865 fidl::encoding::BoundedString<1024>,
1866 fidl::encoding::DefaultFuchsiaResourceDialect
1867 ),
1868 env: fidl::new_empty!(fidl::encoding::Vector<EnvironmentVariable, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect),
1869 stdin: fidl::new_empty!(
1870 fidl::encoding::Optional<
1871 fidl::encoding::HandleType<
1872 fidl::Socket,
1873 { fidl::ObjectType::SOCKET.into_raw() },
1874 2147483648,
1875 >,
1876 >,
1877 fidl::encoding::DefaultFuchsiaResourceDialect
1878 ),
1879 stdout: fidl::new_empty!(
1880 fidl::encoding::Optional<
1881 fidl::encoding::HandleType<
1882 fidl::Socket,
1883 { fidl::ObjectType::SOCKET.into_raw() },
1884 2147483648,
1885 >,
1886 >,
1887 fidl::encoding::DefaultFuchsiaResourceDialect
1888 ),
1889 stderr: fidl::new_empty!(
1890 fidl::encoding::Optional<
1891 fidl::encoding::HandleType<
1892 fidl::Socket,
1893 { fidl::ObjectType::SOCKET.into_raw() },
1894 2147483648,
1895 >,
1896 >,
1897 fidl::encoding::DefaultFuchsiaResourceDialect
1898 ),
1899 command_listener: fidl::new_empty!(
1900 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
1901 fidl::encoding::DefaultFuchsiaResourceDialect
1902 ),
1903 }
1904 }
1905
1906 #[inline]
1907 unsafe fn decode(
1908 &mut self,
1909 decoder: &mut fidl::encoding::Decoder<
1910 '_,
1911 fidl::encoding::DefaultFuchsiaResourceDialect,
1912 >,
1913 offset: usize,
1914 _depth: fidl::encoding::Depth,
1915 ) -> fidl::Result<()> {
1916 decoder.debug_check_bounds::<Self>(offset);
1917 fidl::decode!(
1919 fidl::encoding::BoundedString<1024>,
1920 fidl::encoding::DefaultFuchsiaResourceDialect,
1921 &mut self.command,
1922 decoder,
1923 offset + 0,
1924 _depth
1925 )?;
1926 fidl::decode!(fidl::encoding::Vector<EnvironmentVariable, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.env, decoder, offset + 16, _depth)?;
1927 fidl::decode!(
1928 fidl::encoding::Optional<
1929 fidl::encoding::HandleType<
1930 fidl::Socket,
1931 { fidl::ObjectType::SOCKET.into_raw() },
1932 2147483648,
1933 >,
1934 >,
1935 fidl::encoding::DefaultFuchsiaResourceDialect,
1936 &mut self.stdin,
1937 decoder,
1938 offset + 32,
1939 _depth
1940 )?;
1941 fidl::decode!(
1942 fidl::encoding::Optional<
1943 fidl::encoding::HandleType<
1944 fidl::Socket,
1945 { fidl::ObjectType::SOCKET.into_raw() },
1946 2147483648,
1947 >,
1948 >,
1949 fidl::encoding::DefaultFuchsiaResourceDialect,
1950 &mut self.stdout,
1951 decoder,
1952 offset + 36,
1953 _depth
1954 )?;
1955 fidl::decode!(
1956 fidl::encoding::Optional<
1957 fidl::encoding::HandleType<
1958 fidl::Socket,
1959 { fidl::ObjectType::SOCKET.into_raw() },
1960 2147483648,
1961 >,
1962 >,
1963 fidl::encoding::DefaultFuchsiaResourceDialect,
1964 &mut self.stderr,
1965 decoder,
1966 offset + 40,
1967 _depth
1968 )?;
1969 fidl::decode!(
1970 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
1971 fidl::encoding::DefaultFuchsiaResourceDialect,
1972 &mut self.command_listener,
1973 decoder,
1974 offset + 44,
1975 _depth
1976 )?;
1977 Ok(())
1978 }
1979 }
1980
1981 impl fidl::encoding::ResourceTypeMarker for InteractionGetFileRequest {
1982 type Borrowed<'a> = &'a mut Self;
1983 fn take_or_borrow<'a>(
1984 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1985 ) -> Self::Borrowed<'a> {
1986 value
1987 }
1988 }
1989
1990 unsafe impl fidl::encoding::TypeMarker for InteractionGetFileRequest {
1991 type Owned = Self;
1992
1993 #[inline(always)]
1994 fn inline_align(_context: fidl::encoding::Context) -> usize {
1995 8
1996 }
1997
1998 #[inline(always)]
1999 fn inline_size(_context: fidl::encoding::Context) -> usize {
2000 24
2001 }
2002 }
2003
2004 unsafe impl
2005 fidl::encoding::Encode<
2006 InteractionGetFileRequest,
2007 fidl::encoding::DefaultFuchsiaResourceDialect,
2008 > for &mut InteractionGetFileRequest
2009 {
2010 #[inline]
2011 unsafe fn encode(
2012 self,
2013 encoder: &mut fidl::encoding::Encoder<
2014 '_,
2015 fidl::encoding::DefaultFuchsiaResourceDialect,
2016 >,
2017 offset: usize,
2018 _depth: fidl::encoding::Depth,
2019 ) -> fidl::Result<()> {
2020 encoder.debug_check_bounds::<InteractionGetFileRequest>(offset);
2021 fidl::encoding::Encode::<InteractionGetFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2023 (
2024 <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_path),
2025 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.local_file),
2026 ),
2027 encoder, offset, _depth
2028 )
2029 }
2030 }
2031 unsafe impl<
2032 T0: fidl::encoding::Encode<
2033 fidl::encoding::BoundedString<1024>,
2034 fidl::encoding::DefaultFuchsiaResourceDialect,
2035 >,
2036 T1: fidl::encoding::Encode<
2037 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
2038 fidl::encoding::DefaultFuchsiaResourceDialect,
2039 >,
2040 >
2041 fidl::encoding::Encode<
2042 InteractionGetFileRequest,
2043 fidl::encoding::DefaultFuchsiaResourceDialect,
2044 > for (T0, T1)
2045 {
2046 #[inline]
2047 unsafe fn encode(
2048 self,
2049 encoder: &mut fidl::encoding::Encoder<
2050 '_,
2051 fidl::encoding::DefaultFuchsiaResourceDialect,
2052 >,
2053 offset: usize,
2054 depth: fidl::encoding::Depth,
2055 ) -> fidl::Result<()> {
2056 encoder.debug_check_bounds::<InteractionGetFileRequest>(offset);
2057 unsafe {
2060 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2061 (ptr as *mut u64).write_unaligned(0);
2062 }
2063 self.0.encode(encoder, offset + 0, depth)?;
2065 self.1.encode(encoder, offset + 16, depth)?;
2066 Ok(())
2067 }
2068 }
2069
2070 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2071 for InteractionGetFileRequest
2072 {
2073 #[inline(always)]
2074 fn new_empty() -> Self {
2075 Self {
2076 remote_path: fidl::new_empty!(
2077 fidl::encoding::BoundedString<1024>,
2078 fidl::encoding::DefaultFuchsiaResourceDialect
2079 ),
2080 local_file: fidl::new_empty!(
2081 fidl::encoding::Endpoint<
2082 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
2083 >,
2084 fidl::encoding::DefaultFuchsiaResourceDialect
2085 ),
2086 }
2087 }
2088
2089 #[inline]
2090 unsafe fn decode(
2091 &mut self,
2092 decoder: &mut fidl::encoding::Decoder<
2093 '_,
2094 fidl::encoding::DefaultFuchsiaResourceDialect,
2095 >,
2096 offset: usize,
2097 _depth: fidl::encoding::Depth,
2098 ) -> fidl::Result<()> {
2099 decoder.debug_check_bounds::<Self>(offset);
2100 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2102 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2103 let mask = 0xffffffff00000000u64;
2104 let maskedval = padval & mask;
2105 if maskedval != 0 {
2106 return Err(fidl::Error::NonZeroPadding {
2107 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2108 });
2109 }
2110 fidl::decode!(
2111 fidl::encoding::BoundedString<1024>,
2112 fidl::encoding::DefaultFuchsiaResourceDialect,
2113 &mut self.remote_path,
2114 decoder,
2115 offset + 0,
2116 _depth
2117 )?;
2118 fidl::decode!(
2119 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
2120 fidl::encoding::DefaultFuchsiaResourceDialect,
2121 &mut self.local_file,
2122 decoder,
2123 offset + 16,
2124 _depth
2125 )?;
2126 Ok(())
2127 }
2128 }
2129
2130 impl fidl::encoding::ResourceTypeMarker for InteractionPutFileRequest {
2131 type Borrowed<'a> = &'a mut Self;
2132 fn take_or_borrow<'a>(
2133 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2134 ) -> Self::Borrowed<'a> {
2135 value
2136 }
2137 }
2138
2139 unsafe impl fidl::encoding::TypeMarker for InteractionPutFileRequest {
2140 type Owned = Self;
2141
2142 #[inline(always)]
2143 fn inline_align(_context: fidl::encoding::Context) -> usize {
2144 8
2145 }
2146
2147 #[inline(always)]
2148 fn inline_size(_context: fidl::encoding::Context) -> usize {
2149 24
2150 }
2151 }
2152
2153 unsafe impl
2154 fidl::encoding::Encode<
2155 InteractionPutFileRequest,
2156 fidl::encoding::DefaultFuchsiaResourceDialect,
2157 > for &mut InteractionPutFileRequest
2158 {
2159 #[inline]
2160 unsafe fn encode(
2161 self,
2162 encoder: &mut fidl::encoding::Encoder<
2163 '_,
2164 fidl::encoding::DefaultFuchsiaResourceDialect,
2165 >,
2166 offset: usize,
2167 _depth: fidl::encoding::Depth,
2168 ) -> fidl::Result<()> {
2169 encoder.debug_check_bounds::<InteractionPutFileRequest>(offset);
2170 fidl::encoding::Encode::<InteractionPutFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2172 (
2173 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.local_file),
2174 <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_path),
2175 ),
2176 encoder, offset, _depth
2177 )
2178 }
2179 }
2180 unsafe impl<
2181 T0: fidl::encoding::Encode<
2182 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
2183 fidl::encoding::DefaultFuchsiaResourceDialect,
2184 >,
2185 T1: fidl::encoding::Encode<
2186 fidl::encoding::BoundedString<1024>,
2187 fidl::encoding::DefaultFuchsiaResourceDialect,
2188 >,
2189 >
2190 fidl::encoding::Encode<
2191 InteractionPutFileRequest,
2192 fidl::encoding::DefaultFuchsiaResourceDialect,
2193 > for (T0, T1)
2194 {
2195 #[inline]
2196 unsafe fn encode(
2197 self,
2198 encoder: &mut fidl::encoding::Encoder<
2199 '_,
2200 fidl::encoding::DefaultFuchsiaResourceDialect,
2201 >,
2202 offset: usize,
2203 depth: fidl::encoding::Depth,
2204 ) -> fidl::Result<()> {
2205 encoder.debug_check_bounds::<InteractionPutFileRequest>(offset);
2206 unsafe {
2209 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2210 (ptr as *mut u64).write_unaligned(0);
2211 }
2212 self.0.encode(encoder, offset + 0, depth)?;
2214 self.1.encode(encoder, offset + 8, depth)?;
2215 Ok(())
2216 }
2217 }
2218
2219 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2220 for InteractionPutFileRequest
2221 {
2222 #[inline(always)]
2223 fn new_empty() -> Self {
2224 Self {
2225 local_file: fidl::new_empty!(
2226 fidl::encoding::Endpoint<
2227 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
2228 >,
2229 fidl::encoding::DefaultFuchsiaResourceDialect
2230 ),
2231 remote_path: fidl::new_empty!(
2232 fidl::encoding::BoundedString<1024>,
2233 fidl::encoding::DefaultFuchsiaResourceDialect
2234 ),
2235 }
2236 }
2237
2238 #[inline]
2239 unsafe fn decode(
2240 &mut self,
2241 decoder: &mut fidl::encoding::Decoder<
2242 '_,
2243 fidl::encoding::DefaultFuchsiaResourceDialect,
2244 >,
2245 offset: usize,
2246 _depth: fidl::encoding::Depth,
2247 ) -> fidl::Result<()> {
2248 decoder.debug_check_bounds::<Self>(offset);
2249 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2251 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2252 let mask = 0xffffffff00000000u64;
2253 let maskedval = padval & mask;
2254 if maskedval != 0 {
2255 return Err(fidl::Error::NonZeroPadding {
2256 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2257 });
2258 }
2259 fidl::decode!(
2260 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
2261 fidl::encoding::DefaultFuchsiaResourceDialect,
2262 &mut self.local_file,
2263 decoder,
2264 offset + 0,
2265 _depth
2266 )?;
2267 fidl::decode!(
2268 fidl::encoding::BoundedString<1024>,
2269 fidl::encoding::DefaultFuchsiaResourceDialect,
2270 &mut self.remote_path,
2271 decoder,
2272 offset + 8,
2273 _depth
2274 )?;
2275 Ok(())
2276 }
2277 }
2278}