Skip to main content

fidl_next_common_examples_calculator/
fidl_next_common_examples_calculator.rs

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