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