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 fdomain_client::fidl::ControlHandle for EchoControlHandle {
356 fn shutdown(&self) {
357 self.inner.shutdown()
358 }
359
360 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
361 self.inner.shutdown_with_epitaph(status)
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 shutdown_with_epitaph(&self, status: zx_status::Status) {
793 self.inner.shutdown_with_epitaph(status)
794 }
795
796 fn is_closed(&self) -> bool {
797 self.inner.channel().is_closed()
798 }
799 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
800 self.inner.channel().on_closed()
801 }
802}
803
804impl EchoLauncherControlHandle {}
805
806#[must_use = "FIDL methods require a response to be sent"]
807#[derive(Debug)]
808pub struct EchoLauncherGetEchoResponder {
809 control_handle: std::mem::ManuallyDrop<EchoLauncherControlHandle>,
810 tx_id: u32,
811}
812
813impl std::ops::Drop for EchoLauncherGetEchoResponder {
817 fn drop(&mut self) {
818 self.control_handle.shutdown();
819 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
821 }
822}
823
824impl fdomain_client::fidl::Responder for EchoLauncherGetEchoResponder {
825 type ControlHandle = EchoLauncherControlHandle;
826
827 fn control_handle(&self) -> &EchoLauncherControlHandle {
828 &self.control_handle
829 }
830
831 fn drop_without_shutdown(mut self) {
832 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
834 std::mem::forget(self);
836 }
837}
838
839impl EchoLauncherGetEchoResponder {
840 pub fn send(
844 self,
845 mut response: fdomain_client::fidl::ClientEnd<EchoMarker>,
846 ) -> Result<(), fidl::Error> {
847 let _result = self.send_raw(response);
848 if _result.is_err() {
849 self.control_handle.shutdown();
850 }
851 self.drop_without_shutdown();
852 _result
853 }
854
855 pub fn send_no_shutdown_on_err(
857 self,
858 mut response: fdomain_client::fidl::ClientEnd<EchoMarker>,
859 ) -> Result<(), fidl::Error> {
860 let _result = self.send_raw(response);
861 self.drop_without_shutdown();
862 _result
863 }
864
865 fn send_raw(
866 &self,
867 mut response: fdomain_client::fidl::ClientEnd<EchoMarker>,
868 ) -> Result<(), fidl::Error> {
869 self.control_handle.inner.send::<EchoLauncherGetEchoResponse>(
870 (response,),
871 self.tx_id,
872 0x10d693a107613de8,
873 fidl::encoding::DynamicFlags::empty(),
874 )
875 }
876}
877
878#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
879pub struct TicTacToeMarker;
880
881impl fdomain_client::fidl::ProtocolMarker for TicTacToeMarker {
882 type Proxy = TicTacToeProxy;
883 type RequestStream = TicTacToeRequestStream;
884
885 const DEBUG_NAME: &'static str = "(anonymous) TicTacToe";
886}
887
888pub trait TicTacToeProxyInterface: Send + Sync {
889 fn r#start_game(&self, start_first: bool) -> Result<(), fidl::Error>;
890 type MakeMoveResponseFut: std::future::Future<Output = Result<(bool, Option<Box<GameState>>), fidl::Error>>
891 + Send;
892 fn r#make_move(&self, row: u8, col: u8) -> Self::MakeMoveResponseFut;
893}
894
895#[derive(Debug, Clone)]
896pub struct TicTacToeProxy {
897 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
898}
899
900impl fdomain_client::fidl::Proxy for TicTacToeProxy {
901 type Protocol = TicTacToeMarker;
902
903 fn from_channel(inner: fdomain_client::Channel) -> Self {
904 Self::new(inner)
905 }
906
907 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
908 self.client.into_channel().map_err(|client| Self { client })
909 }
910
911 fn as_channel(&self) -> &fdomain_client::Channel {
912 self.client.as_channel()
913 }
914}
915
916impl TicTacToeProxy {
917 pub fn new(channel: fdomain_client::Channel) -> Self {
919 let protocol_name = <TicTacToeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
920 Self { client: fidl::client::Client::new(channel, protocol_name) }
921 }
922
923 pub fn take_event_stream(&self) -> TicTacToeEventStream {
929 TicTacToeEventStream { event_receiver: self.client.take_event_receiver() }
930 }
931
932 pub fn r#start_game(&self, mut start_first: bool) -> Result<(), fidl::Error> {
933 TicTacToeProxyInterface::r#start_game(self, start_first)
934 }
935
936 pub fn r#make_move(
937 &self,
938 mut row: u8,
939 mut col: u8,
940 ) -> fidl::client::QueryResponseFut<
941 (bool, Option<Box<GameState>>),
942 fdomain_client::fidl::FDomainResourceDialect,
943 > {
944 TicTacToeProxyInterface::r#make_move(self, row, col)
945 }
946}
947
948impl TicTacToeProxyInterface for TicTacToeProxy {
949 fn r#start_game(&self, mut start_first: bool) -> Result<(), fidl::Error> {
950 self.client.send::<TicTacToeStartGameRequest>(
951 (start_first,),
952 0x162c79ca23670659,
953 fidl::encoding::DynamicFlags::empty(),
954 )
955 }
956
957 type MakeMoveResponseFut = fidl::client::QueryResponseFut<
958 (bool, Option<Box<GameState>>),
959 fdomain_client::fidl::FDomainResourceDialect,
960 >;
961 fn r#make_move(&self, mut row: u8, mut col: u8) -> Self::MakeMoveResponseFut {
962 fn _decode(
963 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
964 ) -> Result<(bool, Option<Box<GameState>>), fidl::Error> {
965 let _response = fidl::client::decode_transaction_body::<
966 TicTacToeMakeMoveResponse,
967 fdomain_client::fidl::FDomainResourceDialect,
968 0x7fe54d55da796551,
969 >(_buf?)?;
970 Ok((_response.success, _response.new_state))
971 }
972 self.client
973 .send_query_and_decode::<TicTacToeMakeMoveRequest, (bool, Option<Box<GameState>>)>(
974 (row, col),
975 0x7fe54d55da796551,
976 fidl::encoding::DynamicFlags::empty(),
977 _decode,
978 )
979 }
980}
981
982pub struct TicTacToeEventStream {
983 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
984}
985
986impl std::marker::Unpin for TicTacToeEventStream {}
987
988impl futures::stream::FusedStream for TicTacToeEventStream {
989 fn is_terminated(&self) -> bool {
990 self.event_receiver.is_terminated()
991 }
992}
993
994impl futures::Stream for TicTacToeEventStream {
995 type Item = Result<TicTacToeEvent, fidl::Error>;
996
997 fn poll_next(
998 mut self: std::pin::Pin<&mut Self>,
999 cx: &mut std::task::Context<'_>,
1000 ) -> std::task::Poll<Option<Self::Item>> {
1001 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1002 &mut self.event_receiver,
1003 cx
1004 )?) {
1005 Some(buf) => std::task::Poll::Ready(Some(TicTacToeEvent::decode(buf))),
1006 None => std::task::Poll::Ready(None),
1007 }
1008 }
1009}
1010
1011#[derive(Debug)]
1012pub enum TicTacToeEvent {
1013 OnOpponentMove { new_state: GameState },
1014}
1015
1016impl TicTacToeEvent {
1017 #[allow(irrefutable_let_patterns)]
1018 pub fn into_on_opponent_move(self) -> Option<GameState> {
1019 if let TicTacToeEvent::OnOpponentMove { new_state } = self {
1020 Some((new_state))
1021 } else {
1022 None
1023 }
1024 }
1025
1026 fn decode(
1028 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1029 ) -> Result<TicTacToeEvent, fidl::Error> {
1030 let (bytes, _handles) = buf.split_mut();
1031 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1032 debug_assert_eq!(tx_header.tx_id, 0);
1033 match tx_header.ordinal {
1034 0x538cf57bfe01c728 => {
1035 let mut out = fidl::new_empty!(
1036 TicTacToeOnOpponentMoveRequest,
1037 fdomain_client::fidl::FDomainResourceDialect
1038 );
1039 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<TicTacToeOnOpponentMoveRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1040 Ok((TicTacToeEvent::OnOpponentMove { new_state: out.new_state }))
1041 }
1042 _ => Err(fidl::Error::UnknownOrdinal {
1043 ordinal: tx_header.ordinal,
1044 protocol_name:
1045 <TicTacToeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1046 }),
1047 }
1048 }
1049}
1050
1051pub struct TicTacToeRequestStream {
1053 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1054 is_terminated: bool,
1055}
1056
1057impl std::marker::Unpin for TicTacToeRequestStream {}
1058
1059impl futures::stream::FusedStream for TicTacToeRequestStream {
1060 fn is_terminated(&self) -> bool {
1061 self.is_terminated
1062 }
1063}
1064
1065impl fdomain_client::fidl::RequestStream for TicTacToeRequestStream {
1066 type Protocol = TicTacToeMarker;
1067 type ControlHandle = TicTacToeControlHandle;
1068
1069 fn from_channel(channel: fdomain_client::Channel) -> Self {
1070 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1071 }
1072
1073 fn control_handle(&self) -> Self::ControlHandle {
1074 TicTacToeControlHandle { inner: self.inner.clone() }
1075 }
1076
1077 fn into_inner(
1078 self,
1079 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1080 {
1081 (self.inner, self.is_terminated)
1082 }
1083
1084 fn from_inner(
1085 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1086 is_terminated: bool,
1087 ) -> Self {
1088 Self { inner, is_terminated }
1089 }
1090}
1091
1092impl futures::Stream for TicTacToeRequestStream {
1093 type Item = Result<TicTacToeRequest, fidl::Error>;
1094
1095 fn poll_next(
1096 mut self: std::pin::Pin<&mut Self>,
1097 cx: &mut std::task::Context<'_>,
1098 ) -> std::task::Poll<Option<Self::Item>> {
1099 let this = &mut *self;
1100 if this.inner.check_shutdown(cx) {
1101 this.is_terminated = true;
1102 return std::task::Poll::Ready(None);
1103 }
1104 if this.is_terminated {
1105 panic!("polled TicTacToeRequestStream after completion");
1106 }
1107 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1108 |bytes, handles| {
1109 match this.inner.channel().read_etc(cx, bytes, handles) {
1110 std::task::Poll::Ready(Ok(())) => {}
1111 std::task::Poll::Pending => return std::task::Poll::Pending,
1112 std::task::Poll::Ready(Err(None)) => {
1113 this.is_terminated = true;
1114 return std::task::Poll::Ready(None);
1115 }
1116 std::task::Poll::Ready(Err(Some(e))) => {
1117 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1118 e.into(),
1119 ))));
1120 }
1121 }
1122
1123 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1125
1126 std::task::Poll::Ready(Some(match header.ordinal {
1127 0x162c79ca23670659 => {
1128 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1129 let mut req = fidl::new_empty!(
1130 TicTacToeStartGameRequest,
1131 fdomain_client::fidl::FDomainResourceDialect
1132 );
1133 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<TicTacToeStartGameRequest>(&header, _body_bytes, handles, &mut req)?;
1134 let control_handle = TicTacToeControlHandle { inner: this.inner.clone() };
1135 Ok(TicTacToeRequest::StartGame {
1136 start_first: req.start_first,
1137
1138 control_handle,
1139 })
1140 }
1141 0x7fe54d55da796551 => {
1142 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1143 let mut req = fidl::new_empty!(
1144 TicTacToeMakeMoveRequest,
1145 fdomain_client::fidl::FDomainResourceDialect
1146 );
1147 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<TicTacToeMakeMoveRequest>(&header, _body_bytes, handles, &mut req)?;
1148 let control_handle = TicTacToeControlHandle { inner: this.inner.clone() };
1149 Ok(TicTacToeRequest::MakeMove {
1150 row: req.row,
1151 col: req.col,
1152
1153 responder: TicTacToeMakeMoveResponder {
1154 control_handle: std::mem::ManuallyDrop::new(control_handle),
1155 tx_id: header.tx_id,
1156 },
1157 })
1158 }
1159 _ => Err(fidl::Error::UnknownOrdinal {
1160 ordinal: header.ordinal,
1161 protocol_name:
1162 <TicTacToeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1163 }),
1164 }))
1165 },
1166 )
1167 }
1168}
1169
1170#[derive(Debug)]
1171pub enum TicTacToeRequest {
1172 StartGame { start_first: bool, control_handle: TicTacToeControlHandle },
1173 MakeMove { row: u8, col: u8, responder: TicTacToeMakeMoveResponder },
1174}
1175
1176impl TicTacToeRequest {
1177 #[allow(irrefutable_let_patterns)]
1178 pub fn into_start_game(self) -> Option<(bool, TicTacToeControlHandle)> {
1179 if let TicTacToeRequest::StartGame { start_first, control_handle } = self {
1180 Some((start_first, control_handle))
1181 } else {
1182 None
1183 }
1184 }
1185
1186 #[allow(irrefutable_let_patterns)]
1187 pub fn into_make_move(self) -> Option<(u8, u8, TicTacToeMakeMoveResponder)> {
1188 if let TicTacToeRequest::MakeMove { row, col, responder } = self {
1189 Some((row, col, responder))
1190 } else {
1191 None
1192 }
1193 }
1194
1195 pub fn method_name(&self) -> &'static str {
1197 match *self {
1198 TicTacToeRequest::StartGame { .. } => "start_game",
1199 TicTacToeRequest::MakeMove { .. } => "make_move",
1200 }
1201 }
1202}
1203
1204#[derive(Debug, Clone)]
1205pub struct TicTacToeControlHandle {
1206 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1207}
1208
1209impl fdomain_client::fidl::ControlHandle for TicTacToeControlHandle {
1210 fn shutdown(&self) {
1211 self.inner.shutdown()
1212 }
1213
1214 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1215 self.inner.shutdown_with_epitaph(status)
1216 }
1217
1218 fn is_closed(&self) -> bool {
1219 self.inner.channel().is_closed()
1220 }
1221 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1222 self.inner.channel().on_closed()
1223 }
1224}
1225
1226impl TicTacToeControlHandle {
1227 pub fn send_on_opponent_move(&self, mut new_state: &GameState) -> Result<(), fidl::Error> {
1228 self.inner.send::<TicTacToeOnOpponentMoveRequest>(
1229 (new_state,),
1230 0,
1231 0x538cf57bfe01c728,
1232 fidl::encoding::DynamicFlags::empty(),
1233 )
1234 }
1235}
1236
1237#[must_use = "FIDL methods require a response to be sent"]
1238#[derive(Debug)]
1239pub struct TicTacToeMakeMoveResponder {
1240 control_handle: std::mem::ManuallyDrop<TicTacToeControlHandle>,
1241 tx_id: u32,
1242}
1243
1244impl std::ops::Drop for TicTacToeMakeMoveResponder {
1248 fn drop(&mut self) {
1249 self.control_handle.shutdown();
1250 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1252 }
1253}
1254
1255impl fdomain_client::fidl::Responder for TicTacToeMakeMoveResponder {
1256 type ControlHandle = TicTacToeControlHandle;
1257
1258 fn control_handle(&self) -> &TicTacToeControlHandle {
1259 &self.control_handle
1260 }
1261
1262 fn drop_without_shutdown(mut self) {
1263 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1265 std::mem::forget(self);
1267 }
1268}
1269
1270impl TicTacToeMakeMoveResponder {
1271 pub fn send(
1275 self,
1276 mut success: bool,
1277 mut new_state: Option<&GameState>,
1278 ) -> Result<(), fidl::Error> {
1279 let _result = self.send_raw(success, new_state);
1280 if _result.is_err() {
1281 self.control_handle.shutdown();
1282 }
1283 self.drop_without_shutdown();
1284 _result
1285 }
1286
1287 pub fn send_no_shutdown_on_err(
1289 self,
1290 mut success: bool,
1291 mut new_state: Option<&GameState>,
1292 ) -> Result<(), fidl::Error> {
1293 let _result = self.send_raw(success, new_state);
1294 self.drop_without_shutdown();
1295 _result
1296 }
1297
1298 fn send_raw(
1299 &self,
1300 mut success: bool,
1301 mut new_state: Option<&GameState>,
1302 ) -> Result<(), fidl::Error> {
1303 self.control_handle.inner.send::<TicTacToeMakeMoveResponse>(
1304 (success, new_state),
1305 self.tx_id,
1306 0x7fe54d55da796551,
1307 fidl::encoding::DynamicFlags::empty(),
1308 )
1309 }
1310}
1311
1312mod internal {
1313 use super::*;
1314
1315 impl fidl::encoding::ResourceTypeMarker for EchoLauncherGetEchoPipelinedRequest {
1316 type Borrowed<'a> = &'a mut Self;
1317 fn take_or_borrow<'a>(
1318 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1319 ) -> Self::Borrowed<'a> {
1320 value
1321 }
1322 }
1323
1324 unsafe impl fidl::encoding::TypeMarker for EchoLauncherGetEchoPipelinedRequest {
1325 type Owned = Self;
1326
1327 #[inline(always)]
1328 fn inline_align(_context: fidl::encoding::Context) -> usize {
1329 8
1330 }
1331
1332 #[inline(always)]
1333 fn inline_size(_context: fidl::encoding::Context) -> usize {
1334 24
1335 }
1336 }
1337
1338 unsafe impl
1339 fidl::encoding::Encode<
1340 EchoLauncherGetEchoPipelinedRequest,
1341 fdomain_client::fidl::FDomainResourceDialect,
1342 > for &mut EchoLauncherGetEchoPipelinedRequest
1343 {
1344 #[inline]
1345 unsafe fn encode(
1346 self,
1347 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1348 offset: usize,
1349 _depth: fidl::encoding::Depth,
1350 ) -> fidl::Result<()> {
1351 encoder.debug_check_bounds::<EchoLauncherGetEchoPipelinedRequest>(offset);
1352 fidl::encoding::Encode::<EchoLauncherGetEchoPipelinedRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1354 (
1355 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.echo_prefix),
1356 <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<EchoMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1357 ),
1358 encoder, offset, _depth
1359 )
1360 }
1361 }
1362 unsafe impl<
1363 T0: fidl::encoding::Encode<
1364 fidl::encoding::BoundedString<32>,
1365 fdomain_client::fidl::FDomainResourceDialect,
1366 >,
1367 T1: fidl::encoding::Encode<
1368 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<EchoMarker>>,
1369 fdomain_client::fidl::FDomainResourceDialect,
1370 >,
1371 >
1372 fidl::encoding::Encode<
1373 EchoLauncherGetEchoPipelinedRequest,
1374 fdomain_client::fidl::FDomainResourceDialect,
1375 > for (T0, T1)
1376 {
1377 #[inline]
1378 unsafe fn encode(
1379 self,
1380 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1381 offset: usize,
1382 depth: fidl::encoding::Depth,
1383 ) -> fidl::Result<()> {
1384 encoder.debug_check_bounds::<EchoLauncherGetEchoPipelinedRequest>(offset);
1385 unsafe {
1388 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1389 (ptr as *mut u64).write_unaligned(0);
1390 }
1391 self.0.encode(encoder, offset + 0, depth)?;
1393 self.1.encode(encoder, offset + 16, depth)?;
1394 Ok(())
1395 }
1396 }
1397
1398 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1399 for EchoLauncherGetEchoPipelinedRequest
1400 {
1401 #[inline(always)]
1402 fn new_empty() -> Self {
1403 Self {
1404 echo_prefix: fidl::new_empty!(
1405 fidl::encoding::BoundedString<32>,
1406 fdomain_client::fidl::FDomainResourceDialect
1407 ),
1408 request: fidl::new_empty!(
1409 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<EchoMarker>>,
1410 fdomain_client::fidl::FDomainResourceDialect
1411 ),
1412 }
1413 }
1414
1415 #[inline]
1416 unsafe fn decode(
1417 &mut self,
1418 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1419 offset: usize,
1420 _depth: fidl::encoding::Depth,
1421 ) -> fidl::Result<()> {
1422 decoder.debug_check_bounds::<Self>(offset);
1423 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1425 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1426 let mask = 0xffffffff00000000u64;
1427 let maskedval = padval & mask;
1428 if maskedval != 0 {
1429 return Err(fidl::Error::NonZeroPadding {
1430 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1431 });
1432 }
1433 fidl::decode!(
1434 fidl::encoding::BoundedString<32>,
1435 fdomain_client::fidl::FDomainResourceDialect,
1436 &mut self.echo_prefix,
1437 decoder,
1438 offset + 0,
1439 _depth
1440 )?;
1441 fidl::decode!(
1442 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<EchoMarker>>,
1443 fdomain_client::fidl::FDomainResourceDialect,
1444 &mut self.request,
1445 decoder,
1446 offset + 16,
1447 _depth
1448 )?;
1449 Ok(())
1450 }
1451 }
1452
1453 impl fidl::encoding::ResourceTypeMarker for EchoLauncherGetEchoResponse {
1454 type Borrowed<'a> = &'a mut Self;
1455 fn take_or_borrow<'a>(
1456 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1457 ) -> Self::Borrowed<'a> {
1458 value
1459 }
1460 }
1461
1462 unsafe impl fidl::encoding::TypeMarker for EchoLauncherGetEchoResponse {
1463 type Owned = Self;
1464
1465 #[inline(always)]
1466 fn inline_align(_context: fidl::encoding::Context) -> usize {
1467 4
1468 }
1469
1470 #[inline(always)]
1471 fn inline_size(_context: fidl::encoding::Context) -> usize {
1472 4
1473 }
1474 }
1475
1476 unsafe impl
1477 fidl::encoding::Encode<
1478 EchoLauncherGetEchoResponse,
1479 fdomain_client::fidl::FDomainResourceDialect,
1480 > for &mut EchoLauncherGetEchoResponse
1481 {
1482 #[inline]
1483 unsafe fn encode(
1484 self,
1485 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1486 offset: usize,
1487 _depth: fidl::encoding::Depth,
1488 ) -> fidl::Result<()> {
1489 encoder.debug_check_bounds::<EchoLauncherGetEchoResponse>(offset);
1490 fidl::encoding::Encode::<EchoLauncherGetEchoResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
1492 (
1493 <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<EchoMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.response),
1494 ),
1495 encoder, offset, _depth
1496 )
1497 }
1498 }
1499 unsafe impl<
1500 T0: fidl::encoding::Encode<
1501 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<EchoMarker>>,
1502 fdomain_client::fidl::FDomainResourceDialect,
1503 >,
1504 >
1505 fidl::encoding::Encode<
1506 EchoLauncherGetEchoResponse,
1507 fdomain_client::fidl::FDomainResourceDialect,
1508 > for (T0,)
1509 {
1510 #[inline]
1511 unsafe fn encode(
1512 self,
1513 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1514 offset: usize,
1515 depth: fidl::encoding::Depth,
1516 ) -> fidl::Result<()> {
1517 encoder.debug_check_bounds::<EchoLauncherGetEchoResponse>(offset);
1518 self.0.encode(encoder, offset + 0, depth)?;
1522 Ok(())
1523 }
1524 }
1525
1526 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1527 for EchoLauncherGetEchoResponse
1528 {
1529 #[inline(always)]
1530 fn new_empty() -> Self {
1531 Self {
1532 response: fidl::new_empty!(
1533 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<EchoMarker>>,
1534 fdomain_client::fidl::FDomainResourceDialect
1535 ),
1536 }
1537 }
1538
1539 #[inline]
1540 unsafe fn decode(
1541 &mut self,
1542 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1543 offset: usize,
1544 _depth: fidl::encoding::Depth,
1545 ) -> fidl::Result<()> {
1546 decoder.debug_check_bounds::<Self>(offset);
1547 fidl::decode!(
1549 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<EchoMarker>>,
1550 fdomain_client::fidl::FDomainResourceDialect,
1551 &mut self.response,
1552 decoder,
1553 offset + 0,
1554 _depth
1555 )?;
1556 Ok(())
1557 }
1558 }
1559
1560 impl fidl::encoding::ResourceTypeMarker for EventStruct {
1561 type Borrowed<'a> = &'a mut Self;
1562 fn take_or_borrow<'a>(
1563 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1564 ) -> Self::Borrowed<'a> {
1565 value
1566 }
1567 }
1568
1569 unsafe impl fidl::encoding::TypeMarker for EventStruct {
1570 type Owned = Self;
1571
1572 #[inline(always)]
1573 fn inline_align(_context: fidl::encoding::Context) -> usize {
1574 4
1575 }
1576
1577 #[inline(always)]
1578 fn inline_size(_context: fidl::encoding::Context) -> usize {
1579 4
1580 }
1581 }
1582
1583 unsafe impl fidl::encoding::Encode<EventStruct, fdomain_client::fidl::FDomainResourceDialect>
1584 for &mut EventStruct
1585 {
1586 #[inline]
1587 unsafe fn encode(
1588 self,
1589 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1590 offset: usize,
1591 _depth: fidl::encoding::Depth,
1592 ) -> fidl::Result<()> {
1593 encoder.debug_check_bounds::<EventStruct>(offset);
1594 fidl::encoding::Encode::<EventStruct, fdomain_client::fidl::FDomainResourceDialect>::encode(
1596 (
1597 <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),
1598 ),
1599 encoder, offset, _depth
1600 )
1601 }
1602 }
1603 unsafe impl<
1604 T0: fidl::encoding::Encode<
1605 fidl::encoding::Optional<
1606 fidl::encoding::HandleType<
1607 fdomain_client::Event,
1608 { fidl::ObjectType::EVENT.into_raw() },
1609 2147483648,
1610 >,
1611 >,
1612 fdomain_client::fidl::FDomainResourceDialect,
1613 >,
1614 > fidl::encoding::Encode<EventStruct, fdomain_client::fidl::FDomainResourceDialect> for (T0,)
1615 {
1616 #[inline]
1617 unsafe fn encode(
1618 self,
1619 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1620 offset: usize,
1621 depth: fidl::encoding::Depth,
1622 ) -> fidl::Result<()> {
1623 encoder.debug_check_bounds::<EventStruct>(offset);
1624 self.0.encode(encoder, offset + 0, depth)?;
1628 Ok(())
1629 }
1630 }
1631
1632 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for EventStruct {
1633 #[inline(always)]
1634 fn new_empty() -> Self {
1635 Self {
1636 event: fidl::new_empty!(
1637 fidl::encoding::Optional<
1638 fidl::encoding::HandleType<
1639 fdomain_client::Event,
1640 { fidl::ObjectType::EVENT.into_raw() },
1641 2147483648,
1642 >,
1643 >,
1644 fdomain_client::fidl::FDomainResourceDialect
1645 ),
1646 }
1647 }
1648
1649 #[inline]
1650 unsafe fn decode(
1651 &mut self,
1652 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1653 offset: usize,
1654 _depth: fidl::encoding::Depth,
1655 ) -> fidl::Result<()> {
1656 decoder.debug_check_bounds::<Self>(offset);
1657 fidl::decode!(
1659 fidl::encoding::Optional<
1660 fidl::encoding::HandleType<
1661 fdomain_client::Event,
1662 { fidl::ObjectType::EVENT.into_raw() },
1663 2147483648,
1664 >,
1665 >,
1666 fdomain_client::fidl::FDomainResourceDialect,
1667 &mut self.event,
1668 decoder,
1669 offset + 0,
1670 _depth
1671 )?;
1672 Ok(())
1673 }
1674 }
1675}