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    /// The generic type corresponding to [`BoundingBox`].
777    pub struct BoundingBox<T0, T1> {
778        pub top_left: T0,
779
780        pub bottom_right: T1,
781    }
782
783    unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::BoundingBox, ___E>
784        for BoundingBox<T0, T1>
785    where
786        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
787        T0: ::fidl_next::Encode<crate::wire::Point, ___E>,
788        T1: ::fidl_next::Encode<crate::wire::Point, ___E>,
789    {
790        #[inline]
791        fn encode(
792            self,
793            encoder_: &mut ___E,
794            out_: &mut ::core::mem::MaybeUninit<crate::wire::BoundingBox>,
795            _: (),
796        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
797            ::fidl_next::munge! {
798                let crate::wire::BoundingBox {
799                    top_left,
800                    bottom_right,
801
802                } = out_;
803            }
804
805            ::fidl_next::Encode::encode(self.top_left, encoder_, top_left, ())?;
806
807            ::fidl_next::Encode::encode(self.bottom_right, encoder_, bottom_right, ())?;
808
809            Ok(())
810        }
811    }
812
813    /// The generic type corresponding to [`InstanceAddLinesRequest`].
814    pub struct InstanceAddLinesRequest<T0> {
815        pub lines: T0,
816    }
817
818    unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::InstanceAddLinesRequest<'static>, ___E>
819        for InstanceAddLinesRequest<T0>
820    where
821        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
822        ___E: ::fidl_next::Encoder,
823        T0: ::fidl_next::Encode<::fidl_next::wire::Vector<'static, [crate::wire::Point; 2]>, ___E>,
824    {
825        #[inline]
826        fn encode(
827            self,
828            encoder_: &mut ___E,
829            out_: &mut ::core::mem::MaybeUninit<crate::wire::InstanceAddLinesRequest<'static>>,
830            _: (),
831        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
832            ::fidl_next::munge! {
833                let crate::wire::InstanceAddLinesRequest {
834                    lines,
835
836                } = out_;
837            }
838
839            ::fidl_next::Encode::encode(self.lines, encoder_, lines, (4294967295, ()))?;
840
841            Ok(())
842        }
843    }
844
845    /// The generic type corresponding to [`InstanceReadyResponse`].
846    pub type InstanceReadyResponse = ();
847}
848
849pub use self::natural::*;
850
851/// The type corresponding to the Instance protocol.
852#[doc = " Manages a single instance of a canvas. Each session of this protocol is responsible for a new\n canvas.\n"]
853#[derive(PartialEq, Debug)]
854pub struct Instance;
855
856impl ::fidl_next::Discoverable for Instance {
857    const PROTOCOL_NAME: &'static str = "examples.canvas.clientrequesteddraw.Instance";
858}
859
860#[cfg(target_os = "fuchsia")]
861impl ::fidl_next::HasTransport for Instance {
862    type Transport = ::fidl_next::fuchsia::zx::Channel;
863}
864
865pub mod instance {
866    pub mod prelude {
867        pub use crate::{
868            Instance, InstanceClientHandler, InstanceLocalClientHandler,
869            InstanceLocalServerHandler, InstanceServerHandler, instance,
870        };
871
872        pub use crate::natural::BoundingBox;
873
874        pub use crate::natural::InstanceAddLinesRequest;
875
876        pub use crate::natural::InstanceReadyResponse;
877    }
878
879    pub struct AddLines;
880
881    impl ::fidl_next::Method for AddLines {
882        const ORDINAL: u64 = 6522039862237268950;
883        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
884            ::fidl_next::protocol::Flexibility::Flexible;
885
886        type Protocol = crate::Instance;
887
888        type Request = crate::wire::InstanceAddLinesRequest<'static>;
889    }
890
891    pub struct Ready;
892
893    impl ::fidl_next::Method for Ready {
894        const ORDINAL: u64 = 3772001797641023824;
895        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
896            ::fidl_next::protocol::Flexibility::Flexible;
897
898        type Protocol = crate::Instance;
899
900        type Request = ::fidl_next::wire::EmptyMessageBody;
901    }
902
903    impl ::fidl_next::TwoWayMethod for Ready {
904        type Response = ::fidl_next::wire::Flexible<'static, crate::wire::InstanceReadyResponse>;
905    }
906
907    impl<___R> ::fidl_next::Respond<___R> for Ready {
908        type Output = ::fidl_next::Flexible<___R>;
909
910        fn respond(response: ___R) -> Self::Output {
911            ::fidl_next::Flexible::Ok(response)
912        }
913    }
914
915    pub struct OnDrawn;
916
917    impl ::fidl_next::Method for OnDrawn {
918        const ORDINAL: u64 = 2731108033267712410;
919        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
920            ::fidl_next::protocol::Flexibility::Flexible;
921
922        type Protocol = crate::Instance;
923
924        type Request = crate::wire::BoundingBox;
925    }
926
927    mod ___detail {
928        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Instance
929        where
930            ___T: ::fidl_next::Transport,
931        {
932            type Client = InstanceClient<___T>;
933            type Server = InstanceServer<___T>;
934        }
935
936        /// The client for the `Instance` protocol.
937        #[repr(transparent)]
938        pub struct InstanceClient<___T: ::fidl_next::Transport> {
939            #[allow(dead_code)]
940            client: ::fidl_next::protocol::Client<___T>,
941        }
942
943        impl<___T> InstanceClient<___T>
944        where
945            ___T: ::fidl_next::Transport,
946        {
947            #[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"]
948            pub fn add_lines(
949                &self,
950
951                lines: impl ::fidl_next::Encode<
952                    ::fidl_next::wire::Vector<'static, [crate::wire::Point; 2]>,
953                    <___T as ::fidl_next::Transport>::SendBuffer,
954                >,
955            ) -> ::fidl_next::SendFuture<'_, ___T>
956            where
957                <___T as ::fidl_next::Transport>::SendBuffer:
958                    ::fidl_next::encoder::InternalHandleEncoder,
959                <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
960            {
961                self.add_lines_with(crate::generic::InstanceAddLinesRequest { lines })
962            }
963
964            #[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"]
965            pub fn add_lines_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
966            where
967                ___R: ::fidl_next::Encode<
968                        crate::wire::InstanceAddLinesRequest<'static>,
969                        <___T as ::fidl_next::Transport>::SendBuffer,
970                    >,
971            {
972                ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
973                    6522039862237268950,
974                    <super::AddLines as ::fidl_next::Method>::FLEXIBILITY,
975                    request,
976                ))
977            }
978
979            #[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"]
980            pub fn ready(&self) -> ::fidl_next::TwoWayFuture<'_, super::Ready, ___T> {
981                ::fidl_next::TwoWayFuture::from_untyped(
982                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
983                        3772001797641023824,
984                        <super::Ready as ::fidl_next::Method>::FLEXIBILITY,
985                        (),
986                    ),
987                )
988            }
989        }
990
991        /// The server for the `Instance` protocol.
992        #[repr(transparent)]
993        pub struct InstanceServer<___T: ::fidl_next::Transport> {
994            server: ::fidl_next::protocol::Server<___T>,
995        }
996
997        impl<___T> InstanceServer<___T>
998        where
999            ___T: ::fidl_next::Transport,
1000        {
1001            #[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"]
1002            pub fn on_drawn(
1003                &self,
1004
1005                top_left: impl ::fidl_next::Encode<
1006                    crate::wire::Point,
1007                    <___T as ::fidl_next::Transport>::SendBuffer,
1008                >,
1009
1010                bottom_right: impl ::fidl_next::Encode<
1011                    crate::wire::Point,
1012                    <___T as ::fidl_next::Transport>::SendBuffer,
1013                >,
1014            ) -> ::fidl_next::SendFuture<'_, ___T>
1015            where
1016                <___T as ::fidl_next::Transport>::SendBuffer:
1017                    ::fidl_next::encoder::InternalHandleEncoder,
1018            {
1019                self.on_drawn_with(crate::generic::BoundingBox { top_left, bottom_right })
1020            }
1021
1022            #[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"]
1023
1024            pub fn on_drawn_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
1025            where
1026                ___R: ::fidl_next::Encode<
1027                        <super::OnDrawn as ::fidl_next::Method>::Request,
1028                        <___T as ::fidl_next::Transport>::SendBuffer,
1029                    >,
1030            {
1031                ::fidl_next::SendFuture::from_untyped(self.server.send_event(
1032                    2731108033267712410,
1033                    <super::OnDrawn as ::fidl_next::Method>::FLEXIBILITY,
1034                    request,
1035                ))
1036            }
1037        }
1038    }
1039}
1040
1041#[diagnostic::on_unimplemented(
1042    note = "If {Self} implements the non-local InstanceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1043)]
1044
1045/// A client handler for the Instance protocol.
1046///
1047/// See [`Instance`] for more details.
1048pub trait InstanceLocalClientHandler<
1049    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1050    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1051>
1052{
1053    #[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"]
1054    fn on_drawn(
1055        &mut self,
1056
1057        request: ::fidl_next::Request<instance::OnDrawn, ___T>,
1058    ) -> impl ::core::future::Future<Output = ()>;
1059
1060    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1061        ::core::future::ready(())
1062    }
1063}
1064
1065impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Instance
1066where
1067    ___H: InstanceLocalClientHandler<___T>,
1068    ___T: ::fidl_next::Transport,
1069    for<'de> crate::wire::BoundingBox: ::fidl_next::Decode<
1070            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1071            Constraint = (),
1072        >,
1073{
1074    async fn on_event(
1075        handler: &mut ___H,
1076        ordinal: u64,
1077        flexibility: ::fidl_next::protocol::Flexibility,
1078        body: ::fidl_next::Body<___T>,
1079    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1080        match ordinal {
1081            2731108033267712410 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
1082                Ok(decoded) => {
1083                    handler.on_drawn(::fidl_next::Request::from_decoded(decoded)).await;
1084                    Ok(())
1085                }
1086                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1087                    ordinal: 2731108033267712410,
1088                    error,
1089                }),
1090            },
1091
1092            ordinal => {
1093                handler.on_unknown_interaction(ordinal).await;
1094                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1095                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1096                } else {
1097                    Ok(())
1098                }
1099            }
1100        }
1101    }
1102}
1103
1104#[diagnostic::on_unimplemented(
1105    note = "If {Self} implements the non-local InstanceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1106)]
1107
1108/// A server handler for the Instance protocol.
1109///
1110/// See [`Instance`] for more details.
1111pub trait InstanceLocalServerHandler<
1112    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1113    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1114>
1115{
1116    #[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"]
1117    fn add_lines(
1118        &mut self,
1119
1120        request: ::fidl_next::Request<instance::AddLines, ___T>,
1121    ) -> impl ::core::future::Future<Output = ()>;
1122
1123    #[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"]
1124    fn ready(
1125        &mut self,
1126
1127        responder: ::fidl_next::Responder<instance::Ready, ___T>,
1128    ) -> impl ::core::future::Future<Output = ()>;
1129
1130    fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1131        ::core::future::ready(())
1132    }
1133}
1134
1135impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Instance
1136where
1137    ___H: InstanceLocalServerHandler<___T>,
1138    ___T: ::fidl_next::Transport,
1139    for<'de> crate::wire::InstanceAddLinesRequest<'de>: ::fidl_next::Decode<
1140            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1141            Constraint = (),
1142        >,
1143{
1144    async fn on_one_way(
1145        handler: &mut ___H,
1146        ordinal: u64,
1147        flexibility: ::fidl_next::protocol::Flexibility,
1148        body: ::fidl_next::Body<___T>,
1149    ) -> ::core::result::Result<
1150        (),
1151        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1152    > {
1153        match ordinal {
1154            6522039862237268950 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
1155                Ok(decoded) => {
1156                    handler.add_lines(::fidl_next::Request::from_decoded(decoded)).await;
1157                    Ok(())
1158                }
1159                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1160                    ordinal: 6522039862237268950,
1161                    error,
1162                }),
1163            },
1164
1165            ordinal => {
1166                handler.on_unknown_interaction(ordinal).await;
1167                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1168                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1169                } else {
1170                    Ok(())
1171                }
1172            }
1173        }
1174    }
1175
1176    async fn on_two_way(
1177        handler: &mut ___H,
1178        ordinal: u64,
1179        flexibility: ::fidl_next::protocol::Flexibility,
1180        body: ::fidl_next::Body<___T>,
1181        responder: ::fidl_next::protocol::Responder<___T>,
1182    ) -> ::core::result::Result<
1183        (),
1184        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1185    > {
1186        match ordinal {
1187            3772001797641023824 => {
1188                let responder = ::fidl_next::Responder::from_untyped(responder);
1189
1190                handler.ready(responder).await;
1191                Ok(())
1192            }
1193
1194            ordinal => {
1195                handler.on_unknown_interaction(ordinal).await;
1196                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1197                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1198                } else {
1199                    responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
1200                                ordinal,
1201                                flexibility,
1202                                ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
1203                            )
1204                            .expect("encoding a framework error should never fail")
1205                            .await?;
1206                    Ok(())
1207                }
1208            }
1209        }
1210    }
1211}
1212
1213/// A client handler for the Instance protocol.
1214///
1215/// See [`Instance`] for more details.
1216pub trait InstanceClientHandler<
1217    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1218    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1219>
1220{
1221    #[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"]
1222    fn on_drawn(
1223        &mut self,
1224
1225        request: ::fidl_next::Request<instance::OnDrawn, ___T>,
1226    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1227
1228    fn on_unknown_interaction(
1229        &mut self,
1230        ordinal: u64,
1231    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1232        ::core::future::ready(())
1233    }
1234}
1235
1236impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Instance
1237where
1238    ___H: InstanceClientHandler<___T> + ::core::marker::Send,
1239    ___T: ::fidl_next::Transport,
1240    for<'de> crate::wire::BoundingBox: ::fidl_next::Decode<
1241            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1242            Constraint = (),
1243        >,
1244{
1245    async fn on_event(
1246        handler: &mut ___H,
1247        ordinal: u64,
1248        flexibility: ::fidl_next::protocol::Flexibility,
1249        body: ::fidl_next::Body<___T>,
1250    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1251        match ordinal {
1252            2731108033267712410 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
1253                Ok(decoded) => {
1254                    handler.on_drawn(::fidl_next::Request::from_decoded(decoded)).await;
1255                    Ok(())
1256                }
1257                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1258                    ordinal: 2731108033267712410,
1259                    error,
1260                }),
1261            },
1262
1263            ordinal => {
1264                handler.on_unknown_interaction(ordinal).await;
1265                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1266                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1267                } else {
1268                    Ok(())
1269                }
1270            }
1271        }
1272    }
1273}
1274
1275/// A server handler for the Instance protocol.
1276///
1277/// See [`Instance`] for more details.
1278pub trait InstanceServerHandler<
1279    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1280    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1281>
1282{
1283    #[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"]
1284    fn add_lines(
1285        &mut self,
1286
1287        request: ::fidl_next::Request<instance::AddLines, ___T>,
1288    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1289
1290    #[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"]
1291    fn ready(
1292        &mut self,
1293
1294        responder: ::fidl_next::Responder<instance::Ready, ___T>,
1295    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1296
1297    fn on_unknown_interaction(
1298        &mut self,
1299        ordinal: u64,
1300    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1301        ::core::future::ready(())
1302    }
1303}
1304
1305impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Instance
1306where
1307    ___H: InstanceServerHandler<___T> + ::core::marker::Send,
1308    ___T: ::fidl_next::Transport,
1309    for<'de> crate::wire::InstanceAddLinesRequest<'de>: ::fidl_next::Decode<
1310            <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1311            Constraint = (),
1312        >,
1313{
1314    async fn on_one_way(
1315        handler: &mut ___H,
1316        ordinal: u64,
1317        flexibility: ::fidl_next::protocol::Flexibility,
1318        body: ::fidl_next::Body<___T>,
1319    ) -> ::core::result::Result<
1320        (),
1321        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1322    > {
1323        match ordinal {
1324            6522039862237268950 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
1325                Ok(decoded) => {
1326                    handler.add_lines(::fidl_next::Request::from_decoded(decoded)).await;
1327                    Ok(())
1328                }
1329                Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1330                    ordinal: 6522039862237268950,
1331                    error,
1332                }),
1333            },
1334
1335            ordinal => {
1336                handler.on_unknown_interaction(ordinal).await;
1337                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1338                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1339                } else {
1340                    Ok(())
1341                }
1342            }
1343        }
1344    }
1345
1346    async fn on_two_way(
1347        handler: &mut ___H,
1348        ordinal: u64,
1349        flexibility: ::fidl_next::protocol::Flexibility,
1350        body: ::fidl_next::Body<___T>,
1351        responder: ::fidl_next::protocol::Responder<___T>,
1352    ) -> ::core::result::Result<
1353        (),
1354        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1355    > {
1356        match ordinal {
1357            3772001797641023824 => {
1358                let responder = ::fidl_next::Responder::from_untyped(responder);
1359
1360                handler.ready(responder).await;
1361                Ok(())
1362            }
1363
1364            ordinal => {
1365                handler.on_unknown_interaction(ordinal).await;
1366                if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1367                    Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1368                } else {
1369                    responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
1370                                ordinal,
1371                                flexibility,
1372                                ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
1373                            )
1374                            .expect("encoding a framework error should never fail")
1375                            .await?;
1376                    Ok(())
1377                }
1378            }
1379        }
1380    }
1381}
1382
1383impl<___T> InstanceClientHandler<___T> for ::fidl_next::IgnoreEvents
1384where
1385    ___T: ::fidl_next::Transport,
1386{
1387    async fn on_drawn(&mut self, _: ::fidl_next::Request<instance::OnDrawn, ___T>) {}
1388
1389    async fn on_unknown_interaction(&mut self, _: u64) {}
1390}
1391
1392impl<___H, ___T> InstanceLocalClientHandler<___T> for ::fidl_next::Local<___H>
1393where
1394    ___H: InstanceClientHandler<___T>,
1395    ___T: ::fidl_next::Transport,
1396{
1397    async fn on_drawn(&mut self, request: ::fidl_next::Request<instance::OnDrawn, ___T>) {
1398        ___H::on_drawn(&mut self.0, request).await
1399    }
1400
1401    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1402        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1403    }
1404}
1405
1406impl<___H, ___T> InstanceLocalServerHandler<___T> for ::fidl_next::Local<___H>
1407where
1408    ___H: InstanceServerHandler<___T>,
1409    ___T: ::fidl_next::Transport,
1410{
1411    async fn add_lines(&mut self, request: ::fidl_next::Request<instance::AddLines, ___T>) {
1412        ___H::add_lines(&mut self.0, request).await
1413    }
1414
1415    async fn ready(&mut self, responder: ::fidl_next::Responder<instance::Ready, ___T>) {
1416        ___H::ready(&mut self.0, responder).await
1417    }
1418
1419    async fn on_unknown_interaction(&mut self, ordinal: u64) {
1420        ___H::on_unknown_interaction(&mut self.0, ordinal).await
1421    }
1422}