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, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3674 pub struct Domain {
3675 pub id: ::core::option::Option<u32>,
3676
3677 pub name: ::core::option::Option<::std::string::String>,
3678
3679 pub global_id: ::core::option::Option<u32>,
3680 }
3681
3682 impl Domain {
3683 fn __max_ordinal(&self) -> usize {
3684 if self.global_id.is_some() {
3685 return 3;
3686 }
3687
3688 if self.name.is_some() {
3689 return 2;
3690 }
3691
3692 if self.id.is_some() {
3693 return 1;
3694 }
3695
3696 0
3697 }
3698 }
3699
3700 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Domain<'static>, ___E> for Domain
3701 where
3702 ___E: ::fidl_next::Encoder + ?Sized,
3703 {
3704 #[inline]
3705 fn encode(
3706 mut self,
3707 encoder: &mut ___E,
3708 out: &mut ::core::mem::MaybeUninit<crate::wire::Domain<'static>>,
3709 _: (),
3710 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3711 ::fidl_next::munge!(let crate::wire::Domain { table } = out);
3712
3713 let max_ord = self.__max_ordinal();
3714
3715 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
3716 ::fidl_next::Wire::zero_padding(&mut out);
3717
3718 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
3719 ::fidl_next::wire::Envelope,
3720 >(encoder, max_ord);
3721
3722 for i in 1..=max_ord {
3723 match i {
3724 3 => {
3725 if let Some(value) = self.global_id.take() {
3726 ::fidl_next::wire::Envelope::encode_value::<
3727 ::fidl_next::wire::Uint32,
3728 ___E,
3729 >(
3730 value, preallocated.encoder, &mut out, ()
3731 )?;
3732 } else {
3733 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3734 }
3735 }
3736
3737 2 => {
3738 if let Some(value) = self.name.take() {
3739 ::fidl_next::wire::Envelope::encode_value::<
3740 ::fidl_next::wire::String<'static>,
3741 ___E,
3742 >(
3743 value, preallocated.encoder, &mut out, 64
3744 )?;
3745 } else {
3746 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3747 }
3748 }
3749
3750 1 => {
3751 if let Some(value) = self.id.take() {
3752 ::fidl_next::wire::Envelope::encode_value::<
3753 ::fidl_next::wire::Uint32,
3754 ___E,
3755 >(
3756 value, preallocated.encoder, &mut out, ()
3757 )?;
3758 } else {
3759 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3760 }
3761 }
3762
3763 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
3764 }
3765 unsafe {
3766 preallocated.write_next(out.assume_init_ref());
3767 }
3768 }
3769
3770 ::fidl_next::wire::Table::encode_len(table, max_ord);
3771
3772 Ok(())
3773 }
3774 }
3775
3776 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Domain<'static>, ___E> for &'a Domain
3777 where
3778 ___E: ::fidl_next::Encoder + ?Sized,
3779 {
3780 #[inline]
3781 fn encode(
3782 self,
3783 encoder: &mut ___E,
3784 out: &mut ::core::mem::MaybeUninit<crate::wire::Domain<'static>>,
3785 _: (),
3786 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3787 ::fidl_next::munge!(let crate::wire::Domain { table } = out);
3788
3789 let max_ord = self.__max_ordinal();
3790
3791 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
3792 ::fidl_next::Wire::zero_padding(&mut out);
3793
3794 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
3795 ::fidl_next::wire::Envelope,
3796 >(encoder, max_ord);
3797
3798 for i in 1..=max_ord {
3799 match i {
3800 3 => {
3801 if let Some(value) = &self.global_id {
3802 ::fidl_next::wire::Envelope::encode_value::<
3803 ::fidl_next::wire::Uint32,
3804 ___E,
3805 >(
3806 value, preallocated.encoder, &mut out, ()
3807 )?;
3808 } else {
3809 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3810 }
3811 }
3812
3813 2 => {
3814 if let Some(value) = &self.name {
3815 ::fidl_next::wire::Envelope::encode_value::<
3816 ::fidl_next::wire::String<'static>,
3817 ___E,
3818 >(
3819 value, preallocated.encoder, &mut out, 64
3820 )?;
3821 } else {
3822 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3823 }
3824 }
3825
3826 1 => {
3827 if let Some(value) = &self.id {
3828 ::fidl_next::wire::Envelope::encode_value::<
3829 ::fidl_next::wire::Uint32,
3830 ___E,
3831 >(
3832 value, preallocated.encoder, &mut out, ()
3833 )?;
3834 } else {
3835 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3836 }
3837 }
3838
3839 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
3840 }
3841 unsafe {
3842 preallocated.write_next(out.assume_init_ref());
3843 }
3844 }
3845
3846 ::fidl_next::wire::Table::encode_len(table, max_ord);
3847
3848 Ok(())
3849 }
3850 }
3851
3852 impl<'de> ::fidl_next::FromWire<crate::wire::Domain<'de>> for Domain {
3853 #[inline]
3854 fn from_wire(wire_: crate::wire::Domain<'de>) -> Self {
3855 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
3856
3857 let id = wire_.table.get(1);
3858
3859 let name = wire_.table.get(2);
3860
3861 let global_id = wire_.table.get(3);
3862
3863 Self {
3864 id: id.map(|envelope| {
3865 ::fidl_next::FromWire::from_wire(unsafe {
3866 envelope.read_unchecked::<::fidl_next::wire::Uint32>()
3867 })
3868 }),
3869
3870 name: name.map(|envelope| {
3871 ::fidl_next::FromWire::from_wire(unsafe {
3872 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
3873 })
3874 }),
3875
3876 global_id: global_id.map(|envelope| {
3877 ::fidl_next::FromWire::from_wire(unsafe {
3878 envelope.read_unchecked::<::fidl_next::wire::Uint32>()
3879 })
3880 }),
3881 }
3882 }
3883 }
3884
3885 impl<'de> ::fidl_next::FromWireRef<crate::wire::Domain<'de>> for Domain {
3886 #[inline]
3887 fn from_wire_ref(wire: &crate::wire::Domain<'de>) -> Self {
3888 Self {
3889 id: wire.table.get(1).map(|envelope| {
3890 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
3891 envelope.deref_unchecked::<::fidl_next::wire::Uint32>()
3892 })
3893 }),
3894
3895 name: wire.table.get(2).map(|envelope| {
3896 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
3897 envelope.deref_unchecked::<::fidl_next::wire::String<'de>>()
3898 })
3899 }),
3900
3901 global_id: wire.table.get(3).map(|envelope| {
3902 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
3903 envelope.deref_unchecked::<::fidl_next::wire::Uint32>()
3904 })
3905 }),
3906 }
3907 }
3908 }
3909
3910 #[doc = " Passed to the power core driver in metadata.\n"]
3911 #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3912 pub struct DomainMetadata {
3913 pub domains: ::core::option::Option<::std::vec::Vec<crate::natural::Domain>>,
3914 }
3915
3916 impl DomainMetadata {
3917 fn __max_ordinal(&self) -> usize {
3918 if self.domains.is_some() {
3919 return 1;
3920 }
3921
3922 0
3923 }
3924 }
3925
3926 unsafe impl<___E> ::fidl_next::Encode<crate::wire::DomainMetadata<'static>, ___E> for DomainMetadata
3927 where
3928 ___E: ::fidl_next::Encoder + ?Sized,
3929 {
3930 #[inline]
3931 fn encode(
3932 mut self,
3933 encoder: &mut ___E,
3934 out: &mut ::core::mem::MaybeUninit<crate::wire::DomainMetadata<'static>>,
3935 _: (),
3936 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3937 ::fidl_next::munge!(let crate::wire::DomainMetadata { table } = out);
3938
3939 let max_ord = self.__max_ordinal();
3940
3941 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
3942 ::fidl_next::Wire::zero_padding(&mut out);
3943
3944 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
3945 ::fidl_next::wire::Envelope,
3946 >(encoder, max_ord);
3947
3948 for i in 1..=max_ord {
3949 match i {
3950 1 => {
3951 if let Some(value) = self.domains.take() {
3952 ::fidl_next::wire::Envelope::encode_value::<
3953 ::fidl_next::wire::Vector<'static, crate::wire::Domain<'static>>,
3954 ___E,
3955 >(
3956 value, preallocated.encoder, &mut out, (4294967295, ())
3957 )?;
3958 } else {
3959 ::fidl_next::wire::Envelope::encode_zero(&mut out)
3960 }
3961 }
3962
3963 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
3964 }
3965 unsafe {
3966 preallocated.write_next(out.assume_init_ref());
3967 }
3968 }
3969
3970 ::fidl_next::wire::Table::encode_len(table, max_ord);
3971
3972 Ok(())
3973 }
3974 }
3975
3976 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::DomainMetadata<'static>, ___E>
3977 for &'a DomainMetadata
3978 where
3979 ___E: ::fidl_next::Encoder + ?Sized,
3980 {
3981 #[inline]
3982 fn encode(
3983 self,
3984 encoder: &mut ___E,
3985 out: &mut ::core::mem::MaybeUninit<crate::wire::DomainMetadata<'static>>,
3986 _: (),
3987 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3988 ::fidl_next::munge!(let crate::wire::DomainMetadata { table } = out);
3989
3990 let max_ord = self.__max_ordinal();
3991
3992 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
3993 ::fidl_next::Wire::zero_padding(&mut out);
3994
3995 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
3996 ::fidl_next::wire::Envelope,
3997 >(encoder, max_ord);
3998
3999 for i in 1..=max_ord {
4000 match i {
4001 1 => {
4002 if let Some(value) = &self.domains {
4003 ::fidl_next::wire::Envelope::encode_value::<
4004 ::fidl_next::wire::Vector<'static, crate::wire::Domain<'static>>,
4005 ___E,
4006 >(
4007 value, preallocated.encoder, &mut out, (4294967295, ())
4008 )?;
4009 } else {
4010 ::fidl_next::wire::Envelope::encode_zero(&mut out)
4011 }
4012 }
4013
4014 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
4015 }
4016 unsafe {
4017 preallocated.write_next(out.assume_init_ref());
4018 }
4019 }
4020
4021 ::fidl_next::wire::Table::encode_len(table, max_ord);
4022
4023 Ok(())
4024 }
4025 }
4026
4027 impl<'de> ::fidl_next::FromWire<crate::wire::DomainMetadata<'de>> for DomainMetadata {
4028 #[inline]
4029 fn from_wire(wire_: crate::wire::DomainMetadata<'de>) -> Self {
4030 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
4031
4032 let domains = wire_.table.get(1);
4033
4034 Self {
4035
4036
4037 domains: domains.map(|envelope| ::fidl_next::FromWire::from_wire(
4038 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>() }
4039 )),
4040
4041 }
4042 }
4043 }
4044
4045 impl<'de> ::fidl_next::FromWireRef<crate::wire::DomainMetadata<'de>> for DomainMetadata {
4046 #[inline]
4047 fn from_wire_ref(wire: &crate::wire::DomainMetadata<'de>) -> Self {
4048 Self {
4049
4050
4051 domains: wire.table.get(1)
4052 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
4053 unsafe { envelope.deref_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>() }
4054 )),
4055
4056 }
4057 }
4058 }
4059
4060 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
4061 #[repr(u32)]
4062 pub enum FrameworkElementLevels {
4063 Off = 0,
4064 On = 1,
4065 }
4066 impl ::core::convert::TryFrom<u32> for FrameworkElementLevels {
4067 type Error = ::fidl_next::UnknownStrictEnumMemberError;
4068 fn try_from(
4069 value: u32,
4070 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
4071 match value {
4072 0 => Ok(Self::Off),
4073 1 => Ok(Self::On),
4074
4075 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
4076 }
4077 }
4078 }
4079
4080 impl ::std::convert::From<FrameworkElementLevels> for u32 {
4081 fn from(value: FrameworkElementLevels) -> Self {
4082 match value {
4083 FrameworkElementLevels::Off => 0,
4084 FrameworkElementLevels::On => 1,
4085 }
4086 }
4087 }
4088
4089 unsafe impl<___E> ::fidl_next::Encode<crate::wire::FrameworkElementLevels, ___E>
4090 for FrameworkElementLevels
4091 where
4092 ___E: ?Sized,
4093 {
4094 #[inline]
4095 fn encode(
4096 self,
4097 encoder: &mut ___E,
4098 out: &mut ::core::mem::MaybeUninit<crate::wire::FrameworkElementLevels>,
4099 _: (),
4100 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
4101 ::fidl_next::Encode::encode(&self, encoder, out, ())
4102 }
4103 }
4104
4105 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::FrameworkElementLevels, ___E>
4106 for &'a FrameworkElementLevels
4107 where
4108 ___E: ?Sized,
4109 {
4110 #[inline]
4111 fn encode(
4112 self,
4113 encoder: &mut ___E,
4114 out: &mut ::core::mem::MaybeUninit<crate::wire::FrameworkElementLevels>,
4115 _: (),
4116 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
4117 ::fidl_next::munge!(let crate::wire::FrameworkElementLevels { value } = out);
4118 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
4119 FrameworkElementLevels::Off => 0,
4120
4121 FrameworkElementLevels::On => 1,
4122 }));
4123
4124 Ok(())
4125 }
4126 }
4127
4128 impl ::core::convert::From<crate::wire::FrameworkElementLevels> for FrameworkElementLevels {
4129 fn from(wire: crate::wire::FrameworkElementLevels) -> Self {
4130 match u32::from(wire.value) {
4131 0 => Self::Off,
4132
4133 1 => Self::On,
4134
4135 _ => unsafe { ::core::hint::unreachable_unchecked() },
4136 }
4137 }
4138 }
4139
4140 impl ::fidl_next::FromWire<crate::wire::FrameworkElementLevels> for FrameworkElementLevels {
4141 #[inline]
4142 fn from_wire(wire: crate::wire::FrameworkElementLevels) -> Self {
4143 Self::from(wire)
4144 }
4145 }
4146
4147 impl ::fidl_next::FromWireRef<crate::wire::FrameworkElementLevels> for FrameworkElementLevels {
4148 #[inline]
4149 fn from_wire_ref(wire: &crate::wire::FrameworkElementLevels) -> Self {
4150 Self::from(*wire)
4151 }
4152 }
4153}
4154
4155pub mod wire {
4156
4157 #[repr(C)]
4159 pub struct Transition<'de> {
4160 pub(crate) table: ::fidl_next::wire::Table<'de>,
4161 }
4162
4163 impl<'de> Drop for Transition<'de> {
4164 fn drop(&mut self) {
4165 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
4166
4167 let _ = self
4168 .table
4169 .get(2)
4170 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
4171 }
4172 }
4173
4174 impl ::fidl_next::Constrained for Transition<'_> {
4175 type Constraint = ();
4176
4177 fn validate(
4178 _: ::fidl_next::Slot<'_, Self>,
4179 _: Self::Constraint,
4180 ) -> Result<(), ::fidl_next::ValidationError> {
4181 Ok(())
4182 }
4183 }
4184
4185 unsafe impl ::fidl_next::Wire for Transition<'static> {
4186 type Narrowed<'de> = Transition<'de>;
4187
4188 #[inline]
4189 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4190 ::fidl_next::munge!(let Self { table } = out);
4191 ::fidl_next::wire::Table::zero_padding(table);
4192 }
4193 }
4194
4195 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Transition<'de>
4196 where
4197 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4198 {
4199 fn decode(
4200 slot: ::fidl_next::Slot<'_, Self>,
4201 decoder: &mut ___D,
4202 _: (),
4203 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4204 ::fidl_next::munge!(let Self { table } = slot);
4205
4206 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4207 match ordinal {
4208 0 => unsafe { ::core::hint::unreachable_unchecked() },
4209
4210 1 => {
4211 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
4212 slot.as_mut(),
4213 decoder,
4214 (),
4215 )?;
4216
4217 Ok(())
4218 }
4219
4220 2 => {
4221 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
4222 slot.as_mut(),
4223 decoder,
4224 (),
4225 )?;
4226
4227 Ok(())
4228 }
4229
4230 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4231 }
4232 })
4233 }
4234 }
4235
4236 impl<'de> Transition<'de> {
4237 pub fn target_level(&self) -> ::core::option::Option<&u8> {
4238 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4239 }
4240
4241 pub fn take_target_level(&mut self) -> ::core::option::Option<u8> {
4242 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4243 }
4244
4245 pub fn latency_us(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
4246 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4247 }
4248
4249 pub fn take_latency_us(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint32> {
4250 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4251 }
4252 }
4253
4254 impl<'de> ::core::fmt::Debug for Transition<'de> {
4255 fn fmt(
4256 &self,
4257 f: &mut ::core::fmt::Formatter<'_>,
4258 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4259 f.debug_struct("Transition")
4260 .field("target_level", &self.target_level())
4261 .field("latency_us", &self.latency_us())
4262 .finish()
4263 }
4264 }
4265
4266 impl<'de> ::fidl_next::IntoNatural for Transition<'de> {
4267 type Natural = crate::natural::Transition;
4268 }
4269
4270 #[repr(C)]
4272 pub struct PowerLevel<'de> {
4273 pub(crate) table: ::fidl_next::wire::Table<'de>,
4274 }
4275
4276 impl<'de> Drop for PowerLevel<'de> {
4277 fn drop(&mut self) {
4278 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
4279
4280 let _ = self.table.get(2).map(|envelope| unsafe {
4281 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
4282 });
4283
4284 let _ = self.table.get(3).map(|envelope| unsafe {
4285 envelope
4286 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>>(
4287 )
4288 });
4289 }
4290 }
4291
4292 impl ::fidl_next::Constrained for PowerLevel<'_> {
4293 type Constraint = ();
4294
4295 fn validate(
4296 _: ::fidl_next::Slot<'_, Self>,
4297 _: Self::Constraint,
4298 ) -> Result<(), ::fidl_next::ValidationError> {
4299 Ok(())
4300 }
4301 }
4302
4303 unsafe impl ::fidl_next::Wire for PowerLevel<'static> {
4304 type Narrowed<'de> = PowerLevel<'de>;
4305
4306 #[inline]
4307 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4308 ::fidl_next::munge!(let Self { table } = out);
4309 ::fidl_next::wire::Table::zero_padding(table);
4310 }
4311 }
4312
4313 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerLevel<'de>
4314 where
4315 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4316 {
4317 fn decode(
4318 slot: ::fidl_next::Slot<'_, Self>,
4319 decoder: &mut ___D,
4320 _: (),
4321 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4322 ::fidl_next::munge!(let Self { table } = slot);
4323
4324 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4325 match ordinal {
4326 0 => unsafe { ::core::hint::unreachable_unchecked() },
4327
4328 1 => {
4329 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
4330 slot.as_mut(),
4331 decoder,
4332 (),
4333 )?;
4334
4335 Ok(())
4336 }
4337
4338 2 => {
4339 ::fidl_next::wire::Envelope::decode_as::<
4340 ___D,
4341 ::fidl_next::wire::String<'de>,
4342 >(slot.as_mut(), decoder, 63)?;
4343
4344 let value = unsafe {
4345 slot.deref_unchecked()
4346 .deref_unchecked::<::fidl_next::wire::String<'_>>()
4347 };
4348
4349 if value.len() > 63 {
4350 return Err(::fidl_next::DecodeError::VectorTooLong {
4351 size: value.len() as u64,
4352 limit: 63,
4353 });
4354 }
4355
4356 Ok(())
4357 }
4358
4359 3 => {
4360 ::fidl_next::wire::Envelope::decode_as::<
4361 ___D,
4362 ::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>,
4363 >(slot.as_mut(), decoder, (127, ()))?;
4364
4365 let value = unsafe {
4366 slot
4367 .deref_unchecked()
4368 .deref_unchecked::<
4369 ::fidl_next::wire::Vector<'_, crate::wire::Transition<'_>>
4370 >()
4371 };
4372
4373 if value.len() > 127 {
4374 return Err(::fidl_next::DecodeError::VectorTooLong {
4375 size: value.len() as u64,
4376 limit: 127,
4377 });
4378 }
4379
4380 Ok(())
4381 }
4382
4383 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4384 }
4385 })
4386 }
4387 }
4388
4389 impl<'de> PowerLevel<'de> {
4390 pub fn level(&self) -> ::core::option::Option<&u8> {
4391 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4392 }
4393
4394 pub fn take_level(&mut self) -> ::core::option::Option<u8> {
4395 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4396 }
4397
4398 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
4399 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4400 }
4401
4402 pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
4403 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4404 }
4405
4406 pub fn transitions(
4407 &self,
4408 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>>
4409 {
4410 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
4411 }
4412
4413 pub fn take_transitions(
4414 &mut self,
4415 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::Transition<'de>>>
4416 {
4417 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
4418 }
4419 }
4420
4421 impl<'de> ::core::fmt::Debug for PowerLevel<'de> {
4422 fn fmt(
4423 &self,
4424 f: &mut ::core::fmt::Formatter<'_>,
4425 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4426 f.debug_struct("PowerLevel")
4427 .field("level", &self.level())
4428 .field("name", &self.name())
4429 .field("transitions", &self.transitions())
4430 .finish()
4431 }
4432 }
4433
4434 impl<'de> ::fidl_next::IntoNatural for PowerLevel<'de> {
4435 type Natural = crate::natural::PowerLevel;
4436 }
4437
4438 #[repr(C)]
4440 pub struct PowerElement<'de> {
4441 pub(crate) table: ::fidl_next::wire::Table<'de>,
4442 }
4443
4444 impl<'de> Drop for PowerElement<'de> {
4445 fn drop(&mut self) {
4446 let _ = self.table.get(1).map(|envelope| unsafe {
4447 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
4448 });
4449
4450 let _ = self.table.get(2).map(|envelope| unsafe {
4451 envelope
4452 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>>(
4453 )
4454 });
4455 }
4456 }
4457
4458 impl ::fidl_next::Constrained for PowerElement<'_> {
4459 type Constraint = ();
4460
4461 fn validate(
4462 _: ::fidl_next::Slot<'_, Self>,
4463 _: Self::Constraint,
4464 ) -> Result<(), ::fidl_next::ValidationError> {
4465 Ok(())
4466 }
4467 }
4468
4469 unsafe impl ::fidl_next::Wire for PowerElement<'static> {
4470 type Narrowed<'de> = PowerElement<'de>;
4471
4472 #[inline]
4473 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4474 ::fidl_next::munge!(let Self { table } = out);
4475 ::fidl_next::wire::Table::zero_padding(table);
4476 }
4477 }
4478
4479 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerElement<'de>
4480 where
4481 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4482 {
4483 fn decode(
4484 slot: ::fidl_next::Slot<'_, Self>,
4485 decoder: &mut ___D,
4486 _: (),
4487 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4488 ::fidl_next::munge!(let Self { table } = slot);
4489
4490 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4491 match ordinal {
4492 0 => unsafe { ::core::hint::unreachable_unchecked() },
4493
4494 1 => {
4495 ::fidl_next::wire::Envelope::decode_as::<
4496 ___D,
4497 ::fidl_next::wire::String<'de>,
4498 >(slot.as_mut(), decoder, 63)?;
4499
4500 let value = unsafe {
4501 slot.deref_unchecked()
4502 .deref_unchecked::<::fidl_next::wire::String<'_>>()
4503 };
4504
4505 if value.len() > 63 {
4506 return Err(::fidl_next::DecodeError::VectorTooLong {
4507 size: value.len() as u64,
4508 limit: 63,
4509 });
4510 }
4511
4512 Ok(())
4513 }
4514
4515 2 => {
4516 ::fidl_next::wire::Envelope::decode_as::<
4517 ___D,
4518 ::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>,
4519 >(slot.as_mut(), decoder, (128, ()))?;
4520
4521 let value = unsafe {
4522 slot
4523 .deref_unchecked()
4524 .deref_unchecked::<
4525 ::fidl_next::wire::Vector<'_, crate::wire::PowerLevel<'_>>
4526 >()
4527 };
4528
4529 if value.len() > 128 {
4530 return Err(::fidl_next::DecodeError::VectorTooLong {
4531 size: value.len() as u64,
4532 limit: 128,
4533 });
4534 }
4535
4536 Ok(())
4537 }
4538
4539 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4540 }
4541 })
4542 }
4543 }
4544
4545 impl<'de> PowerElement<'de> {
4546 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
4547 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4548 }
4549
4550 pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
4551 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4552 }
4553
4554 pub fn levels(
4555 &self,
4556 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>>
4557 {
4558 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4559 }
4560
4561 pub fn take_levels(
4562 &mut self,
4563 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::PowerLevel<'de>>>
4564 {
4565 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4566 }
4567 }
4568
4569 impl<'de> ::core::fmt::Debug for PowerElement<'de> {
4570 fn fmt(
4571 &self,
4572 f: &mut ::core::fmt::Formatter<'_>,
4573 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4574 f.debug_struct("PowerElement")
4575 .field("name", &self.name())
4576 .field("levels", &self.levels())
4577 .finish()
4578 }
4579 }
4580
4581 impl<'de> ::fidl_next::IntoNatural for PowerElement<'de> {
4582 type Natural = crate::natural::PowerElement;
4583 }
4584
4585 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
4587 #[repr(transparent)]
4588 pub struct SagElement {
4589 pub(crate) value: ::fidl_next::wire::Uint32,
4590 }
4591
4592 impl ::fidl_next::Constrained for SagElement {
4593 type Constraint = ();
4594
4595 fn validate(
4596 _: ::fidl_next::Slot<'_, Self>,
4597 _: Self::Constraint,
4598 ) -> Result<(), ::fidl_next::ValidationError> {
4599 Ok(())
4600 }
4601 }
4602
4603 unsafe impl ::fidl_next::Wire for SagElement {
4604 type Narrowed<'de> = Self;
4605
4606 #[inline]
4607 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
4608 }
4610 }
4611
4612 impl SagElement {
4613 pub const EXECUTION_STATE: SagElement = SagElement { value: ::fidl_next::wire::Uint32(1) };
4614
4615 pub const APPLICATION_ACTIVITY: SagElement =
4616 SagElement { value: ::fidl_next::wire::Uint32(4) };
4617 }
4618
4619 unsafe impl<___D> ::fidl_next::Decode<___D> for SagElement
4620 where
4621 ___D: ?Sized,
4622 {
4623 fn decode(
4624 slot: ::fidl_next::Slot<'_, Self>,
4625 _: &mut ___D,
4626 _: (),
4627 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4628 ::fidl_next::munge!(let Self { value } = slot);
4629
4630 match u32::from(*value) {
4631 1 | 4 => (),
4632 unknown => {
4633 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
4634 }
4635 }
4636
4637 Ok(())
4638 }
4639 }
4640
4641 impl ::core::convert::From<crate::natural::SagElement> for SagElement {
4642 fn from(natural: crate::natural::SagElement) -> Self {
4643 match natural {
4644 crate::natural::SagElement::ExecutionState => SagElement::EXECUTION_STATE,
4645
4646 crate::natural::SagElement::ApplicationActivity => SagElement::APPLICATION_ACTIVITY,
4647 }
4648 }
4649 }
4650
4651 impl ::fidl_next::IntoNatural for SagElement {
4652 type Natural = crate::natural::SagElement;
4653 }
4654
4655 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
4657 #[repr(transparent)]
4658 pub struct CpuPowerElement {
4659 pub(crate) value: ::fidl_next::wire::Uint32,
4660 }
4661
4662 impl ::fidl_next::Constrained for CpuPowerElement {
4663 type Constraint = ();
4664
4665 fn validate(
4666 _: ::fidl_next::Slot<'_, Self>,
4667 _: Self::Constraint,
4668 ) -> Result<(), ::fidl_next::ValidationError> {
4669 Ok(())
4670 }
4671 }
4672
4673 unsafe impl ::fidl_next::Wire for CpuPowerElement {
4674 type Narrowed<'de> = Self;
4675
4676 #[inline]
4677 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
4678 }
4680 }
4681
4682 impl CpuPowerElement {
4683 pub const CPU: CpuPowerElement = CpuPowerElement { value: ::fidl_next::wire::Uint32(1) };
4684 }
4685
4686 unsafe impl<___D> ::fidl_next::Decode<___D> for CpuPowerElement
4687 where
4688 ___D: ?Sized,
4689 {
4690 fn decode(
4691 slot: ::fidl_next::Slot<'_, Self>,
4692 _: &mut ___D,
4693 _: (),
4694 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4695 ::fidl_next::munge!(let Self { value } = slot);
4696
4697 match u32::from(*value) {
4698 1 => (),
4699 unknown => {
4700 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
4701 }
4702 }
4703
4704 Ok(())
4705 }
4706 }
4707
4708 impl ::core::convert::From<crate::natural::CpuPowerElement> for CpuPowerElement {
4709 fn from(natural: crate::natural::CpuPowerElement) -> Self {
4710 match natural {
4711 crate::natural::CpuPowerElement::Cpu => CpuPowerElement::CPU,
4712 }
4713 }
4714 }
4715
4716 impl ::fidl_next::IntoNatural for CpuPowerElement {
4717 type Natural = crate::natural::CpuPowerElement;
4718 }
4719
4720 #[repr(transparent)]
4722 pub struct ParentElement<'de> {
4723 pub(crate) raw: ::fidl_next::wire::Union,
4724 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
4725 }
4726
4727 impl<'de> Drop for ParentElement<'de> {
4728 fn drop(&mut self) {
4729 match self.raw.ordinal() {
4730 1 => {
4731 let _ = unsafe { self.raw.get().read_unchecked::<crate::wire::SagElement>() };
4732 }
4733
4734 2 => {
4735 let _ = unsafe {
4736 self.raw.get().read_unchecked::<::fidl_next::wire::String<'de>>()
4737 };
4738 }
4739
4740 3 => {
4741 let _ =
4742 unsafe { self.raw.get().read_unchecked::<crate::wire::CpuPowerElement>() };
4743 }
4744
4745 _ => unsafe { ::core::hint::unreachable_unchecked() },
4746 }
4747 }
4748 }
4749
4750 impl ::fidl_next::Constrained for ParentElement<'_> {
4751 type Constraint = ();
4752
4753 fn validate(
4754 _: ::fidl_next::Slot<'_, Self>,
4755 _: Self::Constraint,
4756 ) -> Result<(), ::fidl_next::ValidationError> {
4757 Ok(())
4758 }
4759 }
4760
4761 unsafe impl ::fidl_next::Wire for ParentElement<'static> {
4762 type Narrowed<'de> = ParentElement<'de>;
4763
4764 #[inline]
4765 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4766 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
4767 ::fidl_next::wire::Union::zero_padding(raw);
4768 }
4769 }
4770
4771 pub mod parent_element {
4772 pub enum Ref<'de> {
4773 Sag(&'de crate::wire::SagElement),
4774
4775 InstanceName(&'de ::fidl_next::wire::String<'de>),
4776
4777 CpuControl(&'de crate::wire::CpuPowerElement),
4778 }
4779
4780 pub enum Value<'de> {
4781 Sag(crate::wire::SagElement),
4782
4783 InstanceName(::fidl_next::wire::String<'de>),
4784
4785 CpuControl(crate::wire::CpuPowerElement),
4786 }
4787 }
4788
4789 impl<'de> ParentElement<'de> {
4790 pub fn as_ref(&self) -> crate::wire::parent_element::Ref<'_> {
4791 match self.raw.ordinal() {
4792 1 => crate::wire::parent_element::Ref::Sag(unsafe {
4793 self.raw.get().deref_unchecked::<crate::wire::SagElement>()
4794 }),
4795
4796 2 => crate::wire::parent_element::Ref::InstanceName(unsafe {
4797 self.raw.get().deref_unchecked::<::fidl_next::wire::String<'_>>()
4798 }),
4799
4800 3 => crate::wire::parent_element::Ref::CpuControl(unsafe {
4801 self.raw.get().deref_unchecked::<crate::wire::CpuPowerElement>()
4802 }),
4803
4804 _ => unsafe { ::core::hint::unreachable_unchecked() },
4805 }
4806 }
4807
4808 pub fn into_inner(self) -> crate::wire::parent_element::Value<'de> {
4809 let this = ::core::mem::ManuallyDrop::new(self);
4810
4811 match this.raw.ordinal() {
4812 1 => crate::wire::parent_element::Value::Sag(unsafe {
4813 this.raw.get().read_unchecked::<crate::wire::SagElement>()
4814 }),
4815
4816 2 => crate::wire::parent_element::Value::InstanceName(unsafe {
4817 this.raw.get().read_unchecked::<::fidl_next::wire::String<'de>>()
4818 }),
4819
4820 3 => crate::wire::parent_element::Value::CpuControl(unsafe {
4821 this.raw.get().read_unchecked::<crate::wire::CpuPowerElement>()
4822 }),
4823
4824 _ => unsafe { ::core::hint::unreachable_unchecked() },
4825 }
4826 }
4827 }
4828
4829 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ParentElement<'de>
4830 where
4831 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
4832 ___D: ::fidl_next::Decoder<'de>,
4833 {
4834 fn decode(
4835 mut slot: ::fidl_next::Slot<'_, Self>,
4836 decoder: &mut ___D,
4837 _: (),
4838 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4839 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
4840 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
4841 1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::SagElement>(
4842 raw,
4843 decoder,
4844 (),
4845 )?,
4846
4847 2 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::String<'de>>(
4848 raw, decoder, 63,
4849 )?,
4850
4851 3 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::CpuPowerElement>(
4852 raw,
4853 decoder,
4854 (),
4855 )?,
4856
4857 ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)),
4858 }
4859
4860 Ok(())
4861 }
4862 }
4863
4864 impl<'de> ::core::fmt::Debug for ParentElement<'de> {
4865 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4866 match self.raw.ordinal() {
4867 1 => unsafe { self.raw.get().deref_unchecked::<crate::wire::SagElement>().fmt(f) },
4868 2 => unsafe {
4869 self.raw.get().deref_unchecked::<::fidl_next::wire::String<'_>>().fmt(f)
4870 },
4871 3 => unsafe {
4872 self.raw.get().deref_unchecked::<crate::wire::CpuPowerElement>().fmt(f)
4873 },
4874 _ => unsafe { ::core::hint::unreachable_unchecked() },
4875 }
4876 }
4877 }
4878
4879 impl<'de> ::fidl_next::IntoNatural for ParentElement<'de> {
4880 type Natural = crate::natural::ParentElement;
4881 }
4882
4883 #[repr(C)]
4885 pub struct LevelTuple<'de> {
4886 pub(crate) table: ::fidl_next::wire::Table<'de>,
4887 }
4888
4889 impl<'de> Drop for LevelTuple<'de> {
4890 fn drop(&mut self) {
4891 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
4892
4893 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
4894 }
4895 }
4896
4897 impl ::fidl_next::Constrained for LevelTuple<'_> {
4898 type Constraint = ();
4899
4900 fn validate(
4901 _: ::fidl_next::Slot<'_, Self>,
4902 _: Self::Constraint,
4903 ) -> Result<(), ::fidl_next::ValidationError> {
4904 Ok(())
4905 }
4906 }
4907
4908 unsafe impl ::fidl_next::Wire for LevelTuple<'static> {
4909 type Narrowed<'de> = LevelTuple<'de>;
4910
4911 #[inline]
4912 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4913 ::fidl_next::munge!(let Self { table } = out);
4914 ::fidl_next::wire::Table::zero_padding(table);
4915 }
4916 }
4917
4918 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LevelTuple<'de>
4919 where
4920 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4921 {
4922 fn decode(
4923 slot: ::fidl_next::Slot<'_, Self>,
4924 decoder: &mut ___D,
4925 _: (),
4926 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4927 ::fidl_next::munge!(let Self { table } = slot);
4928
4929 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4930 match ordinal {
4931 0 => unsafe { ::core::hint::unreachable_unchecked() },
4932
4933 1 => {
4934 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
4935 slot.as_mut(),
4936 decoder,
4937 (),
4938 )?;
4939
4940 Ok(())
4941 }
4942
4943 2 => {
4944 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
4945 slot.as_mut(),
4946 decoder,
4947 (),
4948 )?;
4949
4950 Ok(())
4951 }
4952
4953 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4954 }
4955 })
4956 }
4957 }
4958
4959 impl<'de> LevelTuple<'de> {
4960 pub fn child_level(&self) -> ::core::option::Option<&u8> {
4961 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4962 }
4963
4964 pub fn take_child_level(&mut self) -> ::core::option::Option<u8> {
4965 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4966 }
4967
4968 pub fn parent_level(&self) -> ::core::option::Option<&u8> {
4969 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4970 }
4971
4972 pub fn take_parent_level(&mut self) -> ::core::option::Option<u8> {
4973 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4974 }
4975 }
4976
4977 impl<'de> ::core::fmt::Debug for LevelTuple<'de> {
4978 fn fmt(
4979 &self,
4980 f: &mut ::core::fmt::Formatter<'_>,
4981 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4982 f.debug_struct("LevelTuple")
4983 .field("child_level", &self.child_level())
4984 .field("parent_level", &self.parent_level())
4985 .finish()
4986 }
4987 }
4988
4989 impl<'de> ::fidl_next::IntoNatural for LevelTuple<'de> {
4990 type Natural = crate::natural::LevelTuple;
4991 }
4992
4993 #[repr(C)]
4995 pub struct PowerDependency<'de> {
4996 pub(crate) table: ::fidl_next::wire::Table<'de>,
4997 }
4998
4999 impl<'de> Drop for PowerDependency<'de> {
5000 fn drop(&mut self) {
5001 let _ = self.table.get(1).map(|envelope| unsafe {
5002 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
5003 });
5004
5005 let _ = self.table.get(2).map(|envelope| unsafe {
5006 envelope.read_unchecked::<crate::wire::ParentElement<'de>>()
5007 });
5008
5009 let _ = self.table.get(3).map(|envelope| unsafe {
5010 envelope
5011 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>>(
5012 )
5013 });
5014 }
5015 }
5016
5017 impl ::fidl_next::Constrained for PowerDependency<'_> {
5018 type Constraint = ();
5019
5020 fn validate(
5021 _: ::fidl_next::Slot<'_, Self>,
5022 _: Self::Constraint,
5023 ) -> Result<(), ::fidl_next::ValidationError> {
5024 Ok(())
5025 }
5026 }
5027
5028 unsafe impl ::fidl_next::Wire for PowerDependency<'static> {
5029 type Narrowed<'de> = PowerDependency<'de>;
5030
5031 #[inline]
5032 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5033 ::fidl_next::munge!(let Self { table } = out);
5034 ::fidl_next::wire::Table::zero_padding(table);
5035 }
5036 }
5037
5038 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerDependency<'de>
5039 where
5040 ___D: ::fidl_next::Decoder<'de> + ?Sized,
5041 {
5042 fn decode(
5043 slot: ::fidl_next::Slot<'_, Self>,
5044 decoder: &mut ___D,
5045 _: (),
5046 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5047 ::fidl_next::munge!(let Self { table } = slot);
5048
5049 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
5050 match ordinal {
5051 0 => unsafe { ::core::hint::unreachable_unchecked() },
5052
5053 1 => {
5054 ::fidl_next::wire::Envelope::decode_as::<
5055 ___D,
5056 ::fidl_next::wire::String<'de>,
5057 >(slot.as_mut(), decoder, 63)?;
5058
5059 let value = unsafe {
5060 slot.deref_unchecked()
5061 .deref_unchecked::<::fidl_next::wire::String<'_>>()
5062 };
5063
5064 if value.len() > 63 {
5065 return Err(::fidl_next::DecodeError::VectorTooLong {
5066 size: value.len() as u64,
5067 limit: 63,
5068 });
5069 }
5070
5071 Ok(())
5072 }
5073
5074 2 => {
5075 ::fidl_next::wire::Envelope::decode_as::<
5076 ___D,
5077 crate::wire::ParentElement<'de>,
5078 >(slot.as_mut(), decoder, ())?;
5079
5080 Ok(())
5081 }
5082
5083 3 => {
5084 ::fidl_next::wire::Envelope::decode_as::<
5085 ___D,
5086 ::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>,
5087 >(slot.as_mut(), decoder, (128, ()))?;
5088
5089 let value = unsafe {
5090 slot
5091 .deref_unchecked()
5092 .deref_unchecked::<
5093 ::fidl_next::wire::Vector<'_, crate::wire::LevelTuple<'_>>
5094 >()
5095 };
5096
5097 if value.len() > 128 {
5098 return Err(::fidl_next::DecodeError::VectorTooLong {
5099 size: value.len() as u64,
5100 limit: 128,
5101 });
5102 }
5103
5104 Ok(())
5105 }
5106
5107 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
5108 }
5109 })
5110 }
5111 }
5112
5113 impl<'de> PowerDependency<'de> {
5114 pub fn child(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
5115 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5116 }
5117
5118 pub fn take_child(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
5119 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
5120 }
5121
5122 pub fn parent(&self) -> ::core::option::Option<&crate::wire::ParentElement<'de>> {
5123 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
5124 }
5125
5126 pub fn take_parent(&mut self) -> ::core::option::Option<crate::wire::ParentElement<'de>> {
5127 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
5128 }
5129
5130 pub fn level_deps(
5131 &self,
5132 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>>
5133 {
5134 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
5135 }
5136
5137 pub fn take_level_deps(
5138 &mut self,
5139 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::LevelTuple<'de>>>
5140 {
5141 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
5142 }
5143 }
5144
5145 impl<'de> ::core::fmt::Debug for PowerDependency<'de> {
5146 fn fmt(
5147 &self,
5148 f: &mut ::core::fmt::Formatter<'_>,
5149 ) -> ::core::result::Result<(), ::core::fmt::Error> {
5150 f.debug_struct("PowerDependency")
5151 .field("child", &self.child())
5152 .field("parent", &self.parent())
5153 .field("level_deps", &self.level_deps())
5154 .finish()
5155 }
5156 }
5157
5158 impl<'de> ::fidl_next::IntoNatural for PowerDependency<'de> {
5159 type Natural = crate::natural::PowerDependency;
5160 }
5161
5162 #[repr(C)]
5164 pub struct PowerElementConfiguration<'de> {
5165 pub(crate) table: ::fidl_next::wire::Table<'de>,
5166 }
5167
5168 impl<'de> Drop for PowerElementConfiguration<'de> {
5169 fn drop(&mut self) {
5170 let _ = self.table.get(1).map(|envelope| unsafe {
5171 envelope.read_unchecked::<crate::wire::PowerElement<'de>>()
5172 });
5173
5174 let _ = self.table.get(2)
5175 .map(|envelope| unsafe {
5176 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>>()
5177 });
5178 }
5179 }
5180
5181 impl ::fidl_next::Constrained for PowerElementConfiguration<'_> {
5182 type Constraint = ();
5183
5184 fn validate(
5185 _: ::fidl_next::Slot<'_, Self>,
5186 _: Self::Constraint,
5187 ) -> Result<(), ::fidl_next::ValidationError> {
5188 Ok(())
5189 }
5190 }
5191
5192 unsafe impl ::fidl_next::Wire for PowerElementConfiguration<'static> {
5193 type Narrowed<'de> = PowerElementConfiguration<'de>;
5194
5195 #[inline]
5196 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
5197 ::fidl_next::munge!(let Self { table } = out);
5198 ::fidl_next::wire::Table::zero_padding(table);
5199 }
5200 }
5201
5202 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for PowerElementConfiguration<'de>
5203 where
5204 ___D: ::fidl_next::Decoder<'de> + ?Sized,
5205 {
5206 fn decode(
5207 slot: ::fidl_next::Slot<'_, Self>,
5208 decoder: &mut ___D,
5209 _: (),
5210 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5211 ::fidl_next::munge!(let Self { table } = slot);
5212
5213 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
5214 match ordinal {
5215 0 => unsafe { ::core::hint::unreachable_unchecked() },
5216
5217 1 => {
5218 ::fidl_next::wire::Envelope::decode_as::<
5219 ___D,
5220 crate::wire::PowerElement<'de>,
5221 >(slot.as_mut(), decoder, ())?;
5222
5223 Ok(())
5224 }
5225
5226 2 => {
5227 ::fidl_next::wire::Envelope::decode_as::<
5228 ___D,
5229 ::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>,
5230 >(slot.as_mut(), decoder, (128, ()))?;
5231
5232 let value = unsafe {
5233 slot
5234 .deref_unchecked()
5235 .deref_unchecked::<
5236 ::fidl_next::wire::Vector<'_, crate::wire::PowerDependency<'_>>
5237 >()
5238 };
5239
5240 if value.len() > 128 {
5241 return Err(::fidl_next::DecodeError::VectorTooLong {
5242 size: value.len() as u64,
5243 limit: 128,
5244 });
5245 }
5246
5247 Ok(())
5248 }
5249
5250 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
5251 }
5252 })
5253 }
5254 }
5255
5256 impl<'de> PowerElementConfiguration<'de> {
5257 pub fn element(&self) -> ::core::option::Option<&crate::wire::PowerElement<'de>> {
5258 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5259 }
5260
5261 pub fn take_element(&mut self) -> ::core::option::Option<crate::wire::PowerElement<'de>> {
5262 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
5263 }
5264
5265 pub fn dependencies(
5266 &self,
5267 ) -> ::core::option::Option<
5268 &::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>,
5269 > {
5270 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
5271 }
5272
5273 pub fn take_dependencies(
5274 &mut self,
5275 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::PowerDependency<'de>>>
5276 {
5277 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
5278 }
5279 }
5280
5281 impl<'de> ::core::fmt::Debug for PowerElementConfiguration<'de> {
5282 fn fmt(
5283 &self,
5284 f: &mut ::core::fmt::Formatter<'_>,
5285 ) -> ::core::result::Result<(), ::core::fmt::Error> {
5286 f.debug_struct("PowerElementConfiguration")
5287 .field("element", &self.element())
5288 .field("dependencies", &self.dependencies())
5289 .finish()
5290 }
5291 }
5292
5293 impl<'de> ::fidl_next::IntoNatural for PowerElementConfiguration<'de> {
5294 type Natural = crate::natural::PowerElementConfiguration;
5295 }
5296
5297 #[derive(Debug)]
5299 #[repr(C)]
5300 pub struct ComponentPowerConfiguration<'de> {
5301 pub power_elements:
5302 ::fidl_next::wire::Vector<'de, crate::wire::PowerElementConfiguration<'de>>,
5303 }
5304
5305 static_assertions::const_assert_eq!(std::mem::size_of::<ComponentPowerConfiguration<'_>>(), 16);
5306 static_assertions::const_assert_eq!(std::mem::align_of::<ComponentPowerConfiguration<'_>>(), 8);
5307
5308 static_assertions::const_assert_eq!(
5309 std::mem::offset_of!(ComponentPowerConfiguration<'_>, power_elements),
5310 0
5311 );
5312
5313 impl ::fidl_next::Constrained for ComponentPowerConfiguration<'_> {
5314 type Constraint = ();
5315
5316 fn validate(
5317 _: ::fidl_next::Slot<'_, Self>,
5318 _: Self::Constraint,
5319 ) -> Result<(), ::fidl_next::ValidationError> {
5320 Ok(())
5321 }
5322 }
5323
5324 unsafe impl ::fidl_next::Wire for ComponentPowerConfiguration<'static> {
5325 type Narrowed<'de> = ComponentPowerConfiguration<'de>;
5326
5327 #[inline]
5328 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5329 ::fidl_next::munge! {
5330 let Self {
5331 power_elements,
5332
5333 } = &mut *out_;
5334 }
5335
5336 ::fidl_next::Wire::zero_padding(power_elements);
5337 }
5338 }
5339
5340 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ComponentPowerConfiguration<'de>
5341 where
5342 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5343 ___D: ::fidl_next::Decoder<'de>,
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 power_elements,
5353
5354 } = slot_;
5355 }
5356
5357 let _field = power_elements.as_mut();
5358 ::fidl_next::Constrained::validate(_field, (32, ()))?;
5359 ::fidl_next::Decode::decode(power_elements.as_mut(), decoder_, (32, ()))?;
5360
5361 let power_elements = unsafe { power_elements.deref_unchecked() };
5362
5363 if power_elements.len() > 32 {
5364 return Err(::fidl_next::DecodeError::VectorTooLong {
5365 size: power_elements.len() as u64,
5366 limit: 32,
5367 });
5368 }
5369
5370 Ok(())
5371 }
5372 }
5373
5374 impl<'de> ::fidl_next::IntoNatural for ComponentPowerConfiguration<'de> {
5375 type Natural = crate::natural::ComponentPowerConfiguration;
5376 }
5377
5378 #[derive(Clone, Debug)]
5380 #[repr(C)]
5381 pub struct DeviceRegisterPowerDomainRequest {
5382 pub min_needed_voltage: ::fidl_next::wire::Uint32,
5383
5384 pub max_supported_voltage: ::fidl_next::wire::Uint32,
5385 }
5386
5387 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceRegisterPowerDomainRequest>(), 8);
5388 static_assertions::const_assert_eq!(
5389 std::mem::align_of::<DeviceRegisterPowerDomainRequest>(),
5390 4
5391 );
5392
5393 static_assertions::const_assert_eq!(
5394 std::mem::offset_of!(DeviceRegisterPowerDomainRequest, min_needed_voltage),
5395 0
5396 );
5397
5398 static_assertions::const_assert_eq!(
5399 std::mem::offset_of!(DeviceRegisterPowerDomainRequest, max_supported_voltage),
5400 4
5401 );
5402
5403 impl ::fidl_next::Constrained for DeviceRegisterPowerDomainRequest {
5404 type Constraint = ();
5405
5406 fn validate(
5407 _: ::fidl_next::Slot<'_, Self>,
5408 _: Self::Constraint,
5409 ) -> Result<(), ::fidl_next::ValidationError> {
5410 Ok(())
5411 }
5412 }
5413
5414 unsafe impl ::fidl_next::Wire for DeviceRegisterPowerDomainRequest {
5415 type Narrowed<'de> = DeviceRegisterPowerDomainRequest;
5416
5417 #[inline]
5418 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5419 ::fidl_next::munge! {
5420 let Self {
5421 min_needed_voltage,
5422 max_supported_voltage,
5423
5424 } = &mut *out_;
5425 }
5426
5427 ::fidl_next::Wire::zero_padding(min_needed_voltage);
5428
5429 ::fidl_next::Wire::zero_padding(max_supported_voltage);
5430 }
5431 }
5432
5433 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceRegisterPowerDomainRequest
5434 where
5435 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5436 {
5437 fn decode(
5438 slot_: ::fidl_next::Slot<'_, Self>,
5439 decoder_: &mut ___D,
5440 _: (),
5441 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5442 ::fidl_next::munge! {
5443 let Self {
5444 mut min_needed_voltage,
5445 mut max_supported_voltage,
5446
5447 } = slot_;
5448 }
5449
5450 let _field = min_needed_voltage.as_mut();
5451
5452 ::fidl_next::Decode::decode(min_needed_voltage.as_mut(), decoder_, ())?;
5453
5454 let _field = max_supported_voltage.as_mut();
5455
5456 ::fidl_next::Decode::decode(max_supported_voltage.as_mut(), decoder_, ())?;
5457
5458 Ok(())
5459 }
5460 }
5461
5462 impl ::fidl_next::IntoNatural for DeviceRegisterPowerDomainRequest {
5463 type Natural = crate::natural::DeviceRegisterPowerDomainRequest;
5464 }
5465
5466 pub type DeviceRegisterPowerDomainResponse = ::fidl_next::wire::Unit;
5468
5469 pub type DeviceUnregisterPowerDomainResponse = ::fidl_next::wire::Unit;
5471
5472 #[derive(Clone, Debug)]
5474 #[repr(C)]
5475 pub struct DeviceGetSupportedVoltageRangeResponse {
5476 pub min: ::fidl_next::wire::Uint32,
5477
5478 pub max: ::fidl_next::wire::Uint32,
5479 }
5480
5481 static_assertions::const_assert_eq!(
5482 std::mem::size_of::<DeviceGetSupportedVoltageRangeResponse>(),
5483 8
5484 );
5485 static_assertions::const_assert_eq!(
5486 std::mem::align_of::<DeviceGetSupportedVoltageRangeResponse>(),
5487 4
5488 );
5489
5490 static_assertions::const_assert_eq!(
5491 std::mem::offset_of!(DeviceGetSupportedVoltageRangeResponse, min),
5492 0
5493 );
5494
5495 static_assertions::const_assert_eq!(
5496 std::mem::offset_of!(DeviceGetSupportedVoltageRangeResponse, max),
5497 4
5498 );
5499
5500 impl ::fidl_next::Constrained for DeviceGetSupportedVoltageRangeResponse {
5501 type Constraint = ();
5502
5503 fn validate(
5504 _: ::fidl_next::Slot<'_, Self>,
5505 _: Self::Constraint,
5506 ) -> Result<(), ::fidl_next::ValidationError> {
5507 Ok(())
5508 }
5509 }
5510
5511 unsafe impl ::fidl_next::Wire for DeviceGetSupportedVoltageRangeResponse {
5512 type Narrowed<'de> = DeviceGetSupportedVoltageRangeResponse;
5513
5514 #[inline]
5515 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5516 ::fidl_next::munge! {
5517 let Self {
5518 min,
5519 max,
5520
5521 } = &mut *out_;
5522 }
5523
5524 ::fidl_next::Wire::zero_padding(min);
5525
5526 ::fidl_next::Wire::zero_padding(max);
5527 }
5528 }
5529
5530 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetSupportedVoltageRangeResponse
5531 where
5532 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5533 {
5534 fn decode(
5535 slot_: ::fidl_next::Slot<'_, Self>,
5536 decoder_: &mut ___D,
5537 _: (),
5538 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5539 ::fidl_next::munge! {
5540 let Self {
5541 mut min,
5542 mut max,
5543
5544 } = slot_;
5545 }
5546
5547 let _field = min.as_mut();
5548
5549 ::fidl_next::Decode::decode(min.as_mut(), decoder_, ())?;
5550
5551 let _field = max.as_mut();
5552
5553 ::fidl_next::Decode::decode(max.as_mut(), decoder_, ())?;
5554
5555 Ok(())
5556 }
5557 }
5558
5559 impl ::fidl_next::IntoNatural for DeviceGetSupportedVoltageRangeResponse {
5560 type Natural = crate::natural::DeviceGetSupportedVoltageRangeResponse;
5561 }
5562
5563 #[derive(Clone, Debug)]
5565 #[repr(C)]
5566 pub struct DeviceRequestVoltageRequest {
5567 pub voltage: ::fidl_next::wire::Uint32,
5568 }
5569
5570 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceRequestVoltageRequest>(), 4);
5571 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceRequestVoltageRequest>(), 4);
5572
5573 static_assertions::const_assert_eq!(
5574 std::mem::offset_of!(DeviceRequestVoltageRequest, voltage),
5575 0
5576 );
5577
5578 impl ::fidl_next::Constrained for DeviceRequestVoltageRequest {
5579 type Constraint = ();
5580
5581 fn validate(
5582 _: ::fidl_next::Slot<'_, Self>,
5583 _: Self::Constraint,
5584 ) -> Result<(), ::fidl_next::ValidationError> {
5585 Ok(())
5586 }
5587 }
5588
5589 unsafe impl ::fidl_next::Wire for DeviceRequestVoltageRequest {
5590 type Narrowed<'de> = DeviceRequestVoltageRequest;
5591
5592 #[inline]
5593 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5594 ::fidl_next::munge! {
5595 let Self {
5596 voltage,
5597
5598 } = &mut *out_;
5599 }
5600
5601 ::fidl_next::Wire::zero_padding(voltage);
5602 }
5603 }
5604
5605 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceRequestVoltageRequest
5606 where
5607 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5608 {
5609 fn decode(
5610 slot_: ::fidl_next::Slot<'_, Self>,
5611 decoder_: &mut ___D,
5612 _: (),
5613 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5614 ::fidl_next::munge! {
5615 let Self {
5616 mut voltage,
5617
5618 } = slot_;
5619 }
5620
5621 let _field = voltage.as_mut();
5622
5623 ::fidl_next::Decode::decode(voltage.as_mut(), decoder_, ())?;
5624
5625 Ok(())
5626 }
5627 }
5628
5629 impl ::fidl_next::IntoNatural for DeviceRequestVoltageRequest {
5630 type Natural = crate::natural::DeviceRequestVoltageRequest;
5631 }
5632
5633 #[derive(Clone, Debug)]
5635 #[repr(C)]
5636 pub struct DeviceRequestVoltageResponse {
5637 pub actual_voltage: ::fidl_next::wire::Uint32,
5638 }
5639
5640 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceRequestVoltageResponse>(), 4);
5641 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceRequestVoltageResponse>(), 4);
5642
5643 static_assertions::const_assert_eq!(
5644 std::mem::offset_of!(DeviceRequestVoltageResponse, actual_voltage),
5645 0
5646 );
5647
5648 impl ::fidl_next::Constrained for DeviceRequestVoltageResponse {
5649 type Constraint = ();
5650
5651 fn validate(
5652 _: ::fidl_next::Slot<'_, Self>,
5653 _: Self::Constraint,
5654 ) -> Result<(), ::fidl_next::ValidationError> {
5655 Ok(())
5656 }
5657 }
5658
5659 unsafe impl ::fidl_next::Wire for DeviceRequestVoltageResponse {
5660 type Narrowed<'de> = DeviceRequestVoltageResponse;
5661
5662 #[inline]
5663 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5664 ::fidl_next::munge! {
5665 let Self {
5666 actual_voltage,
5667
5668 } = &mut *out_;
5669 }
5670
5671 ::fidl_next::Wire::zero_padding(actual_voltage);
5672 }
5673 }
5674
5675 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceRequestVoltageResponse
5676 where
5677 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5678 {
5679 fn decode(
5680 slot_: ::fidl_next::Slot<'_, Self>,
5681 decoder_: &mut ___D,
5682 _: (),
5683 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5684 ::fidl_next::munge! {
5685 let Self {
5686 mut actual_voltage,
5687
5688 } = slot_;
5689 }
5690
5691 let _field = actual_voltage.as_mut();
5692
5693 ::fidl_next::Decode::decode(actual_voltage.as_mut(), decoder_, ())?;
5694
5695 Ok(())
5696 }
5697 }
5698
5699 impl ::fidl_next::IntoNatural for DeviceRequestVoltageResponse {
5700 type Natural = crate::natural::DeviceRequestVoltageResponse;
5701 }
5702
5703 #[derive(Clone, Debug)]
5705 #[repr(C)]
5706 pub struct DeviceGetCurrentVoltageRequest {
5707 pub index: ::fidl_next::wire::Uint32,
5708 }
5709
5710 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetCurrentVoltageRequest>(), 4);
5711 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetCurrentVoltageRequest>(), 4);
5712
5713 static_assertions::const_assert_eq!(
5714 std::mem::offset_of!(DeviceGetCurrentVoltageRequest, index),
5715 0
5716 );
5717
5718 impl ::fidl_next::Constrained for DeviceGetCurrentVoltageRequest {
5719 type Constraint = ();
5720
5721 fn validate(
5722 _: ::fidl_next::Slot<'_, Self>,
5723 _: Self::Constraint,
5724 ) -> Result<(), ::fidl_next::ValidationError> {
5725 Ok(())
5726 }
5727 }
5728
5729 unsafe impl ::fidl_next::Wire for DeviceGetCurrentVoltageRequest {
5730 type Narrowed<'de> = DeviceGetCurrentVoltageRequest;
5731
5732 #[inline]
5733 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5734 ::fidl_next::munge! {
5735 let Self {
5736 index,
5737
5738 } = &mut *out_;
5739 }
5740
5741 ::fidl_next::Wire::zero_padding(index);
5742 }
5743 }
5744
5745 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetCurrentVoltageRequest
5746 where
5747 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5748 {
5749 fn decode(
5750 slot_: ::fidl_next::Slot<'_, Self>,
5751 decoder_: &mut ___D,
5752 _: (),
5753 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5754 ::fidl_next::munge! {
5755 let Self {
5756 mut index,
5757
5758 } = slot_;
5759 }
5760
5761 let _field = index.as_mut();
5762
5763 ::fidl_next::Decode::decode(index.as_mut(), decoder_, ())?;
5764
5765 Ok(())
5766 }
5767 }
5768
5769 impl ::fidl_next::IntoNatural for DeviceGetCurrentVoltageRequest {
5770 type Natural = crate::natural::DeviceGetCurrentVoltageRequest;
5771 }
5772
5773 #[derive(Clone, Debug)]
5775 #[repr(C)]
5776 pub struct DeviceGetCurrentVoltageResponse {
5777 pub current_voltage: ::fidl_next::wire::Uint32,
5778 }
5779
5780 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceGetCurrentVoltageResponse>(), 4);
5781 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceGetCurrentVoltageResponse>(), 4);
5782
5783 static_assertions::const_assert_eq!(
5784 std::mem::offset_of!(DeviceGetCurrentVoltageResponse, current_voltage),
5785 0
5786 );
5787
5788 impl ::fidl_next::Constrained for DeviceGetCurrentVoltageResponse {
5789 type Constraint = ();
5790
5791 fn validate(
5792 _: ::fidl_next::Slot<'_, Self>,
5793 _: Self::Constraint,
5794 ) -> Result<(), ::fidl_next::ValidationError> {
5795 Ok(())
5796 }
5797 }
5798
5799 unsafe impl ::fidl_next::Wire for DeviceGetCurrentVoltageResponse {
5800 type Narrowed<'de> = DeviceGetCurrentVoltageResponse;
5801
5802 #[inline]
5803 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5804 ::fidl_next::munge! {
5805 let Self {
5806 current_voltage,
5807
5808 } = &mut *out_;
5809 }
5810
5811 ::fidl_next::Wire::zero_padding(current_voltage);
5812 }
5813 }
5814
5815 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetCurrentVoltageResponse
5816 where
5817 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5818 {
5819 fn decode(
5820 slot_: ::fidl_next::Slot<'_, Self>,
5821 decoder_: &mut ___D,
5822 _: (),
5823 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5824 ::fidl_next::munge! {
5825 let Self {
5826 mut current_voltage,
5827
5828 } = slot_;
5829 }
5830
5831 let _field = current_voltage.as_mut();
5832
5833 ::fidl_next::Decode::decode(current_voltage.as_mut(), decoder_, ())?;
5834
5835 Ok(())
5836 }
5837 }
5838
5839 impl ::fidl_next::IntoNatural for DeviceGetCurrentVoltageResponse {
5840 type Natural = crate::natural::DeviceGetCurrentVoltageResponse;
5841 }
5842
5843 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
5845 #[repr(transparent)]
5846 pub struct PowerDomainStatus {
5847 pub(crate) value: u8,
5848 }
5849
5850 impl ::fidl_next::Constrained for PowerDomainStatus {
5851 type Constraint = ();
5852
5853 fn validate(
5854 _: ::fidl_next::Slot<'_, Self>,
5855 _: Self::Constraint,
5856 ) -> Result<(), ::fidl_next::ValidationError> {
5857 Ok(())
5858 }
5859 }
5860
5861 unsafe impl ::fidl_next::Wire for PowerDomainStatus {
5862 type Narrowed<'de> = Self;
5863
5864 #[inline]
5865 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
5866 }
5868 }
5869
5870 impl PowerDomainStatus {
5871 pub const DISABLED: PowerDomainStatus = PowerDomainStatus { value: 1 };
5872
5873 pub const ENABLED: PowerDomainStatus = PowerDomainStatus { value: 2 };
5874 }
5875
5876 unsafe impl<___D> ::fidl_next::Decode<___D> for PowerDomainStatus
5877 where
5878 ___D: ?Sized,
5879 {
5880 fn decode(
5881 slot: ::fidl_next::Slot<'_, Self>,
5882 _: &mut ___D,
5883 _: (),
5884 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5885 ::fidl_next::munge!(let Self { value } = slot);
5886
5887 match u8::from(*value) {
5888 1 | 2 => (),
5889 unknown => {
5890 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
5891 }
5892 }
5893
5894 Ok(())
5895 }
5896 }
5897
5898 impl ::core::convert::From<crate::natural::PowerDomainStatus> for PowerDomainStatus {
5899 fn from(natural: crate::natural::PowerDomainStatus) -> Self {
5900 match natural {
5901 crate::natural::PowerDomainStatus::Disabled => PowerDomainStatus::DISABLED,
5902
5903 crate::natural::PowerDomainStatus::Enabled => PowerDomainStatus::ENABLED,
5904 }
5905 }
5906 }
5907
5908 impl ::fidl_next::IntoNatural for PowerDomainStatus {
5909 type Natural = crate::natural::PowerDomainStatus;
5910 }
5911
5912 #[derive(Clone, Debug)]
5914 #[repr(C)]
5915 pub struct DeviceGetPowerDomainStatusResponse {
5916 pub status: crate::wire::PowerDomainStatus,
5917 }
5918
5919 static_assertions::const_assert_eq!(
5920 std::mem::size_of::<DeviceGetPowerDomainStatusResponse>(),
5921 1
5922 );
5923 static_assertions::const_assert_eq!(
5924 std::mem::align_of::<DeviceGetPowerDomainStatusResponse>(),
5925 1
5926 );
5927
5928 static_assertions::const_assert_eq!(
5929 std::mem::offset_of!(DeviceGetPowerDomainStatusResponse, status),
5930 0
5931 );
5932
5933 impl ::fidl_next::Constrained for DeviceGetPowerDomainStatusResponse {
5934 type Constraint = ();
5935
5936 fn validate(
5937 _: ::fidl_next::Slot<'_, Self>,
5938 _: Self::Constraint,
5939 ) -> Result<(), ::fidl_next::ValidationError> {
5940 Ok(())
5941 }
5942 }
5943
5944 unsafe impl ::fidl_next::Wire for DeviceGetPowerDomainStatusResponse {
5945 type Narrowed<'de> = DeviceGetPowerDomainStatusResponse;
5946
5947 #[inline]
5948 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
5949 ::fidl_next::munge! {
5950 let Self {
5951 status,
5952
5953 } = &mut *out_;
5954 }
5955
5956 ::fidl_next::Wire::zero_padding(status);
5957 }
5958 }
5959
5960 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceGetPowerDomainStatusResponse
5961 where
5962 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
5963 {
5964 fn decode(
5965 slot_: ::fidl_next::Slot<'_, Self>,
5966 decoder_: &mut ___D,
5967 _: (),
5968 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
5969 ::fidl_next::munge! {
5970 let Self {
5971 mut status,
5972
5973 } = slot_;
5974 }
5975
5976 let _field = status.as_mut();
5977
5978 ::fidl_next::Decode::decode(status.as_mut(), decoder_, ())?;
5979
5980 Ok(())
5981 }
5982 }
5983
5984 impl ::fidl_next::IntoNatural for DeviceGetPowerDomainStatusResponse {
5985 type Natural = crate::natural::DeviceGetPowerDomainStatusResponse;
5986 }
5987
5988 #[derive(Clone, Debug)]
5990 #[repr(C)]
5991 pub struct DeviceWritePmicCtrlRegRequest {
5992 pub reg_addr: ::fidl_next::wire::Uint32,
5993
5994 pub value: ::fidl_next::wire::Uint32,
5995 }
5996
5997 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceWritePmicCtrlRegRequest>(), 8);
5998 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceWritePmicCtrlRegRequest>(), 4);
5999
6000 static_assertions::const_assert_eq!(
6001 std::mem::offset_of!(DeviceWritePmicCtrlRegRequest, reg_addr),
6002 0
6003 );
6004
6005 static_assertions::const_assert_eq!(
6006 std::mem::offset_of!(DeviceWritePmicCtrlRegRequest, value),
6007 4
6008 );
6009
6010 impl ::fidl_next::Constrained for DeviceWritePmicCtrlRegRequest {
6011 type Constraint = ();
6012
6013 fn validate(
6014 _: ::fidl_next::Slot<'_, Self>,
6015 _: Self::Constraint,
6016 ) -> Result<(), ::fidl_next::ValidationError> {
6017 Ok(())
6018 }
6019 }
6020
6021 unsafe impl ::fidl_next::Wire for DeviceWritePmicCtrlRegRequest {
6022 type Narrowed<'de> = DeviceWritePmicCtrlRegRequest;
6023
6024 #[inline]
6025 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
6026 ::fidl_next::munge! {
6027 let Self {
6028 reg_addr,
6029 value,
6030
6031 } = &mut *out_;
6032 }
6033
6034 ::fidl_next::Wire::zero_padding(reg_addr);
6035
6036 ::fidl_next::Wire::zero_padding(value);
6037 }
6038 }
6039
6040 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceWritePmicCtrlRegRequest
6041 where
6042 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6043 {
6044 fn decode(
6045 slot_: ::fidl_next::Slot<'_, Self>,
6046 decoder_: &mut ___D,
6047 _: (),
6048 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6049 ::fidl_next::munge! {
6050 let Self {
6051 mut reg_addr,
6052 mut value,
6053
6054 } = slot_;
6055 }
6056
6057 let _field = reg_addr.as_mut();
6058
6059 ::fidl_next::Decode::decode(reg_addr.as_mut(), decoder_, ())?;
6060
6061 let _field = value.as_mut();
6062
6063 ::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
6064
6065 Ok(())
6066 }
6067 }
6068
6069 impl ::fidl_next::IntoNatural for DeviceWritePmicCtrlRegRequest {
6070 type Natural = crate::natural::DeviceWritePmicCtrlRegRequest;
6071 }
6072
6073 pub type DeviceWritePmicCtrlRegResponse = ::fidl_next::wire::Unit;
6075
6076 #[derive(Clone, Debug)]
6078 #[repr(C)]
6079 pub struct DeviceReadPmicCtrlRegRequest {
6080 pub reg_addr: ::fidl_next::wire::Uint32,
6081 }
6082
6083 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceReadPmicCtrlRegRequest>(), 4);
6084 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceReadPmicCtrlRegRequest>(), 4);
6085
6086 static_assertions::const_assert_eq!(
6087 std::mem::offset_of!(DeviceReadPmicCtrlRegRequest, reg_addr),
6088 0
6089 );
6090
6091 impl ::fidl_next::Constrained for DeviceReadPmicCtrlRegRequest {
6092 type Constraint = ();
6093
6094 fn validate(
6095 _: ::fidl_next::Slot<'_, Self>,
6096 _: Self::Constraint,
6097 ) -> Result<(), ::fidl_next::ValidationError> {
6098 Ok(())
6099 }
6100 }
6101
6102 unsafe impl ::fidl_next::Wire for DeviceReadPmicCtrlRegRequest {
6103 type Narrowed<'de> = DeviceReadPmicCtrlRegRequest;
6104
6105 #[inline]
6106 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
6107 ::fidl_next::munge! {
6108 let Self {
6109 reg_addr,
6110
6111 } = &mut *out_;
6112 }
6113
6114 ::fidl_next::Wire::zero_padding(reg_addr);
6115 }
6116 }
6117
6118 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceReadPmicCtrlRegRequest
6119 where
6120 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6121 {
6122 fn decode(
6123 slot_: ::fidl_next::Slot<'_, Self>,
6124 decoder_: &mut ___D,
6125 _: (),
6126 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6127 ::fidl_next::munge! {
6128 let Self {
6129 mut reg_addr,
6130
6131 } = slot_;
6132 }
6133
6134 let _field = reg_addr.as_mut();
6135
6136 ::fidl_next::Decode::decode(reg_addr.as_mut(), decoder_, ())?;
6137
6138 Ok(())
6139 }
6140 }
6141
6142 impl ::fidl_next::IntoNatural for DeviceReadPmicCtrlRegRequest {
6143 type Natural = crate::natural::DeviceReadPmicCtrlRegRequest;
6144 }
6145
6146 #[derive(Clone, Debug)]
6148 #[repr(C)]
6149 pub struct DeviceReadPmicCtrlRegResponse {
6150 pub value: ::fidl_next::wire::Uint32,
6151 }
6152
6153 static_assertions::const_assert_eq!(std::mem::size_of::<DeviceReadPmicCtrlRegResponse>(), 4);
6154 static_assertions::const_assert_eq!(std::mem::align_of::<DeviceReadPmicCtrlRegResponse>(), 4);
6155
6156 static_assertions::const_assert_eq!(
6157 std::mem::offset_of!(DeviceReadPmicCtrlRegResponse, value),
6158 0
6159 );
6160
6161 impl ::fidl_next::Constrained for DeviceReadPmicCtrlRegResponse {
6162 type Constraint = ();
6163
6164 fn validate(
6165 _: ::fidl_next::Slot<'_, Self>,
6166 _: Self::Constraint,
6167 ) -> Result<(), ::fidl_next::ValidationError> {
6168 Ok(())
6169 }
6170 }
6171
6172 unsafe impl ::fidl_next::Wire for DeviceReadPmicCtrlRegResponse {
6173 type Narrowed<'de> = DeviceReadPmicCtrlRegResponse;
6174
6175 #[inline]
6176 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
6177 ::fidl_next::munge! {
6178 let Self {
6179 value,
6180
6181 } = &mut *out_;
6182 }
6183
6184 ::fidl_next::Wire::zero_padding(value);
6185 }
6186 }
6187
6188 unsafe impl<___D> ::fidl_next::Decode<___D> for DeviceReadPmicCtrlRegResponse
6189 where
6190 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6191 {
6192 fn decode(
6193 slot_: ::fidl_next::Slot<'_, Self>,
6194 decoder_: &mut ___D,
6195 _: (),
6196 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6197 ::fidl_next::munge! {
6198 let Self {
6199 mut value,
6200
6201 } = slot_;
6202 }
6203
6204 let _field = value.as_mut();
6205
6206 ::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
6207
6208 Ok(())
6209 }
6210 }
6211
6212 impl ::fidl_next::IntoNatural for DeviceReadPmicCtrlRegResponse {
6213 type Natural = crate::natural::DeviceReadPmicCtrlRegResponse;
6214 }
6215
6216 #[repr(C)]
6218 pub struct Domain<'de> {
6219 pub(crate) table: ::fidl_next::wire::Table<'de>,
6220 }
6221
6222 impl<'de> Drop for Domain<'de> {
6223 fn drop(&mut self) {
6224 let _ = self
6225 .table
6226 .get(1)
6227 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
6228
6229 let _ = self.table.get(2).map(|envelope| unsafe {
6230 envelope.read_unchecked::<::fidl_next::wire::String<'de>>()
6231 });
6232
6233 let _ = self
6234 .table
6235 .get(3)
6236 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
6237 }
6238 }
6239
6240 impl ::fidl_next::Constrained for Domain<'_> {
6241 type Constraint = ();
6242
6243 fn validate(
6244 _: ::fidl_next::Slot<'_, Self>,
6245 _: Self::Constraint,
6246 ) -> Result<(), ::fidl_next::ValidationError> {
6247 Ok(())
6248 }
6249 }
6250
6251 unsafe impl ::fidl_next::Wire for Domain<'static> {
6252 type Narrowed<'de> = Domain<'de>;
6253
6254 #[inline]
6255 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6256 ::fidl_next::munge!(let Self { table } = out);
6257 ::fidl_next::wire::Table::zero_padding(table);
6258 }
6259 }
6260
6261 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Domain<'de>
6262 where
6263 ___D: ::fidl_next::Decoder<'de> + ?Sized,
6264 {
6265 fn decode(
6266 slot: ::fidl_next::Slot<'_, Self>,
6267 decoder: &mut ___D,
6268 _: (),
6269 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6270 ::fidl_next::munge!(let Self { table } = slot);
6271
6272 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
6273 match ordinal {
6274 0 => unsafe { ::core::hint::unreachable_unchecked() },
6275
6276 1 => {
6277 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
6278 slot.as_mut(),
6279 decoder,
6280 (),
6281 )?;
6282
6283 Ok(())
6284 }
6285
6286 2 => {
6287 ::fidl_next::wire::Envelope::decode_as::<
6288 ___D,
6289 ::fidl_next::wire::String<'de>,
6290 >(slot.as_mut(), decoder, 64)?;
6291
6292 let value = unsafe {
6293 slot.deref_unchecked()
6294 .deref_unchecked::<::fidl_next::wire::String<'_>>()
6295 };
6296
6297 if value.len() > 64 {
6298 return Err(::fidl_next::DecodeError::VectorTooLong {
6299 size: value.len() as u64,
6300 limit: 64,
6301 });
6302 }
6303
6304 Ok(())
6305 }
6306
6307 3 => {
6308 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
6309 slot.as_mut(),
6310 decoder,
6311 (),
6312 )?;
6313
6314 Ok(())
6315 }
6316
6317 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
6318 }
6319 })
6320 }
6321 }
6322
6323 impl<'de> Domain<'de> {
6324 pub fn id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
6325 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
6326 }
6327
6328 pub fn take_id(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint32> {
6329 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
6330 }
6331
6332 pub fn name(&self) -> ::core::option::Option<&::fidl_next::wire::String<'de>> {
6333 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
6334 }
6335
6336 pub fn take_name(&mut self) -> ::core::option::Option<::fidl_next::wire::String<'de>> {
6337 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
6338 }
6339
6340 pub fn global_id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
6341 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
6342 }
6343
6344 pub fn take_global_id(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint32> {
6345 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
6346 }
6347 }
6348
6349 impl<'de> ::core::fmt::Debug for Domain<'de> {
6350 fn fmt(
6351 &self,
6352 f: &mut ::core::fmt::Formatter<'_>,
6353 ) -> ::core::result::Result<(), ::core::fmt::Error> {
6354 f.debug_struct("Domain")
6355 .field("id", &self.id())
6356 .field("name", &self.name())
6357 .field("global_id", &self.global_id())
6358 .finish()
6359 }
6360 }
6361
6362 impl<'de> ::fidl_next::IntoNatural for Domain<'de> {
6363 type Natural = crate::natural::Domain;
6364 }
6365
6366 #[repr(C)]
6368 pub struct DomainMetadata<'de> {
6369 pub(crate) table: ::fidl_next::wire::Table<'de>,
6370 }
6371
6372 impl<'de> Drop for DomainMetadata<'de> {
6373 fn drop(&mut self) {
6374 let _ = self.table.get(1).map(|envelope| unsafe {
6375 envelope
6376 .read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>()
6377 });
6378 }
6379 }
6380
6381 impl ::fidl_next::Constrained for DomainMetadata<'_> {
6382 type Constraint = ();
6383
6384 fn validate(
6385 _: ::fidl_next::Slot<'_, Self>,
6386 _: Self::Constraint,
6387 ) -> Result<(), ::fidl_next::ValidationError> {
6388 Ok(())
6389 }
6390 }
6391
6392 unsafe impl ::fidl_next::Wire for DomainMetadata<'static> {
6393 type Narrowed<'de> = DomainMetadata<'de>;
6394
6395 #[inline]
6396 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6397 ::fidl_next::munge!(let Self { table } = out);
6398 ::fidl_next::wire::Table::zero_padding(table);
6399 }
6400 }
6401
6402 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for DomainMetadata<'de>
6403 where
6404 ___D: ::fidl_next::Decoder<'de> + ?Sized,
6405 {
6406 fn decode(
6407 slot: ::fidl_next::Slot<'_, Self>,
6408 decoder: &mut ___D,
6409 _: (),
6410 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6411 ::fidl_next::munge!(let Self { table } = slot);
6412
6413 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
6414 match ordinal {
6415 0 => unsafe { ::core::hint::unreachable_unchecked() },
6416
6417 1 => {
6418 ::fidl_next::wire::Envelope::decode_as::<
6419 ___D,
6420 ::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>,
6421 >(slot.as_mut(), decoder, (4294967295, ()))?;
6422
6423 Ok(())
6424 }
6425
6426 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
6427 }
6428 })
6429 }
6430 }
6431
6432 impl<'de> DomainMetadata<'de> {
6433 pub fn domains(
6434 &self,
6435 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>
6436 {
6437 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
6438 }
6439
6440 pub fn take_domains(
6441 &mut self,
6442 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::Domain<'de>>>
6443 {
6444 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
6445 }
6446 }
6447
6448 impl<'de> ::core::fmt::Debug for DomainMetadata<'de> {
6449 fn fmt(
6450 &self,
6451 f: &mut ::core::fmt::Formatter<'_>,
6452 ) -> ::core::result::Result<(), ::core::fmt::Error> {
6453 f.debug_struct("DomainMetadata").field("domains", &self.domains()).finish()
6454 }
6455 }
6456
6457 impl<'de> ::fidl_next::IntoNatural for DomainMetadata<'de> {
6458 type Natural = crate::natural::DomainMetadata;
6459 }
6460
6461 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
6463 #[repr(transparent)]
6464 pub struct FrameworkElementLevels {
6465 pub(crate) value: ::fidl_next::wire::Uint32,
6466 }
6467
6468 impl ::fidl_next::Constrained for FrameworkElementLevels {
6469 type Constraint = ();
6470
6471 fn validate(
6472 _: ::fidl_next::Slot<'_, Self>,
6473 _: Self::Constraint,
6474 ) -> Result<(), ::fidl_next::ValidationError> {
6475 Ok(())
6476 }
6477 }
6478
6479 unsafe impl ::fidl_next::Wire for FrameworkElementLevels {
6480 type Narrowed<'de> = Self;
6481
6482 #[inline]
6483 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
6484 }
6486 }
6487
6488 impl FrameworkElementLevels {
6489 pub const OFF: FrameworkElementLevels =
6490 FrameworkElementLevels { value: ::fidl_next::wire::Uint32(0) };
6491
6492 pub const ON: FrameworkElementLevels =
6493 FrameworkElementLevels { value: ::fidl_next::wire::Uint32(1) };
6494 }
6495
6496 unsafe impl<___D> ::fidl_next::Decode<___D> for FrameworkElementLevels
6497 where
6498 ___D: ?Sized,
6499 {
6500 fn decode(
6501 slot: ::fidl_next::Slot<'_, Self>,
6502 _: &mut ___D,
6503 _: (),
6504 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6505 ::fidl_next::munge!(let Self { value } = slot);
6506
6507 match u32::from(*value) {
6508 0 | 1 => (),
6509 unknown => {
6510 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
6511 }
6512 }
6513
6514 Ok(())
6515 }
6516 }
6517
6518 impl ::core::convert::From<crate::natural::FrameworkElementLevels> for FrameworkElementLevels {
6519 fn from(natural: crate::natural::FrameworkElementLevels) -> Self {
6520 match natural {
6521 crate::natural::FrameworkElementLevels::Off => FrameworkElementLevels::OFF,
6522
6523 crate::natural::FrameworkElementLevels::On => FrameworkElementLevels::ON,
6524 }
6525 }
6526 }
6527
6528 impl ::fidl_next::IntoNatural for FrameworkElementLevels {
6529 type Natural = crate::natural::FrameworkElementLevels;
6530 }
6531}
6532
6533pub mod wire_optional {
6534
6535 #[repr(transparent)]
6536 pub struct ParentElement<'de> {
6537 pub(crate) raw: ::fidl_next::wire::Union,
6538 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
6539 }
6540
6541 impl ::fidl_next::Constrained for ParentElement<'_> {
6542 type Constraint = ();
6543
6544 fn validate(
6545 _: ::fidl_next::Slot<'_, Self>,
6546 _: Self::Constraint,
6547 ) -> Result<(), ::fidl_next::ValidationError> {
6548 Ok(())
6549 }
6550 }
6551
6552 unsafe impl ::fidl_next::Wire for ParentElement<'static> {
6553 type Narrowed<'de> = ParentElement<'de>;
6554
6555 #[inline]
6556 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
6557 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
6558 ::fidl_next::wire::Union::zero_padding(raw);
6559 }
6560 }
6561
6562 impl<'de> ParentElement<'de> {
6563 pub fn is_some(&self) -> bool {
6564 self.raw.is_some()
6565 }
6566
6567 pub fn is_none(&self) -> bool {
6568 self.raw.is_none()
6569 }
6570
6571 pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::ParentElement<'de>> {
6572 if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
6573 }
6574
6575 pub fn into_option(self) -> ::core::option::Option<crate::wire::ParentElement<'de>> {
6576 if self.is_some() {
6577 Some(crate::wire::ParentElement {
6578 raw: self.raw,
6579 _phantom: ::core::marker::PhantomData,
6580 })
6581 } else {
6582 None
6583 }
6584 }
6585 }
6586
6587 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ParentElement<'de>
6588 where
6589 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
6590 ___D: ::fidl_next::Decoder<'de>,
6591 {
6592 fn decode(
6593 mut slot: ::fidl_next::Slot<'_, Self>,
6594 decoder: &mut ___D,
6595 _: (),
6596 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
6597 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
6598 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
6599 1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::SagElement>(
6600 raw,
6601 decoder,
6602 (),
6603 )?,
6604
6605 2 => ::fidl_next::wire::Union::decode_as::<___D, ::fidl_next::wire::String<'de>>(
6606 raw, decoder, 63,
6607 )?,
6608
6609 3 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::CpuPowerElement>(
6610 raw,
6611 decoder,
6612 (),
6613 )?,
6614
6615 0 => ::fidl_next::wire::Union::decode_absent(raw)?,
6616 _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
6617 }
6618
6619 Ok(())
6620 }
6621 }
6622
6623 impl<'de> ::core::fmt::Debug for ParentElement<'de> {
6624 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6625 self.as_ref().fmt(f)
6626 }
6627 }
6628
6629 impl<'de> ::fidl_next::IntoNatural for ParentElement<'de> {
6630 type Natural = ::core::option::Option<crate::natural::ParentElement>;
6631 }
6632}
6633
6634pub mod generic {
6635
6636 pub struct ComponentPowerConfiguration<T0> {
6638 pub power_elements: T0,
6639 }
6640
6641 unsafe impl<___E, T0>
6642 ::fidl_next::Encode<crate::wire::ComponentPowerConfiguration<'static>, ___E>
6643 for ComponentPowerConfiguration<T0>
6644 where
6645 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6646 ___E: ::fidl_next::Encoder,
6647 T0: ::fidl_next::Encode<
6648 ::fidl_next::wire::Vector<'static, crate::wire::PowerElementConfiguration<'static>>,
6649 ___E,
6650 >,
6651 {
6652 #[inline]
6653 fn encode(
6654 self,
6655 encoder_: &mut ___E,
6656 out_: &mut ::core::mem::MaybeUninit<crate::wire::ComponentPowerConfiguration<'static>>,
6657 _: (),
6658 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6659 ::fidl_next::munge! {
6660 let crate::wire::ComponentPowerConfiguration {
6661 power_elements,
6662
6663 } = out_;
6664 }
6665
6666 ::fidl_next::Encode::encode(self.power_elements, encoder_, power_elements, (32, ()))?;
6667
6668 Ok(())
6669 }
6670 }
6671
6672 pub struct DeviceRegisterPowerDomainRequest<T0, T1> {
6674 pub min_needed_voltage: T0,
6675
6676 pub max_supported_voltage: T1,
6677 }
6678
6679 unsafe impl<___E, T0, T1>
6680 ::fidl_next::Encode<crate::wire::DeviceRegisterPowerDomainRequest, ___E>
6681 for DeviceRegisterPowerDomainRequest<T0, T1>
6682 where
6683 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6684 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6685 T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6686 {
6687 #[inline]
6688 fn encode(
6689 self,
6690 encoder_: &mut ___E,
6691 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRegisterPowerDomainRequest>,
6692 _: (),
6693 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6694 ::fidl_next::munge! {
6695 let crate::wire::DeviceRegisterPowerDomainRequest {
6696 min_needed_voltage,
6697 max_supported_voltage,
6698
6699 } = out_;
6700 }
6701
6702 ::fidl_next::Encode::encode(self.min_needed_voltage, encoder_, min_needed_voltage, ())?;
6703
6704 ::fidl_next::Encode::encode(
6705 self.max_supported_voltage,
6706 encoder_,
6707 max_supported_voltage,
6708 (),
6709 )?;
6710
6711 Ok(())
6712 }
6713 }
6714
6715 pub type DeviceRegisterPowerDomainResponse = ();
6717
6718 pub type DeviceUnregisterPowerDomainResponse = ();
6720
6721 pub struct DeviceGetSupportedVoltageRangeResponse<T0, T1> {
6723 pub min: T0,
6724
6725 pub max: T1,
6726 }
6727
6728 unsafe impl<___E, T0, T1>
6729 ::fidl_next::Encode<crate::wire::DeviceGetSupportedVoltageRangeResponse, ___E>
6730 for DeviceGetSupportedVoltageRangeResponse<T0, T1>
6731 where
6732 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6733 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6734 T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6735 {
6736 #[inline]
6737 fn encode(
6738 self,
6739 encoder_: &mut ___E,
6740 out_: &mut ::core::mem::MaybeUninit<
6741 crate::wire::DeviceGetSupportedVoltageRangeResponse,
6742 >,
6743 _: (),
6744 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6745 ::fidl_next::munge! {
6746 let crate::wire::DeviceGetSupportedVoltageRangeResponse {
6747 min,
6748 max,
6749
6750 } = out_;
6751 }
6752
6753 ::fidl_next::Encode::encode(self.min, encoder_, min, ())?;
6754
6755 ::fidl_next::Encode::encode(self.max, encoder_, max, ())?;
6756
6757 Ok(())
6758 }
6759 }
6760
6761 pub struct DeviceRequestVoltageRequest<T0> {
6763 pub voltage: T0,
6764 }
6765
6766 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceRequestVoltageRequest, ___E>
6767 for DeviceRequestVoltageRequest<T0>
6768 where
6769 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6770 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6771 {
6772 #[inline]
6773 fn encode(
6774 self,
6775 encoder_: &mut ___E,
6776 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRequestVoltageRequest>,
6777 _: (),
6778 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6779 ::fidl_next::munge! {
6780 let crate::wire::DeviceRequestVoltageRequest {
6781 voltage,
6782
6783 } = out_;
6784 }
6785
6786 ::fidl_next::Encode::encode(self.voltage, encoder_, voltage, ())?;
6787
6788 Ok(())
6789 }
6790 }
6791
6792 pub struct DeviceRequestVoltageResponse<T0> {
6794 pub actual_voltage: T0,
6795 }
6796
6797 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceRequestVoltageResponse, ___E>
6798 for DeviceRequestVoltageResponse<T0>
6799 where
6800 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6801 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6802 {
6803 #[inline]
6804 fn encode(
6805 self,
6806 encoder_: &mut ___E,
6807 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceRequestVoltageResponse>,
6808 _: (),
6809 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6810 ::fidl_next::munge! {
6811 let crate::wire::DeviceRequestVoltageResponse {
6812 actual_voltage,
6813
6814 } = out_;
6815 }
6816
6817 ::fidl_next::Encode::encode(self.actual_voltage, encoder_, actual_voltage, ())?;
6818
6819 Ok(())
6820 }
6821 }
6822
6823 pub struct DeviceGetCurrentVoltageRequest<T0> {
6825 pub index: T0,
6826 }
6827
6828 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageRequest, ___E>
6829 for DeviceGetCurrentVoltageRequest<T0>
6830 where
6831 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6832 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6833 {
6834 #[inline]
6835 fn encode(
6836 self,
6837 encoder_: &mut ___E,
6838 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetCurrentVoltageRequest>,
6839 _: (),
6840 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6841 ::fidl_next::munge! {
6842 let crate::wire::DeviceGetCurrentVoltageRequest {
6843 index,
6844
6845 } = out_;
6846 }
6847
6848 ::fidl_next::Encode::encode(self.index, encoder_, index, ())?;
6849
6850 Ok(())
6851 }
6852 }
6853
6854 pub struct DeviceGetCurrentVoltageResponse<T0> {
6856 pub current_voltage: T0,
6857 }
6858
6859 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetCurrentVoltageResponse, ___E>
6860 for DeviceGetCurrentVoltageResponse<T0>
6861 where
6862 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6863 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6864 {
6865 #[inline]
6866 fn encode(
6867 self,
6868 encoder_: &mut ___E,
6869 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetCurrentVoltageResponse>,
6870 _: (),
6871 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6872 ::fidl_next::munge! {
6873 let crate::wire::DeviceGetCurrentVoltageResponse {
6874 current_voltage,
6875
6876 } = out_;
6877 }
6878
6879 ::fidl_next::Encode::encode(self.current_voltage, encoder_, current_voltage, ())?;
6880
6881 Ok(())
6882 }
6883 }
6884
6885 pub struct DeviceGetPowerDomainStatusResponse<T0> {
6887 pub status: T0,
6888 }
6889
6890 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceGetPowerDomainStatusResponse, ___E>
6891 for DeviceGetPowerDomainStatusResponse<T0>
6892 where
6893 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6894 T0: ::fidl_next::Encode<crate::wire::PowerDomainStatus, ___E>,
6895 {
6896 #[inline]
6897 fn encode(
6898 self,
6899 encoder_: &mut ___E,
6900 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceGetPowerDomainStatusResponse>,
6901 _: (),
6902 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6903 ::fidl_next::munge! {
6904 let crate::wire::DeviceGetPowerDomainStatusResponse {
6905 status,
6906
6907 } = out_;
6908 }
6909
6910 ::fidl_next::Encode::encode(self.status, encoder_, status, ())?;
6911
6912 Ok(())
6913 }
6914 }
6915
6916 pub struct DeviceWritePmicCtrlRegRequest<T0, T1> {
6918 pub reg_addr: T0,
6919
6920 pub value: T1,
6921 }
6922
6923 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::DeviceWritePmicCtrlRegRequest, ___E>
6924 for DeviceWritePmicCtrlRegRequest<T0, T1>
6925 where
6926 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6927 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6928 T1: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6929 {
6930 #[inline]
6931 fn encode(
6932 self,
6933 encoder_: &mut ___E,
6934 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceWritePmicCtrlRegRequest>,
6935 _: (),
6936 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6937 ::fidl_next::munge! {
6938 let crate::wire::DeviceWritePmicCtrlRegRequest {
6939 reg_addr,
6940 value,
6941
6942 } = out_;
6943 }
6944
6945 ::fidl_next::Encode::encode(self.reg_addr, encoder_, reg_addr, ())?;
6946
6947 ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
6948
6949 Ok(())
6950 }
6951 }
6952
6953 pub type DeviceWritePmicCtrlRegResponse = ();
6955
6956 pub struct DeviceReadPmicCtrlRegRequest<T0> {
6958 pub reg_addr: T0,
6959 }
6960
6961 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegRequest, ___E>
6962 for DeviceReadPmicCtrlRegRequest<T0>
6963 where
6964 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6965 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6966 {
6967 #[inline]
6968 fn encode(
6969 self,
6970 encoder_: &mut ___E,
6971 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadPmicCtrlRegRequest>,
6972 _: (),
6973 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
6974 ::fidl_next::munge! {
6975 let crate::wire::DeviceReadPmicCtrlRegRequest {
6976 reg_addr,
6977
6978 } = out_;
6979 }
6980
6981 ::fidl_next::Encode::encode(self.reg_addr, encoder_, reg_addr, ())?;
6982
6983 Ok(())
6984 }
6985 }
6986
6987 pub struct DeviceReadPmicCtrlRegResponse<T0> {
6989 pub value: T0,
6990 }
6991
6992 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::DeviceReadPmicCtrlRegResponse, ___E>
6993 for DeviceReadPmicCtrlRegResponse<T0>
6994 where
6995 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
6996 T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
6997 {
6998 #[inline]
6999 fn encode(
7000 self,
7001 encoder_: &mut ___E,
7002 out_: &mut ::core::mem::MaybeUninit<crate::wire::DeviceReadPmicCtrlRegResponse>,
7003 _: (),
7004 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
7005 ::fidl_next::munge! {
7006 let crate::wire::DeviceReadPmicCtrlRegResponse {
7007 value,
7008
7009 } = out_;
7010 }
7011
7012 ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
7013
7014 Ok(())
7015 }
7016 }
7017}
7018
7019pub use self::natural::*;
7020
7021pub const MAX_NAME_LENGTH: u16 = 63 as u16;
7022
7023#[doc = " This means we could have up to 128 power levels, which seems like more than\n enough.\n"]
7024pub const MAX_TRANSITIONS: u16 = 127 as u16;
7025
7026#[doc = " Should be MAX_TRANSITIONS + 1\n"]
7027pub const MAX_LEVELS: u16 = 128 as u16;
7028
7029pub const MAX_DEPENDENCIES: u16 = 128 as u16;
7030
7031pub const MAX_POWER_ELEMENTS: u16 = 32 as u16;
7032
7033#[derive(PartialEq, Debug)]
7035pub struct Device;
7036
7037impl ::fidl_next::Discoverable for Device {
7038 const PROTOCOL_NAME: &'static str = "fuchsia.hardware.power.Device";
7039}
7040
7041#[cfg(target_os = "fuchsia")]
7042impl ::fidl_next::HasTransport for Device {
7043 type Transport = ::fidl_next::fuchsia::zx::Channel;
7044}
7045
7046pub mod device {
7047 pub mod prelude {
7048 pub use crate::{
7049 Device, DeviceClientHandler, DeviceLocalClientHandler, DeviceLocalServerHandler,
7050 DeviceServerHandler, device,
7051 };
7052
7053 pub use crate::natural::DeviceGetCurrentVoltageRequest;
7054
7055 pub use crate::natural::DeviceReadPmicCtrlRegRequest;
7056
7057 pub use crate::natural::DeviceRegisterPowerDomainRequest;
7058
7059 pub use crate::natural::DeviceRequestVoltageRequest;
7060
7061 pub use crate::natural::DeviceWritePmicCtrlRegRequest;
7062
7063 pub use crate::natural::DeviceGetCurrentVoltageResponse;
7064
7065 pub use crate::natural::DeviceGetPowerDomainStatusResponse;
7066
7067 pub use crate::natural::DeviceGetSupportedVoltageRangeResponse;
7068
7069 pub use crate::natural::DeviceReadPmicCtrlRegResponse;
7070
7071 pub use crate::natural::DeviceRegisterPowerDomainResponse;
7072
7073 pub use crate::natural::DeviceRequestVoltageResponse;
7074
7075 pub use crate::natural::DeviceUnregisterPowerDomainResponse;
7076
7077 pub use crate::natural::DeviceWritePmicCtrlRegResponse;
7078 }
7079
7080 pub struct RegisterPowerDomain;
7081
7082 impl ::fidl_next::Method for RegisterPowerDomain {
7083 const ORDINAL: u64 = 4458069386545205468;
7084 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7085 ::fidl_next::protocol::Flexibility::Strict;
7086
7087 type Protocol = crate::Device;
7088
7089 type Request = crate::wire::DeviceRegisterPowerDomainRequest;
7090 }
7091
7092 impl ::fidl_next::TwoWayMethod for RegisterPowerDomain {
7093 type Response = ::fidl_next::wire::Result<
7094 'static,
7095 crate::wire::DeviceRegisterPowerDomainResponse,
7096 ::fidl_next::wire::fuchsia::StatusResult,
7097 >;
7098 }
7099
7100 impl<___R> ::fidl_next::Respond<___R> for RegisterPowerDomain {
7101 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
7102
7103 fn respond(response: ___R) -> Self::Output {
7104 ::core::result::Result::Ok(response)
7105 }
7106 }
7107
7108 impl<___R> ::fidl_next::RespondErr<___R> for RegisterPowerDomain {
7109 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7110
7111 fn respond_err(response: ___R) -> Self::Output {
7112 ::core::result::Result::Err(response)
7113 }
7114 }
7115
7116 pub struct UnregisterPowerDomain;
7117
7118 impl ::fidl_next::Method for UnregisterPowerDomain {
7119 const ORDINAL: u64 = 7717805237469023337;
7120 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7121 ::fidl_next::protocol::Flexibility::Strict;
7122
7123 type Protocol = crate::Device;
7124
7125 type Request = ::fidl_next::wire::EmptyMessageBody;
7126 }
7127
7128 impl ::fidl_next::TwoWayMethod for UnregisterPowerDomain {
7129 type Response = ::fidl_next::wire::Result<
7130 'static,
7131 crate::wire::DeviceUnregisterPowerDomainResponse,
7132 ::fidl_next::wire::fuchsia::StatusResult,
7133 >;
7134 }
7135
7136 impl<___R> ::fidl_next::Respond<___R> for UnregisterPowerDomain {
7137 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
7138
7139 fn respond(response: ___R) -> Self::Output {
7140 ::core::result::Result::Ok(response)
7141 }
7142 }
7143
7144 impl<___R> ::fidl_next::RespondErr<___R> for UnregisterPowerDomain {
7145 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7146
7147 fn respond_err(response: ___R) -> Self::Output {
7148 ::core::result::Result::Err(response)
7149 }
7150 }
7151
7152 pub struct GetSupportedVoltageRange;
7153
7154 impl ::fidl_next::Method for GetSupportedVoltageRange {
7155 const ORDINAL: u64 = 7887361504891407856;
7156 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7157 ::fidl_next::protocol::Flexibility::Strict;
7158
7159 type Protocol = crate::Device;
7160
7161 type Request = ::fidl_next::wire::EmptyMessageBody;
7162 }
7163
7164 impl ::fidl_next::TwoWayMethod for GetSupportedVoltageRange {
7165 type Response = ::fidl_next::wire::Result<
7166 'static,
7167 crate::wire::DeviceGetSupportedVoltageRangeResponse,
7168 ::fidl_next::wire::fuchsia::StatusResult,
7169 >;
7170 }
7171
7172 impl<___R> ::fidl_next::Respond<___R> for GetSupportedVoltageRange {
7173 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
7174
7175 fn respond(response: ___R) -> Self::Output {
7176 ::core::result::Result::Ok(response)
7177 }
7178 }
7179
7180 impl<___R> ::fidl_next::RespondErr<___R> for GetSupportedVoltageRange {
7181 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7182
7183 fn respond_err(response: ___R) -> Self::Output {
7184 ::core::result::Result::Err(response)
7185 }
7186 }
7187
7188 pub struct RequestVoltage;
7189
7190 impl ::fidl_next::Method for RequestVoltage {
7191 const ORDINAL: u64 = 2578932345713622683;
7192 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7193 ::fidl_next::protocol::Flexibility::Strict;
7194
7195 type Protocol = crate::Device;
7196
7197 type Request = crate::wire::DeviceRequestVoltageRequest;
7198 }
7199
7200 impl ::fidl_next::TwoWayMethod for RequestVoltage {
7201 type Response = ::fidl_next::wire::Result<
7202 'static,
7203 crate::wire::DeviceRequestVoltageResponse,
7204 ::fidl_next::wire::fuchsia::StatusResult,
7205 >;
7206 }
7207
7208 impl<___R> ::fidl_next::Respond<___R> for RequestVoltage {
7209 type Output = ::core::result::Result<
7210 crate::generic::DeviceRequestVoltageResponse<___R>,
7211 ::fidl_next::never::Never,
7212 >;
7213
7214 fn respond(response: ___R) -> Self::Output {
7215 ::core::result::Result::Ok(crate::generic::DeviceRequestVoltageResponse {
7216 actual_voltage: response,
7217 })
7218 }
7219 }
7220
7221 impl<___R> ::fidl_next::RespondErr<___R> for RequestVoltage {
7222 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7223
7224 fn respond_err(response: ___R) -> Self::Output {
7225 ::core::result::Result::Err(response)
7226 }
7227 }
7228
7229 pub struct GetCurrentVoltage;
7230
7231 impl ::fidl_next::Method for GetCurrentVoltage {
7232 const ORDINAL: u64 = 7683000915093989729;
7233 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7234 ::fidl_next::protocol::Flexibility::Strict;
7235
7236 type Protocol = crate::Device;
7237
7238 type Request = crate::wire::DeviceGetCurrentVoltageRequest;
7239 }
7240
7241 impl ::fidl_next::TwoWayMethod for GetCurrentVoltage {
7242 type Response = ::fidl_next::wire::Result<
7243 'static,
7244 crate::wire::DeviceGetCurrentVoltageResponse,
7245 ::fidl_next::wire::fuchsia::StatusResult,
7246 >;
7247 }
7248
7249 impl<___R> ::fidl_next::Respond<___R> for GetCurrentVoltage {
7250 type Output = ::core::result::Result<
7251 crate::generic::DeviceGetCurrentVoltageResponse<___R>,
7252 ::fidl_next::never::Never,
7253 >;
7254
7255 fn respond(response: ___R) -> Self::Output {
7256 ::core::result::Result::Ok(crate::generic::DeviceGetCurrentVoltageResponse {
7257 current_voltage: response,
7258 })
7259 }
7260 }
7261
7262 impl<___R> ::fidl_next::RespondErr<___R> for GetCurrentVoltage {
7263 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7264
7265 fn respond_err(response: ___R) -> Self::Output {
7266 ::core::result::Result::Err(response)
7267 }
7268 }
7269
7270 pub struct GetPowerDomainStatus;
7271
7272 impl ::fidl_next::Method for GetPowerDomainStatus {
7273 const ORDINAL: u64 = 4178917272116294842;
7274 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7275 ::fidl_next::protocol::Flexibility::Strict;
7276
7277 type Protocol = crate::Device;
7278
7279 type Request = ::fidl_next::wire::EmptyMessageBody;
7280 }
7281
7282 impl ::fidl_next::TwoWayMethod for GetPowerDomainStatus {
7283 type Response = ::fidl_next::wire::Result<
7284 'static,
7285 crate::wire::DeviceGetPowerDomainStatusResponse,
7286 ::fidl_next::wire::fuchsia::StatusResult,
7287 >;
7288 }
7289
7290 impl<___R> ::fidl_next::Respond<___R> for GetPowerDomainStatus {
7291 type Output = ::core::result::Result<
7292 crate::generic::DeviceGetPowerDomainStatusResponse<___R>,
7293 ::fidl_next::never::Never,
7294 >;
7295
7296 fn respond(response: ___R) -> Self::Output {
7297 ::core::result::Result::Ok(crate::generic::DeviceGetPowerDomainStatusResponse {
7298 status: response,
7299 })
7300 }
7301 }
7302
7303 impl<___R> ::fidl_next::RespondErr<___R> for GetPowerDomainStatus {
7304 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7305
7306 fn respond_err(response: ___R) -> Self::Output {
7307 ::core::result::Result::Err(response)
7308 }
7309 }
7310
7311 pub struct WritePmicCtrlReg;
7312
7313 impl ::fidl_next::Method for WritePmicCtrlReg {
7314 const ORDINAL: u64 = 3749867380549091993;
7315 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7316 ::fidl_next::protocol::Flexibility::Strict;
7317
7318 type Protocol = crate::Device;
7319
7320 type Request = crate::wire::DeviceWritePmicCtrlRegRequest;
7321 }
7322
7323 impl ::fidl_next::TwoWayMethod for WritePmicCtrlReg {
7324 type Response = ::fidl_next::wire::Result<
7325 'static,
7326 crate::wire::DeviceWritePmicCtrlRegResponse,
7327 ::fidl_next::wire::fuchsia::StatusResult,
7328 >;
7329 }
7330
7331 impl<___R> ::fidl_next::Respond<___R> for WritePmicCtrlReg {
7332 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
7333
7334 fn respond(response: ___R) -> Self::Output {
7335 ::core::result::Result::Ok(response)
7336 }
7337 }
7338
7339 impl<___R> ::fidl_next::RespondErr<___R> for WritePmicCtrlReg {
7340 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7341
7342 fn respond_err(response: ___R) -> Self::Output {
7343 ::core::result::Result::Err(response)
7344 }
7345 }
7346
7347 pub struct ReadPmicCtrlReg;
7348
7349 impl ::fidl_next::Method for ReadPmicCtrlReg {
7350 const ORDINAL: u64 = 8281766978930618131;
7351 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7352 ::fidl_next::protocol::Flexibility::Strict;
7353
7354 type Protocol = crate::Device;
7355
7356 type Request = crate::wire::DeviceReadPmicCtrlRegRequest;
7357 }
7358
7359 impl ::fidl_next::TwoWayMethod for ReadPmicCtrlReg {
7360 type Response = ::fidl_next::wire::Result<
7361 'static,
7362 crate::wire::DeviceReadPmicCtrlRegResponse,
7363 ::fidl_next::wire::fuchsia::StatusResult,
7364 >;
7365 }
7366
7367 impl<___R> ::fidl_next::Respond<___R> for ReadPmicCtrlReg {
7368 type Output = ::core::result::Result<
7369 crate::generic::DeviceReadPmicCtrlRegResponse<___R>,
7370 ::fidl_next::never::Never,
7371 >;
7372
7373 fn respond(response: ___R) -> Self::Output {
7374 ::core::result::Result::Ok(crate::generic::DeviceReadPmicCtrlRegResponse {
7375 value: response,
7376 })
7377 }
7378 }
7379
7380 impl<___R> ::fidl_next::RespondErr<___R> for ReadPmicCtrlReg {
7381 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7382
7383 fn respond_err(response: ___R) -> Self::Output {
7384 ::core::result::Result::Err(response)
7385 }
7386 }
7387
7388 mod ___detail {
7389 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Device
7390 where
7391 ___T: ::fidl_next::Transport,
7392 {
7393 type Client = DeviceClient<___T>;
7394 type Server = DeviceServer<___T>;
7395 }
7396
7397 #[repr(transparent)]
7399 pub struct DeviceClient<___T: ::fidl_next::Transport> {
7400 #[allow(dead_code)]
7401 client: ::fidl_next::protocol::Client<___T>,
7402 }
7403
7404 impl<___T> DeviceClient<___T>
7405 where
7406 ___T: ::fidl_next::Transport,
7407 {
7408 #[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"]
7409 pub fn register_power_domain(
7410 &self,
7411
7412 min_needed_voltage: impl ::fidl_next::Encode<
7413 ::fidl_next::wire::Uint32,
7414 <___T as ::fidl_next::Transport>::SendBuffer,
7415 >,
7416
7417 max_supported_voltage: impl ::fidl_next::Encode<
7418 ::fidl_next::wire::Uint32,
7419 <___T as ::fidl_next::Transport>::SendBuffer,
7420 >,
7421 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterPowerDomain, ___T>
7422 where
7423 <___T as ::fidl_next::Transport>::SendBuffer:
7424 ::fidl_next::encoder::InternalHandleEncoder,
7425 {
7426 self.register_power_domain_with(crate::generic::DeviceRegisterPowerDomainRequest {
7427 min_needed_voltage,
7428
7429 max_supported_voltage,
7430 })
7431 }
7432
7433 #[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"]
7434 pub fn register_power_domain_with<___R>(
7435 &self,
7436 request: ___R,
7437 ) -> ::fidl_next::TwoWayFuture<'_, super::RegisterPowerDomain, ___T>
7438 where
7439 ___R: ::fidl_next::Encode<
7440 crate::wire::DeviceRegisterPowerDomainRequest,
7441 <___T as ::fidl_next::Transport>::SendBuffer,
7442 >,
7443 {
7444 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7445 4458069386545205468,
7446 <super::RegisterPowerDomain as ::fidl_next::Method>::FLEXIBILITY,
7447 request,
7448 ))
7449 }
7450
7451 #[doc = " Unregister the callee for this power domain. The callee will no longer be considered as\n a dependent of this power domain.\n"]
7452 pub fn unregister_power_domain(
7453 &self,
7454 ) -> ::fidl_next::TwoWayFuture<'_, super::UnregisterPowerDomain, ___T> {
7455 ::fidl_next::TwoWayFuture::from_untyped(
7456 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7457 7717805237469023337,
7458 <super::UnregisterPowerDomain as ::fidl_next::Method>::FLEXIBILITY,
7459 (),
7460 ),
7461 )
7462 }
7463
7464 #[doc = " Get Supported Voltage Range. min and max are in micorVolts(uV)\n"]
7465 pub fn get_supported_voltage_range(
7466 &self,
7467 ) -> ::fidl_next::TwoWayFuture<'_, super::GetSupportedVoltageRange, ___T> {
7468 ::fidl_next::TwoWayFuture::from_untyped(
7469 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7470 7887361504891407856,
7471 <super::GetSupportedVoltageRange as ::fidl_next::Method>::FLEXIBILITY,
7472 (),
7473 ),
7474 )
7475 }
7476
7477 #[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"]
7478 pub fn request_voltage(
7479 &self,
7480
7481 voltage: impl ::fidl_next::Encode<
7482 ::fidl_next::wire::Uint32,
7483 <___T as ::fidl_next::Transport>::SendBuffer,
7484 >,
7485 ) -> ::fidl_next::TwoWayFuture<'_, super::RequestVoltage, ___T>
7486 where
7487 <___T as ::fidl_next::Transport>::SendBuffer:
7488 ::fidl_next::encoder::InternalHandleEncoder,
7489 {
7490 self.request_voltage_with(crate::generic::DeviceRequestVoltageRequest { voltage })
7491 }
7492
7493 #[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"]
7494 pub fn request_voltage_with<___R>(
7495 &self,
7496 request: ___R,
7497 ) -> ::fidl_next::TwoWayFuture<'_, super::RequestVoltage, ___T>
7498 where
7499 ___R: ::fidl_next::Encode<
7500 crate::wire::DeviceRequestVoltageRequest,
7501 <___T as ::fidl_next::Transport>::SendBuffer,
7502 >,
7503 {
7504 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7505 2578932345713622683,
7506 <super::RequestVoltage as ::fidl_next::Method>::FLEXIBILITY,
7507 request,
7508 ))
7509 }
7510
7511 #[doc = " Get current voltage in uV.\n"]
7512 pub fn get_current_voltage(
7513 &self,
7514
7515 index: impl ::fidl_next::Encode<
7516 ::fidl_next::wire::Uint32,
7517 <___T as ::fidl_next::Transport>::SendBuffer,
7518 >,
7519 ) -> ::fidl_next::TwoWayFuture<'_, super::GetCurrentVoltage, ___T>
7520 where
7521 <___T as ::fidl_next::Transport>::SendBuffer:
7522 ::fidl_next::encoder::InternalHandleEncoder,
7523 {
7524 self.get_current_voltage_with(crate::generic::DeviceGetCurrentVoltageRequest {
7525 index,
7526 })
7527 }
7528
7529 #[doc = " Get current voltage in uV.\n"]
7530 pub fn get_current_voltage_with<___R>(
7531 &self,
7532 request: ___R,
7533 ) -> ::fidl_next::TwoWayFuture<'_, super::GetCurrentVoltage, ___T>
7534 where
7535 ___R: ::fidl_next::Encode<
7536 crate::wire::DeviceGetCurrentVoltageRequest,
7537 <___T as ::fidl_next::Transport>::SendBuffer,
7538 >,
7539 {
7540 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7541 7683000915093989729,
7542 <super::GetCurrentVoltage as ::fidl_next::Method>::FLEXIBILITY,
7543 request,
7544 ))
7545 }
7546
7547 #[doc = " Get power domain status\n"]
7548 pub fn get_power_domain_status(
7549 &self,
7550 ) -> ::fidl_next::TwoWayFuture<'_, super::GetPowerDomainStatus, ___T> {
7551 ::fidl_next::TwoWayFuture::from_untyped(
7552 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7553 4178917272116294842,
7554 <super::GetPowerDomainStatus as ::fidl_next::Method>::FLEXIBILITY,
7555 (),
7556 ),
7557 )
7558 }
7559
7560 #[doc = " Write to ctrl register of PMIC\n"]
7561 pub fn write_pmic_ctrl_reg(
7562 &self,
7563
7564 reg_addr: impl ::fidl_next::Encode<
7565 ::fidl_next::wire::Uint32,
7566 <___T as ::fidl_next::Transport>::SendBuffer,
7567 >,
7568
7569 value: impl ::fidl_next::Encode<
7570 ::fidl_next::wire::Uint32,
7571 <___T as ::fidl_next::Transport>::SendBuffer,
7572 >,
7573 ) -> ::fidl_next::TwoWayFuture<'_, super::WritePmicCtrlReg, ___T>
7574 where
7575 <___T as ::fidl_next::Transport>::SendBuffer:
7576 ::fidl_next::encoder::InternalHandleEncoder,
7577 {
7578 self.write_pmic_ctrl_reg_with(crate::generic::DeviceWritePmicCtrlRegRequest {
7579 reg_addr,
7580
7581 value,
7582 })
7583 }
7584
7585 #[doc = " Write to ctrl register of PMIC\n"]
7586 pub fn write_pmic_ctrl_reg_with<___R>(
7587 &self,
7588 request: ___R,
7589 ) -> ::fidl_next::TwoWayFuture<'_, super::WritePmicCtrlReg, ___T>
7590 where
7591 ___R: ::fidl_next::Encode<
7592 crate::wire::DeviceWritePmicCtrlRegRequest,
7593 <___T as ::fidl_next::Transport>::SendBuffer,
7594 >,
7595 {
7596 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7597 3749867380549091993,
7598 <super::WritePmicCtrlReg as ::fidl_next::Method>::FLEXIBILITY,
7599 request,
7600 ))
7601 }
7602
7603 #[doc = " Read ctrl register of PMIC\n"]
7604 pub fn read_pmic_ctrl_reg(
7605 &self,
7606
7607 reg_addr: impl ::fidl_next::Encode<
7608 ::fidl_next::wire::Uint32,
7609 <___T as ::fidl_next::Transport>::SendBuffer,
7610 >,
7611 ) -> ::fidl_next::TwoWayFuture<'_, super::ReadPmicCtrlReg, ___T>
7612 where
7613 <___T as ::fidl_next::Transport>::SendBuffer:
7614 ::fidl_next::encoder::InternalHandleEncoder,
7615 {
7616 self.read_pmic_ctrl_reg_with(crate::generic::DeviceReadPmicCtrlRegRequest {
7617 reg_addr,
7618 })
7619 }
7620
7621 #[doc = " Read ctrl register of PMIC\n"]
7622 pub fn read_pmic_ctrl_reg_with<___R>(
7623 &self,
7624 request: ___R,
7625 ) -> ::fidl_next::TwoWayFuture<'_, super::ReadPmicCtrlReg, ___T>
7626 where
7627 ___R: ::fidl_next::Encode<
7628 crate::wire::DeviceReadPmicCtrlRegRequest,
7629 <___T as ::fidl_next::Transport>::SendBuffer,
7630 >,
7631 {
7632 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7633 8281766978930618131,
7634 <super::ReadPmicCtrlReg as ::fidl_next::Method>::FLEXIBILITY,
7635 request,
7636 ))
7637 }
7638 }
7639
7640 #[repr(transparent)]
7642 pub struct DeviceServer<___T: ::fidl_next::Transport> {
7643 server: ::fidl_next::protocol::Server<___T>,
7644 }
7645
7646 impl<___T> DeviceServer<___T> where ___T: ::fidl_next::Transport {}
7647 }
7648}
7649
7650#[diagnostic::on_unimplemented(
7651 note = "If {Self} implements the non-local DeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
7652)]
7653
7654pub trait DeviceLocalClientHandler<
7658 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7659 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7660>
7661{
7662}
7663
7664impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Device
7665where
7666 ___H: DeviceLocalClientHandler<___T>,
7667 ___T: ::fidl_next::Transport,
7668{
7669 async fn on_event(
7670 handler: &mut ___H,
7671 mut message: ::fidl_next::Message<___T>,
7672 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
7673 match *message.header().ordinal {
7674 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
7675 }
7676 }
7677}
7678
7679#[diagnostic::on_unimplemented(
7680 note = "If {Self} implements the non-local DeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
7681)]
7682
7683pub trait DeviceLocalServerHandler<
7687 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7688 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7689>
7690{
7691 #[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"]
7692 fn register_power_domain(
7693 &mut self,
7694
7695 request: ::fidl_next::Request<device::RegisterPowerDomain, ___T>,
7696
7697 responder: ::fidl_next::Responder<device::RegisterPowerDomain, ___T>,
7698 ) -> impl ::core::future::Future<Output = ()>;
7699
7700 #[doc = " Unregister the callee for this power domain. The callee will no longer be considered as\n a dependent of this power domain.\n"]
7701 fn unregister_power_domain(
7702 &mut self,
7703
7704 responder: ::fidl_next::Responder<device::UnregisterPowerDomain, ___T>,
7705 ) -> impl ::core::future::Future<Output = ()>;
7706
7707 #[doc = " Get Supported Voltage Range. min and max are in micorVolts(uV)\n"]
7708 fn get_supported_voltage_range(
7709 &mut self,
7710
7711 responder: ::fidl_next::Responder<device::GetSupportedVoltageRange, ___T>,
7712 ) -> impl ::core::future::Future<Output = ()>;
7713
7714 #[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"]
7715 fn request_voltage(
7716 &mut self,
7717
7718 request: ::fidl_next::Request<device::RequestVoltage, ___T>,
7719
7720 responder: ::fidl_next::Responder<device::RequestVoltage, ___T>,
7721 ) -> impl ::core::future::Future<Output = ()>;
7722
7723 #[doc = " Get current voltage in uV.\n"]
7724 fn get_current_voltage(
7725 &mut self,
7726
7727 request: ::fidl_next::Request<device::GetCurrentVoltage, ___T>,
7728
7729 responder: ::fidl_next::Responder<device::GetCurrentVoltage, ___T>,
7730 ) -> impl ::core::future::Future<Output = ()>;
7731
7732 #[doc = " Get power domain status\n"]
7733 fn get_power_domain_status(
7734 &mut self,
7735
7736 responder: ::fidl_next::Responder<device::GetPowerDomainStatus, ___T>,
7737 ) -> impl ::core::future::Future<Output = ()>;
7738
7739 #[doc = " Write to ctrl register of PMIC\n"]
7740 fn write_pmic_ctrl_reg(
7741 &mut self,
7742
7743 request: ::fidl_next::Request<device::WritePmicCtrlReg, ___T>,
7744
7745 responder: ::fidl_next::Responder<device::WritePmicCtrlReg, ___T>,
7746 ) -> impl ::core::future::Future<Output = ()>;
7747
7748 #[doc = " Read ctrl register of PMIC\n"]
7749 fn read_pmic_ctrl_reg(
7750 &mut self,
7751
7752 request: ::fidl_next::Request<device::ReadPmicCtrlReg, ___T>,
7753
7754 responder: ::fidl_next::Responder<device::ReadPmicCtrlReg, ___T>,
7755 ) -> impl ::core::future::Future<Output = ()>;
7756}
7757
7758impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Device
7759where
7760 ___H: DeviceLocalServerHandler<___T>,
7761 ___T: ::fidl_next::Transport,
7762 for<'de> crate::wire::DeviceRegisterPowerDomainRequest: ::fidl_next::Decode<
7763 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7764 Constraint = (),
7765 >,
7766 for<'de> crate::wire::DeviceRequestVoltageRequest: ::fidl_next::Decode<
7767 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7768 Constraint = (),
7769 >,
7770 for<'de> crate::wire::DeviceGetCurrentVoltageRequest: ::fidl_next::Decode<
7771 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7772 Constraint = (),
7773 >,
7774 for<'de> crate::wire::DeviceWritePmicCtrlRegRequest: ::fidl_next::Decode<
7775 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7776 Constraint = (),
7777 >,
7778 for<'de> crate::wire::DeviceReadPmicCtrlRegRequest: ::fidl_next::Decode<
7779 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7780 Constraint = (),
7781 >,
7782{
7783 async fn on_one_way(
7784 handler: &mut ___H,
7785 mut message: ::fidl_next::Message<___T>,
7786 ) -> ::core::result::Result<
7787 (),
7788 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7789 > {
7790 match *message.header().ordinal {
7791 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
7792 }
7793 }
7794
7795 async fn on_two_way(
7796 handler: &mut ___H,
7797 mut message: ::fidl_next::Message<___T>,
7798 responder: ::fidl_next::protocol::Responder<___T>,
7799 ) -> ::core::result::Result<
7800 (),
7801 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7802 > {
7803 match *message.header().ordinal {
7804 4458069386545205468 => {
7805 let responder = ::fidl_next::Responder::from_untyped(responder);
7806
7807 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7808 Ok(decoded) => {
7809 handler
7810 .register_power_domain(
7811 ::fidl_next::Request::from_decoded(decoded),
7812 responder,
7813 )
7814 .await;
7815 Ok(())
7816 }
7817 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7818 ordinal: 4458069386545205468,
7819 error,
7820 }),
7821 }
7822 }
7823
7824 7717805237469023337 => {
7825 let responder = ::fidl_next::Responder::from_untyped(responder);
7826
7827 handler.unregister_power_domain(responder).await;
7828 Ok(())
7829 }
7830
7831 7887361504891407856 => {
7832 let responder = ::fidl_next::Responder::from_untyped(responder);
7833
7834 handler.get_supported_voltage_range(responder).await;
7835 Ok(())
7836 }
7837
7838 2578932345713622683 => {
7839 let responder = ::fidl_next::Responder::from_untyped(responder);
7840
7841 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7842 Ok(decoded) => {
7843 handler
7844 .request_voltage(::fidl_next::Request::from_decoded(decoded), responder)
7845 .await;
7846 Ok(())
7847 }
7848 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7849 ordinal: 2578932345713622683,
7850 error,
7851 }),
7852 }
7853 }
7854
7855 7683000915093989729 => {
7856 let responder = ::fidl_next::Responder::from_untyped(responder);
7857
7858 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7859 Ok(decoded) => {
7860 handler
7861 .get_current_voltage(
7862 ::fidl_next::Request::from_decoded(decoded),
7863 responder,
7864 )
7865 .await;
7866 Ok(())
7867 }
7868 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7869 ordinal: 7683000915093989729,
7870 error,
7871 }),
7872 }
7873 }
7874
7875 4178917272116294842 => {
7876 let responder = ::fidl_next::Responder::from_untyped(responder);
7877
7878 handler.get_power_domain_status(responder).await;
7879 Ok(())
7880 }
7881
7882 3749867380549091993 => {
7883 let responder = ::fidl_next::Responder::from_untyped(responder);
7884
7885 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7886 Ok(decoded) => {
7887 handler
7888 .write_pmic_ctrl_reg(
7889 ::fidl_next::Request::from_decoded(decoded),
7890 responder,
7891 )
7892 .await;
7893 Ok(())
7894 }
7895 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7896 ordinal: 3749867380549091993,
7897 error,
7898 }),
7899 }
7900 }
7901
7902 8281766978930618131 => {
7903 let responder = ::fidl_next::Responder::from_untyped(responder);
7904
7905 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7906 Ok(decoded) => {
7907 handler
7908 .read_pmic_ctrl_reg(
7909 ::fidl_next::Request::from_decoded(decoded),
7910 responder,
7911 )
7912 .await;
7913 Ok(())
7914 }
7915 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7916 ordinal: 8281766978930618131,
7917 error,
7918 }),
7919 }
7920 }
7921
7922 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
7923 }
7924 }
7925}
7926
7927pub trait DeviceClientHandler<
7931 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7932 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7933>
7934{
7935}
7936
7937impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Device
7938where
7939 ___H: DeviceClientHandler<___T> + ::core::marker::Send,
7940 ___T: ::fidl_next::Transport,
7941{
7942 async fn on_event(
7943 handler: &mut ___H,
7944 mut message: ::fidl_next::Message<___T>,
7945 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
7946 match *message.header().ordinal {
7947 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
7948 }
7949 }
7950}
7951
7952pub trait DeviceServerHandler<
7956 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7957 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7958>
7959{
7960 #[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"]
7961 fn register_power_domain(
7962 &mut self,
7963
7964 request: ::fidl_next::Request<device::RegisterPowerDomain, ___T>,
7965
7966 responder: ::fidl_next::Responder<device::RegisterPowerDomain, ___T>,
7967 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7968
7969 #[doc = " Unregister the callee for this power domain. The callee will no longer be considered as\n a dependent of this power domain.\n"]
7970 fn unregister_power_domain(
7971 &mut self,
7972
7973 responder: ::fidl_next::Responder<device::UnregisterPowerDomain, ___T>,
7974 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7975
7976 #[doc = " Get Supported Voltage Range. min and max are in micorVolts(uV)\n"]
7977 fn get_supported_voltage_range(
7978 &mut self,
7979
7980 responder: ::fidl_next::Responder<device::GetSupportedVoltageRange, ___T>,
7981 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7982
7983 #[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"]
7984 fn request_voltage(
7985 &mut self,
7986
7987 request: ::fidl_next::Request<device::RequestVoltage, ___T>,
7988
7989 responder: ::fidl_next::Responder<device::RequestVoltage, ___T>,
7990 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7991
7992 #[doc = " Get current voltage in uV.\n"]
7993 fn get_current_voltage(
7994 &mut self,
7995
7996 request: ::fidl_next::Request<device::GetCurrentVoltage, ___T>,
7997
7998 responder: ::fidl_next::Responder<device::GetCurrentVoltage, ___T>,
7999 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8000
8001 #[doc = " Get power domain status\n"]
8002 fn get_power_domain_status(
8003 &mut self,
8004
8005 responder: ::fidl_next::Responder<device::GetPowerDomainStatus, ___T>,
8006 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8007
8008 #[doc = " Write to ctrl register of PMIC\n"]
8009 fn write_pmic_ctrl_reg(
8010 &mut self,
8011
8012 request: ::fidl_next::Request<device::WritePmicCtrlReg, ___T>,
8013
8014 responder: ::fidl_next::Responder<device::WritePmicCtrlReg, ___T>,
8015 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8016
8017 #[doc = " Read ctrl register of PMIC\n"]
8018 fn read_pmic_ctrl_reg(
8019 &mut self,
8020
8021 request: ::fidl_next::Request<device::ReadPmicCtrlReg, ___T>,
8022
8023 responder: ::fidl_next::Responder<device::ReadPmicCtrlReg, ___T>,
8024 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8025}
8026
8027impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Device
8028where
8029 ___H: DeviceServerHandler<___T> + ::core::marker::Send,
8030 ___T: ::fidl_next::Transport,
8031 for<'de> crate::wire::DeviceRegisterPowerDomainRequest: ::fidl_next::Decode<
8032 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8033 Constraint = (),
8034 >,
8035 for<'de> crate::wire::DeviceRequestVoltageRequest: ::fidl_next::Decode<
8036 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8037 Constraint = (),
8038 >,
8039 for<'de> crate::wire::DeviceGetCurrentVoltageRequest: ::fidl_next::Decode<
8040 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8041 Constraint = (),
8042 >,
8043 for<'de> crate::wire::DeviceWritePmicCtrlRegRequest: ::fidl_next::Decode<
8044 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8045 Constraint = (),
8046 >,
8047 for<'de> crate::wire::DeviceReadPmicCtrlRegRequest: ::fidl_next::Decode<
8048 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8049 Constraint = (),
8050 >,
8051{
8052 async fn on_one_way(
8053 handler: &mut ___H,
8054 mut message: ::fidl_next::Message<___T>,
8055 ) -> ::core::result::Result<
8056 (),
8057 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
8058 > {
8059 match *message.header().ordinal {
8060 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
8061 }
8062 }
8063
8064 async fn on_two_way(
8065 handler: &mut ___H,
8066 mut message: ::fidl_next::Message<___T>,
8067 responder: ::fidl_next::protocol::Responder<___T>,
8068 ) -> ::core::result::Result<
8069 (),
8070 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
8071 > {
8072 match *message.header().ordinal {
8073 4458069386545205468 => {
8074 let responder = ::fidl_next::Responder::from_untyped(responder);
8075
8076 match ::fidl_next::AsDecoderExt::into_decoded(message) {
8077 Ok(decoded) => {
8078 handler
8079 .register_power_domain(
8080 ::fidl_next::Request::from_decoded(decoded),
8081 responder,
8082 )
8083 .await;
8084 Ok(())
8085 }
8086 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8087 ordinal: 4458069386545205468,
8088 error,
8089 }),
8090 }
8091 }
8092
8093 7717805237469023337 => {
8094 let responder = ::fidl_next::Responder::from_untyped(responder);
8095
8096 handler.unregister_power_domain(responder).await;
8097 Ok(())
8098 }
8099
8100 7887361504891407856 => {
8101 let responder = ::fidl_next::Responder::from_untyped(responder);
8102
8103 handler.get_supported_voltage_range(responder).await;
8104 Ok(())
8105 }
8106
8107 2578932345713622683 => {
8108 let responder = ::fidl_next::Responder::from_untyped(responder);
8109
8110 match ::fidl_next::AsDecoderExt::into_decoded(message) {
8111 Ok(decoded) => {
8112 handler
8113 .request_voltage(::fidl_next::Request::from_decoded(decoded), responder)
8114 .await;
8115 Ok(())
8116 }
8117 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8118 ordinal: 2578932345713622683,
8119 error,
8120 }),
8121 }
8122 }
8123
8124 7683000915093989729 => {
8125 let responder = ::fidl_next::Responder::from_untyped(responder);
8126
8127 match ::fidl_next::AsDecoderExt::into_decoded(message) {
8128 Ok(decoded) => {
8129 handler
8130 .get_current_voltage(
8131 ::fidl_next::Request::from_decoded(decoded),
8132 responder,
8133 )
8134 .await;
8135 Ok(())
8136 }
8137 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8138 ordinal: 7683000915093989729,
8139 error,
8140 }),
8141 }
8142 }
8143
8144 4178917272116294842 => {
8145 let responder = ::fidl_next::Responder::from_untyped(responder);
8146
8147 handler.get_power_domain_status(responder).await;
8148 Ok(())
8149 }
8150
8151 3749867380549091993 => {
8152 let responder = ::fidl_next::Responder::from_untyped(responder);
8153
8154 match ::fidl_next::AsDecoderExt::into_decoded(message) {
8155 Ok(decoded) => {
8156 handler
8157 .write_pmic_ctrl_reg(
8158 ::fidl_next::Request::from_decoded(decoded),
8159 responder,
8160 )
8161 .await;
8162 Ok(())
8163 }
8164 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8165 ordinal: 3749867380549091993,
8166 error,
8167 }),
8168 }
8169 }
8170
8171 8281766978930618131 => {
8172 let responder = ::fidl_next::Responder::from_untyped(responder);
8173
8174 match ::fidl_next::AsDecoderExt::into_decoded(message) {
8175 Ok(decoded) => {
8176 handler
8177 .read_pmic_ctrl_reg(
8178 ::fidl_next::Request::from_decoded(decoded),
8179 responder,
8180 )
8181 .await;
8182 Ok(())
8183 }
8184 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8185 ordinal: 8281766978930618131,
8186 error,
8187 }),
8188 }
8189 }
8190
8191 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
8192 }
8193 }
8194}
8195
8196impl<___T> DeviceClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
8197{}
8198
8199impl<___H, ___T> DeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
8200where
8201 ___H: DeviceClientHandler<___T>,
8202 ___T: ::fidl_next::Transport,
8203{
8204}
8205
8206impl<___H, ___T> DeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
8207where
8208 ___H: DeviceServerHandler<___T>,
8209 ___T: ::fidl_next::Transport,
8210{
8211 async fn register_power_domain(
8212 &mut self,
8213
8214 request: ::fidl_next::Request<device::RegisterPowerDomain, ___T>,
8215
8216 responder: ::fidl_next::Responder<device::RegisterPowerDomain, ___T>,
8217 ) {
8218 ___H::register_power_domain(&mut self.0, request, responder).await
8219 }
8220
8221 async fn unregister_power_domain(
8222 &mut self,
8223
8224 responder: ::fidl_next::Responder<device::UnregisterPowerDomain, ___T>,
8225 ) {
8226 ___H::unregister_power_domain(&mut self.0, responder).await
8227 }
8228
8229 async fn get_supported_voltage_range(
8230 &mut self,
8231
8232 responder: ::fidl_next::Responder<device::GetSupportedVoltageRange, ___T>,
8233 ) {
8234 ___H::get_supported_voltage_range(&mut self.0, responder).await
8235 }
8236
8237 async fn request_voltage(
8238 &mut self,
8239
8240 request: ::fidl_next::Request<device::RequestVoltage, ___T>,
8241
8242 responder: ::fidl_next::Responder<device::RequestVoltage, ___T>,
8243 ) {
8244 ___H::request_voltage(&mut self.0, request, responder).await
8245 }
8246
8247 async fn get_current_voltage(
8248 &mut self,
8249
8250 request: ::fidl_next::Request<device::GetCurrentVoltage, ___T>,
8251
8252 responder: ::fidl_next::Responder<device::GetCurrentVoltage, ___T>,
8253 ) {
8254 ___H::get_current_voltage(&mut self.0, request, responder).await
8255 }
8256
8257 async fn get_power_domain_status(
8258 &mut self,
8259
8260 responder: ::fidl_next::Responder<device::GetPowerDomainStatus, ___T>,
8261 ) {
8262 ___H::get_power_domain_status(&mut self.0, responder).await
8263 }
8264
8265 async fn write_pmic_ctrl_reg(
8266 &mut self,
8267
8268 request: ::fidl_next::Request<device::WritePmicCtrlReg, ___T>,
8269
8270 responder: ::fidl_next::Responder<device::WritePmicCtrlReg, ___T>,
8271 ) {
8272 ___H::write_pmic_ctrl_reg(&mut self.0, request, responder).await
8273 }
8274
8275 async fn read_pmic_ctrl_reg(
8276 &mut self,
8277
8278 request: ::fidl_next::Request<device::ReadPmicCtrlReg, ___T>,
8279
8280 responder: ::fidl_next::Responder<device::ReadPmicCtrlReg, ___T>,
8281 ) {
8282 ___H::read_pmic_ctrl_reg(&mut self.0, request, responder).await
8283 }
8284}