1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13pub enum TripPointType {
14 OneshotTempAbove,
18 OneshotTempBelow,
19 #[doc(hidden)]
20 __SourceBreaking {
21 unknown_ordinal: u16,
22 },
23}
24
25#[macro_export]
27macro_rules! TripPointTypeUnknown {
28 () => {
29 _
30 };
31}
32
33impl TripPointType {
34 #[inline]
35 pub fn from_primitive(prim: u16) -> Option<Self> {
36 match prim {
37 1 => Some(Self::OneshotTempAbove),
38 2 => Some(Self::OneshotTempBelow),
39 _ => None,
40 }
41 }
42
43 #[inline]
44 pub fn from_primitive_allow_unknown(prim: u16) -> Self {
45 match prim {
46 1 => Self::OneshotTempAbove,
47 2 => Self::OneshotTempBelow,
48 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
49 }
50 }
51
52 #[inline]
53 pub fn unknown() -> Self {
54 Self::__SourceBreaking { unknown_ordinal: 0xffff }
55 }
56
57 #[inline]
58 pub const fn into_primitive(self) -> u16 {
59 match self {
60 Self::OneshotTempAbove => 1,
61 Self::OneshotTempBelow => 2,
62 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
63 }
64 }
65
66 #[inline]
67 pub fn is_unknown(&self) -> bool {
68 match self {
69 Self::__SourceBreaking { unknown_ordinal: _ } => true,
70 _ => false,
71 }
72 }
73}
74
75#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
76pub struct ClearedTripPoint;
77
78impl fidl::Persistable for ClearedTripPoint {}
79
80#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
81#[repr(C)]
82pub struct DebugTripRequest {
83 pub index: u32,
84}
85
86impl fidl::Persistable for DebugTripRequest {}
87
88#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
90pub struct OneshotTempAboveTripPoint {
91 pub critical_temperature_celsius: f32,
93}
94
95impl fidl::Persistable for OneshotTempAboveTripPoint {}
96
97#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
98pub struct OneshotTempBelowTripPoint {
99 pub critical_temperature_celsius: f32,
101}
102
103impl fidl::Persistable for OneshotTempBelowTripPoint {}
104
105#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
106pub struct TripDeviceMetadata {
107 pub critical_temp_celsius: f32,
109}
110
111impl fidl::Persistable for TripDeviceMetadata {}
112impl fidl::Serializable for TripDeviceMetadata {
113 const SERIALIZABLE_NAME: &'static str = "fuchsia.hardware.trippoint.TripDeviceMetadata";
114}
115
116#[derive(Clone, Debug, PartialEq)]
117pub struct TripPointDescriptor {
118 pub type_: TripPointType,
120 pub index: u32,
124 pub configuration: TripPointValue,
128}
129
130impl fidl::Persistable for TripPointDescriptor {}
131
132#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
133pub struct TripPointResult {
134 pub measured_temperature_celsius: f32,
137 pub index: u32,
139}
140
141impl fidl::Persistable for TripPointResult {}
142
143#[derive(Clone, Debug, PartialEq)]
144pub struct TripPointSetTripPointsRequest {
145 pub descriptors: Vec<TripPointDescriptor>,
157}
158
159impl fidl::Persistable for TripPointSetTripPointsRequest {}
160
161#[derive(Clone, Debug, PartialEq)]
162pub struct TripPointGetTripPointDescriptorsResponse {
163 pub descriptors: Vec<TripPointDescriptor>,
164}
165
166impl fidl::Persistable for TripPointGetTripPointDescriptorsResponse {}
167
168#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
169pub struct TripPointWaitForAnyTripPointResponse {
170 pub result: TripPointResult,
171}
172
173impl fidl::Persistable for TripPointWaitForAnyTripPointResponse {}
174
175#[derive(Clone, Debug)]
177pub enum TripPointValue {
178 ClearedTripPoint(ClearedTripPoint),
181 OneshotTempAboveTripPoint(OneshotTempAboveTripPoint),
182 OneshotTempBelowTripPoint(OneshotTempBelowTripPoint),
183 #[doc(hidden)]
184 __SourceBreaking {
185 unknown_ordinal: u64,
186 },
187}
188
189#[macro_export]
191macro_rules! TripPointValueUnknown {
192 () => {
193 _
194 };
195}
196
197impl PartialEq for TripPointValue {
199 fn eq(&self, other: &Self) -> bool {
200 match (self, other) {
201 (Self::ClearedTripPoint(x), Self::ClearedTripPoint(y)) => *x == *y,
202 (Self::OneshotTempAboveTripPoint(x), Self::OneshotTempAboveTripPoint(y)) => *x == *y,
203 (Self::OneshotTempBelowTripPoint(x), Self::OneshotTempBelowTripPoint(y)) => *x == *y,
204 _ => false,
205 }
206 }
207}
208
209impl TripPointValue {
210 #[inline]
211 pub fn ordinal(&self) -> u64 {
212 match *self {
213 Self::ClearedTripPoint(_) => 1,
214 Self::OneshotTempAboveTripPoint(_) => 2,
215 Self::OneshotTempBelowTripPoint(_) => 3,
216 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
217 }
218 }
219
220 #[inline]
221 pub fn unknown_variant_for_testing() -> Self {
222 Self::__SourceBreaking { unknown_ordinal: 0 }
223 }
224
225 #[inline]
226 pub fn is_unknown(&self) -> bool {
227 match self {
228 Self::__SourceBreaking { .. } => true,
229 _ => false,
230 }
231 }
232}
233
234impl fidl::Persistable for TripPointValue {}
235
236pub mod debug_ordinals {
237 pub const TRIP: u64 = 0x2785e550debdf5a;
238}
239
240pub mod trip_point_ordinals {
241 pub const GET_TRIP_POINT_DESCRIPTORS: u64 = 0xbbc73e208bf4875;
242 pub const SET_TRIP_POINTS: u64 = 0x8e768ac1e677593;
243 pub const WAIT_FOR_ANY_TRIP_POINT: u64 = 0x66b959b54d27ce45;
244}
245
246mod internal {
247 use super::*;
248 unsafe impl fidl::encoding::TypeMarker for TripPointType {
249 type Owned = Self;
250
251 #[inline(always)]
252 fn inline_align(_context: fidl::encoding::Context) -> usize {
253 std::mem::align_of::<u16>()
254 }
255
256 #[inline(always)]
257 fn inline_size(_context: fidl::encoding::Context) -> usize {
258 std::mem::size_of::<u16>()
259 }
260
261 #[inline(always)]
262 fn encode_is_copy() -> bool {
263 false
264 }
265
266 #[inline(always)]
267 fn decode_is_copy() -> bool {
268 false
269 }
270 }
271
272 impl fidl::encoding::ValueTypeMarker for TripPointType {
273 type Borrowed<'a> = Self;
274 #[inline(always)]
275 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
276 *value
277 }
278 }
279
280 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TripPointType {
281 #[inline]
282 unsafe fn encode(
283 self,
284 encoder: &mut fidl::encoding::Encoder<'_, D>,
285 offset: usize,
286 _depth: fidl::encoding::Depth,
287 ) -> fidl::Result<()> {
288 encoder.debug_check_bounds::<Self>(offset);
289 encoder.write_num(self.into_primitive(), offset);
290 Ok(())
291 }
292 }
293
294 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TripPointType {
295 #[inline(always)]
296 fn new_empty() -> Self {
297 Self::unknown()
298 }
299
300 #[inline]
301 unsafe fn decode(
302 &mut self,
303 decoder: &mut fidl::encoding::Decoder<'_, D>,
304 offset: usize,
305 _depth: fidl::encoding::Depth,
306 ) -> fidl::Result<()> {
307 decoder.debug_check_bounds::<Self>(offset);
308 let prim = decoder.read_num::<u16>(offset);
309
310 *self = Self::from_primitive_allow_unknown(prim);
311 Ok(())
312 }
313 }
314
315 impl fidl::encoding::ValueTypeMarker for ClearedTripPoint {
316 type Borrowed<'a> = &'a Self;
317 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
318 value
319 }
320 }
321
322 unsafe impl fidl::encoding::TypeMarker for ClearedTripPoint {
323 type Owned = Self;
324
325 #[inline(always)]
326 fn inline_align(_context: fidl::encoding::Context) -> usize {
327 1
328 }
329
330 #[inline(always)]
331 fn inline_size(_context: fidl::encoding::Context) -> usize {
332 1
333 }
334 }
335
336 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClearedTripPoint, D>
337 for &ClearedTripPoint
338 {
339 #[inline]
340 unsafe fn encode(
341 self,
342 encoder: &mut fidl::encoding::Encoder<'_, D>,
343 offset: usize,
344 _depth: fidl::encoding::Depth,
345 ) -> fidl::Result<()> {
346 encoder.debug_check_bounds::<ClearedTripPoint>(offset);
347 encoder.write_num(0u8, offset);
348 Ok(())
349 }
350 }
351
352 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClearedTripPoint {
353 #[inline(always)]
354 fn new_empty() -> Self {
355 Self
356 }
357
358 #[inline]
359 unsafe fn decode(
360 &mut self,
361 decoder: &mut fidl::encoding::Decoder<'_, D>,
362 offset: usize,
363 _depth: fidl::encoding::Depth,
364 ) -> fidl::Result<()> {
365 decoder.debug_check_bounds::<Self>(offset);
366 match decoder.read_num::<u8>(offset) {
367 0 => Ok(()),
368 _ => Err(fidl::Error::Invalid),
369 }
370 }
371 }
372
373 impl fidl::encoding::ValueTypeMarker for DebugTripRequest {
374 type Borrowed<'a> = &'a Self;
375 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
376 value
377 }
378 }
379
380 unsafe impl fidl::encoding::TypeMarker for DebugTripRequest {
381 type Owned = Self;
382
383 #[inline(always)]
384 fn inline_align(_context: fidl::encoding::Context) -> usize {
385 4
386 }
387
388 #[inline(always)]
389 fn inline_size(_context: fidl::encoding::Context) -> usize {
390 4
391 }
392 #[inline(always)]
393 fn encode_is_copy() -> bool {
394 true
395 }
396
397 #[inline(always)]
398 fn decode_is_copy() -> bool {
399 true
400 }
401 }
402
403 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DebugTripRequest, D>
404 for &DebugTripRequest
405 {
406 #[inline]
407 unsafe fn encode(
408 self,
409 encoder: &mut fidl::encoding::Encoder<'_, D>,
410 offset: usize,
411 _depth: fidl::encoding::Depth,
412 ) -> fidl::Result<()> {
413 encoder.debug_check_bounds::<DebugTripRequest>(offset);
414 unsafe {
415 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
417 (buf_ptr as *mut DebugTripRequest)
418 .write_unaligned((self as *const DebugTripRequest).read());
419 }
422 Ok(())
423 }
424 }
425 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
426 fidl::encoding::Encode<DebugTripRequest, D> for (T0,)
427 {
428 #[inline]
429 unsafe fn encode(
430 self,
431 encoder: &mut fidl::encoding::Encoder<'_, D>,
432 offset: usize,
433 depth: fidl::encoding::Depth,
434 ) -> fidl::Result<()> {
435 encoder.debug_check_bounds::<DebugTripRequest>(offset);
436 self.0.encode(encoder, offset + 0, depth)?;
440 Ok(())
441 }
442 }
443
444 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DebugTripRequest {
445 #[inline(always)]
446 fn new_empty() -> Self {
447 Self { index: fidl::new_empty!(u32, D) }
448 }
449
450 #[inline]
451 unsafe fn decode(
452 &mut self,
453 decoder: &mut fidl::encoding::Decoder<'_, D>,
454 offset: usize,
455 _depth: fidl::encoding::Depth,
456 ) -> fidl::Result<()> {
457 decoder.debug_check_bounds::<Self>(offset);
458 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
459 unsafe {
462 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
463 }
464 Ok(())
465 }
466 }
467
468 impl fidl::encoding::ValueTypeMarker for OneshotTempAboveTripPoint {
469 type Borrowed<'a> = &'a Self;
470 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
471 value
472 }
473 }
474
475 unsafe impl fidl::encoding::TypeMarker for OneshotTempAboveTripPoint {
476 type Owned = Self;
477
478 #[inline(always)]
479 fn inline_align(_context: fidl::encoding::Context) -> usize {
480 4
481 }
482
483 #[inline(always)]
484 fn inline_size(_context: fidl::encoding::Context) -> usize {
485 4
486 }
487 }
488
489 unsafe impl<D: fidl::encoding::ResourceDialect>
490 fidl::encoding::Encode<OneshotTempAboveTripPoint, D> for &OneshotTempAboveTripPoint
491 {
492 #[inline]
493 unsafe fn encode(
494 self,
495 encoder: &mut fidl::encoding::Encoder<'_, D>,
496 offset: usize,
497 _depth: fidl::encoding::Depth,
498 ) -> fidl::Result<()> {
499 encoder.debug_check_bounds::<OneshotTempAboveTripPoint>(offset);
500 fidl::encoding::Encode::<OneshotTempAboveTripPoint, D>::encode(
502 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(
503 &self.critical_temperature_celsius,
504 ),),
505 encoder,
506 offset,
507 _depth,
508 )
509 }
510 }
511 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
512 fidl::encoding::Encode<OneshotTempAboveTripPoint, D> for (T0,)
513 {
514 #[inline]
515 unsafe fn encode(
516 self,
517 encoder: &mut fidl::encoding::Encoder<'_, D>,
518 offset: usize,
519 depth: fidl::encoding::Depth,
520 ) -> fidl::Result<()> {
521 encoder.debug_check_bounds::<OneshotTempAboveTripPoint>(offset);
522 self.0.encode(encoder, offset + 0, depth)?;
526 Ok(())
527 }
528 }
529
530 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
531 for OneshotTempAboveTripPoint
532 {
533 #[inline(always)]
534 fn new_empty() -> Self {
535 Self { critical_temperature_celsius: fidl::new_empty!(f32, D) }
536 }
537
538 #[inline]
539 unsafe fn decode(
540 &mut self,
541 decoder: &mut fidl::encoding::Decoder<'_, D>,
542 offset: usize,
543 _depth: fidl::encoding::Depth,
544 ) -> fidl::Result<()> {
545 decoder.debug_check_bounds::<Self>(offset);
546 fidl::decode!(
548 f32,
549 D,
550 &mut self.critical_temperature_celsius,
551 decoder,
552 offset + 0,
553 _depth
554 )?;
555 Ok(())
556 }
557 }
558
559 impl fidl::encoding::ValueTypeMarker for OneshotTempBelowTripPoint {
560 type Borrowed<'a> = &'a Self;
561 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
562 value
563 }
564 }
565
566 unsafe impl fidl::encoding::TypeMarker for OneshotTempBelowTripPoint {
567 type Owned = Self;
568
569 #[inline(always)]
570 fn inline_align(_context: fidl::encoding::Context) -> usize {
571 4
572 }
573
574 #[inline(always)]
575 fn inline_size(_context: fidl::encoding::Context) -> usize {
576 4
577 }
578 }
579
580 unsafe impl<D: fidl::encoding::ResourceDialect>
581 fidl::encoding::Encode<OneshotTempBelowTripPoint, D> for &OneshotTempBelowTripPoint
582 {
583 #[inline]
584 unsafe fn encode(
585 self,
586 encoder: &mut fidl::encoding::Encoder<'_, D>,
587 offset: usize,
588 _depth: fidl::encoding::Depth,
589 ) -> fidl::Result<()> {
590 encoder.debug_check_bounds::<OneshotTempBelowTripPoint>(offset);
591 fidl::encoding::Encode::<OneshotTempBelowTripPoint, D>::encode(
593 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(
594 &self.critical_temperature_celsius,
595 ),),
596 encoder,
597 offset,
598 _depth,
599 )
600 }
601 }
602 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
603 fidl::encoding::Encode<OneshotTempBelowTripPoint, D> for (T0,)
604 {
605 #[inline]
606 unsafe fn encode(
607 self,
608 encoder: &mut fidl::encoding::Encoder<'_, D>,
609 offset: usize,
610 depth: fidl::encoding::Depth,
611 ) -> fidl::Result<()> {
612 encoder.debug_check_bounds::<OneshotTempBelowTripPoint>(offset);
613 self.0.encode(encoder, offset + 0, depth)?;
617 Ok(())
618 }
619 }
620
621 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
622 for OneshotTempBelowTripPoint
623 {
624 #[inline(always)]
625 fn new_empty() -> Self {
626 Self { critical_temperature_celsius: fidl::new_empty!(f32, D) }
627 }
628
629 #[inline]
630 unsafe fn decode(
631 &mut self,
632 decoder: &mut fidl::encoding::Decoder<'_, D>,
633 offset: usize,
634 _depth: fidl::encoding::Depth,
635 ) -> fidl::Result<()> {
636 decoder.debug_check_bounds::<Self>(offset);
637 fidl::decode!(
639 f32,
640 D,
641 &mut self.critical_temperature_celsius,
642 decoder,
643 offset + 0,
644 _depth
645 )?;
646 Ok(())
647 }
648 }
649
650 impl fidl::encoding::ValueTypeMarker for TripDeviceMetadata {
651 type Borrowed<'a> = &'a Self;
652 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
653 value
654 }
655 }
656
657 unsafe impl fidl::encoding::TypeMarker for TripDeviceMetadata {
658 type Owned = Self;
659
660 #[inline(always)]
661 fn inline_align(_context: fidl::encoding::Context) -> usize {
662 4
663 }
664
665 #[inline(always)]
666 fn inline_size(_context: fidl::encoding::Context) -> usize {
667 4
668 }
669 }
670
671 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TripDeviceMetadata, D>
672 for &TripDeviceMetadata
673 {
674 #[inline]
675 unsafe fn encode(
676 self,
677 encoder: &mut fidl::encoding::Encoder<'_, D>,
678 offset: usize,
679 _depth: fidl::encoding::Depth,
680 ) -> fidl::Result<()> {
681 encoder.debug_check_bounds::<TripDeviceMetadata>(offset);
682 fidl::encoding::Encode::<TripDeviceMetadata, D>::encode(
684 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.critical_temp_celsius),),
685 encoder,
686 offset,
687 _depth,
688 )
689 }
690 }
691 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
692 fidl::encoding::Encode<TripDeviceMetadata, D> for (T0,)
693 {
694 #[inline]
695 unsafe fn encode(
696 self,
697 encoder: &mut fidl::encoding::Encoder<'_, D>,
698 offset: usize,
699 depth: fidl::encoding::Depth,
700 ) -> fidl::Result<()> {
701 encoder.debug_check_bounds::<TripDeviceMetadata>(offset);
702 self.0.encode(encoder, offset + 0, depth)?;
706 Ok(())
707 }
708 }
709
710 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TripDeviceMetadata {
711 #[inline(always)]
712 fn new_empty() -> Self {
713 Self { critical_temp_celsius: fidl::new_empty!(f32, D) }
714 }
715
716 #[inline]
717 unsafe fn decode(
718 &mut self,
719 decoder: &mut fidl::encoding::Decoder<'_, D>,
720 offset: usize,
721 _depth: fidl::encoding::Depth,
722 ) -> fidl::Result<()> {
723 decoder.debug_check_bounds::<Self>(offset);
724 fidl::decode!(f32, D, &mut self.critical_temp_celsius, decoder, offset + 0, _depth)?;
726 Ok(())
727 }
728 }
729
730 impl fidl::encoding::ValueTypeMarker for TripPointDescriptor {
731 type Borrowed<'a> = &'a Self;
732 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
733 value
734 }
735 }
736
737 unsafe impl fidl::encoding::TypeMarker for TripPointDescriptor {
738 type Owned = Self;
739
740 #[inline(always)]
741 fn inline_align(_context: fidl::encoding::Context) -> usize {
742 8
743 }
744
745 #[inline(always)]
746 fn inline_size(_context: fidl::encoding::Context) -> usize {
747 24
748 }
749 }
750
751 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TripPointDescriptor, D>
752 for &TripPointDescriptor
753 {
754 #[inline]
755 unsafe fn encode(
756 self,
757 encoder: &mut fidl::encoding::Encoder<'_, D>,
758 offset: usize,
759 _depth: fidl::encoding::Depth,
760 ) -> fidl::Result<()> {
761 encoder.debug_check_bounds::<TripPointDescriptor>(offset);
762 fidl::encoding::Encode::<TripPointDescriptor, D>::encode(
764 (
765 <TripPointType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
766 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
767 <TripPointValue as fidl::encoding::ValueTypeMarker>::borrow(
768 &self.configuration,
769 ),
770 ),
771 encoder,
772 offset,
773 _depth,
774 )
775 }
776 }
777 unsafe impl<
778 D: fidl::encoding::ResourceDialect,
779 T0: fidl::encoding::Encode<TripPointType, D>,
780 T1: fidl::encoding::Encode<u32, D>,
781 T2: fidl::encoding::Encode<TripPointValue, D>,
782 > fidl::encoding::Encode<TripPointDescriptor, D> for (T0, T1, T2)
783 {
784 #[inline]
785 unsafe fn encode(
786 self,
787 encoder: &mut fidl::encoding::Encoder<'_, D>,
788 offset: usize,
789 depth: fidl::encoding::Depth,
790 ) -> fidl::Result<()> {
791 encoder.debug_check_bounds::<TripPointDescriptor>(offset);
792 unsafe {
795 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
796 (ptr as *mut u64).write_unaligned(0);
797 }
798 self.0.encode(encoder, offset + 0, depth)?;
800 self.1.encode(encoder, offset + 4, depth)?;
801 self.2.encode(encoder, offset + 8, depth)?;
802 Ok(())
803 }
804 }
805
806 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TripPointDescriptor {
807 #[inline(always)]
808 fn new_empty() -> Self {
809 Self {
810 type_: fidl::new_empty!(TripPointType, D),
811 index: fidl::new_empty!(u32, D),
812 configuration: fidl::new_empty!(TripPointValue, D),
813 }
814 }
815
816 #[inline]
817 unsafe fn decode(
818 &mut self,
819 decoder: &mut fidl::encoding::Decoder<'_, D>,
820 offset: usize,
821 _depth: fidl::encoding::Depth,
822 ) -> fidl::Result<()> {
823 decoder.debug_check_bounds::<Self>(offset);
824 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
826 let padval = unsafe { (ptr as *const u64).read_unaligned() };
827 let mask = 0xffff0000u64;
828 let maskedval = padval & mask;
829 if maskedval != 0 {
830 return Err(fidl::Error::NonZeroPadding {
831 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
832 });
833 }
834 fidl::decode!(TripPointType, D, &mut self.type_, decoder, offset + 0, _depth)?;
835 fidl::decode!(u32, D, &mut self.index, decoder, offset + 4, _depth)?;
836 fidl::decode!(TripPointValue, D, &mut self.configuration, decoder, offset + 8, _depth)?;
837 Ok(())
838 }
839 }
840
841 impl fidl::encoding::ValueTypeMarker for TripPointResult {
842 type Borrowed<'a> = &'a Self;
843 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
844 value
845 }
846 }
847
848 unsafe impl fidl::encoding::TypeMarker for TripPointResult {
849 type Owned = Self;
850
851 #[inline(always)]
852 fn inline_align(_context: fidl::encoding::Context) -> usize {
853 4
854 }
855
856 #[inline(always)]
857 fn inline_size(_context: fidl::encoding::Context) -> usize {
858 8
859 }
860 }
861
862 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TripPointResult, D>
863 for &TripPointResult
864 {
865 #[inline]
866 unsafe fn encode(
867 self,
868 encoder: &mut fidl::encoding::Encoder<'_, D>,
869 offset: usize,
870 _depth: fidl::encoding::Depth,
871 ) -> fidl::Result<()> {
872 encoder.debug_check_bounds::<TripPointResult>(offset);
873 fidl::encoding::Encode::<TripPointResult, D>::encode(
875 (
876 <f32 as fidl::encoding::ValueTypeMarker>::borrow(
877 &self.measured_temperature_celsius,
878 ),
879 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
880 ),
881 encoder,
882 offset,
883 _depth,
884 )
885 }
886 }
887 unsafe impl<
888 D: fidl::encoding::ResourceDialect,
889 T0: fidl::encoding::Encode<f32, D>,
890 T1: fidl::encoding::Encode<u32, D>,
891 > fidl::encoding::Encode<TripPointResult, D> for (T0, T1)
892 {
893 #[inline]
894 unsafe fn encode(
895 self,
896 encoder: &mut fidl::encoding::Encoder<'_, D>,
897 offset: usize,
898 depth: fidl::encoding::Depth,
899 ) -> fidl::Result<()> {
900 encoder.debug_check_bounds::<TripPointResult>(offset);
901 self.0.encode(encoder, offset + 0, depth)?;
905 self.1.encode(encoder, offset + 4, depth)?;
906 Ok(())
907 }
908 }
909
910 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TripPointResult {
911 #[inline(always)]
912 fn new_empty() -> Self {
913 Self {
914 measured_temperature_celsius: fidl::new_empty!(f32, D),
915 index: fidl::new_empty!(u32, D),
916 }
917 }
918
919 #[inline]
920 unsafe fn decode(
921 &mut self,
922 decoder: &mut fidl::encoding::Decoder<'_, D>,
923 offset: usize,
924 _depth: fidl::encoding::Depth,
925 ) -> fidl::Result<()> {
926 decoder.debug_check_bounds::<Self>(offset);
927 fidl::decode!(
929 f32,
930 D,
931 &mut self.measured_temperature_celsius,
932 decoder,
933 offset + 0,
934 _depth
935 )?;
936 fidl::decode!(u32, D, &mut self.index, decoder, offset + 4, _depth)?;
937 Ok(())
938 }
939 }
940
941 impl fidl::encoding::ValueTypeMarker for TripPointSetTripPointsRequest {
942 type Borrowed<'a> = &'a Self;
943 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
944 value
945 }
946 }
947
948 unsafe impl fidl::encoding::TypeMarker for TripPointSetTripPointsRequest {
949 type Owned = Self;
950
951 #[inline(always)]
952 fn inline_align(_context: fidl::encoding::Context) -> usize {
953 8
954 }
955
956 #[inline(always)]
957 fn inline_size(_context: fidl::encoding::Context) -> usize {
958 16
959 }
960 }
961
962 unsafe impl<D: fidl::encoding::ResourceDialect>
963 fidl::encoding::Encode<TripPointSetTripPointsRequest, D>
964 for &TripPointSetTripPointsRequest
965 {
966 #[inline]
967 unsafe fn encode(
968 self,
969 encoder: &mut fidl::encoding::Encoder<'_, D>,
970 offset: usize,
971 _depth: fidl::encoding::Depth,
972 ) -> fidl::Result<()> {
973 encoder.debug_check_bounds::<TripPointSetTripPointsRequest>(offset);
974 fidl::encoding::Encode::<TripPointSetTripPointsRequest, D>::encode(
976 (
977 <fidl::encoding::UnboundedVector<TripPointDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.descriptors),
978 ),
979 encoder, offset, _depth
980 )
981 }
982 }
983 unsafe impl<
984 D: fidl::encoding::ResourceDialect,
985 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<TripPointDescriptor>, D>,
986 > fidl::encoding::Encode<TripPointSetTripPointsRequest, D> for (T0,)
987 {
988 #[inline]
989 unsafe fn encode(
990 self,
991 encoder: &mut fidl::encoding::Encoder<'_, D>,
992 offset: usize,
993 depth: fidl::encoding::Depth,
994 ) -> fidl::Result<()> {
995 encoder.debug_check_bounds::<TripPointSetTripPointsRequest>(offset);
996 self.0.encode(encoder, offset + 0, depth)?;
1000 Ok(())
1001 }
1002 }
1003
1004 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1005 for TripPointSetTripPointsRequest
1006 {
1007 #[inline(always)]
1008 fn new_empty() -> Self {
1009 Self {
1010 descriptors: fidl::new_empty!(
1011 fidl::encoding::UnboundedVector<TripPointDescriptor>,
1012 D
1013 ),
1014 }
1015 }
1016
1017 #[inline]
1018 unsafe fn decode(
1019 &mut self,
1020 decoder: &mut fidl::encoding::Decoder<'_, D>,
1021 offset: usize,
1022 _depth: fidl::encoding::Depth,
1023 ) -> fidl::Result<()> {
1024 decoder.debug_check_bounds::<Self>(offset);
1025 fidl::decode!(
1027 fidl::encoding::UnboundedVector<TripPointDescriptor>,
1028 D,
1029 &mut self.descriptors,
1030 decoder,
1031 offset + 0,
1032 _depth
1033 )?;
1034 Ok(())
1035 }
1036 }
1037
1038 impl fidl::encoding::ValueTypeMarker for TripPointGetTripPointDescriptorsResponse {
1039 type Borrowed<'a> = &'a Self;
1040 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1041 value
1042 }
1043 }
1044
1045 unsafe impl fidl::encoding::TypeMarker for TripPointGetTripPointDescriptorsResponse {
1046 type Owned = Self;
1047
1048 #[inline(always)]
1049 fn inline_align(_context: fidl::encoding::Context) -> usize {
1050 8
1051 }
1052
1053 #[inline(always)]
1054 fn inline_size(_context: fidl::encoding::Context) -> usize {
1055 16
1056 }
1057 }
1058
1059 unsafe impl<D: fidl::encoding::ResourceDialect>
1060 fidl::encoding::Encode<TripPointGetTripPointDescriptorsResponse, D>
1061 for &TripPointGetTripPointDescriptorsResponse
1062 {
1063 #[inline]
1064 unsafe fn encode(
1065 self,
1066 encoder: &mut fidl::encoding::Encoder<'_, D>,
1067 offset: usize,
1068 _depth: fidl::encoding::Depth,
1069 ) -> fidl::Result<()> {
1070 encoder.debug_check_bounds::<TripPointGetTripPointDescriptorsResponse>(offset);
1071 fidl::encoding::Encode::<TripPointGetTripPointDescriptorsResponse, D>::encode(
1073 (
1074 <fidl::encoding::UnboundedVector<TripPointDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.descriptors),
1075 ),
1076 encoder, offset, _depth
1077 )
1078 }
1079 }
1080 unsafe impl<
1081 D: fidl::encoding::ResourceDialect,
1082 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<TripPointDescriptor>, D>,
1083 > fidl::encoding::Encode<TripPointGetTripPointDescriptorsResponse, D> for (T0,)
1084 {
1085 #[inline]
1086 unsafe fn encode(
1087 self,
1088 encoder: &mut fidl::encoding::Encoder<'_, D>,
1089 offset: usize,
1090 depth: fidl::encoding::Depth,
1091 ) -> fidl::Result<()> {
1092 encoder.debug_check_bounds::<TripPointGetTripPointDescriptorsResponse>(offset);
1093 self.0.encode(encoder, offset + 0, depth)?;
1097 Ok(())
1098 }
1099 }
1100
1101 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1102 for TripPointGetTripPointDescriptorsResponse
1103 {
1104 #[inline(always)]
1105 fn new_empty() -> Self {
1106 Self {
1107 descriptors: fidl::new_empty!(
1108 fidl::encoding::UnboundedVector<TripPointDescriptor>,
1109 D
1110 ),
1111 }
1112 }
1113
1114 #[inline]
1115 unsafe fn decode(
1116 &mut self,
1117 decoder: &mut fidl::encoding::Decoder<'_, D>,
1118 offset: usize,
1119 _depth: fidl::encoding::Depth,
1120 ) -> fidl::Result<()> {
1121 decoder.debug_check_bounds::<Self>(offset);
1122 fidl::decode!(
1124 fidl::encoding::UnboundedVector<TripPointDescriptor>,
1125 D,
1126 &mut self.descriptors,
1127 decoder,
1128 offset + 0,
1129 _depth
1130 )?;
1131 Ok(())
1132 }
1133 }
1134
1135 impl fidl::encoding::ValueTypeMarker for TripPointWaitForAnyTripPointResponse {
1136 type Borrowed<'a> = &'a Self;
1137 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1138 value
1139 }
1140 }
1141
1142 unsafe impl fidl::encoding::TypeMarker for TripPointWaitForAnyTripPointResponse {
1143 type Owned = Self;
1144
1145 #[inline(always)]
1146 fn inline_align(_context: fidl::encoding::Context) -> usize {
1147 4
1148 }
1149
1150 #[inline(always)]
1151 fn inline_size(_context: fidl::encoding::Context) -> usize {
1152 8
1153 }
1154 }
1155
1156 unsafe impl<D: fidl::encoding::ResourceDialect>
1157 fidl::encoding::Encode<TripPointWaitForAnyTripPointResponse, D>
1158 for &TripPointWaitForAnyTripPointResponse
1159 {
1160 #[inline]
1161 unsafe fn encode(
1162 self,
1163 encoder: &mut fidl::encoding::Encoder<'_, D>,
1164 offset: usize,
1165 _depth: fidl::encoding::Depth,
1166 ) -> fidl::Result<()> {
1167 encoder.debug_check_bounds::<TripPointWaitForAnyTripPointResponse>(offset);
1168 fidl::encoding::Encode::<TripPointWaitForAnyTripPointResponse, D>::encode(
1170 (<TripPointResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
1171 encoder,
1172 offset,
1173 _depth,
1174 )
1175 }
1176 }
1177 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TripPointResult, D>>
1178 fidl::encoding::Encode<TripPointWaitForAnyTripPointResponse, D> for (T0,)
1179 {
1180 #[inline]
1181 unsafe fn encode(
1182 self,
1183 encoder: &mut fidl::encoding::Encoder<'_, D>,
1184 offset: usize,
1185 depth: fidl::encoding::Depth,
1186 ) -> fidl::Result<()> {
1187 encoder.debug_check_bounds::<TripPointWaitForAnyTripPointResponse>(offset);
1188 self.0.encode(encoder, offset + 0, depth)?;
1192 Ok(())
1193 }
1194 }
1195
1196 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1197 for TripPointWaitForAnyTripPointResponse
1198 {
1199 #[inline(always)]
1200 fn new_empty() -> Self {
1201 Self { result: fidl::new_empty!(TripPointResult, D) }
1202 }
1203
1204 #[inline]
1205 unsafe fn decode(
1206 &mut self,
1207 decoder: &mut fidl::encoding::Decoder<'_, D>,
1208 offset: usize,
1209 _depth: fidl::encoding::Depth,
1210 ) -> fidl::Result<()> {
1211 decoder.debug_check_bounds::<Self>(offset);
1212 fidl::decode!(TripPointResult, D, &mut self.result, decoder, offset + 0, _depth)?;
1214 Ok(())
1215 }
1216 }
1217
1218 impl fidl::encoding::ValueTypeMarker for TripPointValue {
1219 type Borrowed<'a> = &'a Self;
1220 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1221 value
1222 }
1223 }
1224
1225 unsafe impl fidl::encoding::TypeMarker for TripPointValue {
1226 type Owned = Self;
1227
1228 #[inline(always)]
1229 fn inline_align(_context: fidl::encoding::Context) -> usize {
1230 8
1231 }
1232
1233 #[inline(always)]
1234 fn inline_size(_context: fidl::encoding::Context) -> usize {
1235 16
1236 }
1237 }
1238
1239 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TripPointValue, D>
1240 for &TripPointValue
1241 {
1242 #[inline]
1243 unsafe fn encode(
1244 self,
1245 encoder: &mut fidl::encoding::Encoder<'_, D>,
1246 offset: usize,
1247 _depth: fidl::encoding::Depth,
1248 ) -> fidl::Result<()> {
1249 encoder.debug_check_bounds::<TripPointValue>(offset);
1250 encoder.write_num::<u64>(self.ordinal(), offset);
1251 match self {
1252 TripPointValue::ClearedTripPoint(ref val) => {
1253 fidl::encoding::encode_in_envelope::<ClearedTripPoint, D>(
1254 <ClearedTripPoint as fidl::encoding::ValueTypeMarker>::borrow(val),
1255 encoder,
1256 offset + 8,
1257 _depth,
1258 )
1259 }
1260 TripPointValue::OneshotTempAboveTripPoint(ref val) => {
1261 fidl::encoding::encode_in_envelope::<OneshotTempAboveTripPoint, D>(
1262 <OneshotTempAboveTripPoint as fidl::encoding::ValueTypeMarker>::borrow(val),
1263 encoder,
1264 offset + 8,
1265 _depth,
1266 )
1267 }
1268 TripPointValue::OneshotTempBelowTripPoint(ref val) => {
1269 fidl::encoding::encode_in_envelope::<OneshotTempBelowTripPoint, D>(
1270 <OneshotTempBelowTripPoint as fidl::encoding::ValueTypeMarker>::borrow(val),
1271 encoder,
1272 offset + 8,
1273 _depth,
1274 )
1275 }
1276 TripPointValue::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1277 }
1278 }
1279 }
1280
1281 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TripPointValue {
1282 #[inline(always)]
1283 fn new_empty() -> Self {
1284 Self::__SourceBreaking { unknown_ordinal: 0 }
1285 }
1286
1287 #[inline]
1288 unsafe fn decode(
1289 &mut self,
1290 decoder: &mut fidl::encoding::Decoder<'_, D>,
1291 offset: usize,
1292 mut depth: fidl::encoding::Depth,
1293 ) -> fidl::Result<()> {
1294 decoder.debug_check_bounds::<Self>(offset);
1295 #[allow(unused_variables)]
1296 let next_out_of_line = decoder.next_out_of_line();
1297 let handles_before = decoder.remaining_handles();
1298 let (ordinal, inlined, num_bytes, num_handles) =
1299 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1300
1301 let member_inline_size = match ordinal {
1302 1 => <ClearedTripPoint as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1303 2 => <OneshotTempAboveTripPoint as fidl::encoding::TypeMarker>::inline_size(
1304 decoder.context,
1305 ),
1306 3 => <OneshotTempBelowTripPoint as fidl::encoding::TypeMarker>::inline_size(
1307 decoder.context,
1308 ),
1309 0 => return Err(fidl::Error::UnknownUnionTag),
1310 _ => num_bytes as usize,
1311 };
1312
1313 if inlined != (member_inline_size <= 4) {
1314 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1315 }
1316 let _inner_offset;
1317 if inlined {
1318 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1319 _inner_offset = offset + 8;
1320 } else {
1321 depth.increment()?;
1322 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1323 }
1324 match ordinal {
1325 1 => {
1326 #[allow(irrefutable_let_patterns)]
1327 if let TripPointValue::ClearedTripPoint(_) = self {
1328 } else {
1330 *self =
1332 TripPointValue::ClearedTripPoint(fidl::new_empty!(ClearedTripPoint, D));
1333 }
1334 #[allow(irrefutable_let_patterns)]
1335 if let TripPointValue::ClearedTripPoint(ref mut val) = self {
1336 fidl::decode!(ClearedTripPoint, D, val, decoder, _inner_offset, depth)?;
1337 } else {
1338 unreachable!()
1339 }
1340 }
1341 2 => {
1342 #[allow(irrefutable_let_patterns)]
1343 if let TripPointValue::OneshotTempAboveTripPoint(_) = self {
1344 } else {
1346 *self = TripPointValue::OneshotTempAboveTripPoint(fidl::new_empty!(
1348 OneshotTempAboveTripPoint,
1349 D
1350 ));
1351 }
1352 #[allow(irrefutable_let_patterns)]
1353 if let TripPointValue::OneshotTempAboveTripPoint(ref mut val) = self {
1354 fidl::decode!(
1355 OneshotTempAboveTripPoint,
1356 D,
1357 val,
1358 decoder,
1359 _inner_offset,
1360 depth
1361 )?;
1362 } else {
1363 unreachable!()
1364 }
1365 }
1366 3 => {
1367 #[allow(irrefutable_let_patterns)]
1368 if let TripPointValue::OneshotTempBelowTripPoint(_) = self {
1369 } else {
1371 *self = TripPointValue::OneshotTempBelowTripPoint(fidl::new_empty!(
1373 OneshotTempBelowTripPoint,
1374 D
1375 ));
1376 }
1377 #[allow(irrefutable_let_patterns)]
1378 if let TripPointValue::OneshotTempBelowTripPoint(ref mut val) = self {
1379 fidl::decode!(
1380 OneshotTempBelowTripPoint,
1381 D,
1382 val,
1383 decoder,
1384 _inner_offset,
1385 depth
1386 )?;
1387 } else {
1388 unreachable!()
1389 }
1390 }
1391 #[allow(deprecated)]
1392 ordinal => {
1393 for _ in 0..num_handles {
1394 decoder.drop_next_handle()?;
1395 }
1396 *self = TripPointValue::__SourceBreaking { unknown_ordinal: ordinal };
1397 }
1398 }
1399 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1400 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1401 }
1402 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1403 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1404 }
1405 Ok(())
1406 }
1407 }
1408}