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