1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
8 #[repr(C)]
9 pub struct CalculatorAddRequest {
10 pub a: i32,
11
12 pub b: i32,
13 }
14
15 unsafe impl<___E> ::fidl_next::Encode<crate::wire::CalculatorAddRequest, ___E>
16 for CalculatorAddRequest
17 where
18 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
19 {
20 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
21 Self,
22 crate::wire::CalculatorAddRequest,
23 > = unsafe {
24 ::fidl_next::CopyOptimization::enable_if(
25 true
26
27 && <
28 i32 as ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>
29 >::COPY_OPTIMIZATION.is_enabled()
30
31 && <
32 i32 as ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>
33 >::COPY_OPTIMIZATION.is_enabled()
34
35 )
36 };
37
38 #[inline]
39 fn encode(
40 self,
41 encoder_: &mut ___E,
42 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddRequest>,
43 _: (),
44 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
45 ::fidl_next::munge! {
46 let crate::wire::CalculatorAddRequest {
47 a,
48 b,
49
50 } = out_;
51 }
52
53 ::fidl_next::Encode::encode(self.a, encoder_, a, ())?;
54
55 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(a.as_mut_ptr()) };
56
57 ::fidl_next::Encode::encode(self.b, encoder_, b, ())?;
58
59 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(b.as_mut_ptr()) };
60
61 Ok(())
62 }
63 }
64
65 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::CalculatorAddRequest, ___E>
66 for &'a CalculatorAddRequest
67 where
68 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
69 {
70 #[inline]
71 fn encode(
72 self,
73 encoder_: &mut ___E,
74 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddRequest>,
75 _: (),
76 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
77 ::fidl_next::munge! {
78 let crate::wire::CalculatorAddRequest {
79 a,
80 b,
81
82 } = out_;
83 }
84
85 ::fidl_next::Encode::encode(&self.a, encoder_, a, ())?;
86
87 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(a.as_mut_ptr()) };
88
89 ::fidl_next::Encode::encode(&self.b, encoder_, b, ())?;
90
91 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(b.as_mut_ptr()) };
92
93 Ok(())
94 }
95 }
96
97 unsafe impl<___E>
98 ::fidl_next::EncodeOption<
99 ::fidl_next::wire::Box<'static, crate::wire::CalculatorAddRequest>,
100 ___E,
101 > for CalculatorAddRequest
102 where
103 ___E: ::fidl_next::Encoder + ?Sized,
104 CalculatorAddRequest: ::fidl_next::Encode<crate::wire::CalculatorAddRequest, ___E>,
105 {
106 #[inline]
107 fn encode_option(
108 this: ::core::option::Option<Self>,
109 encoder: &mut ___E,
110 out: &mut ::core::mem::MaybeUninit<
111 ::fidl_next::wire::Box<'static, crate::wire::CalculatorAddRequest>,
112 >,
113 _: (),
114 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
115 if let Some(inner) = this {
116 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
117 ::fidl_next::wire::Box::encode_present(out);
118 } else {
119 ::fidl_next::wire::Box::encode_absent(out);
120 }
121
122 Ok(())
123 }
124 }
125
126 unsafe impl<'a, ___E>
127 ::fidl_next::EncodeOption<
128 ::fidl_next::wire::Box<'static, crate::wire::CalculatorAddRequest>,
129 ___E,
130 > for &'a CalculatorAddRequest
131 where
132 ___E: ::fidl_next::Encoder + ?Sized,
133 &'a CalculatorAddRequest: ::fidl_next::Encode<crate::wire::CalculatorAddRequest, ___E>,
134 {
135 #[inline]
136 fn encode_option(
137 this: ::core::option::Option<Self>,
138 encoder: &mut ___E,
139 out: &mut ::core::mem::MaybeUninit<
140 ::fidl_next::wire::Box<'static, crate::wire::CalculatorAddRequest>,
141 >,
142 _: (),
143 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
144 if let Some(inner) = this {
145 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
146 ::fidl_next::wire::Box::encode_present(out);
147 } else {
148 ::fidl_next::wire::Box::encode_absent(out);
149 }
150
151 Ok(())
152 }
153 }
154
155 impl ::fidl_next::FromWire<crate::wire::CalculatorAddRequest> for CalculatorAddRequest {
156 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
157 crate::wire::CalculatorAddRequest,
158 Self,
159 > = unsafe {
160 ::fidl_next::CopyOptimization::enable_if(
161 true && <i32 as ::fidl_next::FromWire<::fidl_next::wire::Int32>>::COPY_OPTIMIZATION
162 .is_enabled()
163 && <i32 as ::fidl_next::FromWire<::fidl_next::wire::Int32>>::COPY_OPTIMIZATION
164 .is_enabled(),
165 )
166 };
167
168 #[inline]
169 fn from_wire(wire: crate::wire::CalculatorAddRequest) -> Self {
170 Self {
171 a: ::fidl_next::FromWire::from_wire(wire.a),
172
173 b: ::fidl_next::FromWire::from_wire(wire.b),
174 }
175 }
176 }
177
178 impl ::fidl_next::FromWireRef<crate::wire::CalculatorAddRequest> for CalculatorAddRequest {
179 #[inline]
180 fn from_wire_ref(wire: &crate::wire::CalculatorAddRequest) -> Self {
181 Self {
182 a: ::fidl_next::FromWireRef::from_wire_ref(&wire.a),
183
184 b: ::fidl_next::FromWireRef::from_wire_ref(&wire.b),
185 }
186 }
187 }
188
189 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
190 #[repr(C)]
191 pub struct CalculatorAddResponse {
192 pub sum: i32,
193 }
194
195 unsafe impl<___E> ::fidl_next::Encode<crate::wire::CalculatorAddResponse, ___E>
196 for CalculatorAddResponse
197 where
198 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
199 {
200 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
201 Self,
202 crate::wire::CalculatorAddResponse,
203 > = unsafe {
204 ::fidl_next::CopyOptimization::enable_if(
205 true
206
207 && <
208 i32 as ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>
209 >::COPY_OPTIMIZATION.is_enabled()
210
211 )
212 };
213
214 #[inline]
215 fn encode(
216 self,
217 encoder_: &mut ___E,
218 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddResponse>,
219 _: (),
220 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
221 ::fidl_next::munge! {
222 let crate::wire::CalculatorAddResponse {
223 sum,
224
225 } = out_;
226 }
227
228 ::fidl_next::Encode::encode(self.sum, encoder_, sum, ())?;
229
230 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(sum.as_mut_ptr()) };
231
232 Ok(())
233 }
234 }
235
236 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::CalculatorAddResponse, ___E>
237 for &'a CalculatorAddResponse
238 where
239 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
240 {
241 #[inline]
242 fn encode(
243 self,
244 encoder_: &mut ___E,
245 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddResponse>,
246 _: (),
247 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
248 ::fidl_next::munge! {
249 let crate::wire::CalculatorAddResponse {
250 sum,
251
252 } = out_;
253 }
254
255 ::fidl_next::Encode::encode(&self.sum, encoder_, sum, ())?;
256
257 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(sum.as_mut_ptr()) };
258
259 Ok(())
260 }
261 }
262
263 unsafe impl<___E>
264 ::fidl_next::EncodeOption<
265 ::fidl_next::wire::Box<'static, crate::wire::CalculatorAddResponse>,
266 ___E,
267 > for CalculatorAddResponse
268 where
269 ___E: ::fidl_next::Encoder + ?Sized,
270 CalculatorAddResponse: ::fidl_next::Encode<crate::wire::CalculatorAddResponse, ___E>,
271 {
272 #[inline]
273 fn encode_option(
274 this: ::core::option::Option<Self>,
275 encoder: &mut ___E,
276 out: &mut ::core::mem::MaybeUninit<
277 ::fidl_next::wire::Box<'static, crate::wire::CalculatorAddResponse>,
278 >,
279 _: (),
280 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
281 if let Some(inner) = this {
282 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
283 ::fidl_next::wire::Box::encode_present(out);
284 } else {
285 ::fidl_next::wire::Box::encode_absent(out);
286 }
287
288 Ok(())
289 }
290 }
291
292 unsafe impl<'a, ___E>
293 ::fidl_next::EncodeOption<
294 ::fidl_next::wire::Box<'static, crate::wire::CalculatorAddResponse>,
295 ___E,
296 > for &'a CalculatorAddResponse
297 where
298 ___E: ::fidl_next::Encoder + ?Sized,
299 &'a CalculatorAddResponse: ::fidl_next::Encode<crate::wire::CalculatorAddResponse, ___E>,
300 {
301 #[inline]
302 fn encode_option(
303 this: ::core::option::Option<Self>,
304 encoder: &mut ___E,
305 out: &mut ::core::mem::MaybeUninit<
306 ::fidl_next::wire::Box<'static, crate::wire::CalculatorAddResponse>,
307 >,
308 _: (),
309 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
310 if let Some(inner) = this {
311 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
312 ::fidl_next::wire::Box::encode_present(out);
313 } else {
314 ::fidl_next::wire::Box::encode_absent(out);
315 }
316
317 Ok(())
318 }
319 }
320
321 impl ::fidl_next::FromWire<crate::wire::CalculatorAddResponse> for CalculatorAddResponse {
322 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
323 crate::wire::CalculatorAddResponse,
324 Self,
325 > = unsafe {
326 ::fidl_next::CopyOptimization::enable_if(
327 true && <i32 as ::fidl_next::FromWire<::fidl_next::wire::Int32>>::COPY_OPTIMIZATION
328 .is_enabled(),
329 )
330 };
331
332 #[inline]
333 fn from_wire(wire: crate::wire::CalculatorAddResponse) -> Self {
334 Self { sum: ::fidl_next::FromWire::from_wire(wire.sum) }
335 }
336 }
337
338 impl ::fidl_next::FromWireRef<crate::wire::CalculatorAddResponse> for CalculatorAddResponse {
339 #[inline]
340 fn from_wire_ref(wire: &crate::wire::CalculatorAddResponse) -> Self {
341 Self { sum: ::fidl_next::FromWireRef::from_wire_ref(&wire.sum) }
342 }
343 }
344
345 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
346 #[repr(C)]
347 pub struct CalculatorDivideRequest {
348 pub dividend: i32,
349
350 pub divisor: i32,
351 }
352
353 unsafe impl<___E> ::fidl_next::Encode<crate::wire::CalculatorDivideRequest, ___E>
354 for CalculatorDivideRequest
355 where
356 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
357 {
358 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
359 Self,
360 crate::wire::CalculatorDivideRequest,
361 > = unsafe {
362 ::fidl_next::CopyOptimization::enable_if(
363 true
364
365 && <
366 i32 as ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>
367 >::COPY_OPTIMIZATION.is_enabled()
368
369 && <
370 i32 as ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>
371 >::COPY_OPTIMIZATION.is_enabled()
372
373 )
374 };
375
376 #[inline]
377 fn encode(
378 self,
379 encoder_: &mut ___E,
380 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideRequest>,
381 _: (),
382 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
383 ::fidl_next::munge! {
384 let crate::wire::CalculatorDivideRequest {
385 dividend,
386 divisor,
387
388 } = out_;
389 }
390
391 ::fidl_next::Encode::encode(self.dividend, encoder_, dividend, ())?;
392
393 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(dividend.as_mut_ptr()) };
394
395 ::fidl_next::Encode::encode(self.divisor, encoder_, divisor, ())?;
396
397 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(divisor.as_mut_ptr()) };
398
399 Ok(())
400 }
401 }
402
403 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::CalculatorDivideRequest, ___E>
404 for &'a CalculatorDivideRequest
405 where
406 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
407 {
408 #[inline]
409 fn encode(
410 self,
411 encoder_: &mut ___E,
412 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideRequest>,
413 _: (),
414 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
415 ::fidl_next::munge! {
416 let crate::wire::CalculatorDivideRequest {
417 dividend,
418 divisor,
419
420 } = out_;
421 }
422
423 ::fidl_next::Encode::encode(&self.dividend, encoder_, dividend, ())?;
424
425 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(dividend.as_mut_ptr()) };
426
427 ::fidl_next::Encode::encode(&self.divisor, encoder_, divisor, ())?;
428
429 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(divisor.as_mut_ptr()) };
430
431 Ok(())
432 }
433 }
434
435 unsafe impl<___E>
436 ::fidl_next::EncodeOption<
437 ::fidl_next::wire::Box<'static, crate::wire::CalculatorDivideRequest>,
438 ___E,
439 > for CalculatorDivideRequest
440 where
441 ___E: ::fidl_next::Encoder + ?Sized,
442 CalculatorDivideRequest: ::fidl_next::Encode<crate::wire::CalculatorDivideRequest, ___E>,
443 {
444 #[inline]
445 fn encode_option(
446 this: ::core::option::Option<Self>,
447 encoder: &mut ___E,
448 out: &mut ::core::mem::MaybeUninit<
449 ::fidl_next::wire::Box<'static, crate::wire::CalculatorDivideRequest>,
450 >,
451 _: (),
452 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
453 if let Some(inner) = this {
454 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
455 ::fidl_next::wire::Box::encode_present(out);
456 } else {
457 ::fidl_next::wire::Box::encode_absent(out);
458 }
459
460 Ok(())
461 }
462 }
463
464 unsafe impl<'a, ___E>
465 ::fidl_next::EncodeOption<
466 ::fidl_next::wire::Box<'static, crate::wire::CalculatorDivideRequest>,
467 ___E,
468 > for &'a CalculatorDivideRequest
469 where
470 ___E: ::fidl_next::Encoder + ?Sized,
471 &'a CalculatorDivideRequest:
472 ::fidl_next::Encode<crate::wire::CalculatorDivideRequest, ___E>,
473 {
474 #[inline]
475 fn encode_option(
476 this: ::core::option::Option<Self>,
477 encoder: &mut ___E,
478 out: &mut ::core::mem::MaybeUninit<
479 ::fidl_next::wire::Box<'static, crate::wire::CalculatorDivideRequest>,
480 >,
481 _: (),
482 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
483 if let Some(inner) = this {
484 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
485 ::fidl_next::wire::Box::encode_present(out);
486 } else {
487 ::fidl_next::wire::Box::encode_absent(out);
488 }
489
490 Ok(())
491 }
492 }
493
494 impl ::fidl_next::FromWire<crate::wire::CalculatorDivideRequest> for CalculatorDivideRequest {
495 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
496 crate::wire::CalculatorDivideRequest,
497 Self,
498 > = unsafe {
499 ::fidl_next::CopyOptimization::enable_if(
500 true && <i32 as ::fidl_next::FromWire<::fidl_next::wire::Int32>>::COPY_OPTIMIZATION
501 .is_enabled()
502 && <i32 as ::fidl_next::FromWire<::fidl_next::wire::Int32>>::COPY_OPTIMIZATION
503 .is_enabled(),
504 )
505 };
506
507 #[inline]
508 fn from_wire(wire: crate::wire::CalculatorDivideRequest) -> Self {
509 Self {
510 dividend: ::fidl_next::FromWire::from_wire(wire.dividend),
511
512 divisor: ::fidl_next::FromWire::from_wire(wire.divisor),
513 }
514 }
515 }
516
517 impl ::fidl_next::FromWireRef<crate::wire::CalculatorDivideRequest> for CalculatorDivideRequest {
518 #[inline]
519 fn from_wire_ref(wire: &crate::wire::CalculatorDivideRequest) -> Self {
520 Self {
521 dividend: ::fidl_next::FromWireRef::from_wire_ref(&wire.dividend),
522
523 divisor: ::fidl_next::FromWireRef::from_wire_ref(&wire.divisor),
524 }
525 }
526 }
527
528 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
529 #[repr(C)]
530 pub struct CalculatorDivideResponse {
531 pub quotient: i32,
532
533 pub remainder: i32,
534 }
535
536 unsafe impl<___E> ::fidl_next::Encode<crate::wire::CalculatorDivideResponse, ___E>
537 for CalculatorDivideResponse
538 where
539 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
540 {
541 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
542 Self,
543 crate::wire::CalculatorDivideResponse,
544 > = unsafe {
545 ::fidl_next::CopyOptimization::enable_if(
546 true
547
548 && <
549 i32 as ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>
550 >::COPY_OPTIMIZATION.is_enabled()
551
552 && <
553 i32 as ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>
554 >::COPY_OPTIMIZATION.is_enabled()
555
556 )
557 };
558
559 #[inline]
560 fn encode(
561 self,
562 encoder_: &mut ___E,
563 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideResponse>,
564 _: (),
565 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
566 ::fidl_next::munge! {
567 let crate::wire::CalculatorDivideResponse {
568 quotient,
569 remainder,
570
571 } = out_;
572 }
573
574 ::fidl_next::Encode::encode(self.quotient, encoder_, quotient, ())?;
575
576 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(quotient.as_mut_ptr()) };
577
578 ::fidl_next::Encode::encode(self.remainder, encoder_, remainder, ())?;
579
580 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(remainder.as_mut_ptr()) };
581
582 Ok(())
583 }
584 }
585
586 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::CalculatorDivideResponse, ___E>
587 for &'a CalculatorDivideResponse
588 where
589 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
590 {
591 #[inline]
592 fn encode(
593 self,
594 encoder_: &mut ___E,
595 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideResponse>,
596 _: (),
597 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
598 ::fidl_next::munge! {
599 let crate::wire::CalculatorDivideResponse {
600 quotient,
601 remainder,
602
603 } = out_;
604 }
605
606 ::fidl_next::Encode::encode(&self.quotient, encoder_, quotient, ())?;
607
608 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(quotient.as_mut_ptr()) };
609
610 ::fidl_next::Encode::encode(&self.remainder, encoder_, remainder, ())?;
611
612 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(remainder.as_mut_ptr()) };
613
614 Ok(())
615 }
616 }
617
618 unsafe impl<___E>
619 ::fidl_next::EncodeOption<
620 ::fidl_next::wire::Box<'static, crate::wire::CalculatorDivideResponse>,
621 ___E,
622 > for CalculatorDivideResponse
623 where
624 ___E: ::fidl_next::Encoder + ?Sized,
625 CalculatorDivideResponse: ::fidl_next::Encode<crate::wire::CalculatorDivideResponse, ___E>,
626 {
627 #[inline]
628 fn encode_option(
629 this: ::core::option::Option<Self>,
630 encoder: &mut ___E,
631 out: &mut ::core::mem::MaybeUninit<
632 ::fidl_next::wire::Box<'static, crate::wire::CalculatorDivideResponse>,
633 >,
634 _: (),
635 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
636 if let Some(inner) = this {
637 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
638 ::fidl_next::wire::Box::encode_present(out);
639 } else {
640 ::fidl_next::wire::Box::encode_absent(out);
641 }
642
643 Ok(())
644 }
645 }
646
647 unsafe impl<'a, ___E>
648 ::fidl_next::EncodeOption<
649 ::fidl_next::wire::Box<'static, crate::wire::CalculatorDivideResponse>,
650 ___E,
651 > for &'a CalculatorDivideResponse
652 where
653 ___E: ::fidl_next::Encoder + ?Sized,
654 &'a CalculatorDivideResponse:
655 ::fidl_next::Encode<crate::wire::CalculatorDivideResponse, ___E>,
656 {
657 #[inline]
658 fn encode_option(
659 this: ::core::option::Option<Self>,
660 encoder: &mut ___E,
661 out: &mut ::core::mem::MaybeUninit<
662 ::fidl_next::wire::Box<'static, crate::wire::CalculatorDivideResponse>,
663 >,
664 _: (),
665 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
666 if let Some(inner) = this {
667 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
668 ::fidl_next::wire::Box::encode_present(out);
669 } else {
670 ::fidl_next::wire::Box::encode_absent(out);
671 }
672
673 Ok(())
674 }
675 }
676
677 impl ::fidl_next::FromWire<crate::wire::CalculatorDivideResponse> for CalculatorDivideResponse {
678 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
679 crate::wire::CalculatorDivideResponse,
680 Self,
681 > = unsafe {
682 ::fidl_next::CopyOptimization::enable_if(
683 true && <i32 as ::fidl_next::FromWire<::fidl_next::wire::Int32>>::COPY_OPTIMIZATION
684 .is_enabled()
685 && <i32 as ::fidl_next::FromWire<::fidl_next::wire::Int32>>::COPY_OPTIMIZATION
686 .is_enabled(),
687 )
688 };
689
690 #[inline]
691 fn from_wire(wire: crate::wire::CalculatorDivideResponse) -> Self {
692 Self {
693 quotient: ::fidl_next::FromWire::from_wire(wire.quotient),
694
695 remainder: ::fidl_next::FromWire::from_wire(wire.remainder),
696 }
697 }
698 }
699
700 impl ::fidl_next::FromWireRef<crate::wire::CalculatorDivideResponse> for CalculatorDivideResponse {
701 #[inline]
702 fn from_wire_ref(wire: &crate::wire::CalculatorDivideResponse) -> Self {
703 Self {
704 quotient: ::fidl_next::FromWireRef::from_wire_ref(&wire.quotient),
705
706 remainder: ::fidl_next::FromWireRef::from_wire_ref(&wire.remainder),
707 }
708 }
709 }
710
711 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
712 #[repr(u32)]
713 pub enum DivisionError {
714 DivideByZero = 1,
715 }
716 impl ::core::convert::TryFrom<u32> for DivisionError {
717 type Error = ::fidl_next::UnknownStrictEnumMemberError;
718 fn try_from(
719 value: u32,
720 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
721 match value {
722 1 => Ok(Self::DivideByZero),
723
724 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
725 }
726 }
727 }
728
729 impl ::std::convert::From<DivisionError> for u32 {
730 fn from(value: DivisionError) -> Self {
731 match value {
732 DivisionError::DivideByZero => 1,
733 }
734 }
735 }
736
737 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DivisionError, ___E> for DivisionError
738 where
739 ___E: ?Sized,
740 {
741 #[inline]
742 fn encode(
743 self,
744 encoder: &mut ___E,
745 out: &mut ::core::mem::MaybeUninit<crate::wire::DivisionError>,
746 _: (),
747 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
748 ::fidl_next::Encode::encode(&self, encoder, out, ())
749 }
750 }
751
752 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DivisionError, ___E> for &'a DivisionError
753 where
754 ___E: ?Sized,
755 {
756 #[inline]
757 fn encode(
758 self,
759 encoder: &mut ___E,
760 out: &mut ::core::mem::MaybeUninit<crate::wire::DivisionError>,
761 _: (),
762 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
763 ::fidl_next::munge!(let crate::wire::DivisionError { value } = out);
764 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
765 DivisionError::DivideByZero => 1,
766 }));
767
768 Ok(())
769 }
770 }
771
772 impl ::core::convert::From<crate::wire::DivisionError> for DivisionError {
773 fn from(wire: crate::wire::DivisionError) -> Self {
774 match u32::from(wire.value) {
775 1 => Self::DivideByZero,
776
777 _ => unsafe { ::core::hint::unreachable_unchecked() },
778 }
779 }
780 }
781
782 impl ::fidl_next::FromWire<crate::wire::DivisionError> for DivisionError {
783 #[inline]
784 fn from_wire(wire: crate::wire::DivisionError) -> Self {
785 Self::from(wire)
786 }
787 }
788
789 impl ::fidl_next::FromWireRef<crate::wire::DivisionError> for DivisionError {
790 #[inline]
791 fn from_wire_ref(wire: &crate::wire::DivisionError) -> Self {
792 Self::from(*wire)
793 }
794 }
795
796 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
797 #[repr(C)]
798 pub struct CalculatorOnErrorRequest {
799 pub status_code: u32,
800 }
801
802 unsafe impl<___E> ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>
803 for CalculatorOnErrorRequest
804 where
805 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
806 {
807 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
808 Self,
809 crate::wire::CalculatorOnErrorRequest,
810 > = unsafe {
811 ::fidl_next::CopyOptimization::enable_if(
812 true
813
814 && <
815 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
816 >::COPY_OPTIMIZATION.is_enabled()
817
818 )
819 };
820
821 #[inline]
822 fn encode(
823 self,
824 encoder_: &mut ___E,
825 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorOnErrorRequest>,
826 _: (),
827 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
828 ::fidl_next::munge! {
829 let crate::wire::CalculatorOnErrorRequest {
830 status_code,
831
832 } = out_;
833 }
834
835 ::fidl_next::Encode::encode(self.status_code, encoder_, status_code, ())?;
836
837 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(status_code.as_mut_ptr()) };
838
839 Ok(())
840 }
841 }
842
843 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>
844 for &'a CalculatorOnErrorRequest
845 where
846 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
847 {
848 #[inline]
849 fn encode(
850 self,
851 encoder_: &mut ___E,
852 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorOnErrorRequest>,
853 _: (),
854 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
855 ::fidl_next::munge! {
856 let crate::wire::CalculatorOnErrorRequest {
857 status_code,
858
859 } = out_;
860 }
861
862 ::fidl_next::Encode::encode(&self.status_code, encoder_, status_code, ())?;
863
864 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(status_code.as_mut_ptr()) };
865
866 Ok(())
867 }
868 }
869
870 unsafe impl<___E>
871 ::fidl_next::EncodeOption<
872 ::fidl_next::wire::Box<'static, crate::wire::CalculatorOnErrorRequest>,
873 ___E,
874 > for CalculatorOnErrorRequest
875 where
876 ___E: ::fidl_next::Encoder + ?Sized,
877 CalculatorOnErrorRequest: ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>,
878 {
879 #[inline]
880 fn encode_option(
881 this: ::core::option::Option<Self>,
882 encoder: &mut ___E,
883 out: &mut ::core::mem::MaybeUninit<
884 ::fidl_next::wire::Box<'static, crate::wire::CalculatorOnErrorRequest>,
885 >,
886 _: (),
887 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
888 if let Some(inner) = this {
889 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
890 ::fidl_next::wire::Box::encode_present(out);
891 } else {
892 ::fidl_next::wire::Box::encode_absent(out);
893 }
894
895 Ok(())
896 }
897 }
898
899 unsafe impl<'a, ___E>
900 ::fidl_next::EncodeOption<
901 ::fidl_next::wire::Box<'static, crate::wire::CalculatorOnErrorRequest>,
902 ___E,
903 > for &'a CalculatorOnErrorRequest
904 where
905 ___E: ::fidl_next::Encoder + ?Sized,
906 &'a CalculatorOnErrorRequest:
907 ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>,
908 {
909 #[inline]
910 fn encode_option(
911 this: ::core::option::Option<Self>,
912 encoder: &mut ___E,
913 out: &mut ::core::mem::MaybeUninit<
914 ::fidl_next::wire::Box<'static, crate::wire::CalculatorOnErrorRequest>,
915 >,
916 _: (),
917 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
918 if let Some(inner) = this {
919 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
920 ::fidl_next::wire::Box::encode_present(out);
921 } else {
922 ::fidl_next::wire::Box::encode_absent(out);
923 }
924
925 Ok(())
926 }
927 }
928
929 impl ::fidl_next::FromWire<crate::wire::CalculatorOnErrorRequest> for CalculatorOnErrorRequest {
930 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
931 crate::wire::CalculatorOnErrorRequest,
932 Self,
933 > = unsafe {
934 ::fidl_next::CopyOptimization::enable_if(
935 true
936 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
937 .is_enabled(),
938 )
939 };
940
941 #[inline]
942 fn from_wire(wire: crate::wire::CalculatorOnErrorRequest) -> Self {
943 Self { status_code: ::fidl_next::FromWire::from_wire(wire.status_code) }
944 }
945 }
946
947 impl ::fidl_next::FromWireRef<crate::wire::CalculatorOnErrorRequest> for CalculatorOnErrorRequest {
948 #[inline]
949 fn from_wire_ref(wire: &crate::wire::CalculatorOnErrorRequest) -> Self {
950 Self { status_code: ::fidl_next::FromWireRef::from_wire_ref(&wire.status_code) }
951 }
952 }
953}
954
955pub mod wire {
956
957 #[derive(Clone, Debug)]
959 #[repr(C)]
960 pub struct CalculatorAddRequest {
961 pub a: ::fidl_next::wire::Int32,
962
963 pub b: ::fidl_next::wire::Int32,
964 }
965
966 static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorAddRequest>(), 8);
967 static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorAddRequest>(), 4);
968
969 static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorAddRequest, a), 0);
970
971 static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorAddRequest, b), 4);
972
973 impl ::fidl_next::Constrained for CalculatorAddRequest {
974 type Constraint = ();
975
976 fn validate(
977 _: ::fidl_next::Slot<'_, Self>,
978 _: Self::Constraint,
979 ) -> Result<(), ::fidl_next::ValidationError> {
980 Ok(())
981 }
982 }
983
984 unsafe impl ::fidl_next::Wire for CalculatorAddRequest {
985 type Narrowed<'de> = CalculatorAddRequest;
986
987 #[inline]
988 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
989 ::fidl_next::munge! {
990 let Self {
991 a,
992 b,
993
994 } = &mut *out_;
995 }
996
997 ::fidl_next::Wire::zero_padding(a);
998
999 ::fidl_next::Wire::zero_padding(b);
1000 }
1001 }
1002
1003 unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorAddRequest
1004 where
1005 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1006 {
1007 fn decode(
1008 slot_: ::fidl_next::Slot<'_, Self>,
1009 decoder_: &mut ___D,
1010 _: (),
1011 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1012 ::fidl_next::munge! {
1013 let Self {
1014 mut a,
1015 mut b,
1016
1017 } = slot_;
1018 }
1019
1020 let _field = a.as_mut();
1021
1022 ::fidl_next::Decode::decode(a.as_mut(), decoder_, ())?;
1023
1024 let _field = b.as_mut();
1025
1026 ::fidl_next::Decode::decode(b.as_mut(), decoder_, ())?;
1027
1028 Ok(())
1029 }
1030 }
1031
1032 impl ::fidl_next::IntoNatural for CalculatorAddRequest {
1033 type Natural = crate::natural::CalculatorAddRequest;
1034 }
1035
1036 #[derive(Clone, Debug)]
1038 #[repr(C)]
1039 pub struct CalculatorAddResponse {
1040 pub sum: ::fidl_next::wire::Int32,
1041 }
1042
1043 static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorAddResponse>(), 4);
1044 static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorAddResponse>(), 4);
1045
1046 static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorAddResponse, sum), 0);
1047
1048 impl ::fidl_next::Constrained for CalculatorAddResponse {
1049 type Constraint = ();
1050
1051 fn validate(
1052 _: ::fidl_next::Slot<'_, Self>,
1053 _: Self::Constraint,
1054 ) -> Result<(), ::fidl_next::ValidationError> {
1055 Ok(())
1056 }
1057 }
1058
1059 unsafe impl ::fidl_next::Wire for CalculatorAddResponse {
1060 type Narrowed<'de> = CalculatorAddResponse;
1061
1062 #[inline]
1063 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1064 ::fidl_next::munge! {
1065 let Self {
1066 sum,
1067
1068 } = &mut *out_;
1069 }
1070
1071 ::fidl_next::Wire::zero_padding(sum);
1072 }
1073 }
1074
1075 unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorAddResponse
1076 where
1077 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1078 {
1079 fn decode(
1080 slot_: ::fidl_next::Slot<'_, Self>,
1081 decoder_: &mut ___D,
1082 _: (),
1083 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1084 ::fidl_next::munge! {
1085 let Self {
1086 mut sum,
1087
1088 } = slot_;
1089 }
1090
1091 let _field = sum.as_mut();
1092
1093 ::fidl_next::Decode::decode(sum.as_mut(), decoder_, ())?;
1094
1095 Ok(())
1096 }
1097 }
1098
1099 impl ::fidl_next::IntoNatural for CalculatorAddResponse {
1100 type Natural = crate::natural::CalculatorAddResponse;
1101 }
1102
1103 #[derive(Clone, Debug)]
1105 #[repr(C)]
1106 pub struct CalculatorDivideRequest {
1107 pub dividend: ::fidl_next::wire::Int32,
1108
1109 pub divisor: ::fidl_next::wire::Int32,
1110 }
1111
1112 static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorDivideRequest>(), 8);
1113 static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorDivideRequest>(), 4);
1114
1115 static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorDivideRequest, dividend), 0);
1116
1117 static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorDivideRequest, divisor), 4);
1118
1119 impl ::fidl_next::Constrained for CalculatorDivideRequest {
1120 type Constraint = ();
1121
1122 fn validate(
1123 _: ::fidl_next::Slot<'_, Self>,
1124 _: Self::Constraint,
1125 ) -> Result<(), ::fidl_next::ValidationError> {
1126 Ok(())
1127 }
1128 }
1129
1130 unsafe impl ::fidl_next::Wire for CalculatorDivideRequest {
1131 type Narrowed<'de> = CalculatorDivideRequest;
1132
1133 #[inline]
1134 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1135 ::fidl_next::munge! {
1136 let Self {
1137 dividend,
1138 divisor,
1139
1140 } = &mut *out_;
1141 }
1142
1143 ::fidl_next::Wire::zero_padding(dividend);
1144
1145 ::fidl_next::Wire::zero_padding(divisor);
1146 }
1147 }
1148
1149 unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorDivideRequest
1150 where
1151 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1152 {
1153 fn decode(
1154 slot_: ::fidl_next::Slot<'_, Self>,
1155 decoder_: &mut ___D,
1156 _: (),
1157 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1158 ::fidl_next::munge! {
1159 let Self {
1160 mut dividend,
1161 mut divisor,
1162
1163 } = slot_;
1164 }
1165
1166 let _field = dividend.as_mut();
1167
1168 ::fidl_next::Decode::decode(dividend.as_mut(), decoder_, ())?;
1169
1170 let _field = divisor.as_mut();
1171
1172 ::fidl_next::Decode::decode(divisor.as_mut(), decoder_, ())?;
1173
1174 Ok(())
1175 }
1176 }
1177
1178 impl ::fidl_next::IntoNatural for CalculatorDivideRequest {
1179 type Natural = crate::natural::CalculatorDivideRequest;
1180 }
1181
1182 #[derive(Clone, Debug)]
1184 #[repr(C)]
1185 pub struct CalculatorDivideResponse {
1186 pub quotient: ::fidl_next::wire::Int32,
1187
1188 pub remainder: ::fidl_next::wire::Int32,
1189 }
1190
1191 static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorDivideResponse>(), 8);
1192 static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorDivideResponse>(), 4);
1193
1194 static_assertions::const_assert_eq!(
1195 std::mem::offset_of!(CalculatorDivideResponse, quotient),
1196 0
1197 );
1198
1199 static_assertions::const_assert_eq!(
1200 std::mem::offset_of!(CalculatorDivideResponse, remainder),
1201 4
1202 );
1203
1204 impl ::fidl_next::Constrained for CalculatorDivideResponse {
1205 type Constraint = ();
1206
1207 fn validate(
1208 _: ::fidl_next::Slot<'_, Self>,
1209 _: Self::Constraint,
1210 ) -> Result<(), ::fidl_next::ValidationError> {
1211 Ok(())
1212 }
1213 }
1214
1215 unsafe impl ::fidl_next::Wire for CalculatorDivideResponse {
1216 type Narrowed<'de> = CalculatorDivideResponse;
1217
1218 #[inline]
1219 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1220 ::fidl_next::munge! {
1221 let Self {
1222 quotient,
1223 remainder,
1224
1225 } = &mut *out_;
1226 }
1227
1228 ::fidl_next::Wire::zero_padding(quotient);
1229
1230 ::fidl_next::Wire::zero_padding(remainder);
1231 }
1232 }
1233
1234 unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorDivideResponse
1235 where
1236 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1237 {
1238 fn decode(
1239 slot_: ::fidl_next::Slot<'_, Self>,
1240 decoder_: &mut ___D,
1241 _: (),
1242 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1243 ::fidl_next::munge! {
1244 let Self {
1245 mut quotient,
1246 mut remainder,
1247
1248 } = slot_;
1249 }
1250
1251 let _field = quotient.as_mut();
1252
1253 ::fidl_next::Decode::decode(quotient.as_mut(), decoder_, ())?;
1254
1255 let _field = remainder.as_mut();
1256
1257 ::fidl_next::Decode::decode(remainder.as_mut(), decoder_, ())?;
1258
1259 Ok(())
1260 }
1261 }
1262
1263 impl ::fidl_next::IntoNatural for CalculatorDivideResponse {
1264 type Natural = crate::natural::CalculatorDivideResponse;
1265 }
1266
1267 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1269 #[repr(transparent)]
1270 pub struct DivisionError {
1271 pub(crate) value: ::fidl_next::wire::Uint32,
1272 }
1273
1274 impl ::fidl_next::Constrained for DivisionError {
1275 type Constraint = ();
1276
1277 fn validate(
1278 _: ::fidl_next::Slot<'_, Self>,
1279 _: Self::Constraint,
1280 ) -> Result<(), ::fidl_next::ValidationError> {
1281 Ok(())
1282 }
1283 }
1284
1285 unsafe impl ::fidl_next::Wire for DivisionError {
1286 type Narrowed<'de> = Self;
1287
1288 #[inline]
1289 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1290 }
1292 }
1293
1294 impl DivisionError {
1295 pub const DIVIDE_BY_ZERO: DivisionError =
1296 DivisionError { value: ::fidl_next::wire::Uint32(1) };
1297 }
1298
1299 unsafe impl<___D> ::fidl_next::Decode<___D> for DivisionError
1300 where
1301 ___D: ?Sized,
1302 {
1303 fn decode(
1304 slot: ::fidl_next::Slot<'_, Self>,
1305 _: &mut ___D,
1306 _: (),
1307 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1308 ::fidl_next::munge!(let Self { value } = slot);
1309
1310 match u32::from(*value) {
1311 1 => (),
1312 unknown => {
1313 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1314 }
1315 }
1316
1317 Ok(())
1318 }
1319 }
1320
1321 impl ::core::convert::From<crate::natural::DivisionError> for DivisionError {
1322 fn from(natural: crate::natural::DivisionError) -> Self {
1323 match natural {
1324 crate::natural::DivisionError::DivideByZero => DivisionError::DIVIDE_BY_ZERO,
1325 }
1326 }
1327 }
1328
1329 impl ::fidl_next::IntoNatural for DivisionError {
1330 type Natural = crate::natural::DivisionError;
1331 }
1332
1333 #[derive(Clone, Debug)]
1335 #[repr(C)]
1336 pub struct CalculatorOnErrorRequest {
1337 pub status_code: ::fidl_next::wire::Uint32,
1338 }
1339
1340 static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorOnErrorRequest>(), 4);
1341 static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorOnErrorRequest>(), 4);
1342
1343 static_assertions::const_assert_eq!(
1344 std::mem::offset_of!(CalculatorOnErrorRequest, status_code),
1345 0
1346 );
1347
1348 impl ::fidl_next::Constrained for CalculatorOnErrorRequest {
1349 type Constraint = ();
1350
1351 fn validate(
1352 _: ::fidl_next::Slot<'_, Self>,
1353 _: Self::Constraint,
1354 ) -> Result<(), ::fidl_next::ValidationError> {
1355 Ok(())
1356 }
1357 }
1358
1359 unsafe impl ::fidl_next::Wire for CalculatorOnErrorRequest {
1360 type Narrowed<'de> = CalculatorOnErrorRequest;
1361
1362 #[inline]
1363 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1364 ::fidl_next::munge! {
1365 let Self {
1366 status_code,
1367
1368 } = &mut *out_;
1369 }
1370
1371 ::fidl_next::Wire::zero_padding(status_code);
1372 }
1373 }
1374
1375 unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorOnErrorRequest
1376 where
1377 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1378 {
1379 fn decode(
1380 slot_: ::fidl_next::Slot<'_, Self>,
1381 decoder_: &mut ___D,
1382 _: (),
1383 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1384 ::fidl_next::munge! {
1385 let Self {
1386 mut status_code,
1387
1388 } = slot_;
1389 }
1390
1391 let _field = status_code.as_mut();
1392
1393 ::fidl_next::Decode::decode(status_code.as_mut(), decoder_, ())?;
1394
1395 Ok(())
1396 }
1397 }
1398
1399 impl ::fidl_next::IntoNatural for CalculatorOnErrorRequest {
1400 type Natural = crate::natural::CalculatorOnErrorRequest;
1401 }
1402}
1403
1404pub mod wire_optional {}
1405
1406pub mod generic {
1407
1408 pub struct CalculatorAddRequest<T0, T1> {
1410 pub a: T0,
1411
1412 pub b: T1,
1413 }
1414
1415 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::CalculatorAddRequest, ___E>
1416 for CalculatorAddRequest<T0, T1>
1417 where
1418 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1419 T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1420 T1: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1421 {
1422 #[inline]
1423 fn encode(
1424 self,
1425 encoder_: &mut ___E,
1426 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddRequest>,
1427 _: (),
1428 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1429 ::fidl_next::munge! {
1430 let crate::wire::CalculatorAddRequest {
1431 a,
1432 b,
1433
1434 } = out_;
1435 }
1436
1437 ::fidl_next::Encode::encode(self.a, encoder_, a, ())?;
1438
1439 ::fidl_next::Encode::encode(self.b, encoder_, b, ())?;
1440
1441 Ok(())
1442 }
1443 }
1444
1445 unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::CalculatorAddRequest, ___E>
1446 for &'a CalculatorAddRequest<T0, T1>
1447 where
1448 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1449 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1450 &'a T1: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1451 {
1452 #[inline]
1453 fn encode(
1454 self,
1455 encoder_: &mut ___E,
1456 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddRequest>,
1457 _: (),
1458 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1459 ::fidl_next::munge! {
1460 let crate::wire::CalculatorAddRequest {
1461 a,
1462 b,
1463
1464 } = out_;
1465 }
1466
1467 ::fidl_next::Encode::encode(&self.a, encoder_, a, ())?;
1468
1469 ::fidl_next::Encode::encode(&self.b, encoder_, b, ())?;
1470
1471 Ok(())
1472 }
1473 }
1474
1475 pub struct CalculatorAddResponse<T0> {
1477 pub sum: T0,
1478 }
1479
1480 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::CalculatorAddResponse, ___E>
1481 for CalculatorAddResponse<T0>
1482 where
1483 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1484 T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1485 {
1486 #[inline]
1487 fn encode(
1488 self,
1489 encoder_: &mut ___E,
1490 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddResponse>,
1491 _: (),
1492 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1493 ::fidl_next::munge! {
1494 let crate::wire::CalculatorAddResponse {
1495 sum,
1496
1497 } = out_;
1498 }
1499
1500 ::fidl_next::Encode::encode(self.sum, encoder_, sum, ())?;
1501
1502 Ok(())
1503 }
1504 }
1505
1506 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::CalculatorAddResponse, ___E>
1507 for &'a CalculatorAddResponse<T0>
1508 where
1509 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1510 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1511 {
1512 #[inline]
1513 fn encode(
1514 self,
1515 encoder_: &mut ___E,
1516 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddResponse>,
1517 _: (),
1518 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1519 ::fidl_next::munge! {
1520 let crate::wire::CalculatorAddResponse {
1521 sum,
1522
1523 } = out_;
1524 }
1525
1526 ::fidl_next::Encode::encode(&self.sum, encoder_, sum, ())?;
1527
1528 Ok(())
1529 }
1530 }
1531
1532 pub struct CalculatorDivideRequest<T0, T1> {
1534 pub dividend: T0,
1535
1536 pub divisor: T1,
1537 }
1538
1539 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::CalculatorDivideRequest, ___E>
1540 for CalculatorDivideRequest<T0, T1>
1541 where
1542 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1543 T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1544 T1: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1545 {
1546 #[inline]
1547 fn encode(
1548 self,
1549 encoder_: &mut ___E,
1550 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideRequest>,
1551 _: (),
1552 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1553 ::fidl_next::munge! {
1554 let crate::wire::CalculatorDivideRequest {
1555 dividend,
1556 divisor,
1557
1558 } = out_;
1559 }
1560
1561 ::fidl_next::Encode::encode(self.dividend, encoder_, dividend, ())?;
1562
1563 ::fidl_next::Encode::encode(self.divisor, encoder_, divisor, ())?;
1564
1565 Ok(())
1566 }
1567 }
1568
1569 unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::CalculatorDivideRequest, ___E>
1570 for &'a CalculatorDivideRequest<T0, T1>
1571 where
1572 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1573 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1574 &'a T1: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1575 {
1576 #[inline]
1577 fn encode(
1578 self,
1579 encoder_: &mut ___E,
1580 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideRequest>,
1581 _: (),
1582 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1583 ::fidl_next::munge! {
1584 let crate::wire::CalculatorDivideRequest {
1585 dividend,
1586 divisor,
1587
1588 } = out_;
1589 }
1590
1591 ::fidl_next::Encode::encode(&self.dividend, encoder_, dividend, ())?;
1592
1593 ::fidl_next::Encode::encode(&self.divisor, encoder_, divisor, ())?;
1594
1595 Ok(())
1596 }
1597 }
1598
1599 pub struct CalculatorDivideResponse<T0, T1> {
1601 pub quotient: T0,
1602
1603 pub remainder: T1,
1604 }
1605
1606 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::CalculatorDivideResponse, ___E>
1607 for CalculatorDivideResponse<T0, T1>
1608 where
1609 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1610 T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1611 T1: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1612 {
1613 #[inline]
1614 fn encode(
1615 self,
1616 encoder_: &mut ___E,
1617 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideResponse>,
1618 _: (),
1619 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1620 ::fidl_next::munge! {
1621 let crate::wire::CalculatorDivideResponse {
1622 quotient,
1623 remainder,
1624
1625 } = out_;
1626 }
1627
1628 ::fidl_next::Encode::encode(self.quotient, encoder_, quotient, ())?;
1629
1630 ::fidl_next::Encode::encode(self.remainder, encoder_, remainder, ())?;
1631
1632 Ok(())
1633 }
1634 }
1635
1636 unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::CalculatorDivideResponse, ___E>
1637 for &'a CalculatorDivideResponse<T0, T1>
1638 where
1639 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1640 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1641 &'a T1: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1642 {
1643 #[inline]
1644 fn encode(
1645 self,
1646 encoder_: &mut ___E,
1647 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideResponse>,
1648 _: (),
1649 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1650 ::fidl_next::munge! {
1651 let crate::wire::CalculatorDivideResponse {
1652 quotient,
1653 remainder,
1654
1655 } = out_;
1656 }
1657
1658 ::fidl_next::Encode::encode(&self.quotient, encoder_, quotient, ())?;
1659
1660 ::fidl_next::Encode::encode(&self.remainder, encoder_, remainder, ())?;
1661
1662 Ok(())
1663 }
1664 }
1665
1666 pub struct CalculatorOnErrorRequest<T0> {
1668 pub status_code: T0,
1669 }
1670
1671 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>
1672 for CalculatorOnErrorRequest<T0>
1673 where
1674 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1675 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1676 {
1677 #[inline]
1678 fn encode(
1679 self,
1680 encoder_: &mut ___E,
1681 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorOnErrorRequest>,
1682 _: (),
1683 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1684 ::fidl_next::munge! {
1685 let crate::wire::CalculatorOnErrorRequest {
1686 status_code,
1687
1688 } = out_;
1689 }
1690
1691 ::fidl_next::Encode::encode(self.status_code, encoder_, status_code, ())?;
1692
1693 Ok(())
1694 }
1695 }
1696
1697 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>
1698 for &'a CalculatorOnErrorRequest<T0>
1699 where
1700 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1701 &'a T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1702 {
1703 #[inline]
1704 fn encode(
1705 self,
1706 encoder_: &mut ___E,
1707 out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorOnErrorRequest>,
1708 _: (),
1709 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1710 ::fidl_next::munge! {
1711 let crate::wire::CalculatorOnErrorRequest {
1712 status_code,
1713
1714 } = out_;
1715 }
1716
1717 ::fidl_next::Encode::encode(&self.status_code, encoder_, status_code, ())?;
1718
1719 Ok(())
1720 }
1721 }
1722}
1723
1724pub use self::natural::*;
1725
1726#[derive(PartialEq, Debug)]
1728pub struct Calculator;
1729
1730#[cfg(target_os = "fuchsia")]
1731impl ::fidl_next::HasTransport for Calculator {
1732 type Transport = ::fidl_next::fuchsia::zx::Channel;
1733}
1734
1735pub mod calculator {
1736 pub mod prelude {
1737 pub use crate::{
1738 Calculator, CalculatorClientHandler, CalculatorLocalClientHandler,
1739 CalculatorLocalServerHandler, CalculatorServerHandler, calculator,
1740 };
1741
1742 pub use crate::natural::CalculatorAddRequest;
1743
1744 pub use crate::natural::CalculatorDivideRequest;
1745
1746 pub use crate::natural::CalculatorOnErrorRequest;
1747
1748 pub use crate::natural::CalculatorAddResponse;
1749
1750 pub use crate::natural::CalculatorDivideResponse;
1751
1752 pub use crate::natural::DivisionError;
1753 }
1754
1755 pub struct Add;
1756
1757 impl ::fidl_next::Method for Add {
1758 const ORDINAL: u64 = 8640324702111165953;
1759 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1760 ::fidl_next::protocol::Flexibility::Flexible;
1761
1762 type Protocol = crate::Calculator;
1763
1764 type Request = crate::wire::CalculatorAddRequest;
1765 }
1766
1767 impl ::fidl_next::TwoWayMethod for Add {
1768 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::CalculatorAddResponse>;
1769 }
1770
1771 impl<___R> ::fidl_next::Respond<___R> for Add {
1772 type Output = ::fidl_next::Flexible<crate::generic::CalculatorAddResponse<___R>>;
1773
1774 fn respond(response: ___R) -> Self::Output {
1775 ::fidl_next::Flexible(crate::generic::CalculatorAddResponse { sum: response })
1776 }
1777 }
1778
1779 pub struct Divide;
1780
1781 impl ::fidl_next::Method for Divide {
1782 const ORDINAL: u64 = 5497947425807432439;
1783 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1784 ::fidl_next::protocol::Flexibility::Flexible;
1785
1786 type Protocol = crate::Calculator;
1787
1788 type Request = crate::wire::CalculatorDivideRequest;
1789 }
1790
1791 impl ::fidl_next::TwoWayMethod for Divide {
1792 type Response = ::fidl_next::wire::Result<
1793 'static,
1794 crate::wire::CalculatorDivideResponse,
1795 crate::wire::DivisionError,
1796 >;
1797 }
1798
1799 impl<___R> ::fidl_next::Respond<___R> for Divide {
1800 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1801
1802 fn respond(response: ___R) -> Self::Output {
1803 ::core::result::Result::Ok(response)
1804 }
1805 }
1806
1807 impl<___R> ::fidl_next::RespondErr<___R> for Divide {
1808 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1809
1810 fn respond_err(response: ___R) -> Self::Output {
1811 ::core::result::Result::Err(response)
1812 }
1813 }
1814
1815 pub struct Clear;
1816
1817 impl ::fidl_next::Method for Clear {
1818 const ORDINAL: u64 = 7439411180362570889;
1819 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1820 ::fidl_next::protocol::Flexibility::Flexible;
1821
1822 type Protocol = crate::Calculator;
1823
1824 type Request = ::fidl_next::wire::EmptyMessageBody;
1825 }
1826
1827 pub struct OnError;
1828
1829 impl ::fidl_next::Method for OnError {
1830 const ORDINAL: u64 = 8940578522385404924;
1831 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1832 ::fidl_next::protocol::Flexibility::Flexible;
1833
1834 type Protocol = crate::Calculator;
1835
1836 type Request = crate::wire::CalculatorOnErrorRequest;
1837 }
1838
1839 mod ___detail {
1840 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Calculator
1841 where
1842 ___T: ::fidl_next::Transport,
1843 {
1844 type Client = CalculatorClient<___T>;
1845 type Server = CalculatorServer<___T>;
1846 }
1847
1848 #[repr(transparent)]
1850 pub struct CalculatorClient<___T: ::fidl_next::Transport> {
1851 #[allow(dead_code)]
1852 client: ::fidl_next::protocol::Client<___T>,
1853 }
1854
1855 impl<___T> CalculatorClient<___T>
1856 where
1857 ___T: ::fidl_next::Transport,
1858 {
1859 pub fn add(
1860 &self,
1861
1862 a: impl ::fidl_next::Encode<
1863 ::fidl_next::wire::Int32,
1864 <___T as ::fidl_next::Transport>::SendBuffer,
1865 >,
1866
1867 b: impl ::fidl_next::Encode<
1868 ::fidl_next::wire::Int32,
1869 <___T as ::fidl_next::Transport>::SendBuffer,
1870 >,
1871 ) -> ::fidl_next::TwoWayFuture<'_, super::Add, ___T>
1872 where
1873 <___T as ::fidl_next::Transport>::SendBuffer:
1874 ::fidl_next::encoder::InternalHandleEncoder,
1875 {
1876 self.add_with(crate::generic::CalculatorAddRequest { a, b })
1877 }
1878
1879 pub fn add_with<___R>(
1880 &self,
1881 request: ___R,
1882 ) -> ::fidl_next::TwoWayFuture<'_, super::Add, ___T>
1883 where
1884 ___R: ::fidl_next::Encode<
1885 crate::wire::CalculatorAddRequest,
1886 <___T as ::fidl_next::Transport>::SendBuffer,
1887 >,
1888 {
1889 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1890 8640324702111165953,
1891 <super::Add as ::fidl_next::Method>::FLEXIBILITY,
1892 request,
1893 ))
1894 }
1895
1896 pub fn divide(
1897 &self,
1898
1899 dividend: impl ::fidl_next::Encode<
1900 ::fidl_next::wire::Int32,
1901 <___T as ::fidl_next::Transport>::SendBuffer,
1902 >,
1903
1904 divisor: impl ::fidl_next::Encode<
1905 ::fidl_next::wire::Int32,
1906 <___T as ::fidl_next::Transport>::SendBuffer,
1907 >,
1908 ) -> ::fidl_next::TwoWayFuture<'_, super::Divide, ___T>
1909 where
1910 <___T as ::fidl_next::Transport>::SendBuffer:
1911 ::fidl_next::encoder::InternalHandleEncoder,
1912 {
1913 self.divide_with(crate::generic::CalculatorDivideRequest { dividend, divisor })
1914 }
1915
1916 pub fn divide_with<___R>(
1917 &self,
1918 request: ___R,
1919 ) -> ::fidl_next::TwoWayFuture<'_, super::Divide, ___T>
1920 where
1921 ___R: ::fidl_next::Encode<
1922 crate::wire::CalculatorDivideRequest,
1923 <___T as ::fidl_next::Transport>::SendBuffer,
1924 >,
1925 {
1926 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1927 5497947425807432439,
1928 <super::Divide as ::fidl_next::Method>::FLEXIBILITY,
1929 request,
1930 ))
1931 }
1932
1933 pub fn clear(&self) -> ::fidl_next::SendFuture<'_, ___T> {
1934 ::fidl_next::SendFuture::from_untyped(
1935 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
1936 7439411180362570889,
1937 <super::Clear as ::fidl_next::Method>::FLEXIBILITY,
1938 (),
1939 ),
1940 )
1941 }
1942 }
1943
1944 #[repr(transparent)]
1946 pub struct CalculatorServer<___T: ::fidl_next::Transport> {
1947 server: ::fidl_next::protocol::Server<___T>,
1948 }
1949
1950 impl<___T> CalculatorServer<___T>
1951 where
1952 ___T: ::fidl_next::Transport,
1953 {
1954 pub fn on_error(
1955 &self,
1956
1957 status_code: impl ::fidl_next::Encode<
1958 ::fidl_next::wire::Uint32,
1959 <___T as ::fidl_next::Transport>::SendBuffer,
1960 >,
1961 ) -> ::fidl_next::SendFuture<'_, ___T>
1962 where
1963 <___T as ::fidl_next::Transport>::SendBuffer:
1964 ::fidl_next::encoder::InternalHandleEncoder,
1965 {
1966 self.on_error_with(crate::generic::CalculatorOnErrorRequest { status_code })
1967 }
1968
1969 pub fn on_error_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
1970 where
1971 ___R: ::fidl_next::Encode<
1972 <super::OnError as ::fidl_next::Method>::Request,
1973 <___T as ::fidl_next::Transport>::SendBuffer,
1974 >,
1975 {
1976 ::fidl_next::SendFuture::from_untyped(self.server.send_event(
1977 8940578522385404924,
1978 <super::OnError as ::fidl_next::Method>::FLEXIBILITY,
1979 request,
1980 ))
1981 }
1982 }
1983 }
1984}
1985
1986#[diagnostic::on_unimplemented(
1987 note = "If {Self} implements the non-local CalculatorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1988)]
1989
1990pub trait CalculatorLocalClientHandler<
1994 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1995 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1996>
1997{
1998 fn on_error(
1999 &mut self,
2000
2001 request: ::fidl_next::Request<calculator::OnError, ___T>,
2002 ) -> impl ::core::future::Future<Output = ()>;
2003
2004 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2005 ::core::future::ready(())
2006 }
2007}
2008
2009impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Calculator
2010where
2011 ___H: CalculatorLocalClientHandler<___T>,
2012 ___T: ::fidl_next::Transport,
2013 for<'de> crate::wire::CalculatorOnErrorRequest: ::fidl_next::Decode<
2014 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2015 Constraint = (),
2016 >,
2017{
2018 async fn on_event(
2019 handler: &mut ___H,
2020 mut message: ::fidl_next::Message<___T>,
2021 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2022 match *message.header().ordinal {
2023 8940578522385404924 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
2024 Ok(decoded) => {
2025 handler.on_error(::fidl_next::Request::from_decoded(decoded)).await;
2026 Ok(())
2027 }
2028 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2029 ordinal: 8940578522385404924,
2030 error,
2031 }),
2032 },
2033
2034 ordinal => {
2035 handler.on_unknown_interaction(ordinal).await;
2036 if ::core::matches!(
2037 message.header().flexibility(),
2038 ::fidl_next::protocol::Flexibility::Strict
2039 ) {
2040 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2041 } else {
2042 Ok(())
2043 }
2044 }
2045 }
2046 }
2047}
2048
2049#[diagnostic::on_unimplemented(
2050 note = "If {Self} implements the non-local CalculatorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
2051)]
2052
2053pub trait CalculatorLocalServerHandler<
2057 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2058 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2059>
2060{
2061 fn add(
2062 &mut self,
2063
2064 request: ::fidl_next::Request<calculator::Add, ___T>,
2065
2066 responder: ::fidl_next::Responder<calculator::Add, ___T>,
2067 ) -> impl ::core::future::Future<Output = ()>;
2068
2069 fn divide(
2070 &mut self,
2071
2072 request: ::fidl_next::Request<calculator::Divide, ___T>,
2073
2074 responder: ::fidl_next::Responder<calculator::Divide, ___T>,
2075 ) -> impl ::core::future::Future<Output = ()>;
2076
2077 fn clear(&mut self) -> impl ::core::future::Future<Output = ()>;
2078
2079 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
2080 ::core::future::ready(())
2081 }
2082}
2083
2084impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Calculator
2085where
2086 ___H: CalculatorLocalServerHandler<___T>,
2087 ___T: ::fidl_next::Transport,
2088 for<'de> crate::wire::CalculatorAddRequest: ::fidl_next::Decode<
2089 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2090 Constraint = (),
2091 >,
2092 for<'de> crate::wire::CalculatorDivideRequest: ::fidl_next::Decode<
2093 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2094 Constraint = (),
2095 >,
2096{
2097 async fn on_one_way(
2098 handler: &mut ___H,
2099 mut message: ::fidl_next::Message<___T>,
2100 ) -> ::core::result::Result<
2101 (),
2102 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2103 > {
2104 match *message.header().ordinal {
2105 7439411180362570889 => {
2106 handler.clear().await;
2107 Ok(())
2108 }
2109
2110 ordinal => {
2111 handler.on_unknown_interaction(ordinal).await;
2112 if ::core::matches!(
2113 message.header().flexibility(),
2114 ::fidl_next::protocol::Flexibility::Strict
2115 ) {
2116 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2117 } else {
2118 Ok(())
2119 }
2120 }
2121 }
2122 }
2123
2124 async fn on_two_way(
2125 handler: &mut ___H,
2126 mut message: ::fidl_next::Message<___T>,
2127 responder: ::fidl_next::protocol::Responder<___T>,
2128 ) -> ::core::result::Result<
2129 (),
2130 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2131 > {
2132 match *message.header().ordinal {
2133 8640324702111165953 => {
2134 let responder = ::fidl_next::Responder::from_untyped(responder);
2135
2136 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2137 Ok(decoded) => {
2138 handler.add(::fidl_next::Request::from_decoded(decoded), responder).await;
2139 Ok(())
2140 }
2141 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2142 ordinal: 8640324702111165953,
2143 error,
2144 }),
2145 }
2146 }
2147
2148 5497947425807432439 => {
2149 let responder = ::fidl_next::Responder::from_untyped(responder);
2150
2151 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2152 Ok(decoded) => {
2153 handler
2154 .divide(::fidl_next::Request::from_decoded(decoded), responder)
2155 .await;
2156 Ok(())
2157 }
2158 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2159 ordinal: 5497947425807432439,
2160 error,
2161 }),
2162 }
2163 }
2164
2165 ordinal => {
2166 handler.on_unknown_interaction(ordinal).await;
2167 if ::core::matches!(
2168 message.header().flexibility(),
2169 ::fidl_next::protocol::Flexibility::Strict
2170 ) {
2171 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2172 } else {
2173 responder
2174 .respond_framework_error(
2175 ordinal,
2176 ::fidl_next::FrameworkError::UnknownMethod,
2177 )
2178 .expect("encoding a framework error should never fail")
2179 .await?;
2180 Ok(())
2181 }
2182 }
2183 }
2184 }
2185}
2186
2187pub trait CalculatorClientHandler<
2191 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2192 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2193>
2194{
2195 fn on_error(
2196 &mut self,
2197
2198 request: ::fidl_next::Request<calculator::OnError, ___T>,
2199 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2200
2201 fn on_unknown_interaction(
2202 &mut self,
2203 ordinal: u64,
2204 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2205 ::core::future::ready(())
2206 }
2207}
2208
2209impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Calculator
2210where
2211 ___H: CalculatorClientHandler<___T> + ::core::marker::Send,
2212 ___T: ::fidl_next::Transport,
2213 for<'de> crate::wire::CalculatorOnErrorRequest: ::fidl_next::Decode<
2214 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2215 Constraint = (),
2216 >,
2217{
2218 async fn on_event(
2219 handler: &mut ___H,
2220 mut message: ::fidl_next::Message<___T>,
2221 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2222 match *message.header().ordinal {
2223 8940578522385404924 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
2224 Ok(decoded) => {
2225 handler.on_error(::fidl_next::Request::from_decoded(decoded)).await;
2226 Ok(())
2227 }
2228 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2229 ordinal: 8940578522385404924,
2230 error,
2231 }),
2232 },
2233
2234 ordinal => {
2235 handler.on_unknown_interaction(ordinal).await;
2236 if ::core::matches!(
2237 message.header().flexibility(),
2238 ::fidl_next::protocol::Flexibility::Strict
2239 ) {
2240 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2241 } else {
2242 Ok(())
2243 }
2244 }
2245 }
2246 }
2247}
2248
2249pub trait CalculatorServerHandler<
2253 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2254 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2255>
2256{
2257 fn add(
2258 &mut self,
2259
2260 request: ::fidl_next::Request<calculator::Add, ___T>,
2261
2262 responder: ::fidl_next::Responder<calculator::Add, ___T>,
2263 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2264
2265 fn divide(
2266 &mut self,
2267
2268 request: ::fidl_next::Request<calculator::Divide, ___T>,
2269
2270 responder: ::fidl_next::Responder<calculator::Divide, ___T>,
2271 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2272
2273 fn clear(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2274
2275 fn on_unknown_interaction(
2276 &mut self,
2277 ordinal: u64,
2278 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2279 ::core::future::ready(())
2280 }
2281}
2282
2283impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Calculator
2284where
2285 ___H: CalculatorServerHandler<___T> + ::core::marker::Send,
2286 ___T: ::fidl_next::Transport,
2287 for<'de> crate::wire::CalculatorAddRequest: ::fidl_next::Decode<
2288 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2289 Constraint = (),
2290 >,
2291 for<'de> crate::wire::CalculatorDivideRequest: ::fidl_next::Decode<
2292 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2293 Constraint = (),
2294 >,
2295{
2296 async fn on_one_way(
2297 handler: &mut ___H,
2298 mut message: ::fidl_next::Message<___T>,
2299 ) -> ::core::result::Result<
2300 (),
2301 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2302 > {
2303 match *message.header().ordinal {
2304 7439411180362570889 => {
2305 handler.clear().await;
2306 Ok(())
2307 }
2308
2309 ordinal => {
2310 handler.on_unknown_interaction(ordinal).await;
2311 if ::core::matches!(
2312 message.header().flexibility(),
2313 ::fidl_next::protocol::Flexibility::Strict
2314 ) {
2315 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2316 } else {
2317 Ok(())
2318 }
2319 }
2320 }
2321 }
2322
2323 async fn on_two_way(
2324 handler: &mut ___H,
2325 mut message: ::fidl_next::Message<___T>,
2326 responder: ::fidl_next::protocol::Responder<___T>,
2327 ) -> ::core::result::Result<
2328 (),
2329 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2330 > {
2331 match *message.header().ordinal {
2332 8640324702111165953 => {
2333 let responder = ::fidl_next::Responder::from_untyped(responder);
2334
2335 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2336 Ok(decoded) => {
2337 handler.add(::fidl_next::Request::from_decoded(decoded), responder).await;
2338 Ok(())
2339 }
2340 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2341 ordinal: 8640324702111165953,
2342 error,
2343 }),
2344 }
2345 }
2346
2347 5497947425807432439 => {
2348 let responder = ::fidl_next::Responder::from_untyped(responder);
2349
2350 match ::fidl_next::AsDecoderExt::into_decoded(message) {
2351 Ok(decoded) => {
2352 handler
2353 .divide(::fidl_next::Request::from_decoded(decoded), responder)
2354 .await;
2355 Ok(())
2356 }
2357 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2358 ordinal: 5497947425807432439,
2359 error,
2360 }),
2361 }
2362 }
2363
2364 ordinal => {
2365 handler.on_unknown_interaction(ordinal).await;
2366 if ::core::matches!(
2367 message.header().flexibility(),
2368 ::fidl_next::protocol::Flexibility::Strict
2369 ) {
2370 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2371 } else {
2372 responder
2373 .respond_framework_error(
2374 ordinal,
2375 ::fidl_next::FrameworkError::UnknownMethod,
2376 )
2377 .expect("encoding a framework error should never fail")
2378 .await?;
2379 Ok(())
2380 }
2381 }
2382 }
2383 }
2384}
2385
2386impl<___T> CalculatorClientHandler<___T> for ::fidl_next::IgnoreEvents
2387where
2388 ___T: ::fidl_next::Transport,
2389{
2390 async fn on_error(&mut self, _: ::fidl_next::Request<calculator::OnError, ___T>) {}
2391
2392 async fn on_unknown_interaction(&mut self, _: u64) {}
2393}
2394
2395impl<___H, ___T> CalculatorLocalClientHandler<___T> for ::fidl_next::Local<___H>
2396where
2397 ___H: CalculatorClientHandler<___T>,
2398 ___T: ::fidl_next::Transport,
2399{
2400 async fn on_error(&mut self, request: ::fidl_next::Request<calculator::OnError, ___T>) {
2401 ___H::on_error(&mut self.0, request).await
2402 }
2403
2404 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2405 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2406 }
2407}
2408
2409impl<___H, ___T> CalculatorLocalServerHandler<___T> for ::fidl_next::Local<___H>
2410where
2411 ___H: CalculatorServerHandler<___T>,
2412 ___T: ::fidl_next::Transport,
2413{
2414 async fn add(
2415 &mut self,
2416
2417 request: ::fidl_next::Request<calculator::Add, ___T>,
2418
2419 responder: ::fidl_next::Responder<calculator::Add, ___T>,
2420 ) {
2421 ___H::add(&mut self.0, request, responder).await
2422 }
2423
2424 async fn divide(
2425 &mut self,
2426
2427 request: ::fidl_next::Request<calculator::Divide, ___T>,
2428
2429 responder: ::fidl_next::Responder<calculator::Divide, ___T>,
2430 ) {
2431 ___H::divide(&mut self.0, request, responder).await
2432 }
2433
2434 async fn clear(&mut self) {
2435 ___H::clear(&mut self.0).await
2436 }
2437
2438 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2439 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2440 }
2441}