1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_MODE_MATCHES_PER_CLIENT: u32 = 0;
18
19#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
21pub enum ModeRequestError {
22 Generic,
24 #[doc(hidden)]
25 __SourceBreaking { unknown_ordinal: u32 },
26}
27
28#[macro_export]
30macro_rules! ModeRequestErrorUnknown {
31 () => {
32 _
33 };
34}
35
36impl ModeRequestError {
37 #[inline]
38 pub fn from_primitive(prim: u32) -> Option<Self> {
39 match prim {
40 1 => Some(Self::Generic),
41 _ => None,
42 }
43 }
44
45 #[inline]
46 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
47 match prim {
48 1 => Self::Generic,
49 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
50 }
51 }
52
53 #[inline]
54 pub fn unknown() -> Self {
55 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
56 }
57
58 #[inline]
59 pub const fn into_primitive(self) -> u32 {
60 match self {
61 Self::Generic => 1,
62 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
63 }
64 }
65
66 #[inline]
67 pub fn is_unknown(&self) -> bool {
68 match self {
69 Self::__SourceBreaking { unknown_ordinal: _ } => true,
70 _ => false,
71 }
72 }
73}
74
75#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
87pub enum SystemMode {
88 #[doc(hidden)]
89 __SourceBreaking { unknown_ordinal: u32 },
90}
91
92#[macro_export]
94macro_rules! SystemModeUnknown {
95 () => {
96 _
97 };
98}
99
100impl SystemMode {
101 #[inline]
102 pub fn from_primitive(prim: u32) -> Option<Self> {
103 match prim {
104 _ => None,
105 }
106 }
107
108 #[inline]
109 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
110 match prim {
111 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
112 }
113 }
114
115 #[inline]
116 pub fn unknown() -> Self {
117 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
118 }
119
120 #[inline]
121 pub const fn into_primitive(self) -> u32 {
122 match self {
123 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
124 }
125 }
126
127 #[inline]
128 pub fn is_unknown(&self) -> bool {
129 match self {
130 Self::__SourceBreaking { unknown_ordinal: _ } => true,
131 }
132 }
133}
134
135#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
149pub struct ClientConfig {
150 pub mode_matches: Vec<ModeMatch>,
151 pub default_level: u64,
152}
153
154impl fidl::Persistable for ClientConfig {}
155
156#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
157pub struct ClientConfiguratorGetRequest {
158 pub client_type: fidl_fuchsia_power_clientlevel::ClientType,
159}
160
161impl fidl::Persistable for ClientConfiguratorGetRequest {}
162
163#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
164pub struct ClientConfiguratorGetResponse {
165 pub config: Option<Box<ClientConfig>>,
166}
167
168impl fidl::Persistable for ClientConfiguratorGetResponse {}
169
170#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
171pub struct ClientConfiguratorSetRequest {
172 pub client_type: fidl_fuchsia_power_clientlevel::ClientType,
173 pub config: ClientConfig,
174}
175
176impl fidl::Persistable for ClientConfiguratorSetRequest {}
177
178#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
185pub struct ModeMatch {
186 pub mode: SystemMode,
187 pub power_level: u64,
188}
189
190impl fidl::Persistable for ModeMatch {}
191
192#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
193pub struct RequesterRequestRequest {
194 pub mode: SystemMode,
195 pub set: bool,
196}
197
198impl fidl::Persistable for RequesterRequestRequest {}
199
200mod internal {
201 use super::*;
202 unsafe impl fidl::encoding::TypeMarker for ModeRequestError {
203 type Owned = Self;
204
205 #[inline(always)]
206 fn inline_align(_context: fidl::encoding::Context) -> usize {
207 std::mem::align_of::<u32>()
208 }
209
210 #[inline(always)]
211 fn inline_size(_context: fidl::encoding::Context) -> usize {
212 std::mem::size_of::<u32>()
213 }
214
215 #[inline(always)]
216 fn encode_is_copy() -> bool {
217 false
218 }
219
220 #[inline(always)]
221 fn decode_is_copy() -> bool {
222 false
223 }
224 }
225
226 impl fidl::encoding::ValueTypeMarker for ModeRequestError {
227 type Borrowed<'a> = Self;
228 #[inline(always)]
229 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
230 *value
231 }
232 }
233
234 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
235 for ModeRequestError
236 {
237 #[inline]
238 unsafe fn encode(
239 self,
240 encoder: &mut fidl::encoding::Encoder<'_, D>,
241 offset: usize,
242 _depth: fidl::encoding::Depth,
243 ) -> fidl::Result<()> {
244 encoder.debug_check_bounds::<Self>(offset);
245 encoder.write_num(self.into_primitive(), offset);
246 Ok(())
247 }
248 }
249
250 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ModeRequestError {
251 #[inline(always)]
252 fn new_empty() -> Self {
253 Self::unknown()
254 }
255
256 #[inline]
257 unsafe fn decode(
258 &mut self,
259 decoder: &mut fidl::encoding::Decoder<'_, D>,
260 offset: usize,
261 _depth: fidl::encoding::Depth,
262 ) -> fidl::Result<()> {
263 decoder.debug_check_bounds::<Self>(offset);
264 let prim = decoder.read_num::<u32>(offset);
265
266 *self = Self::from_primitive_allow_unknown(prim);
267 Ok(())
268 }
269 }
270 unsafe impl fidl::encoding::TypeMarker for SystemMode {
271 type Owned = Self;
272
273 #[inline(always)]
274 fn inline_align(_context: fidl::encoding::Context) -> usize {
275 std::mem::align_of::<u32>()
276 }
277
278 #[inline(always)]
279 fn inline_size(_context: fidl::encoding::Context) -> usize {
280 std::mem::size_of::<u32>()
281 }
282
283 #[inline(always)]
284 fn encode_is_copy() -> bool {
285 false
286 }
287
288 #[inline(always)]
289 fn decode_is_copy() -> bool {
290 false
291 }
292 }
293
294 impl fidl::encoding::ValueTypeMarker for SystemMode {
295 type Borrowed<'a> = Self;
296 #[inline(always)]
297 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
298 *value
299 }
300 }
301
302 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SystemMode {
303 #[inline]
304 unsafe fn encode(
305 self,
306 encoder: &mut fidl::encoding::Encoder<'_, D>,
307 offset: usize,
308 _depth: fidl::encoding::Depth,
309 ) -> fidl::Result<()> {
310 encoder.debug_check_bounds::<Self>(offset);
311 encoder.write_num(self.into_primitive(), offset);
312 Ok(())
313 }
314 }
315
316 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SystemMode {
317 #[inline(always)]
318 fn new_empty() -> Self {
319 Self::unknown()
320 }
321
322 #[inline]
323 unsafe fn decode(
324 &mut self,
325 decoder: &mut fidl::encoding::Decoder<'_, D>,
326 offset: usize,
327 _depth: fidl::encoding::Depth,
328 ) -> fidl::Result<()> {
329 decoder.debug_check_bounds::<Self>(offset);
330 let prim = decoder.read_num::<u32>(offset);
331
332 *self = Self::from_primitive_allow_unknown(prim);
333 Ok(())
334 }
335 }
336
337 impl fidl::encoding::ValueTypeMarker for ClientConfig {
338 type Borrowed<'a> = &'a Self;
339 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
340 value
341 }
342 }
343
344 unsafe impl fidl::encoding::TypeMarker for ClientConfig {
345 type Owned = Self;
346
347 #[inline(always)]
348 fn inline_align(_context: fidl::encoding::Context) -> usize {
349 8
350 }
351
352 #[inline(always)]
353 fn inline_size(_context: fidl::encoding::Context) -> usize {
354 24
355 }
356 }
357
358 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClientConfig, D>
359 for &ClientConfig
360 {
361 #[inline]
362 unsafe fn encode(
363 self,
364 encoder: &mut fidl::encoding::Encoder<'_, D>,
365 offset: usize,
366 _depth: fidl::encoding::Depth,
367 ) -> fidl::Result<()> {
368 encoder.debug_check_bounds::<ClientConfig>(offset);
369 fidl::encoding::Encode::<ClientConfig, D>::encode(
371 (
372 <fidl::encoding::Vector<ModeMatch, 0> as fidl::encoding::ValueTypeMarker>::borrow(&self.mode_matches),
373 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.default_level),
374 ),
375 encoder, offset, _depth
376 )
377 }
378 }
379 unsafe impl<
380 D: fidl::encoding::ResourceDialect,
381 T0: fidl::encoding::Encode<fidl::encoding::Vector<ModeMatch, 0>, D>,
382 T1: fidl::encoding::Encode<u64, D>,
383 > fidl::encoding::Encode<ClientConfig, D> for (T0, T1)
384 {
385 #[inline]
386 unsafe fn encode(
387 self,
388 encoder: &mut fidl::encoding::Encoder<'_, D>,
389 offset: usize,
390 depth: fidl::encoding::Depth,
391 ) -> fidl::Result<()> {
392 encoder.debug_check_bounds::<ClientConfig>(offset);
393 self.0.encode(encoder, offset + 0, depth)?;
397 self.1.encode(encoder, offset + 16, depth)?;
398 Ok(())
399 }
400 }
401
402 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClientConfig {
403 #[inline(always)]
404 fn new_empty() -> Self {
405 Self {
406 mode_matches: fidl::new_empty!(fidl::encoding::Vector<ModeMatch, 0>, D),
407 default_level: fidl::new_empty!(u64, D),
408 }
409 }
410
411 #[inline]
412 unsafe fn decode(
413 &mut self,
414 decoder: &mut fidl::encoding::Decoder<'_, D>,
415 offset: usize,
416 _depth: fidl::encoding::Depth,
417 ) -> fidl::Result<()> {
418 decoder.debug_check_bounds::<Self>(offset);
419 fidl::decode!(fidl::encoding::Vector<ModeMatch, 0>, D, &mut self.mode_matches, decoder, offset + 0, _depth)?;
421 fidl::decode!(u64, D, &mut self.default_level, decoder, offset + 16, _depth)?;
422 Ok(())
423 }
424 }
425
426 impl fidl::encoding::ValueTypeMarker for ClientConfiguratorGetRequest {
427 type Borrowed<'a> = &'a Self;
428 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
429 value
430 }
431 }
432
433 unsafe impl fidl::encoding::TypeMarker for ClientConfiguratorGetRequest {
434 type Owned = Self;
435
436 #[inline(always)]
437 fn inline_align(_context: fidl::encoding::Context) -> usize {
438 4
439 }
440
441 #[inline(always)]
442 fn inline_size(_context: fidl::encoding::Context) -> usize {
443 4
444 }
445 }
446
447 unsafe impl<D: fidl::encoding::ResourceDialect>
448 fidl::encoding::Encode<ClientConfiguratorGetRequest, D> for &ClientConfiguratorGetRequest
449 {
450 #[inline]
451 unsafe fn encode(
452 self,
453 encoder: &mut fidl::encoding::Encoder<'_, D>,
454 offset: usize,
455 _depth: fidl::encoding::Depth,
456 ) -> fidl::Result<()> {
457 encoder.debug_check_bounds::<ClientConfiguratorGetRequest>(offset);
458 fidl::encoding::Encode::<ClientConfiguratorGetRequest, D>::encode(
460 (
461 <fidl_fuchsia_power_clientlevel::ClientType as fidl::encoding::ValueTypeMarker>::borrow(&self.client_type),
462 ),
463 encoder, offset, _depth
464 )
465 }
466 }
467 unsafe impl<
468 D: fidl::encoding::ResourceDialect,
469 T0: fidl::encoding::Encode<fidl_fuchsia_power_clientlevel::ClientType, D>,
470 > fidl::encoding::Encode<ClientConfiguratorGetRequest, D> for (T0,)
471 {
472 #[inline]
473 unsafe fn encode(
474 self,
475 encoder: &mut fidl::encoding::Encoder<'_, D>,
476 offset: usize,
477 depth: fidl::encoding::Depth,
478 ) -> fidl::Result<()> {
479 encoder.debug_check_bounds::<ClientConfiguratorGetRequest>(offset);
480 self.0.encode(encoder, offset + 0, depth)?;
484 Ok(())
485 }
486 }
487
488 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
489 for ClientConfiguratorGetRequest
490 {
491 #[inline(always)]
492 fn new_empty() -> Self {
493 Self { client_type: fidl::new_empty!(fidl_fuchsia_power_clientlevel::ClientType, D) }
494 }
495
496 #[inline]
497 unsafe fn decode(
498 &mut self,
499 decoder: &mut fidl::encoding::Decoder<'_, D>,
500 offset: usize,
501 _depth: fidl::encoding::Depth,
502 ) -> fidl::Result<()> {
503 decoder.debug_check_bounds::<Self>(offset);
504 fidl::decode!(
506 fidl_fuchsia_power_clientlevel::ClientType,
507 D,
508 &mut self.client_type,
509 decoder,
510 offset + 0,
511 _depth
512 )?;
513 Ok(())
514 }
515 }
516
517 impl fidl::encoding::ValueTypeMarker for ClientConfiguratorGetResponse {
518 type Borrowed<'a> = &'a Self;
519 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
520 value
521 }
522 }
523
524 unsafe impl fidl::encoding::TypeMarker for ClientConfiguratorGetResponse {
525 type Owned = Self;
526
527 #[inline(always)]
528 fn inline_align(_context: fidl::encoding::Context) -> usize {
529 8
530 }
531
532 #[inline(always)]
533 fn inline_size(_context: fidl::encoding::Context) -> usize {
534 8
535 }
536 }
537
538 unsafe impl<D: fidl::encoding::ResourceDialect>
539 fidl::encoding::Encode<ClientConfiguratorGetResponse, D>
540 for &ClientConfiguratorGetResponse
541 {
542 #[inline]
543 unsafe fn encode(
544 self,
545 encoder: &mut fidl::encoding::Encoder<'_, D>,
546 offset: usize,
547 _depth: fidl::encoding::Depth,
548 ) -> fidl::Result<()> {
549 encoder.debug_check_bounds::<ClientConfiguratorGetResponse>(offset);
550 fidl::encoding::Encode::<ClientConfiguratorGetResponse, D>::encode(
552 (<fidl::encoding::Boxed<ClientConfig> as fidl::encoding::ValueTypeMarker>::borrow(
553 &self.config,
554 ),),
555 encoder,
556 offset,
557 _depth,
558 )
559 }
560 }
561 unsafe impl<
562 D: fidl::encoding::ResourceDialect,
563 T0: fidl::encoding::Encode<fidl::encoding::Boxed<ClientConfig>, D>,
564 > fidl::encoding::Encode<ClientConfiguratorGetResponse, D> for (T0,)
565 {
566 #[inline]
567 unsafe fn encode(
568 self,
569 encoder: &mut fidl::encoding::Encoder<'_, D>,
570 offset: usize,
571 depth: fidl::encoding::Depth,
572 ) -> fidl::Result<()> {
573 encoder.debug_check_bounds::<ClientConfiguratorGetResponse>(offset);
574 self.0.encode(encoder, offset + 0, depth)?;
578 Ok(())
579 }
580 }
581
582 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
583 for ClientConfiguratorGetResponse
584 {
585 #[inline(always)]
586 fn new_empty() -> Self {
587 Self { config: fidl::new_empty!(fidl::encoding::Boxed<ClientConfig>, D) }
588 }
589
590 #[inline]
591 unsafe fn decode(
592 &mut self,
593 decoder: &mut fidl::encoding::Decoder<'_, D>,
594 offset: usize,
595 _depth: fidl::encoding::Depth,
596 ) -> fidl::Result<()> {
597 decoder.debug_check_bounds::<Self>(offset);
598 fidl::decode!(
600 fidl::encoding::Boxed<ClientConfig>,
601 D,
602 &mut self.config,
603 decoder,
604 offset + 0,
605 _depth
606 )?;
607 Ok(())
608 }
609 }
610
611 impl fidl::encoding::ValueTypeMarker for ClientConfiguratorSetRequest {
612 type Borrowed<'a> = &'a Self;
613 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
614 value
615 }
616 }
617
618 unsafe impl fidl::encoding::TypeMarker for ClientConfiguratorSetRequest {
619 type Owned = Self;
620
621 #[inline(always)]
622 fn inline_align(_context: fidl::encoding::Context) -> usize {
623 8
624 }
625
626 #[inline(always)]
627 fn inline_size(_context: fidl::encoding::Context) -> usize {
628 32
629 }
630 }
631
632 unsafe impl<D: fidl::encoding::ResourceDialect>
633 fidl::encoding::Encode<ClientConfiguratorSetRequest, D> for &ClientConfiguratorSetRequest
634 {
635 #[inline]
636 unsafe fn encode(
637 self,
638 encoder: &mut fidl::encoding::Encoder<'_, D>,
639 offset: usize,
640 _depth: fidl::encoding::Depth,
641 ) -> fidl::Result<()> {
642 encoder.debug_check_bounds::<ClientConfiguratorSetRequest>(offset);
643 fidl::encoding::Encode::<ClientConfiguratorSetRequest, D>::encode(
645 (
646 <fidl_fuchsia_power_clientlevel::ClientType as fidl::encoding::ValueTypeMarker>::borrow(&self.client_type),
647 <ClientConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
648 ),
649 encoder, offset, _depth
650 )
651 }
652 }
653 unsafe impl<
654 D: fidl::encoding::ResourceDialect,
655 T0: fidl::encoding::Encode<fidl_fuchsia_power_clientlevel::ClientType, D>,
656 T1: fidl::encoding::Encode<ClientConfig, D>,
657 > fidl::encoding::Encode<ClientConfiguratorSetRequest, D> for (T0, T1)
658 {
659 #[inline]
660 unsafe fn encode(
661 self,
662 encoder: &mut fidl::encoding::Encoder<'_, D>,
663 offset: usize,
664 depth: fidl::encoding::Depth,
665 ) -> fidl::Result<()> {
666 encoder.debug_check_bounds::<ClientConfiguratorSetRequest>(offset);
667 unsafe {
670 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
671 (ptr as *mut u64).write_unaligned(0);
672 }
673 self.0.encode(encoder, offset + 0, depth)?;
675 self.1.encode(encoder, offset + 8, depth)?;
676 Ok(())
677 }
678 }
679
680 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
681 for ClientConfiguratorSetRequest
682 {
683 #[inline(always)]
684 fn new_empty() -> Self {
685 Self {
686 client_type: fidl::new_empty!(fidl_fuchsia_power_clientlevel::ClientType, D),
687 config: fidl::new_empty!(ClientConfig, D),
688 }
689 }
690
691 #[inline]
692 unsafe fn decode(
693 &mut self,
694 decoder: &mut fidl::encoding::Decoder<'_, D>,
695 offset: usize,
696 _depth: fidl::encoding::Depth,
697 ) -> fidl::Result<()> {
698 decoder.debug_check_bounds::<Self>(offset);
699 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
701 let padval = unsafe { (ptr as *const u64).read_unaligned() };
702 let mask = 0xffffffff00000000u64;
703 let maskedval = padval & mask;
704 if maskedval != 0 {
705 return Err(fidl::Error::NonZeroPadding {
706 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
707 });
708 }
709 fidl::decode!(
710 fidl_fuchsia_power_clientlevel::ClientType,
711 D,
712 &mut self.client_type,
713 decoder,
714 offset + 0,
715 _depth
716 )?;
717 fidl::decode!(ClientConfig, D, &mut self.config, decoder, offset + 8, _depth)?;
718 Ok(())
719 }
720 }
721
722 impl fidl::encoding::ValueTypeMarker for ModeMatch {
723 type Borrowed<'a> = &'a Self;
724 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
725 value
726 }
727 }
728
729 unsafe impl fidl::encoding::TypeMarker for ModeMatch {
730 type Owned = Self;
731
732 #[inline(always)]
733 fn inline_align(_context: fidl::encoding::Context) -> usize {
734 8
735 }
736
737 #[inline(always)]
738 fn inline_size(_context: fidl::encoding::Context) -> usize {
739 16
740 }
741 }
742
743 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ModeMatch, D>
744 for &ModeMatch
745 {
746 #[inline]
747 unsafe fn encode(
748 self,
749 encoder: &mut fidl::encoding::Encoder<'_, D>,
750 offset: usize,
751 _depth: fidl::encoding::Depth,
752 ) -> fidl::Result<()> {
753 encoder.debug_check_bounds::<ModeMatch>(offset);
754 fidl::encoding::Encode::<ModeMatch, D>::encode(
756 (
757 <SystemMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
758 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.power_level),
759 ),
760 encoder,
761 offset,
762 _depth,
763 )
764 }
765 }
766 unsafe impl<
767 D: fidl::encoding::ResourceDialect,
768 T0: fidl::encoding::Encode<SystemMode, D>,
769 T1: fidl::encoding::Encode<u64, D>,
770 > fidl::encoding::Encode<ModeMatch, D> for (T0, T1)
771 {
772 #[inline]
773 unsafe fn encode(
774 self,
775 encoder: &mut fidl::encoding::Encoder<'_, D>,
776 offset: usize,
777 depth: fidl::encoding::Depth,
778 ) -> fidl::Result<()> {
779 encoder.debug_check_bounds::<ModeMatch>(offset);
780 unsafe {
783 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
784 (ptr as *mut u64).write_unaligned(0);
785 }
786 self.0.encode(encoder, offset + 0, depth)?;
788 self.1.encode(encoder, offset + 8, depth)?;
789 Ok(())
790 }
791 }
792
793 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ModeMatch {
794 #[inline(always)]
795 fn new_empty() -> Self {
796 Self { mode: fidl::new_empty!(SystemMode, D), power_level: fidl::new_empty!(u64, D) }
797 }
798
799 #[inline]
800 unsafe fn decode(
801 &mut self,
802 decoder: &mut fidl::encoding::Decoder<'_, D>,
803 offset: usize,
804 _depth: fidl::encoding::Depth,
805 ) -> fidl::Result<()> {
806 decoder.debug_check_bounds::<Self>(offset);
807 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
809 let padval = unsafe { (ptr as *const u64).read_unaligned() };
810 let mask = 0xffffffff00000000u64;
811 let maskedval = padval & mask;
812 if maskedval != 0 {
813 return Err(fidl::Error::NonZeroPadding {
814 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
815 });
816 }
817 fidl::decode!(SystemMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
818 fidl::decode!(u64, D, &mut self.power_level, decoder, offset + 8, _depth)?;
819 Ok(())
820 }
821 }
822
823 impl fidl::encoding::ValueTypeMarker for RequesterRequestRequest {
824 type Borrowed<'a> = &'a Self;
825 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
826 value
827 }
828 }
829
830 unsafe impl fidl::encoding::TypeMarker for RequesterRequestRequest {
831 type Owned = Self;
832
833 #[inline(always)]
834 fn inline_align(_context: fidl::encoding::Context) -> usize {
835 4
836 }
837
838 #[inline(always)]
839 fn inline_size(_context: fidl::encoding::Context) -> usize {
840 8
841 }
842 }
843
844 unsafe impl<D: fidl::encoding::ResourceDialect>
845 fidl::encoding::Encode<RequesterRequestRequest, D> for &RequesterRequestRequest
846 {
847 #[inline]
848 unsafe fn encode(
849 self,
850 encoder: &mut fidl::encoding::Encoder<'_, D>,
851 offset: usize,
852 _depth: fidl::encoding::Depth,
853 ) -> fidl::Result<()> {
854 encoder.debug_check_bounds::<RequesterRequestRequest>(offset);
855 fidl::encoding::Encode::<RequesterRequestRequest, D>::encode(
857 (
858 <SystemMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
859 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.set),
860 ),
861 encoder,
862 offset,
863 _depth,
864 )
865 }
866 }
867 unsafe impl<
868 D: fidl::encoding::ResourceDialect,
869 T0: fidl::encoding::Encode<SystemMode, D>,
870 T1: fidl::encoding::Encode<bool, D>,
871 > fidl::encoding::Encode<RequesterRequestRequest, D> for (T0, T1)
872 {
873 #[inline]
874 unsafe fn encode(
875 self,
876 encoder: &mut fidl::encoding::Encoder<'_, D>,
877 offset: usize,
878 depth: fidl::encoding::Depth,
879 ) -> fidl::Result<()> {
880 encoder.debug_check_bounds::<RequesterRequestRequest>(offset);
881 unsafe {
884 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
885 (ptr as *mut u32).write_unaligned(0);
886 }
887 self.0.encode(encoder, offset + 0, depth)?;
889 self.1.encode(encoder, offset + 4, depth)?;
890 Ok(())
891 }
892 }
893
894 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
895 for RequesterRequestRequest
896 {
897 #[inline(always)]
898 fn new_empty() -> Self {
899 Self { mode: fidl::new_empty!(SystemMode, D), set: fidl::new_empty!(bool, D) }
900 }
901
902 #[inline]
903 unsafe fn decode(
904 &mut self,
905 decoder: &mut fidl::encoding::Decoder<'_, D>,
906 offset: usize,
907 _depth: fidl::encoding::Depth,
908 ) -> fidl::Result<()> {
909 decoder.debug_check_bounds::<Self>(offset);
910 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
912 let padval = unsafe { (ptr as *const u32).read_unaligned() };
913 let mask = 0xffffff00u32;
914 let maskedval = padval & mask;
915 if maskedval != 0 {
916 return Err(fidl::Error::NonZeroPadding {
917 padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
918 });
919 }
920 fidl::decode!(SystemMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
921 fidl::decode!(bool, D, &mut self.set, decoder, offset + 4, _depth)?;
922 Ok(())
923 }
924 }
925}