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