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