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