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 mut message: ::fidl_next::Message<___T>,
1042 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1043 match *message.header().ordinal {
1044 3380696926713300365 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1045 Ok(decoded) => {
1046 handler.on_drawn(::fidl_next::Request::from_decoded(decoded)).await;
1047 Ok(())
1048 }
1049 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1050 ordinal: 3380696926713300365,
1051 error,
1052 }),
1053 },
1054
1055 ordinal => {
1056 handler.on_unknown_interaction(ordinal).await;
1057 if ::core::matches!(
1058 message.header().flexibility(),
1059 ::fidl_next::protocol::Flexibility::Strict
1060 ) {
1061 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1062 } else {
1063 Ok(())
1064 }
1065 }
1066 }
1067 }
1068}
1069
1070#[diagnostic::on_unimplemented(
1071 note = "If {Self} implements the non-local InstanceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1072)]
1073
1074pub trait InstanceLocalServerHandler<
1078 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1079 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1080>
1081{
1082 #[doc = " Add a line to the canvas.\n"]
1083 fn add_line(
1084 &mut self,
1085
1086 request: ::fidl_next::Request<instance::AddLine, ___T>,
1087 ) -> impl ::core::future::Future<Output = ()>;
1088
1089 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1090 ::core::future::ready(())
1091 }
1092}
1093
1094impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Instance
1095where
1096 ___H: InstanceLocalServerHandler<___T>,
1097 ___T: ::fidl_next::Transport,
1098 for<'de> crate::wire::InstanceAddLineRequest: ::fidl_next::Decode<
1099 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1100 Constraint = (),
1101 >,
1102{
1103 async fn on_one_way(
1104 handler: &mut ___H,
1105 mut message: ::fidl_next::Message<___T>,
1106 ) -> ::core::result::Result<
1107 (),
1108 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1109 > {
1110 match *message.header().ordinal {
1111 285336022744255136 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1112 Ok(decoded) => {
1113 handler.add_line(::fidl_next::Request::from_decoded(decoded)).await;
1114 Ok(())
1115 }
1116 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1117 ordinal: 285336022744255136,
1118 error,
1119 }),
1120 },
1121
1122 ordinal => {
1123 handler.on_unknown_interaction(ordinal).await;
1124 if ::core::matches!(
1125 message.header().flexibility(),
1126 ::fidl_next::protocol::Flexibility::Strict
1127 ) {
1128 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1129 } else {
1130 Ok(())
1131 }
1132 }
1133 }
1134 }
1135
1136 async fn on_two_way(
1137 handler: &mut ___H,
1138 mut message: ::fidl_next::Message<___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 *message.header().ordinal {
1145 ordinal => {
1146 handler.on_unknown_interaction(ordinal).await;
1147 if ::core::matches!(
1148 message.header().flexibility(),
1149 ::fidl_next::protocol::Flexibility::Strict
1150 ) {
1151 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1152 } else {
1153 responder
1154 .respond_framework_error(
1155 ordinal,
1156 ::fidl_next::FrameworkError::UnknownMethod,
1157 )
1158 .expect("encoding a framework error should never fail")
1159 .await?;
1160 Ok(())
1161 }
1162 }
1163 }
1164 }
1165}
1166
1167pub trait InstanceClientHandler<
1171 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1172 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1173>
1174{
1175 #[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"]
1176 fn on_drawn(
1177 &mut self,
1178
1179 request: ::fidl_next::Request<instance::OnDrawn, ___T>,
1180 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1181
1182 fn on_unknown_interaction(
1183 &mut self,
1184 ordinal: u64,
1185 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1186 ::core::future::ready(())
1187 }
1188}
1189
1190impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Instance
1191where
1192 ___H: InstanceClientHandler<___T> + ::core::marker::Send,
1193 ___T: ::fidl_next::Transport,
1194 for<'de> crate::wire::BoundingBox: ::fidl_next::Decode<
1195 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1196 Constraint = (),
1197 >,
1198{
1199 async fn on_event(
1200 handler: &mut ___H,
1201 mut message: ::fidl_next::Message<___T>,
1202 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1203 match *message.header().ordinal {
1204 3380696926713300365 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1205 Ok(decoded) => {
1206 handler.on_drawn(::fidl_next::Request::from_decoded(decoded)).await;
1207 Ok(())
1208 }
1209 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1210 ordinal: 3380696926713300365,
1211 error,
1212 }),
1213 },
1214
1215 ordinal => {
1216 handler.on_unknown_interaction(ordinal).await;
1217 if ::core::matches!(
1218 message.header().flexibility(),
1219 ::fidl_next::protocol::Flexibility::Strict
1220 ) {
1221 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1222 } else {
1223 Ok(())
1224 }
1225 }
1226 }
1227 }
1228}
1229
1230pub trait InstanceServerHandler<
1234 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1235 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1236>
1237{
1238 #[doc = " Add a line to the canvas.\n"]
1239 fn add_line(
1240 &mut self,
1241
1242 request: ::fidl_next::Request<instance::AddLine, ___T>,
1243 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1244
1245 fn on_unknown_interaction(
1246 &mut self,
1247 ordinal: u64,
1248 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1249 ::core::future::ready(())
1250 }
1251}
1252
1253impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Instance
1254where
1255 ___H: InstanceServerHandler<___T> + ::core::marker::Send,
1256 ___T: ::fidl_next::Transport,
1257 for<'de> crate::wire::InstanceAddLineRequest: ::fidl_next::Decode<
1258 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1259 Constraint = (),
1260 >,
1261{
1262 async fn on_one_way(
1263 handler: &mut ___H,
1264 mut message: ::fidl_next::Message<___T>,
1265 ) -> ::core::result::Result<
1266 (),
1267 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1268 > {
1269 match *message.header().ordinal {
1270 285336022744255136 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1271 Ok(decoded) => {
1272 handler.add_line(::fidl_next::Request::from_decoded(decoded)).await;
1273 Ok(())
1274 }
1275 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1276 ordinal: 285336022744255136,
1277 error,
1278 }),
1279 },
1280
1281 ordinal => {
1282 handler.on_unknown_interaction(ordinal).await;
1283 if ::core::matches!(
1284 message.header().flexibility(),
1285 ::fidl_next::protocol::Flexibility::Strict
1286 ) {
1287 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1288 } else {
1289 Ok(())
1290 }
1291 }
1292 }
1293 }
1294
1295 async fn on_two_way(
1296 handler: &mut ___H,
1297 mut message: ::fidl_next::Message<___T>,
1298 responder: ::fidl_next::protocol::Responder<___T>,
1299 ) -> ::core::result::Result<
1300 (),
1301 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1302 > {
1303 match *message.header().ordinal {
1304 ordinal => {
1305 handler.on_unknown_interaction(ordinal).await;
1306 if ::core::matches!(
1307 message.header().flexibility(),
1308 ::fidl_next::protocol::Flexibility::Strict
1309 ) {
1310 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1311 } else {
1312 responder
1313 .respond_framework_error(
1314 ordinal,
1315 ::fidl_next::FrameworkError::UnknownMethod,
1316 )
1317 .expect("encoding a framework error should never fail")
1318 .await?;
1319 Ok(())
1320 }
1321 }
1322 }
1323 }
1324}
1325
1326impl<___T> InstanceClientHandler<___T> for ::fidl_next::IgnoreEvents
1327where
1328 ___T: ::fidl_next::Transport,
1329{
1330 async fn on_drawn(&mut self, _: ::fidl_next::Request<instance::OnDrawn, ___T>) {}
1331
1332 async fn on_unknown_interaction(&mut self, _: u64) {}
1333}
1334
1335impl<___H, ___T> InstanceLocalClientHandler<___T> for ::fidl_next::Local<___H>
1336where
1337 ___H: InstanceClientHandler<___T>,
1338 ___T: ::fidl_next::Transport,
1339{
1340 async fn on_drawn(&mut self, request: ::fidl_next::Request<instance::OnDrawn, ___T>) {
1341 ___H::on_drawn(&mut self.0, request).await
1342 }
1343
1344 async fn on_unknown_interaction(&mut self, ordinal: u64) {
1345 ___H::on_unknown_interaction(&mut self.0, ordinal).await
1346 }
1347}
1348
1349impl<___H, ___T> InstanceLocalServerHandler<___T> for ::fidl_next::Local<___H>
1350where
1351 ___H: InstanceServerHandler<___T>,
1352 ___T: ::fidl_next::Transport,
1353{
1354 async fn add_line(&mut self, request: ::fidl_next::Request<instance::AddLine, ___T>) {
1355 ___H::add_line(&mut self.0, request).await
1356 }
1357
1358 async fn on_unknown_interaction(&mut self, ordinal: u64) {
1359 ___H::on_unknown_interaction(&mut self.0, ordinal).await
1360 }
1361}