fidl_cf_sc_internal_archivistconfig_common/
fidl_cf_sc_internal_archivistconfig_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
11#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13    pub allow_serial_logs: Vec<String>,
14    pub bind_services: Vec<String>,
15    pub component_initial_interests: Vec<String>,
16    pub deny_serial_log_tags: Vec<String>,
17    pub enable_klog: bool,
18    pub log_to_debuglog: bool,
19    pub logs_max_cached_original_bytes: u64,
20    pub maximum_concurrent_snapshots_per_reader: u64,
21    pub num_threads: u8,
22    pub per_component_batch_timeout_seconds: i64,
23    pub pipelines_path: String,
24}
25
26impl fidl::Persistable for Config {}
27
28mod internal {
29    use super::*;
30
31    impl fidl::encoding::ValueTypeMarker for Config {
32        type Borrowed<'a> = &'a Self;
33        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
34            value
35        }
36    }
37
38    unsafe impl fidl::encoding::TypeMarker for Config {
39        type Owned = Self;
40
41        #[inline(always)]
42        fn inline_align(_context: fidl::encoding::Context) -> usize {
43            8
44        }
45
46        #[inline(always)]
47        fn inline_size(_context: fidl::encoding::Context) -> usize {
48            120
49        }
50    }
51
52    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
53        #[inline]
54        unsafe fn encode(
55            self,
56            encoder: &mut fidl::encoding::Encoder<'_, D>,
57            offset: usize,
58            _depth: fidl::encoding::Depth,
59        ) -> fidl::Result<()> {
60            encoder.debug_check_bounds::<Config>(offset);
61            // Delegate to tuple encoding.
62            fidl::encoding::Encode::<Config, D>::encode(
63                (
64                    <fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.allow_serial_logs),
65                    <fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 10> as fidl::encoding::ValueTypeMarker>::borrow(&self.bind_services),
66                    <fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.component_initial_interests),
67                    <fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.deny_serial_log_tags),
68                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_klog),
69                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.log_to_debuglog),
70                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.logs_max_cached_original_bytes),
71                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.maximum_concurrent_snapshots_per_reader),
72                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_threads),
73                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.per_component_batch_timeout_seconds),
74                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(&self.pipelines_path),
75                ),
76                encoder, offset, _depth
77            )
78        }
79    }
80    unsafe impl<
81            D: fidl::encoding::ResourceDialect,
82            T0: fidl::encoding::Encode<
83                fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
84                D,
85            >,
86            T1: fidl::encoding::Encode<
87                fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 10>,
88                D,
89            >,
90            T2: fidl::encoding::Encode<
91                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 512>,
92                D,
93            >,
94            T3: fidl::encoding::Encode<
95                fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
96                D,
97            >,
98            T4: fidl::encoding::Encode<bool, D>,
99            T5: fidl::encoding::Encode<bool, D>,
100            T6: fidl::encoding::Encode<u64, D>,
101            T7: fidl::encoding::Encode<u64, D>,
102            T8: fidl::encoding::Encode<u8, D>,
103            T9: fidl::encoding::Encode<i64, D>,
104            T10: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
105        > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
106    {
107        #[inline]
108        unsafe fn encode(
109            self,
110            encoder: &mut fidl::encoding::Encoder<'_, D>,
111            offset: usize,
112            depth: fidl::encoding::Depth,
113        ) -> fidl::Result<()> {
114            encoder.debug_check_bounds::<Config>(offset);
115            // Zero out padding regions. There's no need to apply masks
116            // because the unmasked parts will be overwritten by fields.
117            unsafe {
118                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
119                (ptr as *mut u64).write_unaligned(0);
120            }
121            unsafe {
122                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(88);
123                (ptr as *mut u64).write_unaligned(0);
124            }
125            // Write the fields.
126            self.0.encode(encoder, offset + 0, depth)?;
127            self.1.encode(encoder, offset + 16, depth)?;
128            self.2.encode(encoder, offset + 32, depth)?;
129            self.3.encode(encoder, offset + 48, depth)?;
130            self.4.encode(encoder, offset + 64, depth)?;
131            self.5.encode(encoder, offset + 65, depth)?;
132            self.6.encode(encoder, offset + 72, depth)?;
133            self.7.encode(encoder, offset + 80, depth)?;
134            self.8.encode(encoder, offset + 88, depth)?;
135            self.9.encode(encoder, offset + 96, depth)?;
136            self.10.encode(encoder, offset + 104, depth)?;
137            Ok(())
138        }
139    }
140
141    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
142        #[inline(always)]
143        fn new_empty() -> Self {
144            Self {
145                allow_serial_logs: fidl::new_empty!(
146                    fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
147                    D
148                ),
149                bind_services: fidl::new_empty!(
150                    fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 10>,
151                    D
152                ),
153                component_initial_interests: fidl::new_empty!(
154                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 512>,
155                    D
156                ),
157                deny_serial_log_tags: fidl::new_empty!(
158                    fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
159                    D
160                ),
161                enable_klog: fidl::new_empty!(bool, D),
162                log_to_debuglog: fidl::new_empty!(bool, D),
163                logs_max_cached_original_bytes: fidl::new_empty!(u64, D),
164                maximum_concurrent_snapshots_per_reader: fidl::new_empty!(u64, D),
165                num_threads: fidl::new_empty!(u8, D),
166                per_component_batch_timeout_seconds: fidl::new_empty!(i64, D),
167                pipelines_path: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
168            }
169        }
170
171        #[inline]
172        unsafe fn decode(
173            &mut self,
174            decoder: &mut fidl::encoding::Decoder<'_, D>,
175            offset: usize,
176            _depth: fidl::encoding::Depth,
177        ) -> fidl::Result<()> {
178            decoder.debug_check_bounds::<Self>(offset);
179            // Verify that padding bytes are zero.
180            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
181            let padval = unsafe { (ptr as *const u64).read_unaligned() };
182            let mask = 0xffffffffffff0000u64;
183            let maskedval = padval & mask;
184            if maskedval != 0 {
185                return Err(fidl::Error::NonZeroPadding {
186                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
187                });
188            }
189            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(88) };
190            let padval = unsafe { (ptr as *const u64).read_unaligned() };
191            let mask = 0xffffffffffffff00u64;
192            let maskedval = padval & mask;
193            if maskedval != 0 {
194                return Err(fidl::Error::NonZeroPadding {
195                    padding_start: offset + 88 + ((mask as u64).trailing_zeros() / 8) as usize,
196                });
197            }
198            fidl::decode!(
199                fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
200                D,
201                &mut self.allow_serial_logs,
202                decoder,
203                offset + 0,
204                _depth
205            )?;
206            fidl::decode!(
207                fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 10>,
208                D,
209                &mut self.bind_services,
210                decoder,
211                offset + 16,
212                _depth
213            )?;
214            fidl::decode!(
215                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 512>,
216                D,
217                &mut self.component_initial_interests,
218                decoder,
219                offset + 32,
220                _depth
221            )?;
222            fidl::decode!(
223                fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
224                D,
225                &mut self.deny_serial_log_tags,
226                decoder,
227                offset + 48,
228                _depth
229            )?;
230            fidl::decode!(bool, D, &mut self.enable_klog, decoder, offset + 64, _depth)?;
231            fidl::decode!(bool, D, &mut self.log_to_debuglog, decoder, offset + 65, _depth)?;
232            fidl::decode!(
233                u64,
234                D,
235                &mut self.logs_max_cached_original_bytes,
236                decoder,
237                offset + 72,
238                _depth
239            )?;
240            fidl::decode!(
241                u64,
242                D,
243                &mut self.maximum_concurrent_snapshots_per_reader,
244                decoder,
245                offset + 80,
246                _depth
247            )?;
248            fidl::decode!(u8, D, &mut self.num_threads, decoder, offset + 88, _depth)?;
249            fidl::decode!(
250                i64,
251                D,
252                &mut self.per_component_batch_timeout_seconds,
253                decoder,
254                offset + 96,
255                _depth
256            )?;
257            fidl::decode!(
258                fidl::encoding::BoundedString<256>,
259                D,
260                &mut self.pipelines_path,
261                decoder,
262                offset + 104,
263                _depth
264            )?;
265            Ok(())
266        }
267    }
268}