1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5#[derive(Clone, Debug)]
6#[repr(C)]
7pub struct CalculatorAddRequest {
8 pub a: i32,
9
10 pub b: i32,
11}
12
13impl ::fidl_next::Encodable for CalculatorAddRequest {
14 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireCalculatorAddRequest> = unsafe {
15 ::fidl_next::CopyOptimization::enable_if(
16 true && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled()
17 && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
18 )
19 };
20
21 type Encoded = WireCalculatorAddRequest;
22}
23
24unsafe impl<___E> ::fidl_next::Encode<___E> for CalculatorAddRequest
25where
26 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
27{
28 #[inline]
29 fn encode(
30 self,
31 encoder: &mut ___E,
32 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
33 ) -> Result<(), ::fidl_next::EncodeError> {
34 ::fidl_next::munge! {
35 let Self::Encoded {
36 a,
37 b,
38
39 } = out;
40 }
41
42 ::fidl_next::Encode::encode(self.a, encoder, a)?;
43
44 ::fidl_next::Encode::encode(self.b, encoder, b)?;
45
46 Ok(())
47 }
48}
49
50unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CalculatorAddRequest
51where
52 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
53{
54 #[inline]
55 fn encode_ref(
56 &self,
57 encoder: &mut ___E,
58 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
59 ) -> Result<(), ::fidl_next::EncodeError> {
60 ::fidl_next::munge! {
61 let Self::Encoded {
62 a,
63 b,
64
65 } = out;
66 }
67
68 ::fidl_next::EncodeRef::encode_ref(&self.a, encoder, a)?;
69
70 ::fidl_next::EncodeRef::encode_ref(&self.b, encoder, b)?;
71
72 Ok(())
73 }
74}
75
76impl ::fidl_next::EncodableOption for CalculatorAddRequest {
77 type EncodedOption = ::fidl_next::WireBox<'static, WireCalculatorAddRequest>;
78}
79
80unsafe impl<___E> ::fidl_next::EncodeOption<___E> for CalculatorAddRequest
81where
82 ___E: ::fidl_next::Encoder + ?Sized,
83 CalculatorAddRequest: ::fidl_next::Encode<___E>,
84{
85 #[inline]
86 fn encode_option(
87 this: Option<Self>,
88 encoder: &mut ___E,
89 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
90 ) -> Result<(), ::fidl_next::EncodeError> {
91 if let Some(inner) = this {
92 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
93 ::fidl_next::WireBox::encode_present(out);
94 } else {
95 ::fidl_next::WireBox::encode_absent(out);
96 }
97
98 Ok(())
99 }
100}
101
102unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for CalculatorAddRequest
103where
104 ___E: ::fidl_next::Encoder + ?Sized,
105 CalculatorAddRequest: ::fidl_next::EncodeRef<___E>,
106{
107 #[inline]
108 fn encode_option_ref(
109 this: Option<&Self>,
110 encoder: &mut ___E,
111 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
112 ) -> Result<(), ::fidl_next::EncodeError> {
113 if let Some(inner) = this {
114 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
115 ::fidl_next::WireBox::encode_present(out);
116 } else {
117 ::fidl_next::WireBox::encode_absent(out);
118 }
119
120 Ok(())
121 }
122}
123
124impl ::fidl_next::FromWire<WireCalculatorAddRequest> for CalculatorAddRequest {
125 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireCalculatorAddRequest, Self> = unsafe {
126 ::fidl_next::CopyOptimization::enable_if(
127 true && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
128 .is_enabled()
129 && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
130 .is_enabled(),
131 )
132 };
133
134 #[inline]
135 fn from_wire(wire: WireCalculatorAddRequest) -> Self {
136 Self {
137 a: ::fidl_next::FromWire::from_wire(wire.a),
138
139 b: ::fidl_next::FromWire::from_wire(wire.b),
140 }
141 }
142}
143
144impl ::fidl_next::FromWireRef<WireCalculatorAddRequest> for CalculatorAddRequest {
145 #[inline]
146 fn from_wire_ref(wire: &WireCalculatorAddRequest) -> Self {
147 Self {
148 a: ::fidl_next::FromWireRef::from_wire_ref(&wire.a),
149
150 b: ::fidl_next::FromWireRef::from_wire_ref(&wire.b),
151 }
152 }
153}
154
155#[derive(Clone, Debug)]
157#[repr(C)]
158pub struct WireCalculatorAddRequest {
159 pub a: ::fidl_next::WireI32,
160
161 pub b: ::fidl_next::WireI32,
162}
163
164unsafe impl ::fidl_next::Wire for WireCalculatorAddRequest {
165 type Decoded<'de> = WireCalculatorAddRequest;
166
167 #[inline]
168 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
169}
170
171unsafe impl<___D> ::fidl_next::Decode<___D> for WireCalculatorAddRequest
172where
173 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
174{
175 fn decode(
176 slot: ::fidl_next::Slot<'_, Self>,
177 decoder: &mut ___D,
178 ) -> Result<(), ::fidl_next::DecodeError> {
179 ::fidl_next::munge! {
180 let Self {
181 mut a,
182 mut b,
183
184 } = slot;
185 }
186
187 ::fidl_next::Decode::decode(a.as_mut(), decoder)?;
188
189 ::fidl_next::Decode::decode(b.as_mut(), decoder)?;
190
191 Ok(())
192 }
193}
194
195#[derive(Clone, Debug)]
196#[repr(C)]
197pub struct CalculatorAddResponse {
198 pub sum: i32,
199}
200
201impl ::fidl_next::Encodable for CalculatorAddResponse {
202 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireCalculatorAddResponse> = unsafe {
203 ::fidl_next::CopyOptimization::enable_if(
204 true && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
205 )
206 };
207
208 type Encoded = WireCalculatorAddResponse;
209}
210
211unsafe impl<___E> ::fidl_next::Encode<___E> for CalculatorAddResponse
212where
213 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
214{
215 #[inline]
216 fn encode(
217 self,
218 encoder: &mut ___E,
219 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
220 ) -> Result<(), ::fidl_next::EncodeError> {
221 ::fidl_next::munge! {
222 let Self::Encoded {
223 sum,
224
225 } = out;
226 }
227
228 ::fidl_next::Encode::encode(self.sum, encoder, sum)?;
229
230 Ok(())
231 }
232}
233
234unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CalculatorAddResponse
235where
236 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
237{
238 #[inline]
239 fn encode_ref(
240 &self,
241 encoder: &mut ___E,
242 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
243 ) -> Result<(), ::fidl_next::EncodeError> {
244 ::fidl_next::munge! {
245 let Self::Encoded {
246 sum,
247
248 } = out;
249 }
250
251 ::fidl_next::EncodeRef::encode_ref(&self.sum, encoder, sum)?;
252
253 Ok(())
254 }
255}
256
257impl ::fidl_next::EncodableOption for CalculatorAddResponse {
258 type EncodedOption = ::fidl_next::WireBox<'static, WireCalculatorAddResponse>;
259}
260
261unsafe impl<___E> ::fidl_next::EncodeOption<___E> for CalculatorAddResponse
262where
263 ___E: ::fidl_next::Encoder + ?Sized,
264 CalculatorAddResponse: ::fidl_next::Encode<___E>,
265{
266 #[inline]
267 fn encode_option(
268 this: Option<Self>,
269 encoder: &mut ___E,
270 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
271 ) -> Result<(), ::fidl_next::EncodeError> {
272 if let Some(inner) = this {
273 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
274 ::fidl_next::WireBox::encode_present(out);
275 } else {
276 ::fidl_next::WireBox::encode_absent(out);
277 }
278
279 Ok(())
280 }
281}
282
283unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for CalculatorAddResponse
284where
285 ___E: ::fidl_next::Encoder + ?Sized,
286 CalculatorAddResponse: ::fidl_next::EncodeRef<___E>,
287{
288 #[inline]
289 fn encode_option_ref(
290 this: Option<&Self>,
291 encoder: &mut ___E,
292 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
293 ) -> Result<(), ::fidl_next::EncodeError> {
294 if let Some(inner) = this {
295 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
296 ::fidl_next::WireBox::encode_present(out);
297 } else {
298 ::fidl_next::WireBox::encode_absent(out);
299 }
300
301 Ok(())
302 }
303}
304
305impl ::fidl_next::FromWire<WireCalculatorAddResponse> for CalculatorAddResponse {
306 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireCalculatorAddResponse, Self> = unsafe {
307 ::fidl_next::CopyOptimization::enable_if(
308 true && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
309 .is_enabled(),
310 )
311 };
312
313 #[inline]
314 fn from_wire(wire: WireCalculatorAddResponse) -> Self {
315 Self { sum: ::fidl_next::FromWire::from_wire(wire.sum) }
316 }
317}
318
319impl ::fidl_next::FromWireRef<WireCalculatorAddResponse> for CalculatorAddResponse {
320 #[inline]
321 fn from_wire_ref(wire: &WireCalculatorAddResponse) -> Self {
322 Self { sum: ::fidl_next::FromWireRef::from_wire_ref(&wire.sum) }
323 }
324}
325
326#[derive(Clone, Debug)]
328#[repr(C)]
329pub struct WireCalculatorAddResponse {
330 pub sum: ::fidl_next::WireI32,
331}
332
333unsafe impl ::fidl_next::Wire for WireCalculatorAddResponse {
334 type Decoded<'de> = WireCalculatorAddResponse;
335
336 #[inline]
337 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
338}
339
340unsafe impl<___D> ::fidl_next::Decode<___D> for WireCalculatorAddResponse
341where
342 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
343{
344 fn decode(
345 slot: ::fidl_next::Slot<'_, Self>,
346 decoder: &mut ___D,
347 ) -> Result<(), ::fidl_next::DecodeError> {
348 ::fidl_next::munge! {
349 let Self {
350 mut sum,
351
352 } = slot;
353 }
354
355 ::fidl_next::Decode::decode(sum.as_mut(), decoder)?;
356
357 Ok(())
358 }
359}
360
361#[derive(Clone, Debug)]
362#[repr(C)]
363pub struct CalculatorDivideRequest {
364 pub dividend: i32,
365
366 pub divisor: i32,
367}
368
369impl ::fidl_next::Encodable for CalculatorDivideRequest {
370 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireCalculatorDivideRequest> = unsafe {
371 ::fidl_next::CopyOptimization::enable_if(
372 true && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled()
373 && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
374 )
375 };
376
377 type Encoded = WireCalculatorDivideRequest;
378}
379
380unsafe impl<___E> ::fidl_next::Encode<___E> for CalculatorDivideRequest
381where
382 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
383{
384 #[inline]
385 fn encode(
386 self,
387 encoder: &mut ___E,
388 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
389 ) -> Result<(), ::fidl_next::EncodeError> {
390 ::fidl_next::munge! {
391 let Self::Encoded {
392 dividend,
393 divisor,
394
395 } = out;
396 }
397
398 ::fidl_next::Encode::encode(self.dividend, encoder, dividend)?;
399
400 ::fidl_next::Encode::encode(self.divisor, encoder, divisor)?;
401
402 Ok(())
403 }
404}
405
406unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CalculatorDivideRequest
407where
408 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
409{
410 #[inline]
411 fn encode_ref(
412 &self,
413 encoder: &mut ___E,
414 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
415 ) -> Result<(), ::fidl_next::EncodeError> {
416 ::fidl_next::munge! {
417 let Self::Encoded {
418 dividend,
419 divisor,
420
421 } = out;
422 }
423
424 ::fidl_next::EncodeRef::encode_ref(&self.dividend, encoder, dividend)?;
425
426 ::fidl_next::EncodeRef::encode_ref(&self.divisor, encoder, divisor)?;
427
428 Ok(())
429 }
430}
431
432impl ::fidl_next::EncodableOption for CalculatorDivideRequest {
433 type EncodedOption = ::fidl_next::WireBox<'static, WireCalculatorDivideRequest>;
434}
435
436unsafe impl<___E> ::fidl_next::EncodeOption<___E> for CalculatorDivideRequest
437where
438 ___E: ::fidl_next::Encoder + ?Sized,
439 CalculatorDivideRequest: ::fidl_next::Encode<___E>,
440{
441 #[inline]
442 fn encode_option(
443 this: Option<Self>,
444 encoder: &mut ___E,
445 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
446 ) -> Result<(), ::fidl_next::EncodeError> {
447 if let Some(inner) = this {
448 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
449 ::fidl_next::WireBox::encode_present(out);
450 } else {
451 ::fidl_next::WireBox::encode_absent(out);
452 }
453
454 Ok(())
455 }
456}
457
458unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for CalculatorDivideRequest
459where
460 ___E: ::fidl_next::Encoder + ?Sized,
461 CalculatorDivideRequest: ::fidl_next::EncodeRef<___E>,
462{
463 #[inline]
464 fn encode_option_ref(
465 this: Option<&Self>,
466 encoder: &mut ___E,
467 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
468 ) -> Result<(), ::fidl_next::EncodeError> {
469 if let Some(inner) = this {
470 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
471 ::fidl_next::WireBox::encode_present(out);
472 } else {
473 ::fidl_next::WireBox::encode_absent(out);
474 }
475
476 Ok(())
477 }
478}
479
480impl ::fidl_next::FromWire<WireCalculatorDivideRequest> for CalculatorDivideRequest {
481 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireCalculatorDivideRequest, Self> = unsafe {
482 ::fidl_next::CopyOptimization::enable_if(
483 true && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
484 .is_enabled()
485 && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
486 .is_enabled(),
487 )
488 };
489
490 #[inline]
491 fn from_wire(wire: WireCalculatorDivideRequest) -> Self {
492 Self {
493 dividend: ::fidl_next::FromWire::from_wire(wire.dividend),
494
495 divisor: ::fidl_next::FromWire::from_wire(wire.divisor),
496 }
497 }
498}
499
500impl ::fidl_next::FromWireRef<WireCalculatorDivideRequest> for CalculatorDivideRequest {
501 #[inline]
502 fn from_wire_ref(wire: &WireCalculatorDivideRequest) -> Self {
503 Self {
504 dividend: ::fidl_next::FromWireRef::from_wire_ref(&wire.dividend),
505
506 divisor: ::fidl_next::FromWireRef::from_wire_ref(&wire.divisor),
507 }
508 }
509}
510
511#[derive(Clone, Debug)]
513#[repr(C)]
514pub struct WireCalculatorDivideRequest {
515 pub dividend: ::fidl_next::WireI32,
516
517 pub divisor: ::fidl_next::WireI32,
518}
519
520unsafe impl ::fidl_next::Wire for WireCalculatorDivideRequest {
521 type Decoded<'de> = WireCalculatorDivideRequest;
522
523 #[inline]
524 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
525}
526
527unsafe impl<___D> ::fidl_next::Decode<___D> for WireCalculatorDivideRequest
528where
529 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
530{
531 fn decode(
532 slot: ::fidl_next::Slot<'_, Self>,
533 decoder: &mut ___D,
534 ) -> Result<(), ::fidl_next::DecodeError> {
535 ::fidl_next::munge! {
536 let Self {
537 mut dividend,
538 mut divisor,
539
540 } = slot;
541 }
542
543 ::fidl_next::Decode::decode(dividend.as_mut(), decoder)?;
544
545 ::fidl_next::Decode::decode(divisor.as_mut(), decoder)?;
546
547 Ok(())
548 }
549}
550
551#[derive(Clone, Debug)]
552#[repr(C)]
553pub struct CalculatorDivideResponse {
554 pub quotient: i32,
555
556 pub remainder: i32,
557}
558
559impl ::fidl_next::Encodable for CalculatorDivideResponse {
560 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireCalculatorDivideResponse> = unsafe {
561 ::fidl_next::CopyOptimization::enable_if(
562 true && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled()
563 && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
564 )
565 };
566
567 type Encoded = WireCalculatorDivideResponse;
568}
569
570unsafe impl<___E> ::fidl_next::Encode<___E> for CalculatorDivideResponse
571where
572 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
573{
574 #[inline]
575 fn encode(
576 self,
577 encoder: &mut ___E,
578 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
579 ) -> Result<(), ::fidl_next::EncodeError> {
580 ::fidl_next::munge! {
581 let Self::Encoded {
582 quotient,
583 remainder,
584
585 } = out;
586 }
587
588 ::fidl_next::Encode::encode(self.quotient, encoder, quotient)?;
589
590 ::fidl_next::Encode::encode(self.remainder, encoder, remainder)?;
591
592 Ok(())
593 }
594}
595
596unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CalculatorDivideResponse
597where
598 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
599{
600 #[inline]
601 fn encode_ref(
602 &self,
603 encoder: &mut ___E,
604 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
605 ) -> Result<(), ::fidl_next::EncodeError> {
606 ::fidl_next::munge! {
607 let Self::Encoded {
608 quotient,
609 remainder,
610
611 } = out;
612 }
613
614 ::fidl_next::EncodeRef::encode_ref(&self.quotient, encoder, quotient)?;
615
616 ::fidl_next::EncodeRef::encode_ref(&self.remainder, encoder, remainder)?;
617
618 Ok(())
619 }
620}
621
622impl ::fidl_next::EncodableOption for CalculatorDivideResponse {
623 type EncodedOption = ::fidl_next::WireBox<'static, WireCalculatorDivideResponse>;
624}
625
626unsafe impl<___E> ::fidl_next::EncodeOption<___E> for CalculatorDivideResponse
627where
628 ___E: ::fidl_next::Encoder + ?Sized,
629 CalculatorDivideResponse: ::fidl_next::Encode<___E>,
630{
631 #[inline]
632 fn encode_option(
633 this: Option<Self>,
634 encoder: &mut ___E,
635 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
636 ) -> Result<(), ::fidl_next::EncodeError> {
637 if let Some(inner) = this {
638 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
639 ::fidl_next::WireBox::encode_present(out);
640 } else {
641 ::fidl_next::WireBox::encode_absent(out);
642 }
643
644 Ok(())
645 }
646}
647
648unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for CalculatorDivideResponse
649where
650 ___E: ::fidl_next::Encoder + ?Sized,
651 CalculatorDivideResponse: ::fidl_next::EncodeRef<___E>,
652{
653 #[inline]
654 fn encode_option_ref(
655 this: Option<&Self>,
656 encoder: &mut ___E,
657 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
658 ) -> Result<(), ::fidl_next::EncodeError> {
659 if let Some(inner) = this {
660 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
661 ::fidl_next::WireBox::encode_present(out);
662 } else {
663 ::fidl_next::WireBox::encode_absent(out);
664 }
665
666 Ok(())
667 }
668}
669
670impl ::fidl_next::FromWire<WireCalculatorDivideResponse> for CalculatorDivideResponse {
671 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireCalculatorDivideResponse, Self> = unsafe {
672 ::fidl_next::CopyOptimization::enable_if(
673 true && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
674 .is_enabled()
675 && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
676 .is_enabled(),
677 )
678 };
679
680 #[inline]
681 fn from_wire(wire: WireCalculatorDivideResponse) -> Self {
682 Self {
683 quotient: ::fidl_next::FromWire::from_wire(wire.quotient),
684
685 remainder: ::fidl_next::FromWire::from_wire(wire.remainder),
686 }
687 }
688}
689
690impl ::fidl_next::FromWireRef<WireCalculatorDivideResponse> for CalculatorDivideResponse {
691 #[inline]
692 fn from_wire_ref(wire: &WireCalculatorDivideResponse) -> Self {
693 Self {
694 quotient: ::fidl_next::FromWireRef::from_wire_ref(&wire.quotient),
695
696 remainder: ::fidl_next::FromWireRef::from_wire_ref(&wire.remainder),
697 }
698 }
699}
700
701#[derive(Clone, Debug)]
703#[repr(C)]
704pub struct WireCalculatorDivideResponse {
705 pub quotient: ::fidl_next::WireI32,
706
707 pub remainder: ::fidl_next::WireI32,
708}
709
710unsafe impl ::fidl_next::Wire for WireCalculatorDivideResponse {
711 type Decoded<'de> = WireCalculatorDivideResponse;
712
713 #[inline]
714 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
715}
716
717unsafe impl<___D> ::fidl_next::Decode<___D> for WireCalculatorDivideResponse
718where
719 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
720{
721 fn decode(
722 slot: ::fidl_next::Slot<'_, Self>,
723 decoder: &mut ___D,
724 ) -> Result<(), ::fidl_next::DecodeError> {
725 ::fidl_next::munge! {
726 let Self {
727 mut quotient,
728 mut remainder,
729
730 } = slot;
731 }
732
733 ::fidl_next::Decode::decode(quotient.as_mut(), decoder)?;
734
735 ::fidl_next::Decode::decode(remainder.as_mut(), decoder)?;
736
737 Ok(())
738 }
739}
740
741#[derive(Clone, Copy, Debug, PartialEq, Eq)]
742#[repr(u32)]
743pub enum DivisionError {
744 DivideByZero = 1,
745}
746
747impl ::fidl_next::Encodable for DivisionError {
748 type Encoded = WireDivisionError;
749}
750impl ::std::convert::TryFrom<u32> for DivisionError {
751 type Error = ::fidl_next::UnknownStrictEnumMemberError;
752 fn try_from(value: u32) -> Result<Self, Self::Error> {
753 match value {
754 1 => Ok(Self::DivideByZero),
755
756 _ => Err(Self::Error::new(value.into())),
757 }
758 }
759}
760
761unsafe impl<___E> ::fidl_next::Encode<___E> for DivisionError
762where
763 ___E: ?Sized,
764{
765 #[inline]
766 fn encode(
767 self,
768 encoder: &mut ___E,
769 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
770 ) -> Result<(), ::fidl_next::EncodeError> {
771 ::fidl_next::EncodeRef::encode_ref(&self, encoder, out)
772 }
773}
774
775unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DivisionError
776where
777 ___E: ?Sized,
778{
779 #[inline]
780 fn encode_ref(
781 &self,
782 encoder: &mut ___E,
783 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
784 ) -> Result<(), ::fidl_next::EncodeError> {
785 ::fidl_next::munge!(let WireDivisionError { value } = out);
786 let _ = value.write(::fidl_next::WireU32::from(match *self {
787 Self::DivideByZero => 1,
788 }));
789
790 Ok(())
791 }
792}
793
794impl ::core::convert::From<WireDivisionError> for DivisionError {
795 fn from(wire: WireDivisionError) -> Self {
796 match u32::from(wire.value) {
797 1 => Self::DivideByZero,
798
799 _ => unsafe { ::core::hint::unreachable_unchecked() },
800 }
801 }
802}
803
804impl ::fidl_next::FromWire<WireDivisionError> for DivisionError {
805 #[inline]
806 fn from_wire(wire: WireDivisionError) -> Self {
807 Self::from(wire)
808 }
809}
810
811impl ::fidl_next::FromWireRef<WireDivisionError> for DivisionError {
812 #[inline]
813 fn from_wire_ref(wire: &WireDivisionError) -> Self {
814 Self::from(*wire)
815 }
816}
817
818#[derive(Clone, Copy, Debug, PartialEq, Eq)]
820#[repr(transparent)]
821pub struct WireDivisionError {
822 value: ::fidl_next::WireU32,
823}
824
825unsafe impl ::fidl_next::Wire for WireDivisionError {
826 type Decoded<'de> = Self;
827
828 #[inline]
829 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
830 }
832}
833
834impl WireDivisionError {
835 pub const DIVIDE_BY_ZERO: WireDivisionError =
836 WireDivisionError { value: ::fidl_next::WireU32(1) };
837}
838
839unsafe impl<___D> ::fidl_next::Decode<___D> for WireDivisionError
840where
841 ___D: ?Sized,
842{
843 fn decode(
844 slot: ::fidl_next::Slot<'_, Self>,
845 _: &mut ___D,
846 ) -> Result<(), ::fidl_next::DecodeError> {
847 ::fidl_next::munge!(let Self { value } = slot);
848
849 match u32::from(*value) {
850 1 => (),
851 unknown => return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)),
852 }
853
854 Ok(())
855 }
856}
857
858impl ::core::convert::From<DivisionError> for WireDivisionError {
859 fn from(natural: DivisionError) -> Self {
860 match natural {
861 DivisionError::DivideByZero => WireDivisionError::DIVIDE_BY_ZERO,
862 }
863 }
864}
865
866#[derive(Clone, Debug)]
867#[repr(C)]
868pub struct CalculatorOnErrorRequest {
869 pub status_code: u32,
870}
871
872impl ::fidl_next::Encodable for CalculatorOnErrorRequest {
873 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, WireCalculatorOnErrorRequest> = unsafe {
874 ::fidl_next::CopyOptimization::enable_if(
875 true && <u32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
876 )
877 };
878
879 type Encoded = WireCalculatorOnErrorRequest;
880}
881
882unsafe impl<___E> ::fidl_next::Encode<___E> for CalculatorOnErrorRequest
883where
884 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
885{
886 #[inline]
887 fn encode(
888 self,
889 encoder: &mut ___E,
890 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
891 ) -> Result<(), ::fidl_next::EncodeError> {
892 ::fidl_next::munge! {
893 let Self::Encoded {
894 status_code,
895
896 } = out;
897 }
898
899 ::fidl_next::Encode::encode(self.status_code, encoder, status_code)?;
900
901 Ok(())
902 }
903}
904
905unsafe impl<___E> ::fidl_next::EncodeRef<___E> for CalculatorOnErrorRequest
906where
907 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
908{
909 #[inline]
910 fn encode_ref(
911 &self,
912 encoder: &mut ___E,
913 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
914 ) -> Result<(), ::fidl_next::EncodeError> {
915 ::fidl_next::munge! {
916 let Self::Encoded {
917 status_code,
918
919 } = out;
920 }
921
922 ::fidl_next::EncodeRef::encode_ref(&self.status_code, encoder, status_code)?;
923
924 Ok(())
925 }
926}
927
928impl ::fidl_next::EncodableOption for CalculatorOnErrorRequest {
929 type EncodedOption = ::fidl_next::WireBox<'static, WireCalculatorOnErrorRequest>;
930}
931
932unsafe impl<___E> ::fidl_next::EncodeOption<___E> for CalculatorOnErrorRequest
933where
934 ___E: ::fidl_next::Encoder + ?Sized,
935 CalculatorOnErrorRequest: ::fidl_next::Encode<___E>,
936{
937 #[inline]
938 fn encode_option(
939 this: Option<Self>,
940 encoder: &mut ___E,
941 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
942 ) -> Result<(), ::fidl_next::EncodeError> {
943 if let Some(inner) = this {
944 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
945 ::fidl_next::WireBox::encode_present(out);
946 } else {
947 ::fidl_next::WireBox::encode_absent(out);
948 }
949
950 Ok(())
951 }
952}
953
954unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for CalculatorOnErrorRequest
955where
956 ___E: ::fidl_next::Encoder + ?Sized,
957 CalculatorOnErrorRequest: ::fidl_next::EncodeRef<___E>,
958{
959 #[inline]
960 fn encode_option_ref(
961 this: Option<&Self>,
962 encoder: &mut ___E,
963 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
964 ) -> Result<(), ::fidl_next::EncodeError> {
965 if let Some(inner) = this {
966 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
967 ::fidl_next::WireBox::encode_present(out);
968 } else {
969 ::fidl_next::WireBox::encode_absent(out);
970 }
971
972 Ok(())
973 }
974}
975
976impl ::fidl_next::FromWire<WireCalculatorOnErrorRequest> for CalculatorOnErrorRequest {
977 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<WireCalculatorOnErrorRequest, Self> = unsafe {
978 ::fidl_next::CopyOptimization::enable_if(
979 true && <u32 as ::fidl_next::FromWire<::fidl_next::WireU32>>::COPY_OPTIMIZATION
980 .is_enabled(),
981 )
982 };
983
984 #[inline]
985 fn from_wire(wire: WireCalculatorOnErrorRequest) -> Self {
986 Self { status_code: ::fidl_next::FromWire::from_wire(wire.status_code) }
987 }
988}
989
990impl ::fidl_next::FromWireRef<WireCalculatorOnErrorRequest> for CalculatorOnErrorRequest {
991 #[inline]
992 fn from_wire_ref(wire: &WireCalculatorOnErrorRequest) -> Self {
993 Self { status_code: ::fidl_next::FromWireRef::from_wire_ref(&wire.status_code) }
994 }
995}
996
997#[derive(Clone, Debug)]
999#[repr(C)]
1000pub struct WireCalculatorOnErrorRequest {
1001 pub status_code: ::fidl_next::WireU32,
1002}
1003
1004unsafe impl ::fidl_next::Wire for WireCalculatorOnErrorRequest {
1005 type Decoded<'de> = WireCalculatorOnErrorRequest;
1006
1007 #[inline]
1008 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {}
1009}
1010
1011unsafe impl<___D> ::fidl_next::Decode<___D> for WireCalculatorOnErrorRequest
1012where
1013 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1014{
1015 fn decode(
1016 slot: ::fidl_next::Slot<'_, Self>,
1017 decoder: &mut ___D,
1018 ) -> Result<(), ::fidl_next::DecodeError> {
1019 ::fidl_next::munge! {
1020 let Self {
1021 mut status_code,
1022
1023 } = slot;
1024 }
1025
1026 ::fidl_next::Decode::decode(status_code.as_mut(), decoder)?;
1027
1028 Ok(())
1029 }
1030}
1031
1032#[derive(Debug)]
1034pub struct Calculator;
1035
1036pub mod calculator {
1037 pub mod prelude {
1038 pub use crate::{calculator, Calculator, CalculatorClientHandler, CalculatorServerHandler};
1039
1040 pub use crate::CalculatorAddRequest;
1041
1042 pub use crate::CalculatorDivideRequest;
1043
1044 pub use crate::CalculatorOnErrorRequest;
1045
1046 pub use crate::CalculatorAddResponse;
1047
1048 pub use crate::CalculatorDivideResponse;
1049
1050 pub use crate::DivisionError;
1051 }
1052
1053 pub struct Add;
1054
1055 impl ::fidl_next::Method for Add {
1056 const ORDINAL: u64 = 8640324702111165953;
1057
1058 type Protocol = crate::Calculator;
1059
1060 type Request = crate::WireCalculatorAddRequest;
1061
1062 type Response = ::fidl_next::WireFlexible<'static, crate::WireCalculatorAddResponse>;
1063 }
1064
1065 pub struct Divide;
1066
1067 impl ::fidl_next::Method for Divide {
1068 const ORDINAL: u64 = 5497947425807432439;
1069
1070 type Protocol = crate::Calculator;
1071
1072 type Request = crate::WireCalculatorDivideRequest;
1073
1074 type Response = ::fidl_next::WireFlexibleResult<
1075 'static,
1076 crate::WireCalculatorDivideResponse,
1077 crate::WireDivisionError,
1078 >;
1079 }
1080
1081 pub struct Clear;
1082
1083 impl ::fidl_next::Method for Clear {
1084 const ORDINAL: u64 = 7439411180362570889;
1085
1086 type Protocol = crate::Calculator;
1087
1088 type Request = ();
1089
1090 type Response = ::fidl_next::Never;
1091 }
1092
1093 pub struct OnError;
1094
1095 impl ::fidl_next::Method for OnError {
1096 const ORDINAL: u64 = 8940578522385404924;
1097
1098 type Protocol = crate::Calculator;
1099
1100 type Request = ::fidl_next::Never;
1101
1102 type Response = crate::WireCalculatorOnErrorRequest;
1103 }
1104
1105 mod ___detail {
1106
1107 pub struct Add<T0, T1> {
1108 a: T0,
1109
1110 b: T1,
1111 }
1112
1113 impl<T0, T1> ::fidl_next::Encodable for Add<T0, T1>
1114 where
1115 T0: ::fidl_next::Encodable<Encoded = ::fidl_next::WireI32>,
1116
1117 T1: ::fidl_next::Encodable<Encoded = ::fidl_next::WireI32>,
1118 {
1119 type Encoded = crate::WireCalculatorAddRequest;
1120 }
1121
1122 unsafe impl<___E, T0, T1> ::fidl_next::Encode<___E> for Add<T0, T1>
1123 where
1124 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1125
1126 T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireI32>,
1127
1128 T1: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireI32>,
1129 {
1130 #[inline]
1131 fn encode(
1132 self,
1133 encoder: &mut ___E,
1134 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1135 ) -> Result<(), ::fidl_next::EncodeError> {
1136 ::fidl_next::munge! {
1137 let Self::Encoded {
1138 a,
1139 b,
1140
1141 } = out;
1142 }
1143
1144 ::fidl_next::Encode::encode(self.a, encoder, a)?;
1145
1146 ::fidl_next::Encode::encode(self.b, encoder, b)?;
1147
1148 Ok(())
1149 }
1150 }
1151
1152 pub struct Divide<T0, T1> {
1153 dividend: T0,
1154
1155 divisor: T1,
1156 }
1157
1158 impl<T0, T1> ::fidl_next::Encodable for Divide<T0, T1>
1159 where
1160 T0: ::fidl_next::Encodable<Encoded = ::fidl_next::WireI32>,
1161
1162 T1: ::fidl_next::Encodable<Encoded = ::fidl_next::WireI32>,
1163 {
1164 type Encoded = crate::WireCalculatorDivideRequest;
1165 }
1166
1167 unsafe impl<___E, T0, T1> ::fidl_next::Encode<___E> for Divide<T0, T1>
1168 where
1169 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1170
1171 T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireI32>,
1172
1173 T1: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireI32>,
1174 {
1175 #[inline]
1176 fn encode(
1177 self,
1178 encoder: &mut ___E,
1179 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1180 ) -> Result<(), ::fidl_next::EncodeError> {
1181 ::fidl_next::munge! {
1182 let Self::Encoded {
1183 dividend,
1184 divisor,
1185
1186 } = out;
1187 }
1188
1189 ::fidl_next::Encode::encode(self.dividend, encoder, dividend)?;
1190
1191 ::fidl_next::Encode::encode(self.divisor, encoder, divisor)?;
1192
1193 Ok(())
1194 }
1195 }
1196
1197 pub struct OnError<T0> {
1198 status_code: T0,
1199 }
1200
1201 impl<T0> ::fidl_next::Encodable for OnError<T0>
1202 where
1203 T0: ::fidl_next::Encodable<Encoded = ::fidl_next::WireU32>,
1204 {
1205 type Encoded = crate::WireCalculatorOnErrorRequest;
1206 }
1207
1208 unsafe impl<___E, T0> ::fidl_next::Encode<___E> for OnError<T0>
1209 where
1210 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1211
1212 T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireU32>,
1213 {
1214 #[inline]
1215 fn encode(
1216 self,
1217 encoder: &mut ___E,
1218 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
1219 ) -> Result<(), ::fidl_next::EncodeError> {
1220 ::fidl_next::munge! {
1221 let Self::Encoded {
1222 status_code,
1223
1224 } = out;
1225 }
1226
1227 ::fidl_next::Encode::encode(self.status_code, encoder, status_code)?;
1228
1229 Ok(())
1230 }
1231 }
1232
1233 unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::Calculator
1234 where
1235 ___T: ::fidl_next::Transport,
1236 {
1237 type ClientSender = CalculatorClientSender<___T>;
1238 type ServerSender = CalculatorServerSender<___T>;
1239 }
1240
1241 pub struct CalculatorClientSender<___T: ::fidl_next::Transport> {
1243 #[allow(dead_code)]
1244 sender: ::fidl_next::protocol::ClientSender<___T>,
1245 }
1246
1247 impl<___T> CalculatorClientSender<___T>
1248 where
1249 ___T: ::fidl_next::Transport,
1250 {
1251 pub fn add(
1252 &self,
1253
1254 a: impl ::fidl_next::Encode<
1255 <___T as ::fidl_next::Transport>::SendBuffer,
1256 Encoded = ::fidl_next::WireI32,
1257 >,
1258
1259 b: impl ::fidl_next::Encode<
1260 <___T as ::fidl_next::Transport>::SendBuffer,
1261 Encoded = ::fidl_next::WireI32,
1262 >,
1263 ) -> Result<::fidl_next::ResponseFuture<'_, super::Add, ___T>, ::fidl_next::EncodeError>
1264 where
1265 <___T as ::fidl_next::Transport>::SendBuffer:
1266 ::fidl_next::encoder::InternalHandleEncoder,
1267 {
1268 self.add_with(Add { a, b })
1269 }
1270
1271 pub fn add_with<___R>(
1272 &self,
1273 request: ___R,
1274 ) -> Result<::fidl_next::ResponseFuture<'_, super::Add, ___T>, ::fidl_next::EncodeError>
1275 where
1276 ___R: ::fidl_next::Encode<
1277 <___T as ::fidl_next::Transport>::SendBuffer,
1278 Encoded = crate::WireCalculatorAddRequest,
1279 >,
1280 {
1281 self.sender
1282 .send_two_way(8640324702111165953, request)
1283 .map(::fidl_next::ResponseFuture::from_untyped)
1284 }
1285
1286 pub fn divide(
1287 &self,
1288
1289 dividend: impl ::fidl_next::Encode<
1290 <___T as ::fidl_next::Transport>::SendBuffer,
1291 Encoded = ::fidl_next::WireI32,
1292 >,
1293
1294 divisor: impl ::fidl_next::Encode<
1295 <___T as ::fidl_next::Transport>::SendBuffer,
1296 Encoded = ::fidl_next::WireI32,
1297 >,
1298 ) -> Result<
1299 ::fidl_next::ResponseFuture<'_, super::Divide, ___T>,
1300 ::fidl_next::EncodeError,
1301 >
1302 where
1303 <___T as ::fidl_next::Transport>::SendBuffer:
1304 ::fidl_next::encoder::InternalHandleEncoder,
1305 {
1306 self.divide_with(Divide { dividend, divisor })
1307 }
1308
1309 pub fn divide_with<___R>(
1310 &self,
1311 request: ___R,
1312 ) -> Result<
1313 ::fidl_next::ResponseFuture<'_, super::Divide, ___T>,
1314 ::fidl_next::EncodeError,
1315 >
1316 where
1317 ___R: ::fidl_next::Encode<
1318 <___T as ::fidl_next::Transport>::SendBuffer,
1319 Encoded = crate::WireCalculatorDivideRequest,
1320 >,
1321 {
1322 self.sender
1323 .send_two_way(5497947425807432439, request)
1324 .map(::fidl_next::ResponseFuture::from_untyped)
1325 }
1326
1327 pub fn clear(
1328 &self,
1329 ) -> Result<::fidl_next::SendFuture<'_, ___T>, ::fidl_next::EncodeError> {
1330 self.sender.send_one_way(7439411180362570889, ())
1331 }
1332 }
1333
1334 #[repr(transparent)]
1336 pub struct CalculatorServerSender<___T: ::fidl_next::Transport> {
1337 sender: ::fidl_next::protocol::ServerSender<___T>,
1338 }
1339
1340 impl<___T> CalculatorServerSender<___T>
1341 where
1342 ___T: ::fidl_next::Transport,
1343 {
1344 pub fn on_error(
1345 &self,
1346
1347 status_code: impl ::fidl_next::Encode<
1348 <___T as ::fidl_next::Transport>::SendBuffer,
1349 Encoded = ::fidl_next::WireU32,
1350 >,
1351 ) -> Result<::fidl_next::SendFuture<'_, ___T>, ::fidl_next::EncodeError>
1352 where
1353 <___T as ::fidl_next::Transport>::SendBuffer:
1354 ::fidl_next::encoder::InternalHandleEncoder,
1355 {
1356 self.on_error_with(OnError { status_code })
1357 }
1358
1359 pub fn on_error_with<___R>(
1360 &self,
1361 request: ___R,
1362 ) -> Result<::fidl_next::SendFuture<'_, ___T>, ::fidl_next::EncodeError>
1363 where
1364 ___R: ::fidl_next::Encode<
1365 <___T as ::fidl_next::Transport>::SendBuffer,
1366 Encoded = <super::OnError as ::fidl_next::Method>::Response,
1367 >,
1368 {
1369 self.sender.send_event(8940578522385404924, request)
1370 }
1371 }
1372 }
1373}
1374
1375pub trait CalculatorClientHandler<___T: ::fidl_next::Transport> {
1379 fn on_error(
1380 &mut self,
1381 sender: &::fidl_next::ClientSender<Calculator, ___T>,
1382
1383 event: ::fidl_next::Response<calculator::OnError, ___T>,
1384 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1385
1386 fn on_unknown_interaction(
1387 &mut self,
1388 sender: &::fidl_next::ClientSender<Calculator, ___T>,
1389 ordinal: u64,
1390 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1391 sender.close();
1392 ::core::future::ready(())
1393 }
1394}
1395
1396impl<___H, ___T> ::fidl_next::ClientProtocol<___H, ___T> for Calculator
1397where
1398 ___H: CalculatorClientHandler<___T> + Send,
1399 ___T: ::fidl_next::Transport,
1400
1401 <calculator::Add as ::fidl_next::Method>::Response:
1402 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1403
1404 <calculator::Divide as ::fidl_next::Method>::Response:
1405 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1406
1407 <calculator::OnError as ::fidl_next::Method>::Response:
1408 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1409{
1410 async fn on_event(
1411 handler: &mut ___H,
1412 sender: &::fidl_next::ClientSender<Self, ___T>,
1413 ordinal: u64,
1414 buffer: ___T::RecvBuffer,
1415 ) {
1416 match ordinal {
1417 8940578522385404924 => match ::fidl_next::DecoderExt::decode(buffer) {
1418 Ok(decoded) => handler.on_error(sender, decoded).await,
1419 Err(e) => {
1420 sender.close();
1421 }
1422 },
1423
1424 ordinal => handler.on_unknown_interaction(sender, ordinal).await,
1425 }
1426 }
1427}
1428
1429pub trait CalculatorServerHandler<___T: ::fidl_next::Transport> {
1433 fn add(
1434 &mut self,
1435 sender: &::fidl_next::ServerSender<Calculator, ___T>,
1436
1437 request: ::fidl_next::Request<calculator::Add, ___T>,
1438
1439 responder: ::fidl_next::Responder<calculator::Add>,
1440 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1441
1442 fn divide(
1443 &mut self,
1444 sender: &::fidl_next::ServerSender<Calculator, ___T>,
1445
1446 request: ::fidl_next::Request<calculator::Divide, ___T>,
1447
1448 responder: ::fidl_next::Responder<calculator::Divide>,
1449 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1450
1451 fn clear(
1452 &mut self,
1453 sender: &::fidl_next::ServerSender<Calculator, ___T>,
1454 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1455
1456 fn on_unknown_interaction(
1457 &mut self,
1458 sender: &::fidl_next::ServerSender<Calculator, ___T>,
1459 ordinal: u64,
1460 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1461 sender.close();
1462 ::core::future::ready(())
1463 }
1464}
1465
1466impl<___H, ___T> ::fidl_next::ServerProtocol<___H, ___T> for Calculator
1467where
1468 ___H: CalculatorServerHandler<___T> + Send,
1469 ___T: ::fidl_next::Transport,
1470
1471 <calculator::Add as ::fidl_next::Method>::Request:
1472 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1473
1474 <calculator::Divide as ::fidl_next::Method>::Request:
1475 ::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
1476{
1477 async fn on_one_way(
1478 handler: &mut ___H,
1479 sender: &::fidl_next::ServerSender<Self, ___T>,
1480 ordinal: u64,
1481 buffer: ___T::RecvBuffer,
1482 ) {
1483 match ordinal {
1484 7439411180362570889 => {
1485 handler.clear(sender).await;
1486 }
1487
1488 ordinal => handler.on_unknown_interaction(sender, ordinal).await,
1489 }
1490 }
1491
1492 async fn on_two_way(
1493 handler: &mut ___H,
1494 sender: &::fidl_next::ServerSender<Self, ___T>,
1495 ordinal: u64,
1496 buffer: ___T::RecvBuffer,
1497 responder: ::fidl_next::protocol::Responder,
1498 ) {
1499 match ordinal {
1500 8640324702111165953 => {
1501 let responder = ::fidl_next::Responder::from_untyped(responder);
1502
1503 match ::fidl_next::DecoderExt::decode(buffer) {
1504 Ok(decoded) => handler.add(sender, decoded, responder).await,
1505 Err(e) => {
1506 sender.close();
1507 }
1508 }
1509 }
1510
1511 5497947425807432439 => {
1512 let responder = ::fidl_next::Responder::from_untyped(responder);
1513
1514 match ::fidl_next::DecoderExt::decode(buffer) {
1515 Ok(decoded) => handler.divide(sender, decoded, responder).await,
1516 Err(e) => {
1517 sender.close();
1518 }
1519 }
1520 }
1521
1522 ordinal => handler.on_unknown_interaction(sender, ordinal).await,
1523 }
1524 }
1525}
1526
1527pub mod compat {
1529
1530 impl ::core::convert::From<crate::DivisionError> for ::fidl_examples_calculator::DivisionError {
1531 #[inline]
1532 fn from(from: crate::DivisionError) -> Self {
1533 match crate::DivisionError::from(from) {
1534 crate::DivisionError::DivideByZero => Self::DivideByZero,
1535 }
1536 }
1537 }
1538
1539 #[cfg(target_os = "fuchsia")]
1540 pub type CalculatorProxy =
1543 ::fidl_next::ClientSender<::fidl_next::fuchsia::zx::Channel, crate::Calculator>;
1544
1545 impl ::core::convert::From<crate::Calculator> for ::fidl_examples_calculator::CalculatorMarker {
1546 #[inline]
1547 fn from(_: crate::Calculator) -> Self {
1548 Self
1549 }
1550 }
1551}