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