1#![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_NAME_SIZE: u64 = 100;
12
13pub const MAX_TAGS: u64 = 100;
14
15#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
16#[repr(u32)]
17pub enum PersistResult {
18 Queued = 1,
19 TooBig = 2,
20 BadName = 3,
21 InternalError = 4,
22}
23
24impl PersistResult {
25 #[inline]
26 pub fn from_primitive(prim: u32) -> Option<Self> {
27 match prim {
28 1 => Some(Self::Queued),
29 2 => Some(Self::TooBig),
30 3 => Some(Self::BadName),
31 4 => Some(Self::InternalError),
32 _ => None,
33 }
34 }
35
36 #[inline]
37 pub const fn into_primitive(self) -> u32 {
38 self as u32
39 }
40
41 #[deprecated = "Strict enums should not use `is_unknown`"]
42 #[inline]
43 pub fn is_unknown(&self) -> bool {
44 false
45 }
46}
47
48#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
49pub struct DataPersistencePersistRequest {
50 pub tag: String,
51}
52
53impl fidl::Persistable for DataPersistencePersistRequest {}
54
55#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct DataPersistencePersistResponse {
57 pub result: PersistResult,
58}
59
60impl fidl::Persistable for DataPersistencePersistResponse {}
61
62#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
63pub struct DataPersistencePersistTagsRequest {
64 pub tags: Vec<String>,
65}
66
67impl fidl::Persistable for DataPersistencePersistTagsRequest {}
68
69#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct DataPersistencePersistTagsResponse {
71 pub results: Vec<PersistResult>,
72}
73
74impl fidl::Persistable for DataPersistencePersistTagsResponse {}
75
76mod internal {
77 use super::*;
78 unsafe impl fidl::encoding::TypeMarker for PersistResult {
79 type Owned = Self;
80
81 #[inline(always)]
82 fn inline_align(_context: fidl::encoding::Context) -> usize {
83 std::mem::align_of::<u32>()
84 }
85
86 #[inline(always)]
87 fn inline_size(_context: fidl::encoding::Context) -> usize {
88 std::mem::size_of::<u32>()
89 }
90
91 #[inline(always)]
92 fn encode_is_copy() -> bool {
93 true
94 }
95
96 #[inline(always)]
97 fn decode_is_copy() -> bool {
98 false
99 }
100 }
101
102 impl fidl::encoding::ValueTypeMarker for PersistResult {
103 type Borrowed<'a> = Self;
104 #[inline(always)]
105 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
106 *value
107 }
108 }
109
110 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PersistResult {
111 #[inline]
112 unsafe fn encode(
113 self,
114 encoder: &mut fidl::encoding::Encoder<'_, D>,
115 offset: usize,
116 _depth: fidl::encoding::Depth,
117 ) -> fidl::Result<()> {
118 encoder.debug_check_bounds::<Self>(offset);
119 encoder.write_num(self.into_primitive(), offset);
120 Ok(())
121 }
122 }
123
124 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PersistResult {
125 #[inline(always)]
126 fn new_empty() -> Self {
127 Self::Queued
128 }
129
130 #[inline]
131 unsafe fn decode(
132 &mut self,
133 decoder: &mut fidl::encoding::Decoder<'_, D>,
134 offset: usize,
135 _depth: fidl::encoding::Depth,
136 ) -> fidl::Result<()> {
137 decoder.debug_check_bounds::<Self>(offset);
138 let prim = decoder.read_num::<u32>(offset);
139
140 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
141 Ok(())
142 }
143 }
144
145 impl fidl::encoding::ValueTypeMarker for DataPersistencePersistRequest {
146 type Borrowed<'a> = &'a Self;
147 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
148 value
149 }
150 }
151
152 unsafe impl fidl::encoding::TypeMarker for DataPersistencePersistRequest {
153 type Owned = Self;
154
155 #[inline(always)]
156 fn inline_align(_context: fidl::encoding::Context) -> usize {
157 8
158 }
159
160 #[inline(always)]
161 fn inline_size(_context: fidl::encoding::Context) -> usize {
162 16
163 }
164 }
165
166 unsafe impl<D: fidl::encoding::ResourceDialect>
167 fidl::encoding::Encode<DataPersistencePersistRequest, D>
168 for &DataPersistencePersistRequest
169 {
170 #[inline]
171 unsafe fn encode(
172 self,
173 encoder: &mut fidl::encoding::Encoder<'_, D>,
174 offset: usize,
175 _depth: fidl::encoding::Depth,
176 ) -> fidl::Result<()> {
177 encoder.debug_check_bounds::<DataPersistencePersistRequest>(offset);
178 fidl::encoding::Encode::<DataPersistencePersistRequest, D>::encode(
180 (<fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(
181 &self.tag,
182 ),),
183 encoder,
184 offset,
185 _depth,
186 )
187 }
188 }
189 unsafe impl<
190 D: fidl::encoding::ResourceDialect,
191 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<100>, D>,
192 > fidl::encoding::Encode<DataPersistencePersistRequest, D> for (T0,)
193 {
194 #[inline]
195 unsafe fn encode(
196 self,
197 encoder: &mut fidl::encoding::Encoder<'_, D>,
198 offset: usize,
199 depth: fidl::encoding::Depth,
200 ) -> fidl::Result<()> {
201 encoder.debug_check_bounds::<DataPersistencePersistRequest>(offset);
202 self.0.encode(encoder, offset + 0, depth)?;
206 Ok(())
207 }
208 }
209
210 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
211 for DataPersistencePersistRequest
212 {
213 #[inline(always)]
214 fn new_empty() -> Self {
215 Self { tag: fidl::new_empty!(fidl::encoding::BoundedString<100>, D) }
216 }
217
218 #[inline]
219 unsafe fn decode(
220 &mut self,
221 decoder: &mut fidl::encoding::Decoder<'_, D>,
222 offset: usize,
223 _depth: fidl::encoding::Depth,
224 ) -> fidl::Result<()> {
225 decoder.debug_check_bounds::<Self>(offset);
226 fidl::decode!(
228 fidl::encoding::BoundedString<100>,
229 D,
230 &mut self.tag,
231 decoder,
232 offset + 0,
233 _depth
234 )?;
235 Ok(())
236 }
237 }
238
239 impl fidl::encoding::ValueTypeMarker for DataPersistencePersistResponse {
240 type Borrowed<'a> = &'a Self;
241 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
242 value
243 }
244 }
245
246 unsafe impl fidl::encoding::TypeMarker for DataPersistencePersistResponse {
247 type Owned = Self;
248
249 #[inline(always)]
250 fn inline_align(_context: fidl::encoding::Context) -> usize {
251 4
252 }
253
254 #[inline(always)]
255 fn inline_size(_context: fidl::encoding::Context) -> usize {
256 4
257 }
258 }
259
260 unsafe impl<D: fidl::encoding::ResourceDialect>
261 fidl::encoding::Encode<DataPersistencePersistResponse, D>
262 for &DataPersistencePersistResponse
263 {
264 #[inline]
265 unsafe fn encode(
266 self,
267 encoder: &mut fidl::encoding::Encoder<'_, D>,
268 offset: usize,
269 _depth: fidl::encoding::Depth,
270 ) -> fidl::Result<()> {
271 encoder.debug_check_bounds::<DataPersistencePersistResponse>(offset);
272 fidl::encoding::Encode::<DataPersistencePersistResponse, D>::encode(
274 (<PersistResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
275 encoder,
276 offset,
277 _depth,
278 )
279 }
280 }
281 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PersistResult, D>>
282 fidl::encoding::Encode<DataPersistencePersistResponse, D> for (T0,)
283 {
284 #[inline]
285 unsafe fn encode(
286 self,
287 encoder: &mut fidl::encoding::Encoder<'_, D>,
288 offset: usize,
289 depth: fidl::encoding::Depth,
290 ) -> fidl::Result<()> {
291 encoder.debug_check_bounds::<DataPersistencePersistResponse>(offset);
292 self.0.encode(encoder, offset + 0, depth)?;
296 Ok(())
297 }
298 }
299
300 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
301 for DataPersistencePersistResponse
302 {
303 #[inline(always)]
304 fn new_empty() -> Self {
305 Self { result: fidl::new_empty!(PersistResult, 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 fidl::decode!(PersistResult, D, &mut self.result, decoder, offset + 0, _depth)?;
318 Ok(())
319 }
320 }
321
322 impl fidl::encoding::ValueTypeMarker for DataPersistencePersistTagsRequest {
323 type Borrowed<'a> = &'a Self;
324 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
325 value
326 }
327 }
328
329 unsafe impl fidl::encoding::TypeMarker for DataPersistencePersistTagsRequest {
330 type Owned = Self;
331
332 #[inline(always)]
333 fn inline_align(_context: fidl::encoding::Context) -> usize {
334 8
335 }
336
337 #[inline(always)]
338 fn inline_size(_context: fidl::encoding::Context) -> usize {
339 16
340 }
341 }
342
343 unsafe impl<D: fidl::encoding::ResourceDialect>
344 fidl::encoding::Encode<DataPersistencePersistTagsRequest, D>
345 for &DataPersistencePersistTagsRequest
346 {
347 #[inline]
348 unsafe fn encode(
349 self,
350 encoder: &mut fidl::encoding::Encoder<'_, D>,
351 offset: usize,
352 _depth: fidl::encoding::Depth,
353 ) -> fidl::Result<()> {
354 encoder.debug_check_bounds::<DataPersistencePersistTagsRequest>(offset);
355 fidl::encoding::Encode::<DataPersistencePersistTagsRequest, D>::encode(
357 (
358 <fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.tags),
359 ),
360 encoder, offset, _depth
361 )
362 }
363 }
364 unsafe impl<
365 D: fidl::encoding::ResourceDialect,
366 T0: fidl::encoding::Encode<
367 fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
368 D,
369 >,
370 > fidl::encoding::Encode<DataPersistencePersistTagsRequest, D> for (T0,)
371 {
372 #[inline]
373 unsafe fn encode(
374 self,
375 encoder: &mut fidl::encoding::Encoder<'_, D>,
376 offset: usize,
377 depth: fidl::encoding::Depth,
378 ) -> fidl::Result<()> {
379 encoder.debug_check_bounds::<DataPersistencePersistTagsRequest>(offset);
380 self.0.encode(encoder, offset + 0, depth)?;
384 Ok(())
385 }
386 }
387
388 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
389 for DataPersistencePersistTagsRequest
390 {
391 #[inline(always)]
392 fn new_empty() -> Self {
393 Self {
394 tags: fidl::new_empty!(
395 fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
396 D
397 ),
398 }
399 }
400
401 #[inline]
402 unsafe fn decode(
403 &mut self,
404 decoder: &mut fidl::encoding::Decoder<'_, D>,
405 offset: usize,
406 _depth: fidl::encoding::Depth,
407 ) -> fidl::Result<()> {
408 decoder.debug_check_bounds::<Self>(offset);
409 fidl::decode!(
411 fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 100>,
412 D,
413 &mut self.tags,
414 decoder,
415 offset + 0,
416 _depth
417 )?;
418 Ok(())
419 }
420 }
421
422 impl fidl::encoding::ValueTypeMarker for DataPersistencePersistTagsResponse {
423 type Borrowed<'a> = &'a Self;
424 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
425 value
426 }
427 }
428
429 unsafe impl fidl::encoding::TypeMarker for DataPersistencePersistTagsResponse {
430 type Owned = Self;
431
432 #[inline(always)]
433 fn inline_align(_context: fidl::encoding::Context) -> usize {
434 8
435 }
436
437 #[inline(always)]
438 fn inline_size(_context: fidl::encoding::Context) -> usize {
439 16
440 }
441 }
442
443 unsafe impl<D: fidl::encoding::ResourceDialect>
444 fidl::encoding::Encode<DataPersistencePersistTagsResponse, D>
445 for &DataPersistencePersistTagsResponse
446 {
447 #[inline]
448 unsafe fn encode(
449 self,
450 encoder: &mut fidl::encoding::Encoder<'_, D>,
451 offset: usize,
452 _depth: fidl::encoding::Depth,
453 ) -> fidl::Result<()> {
454 encoder.debug_check_bounds::<DataPersistencePersistTagsResponse>(offset);
455 fidl::encoding::Encode::<DataPersistencePersistTagsResponse, D>::encode(
457 (
458 <fidl::encoding::Vector<PersistResult, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.results),
459 ),
460 encoder, offset, _depth
461 )
462 }
463 }
464 unsafe impl<
465 D: fidl::encoding::ResourceDialect,
466 T0: fidl::encoding::Encode<fidl::encoding::Vector<PersistResult, 100>, D>,
467 > fidl::encoding::Encode<DataPersistencePersistTagsResponse, D> for (T0,)
468 {
469 #[inline]
470 unsafe fn encode(
471 self,
472 encoder: &mut fidl::encoding::Encoder<'_, D>,
473 offset: usize,
474 depth: fidl::encoding::Depth,
475 ) -> fidl::Result<()> {
476 encoder.debug_check_bounds::<DataPersistencePersistTagsResponse>(offset);
477 self.0.encode(encoder, offset + 0, depth)?;
481 Ok(())
482 }
483 }
484
485 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
486 for DataPersistencePersistTagsResponse
487 {
488 #[inline(always)]
489 fn new_empty() -> Self {
490 Self { results: fidl::new_empty!(fidl::encoding::Vector<PersistResult, 100>, D) }
491 }
492
493 #[inline]
494 unsafe fn decode(
495 &mut self,
496 decoder: &mut fidl::encoding::Decoder<'_, D>,
497 offset: usize,
498 _depth: fidl::encoding::Depth,
499 ) -> fidl::Result<()> {
500 decoder.debug_check_bounds::<Self>(offset);
501 fidl::decode!(fidl::encoding::Vector<PersistResult, 100>, D, &mut self.results, decoder, offset + 0, _depth)?;
503 Ok(())
504 }
505 }
506}