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_STRING_LENGTH: u64 = 100;
12
13#[derive(Clone, Debug, PartialEq)]
14pub struct ProviderGetBuildInfoResponse {
15 pub build_info: BuildInfo,
16}
17
18impl fidl::Persistable for ProviderGetBuildInfoResponse {}
19
20#[derive(Clone, Debug, Default, PartialEq)]
21pub struct BuildInfo {
22 pub product_config: Option<String>,
26 pub board_config: Option<String>,
30 pub version: Option<String>,
33 pub latest_commit_date: Option<String>,
37 pub platform_version: Option<String>,
40 pub product_version: Option<String>,
44 #[doc(hidden)]
45 pub __source_breaking: fidl::marker::SourceBreaking,
46}
47
48impl fidl::Persistable for BuildInfo {}
49
50mod internal {
51 use super::*;
52
53 impl fidl::encoding::ValueTypeMarker for ProviderGetBuildInfoResponse {
54 type Borrowed<'a> = &'a Self;
55 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
56 value
57 }
58 }
59
60 unsafe impl fidl::encoding::TypeMarker for ProviderGetBuildInfoResponse {
61 type Owned = Self;
62
63 #[inline(always)]
64 fn inline_align(_context: fidl::encoding::Context) -> usize {
65 8
66 }
67
68 #[inline(always)]
69 fn inline_size(_context: fidl::encoding::Context) -> usize {
70 16
71 }
72 }
73
74 unsafe impl<D: fidl::encoding::ResourceDialect>
75 fidl::encoding::Encode<ProviderGetBuildInfoResponse, D> for &ProviderGetBuildInfoResponse
76 {
77 #[inline]
78 unsafe fn encode(
79 self,
80 encoder: &mut fidl::encoding::Encoder<'_, D>,
81 offset: usize,
82 _depth: fidl::encoding::Depth,
83 ) -> fidl::Result<()> {
84 encoder.debug_check_bounds::<ProviderGetBuildInfoResponse>(offset);
85 fidl::encoding::Encode::<ProviderGetBuildInfoResponse, D>::encode(
87 (<BuildInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.build_info),),
88 encoder,
89 offset,
90 _depth,
91 )
92 }
93 }
94 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BuildInfo, D>>
95 fidl::encoding::Encode<ProviderGetBuildInfoResponse, D> for (T0,)
96 {
97 #[inline]
98 unsafe fn encode(
99 self,
100 encoder: &mut fidl::encoding::Encoder<'_, D>,
101 offset: usize,
102 depth: fidl::encoding::Depth,
103 ) -> fidl::Result<()> {
104 encoder.debug_check_bounds::<ProviderGetBuildInfoResponse>(offset);
105 self.0.encode(encoder, offset + 0, depth)?;
109 Ok(())
110 }
111 }
112
113 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
114 for ProviderGetBuildInfoResponse
115 {
116 #[inline(always)]
117 fn new_empty() -> Self {
118 Self { build_info: fidl::new_empty!(BuildInfo, D) }
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 fidl::decode!(BuildInfo, D, &mut self.build_info, decoder, offset + 0, _depth)?;
131 Ok(())
132 }
133 }
134
135 impl BuildInfo {
136 #[inline(always)]
137 fn max_ordinal_present(&self) -> u64 {
138 if let Some(_) = self.product_version {
139 return 6;
140 }
141 if let Some(_) = self.platform_version {
142 return 5;
143 }
144 if let Some(_) = self.latest_commit_date {
145 return 4;
146 }
147 if let Some(_) = self.version {
148 return 3;
149 }
150 if let Some(_) = self.board_config {
151 return 2;
152 }
153 if let Some(_) = self.product_config {
154 return 1;
155 }
156 0
157 }
158 }
159
160 impl fidl::encoding::ValueTypeMarker for BuildInfo {
161 type Borrowed<'a> = &'a Self;
162 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
163 value
164 }
165 }
166
167 unsafe impl fidl::encoding::TypeMarker for BuildInfo {
168 type Owned = Self;
169
170 #[inline(always)]
171 fn inline_align(_context: fidl::encoding::Context) -> usize {
172 8
173 }
174
175 #[inline(always)]
176 fn inline_size(_context: fidl::encoding::Context) -> usize {
177 16
178 }
179 }
180
181 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BuildInfo, D>
182 for &BuildInfo
183 {
184 unsafe fn encode(
185 self,
186 encoder: &mut fidl::encoding::Encoder<'_, D>,
187 offset: usize,
188 mut depth: fidl::encoding::Depth,
189 ) -> fidl::Result<()> {
190 encoder.debug_check_bounds::<BuildInfo>(offset);
191 let max_ordinal: u64 = self.max_ordinal_present();
193 encoder.write_num(max_ordinal, offset);
194 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
195 if max_ordinal == 0 {
197 return Ok(());
198 }
199 depth.increment()?;
200 let envelope_size = 8;
201 let bytes_len = max_ordinal as usize * envelope_size;
202 #[allow(unused_variables)]
203 let offset = encoder.out_of_line_offset(bytes_len);
204 let mut _prev_end_offset: usize = 0;
205 if 1 > max_ordinal {
206 return Ok(());
207 }
208
209 let cur_offset: usize = (1 - 1) * envelope_size;
212
213 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
215
216 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
221 self.product_config.as_ref().map(
222 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
223 ),
224 encoder,
225 offset + cur_offset,
226 depth,
227 )?;
228
229 _prev_end_offset = cur_offset + envelope_size;
230 if 2 > max_ordinal {
231 return Ok(());
232 }
233
234 let cur_offset: usize = (2 - 1) * envelope_size;
237
238 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
240
241 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
246 self.board_config.as_ref().map(
247 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
248 ),
249 encoder,
250 offset + cur_offset,
251 depth,
252 )?;
253
254 _prev_end_offset = cur_offset + envelope_size;
255 if 3 > max_ordinal {
256 return Ok(());
257 }
258
259 let cur_offset: usize = (3 - 1) * envelope_size;
262
263 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
265
266 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
271 self.version.as_ref().map(
272 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
273 ),
274 encoder,
275 offset + cur_offset,
276 depth,
277 )?;
278
279 _prev_end_offset = cur_offset + envelope_size;
280 if 4 > max_ordinal {
281 return Ok(());
282 }
283
284 let cur_offset: usize = (4 - 1) * envelope_size;
287
288 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
290
291 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
296 self.latest_commit_date.as_ref().map(
297 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
298 ),
299 encoder,
300 offset + cur_offset,
301 depth,
302 )?;
303
304 _prev_end_offset = cur_offset + envelope_size;
305 if 5 > max_ordinal {
306 return Ok(());
307 }
308
309 let cur_offset: usize = (5 - 1) * envelope_size;
312
313 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
315
316 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
321 self.platform_version.as_ref().map(
322 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
323 ),
324 encoder,
325 offset + cur_offset,
326 depth,
327 )?;
328
329 _prev_end_offset = cur_offset + envelope_size;
330 if 6 > max_ordinal {
331 return Ok(());
332 }
333
334 let cur_offset: usize = (6 - 1) * envelope_size;
337
338 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
340
341 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<100>, D>(
346 self.product_version.as_ref().map(
347 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow,
348 ),
349 encoder,
350 offset + cur_offset,
351 depth,
352 )?;
353
354 _prev_end_offset = cur_offset + envelope_size;
355
356 Ok(())
357 }
358 }
359
360 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BuildInfo {
361 #[inline(always)]
362 fn new_empty() -> Self {
363 Self::default()
364 }
365
366 unsafe fn decode(
367 &mut self,
368 decoder: &mut fidl::encoding::Decoder<'_, D>,
369 offset: usize,
370 mut depth: fidl::encoding::Depth,
371 ) -> fidl::Result<()> {
372 decoder.debug_check_bounds::<Self>(offset);
373 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
374 None => return Err(fidl::Error::NotNullable),
375 Some(len) => len,
376 };
377 if len == 0 {
379 return Ok(());
380 };
381 depth.increment()?;
382 let envelope_size = 8;
383 let bytes_len = len * envelope_size;
384 let offset = decoder.out_of_line_offset(bytes_len)?;
385 let mut _next_ordinal_to_read = 0;
387 let mut next_offset = offset;
388 let end_offset = offset + bytes_len;
389 _next_ordinal_to_read += 1;
390 if next_offset >= end_offset {
391 return Ok(());
392 }
393
394 while _next_ordinal_to_read < 1 {
396 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
397 _next_ordinal_to_read += 1;
398 next_offset += envelope_size;
399 }
400
401 let next_out_of_line = decoder.next_out_of_line();
402 let handles_before = decoder.remaining_handles();
403 if let Some((inlined, num_bytes, num_handles)) =
404 fidl::encoding::decode_envelope_header(decoder, next_offset)?
405 {
406 let member_inline_size =
407 <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
408 decoder.context,
409 );
410 if inlined != (member_inline_size <= 4) {
411 return Err(fidl::Error::InvalidInlineBitInEnvelope);
412 }
413 let inner_offset;
414 let mut inner_depth = depth.clone();
415 if inlined {
416 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
417 inner_offset = next_offset;
418 } else {
419 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
420 inner_depth.increment()?;
421 }
422 let val_ref = self
423 .product_config
424 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
425 fidl::decode!(
426 fidl::encoding::BoundedString<100>,
427 D,
428 val_ref,
429 decoder,
430 inner_offset,
431 inner_depth
432 )?;
433 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
434 {
435 return Err(fidl::Error::InvalidNumBytesInEnvelope);
436 }
437 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
438 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
439 }
440 }
441
442 next_offset += envelope_size;
443 _next_ordinal_to_read += 1;
444 if next_offset >= end_offset {
445 return Ok(());
446 }
447
448 while _next_ordinal_to_read < 2 {
450 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
451 _next_ordinal_to_read += 1;
452 next_offset += envelope_size;
453 }
454
455 let next_out_of_line = decoder.next_out_of_line();
456 let handles_before = decoder.remaining_handles();
457 if let Some((inlined, num_bytes, num_handles)) =
458 fidl::encoding::decode_envelope_header(decoder, next_offset)?
459 {
460 let member_inline_size =
461 <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
462 decoder.context,
463 );
464 if inlined != (member_inline_size <= 4) {
465 return Err(fidl::Error::InvalidInlineBitInEnvelope);
466 }
467 let inner_offset;
468 let mut inner_depth = depth.clone();
469 if inlined {
470 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
471 inner_offset = next_offset;
472 } else {
473 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
474 inner_depth.increment()?;
475 }
476 let val_ref = self
477 .board_config
478 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
479 fidl::decode!(
480 fidl::encoding::BoundedString<100>,
481 D,
482 val_ref,
483 decoder,
484 inner_offset,
485 inner_depth
486 )?;
487 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
488 {
489 return Err(fidl::Error::InvalidNumBytesInEnvelope);
490 }
491 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
492 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
493 }
494 }
495
496 next_offset += envelope_size;
497 _next_ordinal_to_read += 1;
498 if next_offset >= end_offset {
499 return Ok(());
500 }
501
502 while _next_ordinal_to_read < 3 {
504 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
505 _next_ordinal_to_read += 1;
506 next_offset += envelope_size;
507 }
508
509 let next_out_of_line = decoder.next_out_of_line();
510 let handles_before = decoder.remaining_handles();
511 if let Some((inlined, num_bytes, num_handles)) =
512 fidl::encoding::decode_envelope_header(decoder, next_offset)?
513 {
514 let member_inline_size =
515 <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
516 decoder.context,
517 );
518 if inlined != (member_inline_size <= 4) {
519 return Err(fidl::Error::InvalidInlineBitInEnvelope);
520 }
521 let inner_offset;
522 let mut inner_depth = depth.clone();
523 if inlined {
524 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
525 inner_offset = next_offset;
526 } else {
527 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
528 inner_depth.increment()?;
529 }
530 let val_ref = self
531 .version
532 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
533 fidl::decode!(
534 fidl::encoding::BoundedString<100>,
535 D,
536 val_ref,
537 decoder,
538 inner_offset,
539 inner_depth
540 )?;
541 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
542 {
543 return Err(fidl::Error::InvalidNumBytesInEnvelope);
544 }
545 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
546 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
547 }
548 }
549
550 next_offset += envelope_size;
551 _next_ordinal_to_read += 1;
552 if next_offset >= end_offset {
553 return Ok(());
554 }
555
556 while _next_ordinal_to_read < 4 {
558 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
559 _next_ordinal_to_read += 1;
560 next_offset += envelope_size;
561 }
562
563 let next_out_of_line = decoder.next_out_of_line();
564 let handles_before = decoder.remaining_handles();
565 if let Some((inlined, num_bytes, num_handles)) =
566 fidl::encoding::decode_envelope_header(decoder, next_offset)?
567 {
568 let member_inline_size =
569 <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
570 decoder.context,
571 );
572 if inlined != (member_inline_size <= 4) {
573 return Err(fidl::Error::InvalidInlineBitInEnvelope);
574 }
575 let inner_offset;
576 let mut inner_depth = depth.clone();
577 if inlined {
578 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
579 inner_offset = next_offset;
580 } else {
581 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
582 inner_depth.increment()?;
583 }
584 let val_ref = self
585 .latest_commit_date
586 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
587 fidl::decode!(
588 fidl::encoding::BoundedString<100>,
589 D,
590 val_ref,
591 decoder,
592 inner_offset,
593 inner_depth
594 )?;
595 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
596 {
597 return Err(fidl::Error::InvalidNumBytesInEnvelope);
598 }
599 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
600 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
601 }
602 }
603
604 next_offset += envelope_size;
605 _next_ordinal_to_read += 1;
606 if next_offset >= end_offset {
607 return Ok(());
608 }
609
610 while _next_ordinal_to_read < 5 {
612 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
613 _next_ordinal_to_read += 1;
614 next_offset += envelope_size;
615 }
616
617 let next_out_of_line = decoder.next_out_of_line();
618 let handles_before = decoder.remaining_handles();
619 if let Some((inlined, num_bytes, num_handles)) =
620 fidl::encoding::decode_envelope_header(decoder, next_offset)?
621 {
622 let member_inline_size =
623 <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
624 decoder.context,
625 );
626 if inlined != (member_inline_size <= 4) {
627 return Err(fidl::Error::InvalidInlineBitInEnvelope);
628 }
629 let inner_offset;
630 let mut inner_depth = depth.clone();
631 if inlined {
632 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
633 inner_offset = next_offset;
634 } else {
635 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
636 inner_depth.increment()?;
637 }
638 let val_ref = self
639 .platform_version
640 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
641 fidl::decode!(
642 fidl::encoding::BoundedString<100>,
643 D,
644 val_ref,
645 decoder,
646 inner_offset,
647 inner_depth
648 )?;
649 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
650 {
651 return Err(fidl::Error::InvalidNumBytesInEnvelope);
652 }
653 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
654 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
655 }
656 }
657
658 next_offset += envelope_size;
659 _next_ordinal_to_read += 1;
660 if next_offset >= end_offset {
661 return Ok(());
662 }
663
664 while _next_ordinal_to_read < 6 {
666 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
667 _next_ordinal_to_read += 1;
668 next_offset += envelope_size;
669 }
670
671 let next_out_of_line = decoder.next_out_of_line();
672 let handles_before = decoder.remaining_handles();
673 if let Some((inlined, num_bytes, num_handles)) =
674 fidl::encoding::decode_envelope_header(decoder, next_offset)?
675 {
676 let member_inline_size =
677 <fidl::encoding::BoundedString<100> as fidl::encoding::TypeMarker>::inline_size(
678 decoder.context,
679 );
680 if inlined != (member_inline_size <= 4) {
681 return Err(fidl::Error::InvalidInlineBitInEnvelope);
682 }
683 let inner_offset;
684 let mut inner_depth = depth.clone();
685 if inlined {
686 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
687 inner_offset = next_offset;
688 } else {
689 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
690 inner_depth.increment()?;
691 }
692 let val_ref = self
693 .product_version
694 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<100>, D));
695 fidl::decode!(
696 fidl::encoding::BoundedString<100>,
697 D,
698 val_ref,
699 decoder,
700 inner_offset,
701 inner_depth
702 )?;
703 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
704 {
705 return Err(fidl::Error::InvalidNumBytesInEnvelope);
706 }
707 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
708 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
709 }
710 }
711
712 next_offset += envelope_size;
713
714 while next_offset < end_offset {
716 _next_ordinal_to_read += 1;
717 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
718 next_offset += envelope_size;
719 }
720
721 Ok(())
722 }
723 }
724}