Skip to main content

fidl_next_common_examples_canvas_clientrequesteddraw/
fidl_next_common_examples_canvas_clientrequesteddraw.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, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
355    pub struct InstanceAddLinesRequest {
356        pub lines: ::std::vec::Vec<[crate::natural::Point; 2]>,
357    }
358
359    unsafe impl<___E> ::fidl_next::Encode<crate::wire::InstanceAddLinesRequest<'static>, ___E>
360        for InstanceAddLinesRequest
361    where
362        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
363        ___E: ::fidl_next::Encoder,
364    {
365        #[inline]
366        fn encode(
367            self,
368            encoder_: &mut ___E,
369            out_: &mut ::core::mem::MaybeUninit<crate::wire::InstanceAddLinesRequest<'static>>,
370            _: (),
371        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
372            ::fidl_next::munge! {
373                let crate::wire::InstanceAddLinesRequest {
374                    lines,
375
376                } = out_;
377            }
378
379            ::fidl_next::Encode::encode(self.lines, encoder_, lines, (4294967295, ()))?;
380
381            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(lines.as_mut_ptr()) };
382            ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
383
384            Ok(())
385        }
386    }
387
388    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::InstanceAddLinesRequest<'static>, ___E>
389        for &'a InstanceAddLinesRequest
390    where
391        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
392        ___E: ::fidl_next::Encoder,
393    {
394        #[inline]
395        fn encode(
396            self,
397            encoder_: &mut ___E,
398            out_: &mut ::core::mem::MaybeUninit<crate::wire::InstanceAddLinesRequest<'static>>,
399            _: (),
400        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
401            ::fidl_next::munge! {
402                let crate::wire::InstanceAddLinesRequest {
403                    lines,
404
405                } = out_;
406            }
407
408            ::fidl_next::Encode::encode(&self.lines, encoder_, lines, (4294967295, ()))?;
409
410            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(lines.as_mut_ptr()) };
411            ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
412
413            Ok(())
414        }
415    }
416
417    unsafe impl<___E>
418        ::fidl_next::EncodeOption<
419            ::fidl_next::wire::Box<'static, crate::wire::InstanceAddLinesRequest<'static>>,
420            ___E,
421        > for InstanceAddLinesRequest
422    where
423        ___E: ::fidl_next::Encoder + ?Sized,
424        InstanceAddLinesRequest:
425            ::fidl_next::Encode<crate::wire::InstanceAddLinesRequest<'static>, ___E>,
426    {
427        #[inline]
428        fn encode_option(
429            this: ::core::option::Option<Self>,
430            encoder: &mut ___E,
431            out: &mut ::core::mem::MaybeUninit<
432                ::fidl_next::wire::Box<'static, crate::wire::InstanceAddLinesRequest<'static>>,
433            >,
434            _: (),
435        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
436            if let Some(inner) = this {
437                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
438                ::fidl_next::wire::Box::encode_present(out);
439            } else {
440                ::fidl_next::wire::Box::encode_absent(out);
441            }
442
443            Ok(())
444        }
445    }
446
447    unsafe impl<'a, ___E>
448        ::fidl_next::EncodeOption<
449            ::fidl_next::wire::Box<'static, crate::wire::InstanceAddLinesRequest<'static>>,
450            ___E,
451        > for &'a InstanceAddLinesRequest
452    where
453        ___E: ::fidl_next::Encoder + ?Sized,
454        &'a InstanceAddLinesRequest:
455            ::fidl_next::Encode<crate::wire::InstanceAddLinesRequest<'static>, ___E>,
456    {
457        #[inline]
458        fn encode_option(
459            this: ::core::option::Option<Self>,
460            encoder: &mut ___E,
461            out: &mut ::core::mem::MaybeUninit<
462                ::fidl_next::wire::Box<'static, crate::wire::InstanceAddLinesRequest<'static>>,
463            >,
464            _: (),
465        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
466            if let Some(inner) = this {
467                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
468                ::fidl_next::wire::Box::encode_present(out);
469            } else {
470                ::fidl_next::wire::Box::encode_absent(out);
471            }
472
473            Ok(())
474        }
475    }
476
477    impl<'de> ::fidl_next::FromWire<crate::wire::InstanceAddLinesRequest<'de>>
478        for InstanceAddLinesRequest
479    {
480        #[inline]
481        fn from_wire(wire: crate::wire::InstanceAddLinesRequest<'de>) -> Self {
482            Self { lines: ::fidl_next::FromWire::from_wire(wire.lines) }
483        }
484    }
485
486    impl<'de> ::fidl_next::FromWireRef<crate::wire::InstanceAddLinesRequest<'de>>
487        for InstanceAddLinesRequest
488    {
489        #[inline]
490        fn from_wire_ref(wire: &crate::wire::InstanceAddLinesRequest<'de>) -> Self {
491            Self { lines: ::fidl_next::FromWireRef::from_wire_ref(&wire.lines) }
492        }
493    }
494
495    pub type InstanceReadyResponse = ();
496}
497
498pub mod wire {
499
500    /// The wire type corresponding to [`Point`].
501    #[derive(Clone, Debug)]
502    #[repr(C)]
503    pub struct Point {
504        pub x: ::fidl_next::wire::Int64,
505
506        pub y: ::fidl_next::wire::Int64,
507    }
508
509    static_assertions::const_assert_eq!(std::mem::size_of::<Point>(), 16);
510    static_assertions::const_assert_eq!(std::mem::align_of::<Point>(), 8);
511
512    static_assertions::const_assert_eq!(std::mem::offset_of!(Point, x), 0);
513
514    static_assertions::const_assert_eq!(std::mem::offset_of!(Point, y), 8);
515
516    impl ::fidl_next::Constrained for Point {
517        type Constraint = ();
518
519        fn validate(
520            _: ::fidl_next::Slot<'_, Self>,
521            _: Self::Constraint,
522        ) -> Result<(), ::fidl_next::ValidationError> {
523            Ok(())
524        }
525    }
526
527    unsafe impl ::fidl_next::Wire for Point {
528        type Narrowed<'de> = Point;
529
530        #[inline]
531        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
532            ::fidl_next::munge! {
533                let Self {
534                    x,
535                    y,
536
537                } = &mut *out_;
538            }
539
540            ::fidl_next::Wire::zero_padding(x);
541
542            ::fidl_next::Wire::zero_padding(y);
543        }
544    }
545
546    unsafe impl<___D> ::fidl_next::Decode<___D> for Point
547    where
548        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
549    {
550        fn decode(
551            slot_: ::fidl_next::Slot<'_, Self>,
552            decoder_: &mut ___D,
553            _: (),
554        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
555            ::fidl_next::munge! {
556                let Self {
557                    mut x,
558                    mut y,
559
560                } = slot_;
561            }
562
563            let _field = x.as_mut();
564
565            ::fidl_next::Decode::decode(x.as_mut(), decoder_, ())?;
566
567            let _field = y.as_mut();
568
569            ::fidl_next::Decode::decode(y.as_mut(), decoder_, ())?;
570
571            Ok(())
572        }
573    }
574
575    impl ::fidl_next::IntoNatural for Point {
576        type Natural = crate::natural::Point;
577    }
578
579    /// The wire type corresponding to [`BoundingBox`].
580    #[derive(Clone, Debug)]
581    #[repr(C)]
582    pub struct BoundingBox {
583        pub top_left: crate::wire::Point,
584
585        pub bottom_right: crate::wire::Point,
586    }
587
588    static_assertions::const_assert_eq!(std::mem::size_of::<BoundingBox>(), 32);
589    static_assertions::const_assert_eq!(std::mem::align_of::<BoundingBox>(), 8);
590
591    static_assertions::const_assert_eq!(std::mem::offset_of!(BoundingBox, top_left), 0);
592
593    static_assertions::const_assert_eq!(std::mem::offset_of!(BoundingBox, bottom_right), 16);
594
595    impl ::fidl_next::Constrained for BoundingBox {
596        type Constraint = ();
597
598        fn validate(
599            _: ::fidl_next::Slot<'_, Self>,
600            _: Self::Constraint,
601        ) -> Result<(), ::fidl_next::ValidationError> {
602            Ok(())
603        }
604    }
605
606    unsafe impl ::fidl_next::Wire for BoundingBox {
607        type Narrowed<'de> = BoundingBox;
608
609        #[inline]
610        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
611            ::fidl_next::munge! {
612                let Self {
613                    top_left,
614                    bottom_right,
615
616                } = &mut *out_;
617            }
618
619            ::fidl_next::Wire::zero_padding(top_left);
620
621            ::fidl_next::Wire::zero_padding(bottom_right);
622        }
623    }
624
625    unsafe impl<___D> ::fidl_next::Decode<___D> for BoundingBox
626    where
627        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
628    {
629        fn decode(
630            slot_: ::fidl_next::Slot<'_, Self>,
631            decoder_: &mut ___D,
632            _: (),
633        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
634            ::fidl_next::munge! {
635                let Self {
636                    mut top_left,
637                    mut bottom_right,
638
639                } = slot_;
640            }
641
642            let _field = top_left.as_mut();
643
644            ::fidl_next::Decode::decode(top_left.as_mut(), decoder_, ())?;
645
646            let _field = bottom_right.as_mut();
647
648            ::fidl_next::Decode::decode(bottom_right.as_mut(), decoder_, ())?;
649
650            Ok(())
651        }
652    }
653
654    impl ::fidl_next::IntoNatural for BoundingBox {
655        type Natural = crate::natural::BoundingBox;
656    }
657
658    /// The wire type corresponding to [`Line`](crate::natural::Line).
659    pub type Line = [crate::wire::Point; 2];
660
661    /// The wire type corresponding to [`InstanceAddLinesRequest`].
662    #[derive(Debug)]
663    #[repr(C)]
664    pub struct InstanceAddLinesRequest<'de> {
665        pub lines: ::fidl_next::wire::Vector<'de, [crate::wire::Point; 2]>,
666    }
667
668    static_assertions::const_assert_eq!(std::mem::size_of::<InstanceAddLinesRequest<'_>>(), 16);
669    static_assertions::const_assert_eq!(std::mem::align_of::<InstanceAddLinesRequest<'_>>(), 8);
670
671    static_assertions::const_assert_eq!(
672        std::mem::offset_of!(InstanceAddLinesRequest<'_>, lines),
673        0
674    );
675
676    impl ::fidl_next::Constrained for InstanceAddLinesRequest<'_> {
677        type Constraint = ();
678
679        fn validate(
680            _: ::fidl_next::Slot<'_, Self>,
681            _: Self::Constraint,
682        ) -> Result<(), ::fidl_next::ValidationError> {
683            Ok(())
684        }
685    }
686
687    unsafe impl ::fidl_next::Wire for InstanceAddLinesRequest<'static> {
688        type Narrowed<'de> = InstanceAddLinesRequest<'de>;
689
690        #[inline]
691        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
692            ::fidl_next::munge! {
693                let Self {
694                    lines,
695
696                } = &mut *out_;
697            }
698
699            ::fidl_next::Wire::zero_padding(lines);
700        }
701    }
702
703    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for InstanceAddLinesRequest<'de>
704    where
705        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
706        ___D: ::fidl_next::Decoder<'de>,
707    {
708        fn decode(
709            slot_: ::fidl_next::Slot<'_, Self>,
710            decoder_: &mut ___D,
711            _: (),
712        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
713            ::fidl_next::munge! {
714                let Self {
715                    mut lines,
716
717                } = slot_;
718            }
719
720            let _field = lines.as_mut();
721            ::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
722            ::fidl_next::Decode::decode(lines.as_mut(), decoder_, (4294967295, ()))?;
723
724            Ok(())
725        }
726    }
727
728    impl<'de> ::fidl_next::IntoNatural for InstanceAddLinesRequest<'de> {
729        type Natural = crate::natural::InstanceAddLinesRequest;
730    }
731
732    /// The wire type corresponding to [`InstanceReadyResponse`].
733    pub type InstanceReadyResponse = ::fidl_next::wire::Unit;
734}
735
736pub mod wire_optional {}
737
738pub mod generic {
739
740    /// The generic type corresponding to [`Point`].
741    pub struct Point<T0, T1> {
742        pub x: T0,
743
744        pub y: T1,
745    }
746
747    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::Point, ___E> for Point<T0, T1>
748    where
749        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
750        T0: ::fidl_next::Encode<::fidl_next::wire::Int64, ___E>,
751        T1: ::fidl_next::Encode<::fidl_next::wire::Int64, ___E>,
752    {
753        #[inline]
754        fn encode(
755            self,
756            encoder_: &mut ___E,
757            out_: &mut ::core::mem::MaybeUninit<crate::wire::Point>,
758            _: (),
759        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
760            ::fidl_next::munge! {
761                let crate::wire::Point {
762                    x,
763                    y,
764
765                } = out_;
766            }
767
768            ::fidl_next::Encode::encode(self.x, encoder_, x, ())?;
769
770            ::fidl_next::Encode::encode(self.y, encoder_, y, ())?;
771
772            Ok(())
773        }
774    }
775
776    unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::Point, ___E> for &'a Point<T0, T1>
777    where
778        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
779        &'a T0: ::fidl_next::Encode<::fidl_next::wire::Int64, ___E>,
780        &'a T1: ::fidl_next::Encode<::fidl_next::wire::Int64, ___E>,
781    {
782        #[inline]
783        fn encode(
784            self,
785            encoder_: &mut ___E,
786            out_: &mut ::core::mem::MaybeUninit<crate::wire::Point>,
787            _: (),
788        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
789            ::fidl_next::munge! {
790                let crate::wire::Point {
791                    x,
792                    y,
793
794                } = out_;
795            }
796
797            ::fidl_next::Encode::encode(&self.x, encoder_, x, ())?;
798
799            ::fidl_next::Encode::encode(&self.y, encoder_, y, ())?;
800
801            Ok(())
802        }
803    }
804
805    /// The generic type corresponding to [`BoundingBox`].
806    pub struct BoundingBox<T0, T1> {
807        pub top_left: T0,
808
809        pub bottom_right: T1,
810    }
811
812    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::BoundingBox, ___E>
813        for BoundingBox<T0, T1>
814    where
815        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
816        T0: ::fidl_next::Encode<crate::wire::Point, ___E>,
817        T1: ::fidl_next::Encode<crate::wire::Point, ___E>,
818    {
819        #[inline]
820        fn encode(
821            self,
822            encoder_: &mut ___E,
823            out_: &mut ::core::mem::MaybeUninit<crate::wire::BoundingBox>,
824            _: (),
825        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
826            ::fidl_next::munge! {
827                let crate::wire::BoundingBox {
828                    top_left,
829                    bottom_right,
830
831                } = out_;
832            }
833
834            ::fidl_next::Encode::encode(self.top_left, encoder_, top_left, ())?;
835
836            ::fidl_next::Encode::encode(self.bottom_right, encoder_, bottom_right, ())?;
837
838            Ok(())
839        }
840    }
841
842    unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::BoundingBox, ___E>
843        for &'a BoundingBox<T0, T1>
844    where
845        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
846        &'a T0: ::fidl_next::Encode<crate::wire::Point, ___E>,
847        &'a T1: ::fidl_next::Encode<crate::wire::Point, ___E>,
848    {
849        #[inline]
850        fn encode(
851            self,
852            encoder_: &mut ___E,
853            out_: &mut ::core::mem::MaybeUninit<crate::wire::BoundingBox>,
854            _: (),
855        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
856            ::fidl_next::munge! {
857                let crate::wire::BoundingBox {
858                    top_left,
859                    bottom_right,
860
861                } = out_;
862            }
863
864            ::fidl_next::Encode::encode(&self.top_left, encoder_, top_left, ())?;
865
866            ::fidl_next::Encode::encode(&self.bottom_right, encoder_, bottom_right, ())?;
867
868            Ok(())
869        }
870    }
871
872    /// The generic type corresponding to [`InstanceAddLinesRequest`].
873    pub struct InstanceAddLinesRequest<T0> {
874        pub lines: T0,
875    }
876
877    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::InstanceAddLinesRequest<'static>, ___E>
878        for InstanceAddLinesRequest<T0>
879    where
880        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
881        ___E: ::fidl_next::Encoder,
882        T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, [crate::wire::Point; 2]>, ___E>,
883    {
884        #[inline]
885        fn encode(
886            self,
887            encoder_: &mut ___E,
888            out_: &mut ::core::mem::MaybeUninit<crate::wire::InstanceAddLinesRequest<'static>>,
889            _: (),
890        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
891            ::fidl_next::munge! {
892                let crate::wire::InstanceAddLinesRequest {
893                    lines,
894
895                } = out_;
896            }
897
898            ::fidl_next::Encode::encode(self.lines, encoder_, lines, (4294967295, ()))?;
899
900            Ok(())
901        }
902    }
903
904    unsafe impl<'a, ___E, T0>
905        ::fidl_next::Encode<crate::wire::InstanceAddLinesRequest<'static>, ___E>
906        for &'a InstanceAddLinesRequest<T0>
907    where
908        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
909        ___E: ::fidl_next::Encoder,
910        &'a T0:
911            ::fidl_next::Encode<::fidl_next::wire::Vector<'static, [crate::wire::Point; 2]>, ___E>,
912    {
913        #[inline]
914        fn encode(
915            self,
916            encoder_: &mut ___E,
917            out_: &mut ::core::mem::MaybeUninit<crate::wire::InstanceAddLinesRequest<'static>>,
918            _: (),
919        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
920            ::fidl_next::munge! {
921                let crate::wire::InstanceAddLinesRequest {
922                    lines,
923
924                } = out_;
925            }
926
927            ::fidl_next::Encode::encode(&self.lines, encoder_, lines, (4294967295, ()))?;
928
929            Ok(())
930        }
931    }
932
933    /// The generic type corresponding to [`InstanceReadyResponse`].
934    pub type InstanceReadyResponse = ();
935}
936
937pub use self::natural::*;
938
939/// The type corresponding to the Instance protocol.
940#[doc = " Manages a single instance of a canvas. Each session of this protocol is responsible for a new\n canvas.\n"]
941#[derive(PartialEq, Debug)]
942pub struct Instance;
943
944impl ::fidl_next::Discoverable for Instance {
945    const PROTOCOL_NAME: &'static str = "examples.canvas.clientrequesteddraw.Instance";
946}
947
948#[cfg(target_os = "fuchsia")]
949impl ::fidl_next::HasTransport for Instance {
950    type Transport = ::fidl_next::fuchsia::zx::Channel;
951}
952
953pub mod instance {
954    pub mod prelude {
955        pub use crate::{
956            Instance, InstanceClientHandler, InstanceLocalClientHandler,
957            InstanceLocalServerHandler, InstanceServerHandler, instance,
958        };
959
960        pub use crate::natural::BoundingBox;
961
962        pub use crate::natural::InstanceAddLinesRequest;
963
964        pub use crate::natural::InstanceReadyResponse;
965    }
966
967    pub struct AddLines;
968
969    impl ::fidl_next::Method for AddLines {
970        const ORDINAL: u64 = 6522039862237268950;
971        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
972            ::fidl_next::protocol::Flexibility::Flexible;
973
974        type Protocol = crate::Instance;
975
976        type Request = crate::wire::InstanceAddLinesRequest<'static>;
977    }
978
979    pub struct Ready;
980
981    impl ::fidl_next::Method for Ready {
982        const ORDINAL: u64 = 3772001797641023824;
983        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
984            ::fidl_next::protocol::Flexibility::Flexible;
985
986        type Protocol = crate::Instance;
987
988        type Request = ::fidl_next::wire::EmptyMessageBody;
989    }
990
991    impl ::fidl_next::TwoWayMethod for Ready {
992        type Response = ::fidl_next::wire::Flexible<'static, crate::wire::InstanceReadyResponse>;
993    }
994
995    impl<___R> ::fidl_next::Respond<___R> for Ready {
996        type Output = ::fidl_next::Flexible<___R>;
997
998        fn respond(response: ___R) -> Self::Output {
999            ::fidl_next::Flexible(response)
1000        }
1001    }
1002
1003    pub struct OnDrawn;
1004
1005    impl ::fidl_next::Method for OnDrawn {
1006        const ORDINAL: u64 = 2731108033267712410;
1007        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1008            ::fidl_next::protocol::Flexibility::Flexible;
1009
1010        type Protocol = crate::Instance;
1011
1012        type Request = crate::wire::BoundingBox;
1013    }
1014
1015    mod ___detail {
1016        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Instance
1017        where
1018            ___T: ::fidl_next::Transport,
1019        {
1020            type Client = InstanceClient<___T>;
1021            type Server = InstanceServer<___T>;
1022        }
1023
1024        /// The client for the `Instance` protocol.
1025        #[repr(transparent)]
1026        pub struct InstanceClient<___T: ::fidl_next::Transport> {
1027            #[allow(dead_code)]
1028            client: ::fidl_next::protocol::Client<___T>,
1029        }
1030
1031        impl<___T> InstanceClient<___T>
1032        where
1033            ___T: ::fidl_next::Transport,
1034        {
1035            #[doc = " Add multiple lines to the canvas. We are able to reduce protocol chatter and the number of\n requests needed by batching instead of calling the simpler `AddLine(...)` one line at a\n time.\n"]
1036            pub fn add_lines(
1037                &self,
1038
1039                lines: impl ::fidl_next::Encode<
1040                    ::fidl_next::wire::Vector<'static, [crate::wire::Point; 2]>,
1041                    <___T as ::fidl_next::Transport>::SendBuffer,
1042                >,
1043            ) -> ::fidl_next::SendFuture<'_, ___T>
1044            where
1045                <___T as ::fidl_next::Transport>::SendBuffer:
1046                    ::fidl_next::encoder::InternalHandleEncoder,
1047                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1048            {
1049                self.add_lines_with(crate::generic::InstanceAddLinesRequest { lines })
1050            }
1051
1052            #[doc = " Add multiple lines to the canvas. We are able to reduce protocol chatter and the number of\n requests needed by batching instead of calling the simpler `AddLine(...)` one line at a\n time.\n"]
1053            pub fn add_lines_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
1054            where
1055                ___R: ::fidl_next::Encode<
1056                        crate::wire::InstanceAddLinesRequest<'static>,
1057                        <___T as ::fidl_next::Transport>::SendBuffer,
1058                    >,
1059            {
1060                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
1061                    6522039862237268950,
1062                    <super::AddLines as ::fidl_next::Method>::FLEXIBILITY,
1063                    request,
1064                ))
1065            }
1066
1067            #[doc = " Rather than the server randomly performing draws, or trying to guess when to do so, the\n client must explicitly ask for them. This creates a bit of extra chatter with the additional\n method invocation, but allows much greater client-side control of when the canvas is \"ready\"\n for a view update, thereby eliminating unnecessary draws.\n\n This method also has the benefit of \"throttling\" the `-> OnDrawn(...)` event - rather than\n allowing a potentially unlimited flood of `-> OnDrawn(...)` calls, we now have the runtime\n enforced semantic that each `-> OnDrawn(...)` call must follow a unique `Ready() -> ()` call\n from the client. An unprompted `-> OnDrawn(...)` is invalid, and should cause the channel to\n immediately close.\n"]
1068            pub fn ready(&self) -> ::fidl_next::TwoWayFuture<'_, super::Ready, ___T> {
1069                ::fidl_next::TwoWayFuture::from_untyped(
1070                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1071                        3772001797641023824,
1072                        <super::Ready as ::fidl_next::Method>::FLEXIBILITY,
1073                        (),
1074                    ),
1075                )
1076            }
1077        }
1078
1079        /// The server for the `Instance` protocol.
1080        #[repr(transparent)]
1081        pub struct InstanceServer<___T: ::fidl_next::Transport> {
1082            server: ::fidl_next::protocol::Server<___T>,
1083        }
1084
1085        impl<___T> InstanceServer<___T>
1086        where
1087            ___T: ::fidl_next::Transport,
1088        {
1089            #[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"]
1090            pub fn on_drawn(
1091                &self,
1092
1093                top_left: impl ::fidl_next::Encode<
1094                    crate::wire::Point,
1095                    <___T as ::fidl_next::Transport>::SendBuffer,
1096                >,
1097
1098                bottom_right: impl ::fidl_next::Encode<
1099                    crate::wire::Point,
1100                    <___T as ::fidl_next::Transport>::SendBuffer,
1101                >,
1102            ) -> ::fidl_next::SendFuture<'_, ___T>
1103            where
1104                <___T as ::fidl_next::Transport>::SendBuffer:
1105                    ::fidl_next::encoder::InternalHandleEncoder,
1106            {
1107                self.on_drawn_with(crate::generic::BoundingBox { top_left, bottom_right })
1108            }
1109
1110            #[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"]
1111
1112            pub fn on_drawn_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
1113            where
1114                ___R: ::fidl_next::Encode<
1115                        <super::OnDrawn as ::fidl_next::Method>::Request,
1116                        <___T as ::fidl_next::Transport>::SendBuffer,
1117                    >,
1118            {
1119                ::fidl_next::SendFuture::from_untyped(self.server.send_event(
1120                    2731108033267712410,
1121                    <super::OnDrawn as ::fidl_next::Method>::FLEXIBILITY,
1122                    request,
1123                ))
1124            }
1125        }
1126    }
1127}
1128
1129#[diagnostic::on_unimplemented(
1130    note = "If {Self} implements the non-local InstanceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1131)]
1132
1133/// A client handler for the Instance protocol.
1134///
1135/// See [`Instance`] for more details.
1136pub trait InstanceLocalClientHandler<
1137    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1138    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1139>
1140{
1141    #[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"]
1142    fn on_drawn(
1143        &mut self,
1144
1145        request: ::fidl_next::Request<instance::OnDrawn, ___T>,
1146    ) -> impl ::core::future::Future<Output = ()>;
1147
1148    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1149        ::core::future::ready(())
1150    }
1151}
1152
1153impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Instance
1154where
1155    ___H: InstanceLocalClientHandler<___T>,
1156    ___T: ::fidl_next::Transport,
1157    for<'de> crate::wire::BoundingBox: ::fidl_next::Decode<
1158            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1159            Constraint = (),
1160        >,
1161{
1162    async fn on_event(
1163        handler: &mut ___H,
1164        mut message: ::fidl_next::Message<___T>,
1165    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1166        match *message.header().ordinal {
1167            2731108033267712410 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1168                Ok(decoded) => {
1169                    handler.on_drawn(::fidl_next::Request::from_decoded(decoded)).await;
1170                    Ok(())
1171                }
1172                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1173                    ordinal: 2731108033267712410,
1174                    error,
1175                }),
1176            },
1177
1178            ordinal => {
1179                handler.on_unknown_interaction(ordinal).await;
1180                if ::core::matches!(
1181                    message.header().flexibility(),
1182                    ::fidl_next::protocol::Flexibility::Strict
1183                ) {
1184                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1185                } else {
1186                    Ok(())
1187                }
1188            }
1189        }
1190    }
1191}
1192
1193#[diagnostic::on_unimplemented(
1194    note = "If {Self} implements the non-local InstanceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1195)]
1196
1197/// A server handler for the Instance protocol.
1198///
1199/// See [`Instance`] for more details.
1200pub trait InstanceLocalServerHandler<
1201    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1202    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1203>
1204{
1205    #[doc = " Add multiple lines to the canvas. We are able to reduce protocol chatter and the number of\n requests needed by batching instead of calling the simpler `AddLine(...)` one line at a\n time.\n"]
1206    fn add_lines(
1207        &mut self,
1208
1209        request: ::fidl_next::Request<instance::AddLines, ___T>,
1210    ) -> impl ::core::future::Future<Output = ()>;
1211
1212    #[doc = " Rather than the server randomly performing draws, or trying to guess when to do so, the\n client must explicitly ask for them. This creates a bit of extra chatter with the additional\n method invocation, but allows much greater client-side control of when the canvas is \"ready\"\n for a view update, thereby eliminating unnecessary draws.\n\n This method also has the benefit of \"throttling\" the `-> OnDrawn(...)` event - rather than\n allowing a potentially unlimited flood of `-> OnDrawn(...)` calls, we now have the runtime\n enforced semantic that each `-> OnDrawn(...)` call must follow a unique `Ready() -> ()` call\n from the client. An unprompted `-> OnDrawn(...)` is invalid, and should cause the channel to\n immediately close.\n"]
1213    fn ready(
1214        &mut self,
1215
1216        responder: ::fidl_next::Responder<instance::Ready, ___T>,
1217    ) -> impl ::core::future::Future<Output = ()>;
1218
1219    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1220        ::core::future::ready(())
1221    }
1222}
1223
1224impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Instance
1225where
1226    ___H: InstanceLocalServerHandler<___T>,
1227    ___T: ::fidl_next::Transport,
1228    for<'de> crate::wire::InstanceAddLinesRequest<'de>: ::fidl_next::Decode<
1229            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1230            Constraint = (),
1231        >,
1232{
1233    async fn on_one_way(
1234        handler: &mut ___H,
1235        mut message: ::fidl_next::Message<___T>,
1236    ) -> ::core::result::Result<
1237        (),
1238        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1239    > {
1240        match *message.header().ordinal {
1241            6522039862237268950 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1242                Ok(decoded) => {
1243                    handler.add_lines(::fidl_next::Request::from_decoded(decoded)).await;
1244                    Ok(())
1245                }
1246                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1247                    ordinal: 6522039862237268950,
1248                    error,
1249                }),
1250            },
1251
1252            ordinal => {
1253                handler.on_unknown_interaction(ordinal).await;
1254                if ::core::matches!(
1255                    message.header().flexibility(),
1256                    ::fidl_next::protocol::Flexibility::Strict
1257                ) {
1258                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1259                } else {
1260                    Ok(())
1261                }
1262            }
1263        }
1264    }
1265
1266    async fn on_two_way(
1267        handler: &mut ___H,
1268        mut message: ::fidl_next::Message<___T>,
1269        responder: ::fidl_next::protocol::Responder<___T>,
1270    ) -> ::core::result::Result<
1271        (),
1272        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1273    > {
1274        match *message.header().ordinal {
1275            3772001797641023824 => {
1276                let responder = ::fidl_next::Responder::from_untyped(responder);
1277
1278                handler.ready(responder).await;
1279                Ok(())
1280            }
1281
1282            ordinal => {
1283                handler.on_unknown_interaction(ordinal).await;
1284                if ::core::matches!(
1285                    message.header().flexibility(),
1286                    ::fidl_next::protocol::Flexibility::Strict
1287                ) {
1288                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1289                } else {
1290                    responder
1291                        .respond_framework_error(
1292                            ordinal,
1293                            ::fidl_next::FrameworkError::UnknownMethod,
1294                        )
1295                        .expect("encoding a framework error should never fail")
1296                        .await?;
1297                    Ok(())
1298                }
1299            }
1300        }
1301    }
1302}
1303
1304/// A client handler for the Instance protocol.
1305///
1306/// See [`Instance`] for more details.
1307pub trait InstanceClientHandler<
1308    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1309    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1310>
1311{
1312    #[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"]
1313    fn on_drawn(
1314        &mut self,
1315
1316        request: ::fidl_next::Request<instance::OnDrawn, ___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::DispatchClientMessage<___H, ___T> for Instance
1328where
1329    ___H: InstanceClientHandler<___T> + ::core::marker::Send,
1330    ___T: ::fidl_next::Transport,
1331    for<'de> crate::wire::BoundingBox: ::fidl_next::Decode<
1332            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1333            Constraint = (),
1334        >,
1335{
1336    async fn on_event(
1337        handler: &mut ___H,
1338        mut message: ::fidl_next::Message<___T>,
1339    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1340        match *message.header().ordinal {
1341            2731108033267712410 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1342                Ok(decoded) => {
1343                    handler.on_drawn(::fidl_next::Request::from_decoded(decoded)).await;
1344                    Ok(())
1345                }
1346                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1347                    ordinal: 2731108033267712410,
1348                    error,
1349                }),
1350            },
1351
1352            ordinal => {
1353                handler.on_unknown_interaction(ordinal).await;
1354                if ::core::matches!(
1355                    message.header().flexibility(),
1356                    ::fidl_next::protocol::Flexibility::Strict
1357                ) {
1358                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1359                } else {
1360                    Ok(())
1361                }
1362            }
1363        }
1364    }
1365}
1366
1367/// A server handler for the Instance protocol.
1368///
1369/// See [`Instance`] for more details.
1370pub trait InstanceServerHandler<
1371    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1372    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1373>
1374{
1375    #[doc = " Add multiple lines to the canvas. We are able to reduce protocol chatter and the number of\n requests needed by batching instead of calling the simpler `AddLine(...)` one line at a\n time.\n"]
1376    fn add_lines(
1377        &mut self,
1378
1379        request: ::fidl_next::Request<instance::AddLines, ___T>,
1380    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1381
1382    #[doc = " Rather than the server randomly performing draws, or trying to guess when to do so, the\n client must explicitly ask for them. This creates a bit of extra chatter with the additional\n method invocation, but allows much greater client-side control of when the canvas is \"ready\"\n for a view update, thereby eliminating unnecessary draws.\n\n This method also has the benefit of \"throttling\" the `-> OnDrawn(...)` event - rather than\n allowing a potentially unlimited flood of `-> OnDrawn(...)` calls, we now have the runtime\n enforced semantic that each `-> OnDrawn(...)` call must follow a unique `Ready() -> ()` call\n from the client. An unprompted `-> OnDrawn(...)` is invalid, and should cause the channel to\n immediately close.\n"]
1383    fn ready(
1384        &mut self,
1385
1386        responder: ::fidl_next::Responder<instance::Ready, ___T>,
1387    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1388
1389    fn on_unknown_interaction(
1390        &mut self,
1391        ordinal: u64,
1392    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1393        ::core::future::ready(())
1394    }
1395}
1396
1397impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Instance
1398where
1399    ___H: InstanceServerHandler<___T> + ::core::marker::Send,
1400    ___T: ::fidl_next::Transport,
1401    for<'de> crate::wire::InstanceAddLinesRequest<'de>: ::fidl_next::Decode<
1402            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1403            Constraint = (),
1404        >,
1405{
1406    async fn on_one_way(
1407        handler: &mut ___H,
1408        mut message: ::fidl_next::Message<___T>,
1409    ) -> ::core::result::Result<
1410        (),
1411        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1412    > {
1413        match *message.header().ordinal {
1414            6522039862237268950 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1415                Ok(decoded) => {
1416                    handler.add_lines(::fidl_next::Request::from_decoded(decoded)).await;
1417                    Ok(())
1418                }
1419                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1420                    ordinal: 6522039862237268950,
1421                    error,
1422                }),
1423            },
1424
1425            ordinal => {
1426                handler.on_unknown_interaction(ordinal).await;
1427                if ::core::matches!(
1428                    message.header().flexibility(),
1429                    ::fidl_next::protocol::Flexibility::Strict
1430                ) {
1431                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1432                } else {
1433                    Ok(())
1434                }
1435            }
1436        }
1437    }
1438
1439    async fn on_two_way(
1440        handler: &mut ___H,
1441        mut message: ::fidl_next::Message<___T>,
1442        responder: ::fidl_next::protocol::Responder<___T>,
1443    ) -> ::core::result::Result<
1444        (),
1445        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1446    > {
1447        match *message.header().ordinal {
1448            3772001797641023824 => {
1449                let responder = ::fidl_next::Responder::from_untyped(responder);
1450
1451                handler.ready(responder).await;
1452                Ok(())
1453            }
1454
1455            ordinal => {
1456                handler.on_unknown_interaction(ordinal).await;
1457                if ::core::matches!(
1458                    message.header().flexibility(),
1459                    ::fidl_next::protocol::Flexibility::Strict
1460                ) {
1461                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1462                } else {
1463                    responder
1464                        .respond_framework_error(
1465                            ordinal,
1466                            ::fidl_next::FrameworkError::UnknownMethod,
1467                        )
1468                        .expect("encoding a framework error should never fail")
1469                        .await?;
1470                    Ok(())
1471                }
1472            }
1473        }
1474    }
1475}
1476
1477impl<___T> InstanceClientHandler<___T> for ::fidl_next::IgnoreEvents
1478where
1479    ___T: ::fidl_next::Transport,
1480{
1481    async fn on_drawn(&mut self, _: ::fidl_next::Request<instance::OnDrawn, ___T>) {}
1482
1483    async fn on_unknown_interaction(&mut self, _: u64) {}
1484}
1485
1486impl<___H, ___T> InstanceLocalClientHandler<___T> for ::fidl_next::Local<___H>
1487where
1488    ___H: InstanceClientHandler<___T>,
1489    ___T: ::fidl_next::Transport,
1490{
1491    async fn on_drawn(&mut self, request: ::fidl_next::Request<instance::OnDrawn, ___T>) {
1492        ___H::on_drawn(&mut self.0, request).await
1493    }
1494
1495    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1496        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1497    }
1498}
1499
1500impl<___H, ___T> InstanceLocalServerHandler<___T> for ::fidl_next::Local<___H>
1501where
1502    ___H: InstanceServerHandler<___T>,
1503    ___T: ::fidl_next::Transport,
1504{
1505    async fn add_lines(&mut self, request: ::fidl_next::Request<instance::AddLines, ___T>) {
1506        ___H::add_lines(&mut self.0, request).await
1507    }
1508
1509    async fn ready(&mut self, responder: ::fidl_next::Responder<instance::Ready, ___T>) {
1510        ___H::ready(&mut self.0, responder).await
1511    }
1512
1513    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1514        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1515    }
1516}