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    impl ::std::convert::From<DivisionError> for u32 {
730        fn from(value: DivisionError) -> Self {
731            match value {
732                DivisionError::DivideByZero => 1,
733            }
734        }
735    }
736
737    unsafe impl<___E> ::fidl_next::Encode<crate::wire::DivisionError, ___E> for DivisionError
738    where
739        ___E: ?Sized,
740    {
741        #[inline]
742        fn encode(
743            self,
744            encoder: &mut ___E,
745            out: &mut ::core::mem::MaybeUninit<crate::wire::DivisionError>,
746            _: (),
747        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
748            ::fidl_next::Encode::encode(&self, encoder, out, ())
749        }
750    }
751
752    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DivisionError, ___E> for &'a DivisionError
753    where
754        ___E: ?Sized,
755    {
756        #[inline]
757        fn encode(
758            self,
759            encoder: &mut ___E,
760            out: &mut ::core::mem::MaybeUninit<crate::wire::DivisionError>,
761            _: (),
762        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
763            ::fidl_next::munge!(let crate::wire::DivisionError { value } = out);
764            let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
765                DivisionError::DivideByZero => 1,
766            }));
767
768            Ok(())
769        }
770    }
771
772    impl ::core::convert::From<crate::wire::DivisionError> for DivisionError {
773        fn from(wire: crate::wire::DivisionError) -> Self {
774            match u32::from(wire.value) {
775                1 => Self::DivideByZero,
776
777                _ => unsafe { ::core::hint::unreachable_unchecked() },
778            }
779        }
780    }
781
782    impl ::fidl_next::FromWire<crate::wire::DivisionError> for DivisionError {
783        #[inline]
784        fn from_wire(wire: crate::wire::DivisionError) -> Self {
785            Self::from(wire)
786        }
787    }
788
789    impl ::fidl_next::FromWireRef<crate::wire::DivisionError> for DivisionError {
790        #[inline]
791        fn from_wire_ref(wire: &crate::wire::DivisionError) -> Self {
792            Self::from(*wire)
793        }
794    }
795
796    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
797    #[repr(C)]
798    pub struct CalculatorOnErrorRequest {
799        pub status_code: u32,
800    }
801
802    unsafe impl<___E> ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>
803        for CalculatorOnErrorRequest
804    where
805        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
806    {
807        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
808            Self,
809            crate::wire::CalculatorOnErrorRequest,
810        > = unsafe {
811            ::fidl_next::CopyOptimization::enable_if(
812            true
813
814                && <
815                    u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
816                >::COPY_OPTIMIZATION.is_enabled()
817
818        )
819        };
820
821        #[inline]
822        fn encode(
823            self,
824            encoder_: &mut ___E,
825            out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorOnErrorRequest>,
826            _: (),
827        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
828            ::fidl_next::munge! {
829                let crate::wire::CalculatorOnErrorRequest {
830                    status_code,
831
832                } = out_;
833            }
834
835            ::fidl_next::Encode::encode(self.status_code, encoder_, status_code, ())?;
836
837            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(status_code.as_mut_ptr()) };
838
839            Ok(())
840        }
841    }
842
843    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>
844        for &'a CalculatorOnErrorRequest
845    where
846        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
847    {
848        #[inline]
849        fn encode(
850            self,
851            encoder_: &mut ___E,
852            out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorOnErrorRequest>,
853            _: (),
854        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
855            ::fidl_next::munge! {
856                let crate::wire::CalculatorOnErrorRequest {
857                    status_code,
858
859                } = out_;
860            }
861
862            ::fidl_next::Encode::encode(&self.status_code, encoder_, status_code, ())?;
863
864            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(status_code.as_mut_ptr()) };
865
866            Ok(())
867        }
868    }
869
870    unsafe impl<___E>
871        ::fidl_next::EncodeOption<
872            ::fidl_next::wire::Box<'static, crate::wire::CalculatorOnErrorRequest>,
873            ___E,
874        > for CalculatorOnErrorRequest
875    where
876        ___E: ::fidl_next::Encoder + ?Sized,
877        CalculatorOnErrorRequest: ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>,
878    {
879        #[inline]
880        fn encode_option(
881            this: ::core::option::Option<Self>,
882            encoder: &mut ___E,
883            out: &mut ::core::mem::MaybeUninit<
884                ::fidl_next::wire::Box<'static, crate::wire::CalculatorOnErrorRequest>,
885            >,
886            _: (),
887        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
888            if let Some(inner) = this {
889                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
890                ::fidl_next::wire::Box::encode_present(out);
891            } else {
892                ::fidl_next::wire::Box::encode_absent(out);
893            }
894
895            Ok(())
896        }
897    }
898
899    unsafe impl<'a, ___E>
900        ::fidl_next::EncodeOption<
901            ::fidl_next::wire::Box<'static, crate::wire::CalculatorOnErrorRequest>,
902            ___E,
903        > for &'a CalculatorOnErrorRequest
904    where
905        ___E: ::fidl_next::Encoder + ?Sized,
906        &'a CalculatorOnErrorRequest:
907            ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>,
908    {
909        #[inline]
910        fn encode_option(
911            this: ::core::option::Option<Self>,
912            encoder: &mut ___E,
913            out: &mut ::core::mem::MaybeUninit<
914                ::fidl_next::wire::Box<'static, crate::wire::CalculatorOnErrorRequest>,
915            >,
916            _: (),
917        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
918            if let Some(inner) = this {
919                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
920                ::fidl_next::wire::Box::encode_present(out);
921            } else {
922                ::fidl_next::wire::Box::encode_absent(out);
923            }
924
925            Ok(())
926        }
927    }
928
929    impl ::fidl_next::FromWire<crate::wire::CalculatorOnErrorRequest> for CalculatorOnErrorRequest {
930        const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
931            crate::wire::CalculatorOnErrorRequest,
932            Self,
933        > = unsafe {
934            ::fidl_next::CopyOptimization::enable_if(
935                true
936                    && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
937                        .is_enabled(),
938            )
939        };
940
941        #[inline]
942        fn from_wire(wire: crate::wire::CalculatorOnErrorRequest) -> Self {
943            Self { status_code: ::fidl_next::FromWire::from_wire(wire.status_code) }
944        }
945    }
946
947    impl ::fidl_next::FromWireRef<crate::wire::CalculatorOnErrorRequest> for CalculatorOnErrorRequest {
948        #[inline]
949        fn from_wire_ref(wire: &crate::wire::CalculatorOnErrorRequest) -> Self {
950            Self { status_code: ::fidl_next::FromWireRef::from_wire_ref(&wire.status_code) }
951        }
952    }
953}
954
955pub mod wire {
956
957    /// The wire type corresponding to [`CalculatorAddRequest`].
958    #[derive(Clone, Debug)]
959    #[repr(C)]
960    pub struct CalculatorAddRequest {
961        pub a: ::fidl_next::wire::Int32,
962
963        pub b: ::fidl_next::wire::Int32,
964    }
965
966    static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorAddRequest>(), 8);
967    static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorAddRequest>(), 4);
968
969    static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorAddRequest, a), 0);
970
971    static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorAddRequest, b), 4);
972
973    impl ::fidl_next::Constrained for CalculatorAddRequest {
974        type Constraint = ();
975
976        fn validate(
977            _: ::fidl_next::Slot<'_, Self>,
978            _: Self::Constraint,
979        ) -> Result<(), ::fidl_next::ValidationError> {
980            Ok(())
981        }
982    }
983
984    unsafe impl ::fidl_next::Wire for CalculatorAddRequest {
985        type Narrowed<'de> = CalculatorAddRequest;
986
987        #[inline]
988        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
989            ::fidl_next::munge! {
990                let Self {
991                    a,
992                    b,
993
994                } = &mut *out_;
995            }
996
997            ::fidl_next::Wire::zero_padding(a);
998
999            ::fidl_next::Wire::zero_padding(b);
1000        }
1001    }
1002
1003    unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorAddRequest
1004    where
1005        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1006    {
1007        fn decode(
1008            slot_: ::fidl_next::Slot<'_, Self>,
1009            decoder_: &mut ___D,
1010            _: (),
1011        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1012            ::fidl_next::munge! {
1013                let Self {
1014                    mut a,
1015                    mut b,
1016
1017                } = slot_;
1018            }
1019
1020            let _field = a.as_mut();
1021
1022            ::fidl_next::Decode::decode(a.as_mut(), decoder_, ())?;
1023
1024            let _field = b.as_mut();
1025
1026            ::fidl_next::Decode::decode(b.as_mut(), decoder_, ())?;
1027
1028            Ok(())
1029        }
1030    }
1031
1032    impl ::fidl_next::IntoNatural for CalculatorAddRequest {
1033        type Natural = crate::natural::CalculatorAddRequest;
1034    }
1035
1036    /// The wire type corresponding to [`CalculatorAddResponse`].
1037    #[derive(Clone, Debug)]
1038    #[repr(C)]
1039    pub struct CalculatorAddResponse {
1040        pub sum: ::fidl_next::wire::Int32,
1041    }
1042
1043    static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorAddResponse>(), 4);
1044    static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorAddResponse>(), 4);
1045
1046    static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorAddResponse, sum), 0);
1047
1048    impl ::fidl_next::Constrained for CalculatorAddResponse {
1049        type Constraint = ();
1050
1051        fn validate(
1052            _: ::fidl_next::Slot<'_, Self>,
1053            _: Self::Constraint,
1054        ) -> Result<(), ::fidl_next::ValidationError> {
1055            Ok(())
1056        }
1057    }
1058
1059    unsafe impl ::fidl_next::Wire for CalculatorAddResponse {
1060        type Narrowed<'de> = CalculatorAddResponse;
1061
1062        #[inline]
1063        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1064            ::fidl_next::munge! {
1065                let Self {
1066                    sum,
1067
1068                } = &mut *out_;
1069            }
1070
1071            ::fidl_next::Wire::zero_padding(sum);
1072        }
1073    }
1074
1075    unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorAddResponse
1076    where
1077        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1078    {
1079        fn decode(
1080            slot_: ::fidl_next::Slot<'_, Self>,
1081            decoder_: &mut ___D,
1082            _: (),
1083        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1084            ::fidl_next::munge! {
1085                let Self {
1086                    mut sum,
1087
1088                } = slot_;
1089            }
1090
1091            let _field = sum.as_mut();
1092
1093            ::fidl_next::Decode::decode(sum.as_mut(), decoder_, ())?;
1094
1095            Ok(())
1096        }
1097    }
1098
1099    impl ::fidl_next::IntoNatural for CalculatorAddResponse {
1100        type Natural = crate::natural::CalculatorAddResponse;
1101    }
1102
1103    /// The wire type corresponding to [`CalculatorDivideRequest`].
1104    #[derive(Clone, Debug)]
1105    #[repr(C)]
1106    pub struct CalculatorDivideRequest {
1107        pub dividend: ::fidl_next::wire::Int32,
1108
1109        pub divisor: ::fidl_next::wire::Int32,
1110    }
1111
1112    static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorDivideRequest>(), 8);
1113    static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorDivideRequest>(), 4);
1114
1115    static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorDivideRequest, dividend), 0);
1116
1117    static_assertions::const_assert_eq!(std::mem::offset_of!(CalculatorDivideRequest, divisor), 4);
1118
1119    impl ::fidl_next::Constrained for CalculatorDivideRequest {
1120        type Constraint = ();
1121
1122        fn validate(
1123            _: ::fidl_next::Slot<'_, Self>,
1124            _: Self::Constraint,
1125        ) -> Result<(), ::fidl_next::ValidationError> {
1126            Ok(())
1127        }
1128    }
1129
1130    unsafe impl ::fidl_next::Wire for CalculatorDivideRequest {
1131        type Narrowed<'de> = CalculatorDivideRequest;
1132
1133        #[inline]
1134        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1135            ::fidl_next::munge! {
1136                let Self {
1137                    dividend,
1138                    divisor,
1139
1140                } = &mut *out_;
1141            }
1142
1143            ::fidl_next::Wire::zero_padding(dividend);
1144
1145            ::fidl_next::Wire::zero_padding(divisor);
1146        }
1147    }
1148
1149    unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorDivideRequest
1150    where
1151        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1152    {
1153        fn decode(
1154            slot_: ::fidl_next::Slot<'_, Self>,
1155            decoder_: &mut ___D,
1156            _: (),
1157        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1158            ::fidl_next::munge! {
1159                let Self {
1160                    mut dividend,
1161                    mut divisor,
1162
1163                } = slot_;
1164            }
1165
1166            let _field = dividend.as_mut();
1167
1168            ::fidl_next::Decode::decode(dividend.as_mut(), decoder_, ())?;
1169
1170            let _field = divisor.as_mut();
1171
1172            ::fidl_next::Decode::decode(divisor.as_mut(), decoder_, ())?;
1173
1174            Ok(())
1175        }
1176    }
1177
1178    impl ::fidl_next::IntoNatural for CalculatorDivideRequest {
1179        type Natural = crate::natural::CalculatorDivideRequest;
1180    }
1181
1182    /// The wire type corresponding to [`CalculatorDivideResponse`].
1183    #[derive(Clone, Debug)]
1184    #[repr(C)]
1185    pub struct CalculatorDivideResponse {
1186        pub quotient: ::fidl_next::wire::Int32,
1187
1188        pub remainder: ::fidl_next::wire::Int32,
1189    }
1190
1191    static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorDivideResponse>(), 8);
1192    static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorDivideResponse>(), 4);
1193
1194    static_assertions::const_assert_eq!(
1195        std::mem::offset_of!(CalculatorDivideResponse, quotient),
1196        0
1197    );
1198
1199    static_assertions::const_assert_eq!(
1200        std::mem::offset_of!(CalculatorDivideResponse, remainder),
1201        4
1202    );
1203
1204    impl ::fidl_next::Constrained for CalculatorDivideResponse {
1205        type Constraint = ();
1206
1207        fn validate(
1208            _: ::fidl_next::Slot<'_, Self>,
1209            _: Self::Constraint,
1210        ) -> Result<(), ::fidl_next::ValidationError> {
1211            Ok(())
1212        }
1213    }
1214
1215    unsafe impl ::fidl_next::Wire for CalculatorDivideResponse {
1216        type Narrowed<'de> = CalculatorDivideResponse;
1217
1218        #[inline]
1219        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1220            ::fidl_next::munge! {
1221                let Self {
1222                    quotient,
1223                    remainder,
1224
1225                } = &mut *out_;
1226            }
1227
1228            ::fidl_next::Wire::zero_padding(quotient);
1229
1230            ::fidl_next::Wire::zero_padding(remainder);
1231        }
1232    }
1233
1234    unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorDivideResponse
1235    where
1236        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1237    {
1238        fn decode(
1239            slot_: ::fidl_next::Slot<'_, Self>,
1240            decoder_: &mut ___D,
1241            _: (),
1242        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1243            ::fidl_next::munge! {
1244                let Self {
1245                    mut quotient,
1246                    mut remainder,
1247
1248                } = slot_;
1249            }
1250
1251            let _field = quotient.as_mut();
1252
1253            ::fidl_next::Decode::decode(quotient.as_mut(), decoder_, ())?;
1254
1255            let _field = remainder.as_mut();
1256
1257            ::fidl_next::Decode::decode(remainder.as_mut(), decoder_, ())?;
1258
1259            Ok(())
1260        }
1261    }
1262
1263    impl ::fidl_next::IntoNatural for CalculatorDivideResponse {
1264        type Natural = crate::natural::CalculatorDivideResponse;
1265    }
1266
1267    /// The wire type corresponding to [`DivisionError`].
1268    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1269    #[repr(transparent)]
1270    pub struct DivisionError {
1271        pub(crate) value: ::fidl_next::wire::Uint32,
1272    }
1273
1274    impl ::fidl_next::Constrained for DivisionError {
1275        type Constraint = ();
1276
1277        fn validate(
1278            _: ::fidl_next::Slot<'_, Self>,
1279            _: Self::Constraint,
1280        ) -> Result<(), ::fidl_next::ValidationError> {
1281            Ok(())
1282        }
1283    }
1284
1285    unsafe impl ::fidl_next::Wire for DivisionError {
1286        type Narrowed<'de> = Self;
1287
1288        #[inline]
1289        fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1290            // Wire enums have no padding
1291        }
1292    }
1293
1294    impl DivisionError {
1295        pub const DIVIDE_BY_ZERO: DivisionError =
1296            DivisionError { value: ::fidl_next::wire::Uint32(1) };
1297    }
1298
1299    unsafe impl<___D> ::fidl_next::Decode<___D> for DivisionError
1300    where
1301        ___D: ?Sized,
1302    {
1303        fn decode(
1304            slot: ::fidl_next::Slot<'_, Self>,
1305            _: &mut ___D,
1306            _: (),
1307        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1308            ::fidl_next::munge!(let Self { value } = slot);
1309
1310            match u32::from(*value) {
1311                1 => (),
1312                unknown => {
1313                    return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1314                }
1315            }
1316
1317            Ok(())
1318        }
1319    }
1320
1321    impl ::core::convert::From<crate::natural::DivisionError> for DivisionError {
1322        fn from(natural: crate::natural::DivisionError) -> Self {
1323            match natural {
1324                crate::natural::DivisionError::DivideByZero => DivisionError::DIVIDE_BY_ZERO,
1325            }
1326        }
1327    }
1328
1329    impl ::fidl_next::IntoNatural for DivisionError {
1330        type Natural = crate::natural::DivisionError;
1331    }
1332
1333    /// The wire type corresponding to [`CalculatorOnErrorRequest`].
1334    #[derive(Clone, Debug)]
1335    #[repr(C)]
1336    pub struct CalculatorOnErrorRequest {
1337        pub status_code: ::fidl_next::wire::Uint32,
1338    }
1339
1340    static_assertions::const_assert_eq!(std::mem::size_of::<CalculatorOnErrorRequest>(), 4);
1341    static_assertions::const_assert_eq!(std::mem::align_of::<CalculatorOnErrorRequest>(), 4);
1342
1343    static_assertions::const_assert_eq!(
1344        std::mem::offset_of!(CalculatorOnErrorRequest, status_code),
1345        0
1346    );
1347
1348    impl ::fidl_next::Constrained for CalculatorOnErrorRequest {
1349        type Constraint = ();
1350
1351        fn validate(
1352            _: ::fidl_next::Slot<'_, Self>,
1353            _: Self::Constraint,
1354        ) -> Result<(), ::fidl_next::ValidationError> {
1355            Ok(())
1356        }
1357    }
1358
1359    unsafe impl ::fidl_next::Wire for CalculatorOnErrorRequest {
1360        type Narrowed<'de> = CalculatorOnErrorRequest;
1361
1362        #[inline]
1363        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1364            ::fidl_next::munge! {
1365                let Self {
1366                    status_code,
1367
1368                } = &mut *out_;
1369            }
1370
1371            ::fidl_next::Wire::zero_padding(status_code);
1372        }
1373    }
1374
1375    unsafe impl<___D> ::fidl_next::Decode<___D> for CalculatorOnErrorRequest
1376    where
1377        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1378    {
1379        fn decode(
1380            slot_: ::fidl_next::Slot<'_, Self>,
1381            decoder_: &mut ___D,
1382            _: (),
1383        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1384            ::fidl_next::munge! {
1385                let Self {
1386                    mut status_code,
1387
1388                } = slot_;
1389            }
1390
1391            let _field = status_code.as_mut();
1392
1393            ::fidl_next::Decode::decode(status_code.as_mut(), decoder_, ())?;
1394
1395            Ok(())
1396        }
1397    }
1398
1399    impl ::fidl_next::IntoNatural for CalculatorOnErrorRequest {
1400        type Natural = crate::natural::CalculatorOnErrorRequest;
1401    }
1402}
1403
1404pub mod wire_optional {}
1405
1406pub mod generic {
1407
1408    /// The generic type corresponding to [`CalculatorAddRequest`].
1409    pub struct CalculatorAddRequest<T0, T1> {
1410        pub a: T0,
1411
1412        pub b: T1,
1413    }
1414
1415    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::CalculatorAddRequest, ___E>
1416        for CalculatorAddRequest<T0, T1>
1417    where
1418        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1419        T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1420        T1: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1421    {
1422        #[inline]
1423        fn encode(
1424            self,
1425            encoder_: &mut ___E,
1426            out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddRequest>,
1427            _: (),
1428        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1429            ::fidl_next::munge! {
1430                let crate::wire::CalculatorAddRequest {
1431                    a,
1432                    b,
1433
1434                } = out_;
1435            }
1436
1437            ::fidl_next::Encode::encode(self.a, encoder_, a, ())?;
1438
1439            ::fidl_next::Encode::encode(self.b, encoder_, b, ())?;
1440
1441            Ok(())
1442        }
1443    }
1444
1445    /// The generic type corresponding to [`CalculatorAddResponse`].
1446    pub struct CalculatorAddResponse<T0> {
1447        pub sum: T0,
1448    }
1449
1450    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::CalculatorAddResponse, ___E>
1451        for CalculatorAddResponse<T0>
1452    where
1453        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1454        T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1455    {
1456        #[inline]
1457        fn encode(
1458            self,
1459            encoder_: &mut ___E,
1460            out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorAddResponse>,
1461            _: (),
1462        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1463            ::fidl_next::munge! {
1464                let crate::wire::CalculatorAddResponse {
1465                    sum,
1466
1467                } = out_;
1468            }
1469
1470            ::fidl_next::Encode::encode(self.sum, encoder_, sum, ())?;
1471
1472            Ok(())
1473        }
1474    }
1475
1476    /// The generic type corresponding to [`CalculatorDivideRequest`].
1477    pub struct CalculatorDivideRequest<T0, T1> {
1478        pub dividend: T0,
1479
1480        pub divisor: T1,
1481    }
1482
1483    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::CalculatorDivideRequest, ___E>
1484        for CalculatorDivideRequest<T0, T1>
1485    where
1486        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1487        T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1488        T1: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1489    {
1490        #[inline]
1491        fn encode(
1492            self,
1493            encoder_: &mut ___E,
1494            out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideRequest>,
1495            _: (),
1496        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1497            ::fidl_next::munge! {
1498                let crate::wire::CalculatorDivideRequest {
1499                    dividend,
1500                    divisor,
1501
1502                } = out_;
1503            }
1504
1505            ::fidl_next::Encode::encode(self.dividend, encoder_, dividend, ())?;
1506
1507            ::fidl_next::Encode::encode(self.divisor, encoder_, divisor, ())?;
1508
1509            Ok(())
1510        }
1511    }
1512
1513    /// The generic type corresponding to [`CalculatorDivideResponse`].
1514    pub struct CalculatorDivideResponse<T0, T1> {
1515        pub quotient: T0,
1516
1517        pub remainder: T1,
1518    }
1519
1520    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::CalculatorDivideResponse, ___E>
1521        for CalculatorDivideResponse<T0, T1>
1522    where
1523        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1524        T0: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1525        T1: ::fidl_next::Encode<::fidl_next::wire::Int32, ___E>,
1526    {
1527        #[inline]
1528        fn encode(
1529            self,
1530            encoder_: &mut ___E,
1531            out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorDivideResponse>,
1532            _: (),
1533        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1534            ::fidl_next::munge! {
1535                let crate::wire::CalculatorDivideResponse {
1536                    quotient,
1537                    remainder,
1538
1539                } = out_;
1540            }
1541
1542            ::fidl_next::Encode::encode(self.quotient, encoder_, quotient, ())?;
1543
1544            ::fidl_next::Encode::encode(self.remainder, encoder_, remainder, ())?;
1545
1546            Ok(())
1547        }
1548    }
1549
1550    /// The generic type corresponding to [`CalculatorOnErrorRequest`].
1551    pub struct CalculatorOnErrorRequest<T0> {
1552        pub status_code: T0,
1553    }
1554
1555    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::CalculatorOnErrorRequest, ___E>
1556        for CalculatorOnErrorRequest<T0>
1557    where
1558        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1559        T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
1560    {
1561        #[inline]
1562        fn encode(
1563            self,
1564            encoder_: &mut ___E,
1565            out_: &mut ::core::mem::MaybeUninit<crate::wire::CalculatorOnErrorRequest>,
1566            _: (),
1567        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1568            ::fidl_next::munge! {
1569                let crate::wire::CalculatorOnErrorRequest {
1570                    status_code,
1571
1572                } = out_;
1573            }
1574
1575            ::fidl_next::Encode::encode(self.status_code, encoder_, status_code, ())?;
1576
1577            Ok(())
1578        }
1579    }
1580}
1581
1582pub use self::natural::*;
1583
1584/// The type corresponding to the Calculator protocol.
1585#[derive(PartialEq, Debug)]
1586pub struct Calculator;
1587
1588#[cfg(target_os = "fuchsia")]
1589impl ::fidl_next::HasTransport for Calculator {
1590    type Transport = ::fidl_next::fuchsia::zx::Channel;
1591}
1592
1593pub mod calculator {
1594    pub mod prelude {
1595        pub use crate::{
1596            Calculator, CalculatorClientHandler, CalculatorLocalClientHandler,
1597            CalculatorLocalServerHandler, CalculatorServerHandler, calculator,
1598        };
1599
1600        pub use crate::natural::CalculatorAddRequest;
1601
1602        pub use crate::natural::CalculatorDivideRequest;
1603
1604        pub use crate::natural::CalculatorOnErrorRequest;
1605
1606        pub use crate::natural::CalculatorAddResponse;
1607
1608        pub use crate::natural::CalculatorDivideResponse;
1609
1610        pub use crate::natural::DivisionError;
1611    }
1612
1613    pub struct Add;
1614
1615    impl ::fidl_next::Method for Add {
1616        const ORDINAL: u64 = 8640324702111165953;
1617        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1618            ::fidl_next::protocol::Flexibility::Flexible;
1619
1620        type Protocol = crate::Calculator;
1621
1622        type Request = crate::wire::CalculatorAddRequest;
1623    }
1624
1625    impl ::fidl_next::TwoWayMethod for Add {
1626        type Response = ::fidl_next::wire::Flexible<'static, crate::wire::CalculatorAddResponse>;
1627    }
1628
1629    impl<___R> ::fidl_next::Respond<___R> for Add {
1630        type Output = ::fidl_next::Flexible<crate::generic::CalculatorAddResponse<___R>>;
1631
1632        fn respond(response: ___R) -> Self::Output {
1633            ::fidl_next::Flexible(crate::generic::CalculatorAddResponse { sum: response })
1634        }
1635    }
1636
1637    pub struct Divide;
1638
1639    impl ::fidl_next::Method for Divide {
1640        const ORDINAL: u64 = 5497947425807432439;
1641        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1642            ::fidl_next::protocol::Flexibility::Flexible;
1643
1644        type Protocol = crate::Calculator;
1645
1646        type Request = crate::wire::CalculatorDivideRequest;
1647    }
1648
1649    impl ::fidl_next::TwoWayMethod for Divide {
1650        type Response = ::fidl_next::wire::Result<
1651            'static,
1652            crate::wire::CalculatorDivideResponse,
1653            crate::wire::DivisionError,
1654        >;
1655    }
1656
1657    impl<___R> ::fidl_next::Respond<___R> for Divide {
1658        type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
1659
1660        fn respond(response: ___R) -> Self::Output {
1661            ::core::result::Result::Ok(response)
1662        }
1663    }
1664
1665    impl<___R> ::fidl_next::RespondErr<___R> for Divide {
1666        type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
1667
1668        fn respond_err(response: ___R) -> Self::Output {
1669            ::core::result::Result::Err(response)
1670        }
1671    }
1672
1673    pub struct Clear;
1674
1675    impl ::fidl_next::Method for Clear {
1676        const ORDINAL: u64 = 7439411180362570889;
1677        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1678            ::fidl_next::protocol::Flexibility::Flexible;
1679
1680        type Protocol = crate::Calculator;
1681
1682        type Request = ::fidl_next::wire::EmptyMessageBody;
1683    }
1684
1685    pub struct OnError;
1686
1687    impl ::fidl_next::Method for OnError {
1688        const ORDINAL: u64 = 8940578522385404924;
1689        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1690            ::fidl_next::protocol::Flexibility::Flexible;
1691
1692        type Protocol = crate::Calculator;
1693
1694        type Request = crate::wire::CalculatorOnErrorRequest;
1695    }
1696
1697    mod ___detail {
1698        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Calculator
1699        where
1700            ___T: ::fidl_next::Transport,
1701        {
1702            type Client = CalculatorClient<___T>;
1703            type Server = CalculatorServer<___T>;
1704        }
1705
1706        /// The client for the `Calculator` protocol.
1707        #[repr(transparent)]
1708        pub struct CalculatorClient<___T: ::fidl_next::Transport> {
1709            #[allow(dead_code)]
1710            client: ::fidl_next::protocol::Client<___T>,
1711        }
1712
1713        impl<___T> CalculatorClient<___T>
1714        where
1715            ___T: ::fidl_next::Transport,
1716        {
1717            pub fn add(
1718                &self,
1719
1720                a: impl ::fidl_next::Encode<
1721                    ::fidl_next::wire::Int32,
1722                    <___T as ::fidl_next::Transport>::SendBuffer,
1723                >,
1724
1725                b: impl ::fidl_next::Encode<
1726                    ::fidl_next::wire::Int32,
1727                    <___T as ::fidl_next::Transport>::SendBuffer,
1728                >,
1729            ) -> ::fidl_next::TwoWayFuture<'_, super::Add, ___T>
1730            where
1731                <___T as ::fidl_next::Transport>::SendBuffer:
1732                    ::fidl_next::encoder::InternalHandleEncoder,
1733            {
1734                self.add_with(crate::generic::CalculatorAddRequest { a, b })
1735            }
1736
1737            pub fn add_with<___R>(
1738                &self,
1739                request: ___R,
1740            ) -> ::fidl_next::TwoWayFuture<'_, super::Add, ___T>
1741            where
1742                ___R: ::fidl_next::Encode<
1743                        crate::wire::CalculatorAddRequest,
1744                        <___T as ::fidl_next::Transport>::SendBuffer,
1745                    >,
1746            {
1747                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1748                    8640324702111165953,
1749                    <super::Add as ::fidl_next::Method>::FLEXIBILITY,
1750                    request,
1751                ))
1752            }
1753
1754            pub fn divide(
1755                &self,
1756
1757                dividend: impl ::fidl_next::Encode<
1758                    ::fidl_next::wire::Int32,
1759                    <___T as ::fidl_next::Transport>::SendBuffer,
1760                >,
1761
1762                divisor: impl ::fidl_next::Encode<
1763                    ::fidl_next::wire::Int32,
1764                    <___T as ::fidl_next::Transport>::SendBuffer,
1765                >,
1766            ) -> ::fidl_next::TwoWayFuture<'_, super::Divide, ___T>
1767            where
1768                <___T as ::fidl_next::Transport>::SendBuffer:
1769                    ::fidl_next::encoder::InternalHandleEncoder,
1770            {
1771                self.divide_with(crate::generic::CalculatorDivideRequest { dividend, divisor })
1772            }
1773
1774            pub fn divide_with<___R>(
1775                &self,
1776                request: ___R,
1777            ) -> ::fidl_next::TwoWayFuture<'_, super::Divide, ___T>
1778            where
1779                ___R: ::fidl_next::Encode<
1780                        crate::wire::CalculatorDivideRequest,
1781                        <___T as ::fidl_next::Transport>::SendBuffer,
1782                    >,
1783            {
1784                ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1785                    5497947425807432439,
1786                    <super::Divide as ::fidl_next::Method>::FLEXIBILITY,
1787                    request,
1788                ))
1789            }
1790
1791            pub fn clear(&self) -> ::fidl_next::SendFuture<'_, ___T> {
1792                ::fidl_next::SendFuture::from_untyped(
1793                    self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
1794                        7439411180362570889,
1795                        <super::Clear as ::fidl_next::Method>::FLEXIBILITY,
1796                        (),
1797                    ),
1798                )
1799            }
1800        }
1801
1802        /// The server for the `Calculator` protocol.
1803        #[repr(transparent)]
1804        pub struct CalculatorServer<___T: ::fidl_next::Transport> {
1805            server: ::fidl_next::protocol::Server<___T>,
1806        }
1807
1808        impl<___T> CalculatorServer<___T>
1809        where
1810            ___T: ::fidl_next::Transport,
1811        {
1812            pub fn on_error(
1813                &self,
1814
1815                status_code: impl ::fidl_next::Encode<
1816                    ::fidl_next::wire::Uint32,
1817                    <___T as ::fidl_next::Transport>::SendBuffer,
1818                >,
1819            ) -> ::fidl_next::SendFuture<'_, ___T>
1820            where
1821                <___T as ::fidl_next::Transport>::SendBuffer:
1822                    ::fidl_next::encoder::InternalHandleEncoder,
1823            {
1824                self.on_error_with(crate::generic::CalculatorOnErrorRequest { status_code })
1825            }
1826
1827            pub fn on_error_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
1828            where
1829                ___R: ::fidl_next::Encode<
1830                        <super::OnError as ::fidl_next::Method>::Request,
1831                        <___T as ::fidl_next::Transport>::SendBuffer,
1832                    >,
1833            {
1834                ::fidl_next::SendFuture::from_untyped(self.server.send_event(
1835                    8940578522385404924,
1836                    <super::OnError as ::fidl_next::Method>::FLEXIBILITY,
1837                    request,
1838                ))
1839            }
1840        }
1841    }
1842}
1843
1844#[diagnostic::on_unimplemented(
1845    note = "If {Self} implements the non-local CalculatorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1846)]
1847
1848/// A client handler for the Calculator protocol.
1849///
1850/// See [`Calculator`] for more details.
1851pub trait CalculatorLocalClientHandler<
1852    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1853    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1854>
1855{
1856    fn on_error(
1857        &mut self,
1858
1859        request: ::fidl_next::Request<calculator::OnError, ___T>,
1860    ) -> impl ::core::future::Future<Output = ()>;
1861
1862    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1863        ::core::future::ready(())
1864    }
1865}
1866
1867impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Calculator
1868where
1869    ___H: CalculatorLocalClientHandler<___T>,
1870    ___T: ::fidl_next::Transport,
1871    for<'de> crate::wire::CalculatorOnErrorRequest: ::fidl_next::Decode<
1872            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1873            Constraint = (),
1874        >,
1875{
1876    async fn on_event(
1877        handler: &mut ___H,
1878        mut message: ::fidl_next::Message<___T>,
1879    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1880        match *message.header().ordinal {
1881            8940578522385404924 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1882                Ok(decoded) => {
1883                    handler.on_error(::fidl_next::Request::from_decoded(decoded)).await;
1884                    Ok(())
1885                }
1886                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1887                    ordinal: 8940578522385404924,
1888                    error,
1889                }),
1890            },
1891
1892            ordinal => {
1893                handler.on_unknown_interaction(ordinal).await;
1894                if ::core::matches!(
1895                    message.header().flexibility(),
1896                    ::fidl_next::protocol::Flexibility::Strict
1897                ) {
1898                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1899                } else {
1900                    Ok(())
1901                }
1902            }
1903        }
1904    }
1905}
1906
1907#[diagnostic::on_unimplemented(
1908    note = "If {Self} implements the non-local CalculatorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1909)]
1910
1911/// A server handler for the Calculator protocol.
1912///
1913/// See [`Calculator`] for more details.
1914pub trait CalculatorLocalServerHandler<
1915    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1916    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1917>
1918{
1919    fn add(
1920        &mut self,
1921
1922        request: ::fidl_next::Request<calculator::Add, ___T>,
1923
1924        responder: ::fidl_next::Responder<calculator::Add, ___T>,
1925    ) -> impl ::core::future::Future<Output = ()>;
1926
1927    fn divide(
1928        &mut self,
1929
1930        request: ::fidl_next::Request<calculator::Divide, ___T>,
1931
1932        responder: ::fidl_next::Responder<calculator::Divide, ___T>,
1933    ) -> impl ::core::future::Future<Output = ()>;
1934
1935    fn clear(&mut self) -> impl ::core::future::Future<Output = ()>;
1936
1937    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1938        ::core::future::ready(())
1939    }
1940}
1941
1942impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Calculator
1943where
1944    ___H: CalculatorLocalServerHandler<___T>,
1945    ___T: ::fidl_next::Transport,
1946    for<'de> crate::wire::CalculatorAddRequest: ::fidl_next::Decode<
1947            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1948            Constraint = (),
1949        >,
1950    for<'de> crate::wire::CalculatorDivideRequest: ::fidl_next::Decode<
1951            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1952            Constraint = (),
1953        >,
1954{
1955    async fn on_one_way(
1956        handler: &mut ___H,
1957        mut message: ::fidl_next::Message<___T>,
1958    ) -> ::core::result::Result<
1959        (),
1960        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1961    > {
1962        match *message.header().ordinal {
1963            7439411180362570889 => {
1964                handler.clear().await;
1965                Ok(())
1966            }
1967
1968            ordinal => {
1969                handler.on_unknown_interaction(ordinal).await;
1970                if ::core::matches!(
1971                    message.header().flexibility(),
1972                    ::fidl_next::protocol::Flexibility::Strict
1973                ) {
1974                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1975                } else {
1976                    Ok(())
1977                }
1978            }
1979        }
1980    }
1981
1982    async fn on_two_way(
1983        handler: &mut ___H,
1984        mut message: ::fidl_next::Message<___T>,
1985        responder: ::fidl_next::protocol::Responder<___T>,
1986    ) -> ::core::result::Result<
1987        (),
1988        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1989    > {
1990        match *message.header().ordinal {
1991            8640324702111165953 => {
1992                let responder = ::fidl_next::Responder::from_untyped(responder);
1993
1994                match ::fidl_next::AsDecoderExt::into_decoded(message) {
1995                    Ok(decoded) => {
1996                        handler.add(::fidl_next::Request::from_decoded(decoded), responder).await;
1997                        Ok(())
1998                    }
1999                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2000                        ordinal: 8640324702111165953,
2001                        error,
2002                    }),
2003                }
2004            }
2005
2006            5497947425807432439 => {
2007                let responder = ::fidl_next::Responder::from_untyped(responder);
2008
2009                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2010                    Ok(decoded) => {
2011                        handler
2012                            .divide(::fidl_next::Request::from_decoded(decoded), responder)
2013                            .await;
2014                        Ok(())
2015                    }
2016                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2017                        ordinal: 5497947425807432439,
2018                        error,
2019                    }),
2020                }
2021            }
2022
2023            ordinal => {
2024                handler.on_unknown_interaction(ordinal).await;
2025                if ::core::matches!(
2026                    message.header().flexibility(),
2027                    ::fidl_next::protocol::Flexibility::Strict
2028                ) {
2029                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2030                } else {
2031                    responder
2032                        .respond_framework_error(
2033                            ordinal,
2034                            ::fidl_next::FrameworkError::UnknownMethod,
2035                        )
2036                        .expect("encoding a framework error should never fail")
2037                        .await?;
2038                    Ok(())
2039                }
2040            }
2041        }
2042    }
2043}
2044
2045/// A client handler for the Calculator protocol.
2046///
2047/// See [`Calculator`] for more details.
2048pub trait CalculatorClientHandler<
2049    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2050    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2051>
2052{
2053    fn on_error(
2054        &mut self,
2055
2056        request: ::fidl_next::Request<calculator::OnError, ___T>,
2057    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2058
2059    fn on_unknown_interaction(
2060        &mut self,
2061        ordinal: u64,
2062    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2063        ::core::future::ready(())
2064    }
2065}
2066
2067impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Calculator
2068where
2069    ___H: CalculatorClientHandler<___T> + ::core::marker::Send,
2070    ___T: ::fidl_next::Transport,
2071    for<'de> crate::wire::CalculatorOnErrorRequest: ::fidl_next::Decode<
2072            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2073            Constraint = (),
2074        >,
2075{
2076    async fn on_event(
2077        handler: &mut ___H,
2078        mut message: ::fidl_next::Message<___T>,
2079    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2080        match *message.header().ordinal {
2081            8940578522385404924 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
2082                Ok(decoded) => {
2083                    handler.on_error(::fidl_next::Request::from_decoded(decoded)).await;
2084                    Ok(())
2085                }
2086                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2087                    ordinal: 8940578522385404924,
2088                    error,
2089                }),
2090            },
2091
2092            ordinal => {
2093                handler.on_unknown_interaction(ordinal).await;
2094                if ::core::matches!(
2095                    message.header().flexibility(),
2096                    ::fidl_next::protocol::Flexibility::Strict
2097                ) {
2098                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2099                } else {
2100                    Ok(())
2101                }
2102            }
2103        }
2104    }
2105}
2106
2107/// A server handler for the Calculator protocol.
2108///
2109/// See [`Calculator`] for more details.
2110pub trait CalculatorServerHandler<
2111    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2112    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2113>
2114{
2115    fn add(
2116        &mut self,
2117
2118        request: ::fidl_next::Request<calculator::Add, ___T>,
2119
2120        responder: ::fidl_next::Responder<calculator::Add, ___T>,
2121    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2122
2123    fn divide(
2124        &mut self,
2125
2126        request: ::fidl_next::Request<calculator::Divide, ___T>,
2127
2128        responder: ::fidl_next::Responder<calculator::Divide, ___T>,
2129    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2130
2131    fn clear(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2132
2133    fn on_unknown_interaction(
2134        &mut self,
2135        ordinal: u64,
2136    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2137        ::core::future::ready(())
2138    }
2139}
2140
2141impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Calculator
2142where
2143    ___H: CalculatorServerHandler<___T> + ::core::marker::Send,
2144    ___T: ::fidl_next::Transport,
2145    for<'de> crate::wire::CalculatorAddRequest: ::fidl_next::Decode<
2146            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2147            Constraint = (),
2148        >,
2149    for<'de> crate::wire::CalculatorDivideRequest: ::fidl_next::Decode<
2150            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2151            Constraint = (),
2152        >,
2153{
2154    async fn on_one_way(
2155        handler: &mut ___H,
2156        mut message: ::fidl_next::Message<___T>,
2157    ) -> ::core::result::Result<
2158        (),
2159        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2160    > {
2161        match *message.header().ordinal {
2162            7439411180362570889 => {
2163                handler.clear().await;
2164                Ok(())
2165            }
2166
2167            ordinal => {
2168                handler.on_unknown_interaction(ordinal).await;
2169                if ::core::matches!(
2170                    message.header().flexibility(),
2171                    ::fidl_next::protocol::Flexibility::Strict
2172                ) {
2173                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2174                } else {
2175                    Ok(())
2176                }
2177            }
2178        }
2179    }
2180
2181    async fn on_two_way(
2182        handler: &mut ___H,
2183        mut message: ::fidl_next::Message<___T>,
2184        responder: ::fidl_next::protocol::Responder<___T>,
2185    ) -> ::core::result::Result<
2186        (),
2187        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2188    > {
2189        match *message.header().ordinal {
2190            8640324702111165953 => {
2191                let responder = ::fidl_next::Responder::from_untyped(responder);
2192
2193                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2194                    Ok(decoded) => {
2195                        handler.add(::fidl_next::Request::from_decoded(decoded), responder).await;
2196                        Ok(())
2197                    }
2198                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2199                        ordinal: 8640324702111165953,
2200                        error,
2201                    }),
2202                }
2203            }
2204
2205            5497947425807432439 => {
2206                let responder = ::fidl_next::Responder::from_untyped(responder);
2207
2208                match ::fidl_next::AsDecoderExt::into_decoded(message) {
2209                    Ok(decoded) => {
2210                        handler
2211                            .divide(::fidl_next::Request::from_decoded(decoded), responder)
2212                            .await;
2213                        Ok(())
2214                    }
2215                    Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2216                        ordinal: 5497947425807432439,
2217                        error,
2218                    }),
2219                }
2220            }
2221
2222            ordinal => {
2223                handler.on_unknown_interaction(ordinal).await;
2224                if ::core::matches!(
2225                    message.header().flexibility(),
2226                    ::fidl_next::protocol::Flexibility::Strict
2227                ) {
2228                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2229                } else {
2230                    responder
2231                        .respond_framework_error(
2232                            ordinal,
2233                            ::fidl_next::FrameworkError::UnknownMethod,
2234                        )
2235                        .expect("encoding a framework error should never fail")
2236                        .await?;
2237                    Ok(())
2238                }
2239            }
2240        }
2241    }
2242}
2243
2244impl<___T> CalculatorClientHandler<___T> for ::fidl_next::IgnoreEvents
2245where
2246    ___T: ::fidl_next::Transport,
2247{
2248    async fn on_error(&mut self, _: ::fidl_next::Request<calculator::OnError, ___T>) {}
2249
2250    async fn on_unknown_interaction(&mut self, _: u64) {}
2251}
2252
2253impl<___H, ___T> CalculatorLocalClientHandler<___T> for ::fidl_next::Local<___H>
2254where
2255    ___H: CalculatorClientHandler<___T>,
2256    ___T: ::fidl_next::Transport,
2257{
2258    async fn on_error(&mut self, request: ::fidl_next::Request<calculator::OnError, ___T>) {
2259        ___H::on_error(&mut self.0, request).await
2260    }
2261
2262    async fn on_unknown_interaction(&mut self, ordinal: u64) {
2263        ___H::on_unknown_interaction(&mut self.0, ordinal).await
2264    }
2265}
2266
2267impl<___H, ___T> CalculatorLocalServerHandler<___T> for ::fidl_next::Local<___H>
2268where
2269    ___H: CalculatorServerHandler<___T>,
2270    ___T: ::fidl_next::Transport,
2271{
2272    async fn add(
2273        &mut self,
2274
2275        request: ::fidl_next::Request<calculator::Add, ___T>,
2276
2277        responder: ::fidl_next::Responder<calculator::Add, ___T>,
2278    ) {
2279        ___H::add(&mut self.0, request, responder).await
2280    }
2281
2282    async fn divide(
2283        &mut self,
2284
2285        request: ::fidl_next::Request<calculator::Divide, ___T>,
2286
2287        responder: ::fidl_next::Responder<calculator::Divide, ___T>,
2288    ) {
2289        ___H::divide(&mut self.0, request, responder).await
2290    }
2291
2292    async fn clear(&mut self) {
2293        ___H::clear(&mut self.0).await
2294    }
2295
2296    async fn on_unknown_interaction(&mut self, ordinal: u64) {
2297        ___H::on_unknown_interaction(&mut self.0, ordinal).await
2298    }
2299}