fidl_cf_sc_internal_systemupdaterconfig_common/
fidl_cf_sc_internal_systemupdaterconfig_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, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13 pub concurrent_blob_fetches: u16,
14 pub concurrent_package_resolves: u16,
15 pub excessive_update_duration_seconds: u32,
16 pub manifest_public_keys: Vec<String>,
17 pub verify_existing_blobs: bool,
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 8
38 }
39
40 #[inline(always)]
41 fn inline_size(_context: fidl::encoding::Context) -> usize {
42 32
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 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.concurrent_blob_fetches),
59 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.concurrent_package_resolves),
60 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.excessive_update_duration_seconds),
61 <fidl::encoding::Vector<fidl::encoding::BoundedString<64>, 10> as fidl::encoding::ValueTypeMarker>::borrow(&self.manifest_public_keys),
62 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.verify_existing_blobs),
63 ),
64 encoder, offset, _depth
65 )
66 }
67 }
68 unsafe impl<
69 D: fidl::encoding::ResourceDialect,
70 T0: fidl::encoding::Encode<u16, D>,
71 T1: fidl::encoding::Encode<u16, D>,
72 T2: fidl::encoding::Encode<u32, D>,
73 T3: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<64>, 10>, D>,
74 T4: fidl::encoding::Encode<bool, D>,
75 > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3, T4)
76 {
77 #[inline]
78 unsafe fn encode(
79 self,
80 encoder: &mut fidl::encoding::Encoder<'_, D>,
81 offset: usize,
82 depth: fidl::encoding::Depth,
83 ) -> fidl::Result<()> {
84 encoder.debug_check_bounds::<Config>(offset);
85 unsafe {
88 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
89 (ptr as *mut u64).write_unaligned(0);
90 }
91 self.0.encode(encoder, offset + 0, depth)?;
93 self.1.encode(encoder, offset + 2, depth)?;
94 self.2.encode(encoder, offset + 4, depth)?;
95 self.3.encode(encoder, offset + 8, depth)?;
96 self.4.encode(encoder, offset + 24, 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 concurrent_blob_fetches: fidl::new_empty!(u16, D),
106 concurrent_package_resolves: fidl::new_empty!(u16, D),
107 excessive_update_duration_seconds: fidl::new_empty!(u32, D),
108 manifest_public_keys: fidl::new_empty!(
109 fidl::encoding::Vector<fidl::encoding::BoundedString<64>, 10>,
110 D
111 ),
112 verify_existing_blobs: fidl::new_empty!(bool, D),
113 }
114 }
115
116 #[inline]
117 unsafe fn decode(
118 &mut self,
119 decoder: &mut fidl::encoding::Decoder<'_, D>,
120 offset: usize,
121 _depth: fidl::encoding::Depth,
122 ) -> fidl::Result<()> {
123 decoder.debug_check_bounds::<Self>(offset);
124 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
126 let padval = unsafe { (ptr as *const u64).read_unaligned() };
127 let mask = 0xffffffffffffff00u64;
128 let maskedval = padval & mask;
129 if maskedval != 0 {
130 return Err(fidl::Error::NonZeroPadding {
131 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
132 });
133 }
134 fidl::decode!(u16, D, &mut self.concurrent_blob_fetches, decoder, offset + 0, _depth)?;
135 fidl::decode!(
136 u16,
137 D,
138 &mut self.concurrent_package_resolves,
139 decoder,
140 offset + 2,
141 _depth
142 )?;
143 fidl::decode!(
144 u32,
145 D,
146 &mut self.excessive_update_duration_seconds,
147 decoder,
148 offset + 4,
149 _depth
150 )?;
151 fidl::decode!(
152 fidl::encoding::Vector<fidl::encoding::BoundedString<64>, 10>,
153 D,
154 &mut self.manifest_public_keys,
155 decoder,
156 offset + 8,
157 _depth
158 )?;
159 fidl::decode!(bool, D, &mut self.verify_existing_blobs, decoder, offset + 24, _depth)?;
160 Ok(())
161 }
162 }
163}