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