1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_examples_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct EchoLauncherGetEchoPipelinedRequest {
15 pub echo_prefix: String,
16 pub request: fdomain_client::fidl::ServerEnd<EchoMarker>,
17}
18
19impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
20 for EchoLauncherGetEchoPipelinedRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct EchoLauncherGetEchoResponse {
26 pub response: fdomain_client::fidl::ClientEnd<EchoMarker>,
27}
28
29impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
30 for EchoLauncherGetEchoResponse
31{
32}
33
34#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct EventStruct {
36 pub event: Option<fdomain_client::Event>,
37}
38
39impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for EventStruct {}
40
41#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
42pub struct EchoMarker;
43
44impl fdomain_client::fidl::ProtocolMarker for EchoMarker {
45 type Proxy = EchoProxy;
46 type RequestStream = EchoRequestStream;
47
48 const DEBUG_NAME: &'static str = "fuchsia.examples.Echo";
49}
50impl fdomain_client::fidl::DiscoverableProtocolMarker for EchoMarker {}
51
52pub trait EchoProxyInterface: Send + Sync {
53 type EchoStringResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
54 fn r#echo_string(&self, value: &str) -> Self::EchoStringResponseFut;
55 fn r#send_string(&self, value: &str) -> Result<(), fidl::Error>;
56}
57
58#[derive(Debug, Clone)]
59pub struct EchoProxy {
60 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
61}
62
63impl fdomain_client::fidl::Proxy for EchoProxy {
64 type Protocol = EchoMarker;
65
66 fn from_channel(inner: fdomain_client::Channel) -> Self {
67 Self::new(inner)
68 }
69
70 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
71 self.client.into_channel().map_err(|client| Self { client })
72 }
73
74 fn as_channel(&self) -> &fdomain_client::Channel {
75 self.client.as_channel()
76 }
77}
78
79impl EchoProxy {
80 pub fn new(channel: fdomain_client::Channel) -> Self {
82 let protocol_name = <EchoMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
83 Self { client: fidl::client::Client::new(channel, protocol_name) }
84 }
85
86 pub fn take_event_stream(&self) -> EchoEventStream {
92 EchoEventStream { event_receiver: self.client.take_event_receiver() }
93 }
94
95 pub fn r#echo_string(
96 &self,
97 mut value: &str,
98 ) -> fidl::client::QueryResponseFut<String, fdomain_client::fidl::FDomainResourceDialect> {
99 EchoProxyInterface::r#echo_string(self, value)
100 }
101
102 pub fn r#send_string(&self, mut value: &str) -> Result<(), fidl::Error> {
103 EchoProxyInterface::r#send_string(self, value)
104 }
105}
106
107impl EchoProxyInterface for EchoProxy {
108 type EchoStringResponseFut =
109 fidl::client::QueryResponseFut<String, fdomain_client::fidl::FDomainResourceDialect>;
110 fn r#echo_string(&self, mut value: &str) -> Self::EchoStringResponseFut {
111 fn _decode(
112 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
113 ) -> Result<String, fidl::Error> {
114 let _response = fidl::client::decode_transaction_body::<
115 EchoEchoStringResponse,
116 fdomain_client::fidl::FDomainResourceDialect,
117 0x75b8274e52d9a616,
118 >(_buf?)?;
119 Ok(_response.response)
120 }
121 self.client.send_query_and_decode::<EchoEchoStringRequest, String>(
122 (value,),
123 0x75b8274e52d9a616,
124 fidl::encoding::DynamicFlags::empty(),
125 _decode,
126 )
127 }
128
129 fn r#send_string(&self, mut value: &str) -> Result<(), fidl::Error> {
130 self.client.send::<EchoSendStringRequest>(
131 (value,),
132 0x5ce4c23c86c5d471,
133 fidl::encoding::DynamicFlags::empty(),
134 )
135 }
136}
137
138pub struct EchoEventStream {
139 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
140}
141
142impl std::marker::Unpin for EchoEventStream {}
143
144impl futures::stream::FusedStream for EchoEventStream {
145 fn is_terminated(&self) -> bool {
146 self.event_receiver.is_terminated()
147 }
148}
149
150impl futures::Stream for EchoEventStream {
151 type Item = Result<EchoEvent, fidl::Error>;
152
153 fn poll_next(
154 mut self: std::pin::Pin<&mut Self>,
155 cx: &mut std::task::Context<'_>,
156 ) -> std::task::Poll<Option<Self::Item>> {
157 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
158 &mut self.event_receiver,
159 cx
160 )?) {
161 Some(buf) => std::task::Poll::Ready(Some(EchoEvent::decode(buf))),
162 None => std::task::Poll::Ready(None),
163 }
164 }
165}
166
167#[derive(Debug)]
168pub enum EchoEvent {
169 OnString { response: String },
170}
171
172impl EchoEvent {
173 #[allow(irrefutable_let_patterns)]
174 pub fn into_on_string(self) -> Option<String> {
175 if let EchoEvent::OnString { response } = self { Some((response)) } else { None }
176 }
177
178 fn decode(
180 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
181 ) -> Result<EchoEvent, fidl::Error> {
182 let (bytes, _handles) = buf.split_mut();
183 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
184 debug_assert_eq!(tx_header.tx_id, 0);
185 match tx_header.ordinal {
186 0x132e5bed81197eeb => {
187 let mut out = fidl::new_empty!(
188 EchoOnStringRequest,
189 fdomain_client::fidl::FDomainResourceDialect
190 );
191 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<EchoOnStringRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
192 Ok((EchoEvent::OnString { response: out.response }))
193 }
194 _ => Err(fidl::Error::UnknownOrdinal {
195 ordinal: tx_header.ordinal,
196 protocol_name: <EchoMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
197 }),
198 }
199 }
200}
201
202pub struct EchoRequestStream {
204 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
205 is_terminated: bool,
206}
207
208impl std::marker::Unpin for EchoRequestStream {}
209
210impl futures::stream::FusedStream for EchoRequestStream {
211 fn is_terminated(&self) -> bool {
212 self.is_terminated
213 }
214}
215
216impl fdomain_client::fidl::RequestStream for EchoRequestStream {
217 type Protocol = EchoMarker;
218 type ControlHandle = EchoControlHandle;
219
220 fn from_channel(channel: fdomain_client::Channel) -> Self {
221 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
222 }
223
224 fn control_handle(&self) -> Self::ControlHandle {
225 EchoControlHandle { inner: self.inner.clone() }
226 }
227
228 fn into_inner(
229 self,
230 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
231 {
232 (self.inner, self.is_terminated)
233 }
234
235 fn from_inner(
236 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
237 is_terminated: bool,
238 ) -> Self {
239 Self { inner, is_terminated }
240 }
241}
242
243impl futures::Stream for EchoRequestStream {
244 type Item = Result<EchoRequest, fidl::Error>;
245
246 fn poll_next(
247 mut self: std::pin::Pin<&mut Self>,
248 cx: &mut std::task::Context<'_>,
249 ) -> std::task::Poll<Option<Self::Item>> {
250 let this = &mut *self;
251 if this.inner.check_shutdown(cx) {
252 this.is_terminated = true;
253 return std::task::Poll::Ready(None);
254 }
255 if this.is_terminated {
256 panic!("polled EchoRequestStream after completion");
257 }
258 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
259 |bytes, handles| {
260 match this.inner.channel().read_etc(cx, bytes, handles) {
261 std::task::Poll::Ready(Ok(())) => {}
262 std::task::Poll::Pending => return std::task::Poll::Pending,
263 std::task::Poll::Ready(Err(None)) => {
264 this.is_terminated = true;
265 return std::task::Poll::Ready(None);
266 }
267 std::task::Poll::Ready(Err(Some(e))) => {
268 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
269 e.into(),
270 ))));
271 }
272 }
273
274 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
276
277 std::task::Poll::Ready(Some(match header.ordinal {
278 0x75b8274e52d9a616 => {
279 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
280 let mut req = fidl::new_empty!(
281 EchoEchoStringRequest,
282 fdomain_client::fidl::FDomainResourceDialect
283 );
284 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<EchoEchoStringRequest>(&header, _body_bytes, handles, &mut req)?;
285 let control_handle = EchoControlHandle { inner: this.inner.clone() };
286 Ok(EchoRequest::EchoString {
287 value: req.value,
288
289 responder: EchoEchoStringResponder {
290 control_handle: std::mem::ManuallyDrop::new(control_handle),
291 tx_id: header.tx_id,
292 },
293 })
294 }
295 0x5ce4c23c86c5d471 => {
296 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
297 let mut req = fidl::new_empty!(
298 EchoSendStringRequest,
299 fdomain_client::fidl::FDomainResourceDialect
300 );
301 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<EchoSendStringRequest>(&header, _body_bytes, handles, &mut req)?;
302 let control_handle = EchoControlHandle { inner: this.inner.clone() };
303 Ok(EchoRequest::SendString { value: req.value, control_handle })
304 }
305 _ => Err(fidl::Error::UnknownOrdinal {
306 ordinal: header.ordinal,
307 protocol_name:
308 <EchoMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
309 }),
310 }))
311 },
312 )
313 }
314}
315
316#[derive(Debug)]
317pub enum EchoRequest {
318 EchoString { value: String, responder: EchoEchoStringResponder },
319 SendString { value: String, control_handle: EchoControlHandle },
320}
321
322impl EchoRequest {
323 #[allow(irrefutable_let_patterns)]
324 pub fn into_echo_string(self) -> Option<(String, EchoEchoStringResponder)> {
325 if let EchoRequest::EchoString { value, responder } = self {
326 Some((value, responder))
327 } else {
328 None
329 }
330 }
331
332 #[allow(irrefutable_let_patterns)]
333 pub fn into_send_string(self) -> Option<(String, EchoControlHandle)> {
334 if let EchoRequest::SendString { value, control_handle } = self {
335 Some((value, control_handle))
336 } else {
337 None
338 }
339 }
340
341 pub fn method_name(&self) -> &'static str {
343 match *self {
344 EchoRequest::EchoString { .. } => "echo_string",
345 EchoRequest::SendString { .. } => "send_string",
346 }
347 }
348}
349
350#[derive(Debug, Clone)]
351pub struct EchoControlHandle {
352 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
353}
354
355impl EchoControlHandle {
356 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
357 self.inner.shutdown_with_epitaph(status.into())
358 }
359}
360
361impl fdomain_client::fidl::ControlHandle for EchoControlHandle {
362 fn shutdown(&self) {
363 self.inner.shutdown()
364 }
365
366 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
367 self.inner.shutdown_with_epitaph(status)
368 }
369
370 fn is_closed(&self) -> bool {
371 self.inner.channel().is_closed()
372 }
373 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
374 self.inner.channel().on_closed()
375 }
376}
377
378impl EchoControlHandle {
379 pub fn send_on_string(&self, mut response: &str) -> Result<(), fidl::Error> {
380 self.inner.send::<EchoOnStringRequest>(
381 (response,),
382 0,
383 0x132e5bed81197eeb,
384 fidl::encoding::DynamicFlags::empty(),
385 )
386 }
387}
388
389#[must_use = "FIDL methods require a response to be sent"]
390#[derive(Debug)]
391pub struct EchoEchoStringResponder {
392 control_handle: std::mem::ManuallyDrop<EchoControlHandle>,
393 tx_id: u32,
394}
395
396impl std::ops::Drop for EchoEchoStringResponder {
400 fn drop(&mut self) {
401 self.control_handle.shutdown();
402 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
404 }
405}
406
407impl fdomain_client::fidl::Responder for EchoEchoStringResponder {
408 type ControlHandle = EchoControlHandle;
409
410 fn control_handle(&self) -> &EchoControlHandle {
411 &self.control_handle
412 }
413
414 fn drop_without_shutdown(mut self) {
415 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
417 std::mem::forget(self);
419 }
420}
421
422impl EchoEchoStringResponder {
423 pub fn send(self, mut response: &str) -> Result<(), fidl::Error> {
427 let _result = self.send_raw(response);
428 if _result.is_err() {
429 self.control_handle.shutdown();
430 }
431 self.drop_without_shutdown();
432 _result
433 }
434
435 pub fn send_no_shutdown_on_err(self, mut response: &str) -> Result<(), fidl::Error> {
437 let _result = self.send_raw(response);
438 self.drop_without_shutdown();
439 _result
440 }
441
442 fn send_raw(&self, mut response: &str) -> Result<(), fidl::Error> {
443 self.control_handle.inner.send::<EchoEchoStringResponse>(
444 (response,),
445 self.tx_id,
446 0x75b8274e52d9a616,
447 fidl::encoding::DynamicFlags::empty(),
448 )
449 }
450}
451
452#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
453pub struct EchoLauncherMarker;
454
455impl fdomain_client::fidl::ProtocolMarker for EchoLauncherMarker {
456 type Proxy = EchoLauncherProxy;
457 type RequestStream = EchoLauncherRequestStream;
458
459 const DEBUG_NAME: &'static str = "fuchsia.examples.EchoLauncher";
460}
461impl fdomain_client::fidl::DiscoverableProtocolMarker for EchoLauncherMarker {}
462
463pub trait EchoLauncherProxyInterface: Send + Sync {
464 type GetEchoResponseFut: std::future::Future<
465 Output = Result<fdomain_client::fidl::ClientEnd<EchoMarker>, fidl::Error>,
466 > + Send;
467 fn r#get_echo(&self, echo_prefix: &str) -> Self::GetEchoResponseFut;
468 fn r#get_echo_pipelined(
469 &self,
470 echo_prefix: &str,
471 request: fdomain_client::fidl::ServerEnd<EchoMarker>,
472 ) -> Result<(), fidl::Error>;
473}
474
475#[derive(Debug, Clone)]
476pub struct EchoLauncherProxy {
477 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
478}
479
480impl fdomain_client::fidl::Proxy for EchoLauncherProxy {
481 type Protocol = EchoLauncherMarker;
482
483 fn from_channel(inner: fdomain_client::Channel) -> Self {
484 Self::new(inner)
485 }
486
487 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
488 self.client.into_channel().map_err(|client| Self { client })
489 }
490
491 fn as_channel(&self) -> &fdomain_client::Channel {
492 self.client.as_channel()
493 }
494}
495
496impl EchoLauncherProxy {
497 pub fn new(channel: fdomain_client::Channel) -> Self {
499 let protocol_name =
500 <EchoLauncherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
501 Self { client: fidl::client::Client::new(channel, protocol_name) }
502 }
503
504 pub fn take_event_stream(&self) -> EchoLauncherEventStream {
510 EchoLauncherEventStream { event_receiver: self.client.take_event_receiver() }
511 }
512
513 pub fn r#get_echo(
514 &self,
515 mut echo_prefix: &str,
516 ) -> fidl::client::QueryResponseFut<
517 fdomain_client::fidl::ClientEnd<EchoMarker>,
518 fdomain_client::fidl::FDomainResourceDialect,
519 > {
520 EchoLauncherProxyInterface::r#get_echo(self, echo_prefix)
521 }
522
523 pub fn r#get_echo_pipelined(
524 &self,
525 mut echo_prefix: &str,
526 mut request: fdomain_client::fidl::ServerEnd<EchoMarker>,
527 ) -> Result<(), fidl::Error> {
528 EchoLauncherProxyInterface::r#get_echo_pipelined(self, echo_prefix, request)
529 }
530}
531
532impl EchoLauncherProxyInterface for EchoLauncherProxy {
533 type GetEchoResponseFut = fidl::client::QueryResponseFut<
534 fdomain_client::fidl::ClientEnd<EchoMarker>,
535 fdomain_client::fidl::FDomainResourceDialect,
536 >;
537 fn r#get_echo(&self, mut echo_prefix: &str) -> Self::GetEchoResponseFut {
538 fn _decode(
539 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
540 ) -> Result<fdomain_client::fidl::ClientEnd<EchoMarker>, fidl::Error> {
541 let _response = fidl::client::decode_transaction_body::<
542 EchoLauncherGetEchoResponse,
543 fdomain_client::fidl::FDomainResourceDialect,
544 0x10d693a107613de8,
545 >(_buf?)?;
546 Ok(_response.response)
547 }
548 self.client.send_query_and_decode::<
549 EchoLauncherGetEchoRequest,
550 fdomain_client::fidl::ClientEnd<EchoMarker>,
551 >(
552 (echo_prefix,),
553 0x10d693a107613de8,
554 fidl::encoding::DynamicFlags::empty(),
555 _decode,
556 )
557 }
558
559 fn r#get_echo_pipelined(
560 &self,
561 mut echo_prefix: &str,
562 mut request: fdomain_client::fidl::ServerEnd<EchoMarker>,
563 ) -> Result<(), fidl::Error> {
564 self.client.send::<EchoLauncherGetEchoPipelinedRequest>(
565 (echo_prefix, request),
566 0x1d67613833575473,
567 fidl::encoding::DynamicFlags::empty(),
568 )
569 }
570}
571
572pub struct EchoLauncherEventStream {
573 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
574}
575
576impl std::marker::Unpin for EchoLauncherEventStream {}
577
578impl futures::stream::FusedStream for EchoLauncherEventStream {
579 fn is_terminated(&self) -> bool {
580 self.event_receiver.is_terminated()
581 }
582}
583
584impl futures::Stream for EchoLauncherEventStream {
585 type Item = Result<EchoLauncherEvent, fidl::Error>;
586
587 fn poll_next(
588 mut self: std::pin::Pin<&mut Self>,
589 cx: &mut std::task::Context<'_>,
590 ) -> std::task::Poll<Option<Self::Item>> {
591 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
592 &mut self.event_receiver,
593 cx
594 )?) {
595 Some(buf) => std::task::Poll::Ready(Some(EchoLauncherEvent::decode(buf))),
596 None => std::task::Poll::Ready(None),
597 }
598 }
599}
600
601#[derive(Debug)]
602pub enum EchoLauncherEvent {}
603
604impl EchoLauncherEvent {
605 fn decode(
607 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
608 ) -> Result<EchoLauncherEvent, fidl::Error> {
609 let (bytes, _handles) = buf.split_mut();
610 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
611 debug_assert_eq!(tx_header.tx_id, 0);
612 match tx_header.ordinal {
613 _ => Err(fidl::Error::UnknownOrdinal {
614 ordinal: tx_header.ordinal,
615 protocol_name:
616 <EchoLauncherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
617 }),
618 }
619 }
620}
621
622pub struct EchoLauncherRequestStream {
624 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
625 is_terminated: bool,
626}
627
628impl std::marker::Unpin for EchoLauncherRequestStream {}
629
630impl futures::stream::FusedStream for EchoLauncherRequestStream {
631 fn is_terminated(&self) -> bool {
632 self.is_terminated
633 }
634}
635
636impl fdomain_client::fidl::RequestStream for EchoLauncherRequestStream {
637 type Protocol = EchoLauncherMarker;
638 type ControlHandle = EchoLauncherControlHandle;
639
640 fn from_channel(channel: fdomain_client::Channel) -> Self {
641 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
642 }
643
644 fn control_handle(&self) -> Self::ControlHandle {
645 EchoLauncherControlHandle { inner: self.inner.clone() }
646 }
647
648 fn into_inner(
649 self,
650 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
651 {
652 (self.inner, self.is_terminated)
653 }
654
655 fn from_inner(
656 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
657 is_terminated: bool,
658 ) -> Self {
659 Self { inner, is_terminated }
660 }
661}
662
663impl futures::Stream for EchoLauncherRequestStream {
664 type Item = Result<EchoLauncherRequest, fidl::Error>;
665
666 fn poll_next(
667 mut self: std::pin::Pin<&mut Self>,
668 cx: &mut std::task::Context<'_>,
669 ) -> std::task::Poll<Option<Self::Item>> {
670 let this = &mut *self;
671 if this.inner.check_shutdown(cx) {
672 this.is_terminated = true;
673 return std::task::Poll::Ready(None);
674 }
675 if this.is_terminated {
676 panic!("polled EchoLauncherRequestStream after completion");
677 }
678 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
679 |bytes, handles| {
680 match this.inner.channel().read_etc(cx, bytes, handles) {
681 std::task::Poll::Ready(Ok(())) => {}
682 std::task::Poll::Pending => return std::task::Poll::Pending,
683 std::task::Poll::Ready(Err(None)) => {
684 this.is_terminated = true;
685 return std::task::Poll::Ready(None);
686 }
687 std::task::Poll::Ready(Err(Some(e))) => {
688 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
689 e.into(),
690 ))));
691 }
692 }
693
694 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
696
697 std::task::Poll::Ready(Some(match header.ordinal {
698 0x10d693a107613de8 => {
699 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
700 let mut req = fidl::new_empty!(
701 EchoLauncherGetEchoRequest,
702 fdomain_client::fidl::FDomainResourceDialect
703 );
704 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<EchoLauncherGetEchoRequest>(&header, _body_bytes, handles, &mut req)?;
705 let control_handle =
706 EchoLauncherControlHandle { inner: this.inner.clone() };
707 Ok(EchoLauncherRequest::GetEcho {
708 echo_prefix: req.echo_prefix,
709
710 responder: EchoLauncherGetEchoResponder {
711 control_handle: std::mem::ManuallyDrop::new(control_handle),
712 tx_id: header.tx_id,
713 },
714 })
715 }
716 0x1d67613833575473 => {
717 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
718 let mut req = fidl::new_empty!(
719 EchoLauncherGetEchoPipelinedRequest,
720 fdomain_client::fidl::FDomainResourceDialect
721 );
722 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<EchoLauncherGetEchoPipelinedRequest>(&header, _body_bytes, handles, &mut req)?;
723 let control_handle =
724 EchoLauncherControlHandle { inner: this.inner.clone() };
725 Ok(EchoLauncherRequest::GetEchoPipelined {
726 echo_prefix: req.echo_prefix,
727 request: req.request,
728
729 control_handle,
730 })
731 }
732 _ => Err(fidl::Error::UnknownOrdinal {
733 ordinal: header.ordinal,
734 protocol_name:
735 <EchoLauncherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
736 }),
737 }))
738 },
739 )
740 }
741}
742
743#[derive(Debug)]
744pub enum EchoLauncherRequest {
745 GetEcho {
746 echo_prefix: String,
747 responder: EchoLauncherGetEchoResponder,
748 },
749 GetEchoPipelined {
750 echo_prefix: String,
751 request: fdomain_client::fidl::ServerEnd<EchoMarker>,
752 control_handle: EchoLauncherControlHandle,
753 },
754}
755
756impl EchoLauncherRequest {
757 #[allow(irrefutable_let_patterns)]
758 pub fn into_get_echo(self) -> Option<(String, EchoLauncherGetEchoResponder)> {
759 if let EchoLauncherRequest::GetEcho { echo_prefix, responder } = self {
760 Some((echo_prefix, responder))
761 } else {
762 None
763 }
764 }
765
766 #[allow(irrefutable_let_patterns)]
767 pub fn into_get_echo_pipelined(
768 self,
769 ) -> Option<(String, fdomain_client::fidl::ServerEnd<EchoMarker>, EchoLauncherControlHandle)>
770 {
771 if let EchoLauncherRequest::GetEchoPipelined { echo_prefix, request, control_handle } = self
772 {
773 Some((echo_prefix, request, control_handle))
774 } else {
775 None
776 }
777 }
778
779 pub fn method_name(&self) -> &'static str {
781 match *self {
782 EchoLauncherRequest::GetEcho { .. } => "get_echo",
783 EchoLauncherRequest::GetEchoPipelined { .. } => "get_echo_pipelined",
784 }
785 }
786}
787
788#[derive(Debug, Clone)]
789pub struct EchoLauncherControlHandle {
790 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
791}
792
793impl EchoLauncherControlHandle {
794 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
795 self.inner.shutdown_with_epitaph(status.into())
796 }
797}
798
799impl fdomain_client::fidl::ControlHandle for EchoLauncherControlHandle {
800 fn shutdown(&self) {
801 self.inner.shutdown()
802 }
803
804 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
805 self.inner.shutdown_with_epitaph(status)
806 }
807
808 fn is_closed(&self) -> bool {
809 self.inner.channel().is_closed()
810 }
811 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
812 self.inner.channel().on_closed()
813 }
814}
815
816impl EchoLauncherControlHandle {}
817
818#[must_use = "FIDL methods require a response to be sent"]
819#[derive(Debug)]
820pub struct EchoLauncherGetEchoResponder {
821 control_handle: std::mem::ManuallyDrop<EchoLauncherControlHandle>,
822 tx_id: u32,
823}
824
825impl std::ops::Drop for EchoLauncherGetEchoResponder {
829 fn drop(&mut self) {
830 self.control_handle.shutdown();
831 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
833 }
834}
835
836impl fdomain_client::fidl::Responder for EchoLauncherGetEchoResponder {
837 type ControlHandle = EchoLauncherControlHandle;
838
839 fn control_handle(&self) -> &EchoLauncherControlHandle {
840 &self.control_handle
841 }
842
843 fn drop_without_shutdown(mut self) {
844 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
846 std::mem::forget(self);
848 }
849}
850
851impl EchoLauncherGetEchoResponder {
852 pub fn send(
856 self,
857 mut response: fdomain_client::fidl::ClientEnd<EchoMarker>,
858 ) -> Result<(), fidl::Error> {
859 let _result = self.send_raw(response);
860 if _result.is_err() {
861 self.control_handle.shutdown();
862 }
863 self.drop_without_shutdown();
864 _result
865 }
866
867 pub fn send_no_shutdown_on_err(
869 self,
870 mut response: fdomain_client::fidl::ClientEnd<EchoMarker>,
871 ) -> Result<(), fidl::Error> {
872 let _result = self.send_raw(response);
873 self.drop_without_shutdown();
874 _result
875 }
876
877 fn send_raw(
878 &self,
879 mut response: fdomain_client::fidl::ClientEnd<EchoMarker>,
880 ) -> Result<(), fidl::Error> {
881 self.control_handle.inner.send::<EchoLauncherGetEchoResponse>(
882 (response,),
883 self.tx_id,
884 0x10d693a107613de8,
885 fidl::encoding::DynamicFlags::empty(),
886 )
887 }
888}
889
890#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
891pub struct TicTacToeMarker;
892
893impl fdomain_client::fidl::ProtocolMarker for TicTacToeMarker {
894 type Proxy = TicTacToeProxy;
895 type RequestStream = TicTacToeRequestStream;
896
897 const DEBUG_NAME: &'static str = "(anonymous) TicTacToe";
898}
899
900pub trait TicTacToeProxyInterface: Send + Sync {
901 fn r#start_game(&self, start_first: bool) -> Result<(), fidl::Error>;
902 type MakeMoveResponseFut: std::future::Future<Output = Result<(bool, Option<Box<GameState>>), fidl::Error>>
903 + Send;
904 fn r#make_move(&self, row: u8, col: u8) -> Self::MakeMoveResponseFut;
905}
906
907#[derive(Debug, Clone)]
908pub struct TicTacToeProxy {
909 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
910}
911
912impl fdomain_client::fidl::Proxy for TicTacToeProxy {
913 type Protocol = TicTacToeMarker;
914
915 fn from_channel(inner: fdomain_client::Channel) -> Self {
916 Self::new(inner)
917 }
918
919 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
920 self.client.into_channel().map_err(|client| Self { client })
921 }
922
923 fn as_channel(&self) -> &fdomain_client::Channel {
924 self.client.as_channel()
925 }
926}
927
928impl TicTacToeProxy {
929 pub fn new(channel: fdomain_client::Channel) -> Self {
931 let protocol_name = <TicTacToeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
932 Self { client: fidl::client::Client::new(channel, protocol_name) }
933 }
934
935 pub fn take_event_stream(&self) -> TicTacToeEventStream {
941 TicTacToeEventStream { event_receiver: self.client.take_event_receiver() }
942 }
943
944 pub fn r#start_game(&self, mut start_first: bool) -> Result<(), fidl::Error> {
945 TicTacToeProxyInterface::r#start_game(self, start_first)
946 }
947
948 pub fn r#make_move(
949 &self,
950 mut row: u8,
951 mut col: u8,
952 ) -> fidl::client::QueryResponseFut<
953 (bool, Option<Box<GameState>>),
954 fdomain_client::fidl::FDomainResourceDialect,
955 > {
956 TicTacToeProxyInterface::r#make_move(self, row, col)
957 }
958}
959
960impl TicTacToeProxyInterface for TicTacToeProxy {
961 fn r#start_game(&self, mut start_first: bool) -> Result<(), fidl::Error> {
962 self.client.send::<TicTacToeStartGameRequest>(
963 (start_first,),
964 0x162c79ca23670659,
965 fidl::encoding::DynamicFlags::empty(),
966 )
967 }
968
969 type MakeMoveResponseFut = fidl::client::QueryResponseFut<
970 (bool, Option<Box<GameState>>),
971 fdomain_client::fidl::FDomainResourceDialect,
972 >;
973 fn r#make_move(&self, mut row: u8, mut col: u8) -> Self::MakeMoveResponseFut {
974 fn _decode(
975 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
976 ) -> Result<(bool, Option<Box<GameState>>), fidl::Error> {
977 let _response = fidl::client::decode_transaction_body::<
978 TicTacToeMakeMoveResponse,
979 fdomain_client::fidl::FDomainResourceDialect,
980 0x7fe54d55da796551,
981 >(_buf?)?;
982 Ok((_response.success, _response.new_state))
983 }
984 self.client
985 .send_query_and_decode::<TicTacToeMakeMoveRequest, (bool, Option<Box<GameState>>)>(
986 (row, col),
987 0x7fe54d55da796551,
988 fidl::encoding::DynamicFlags::empty(),
989 _decode,
990 )
991 }
992}
993
994pub struct TicTacToeEventStream {
995 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
996}
997
998impl std::marker::Unpin for TicTacToeEventStream {}
999
1000impl futures::stream::FusedStream for TicTacToeEventStream {
1001 fn is_terminated(&self) -> bool {
1002 self.event_receiver.is_terminated()
1003 }
1004}
1005
1006impl futures::Stream for TicTacToeEventStream {
1007 type Item = Result<TicTacToeEvent, fidl::Error>;
1008
1009 fn poll_next(
1010 mut self: std::pin::Pin<&mut Self>,
1011 cx: &mut std::task::Context<'_>,
1012 ) -> std::task::Poll<Option<Self::Item>> {
1013 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1014 &mut self.event_receiver,
1015 cx
1016 )?) {
1017 Some(buf) => std::task::Poll::Ready(Some(TicTacToeEvent::decode(buf))),
1018 None => std::task::Poll::Ready(None),
1019 }
1020 }
1021}
1022
1023#[derive(Debug)]
1024pub enum TicTacToeEvent {
1025 OnOpponentMove { new_state: GameState },
1026}
1027
1028impl TicTacToeEvent {
1029 #[allow(irrefutable_let_patterns)]
1030 pub fn into_on_opponent_move(self) -> Option<GameState> {
1031 if let TicTacToeEvent::OnOpponentMove { new_state } = self {
1032 Some((new_state))
1033 } else {
1034 None
1035 }
1036 }
1037
1038 fn decode(
1040 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1041 ) -> Result<TicTacToeEvent, fidl::Error> {
1042 let (bytes, _handles) = buf.split_mut();
1043 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1044 debug_assert_eq!(tx_header.tx_id, 0);
1045 match tx_header.ordinal {
1046 0x538cf57bfe01c728 => {
1047 let mut out = fidl::new_empty!(
1048 TicTacToeOnOpponentMoveRequest,
1049 fdomain_client::fidl::FDomainResourceDialect
1050 );
1051 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<TicTacToeOnOpponentMoveRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1052 Ok((TicTacToeEvent::OnOpponentMove { new_state: out.new_state }))
1053 }
1054 _ => Err(fidl::Error::UnknownOrdinal {
1055 ordinal: tx_header.ordinal,
1056 protocol_name:
1057 <TicTacToeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1058 }),
1059 }
1060 }
1061}
1062
1063pub struct TicTacToeRequestStream {
1065 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1066 is_terminated: bool,
1067}
1068
1069impl std::marker::Unpin for TicTacToeRequestStream {}
1070
1071impl futures::stream::FusedStream for TicTacToeRequestStream {
1072 fn is_terminated(&self) -> bool {
1073 self.is_terminated
1074 }
1075}
1076
1077impl fdomain_client::fidl::RequestStream for TicTacToeRequestStream {
1078 type Protocol = TicTacToeMarker;
1079 type ControlHandle = TicTacToeControlHandle;
1080
1081 fn from_channel(channel: fdomain_client::Channel) -> Self {
1082 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1083 }
1084
1085 fn control_handle(&self) -> Self::ControlHandle {
1086 TicTacToeControlHandle { inner: self.inner.clone() }
1087 }
1088
1089 fn into_inner(
1090 self,
1091 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1092 {
1093 (self.inner, self.is_terminated)
1094 }
1095
1096 fn from_inner(
1097 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1098 is_terminated: bool,
1099 ) -> Self {
1100 Self { inner, is_terminated }
1101 }
1102}
1103
1104impl futures::Stream for TicTacToeRequestStream {
1105 type Item = Result<TicTacToeRequest, fidl::Error>;
1106
1107 fn poll_next(
1108 mut self: std::pin::Pin<&mut Self>,
1109 cx: &mut std::task::Context<'_>,
1110 ) -> std::task::Poll<Option<Self::Item>> {
1111 let this = &mut *self;
1112 if this.inner.check_shutdown(cx) {
1113 this.is_terminated = true;
1114 return std::task::Poll::Ready(None);
1115 }
1116 if this.is_terminated {
1117 panic!("polled TicTacToeRequestStream after completion");
1118 }
1119 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1120 |bytes, handles| {
1121 match this.inner.channel().read_etc(cx, bytes, handles) {
1122 std::task::Poll::Ready(Ok(())) => {}
1123 std::task::Poll::Pending => return std::task::Poll::Pending,
1124 std::task::Poll::Ready(Err(None)) => {
1125 this.is_terminated = true;
1126 return std::task::Poll::Ready(None);
1127 }
1128 std::task::Poll::Ready(Err(Some(e))) => {
1129 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1130 e.into(),
1131 ))));
1132 }
1133 }
1134
1135 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1137
1138 std::task::Poll::Ready(Some(match header.ordinal {
1139 0x162c79ca23670659 => {
1140 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1141 let mut req = fidl::new_empty!(
1142 TicTacToeStartGameRequest,
1143 fdomain_client::fidl::FDomainResourceDialect
1144 );
1145 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<TicTacToeStartGameRequest>(&header, _body_bytes, handles, &mut req)?;
1146 let control_handle = TicTacToeControlHandle { inner: this.inner.clone() };
1147 Ok(TicTacToeRequest::StartGame {
1148 start_first: req.start_first,
1149
1150 control_handle,
1151 })
1152 }
1153 0x7fe54d55da796551 => {
1154 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1155 let mut req = fidl::new_empty!(
1156 TicTacToeMakeMoveRequest,
1157 fdomain_client::fidl::FDomainResourceDialect
1158 );
1159 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<TicTacToeMakeMoveRequest>(&header, _body_bytes, handles, &mut req)?;
1160 let control_handle = TicTacToeControlHandle { inner: this.inner.clone() };
1161 Ok(TicTacToeRequest::MakeMove {
1162 row: req.row,
1163 col: req.col,
1164
1165 responder: TicTacToeMakeMoveResponder {
1166 control_handle: std::mem::ManuallyDrop::new(control_handle),
1167 tx_id: header.tx_id,
1168 },
1169 })
1170 }
1171 _ => Err(fidl::Error::UnknownOrdinal {
1172 ordinal: header.ordinal,
1173 protocol_name:
1174 <TicTacToeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1175 }),
1176 }))
1177 },
1178 )
1179 }
1180}
1181
1182#[derive(Debug)]
1183pub enum TicTacToeRequest {
1184 StartGame { start_first: bool, control_handle: TicTacToeControlHandle },
1185 MakeMove { row: u8, col: u8, responder: TicTacToeMakeMoveResponder },
1186}
1187
1188impl TicTacToeRequest {
1189 #[allow(irrefutable_let_patterns)]
1190 pub fn into_start_game(self) -> Option<(bool, TicTacToeControlHandle)> {
1191 if let TicTacToeRequest::StartGame { start_first, control_handle } = self {
1192 Some((start_first, control_handle))
1193 } else {
1194 None
1195 }
1196 }
1197
1198 #[allow(irrefutable_let_patterns)]
1199 pub fn into_make_move(self) -> Option<(u8, u8, TicTacToeMakeMoveResponder)> {
1200 if let TicTacToeRequest::MakeMove { row, col, responder } = self {
1201 Some((row, col, responder))
1202 } else {
1203 None
1204 }
1205 }
1206
1207 pub fn method_name(&self) -> &'static str {
1209 match *self {
1210 TicTacToeRequest::StartGame { .. } => "start_game",
1211 TicTacToeRequest::MakeMove { .. } => "make_move",
1212 }
1213 }
1214}
1215
1216#[derive(Debug, Clone)]
1217pub struct TicTacToeControlHandle {
1218 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1219}
1220
1221impl TicTacToeControlHandle {
1222 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1223 self.inner.shutdown_with_epitaph(status.into())
1224 }
1225}
1226
1227impl fdomain_client::fidl::ControlHandle for TicTacToeControlHandle {
1228 fn shutdown(&self) {
1229 self.inner.shutdown()
1230 }
1231
1232 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1233 self.inner.shutdown_with_epitaph(status)
1234 }
1235
1236 fn is_closed(&self) -> bool {
1237 self.inner.channel().is_closed()
1238 }
1239 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1240 self.inner.channel().on_closed()
1241 }
1242}
1243
1244impl TicTacToeControlHandle {
1245 pub fn send_on_opponent_move(&self, mut new_state: &GameState) -> Result<(), fidl::Error> {
1246 self.inner.send::<TicTacToeOnOpponentMoveRequest>(
1247 (new_state,),
1248 0,
1249 0x538cf57bfe01c728,
1250 fidl::encoding::DynamicFlags::empty(),
1251 )
1252 }
1253}
1254
1255#[must_use = "FIDL methods require a response to be sent"]
1256#[derive(Debug)]
1257pub struct TicTacToeMakeMoveResponder {
1258 control_handle: std::mem::ManuallyDrop<TicTacToeControlHandle>,
1259 tx_id: u32,
1260}
1261
1262impl std::ops::Drop for TicTacToeMakeMoveResponder {
1266 fn drop(&mut self) {
1267 self.control_handle.shutdown();
1268 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1270 }
1271}
1272
1273impl fdomain_client::fidl::Responder for TicTacToeMakeMoveResponder {
1274 type ControlHandle = TicTacToeControlHandle;
1275
1276 fn control_handle(&self) -> &TicTacToeControlHandle {
1277 &self.control_handle
1278 }
1279
1280 fn drop_without_shutdown(mut self) {
1281 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1283 std::mem::forget(self);
1285 }
1286}
1287
1288impl TicTacToeMakeMoveResponder {
1289 pub fn send(
1293 self,
1294 mut success: bool,
1295 mut new_state: Option<&GameState>,
1296 ) -> Result<(), fidl::Error> {
1297 let _result = self.send_raw(success, new_state);
1298 if _result.is_err() {
1299 self.control_handle.shutdown();
1300 }
1301 self.drop_without_shutdown();
1302 _result
1303 }
1304
1305 pub fn send_no_shutdown_on_err(
1307 self,
1308 mut success: bool,
1309 mut new_state: Option<&GameState>,
1310 ) -> Result<(), fidl::Error> {
1311 let _result = self.send_raw(success, new_state);
1312 self.drop_without_shutdown();
1313 _result
1314 }
1315
1316 fn send_raw(
1317 &self,
1318 mut success: bool,
1319 mut new_state: Option<&GameState>,
1320 ) -> Result<(), fidl::Error> {
1321 self.control_handle.inner.send::<TicTacToeMakeMoveResponse>(
1322 (success, new_state),
1323 self.tx_id,
1324 0x7fe54d55da796551,
1325 fidl::encoding::DynamicFlags::empty(),
1326 )
1327 }
1328}
1329
1330mod internal {
1331 use super::*;
1332
1333 impl fidl::encoding::ResourceTypeMarker for EchoLauncherGetEchoPipelinedRequest {
1334 type Borrowed<'a> = &'a mut Self;
1335 fn take_or_borrow<'a>(
1336 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1337 ) -> Self::Borrowed<'a> {
1338 value
1339 }
1340 }
1341
1342 unsafe impl fidl::encoding::TypeMarker for EchoLauncherGetEchoPipelinedRequest {
1343 type Owned = Self;
1344
1345 #[inline(always)]
1346 fn inline_align(_context: fidl::encoding::Context) -> usize {
1347 8
1348 }
1349
1350 #[inline(always)]
1351 fn inline_size(_context: fidl::encoding::Context) -> usize {
1352 24
1353 }
1354 }
1355
1356 unsafe impl
1357 fidl::encoding::Encode<
1358 EchoLauncherGetEchoPipelinedRequest,
1359 fdomain_client::fidl::FDomainResourceDialect,
1360 > for &mut EchoLauncherGetEchoPipelinedRequest
1361 {
1362 #[inline]
1363 unsafe fn encode(
1364 self,
1365 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1366 offset: usize,
1367 _depth: fidl::encoding::Depth,
1368 ) -> fidl::Result<()> {
1369 encoder.debug_check_bounds::<EchoLauncherGetEchoPipelinedRequest>(offset);
1370 fidl::encoding::Encode::<EchoLauncherGetEchoPipelinedRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1372 (
1373 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.echo_prefix),
1374 <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<EchoMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1375 ),
1376 encoder, offset, _depth
1377 )
1378 }
1379 }
1380 unsafe impl<
1381 T0: fidl::encoding::Encode<
1382 fidl::encoding::BoundedString<32>,
1383 fdomain_client::fidl::FDomainResourceDialect,
1384 >,
1385 T1: fidl::encoding::Encode<
1386 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<EchoMarker>>,
1387 fdomain_client::fidl::FDomainResourceDialect,
1388 >,
1389 >
1390 fidl::encoding::Encode<
1391 EchoLauncherGetEchoPipelinedRequest,
1392 fdomain_client::fidl::FDomainResourceDialect,
1393 > for (T0, T1)
1394 {
1395 #[inline]
1396 unsafe fn encode(
1397 self,
1398 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1399 offset: usize,
1400 depth: fidl::encoding::Depth,
1401 ) -> fidl::Result<()> {
1402 encoder.debug_check_bounds::<EchoLauncherGetEchoPipelinedRequest>(offset);
1403 unsafe {
1406 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1407 (ptr as *mut u64).write_unaligned(0);
1408 }
1409 self.0.encode(encoder, offset + 0, depth)?;
1411 self.1.encode(encoder, offset + 16, depth)?;
1412 Ok(())
1413 }
1414 }
1415
1416 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1417 for EchoLauncherGetEchoPipelinedRequest
1418 {
1419 #[inline(always)]
1420 fn new_empty() -> Self {
1421 Self {
1422 echo_prefix: fidl::new_empty!(
1423 fidl::encoding::BoundedString<32>,
1424 fdomain_client::fidl::FDomainResourceDialect
1425 ),
1426 request: fidl::new_empty!(
1427 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<EchoMarker>>,
1428 fdomain_client::fidl::FDomainResourceDialect
1429 ),
1430 }
1431 }
1432
1433 #[inline]
1434 unsafe fn decode(
1435 &mut self,
1436 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1437 offset: usize,
1438 _depth: fidl::encoding::Depth,
1439 ) -> fidl::Result<()> {
1440 decoder.debug_check_bounds::<Self>(offset);
1441 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1443 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1444 let mask = 0xffffffff00000000u64;
1445 let maskedval = padval & mask;
1446 if maskedval != 0 {
1447 return Err(fidl::Error::NonZeroPadding {
1448 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1449 });
1450 }
1451 fidl::decode!(
1452 fidl::encoding::BoundedString<32>,
1453 fdomain_client::fidl::FDomainResourceDialect,
1454 &mut self.echo_prefix,
1455 decoder,
1456 offset + 0,
1457 _depth
1458 )?;
1459 fidl::decode!(
1460 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<EchoMarker>>,
1461 fdomain_client::fidl::FDomainResourceDialect,
1462 &mut self.request,
1463 decoder,
1464 offset + 16,
1465 _depth
1466 )?;
1467 Ok(())
1468 }
1469 }
1470
1471 impl fidl::encoding::ResourceTypeMarker for EchoLauncherGetEchoResponse {
1472 type Borrowed<'a> = &'a mut Self;
1473 fn take_or_borrow<'a>(
1474 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1475 ) -> Self::Borrowed<'a> {
1476 value
1477 }
1478 }
1479
1480 unsafe impl fidl::encoding::TypeMarker for EchoLauncherGetEchoResponse {
1481 type Owned = Self;
1482
1483 #[inline(always)]
1484 fn inline_align(_context: fidl::encoding::Context) -> usize {
1485 4
1486 }
1487
1488 #[inline(always)]
1489 fn inline_size(_context: fidl::encoding::Context) -> usize {
1490 4
1491 }
1492 }
1493
1494 unsafe impl
1495 fidl::encoding::Encode<
1496 EchoLauncherGetEchoResponse,
1497 fdomain_client::fidl::FDomainResourceDialect,
1498 > for &mut EchoLauncherGetEchoResponse
1499 {
1500 #[inline]
1501 unsafe fn encode(
1502 self,
1503 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1504 offset: usize,
1505 _depth: fidl::encoding::Depth,
1506 ) -> fidl::Result<()> {
1507 encoder.debug_check_bounds::<EchoLauncherGetEchoResponse>(offset);
1508 fidl::encoding::Encode::<EchoLauncherGetEchoResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
1510 (
1511 <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<EchoMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.response),
1512 ),
1513 encoder, offset, _depth
1514 )
1515 }
1516 }
1517 unsafe impl<
1518 T0: fidl::encoding::Encode<
1519 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<EchoMarker>>,
1520 fdomain_client::fidl::FDomainResourceDialect,
1521 >,
1522 >
1523 fidl::encoding::Encode<
1524 EchoLauncherGetEchoResponse,
1525 fdomain_client::fidl::FDomainResourceDialect,
1526 > for (T0,)
1527 {
1528 #[inline]
1529 unsafe fn encode(
1530 self,
1531 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1532 offset: usize,
1533 depth: fidl::encoding::Depth,
1534 ) -> fidl::Result<()> {
1535 encoder.debug_check_bounds::<EchoLauncherGetEchoResponse>(offset);
1536 self.0.encode(encoder, offset + 0, depth)?;
1540 Ok(())
1541 }
1542 }
1543
1544 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1545 for EchoLauncherGetEchoResponse
1546 {
1547 #[inline(always)]
1548 fn new_empty() -> Self {
1549 Self {
1550 response: fidl::new_empty!(
1551 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<EchoMarker>>,
1552 fdomain_client::fidl::FDomainResourceDialect
1553 ),
1554 }
1555 }
1556
1557 #[inline]
1558 unsafe fn decode(
1559 &mut self,
1560 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1561 offset: usize,
1562 _depth: fidl::encoding::Depth,
1563 ) -> fidl::Result<()> {
1564 decoder.debug_check_bounds::<Self>(offset);
1565 fidl::decode!(
1567 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<EchoMarker>>,
1568 fdomain_client::fidl::FDomainResourceDialect,
1569 &mut self.response,
1570 decoder,
1571 offset + 0,
1572 _depth
1573 )?;
1574 Ok(())
1575 }
1576 }
1577
1578 impl fidl::encoding::ResourceTypeMarker for EventStruct {
1579 type Borrowed<'a> = &'a mut Self;
1580 fn take_or_borrow<'a>(
1581 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1582 ) -> Self::Borrowed<'a> {
1583 value
1584 }
1585 }
1586
1587 unsafe impl fidl::encoding::TypeMarker for EventStruct {
1588 type Owned = Self;
1589
1590 #[inline(always)]
1591 fn inline_align(_context: fidl::encoding::Context) -> usize {
1592 4
1593 }
1594
1595 #[inline(always)]
1596 fn inline_size(_context: fidl::encoding::Context) -> usize {
1597 4
1598 }
1599 }
1600
1601 unsafe impl fidl::encoding::Encode<EventStruct, fdomain_client::fidl::FDomainResourceDialect>
1602 for &mut EventStruct
1603 {
1604 #[inline]
1605 unsafe fn encode(
1606 self,
1607 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1608 offset: usize,
1609 _depth: fidl::encoding::Depth,
1610 ) -> fidl::Result<()> {
1611 encoder.debug_check_bounds::<EventStruct>(offset);
1612 fidl::encoding::Encode::<EventStruct, fdomain_client::fidl::FDomainResourceDialect>::encode(
1614 (
1615 <fidl::encoding::Optional<fidl::encoding::HandleType<fdomain_client::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.event),
1616 ),
1617 encoder, offset, _depth
1618 )
1619 }
1620 }
1621 unsafe impl<
1622 T0: fidl::encoding::Encode<
1623 fidl::encoding::Optional<
1624 fidl::encoding::HandleType<
1625 fdomain_client::Event,
1626 { fidl::ObjectType::EVENT.into_raw() },
1627 2147483648,
1628 >,
1629 >,
1630 fdomain_client::fidl::FDomainResourceDialect,
1631 >,
1632 > fidl::encoding::Encode<EventStruct, fdomain_client::fidl::FDomainResourceDialect> for (T0,)
1633 {
1634 #[inline]
1635 unsafe fn encode(
1636 self,
1637 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1638 offset: usize,
1639 depth: fidl::encoding::Depth,
1640 ) -> fidl::Result<()> {
1641 encoder.debug_check_bounds::<EventStruct>(offset);
1642 self.0.encode(encoder, offset + 0, depth)?;
1646 Ok(())
1647 }
1648 }
1649
1650 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for EventStruct {
1651 #[inline(always)]
1652 fn new_empty() -> Self {
1653 Self {
1654 event: fidl::new_empty!(
1655 fidl::encoding::Optional<
1656 fidl::encoding::HandleType<
1657 fdomain_client::Event,
1658 { fidl::ObjectType::EVENT.into_raw() },
1659 2147483648,
1660 >,
1661 >,
1662 fdomain_client::fidl::FDomainResourceDialect
1663 ),
1664 }
1665 }
1666
1667 #[inline]
1668 unsafe fn decode(
1669 &mut self,
1670 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1671 offset: usize,
1672 _depth: fidl::encoding::Depth,
1673 ) -> fidl::Result<()> {
1674 decoder.debug_check_bounds::<Self>(offset);
1675 fidl::decode!(
1677 fidl::encoding::Optional<
1678 fidl::encoding::HandleType<
1679 fdomain_client::Event,
1680 { fidl::ObjectType::EVENT.into_raw() },
1681 2147483648,
1682 >,
1683 >,
1684 fdomain_client::fidl::FDomainResourceDialect,
1685 &mut self.event,
1686 decoder,
1687 offset + 0,
1688 _depth
1689 )?;
1690 Ok(())
1691 }
1692 }
1693}