fidl_fuchsia_power_topology_test__common/
fidl_fuchsia_power_topology_test__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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 type ElementName = String;
12
13pub type PowerLevel = u8;
14
15pub const MAX_DEPENDENCIES: u16 = MAX_VALID_POWER_LEVELS as u16;
16
17pub const MAX_ELEMENTS: u16 = 256;
18
19pub const MAX_ELEMENT_NAME_LEN: u16 =
20    fidl_fuchsia_power_broker__common::MAX_ELEMENT_NAME_LEN as u16;
21
22pub const MAX_VALID_POWER_LEVELS: u16 =
23    fidl_fuchsia_power_broker__common::MAX_VALID_POWER_LEVELS as u16;
24
25/// Errors associated with TopologyControl.Create method.
26#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
27#[repr(u32)]
28pub enum CreateTopologyGraphError {
29    /// Indicates that the request failed due to an internal error.
30    Internal = 1,
31    /// Indicates that the element topology provided in Create command is
32    /// invalid.
33    InvalidTopology = 2,
34}
35
36impl CreateTopologyGraphError {
37    #[inline]
38    pub fn from_primitive(prim: u32) -> Option<Self> {
39        match prim {
40            1 => Some(Self::Internal),
41            2 => Some(Self::InvalidTopology),
42            _ => None,
43        }
44    }
45
46    #[inline]
47    pub const fn into_primitive(self) -> u32 {
48        self as u32
49    }
50}
51
52/// Errors associated with TopologyControl.AcquireLease and
53/// TopologyControl.DropLease methods.
54#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
55#[repr(u32)]
56pub enum LeaseControlError {
57    /// Indicates that the request failed due to an internal error.
58    Internal = 1,
59    /// Indicates that an invalid power element name was provided in
60    /// AcquireLease or DropLease.
61    InvalidElement = 2,
62}
63
64impl LeaseControlError {
65    #[inline]
66    pub fn from_primitive(prim: u32) -> Option<Self> {
67        match prim {
68            1 => Some(Self::Internal),
69            2 => Some(Self::InvalidElement),
70            _ => None,
71        }
72    }
73
74    #[inline]
75    pub const fn into_primitive(self) -> u32 {
76        self as u32
77    }
78}
79
80/// Errors associated with TopologyControl.OpenStatusChannel method.
81#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
82#[repr(u32)]
83pub enum OpenStatusChannelError {
84    /// Indicates that the request failed due to an internal error.
85    Internal = 1,
86    /// Indicates that an invalid power element name was provided in
87    /// OpenStatusChannel
88    InvalidElement = 2,
89}
90
91impl OpenStatusChannelError {
92    #[inline]
93    pub fn from_primitive(prim: u32) -> Option<Self> {
94        match prim {
95            1 => Some(Self::Internal),
96            2 => Some(Self::InvalidElement),
97            _ => None,
98        }
99    }
100
101    #[inline]
102    pub const fn into_primitive(self) -> u32 {
103        self as u32
104    }
105}
106
107/// Errors associated with SystemActivityControl methods.
108#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
109#[repr(u32)]
110pub enum SystemActivityControlError {
111    /// Indicates that the request failed due to an internal error.
112    Internal = 1,
113}
114
115impl SystemActivityControlError {
116    #[inline]
117    pub fn from_primitive(prim: u32) -> Option<Self> {
118        match prim {
119            1 => Some(Self::Internal),
120            _ => None,
121        }
122    }
123
124    #[inline]
125    pub const fn into_primitive(self) -> u32 {
126        self as u32
127    }
128}
129
130/// Passed to TopologyControl.Create to construct power topology.
131#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
132pub struct Element {
133    pub element_name: String,
134    pub initial_current_level: u8,
135    pub valid_levels: Vec<u8>,
136    pub dependencies: Vec<LevelDependency>,
137}
138
139impl fidl::Persistable for Element {}
140
141/// Power Dependency information in Element. Used by a client to construct power topology.
142#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
143pub struct LevelDependency {
144    pub dependent_level: u8,
145    pub requires_element: String,
146    pub requires_level: u8,
147}
148
149impl fidl::Persistable for LevelDependency {}
150
151#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
152#[repr(C)]
153pub struct SystemActivityControlRestartApplicationActivityRequest {
154    /// The time to wait after dropping the lease but before reclaiming it.
155    pub wait_time_ns: u64,
156}
157
158impl fidl::Persistable for SystemActivityControlRestartApplicationActivityRequest {}
159
160#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
161pub struct TopologyControlAcquireLeaseRequest {
162    pub element_name: String,
163    /// Power level of this element to be raised to.
164    pub level: u8,
165}
166
167impl fidl::Persistable for TopologyControlAcquireLeaseRequest {}
168
169#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
170pub struct TopologyControlCreateRequest {
171    /// List of elements to create.
172    pub elements: Vec<Element>,
173}
174
175impl fidl::Persistable for TopologyControlCreateRequest {}
176
177#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
178pub struct TopologyControlDropLeaseRequest {
179    pub element_name: String,
180}
181
182impl fidl::Persistable for TopologyControlDropLeaseRequest {}
183
184pub mod system_activity_control_ordinals {
185    pub const START_APPLICATION_ACTIVITY: u64 = 0x61de6f5d5285a4e3;
186    pub const STOP_APPLICATION_ACTIVITY: u64 = 0x294ea5c8d0e2e0c0;
187    pub const RESTART_APPLICATION_ACTIVITY: u64 = 0x2881d47bba86f3d4;
188}
189
190pub mod topology_control_ordinals {
191    pub const CREATE: u64 = 0x12033976b88716fa;
192    pub const ACQUIRE_LEASE: u64 = 0x1bedc35d9b68bac8;
193    pub const DROP_LEASE: u64 = 0x7107f8f1080faddc;
194    pub const OPEN_STATUS_CHANNEL: u64 = 0x69fba616c3ee2e90;
195}
196
197mod internal {
198    use super::*;
199    unsafe impl fidl::encoding::TypeMarker for CreateTopologyGraphError {
200        type Owned = Self;
201
202        #[inline(always)]
203        fn inline_align(_context: fidl::encoding::Context) -> usize {
204            std::mem::align_of::<u32>()
205        }
206
207        #[inline(always)]
208        fn inline_size(_context: fidl::encoding::Context) -> usize {
209            std::mem::size_of::<u32>()
210        }
211
212        #[inline(always)]
213        fn encode_is_copy() -> bool {
214            true
215        }
216
217        #[inline(always)]
218        fn decode_is_copy() -> bool {
219            false
220        }
221    }
222
223    impl fidl::encoding::ValueTypeMarker for CreateTopologyGraphError {
224        type Borrowed<'a> = Self;
225        #[inline(always)]
226        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
227            *value
228        }
229    }
230
231    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
232        for CreateTopologyGraphError
233    {
234        #[inline]
235        unsafe fn encode(
236            self,
237            encoder: &mut fidl::encoding::Encoder<'_, D>,
238            offset: usize,
239            _depth: fidl::encoding::Depth,
240        ) -> fidl::Result<()> {
241            encoder.debug_check_bounds::<Self>(offset);
242            encoder.write_num(self.into_primitive(), offset);
243            Ok(())
244        }
245    }
246
247    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
248        for CreateTopologyGraphError
249    {
250        #[inline(always)]
251        fn new_empty() -> Self {
252            Self::Internal
253        }
254
255        #[inline]
256        unsafe fn decode(
257            &mut self,
258            decoder: &mut fidl::encoding::Decoder<'_, D>,
259            offset: usize,
260            _depth: fidl::encoding::Depth,
261        ) -> fidl::Result<()> {
262            decoder.debug_check_bounds::<Self>(offset);
263            let prim = decoder.read_num::<u32>(offset);
264
265            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
266            Ok(())
267        }
268    }
269    unsafe impl fidl::encoding::TypeMarker for LeaseControlError {
270        type Owned = Self;
271
272        #[inline(always)]
273        fn inline_align(_context: fidl::encoding::Context) -> usize {
274            std::mem::align_of::<u32>()
275        }
276
277        #[inline(always)]
278        fn inline_size(_context: fidl::encoding::Context) -> usize {
279            std::mem::size_of::<u32>()
280        }
281
282        #[inline(always)]
283        fn encode_is_copy() -> bool {
284            true
285        }
286
287        #[inline(always)]
288        fn decode_is_copy() -> bool {
289            false
290        }
291    }
292
293    impl fidl::encoding::ValueTypeMarker for LeaseControlError {
294        type Borrowed<'a> = Self;
295        #[inline(always)]
296        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
297            *value
298        }
299    }
300
301    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
302        for LeaseControlError
303    {
304        #[inline]
305        unsafe fn encode(
306            self,
307            encoder: &mut fidl::encoding::Encoder<'_, D>,
308            offset: usize,
309            _depth: fidl::encoding::Depth,
310        ) -> fidl::Result<()> {
311            encoder.debug_check_bounds::<Self>(offset);
312            encoder.write_num(self.into_primitive(), offset);
313            Ok(())
314        }
315    }
316
317    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LeaseControlError {
318        #[inline(always)]
319        fn new_empty() -> Self {
320            Self::Internal
321        }
322
323        #[inline]
324        unsafe fn decode(
325            &mut self,
326            decoder: &mut fidl::encoding::Decoder<'_, D>,
327            offset: usize,
328            _depth: fidl::encoding::Depth,
329        ) -> fidl::Result<()> {
330            decoder.debug_check_bounds::<Self>(offset);
331            let prim = decoder.read_num::<u32>(offset);
332
333            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
334            Ok(())
335        }
336    }
337    unsafe impl fidl::encoding::TypeMarker for OpenStatusChannelError {
338        type Owned = Self;
339
340        #[inline(always)]
341        fn inline_align(_context: fidl::encoding::Context) -> usize {
342            std::mem::align_of::<u32>()
343        }
344
345        #[inline(always)]
346        fn inline_size(_context: fidl::encoding::Context) -> usize {
347            std::mem::size_of::<u32>()
348        }
349
350        #[inline(always)]
351        fn encode_is_copy() -> bool {
352            true
353        }
354
355        #[inline(always)]
356        fn decode_is_copy() -> bool {
357            false
358        }
359    }
360
361    impl fidl::encoding::ValueTypeMarker for OpenStatusChannelError {
362        type Borrowed<'a> = Self;
363        #[inline(always)]
364        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
365            *value
366        }
367    }
368
369    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
370        for OpenStatusChannelError
371    {
372        #[inline]
373        unsafe fn encode(
374            self,
375            encoder: &mut fidl::encoding::Encoder<'_, D>,
376            offset: usize,
377            _depth: fidl::encoding::Depth,
378        ) -> fidl::Result<()> {
379            encoder.debug_check_bounds::<Self>(offset);
380            encoder.write_num(self.into_primitive(), offset);
381            Ok(())
382        }
383    }
384
385    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
386        for OpenStatusChannelError
387    {
388        #[inline(always)]
389        fn new_empty() -> Self {
390            Self::Internal
391        }
392
393        #[inline]
394        unsafe fn decode(
395            &mut self,
396            decoder: &mut fidl::encoding::Decoder<'_, D>,
397            offset: usize,
398            _depth: fidl::encoding::Depth,
399        ) -> fidl::Result<()> {
400            decoder.debug_check_bounds::<Self>(offset);
401            let prim = decoder.read_num::<u32>(offset);
402
403            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
404            Ok(())
405        }
406    }
407    unsafe impl fidl::encoding::TypeMarker for SystemActivityControlError {
408        type Owned = Self;
409
410        #[inline(always)]
411        fn inline_align(_context: fidl::encoding::Context) -> usize {
412            std::mem::align_of::<u32>()
413        }
414
415        #[inline(always)]
416        fn inline_size(_context: fidl::encoding::Context) -> usize {
417            std::mem::size_of::<u32>()
418        }
419
420        #[inline(always)]
421        fn encode_is_copy() -> bool {
422            true
423        }
424
425        #[inline(always)]
426        fn decode_is_copy() -> bool {
427            false
428        }
429    }
430
431    impl fidl::encoding::ValueTypeMarker for SystemActivityControlError {
432        type Borrowed<'a> = Self;
433        #[inline(always)]
434        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
435            *value
436        }
437    }
438
439    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
440        for SystemActivityControlError
441    {
442        #[inline]
443        unsafe fn encode(
444            self,
445            encoder: &mut fidl::encoding::Encoder<'_, D>,
446            offset: usize,
447            _depth: fidl::encoding::Depth,
448        ) -> fidl::Result<()> {
449            encoder.debug_check_bounds::<Self>(offset);
450            encoder.write_num(self.into_primitive(), offset);
451            Ok(())
452        }
453    }
454
455    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
456        for SystemActivityControlError
457    {
458        #[inline(always)]
459        fn new_empty() -> Self {
460            Self::Internal
461        }
462
463        #[inline]
464        unsafe fn decode(
465            &mut self,
466            decoder: &mut fidl::encoding::Decoder<'_, D>,
467            offset: usize,
468            _depth: fidl::encoding::Depth,
469        ) -> fidl::Result<()> {
470            decoder.debug_check_bounds::<Self>(offset);
471            let prim = decoder.read_num::<u32>(offset);
472
473            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
474            Ok(())
475        }
476    }
477
478    impl fidl::encoding::ValueTypeMarker for Element {
479        type Borrowed<'a> = &'a Self;
480        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
481            value
482        }
483    }
484
485    unsafe impl fidl::encoding::TypeMarker for Element {
486        type Owned = Self;
487
488        #[inline(always)]
489        fn inline_align(_context: fidl::encoding::Context) -> usize {
490            8
491        }
492
493        #[inline(always)]
494        fn inline_size(_context: fidl::encoding::Context) -> usize {
495            56
496        }
497    }
498
499    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Element, D> for &Element {
500        #[inline]
501        unsafe fn encode(
502            self,
503            encoder: &mut fidl::encoding::Encoder<'_, D>,
504            offset: usize,
505            _depth: fidl::encoding::Depth,
506        ) -> fidl::Result<()> {
507            encoder.debug_check_bounds::<Element>(offset);
508            // Delegate to tuple encoding.
509            fidl::encoding::Encode::<Element, D>::encode(
510                (
511                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(&self.element_name),
512                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_current_level),
513                    <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.valid_levels),
514                    <fidl::encoding::Vector<LevelDependency, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.dependencies),
515                ),
516                encoder, offset, _depth
517            )
518        }
519    }
520    unsafe impl<
521        D: fidl::encoding::ResourceDialect,
522        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
523        T1: fidl::encoding::Encode<u8, D>,
524        T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
525        T3: fidl::encoding::Encode<fidl::encoding::Vector<LevelDependency, 256>, D>,
526    > fidl::encoding::Encode<Element, D> for (T0, T1, T2, T3)
527    {
528        #[inline]
529        unsafe fn encode(
530            self,
531            encoder: &mut fidl::encoding::Encoder<'_, D>,
532            offset: usize,
533            depth: fidl::encoding::Depth,
534        ) -> fidl::Result<()> {
535            encoder.debug_check_bounds::<Element>(offset);
536            // Zero out padding regions. There's no need to apply masks
537            // because the unmasked parts will be overwritten by fields.
538            unsafe {
539                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
540                (ptr as *mut u64).write_unaligned(0);
541            }
542            // Write the fields.
543            self.0.encode(encoder, offset + 0, depth)?;
544            self.1.encode(encoder, offset + 16, depth)?;
545            self.2.encode(encoder, offset + 24, depth)?;
546            self.3.encode(encoder, offset + 40, depth)?;
547            Ok(())
548        }
549    }
550
551    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Element {
552        #[inline(always)]
553        fn new_empty() -> Self {
554            Self {
555                element_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
556                initial_current_level: fidl::new_empty!(u8, D),
557                valid_levels: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D),
558                dependencies: fidl::new_empty!(fidl::encoding::Vector<LevelDependency, 256>, D),
559            }
560        }
561
562        #[inline]
563        unsafe fn decode(
564            &mut self,
565            decoder: &mut fidl::encoding::Decoder<'_, D>,
566            offset: usize,
567            _depth: fidl::encoding::Depth,
568        ) -> fidl::Result<()> {
569            decoder.debug_check_bounds::<Self>(offset);
570            // Verify that padding bytes are zero.
571            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
572            let padval = unsafe { (ptr as *const u64).read_unaligned() };
573            let mask = 0xffffffffffffff00u64;
574            let maskedval = padval & mask;
575            if maskedval != 0 {
576                return Err(fidl::Error::NonZeroPadding {
577                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
578                });
579            }
580            fidl::decode!(
581                fidl::encoding::BoundedString<64>,
582                D,
583                &mut self.element_name,
584                decoder,
585                offset + 0,
586                _depth
587            )?;
588            fidl::decode!(u8, D, &mut self.initial_current_level, decoder, offset + 16, _depth)?;
589            fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.valid_levels, decoder, offset + 24, _depth)?;
590            fidl::decode!(fidl::encoding::Vector<LevelDependency, 256>, D, &mut self.dependencies, decoder, offset + 40, _depth)?;
591            Ok(())
592        }
593    }
594
595    impl fidl::encoding::ValueTypeMarker for LevelDependency {
596        type Borrowed<'a> = &'a Self;
597        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
598            value
599        }
600    }
601
602    unsafe impl fidl::encoding::TypeMarker for LevelDependency {
603        type Owned = Self;
604
605        #[inline(always)]
606        fn inline_align(_context: fidl::encoding::Context) -> usize {
607            8
608        }
609
610        #[inline(always)]
611        fn inline_size(_context: fidl::encoding::Context) -> usize {
612            32
613        }
614    }
615
616    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LevelDependency, D>
617        for &LevelDependency
618    {
619        #[inline]
620        unsafe fn encode(
621            self,
622            encoder: &mut fidl::encoding::Encoder<'_, D>,
623            offset: usize,
624            _depth: fidl::encoding::Depth,
625        ) -> fidl::Result<()> {
626            encoder.debug_check_bounds::<LevelDependency>(offset);
627            // Delegate to tuple encoding.
628            fidl::encoding::Encode::<LevelDependency, D>::encode(
629                (
630                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dependent_level),
631                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
632                        &self.requires_element,
633                    ),
634                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.requires_level),
635                ),
636                encoder,
637                offset,
638                _depth,
639            )
640        }
641    }
642    unsafe impl<
643        D: fidl::encoding::ResourceDialect,
644        T0: fidl::encoding::Encode<u8, D>,
645        T1: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
646        T2: fidl::encoding::Encode<u8, D>,
647    > fidl::encoding::Encode<LevelDependency, D> for (T0, T1, T2)
648    {
649        #[inline]
650        unsafe fn encode(
651            self,
652            encoder: &mut fidl::encoding::Encoder<'_, D>,
653            offset: usize,
654            depth: fidl::encoding::Depth,
655        ) -> fidl::Result<()> {
656            encoder.debug_check_bounds::<LevelDependency>(offset);
657            // Zero out padding regions. There's no need to apply masks
658            // because the unmasked parts will be overwritten by fields.
659            unsafe {
660                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
661                (ptr as *mut u64).write_unaligned(0);
662            }
663            unsafe {
664                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
665                (ptr as *mut u64).write_unaligned(0);
666            }
667            // Write the fields.
668            self.0.encode(encoder, offset + 0, depth)?;
669            self.1.encode(encoder, offset + 8, depth)?;
670            self.2.encode(encoder, offset + 24, depth)?;
671            Ok(())
672        }
673    }
674
675    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LevelDependency {
676        #[inline(always)]
677        fn new_empty() -> Self {
678            Self {
679                dependent_level: fidl::new_empty!(u8, D),
680                requires_element: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
681                requires_level: fidl::new_empty!(u8, D),
682            }
683        }
684
685        #[inline]
686        unsafe fn decode(
687            &mut self,
688            decoder: &mut fidl::encoding::Decoder<'_, D>,
689            offset: usize,
690            _depth: fidl::encoding::Depth,
691        ) -> fidl::Result<()> {
692            decoder.debug_check_bounds::<Self>(offset);
693            // Verify that padding bytes are zero.
694            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
695            let padval = unsafe { (ptr as *const u64).read_unaligned() };
696            let mask = 0xffffffffffffff00u64;
697            let maskedval = padval & mask;
698            if maskedval != 0 {
699                return Err(fidl::Error::NonZeroPadding {
700                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
701                });
702            }
703            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
704            let padval = unsafe { (ptr as *const u64).read_unaligned() };
705            let mask = 0xffffffffffffff00u64;
706            let maskedval = padval & mask;
707            if maskedval != 0 {
708                return Err(fidl::Error::NonZeroPadding {
709                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
710                });
711            }
712            fidl::decode!(u8, D, &mut self.dependent_level, decoder, offset + 0, _depth)?;
713            fidl::decode!(
714                fidl::encoding::BoundedString<64>,
715                D,
716                &mut self.requires_element,
717                decoder,
718                offset + 8,
719                _depth
720            )?;
721            fidl::decode!(u8, D, &mut self.requires_level, decoder, offset + 24, _depth)?;
722            Ok(())
723        }
724    }
725
726    impl fidl::encoding::ValueTypeMarker for SystemActivityControlRestartApplicationActivityRequest {
727        type Borrowed<'a> = &'a Self;
728        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
729            value
730        }
731    }
732
733    unsafe impl fidl::encoding::TypeMarker for SystemActivityControlRestartApplicationActivityRequest {
734        type Owned = Self;
735
736        #[inline(always)]
737        fn inline_align(_context: fidl::encoding::Context) -> usize {
738            8
739        }
740
741        #[inline(always)]
742        fn inline_size(_context: fidl::encoding::Context) -> usize {
743            8
744        }
745        #[inline(always)]
746        fn encode_is_copy() -> bool {
747            true
748        }
749
750        #[inline(always)]
751        fn decode_is_copy() -> bool {
752            true
753        }
754    }
755
756    unsafe impl<D: fidl::encoding::ResourceDialect>
757        fidl::encoding::Encode<SystemActivityControlRestartApplicationActivityRequest, D>
758        for &SystemActivityControlRestartApplicationActivityRequest
759    {
760        #[inline]
761        unsafe fn encode(
762            self,
763            encoder: &mut fidl::encoding::Encoder<'_, D>,
764            offset: usize,
765            _depth: fidl::encoding::Depth,
766        ) -> fidl::Result<()> {
767            encoder.debug_check_bounds::<SystemActivityControlRestartApplicationActivityRequest>(
768                offset,
769            );
770            unsafe {
771                // Copy the object into the buffer.
772                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
773                (buf_ptr as *mut SystemActivityControlRestartApplicationActivityRequest)
774                    .write_unaligned(
775                        (self as *const SystemActivityControlRestartApplicationActivityRequest)
776                            .read(),
777                    );
778                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
779                // done second because the memcpy will write garbage to these bytes.
780            }
781            Ok(())
782        }
783    }
784    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
785        fidl::encoding::Encode<SystemActivityControlRestartApplicationActivityRequest, D> for (T0,)
786    {
787        #[inline]
788        unsafe fn encode(
789            self,
790            encoder: &mut fidl::encoding::Encoder<'_, D>,
791            offset: usize,
792            depth: fidl::encoding::Depth,
793        ) -> fidl::Result<()> {
794            encoder.debug_check_bounds::<SystemActivityControlRestartApplicationActivityRequest>(
795                offset,
796            );
797            // Zero out padding regions. There's no need to apply masks
798            // because the unmasked parts will be overwritten by fields.
799            // Write the fields.
800            self.0.encode(encoder, offset + 0, depth)?;
801            Ok(())
802        }
803    }
804
805    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
806        for SystemActivityControlRestartApplicationActivityRequest
807    {
808        #[inline(always)]
809        fn new_empty() -> Self {
810            Self { wait_time_ns: fidl::new_empty!(u64, D) }
811        }
812
813        #[inline]
814        unsafe fn decode(
815            &mut self,
816            decoder: &mut fidl::encoding::Decoder<'_, D>,
817            offset: usize,
818            _depth: fidl::encoding::Depth,
819        ) -> fidl::Result<()> {
820            decoder.debug_check_bounds::<Self>(offset);
821            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
822            // Verify that padding bytes are zero.
823            // Copy from the buffer into the object.
824            unsafe {
825                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
826            }
827            Ok(())
828        }
829    }
830
831    impl fidl::encoding::ValueTypeMarker for TopologyControlAcquireLeaseRequest {
832        type Borrowed<'a> = &'a Self;
833        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
834            value
835        }
836    }
837
838    unsafe impl fidl::encoding::TypeMarker for TopologyControlAcquireLeaseRequest {
839        type Owned = Self;
840
841        #[inline(always)]
842        fn inline_align(_context: fidl::encoding::Context) -> usize {
843            8
844        }
845
846        #[inline(always)]
847        fn inline_size(_context: fidl::encoding::Context) -> usize {
848            24
849        }
850    }
851
852    unsafe impl<D: fidl::encoding::ResourceDialect>
853        fidl::encoding::Encode<TopologyControlAcquireLeaseRequest, D>
854        for &TopologyControlAcquireLeaseRequest
855    {
856        #[inline]
857        unsafe fn encode(
858            self,
859            encoder: &mut fidl::encoding::Encoder<'_, D>,
860            offset: usize,
861            _depth: fidl::encoding::Depth,
862        ) -> fidl::Result<()> {
863            encoder.debug_check_bounds::<TopologyControlAcquireLeaseRequest>(offset);
864            // Delegate to tuple encoding.
865            fidl::encoding::Encode::<TopologyControlAcquireLeaseRequest, D>::encode(
866                (
867                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
868                        &self.element_name,
869                    ),
870                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.level),
871                ),
872                encoder,
873                offset,
874                _depth,
875            )
876        }
877    }
878    unsafe impl<
879        D: fidl::encoding::ResourceDialect,
880        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
881        T1: fidl::encoding::Encode<u8, D>,
882    > fidl::encoding::Encode<TopologyControlAcquireLeaseRequest, D> for (T0, T1)
883    {
884        #[inline]
885        unsafe fn encode(
886            self,
887            encoder: &mut fidl::encoding::Encoder<'_, D>,
888            offset: usize,
889            depth: fidl::encoding::Depth,
890        ) -> fidl::Result<()> {
891            encoder.debug_check_bounds::<TopologyControlAcquireLeaseRequest>(offset);
892            // Zero out padding regions. There's no need to apply masks
893            // because the unmasked parts will be overwritten by fields.
894            unsafe {
895                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
896                (ptr as *mut u64).write_unaligned(0);
897            }
898            // Write the fields.
899            self.0.encode(encoder, offset + 0, depth)?;
900            self.1.encode(encoder, offset + 16, depth)?;
901            Ok(())
902        }
903    }
904
905    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
906        for TopologyControlAcquireLeaseRequest
907    {
908        #[inline(always)]
909        fn new_empty() -> Self {
910            Self {
911                element_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
912                level: fidl::new_empty!(u8, D),
913            }
914        }
915
916        #[inline]
917        unsafe fn decode(
918            &mut self,
919            decoder: &mut fidl::encoding::Decoder<'_, D>,
920            offset: usize,
921            _depth: fidl::encoding::Depth,
922        ) -> fidl::Result<()> {
923            decoder.debug_check_bounds::<Self>(offset);
924            // Verify that padding bytes are zero.
925            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
926            let padval = unsafe { (ptr as *const u64).read_unaligned() };
927            let mask = 0xffffffffffffff00u64;
928            let maskedval = padval & mask;
929            if maskedval != 0 {
930                return Err(fidl::Error::NonZeroPadding {
931                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
932                });
933            }
934            fidl::decode!(
935                fidl::encoding::BoundedString<64>,
936                D,
937                &mut self.element_name,
938                decoder,
939                offset + 0,
940                _depth
941            )?;
942            fidl::decode!(u8, D, &mut self.level, decoder, offset + 16, _depth)?;
943            Ok(())
944        }
945    }
946
947    impl fidl::encoding::ValueTypeMarker for TopologyControlCreateRequest {
948        type Borrowed<'a> = &'a Self;
949        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
950            value
951        }
952    }
953
954    unsafe impl fidl::encoding::TypeMarker for TopologyControlCreateRequest {
955        type Owned = Self;
956
957        #[inline(always)]
958        fn inline_align(_context: fidl::encoding::Context) -> usize {
959            8
960        }
961
962        #[inline(always)]
963        fn inline_size(_context: fidl::encoding::Context) -> usize {
964            16
965        }
966    }
967
968    unsafe impl<D: fidl::encoding::ResourceDialect>
969        fidl::encoding::Encode<TopologyControlCreateRequest, D> for &TopologyControlCreateRequest
970    {
971        #[inline]
972        unsafe fn encode(
973            self,
974            encoder: &mut fidl::encoding::Encoder<'_, D>,
975            offset: usize,
976            _depth: fidl::encoding::Depth,
977        ) -> fidl::Result<()> {
978            encoder.debug_check_bounds::<TopologyControlCreateRequest>(offset);
979            // Delegate to tuple encoding.
980            fidl::encoding::Encode::<TopologyControlCreateRequest, D>::encode(
981                (
982                    <fidl::encoding::Vector<Element, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.elements),
983                ),
984                encoder, offset, _depth
985            )
986        }
987    }
988    unsafe impl<
989        D: fidl::encoding::ResourceDialect,
990        T0: fidl::encoding::Encode<fidl::encoding::Vector<Element, 256>, D>,
991    > fidl::encoding::Encode<TopologyControlCreateRequest, D> for (T0,)
992    {
993        #[inline]
994        unsafe fn encode(
995            self,
996            encoder: &mut fidl::encoding::Encoder<'_, D>,
997            offset: usize,
998            depth: fidl::encoding::Depth,
999        ) -> fidl::Result<()> {
1000            encoder.debug_check_bounds::<TopologyControlCreateRequest>(offset);
1001            // Zero out padding regions. There's no need to apply masks
1002            // because the unmasked parts will be overwritten by fields.
1003            // Write the fields.
1004            self.0.encode(encoder, offset + 0, depth)?;
1005            Ok(())
1006        }
1007    }
1008
1009    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1010        for TopologyControlCreateRequest
1011    {
1012        #[inline(always)]
1013        fn new_empty() -> Self {
1014            Self { elements: fidl::new_empty!(fidl::encoding::Vector<Element, 256>, D) }
1015        }
1016
1017        #[inline]
1018        unsafe fn decode(
1019            &mut self,
1020            decoder: &mut fidl::encoding::Decoder<'_, D>,
1021            offset: usize,
1022            _depth: fidl::encoding::Depth,
1023        ) -> fidl::Result<()> {
1024            decoder.debug_check_bounds::<Self>(offset);
1025            // Verify that padding bytes are zero.
1026            fidl::decode!(fidl::encoding::Vector<Element, 256>, D, &mut self.elements, decoder, offset + 0, _depth)?;
1027            Ok(())
1028        }
1029    }
1030
1031    impl fidl::encoding::ValueTypeMarker for TopologyControlDropLeaseRequest {
1032        type Borrowed<'a> = &'a Self;
1033        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1034            value
1035        }
1036    }
1037
1038    unsafe impl fidl::encoding::TypeMarker for TopologyControlDropLeaseRequest {
1039        type Owned = Self;
1040
1041        #[inline(always)]
1042        fn inline_align(_context: fidl::encoding::Context) -> usize {
1043            8
1044        }
1045
1046        #[inline(always)]
1047        fn inline_size(_context: fidl::encoding::Context) -> usize {
1048            16
1049        }
1050    }
1051
1052    unsafe impl<D: fidl::encoding::ResourceDialect>
1053        fidl::encoding::Encode<TopologyControlDropLeaseRequest, D>
1054        for &TopologyControlDropLeaseRequest
1055    {
1056        #[inline]
1057        unsafe fn encode(
1058            self,
1059            encoder: &mut fidl::encoding::Encoder<'_, D>,
1060            offset: usize,
1061            _depth: fidl::encoding::Depth,
1062        ) -> fidl::Result<()> {
1063            encoder.debug_check_bounds::<TopologyControlDropLeaseRequest>(offset);
1064            // Delegate to tuple encoding.
1065            fidl::encoding::Encode::<TopologyControlDropLeaseRequest, D>::encode(
1066                (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
1067                    &self.element_name,
1068                ),),
1069                encoder,
1070                offset,
1071                _depth,
1072            )
1073        }
1074    }
1075    unsafe impl<
1076        D: fidl::encoding::ResourceDialect,
1077        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
1078    > fidl::encoding::Encode<TopologyControlDropLeaseRequest, D> for (T0,)
1079    {
1080        #[inline]
1081        unsafe fn encode(
1082            self,
1083            encoder: &mut fidl::encoding::Encoder<'_, D>,
1084            offset: usize,
1085            depth: fidl::encoding::Depth,
1086        ) -> fidl::Result<()> {
1087            encoder.debug_check_bounds::<TopologyControlDropLeaseRequest>(offset);
1088            // Zero out padding regions. There's no need to apply masks
1089            // because the unmasked parts will be overwritten by fields.
1090            // Write the fields.
1091            self.0.encode(encoder, offset + 0, depth)?;
1092            Ok(())
1093        }
1094    }
1095
1096    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1097        for TopologyControlDropLeaseRequest
1098    {
1099        #[inline(always)]
1100        fn new_empty() -> Self {
1101            Self { element_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
1102        }
1103
1104        #[inline]
1105        unsafe fn decode(
1106            &mut self,
1107            decoder: &mut fidl::encoding::Decoder<'_, D>,
1108            offset: usize,
1109            _depth: fidl::encoding::Depth,
1110        ) -> fidl::Result<()> {
1111            decoder.debug_check_bounds::<Self>(offset);
1112            // Verify that padding bytes are zero.
1113            fidl::decode!(
1114                fidl::encoding::BoundedString<64>,
1115                D,
1116                &mut self.element_name,
1117                decoder,
1118                offset + 0,
1119                _depth
1120            )?;
1121            Ok(())
1122        }
1123    }
1124}