fidl_cf_sc_internal_omahaclientstructuredconfig_common/
fidl_cf_sc_internal_omahaclientstructuredconfig_common.rs1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13 pub allow_reboot_when_idle: bool,
14 pub fuzz_percentage_range: u8,
15 pub periodic_interval_minutes: u16,
16 pub retry_delay_seconds: u16,
17 pub startup_delay_seconds: u16,
18}
19
20impl fidl::Persistable for Config {}
21
22mod internal {
23 use super::*;
24
25 impl fidl::encoding::ValueTypeMarker for Config {
26 type Borrowed<'a> = &'a Self;
27 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
28 value
29 }
30 }
31
32 unsafe impl fidl::encoding::TypeMarker for Config {
33 type Owned = Self;
34
35 #[inline(always)]
36 fn inline_align(_context: fidl::encoding::Context) -> usize {
37 2
38 }
39
40 #[inline(always)]
41 fn inline_size(_context: fidl::encoding::Context) -> usize {
42 8
43 }
44 }
45
46 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
47 #[inline]
48 unsafe fn encode(
49 self,
50 encoder: &mut fidl::encoding::Encoder<'_, D>,
51 offset: usize,
52 _depth: fidl::encoding::Depth,
53 ) -> fidl::Result<()> {
54 encoder.debug_check_bounds::<Config>(offset);
55 fidl::encoding::Encode::<Config, D>::encode(
57 (
58 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.allow_reboot_when_idle),
59 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.fuzz_percentage_range),
60 <u16 as fidl::encoding::ValueTypeMarker>::borrow(
61 &self.periodic_interval_minutes,
62 ),
63 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.retry_delay_seconds),
64 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.startup_delay_seconds),
65 ),
66 encoder,
67 offset,
68 _depth,
69 )
70 }
71 }
72 unsafe impl<
73 D: fidl::encoding::ResourceDialect,
74 T0: fidl::encoding::Encode<bool, D>,
75 T1: fidl::encoding::Encode<u8, D>,
76 T2: fidl::encoding::Encode<u16, D>,
77 T3: fidl::encoding::Encode<u16, D>,
78 T4: fidl::encoding::Encode<u16, D>,
79 > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3, T4)
80 {
81 #[inline]
82 unsafe fn encode(
83 self,
84 encoder: &mut fidl::encoding::Encoder<'_, D>,
85 offset: usize,
86 depth: fidl::encoding::Depth,
87 ) -> fidl::Result<()> {
88 encoder.debug_check_bounds::<Config>(offset);
89 self.0.encode(encoder, offset + 0, depth)?;
93 self.1.encode(encoder, offset + 1, depth)?;
94 self.2.encode(encoder, offset + 2, depth)?;
95 self.3.encode(encoder, offset + 4, depth)?;
96 self.4.encode(encoder, offset + 6, depth)?;
97 Ok(())
98 }
99 }
100
101 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
102 #[inline(always)]
103 fn new_empty() -> Self {
104 Self {
105 allow_reboot_when_idle: fidl::new_empty!(bool, D),
106 fuzz_percentage_range: fidl::new_empty!(u8, D),
107 periodic_interval_minutes: fidl::new_empty!(u16, D),
108 retry_delay_seconds: fidl::new_empty!(u16, D),
109 startup_delay_seconds: fidl::new_empty!(u16, D),
110 }
111 }
112
113 #[inline]
114 unsafe fn decode(
115 &mut self,
116 decoder: &mut fidl::encoding::Decoder<'_, D>,
117 offset: usize,
118 _depth: fidl::encoding::Depth,
119 ) -> fidl::Result<()> {
120 decoder.debug_check_bounds::<Self>(offset);
121 fidl::decode!(bool, D, &mut self.allow_reboot_when_idle, decoder, offset + 0, _depth)?;
123 fidl::decode!(u8, D, &mut self.fuzz_percentage_range, decoder, offset + 1, _depth)?;
124 fidl::decode!(
125 u16,
126 D,
127 &mut self.periodic_interval_minutes,
128 decoder,
129 offset + 2,
130 _depth
131 )?;
132 fidl::decode!(u16, D, &mut self.retry_delay_seconds, decoder, offset + 4, _depth)?;
133 fidl::decode!(u16, D, &mut self.startup_delay_seconds, decoder, offset + 6, _depth)?;
134 Ok(())
135 }
136 }
137}