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