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