fidl_fuchsia_tracing_provider_common/
fidl_fuchsia_tracing_provider_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, PartialEq)]
12pub struct ProviderGetKnownCategoriesResponse {
13    pub categories: Vec<fidl_fuchsia_tracing::KnownCategory>,
14}
15
16impl fidl::Persistable for ProviderGetKnownCategoriesResponse {}
17
18#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
19pub struct ProviderStartRequest {
20    pub options: StartOptions,
21}
22
23impl fidl::Persistable for ProviderStartRequest {}
24
25#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct RegistryRegisterProviderSynchronouslyResponse {
27    pub s: i32,
28    pub started: bool,
29}
30
31impl fidl::Persistable for RegistryRegisterProviderSynchronouslyResponse {}
32
33/// Additional options to control tracing at start.
34#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct StartOptions {
36    pub buffer_disposition: fidl_fuchsia_tracing::BufferDisposition,
37    pub additional_categories: Vec<String>,
38}
39
40impl fidl::Persistable for StartOptions {}
41
42mod internal {
43    use super::*;
44
45    impl fidl::encoding::ValueTypeMarker for ProviderGetKnownCategoriesResponse {
46        type Borrowed<'a> = &'a Self;
47        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
48            value
49        }
50    }
51
52    unsafe impl fidl::encoding::TypeMarker for ProviderGetKnownCategoriesResponse {
53        type Owned = Self;
54
55        #[inline(always)]
56        fn inline_align(_context: fidl::encoding::Context) -> usize {
57            8
58        }
59
60        #[inline(always)]
61        fn inline_size(_context: fidl::encoding::Context) -> usize {
62            16
63        }
64    }
65
66    unsafe impl<D: fidl::encoding::ResourceDialect>
67        fidl::encoding::Encode<ProviderGetKnownCategoriesResponse, D>
68        for &ProviderGetKnownCategoriesResponse
69    {
70        #[inline]
71        unsafe fn encode(
72            self,
73            encoder: &mut fidl::encoding::Encoder<'_, D>,
74            offset: usize,
75            _depth: fidl::encoding::Depth,
76        ) -> fidl::Result<()> {
77            encoder.debug_check_bounds::<ProviderGetKnownCategoriesResponse>(offset);
78            // Delegate to tuple encoding.
79            fidl::encoding::Encode::<ProviderGetKnownCategoriesResponse, D>::encode(
80                (
81                    <fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000> as fidl::encoding::ValueTypeMarker>::borrow(&self.categories),
82                ),
83                encoder, offset, _depth
84            )
85        }
86    }
87    unsafe impl<
88            D: fidl::encoding::ResourceDialect,
89            T0: fidl::encoding::Encode<
90                fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>,
91                D,
92            >,
93        > fidl::encoding::Encode<ProviderGetKnownCategoriesResponse, D> for (T0,)
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::<ProviderGetKnownCategoriesResponse>(offset);
103            // Zero out padding regions. There's no need to apply masks
104            // because the unmasked parts will be overwritten by fields.
105            // Write the fields.
106            self.0.encode(encoder, offset + 0, depth)?;
107            Ok(())
108        }
109    }
110
111    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
112        for ProviderGetKnownCategoriesResponse
113    {
114        #[inline(always)]
115        fn new_empty() -> Self {
116            Self {
117                categories: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>, D),
118            }
119        }
120
121        #[inline]
122        unsafe fn decode(
123            &mut self,
124            decoder: &mut fidl::encoding::Decoder<'_, D>,
125            offset: usize,
126            _depth: fidl::encoding::Depth,
127        ) -> fidl::Result<()> {
128            decoder.debug_check_bounds::<Self>(offset);
129            // Verify that padding bytes are zero.
130            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_tracing::KnownCategory, 5000>, D, &mut self.categories, decoder, offset + 0, _depth)?;
131            Ok(())
132        }
133    }
134
135    impl fidl::encoding::ValueTypeMarker for ProviderStartRequest {
136        type Borrowed<'a> = &'a Self;
137        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
138            value
139        }
140    }
141
142    unsafe impl fidl::encoding::TypeMarker for ProviderStartRequest {
143        type Owned = Self;
144
145        #[inline(always)]
146        fn inline_align(_context: fidl::encoding::Context) -> usize {
147            8
148        }
149
150        #[inline(always)]
151        fn inline_size(_context: fidl::encoding::Context) -> usize {
152            24
153        }
154    }
155
156    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderStartRequest, D>
157        for &ProviderStartRequest
158    {
159        #[inline]
160        unsafe fn encode(
161            self,
162            encoder: &mut fidl::encoding::Encoder<'_, D>,
163            offset: usize,
164            _depth: fidl::encoding::Depth,
165        ) -> fidl::Result<()> {
166            encoder.debug_check_bounds::<ProviderStartRequest>(offset);
167            // Delegate to tuple encoding.
168            fidl::encoding::Encode::<ProviderStartRequest, D>::encode(
169                (<StartOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),),
170                encoder,
171                offset,
172                _depth,
173            )
174        }
175    }
176    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StartOptions, D>>
177        fidl::encoding::Encode<ProviderStartRequest, D> for (T0,)
178    {
179        #[inline]
180        unsafe fn encode(
181            self,
182            encoder: &mut fidl::encoding::Encoder<'_, D>,
183            offset: usize,
184            depth: fidl::encoding::Depth,
185        ) -> fidl::Result<()> {
186            encoder.debug_check_bounds::<ProviderStartRequest>(offset);
187            // Zero out padding regions. There's no need to apply masks
188            // because the unmasked parts will be overwritten by fields.
189            // Write the fields.
190            self.0.encode(encoder, offset + 0, depth)?;
191            Ok(())
192        }
193    }
194
195    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderStartRequest {
196        #[inline(always)]
197        fn new_empty() -> Self {
198            Self { options: fidl::new_empty!(StartOptions, D) }
199        }
200
201        #[inline]
202        unsafe fn decode(
203            &mut self,
204            decoder: &mut fidl::encoding::Decoder<'_, D>,
205            offset: usize,
206            _depth: fidl::encoding::Depth,
207        ) -> fidl::Result<()> {
208            decoder.debug_check_bounds::<Self>(offset);
209            // Verify that padding bytes are zero.
210            fidl::decode!(StartOptions, D, &mut self.options, decoder, offset + 0, _depth)?;
211            Ok(())
212        }
213    }
214
215    impl fidl::encoding::ValueTypeMarker for RegistryRegisterProviderSynchronouslyResponse {
216        type Borrowed<'a> = &'a Self;
217        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
218            value
219        }
220    }
221
222    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterProviderSynchronouslyResponse {
223        type Owned = Self;
224
225        #[inline(always)]
226        fn inline_align(_context: fidl::encoding::Context) -> usize {
227            4
228        }
229
230        #[inline(always)]
231        fn inline_size(_context: fidl::encoding::Context) -> usize {
232            8
233        }
234    }
235
236    unsafe impl<D: fidl::encoding::ResourceDialect>
237        fidl::encoding::Encode<RegistryRegisterProviderSynchronouslyResponse, D>
238        for &RegistryRegisterProviderSynchronouslyResponse
239    {
240        #[inline]
241        unsafe fn encode(
242            self,
243            encoder: &mut fidl::encoding::Encoder<'_, D>,
244            offset: usize,
245            _depth: fidl::encoding::Depth,
246        ) -> fidl::Result<()> {
247            encoder.debug_check_bounds::<RegistryRegisterProviderSynchronouslyResponse>(offset);
248            // Delegate to tuple encoding.
249            fidl::encoding::Encode::<RegistryRegisterProviderSynchronouslyResponse, D>::encode(
250                (
251                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.s),
252                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.started),
253                ),
254                encoder,
255                offset,
256                _depth,
257            )
258        }
259    }
260    unsafe impl<
261            D: fidl::encoding::ResourceDialect,
262            T0: fidl::encoding::Encode<i32, D>,
263            T1: fidl::encoding::Encode<bool, D>,
264        > fidl::encoding::Encode<RegistryRegisterProviderSynchronouslyResponse, D> for (T0, T1)
265    {
266        #[inline]
267        unsafe fn encode(
268            self,
269            encoder: &mut fidl::encoding::Encoder<'_, D>,
270            offset: usize,
271            depth: fidl::encoding::Depth,
272        ) -> fidl::Result<()> {
273            encoder.debug_check_bounds::<RegistryRegisterProviderSynchronouslyResponse>(offset);
274            // Zero out padding regions. There's no need to apply masks
275            // because the unmasked parts will be overwritten by fields.
276            unsafe {
277                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
278                (ptr as *mut u32).write_unaligned(0);
279            }
280            // Write the fields.
281            self.0.encode(encoder, offset + 0, depth)?;
282            self.1.encode(encoder, offset + 4, depth)?;
283            Ok(())
284        }
285    }
286
287    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
288        for RegistryRegisterProviderSynchronouslyResponse
289    {
290        #[inline(always)]
291        fn new_empty() -> Self {
292            Self { s: fidl::new_empty!(i32, D), started: fidl::new_empty!(bool, D) }
293        }
294
295        #[inline]
296        unsafe fn decode(
297            &mut self,
298            decoder: &mut fidl::encoding::Decoder<'_, D>,
299            offset: usize,
300            _depth: fidl::encoding::Depth,
301        ) -> fidl::Result<()> {
302            decoder.debug_check_bounds::<Self>(offset);
303            // Verify that padding bytes are zero.
304            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
305            let padval = unsafe { (ptr as *const u32).read_unaligned() };
306            let mask = 0xffffff00u32;
307            let maskedval = padval & mask;
308            if maskedval != 0 {
309                return Err(fidl::Error::NonZeroPadding {
310                    padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
311                });
312            }
313            fidl::decode!(i32, D, &mut self.s, decoder, offset + 0, _depth)?;
314            fidl::decode!(bool, D, &mut self.started, decoder, offset + 4, _depth)?;
315            Ok(())
316        }
317    }
318
319    impl fidl::encoding::ValueTypeMarker for StartOptions {
320        type Borrowed<'a> = &'a Self;
321        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
322            value
323        }
324    }
325
326    unsafe impl fidl::encoding::TypeMarker for StartOptions {
327        type Owned = Self;
328
329        #[inline(always)]
330        fn inline_align(_context: fidl::encoding::Context) -> usize {
331            8
332        }
333
334        #[inline(always)]
335        fn inline_size(_context: fidl::encoding::Context) -> usize {
336            24
337        }
338    }
339
340    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StartOptions, D>
341        for &StartOptions
342    {
343        #[inline]
344        unsafe fn encode(
345            self,
346            encoder: &mut fidl::encoding::Encoder<'_, D>,
347            offset: usize,
348            _depth: fidl::encoding::Depth,
349        ) -> fidl::Result<()> {
350            encoder.debug_check_bounds::<StartOptions>(offset);
351            // Delegate to tuple encoding.
352            fidl::encoding::Encode::<StartOptions, D>::encode(
353                (
354                    <fidl_fuchsia_tracing::BufferDisposition as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_disposition),
355                    <fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow(&self.additional_categories),
356                ),
357                encoder, offset, _depth
358            )
359        }
360    }
361    unsafe impl<
362            D: fidl::encoding::ResourceDialect,
363            T0: fidl::encoding::Encode<fidl_fuchsia_tracing::BufferDisposition, D>,
364            T1: fidl::encoding::Encode<
365                fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
366                D,
367            >,
368        > fidl::encoding::Encode<StartOptions, D> for (T0, T1)
369    {
370        #[inline]
371        unsafe fn encode(
372            self,
373            encoder: &mut fidl::encoding::Encoder<'_, D>,
374            offset: usize,
375            depth: fidl::encoding::Depth,
376        ) -> fidl::Result<()> {
377            encoder.debug_check_bounds::<StartOptions>(offset);
378            // Zero out padding regions. There's no need to apply masks
379            // because the unmasked parts will be overwritten by fields.
380            unsafe {
381                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
382                (ptr as *mut u64).write_unaligned(0);
383            }
384            // Write the fields.
385            self.0.encode(encoder, offset + 0, depth)?;
386            self.1.encode(encoder, offset + 8, depth)?;
387            Ok(())
388        }
389    }
390
391    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StartOptions {
392        #[inline(always)]
393        fn new_empty() -> Self {
394            Self {
395                buffer_disposition: fidl::new_empty!(fidl_fuchsia_tracing::BufferDisposition, D),
396                additional_categories: fidl::new_empty!(
397                    fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
398                    D
399                ),
400            }
401        }
402
403        #[inline]
404        unsafe fn decode(
405            &mut self,
406            decoder: &mut fidl::encoding::Decoder<'_, D>,
407            offset: usize,
408            _depth: fidl::encoding::Depth,
409        ) -> fidl::Result<()> {
410            decoder.debug_check_bounds::<Self>(offset);
411            // Verify that padding bytes are zero.
412            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
413            let padval = unsafe { (ptr as *const u64).read_unaligned() };
414            let mask = 0xffffffffffffff00u64;
415            let maskedval = padval & mask;
416            if maskedval != 0 {
417                return Err(fidl::Error::NonZeroPadding {
418                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
419                });
420            }
421            fidl::decode!(
422                fidl_fuchsia_tracing::BufferDisposition,
423                D,
424                &mut self.buffer_disposition,
425                decoder,
426                offset + 0,
427                _depth
428            )?;
429            fidl::decode!(
430                fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
431                D,
432                &mut self.additional_categories,
433                decoder,
434                offset + 8,
435                _depth
436            )?;
437            Ok(())
438        }
439    }
440}