Skip to main content

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