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 fuchsia_diagnostics_sample_min_period_seconds: i64,
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            128
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                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.fuchsia_diagnostics_sample_min_period_seconds),
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<fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>, D>,
83        T1: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 10>, D>,
84        T2: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 512>, D>,
85        T3: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>, D>,
86        T4: fidl::encoding::Encode<bool, D>,
87        T5: fidl::encoding::Encode<i64, D>,
88        T6: fidl::encoding::Encode<u64, D>,
89        T7: fidl::encoding::Encode<u64, D>,
90        T8: fidl::encoding::Encode<u8, D>,
91        T9: fidl::encoding::Encode<i64, D>,
92        T10: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
93    > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
94    {
95        #[inline]
96        unsafe fn encode(
97            self,
98            encoder: &mut fidl::encoding::Encoder<'_, D>,
99            offset: usize,
100            depth: fidl::encoding::Depth,
101        ) -> fidl::Result<()> {
102            encoder.debug_check_bounds::<Config>(offset);
103            // Zero out padding regions. There's no need to apply masks
104            // because the unmasked parts will be overwritten by fields.
105            unsafe {
106                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
107                (ptr as *mut u64).write_unaligned(0);
108            }
109            unsafe {
110                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(96);
111                (ptr as *mut u64).write_unaligned(0);
112            }
113            // Write the fields.
114            self.0.encode(encoder, offset + 0, depth)?;
115            self.1.encode(encoder, offset + 16, depth)?;
116            self.2.encode(encoder, offset + 32, depth)?;
117            self.3.encode(encoder, offset + 48, depth)?;
118            self.4.encode(encoder, offset + 64, depth)?;
119            self.5.encode(encoder, offset + 72, depth)?;
120            self.6.encode(encoder, offset + 80, depth)?;
121            self.7.encode(encoder, offset + 88, depth)?;
122            self.8.encode(encoder, offset + 96, depth)?;
123            self.9.encode(encoder, offset + 104, depth)?;
124            self.10.encode(encoder, offset + 112, depth)?;
125            Ok(())
126        }
127    }
128
129    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
130        #[inline(always)]
131        fn new_empty() -> Self {
132            Self {
133                allow_serial_logs: fidl::new_empty!(
134                    fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
135                    D
136                ),
137                bind_services: fidl::new_empty!(
138                    fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 10>,
139                    D
140                ),
141                component_initial_interests: fidl::new_empty!(
142                    fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 512>,
143                    D
144                ),
145                deny_serial_log_tags: fidl::new_empty!(
146                    fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
147                    D
148                ),
149                enable_klog: fidl::new_empty!(bool, D),
150                fuchsia_diagnostics_sample_min_period_seconds: fidl::new_empty!(i64, D),
151                logs_max_cached_original_bytes: fidl::new_empty!(u64, D),
152                maximum_concurrent_snapshots_per_reader: fidl::new_empty!(u64, D),
153                num_threads: fidl::new_empty!(u8, D),
154                per_component_batch_timeout_seconds: fidl::new_empty!(i64, D),
155                pipelines_path: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
156            }
157        }
158
159        #[inline]
160        unsafe fn decode(
161            &mut self,
162            decoder: &mut fidl::encoding::Decoder<'_, D>,
163            offset: usize,
164            _depth: fidl::encoding::Depth,
165        ) -> fidl::Result<()> {
166            decoder.debug_check_bounds::<Self>(offset);
167            // Verify that padding bytes are zero.
168            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
169            let padval = unsafe { (ptr as *const u64).read_unaligned() };
170            let mask = 0xffffffffffffff00u64;
171            let maskedval = padval & mask;
172            if maskedval != 0 {
173                return Err(fidl::Error::NonZeroPadding {
174                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
175                });
176            }
177            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(96) };
178            let padval = unsafe { (ptr as *const u64).read_unaligned() };
179            let mask = 0xffffffffffffff00u64;
180            let maskedval = padval & mask;
181            if maskedval != 0 {
182                return Err(fidl::Error::NonZeroPadding {
183                    padding_start: offset + 96 + ((mask as u64).trailing_zeros() / 8) as usize,
184                });
185            }
186            fidl::decode!(
187                fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
188                D,
189                &mut self.allow_serial_logs,
190                decoder,
191                offset + 0,
192                _depth
193            )?;
194            fidl::decode!(
195                fidl::encoding::Vector<fidl::encoding::BoundedString<256>, 10>,
196                D,
197                &mut self.bind_services,
198                decoder,
199                offset + 16,
200                _depth
201            )?;
202            fidl::decode!(
203                fidl::encoding::Vector<fidl::encoding::BoundedString<4096>, 512>,
204                D,
205                &mut self.component_initial_interests,
206                decoder,
207                offset + 32,
208                _depth
209            )?;
210            fidl::decode!(
211                fidl::encoding::Vector<fidl::encoding::BoundedString<50>, 512>,
212                D,
213                &mut self.deny_serial_log_tags,
214                decoder,
215                offset + 48,
216                _depth
217            )?;
218            fidl::decode!(bool, D, &mut self.enable_klog, decoder, offset + 64, _depth)?;
219            fidl::decode!(
220                i64,
221                D,
222                &mut self.fuchsia_diagnostics_sample_min_period_seconds,
223                decoder,
224                offset + 72,
225                _depth
226            )?;
227            fidl::decode!(
228                u64,
229                D,
230                &mut self.logs_max_cached_original_bytes,
231                decoder,
232                offset + 80,
233                _depth
234            )?;
235            fidl::decode!(
236                u64,
237                D,
238                &mut self.maximum_concurrent_snapshots_per_reader,
239                decoder,
240                offset + 88,
241                _depth
242            )?;
243            fidl::decode!(u8, D, &mut self.num_threads, decoder, offset + 96, _depth)?;
244            fidl::decode!(
245                i64,
246                D,
247                &mut self.per_component_batch_timeout_seconds,
248                decoder,
249                offset + 104,
250                _depth
251            )?;
252            fidl::decode!(
253                fidl::encoding::BoundedString<256>,
254                D,
255                &mut self.pipelines_path,
256                decoder,
257                offset + 112,
258                _depth
259            )?;
260            Ok(())
261        }
262    }
263}