1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[doc = " The length of time it takes to move to a power level.\n + `target_level` is the power level we\'re moving to.\n + `latency_us` is the time it takes to move to the level in microseconds.\n"]
8 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
9 pub struct Transition {
10 pub target_level: ::core::option::Option<u8>,
11
12 pub latency_us: ::core::option::Option<u32>,
13 }
14
15 impl Transition {
16 fn __max_ordinal(&self) -> usize {
17 if self.latency_us.is_some() {
18 return 2;
19 }
20
21 if self.target_level.is_some() {
22 return 1;
23 }
24
25 0
26 }
27 }
28
29 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Transition<'static>, ___E> for Transition
30 where
31 ___E: ::fidl_next::Encoder + ?Sized,
32 {
33 #[inline]
34 fn encode(
35 mut self,
36 encoder: &mut ___E,
37 out: &mut ::core::mem::MaybeUninit<crate::wire::Transition<'static>>,
38 _: (),
39 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
40 ::fidl_next::munge!(let crate::wire::Transition { table } = out);
41
42 let max_ord = self.__max_ordinal();
43
44 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
45 ::fidl_next::Wire::zero_padding(&mut out);
46
47 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
48 ::fidl_next::wire::Envelope,
49 >(encoder, max_ord);
50
51 for i in 1..=max_ord {
52 match i {
53 2 => {
54 if let Some(value) = self.latency_us.take() {
55 ::fidl_next::wire::Envelope::encode_value::<
56 ::fidl_next::wire::Uint32,
57 ___E,
58 >(
59 value, preallocated.encoder, &mut out, ()
60 )?;
61 } else {
62 ::fidl_next::wire::Envelope::encode_zero(&mut out)
63 }
64 }
65
66 1 => {
67 if let Some(value) = self.target_level.take() {
68 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
69 value,
70 preallocated.encoder,
71 &mut out,
72 (),
73 )?;
74 } else {
75 ::fidl_next::wire::Envelope::encode_zero(&mut out)
76 }
77 }
78
79 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
80 }
81 unsafe {
82 preallocated.write_next(out.assume_init_ref());
83 }
84 }
85
86 ::fidl_next::wire::Table::encode_len(table, max_ord);
87
88 Ok(())
89 }
90 }
91
92 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Transition<'static>, ___E> for &'a Transition
93 where
94 ___E: ::fidl_next::Encoder + ?Sized,
95 {
96 #[inline]
97 fn encode(
98 self,
99 encoder: &mut ___E,
100 out: &mut ::core::mem::MaybeUninit<crate::wire::Transition<'static>>,
101 _: (),
102 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
103 ::fidl_next::munge!(let crate::wire::Transition { table } = out);
104
105 let max_ord = self.__max_ordinal();
106
107 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
108 ::fidl_next::Wire::zero_padding(&mut out);
109
110 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
111 ::fidl_next::wire::Envelope,
112 >(encoder, max_ord);
113
114 for i in 1..=max_ord {
115 match i {
116 2 => {
117 if let Some(value) = &self.latency_us {
118 ::fidl_next::wire::Envelope::encode_value::<
119 ::fidl_next::wire::Uint32,
120 ___E,
121 >(
122 value, preallocated.encoder, &mut out, ()
123 )?;
124 } else {
125 ::fidl_next::wire::Envelope::encode_zero(&mut out)
126 }
127 }
128
129 1 => {
130 if let Some(value) = &self.target_level {
131 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
132 value,
133 preallocated.encoder,
134 &mut out,
135 (),
136 )?;
137 } else {
138 ::fidl_next::wire::Envelope::encode_zero(&mut out)
139 }
140 }
141
142 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
143 }
144 unsafe {
145 preallocated.write_next(out.assume_init_ref());
146 }
147 }
148
149 ::fidl_next::wire::Table::encode_len(table, max_ord);
150
151 Ok(())
152 }
153 }
154
155 impl<'de> ::fidl_next::FromWire<crate::wire::Transition<'de>> for Transition {
156 #[inline]
157 fn from_wire(wire_: crate::wire::Transition<'de>) -> Self {
158 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
159
160 let target_level = wire_.table.get(1);
161
162 let latency_us = wire_.table.get(2);
163
164 Self {
165 target_level: target_level.map(|envelope| {
166 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
167 }),
168
169 latency_us: latency_us.map(|envelope| {
170 ::fidl_next::FromWire::from_wire(unsafe {
171 envelope.read_unchecked::<::fidl_next::wire::Uint32>()
172 })
173 }),
174 }
175 }
176 }
177
178 impl<'de> ::fidl_next::FromWireRef<crate::wire::Transition<'de>> for Transition {
179 #[inline]
180 fn from_wire_ref(wire: &crate::wire::Transition<'de>) -> Self {
181 Self {
182 target_level: wire.table.get(1).map(|envelope| {
183 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
184 envelope.deref_unchecked::<u8>()
185 })
186 }),
187
188 latency_us: wire.table.get(2).map(|envelope| {
189 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
190 envelope.deref_unchecked::<::fidl_next::wire::Uint32>()
191 })
192 }),
193 }
194 }
195 }
196
197 #[doc = " A zero-indexed set of levels that a device can assume.\n + `level` is the zero-indexed level of this `PowerLevel`.\n + `name` is a human-readable label for this `PowerLevel`, used only for\n debugging.\n + `transitions` describes the levels that are valid transitions from this\n `PowerLevel`.\n"]
198 #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
199 pub struct PowerLevel {
200 pub level: ::core::option::Option<u8>,
201
202 pub name: ::core::option::Option<::std::string::String>,
203
204 pub transitions: ::core::option::Option<::std::vec::Vec<crate::natural::Transition>>,
205 }
206
207 impl PowerLevel {
208 fn __max_ordinal(&self) -> usize {
209 if self.transitions.is_some() {
210 return 3;
211 }
212
213 if self.name.is_some() {
214 return 2;
215 }
216
217 if self.level.is_some() {
218 return 1;
219 }
220
221 0
222 }
223 }
224
225 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerLevel<'static>, ___E> for PowerLevel
226 where
227 ___E: ::fidl_next::Encoder + ?Sized,
228 {
229 #[inline]
230 fn encode(
231 mut self,
232 encoder: &mut ___E,
233 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerLevel<'static>>,
234 _: (),
235 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
236 ::fidl_next::munge!(let crate::wire::PowerLevel { table } = out);
237
238 let max_ord = self.__max_ordinal();
239
240 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
241 ::fidl_next::Wire::zero_padding(&mut out);
242
243 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
244 ::fidl_next::wire::Envelope,
245 >(encoder, max_ord);
246
247 for i in 1..=max_ord {
248 match i {
249 3 => {
250 if let Some(value) = self.transitions.take() {
251 ::fidl_next::wire::Envelope::encode_value::<
252 ::fidl_next::wire::Vector<
253 'static,
254 crate::wire::Transition<'static>,
255 >,
256 ___E,
257 >(
258 value, preallocated.encoder, &mut out, (127, ())
259 )?;
260 } else {
261 ::fidl_next::wire::Envelope::encode_zero(&mut out)
262 }
263 }
264
265 2 => {
266 if let Some(value) = self.name.take() {
267 ::fidl_next::wire::Envelope::encode_value::<
268 ::fidl_next::wire::String<'static>,
269 ___E,
270 >(
271 value, preallocated.encoder, &mut out, 63
272 )?;
273 } else {
274 ::fidl_next::wire::Envelope::encode_zero(&mut out)
275 }
276 }
277
278 1 => {
279 if let Some(value) = self.level.take() {
280 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
281 value,
282 preallocated.encoder,
283 &mut out,
284 (),
285 )?;
286 } else {
287 ::fidl_next::wire::Envelope::encode_zero(&mut out)
288 }
289 }
290
291 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
292 }
293 unsafe {
294 preallocated.write_next(out.assume_init_ref());
295 }
296 }
297
298 ::fidl_next::wire::Table::encode_len(table, max_ord);
299
300 Ok(())
301 }
302 }
303
304 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::PowerLevel<'static>, ___E> for &'a PowerLevel
305 where
306 ___E: ::fidl_next::Encoder + ?Sized,
307 {
308 #[inline]
309 fn encode(
310 self,
311 encoder: &mut ___E,
312 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerLevel<'static>>,
313 _: (),
314 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
315 ::fidl_next::munge!(let crate::wire::PowerLevel { table } = out);
316
317 let max_ord = self.__max_ordinal();
318
319 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
320 ::fidl_next::Wire::zero_padding(&mut out);
321
322 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
323 ::fidl_next::wire::Envelope,
324 >(encoder, max_ord);
325
326 for i in 1..=max_ord {
327 match i {
328 3 => {
329 if let Some(value) = &self.transitions {
330 ::fidl_next::wire::Envelope::encode_value::<
331 ::fidl_next::wire::Vector<
332 'static,
333 crate::wire::Transition<'static>,
334 >,
335 ___E,
336 >(
337 value, preallocated.encoder, &mut out, (127, ())
338 )?;
339 } else {
340 ::fidl_next::wire::Envelope::encode_zero(&mut out)
341 }
342 }
343
344 2 => {
345 if let Some(value) = &self.name {
346 ::fidl_next::wire::Envelope::encode_value::<
347 ::fidl_next::wire::String<'static>,
348 ___E,
349 >(
350 value, preallocated.encoder, &mut out, 63
351 )?;
352 } else {
353 ::fidl_next::wire::Envelope::encode_zero(&mut out)
354 }
355 }
356
357 1 => {
358 if let Some(value) = &self.level {
359 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
360 value,
361 preallocated.encoder,
362 &mut out,
363 (),
364 )?;
365 } else {
366 ::fidl_next::wire::Envelope::encode_zero(&mut out)
367 }
368 }
369
370 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
371 }
372 unsafe {
373 preallocated.write_next(out.assume_init_ref());
374 }
375 }
376
377 ::fidl_next::wire::Table::encode_len(table, max_ord);
378
379 Ok(())
380 }
381 }
382
383 impl<'de> ::fidl_next::FromWire<crate::wire::PowerLevel<'de>> for PowerLevel {
384 #[inline]
385 fn from_wire(wire_: crate::wire::PowerLevel<'de>) -> Self {
386 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
387
388 let level = wire_.table.get(1);
389
390 let name = wire_.table.get(2);
391
392 let transitions = wire_.table.get(3);
393
394 Self {
395
396
397 level: level.map(|envelope| ::fidl_next::FromWire::from_wire(
398 unsafe { envelope.read_unchecked::<u8>() }
399 )),
400
401
402 name: name.map(|envelope| ::fidl_next::FromWire::from_wire(
403 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
404 )),
405
406
407 transitions: transitions.map(|envelope| ::fidl_next::FromWire::from_wire(
408 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>>() }
409 )),
410
411 }
412 }
413 }
414
415 impl<'de> ::fidl_next::FromWireRef<crate::wire::PowerLevel<'de>> for PowerLevel {
416 #[inline]
417 fn from_wire_ref(wire: &crate::wire::PowerLevel<'de>) -> Self {
418 Self {
419
420
421 level: wire.table.get(1)
422 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
423 unsafe { envelope.deref_unchecked::<u8>() }
424 )),
425
426
427 name: wire.table.get(2)
428 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
429 unsafe { envelope.deref_unchecked::<::fidl_next::wire::String<'de>>() }
430 )),
431
432
433 transitions: wire.table.get(3)
434 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
435 unsafe { envelope.deref_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>>() }
436 )),
437
438 }
439 }
440 }
441
442 #[doc = " Set of `PowerLevel`s and a human-readable identifier. A `PowerLevel` itself\n contains information about valid transitions out of that level.\n"]
443 #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
444 pub struct PowerElement {
445 pub name: ::core::option::Option<::std::string::String>,
446
447 pub levels: ::core::option::Option<::std::vec::Vec<crate::natural::PowerLevel>>,
448 }
449
450 impl PowerElement {
451 fn __max_ordinal(&self) -> usize {
452 if self.levels.is_some() {
453 return 2;
454 }
455
456 if self.name.is_some() {
457 return 1;
458 }
459
460 0
461 }
462 }
463
464 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerElement<'static>, ___E> for PowerElement
465 where
466 ___E: ::fidl_next::Encoder + ?Sized,
467 {
468 #[inline]
469 fn encode(
470 mut self,
471 encoder: &mut ___E,
472 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerElement<'static>>,
473 _: (),
474 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
475 ::fidl_next::munge!(let crate::wire::PowerElement { table } = out);
476
477 let max_ord = self.__max_ordinal();
478
479 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
480 ::fidl_next::Wire::zero_padding(&mut out);
481
482 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
483 ::fidl_next::wire::Envelope,
484 >(encoder, max_ord);
485
486 for i in 1..=max_ord {
487 match i {
488 2 => {
489 if let Some(value) = self.levels.take() {
490 ::fidl_next::wire::Envelope::encode_value::<
491 ::fidl_next::wire::Vector<
492 'static,
493 crate::wire::PowerLevel<'static>,
494 >,
495 ___E,
496 >(
497 value, preallocated.encoder, &mut out, (128, ())
498 )?;
499 } else {
500 ::fidl_next::wire::Envelope::encode_zero(&mut out)
501 }
502 }
503
504 1 => {
505 if let Some(value) = self.name.take() {
506 ::fidl_next::wire::Envelope::encode_value::<
507 ::fidl_next::wire::String<'static>,
508 ___E,
509 >(
510 value, preallocated.encoder, &mut out, 63
511 )?;
512 } else {
513 ::fidl_next::wire::Envelope::encode_zero(&mut out)
514 }
515 }
516
517 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
518 }
519 unsafe {
520 preallocated.write_next(out.assume_init_ref());
521 }
522 }
523
524 ::fidl_next::wire::Table::encode_len(table, max_ord);
525
526 Ok(())
527 }
528 }
529
530 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::PowerElement<'static>, ___E>
531 for &'a PowerElement
532 where
533 ___E: ::fidl_next::Encoder + ?Sized,
534 {
535 #[inline]
536 fn encode(
537 self,
538 encoder: &mut ___E,
539 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerElement<'static>>,
540 _: (),
541 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
542 ::fidl_next::munge!(let crate::wire::PowerElement { table } = out);
543
544 let max_ord = self.__max_ordinal();
545
546 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
547 ::fidl_next::Wire::zero_padding(&mut out);
548
549 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
550 ::fidl_next::wire::Envelope,
551 >(encoder, max_ord);
552
553 for i in 1..=max_ord {
554 match i {
555 2 => {
556 if let Some(value) = &self.levels {
557 ::fidl_next::wire::Envelope::encode_value::<
558 ::fidl_next::wire::Vector<
559 'static,
560 crate::wire::PowerLevel<'static>,
561 >,
562 ___E,
563 >(
564 value, preallocated.encoder, &mut out, (128, ())
565 )?;
566 } else {
567 ::fidl_next::wire::Envelope::encode_zero(&mut out)
568 }
569 }
570
571 1 => {
572 if let Some(value) = &self.name {
573 ::fidl_next::wire::Envelope::encode_value::<
574 ::fidl_next::wire::String<'static>,
575 ___E,
576 >(
577 value, preallocated.encoder, &mut out, 63
578 )?;
579 } else {
580 ::fidl_next::wire::Envelope::encode_zero(&mut out)
581 }
582 }
583
584 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
585 }
586 unsafe {
587 preallocated.write_next(out.assume_init_ref());
588 }
589 }
590
591 ::fidl_next::wire::Table::encode_len(table, max_ord);
592
593 Ok(())
594 }
595 }
596
597 impl<'de> ::fidl_next::FromWire<crate::wire::PowerElement<'de>> for PowerElement {
598 #[inline]
599 fn from_wire(wire_: crate::wire::PowerElement<'de>) -> Self {
600 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
601
602 let name = wire_.table.get(1);
603
604 let levels = wire_.table.get(2);
605
606 Self {
607
608
609 name: name.map(|envelope| ::fidl_next::FromWire::from_wire(
610 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
611 )),
612
613
614 levels: levels.map(|envelope| ::fidl_next::FromWire::from_wire(
615 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>>() }
616 )),
617
618 }
619 }
620 }
621
622 impl<'de> ::fidl_next::FromWireRef<crate::wire::PowerElement<'de>> for PowerElement {
623 #[inline]
624 fn from_wire_ref(wire: &crate::wire::PowerElement<'de>) -> Self {
625 Self {
626
627
628 name: wire.table.get(1)
629 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
630 unsafe { envelope.deref_unchecked::<::fidl_next::wire::String<'de>>() }
631 )),
632
633
634 levels: wire.table.get(2)
635 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
636 unsafe { envelope.deref_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>>() }
637 )),
638
639 }
640 }
641 }
642
643 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
644 #[repr(u32)]
645 pub enum SagElement {
646 ExecutionState = 1,
647 ApplicationActivity = 4,
648 }
649 impl ::core::convert::TryFrom<u32> for SagElement {
650 type Error = ::fidl_next::UnknownStrictEnumMemberError;
651 fn try_from(
652 value: u32,
653 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
654 match value {
655 1 => Ok(Self::ExecutionState),
656 4 => Ok(Self::ApplicationActivity),
657
658 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
659 }
660 }
661 }
662
663 impl ::std::convert::From<SagElement> for u32 {
664 fn from(value: SagElement) -> Self {
665 match value {
666 SagElement::ExecutionState => 1,
667 SagElement::ApplicationActivity => 4,
668 }
669 }
670 }
671
672 unsafe impl<___E> ::fidl_next::Encode<crate::wire::SagElement, ___E> for SagElement
673 where
674 ___E: ?Sized,
675 {
676 #[inline]
677 fn encode(
678 self,
679 encoder: &mut ___E,
680 out: &mut ::core::mem::MaybeUninit<crate::wire::SagElement>,
681 _: (),
682 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
683 ::fidl_next::Encode::encode(&self, encoder, out, ())
684 }
685 }
686
687 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::SagElement, ___E> for &'a SagElement
688 where
689 ___E: ?Sized,
690 {
691 #[inline]
692 fn encode(
693 self,
694 encoder: &mut ___E,
695 out: &mut ::core::mem::MaybeUninit<crate::wire::SagElement>,
696 _: (),
697 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
698 ::fidl_next::munge!(let crate::wire::SagElement { value } = out);
699 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
700 SagElement::ExecutionState => 1,
701
702 SagElement::ApplicationActivity => 4,
703 }));
704
705 Ok(())
706 }
707 }
708
709 impl ::core::convert::From<crate::wire::SagElement> for SagElement {
710 fn from(wire: crate::wire::SagElement) -> Self {
711 match u32::from(wire.value) {
712 1 => Self::ExecutionState,
713
714 4 => Self::ApplicationActivity,
715
716 _ => unsafe { ::core::hint::unreachable_unchecked() },
717 }
718 }
719 }
720
721 impl ::fidl_next::FromWire<crate::wire::SagElement> for SagElement {
722 #[inline]
723 fn from_wire(wire: crate::wire::SagElement) -> Self {
724 Self::from(wire)
725 }
726 }
727
728 impl ::fidl_next::FromWireRef<crate::wire::SagElement> for SagElement {
729 #[inline]
730 fn from_wire_ref(wire: &crate::wire::SagElement) -> Self {
731 Self::from(*wire)
732 }
733 }
734
735 #[doc = " Represents the power elements related to controlling the CPU. This is an\n enum with a single variant to add flexibility for future addition of more\n elements related to CPU power state.\n"]
736 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
737 #[repr(u32)]
738 pub enum CpuPowerElement {
739 Cpu = 1,
740 }
741 impl ::core::convert::TryFrom<u32> for CpuPowerElement {
742 type Error = ::fidl_next::UnknownStrictEnumMemberError;
743 fn try_from(
744 value: u32,
745 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
746 match value {
747 1 => Ok(Self::Cpu),
748
749 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
750 }
751 }
752 }
753
754 impl ::std::convert::From<CpuPowerElement> for u32 {
755 fn from(value: CpuPowerElement) -> Self {
756 match value {
757 CpuPowerElement::Cpu => 1,
758 }
759 }
760 }
761
762 unsafe impl<___E> ::fidl_next::Encode<crate::wire::CpuPowerElement, ___E> for CpuPowerElement
763 where
764 ___E: ?Sized,
765 {
766 #[inline]
767 fn encode(
768 self,
769 encoder: &mut ___E,
770 out: &mut ::core::mem::MaybeUninit<crate::wire::CpuPowerElement>,
771 _: (),
772 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
773 ::fidl_next::Encode::encode(&self, encoder, out, ())
774 }
775 }
776
777 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::CpuPowerElement, ___E>
778 for &'a CpuPowerElement
779 where
780 ___E: ?Sized,
781 {
782 #[inline]
783 fn encode(
784 self,
785 encoder: &mut ___E,
786 out: &mut ::core::mem::MaybeUninit<crate::wire::CpuPowerElement>,
787 _: (),
788 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
789 ::fidl_next::munge!(let crate::wire::CpuPowerElement { value } = out);
790 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
791 CpuPowerElement::Cpu => 1,
792 }));
793
794 Ok(())
795 }
796 }
797
798 impl ::core::convert::From<crate::wire::CpuPowerElement> for CpuPowerElement {
799 fn from(wire: crate::wire::CpuPowerElement) -> Self {
800 match u32::from(wire.value) {
801 1 => Self::Cpu,
802
803 _ => unsafe { ::core::hint::unreachable_unchecked() },
804 }
805 }
806 }
807
808 impl ::fidl_next::FromWire<crate::wire::CpuPowerElement> for CpuPowerElement {
809 #[inline]
810 fn from_wire(wire: crate::wire::CpuPowerElement) -> Self {
811 Self::from(wire)
812 }
813 }
814
815 impl ::fidl_next::FromWireRef<crate::wire::CpuPowerElement> for CpuPowerElement {
816 #[inline]
817 fn from_wire_ref(wire: &crate::wire::CpuPowerElement) -> Self {
818 Self::from(*wire)
819 }
820 }
821
822 #[doc = " Identifier for an element that is another element\'s parent, in other words\n an element that the other element depends upon.\n"]
823 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
824 pub enum ParentElement {
825 Sag(crate::natural::SagElement),
826
827 InstanceName(::std::string::String),
828
829 CpuControl(crate::natural::CpuPowerElement),
830 }
831
832 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ParentElement<'static>, ___E> for ParentElement
833 where
834 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
835 ___E: ::fidl_next::Encoder,
836 {
837 #[inline]
838 fn encode(
839 self,
840 encoder: &mut ___E,
841 out: &mut ::core::mem::MaybeUninit<crate::wire::ParentElement<'static>>,
842 _: (),
843 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
844 ::fidl_next::munge!(let crate::wire::ParentElement { raw, _phantom: _ } = out);
845
846 match self {
847 Self::Sag(value) => ::fidl_next::wire::Union::encode_as::<
848 ___E,
849 crate::wire::SagElement,
850 >(value, 1, encoder, raw, ())?,
851
852 Self::InstanceName(value) => ::fidl_next::wire::Union::encode_as::<
853 ___E,
854 ::fidl_next::wire::String<'static>,
855 >(value, 2, encoder, raw, 63)?,
856
857 Self::CpuControl(value) => ::fidl_next::wire::Union::encode_as::<
858 ___E,
859 crate::wire::CpuPowerElement,
860 >(value, 3, encoder, raw, ())?,
861 }
862
863 Ok(())
864 }
865 }
866
867 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ParentElement<'static>, ___E>
868 for &'a ParentElement
869 where
870 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
871 ___E: ::fidl_next::Encoder,
872 {
873 #[inline]
874 fn encode(
875 self,
876 encoder: &mut ___E,
877 out: &mut ::core::mem::MaybeUninit<crate::wire::ParentElement<'static>>,
878 _: (),
879 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
880 ::fidl_next::munge!(let crate::wire::ParentElement { raw, _phantom: _ } = out);
881
882 match self {
883 ParentElement::Sag(value) => ::fidl_next::wire::Union::encode_as::<
884 ___E,
885 crate::wire::SagElement,
886 >(value, 1, encoder, raw, ())?,
887
888 ParentElement::InstanceName(value) => ::fidl_next::wire::Union::encode_as::<
889 ___E,
890 ::fidl_next::wire::String<'static>,
891 >(value, 2, encoder, raw, 63)?,
892
893 ParentElement::CpuControl(value) => ::fidl_next::wire::Union::encode_as::<
894 ___E,
895 crate::wire::CpuPowerElement,
896 >(value, 3, encoder, raw, ())?,
897 }
898
899 Ok(())
900 }
901 }
902
903 unsafe impl<___E> ::fidl_next::EncodeOption<crate::wire_optional::ParentElement<'static>, ___E>
904 for ParentElement
905 where
906 ___E: ?Sized,
907 ParentElement: ::fidl_next::Encode<crate::wire::ParentElement<'static>, ___E>,
908 {
909 #[inline]
910 fn encode_option(
911 this: ::core::option::Option<Self>,
912 encoder: &mut ___E,
913 out: &mut ::core::mem::MaybeUninit<crate::wire_optional::ParentElement<'static>>,
914 _: (),
915 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
916 ::fidl_next::munge!(let crate::wire_optional::ParentElement { raw, _phantom: _ } = &mut *out);
917
918 if let Some(inner) = this {
919 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
920 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
921 } else {
922 ::fidl_next::wire::Union::encode_absent(raw);
923 }
924
925 Ok(())
926 }
927 }
928
929 unsafe impl<'a, ___E>
930 ::fidl_next::EncodeOption<crate::wire_optional::ParentElement<'static>, ___E>
931 for &'a ParentElement
932 where
933 ___E: ?Sized,
934 &'a ParentElement: ::fidl_next::Encode<crate::wire::ParentElement<'static>, ___E>,
935 {
936 #[inline]
937 fn encode_option(
938 this: ::core::option::Option<Self>,
939 encoder: &mut ___E,
940 out: &mut ::core::mem::MaybeUninit<crate::wire_optional::ParentElement<'static>>,
941 _: (),
942 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
943 ::fidl_next::munge!(let crate::wire_optional::ParentElement { raw, _phantom: _ } = &mut *out);
944
945 if let Some(inner) = this {
946 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
947 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
948 } else {
949 ::fidl_next::wire::Union::encode_absent(raw);
950 }
951
952 Ok(())
953 }
954 }
955
956 impl<'de> ::fidl_next::FromWire<crate::wire::ParentElement<'de>> for ParentElement {
957 #[inline]
958 fn from_wire(wire: crate::wire::ParentElement<'de>) -> Self {
959 let wire = ::core::mem::ManuallyDrop::new(wire);
960 match wire.raw.ordinal() {
961 1 => Self::Sag(::fidl_next::FromWire::from_wire(unsafe {
962 wire.raw.get().read_unchecked::<crate::wire::SagElement>()
963 })),
964
965 2 => Self::InstanceName(::fidl_next::FromWire::from_wire(unsafe {
966 wire.raw.get().read_unchecked::<::fidl_next::wire::String<'de>>()
967 })),
968
969 3 => Self::CpuControl(::fidl_next::FromWire::from_wire(unsafe {
970 wire.raw.get().read_unchecked::<crate::wire::CpuPowerElement>()
971 })),
972
973 _ => unsafe { ::core::hint::unreachable_unchecked() },
974 }
975 }
976 }
977
978 impl<'de> ::fidl_next::FromWireRef<crate::wire::ParentElement<'de>> for ParentElement {
979 #[inline]
980 fn from_wire_ref(wire: &crate::wire::ParentElement<'de>) -> Self {
981 match wire.raw.ordinal() {
982 1 => Self::Sag(::fidl_next::FromWireRef::from_wire_ref(unsafe {
983 wire.raw.get().deref_unchecked::<crate::wire::SagElement>()
984 })),
985
986 2 => Self::InstanceName(::fidl_next::FromWireRef::from_wire_ref(unsafe {
987 wire.raw.get().deref_unchecked::<::fidl_next::wire::String<'de>>()
988 })),
989
990 3 => Self::CpuControl(::fidl_next::FromWireRef::from_wire_ref(unsafe {
991 wire.raw.get().deref_unchecked::<crate::wire::CpuPowerElement>()
992 })),
993
994 _ => unsafe { ::core::hint::unreachable_unchecked() },
995 }
996 }
997 }
998
999 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::ParentElement<'de>> for ParentElement {
1000 #[inline]
1001 fn from_wire_option(
1002 wire: crate::wire_optional::ParentElement<'de>,
1003 ) -> ::core::option::Option<Self> {
1004 if let Some(inner) = wire.into_option() {
1005 Some(::fidl_next::FromWire::from_wire(inner))
1006 } else {
1007 None
1008 }
1009 }
1010 }
1011
1012 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::ParentElement<'de>>
1013 for Box<ParentElement>
1014 {
1015 #[inline]
1016 fn from_wire_option(
1017 wire: crate::wire_optional::ParentElement<'de>,
1018 ) -> ::core::option::Option<Self> {
1019 <ParentElement as ::fidl_next::FromWireOption<
1020 crate::wire_optional::ParentElement<'de>,
1021 >>::from_wire_option(wire)
1022 .map(Box::new)
1023 }
1024 }
1025
1026 impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::ParentElement<'de>>
1027 for Box<ParentElement>
1028 {
1029 #[inline]
1030 fn from_wire_option_ref(
1031 wire: &crate::wire_optional::ParentElement<'de>,
1032 ) -> ::core::option::Option<Self> {
1033 if let Some(inner) = wire.as_ref() {
1034 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
1035 } else {
1036 None
1037 }
1038 }
1039 }
1040
1041 #[doc = " Represents a dependency between two power levels of two different\n `PowerElement`s.\n"]
1042 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1043 pub struct LevelTuple {
1044 pub child_level: ::core::option::Option<u8>,
1045
1046 pub parent_level: ::core::option::Option<u8>,
1047 }
1048
1049 impl LevelTuple {
1050 fn __max_ordinal(&self) -> usize {
1051 if self.parent_level.is_some() {
1052 return 2;
1053 }
1054
1055 if self.child_level.is_some() {
1056 return 1;
1057 }
1058
1059 0
1060 }
1061 }
1062
1063 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LevelTuple<'static>, ___E> for LevelTuple
1064 where
1065 ___E: ::fidl_next::Encoder + ?Sized,
1066 {
1067 #[inline]
1068 fn encode(
1069 mut self,
1070 encoder: &mut ___E,
1071 out: &mut ::core::mem::MaybeUninit<crate::wire::LevelTuple<'static>>,
1072 _: (),
1073 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1074 ::fidl_next::munge!(let crate::wire::LevelTuple { table } = out);
1075
1076 let max_ord = self.__max_ordinal();
1077
1078 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1079 ::fidl_next::Wire::zero_padding(&mut out);
1080
1081 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1082 ::fidl_next::wire::Envelope,
1083 >(encoder, max_ord);
1084
1085 for i in 1..=max_ord {
1086 match i {
1087 2 => {
1088 if let Some(value) = self.parent_level.take() {
1089 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
1090 value,
1091 preallocated.encoder,
1092 &mut out,
1093 (),
1094 )?;
1095 } else {
1096 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1097 }
1098 }
1099
1100 1 => {
1101 if let Some(value) = self.child_level.take() {
1102 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
1103 value,
1104 preallocated.encoder,
1105 &mut out,
1106 (),
1107 )?;
1108 } else {
1109 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1110 }
1111 }
1112
1113 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1114 }
1115 unsafe {
1116 preallocated.write_next(out.assume_init_ref());
1117 }
1118 }
1119
1120 ::fidl_next::wire::Table::encode_len(table, max_ord);
1121
1122 Ok(())
1123 }
1124 }
1125
1126 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::LevelTuple<'static>, ___E> for &'a LevelTuple
1127 where
1128 ___E: ::fidl_next::Encoder + ?Sized,
1129 {
1130 #[inline]
1131 fn encode(
1132 self,
1133 encoder: &mut ___E,
1134 out: &mut ::core::mem::MaybeUninit<crate::wire::LevelTuple<'static>>,
1135 _: (),
1136 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1137 ::fidl_next::munge!(let crate::wire::LevelTuple { table } = out);
1138
1139 let max_ord = self.__max_ordinal();
1140
1141 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1142 ::fidl_next::Wire::zero_padding(&mut out);
1143
1144 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1145 ::fidl_next::wire::Envelope,
1146 >(encoder, max_ord);
1147
1148 for i in 1..=max_ord {
1149 match i {
1150 2 => {
1151 if let Some(value) = &self.parent_level {
1152 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
1153 value,
1154 preallocated.encoder,
1155 &mut out,
1156 (),
1157 )?;
1158 } else {
1159 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1160 }
1161 }
1162
1163 1 => {
1164 if let Some(value) = &self.child_level {
1165 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
1166 value,
1167 preallocated.encoder,
1168 &mut out,
1169 (),
1170 )?;
1171 } else {
1172 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1173 }
1174 }
1175
1176 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1177 }
1178 unsafe {
1179 preallocated.write_next(out.assume_init_ref());
1180 }
1181 }
1182
1183 ::fidl_next::wire::Table::encode_len(table, max_ord);
1184
1185 Ok(())
1186 }
1187 }
1188
1189 impl<'de> ::fidl_next::FromWire<crate::wire::LevelTuple<'de>> for LevelTuple {
1190 #[inline]
1191 fn from_wire(wire_: crate::wire::LevelTuple<'de>) -> Self {
1192 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1193
1194 let child_level = wire_.table.get(1);
1195
1196 let parent_level = wire_.table.get(2);
1197
1198 Self {
1199 child_level: child_level.map(|envelope| {
1200 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
1201 }),
1202
1203 parent_level: parent_level.map(|envelope| {
1204 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
1205 }),
1206 }
1207 }
1208 }
1209
1210 impl<'de> ::fidl_next::FromWireRef<crate::wire::LevelTuple<'de>> for LevelTuple {
1211 #[inline]
1212 fn from_wire_ref(wire: &crate::wire::LevelTuple<'de>) -> Self {
1213 Self {
1214 child_level: wire.table.get(1).map(|envelope| {
1215 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
1216 envelope.deref_unchecked::<u8>()
1217 })
1218 }),
1219
1220 parent_level: wire.table.get(2).map(|envelope| {
1221 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
1222 envelope.deref_unchecked::<u8>()
1223 })
1224 }),
1225 }
1226 }
1227 }
1228
1229 #[doc = " Describes the relationship between the `PowerLevel`s of two\n `PowerElement`s. `child` is the name of the `PowerElement` which has\n `PowerLevel`s that depend on `parent`.\n + `child` is the name for a `PowerElement` which a driver owns.\n + `parent` is the name for a `PowerElement` which a driver has access to\n + `level_deps` is the map of level dependencies from `child` to `parent`.\n"]
1230 #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1231 pub struct PowerDependency {
1232 pub child: ::core::option::Option<::std::string::String>,
1233
1234 pub parent: ::core::option::Option<crate::natural::ParentElement>,
1235
1236 pub level_deps: ::core::option::Option<::std::vec::Vec<crate::natural::LevelTuple>>,
1237 }
1238
1239 impl PowerDependency {
1240 fn __max_ordinal(&self) -> usize {
1241 if self.level_deps.is_some() {
1242 return 3;
1243 }
1244
1245 if self.parent.is_some() {
1246 return 2;
1247 }
1248
1249 if self.child.is_some() {
1250 return 1;
1251 }
1252
1253 0
1254 }
1255 }
1256
1257 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerDependency<'static>, ___E>
1258 for PowerDependency
1259 where
1260 ___E: ::fidl_next::Encoder + ?Sized,
1261 {
1262 #[inline]
1263 fn encode(
1264 mut self,
1265 encoder: &mut ___E,
1266 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerDependency<'static>>,
1267 _: (),
1268 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1269 ::fidl_next::munge!(let crate::wire::PowerDependency { table } = out);
1270
1271 let max_ord = self.__max_ordinal();
1272
1273 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1274 ::fidl_next::Wire::zero_padding(&mut out);
1275
1276 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1277 ::fidl_next::wire::Envelope,
1278 >(encoder, max_ord);
1279
1280 for i in 1..=max_ord {
1281 match i {
1282 3 => {
1283 if let Some(value) = self.level_deps.take() {
1284 ::fidl_next::wire::Envelope::encode_value::<
1285 ::fidl_next::wire::Vector<
1286 'static,
1287 crate::wire::LevelTuple<'static>,
1288 >,
1289 ___E,
1290 >(
1291 value, preallocated.encoder, &mut out, (128, ())
1292 )?;
1293 } else {
1294 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1295 }
1296 }
1297
1298 2 => {
1299 if let Some(value) = self.parent.take() {
1300 ::fidl_next::wire::Envelope::encode_value::<
1301 crate::wire::ParentElement<'static>,
1302 ___E,
1303 >(
1304 value, preallocated.encoder, &mut out, ()
1305 )?;
1306 } else {
1307 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1308 }
1309 }
1310
1311 1 => {
1312 if let Some(value) = self.child.take() {
1313 ::fidl_next::wire::Envelope::encode_value::<
1314 ::fidl_next::wire::String<'static>,
1315 ___E,
1316 >(
1317 value, preallocated.encoder, &mut out, 63
1318 )?;
1319 } else {
1320 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1321 }
1322 }
1323
1324 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1325 }
1326 unsafe {
1327 preallocated.write_next(out.assume_init_ref());
1328 }
1329 }
1330
1331 ::fidl_next::wire::Table::encode_len(table, max_ord);
1332
1333 Ok(())
1334 }
1335 }
1336
1337 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::PowerDependency<'static>, ___E>
1338 for &'a PowerDependency
1339 where
1340 ___E: ::fidl_next::Encoder + ?Sized,
1341 {
1342 #[inline]
1343 fn encode(
1344 self,
1345 encoder: &mut ___E,
1346 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerDependency<'static>>,
1347 _: (),
1348 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1349 ::fidl_next::munge!(let crate::wire::PowerDependency { table } = out);
1350
1351 let max_ord = self.__max_ordinal();
1352
1353 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1354 ::fidl_next::Wire::zero_padding(&mut out);
1355
1356 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1357 ::fidl_next::wire::Envelope,
1358 >(encoder, max_ord);
1359
1360 for i in 1..=max_ord {
1361 match i {
1362 3 => {
1363 if let Some(value) = &self.level_deps {
1364 ::fidl_next::wire::Envelope::encode_value::<
1365 ::fidl_next::wire::Vector<
1366 'static,
1367 crate::wire::LevelTuple<'static>,
1368 >,
1369 ___E,
1370 >(
1371 value, preallocated.encoder, &mut out, (128, ())
1372 )?;
1373 } else {
1374 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1375 }
1376 }
1377
1378 2 => {
1379 if let Some(value) = &self.parent {
1380 ::fidl_next::wire::Envelope::encode_value::<
1381 crate::wire::ParentElement<'static>,
1382 ___E,
1383 >(
1384 value, preallocated.encoder, &mut out, ()
1385 )?;
1386 } else {
1387 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1388 }
1389 }
1390
1391 1 => {
1392 if let Some(value) = &self.child {
1393 ::fidl_next::wire::Envelope::encode_value::<
1394 ::fidl_next::wire::String<'static>,
1395 ___E,
1396 >(
1397 value, preallocated.encoder, &mut out, 63
1398 )?;
1399 } else {
1400 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1401 }
1402 }
1403
1404 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1405 }
1406 unsafe {
1407 preallocated.write_next(out.assume_init_ref());
1408 }
1409 }
1410
1411 ::fidl_next::wire::Table::encode_len(table, max_ord);
1412
1413 Ok(())
1414 }
1415 }
1416
1417 impl<'de> ::fidl_next::FromWire<crate::wire::PowerDependency<'de>> for PowerDependency {
1418 #[inline]
1419 fn from_wire(wire_: crate::wire::PowerDependency<'de>) -> Self {
1420 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1421
1422 let child = wire_.table.get(1);
1423
1424 let parent = wire_.table.get(2);
1425
1426 let level_deps = wire_.table.get(3);
1427
1428 Self {
1429
1430
1431 child: child.map(|envelope| ::fidl_next::FromWire::from_wire(
1432 unsafe { envelope.read_unchecked::<::fidl_next::wire::String<'de>>() }
1433 )),
1434
1435
1436 parent: parent.map(|envelope| ::fidl_next::FromWire::from_wire(
1437 unsafe { envelope.read_unchecked::<crate::wire::ParentElement<'de>>() }
1438 )),
1439
1440
1441 level_deps: level_deps.map(|envelope| ::fidl_next::FromWire::from_wire(
1442 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>>() }
1443 )),
1444
1445 }
1446 }
1447 }
1448
1449 impl<'de> ::fidl_next::FromWireRef<crate::wire::PowerDependency<'de>> for PowerDependency {
1450 #[inline]
1451 fn from_wire_ref(wire: &crate::wire::PowerDependency<'de>) -> Self {
1452 Self {
1453
1454
1455 child: wire.table.get(1)
1456 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
1457 unsafe { envelope.deref_unchecked::<::fidl_next::wire::String<'de>>() }
1458 )),
1459
1460
1461 parent: wire.table.get(2)
1462 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
1463 unsafe { envelope.deref_unchecked::<crate::wire::ParentElement<'de>>() }
1464 )),
1465
1466
1467 level_deps: wire.table.get(3)
1468 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
1469 unsafe { envelope.deref_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>>() }
1470 )),
1471
1472 }
1473 }
1474 }
1475
1476 #[doc = " Contains the `PowerElement` description and any dependencies it has on\n other `PowerElement`s.\n"]
1477 #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1478 pub struct PowerElementConfiguration {
1479 pub element: ::core::option::Option<crate::natural::PowerElement>,
1480
1481 pub dependencies: ::core::option::Option<::std::vec::Vec<crate::natural::PowerDependency>>,
1482 }
1483
1484 impl PowerElementConfiguration {
1485 fn __max_ordinal(&self) -> usize {
1486 if self.dependencies.is_some() {
1487 return 2;
1488 }
1489
1490 if self.element.is_some() {
1491 return 1;
1492 }
1493
1494 0
1495 }
1496 }
1497
1498 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerElementConfiguration<'static>, ___E>
1499 for PowerElementConfiguration
1500 where
1501 ___E: ::fidl_next::Encoder + ?Sized,
1502 {
1503 #[inline]
1504 fn encode(
1505 mut self,
1506 encoder: &mut ___E,
1507 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerElementConfiguration<'static>>,
1508 _: (),
1509 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1510 ::fidl_next::munge!(let crate::wire::PowerElementConfiguration { table } = out);
1511
1512 let max_ord = self.__max_ordinal();
1513
1514 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1515 ::fidl_next::Wire::zero_padding(&mut out);
1516
1517 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1518 ::fidl_next::wire::Envelope,
1519 >(encoder, max_ord);
1520
1521 for i in 1..=max_ord {
1522 match i {
1523 2 => {
1524 if let Some(value) = self.dependencies.take() {
1525 ::fidl_next::wire::Envelope::encode_value::<
1526 ::fidl_next::wire::Vector<
1527 'static,
1528 crate::wire::PowerDependency<'static>,
1529 >,
1530 ___E,
1531 >(
1532 value, preallocated.encoder, &mut out, (128, ())
1533 )?;
1534 } else {
1535 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1536 }
1537 }
1538
1539 1 => {
1540 if let Some(value) = self.element.take() {
1541 ::fidl_next::wire::Envelope::encode_value::<
1542 crate::wire::PowerElement<'static>,
1543 ___E,
1544 >(
1545 value, preallocated.encoder, &mut out, ()
1546 )?;
1547 } else {
1548 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1549 }
1550 }
1551
1552 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1553 }
1554 unsafe {
1555 preallocated.write_next(out.assume_init_ref());
1556 }
1557 }
1558
1559 ::fidl_next::wire::Table::encode_len(table, max_ord);
1560
1561 Ok(())
1562 }
1563 }
1564
1565 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::PowerElementConfiguration<'static>, ___E>
1566 for &'a PowerElementConfiguration
1567 where
1568 ___E: ::fidl_next::Encoder + ?Sized,
1569 {
1570 #[inline]
1571 fn encode(
1572 self,
1573 encoder: &mut ___E,
1574 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerElementConfiguration<'static>>,
1575 _: (),
1576 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1577 ::fidl_next::munge!(let crate::wire::PowerElementConfiguration { table } = out);
1578
1579 let max_ord = self.__max_ordinal();
1580
1581 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1582 ::fidl_next::Wire::zero_padding(&mut out);
1583
1584 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1585 ::fidl_next::wire::Envelope,
1586 >(encoder, max_ord);
1587
1588 for i in 1..=max_ord {
1589 match i {
1590 2 => {
1591 if let Some(value) = &self.dependencies {
1592 ::fidl_next::wire::Envelope::encode_value::<
1593 ::fidl_next::wire::Vector<
1594 'static,
1595 crate::wire::PowerDependency<'static>,
1596 >,
1597 ___E,
1598 >(
1599 value, preallocated.encoder, &mut out, (128, ())
1600 )?;
1601 } else {
1602 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1603 }
1604 }
1605
1606 1 => {
1607 if let Some(value) = &self.element {
1608 ::fidl_next::wire::Envelope::encode_value::<
1609 crate::wire::PowerElement<'static>,
1610 ___E,
1611 >(
1612 value, preallocated.encoder, &mut out, ()
1613 )?;
1614 } else {
1615 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1616 }
1617 }
1618
1619 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1620 }
1621 unsafe {
1622 preallocated.write_next(out.assume_init_ref());
1623 }
1624 }
1625
1626 ::fidl_next::wire::Table::encode_len(table, max_ord);
1627
1628 Ok(())
1629 }
1630 }
1631
1632 impl<'de> ::fidl_next::FromWire<crate::wire::PowerElementConfiguration<'de>>
1633 for PowerElementConfiguration
1634 {
1635 #[inline]
1636 fn from_wire(wire_: crate::wire::PowerElementConfiguration<'de>) -> Self {
1637 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1638
1639 let element = wire_.table.get(1);
1640
1641 let dependencies = wire_.table.get(2);
1642
1643 Self {
1644
1645
1646 element: element.map(|envelope| ::fidl_next::FromWire::from_wire(
1647 unsafe { envelope.read_unchecked::<crate::wire::PowerElement<'de>>() }
1648 )),
1649
1650
1651 dependencies: dependencies.map(|envelope| ::fidl_next::FromWire::from_wire(
1652 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>>() }
1653 )),
1654
1655 }
1656 }
1657 }
1658
1659 impl<'de> ::fidl_next::FromWireRef<crate::wire::PowerElementConfiguration<'de>>
1660 for PowerElementConfiguration
1661 {
1662 #[inline]
1663 fn from_wire_ref(wire: &crate::wire::PowerElementConfiguration<'de>) -> Self {
1664 Self {
1665
1666
1667 element: wire.table.get(1)
1668 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
1669 unsafe { envelope.deref_unchecked::<crate::wire::PowerElement<'de>>() }
1670 )),
1671
1672
1673 dependencies: wire.table.get(2)
1674 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
1675 unsafe { envelope.deref_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>>() }
1676 )),
1677
1678 }
1679 }
1680 }
1681
1682 #[doc = " The configuration for a component\'s power elements.\n"]
1683 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1684 pub struct ComponentPowerConfiguration {
1685 pub power_elements: ::std::vec::Vec<crate::natural::PowerElementConfiguration>,
1686 }
1687
1688 unsafe impl<___E> ::fidl_next::Encode<crate::wire::ComponentPowerConfiguration<'static>, ___E>
1689 for ComponentPowerConfiguration
1690 where
1691 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1692 ___E: ::fidl_next::Encoder,
1693 {
1694 #[inline]
1695 fn encode(
1696 self,
1697 encoder_: &mut ___E,
1698 out_: &mut ::core::mem::MaybeUninit<crate::wire::ComponentPowerConfiguration<'static>>,
1699 _: (),
1700 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1701 ::fidl_next::munge! {
1702 let crate::wire::ComponentPowerConfiguration {
1703 power_elements,
1704
1705 } = out_;
1706 }
1707
1708 ::fidl_next::Encode::encode(self.power_elements, encoder_, power_elements, (32, ()))?;
1709
1710 let mut _field =
1711 unsafe { ::fidl_next::Slot::new_unchecked(power_elements.as_mut_ptr()) };
1712 ::fidl_next::Constrained::validate(_field, (32, ()))?;
1713
1714 Ok(())
1715 }
1716 }
1717
1718 unsafe impl<'a, ___E>
1719 ::fidl_next::Encode<crate::wire::ComponentPowerConfiguration<'static>, ___E>
1720 for &'a ComponentPowerConfiguration
1721 where
1722 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1723 ___E: ::fidl_next::Encoder,
1724 {
1725 #[inline]
1726 fn encode(
1727 self,
1728 encoder_: &mut ___E,
1729 out_: &mut ::core::mem::MaybeUninit<crate::wire::ComponentPowerConfiguration<'static>>,
1730 _: (),
1731 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1732 ::fidl_next::munge! {
1733 let crate::wire::ComponentPowerConfiguration {
1734 power_elements,
1735
1736 } = out_;
1737 }
1738
1739 ::fidl_next::Encode::encode(&self.power_elements, encoder_, power_elements, (32, ()))?;
1740
1741 let mut _field =
1742 unsafe { ::fidl_next::Slot::new_unchecked(power_elements.as_mut_ptr()) };
1743 ::fidl_next::Constrained::validate(_field, (32, ()))?;
1744
1745 Ok(())
1746 }
1747 }
1748
1749 unsafe impl<___E>
1750 ::fidl_next::EncodeOption<
1751 ::fidl_next::wire::Box<'static, crate::wire::ComponentPowerConfiguration<'static>>,
1752 ___E,
1753 > for ComponentPowerConfiguration
1754 where
1755 ___E: ::fidl_next::Encoder + ?Sized,
1756 ComponentPowerConfiguration:
1757 ::fidl_next::Encode<crate::wire::ComponentPowerConfiguration<'static>, ___E>,
1758 {
1759 #[inline]
1760 fn encode_option(
1761 this: ::core::option::Option<Self>,
1762 encoder: &mut ___E,
1763 out: &mut ::core::mem::MaybeUninit<
1764 ::fidl_next::wire::Box<'static, crate::wire::ComponentPowerConfiguration<'static>>,
1765 >,
1766 _: (),
1767 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1768 if let Some(inner) = this {
1769 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1770 ::fidl_next::wire::Box::encode_present(out);
1771 } else {
1772 ::fidl_next::wire::Box::encode_absent(out);
1773 }
1774
1775 Ok(())
1776 }
1777 }
1778
1779 unsafe impl<'a, ___E>
1780 ::fidl_next::EncodeOption<
1781 ::fidl_next::wire::Box<'static, crate::wire::ComponentPowerConfiguration<'static>>,
1782 ___E,
1783 > for &'a ComponentPowerConfiguration
1784 where
1785 ___E: ::fidl_next::Encoder + ?Sized,
1786 &'a ComponentPowerConfiguration:
1787 ::fidl_next::Encode<crate::wire::ComponentPowerConfiguration<'static>, ___E>,
1788 {
1789 #[inline]
1790 fn encode_option(
1791 this: ::core::option::Option<Self>,
1792 encoder: &mut ___E,
1793 out: &mut ::core::mem::MaybeUninit<
1794 ::fidl_next::wire::Box<'static, crate::wire::ComponentPowerConfiguration<'static>>,
1795 >,
1796 _: (),
1797 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1798 if let Some(inner) = this {
1799 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1800 ::fidl_next::wire::Box::encode_present(out);
1801 } else {
1802 ::fidl_next::wire::Box::encode_absent(out);
1803 }
1804
1805 Ok(())
1806 }
1807 }
1808
1809 impl<'de> ::fidl_next::FromWire<crate::wire::ComponentPowerConfiguration<'de>>
1810 for ComponentPowerConfiguration
1811 {
1812 #[inline]
1813 fn from_wire(wire: crate::wire::ComponentPowerConfiguration<'de>) -> Self {
1814 Self { power_elements: ::fidl_next::FromWire::from_wire(wire.power_elements) }
1815 }
1816 }
1817
1818 impl<'de> ::fidl_next::FromWireRef<crate::wire::ComponentPowerConfiguration<'de>>
1819 for ComponentPowerConfiguration
1820 {
1821 #[inline]
1822 fn from_wire_ref(wire: &crate::wire::ComponentPowerConfiguration<'de>) -> Self {
1823 Self { power_elements: ::fidl_next::FromWireRef::from_wire_ref(&wire.power_elements) }
1824 }
1825 }
1826
1827 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1828 #[repr(C)]
1829 pub struct DeviceRegisterPowerDomainRequest {
1830 pub min_needed_voltage: u32,
1831
1832 pub max_supported_voltage: u32,
1833 }
1834
1835 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceRegisterPowerDomainRequest, ___E>
1836 for DeviceRegisterPowerDomainRequest
1837 where
1838 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1839 {
1840 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1841 Self,
1842 crate::wire::DeviceRegisterPowerDomainRequest,
1843 > = unsafe {
1844 ::fidl_next::CopyOptimization::enable_if(
1845 true
1846
1847 && <
1848 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
1849 >::COPY_OPTIMIZATION.is_enabled()
1850
1851 && <
1852 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
1853 >::COPY_OPTIMIZATION.is_enabled()
1854
1855 )
1856 };
1857
1858 #[inline]
1859 fn encode(
1860 self,
1861 encoder_: &mut ___E,
1862 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRegisterPowerDomainRequest>,
1863 _: (),
1864 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1865 ::fidl_next::munge! {
1866 let crate::wire::DeviceRegisterPowerDomainRequest {
1867 min_needed_voltage,
1868 max_supported_voltage,
1869
1870 } = out_;
1871 }
1872
1873 ::fidl_next::Encode::encode(self.min_needed_voltage, encoder_, min_needed_voltage, ())?;
1874
1875 let mut _field =
1876 unsafe { ::fidl_next::Slot::new_unchecked(min_needed_voltage.as_mut_ptr()) };
1877
1878 ::fidl_next::Encode::encode(
1879 self.max_supported_voltage,
1880 encoder_,
1881 max_supported_voltage,
1882 (),
1883 )?;
1884
1885 let mut _field =
1886 unsafe { ::fidl_next::Slot::new_unchecked(max_supported_voltage.as_mut_ptr()) };
1887
1888 Ok(())
1889 }
1890 }
1891
1892 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceRegisterPowerDomainRequest, ___E>
1893 for &'a DeviceRegisterPowerDomainRequest
1894 where
1895 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1896 {
1897 #[inline]
1898 fn encode(
1899 self,
1900 encoder_: &mut ___E,
1901 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRegisterPowerDomainRequest>,
1902 _: (),
1903 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1904 ::fidl_next::munge! {
1905 let crate::wire::DeviceRegisterPowerDomainRequest {
1906 min_needed_voltage,
1907 max_supported_voltage,
1908
1909 } = out_;
1910 }
1911
1912 ::fidl_next::Encode::encode(
1913 &self.min_needed_voltage,
1914 encoder_,
1915 min_needed_voltage,
1916 (),
1917 )?;
1918
1919 let mut _field =
1920 unsafe { ::fidl_next::Slot::new_unchecked(min_needed_voltage.as_mut_ptr()) };
1921
1922 ::fidl_next::Encode::encode(
1923 &self.max_supported_voltage,
1924 encoder_,
1925 max_supported_voltage,
1926 (),
1927 )?;
1928
1929 let mut _field =
1930 unsafe { ::fidl_next::Slot::new_unchecked(max_supported_voltage.as_mut_ptr()) };
1931
1932 Ok(())
1933 }
1934 }
1935
1936 unsafe impl<___E>
1937 ::fidl_next::EncodeOption<
1938 ::fidl_next::wire::Box<'static, crate::wire::DeviceRegisterPowerDomainRequest>,
1939 ___E,
1940 > for DeviceRegisterPowerDomainRequest
1941 where
1942 ___E: ::fidl_next::Encoder + ?Sized,
1943 DeviceRegisterPowerDomainRequest:
1944 ::fidl_next::Encode<crate::wire::DeviceRegisterPowerDomainRequest, ___E>,
1945 {
1946 #[inline]
1947 fn encode_option(
1948 this: ::core::option::Option<Self>,
1949 encoder: &mut ___E,
1950 out: &mut ::core::mem::MaybeUninit<
1951 ::fidl_next::wire::Box<'static, crate::wire::DeviceRegisterPowerDomainRequest>,
1952 >,
1953 _: (),
1954 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1955 if let Some(inner) = this {
1956 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1957 ::fidl_next::wire::Box::encode_present(out);
1958 } else {
1959 ::fidl_next::wire::Box::encode_absent(out);
1960 }
1961
1962 Ok(())
1963 }
1964 }
1965
1966 unsafe impl<'a, ___E>
1967 ::fidl_next::EncodeOption<
1968 ::fidl_next::wire::Box<'static, crate::wire::DeviceRegisterPowerDomainRequest>,
1969 ___E,
1970 > for &'a DeviceRegisterPowerDomainRequest
1971 where
1972 ___E: ::fidl_next::Encoder + ?Sized,
1973 &'a DeviceRegisterPowerDomainRequest:
1974 ::fidl_next::Encode<crate::wire::DeviceRegisterPowerDomainRequest, ___E>,
1975 {
1976 #[inline]
1977 fn encode_option(
1978 this: ::core::option::Option<Self>,
1979 encoder: &mut ___E,
1980 out: &mut ::core::mem::MaybeUninit<
1981 ::fidl_next::wire::Box<'static, crate::wire::DeviceRegisterPowerDomainRequest>,
1982 >,
1983 _: (),
1984 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1985 if let Some(inner) = this {
1986 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1987 ::fidl_next::wire::Box::encode_present(out);
1988 } else {
1989 ::fidl_next::wire::Box::encode_absent(out);
1990 }
1991
1992 Ok(())
1993 }
1994 }
1995
1996 impl ::fidl_next::FromWire<crate::wire::DeviceRegisterPowerDomainRequest>
1997 for DeviceRegisterPowerDomainRequest
1998 {
1999 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2000 crate::wire::DeviceRegisterPowerDomainRequest,
2001 Self,
2002 > = unsafe {
2003 ::fidl_next::CopyOptimization::enable_if(
2004 true
2005 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
2006 .is_enabled()
2007 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
2008 .is_enabled(),
2009 )
2010 };
2011
2012 #[inline]
2013 fn from_wire(wire: crate::wire::DeviceRegisterPowerDomainRequest) -> Self {
2014 Self {
2015 min_needed_voltage: ::fidl_next::FromWire::from_wire(wire.min_needed_voltage),
2016
2017 max_supported_voltage: ::fidl_next::FromWire::from_wire(wire.max_supported_voltage),
2018 }
2019 }
2020 }
2021
2022 impl ::fidl_next::FromWireRef<crate::wire::DeviceRegisterPowerDomainRequest>
2023 for DeviceRegisterPowerDomainRequest
2024 {
2025 #[inline]
2026 fn from_wire_ref(wire: &crate::wire::DeviceRegisterPowerDomainRequest) -> Self {
2027 Self {
2028 min_needed_voltage: ::fidl_next::FromWireRef::from_wire_ref(
2029 &wire.min_needed_voltage,
2030 ),
2031
2032 max_supported_voltage: ::fidl_next::FromWireRef::from_wire_ref(
2033 &wire.max_supported_voltage,
2034 ),
2035 }
2036 }
2037 }
2038
2039 pub type DeviceRegisterPowerDomainResponse = ();
2040
2041 pub type DeviceUnregisterPowerDomainResponse = ();
2042
2043 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2044 #[repr(C)]
2045 pub struct DeviceGetSupportedVoltageRangeResponse {
2046 pub min: u32,
2047
2048 pub max: u32,
2049 }
2050
2051 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetSupportedVoltageRangeResponse, ___E>
2052 for DeviceGetSupportedVoltageRangeResponse
2053 where
2054 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2055 {
2056 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2057 Self,
2058 crate::wire::DeviceGetSupportedVoltageRangeResponse,
2059 > = unsafe {
2060 ::fidl_next::CopyOptimization::enable_if(
2061 true
2062
2063 && <
2064 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
2065 >::COPY_OPTIMIZATION.is_enabled()
2066
2067 && <
2068 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
2069 >::COPY_OPTIMIZATION.is_enabled()
2070
2071 )
2072 };
2073
2074 #[inline]
2075 fn encode(
2076 self,
2077 encoder_: &mut ___E,
2078 out_: &mut ::core::mem::MaybeUninit<
2079 crate::wire::DeviceGetSupportedVoltageRangeResponse,
2080 >,
2081 _: (),
2082 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2083 ::fidl_next::munge! {
2084 let crate::wire::DeviceGetSupportedVoltageRangeResponse {
2085 min,
2086 max,
2087
2088 } = out_;
2089 }
2090
2091 ::fidl_next::Encode::encode(self.min, encoder_, min, ())?;
2092
2093 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(min.as_mut_ptr()) };
2094
2095 ::fidl_next::Encode::encode(self.max, encoder_, max, ())?;
2096
2097 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(max.as_mut_ptr()) };
2098
2099 Ok(())
2100 }
2101 }
2102
2103 unsafe impl<'a, ___E>
2104 ::fidl_next::Encode<crate::wire::DeviceGetSupportedVoltageRangeResponse, ___E>
2105 for &'a DeviceGetSupportedVoltageRangeResponse
2106 where
2107 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2108 {
2109 #[inline]
2110 fn encode(
2111 self,
2112 encoder_: &mut ___E,
2113 out_: &mut ::core::mem::MaybeUninit<
2114 crate::wire::DeviceGetSupportedVoltageRangeResponse,
2115 >,
2116 _: (),
2117 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2118 ::fidl_next::munge! {
2119 let crate::wire::DeviceGetSupportedVoltageRangeResponse {
2120 min,
2121 max,
2122
2123 } = out_;
2124 }
2125
2126 ::fidl_next::Encode::encode(&self.min, encoder_, min, ())?;
2127
2128 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(min.as_mut_ptr()) };
2129
2130 ::fidl_next::Encode::encode(&self.max, encoder_, max, ())?;
2131
2132 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(max.as_mut_ptr()) };
2133
2134 Ok(())
2135 }
2136 }
2137
2138 unsafe impl<___E>
2139 ::fidl_next::EncodeOption<
2140 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetSupportedVoltageRangeResponse>,
2141 ___E,
2142 > for DeviceGetSupportedVoltageRangeResponse
2143 where
2144 ___E: ::fidl_next::Encoder + ?Sized,
2145 DeviceGetSupportedVoltageRangeResponse:
2146 ::fidl_next::Encode<crate::wire::DeviceGetSupportedVoltageRangeResponse, ___E>,
2147 {
2148 #[inline]
2149 fn encode_option(
2150 this: ::core::option::Option<Self>,
2151 encoder: &mut ___E,
2152 out: &mut ::core::mem::MaybeUninit<
2153 ::fidl_next::wire::Box<
2154 'static,
2155 crate::wire::DeviceGetSupportedVoltageRangeResponse,
2156 >,
2157 >,
2158 _: (),
2159 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2160 if let Some(inner) = this {
2161 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2162 ::fidl_next::wire::Box::encode_present(out);
2163 } else {
2164 ::fidl_next::wire::Box::encode_absent(out);
2165 }
2166
2167 Ok(())
2168 }
2169 }
2170
2171 unsafe impl<'a, ___E>
2172 ::fidl_next::EncodeOption<
2173 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetSupportedVoltageRangeResponse>,
2174 ___E,
2175 > for &'a DeviceGetSupportedVoltageRangeResponse
2176 where
2177 ___E: ::fidl_next::Encoder + ?Sized,
2178 &'a DeviceGetSupportedVoltageRangeResponse:
2179 ::fidl_next::Encode<crate::wire::DeviceGetSupportedVoltageRangeResponse, ___E>,
2180 {
2181 #[inline]
2182 fn encode_option(
2183 this: ::core::option::Option<Self>,
2184 encoder: &mut ___E,
2185 out: &mut ::core::mem::MaybeUninit<
2186 ::fidl_next::wire::Box<
2187 'static,
2188 crate::wire::DeviceGetSupportedVoltageRangeResponse,
2189 >,
2190 >,
2191 _: (),
2192 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2193 if let Some(inner) = this {
2194 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2195 ::fidl_next::wire::Box::encode_present(out);
2196 } else {
2197 ::fidl_next::wire::Box::encode_absent(out);
2198 }
2199
2200 Ok(())
2201 }
2202 }
2203
2204 impl ::fidl_next::FromWire<crate::wire::DeviceGetSupportedVoltageRangeResponse>
2205 for DeviceGetSupportedVoltageRangeResponse
2206 {
2207 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2208 crate::wire::DeviceGetSupportedVoltageRangeResponse,
2209 Self,
2210 > = unsafe {
2211 ::fidl_next::CopyOptimization::enable_if(
2212 true
2213 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
2214 .is_enabled()
2215 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
2216 .is_enabled(),
2217 )
2218 };
2219
2220 #[inline]
2221 fn from_wire(wire: crate::wire::DeviceGetSupportedVoltageRangeResponse) -> Self {
2222 Self {
2223 min: ::fidl_next::FromWire::from_wire(wire.min),
2224
2225 max: ::fidl_next::FromWire::from_wire(wire.max),
2226 }
2227 }
2228 }
2229
2230 impl ::fidl_next::FromWireRef<crate::wire::DeviceGetSupportedVoltageRangeResponse>
2231 for DeviceGetSupportedVoltageRangeResponse
2232 {
2233 #[inline]
2234 fn from_wire_ref(wire: &crate::wire::DeviceGetSupportedVoltageRangeResponse) -> Self {
2235 Self {
2236 min: ::fidl_next::FromWireRef::from_wire_ref(&wire.min),
2237
2238 max: ::fidl_next::FromWireRef::from_wire_ref(&wire.max),
2239 }
2240 }
2241 }
2242
2243 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2244 #[repr(C)]
2245 pub struct DeviceRequestVoltageRequest {
2246 pub voltage: u32,
2247 }
2248
2249 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceRequestVoltageRequest, ___E>
2250 for DeviceRequestVoltageRequest
2251 where
2252 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2253 {
2254 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2255 Self,
2256 crate::wire::DeviceRequestVoltageRequest,
2257 > = unsafe {
2258 ::fidl_next::CopyOptimization::enable_if(
2259 true
2260
2261 && <
2262 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
2263 >::COPY_OPTIMIZATION.is_enabled()
2264
2265 )
2266 };
2267
2268 #[inline]
2269 fn encode(
2270 self,
2271 encoder_: &mut ___E,
2272 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRequestVoltageRequest>,
2273 _: (),
2274 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2275 ::fidl_next::munge! {
2276 let crate::wire::DeviceRequestVoltageRequest {
2277 voltage,
2278
2279 } = out_;
2280 }
2281
2282 ::fidl_next::Encode::encode(self.voltage, encoder_, voltage, ())?;
2283
2284 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(voltage.as_mut_ptr()) };
2285
2286 Ok(())
2287 }
2288 }
2289
2290 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceRequestVoltageRequest, ___E>
2291 for &'a DeviceRequestVoltageRequest
2292 where
2293 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2294 {
2295 #[inline]
2296 fn encode(
2297 self,
2298 encoder_: &mut ___E,
2299 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRequestVoltageRequest>,
2300 _: (),
2301 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2302 ::fidl_next::munge! {
2303 let crate::wire::DeviceRequestVoltageRequest {
2304 voltage,
2305
2306 } = out_;
2307 }
2308
2309 ::fidl_next::Encode::encode(&self.voltage, encoder_, voltage, ())?;
2310
2311 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(voltage.as_mut_ptr()) };
2312
2313 Ok(())
2314 }
2315 }
2316
2317 unsafe impl<___E>
2318 ::fidl_next::EncodeOption<
2319 ::fidl_next::wire::Box<'static, crate::wire::DeviceRequestVoltageRequest>,
2320 ___E,
2321 > for DeviceRequestVoltageRequest
2322 where
2323 ___E: ::fidl_next::Encoder + ?Sized,
2324 DeviceRequestVoltageRequest:
2325 ::fidl_next::Encode<crate::wire::DeviceRequestVoltageRequest, ___E>,
2326 {
2327 #[inline]
2328 fn encode_option(
2329 this: ::core::option::Option<Self>,
2330 encoder: &mut ___E,
2331 out: &mut ::core::mem::MaybeUninit<
2332 ::fidl_next::wire::Box<'static, crate::wire::DeviceRequestVoltageRequest>,
2333 >,
2334 _: (),
2335 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2336 if let Some(inner) = this {
2337 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2338 ::fidl_next::wire::Box::encode_present(out);
2339 } else {
2340 ::fidl_next::wire::Box::encode_absent(out);
2341 }
2342
2343 Ok(())
2344 }
2345 }
2346
2347 unsafe impl<'a, ___E>
2348 ::fidl_next::EncodeOption<
2349 ::fidl_next::wire::Box<'static, crate::wire::DeviceRequestVoltageRequest>,
2350 ___E,
2351 > for &'a DeviceRequestVoltageRequest
2352 where
2353 ___E: ::fidl_next::Encoder + ?Sized,
2354 &'a DeviceRequestVoltageRequest:
2355 ::fidl_next::Encode<crate::wire::DeviceRequestVoltageRequest, ___E>,
2356 {
2357 #[inline]
2358 fn encode_option(
2359 this: ::core::option::Option<Self>,
2360 encoder: &mut ___E,
2361 out: &mut ::core::mem::MaybeUninit<
2362 ::fidl_next::wire::Box<'static, crate::wire::DeviceRequestVoltageRequest>,
2363 >,
2364 _: (),
2365 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2366 if let Some(inner) = this {
2367 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2368 ::fidl_next::wire::Box::encode_present(out);
2369 } else {
2370 ::fidl_next::wire::Box::encode_absent(out);
2371 }
2372
2373 Ok(())
2374 }
2375 }
2376
2377 impl ::fidl_next::FromWire<crate::wire::DeviceRequestVoltageRequest>
2378 for DeviceRequestVoltageRequest
2379 {
2380 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2381 crate::wire::DeviceRequestVoltageRequest,
2382 Self,
2383 > = unsafe {
2384 ::fidl_next::CopyOptimization::enable_if(
2385 true
2386 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
2387 .is_enabled(),
2388 )
2389 };
2390
2391 #[inline]
2392 fn from_wire(wire: crate::wire::DeviceRequestVoltageRequest) -> Self {
2393 Self { voltage: ::fidl_next::FromWire::from_wire(wire.voltage) }
2394 }
2395 }
2396
2397 impl ::fidl_next::FromWireRef<crate::wire::DeviceRequestVoltageRequest>
2398 for DeviceRequestVoltageRequest
2399 {
2400 #[inline]
2401 fn from_wire_ref(wire: &crate::wire::DeviceRequestVoltageRequest) -> Self {
2402 Self { voltage: ::fidl_next::FromWireRef::from_wire_ref(&wire.voltage) }
2403 }
2404 }
2405
2406 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2407 #[repr(C)]
2408 pub struct DeviceRequestVoltageResponse {
2409 pub actual_voltage: u32,
2410 }
2411
2412 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceRequestVoltageResponse, ___E>
2413 for DeviceRequestVoltageResponse
2414 where
2415 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2416 {
2417 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2418 Self,
2419 crate::wire::DeviceRequestVoltageResponse,
2420 > = unsafe {
2421 ::fidl_next::CopyOptimization::enable_if(
2422 true
2423
2424 && <
2425 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
2426 >::COPY_OPTIMIZATION.is_enabled()
2427
2428 )
2429 };
2430
2431 #[inline]
2432 fn encode(
2433 self,
2434 encoder_: &mut ___E,
2435 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRequestVoltageResponse>,
2436 _: (),
2437 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2438 ::fidl_next::munge! {
2439 let crate::wire::DeviceRequestVoltageResponse {
2440 actual_voltage,
2441
2442 } = out_;
2443 }
2444
2445 ::fidl_next::Encode::encode(self.actual_voltage, encoder_, actual_voltage, ())?;
2446
2447 let mut _field =
2448 unsafe { ::fidl_next::Slot::new_unchecked(actual_voltage.as_mut_ptr()) };
2449
2450 Ok(())
2451 }
2452 }
2453
2454 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceRequestVoltageResponse, ___E>
2455 for &'a DeviceRequestVoltageResponse
2456 where
2457 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2458 {
2459 #[inline]
2460 fn encode(
2461 self,
2462 encoder_: &mut ___E,
2463 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRequestVoltageResponse>,
2464 _: (),
2465 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2466 ::fidl_next::munge! {
2467 let crate::wire::DeviceRequestVoltageResponse {
2468 actual_voltage,
2469
2470 } = out_;
2471 }
2472
2473 ::fidl_next::Encode::encode(&self.actual_voltage, encoder_, actual_voltage, ())?;
2474
2475 let mut _field =
2476 unsafe { ::fidl_next::Slot::new_unchecked(actual_voltage.as_mut_ptr()) };
2477
2478 Ok(())
2479 }
2480 }
2481
2482 unsafe impl<___E>
2483 ::fidl_next::EncodeOption<
2484 ::fidl_next::wire::Box<'static, crate::wire::DeviceRequestVoltageResponse>,
2485 ___E,
2486 > for DeviceRequestVoltageResponse
2487 where
2488 ___E: ::fidl_next::Encoder + ?Sized,
2489 DeviceRequestVoltageResponse:
2490 ::fidl_next::Encode<crate::wire::DeviceRequestVoltageResponse, ___E>,
2491 {
2492 #[inline]
2493 fn encode_option(
2494 this: ::core::option::Option<Self>,
2495 encoder: &mut ___E,
2496 out: &mut ::core::mem::MaybeUninit<
2497 ::fidl_next::wire::Box<'static, crate::wire::DeviceRequestVoltageResponse>,
2498 >,
2499 _: (),
2500 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2501 if let Some(inner) = this {
2502 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2503 ::fidl_next::wire::Box::encode_present(out);
2504 } else {
2505 ::fidl_next::wire::Box::encode_absent(out);
2506 }
2507
2508 Ok(())
2509 }
2510 }
2511
2512 unsafe impl<'a, ___E>
2513 ::fidl_next::EncodeOption<
2514 ::fidl_next::wire::Box<'static, crate::wire::DeviceRequestVoltageResponse>,
2515 ___E,
2516 > for &'a DeviceRequestVoltageResponse
2517 where
2518 ___E: ::fidl_next::Encoder + ?Sized,
2519 &'a DeviceRequestVoltageResponse:
2520 ::fidl_next::Encode<crate::wire::DeviceRequestVoltageResponse, ___E>,
2521 {
2522 #[inline]
2523 fn encode_option(
2524 this: ::core::option::Option<Self>,
2525 encoder: &mut ___E,
2526 out: &mut ::core::mem::MaybeUninit<
2527 ::fidl_next::wire::Box<'static, crate::wire::DeviceRequestVoltageResponse>,
2528 >,
2529 _: (),
2530 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2531 if let Some(inner) = this {
2532 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2533 ::fidl_next::wire::Box::encode_present(out);
2534 } else {
2535 ::fidl_next::wire::Box::encode_absent(out);
2536 }
2537
2538 Ok(())
2539 }
2540 }
2541
2542 impl ::fidl_next::FromWire<crate::wire::DeviceRequestVoltageResponse>
2543 for DeviceRequestVoltageResponse
2544 {
2545 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2546 crate::wire::DeviceRequestVoltageResponse,
2547 Self,
2548 > = unsafe {
2549 ::fidl_next::CopyOptimization::enable_if(
2550 true
2551 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
2552 .is_enabled(),
2553 )
2554 };
2555
2556 #[inline]
2557 fn from_wire(wire: crate::wire::DeviceRequestVoltageResponse) -> Self {
2558 Self { actual_voltage: ::fidl_next::FromWire::from_wire(wire.actual_voltage) }
2559 }
2560 }
2561
2562 impl ::fidl_next::FromWireRef<crate::wire::DeviceRequestVoltageResponse>
2563 for DeviceRequestVoltageResponse
2564 {
2565 #[inline]
2566 fn from_wire_ref(wire: &crate::wire::DeviceRequestVoltageResponse) -> Self {
2567 Self { actual_voltage: ::fidl_next::FromWireRef::from_wire_ref(&wire.actual_voltage) }
2568 }
2569 }
2570
2571 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2572 #[repr(C)]
2573 pub struct DeviceGetCurrentVoltageRequest {
2574 pub index: u32,
2575 }
2576
2577 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageRequest, ___E>
2578 for DeviceGetCurrentVoltageRequest
2579 where
2580 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2581 {
2582 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2583 Self,
2584 crate::wire::DeviceGetCurrentVoltageRequest,
2585 > = unsafe {
2586 ::fidl_next::CopyOptimization::enable_if(
2587 true
2588
2589 && <
2590 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
2591 >::COPY_OPTIMIZATION.is_enabled()
2592
2593 )
2594 };
2595
2596 #[inline]
2597 fn encode(
2598 self,
2599 encoder_: &mut ___E,
2600 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetCurrentVoltageRequest>,
2601 _: (),
2602 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2603 ::fidl_next::munge! {
2604 let crate::wire::DeviceGetCurrentVoltageRequest {
2605 index,
2606
2607 } = out_;
2608 }
2609
2610 ::fidl_next::Encode::encode(self.index, encoder_, index, ())?;
2611
2612 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(index.as_mut_ptr()) };
2613
2614 Ok(())
2615 }
2616 }
2617
2618 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageRequest, ___E>
2619 for &'a DeviceGetCurrentVoltageRequest
2620 where
2621 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2622 {
2623 #[inline]
2624 fn encode(
2625 self,
2626 encoder_: &mut ___E,
2627 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetCurrentVoltageRequest>,
2628 _: (),
2629 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2630 ::fidl_next::munge! {
2631 let crate::wire::DeviceGetCurrentVoltageRequest {
2632 index,
2633
2634 } = out_;
2635 }
2636
2637 ::fidl_next::Encode::encode(&self.index, encoder_, index, ())?;
2638
2639 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(index.as_mut_ptr()) };
2640
2641 Ok(())
2642 }
2643 }
2644
2645 unsafe impl<___E>
2646 ::fidl_next::EncodeOption<
2647 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetCurrentVoltageRequest>,
2648 ___E,
2649 > for DeviceGetCurrentVoltageRequest
2650 where
2651 ___E: ::fidl_next::Encoder + ?Sized,
2652 DeviceGetCurrentVoltageRequest:
2653 ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageRequest, ___E>,
2654 {
2655 #[inline]
2656 fn encode_option(
2657 this: ::core::option::Option<Self>,
2658 encoder: &mut ___E,
2659 out: &mut ::core::mem::MaybeUninit<
2660 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetCurrentVoltageRequest>,
2661 >,
2662 _: (),
2663 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2664 if let Some(inner) = this {
2665 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2666 ::fidl_next::wire::Box::encode_present(out);
2667 } else {
2668 ::fidl_next::wire::Box::encode_absent(out);
2669 }
2670
2671 Ok(())
2672 }
2673 }
2674
2675 unsafe impl<'a, ___E>
2676 ::fidl_next::EncodeOption<
2677 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetCurrentVoltageRequest>,
2678 ___E,
2679 > for &'a DeviceGetCurrentVoltageRequest
2680 where
2681 ___E: ::fidl_next::Encoder + ?Sized,
2682 &'a DeviceGetCurrentVoltageRequest:
2683 ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageRequest, ___E>,
2684 {
2685 #[inline]
2686 fn encode_option(
2687 this: ::core::option::Option<Self>,
2688 encoder: &mut ___E,
2689 out: &mut ::core::mem::MaybeUninit<
2690 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetCurrentVoltageRequest>,
2691 >,
2692 _: (),
2693 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2694 if let Some(inner) = this {
2695 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2696 ::fidl_next::wire::Box::encode_present(out);
2697 } else {
2698 ::fidl_next::wire::Box::encode_absent(out);
2699 }
2700
2701 Ok(())
2702 }
2703 }
2704
2705 impl ::fidl_next::FromWire<crate::wire::DeviceGetCurrentVoltageRequest>
2706 for DeviceGetCurrentVoltageRequest
2707 {
2708 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2709 crate::wire::DeviceGetCurrentVoltageRequest,
2710 Self,
2711 > = unsafe {
2712 ::fidl_next::CopyOptimization::enable_if(
2713 true
2714 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
2715 .is_enabled(),
2716 )
2717 };
2718
2719 #[inline]
2720 fn from_wire(wire: crate::wire::DeviceGetCurrentVoltageRequest) -> Self {
2721 Self { index: ::fidl_next::FromWire::from_wire(wire.index) }
2722 }
2723 }
2724
2725 impl ::fidl_next::FromWireRef<crate::wire::DeviceGetCurrentVoltageRequest>
2726 for DeviceGetCurrentVoltageRequest
2727 {
2728 #[inline]
2729 fn from_wire_ref(wire: &crate::wire::DeviceGetCurrentVoltageRequest) -> Self {
2730 Self { index: ::fidl_next::FromWireRef::from_wire_ref(&wire.index) }
2731 }
2732 }
2733
2734 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2735 #[repr(C)]
2736 pub struct DeviceGetCurrentVoltageResponse {
2737 pub current_voltage: u32,
2738 }
2739
2740 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageResponse, ___E>
2741 for DeviceGetCurrentVoltageResponse
2742 where
2743 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2744 {
2745 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2746 Self,
2747 crate::wire::DeviceGetCurrentVoltageResponse,
2748 > = unsafe {
2749 ::fidl_next::CopyOptimization::enable_if(
2750 true
2751
2752 && <
2753 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
2754 >::COPY_OPTIMIZATION.is_enabled()
2755
2756 )
2757 };
2758
2759 #[inline]
2760 fn encode(
2761 self,
2762 encoder_: &mut ___E,
2763 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetCurrentVoltageResponse>,
2764 _: (),
2765 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2766 ::fidl_next::munge! {
2767 let crate::wire::DeviceGetCurrentVoltageResponse {
2768 current_voltage,
2769
2770 } = out_;
2771 }
2772
2773 ::fidl_next::Encode::encode(self.current_voltage, encoder_, current_voltage, ())?;
2774
2775 let mut _field =
2776 unsafe { ::fidl_next::Slot::new_unchecked(current_voltage.as_mut_ptr()) };
2777
2778 Ok(())
2779 }
2780 }
2781
2782 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageResponse, ___E>
2783 for &'a DeviceGetCurrentVoltageResponse
2784 where
2785 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
2786 {
2787 #[inline]
2788 fn encode(
2789 self,
2790 encoder_: &mut ___E,
2791 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetCurrentVoltageResponse>,
2792 _: (),
2793 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2794 ::fidl_next::munge! {
2795 let crate::wire::DeviceGetCurrentVoltageResponse {
2796 current_voltage,
2797
2798 } = out_;
2799 }
2800
2801 ::fidl_next::Encode::encode(&self.current_voltage, encoder_, current_voltage, ())?;
2802
2803 let mut _field =
2804 unsafe { ::fidl_next::Slot::new_unchecked(current_voltage.as_mut_ptr()) };
2805
2806 Ok(())
2807 }
2808 }
2809
2810 unsafe impl<___E>
2811 ::fidl_next::EncodeOption<
2812 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetCurrentVoltageResponse>,
2813 ___E,
2814 > for DeviceGetCurrentVoltageResponse
2815 where
2816 ___E: ::fidl_next::Encoder + ?Sized,
2817 DeviceGetCurrentVoltageResponse:
2818 ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageResponse, ___E>,
2819 {
2820 #[inline]
2821 fn encode_option(
2822 this: ::core::option::Option<Self>,
2823 encoder: &mut ___E,
2824 out: &mut ::core::mem::MaybeUninit<
2825 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetCurrentVoltageResponse>,
2826 >,
2827 _: (),
2828 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2829 if let Some(inner) = this {
2830 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2831 ::fidl_next::wire::Box::encode_present(out);
2832 } else {
2833 ::fidl_next::wire::Box::encode_absent(out);
2834 }
2835
2836 Ok(())
2837 }
2838 }
2839
2840 unsafe impl<'a, ___E>
2841 ::fidl_next::EncodeOption<
2842 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetCurrentVoltageResponse>,
2843 ___E,
2844 > for &'a DeviceGetCurrentVoltageResponse
2845 where
2846 ___E: ::fidl_next::Encoder + ?Sized,
2847 &'a DeviceGetCurrentVoltageResponse:
2848 ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageResponse, ___E>,
2849 {
2850 #[inline]
2851 fn encode_option(
2852 this: ::core::option::Option<Self>,
2853 encoder: &mut ___E,
2854 out: &mut ::core::mem::MaybeUninit<
2855 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetCurrentVoltageResponse>,
2856 >,
2857 _: (),
2858 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2859 if let Some(inner) = this {
2860 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2861 ::fidl_next::wire::Box::encode_present(out);
2862 } else {
2863 ::fidl_next::wire::Box::encode_absent(out);
2864 }
2865
2866 Ok(())
2867 }
2868 }
2869
2870 impl ::fidl_next::FromWire<crate::wire::DeviceGetCurrentVoltageResponse>
2871 for DeviceGetCurrentVoltageResponse
2872 {
2873 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
2874 crate::wire::DeviceGetCurrentVoltageResponse,
2875 Self,
2876 > = unsafe {
2877 ::fidl_next::CopyOptimization::enable_if(
2878 true
2879 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
2880 .is_enabled(),
2881 )
2882 };
2883
2884 #[inline]
2885 fn from_wire(wire: crate::wire::DeviceGetCurrentVoltageResponse) -> Self {
2886 Self { current_voltage: ::fidl_next::FromWire::from_wire(wire.current_voltage) }
2887 }
2888 }
2889
2890 impl ::fidl_next::FromWireRef<crate::wire::DeviceGetCurrentVoltageResponse>
2891 for DeviceGetCurrentVoltageResponse
2892 {
2893 #[inline]
2894 fn from_wire_ref(wire: &crate::wire::DeviceGetCurrentVoltageResponse) -> Self {
2895 Self { current_voltage: ::fidl_next::FromWireRef::from_wire_ref(&wire.current_voltage) }
2896 }
2897 }
2898
2899 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2900 #[repr(u8)]
2901 pub enum PowerDomainStatus {
2902 Disabled = 1,
2903 Enabled = 2,
2904 }
2905 impl ::core::convert::TryFrom<u8> for PowerDomainStatus {
2906 type Error = ::fidl_next::UnknownStrictEnumMemberError;
2907 fn try_from(
2908 value: u8,
2909 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
2910 match value {
2911 1 => Ok(Self::Disabled),
2912 2 => Ok(Self::Enabled),
2913
2914 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
2915 }
2916 }
2917 }
2918
2919 impl ::std::convert::From<PowerDomainStatus> for u8 {
2920 fn from(value: PowerDomainStatus) -> Self {
2921 match value {
2922 PowerDomainStatus::Disabled => 1,
2923 PowerDomainStatus::Enabled => 2,
2924 }
2925 }
2926 }
2927
2928 unsafe impl<___E> ::fidl_next::Encode<crate::wire::PowerDomainStatus, ___E> for PowerDomainStatus
2929 where
2930 ___E: ?Sized,
2931 {
2932 #[inline]
2933 fn encode(
2934 self,
2935 encoder: &mut ___E,
2936 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerDomainStatus>,
2937 _: (),
2938 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2939 ::fidl_next::Encode::encode(&self, encoder, out, ())
2940 }
2941 }
2942
2943 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::PowerDomainStatus, ___E>
2944 for &'a PowerDomainStatus
2945 where
2946 ___E: ?Sized,
2947 {
2948 #[inline]
2949 fn encode(
2950 self,
2951 encoder: &mut ___E,
2952 out: &mut ::core::mem::MaybeUninit<crate::wire::PowerDomainStatus>,
2953 _: (),
2954 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2955 ::fidl_next::munge!(let crate::wire::PowerDomainStatus { value } = out);
2956 let _ = value.write(u8::from(match *self {
2957 PowerDomainStatus::Disabled => 1,
2958
2959 PowerDomainStatus::Enabled => 2,
2960 }));
2961
2962 Ok(())
2963 }
2964 }
2965
2966 impl ::core::convert::From<crate::wire::PowerDomainStatus> for PowerDomainStatus {
2967 fn from(wire: crate::wire::PowerDomainStatus) -> Self {
2968 match u8::from(wire.value) {
2969 1 => Self::Disabled,
2970
2971 2 => Self::Enabled,
2972
2973 _ => unsafe { ::core::hint::unreachable_unchecked() },
2974 }
2975 }
2976 }
2977
2978 impl ::fidl_next::FromWire<crate::wire::PowerDomainStatus> for PowerDomainStatus {
2979 #[inline]
2980 fn from_wire(wire: crate::wire::PowerDomainStatus) -> Self {
2981 Self::from(wire)
2982 }
2983 }
2984
2985 impl ::fidl_next::FromWireRef<crate::wire::PowerDomainStatus> for PowerDomainStatus {
2986 #[inline]
2987 fn from_wire_ref(wire: &crate::wire::PowerDomainStatus) -> Self {
2988 Self::from(*wire)
2989 }
2990 }
2991
2992 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2993 #[repr(C)]
2994 pub struct DeviceGetPowerDomainStatusResponse {
2995 pub status: crate::natural::PowerDomainStatus,
2996 }
2997
2998 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceGetPowerDomainStatusResponse, ___E>
2999 for DeviceGetPowerDomainStatusResponse
3000 where
3001 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3002 {
3003 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
3004 Self,
3005 crate::wire::DeviceGetPowerDomainStatusResponse,
3006 > = unsafe {
3007 ::fidl_next::CopyOptimization::enable_if(
3008 true && <crate::natural::PowerDomainStatus as ::fidl_next::Encode<
3009 crate::wire::PowerDomainStatus,
3010 ___E,
3011 >>::COPY_OPTIMIZATION
3012 .is_enabled(),
3013 )
3014 };
3015
3016 #[inline]
3017 fn encode(
3018 self,
3019 encoder_: &mut ___E,
3020 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetPowerDomainStatusResponse>,
3021 _: (),
3022 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3023 ::fidl_next::munge! {
3024 let crate::wire::DeviceGetPowerDomainStatusResponse {
3025 status,
3026
3027 } = out_;
3028 }
3029
3030 ::fidl_next::Encode::encode(self.status, encoder_, status, ())?;
3031
3032 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(status.as_mut_ptr()) };
3033
3034 Ok(())
3035 }
3036 }
3037
3038 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceGetPowerDomainStatusResponse, ___E>
3039 for &'a DeviceGetPowerDomainStatusResponse
3040 where
3041 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3042 {
3043 #[inline]
3044 fn encode(
3045 self,
3046 encoder_: &mut ___E,
3047 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetPowerDomainStatusResponse>,
3048 _: (),
3049 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3050 ::fidl_next::munge! {
3051 let crate::wire::DeviceGetPowerDomainStatusResponse {
3052 status,
3053
3054 } = out_;
3055 }
3056
3057 ::fidl_next::Encode::encode(&self.status, encoder_, status, ())?;
3058
3059 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(status.as_mut_ptr()) };
3060
3061 Ok(())
3062 }
3063 }
3064
3065 unsafe impl<___E>
3066 ::fidl_next::EncodeOption<
3067 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetPowerDomainStatusResponse>,
3068 ___E,
3069 > for DeviceGetPowerDomainStatusResponse
3070 where
3071 ___E: ::fidl_next::Encoder + ?Sized,
3072 DeviceGetPowerDomainStatusResponse:
3073 ::fidl_next::Encode<crate::wire::DeviceGetPowerDomainStatusResponse, ___E>,
3074 {
3075 #[inline]
3076 fn encode_option(
3077 this: ::core::option::Option<Self>,
3078 encoder: &mut ___E,
3079 out: &mut ::core::mem::MaybeUninit<
3080 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetPowerDomainStatusResponse>,
3081 >,
3082 _: (),
3083 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3084 if let Some(inner) = this {
3085 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
3086 ::fidl_next::wire::Box::encode_present(out);
3087 } else {
3088 ::fidl_next::wire::Box::encode_absent(out);
3089 }
3090
3091 Ok(())
3092 }
3093 }
3094
3095 unsafe impl<'a, ___E>
3096 ::fidl_next::EncodeOption<
3097 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetPowerDomainStatusResponse>,
3098 ___E,
3099 > for &'a DeviceGetPowerDomainStatusResponse
3100 where
3101 ___E: ::fidl_next::Encoder + ?Sized,
3102 &'a DeviceGetPowerDomainStatusResponse:
3103 ::fidl_next::Encode<crate::wire::DeviceGetPowerDomainStatusResponse, ___E>,
3104 {
3105 #[inline]
3106 fn encode_option(
3107 this: ::core::option::Option<Self>,
3108 encoder: &mut ___E,
3109 out: &mut ::core::mem::MaybeUninit<
3110 ::fidl_next::wire::Box<'static, crate::wire::DeviceGetPowerDomainStatusResponse>,
3111 >,
3112 _: (),
3113 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3114 if let Some(inner) = this {
3115 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
3116 ::fidl_next::wire::Box::encode_present(out);
3117 } else {
3118 ::fidl_next::wire::Box::encode_absent(out);
3119 }
3120
3121 Ok(())
3122 }
3123 }
3124
3125 impl ::fidl_next::FromWire<crate::wire::DeviceGetPowerDomainStatusResponse>
3126 for DeviceGetPowerDomainStatusResponse
3127 {
3128 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
3129 crate::wire::DeviceGetPowerDomainStatusResponse,
3130 Self,
3131 > = unsafe {
3132 ::fidl_next::CopyOptimization::enable_if(
3133 true && <crate::natural::PowerDomainStatus as ::fidl_next::FromWire<
3134 crate::wire::PowerDomainStatus,
3135 >>::COPY_OPTIMIZATION
3136 .is_enabled(),
3137 )
3138 };
3139
3140 #[inline]
3141 fn from_wire(wire: crate::wire::DeviceGetPowerDomainStatusResponse) -> Self {
3142 Self { status: ::fidl_next::FromWire::from_wire(wire.status) }
3143 }
3144 }
3145
3146 impl ::fidl_next::FromWireRef<crate::wire::DeviceGetPowerDomainStatusResponse>
3147 for DeviceGetPowerDomainStatusResponse
3148 {
3149 #[inline]
3150 fn from_wire_ref(wire: &crate::wire::DeviceGetPowerDomainStatusResponse) -> Self {
3151 Self { status: ::fidl_next::FromWireRef::from_wire_ref(&wire.status) }
3152 }
3153 }
3154
3155 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3156 #[repr(C)]
3157 pub struct DeviceWritePmicCtrlRegRequest {
3158 pub reg_addr: u32,
3159
3160 pub value: u32,
3161 }
3162
3163 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceWritePmicCtrlRegRequest, ___E>
3164 for DeviceWritePmicCtrlRegRequest
3165 where
3166 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3167 {
3168 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
3169 Self,
3170 crate::wire::DeviceWritePmicCtrlRegRequest,
3171 > = unsafe {
3172 ::fidl_next::CopyOptimization::enable_if(
3173 true
3174
3175 && <
3176 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
3177 >::COPY_OPTIMIZATION.is_enabled()
3178
3179 && <
3180 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
3181 >::COPY_OPTIMIZATION.is_enabled()
3182
3183 )
3184 };
3185
3186 #[inline]
3187 fn encode(
3188 self,
3189 encoder_: &mut ___E,
3190 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWritePmicCtrlRegRequest>,
3191 _: (),
3192 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3193 ::fidl_next::munge! {
3194 let crate::wire::DeviceWritePmicCtrlRegRequest {
3195 reg_addr,
3196 value,
3197
3198 } = out_;
3199 }
3200
3201 ::fidl_next::Encode::encode(self.reg_addr, encoder_, reg_addr, ())?;
3202
3203 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(reg_addr.as_mut_ptr()) };
3204
3205 ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
3206
3207 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
3208
3209 Ok(())
3210 }
3211 }
3212
3213 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceWritePmicCtrlRegRequest, ___E>
3214 for &'a DeviceWritePmicCtrlRegRequest
3215 where
3216 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3217 {
3218 #[inline]
3219 fn encode(
3220 self,
3221 encoder_: &mut ___E,
3222 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWritePmicCtrlRegRequest>,
3223 _: (),
3224 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3225 ::fidl_next::munge! {
3226 let crate::wire::DeviceWritePmicCtrlRegRequest {
3227 reg_addr,
3228 value,
3229
3230 } = out_;
3231 }
3232
3233 ::fidl_next::Encode::encode(&self.reg_addr, encoder_, reg_addr, ())?;
3234
3235 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(reg_addr.as_mut_ptr()) };
3236
3237 ::fidl_next::Encode::encode(&self.value, encoder_, value, ())?;
3238
3239 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
3240
3241 Ok(())
3242 }
3243 }
3244
3245 unsafe impl<___E>
3246 ::fidl_next::EncodeOption<
3247 ::fidl_next::wire::Box<'static, crate::wire::DeviceWritePmicCtrlRegRequest>,
3248 ___E,
3249 > for DeviceWritePmicCtrlRegRequest
3250 where
3251 ___E: ::fidl_next::Encoder + ?Sized,
3252 DeviceWritePmicCtrlRegRequest:
3253 ::fidl_next::Encode<crate::wire::DeviceWritePmicCtrlRegRequest, ___E>,
3254 {
3255 #[inline]
3256 fn encode_option(
3257 this: ::core::option::Option<Self>,
3258 encoder: &mut ___E,
3259 out: &mut ::core::mem::MaybeUninit<
3260 ::fidl_next::wire::Box<'static, crate::wire::DeviceWritePmicCtrlRegRequest>,
3261 >,
3262 _: (),
3263 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3264 if let Some(inner) = this {
3265 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
3266 ::fidl_next::wire::Box::encode_present(out);
3267 } else {
3268 ::fidl_next::wire::Box::encode_absent(out);
3269 }
3270
3271 Ok(())
3272 }
3273 }
3274
3275 unsafe impl<'a, ___E>
3276 ::fidl_next::EncodeOption<
3277 ::fidl_next::wire::Box<'static, crate::wire::DeviceWritePmicCtrlRegRequest>,
3278 ___E,
3279 > for &'a DeviceWritePmicCtrlRegRequest
3280 where
3281 ___E: ::fidl_next::Encoder + ?Sized,
3282 &'a DeviceWritePmicCtrlRegRequest:
3283 ::fidl_next::Encode<crate::wire::DeviceWritePmicCtrlRegRequest, ___E>,
3284 {
3285 #[inline]
3286 fn encode_option(
3287 this: ::core::option::Option<Self>,
3288 encoder: &mut ___E,
3289 out: &mut ::core::mem::MaybeUninit<
3290 ::fidl_next::wire::Box<'static, crate::wire::DeviceWritePmicCtrlRegRequest>,
3291 >,
3292 _: (),
3293 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3294 if let Some(inner) = this {
3295 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
3296 ::fidl_next::wire::Box::encode_present(out);
3297 } else {
3298 ::fidl_next::wire::Box::encode_absent(out);
3299 }
3300
3301 Ok(())
3302 }
3303 }
3304
3305 impl ::fidl_next::FromWire<crate::wire::DeviceWritePmicCtrlRegRequest>
3306 for DeviceWritePmicCtrlRegRequest
3307 {
3308 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
3309 crate::wire::DeviceWritePmicCtrlRegRequest,
3310 Self,
3311 > = unsafe {
3312 ::fidl_next::CopyOptimization::enable_if(
3313 true
3314 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
3315 .is_enabled()
3316 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
3317 .is_enabled(),
3318 )
3319 };
3320
3321 #[inline]
3322 fn from_wire(wire: crate::wire::DeviceWritePmicCtrlRegRequest) -> Self {
3323 Self {
3324 reg_addr: ::fidl_next::FromWire::from_wire(wire.reg_addr),
3325
3326 value: ::fidl_next::FromWire::from_wire(wire.value),
3327 }
3328 }
3329 }
3330
3331 impl ::fidl_next::FromWireRef<crate::wire::DeviceWritePmicCtrlRegRequest>
3332 for DeviceWritePmicCtrlRegRequest
3333 {
3334 #[inline]
3335 fn from_wire_ref(wire: &crate::wire::DeviceWritePmicCtrlRegRequest) -> Self {
3336 Self {
3337 reg_addr: ::fidl_next::FromWireRef::from_wire_ref(&wire.reg_addr),
3338
3339 value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value),
3340 }
3341 }
3342 }
3343
3344 pub type DeviceWritePmicCtrlRegResponse = ();
3345
3346 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3347 #[repr(C)]
3348 pub struct DeviceReadPmicCtrlRegRequest {
3349 pub reg_addr: u32,
3350 }
3351
3352 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegRequest, ___E>
3353 for DeviceReadPmicCtrlRegRequest
3354 where
3355 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3356 {
3357 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
3358 Self,
3359 crate::wire::DeviceReadPmicCtrlRegRequest,
3360 > = unsafe {
3361 ::fidl_next::CopyOptimization::enable_if(
3362 true
3363
3364 && <
3365 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
3366 >::COPY_OPTIMIZATION.is_enabled()
3367
3368 )
3369 };
3370
3371 #[inline]
3372 fn encode(
3373 self,
3374 encoder_: &mut ___E,
3375 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadPmicCtrlRegRequest>,
3376 _: (),
3377 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3378 ::fidl_next::munge! {
3379 let crate::wire::DeviceReadPmicCtrlRegRequest {
3380 reg_addr,
3381
3382 } = out_;
3383 }
3384
3385 ::fidl_next::Encode::encode(self.reg_addr, encoder_, reg_addr, ())?;
3386
3387 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(reg_addr.as_mut_ptr()) };
3388
3389 Ok(())
3390 }
3391 }
3392
3393 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegRequest, ___E>
3394 for &'a DeviceReadPmicCtrlRegRequest
3395 where
3396 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3397 {
3398 #[inline]
3399 fn encode(
3400 self,
3401 encoder_: &mut ___E,
3402 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadPmicCtrlRegRequest>,
3403 _: (),
3404 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3405 ::fidl_next::munge! {
3406 let crate::wire::DeviceReadPmicCtrlRegRequest {
3407 reg_addr,
3408
3409 } = out_;
3410 }
3411
3412 ::fidl_next::Encode::encode(&self.reg_addr, encoder_, reg_addr, ())?;
3413
3414 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(reg_addr.as_mut_ptr()) };
3415
3416 Ok(())
3417 }
3418 }
3419
3420 unsafe impl<___E>
3421 ::fidl_next::EncodeOption<
3422 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadPmicCtrlRegRequest>,
3423 ___E,
3424 > for DeviceReadPmicCtrlRegRequest
3425 where
3426 ___E: ::fidl_next::Encoder + ?Sized,
3427 DeviceReadPmicCtrlRegRequest:
3428 ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegRequest, ___E>,
3429 {
3430 #[inline]
3431 fn encode_option(
3432 this: ::core::option::Option<Self>,
3433 encoder: &mut ___E,
3434 out: &mut ::core::mem::MaybeUninit<
3435 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadPmicCtrlRegRequest>,
3436 >,
3437 _: (),
3438 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3439 if let Some(inner) = this {
3440 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
3441 ::fidl_next::wire::Box::encode_present(out);
3442 } else {
3443 ::fidl_next::wire::Box::encode_absent(out);
3444 }
3445
3446 Ok(())
3447 }
3448 }
3449
3450 unsafe impl<'a, ___E>
3451 ::fidl_next::EncodeOption<
3452 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadPmicCtrlRegRequest>,
3453 ___E,
3454 > for &'a DeviceReadPmicCtrlRegRequest
3455 where
3456 ___E: ::fidl_next::Encoder + ?Sized,
3457 &'a DeviceReadPmicCtrlRegRequest:
3458 ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegRequest, ___E>,
3459 {
3460 #[inline]
3461 fn encode_option(
3462 this: ::core::option::Option<Self>,
3463 encoder: &mut ___E,
3464 out: &mut ::core::mem::MaybeUninit<
3465 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadPmicCtrlRegRequest>,
3466 >,
3467 _: (),
3468 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3469 if let Some(inner) = this {
3470 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
3471 ::fidl_next::wire::Box::encode_present(out);
3472 } else {
3473 ::fidl_next::wire::Box::encode_absent(out);
3474 }
3475
3476 Ok(())
3477 }
3478 }
3479
3480 impl ::fidl_next::FromWire<crate::wire::DeviceReadPmicCtrlRegRequest>
3481 for DeviceReadPmicCtrlRegRequest
3482 {
3483 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
3484 crate::wire::DeviceReadPmicCtrlRegRequest,
3485 Self,
3486 > = unsafe {
3487 ::fidl_next::CopyOptimization::enable_if(
3488 true
3489 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
3490 .is_enabled(),
3491 )
3492 };
3493
3494 #[inline]
3495 fn from_wire(wire: crate::wire::DeviceReadPmicCtrlRegRequest) -> Self {
3496 Self { reg_addr: ::fidl_next::FromWire::from_wire(wire.reg_addr) }
3497 }
3498 }
3499
3500 impl ::fidl_next::FromWireRef<crate::wire::DeviceReadPmicCtrlRegRequest>
3501 for DeviceReadPmicCtrlRegRequest
3502 {
3503 #[inline]
3504 fn from_wire_ref(wire: &crate::wire::DeviceReadPmicCtrlRegRequest) -> Self {
3505 Self { reg_addr: ::fidl_next::FromWireRef::from_wire_ref(&wire.reg_addr) }
3506 }
3507 }
3508
3509 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3510 #[repr(C)]
3511 pub struct DeviceReadPmicCtrlRegResponse {
3512 pub value: u32,
3513 }
3514
3515 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegResponse, ___E>
3516 for DeviceReadPmicCtrlRegResponse
3517 where
3518 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3519 {
3520 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
3521 Self,
3522 crate::wire::DeviceReadPmicCtrlRegResponse,
3523 > = unsafe {
3524 ::fidl_next::CopyOptimization::enable_if(
3525 true
3526
3527 && <
3528 u32 as ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>
3529 >::COPY_OPTIMIZATION.is_enabled()
3530
3531 )
3532 };
3533
3534 #[inline]
3535 fn encode(
3536 self,
3537 encoder_: &mut ___E,
3538 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadPmicCtrlRegResponse>,
3539 _: (),
3540 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3541 ::fidl_next::munge! {
3542 let crate::wire::DeviceReadPmicCtrlRegResponse {
3543 value,
3544
3545 } = out_;
3546 }
3547
3548 ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
3549
3550 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
3551
3552 Ok(())
3553 }
3554 }
3555
3556 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegResponse, ___E>
3557 for &'a DeviceReadPmicCtrlRegResponse
3558 where
3559 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3560 {
3561 #[inline]
3562 fn encode(
3563 self,
3564 encoder_: &mut ___E,
3565 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadPmicCtrlRegResponse>,
3566 _: (),
3567 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3568 ::fidl_next::munge! {
3569 let crate::wire::DeviceReadPmicCtrlRegResponse {
3570 value,
3571
3572 } = out_;
3573 }
3574
3575 ::fidl_next::Encode::encode(&self.value, encoder_, value, ())?;
3576
3577 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
3578
3579 Ok(())
3580 }
3581 }
3582
3583 unsafe impl<___E>
3584 ::fidl_next::EncodeOption<
3585 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadPmicCtrlRegResponse>,
3586 ___E,
3587 > for DeviceReadPmicCtrlRegResponse
3588 where
3589 ___E: ::fidl_next::Encoder + ?Sized,
3590 DeviceReadPmicCtrlRegResponse:
3591 ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegResponse, ___E>,
3592 {
3593 #[inline]
3594 fn encode_option(
3595 this: ::core::option::Option<Self>,
3596 encoder: &mut ___E,
3597 out: &mut ::core::mem::MaybeUninit<
3598 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadPmicCtrlRegResponse>,
3599 >,
3600 _: (),
3601 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3602 if let Some(inner) = this {
3603 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
3604 ::fidl_next::wire::Box::encode_present(out);
3605 } else {
3606 ::fidl_next::wire::Box::encode_absent(out);
3607 }
3608
3609 Ok(())
3610 }
3611 }
3612
3613 unsafe impl<'a, ___E>
3614 ::fidl_next::EncodeOption<
3615 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadPmicCtrlRegResponse>,
3616 ___E,
3617 > for &'a DeviceReadPmicCtrlRegResponse
3618 where
3619 ___E: ::fidl_next::Encoder + ?Sized,
3620 &'a DeviceReadPmicCtrlRegResponse:
3621 ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegResponse, ___E>,
3622 {
3623 #[inline]
3624 fn encode_option(
3625 this: ::core::option::Option<Self>,
3626 encoder: &mut ___E,
3627 out: &mut ::core::mem::MaybeUninit<
3628 ::fidl_next::wire::Box<'static, crate::wire::DeviceReadPmicCtrlRegResponse>,
3629 >,
3630 _: (),
3631 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3632 if let Some(inner) = this {
3633 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
3634 ::fidl_next::wire::Box::encode_present(out);
3635 } else {
3636 ::fidl_next::wire::Box::encode_absent(out);
3637 }
3638
3639 Ok(())
3640 }
3641 }
3642
3643 impl ::fidl_next::FromWire<crate::wire::DeviceReadPmicCtrlRegResponse>
3644 for DeviceReadPmicCtrlRegResponse
3645 {
3646 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
3647 crate::wire::DeviceReadPmicCtrlRegResponse,
3648 Self,
3649 > = unsafe {
3650 ::fidl_next::CopyOptimization::enable_if(
3651 true
3652 && <u32 as ::fidl_next::FromWire<::fidl_next::wire::Uint32>>::COPY_OPTIMIZATION
3653 .is_enabled(),
3654 )
3655 };
3656
3657 #[inline]
3658 fn from_wire(wire: crate::wire::DeviceReadPmicCtrlRegResponse) -> Self {
3659 Self { value: ::fidl_next::FromWire::from_wire(wire.value) }
3660 }
3661 }
3662
3663 impl ::fidl_next::FromWireRef<crate::wire::DeviceReadPmicCtrlRegResponse>
3664 for DeviceReadPmicCtrlRegResponse
3665 {
3666 #[inline]
3667 fn from_wire_ref(wire: &crate::wire::DeviceReadPmicCtrlRegResponse) -> Self {
3668 Self { value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value) }
3669 }
3670 }
3671
3672 #[doc = " Information related to a power domain.\n"]
3673 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3674 pub struct Domain {
3675 pub id: ::core::option::Option<u32>,
3676 }
3677
3678 impl Domain {
3679 fn __max_ordinal(&self) -> usize {
3680 if self.id.is_some() {
3681 return 1;
3682 }
3683
3684 0
3685 }
3686 }
3687
3688 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Domain<'static>, ___E> for Domain
3689 where
3690 ___E: ::fidl_next::Encoder + ?Sized,
3691 {
3692 #[inline]
3693 fn encode(
3694 mut self,
3695 encoder: &mut ___E,
3696 out: &mut ::core::mem::MaybeUninit<crate::wire::Domain<'static>>,
3697 _: (),
3698 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3699 ::fidl_next::munge!(let crate::wire::Domain { table } = out);
3700
3701 let max_ord = self.__max_ordinal();
3702
3703 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
3704 ::fidl_next::Wire::zero_padding(&mut out);
3705
3706 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
3707 ::fidl_next::wire::Envelope,
3708 >(encoder, max_ord);
3709
3710 for i in 1..=max_ord {
3711 match i {
3712 1 => {
3713 if let Some(value) = self.id.take() {
3714 ::fidl_next::wire::Envelope::encode_value::<
3715 ::fidl_next::wire::Uint32,
3716 ___E,
3717 >(
3718 value, preallocated.encoder, &mut out, ()
3719 )?;
3720 } else {
3721 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3722 }
3723 }
3724
3725 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
3726 }
3727 unsafe {
3728 preallocated.write_next(out.assume_init_ref());
3729 }
3730 }
3731
3732 ::fidl_next::wire::Table::encode_len(table, max_ord);
3733
3734 Ok(())
3735 }
3736 }
3737
3738 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Domain<'static>, ___E> for &'a Domain
3739 where
3740 ___E: ::fidl_next::Encoder + ?Sized,
3741 {
3742 #[inline]
3743 fn encode(
3744 self,
3745 encoder: &mut ___E,
3746 out: &mut ::core::mem::MaybeUninit<crate::wire::Domain<'static>>,
3747 _: (),
3748 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3749 ::fidl_next::munge!(let crate::wire::Domain { table } = out);
3750
3751 let max_ord = self.__max_ordinal();
3752
3753 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
3754 ::fidl_next::Wire::zero_padding(&mut out);
3755
3756 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
3757 ::fidl_next::wire::Envelope,
3758 >(encoder, max_ord);
3759
3760 for i in 1..=max_ord {
3761 match i {
3762 1 => {
3763 if let Some(value) = &self.id {
3764 ::fidl_next::wire::Envelope::encode_value::<
3765 ::fidl_next::wire::Uint32,
3766 ___E,
3767 >(
3768 value, preallocated.encoder, &mut out, ()
3769 )?;
3770 } else {
3771 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3772 }
3773 }
3774
3775 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
3776 }
3777 unsafe {
3778 preallocated.write_next(out.assume_init_ref());
3779 }
3780 }
3781
3782 ::fidl_next::wire::Table::encode_len(table, max_ord);
3783
3784 Ok(())
3785 }
3786 }
3787
3788 impl<'de> ::fidl_next::FromWire<crate::wire::Domain<'de>> for Domain {
3789 #[inline]
3790 fn from_wire(wire_: crate::wire::Domain<'de>) -> Self {
3791 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
3792
3793 let id = wire_.table.get(1);
3794
3795 Self {
3796 id: id.map(|envelope| {
3797 ::fidl_next::FromWire::from_wire(unsafe {
3798 envelope.read_unchecked::<::fidl_next::wire::Uint32>()
3799 })
3800 }),
3801 }
3802 }
3803 }
3804
3805 impl<'de> ::fidl_next::FromWireRef<crate::wire::Domain<'de>> for Domain {
3806 #[inline]
3807 fn from_wire_ref(wire: &crate::wire::Domain<'de>) -> Self {
3808 Self {
3809 id: wire.table.get(1).map(|envelope| {
3810 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
3811 envelope.deref_unchecked::<::fidl_next::wire::Uint32>()
3812 })
3813 }),
3814 }
3815 }
3816 }
3817
3818 #[doc = " Passed to the power core driver in metadata.\n"]
3819 #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3820 pub struct DomainMetadata {
3821 pub domains: ::core::option::Option<::std::vec::Vec<crate::natural::Domain>>,
3822 }
3823
3824 impl DomainMetadata {
3825 fn __max_ordinal(&self) -> usize {
3826 if self.domains.is_some() {
3827 return 1;
3828 }
3829
3830 0
3831 }
3832 }
3833
3834 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DomainMetadata<'static>, ___E> for DomainMetadata
3835 where
3836 ___E: ::fidl_next::Encoder + ?Sized,
3837 {
3838 #[inline]
3839 fn encode(
3840 mut self,
3841 encoder: &mut ___E,
3842 out: &mut ::core::mem::MaybeUninit<crate::wire::DomainMetadata<'static>>,
3843 _: (),
3844 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3845 ::fidl_next::munge!(let crate::wire::DomainMetadata { table } = out);
3846
3847 let max_ord = self.__max_ordinal();
3848
3849 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
3850 ::fidl_next::Wire::zero_padding(&mut out);
3851
3852 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
3853 ::fidl_next::wire::Envelope,
3854 >(encoder, max_ord);
3855
3856 for i in 1..=max_ord {
3857 match i {
3858 1 => {
3859 if let Some(value) = self.domains.take() {
3860 ::fidl_next::wire::Envelope::encode_value::<
3861 ::fidl_next::wire::Vector<'static, crate::wire::Domain<'static>>,
3862 ___E,
3863 >(
3864 value, preallocated.encoder, &mut out, (4294967295, ())
3865 )?;
3866 } else {
3867 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3868 }
3869 }
3870
3871 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
3872 }
3873 unsafe {
3874 preallocated.write_next(out.assume_init_ref());
3875 }
3876 }
3877
3878 ::fidl_next::wire::Table::encode_len(table, max_ord);
3879
3880 Ok(())
3881 }
3882 }
3883
3884 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DomainMetadata<'static>, ___E>
3885 for &'a DomainMetadata
3886 where
3887 ___E: ::fidl_next::Encoder + ?Sized,
3888 {
3889 #[inline]
3890 fn encode(
3891 self,
3892 encoder: &mut ___E,
3893 out: &mut ::core::mem::MaybeUninit<crate::wire::DomainMetadata<'static>>,
3894 _: (),
3895 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3896 ::fidl_next::munge!(let crate::wire::DomainMetadata { table } = out);
3897
3898 let max_ord = self.__max_ordinal();
3899
3900 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
3901 ::fidl_next::Wire::zero_padding(&mut out);
3902
3903 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
3904 ::fidl_next::wire::Envelope,
3905 >(encoder, max_ord);
3906
3907 for i in 1..=max_ord {
3908 match i {
3909 1 => {
3910 if let Some(value) = &self.domains {
3911 ::fidl_next::wire::Envelope::encode_value::<
3912 ::fidl_next::wire::Vector<'static, crate::wire::Domain<'static>>,
3913 ___E,
3914 >(
3915 value, preallocated.encoder, &mut out, (4294967295, ())
3916 )?;
3917 } else {
3918 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3919 }
3920 }
3921
3922 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
3923 }
3924 unsafe {
3925 preallocated.write_next(out.assume_init_ref());
3926 }
3927 }
3928
3929 ::fidl_next::wire::Table::encode_len(table, max_ord);
3930
3931 Ok(())
3932 }
3933 }
3934
3935 impl<'de> ::fidl_next::FromWire<crate::wire::DomainMetadata<'de>> for DomainMetadata {
3936 #[inline]
3937 fn from_wire(wire_: crate::wire::DomainMetadata<'de>) -> Self {
3938 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
3939
3940 let domains = wire_.table.get(1);
3941
3942 Self {
3943
3944
3945 domains: domains.map(|envelope| ::fidl_next::FromWire::from_wire(
3946 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>() }
3947 )),
3948
3949 }
3950 }
3951 }
3952
3953 impl<'de> ::fidl_next::FromWireRef<crate::wire::DomainMetadata<'de>> for DomainMetadata {
3954 #[inline]
3955 fn from_wire_ref(wire: &crate::wire::DomainMetadata<'de>) -> Self {
3956 Self {
3957
3958
3959 domains: wire.table.get(1)
3960 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
3961 unsafe { envelope.deref_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>() }
3962 )),
3963
3964 }
3965 }
3966 }
3967
3968 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3969 #[repr(u32)]
3970 pub enum FrameworkElementLevels {
3971 Off = 0,
3972 On = 1,
3973 }
3974 impl ::core::convert::TryFrom<u32> for FrameworkElementLevels {
3975 type Error = ::fidl_next::UnknownStrictEnumMemberError;
3976 fn try_from(
3977 value: u32,
3978 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
3979 match value {
3980 0 => Ok(Self::Off),
3981 1 => Ok(Self::On),
3982
3983 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
3984 }
3985 }
3986 }
3987
3988 impl ::std::convert::From<FrameworkElementLevels> for u32 {
3989 fn from(value: FrameworkElementLevels) -> Self {
3990 match value {
3991 FrameworkElementLevels::Off => 0,
3992 FrameworkElementLevels::On => 1,
3993 }
3994 }
3995 }
3996
3997 unsafe impl<___E> ::fidl_next::Encode<crate::wire::FrameworkElementLevels, ___E>
3998 for FrameworkElementLevels
3999 where
4000 ___E: ?Sized,
4001 {
4002 #[inline]
4003 fn encode(
4004 self,
4005 encoder: &mut ___E,
4006 out: &mut ::core::mem::MaybeUninit<crate::wire::FrameworkElementLevels>,
4007 _: (),
4008 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
4009 ::fidl_next::Encode::encode(&self, encoder, out, ())
4010 }
4011 }
4012
4013 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::FrameworkElementLevels, ___E>
4014 for &'a FrameworkElementLevels
4015 where
4016 ___E: ?Sized,
4017 {
4018 #[inline]
4019 fn encode(
4020 self,
4021 encoder: &mut ___E,
4022 out: &mut ::core::mem::MaybeUninit<crate::wire::FrameworkElementLevels>,
4023 _: (),
4024 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
4025 ::fidl_next::munge!(let crate::wire::FrameworkElementLevels { value } = out);
4026 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
4027 FrameworkElementLevels::Off => 0,
4028
4029 FrameworkElementLevels::On => 1,
4030 }));
4031
4032 Ok(())
4033 }
4034 }
4035
4036 impl ::core::convert::From<crate::wire::FrameworkElementLevels> for FrameworkElementLevels {
4037 fn from(wire: crate::wire::FrameworkElementLevels) -> Self {
4038 match u32::from(wire.value) {
4039 0 => Self::Off,
4040
4041 1 => Self::On,
4042
4043 _ => unsafe { ::core::hint::unreachable_unchecked() },
4044 }
4045 }
4046 }
4047
4048 impl ::fidl_next::FromWire<crate::wire::FrameworkElementLevels> for FrameworkElementLevels {
4049 #[inline]
4050 fn from_wire(wire: crate::wire::FrameworkElementLevels) -> Self {
4051 Self::from(wire)
4052 }
4053 }
4054
4055 impl ::fidl_next::FromWireRef<crate::wire::FrameworkElementLevels> for FrameworkElementLevels {
4056 #[inline]
4057 fn from_wire_ref(wire: &crate::wire::FrameworkElementLevels) -> Self {
4058 Self::from(*wire)
4059 }
4060 }
4061}
4062
4063pub mod wire {
4064
4065 #[repr(C)]
4067 pub struct Transition<'de> {
4068 pub(crate) table: ::fidl_next::wire::Table<'de>,
4069 }
4070
4071 impl<'de> Drop for Transition<'de> {
4072 fn drop(&mut self) {
4073 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
4074
4075 let _ = self
4076 .table
4077 .get(2)
4078 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
4079 }
4080 }
4081
4082 impl ::fidl_next::Constrained for Transition<'_> {
4083 type Constraint = ();
4084
4085 fn validate(
4086 _: ::fidl_next::Slot<'_, Self>,
4087 _: Self::Constraint,
4088 ) -> Result<(), ::fidl_next::ValidationError> {
4089 Ok(())
4090 }
4091 }
4092
4093 unsafe impl ::fidl_next::Wire for Transition<'static> {
4094 type Narrowed<'de> = Transition<'de>;
4095
4096 #[inline]
4097 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4098 ::fidl_next::munge!(let Self { table } = out);
4099 ::fidl_next::wire::Table::zero_padding(table);
4100 }
4101 }
4102
4103 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Transition<'de>
4104 where
4105 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4106 {
4107 fn decode(
4108 slot: ::fidl_next::Slot<'_, Self>,
4109 decoder: &mut ___D,
4110 _: (),
4111 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4112 ::fidl_next::munge!(let Self { table } = slot);
4113
4114 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4115 match ordinal {
4116 0 => unsafe { ::core::hint::unreachable_unchecked() },
4117
4118 1 => {
4119 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
4120 slot.as_mut(),
4121 decoder,
4122 (),
4123 )?;
4124
4125 Ok(())
4126 }
4127
4128 2 => {
4129 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
4130 slot.as_mut(),
4131 decoder,
4132 (),
4133 )?;
4134
4135 Ok(())
4136 }
4137
4138 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4139 }
4140 })
4141 }
4142 }
4143
4144 impl<'de> Transition<'de> {
4145 pub fn target_level(&self) -> ::core::option::Option<&u8> {
4146 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4147 }
4148
4149 pub fn take_target_level(&mut self) -> ::core::option::Option<u8> {
4150 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4151 }
4152
4153 pub fn latency_us(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
4154 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4155 }
4156
4157 pub fn take_latency_us(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint32> {
4158 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4159 }
4160 }
4161
4162 impl<'de> ::core::fmt::Debug for Transition<'de> {
4163 fn fmt(
4164 &self,
4165 f: &mut ::core::fmt::Formatter<'_>,
4166 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4167 f.debug_struct("Transition")
4168 .field("target_level", &self.target_level())
4169 .field("latency_us", &self.latency_us())
4170 .finish()
4171 }
4172 }
4173
4174 impl<'de> ::fidl_next::IntoNatural for Transition<'de> {
4175 type Natural = crate::natural::Transition;
4176 }
4177
4178 #[repr(C)]
4180 pub struct PowerLevel<'de> {
4181 pub(crate) table: ::fidl_next::wire::Table<'de>,
4182 }
4183
4184 impl<'de> Drop for PowerLevel<'de> {
4185 fn drop(&mut self) {
4186 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
4187
4188 let _ = self.table.get(2).map(|envelope| unsafe {
4189 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
4190 });
4191
4192 let _ = self.table.get(3).map(|envelope| unsafe {
4193 envelope
4194 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>>(
4195 )
4196 });
4197 }
4198 }
4199
4200 impl ::fidl_next::Constrained for PowerLevel<'_> {
4201 type Constraint = ();
4202
4203 fn validate(
4204 _: ::fidl_next::Slot<'_, Self>,
4205 _: Self::Constraint,
4206 ) -> Result<(), ::fidl_next::ValidationError> {
4207 Ok(())
4208 }
4209 }
4210
4211 unsafe impl ::fidl_next::Wire for PowerLevel<'static> {
4212 type Narrowed<'de> = PowerLevel<'de>;
4213
4214 #[inline]
4215 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4216 ::fidl_next::munge!(let Self { table } = out);
4217 ::fidl_next::wire::Table::zero_padding(table);
4218 }
4219 }
4220
4221 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerLevel<'de>
4222 where
4223 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4224 {
4225 fn decode(
4226 slot: ::fidl_next::Slot<'_, Self>,
4227 decoder: &mut ___D,
4228 _: (),
4229 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4230 ::fidl_next::munge!(let Self { table } = slot);
4231
4232 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4233 match ordinal {
4234 0 => unsafe { ::core::hint::unreachable_unchecked() },
4235
4236 1 => {
4237 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
4238 slot.as_mut(),
4239 decoder,
4240 (),
4241 )?;
4242
4243 Ok(())
4244 }
4245
4246 2 => {
4247 ::fidl_next::wire::Envelope::decode_as::<
4248 ___D,
4249 ::fidl_next::wire::String<'de>,
4250 >(slot.as_mut(), decoder, 63)?;
4251
4252 let value = unsafe {
4253 slot.deref_unchecked()
4254 .deref_unchecked::<::fidl_next::wire::String<'_>>()
4255 };
4256
4257 if value.len() > 63 {
4258 return Err(::fidl_next::DecodeError::VectorTooLong {
4259 size: value.len() as u64,
4260 limit: 63,
4261 });
4262 }
4263
4264 Ok(())
4265 }
4266
4267 3 => {
4268 ::fidl_next::wire::Envelope::decode_as::<
4269 ___D,
4270 ::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>,
4271 >(slot.as_mut(), decoder, (127, ()))?;
4272
4273 let value = unsafe {
4274 slot
4275 .deref_unchecked()
4276 .deref_unchecked::<
4277 ::fidl_next::wire::Vector<'_, crate::wire::Transition<'_>>
4278 >()
4279 };
4280
4281 if value.len() > 127 {
4282 return Err(::fidl_next::DecodeError::VectorTooLong {
4283 size: value.len() as u64,
4284 limit: 127,
4285 });
4286 }
4287
4288 Ok(())
4289 }
4290
4291 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4292 }
4293 })
4294 }
4295 }
4296
4297 impl<'de> PowerLevel<'de> {
4298 pub fn level(&self) -> ::core::option::Option<&u8> {
4299 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4300 }
4301
4302 pub fn take_level(&mut self) -> ::core::option::Option<u8> {
4303 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4304 }
4305
4306 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
4307 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4308 }
4309
4310 pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
4311 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4312 }
4313
4314 pub fn transitions(
4315 &self,
4316 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>>
4317 {
4318 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
4319 }
4320
4321 pub fn take_transitions(
4322 &mut self,
4323 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>>
4324 {
4325 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
4326 }
4327 }
4328
4329 impl<'de> ::core::fmt::Debug for PowerLevel<'de> {
4330 fn fmt(
4331 &self,
4332 f: &mut ::core::fmt::Formatter<'_>,
4333 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4334 f.debug_struct("PowerLevel")
4335 .field("level", &self.level())
4336 .field("name", &self.name())
4337 .field("transitions", &self.transitions())
4338 .finish()
4339 }
4340 }
4341
4342 impl<'de> ::fidl_next::IntoNatural for PowerLevel<'de> {
4343 type Natural = crate::natural::PowerLevel;
4344 }
4345
4346 #[repr(C)]
4348 pub struct PowerElement<'de> {
4349 pub(crate) table: ::fidl_next::wire::Table<'de>,
4350 }
4351
4352 impl<'de> Drop for PowerElement<'de> {
4353 fn drop(&mut self) {
4354 let _ = self.table.get(1).map(|envelope| unsafe {
4355 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
4356 });
4357
4358 let _ = self.table.get(2).map(|envelope| unsafe {
4359 envelope
4360 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>>(
4361 )
4362 });
4363 }
4364 }
4365
4366 impl ::fidl_next::Constrained for PowerElement<'_> {
4367 type Constraint = ();
4368
4369 fn validate(
4370 _: ::fidl_next::Slot<'_, Self>,
4371 _: Self::Constraint,
4372 ) -> Result<(), ::fidl_next::ValidationError> {
4373 Ok(())
4374 }
4375 }
4376
4377 unsafe impl ::fidl_next::Wire for PowerElement<'static> {
4378 type Narrowed<'de> = PowerElement<'de>;
4379
4380 #[inline]
4381 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4382 ::fidl_next::munge!(let Self { table } = out);
4383 ::fidl_next::wire::Table::zero_padding(table);
4384 }
4385 }
4386
4387 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerElement<'de>
4388 where
4389 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4390 {
4391 fn decode(
4392 slot: ::fidl_next::Slot<'_, Self>,
4393 decoder: &mut ___D,
4394 _: (),
4395 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4396 ::fidl_next::munge!(let Self { table } = slot);
4397
4398 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4399 match ordinal {
4400 0 => unsafe { ::core::hint::unreachable_unchecked() },
4401
4402 1 => {
4403 ::fidl_next::wire::Envelope::decode_as::<
4404 ___D,
4405 ::fidl_next::wire::String<'de>,
4406 >(slot.as_mut(), decoder, 63)?;
4407
4408 let value = unsafe {
4409 slot.deref_unchecked()
4410 .deref_unchecked::<::fidl_next::wire::String<'_>>()
4411 };
4412
4413 if value.len() > 63 {
4414 return Err(::fidl_next::DecodeError::VectorTooLong {
4415 size: value.len() as u64,
4416 limit: 63,
4417 });
4418 }
4419
4420 Ok(())
4421 }
4422
4423 2 => {
4424 ::fidl_next::wire::Envelope::decode_as::<
4425 ___D,
4426 ::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>,
4427 >(slot.as_mut(), decoder, (128, ()))?;
4428
4429 let value = unsafe {
4430 slot
4431 .deref_unchecked()
4432 .deref_unchecked::<
4433 ::fidl_next::wire::Vector<'_, crate::wire::PowerLevel<'_>>
4434 >()
4435 };
4436
4437 if value.len() > 128 {
4438 return Err(::fidl_next::DecodeError::VectorTooLong {
4439 size: value.len() as u64,
4440 limit: 128,
4441 });
4442 }
4443
4444 Ok(())
4445 }
4446
4447 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4448 }
4449 })
4450 }
4451 }
4452
4453 impl<'de> PowerElement<'de> {
4454 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
4455 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4456 }
4457
4458 pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
4459 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4460 }
4461
4462 pub fn levels(
4463 &self,
4464 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>>
4465 {
4466 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4467 }
4468
4469 pub fn take_levels(
4470 &mut self,
4471 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>>
4472 {
4473 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4474 }
4475 }
4476
4477 impl<'de> ::core::fmt::Debug for PowerElement<'de> {
4478 fn fmt(
4479 &self,
4480 f: &mut ::core::fmt::Formatter<'_>,
4481 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4482 f.debug_struct("PowerElement")
4483 .field("name", &self.name())
4484 .field("levels", &self.levels())
4485 .finish()
4486 }
4487 }
4488
4489 impl<'de> ::fidl_next::IntoNatural for PowerElement<'de> {
4490 type Natural = crate::natural::PowerElement;
4491 }
4492
4493 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
4495 #[repr(transparent)]
4496 pub struct SagElement {
4497 pub(crate) value: ::fidl_next::wire::Uint32,
4498 }
4499
4500 impl ::fidl_next::Constrained for SagElement {
4501 type Constraint = ();
4502
4503 fn validate(
4504 _: ::fidl_next::Slot<'_, Self>,
4505 _: Self::Constraint,
4506 ) -> Result<(), ::fidl_next::ValidationError> {
4507 Ok(())
4508 }
4509 }
4510
4511 unsafe impl ::fidl_next::Wire for SagElement {
4512 type Narrowed<'de> = Self;
4513
4514 #[inline]
4515 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
4516 }
4518 }
4519
4520 impl SagElement {
4521 pub const EXECUTION_STATE: SagElement = SagElement { value: ::fidl_next::wire::Uint32(1) };
4522
4523 pub const APPLICATION_ACTIVITY: SagElement =
4524 SagElement { value: ::fidl_next::wire::Uint32(4) };
4525 }
4526
4527 unsafe impl<___D> ::fidl_next::Decode<___D> for SagElement
4528 where
4529 ___D: ?Sized,
4530 {
4531 fn decode(
4532 slot: ::fidl_next::Slot<'_, Self>,
4533 _: &mut ___D,
4534 _: (),
4535 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4536 ::fidl_next::munge!(let Self { value } = slot);
4537
4538 match u32::from(*value) {
4539 1 | 4 => (),
4540 unknown => {
4541 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
4542 }
4543 }
4544
4545 Ok(())
4546 }
4547 }
4548
4549 impl ::core::convert::From<crate::natural::SagElement> for SagElement {
4550 fn from(natural: crate::natural::SagElement) -> Self {
4551 match natural {
4552 crate::natural::SagElement::ExecutionState => SagElement::EXECUTION_STATE,
4553
4554 crate::natural::SagElement::ApplicationActivity => SagElement::APPLICATION_ACTIVITY,
4555 }
4556 }
4557 }
4558
4559 impl ::fidl_next::IntoNatural for SagElement {
4560 type Natural = crate::natural::SagElement;
4561 }
4562
4563 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
4565 #[repr(transparent)]
4566 pub struct CpuPowerElement {
4567 pub(crate) value: ::fidl_next::wire::Uint32,
4568 }
4569
4570 impl ::fidl_next::Constrained for CpuPowerElement {
4571 type Constraint = ();
4572
4573 fn validate(
4574 _: ::fidl_next::Slot<'_, Self>,
4575 _: Self::Constraint,
4576 ) -> Result<(), ::fidl_next::ValidationError> {
4577 Ok(())
4578 }
4579 }
4580
4581 unsafe impl ::fidl_next::Wire for CpuPowerElement {
4582 type Narrowed<'de> = Self;
4583
4584 #[inline]
4585 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
4586 }
4588 }
4589
4590 impl CpuPowerElement {
4591 pub const CPU: CpuPowerElement = CpuPowerElement { value: ::fidl_next::wire::Uint32(1) };
4592 }
4593
4594 unsafe impl<___D> ::fidl_next::Decode<___D> for CpuPowerElement
4595 where
4596 ___D: ?Sized,
4597 {
4598 fn decode(
4599 slot: ::fidl_next::Slot<'_, Self>,
4600 _: &mut ___D,
4601 _: (),
4602 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4603 ::fidl_next::munge!(let Self { value } = slot);
4604
4605 match u32::from(*value) {
4606 1 => (),
4607 unknown => {
4608 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
4609 }
4610 }
4611
4612 Ok(())
4613 }
4614 }
4615
4616 impl ::core::convert::From<crate::natural::CpuPowerElement> for CpuPowerElement {
4617 fn from(natural: crate::natural::CpuPowerElement) -> Self {
4618 match natural {
4619 crate::natural::CpuPowerElement::Cpu => CpuPowerElement::CPU,
4620 }
4621 }
4622 }
4623
4624 impl ::fidl_next::IntoNatural for CpuPowerElement {
4625 type Natural = crate::natural::CpuPowerElement;
4626 }
4627
4628 #[repr(transparent)]
4630 pub struct ParentElement<'de> {
4631 pub(crate) raw: ::fidl_next::wire::Union,
4632 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
4633 }
4634
4635 impl<'de> Drop for ParentElement<'de> {
4636 fn drop(&mut self) {
4637 match self.raw.ordinal() {
4638 1 => {
4639 let _ = unsafe { self.raw.get().read_unchecked::<crate::wire::SagElement>() };
4640 }
4641
4642 2 => {
4643 let _ = unsafe {
4644 self.raw.get().read_unchecked::<::fidl_next::wire::String<'de>>()
4645 };
4646 }
4647
4648 3 => {
4649 let _ =
4650 unsafe { self.raw.get().read_unchecked::<crate::wire::CpuPowerElement>() };
4651 }
4652
4653 _ => unsafe { ::core::hint::unreachable_unchecked() },
4654 }
4655 }
4656 }
4657
4658 impl ::fidl_next::Constrained for ParentElement<'_> {
4659 type Constraint = ();
4660
4661 fn validate(
4662 _: ::fidl_next::Slot<'_, Self>,
4663 _: Self::Constraint,
4664 ) -> Result<(), ::fidl_next::ValidationError> {
4665 Ok(())
4666 }
4667 }
4668
4669 unsafe impl ::fidl_next::Wire for ParentElement<'static> {
4670 type Narrowed<'de> = ParentElement<'de>;
4671
4672 #[inline]
4673 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4674 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
4675 ::fidl_next::wire::Union::zero_padding(raw);
4676 }
4677 }
4678
4679 pub mod parent_element {
4680 pub enum Ref<'de> {
4681 Sag(&'de crate::wire::SagElement),
4682
4683 InstanceName(&'de ::fidl_next::wire::String<'de>),
4684
4685 CpuControl(&'de crate::wire::CpuPowerElement),
4686 }
4687
4688 pub enum Value<'de> {
4689 Sag(crate::wire::SagElement),
4690
4691 InstanceName(::fidl_next::wire::String<'de>),
4692
4693 CpuControl(crate::wire::CpuPowerElement),
4694 }
4695 }
4696
4697 impl<'de> ParentElement<'de> {
4698 pub fn as_ref(&self) -> crate::wire::parent_element::Ref<'_> {
4699 match self.raw.ordinal() {
4700 1 => crate::wire::parent_element::Ref::Sag(unsafe {
4701 self.raw.get().deref_unchecked::<crate::wire::SagElement>()
4702 }),
4703
4704 2 => crate::wire::parent_element::Ref::InstanceName(unsafe {
4705 self.raw.get().deref_unchecked::<::fidl_next::wire::String<'_>>()
4706 }),
4707
4708 3 => crate::wire::parent_element::Ref::CpuControl(unsafe {
4709 self.raw.get().deref_unchecked::<crate::wire::CpuPowerElement>()
4710 }),
4711
4712 _ => unsafe { ::core::hint::unreachable_unchecked() },
4713 }
4714 }
4715
4716 pub fn into_inner(self) -> crate::wire::parent_element::Value<'de> {
4717 let this = ::core::mem::ManuallyDrop::new(self);
4718
4719 match this.raw.ordinal() {
4720 1 => crate::wire::parent_element::Value::Sag(unsafe {
4721 this.raw.get().read_unchecked::<crate::wire::SagElement>()
4722 }),
4723
4724 2 => crate::wire::parent_element::Value::InstanceName(unsafe {
4725 this.raw.get().read_unchecked::<::fidl_next::wire::String<'de>>()
4726 }),
4727
4728 3 => crate::wire::parent_element::Value::CpuControl(unsafe {
4729 this.raw.get().read_unchecked::<crate::wire::CpuPowerElement>()
4730 }),
4731
4732 _ => unsafe { ::core::hint::unreachable_unchecked() },
4733 }
4734 }
4735 }
4736
4737 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ParentElement<'de>
4738 where
4739 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4740 ___D: ::fidl_next::Decoder<'de>,
4741 {
4742 fn decode(
4743 mut slot: ::fidl_next::Slot<'_, Self>,
4744 decoder: &mut ___D,
4745 _: (),
4746 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4747 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
4748 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
4749 1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::SagElement>(
4750 raw,
4751 decoder,
4752 (),
4753 )?,
4754
4755 2 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::String<'de>>(
4756 raw, decoder, 63,
4757 )?,
4758
4759 3 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::CpuPowerElement>(
4760 raw,
4761 decoder,
4762 (),
4763 )?,
4764
4765 ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)),
4766 }
4767
4768 Ok(())
4769 }
4770 }
4771
4772 impl<'de> ::core::fmt::Debug for ParentElement<'de> {
4773 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4774 match self.raw.ordinal() {
4775 1 => unsafe { self.raw.get().deref_unchecked::<crate::wire::SagElement>().fmt(f) },
4776 2 => unsafe {
4777 self.raw.get().deref_unchecked::<::fidl_next::wire::String<'_>>().fmt(f)
4778 },
4779 3 => unsafe {
4780 self.raw.get().deref_unchecked::<crate::wire::CpuPowerElement>().fmt(f)
4781 },
4782 _ => unsafe { ::core::hint::unreachable_unchecked() },
4783 }
4784 }
4785 }
4786
4787 impl<'de> ::fidl_next::IntoNatural for ParentElement<'de> {
4788 type Natural = crate::natural::ParentElement;
4789 }
4790
4791 #[repr(C)]
4793 pub struct LevelTuple<'de> {
4794 pub(crate) table: ::fidl_next::wire::Table<'de>,
4795 }
4796
4797 impl<'de> Drop for LevelTuple<'de> {
4798 fn drop(&mut self) {
4799 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
4800
4801 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
4802 }
4803 }
4804
4805 impl ::fidl_next::Constrained for LevelTuple<'_> {
4806 type Constraint = ();
4807
4808 fn validate(
4809 _: ::fidl_next::Slot<'_, Self>,
4810 _: Self::Constraint,
4811 ) -> Result<(), ::fidl_next::ValidationError> {
4812 Ok(())
4813 }
4814 }
4815
4816 unsafe impl ::fidl_next::Wire for LevelTuple<'static> {
4817 type Narrowed<'de> = LevelTuple<'de>;
4818
4819 #[inline]
4820 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4821 ::fidl_next::munge!(let Self { table } = out);
4822 ::fidl_next::wire::Table::zero_padding(table);
4823 }
4824 }
4825
4826 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LevelTuple<'de>
4827 where
4828 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4829 {
4830 fn decode(
4831 slot: ::fidl_next::Slot<'_, Self>,
4832 decoder: &mut ___D,
4833 _: (),
4834 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4835 ::fidl_next::munge!(let Self { table } = slot);
4836
4837 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4838 match ordinal {
4839 0 => unsafe { ::core::hint::unreachable_unchecked() },
4840
4841 1 => {
4842 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
4843 slot.as_mut(),
4844 decoder,
4845 (),
4846 )?;
4847
4848 Ok(())
4849 }
4850
4851 2 => {
4852 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
4853 slot.as_mut(),
4854 decoder,
4855 (),
4856 )?;
4857
4858 Ok(())
4859 }
4860
4861 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4862 }
4863 })
4864 }
4865 }
4866
4867 impl<'de> LevelTuple<'de> {
4868 pub fn child_level(&self) -> ::core::option::Option<&u8> {
4869 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4870 }
4871
4872 pub fn take_child_level(&mut self) -> ::core::option::Option<u8> {
4873 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4874 }
4875
4876 pub fn parent_level(&self) -> ::core::option::Option<&u8> {
4877 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4878 }
4879
4880 pub fn take_parent_level(&mut self) -> ::core::option::Option<u8> {
4881 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4882 }
4883 }
4884
4885 impl<'de> ::core::fmt::Debug for LevelTuple<'de> {
4886 fn fmt(
4887 &self,
4888 f: &mut ::core::fmt::Formatter<'_>,
4889 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4890 f.debug_struct("LevelTuple")
4891 .field("child_level", &self.child_level())
4892 .field("parent_level", &self.parent_level())
4893 .finish()
4894 }
4895 }
4896
4897 impl<'de> ::fidl_next::IntoNatural for LevelTuple<'de> {
4898 type Natural = crate::natural::LevelTuple;
4899 }
4900
4901 #[repr(C)]
4903 pub struct PowerDependency<'de> {
4904 pub(crate) table: ::fidl_next::wire::Table<'de>,
4905 }
4906
4907 impl<'de> Drop for PowerDependency<'de> {
4908 fn drop(&mut self) {
4909 let _ = self.table.get(1).map(|envelope| unsafe {
4910 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
4911 });
4912
4913 let _ = self.table.get(2).map(|envelope| unsafe {
4914 envelope.read_unchecked::<crate::wire::ParentElement<'de>>()
4915 });
4916
4917 let _ = self.table.get(3).map(|envelope| unsafe {
4918 envelope
4919 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>>(
4920 )
4921 });
4922 }
4923 }
4924
4925 impl ::fidl_next::Constrained for PowerDependency<'_> {
4926 type Constraint = ();
4927
4928 fn validate(
4929 _: ::fidl_next::Slot<'_, Self>,
4930 _: Self::Constraint,
4931 ) -> Result<(), ::fidl_next::ValidationError> {
4932 Ok(())
4933 }
4934 }
4935
4936 unsafe impl ::fidl_next::Wire for PowerDependency<'static> {
4937 type Narrowed<'de> = PowerDependency<'de>;
4938
4939 #[inline]
4940 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4941 ::fidl_next::munge!(let Self { table } = out);
4942 ::fidl_next::wire::Table::zero_padding(table);
4943 }
4944 }
4945
4946 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerDependency<'de>
4947 where
4948 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4949 {
4950 fn decode(
4951 slot: ::fidl_next::Slot<'_, Self>,
4952 decoder: &mut ___D,
4953 _: (),
4954 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4955 ::fidl_next::munge!(let Self { table } = slot);
4956
4957 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4958 match ordinal {
4959 0 => unsafe { ::core::hint::unreachable_unchecked() },
4960
4961 1 => {
4962 ::fidl_next::wire::Envelope::decode_as::<
4963 ___D,
4964 ::fidl_next::wire::String<'de>,
4965 >(slot.as_mut(), decoder, 63)?;
4966
4967 let value = unsafe {
4968 slot.deref_unchecked()
4969 .deref_unchecked::<::fidl_next::wire::String<'_>>()
4970 };
4971
4972 if value.len() > 63 {
4973 return Err(::fidl_next::DecodeError::VectorTooLong {
4974 size: value.len() as u64,
4975 limit: 63,
4976 });
4977 }
4978
4979 Ok(())
4980 }
4981
4982 2 => {
4983 ::fidl_next::wire::Envelope::decode_as::<
4984 ___D,
4985 crate::wire::ParentElement<'de>,
4986 >(slot.as_mut(), decoder, ())?;
4987
4988 Ok(())
4989 }
4990
4991 3 => {
4992 ::fidl_next::wire::Envelope::decode_as::<
4993 ___D,
4994 ::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>,
4995 >(slot.as_mut(), decoder, (128, ()))?;
4996
4997 let value = unsafe {
4998 slot
4999 .deref_unchecked()
5000 .deref_unchecked::<
5001 ::fidl_next::wire::Vector<'_, crate::wire::LevelTuple<'_>>
5002 >()
5003 };
5004
5005 if value.len() > 128 {
5006 return Err(::fidl_next::DecodeError::VectorTooLong {
5007 size: value.len() as u64,
5008 limit: 128,
5009 });
5010 }
5011
5012 Ok(())
5013 }
5014
5015 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
5016 }
5017 })
5018 }
5019 }
5020
5021 impl<'de> PowerDependency<'de> {
5022 pub fn child(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
5023 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5024 }
5025
5026 pub fn take_child(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
5027 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
5028 }
5029
5030 pub fn parent(&self) -> ::core::option::Option<&crate::wire::ParentElement<'de>> {
5031 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
5032 }
5033
5034 pub fn take_parent(&mut self) -> ::core::option::Option<crate::wire::ParentElement<'de>> {
5035 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
5036 }
5037
5038 pub fn level_deps(
5039 &self,
5040 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>>
5041 {
5042 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
5043 }
5044
5045 pub fn take_level_deps(
5046 &mut self,
5047 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>>
5048 {
5049 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
5050 }
5051 }
5052
5053 impl<'de> ::core::fmt::Debug for PowerDependency<'de> {
5054 fn fmt(
5055 &self,
5056 f: &mut ::core::fmt::Formatter<'_>,
5057 ) -> ::core::result::Result<(), ::core::fmt::Error> {
5058 f.debug_struct("PowerDependency")
5059 .field("child", &self.child())
5060 .field("parent", &self.parent())
5061 .field("level_deps", &self.level_deps())
5062 .finish()
5063 }
5064 }
5065
5066 impl<'de> ::fidl_next::IntoNatural for PowerDependency<'de> {
5067 type Natural = crate::natural::PowerDependency;
5068 }
5069
5070 #[repr(C)]
5072 pub struct PowerElementConfiguration<'de> {
5073 pub(crate) table: ::fidl_next::wire::Table<'de>,
5074 }
5075
5076 impl<'de> Drop for PowerElementConfiguration<'de> {
5077 fn drop(&mut self) {
5078 let _ = self.table.get(1).map(|envelope| unsafe {
5079 envelope.read_unchecked::<crate::wire::PowerElement<'de>>()
5080 });
5081
5082 let _ = self.table.get(2)
5083 .map(|envelope| unsafe {
5084 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>>()
5085 });
5086 }
5087 }
5088
5089 impl ::fidl_next::Constrained for PowerElementConfiguration<'_> {
5090 type Constraint = ();
5091
5092 fn validate(
5093 _: ::fidl_next::Slot<'_, Self>,
5094 _: Self::Constraint,
5095 ) -> Result<(), ::fidl_next::ValidationError> {
5096 Ok(())
5097 }
5098 }
5099
5100 unsafe impl ::fidl_next::Wire for PowerElementConfiguration<'static> {
5101 type Narrowed<'de> = PowerElementConfiguration<'de>;
5102
5103 #[inline]
5104 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5105 ::fidl_next::munge!(let Self { table } = out);
5106 ::fidl_next::wire::Table::zero_padding(table);
5107 }
5108 }
5109
5110 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerElementConfiguration<'de>
5111 where
5112 ___D: ::fidl_next::Decoder<'de> + ?Sized,
5113 {
5114 fn decode(
5115 slot: ::fidl_next::Slot<'_, Self>,
5116 decoder: &mut ___D,
5117 _: (),
5118 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5119 ::fidl_next::munge!(let Self { table } = slot);
5120
5121 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
5122 match ordinal {
5123 0 => unsafe { ::core::hint::unreachable_unchecked() },
5124
5125 1 => {
5126 ::fidl_next::wire::Envelope::decode_as::<
5127 ___D,
5128 crate::wire::PowerElement<'de>,
5129 >(slot.as_mut(), decoder, ())?;
5130
5131 Ok(())
5132 }
5133
5134 2 => {
5135 ::fidl_next::wire::Envelope::decode_as::<
5136 ___D,
5137 ::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>,
5138 >(slot.as_mut(), decoder, (128, ()))?;
5139
5140 let value = unsafe {
5141 slot
5142 .deref_unchecked()
5143 .deref_unchecked::<
5144 ::fidl_next::wire::Vector<'_, crate::wire::PowerDependency<'_>>
5145 >()
5146 };
5147
5148 if value.len() > 128 {
5149 return Err(::fidl_next::DecodeError::VectorTooLong {
5150 size: value.len() as u64,
5151 limit: 128,
5152 });
5153 }
5154
5155 Ok(())
5156 }
5157
5158 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
5159 }
5160 })
5161 }
5162 }
5163
5164 impl<'de> PowerElementConfiguration<'de> {
5165 pub fn element(&self) -> ::core::option::Option<&crate::wire::PowerElement<'de>> {
5166 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5167 }
5168
5169 pub fn take_element(&mut self) -> ::core::option::Option<crate::wire::PowerElement<'de>> {
5170 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
5171 }
5172
5173 pub fn dependencies(
5174 &self,
5175 ) -> ::core::option::Option<
5176 &::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>,
5177 > {
5178 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
5179 }
5180
5181 pub fn take_dependencies(
5182 &mut self,
5183 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>>
5184 {
5185 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
5186 }
5187 }
5188
5189 impl<'de> ::core::fmt::Debug for PowerElementConfiguration<'de> {
5190 fn fmt(
5191 &self,
5192 f: &mut ::core::fmt::Formatter<'_>,
5193 ) -> ::core::result::Result<(), ::core::fmt::Error> {
5194 f.debug_struct("PowerElementConfiguration")
5195 .field("element", &self.element())
5196 .field("dependencies", &self.dependencies())
5197 .finish()
5198 }
5199 }
5200
5201 impl<'de> ::fidl_next::IntoNatural for PowerElementConfiguration<'de> {
5202 type Natural = crate::natural::PowerElementConfiguration;
5203 }
5204
5205 #[derive(Debug)]
5207 #[repr(C)]
5208 pub struct ComponentPowerConfiguration<'de> {
5209 pub power_elements:
5210 ::fidl_next::wire::Vector<'de, crate::wire::PowerElementConfiguration<'de>>,
5211 }
5212
5213 static_assertions::const_assert_eq!(std::mem::size_of::<ComponentPowerConfiguration<'_>>(), 16);
5214 static_assertions::const_assert_eq!(std::mem::align_of::<ComponentPowerConfiguration<'_>>(), 8);
5215
5216 static_assertions::const_assert_eq!(
5217 std::mem::offset_of!(ComponentPowerConfiguration<'_>, power_elements),
5218 0
5219 );
5220
5221 impl ::fidl_next::Constrained for ComponentPowerConfiguration<'_> {
5222 type Constraint = ();
5223
5224 fn validate(
5225 _: ::fidl_next::Slot<'_, Self>,
5226 _: Self::Constraint,
5227 ) -> Result<(), ::fidl_next::ValidationError> {
5228 Ok(())
5229 }
5230 }
5231
5232 unsafe impl ::fidl_next::Wire for ComponentPowerConfiguration<'static> {
5233 type Narrowed<'de> = ComponentPowerConfiguration<'de>;
5234
5235 #[inline]
5236 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5237 ::fidl_next::munge! {
5238 let Self {
5239 power_elements,
5240
5241 } = &mut *out_;
5242 }
5243
5244 ::fidl_next::Wire::zero_padding(power_elements);
5245 }
5246 }
5247
5248 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ComponentPowerConfiguration<'de>
5249 where
5250 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5251 ___D: ::fidl_next::Decoder<'de>,
5252 {
5253 fn decode(
5254 slot_: ::fidl_next::Slot<'_, Self>,
5255 decoder_: &mut ___D,
5256 _: (),
5257 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5258 ::fidl_next::munge! {
5259 let Self {
5260 mut power_elements,
5261
5262 } = slot_;
5263 }
5264
5265 let _field = power_elements.as_mut();
5266 ::fidl_next::Constrained::validate(_field, (32, ()))?;
5267 ::fidl_next::Decode::decode(power_elements.as_mut(), decoder_, (32, ()))?;
5268
5269 let power_elements = unsafe { power_elements.deref_unchecked() };
5270
5271 if power_elements.len() > 32 {
5272 return Err(::fidl_next::DecodeError::VectorTooLong {
5273 size: power_elements.len() as u64,
5274 limit: 32,
5275 });
5276 }
5277
5278 Ok(())
5279 }
5280 }
5281
5282 impl<'de> ::fidl_next::IntoNatural for ComponentPowerConfiguration<'de> {
5283 type Natural = crate::natural::ComponentPowerConfiguration;
5284 }
5285
5286 #[derive(Clone, Debug)]
5288 #[repr(C)]
5289 pub struct DeviceRegisterPowerDomainRequest {
5290 pub min_needed_voltage: ::fidl_next::wire::Uint32,
5291
5292 pub max_supported_voltage: ::fidl_next::wire::Uint32,
5293 }
5294
5295 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceRegisterPowerDomainRequest>(), 8);
5296 static_assertions::const_assert_eq!(
5297 std::mem::align_of::<DeviceRegisterPowerDomainRequest>(),
5298 4
5299 );
5300
5301 static_assertions::const_assert_eq!(
5302 std::mem::offset_of!(DeviceRegisterPowerDomainRequest, min_needed_voltage),
5303 0
5304 );
5305
5306 static_assertions::const_assert_eq!(
5307 std::mem::offset_of!(DeviceRegisterPowerDomainRequest, max_supported_voltage),
5308 4
5309 );
5310
5311 impl ::fidl_next::Constrained for DeviceRegisterPowerDomainRequest {
5312 type Constraint = ();
5313
5314 fn validate(
5315 _: ::fidl_next::Slot<'_, Self>,
5316 _: Self::Constraint,
5317 ) -> Result<(), ::fidl_next::ValidationError> {
5318 Ok(())
5319 }
5320 }
5321
5322 unsafe impl ::fidl_next::Wire for DeviceRegisterPowerDomainRequest {
5323 type Narrowed<'de> = DeviceRegisterPowerDomainRequest;
5324
5325 #[inline]
5326 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5327 ::fidl_next::munge! {
5328 let Self {
5329 min_needed_voltage,
5330 max_supported_voltage,
5331
5332 } = &mut *out_;
5333 }
5334
5335 ::fidl_next::Wire::zero_padding(min_needed_voltage);
5336
5337 ::fidl_next::Wire::zero_padding(max_supported_voltage);
5338 }
5339 }
5340
5341 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceRegisterPowerDomainRequest
5342 where
5343 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5344 {
5345 fn decode(
5346 slot_: ::fidl_next::Slot<'_, Self>,
5347 decoder_: &mut ___D,
5348 _: (),
5349 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5350 ::fidl_next::munge! {
5351 let Self {
5352 mut min_needed_voltage,
5353 mut max_supported_voltage,
5354
5355 } = slot_;
5356 }
5357
5358 let _field = min_needed_voltage.as_mut();
5359
5360 ::fidl_next::Decode::decode(min_needed_voltage.as_mut(), decoder_, ())?;
5361
5362 let _field = max_supported_voltage.as_mut();
5363
5364 ::fidl_next::Decode::decode(max_supported_voltage.as_mut(), decoder_, ())?;
5365
5366 Ok(())
5367 }
5368 }
5369
5370 impl ::fidl_next::IntoNatural for DeviceRegisterPowerDomainRequest {
5371 type Natural = crate::natural::DeviceRegisterPowerDomainRequest;
5372 }
5373
5374 pub type DeviceRegisterPowerDomainResponse = ::fidl_next::wire::Unit;
5376
5377 pub type DeviceUnregisterPowerDomainResponse = ::fidl_next::wire::Unit;
5379
5380 #[derive(Clone, Debug)]
5382 #[repr(C)]
5383 pub struct DeviceGetSupportedVoltageRangeResponse {
5384 pub min: ::fidl_next::wire::Uint32,
5385
5386 pub max: ::fidl_next::wire::Uint32,
5387 }
5388
5389 static_assertions::const_assert_eq!(
5390 std::mem::size_of::<DeviceGetSupportedVoltageRangeResponse>(),
5391 8
5392 );
5393 static_assertions::const_assert_eq!(
5394 std::mem::align_of::<DeviceGetSupportedVoltageRangeResponse>(),
5395 4
5396 );
5397
5398 static_assertions::const_assert_eq!(
5399 std::mem::offset_of!(DeviceGetSupportedVoltageRangeResponse, min),
5400 0
5401 );
5402
5403 static_assertions::const_assert_eq!(
5404 std::mem::offset_of!(DeviceGetSupportedVoltageRangeResponse, max),
5405 4
5406 );
5407
5408 impl ::fidl_next::Constrained for DeviceGetSupportedVoltageRangeResponse {
5409 type Constraint = ();
5410
5411 fn validate(
5412 _: ::fidl_next::Slot<'_, Self>,
5413 _: Self::Constraint,
5414 ) -> Result<(), ::fidl_next::ValidationError> {
5415 Ok(())
5416 }
5417 }
5418
5419 unsafe impl ::fidl_next::Wire for DeviceGetSupportedVoltageRangeResponse {
5420 type Narrowed<'de> = DeviceGetSupportedVoltageRangeResponse;
5421
5422 #[inline]
5423 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5424 ::fidl_next::munge! {
5425 let Self {
5426 min,
5427 max,
5428
5429 } = &mut *out_;
5430 }
5431
5432 ::fidl_next::Wire::zero_padding(min);
5433
5434 ::fidl_next::Wire::zero_padding(max);
5435 }
5436 }
5437
5438 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetSupportedVoltageRangeResponse
5439 where
5440 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5441 {
5442 fn decode(
5443 slot_: ::fidl_next::Slot<'_, Self>,
5444 decoder_: &mut ___D,
5445 _: (),
5446 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5447 ::fidl_next::munge! {
5448 let Self {
5449 mut min,
5450 mut max,
5451
5452 } = slot_;
5453 }
5454
5455 let _field = min.as_mut();
5456
5457 ::fidl_next::Decode::decode(min.as_mut(), decoder_, ())?;
5458
5459 let _field = max.as_mut();
5460
5461 ::fidl_next::Decode::decode(max.as_mut(), decoder_, ())?;
5462
5463 Ok(())
5464 }
5465 }
5466
5467 impl ::fidl_next::IntoNatural for DeviceGetSupportedVoltageRangeResponse {
5468 type Natural = crate::natural::DeviceGetSupportedVoltageRangeResponse;
5469 }
5470
5471 #[derive(Clone, Debug)]
5473 #[repr(C)]
5474 pub struct DeviceRequestVoltageRequest {
5475 pub voltage: ::fidl_next::wire::Uint32,
5476 }
5477
5478 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceRequestVoltageRequest>(), 4);
5479 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceRequestVoltageRequest>(), 4);
5480
5481 static_assertions::const_assert_eq!(
5482 std::mem::offset_of!(DeviceRequestVoltageRequest, voltage),
5483 0
5484 );
5485
5486 impl ::fidl_next::Constrained for DeviceRequestVoltageRequest {
5487 type Constraint = ();
5488
5489 fn validate(
5490 _: ::fidl_next::Slot<'_, Self>,
5491 _: Self::Constraint,
5492 ) -> Result<(), ::fidl_next::ValidationError> {
5493 Ok(())
5494 }
5495 }
5496
5497 unsafe impl ::fidl_next::Wire for DeviceRequestVoltageRequest {
5498 type Narrowed<'de> = DeviceRequestVoltageRequest;
5499
5500 #[inline]
5501 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5502 ::fidl_next::munge! {
5503 let Self {
5504 voltage,
5505
5506 } = &mut *out_;
5507 }
5508
5509 ::fidl_next::Wire::zero_padding(voltage);
5510 }
5511 }
5512
5513 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceRequestVoltageRequest
5514 where
5515 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5516 {
5517 fn decode(
5518 slot_: ::fidl_next::Slot<'_, Self>,
5519 decoder_: &mut ___D,
5520 _: (),
5521 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5522 ::fidl_next::munge! {
5523 let Self {
5524 mut voltage,
5525
5526 } = slot_;
5527 }
5528
5529 let _field = voltage.as_mut();
5530
5531 ::fidl_next::Decode::decode(voltage.as_mut(), decoder_, ())?;
5532
5533 Ok(())
5534 }
5535 }
5536
5537 impl ::fidl_next::IntoNatural for DeviceRequestVoltageRequest {
5538 type Natural = crate::natural::DeviceRequestVoltageRequest;
5539 }
5540
5541 #[derive(Clone, Debug)]
5543 #[repr(C)]
5544 pub struct DeviceRequestVoltageResponse {
5545 pub actual_voltage: ::fidl_next::wire::Uint32,
5546 }
5547
5548 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceRequestVoltageResponse>(), 4);
5549 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceRequestVoltageResponse>(), 4);
5550
5551 static_assertions::const_assert_eq!(
5552 std::mem::offset_of!(DeviceRequestVoltageResponse, actual_voltage),
5553 0
5554 );
5555
5556 impl ::fidl_next::Constrained for DeviceRequestVoltageResponse {
5557 type Constraint = ();
5558
5559 fn validate(
5560 _: ::fidl_next::Slot<'_, Self>,
5561 _: Self::Constraint,
5562 ) -> Result<(), ::fidl_next::ValidationError> {
5563 Ok(())
5564 }
5565 }
5566
5567 unsafe impl ::fidl_next::Wire for DeviceRequestVoltageResponse {
5568 type Narrowed<'de> = DeviceRequestVoltageResponse;
5569
5570 #[inline]
5571 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5572 ::fidl_next::munge! {
5573 let Self {
5574 actual_voltage,
5575
5576 } = &mut *out_;
5577 }
5578
5579 ::fidl_next::Wire::zero_padding(actual_voltage);
5580 }
5581 }
5582
5583 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceRequestVoltageResponse
5584 where
5585 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5586 {
5587 fn decode(
5588 slot_: ::fidl_next::Slot<'_, Self>,
5589 decoder_: &mut ___D,
5590 _: (),
5591 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5592 ::fidl_next::munge! {
5593 let Self {
5594 mut actual_voltage,
5595
5596 } = slot_;
5597 }
5598
5599 let _field = actual_voltage.as_mut();
5600
5601 ::fidl_next::Decode::decode(actual_voltage.as_mut(), decoder_, ())?;
5602
5603 Ok(())
5604 }
5605 }
5606
5607 impl ::fidl_next::IntoNatural for DeviceRequestVoltageResponse {
5608 type Natural = crate::natural::DeviceRequestVoltageResponse;
5609 }
5610
5611 #[derive(Clone, Debug)]
5613 #[repr(C)]
5614 pub struct DeviceGetCurrentVoltageRequest {
5615 pub index: ::fidl_next::wire::Uint32,
5616 }
5617
5618 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetCurrentVoltageRequest>(), 4);
5619 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetCurrentVoltageRequest>(), 4);
5620
5621 static_assertions::const_assert_eq!(
5622 std::mem::offset_of!(DeviceGetCurrentVoltageRequest, index),
5623 0
5624 );
5625
5626 impl ::fidl_next::Constrained for DeviceGetCurrentVoltageRequest {
5627 type Constraint = ();
5628
5629 fn validate(
5630 _: ::fidl_next::Slot<'_, Self>,
5631 _: Self::Constraint,
5632 ) -> Result<(), ::fidl_next::ValidationError> {
5633 Ok(())
5634 }
5635 }
5636
5637 unsafe impl ::fidl_next::Wire for DeviceGetCurrentVoltageRequest {
5638 type Narrowed<'de> = DeviceGetCurrentVoltageRequest;
5639
5640 #[inline]
5641 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5642 ::fidl_next::munge! {
5643 let Self {
5644 index,
5645
5646 } = &mut *out_;
5647 }
5648
5649 ::fidl_next::Wire::zero_padding(index);
5650 }
5651 }
5652
5653 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetCurrentVoltageRequest
5654 where
5655 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5656 {
5657 fn decode(
5658 slot_: ::fidl_next::Slot<'_, Self>,
5659 decoder_: &mut ___D,
5660 _: (),
5661 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5662 ::fidl_next::munge! {
5663 let Self {
5664 mut index,
5665
5666 } = slot_;
5667 }
5668
5669 let _field = index.as_mut();
5670
5671 ::fidl_next::Decode::decode(index.as_mut(), decoder_, ())?;
5672
5673 Ok(())
5674 }
5675 }
5676
5677 impl ::fidl_next::IntoNatural for DeviceGetCurrentVoltageRequest {
5678 type Natural = crate::natural::DeviceGetCurrentVoltageRequest;
5679 }
5680
5681 #[derive(Clone, Debug)]
5683 #[repr(C)]
5684 pub struct DeviceGetCurrentVoltageResponse {
5685 pub current_voltage: ::fidl_next::wire::Uint32,
5686 }
5687
5688 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetCurrentVoltageResponse>(), 4);
5689 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetCurrentVoltageResponse>(), 4);
5690
5691 static_assertions::const_assert_eq!(
5692 std::mem::offset_of!(DeviceGetCurrentVoltageResponse, current_voltage),
5693 0
5694 );
5695
5696 impl ::fidl_next::Constrained for DeviceGetCurrentVoltageResponse {
5697 type Constraint = ();
5698
5699 fn validate(
5700 _: ::fidl_next::Slot<'_, Self>,
5701 _: Self::Constraint,
5702 ) -> Result<(), ::fidl_next::ValidationError> {
5703 Ok(())
5704 }
5705 }
5706
5707 unsafe impl ::fidl_next::Wire for DeviceGetCurrentVoltageResponse {
5708 type Narrowed<'de> = DeviceGetCurrentVoltageResponse;
5709
5710 #[inline]
5711 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5712 ::fidl_next::munge! {
5713 let Self {
5714 current_voltage,
5715
5716 } = &mut *out_;
5717 }
5718
5719 ::fidl_next::Wire::zero_padding(current_voltage);
5720 }
5721 }
5722
5723 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetCurrentVoltageResponse
5724 where
5725 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5726 {
5727 fn decode(
5728 slot_: ::fidl_next::Slot<'_, Self>,
5729 decoder_: &mut ___D,
5730 _: (),
5731 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5732 ::fidl_next::munge! {
5733 let Self {
5734 mut current_voltage,
5735
5736 } = slot_;
5737 }
5738
5739 let _field = current_voltage.as_mut();
5740
5741 ::fidl_next::Decode::decode(current_voltage.as_mut(), decoder_, ())?;
5742
5743 Ok(())
5744 }
5745 }
5746
5747 impl ::fidl_next::IntoNatural for DeviceGetCurrentVoltageResponse {
5748 type Natural = crate::natural::DeviceGetCurrentVoltageResponse;
5749 }
5750
5751 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
5753 #[repr(transparent)]
5754 pub struct PowerDomainStatus {
5755 pub(crate) value: u8,
5756 }
5757
5758 impl ::fidl_next::Constrained for PowerDomainStatus {
5759 type Constraint = ();
5760
5761 fn validate(
5762 _: ::fidl_next::Slot<'_, Self>,
5763 _: Self::Constraint,
5764 ) -> Result<(), ::fidl_next::ValidationError> {
5765 Ok(())
5766 }
5767 }
5768
5769 unsafe impl ::fidl_next::Wire for PowerDomainStatus {
5770 type Narrowed<'de> = Self;
5771
5772 #[inline]
5773 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
5774 }
5776 }
5777
5778 impl PowerDomainStatus {
5779 pub const DISABLED: PowerDomainStatus = PowerDomainStatus { value: 1 };
5780
5781 pub const ENABLED: PowerDomainStatus = PowerDomainStatus { value: 2 };
5782 }
5783
5784 unsafe impl<___D> ::fidl_next::Decode<___D> for PowerDomainStatus
5785 where
5786 ___D: ?Sized,
5787 {
5788 fn decode(
5789 slot: ::fidl_next::Slot<'_, Self>,
5790 _: &mut ___D,
5791 _: (),
5792 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5793 ::fidl_next::munge!(let Self { value } = slot);
5794
5795 match u8::from(*value) {
5796 1 | 2 => (),
5797 unknown => {
5798 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
5799 }
5800 }
5801
5802 Ok(())
5803 }
5804 }
5805
5806 impl ::core::convert::From<crate::natural::PowerDomainStatus> for PowerDomainStatus {
5807 fn from(natural: crate::natural::PowerDomainStatus) -> Self {
5808 match natural {
5809 crate::natural::PowerDomainStatus::Disabled => PowerDomainStatus::DISABLED,
5810
5811 crate::natural::PowerDomainStatus::Enabled => PowerDomainStatus::ENABLED,
5812 }
5813 }
5814 }
5815
5816 impl ::fidl_next::IntoNatural for PowerDomainStatus {
5817 type Natural = crate::natural::PowerDomainStatus;
5818 }
5819
5820 #[derive(Clone, Debug)]
5822 #[repr(C)]
5823 pub struct DeviceGetPowerDomainStatusResponse {
5824 pub status: crate::wire::PowerDomainStatus,
5825 }
5826
5827 static_assertions::const_assert_eq!(
5828 std::mem::size_of::<DeviceGetPowerDomainStatusResponse>(),
5829 1
5830 );
5831 static_assertions::const_assert_eq!(
5832 std::mem::align_of::<DeviceGetPowerDomainStatusResponse>(),
5833 1
5834 );
5835
5836 static_assertions::const_assert_eq!(
5837 std::mem::offset_of!(DeviceGetPowerDomainStatusResponse, status),
5838 0
5839 );
5840
5841 impl ::fidl_next::Constrained for DeviceGetPowerDomainStatusResponse {
5842 type Constraint = ();
5843
5844 fn validate(
5845 _: ::fidl_next::Slot<'_, Self>,
5846 _: Self::Constraint,
5847 ) -> Result<(), ::fidl_next::ValidationError> {
5848 Ok(())
5849 }
5850 }
5851
5852 unsafe impl ::fidl_next::Wire for DeviceGetPowerDomainStatusResponse {
5853 type Narrowed<'de> = DeviceGetPowerDomainStatusResponse;
5854
5855 #[inline]
5856 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5857 ::fidl_next::munge! {
5858 let Self {
5859 status,
5860
5861 } = &mut *out_;
5862 }
5863
5864 ::fidl_next::Wire::zero_padding(status);
5865 }
5866 }
5867
5868 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetPowerDomainStatusResponse
5869 where
5870 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5871 {
5872 fn decode(
5873 slot_: ::fidl_next::Slot<'_, Self>,
5874 decoder_: &mut ___D,
5875 _: (),
5876 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5877 ::fidl_next::munge! {
5878 let Self {
5879 mut status,
5880
5881 } = slot_;
5882 }
5883
5884 let _field = status.as_mut();
5885
5886 ::fidl_next::Decode::decode(status.as_mut(), decoder_, ())?;
5887
5888 Ok(())
5889 }
5890 }
5891
5892 impl ::fidl_next::IntoNatural for DeviceGetPowerDomainStatusResponse {
5893 type Natural = crate::natural::DeviceGetPowerDomainStatusResponse;
5894 }
5895
5896 #[derive(Clone, Debug)]
5898 #[repr(C)]
5899 pub struct DeviceWritePmicCtrlRegRequest {
5900 pub reg_addr: ::fidl_next::wire::Uint32,
5901
5902 pub value: ::fidl_next::wire::Uint32,
5903 }
5904
5905 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceWritePmicCtrlRegRequest>(), 8);
5906 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceWritePmicCtrlRegRequest>(), 4);
5907
5908 static_assertions::const_assert_eq!(
5909 std::mem::offset_of!(DeviceWritePmicCtrlRegRequest, reg_addr),
5910 0
5911 );
5912
5913 static_assertions::const_assert_eq!(
5914 std::mem::offset_of!(DeviceWritePmicCtrlRegRequest, value),
5915 4
5916 );
5917
5918 impl ::fidl_next::Constrained for DeviceWritePmicCtrlRegRequest {
5919 type Constraint = ();
5920
5921 fn validate(
5922 _: ::fidl_next::Slot<'_, Self>,
5923 _: Self::Constraint,
5924 ) -> Result<(), ::fidl_next::ValidationError> {
5925 Ok(())
5926 }
5927 }
5928
5929 unsafe impl ::fidl_next::Wire for DeviceWritePmicCtrlRegRequest {
5930 type Narrowed<'de> = DeviceWritePmicCtrlRegRequest;
5931
5932 #[inline]
5933 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5934 ::fidl_next::munge! {
5935 let Self {
5936 reg_addr,
5937 value,
5938
5939 } = &mut *out_;
5940 }
5941
5942 ::fidl_next::Wire::zero_padding(reg_addr);
5943
5944 ::fidl_next::Wire::zero_padding(value);
5945 }
5946 }
5947
5948 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceWritePmicCtrlRegRequest
5949 where
5950 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5951 {
5952 fn decode(
5953 slot_: ::fidl_next::Slot<'_, Self>,
5954 decoder_: &mut ___D,
5955 _: (),
5956 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5957 ::fidl_next::munge! {
5958 let Self {
5959 mut reg_addr,
5960 mut value,
5961
5962 } = slot_;
5963 }
5964
5965 let _field = reg_addr.as_mut();
5966
5967 ::fidl_next::Decode::decode(reg_addr.as_mut(), decoder_, ())?;
5968
5969 let _field = value.as_mut();
5970
5971 ::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
5972
5973 Ok(())
5974 }
5975 }
5976
5977 impl ::fidl_next::IntoNatural for DeviceWritePmicCtrlRegRequest {
5978 type Natural = crate::natural::DeviceWritePmicCtrlRegRequest;
5979 }
5980
5981 pub type DeviceWritePmicCtrlRegResponse = ::fidl_next::wire::Unit;
5983
5984 #[derive(Clone, Debug)]
5986 #[repr(C)]
5987 pub struct DeviceReadPmicCtrlRegRequest {
5988 pub reg_addr: ::fidl_next::wire::Uint32,
5989 }
5990
5991 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceReadPmicCtrlRegRequest>(), 4);
5992 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceReadPmicCtrlRegRequest>(), 4);
5993
5994 static_assertions::const_assert_eq!(
5995 std::mem::offset_of!(DeviceReadPmicCtrlRegRequest, reg_addr),
5996 0
5997 );
5998
5999 impl ::fidl_next::Constrained for DeviceReadPmicCtrlRegRequest {
6000 type Constraint = ();
6001
6002 fn validate(
6003 _: ::fidl_next::Slot<'_, Self>,
6004 _: Self::Constraint,
6005 ) -> Result<(), ::fidl_next::ValidationError> {
6006 Ok(())
6007 }
6008 }
6009
6010 unsafe impl ::fidl_next::Wire for DeviceReadPmicCtrlRegRequest {
6011 type Narrowed<'de> = DeviceReadPmicCtrlRegRequest;
6012
6013 #[inline]
6014 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
6015 ::fidl_next::munge! {
6016 let Self {
6017 reg_addr,
6018
6019 } = &mut *out_;
6020 }
6021
6022 ::fidl_next::Wire::zero_padding(reg_addr);
6023 }
6024 }
6025
6026 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceReadPmicCtrlRegRequest
6027 where
6028 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6029 {
6030 fn decode(
6031 slot_: ::fidl_next::Slot<'_, Self>,
6032 decoder_: &mut ___D,
6033 _: (),
6034 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6035 ::fidl_next::munge! {
6036 let Self {
6037 mut reg_addr,
6038
6039 } = slot_;
6040 }
6041
6042 let _field = reg_addr.as_mut();
6043
6044 ::fidl_next::Decode::decode(reg_addr.as_mut(), decoder_, ())?;
6045
6046 Ok(())
6047 }
6048 }
6049
6050 impl ::fidl_next::IntoNatural for DeviceReadPmicCtrlRegRequest {
6051 type Natural = crate::natural::DeviceReadPmicCtrlRegRequest;
6052 }
6053
6054 #[derive(Clone, Debug)]
6056 #[repr(C)]
6057 pub struct DeviceReadPmicCtrlRegResponse {
6058 pub value: ::fidl_next::wire::Uint32,
6059 }
6060
6061 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceReadPmicCtrlRegResponse>(), 4);
6062 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceReadPmicCtrlRegResponse>(), 4);
6063
6064 static_assertions::const_assert_eq!(
6065 std::mem::offset_of!(DeviceReadPmicCtrlRegResponse, value),
6066 0
6067 );
6068
6069 impl ::fidl_next::Constrained for DeviceReadPmicCtrlRegResponse {
6070 type Constraint = ();
6071
6072 fn validate(
6073 _: ::fidl_next::Slot<'_, Self>,
6074 _: Self::Constraint,
6075 ) -> Result<(), ::fidl_next::ValidationError> {
6076 Ok(())
6077 }
6078 }
6079
6080 unsafe impl ::fidl_next::Wire for DeviceReadPmicCtrlRegResponse {
6081 type Narrowed<'de> = DeviceReadPmicCtrlRegResponse;
6082
6083 #[inline]
6084 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
6085 ::fidl_next::munge! {
6086 let Self {
6087 value,
6088
6089 } = &mut *out_;
6090 }
6091
6092 ::fidl_next::Wire::zero_padding(value);
6093 }
6094 }
6095
6096 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceReadPmicCtrlRegResponse
6097 where
6098 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6099 {
6100 fn decode(
6101 slot_: ::fidl_next::Slot<'_, Self>,
6102 decoder_: &mut ___D,
6103 _: (),
6104 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6105 ::fidl_next::munge! {
6106 let Self {
6107 mut value,
6108
6109 } = slot_;
6110 }
6111
6112 let _field = value.as_mut();
6113
6114 ::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
6115
6116 Ok(())
6117 }
6118 }
6119
6120 impl ::fidl_next::IntoNatural for DeviceReadPmicCtrlRegResponse {
6121 type Natural = crate::natural::DeviceReadPmicCtrlRegResponse;
6122 }
6123
6124 #[repr(C)]
6126 pub struct Domain<'de> {
6127 pub(crate) table: ::fidl_next::wire::Table<'de>,
6128 }
6129
6130 impl<'de> Drop for Domain<'de> {
6131 fn drop(&mut self) {
6132 let _ = self
6133 .table
6134 .get(1)
6135 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
6136 }
6137 }
6138
6139 impl ::fidl_next::Constrained for Domain<'_> {
6140 type Constraint = ();
6141
6142 fn validate(
6143 _: ::fidl_next::Slot<'_, Self>,
6144 _: Self::Constraint,
6145 ) -> Result<(), ::fidl_next::ValidationError> {
6146 Ok(())
6147 }
6148 }
6149
6150 unsafe impl ::fidl_next::Wire for Domain<'static> {
6151 type Narrowed<'de> = Domain<'de>;
6152
6153 #[inline]
6154 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6155 ::fidl_next::munge!(let Self { table } = out);
6156 ::fidl_next::wire::Table::zero_padding(table);
6157 }
6158 }
6159
6160 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Domain<'de>
6161 where
6162 ___D: ::fidl_next::Decoder<'de> + ?Sized,
6163 {
6164 fn decode(
6165 slot: ::fidl_next::Slot<'_, Self>,
6166 decoder: &mut ___D,
6167 _: (),
6168 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6169 ::fidl_next::munge!(let Self { table } = slot);
6170
6171 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
6172 match ordinal {
6173 0 => unsafe { ::core::hint::unreachable_unchecked() },
6174
6175 1 => {
6176 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
6177 slot.as_mut(),
6178 decoder,
6179 (),
6180 )?;
6181
6182 Ok(())
6183 }
6184
6185 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
6186 }
6187 })
6188 }
6189 }
6190
6191 impl<'de> Domain<'de> {
6192 pub fn id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
6193 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
6194 }
6195
6196 pub fn take_id(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint32> {
6197 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
6198 }
6199 }
6200
6201 impl<'de> ::core::fmt::Debug for Domain<'de> {
6202 fn fmt(
6203 &self,
6204 f: &mut ::core::fmt::Formatter<'_>,
6205 ) -> ::core::result::Result<(), ::core::fmt::Error> {
6206 f.debug_struct("Domain").field("id", &self.id()).finish()
6207 }
6208 }
6209
6210 impl<'de> ::fidl_next::IntoNatural for Domain<'de> {
6211 type Natural = crate::natural::Domain;
6212 }
6213
6214 #[repr(C)]
6216 pub struct DomainMetadata<'de> {
6217 pub(crate) table: ::fidl_next::wire::Table<'de>,
6218 }
6219
6220 impl<'de> Drop for DomainMetadata<'de> {
6221 fn drop(&mut self) {
6222 let _ = self.table.get(1).map(|envelope| unsafe {
6223 envelope
6224 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>()
6225 });
6226 }
6227 }
6228
6229 impl ::fidl_next::Constrained for DomainMetadata<'_> {
6230 type Constraint = ();
6231
6232 fn validate(
6233 _: ::fidl_next::Slot<'_, Self>,
6234 _: Self::Constraint,
6235 ) -> Result<(), ::fidl_next::ValidationError> {
6236 Ok(())
6237 }
6238 }
6239
6240 unsafe impl ::fidl_next::Wire for DomainMetadata<'static> {
6241 type Narrowed<'de> = DomainMetadata<'de>;
6242
6243 #[inline]
6244 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6245 ::fidl_next::munge!(let Self { table } = out);
6246 ::fidl_next::wire::Table::zero_padding(table);
6247 }
6248 }
6249
6250 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DomainMetadata<'de>
6251 where
6252 ___D: ::fidl_next::Decoder<'de> + ?Sized,
6253 {
6254 fn decode(
6255 slot: ::fidl_next::Slot<'_, Self>,
6256 decoder: &mut ___D,
6257 _: (),
6258 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6259 ::fidl_next::munge!(let Self { table } = slot);
6260
6261 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
6262 match ordinal {
6263 0 => unsafe { ::core::hint::unreachable_unchecked() },
6264
6265 1 => {
6266 ::fidl_next::wire::Envelope::decode_as::<
6267 ___D,
6268 ::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>,
6269 >(slot.as_mut(), decoder, (4294967295, ()))?;
6270
6271 Ok(())
6272 }
6273
6274 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
6275 }
6276 })
6277 }
6278 }
6279
6280 impl<'de> DomainMetadata<'de> {
6281 pub fn domains(
6282 &self,
6283 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>
6284 {
6285 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
6286 }
6287
6288 pub fn take_domains(
6289 &mut self,
6290 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>
6291 {
6292 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
6293 }
6294 }
6295
6296 impl<'de> ::core::fmt::Debug for DomainMetadata<'de> {
6297 fn fmt(
6298 &self,
6299 f: &mut ::core::fmt::Formatter<'_>,
6300 ) -> ::core::result::Result<(), ::core::fmt::Error> {
6301 f.debug_struct("DomainMetadata").field("domains", &self.domains()).finish()
6302 }
6303 }
6304
6305 impl<'de> ::fidl_next::IntoNatural for DomainMetadata<'de> {
6306 type Natural = crate::natural::DomainMetadata;
6307 }
6308
6309 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
6311 #[repr(transparent)]
6312 pub struct FrameworkElementLevels {
6313 pub(crate) value: ::fidl_next::wire::Uint32,
6314 }
6315
6316 impl ::fidl_next::Constrained for FrameworkElementLevels {
6317 type Constraint = ();
6318
6319 fn validate(
6320 _: ::fidl_next::Slot<'_, Self>,
6321 _: Self::Constraint,
6322 ) -> Result<(), ::fidl_next::ValidationError> {
6323 Ok(())
6324 }
6325 }
6326
6327 unsafe impl ::fidl_next::Wire for FrameworkElementLevels {
6328 type Narrowed<'de> = Self;
6329
6330 #[inline]
6331 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
6332 }
6334 }
6335
6336 impl FrameworkElementLevels {
6337 pub const OFF: FrameworkElementLevels =
6338 FrameworkElementLevels { value: ::fidl_next::wire::Uint32(0) };
6339
6340 pub const ON: FrameworkElementLevels =
6341 FrameworkElementLevels { value: ::fidl_next::wire::Uint32(1) };
6342 }
6343
6344 unsafe impl<___D> ::fidl_next::Decode<___D> for FrameworkElementLevels
6345 where
6346 ___D: ?Sized,
6347 {
6348 fn decode(
6349 slot: ::fidl_next::Slot<'_, Self>,
6350 _: &mut ___D,
6351 _: (),
6352 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6353 ::fidl_next::munge!(let Self { value } = slot);
6354
6355 match u32::from(*value) {
6356 0 | 1 => (),
6357 unknown => {
6358 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
6359 }
6360 }
6361
6362 Ok(())
6363 }
6364 }
6365
6366 impl ::core::convert::From<crate::natural::FrameworkElementLevels> for FrameworkElementLevels {
6367 fn from(natural: crate::natural::FrameworkElementLevels) -> Self {
6368 match natural {
6369 crate::natural::FrameworkElementLevels::Off => FrameworkElementLevels::OFF,
6370
6371 crate::natural::FrameworkElementLevels::On => FrameworkElementLevels::ON,
6372 }
6373 }
6374 }
6375
6376 impl ::fidl_next::IntoNatural for FrameworkElementLevels {
6377 type Natural = crate::natural::FrameworkElementLevels;
6378 }
6379}
6380
6381pub mod wire_optional {
6382
6383 #[repr(transparent)]
6384 pub struct ParentElement<'de> {
6385 pub(crate) raw: ::fidl_next::wire::Union,
6386 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
6387 }
6388
6389 impl ::fidl_next::Constrained for ParentElement<'_> {
6390 type Constraint = ();
6391
6392 fn validate(
6393 _: ::fidl_next::Slot<'_, Self>,
6394 _: Self::Constraint,
6395 ) -> Result<(), ::fidl_next::ValidationError> {
6396 Ok(())
6397 }
6398 }
6399
6400 unsafe impl ::fidl_next::Wire for ParentElement<'static> {
6401 type Narrowed<'de> = ParentElement<'de>;
6402
6403 #[inline]
6404 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6405 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
6406 ::fidl_next::wire::Union::zero_padding(raw);
6407 }
6408 }
6409
6410 impl<'de> ParentElement<'de> {
6411 pub fn is_some(&self) -> bool {
6412 self.raw.is_some()
6413 }
6414
6415 pub fn is_none(&self) -> bool {
6416 self.raw.is_none()
6417 }
6418
6419 pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::ParentElement<'de>> {
6420 if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
6421 }
6422
6423 pub fn into_option(self) -> ::core::option::Option<crate::wire::ParentElement<'de>> {
6424 if self.is_some() {
6425 Some(crate::wire::ParentElement {
6426 raw: self.raw,
6427 _phantom: ::core::marker::PhantomData,
6428 })
6429 } else {
6430 None
6431 }
6432 }
6433 }
6434
6435 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ParentElement<'de>
6436 where
6437 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6438 ___D: ::fidl_next::Decoder<'de>,
6439 {
6440 fn decode(
6441 mut slot: ::fidl_next::Slot<'_, Self>,
6442 decoder: &mut ___D,
6443 _: (),
6444 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6445 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
6446 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
6447 1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::SagElement>(
6448 raw,
6449 decoder,
6450 (),
6451 )?,
6452
6453 2 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::String<'de>>(
6454 raw, decoder, 63,
6455 )?,
6456
6457 3 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::CpuPowerElement>(
6458 raw,
6459 decoder,
6460 (),
6461 )?,
6462
6463 0 => ::fidl_next::wire::Union::decode_absent(raw)?,
6464 _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
6465 }
6466
6467 Ok(())
6468 }
6469 }
6470
6471 impl<'de> ::core::fmt::Debug for ParentElement<'de> {
6472 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6473 self.as_ref().fmt(f)
6474 }
6475 }
6476
6477 impl<'de> ::fidl_next::IntoNatural for ParentElement<'de> {
6478 type Natural = ::core::option::Option<crate::natural::ParentElement>;
6479 }
6480}
6481
6482pub mod generic {
6483
6484 pub struct ComponentPowerConfiguration<T0> {
6486 pub power_elements: T0,
6487 }
6488
6489 unsafe impl<___E, T0>
6490 ::fidl_next::Encode<crate::wire::ComponentPowerConfiguration<'static>, ___E>
6491 for ComponentPowerConfiguration<T0>
6492 where
6493 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6494 ___E: ::fidl_next::Encoder,
6495 T0: ::fidl_next::Encode<
6496 ::fidl_next::wire::Vector<'static, crate::wire::PowerElementConfiguration<'static>>,
6497 ___E,
6498 >,
6499 {
6500 #[inline]
6501 fn encode(
6502 self,
6503 encoder_: &mut ___E,
6504 out_: &mut ::core::mem::MaybeUninit<crate::wire::ComponentPowerConfiguration<'static>>,
6505 _: (),
6506 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6507 ::fidl_next::munge! {
6508 let crate::wire::ComponentPowerConfiguration {
6509 power_elements,
6510
6511 } = out_;
6512 }
6513
6514 ::fidl_next::Encode::encode(self.power_elements, encoder_, power_elements, (32, ()))?;
6515
6516 Ok(())
6517 }
6518 }
6519
6520 pub struct DeviceRegisterPowerDomainRequest<T0, T1> {
6522 pub min_needed_voltage: T0,
6523
6524 pub max_supported_voltage: T1,
6525 }
6526
6527 unsafe impl<___E, T0, T1>
6528 ::fidl_next::Encode<crate::wire::DeviceRegisterPowerDomainRequest, ___E>
6529 for DeviceRegisterPowerDomainRequest<T0, T1>
6530 where
6531 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6532 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6533 T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6534 {
6535 #[inline]
6536 fn encode(
6537 self,
6538 encoder_: &mut ___E,
6539 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRegisterPowerDomainRequest>,
6540 _: (),
6541 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6542 ::fidl_next::munge! {
6543 let crate::wire::DeviceRegisterPowerDomainRequest {
6544 min_needed_voltage,
6545 max_supported_voltage,
6546
6547 } = out_;
6548 }
6549
6550 ::fidl_next::Encode::encode(self.min_needed_voltage, encoder_, min_needed_voltage, ())?;
6551
6552 ::fidl_next::Encode::encode(
6553 self.max_supported_voltage,
6554 encoder_,
6555 max_supported_voltage,
6556 (),
6557 )?;
6558
6559 Ok(())
6560 }
6561 }
6562
6563 pub type DeviceRegisterPowerDomainResponse = ();
6565
6566 pub type DeviceUnregisterPowerDomainResponse = ();
6568
6569 pub struct DeviceGetSupportedVoltageRangeResponse<T0, T1> {
6571 pub min: T0,
6572
6573 pub max: T1,
6574 }
6575
6576 unsafe impl<___E, T0, T1>
6577 ::fidl_next::Encode<crate::wire::DeviceGetSupportedVoltageRangeResponse, ___E>
6578 for DeviceGetSupportedVoltageRangeResponse<T0, T1>
6579 where
6580 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6581 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6582 T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6583 {
6584 #[inline]
6585 fn encode(
6586 self,
6587 encoder_: &mut ___E,
6588 out_: &mut ::core::mem::MaybeUninit<
6589 crate::wire::DeviceGetSupportedVoltageRangeResponse,
6590 >,
6591 _: (),
6592 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6593 ::fidl_next::munge! {
6594 let crate::wire::DeviceGetSupportedVoltageRangeResponse {
6595 min,
6596 max,
6597
6598 } = out_;
6599 }
6600
6601 ::fidl_next::Encode::encode(self.min, encoder_, min, ())?;
6602
6603 ::fidl_next::Encode::encode(self.max, encoder_, max, ())?;
6604
6605 Ok(())
6606 }
6607 }
6608
6609 pub struct DeviceRequestVoltageRequest<T0> {
6611 pub voltage: T0,
6612 }
6613
6614 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceRequestVoltageRequest, ___E>
6615 for DeviceRequestVoltageRequest<T0>
6616 where
6617 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6618 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6619 {
6620 #[inline]
6621 fn encode(
6622 self,
6623 encoder_: &mut ___E,
6624 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRequestVoltageRequest>,
6625 _: (),
6626 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6627 ::fidl_next::munge! {
6628 let crate::wire::DeviceRequestVoltageRequest {
6629 voltage,
6630
6631 } = out_;
6632 }
6633
6634 ::fidl_next::Encode::encode(self.voltage, encoder_, voltage, ())?;
6635
6636 Ok(())
6637 }
6638 }
6639
6640 pub struct DeviceRequestVoltageResponse<T0> {
6642 pub actual_voltage: T0,
6643 }
6644
6645 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceRequestVoltageResponse, ___E>
6646 for DeviceRequestVoltageResponse<T0>
6647 where
6648 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6649 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6650 {
6651 #[inline]
6652 fn encode(
6653 self,
6654 encoder_: &mut ___E,
6655 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRequestVoltageResponse>,
6656 _: (),
6657 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6658 ::fidl_next::munge! {
6659 let crate::wire::DeviceRequestVoltageResponse {
6660 actual_voltage,
6661
6662 } = out_;
6663 }
6664
6665 ::fidl_next::Encode::encode(self.actual_voltage, encoder_, actual_voltage, ())?;
6666
6667 Ok(())
6668 }
6669 }
6670
6671 pub struct DeviceGetCurrentVoltageRequest<T0> {
6673 pub index: T0,
6674 }
6675
6676 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageRequest, ___E>
6677 for DeviceGetCurrentVoltageRequest<T0>
6678 where
6679 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6680 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6681 {
6682 #[inline]
6683 fn encode(
6684 self,
6685 encoder_: &mut ___E,
6686 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetCurrentVoltageRequest>,
6687 _: (),
6688 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6689 ::fidl_next::munge! {
6690 let crate::wire::DeviceGetCurrentVoltageRequest {
6691 index,
6692
6693 } = out_;
6694 }
6695
6696 ::fidl_next::Encode::encode(self.index, encoder_, index, ())?;
6697
6698 Ok(())
6699 }
6700 }
6701
6702 pub struct DeviceGetCurrentVoltageResponse<T0> {
6704 pub current_voltage: T0,
6705 }
6706
6707 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageResponse, ___E>
6708 for DeviceGetCurrentVoltageResponse<T0>
6709 where
6710 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6711 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6712 {
6713 #[inline]
6714 fn encode(
6715 self,
6716 encoder_: &mut ___E,
6717 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetCurrentVoltageResponse>,
6718 _: (),
6719 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6720 ::fidl_next::munge! {
6721 let crate::wire::DeviceGetCurrentVoltageResponse {
6722 current_voltage,
6723
6724 } = out_;
6725 }
6726
6727 ::fidl_next::Encode::encode(self.current_voltage, encoder_, current_voltage, ())?;
6728
6729 Ok(())
6730 }
6731 }
6732
6733 pub struct DeviceGetPowerDomainStatusResponse<T0> {
6735 pub status: T0,
6736 }
6737
6738 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetPowerDomainStatusResponse, ___E>
6739 for DeviceGetPowerDomainStatusResponse<T0>
6740 where
6741 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6742 T0: ::fidl_next::Encode<crate::wire::PowerDomainStatus, ___E>,
6743 {
6744 #[inline]
6745 fn encode(
6746 self,
6747 encoder_: &mut ___E,
6748 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetPowerDomainStatusResponse>,
6749 _: (),
6750 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6751 ::fidl_next::munge! {
6752 let crate::wire::DeviceGetPowerDomainStatusResponse {
6753 status,
6754
6755 } = out_;
6756 }
6757
6758 ::fidl_next::Encode::encode(self.status, encoder_, status, ())?;
6759
6760 Ok(())
6761 }
6762 }
6763
6764 pub struct DeviceWritePmicCtrlRegRequest<T0, T1> {
6766 pub reg_addr: T0,
6767
6768 pub value: T1,
6769 }
6770
6771 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::DeviceWritePmicCtrlRegRequest, ___E>
6772 for DeviceWritePmicCtrlRegRequest<T0, T1>
6773 where
6774 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6775 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6776 T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6777 {
6778 #[inline]
6779 fn encode(
6780 self,
6781 encoder_: &mut ___E,
6782 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWritePmicCtrlRegRequest>,
6783 _: (),
6784 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6785 ::fidl_next::munge! {
6786 let crate::wire::DeviceWritePmicCtrlRegRequest {
6787 reg_addr,
6788 value,
6789
6790 } = out_;
6791 }
6792
6793 ::fidl_next::Encode::encode(self.reg_addr, encoder_, reg_addr, ())?;
6794
6795 ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
6796
6797 Ok(())
6798 }
6799 }
6800
6801 pub type DeviceWritePmicCtrlRegResponse = ();
6803
6804 pub struct DeviceReadPmicCtrlRegRequest<T0> {
6806 pub reg_addr: T0,
6807 }
6808
6809 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegRequest, ___E>
6810 for DeviceReadPmicCtrlRegRequest<T0>
6811 where
6812 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6813 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6814 {
6815 #[inline]
6816 fn encode(
6817 self,
6818 encoder_: &mut ___E,
6819 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadPmicCtrlRegRequest>,
6820 _: (),
6821 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6822 ::fidl_next::munge! {
6823 let crate::wire::DeviceReadPmicCtrlRegRequest {
6824 reg_addr,
6825
6826 } = out_;
6827 }
6828
6829 ::fidl_next::Encode::encode(self.reg_addr, encoder_, reg_addr, ())?;
6830
6831 Ok(())
6832 }
6833 }
6834
6835 pub struct DeviceReadPmicCtrlRegResponse<T0> {
6837 pub value: T0,
6838 }
6839
6840 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegResponse, ___E>
6841 for DeviceReadPmicCtrlRegResponse<T0>
6842 where
6843 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6844 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6845 {
6846 #[inline]
6847 fn encode(
6848 self,
6849 encoder_: &mut ___E,
6850 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadPmicCtrlRegResponse>,
6851 _: (),
6852 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6853 ::fidl_next::munge! {
6854 let crate::wire::DeviceReadPmicCtrlRegResponse {
6855 value,
6856
6857 } = out_;
6858 }
6859
6860 ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
6861
6862 Ok(())
6863 }
6864 }
6865}
6866
6867pub use self::natural::*;
6868
6869pub const MAX_NAME_LENGTH: u16 = 63 as u16;
6870
6871#[doc = " This means we could have up to 128 power levels, which seems like more than\n enough.\n"]
6872pub const MAX_TRANSITIONS: u16 = 127 as u16;
6873
6874#[doc = " Should be MAX_TRANSITIONS + 1\n"]
6875pub const MAX_LEVELS: u16 = 128 as u16;
6876
6877pub const MAX_DEPENDENCIES: u16 = 128 as u16;
6878
6879pub const MAX_POWER_ELEMENTS: u16 = 32 as u16;
6880
6881#[derive(PartialEq, Debug)]
6883pub struct Device;
6884
6885impl ::fidl_next::Discoverable for Device {
6886 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.power.Device";
6887}
6888
6889#[cfg(target_os = "fuchsia")]
6890impl ::fidl_next::HasTransport for Device {
6891 type Transport = ::fidl_next::fuchsia::zx::Channel;
6892}
6893
6894pub mod device {
6895 pub mod prelude {
6896 pub use crate::{
6897 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
6898 DeviceServerHandler, device,
6899 };
6900
6901 pub use crate::natural::DeviceGetCurrentVoltageRequest;
6902
6903 pub use crate::natural::DeviceReadPmicCtrlRegRequest;
6904
6905 pub use crate::natural::DeviceRegisterPowerDomainRequest;
6906
6907 pub use crate::natural::DeviceRequestVoltageRequest;
6908
6909 pub use crate::natural::DeviceWritePmicCtrlRegRequest;
6910
6911 pub use crate::natural::DeviceGetCurrentVoltageResponse;
6912
6913 pub use crate::natural::DeviceGetPowerDomainStatusResponse;
6914
6915 pub use crate::natural::DeviceGetSupportedVoltageRangeResponse;
6916
6917 pub use crate::natural::DeviceReadPmicCtrlRegResponse;
6918
6919 pub use crate::natural::DeviceRegisterPowerDomainResponse;
6920
6921 pub use crate::natural::DeviceRequestVoltageResponse;
6922
6923 pub use crate::natural::DeviceUnregisterPowerDomainResponse;
6924
6925 pub use crate::natural::DeviceWritePmicCtrlRegResponse;
6926 }
6927
6928 pub struct RegisterPowerDomain;
6929
6930 impl ::fidl_next::Method for RegisterPowerDomain {
6931 const ORDINAL: u64 = 4458069386545205468;
6932 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6933 ::fidl_next::protocol::Flexibility::Strict;
6934
6935 type Protocol = crate::Device;
6936
6937 type Request = crate::wire::DeviceRegisterPowerDomainRequest;
6938 }
6939
6940 impl ::fidl_next::TwoWayMethod for RegisterPowerDomain {
6941 type Response = ::fidl_next::wire::Result<
6942 'static,
6943 crate::wire::DeviceRegisterPowerDomainResponse,
6944 ::fidl_next::wire::fuchsia::Status,
6945 >;
6946 }
6947
6948 impl<___R> ::fidl_next::Respond<___R> for RegisterPowerDomain {
6949 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
6950
6951 fn respond(response: ___R) -> Self::Output {
6952 ::core::result::Result::Ok(response)
6953 }
6954 }
6955
6956 impl<___R> ::fidl_next::RespondErr<___R> for RegisterPowerDomain {
6957 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
6958
6959 fn respond_err(response: ___R) -> Self::Output {
6960 ::core::result::Result::Err(response)
6961 }
6962 }
6963
6964 pub struct UnregisterPowerDomain;
6965
6966 impl ::fidl_next::Method for UnregisterPowerDomain {
6967 const ORDINAL: u64 = 7717805237469023337;
6968 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6969 ::fidl_next::protocol::Flexibility::Strict;
6970
6971 type Protocol = crate::Device;
6972
6973 type Request = ::fidl_next::wire::EmptyMessageBody;
6974 }
6975
6976 impl ::fidl_next::TwoWayMethod for UnregisterPowerDomain {
6977 type Response = ::fidl_next::wire::Result<
6978 'static,
6979 crate::wire::DeviceUnregisterPowerDomainResponse,
6980 ::fidl_next::wire::fuchsia::Status,
6981 >;
6982 }
6983
6984 impl<___R> ::fidl_next::Respond<___R> for UnregisterPowerDomain {
6985 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
6986
6987 fn respond(response: ___R) -> Self::Output {
6988 ::core::result::Result::Ok(response)
6989 }
6990 }
6991
6992 impl<___R> ::fidl_next::RespondErr<___R> for UnregisterPowerDomain {
6993 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
6994
6995 fn respond_err(response: ___R) -> Self::Output {
6996 ::core::result::Result::Err(response)
6997 }
6998 }
6999
7000 pub struct GetSupportedVoltageRange;
7001
7002 impl ::fidl_next::Method for GetSupportedVoltageRange {
7003 const ORDINAL: u64 = 7887361504891407856;
7004 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7005 ::fidl_next::protocol::Flexibility::Strict;
7006
7007 type Protocol = crate::Device;
7008
7009 type Request = ::fidl_next::wire::EmptyMessageBody;
7010 }
7011
7012 impl ::fidl_next::TwoWayMethod for GetSupportedVoltageRange {
7013 type Response = ::fidl_next::wire::Result<
7014 'static,
7015 crate::wire::DeviceGetSupportedVoltageRangeResponse,
7016 ::fidl_next::wire::fuchsia::Status,
7017 >;
7018 }
7019
7020 impl<___R> ::fidl_next::Respond<___R> for GetSupportedVoltageRange {
7021 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
7022
7023 fn respond(response: ___R) -> Self::Output {
7024 ::core::result::Result::Ok(response)
7025 }
7026 }
7027
7028 impl<___R> ::fidl_next::RespondErr<___R> for GetSupportedVoltageRange {
7029 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7030
7031 fn respond_err(response: ___R) -> Self::Output {
7032 ::core::result::Result::Err(response)
7033 }
7034 }
7035
7036 pub struct RequestVoltage;
7037
7038 impl ::fidl_next::Method for RequestVoltage {
7039 const ORDINAL: u64 = 2578932345713622683;
7040 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7041 ::fidl_next::protocol::Flexibility::Strict;
7042
7043 type Protocol = crate::Device;
7044
7045 type Request = crate::wire::DeviceRequestVoltageRequest;
7046 }
7047
7048 impl ::fidl_next::TwoWayMethod for RequestVoltage {
7049 type Response = ::fidl_next::wire::Result<
7050 'static,
7051 crate::wire::DeviceRequestVoltageResponse,
7052 ::fidl_next::wire::fuchsia::Status,
7053 >;
7054 }
7055
7056 impl<___R> ::fidl_next::Respond<___R> for RequestVoltage {
7057 type Output = ::core::result::Result<
7058 crate::generic::DeviceRequestVoltageResponse<___R>,
7059 ::fidl_next::never::Never,
7060 >;
7061
7062 fn respond(response: ___R) -> Self::Output {
7063 ::core::result::Result::Ok(crate::generic::DeviceRequestVoltageResponse {
7064 actual_voltage: response,
7065 })
7066 }
7067 }
7068
7069 impl<___R> ::fidl_next::RespondErr<___R> for RequestVoltage {
7070 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7071
7072 fn respond_err(response: ___R) -> Self::Output {
7073 ::core::result::Result::Err(response)
7074 }
7075 }
7076
7077 pub struct GetCurrentVoltage;
7078
7079 impl ::fidl_next::Method for GetCurrentVoltage {
7080 const ORDINAL: u64 = 7683000915093989729;
7081 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7082 ::fidl_next::protocol::Flexibility::Strict;
7083
7084 type Protocol = crate::Device;
7085
7086 type Request = crate::wire::DeviceGetCurrentVoltageRequest;
7087 }
7088
7089 impl ::fidl_next::TwoWayMethod for GetCurrentVoltage {
7090 type Response = ::fidl_next::wire::Result<
7091 'static,
7092 crate::wire::DeviceGetCurrentVoltageResponse,
7093 ::fidl_next::wire::fuchsia::Status,
7094 >;
7095 }
7096
7097 impl<___R> ::fidl_next::Respond<___R> for GetCurrentVoltage {
7098 type Output = ::core::result::Result<
7099 crate::generic::DeviceGetCurrentVoltageResponse<___R>,
7100 ::fidl_next::never::Never,
7101 >;
7102
7103 fn respond(response: ___R) -> Self::Output {
7104 ::core::result::Result::Ok(crate::generic::DeviceGetCurrentVoltageResponse {
7105 current_voltage: response,
7106 })
7107 }
7108 }
7109
7110 impl<___R> ::fidl_next::RespondErr<___R> for GetCurrentVoltage {
7111 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7112
7113 fn respond_err(response: ___R) -> Self::Output {
7114 ::core::result::Result::Err(response)
7115 }
7116 }
7117
7118 pub struct GetPowerDomainStatus;
7119
7120 impl ::fidl_next::Method for GetPowerDomainStatus {
7121 const ORDINAL: u64 = 4178917272116294842;
7122 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7123 ::fidl_next::protocol::Flexibility::Strict;
7124
7125 type Protocol = crate::Device;
7126
7127 type Request = ::fidl_next::wire::EmptyMessageBody;
7128 }
7129
7130 impl ::fidl_next::TwoWayMethod for GetPowerDomainStatus {
7131 type Response = ::fidl_next::wire::Result<
7132 'static,
7133 crate::wire::DeviceGetPowerDomainStatusResponse,
7134 ::fidl_next::wire::fuchsia::Status,
7135 >;
7136 }
7137
7138 impl<___R> ::fidl_next::Respond<___R> for GetPowerDomainStatus {
7139 type Output = ::core::result::Result<
7140 crate::generic::DeviceGetPowerDomainStatusResponse<___R>,
7141 ::fidl_next::never::Never,
7142 >;
7143
7144 fn respond(response: ___R) -> Self::Output {
7145 ::core::result::Result::Ok(crate::generic::DeviceGetPowerDomainStatusResponse {
7146 status: response,
7147 })
7148 }
7149 }
7150
7151 impl<___R> ::fidl_next::RespondErr<___R> for GetPowerDomainStatus {
7152 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7153
7154 fn respond_err(response: ___R) -> Self::Output {
7155 ::core::result::Result::Err(response)
7156 }
7157 }
7158
7159 pub struct WritePmicCtrlReg;
7160
7161 impl ::fidl_next::Method for WritePmicCtrlReg {
7162 const ORDINAL: u64 = 3749867380549091993;
7163 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7164 ::fidl_next::protocol::Flexibility::Strict;
7165
7166 type Protocol = crate::Device;
7167
7168 type Request = crate::wire::DeviceWritePmicCtrlRegRequest;
7169 }
7170
7171 impl ::fidl_next::TwoWayMethod for WritePmicCtrlReg {
7172 type Response = ::fidl_next::wire::Result<
7173 'static,
7174 crate::wire::DeviceWritePmicCtrlRegResponse,
7175 ::fidl_next::wire::fuchsia::Status,
7176 >;
7177 }
7178
7179 impl<___R> ::fidl_next::Respond<___R> for WritePmicCtrlReg {
7180 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
7181
7182 fn respond(response: ___R) -> Self::Output {
7183 ::core::result::Result::Ok(response)
7184 }
7185 }
7186
7187 impl<___R> ::fidl_next::RespondErr<___R> for WritePmicCtrlReg {
7188 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7189
7190 fn respond_err(response: ___R) -> Self::Output {
7191 ::core::result::Result::Err(response)
7192 }
7193 }
7194
7195 pub struct ReadPmicCtrlReg;
7196
7197 impl ::fidl_next::Method for ReadPmicCtrlReg {
7198 const ORDINAL: u64 = 8281766978930618131;
7199 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7200 ::fidl_next::protocol::Flexibility::Strict;
7201
7202 type Protocol = crate::Device;
7203
7204 type Request = crate::wire::DeviceReadPmicCtrlRegRequest;
7205 }
7206
7207 impl ::fidl_next::TwoWayMethod for ReadPmicCtrlReg {
7208 type Response = ::fidl_next::wire::Result<
7209 'static,
7210 crate::wire::DeviceReadPmicCtrlRegResponse,
7211 ::fidl_next::wire::fuchsia::Status,
7212 >;
7213 }
7214
7215 impl<___R> ::fidl_next::Respond<___R> for ReadPmicCtrlReg {
7216 type Output = ::core::result::Result<
7217 crate::generic::DeviceReadPmicCtrlRegResponse<___R>,
7218 ::fidl_next::never::Never,
7219 >;
7220
7221 fn respond(response: ___R) -> Self::Output {
7222 ::core::result::Result::Ok(crate::generic::DeviceReadPmicCtrlRegResponse {
7223 value: response,
7224 })
7225 }
7226 }
7227
7228 impl<___R> ::fidl_next::RespondErr<___R> for ReadPmicCtrlReg {
7229 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7230
7231 fn respond_err(response: ___R) -> Self::Output {
7232 ::core::result::Result::Err(response)
7233 }
7234 }
7235
7236 mod ___detail {
7237 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
7238 where
7239 ___T: ::fidl_next::Transport,
7240 {
7241 type Client = DeviceClient<___T>;
7242 type Server = DeviceServer<___T>;
7243 }
7244
7245 #[repr(transparent)]
7247 pub struct DeviceClient<___T: ::fidl_next::Transport> {
7248 #[allow(dead_code)]
7249 client: ::fidl_next::protocol::Client<___T>,
7250 }
7251
7252 impl<___T> DeviceClient<___T>
7253 where
7254 ___T: ::fidl_next::Transport,
7255 {
7256 #[doc = " Register the callee for this power domain. The callee will be registered until\n UnregisterPowerDomain is called. Any voltage changes to the power domain will\n be made considering the min_needed_voltage(in uV) and max_supported_voltage(in uV) published here.\n If voltages mentioned are out of supported voltage range of domain(obtained by calling\n GetSupportedVoltageRange), the callee will be registered with the supported voltage range.\n"]
7257 pub fn register_power_domain(
7258 &self,
7259
7260 min_needed_voltage: impl ::fidl_next::Encode<
7261 ::fidl_next::wire::Uint32,
7262 <___T as ::fidl_next::Transport>::SendBuffer,
7263 >,
7264
7265 max_supported_voltage: impl ::fidl_next::Encode<
7266 ::fidl_next::wire::Uint32,
7267 <___T as ::fidl_next::Transport>::SendBuffer,
7268 >,
7269 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterPowerDomain, ___T>
7270 where
7271 <___T as ::fidl_next::Transport>::SendBuffer:
7272 ::fidl_next::encoder::InternalHandleEncoder,
7273 {
7274 self.register_power_domain_with(crate::generic::DeviceRegisterPowerDomainRequest {
7275 min_needed_voltage,
7276
7277 max_supported_voltage,
7278 })
7279 }
7280
7281 #[doc = " Register the callee for this power domain. The callee will be registered until\n UnregisterPowerDomain is called. Any voltage changes to the power domain will\n be made considering the min_needed_voltage(in uV) and max_supported_voltage(in uV) published here.\n If voltages mentioned are out of supported voltage range of domain(obtained by calling\n GetSupportedVoltageRange), the callee will be registered with the supported voltage range.\n"]
7282 pub fn register_power_domain_with<___R>(
7283 &self,
7284 request: ___R,
7285 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterPowerDomain, ___T>
7286 where
7287 ___R: ::fidl_next::Encode<
7288 crate::wire::DeviceRegisterPowerDomainRequest,
7289 <___T as ::fidl_next::Transport>::SendBuffer,
7290 >,
7291 {
7292 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7293 4458069386545205468,
7294 <super::RegisterPowerDomain as ::fidl_next::Method>::FLEXIBILITY,
7295 request,
7296 ))
7297 }
7298
7299 #[doc = " Unregister the callee for this power domain. The callee will no longer be considered as\n a dependent of this power domain.\n"]
7300 pub fn unregister_power_domain(
7301 &self,
7302 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterPowerDomain, ___T> {
7303 ::fidl_next::TwoWayFuture::from_untyped(
7304 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7305 7717805237469023337,
7306 <super::UnregisterPowerDomain as ::fidl_next::Method>::FLEXIBILITY,
7307 (),
7308 ),
7309 )
7310 }
7311
7312 #[doc = " Get Supported Voltage Range. min and max are in micorVolts(uV)\n"]
7313 pub fn get_supported_voltage_range(
7314 &self,
7315 ) -> ::fidl_next::TwoWayFuture<'_, super::GetSupportedVoltageRange, ___T> {
7316 ::fidl_next::TwoWayFuture::from_untyped(
7317 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7318 7887361504891407856,
7319 <super::GetSupportedVoltageRange as ::fidl_next::Method>::FLEXIBILITY,
7320 (),
7321 ),
7322 )
7323 }
7324
7325 #[doc = " Request a particular voltage. The actual_voltage is the voltage that the power domain\n is transitioned to after considering supported voltage ranges of all the registered\n dependents. \"voltage\" should be in uV.\n"]
7326 pub fn request_voltage(
7327 &self,
7328
7329 voltage: impl ::fidl_next::Encode<
7330 ::fidl_next::wire::Uint32,
7331 <___T as ::fidl_next::Transport>::SendBuffer,
7332 >,
7333 ) -> ::fidl_next::TwoWayFuture<'_, super::RequestVoltage, ___T>
7334 where
7335 <___T as ::fidl_next::Transport>::SendBuffer:
7336 ::fidl_next::encoder::InternalHandleEncoder,
7337 {
7338 self.request_voltage_with(crate::generic::DeviceRequestVoltageRequest { voltage })
7339 }
7340
7341 #[doc = " Request a particular voltage. The actual_voltage is the voltage that the power domain\n is transitioned to after considering supported voltage ranges of all the registered\n dependents. \"voltage\" should be in uV.\n"]
7342 pub fn request_voltage_with<___R>(
7343 &self,
7344 request: ___R,
7345 ) -> ::fidl_next::TwoWayFuture<'_, super::RequestVoltage, ___T>
7346 where
7347 ___R: ::fidl_next::Encode<
7348 crate::wire::DeviceRequestVoltageRequest,
7349 <___T as ::fidl_next::Transport>::SendBuffer,
7350 >,
7351 {
7352 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7353 2578932345713622683,
7354 <super::RequestVoltage as ::fidl_next::Method>::FLEXIBILITY,
7355 request,
7356 ))
7357 }
7358
7359 #[doc = " Get current voltage in uV.\n"]
7360 pub fn get_current_voltage(
7361 &self,
7362
7363 index: impl ::fidl_next::Encode<
7364 ::fidl_next::wire::Uint32,
7365 <___T as ::fidl_next::Transport>::SendBuffer,
7366 >,
7367 ) -> ::fidl_next::TwoWayFuture<'_, super::GetCurrentVoltage, ___T>
7368 where
7369 <___T as ::fidl_next::Transport>::SendBuffer:
7370 ::fidl_next::encoder::InternalHandleEncoder,
7371 {
7372 self.get_current_voltage_with(crate::generic::DeviceGetCurrentVoltageRequest {
7373 index,
7374 })
7375 }
7376
7377 #[doc = " Get current voltage in uV.\n"]
7378 pub fn get_current_voltage_with<___R>(
7379 &self,
7380 request: ___R,
7381 ) -> ::fidl_next::TwoWayFuture<'_, super::GetCurrentVoltage, ___T>
7382 where
7383 ___R: ::fidl_next::Encode<
7384 crate::wire::DeviceGetCurrentVoltageRequest,
7385 <___T as ::fidl_next::Transport>::SendBuffer,
7386 >,
7387 {
7388 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7389 7683000915093989729,
7390 <super::GetCurrentVoltage as ::fidl_next::Method>::FLEXIBILITY,
7391 request,
7392 ))
7393 }
7394
7395 #[doc = " Get power domain status\n"]
7396 pub fn get_power_domain_status(
7397 &self,
7398 ) -> ::fidl_next::TwoWayFuture<'_, super::GetPowerDomainStatus, ___T> {
7399 ::fidl_next::TwoWayFuture::from_untyped(
7400 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7401 4178917272116294842,
7402 <super::GetPowerDomainStatus as ::fidl_next::Method>::FLEXIBILITY,
7403 (),
7404 ),
7405 )
7406 }
7407
7408 #[doc = " Write to ctrl register of PMIC\n"]
7409 pub fn write_pmic_ctrl_reg(
7410 &self,
7411
7412 reg_addr: impl ::fidl_next::Encode<
7413 ::fidl_next::wire::Uint32,
7414 <___T as ::fidl_next::Transport>::SendBuffer,
7415 >,
7416
7417 value: impl ::fidl_next::Encode<
7418 ::fidl_next::wire::Uint32,
7419 <___T as ::fidl_next::Transport>::SendBuffer,
7420 >,
7421 ) -> ::fidl_next::TwoWayFuture<'_, super::WritePmicCtrlReg, ___T>
7422 where
7423 <___T as ::fidl_next::Transport>::SendBuffer:
7424 ::fidl_next::encoder::InternalHandleEncoder,
7425 {
7426 self.write_pmic_ctrl_reg_with(crate::generic::DeviceWritePmicCtrlRegRequest {
7427 reg_addr,
7428
7429 value,
7430 })
7431 }
7432
7433 #[doc = " Write to ctrl register of PMIC\n"]
7434 pub fn write_pmic_ctrl_reg_with<___R>(
7435 &self,
7436 request: ___R,
7437 ) -> ::fidl_next::TwoWayFuture<'_, super::WritePmicCtrlReg, ___T>
7438 where
7439 ___R: ::fidl_next::Encode<
7440 crate::wire::DeviceWritePmicCtrlRegRequest,
7441 <___T as ::fidl_next::Transport>::SendBuffer,
7442 >,
7443 {
7444 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7445 3749867380549091993,
7446 <super::WritePmicCtrlReg as ::fidl_next::Method>::FLEXIBILITY,
7447 request,
7448 ))
7449 }
7450
7451 #[doc = " Read ctrl register of PMIC\n"]
7452 pub fn read_pmic_ctrl_reg(
7453 &self,
7454
7455 reg_addr: impl ::fidl_next::Encode<
7456 ::fidl_next::wire::Uint32,
7457 <___T as ::fidl_next::Transport>::SendBuffer,
7458 >,
7459 ) -> ::fidl_next::TwoWayFuture<'_, super::ReadPmicCtrlReg, ___T>
7460 where
7461 <___T as ::fidl_next::Transport>::SendBuffer:
7462 ::fidl_next::encoder::InternalHandleEncoder,
7463 {
7464 self.read_pmic_ctrl_reg_with(crate::generic::DeviceReadPmicCtrlRegRequest {
7465 reg_addr,
7466 })
7467 }
7468
7469 #[doc = " Read ctrl register of PMIC\n"]
7470 pub fn read_pmic_ctrl_reg_with<___R>(
7471 &self,
7472 request: ___R,
7473 ) -> ::fidl_next::TwoWayFuture<'_, super::ReadPmicCtrlReg, ___T>
7474 where
7475 ___R: ::fidl_next::Encode<
7476 crate::wire::DeviceReadPmicCtrlRegRequest,
7477 <___T as ::fidl_next::Transport>::SendBuffer,
7478 >,
7479 {
7480 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7481 8281766978930618131,
7482 <super::ReadPmicCtrlReg as ::fidl_next::Method>::FLEXIBILITY,
7483 request,
7484 ))
7485 }
7486 }
7487
7488 #[repr(transparent)]
7490 pub struct DeviceServer<___T: ::fidl_next::Transport> {
7491 server: ::fidl_next::protocol::Server<___T>,
7492 }
7493
7494 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
7495 }
7496}
7497
7498#[diagnostic::on_unimplemented(
7499 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
7500)]
7501
7502pub trait DeviceLocalClientHandler<
7506 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7507 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7508>
7509{
7510}
7511
7512impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
7513where
7514 ___H: DeviceLocalClientHandler<___T>,
7515 ___T: ::fidl_next::Transport,
7516{
7517 async fn on_event(
7518 handler: &mut ___H,
7519 mut message: ::fidl_next::Message<___T>,
7520 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
7521 match *message.header().ordinal {
7522 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
7523 }
7524 }
7525}
7526
7527#[diagnostic::on_unimplemented(
7528 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
7529)]
7530
7531pub trait DeviceLocalServerHandler<
7535 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7536 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7537>
7538{
7539 #[doc = " Register the callee for this power domain. The callee will be registered until\n UnregisterPowerDomain is called. Any voltage changes to the power domain will\n be made considering the min_needed_voltage(in uV) and max_supported_voltage(in uV) published here.\n If voltages mentioned are out of supported voltage range of domain(obtained by calling\n GetSupportedVoltageRange), the callee will be registered with the supported voltage range.\n"]
7540 fn register_power_domain(
7541 &mut self,
7542
7543 request: ::fidl_next::Request<device::RegisterPowerDomain, ___T>,
7544
7545 responder: ::fidl_next::Responder<device::RegisterPowerDomain, ___T>,
7546 ) -> impl ::core::future::Future<Output = ()>;
7547
7548 #[doc = " Unregister the callee for this power domain. The callee will no longer be considered as\n a dependent of this power domain.\n"]
7549 fn unregister_power_domain(
7550 &mut self,
7551
7552 responder: ::fidl_next::Responder<device::UnregisterPowerDomain, ___T>,
7553 ) -> impl ::core::future::Future<Output = ()>;
7554
7555 #[doc = " Get Supported Voltage Range. min and max are in micorVolts(uV)\n"]
7556 fn get_supported_voltage_range(
7557 &mut self,
7558
7559 responder: ::fidl_next::Responder<device::GetSupportedVoltageRange, ___T>,
7560 ) -> impl ::core::future::Future<Output = ()>;
7561
7562 #[doc = " Request a particular voltage. The actual_voltage is the voltage that the power domain\n is transitioned to after considering supported voltage ranges of all the registered\n dependents. \"voltage\" should be in uV.\n"]
7563 fn request_voltage(
7564 &mut self,
7565
7566 request: ::fidl_next::Request<device::RequestVoltage, ___T>,
7567
7568 responder: ::fidl_next::Responder<device::RequestVoltage, ___T>,
7569 ) -> impl ::core::future::Future<Output = ()>;
7570
7571 #[doc = " Get current voltage in uV.\n"]
7572 fn get_current_voltage(
7573 &mut self,
7574
7575 request: ::fidl_next::Request<device::GetCurrentVoltage, ___T>,
7576
7577 responder: ::fidl_next::Responder<device::GetCurrentVoltage, ___T>,
7578 ) -> impl ::core::future::Future<Output = ()>;
7579
7580 #[doc = " Get power domain status\n"]
7581 fn get_power_domain_status(
7582 &mut self,
7583
7584 responder: ::fidl_next::Responder<device::GetPowerDomainStatus, ___T>,
7585 ) -> impl ::core::future::Future<Output = ()>;
7586
7587 #[doc = " Write to ctrl register of PMIC\n"]
7588 fn write_pmic_ctrl_reg(
7589 &mut self,
7590
7591 request: ::fidl_next::Request<device::WritePmicCtrlReg, ___T>,
7592
7593 responder: ::fidl_next::Responder<device::WritePmicCtrlReg, ___T>,
7594 ) -> impl ::core::future::Future<Output = ()>;
7595
7596 #[doc = " Read ctrl register of PMIC\n"]
7597 fn read_pmic_ctrl_reg(
7598 &mut self,
7599
7600 request: ::fidl_next::Request<device::ReadPmicCtrlReg, ___T>,
7601
7602 responder: ::fidl_next::Responder<device::ReadPmicCtrlReg, ___T>,
7603 ) -> impl ::core::future::Future<Output = ()>;
7604}
7605
7606impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
7607where
7608 ___H: DeviceLocalServerHandler<___T>,
7609 ___T: ::fidl_next::Transport,
7610 for<'de> crate::wire::DeviceRegisterPowerDomainRequest: ::fidl_next::Decode<
7611 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7612 Constraint = (),
7613 >,
7614 for<'de> crate::wire::DeviceRequestVoltageRequest: ::fidl_next::Decode<
7615 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7616 Constraint = (),
7617 >,
7618 for<'de> crate::wire::DeviceGetCurrentVoltageRequest: ::fidl_next::Decode<
7619 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7620 Constraint = (),
7621 >,
7622 for<'de> crate::wire::DeviceWritePmicCtrlRegRequest: ::fidl_next::Decode<
7623 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7624 Constraint = (),
7625 >,
7626 for<'de> crate::wire::DeviceReadPmicCtrlRegRequest: ::fidl_next::Decode<
7627 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7628 Constraint = (),
7629 >,
7630{
7631 async fn on_one_way(
7632 handler: &mut ___H,
7633 mut message: ::fidl_next::Message<___T>,
7634 ) -> ::core::result::Result<
7635 (),
7636 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7637 > {
7638 match *message.header().ordinal {
7639 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
7640 }
7641 }
7642
7643 async fn on_two_way(
7644 handler: &mut ___H,
7645 mut message: ::fidl_next::Message<___T>,
7646 responder: ::fidl_next::protocol::Responder<___T>,
7647 ) -> ::core::result::Result<
7648 (),
7649 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7650 > {
7651 match *message.header().ordinal {
7652 4458069386545205468 => {
7653 let responder = ::fidl_next::Responder::from_untyped(responder);
7654
7655 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7656 Ok(decoded) => {
7657 handler
7658 .register_power_domain(
7659 ::fidl_next::Request::from_decoded(decoded),
7660 responder,
7661 )
7662 .await;
7663 Ok(())
7664 }
7665 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7666 ordinal: 4458069386545205468,
7667 error,
7668 }),
7669 }
7670 }
7671
7672 7717805237469023337 => {
7673 let responder = ::fidl_next::Responder::from_untyped(responder);
7674
7675 handler.unregister_power_domain(responder).await;
7676 Ok(())
7677 }
7678
7679 7887361504891407856 => {
7680 let responder = ::fidl_next::Responder::from_untyped(responder);
7681
7682 handler.get_supported_voltage_range(responder).await;
7683 Ok(())
7684 }
7685
7686 2578932345713622683 => {
7687 let responder = ::fidl_next::Responder::from_untyped(responder);
7688
7689 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7690 Ok(decoded) => {
7691 handler
7692 .request_voltage(::fidl_next::Request::from_decoded(decoded), responder)
7693 .await;
7694 Ok(())
7695 }
7696 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7697 ordinal: 2578932345713622683,
7698 error,
7699 }),
7700 }
7701 }
7702
7703 7683000915093989729 => {
7704 let responder = ::fidl_next::Responder::from_untyped(responder);
7705
7706 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7707 Ok(decoded) => {
7708 handler
7709 .get_current_voltage(
7710 ::fidl_next::Request::from_decoded(decoded),
7711 responder,
7712 )
7713 .await;
7714 Ok(())
7715 }
7716 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7717 ordinal: 7683000915093989729,
7718 error,
7719 }),
7720 }
7721 }
7722
7723 4178917272116294842 => {
7724 let responder = ::fidl_next::Responder::from_untyped(responder);
7725
7726 handler.get_power_domain_status(responder).await;
7727 Ok(())
7728 }
7729
7730 3749867380549091993 => {
7731 let responder = ::fidl_next::Responder::from_untyped(responder);
7732
7733 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7734 Ok(decoded) => {
7735 handler
7736 .write_pmic_ctrl_reg(
7737 ::fidl_next::Request::from_decoded(decoded),
7738 responder,
7739 )
7740 .await;
7741 Ok(())
7742 }
7743 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7744 ordinal: 3749867380549091993,
7745 error,
7746 }),
7747 }
7748 }
7749
7750 8281766978930618131 => {
7751 let responder = ::fidl_next::Responder::from_untyped(responder);
7752
7753 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7754 Ok(decoded) => {
7755 handler
7756 .read_pmic_ctrl_reg(
7757 ::fidl_next::Request::from_decoded(decoded),
7758 responder,
7759 )
7760 .await;
7761 Ok(())
7762 }
7763 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7764 ordinal: 8281766978930618131,
7765 error,
7766 }),
7767 }
7768 }
7769
7770 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
7771 }
7772 }
7773}
7774
7775pub trait DeviceClientHandler<
7779 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7780 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7781>
7782{
7783}
7784
7785impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
7786where
7787 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
7788 ___T: ::fidl_next::Transport,
7789{
7790 async fn on_event(
7791 handler: &mut ___H,
7792 mut message: ::fidl_next::Message<___T>,
7793 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
7794 match *message.header().ordinal {
7795 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
7796 }
7797 }
7798}
7799
7800pub trait DeviceServerHandler<
7804 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7805 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7806>
7807{
7808 #[doc = " Register the callee for this power domain. The callee will be registered until\n UnregisterPowerDomain is called. Any voltage changes to the power domain will\n be made considering the min_needed_voltage(in uV) and max_supported_voltage(in uV) published here.\n If voltages mentioned are out of supported voltage range of domain(obtained by calling\n GetSupportedVoltageRange), the callee will be registered with the supported voltage range.\n"]
7809 fn register_power_domain(
7810 &mut self,
7811
7812 request: ::fidl_next::Request<device::RegisterPowerDomain, ___T>,
7813
7814 responder: ::fidl_next::Responder<device::RegisterPowerDomain, ___T>,
7815 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7816
7817 #[doc = " Unregister the callee for this power domain. The callee will no longer be considered as\n a dependent of this power domain.\n"]
7818 fn unregister_power_domain(
7819 &mut self,
7820
7821 responder: ::fidl_next::Responder<device::UnregisterPowerDomain, ___T>,
7822 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7823
7824 #[doc = " Get Supported Voltage Range. min and max are in micorVolts(uV)\n"]
7825 fn get_supported_voltage_range(
7826 &mut self,
7827
7828 responder: ::fidl_next::Responder<device::GetSupportedVoltageRange, ___T>,
7829 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7830
7831 #[doc = " Request a particular voltage. The actual_voltage is the voltage that the power domain\n is transitioned to after considering supported voltage ranges of all the registered\n dependents. \"voltage\" should be in uV.\n"]
7832 fn request_voltage(
7833 &mut self,
7834
7835 request: ::fidl_next::Request<device::RequestVoltage, ___T>,
7836
7837 responder: ::fidl_next::Responder<device::RequestVoltage, ___T>,
7838 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7839
7840 #[doc = " Get current voltage in uV.\n"]
7841 fn get_current_voltage(
7842 &mut self,
7843
7844 request: ::fidl_next::Request<device::GetCurrentVoltage, ___T>,
7845
7846 responder: ::fidl_next::Responder<device::GetCurrentVoltage, ___T>,
7847 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7848
7849 #[doc = " Get power domain status\n"]
7850 fn get_power_domain_status(
7851 &mut self,
7852
7853 responder: ::fidl_next::Responder<device::GetPowerDomainStatus, ___T>,
7854 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7855
7856 #[doc = " Write to ctrl register of PMIC\n"]
7857 fn write_pmic_ctrl_reg(
7858 &mut self,
7859
7860 request: ::fidl_next::Request<device::WritePmicCtrlReg, ___T>,
7861
7862 responder: ::fidl_next::Responder<device::WritePmicCtrlReg, ___T>,
7863 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7864
7865 #[doc = " Read ctrl register of PMIC\n"]
7866 fn read_pmic_ctrl_reg(
7867 &mut self,
7868
7869 request: ::fidl_next::Request<device::ReadPmicCtrlReg, ___T>,
7870
7871 responder: ::fidl_next::Responder<device::ReadPmicCtrlReg, ___T>,
7872 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7873}
7874
7875impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
7876where
7877 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
7878 ___T: ::fidl_next::Transport,
7879 for<'de> crate::wire::DeviceRegisterPowerDomainRequest: ::fidl_next::Decode<
7880 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7881 Constraint = (),
7882 >,
7883 for<'de> crate::wire::DeviceRequestVoltageRequest: ::fidl_next::Decode<
7884 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7885 Constraint = (),
7886 >,
7887 for<'de> crate::wire::DeviceGetCurrentVoltageRequest: ::fidl_next::Decode<
7888 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7889 Constraint = (),
7890 >,
7891 for<'de> crate::wire::DeviceWritePmicCtrlRegRequest: ::fidl_next::Decode<
7892 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7893 Constraint = (),
7894 >,
7895 for<'de> crate::wire::DeviceReadPmicCtrlRegRequest: ::fidl_next::Decode<
7896 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7897 Constraint = (),
7898 >,
7899{
7900 async fn on_one_way(
7901 handler: &mut ___H,
7902 mut message: ::fidl_next::Message<___T>,
7903 ) -> ::core::result::Result<
7904 (),
7905 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7906 > {
7907 match *message.header().ordinal {
7908 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
7909 }
7910 }
7911
7912 async fn on_two_way(
7913 handler: &mut ___H,
7914 mut message: ::fidl_next::Message<___T>,
7915 responder: ::fidl_next::protocol::Responder<___T>,
7916 ) -> ::core::result::Result<
7917 (),
7918 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7919 > {
7920 match *message.header().ordinal {
7921 4458069386545205468 => {
7922 let responder = ::fidl_next::Responder::from_untyped(responder);
7923
7924 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7925 Ok(decoded) => {
7926 handler
7927 .register_power_domain(
7928 ::fidl_next::Request::from_decoded(decoded),
7929 responder,
7930 )
7931 .await;
7932 Ok(())
7933 }
7934 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7935 ordinal: 4458069386545205468,
7936 error,
7937 }),
7938 }
7939 }
7940
7941 7717805237469023337 => {
7942 let responder = ::fidl_next::Responder::from_untyped(responder);
7943
7944 handler.unregister_power_domain(responder).await;
7945 Ok(())
7946 }
7947
7948 7887361504891407856 => {
7949 let responder = ::fidl_next::Responder::from_untyped(responder);
7950
7951 handler.get_supported_voltage_range(responder).await;
7952 Ok(())
7953 }
7954
7955 2578932345713622683 => {
7956 let responder = ::fidl_next::Responder::from_untyped(responder);
7957
7958 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7959 Ok(decoded) => {
7960 handler
7961 .request_voltage(::fidl_next::Request::from_decoded(decoded), responder)
7962 .await;
7963 Ok(())
7964 }
7965 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7966 ordinal: 2578932345713622683,
7967 error,
7968 }),
7969 }
7970 }
7971
7972 7683000915093989729 => {
7973 let responder = ::fidl_next::Responder::from_untyped(responder);
7974
7975 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7976 Ok(decoded) => {
7977 handler
7978 .get_current_voltage(
7979 ::fidl_next::Request::from_decoded(decoded),
7980 responder,
7981 )
7982 .await;
7983 Ok(())
7984 }
7985 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7986 ordinal: 7683000915093989729,
7987 error,
7988 }),
7989 }
7990 }
7991
7992 4178917272116294842 => {
7993 let responder = ::fidl_next::Responder::from_untyped(responder);
7994
7995 handler.get_power_domain_status(responder).await;
7996 Ok(())
7997 }
7998
7999 3749867380549091993 => {
8000 let responder = ::fidl_next::Responder::from_untyped(responder);
8001
8002 match ::fidl_next::AsDecoderExt::into_decoded(message) {
8003 Ok(decoded) => {
8004 handler
8005 .write_pmic_ctrl_reg(
8006 ::fidl_next::Request::from_decoded(decoded),
8007 responder,
8008 )
8009 .await;
8010 Ok(())
8011 }
8012 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8013 ordinal: 3749867380549091993,
8014 error,
8015 }),
8016 }
8017 }
8018
8019 8281766978930618131 => {
8020 let responder = ::fidl_next::Responder::from_untyped(responder);
8021
8022 match ::fidl_next::AsDecoderExt::into_decoded(message) {
8023 Ok(decoded) => {
8024 handler
8025 .read_pmic_ctrl_reg(
8026 ::fidl_next::Request::from_decoded(decoded),
8027 responder,
8028 )
8029 .await;
8030 Ok(())
8031 }
8032 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8033 ordinal: 8281766978930618131,
8034 error,
8035 }),
8036 }
8037 }
8038
8039 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
8040 }
8041 }
8042}
8043
8044impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
8045{}
8046
8047impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
8048where
8049 ___H: DeviceClientHandler<___T>,
8050 ___T: ::fidl_next::Transport,
8051{
8052}
8053
8054impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
8055where
8056 ___H: DeviceServerHandler<___T>,
8057 ___T: ::fidl_next::Transport,
8058{
8059 async fn register_power_domain(
8060 &mut self,
8061
8062 request: ::fidl_next::Request<device::RegisterPowerDomain, ___T>,
8063
8064 responder: ::fidl_next::Responder<device::RegisterPowerDomain, ___T>,
8065 ) {
8066 ___H::register_power_domain(&mut self.0, request, responder).await
8067 }
8068
8069 async fn unregister_power_domain(
8070 &mut self,
8071
8072 responder: ::fidl_next::Responder<device::UnregisterPowerDomain, ___T>,
8073 ) {
8074 ___H::unregister_power_domain(&mut self.0, responder).await
8075 }
8076
8077 async fn get_supported_voltage_range(
8078 &mut self,
8079
8080 responder: ::fidl_next::Responder<device::GetSupportedVoltageRange, ___T>,
8081 ) {
8082 ___H::get_supported_voltage_range(&mut self.0, responder).await
8083 }
8084
8085 async fn request_voltage(
8086 &mut self,
8087
8088 request: ::fidl_next::Request<device::RequestVoltage, ___T>,
8089
8090 responder: ::fidl_next::Responder<device::RequestVoltage, ___T>,
8091 ) {
8092 ___H::request_voltage(&mut self.0, request, responder).await
8093 }
8094
8095 async fn get_current_voltage(
8096 &mut self,
8097
8098 request: ::fidl_next::Request<device::GetCurrentVoltage, ___T>,
8099
8100 responder: ::fidl_next::Responder<device::GetCurrentVoltage, ___T>,
8101 ) {
8102 ___H::get_current_voltage(&mut self.0, request, responder).await
8103 }
8104
8105 async fn get_power_domain_status(
8106 &mut self,
8107
8108 responder: ::fidl_next::Responder<device::GetPowerDomainStatus, ___T>,
8109 ) {
8110 ___H::get_power_domain_status(&mut self.0, responder).await
8111 }
8112
8113 async fn write_pmic_ctrl_reg(
8114 &mut self,
8115
8116 request: ::fidl_next::Request<device::WritePmicCtrlReg, ___T>,
8117
8118 responder: ::fidl_next::Responder<device::WritePmicCtrlReg, ___T>,
8119 ) {
8120 ___H::write_pmic_ctrl_reg(&mut self.0, request, responder).await
8121 }
8122
8123 async fn read_pmic_ctrl_reg(
8124 &mut self,
8125
8126 request: ::fidl_next::Request<device::ReadPmicCtrlReg, ___T>,
8127
8128 responder: ::fidl_next::Responder<device::ReadPmicCtrlReg, ___T>,
8129 ) {
8130 ___H::read_pmic_ctrl_reg(&mut self.0, request, responder).await
8131 }
8132}