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