1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
14#[repr(u32)]
15pub enum WantResponse {
16 Success = 1,
17 Err = 2,
18}
19
20impl WantResponse {
21 #[inline]
22 pub fn from_primitive(prim: u32) -> Option<Self> {
23 match prim {
24 1 => Some(Self::Success),
25 2 => Some(Self::Err),
26 _ => None,
27 }
28 }
29
30 #[inline]
31 pub const fn into_primitive(self) -> u32 {
32 self as u32
33 }
34
35 #[deprecated = "Strict enums should not use `is_unknown`"]
36 #[inline]
37 pub fn is_unknown(&self) -> bool {
38 false
39 }
40}
41
42#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
43pub struct ComposedEchoUnionResponseWithErrorComposedRequest {
44 pub value: i64,
45 pub want_absolute_value: bool,
46 pub forward_to_server: String,
47 pub result_err: u32,
48 pub result_variant: WantResponse,
49}
50
51impl fidl::Persistable for ComposedEchoUnionResponseWithErrorComposedRequest {}
52
53#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54pub struct ErrorableRequestStruct {
55 pub value: SimpleStruct,
56 pub result_err: u32,
57 pub forward_to_server: String,
58 pub result_variant: WantResponse,
59}
60
61impl fidl::Persistable for ErrorableRequestStruct {}
62
63#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
64pub struct EventTriggeringRequestStruct {
65 pub value: SimpleStruct,
66 pub forward_to_server: String,
67}
68
69impl fidl::Persistable for EventTriggeringRequestStruct {}
70
71#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
72pub struct RequestStruct {
73 pub value: SimpleStruct,
74 pub forward_to_server: String,
75}
76
77impl fidl::Persistable for RequestStruct {}
78
79#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
80pub struct ResponseStruct {
81 pub value: SimpleStruct,
82}
83
84impl fidl::Persistable for ResponseStruct {}
85
86#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
87pub struct SimpleStruct {
88 pub f1: bool,
89 pub f2: u64,
90}
91
92impl fidl::Persistable for SimpleStruct {}
93
94#[derive(Clone, Debug, Default, PartialEq)]
95pub struct ComposedEchoTableRequestComposedRequest {
96 pub value: Option<u64>,
97 pub forward_to_server: Option<String>,
98 #[doc(hidden)]
99 pub __source_breaking: fidl::marker::SourceBreaking,
100}
101
102impl fidl::Persistable for ComposedEchoTableRequestComposedRequest {}
103
104#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub enum ComposedEchoUnionResponseWithErrorComposedResponse {
106 Unsigned(u64),
107 Signed(i64),
108}
109
110impl ComposedEchoUnionResponseWithErrorComposedResponse {
111 #[inline]
112 pub fn ordinal(&self) -> u64 {
113 match *self {
114 Self::Unsigned(_) => 1,
115 Self::Signed(_) => 2,
116 }
117 }
118
119 #[deprecated = "Strict unions should not use `is_unknown`"]
120 #[inline]
121 pub fn is_unknown(&self) -> bool {
122 false
123 }
124}
125
126impl fidl::Persistable for ComposedEchoUnionResponseWithErrorComposedResponse {}
127
128#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
129pub struct ComposedMarker;
130
131impl fidl::endpoints::ProtocolMarker for ComposedMarker {
132 type Proxy = ComposedProxy;
133 type RequestStream = ComposedRequestStream;
134 #[cfg(target_os = "fuchsia")]
135 type SynchronousProxy = ComposedSynchronousProxy;
136
137 const DEBUG_NAME: &'static str = "(anonymous) Composed";
138}
139pub type ComposedEchoUnionResponseWithErrorComposedResult =
140 Result<ComposedEchoUnionResponseWithErrorComposedResponse, u32>;
141
142pub trait ComposedProxyInterface: Send + Sync {
143 type EchoTableRequestComposedResponseFut: std::future::Future<Output = Result<SimpleStruct, fidl::Error>>
144 + Send;
145 fn r#echo_table_request_composed(
146 &self,
147 payload: &ComposedEchoTableRequestComposedRequest,
148 ) -> Self::EchoTableRequestComposedResponseFut;
149 type EchoUnionResponseWithErrorComposedResponseFut: std::future::Future<
150 Output = Result<ComposedEchoUnionResponseWithErrorComposedResult, fidl::Error>,
151 > + Send;
152 fn r#echo_union_response_with_error_composed(
153 &self,
154 value: i64,
155 want_absolute_value: bool,
156 forward_to_server: &str,
157 result_err: u32,
158 result_variant: WantResponse,
159 ) -> Self::EchoUnionResponseWithErrorComposedResponseFut;
160}
161#[derive(Debug)]
162#[cfg(target_os = "fuchsia")]
163pub struct ComposedSynchronousProxy {
164 client: fidl::client::sync::Client,
165}
166
167#[cfg(target_os = "fuchsia")]
168impl fidl::endpoints::SynchronousProxy for ComposedSynchronousProxy {
169 type Proxy = ComposedProxy;
170 type Protocol = ComposedMarker;
171
172 fn from_channel(inner: fidl::Channel) -> Self {
173 Self::new(inner)
174 }
175
176 fn into_channel(self) -> fidl::Channel {
177 self.client.into_channel()
178 }
179
180 fn as_channel(&self) -> &fidl::Channel {
181 self.client.as_channel()
182 }
183}
184
185#[cfg(target_os = "fuchsia")]
186impl ComposedSynchronousProxy {
187 pub fn new(channel: fidl::Channel) -> Self {
188 let protocol_name = <ComposedMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
189 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
190 }
191
192 pub fn into_channel(self) -> fidl::Channel {
193 self.client.into_channel()
194 }
195
196 pub fn wait_for_event(
199 &self,
200 deadline: zx::MonotonicInstant,
201 ) -> Result<ComposedEvent, fidl::Error> {
202 ComposedEvent::decode(self.client.wait_for_event(deadline)?)
203 }
204
205 pub fn r#echo_table_request_composed(
206 &self,
207 mut payload: &ComposedEchoTableRequestComposedRequest,
208 ___deadline: zx::MonotonicInstant,
209 ) -> Result<SimpleStruct, fidl::Error> {
210 let _response =
211 self.client.send_query::<ComposedEchoTableRequestComposedRequest, ResponseStruct>(
212 payload,
213 0x1d545c738c7a8ee,
214 fidl::encoding::DynamicFlags::empty(),
215 ___deadline,
216 )?;
217 Ok(_response.value)
218 }
219
220 pub fn r#echo_union_response_with_error_composed(
221 &self,
222 mut value: i64,
223 mut want_absolute_value: bool,
224 mut forward_to_server: &str,
225 mut result_err: u32,
226 mut result_variant: WantResponse,
227 ___deadline: zx::MonotonicInstant,
228 ) -> Result<ComposedEchoUnionResponseWithErrorComposedResult, fidl::Error> {
229 let _response = self.client.send_query::<
230 ComposedEchoUnionResponseWithErrorComposedRequest,
231 fidl::encoding::ResultType<ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
232 >(
233 (value, want_absolute_value, forward_to_server, result_err, result_variant,),
234 0x38a67e88d6106443,
235 fidl::encoding::DynamicFlags::empty(),
236 ___deadline,
237 )?;
238 Ok(_response.map(|x| x))
239 }
240}
241
242#[derive(Debug, Clone)]
243pub struct ComposedProxy {
244 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
245}
246
247impl fidl::endpoints::Proxy for ComposedProxy {
248 type Protocol = ComposedMarker;
249
250 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
251 Self::new(inner)
252 }
253
254 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
255 self.client.into_channel().map_err(|client| Self { client })
256 }
257
258 fn as_channel(&self) -> &::fidl::AsyncChannel {
259 self.client.as_channel()
260 }
261}
262
263impl ComposedProxy {
264 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
266 let protocol_name = <ComposedMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
267 Self { client: fidl::client::Client::new(channel, protocol_name) }
268 }
269
270 pub fn take_event_stream(&self) -> ComposedEventStream {
276 ComposedEventStream { event_receiver: self.client.take_event_receiver() }
277 }
278
279 pub fn r#echo_table_request_composed(
280 &self,
281 mut payload: &ComposedEchoTableRequestComposedRequest,
282 ) -> fidl::client::QueryResponseFut<SimpleStruct, fidl::encoding::DefaultFuchsiaResourceDialect>
283 {
284 ComposedProxyInterface::r#echo_table_request_composed(self, payload)
285 }
286
287 pub fn r#echo_union_response_with_error_composed(
288 &self,
289 mut value: i64,
290 mut want_absolute_value: bool,
291 mut forward_to_server: &str,
292 mut result_err: u32,
293 mut result_variant: WantResponse,
294 ) -> fidl::client::QueryResponseFut<
295 ComposedEchoUnionResponseWithErrorComposedResult,
296 fidl::encoding::DefaultFuchsiaResourceDialect,
297 > {
298 ComposedProxyInterface::r#echo_union_response_with_error_composed(
299 self,
300 value,
301 want_absolute_value,
302 forward_to_server,
303 result_err,
304 result_variant,
305 )
306 }
307}
308
309impl ComposedProxyInterface for ComposedProxy {
310 type EchoTableRequestComposedResponseFut =
311 fidl::client::QueryResponseFut<SimpleStruct, fidl::encoding::DefaultFuchsiaResourceDialect>;
312 fn r#echo_table_request_composed(
313 &self,
314 mut payload: &ComposedEchoTableRequestComposedRequest,
315 ) -> Self::EchoTableRequestComposedResponseFut {
316 fn _decode(
317 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
318 ) -> Result<SimpleStruct, fidl::Error> {
319 let _response = fidl::client::decode_transaction_body::<
320 ResponseStruct,
321 fidl::encoding::DefaultFuchsiaResourceDialect,
322 0x1d545c738c7a8ee,
323 >(_buf?)?;
324 Ok(_response.value)
325 }
326 self.client.send_query_and_decode::<ComposedEchoTableRequestComposedRequest, SimpleStruct>(
327 payload,
328 0x1d545c738c7a8ee,
329 fidl::encoding::DynamicFlags::empty(),
330 _decode,
331 )
332 }
333
334 type EchoUnionResponseWithErrorComposedResponseFut = fidl::client::QueryResponseFut<
335 ComposedEchoUnionResponseWithErrorComposedResult,
336 fidl::encoding::DefaultFuchsiaResourceDialect,
337 >;
338 fn r#echo_union_response_with_error_composed(
339 &self,
340 mut value: i64,
341 mut want_absolute_value: bool,
342 mut forward_to_server: &str,
343 mut result_err: u32,
344 mut result_variant: WantResponse,
345 ) -> Self::EchoUnionResponseWithErrorComposedResponseFut {
346 fn _decode(
347 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
348 ) -> Result<ComposedEchoUnionResponseWithErrorComposedResult, fidl::Error> {
349 let _response = fidl::client::decode_transaction_body::<
350 fidl::encoding::ResultType<ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
351 fidl::encoding::DefaultFuchsiaResourceDialect,
352 0x38a67e88d6106443,
353 >(_buf?)?;
354 Ok(_response.map(|x| x))
355 }
356 self.client.send_query_and_decode::<
357 ComposedEchoUnionResponseWithErrorComposedRequest,
358 ComposedEchoUnionResponseWithErrorComposedResult,
359 >(
360 (value, want_absolute_value, forward_to_server, result_err, result_variant,),
361 0x38a67e88d6106443,
362 fidl::encoding::DynamicFlags::empty(),
363 _decode,
364 )
365 }
366}
367
368pub struct ComposedEventStream {
369 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
370}
371
372impl std::marker::Unpin for ComposedEventStream {}
373
374impl futures::stream::FusedStream for ComposedEventStream {
375 fn is_terminated(&self) -> bool {
376 self.event_receiver.is_terminated()
377 }
378}
379
380impl futures::Stream for ComposedEventStream {
381 type Item = Result<ComposedEvent, fidl::Error>;
382
383 fn poll_next(
384 mut self: std::pin::Pin<&mut Self>,
385 cx: &mut std::task::Context<'_>,
386 ) -> std::task::Poll<Option<Self::Item>> {
387 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
388 &mut self.event_receiver,
389 cx
390 )?) {
391 Some(buf) => std::task::Poll::Ready(Some(ComposedEvent::decode(buf))),
392 None => std::task::Poll::Ready(None),
393 }
394 }
395}
396
397#[derive(Debug)]
398pub enum ComposedEvent {}
399
400impl ComposedEvent {
401 fn decode(
403 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
404 ) -> Result<ComposedEvent, fidl::Error> {
405 let (bytes, _handles) = buf.split_mut();
406 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
407 debug_assert_eq!(tx_header.tx_id, 0);
408 match tx_header.ordinal {
409 _ => Err(fidl::Error::UnknownOrdinal {
410 ordinal: tx_header.ordinal,
411 protocol_name: <ComposedMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
412 }),
413 }
414 }
415}
416
417pub struct ComposedRequestStream {
419 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
420 is_terminated: bool,
421}
422
423impl std::marker::Unpin for ComposedRequestStream {}
424
425impl futures::stream::FusedStream for ComposedRequestStream {
426 fn is_terminated(&self) -> bool {
427 self.is_terminated
428 }
429}
430
431impl fidl::endpoints::RequestStream for ComposedRequestStream {
432 type Protocol = ComposedMarker;
433 type ControlHandle = ComposedControlHandle;
434
435 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
436 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
437 }
438
439 fn control_handle(&self) -> Self::ControlHandle {
440 ComposedControlHandle { inner: self.inner.clone() }
441 }
442
443 fn into_inner(
444 self,
445 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
446 {
447 (self.inner, self.is_terminated)
448 }
449
450 fn from_inner(
451 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
452 is_terminated: bool,
453 ) -> Self {
454 Self { inner, is_terminated }
455 }
456}
457
458impl futures::Stream for ComposedRequestStream {
459 type Item = Result<ComposedRequest, fidl::Error>;
460
461 fn poll_next(
462 mut self: std::pin::Pin<&mut Self>,
463 cx: &mut std::task::Context<'_>,
464 ) -> std::task::Poll<Option<Self::Item>> {
465 let this = &mut *self;
466 if this.inner.check_shutdown(cx) {
467 this.is_terminated = true;
468 return std::task::Poll::Ready(None);
469 }
470 if this.is_terminated {
471 panic!("polled ComposedRequestStream after completion");
472 }
473 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
474 |bytes, handles| {
475 match this.inner.channel().read_etc(cx, bytes, handles) {
476 std::task::Poll::Ready(Ok(())) => {}
477 std::task::Poll::Pending => return std::task::Poll::Pending,
478 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
479 this.is_terminated = true;
480 return std::task::Poll::Ready(None);
481 }
482 std::task::Poll::Ready(Err(e)) => {
483 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
484 e.into(),
485 ))))
486 }
487 }
488
489 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
491
492 std::task::Poll::Ready(Some(match header.ordinal {
493 0x1d545c738c7a8ee => {
494 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
495 let mut req = fidl::new_empty!(
496 ComposedEchoTableRequestComposedRequest,
497 fidl::encoding::DefaultFuchsiaResourceDialect
498 );
499 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedEchoTableRequestComposedRequest>(&header, _body_bytes, handles, &mut req)?;
500 let control_handle = ComposedControlHandle { inner: this.inner.clone() };
501 Ok(ComposedRequest::EchoTableRequestComposed {
502 payload: req,
503 responder: ComposedEchoTableRequestComposedResponder {
504 control_handle: std::mem::ManuallyDrop::new(control_handle),
505 tx_id: header.tx_id,
506 },
507 })
508 }
509 0x38a67e88d6106443 => {
510 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
511 let mut req = fidl::new_empty!(
512 ComposedEchoUnionResponseWithErrorComposedRequest,
513 fidl::encoding::DefaultFuchsiaResourceDialect
514 );
515 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ComposedEchoUnionResponseWithErrorComposedRequest>(&header, _body_bytes, handles, &mut req)?;
516 let control_handle = ComposedControlHandle { inner: this.inner.clone() };
517 Ok(ComposedRequest::EchoUnionResponseWithErrorComposed {
518 value: req.value,
519 want_absolute_value: req.want_absolute_value,
520 forward_to_server: req.forward_to_server,
521 result_err: req.result_err,
522 result_variant: req.result_variant,
523
524 responder: ComposedEchoUnionResponseWithErrorComposedResponder {
525 control_handle: std::mem::ManuallyDrop::new(control_handle),
526 tx_id: header.tx_id,
527 },
528 })
529 }
530 _ => Err(fidl::Error::UnknownOrdinal {
531 ordinal: header.ordinal,
532 protocol_name:
533 <ComposedMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
534 }),
535 }))
536 },
537 )
538 }
539}
540
541#[derive(Debug)]
542pub enum ComposedRequest {
543 EchoTableRequestComposed {
544 payload: ComposedEchoTableRequestComposedRequest,
545 responder: ComposedEchoTableRequestComposedResponder,
546 },
547 EchoUnionResponseWithErrorComposed {
548 value: i64,
549 want_absolute_value: bool,
550 forward_to_server: String,
551 result_err: u32,
552 result_variant: WantResponse,
553 responder: ComposedEchoUnionResponseWithErrorComposedResponder,
554 },
555}
556
557impl ComposedRequest {
558 #[allow(irrefutable_let_patterns)]
559 pub fn into_echo_table_request_composed(
560 self,
561 ) -> Option<(ComposedEchoTableRequestComposedRequest, ComposedEchoTableRequestComposedResponder)>
562 {
563 if let ComposedRequest::EchoTableRequestComposed { payload, responder } = self {
564 Some((payload, responder))
565 } else {
566 None
567 }
568 }
569
570 #[allow(irrefutable_let_patterns)]
571 pub fn into_echo_union_response_with_error_composed(
572 self,
573 ) -> Option<(
574 i64,
575 bool,
576 String,
577 u32,
578 WantResponse,
579 ComposedEchoUnionResponseWithErrorComposedResponder,
580 )> {
581 if let ComposedRequest::EchoUnionResponseWithErrorComposed {
582 value,
583 want_absolute_value,
584 forward_to_server,
585 result_err,
586 result_variant,
587 responder,
588 } = self
589 {
590 Some((
591 value,
592 want_absolute_value,
593 forward_to_server,
594 result_err,
595 result_variant,
596 responder,
597 ))
598 } else {
599 None
600 }
601 }
602
603 pub fn method_name(&self) -> &'static str {
605 match *self {
606 ComposedRequest::EchoTableRequestComposed { .. } => "echo_table_request_composed",
607 ComposedRequest::EchoUnionResponseWithErrorComposed { .. } => {
608 "echo_union_response_with_error_composed"
609 }
610 }
611 }
612}
613
614#[derive(Debug, Clone)]
615pub struct ComposedControlHandle {
616 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
617}
618
619impl fidl::endpoints::ControlHandle for ComposedControlHandle {
620 fn shutdown(&self) {
621 self.inner.shutdown()
622 }
623 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
624 self.inner.shutdown_with_epitaph(status)
625 }
626
627 fn is_closed(&self) -> bool {
628 self.inner.channel().is_closed()
629 }
630 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
631 self.inner.channel().on_closed()
632 }
633
634 #[cfg(target_os = "fuchsia")]
635 fn signal_peer(
636 &self,
637 clear_mask: zx::Signals,
638 set_mask: zx::Signals,
639 ) -> Result<(), zx_status::Status> {
640 use fidl::Peered;
641 self.inner.channel().signal_peer(clear_mask, set_mask)
642 }
643}
644
645impl ComposedControlHandle {}
646
647#[must_use = "FIDL methods require a response to be sent"]
648#[derive(Debug)]
649pub struct ComposedEchoTableRequestComposedResponder {
650 control_handle: std::mem::ManuallyDrop<ComposedControlHandle>,
651 tx_id: u32,
652}
653
654impl std::ops::Drop for ComposedEchoTableRequestComposedResponder {
658 fn drop(&mut self) {
659 self.control_handle.shutdown();
660 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
662 }
663}
664
665impl fidl::endpoints::Responder for ComposedEchoTableRequestComposedResponder {
666 type ControlHandle = ComposedControlHandle;
667
668 fn control_handle(&self) -> &ComposedControlHandle {
669 &self.control_handle
670 }
671
672 fn drop_without_shutdown(mut self) {
673 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
675 std::mem::forget(self);
677 }
678}
679
680impl ComposedEchoTableRequestComposedResponder {
681 pub fn send(self, mut value: &SimpleStruct) -> Result<(), fidl::Error> {
685 let _result = self.send_raw(value);
686 if _result.is_err() {
687 self.control_handle.shutdown();
688 }
689 self.drop_without_shutdown();
690 _result
691 }
692
693 pub fn send_no_shutdown_on_err(self, mut value: &SimpleStruct) -> Result<(), fidl::Error> {
695 let _result = self.send_raw(value);
696 self.drop_without_shutdown();
697 _result
698 }
699
700 fn send_raw(&self, mut value: &SimpleStruct) -> Result<(), fidl::Error> {
701 self.control_handle.inner.send::<ResponseStruct>(
702 (value,),
703 self.tx_id,
704 0x1d545c738c7a8ee,
705 fidl::encoding::DynamicFlags::empty(),
706 )
707 }
708}
709
710#[must_use = "FIDL methods require a response to be sent"]
711#[derive(Debug)]
712pub struct ComposedEchoUnionResponseWithErrorComposedResponder {
713 control_handle: std::mem::ManuallyDrop<ComposedControlHandle>,
714 tx_id: u32,
715}
716
717impl std::ops::Drop for ComposedEchoUnionResponseWithErrorComposedResponder {
721 fn drop(&mut self) {
722 self.control_handle.shutdown();
723 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
725 }
726}
727
728impl fidl::endpoints::Responder for ComposedEchoUnionResponseWithErrorComposedResponder {
729 type ControlHandle = ComposedControlHandle;
730
731 fn control_handle(&self) -> &ComposedControlHandle {
732 &self.control_handle
733 }
734
735 fn drop_without_shutdown(mut self) {
736 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
738 std::mem::forget(self);
740 }
741}
742
743impl ComposedEchoUnionResponseWithErrorComposedResponder {
744 pub fn send(
748 self,
749 mut result: Result<&ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
750 ) -> Result<(), fidl::Error> {
751 let _result = self.send_raw(result);
752 if _result.is_err() {
753 self.control_handle.shutdown();
754 }
755 self.drop_without_shutdown();
756 _result
757 }
758
759 pub fn send_no_shutdown_on_err(
761 self,
762 mut result: Result<&ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
763 ) -> Result<(), fidl::Error> {
764 let _result = self.send_raw(result);
765 self.drop_without_shutdown();
766 _result
767 }
768
769 fn send_raw(
770 &self,
771 mut result: Result<&ComposedEchoUnionResponseWithErrorComposedResponse, u32>,
772 ) -> Result<(), fidl::Error> {
773 self.control_handle.inner.send::<fidl::encoding::ResultType<
774 ComposedEchoUnionResponseWithErrorComposedResponse,
775 u32,
776 >>(
777 result,
778 self.tx_id,
779 0x38a67e88d6106443,
780 fidl::encoding::DynamicFlags::empty(),
781 )
782 }
783}
784
785mod internal {
786 use super::*;
787 unsafe impl fidl::encoding::TypeMarker for WantResponse {
788 type Owned = Self;
789
790 #[inline(always)]
791 fn inline_align(_context: fidl::encoding::Context) -> usize {
792 std::mem::align_of::<u32>()
793 }
794
795 #[inline(always)]
796 fn inline_size(_context: fidl::encoding::Context) -> usize {
797 std::mem::size_of::<u32>()
798 }
799
800 #[inline(always)]
801 fn encode_is_copy() -> bool {
802 true
803 }
804
805 #[inline(always)]
806 fn decode_is_copy() -> bool {
807 false
808 }
809 }
810
811 impl fidl::encoding::ValueTypeMarker for WantResponse {
812 type Borrowed<'a> = Self;
813 #[inline(always)]
814 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
815 *value
816 }
817 }
818
819 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WantResponse {
820 #[inline]
821 unsafe fn encode(
822 self,
823 encoder: &mut fidl::encoding::Encoder<'_, D>,
824 offset: usize,
825 _depth: fidl::encoding::Depth,
826 ) -> fidl::Result<()> {
827 encoder.debug_check_bounds::<Self>(offset);
828 encoder.write_num(self.into_primitive(), offset);
829 Ok(())
830 }
831 }
832
833 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WantResponse {
834 #[inline(always)]
835 fn new_empty() -> Self {
836 Self::Success
837 }
838
839 #[inline]
840 unsafe fn decode(
841 &mut self,
842 decoder: &mut fidl::encoding::Decoder<'_, D>,
843 offset: usize,
844 _depth: fidl::encoding::Depth,
845 ) -> fidl::Result<()> {
846 decoder.debug_check_bounds::<Self>(offset);
847 let prim = decoder.read_num::<u32>(offset);
848
849 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
850 Ok(())
851 }
852 }
853
854 impl fidl::encoding::ValueTypeMarker for ComposedEchoUnionResponseWithErrorComposedRequest {
855 type Borrowed<'a> = &'a Self;
856 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
857 value
858 }
859 }
860
861 unsafe impl fidl::encoding::TypeMarker for ComposedEchoUnionResponseWithErrorComposedRequest {
862 type Owned = Self;
863
864 #[inline(always)]
865 fn inline_align(_context: fidl::encoding::Context) -> usize {
866 8
867 }
868
869 #[inline(always)]
870 fn inline_size(_context: fidl::encoding::Context) -> usize {
871 40
872 }
873 }
874
875 unsafe impl<D: fidl::encoding::ResourceDialect>
876 fidl::encoding::Encode<ComposedEchoUnionResponseWithErrorComposedRequest, D>
877 for &ComposedEchoUnionResponseWithErrorComposedRequest
878 {
879 #[inline]
880 unsafe fn encode(
881 self,
882 encoder: &mut fidl::encoding::Encoder<'_, D>,
883 offset: usize,
884 _depth: fidl::encoding::Depth,
885 ) -> fidl::Result<()> {
886 encoder.debug_check_bounds::<ComposedEchoUnionResponseWithErrorComposedRequest>(offset);
887 fidl::encoding::Encode::<ComposedEchoUnionResponseWithErrorComposedRequest, D>::encode(
889 (
890 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
891 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_absolute_value),
892 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
893 &self.forward_to_server,
894 ),
895 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.result_err),
896 <WantResponse as fidl::encoding::ValueTypeMarker>::borrow(&self.result_variant),
897 ),
898 encoder,
899 offset,
900 _depth,
901 )
902 }
903 }
904 unsafe impl<
905 D: fidl::encoding::ResourceDialect,
906 T0: fidl::encoding::Encode<i64, D>,
907 T1: fidl::encoding::Encode<bool, D>,
908 T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
909 T3: fidl::encoding::Encode<u32, D>,
910 T4: fidl::encoding::Encode<WantResponse, D>,
911 > fidl::encoding::Encode<ComposedEchoUnionResponseWithErrorComposedRequest, D>
912 for (T0, T1, T2, T3, T4)
913 {
914 #[inline]
915 unsafe fn encode(
916 self,
917 encoder: &mut fidl::encoding::Encoder<'_, D>,
918 offset: usize,
919 depth: fidl::encoding::Depth,
920 ) -> fidl::Result<()> {
921 encoder.debug_check_bounds::<ComposedEchoUnionResponseWithErrorComposedRequest>(offset);
922 unsafe {
925 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
926 (ptr as *mut u64).write_unaligned(0);
927 }
928 self.0.encode(encoder, offset + 0, depth)?;
930 self.1.encode(encoder, offset + 8, depth)?;
931 self.2.encode(encoder, offset + 16, depth)?;
932 self.3.encode(encoder, offset + 32, depth)?;
933 self.4.encode(encoder, offset + 36, depth)?;
934 Ok(())
935 }
936 }
937
938 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
939 for ComposedEchoUnionResponseWithErrorComposedRequest
940 {
941 #[inline(always)]
942 fn new_empty() -> Self {
943 Self {
944 value: fidl::new_empty!(i64, D),
945 want_absolute_value: fidl::new_empty!(bool, D),
946 forward_to_server: fidl::new_empty!(fidl::encoding::UnboundedString, D),
947 result_err: fidl::new_empty!(u32, D),
948 result_variant: fidl::new_empty!(WantResponse, D),
949 }
950 }
951
952 #[inline]
953 unsafe fn decode(
954 &mut self,
955 decoder: &mut fidl::encoding::Decoder<'_, D>,
956 offset: usize,
957 _depth: fidl::encoding::Depth,
958 ) -> fidl::Result<()> {
959 decoder.debug_check_bounds::<Self>(offset);
960 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
962 let padval = unsafe { (ptr as *const u64).read_unaligned() };
963 let mask = 0xffffffffffffff00u64;
964 let maskedval = padval & mask;
965 if maskedval != 0 {
966 return Err(fidl::Error::NonZeroPadding {
967 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
968 });
969 }
970 fidl::decode!(i64, D, &mut self.value, decoder, offset + 0, _depth)?;
971 fidl::decode!(bool, D, &mut self.want_absolute_value, decoder, offset + 8, _depth)?;
972 fidl::decode!(
973 fidl::encoding::UnboundedString,
974 D,
975 &mut self.forward_to_server,
976 decoder,
977 offset + 16,
978 _depth
979 )?;
980 fidl::decode!(u32, D, &mut self.result_err, decoder, offset + 32, _depth)?;
981 fidl::decode!(WantResponse, D, &mut self.result_variant, decoder, offset + 36, _depth)?;
982 Ok(())
983 }
984 }
985
986 impl fidl::encoding::ValueTypeMarker for ErrorableRequestStruct {
987 type Borrowed<'a> = &'a Self;
988 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
989 value
990 }
991 }
992
993 unsafe impl fidl::encoding::TypeMarker for ErrorableRequestStruct {
994 type Owned = Self;
995
996 #[inline(always)]
997 fn inline_align(_context: fidl::encoding::Context) -> usize {
998 8
999 }
1000
1001 #[inline(always)]
1002 fn inline_size(_context: fidl::encoding::Context) -> usize {
1003 48
1004 }
1005 }
1006
1007 unsafe impl<D: fidl::encoding::ResourceDialect>
1008 fidl::encoding::Encode<ErrorableRequestStruct, D> for &ErrorableRequestStruct
1009 {
1010 #[inline]
1011 unsafe fn encode(
1012 self,
1013 encoder: &mut fidl::encoding::Encoder<'_, D>,
1014 offset: usize,
1015 _depth: fidl::encoding::Depth,
1016 ) -> fidl::Result<()> {
1017 encoder.debug_check_bounds::<ErrorableRequestStruct>(offset);
1018 fidl::encoding::Encode::<ErrorableRequestStruct, D>::encode(
1020 (
1021 <SimpleStruct as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1022 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.result_err),
1023 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1024 &self.forward_to_server,
1025 ),
1026 <WantResponse as fidl::encoding::ValueTypeMarker>::borrow(&self.result_variant),
1027 ),
1028 encoder,
1029 offset,
1030 _depth,
1031 )
1032 }
1033 }
1034 unsafe impl<
1035 D: fidl::encoding::ResourceDialect,
1036 T0: fidl::encoding::Encode<SimpleStruct, D>,
1037 T1: fidl::encoding::Encode<u32, D>,
1038 T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1039 T3: fidl::encoding::Encode<WantResponse, D>,
1040 > fidl::encoding::Encode<ErrorableRequestStruct, D> for (T0, T1, T2, T3)
1041 {
1042 #[inline]
1043 unsafe fn encode(
1044 self,
1045 encoder: &mut fidl::encoding::Encoder<'_, D>,
1046 offset: usize,
1047 depth: fidl::encoding::Depth,
1048 ) -> fidl::Result<()> {
1049 encoder.debug_check_bounds::<ErrorableRequestStruct>(offset);
1050 unsafe {
1053 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1054 (ptr as *mut u64).write_unaligned(0);
1055 }
1056 unsafe {
1057 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
1058 (ptr as *mut u64).write_unaligned(0);
1059 }
1060 self.0.encode(encoder, offset + 0, depth)?;
1062 self.1.encode(encoder, offset + 16, depth)?;
1063 self.2.encode(encoder, offset + 24, depth)?;
1064 self.3.encode(encoder, offset + 40, depth)?;
1065 Ok(())
1066 }
1067 }
1068
1069 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1070 for ErrorableRequestStruct
1071 {
1072 #[inline(always)]
1073 fn new_empty() -> Self {
1074 Self {
1075 value: fidl::new_empty!(SimpleStruct, D),
1076 result_err: fidl::new_empty!(u32, D),
1077 forward_to_server: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1078 result_variant: fidl::new_empty!(WantResponse, D),
1079 }
1080 }
1081
1082 #[inline]
1083 unsafe fn decode(
1084 &mut self,
1085 decoder: &mut fidl::encoding::Decoder<'_, D>,
1086 offset: usize,
1087 _depth: fidl::encoding::Depth,
1088 ) -> fidl::Result<()> {
1089 decoder.debug_check_bounds::<Self>(offset);
1090 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1092 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1093 let mask = 0xffffffff00000000u64;
1094 let maskedval = padval & mask;
1095 if maskedval != 0 {
1096 return Err(fidl::Error::NonZeroPadding {
1097 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1098 });
1099 }
1100 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
1101 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1102 let mask = 0xffffffff00000000u64;
1103 let maskedval = padval & mask;
1104 if maskedval != 0 {
1105 return Err(fidl::Error::NonZeroPadding {
1106 padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
1107 });
1108 }
1109 fidl::decode!(SimpleStruct, D, &mut self.value, decoder, offset + 0, _depth)?;
1110 fidl::decode!(u32, D, &mut self.result_err, decoder, offset + 16, _depth)?;
1111 fidl::decode!(
1112 fidl::encoding::UnboundedString,
1113 D,
1114 &mut self.forward_to_server,
1115 decoder,
1116 offset + 24,
1117 _depth
1118 )?;
1119 fidl::decode!(WantResponse, D, &mut self.result_variant, decoder, offset + 40, _depth)?;
1120 Ok(())
1121 }
1122 }
1123
1124 impl fidl::encoding::ValueTypeMarker for EventTriggeringRequestStruct {
1125 type Borrowed<'a> = &'a Self;
1126 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1127 value
1128 }
1129 }
1130
1131 unsafe impl fidl::encoding::TypeMarker for EventTriggeringRequestStruct {
1132 type Owned = Self;
1133
1134 #[inline(always)]
1135 fn inline_align(_context: fidl::encoding::Context) -> usize {
1136 8
1137 }
1138
1139 #[inline(always)]
1140 fn inline_size(_context: fidl::encoding::Context) -> usize {
1141 32
1142 }
1143 }
1144
1145 unsafe impl<D: fidl::encoding::ResourceDialect>
1146 fidl::encoding::Encode<EventTriggeringRequestStruct, D> for &EventTriggeringRequestStruct
1147 {
1148 #[inline]
1149 unsafe fn encode(
1150 self,
1151 encoder: &mut fidl::encoding::Encoder<'_, D>,
1152 offset: usize,
1153 _depth: fidl::encoding::Depth,
1154 ) -> fidl::Result<()> {
1155 encoder.debug_check_bounds::<EventTriggeringRequestStruct>(offset);
1156 fidl::encoding::Encode::<EventTriggeringRequestStruct, D>::encode(
1158 (
1159 <SimpleStruct as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1160 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1161 &self.forward_to_server,
1162 ),
1163 ),
1164 encoder,
1165 offset,
1166 _depth,
1167 )
1168 }
1169 }
1170 unsafe impl<
1171 D: fidl::encoding::ResourceDialect,
1172 T0: fidl::encoding::Encode<SimpleStruct, D>,
1173 T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1174 > fidl::encoding::Encode<EventTriggeringRequestStruct, D> for (T0, T1)
1175 {
1176 #[inline]
1177 unsafe fn encode(
1178 self,
1179 encoder: &mut fidl::encoding::Encoder<'_, D>,
1180 offset: usize,
1181 depth: fidl::encoding::Depth,
1182 ) -> fidl::Result<()> {
1183 encoder.debug_check_bounds::<EventTriggeringRequestStruct>(offset);
1184 self.0.encode(encoder, offset + 0, depth)?;
1188 self.1.encode(encoder, offset + 16, depth)?;
1189 Ok(())
1190 }
1191 }
1192
1193 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1194 for EventTriggeringRequestStruct
1195 {
1196 #[inline(always)]
1197 fn new_empty() -> Self {
1198 Self {
1199 value: fidl::new_empty!(SimpleStruct, D),
1200 forward_to_server: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1201 }
1202 }
1203
1204 #[inline]
1205 unsafe fn decode(
1206 &mut self,
1207 decoder: &mut fidl::encoding::Decoder<'_, D>,
1208 offset: usize,
1209 _depth: fidl::encoding::Depth,
1210 ) -> fidl::Result<()> {
1211 decoder.debug_check_bounds::<Self>(offset);
1212 fidl::decode!(SimpleStruct, D, &mut self.value, decoder, offset + 0, _depth)?;
1214 fidl::decode!(
1215 fidl::encoding::UnboundedString,
1216 D,
1217 &mut self.forward_to_server,
1218 decoder,
1219 offset + 16,
1220 _depth
1221 )?;
1222 Ok(())
1223 }
1224 }
1225
1226 impl fidl::encoding::ValueTypeMarker for RequestStruct {
1227 type Borrowed<'a> = &'a Self;
1228 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1229 value
1230 }
1231 }
1232
1233 unsafe impl fidl::encoding::TypeMarker for RequestStruct {
1234 type Owned = Self;
1235
1236 #[inline(always)]
1237 fn inline_align(_context: fidl::encoding::Context) -> usize {
1238 8
1239 }
1240
1241 #[inline(always)]
1242 fn inline_size(_context: fidl::encoding::Context) -> usize {
1243 32
1244 }
1245 }
1246
1247 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RequestStruct, D>
1248 for &RequestStruct
1249 {
1250 #[inline]
1251 unsafe fn encode(
1252 self,
1253 encoder: &mut fidl::encoding::Encoder<'_, D>,
1254 offset: usize,
1255 _depth: fidl::encoding::Depth,
1256 ) -> fidl::Result<()> {
1257 encoder.debug_check_bounds::<RequestStruct>(offset);
1258 fidl::encoding::Encode::<RequestStruct, D>::encode(
1260 (
1261 <SimpleStruct as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1262 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1263 &self.forward_to_server,
1264 ),
1265 ),
1266 encoder,
1267 offset,
1268 _depth,
1269 )
1270 }
1271 }
1272 unsafe impl<
1273 D: fidl::encoding::ResourceDialect,
1274 T0: fidl::encoding::Encode<SimpleStruct, D>,
1275 T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1276 > fidl::encoding::Encode<RequestStruct, D> for (T0, T1)
1277 {
1278 #[inline]
1279 unsafe fn encode(
1280 self,
1281 encoder: &mut fidl::encoding::Encoder<'_, D>,
1282 offset: usize,
1283 depth: fidl::encoding::Depth,
1284 ) -> fidl::Result<()> {
1285 encoder.debug_check_bounds::<RequestStruct>(offset);
1286 self.0.encode(encoder, offset + 0, depth)?;
1290 self.1.encode(encoder, offset + 16, depth)?;
1291 Ok(())
1292 }
1293 }
1294
1295 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RequestStruct {
1296 #[inline(always)]
1297 fn new_empty() -> Self {
1298 Self {
1299 value: fidl::new_empty!(SimpleStruct, D),
1300 forward_to_server: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1301 }
1302 }
1303
1304 #[inline]
1305 unsafe fn decode(
1306 &mut self,
1307 decoder: &mut fidl::encoding::Decoder<'_, D>,
1308 offset: usize,
1309 _depth: fidl::encoding::Depth,
1310 ) -> fidl::Result<()> {
1311 decoder.debug_check_bounds::<Self>(offset);
1312 fidl::decode!(SimpleStruct, D, &mut self.value, decoder, offset + 0, _depth)?;
1314 fidl::decode!(
1315 fidl::encoding::UnboundedString,
1316 D,
1317 &mut self.forward_to_server,
1318 decoder,
1319 offset + 16,
1320 _depth
1321 )?;
1322 Ok(())
1323 }
1324 }
1325
1326 impl fidl::encoding::ValueTypeMarker for ResponseStruct {
1327 type Borrowed<'a> = &'a Self;
1328 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1329 value
1330 }
1331 }
1332
1333 unsafe impl fidl::encoding::TypeMarker for ResponseStruct {
1334 type Owned = Self;
1335
1336 #[inline(always)]
1337 fn inline_align(_context: fidl::encoding::Context) -> usize {
1338 8
1339 }
1340
1341 #[inline(always)]
1342 fn inline_size(_context: fidl::encoding::Context) -> usize {
1343 16
1344 }
1345 }
1346
1347 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ResponseStruct, D>
1348 for &ResponseStruct
1349 {
1350 #[inline]
1351 unsafe fn encode(
1352 self,
1353 encoder: &mut fidl::encoding::Encoder<'_, D>,
1354 offset: usize,
1355 _depth: fidl::encoding::Depth,
1356 ) -> fidl::Result<()> {
1357 encoder.debug_check_bounds::<ResponseStruct>(offset);
1358 fidl::encoding::Encode::<ResponseStruct, D>::encode(
1360 (<SimpleStruct as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1361 encoder,
1362 offset,
1363 _depth,
1364 )
1365 }
1366 }
1367 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SimpleStruct, D>>
1368 fidl::encoding::Encode<ResponseStruct, D> for (T0,)
1369 {
1370 #[inline]
1371 unsafe fn encode(
1372 self,
1373 encoder: &mut fidl::encoding::Encoder<'_, D>,
1374 offset: usize,
1375 depth: fidl::encoding::Depth,
1376 ) -> fidl::Result<()> {
1377 encoder.debug_check_bounds::<ResponseStruct>(offset);
1378 self.0.encode(encoder, offset + 0, depth)?;
1382 Ok(())
1383 }
1384 }
1385
1386 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResponseStruct {
1387 #[inline(always)]
1388 fn new_empty() -> Self {
1389 Self { value: fidl::new_empty!(SimpleStruct, D) }
1390 }
1391
1392 #[inline]
1393 unsafe fn decode(
1394 &mut self,
1395 decoder: &mut fidl::encoding::Decoder<'_, D>,
1396 offset: usize,
1397 _depth: fidl::encoding::Depth,
1398 ) -> fidl::Result<()> {
1399 decoder.debug_check_bounds::<Self>(offset);
1400 fidl::decode!(SimpleStruct, D, &mut self.value, decoder, offset + 0, _depth)?;
1402 Ok(())
1403 }
1404 }
1405
1406 impl fidl::encoding::ValueTypeMarker for SimpleStruct {
1407 type Borrowed<'a> = &'a Self;
1408 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1409 value
1410 }
1411 }
1412
1413 unsafe impl fidl::encoding::TypeMarker for SimpleStruct {
1414 type Owned = Self;
1415
1416 #[inline(always)]
1417 fn inline_align(_context: fidl::encoding::Context) -> usize {
1418 8
1419 }
1420
1421 #[inline(always)]
1422 fn inline_size(_context: fidl::encoding::Context) -> usize {
1423 16
1424 }
1425 }
1426
1427 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SimpleStruct, D>
1428 for &SimpleStruct
1429 {
1430 #[inline]
1431 unsafe fn encode(
1432 self,
1433 encoder: &mut fidl::encoding::Encoder<'_, D>,
1434 offset: usize,
1435 _depth: fidl::encoding::Depth,
1436 ) -> fidl::Result<()> {
1437 encoder.debug_check_bounds::<SimpleStruct>(offset);
1438 fidl::encoding::Encode::<SimpleStruct, D>::encode(
1440 (
1441 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.f1),
1442 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.f2),
1443 ),
1444 encoder,
1445 offset,
1446 _depth,
1447 )
1448 }
1449 }
1450 unsafe impl<
1451 D: fidl::encoding::ResourceDialect,
1452 T0: fidl::encoding::Encode<bool, D>,
1453 T1: fidl::encoding::Encode<u64, D>,
1454 > fidl::encoding::Encode<SimpleStruct, D> for (T0, T1)
1455 {
1456 #[inline]
1457 unsafe fn encode(
1458 self,
1459 encoder: &mut fidl::encoding::Encoder<'_, D>,
1460 offset: usize,
1461 depth: fidl::encoding::Depth,
1462 ) -> fidl::Result<()> {
1463 encoder.debug_check_bounds::<SimpleStruct>(offset);
1464 unsafe {
1467 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1468 (ptr as *mut u64).write_unaligned(0);
1469 }
1470 self.0.encode(encoder, offset + 0, depth)?;
1472 self.1.encode(encoder, offset + 8, depth)?;
1473 Ok(())
1474 }
1475 }
1476
1477 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SimpleStruct {
1478 #[inline(always)]
1479 fn new_empty() -> Self {
1480 Self { f1: fidl::new_empty!(bool, D), f2: fidl::new_empty!(u64, D) }
1481 }
1482
1483 #[inline]
1484 unsafe fn decode(
1485 &mut self,
1486 decoder: &mut fidl::encoding::Decoder<'_, D>,
1487 offset: usize,
1488 _depth: fidl::encoding::Depth,
1489 ) -> fidl::Result<()> {
1490 decoder.debug_check_bounds::<Self>(offset);
1491 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1493 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1494 let mask = 0xffffffffffffff00u64;
1495 let maskedval = padval & mask;
1496 if maskedval != 0 {
1497 return Err(fidl::Error::NonZeroPadding {
1498 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1499 });
1500 }
1501 fidl::decode!(bool, D, &mut self.f1, decoder, offset + 0, _depth)?;
1502 fidl::decode!(u64, D, &mut self.f2, decoder, offset + 8, _depth)?;
1503 Ok(())
1504 }
1505 }
1506
1507 impl ComposedEchoTableRequestComposedRequest {
1508 #[inline(always)]
1509 fn max_ordinal_present(&self) -> u64 {
1510 if let Some(_) = self.forward_to_server {
1511 return 2;
1512 }
1513 if let Some(_) = self.value {
1514 return 1;
1515 }
1516 0
1517 }
1518 }
1519
1520 impl fidl::encoding::ValueTypeMarker for ComposedEchoTableRequestComposedRequest {
1521 type Borrowed<'a> = &'a Self;
1522 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1523 value
1524 }
1525 }
1526
1527 unsafe impl fidl::encoding::TypeMarker for ComposedEchoTableRequestComposedRequest {
1528 type Owned = Self;
1529
1530 #[inline(always)]
1531 fn inline_align(_context: fidl::encoding::Context) -> usize {
1532 8
1533 }
1534
1535 #[inline(always)]
1536 fn inline_size(_context: fidl::encoding::Context) -> usize {
1537 16
1538 }
1539 }
1540
1541 unsafe impl<D: fidl::encoding::ResourceDialect>
1542 fidl::encoding::Encode<ComposedEchoTableRequestComposedRequest, D>
1543 for &ComposedEchoTableRequestComposedRequest
1544 {
1545 unsafe fn encode(
1546 self,
1547 encoder: &mut fidl::encoding::Encoder<'_, D>,
1548 offset: usize,
1549 mut depth: fidl::encoding::Depth,
1550 ) -> fidl::Result<()> {
1551 encoder.debug_check_bounds::<ComposedEchoTableRequestComposedRequest>(offset);
1552 let max_ordinal: u64 = self.max_ordinal_present();
1554 encoder.write_num(max_ordinal, offset);
1555 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1556 if max_ordinal == 0 {
1558 return Ok(());
1559 }
1560 depth.increment()?;
1561 let envelope_size = 8;
1562 let bytes_len = max_ordinal as usize * envelope_size;
1563 #[allow(unused_variables)]
1564 let offset = encoder.out_of_line_offset(bytes_len);
1565 let mut _prev_end_offset: usize = 0;
1566 if 1 > max_ordinal {
1567 return Ok(());
1568 }
1569
1570 let cur_offset: usize = (1 - 1) * envelope_size;
1573
1574 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1576
1577 fidl::encoding::encode_in_envelope_optional::<u64, D>(
1582 self.value.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1583 encoder,
1584 offset + cur_offset,
1585 depth,
1586 )?;
1587
1588 _prev_end_offset = cur_offset + envelope_size;
1589 if 2 > max_ordinal {
1590 return Ok(());
1591 }
1592
1593 let cur_offset: usize = (2 - 1) * envelope_size;
1596
1597 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1599
1600 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
1605 self.forward_to_server.as_ref().map(
1606 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
1607 ),
1608 encoder,
1609 offset + cur_offset,
1610 depth,
1611 )?;
1612
1613 _prev_end_offset = cur_offset + envelope_size;
1614
1615 Ok(())
1616 }
1617 }
1618
1619 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1620 for ComposedEchoTableRequestComposedRequest
1621 {
1622 #[inline(always)]
1623 fn new_empty() -> Self {
1624 Self::default()
1625 }
1626
1627 unsafe fn decode(
1628 &mut self,
1629 decoder: &mut fidl::encoding::Decoder<'_, D>,
1630 offset: usize,
1631 mut depth: fidl::encoding::Depth,
1632 ) -> fidl::Result<()> {
1633 decoder.debug_check_bounds::<Self>(offset);
1634 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1635 None => return Err(fidl::Error::NotNullable),
1636 Some(len) => len,
1637 };
1638 if len == 0 {
1640 return Ok(());
1641 };
1642 depth.increment()?;
1643 let envelope_size = 8;
1644 let bytes_len = len * envelope_size;
1645 let offset = decoder.out_of_line_offset(bytes_len)?;
1646 let mut _next_ordinal_to_read = 0;
1648 let mut next_offset = offset;
1649 let end_offset = offset + bytes_len;
1650 _next_ordinal_to_read += 1;
1651 if next_offset >= end_offset {
1652 return Ok(());
1653 }
1654
1655 while _next_ordinal_to_read < 1 {
1657 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1658 _next_ordinal_to_read += 1;
1659 next_offset += envelope_size;
1660 }
1661
1662 let next_out_of_line = decoder.next_out_of_line();
1663 let handles_before = decoder.remaining_handles();
1664 if let Some((inlined, num_bytes, num_handles)) =
1665 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1666 {
1667 let member_inline_size =
1668 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1669 if inlined != (member_inline_size <= 4) {
1670 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1671 }
1672 let inner_offset;
1673 let mut inner_depth = depth.clone();
1674 if inlined {
1675 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1676 inner_offset = next_offset;
1677 } else {
1678 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1679 inner_depth.increment()?;
1680 }
1681 let val_ref = self.value.get_or_insert_with(|| fidl::new_empty!(u64, D));
1682 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1683 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1684 {
1685 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1686 }
1687 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1688 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1689 }
1690 }
1691
1692 next_offset += envelope_size;
1693 _next_ordinal_to_read += 1;
1694 if next_offset >= end_offset {
1695 return Ok(());
1696 }
1697
1698 while _next_ordinal_to_read < 2 {
1700 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1701 _next_ordinal_to_read += 1;
1702 next_offset += envelope_size;
1703 }
1704
1705 let next_out_of_line = decoder.next_out_of_line();
1706 let handles_before = decoder.remaining_handles();
1707 if let Some((inlined, num_bytes, num_handles)) =
1708 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1709 {
1710 let member_inline_size =
1711 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
1712 decoder.context,
1713 );
1714 if inlined != (member_inline_size <= 4) {
1715 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1716 }
1717 let inner_offset;
1718 let mut inner_depth = depth.clone();
1719 if inlined {
1720 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1721 inner_offset = next_offset;
1722 } else {
1723 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1724 inner_depth.increment()?;
1725 }
1726 let val_ref = self
1727 .forward_to_server
1728 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
1729 fidl::decode!(
1730 fidl::encoding::UnboundedString,
1731 D,
1732 val_ref,
1733 decoder,
1734 inner_offset,
1735 inner_depth
1736 )?;
1737 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1738 {
1739 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1740 }
1741 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1742 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1743 }
1744 }
1745
1746 next_offset += envelope_size;
1747
1748 while next_offset < end_offset {
1750 _next_ordinal_to_read += 1;
1751 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1752 next_offset += envelope_size;
1753 }
1754
1755 Ok(())
1756 }
1757 }
1758
1759 impl fidl::encoding::ValueTypeMarker for ComposedEchoUnionResponseWithErrorComposedResponse {
1760 type Borrowed<'a> = &'a Self;
1761 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1762 value
1763 }
1764 }
1765
1766 unsafe impl fidl::encoding::TypeMarker for ComposedEchoUnionResponseWithErrorComposedResponse {
1767 type Owned = Self;
1768
1769 #[inline(always)]
1770 fn inline_align(_context: fidl::encoding::Context) -> usize {
1771 8
1772 }
1773
1774 #[inline(always)]
1775 fn inline_size(_context: fidl::encoding::Context) -> usize {
1776 16
1777 }
1778 }
1779
1780 unsafe impl<D: fidl::encoding::ResourceDialect>
1781 fidl::encoding::Encode<ComposedEchoUnionResponseWithErrorComposedResponse, D>
1782 for &ComposedEchoUnionResponseWithErrorComposedResponse
1783 {
1784 #[inline]
1785 unsafe fn encode(
1786 self,
1787 encoder: &mut fidl::encoding::Encoder<'_, D>,
1788 offset: usize,
1789 _depth: fidl::encoding::Depth,
1790 ) -> fidl::Result<()> {
1791 encoder
1792 .debug_check_bounds::<ComposedEchoUnionResponseWithErrorComposedResponse>(offset);
1793 encoder.write_num::<u64>(self.ordinal(), offset);
1794 match self {
1795 ComposedEchoUnionResponseWithErrorComposedResponse::Unsigned(ref val) => {
1796 fidl::encoding::encode_in_envelope::<u64, D>(
1797 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1798 encoder,
1799 offset + 8,
1800 _depth,
1801 )
1802 }
1803 ComposedEchoUnionResponseWithErrorComposedResponse::Signed(ref val) => {
1804 fidl::encoding::encode_in_envelope::<i64, D>(
1805 <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1806 encoder,
1807 offset + 8,
1808 _depth,
1809 )
1810 }
1811 }
1812 }
1813 }
1814
1815 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1816 for ComposedEchoUnionResponseWithErrorComposedResponse
1817 {
1818 #[inline(always)]
1819 fn new_empty() -> Self {
1820 Self::Unsigned(fidl::new_empty!(u64, D))
1821 }
1822
1823 #[inline]
1824 unsafe fn decode(
1825 &mut self,
1826 decoder: &mut fidl::encoding::Decoder<'_, D>,
1827 offset: usize,
1828 mut depth: fidl::encoding::Depth,
1829 ) -> fidl::Result<()> {
1830 decoder.debug_check_bounds::<Self>(offset);
1831 #[allow(unused_variables)]
1832 let next_out_of_line = decoder.next_out_of_line();
1833 let handles_before = decoder.remaining_handles();
1834 let (ordinal, inlined, num_bytes, num_handles) =
1835 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1836
1837 let member_inline_size = match ordinal {
1838 1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1839 2 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1840 _ => return Err(fidl::Error::UnknownUnionTag),
1841 };
1842
1843 if inlined != (member_inline_size <= 4) {
1844 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1845 }
1846 let _inner_offset;
1847 if inlined {
1848 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1849 _inner_offset = offset + 8;
1850 } else {
1851 depth.increment()?;
1852 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1853 }
1854 match ordinal {
1855 1 => {
1856 #[allow(irrefutable_let_patterns)]
1857 if let ComposedEchoUnionResponseWithErrorComposedResponse::Unsigned(_) = self {
1858 } else {
1860 *self = ComposedEchoUnionResponseWithErrorComposedResponse::Unsigned(
1862 fidl::new_empty!(u64, D),
1863 );
1864 }
1865 #[allow(irrefutable_let_patterns)]
1866 if let ComposedEchoUnionResponseWithErrorComposedResponse::Unsigned(
1867 ref mut val,
1868 ) = self
1869 {
1870 fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
1871 } else {
1872 unreachable!()
1873 }
1874 }
1875 2 => {
1876 #[allow(irrefutable_let_patterns)]
1877 if let ComposedEchoUnionResponseWithErrorComposedResponse::Signed(_) = self {
1878 } else {
1880 *self = ComposedEchoUnionResponseWithErrorComposedResponse::Signed(
1882 fidl::new_empty!(i64, D),
1883 );
1884 }
1885 #[allow(irrefutable_let_patterns)]
1886 if let ComposedEchoUnionResponseWithErrorComposedResponse::Signed(ref mut val) =
1887 self
1888 {
1889 fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
1890 } else {
1891 unreachable!()
1892 }
1893 }
1894 ordinal => panic!("unexpected ordinal {:?}", ordinal),
1895 }
1896 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1897 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1898 }
1899 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1900 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1901 }
1902 Ok(())
1903 }
1904 }
1905}