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_VERSION_STRING_SIZE: u32 = 128;
14
15#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
18#[repr(u32)]
19pub enum CheckNotStartedReason {
20 Internal = 1,
25 InvalidOptions = 2,
29 AlreadyInProgress = 3,
32 Throttled = 4,
41}
42
43impl CheckNotStartedReason {
44 #[inline]
45 pub fn from_primitive(prim: u32) -> Option<Self> {
46 match prim {
47 1 => Some(Self::Internal),
48 2 => Some(Self::InvalidOptions),
49 3 => Some(Self::AlreadyInProgress),
50 4 => Some(Self::Throttled),
51 _ => None,
52 }
53 }
54
55 #[inline]
56 pub const fn into_primitive(self) -> u32 {
57 self as u32
58 }
59
60 #[deprecated = "Strict enums should not use `is_unknown`"]
61 #[inline]
62 pub fn is_unknown(&self) -> bool {
63 false
64 }
65}
66
67#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
69#[repr(u32)]
70pub enum Initiator {
71 User = 1,
76 Service = 2,
79}
80
81impl Initiator {
82 #[inline]
83 pub fn from_primitive(prim: u32) -> Option<Self> {
84 match prim {
85 1 => Some(Self::User),
86 2 => Some(Self::Service),
87 _ => None,
88 }
89 }
90
91 #[inline]
92 pub const fn into_primitive(self) -> u32 {
93 self as u32
94 }
95
96 #[deprecated = "Strict enums should not use `is_unknown`"]
97 #[inline]
98 pub fn is_unknown(&self) -> bool {
99 false
100 }
101}
102
103#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
106pub enum InstallationDeferralReason {
107 CurrentSystemNotCommitted,
112 #[doc(hidden)]
113 __SourceBreaking { unknown_ordinal: u32 },
114}
115
116#[macro_export]
118macro_rules! InstallationDeferralReasonUnknown {
119 () => {
120 _
121 };
122}
123
124impl InstallationDeferralReason {
125 #[inline]
126 pub fn from_primitive(prim: u32) -> Option<Self> {
127 match prim {
128 1 => Some(Self::CurrentSystemNotCommitted),
129 _ => None,
130 }
131 }
132
133 #[inline]
134 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
135 match prim {
136 1 => Self::CurrentSystemNotCommitted,
137 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
138 }
139 }
140
141 #[inline]
142 pub fn unknown() -> Self {
143 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
144 }
145
146 #[inline]
147 pub const fn into_primitive(self) -> u32 {
148 match self {
149 Self::CurrentSystemNotCommitted => 1,
150 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
151 }
152 }
153
154 #[inline]
155 pub fn is_unknown(&self) -> bool {
156 match self {
157 Self::__SourceBreaking { unknown_ordinal: _ } => true,
158 _ => false,
159 }
160 }
161}
162
163#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
164pub struct ManagerPerformPendingRebootResponse {
165 pub rebooting: bool,
166}
167
168impl fidl::Persistable for ManagerPerformPendingRebootResponse {}
169
170#[derive(Clone, Debug, PartialEq)]
171pub struct MonitorOnStateRequest {
172 pub state: State,
173}
174
175impl fidl::Persistable for MonitorOnStateRequest {}
176
177#[derive(Clone, Debug, Default, PartialEq)]
179pub struct AttemptOptions {
180 pub initiator: Option<Initiator>,
183 #[doc(hidden)]
184 pub __source_breaking: fidl::marker::SourceBreaking,
185}
186
187impl fidl::Persistable for AttemptOptions {}
188
189#[derive(Clone, Debug, Default, PartialEq)]
191pub struct CheckOptions {
192 pub initiator: Option<Initiator>,
197 pub allow_attaching_to_existing_update_check: Option<bool>,
203 #[doc(hidden)]
204 pub __source_breaking: fidl::marker::SourceBreaking,
205}
206
207impl fidl::Persistable for CheckOptions {}
208
209#[derive(Clone, Debug, Default, PartialEq)]
212pub struct CheckingForUpdatesData {
213 #[doc(hidden)]
214 pub __source_breaking: fidl::marker::SourceBreaking,
215}
216
217impl fidl::Persistable for CheckingForUpdatesData {}
218
219#[derive(Clone, Debug, Default, PartialEq)]
223pub struct ErrorCheckingForUpdateData {
224 #[doc(hidden)]
225 pub __source_breaking: fidl::marker::SourceBreaking,
226}
227
228impl fidl::Persistable for ErrorCheckingForUpdateData {}
229
230#[derive(Clone, Debug, Default, PartialEq)]
233pub struct InstallationDeferredData {
234 pub update: Option<UpdateInfo>,
235 pub deferral_reason: Option<InstallationDeferralReason>,
236 #[doc(hidden)]
237 pub __source_breaking: fidl::marker::SourceBreaking,
238}
239
240impl fidl::Persistable for InstallationDeferredData {}
241
242#[derive(Clone, Debug, Default, PartialEq)]
245pub struct InstallationErrorData {
246 pub update: Option<UpdateInfo>,
247 pub installation_progress: Option<InstallationProgress>,
248 #[doc(hidden)]
249 pub __source_breaking: fidl::marker::SourceBreaking,
250}
251
252impl fidl::Persistable for InstallationErrorData {}
253
254#[derive(Clone, Debug, Default, PartialEq)]
256pub struct InstallationProgress {
257 pub fraction_completed: Option<f32>,
259 #[doc(hidden)]
260 pub __source_breaking: fidl::marker::SourceBreaking,
261}
262
263impl fidl::Persistable for InstallationProgress {}
264
265#[derive(Clone, Debug, Default, PartialEq)]
270pub struct InstallingData {
271 pub update: Option<UpdateInfo>,
272 pub installation_progress: Option<InstallationProgress>,
273 #[doc(hidden)]
274 pub __source_breaking: fidl::marker::SourceBreaking,
275}
276
277impl fidl::Persistable for InstallingData {}
278
279#[derive(Clone, Debug, Default, PartialEq)]
282pub struct NoUpdateAvailableData {
283 #[doc(hidden)]
284 pub __source_breaking: fidl::marker::SourceBreaking,
285}
286
287impl fidl::Persistable for NoUpdateAvailableData {}
288
289#[derive(Clone, Debug, Default, PartialEq)]
291pub struct UpdateInfo {
292 pub version_available: Option<String>,
296 pub download_size: Option<u64>,
298 pub urgent: Option<bool>,
300 #[doc(hidden)]
301 pub __source_breaking: fidl::marker::SourceBreaking,
302}
303
304impl fidl::Persistable for UpdateInfo {}
305
306#[derive(Clone, Debug, PartialEq)]
336pub enum State {
337 CheckingForUpdates(CheckingForUpdatesData),
344 ErrorCheckingForUpdate(ErrorCheckingForUpdateData),
349 NoUpdateAvailable(NoUpdateAvailableData),
353 InstallationDeferredByPolicy(InstallationDeferredData),
358 InstallingUpdate(InstallingData),
364 WaitingForReboot(InstallingData),
371 InstallationError(InstallationErrorData),
375}
376
377impl State {
378 #[inline]
379 pub fn ordinal(&self) -> u64 {
380 match *self {
381 Self::CheckingForUpdates(_) => 1,
382 Self::ErrorCheckingForUpdate(_) => 2,
383 Self::NoUpdateAvailable(_) => 3,
384 Self::InstallationDeferredByPolicy(_) => 4,
385 Self::InstallingUpdate(_) => 5,
386 Self::WaitingForReboot(_) => 6,
387 Self::InstallationError(_) => 7,
388 }
389 }
390
391 #[deprecated = "Strict unions should not use `is_unknown`"]
392 #[inline]
393 pub fn is_unknown(&self) -> bool {
394 false
395 }
396}
397
398impl fidl::Persistable for State {}
399
400mod internal {
401 use super::*;
402 unsafe impl fidl::encoding::TypeMarker for CheckNotStartedReason {
403 type Owned = Self;
404
405 #[inline(always)]
406 fn inline_align(_context: fidl::encoding::Context) -> usize {
407 std::mem::align_of::<u32>()
408 }
409
410 #[inline(always)]
411 fn inline_size(_context: fidl::encoding::Context) -> usize {
412 std::mem::size_of::<u32>()
413 }
414
415 #[inline(always)]
416 fn encode_is_copy() -> bool {
417 true
418 }
419
420 #[inline(always)]
421 fn decode_is_copy() -> bool {
422 false
423 }
424 }
425
426 impl fidl::encoding::ValueTypeMarker for CheckNotStartedReason {
427 type Borrowed<'a> = Self;
428 #[inline(always)]
429 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
430 *value
431 }
432 }
433
434 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
435 for CheckNotStartedReason
436 {
437 #[inline]
438 unsafe fn encode(
439 self,
440 encoder: &mut fidl::encoding::Encoder<'_, D>,
441 offset: usize,
442 _depth: fidl::encoding::Depth,
443 ) -> fidl::Result<()> {
444 encoder.debug_check_bounds::<Self>(offset);
445 encoder.write_num(self.into_primitive(), offset);
446 Ok(())
447 }
448 }
449
450 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CheckNotStartedReason {
451 #[inline(always)]
452 fn new_empty() -> Self {
453 Self::Internal
454 }
455
456 #[inline]
457 unsafe fn decode(
458 &mut self,
459 decoder: &mut fidl::encoding::Decoder<'_, D>,
460 offset: usize,
461 _depth: fidl::encoding::Depth,
462 ) -> fidl::Result<()> {
463 decoder.debug_check_bounds::<Self>(offset);
464 let prim = decoder.read_num::<u32>(offset);
465
466 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
467 Ok(())
468 }
469 }
470 unsafe impl fidl::encoding::TypeMarker for Initiator {
471 type Owned = Self;
472
473 #[inline(always)]
474 fn inline_align(_context: fidl::encoding::Context) -> usize {
475 std::mem::align_of::<u32>()
476 }
477
478 #[inline(always)]
479 fn inline_size(_context: fidl::encoding::Context) -> usize {
480 std::mem::size_of::<u32>()
481 }
482
483 #[inline(always)]
484 fn encode_is_copy() -> bool {
485 true
486 }
487
488 #[inline(always)]
489 fn decode_is_copy() -> bool {
490 false
491 }
492 }
493
494 impl fidl::encoding::ValueTypeMarker for Initiator {
495 type Borrowed<'a> = Self;
496 #[inline(always)]
497 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
498 *value
499 }
500 }
501
502 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Initiator {
503 #[inline]
504 unsafe fn encode(
505 self,
506 encoder: &mut fidl::encoding::Encoder<'_, D>,
507 offset: usize,
508 _depth: fidl::encoding::Depth,
509 ) -> fidl::Result<()> {
510 encoder.debug_check_bounds::<Self>(offset);
511 encoder.write_num(self.into_primitive(), offset);
512 Ok(())
513 }
514 }
515
516 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Initiator {
517 #[inline(always)]
518 fn new_empty() -> Self {
519 Self::User
520 }
521
522 #[inline]
523 unsafe fn decode(
524 &mut self,
525 decoder: &mut fidl::encoding::Decoder<'_, D>,
526 offset: usize,
527 _depth: fidl::encoding::Depth,
528 ) -> fidl::Result<()> {
529 decoder.debug_check_bounds::<Self>(offset);
530 let prim = decoder.read_num::<u32>(offset);
531
532 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
533 Ok(())
534 }
535 }
536 unsafe impl fidl::encoding::TypeMarker for InstallationDeferralReason {
537 type Owned = Self;
538
539 #[inline(always)]
540 fn inline_align(_context: fidl::encoding::Context) -> usize {
541 std::mem::align_of::<u32>()
542 }
543
544 #[inline(always)]
545 fn inline_size(_context: fidl::encoding::Context) -> usize {
546 std::mem::size_of::<u32>()
547 }
548
549 #[inline(always)]
550 fn encode_is_copy() -> bool {
551 false
552 }
553
554 #[inline(always)]
555 fn decode_is_copy() -> bool {
556 false
557 }
558 }
559
560 impl fidl::encoding::ValueTypeMarker for InstallationDeferralReason {
561 type Borrowed<'a> = Self;
562 #[inline(always)]
563 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
564 *value
565 }
566 }
567
568 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
569 for InstallationDeferralReason
570 {
571 #[inline]
572 unsafe fn encode(
573 self,
574 encoder: &mut fidl::encoding::Encoder<'_, D>,
575 offset: usize,
576 _depth: fidl::encoding::Depth,
577 ) -> fidl::Result<()> {
578 encoder.debug_check_bounds::<Self>(offset);
579 encoder.write_num(self.into_primitive(), offset);
580 Ok(())
581 }
582 }
583
584 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
585 for InstallationDeferralReason
586 {
587 #[inline(always)]
588 fn new_empty() -> Self {
589 Self::unknown()
590 }
591
592 #[inline]
593 unsafe fn decode(
594 &mut self,
595 decoder: &mut fidl::encoding::Decoder<'_, D>,
596 offset: usize,
597 _depth: fidl::encoding::Depth,
598 ) -> fidl::Result<()> {
599 decoder.debug_check_bounds::<Self>(offset);
600 let prim = decoder.read_num::<u32>(offset);
601
602 *self = Self::from_primitive_allow_unknown(prim);
603 Ok(())
604 }
605 }
606
607 impl fidl::encoding::ValueTypeMarker for ManagerPerformPendingRebootResponse {
608 type Borrowed<'a> = &'a Self;
609 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
610 value
611 }
612 }
613
614 unsafe impl fidl::encoding::TypeMarker for ManagerPerformPendingRebootResponse {
615 type Owned = Self;
616
617 #[inline(always)]
618 fn inline_align(_context: fidl::encoding::Context) -> usize {
619 1
620 }
621
622 #[inline(always)]
623 fn inline_size(_context: fidl::encoding::Context) -> usize {
624 1
625 }
626 }
627
628 unsafe impl<D: fidl::encoding::ResourceDialect>
629 fidl::encoding::Encode<ManagerPerformPendingRebootResponse, D>
630 for &ManagerPerformPendingRebootResponse
631 {
632 #[inline]
633 unsafe fn encode(
634 self,
635 encoder: &mut fidl::encoding::Encoder<'_, D>,
636 offset: usize,
637 _depth: fidl::encoding::Depth,
638 ) -> fidl::Result<()> {
639 encoder.debug_check_bounds::<ManagerPerformPendingRebootResponse>(offset);
640 fidl::encoding::Encode::<ManagerPerformPendingRebootResponse, D>::encode(
642 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.rebooting),),
643 encoder,
644 offset,
645 _depth,
646 )
647 }
648 }
649 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
650 fidl::encoding::Encode<ManagerPerformPendingRebootResponse, D> for (T0,)
651 {
652 #[inline]
653 unsafe fn encode(
654 self,
655 encoder: &mut fidl::encoding::Encoder<'_, D>,
656 offset: usize,
657 depth: fidl::encoding::Depth,
658 ) -> fidl::Result<()> {
659 encoder.debug_check_bounds::<ManagerPerformPendingRebootResponse>(offset);
660 self.0.encode(encoder, offset + 0, depth)?;
664 Ok(())
665 }
666 }
667
668 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
669 for ManagerPerformPendingRebootResponse
670 {
671 #[inline(always)]
672 fn new_empty() -> Self {
673 Self { rebooting: fidl::new_empty!(bool, D) }
674 }
675
676 #[inline]
677 unsafe fn decode(
678 &mut self,
679 decoder: &mut fidl::encoding::Decoder<'_, D>,
680 offset: usize,
681 _depth: fidl::encoding::Depth,
682 ) -> fidl::Result<()> {
683 decoder.debug_check_bounds::<Self>(offset);
684 fidl::decode!(bool, D, &mut self.rebooting, decoder, offset + 0, _depth)?;
686 Ok(())
687 }
688 }
689
690 impl fidl::encoding::ValueTypeMarker for MonitorOnStateRequest {
691 type Borrowed<'a> = &'a Self;
692 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
693 value
694 }
695 }
696
697 unsafe impl fidl::encoding::TypeMarker for MonitorOnStateRequest {
698 type Owned = Self;
699
700 #[inline(always)]
701 fn inline_align(_context: fidl::encoding::Context) -> usize {
702 8
703 }
704
705 #[inline(always)]
706 fn inline_size(_context: fidl::encoding::Context) -> usize {
707 16
708 }
709 }
710
711 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MonitorOnStateRequest, D>
712 for &MonitorOnStateRequest
713 {
714 #[inline]
715 unsafe fn encode(
716 self,
717 encoder: &mut fidl::encoding::Encoder<'_, D>,
718 offset: usize,
719 _depth: fidl::encoding::Depth,
720 ) -> fidl::Result<()> {
721 encoder.debug_check_bounds::<MonitorOnStateRequest>(offset);
722 fidl::encoding::Encode::<MonitorOnStateRequest, D>::encode(
724 (<State as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
725 encoder,
726 offset,
727 _depth,
728 )
729 }
730 }
731 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<State, D>>
732 fidl::encoding::Encode<MonitorOnStateRequest, D> for (T0,)
733 {
734 #[inline]
735 unsafe fn encode(
736 self,
737 encoder: &mut fidl::encoding::Encoder<'_, D>,
738 offset: usize,
739 depth: fidl::encoding::Depth,
740 ) -> fidl::Result<()> {
741 encoder.debug_check_bounds::<MonitorOnStateRequest>(offset);
742 self.0.encode(encoder, offset + 0, depth)?;
746 Ok(())
747 }
748 }
749
750 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MonitorOnStateRequest {
751 #[inline(always)]
752 fn new_empty() -> Self {
753 Self { state: fidl::new_empty!(State, D) }
754 }
755
756 #[inline]
757 unsafe fn decode(
758 &mut self,
759 decoder: &mut fidl::encoding::Decoder<'_, D>,
760 offset: usize,
761 _depth: fidl::encoding::Depth,
762 ) -> fidl::Result<()> {
763 decoder.debug_check_bounds::<Self>(offset);
764 fidl::decode!(State, D, &mut self.state, decoder, offset + 0, _depth)?;
766 Ok(())
767 }
768 }
769
770 impl AttemptOptions {
771 #[inline(always)]
772 fn max_ordinal_present(&self) -> u64 {
773 if let Some(_) = self.initiator {
774 return 1;
775 }
776 0
777 }
778 }
779
780 impl fidl::encoding::ValueTypeMarker for AttemptOptions {
781 type Borrowed<'a> = &'a Self;
782 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
783 value
784 }
785 }
786
787 unsafe impl fidl::encoding::TypeMarker for AttemptOptions {
788 type Owned = Self;
789
790 #[inline(always)]
791 fn inline_align(_context: fidl::encoding::Context) -> usize {
792 8
793 }
794
795 #[inline(always)]
796 fn inline_size(_context: fidl::encoding::Context) -> usize {
797 16
798 }
799 }
800
801 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AttemptOptions, D>
802 for &AttemptOptions
803 {
804 unsafe fn encode(
805 self,
806 encoder: &mut fidl::encoding::Encoder<'_, D>,
807 offset: usize,
808 mut depth: fidl::encoding::Depth,
809 ) -> fidl::Result<()> {
810 encoder.debug_check_bounds::<AttemptOptions>(offset);
811 let max_ordinal: u64 = self.max_ordinal_present();
813 encoder.write_num(max_ordinal, offset);
814 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
815 if max_ordinal == 0 {
817 return Ok(());
818 }
819 depth.increment()?;
820 let envelope_size = 8;
821 let bytes_len = max_ordinal as usize * envelope_size;
822 #[allow(unused_variables)]
823 let offset = encoder.out_of_line_offset(bytes_len);
824 let mut _prev_end_offset: usize = 0;
825 if 1 > max_ordinal {
826 return Ok(());
827 }
828
829 let cur_offset: usize = (1 - 1) * envelope_size;
832
833 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
835
836 fidl::encoding::encode_in_envelope_optional::<Initiator, D>(
841 self.initiator.as_ref().map(<Initiator as fidl::encoding::ValueTypeMarker>::borrow),
842 encoder,
843 offset + cur_offset,
844 depth,
845 )?;
846
847 _prev_end_offset = cur_offset + envelope_size;
848
849 Ok(())
850 }
851 }
852
853 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AttemptOptions {
854 #[inline(always)]
855 fn new_empty() -> Self {
856 Self::default()
857 }
858
859 unsafe fn decode(
860 &mut self,
861 decoder: &mut fidl::encoding::Decoder<'_, D>,
862 offset: usize,
863 mut depth: fidl::encoding::Depth,
864 ) -> fidl::Result<()> {
865 decoder.debug_check_bounds::<Self>(offset);
866 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
867 None => return Err(fidl::Error::NotNullable),
868 Some(len) => len,
869 };
870 if len == 0 {
872 return Ok(());
873 };
874 depth.increment()?;
875 let envelope_size = 8;
876 let bytes_len = len * envelope_size;
877 let offset = decoder.out_of_line_offset(bytes_len)?;
878 let mut _next_ordinal_to_read = 0;
880 let mut next_offset = offset;
881 let end_offset = offset + bytes_len;
882 _next_ordinal_to_read += 1;
883 if next_offset >= end_offset {
884 return Ok(());
885 }
886
887 while _next_ordinal_to_read < 1 {
889 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
890 _next_ordinal_to_read += 1;
891 next_offset += envelope_size;
892 }
893
894 let next_out_of_line = decoder.next_out_of_line();
895 let handles_before = decoder.remaining_handles();
896 if let Some((inlined, num_bytes, num_handles)) =
897 fidl::encoding::decode_envelope_header(decoder, next_offset)?
898 {
899 let member_inline_size =
900 <Initiator as fidl::encoding::TypeMarker>::inline_size(decoder.context);
901 if inlined != (member_inline_size <= 4) {
902 return Err(fidl::Error::InvalidInlineBitInEnvelope);
903 }
904 let inner_offset;
905 let mut inner_depth = depth.clone();
906 if inlined {
907 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
908 inner_offset = next_offset;
909 } else {
910 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
911 inner_depth.increment()?;
912 }
913 let val_ref = self.initiator.get_or_insert_with(|| fidl::new_empty!(Initiator, D));
914 fidl::decode!(Initiator, D, val_ref, decoder, inner_offset, inner_depth)?;
915 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
916 {
917 return Err(fidl::Error::InvalidNumBytesInEnvelope);
918 }
919 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
920 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
921 }
922 }
923
924 next_offset += envelope_size;
925
926 while next_offset < end_offset {
928 _next_ordinal_to_read += 1;
929 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
930 next_offset += envelope_size;
931 }
932
933 Ok(())
934 }
935 }
936
937 impl CheckOptions {
938 #[inline(always)]
939 fn max_ordinal_present(&self) -> u64 {
940 if let Some(_) = self.allow_attaching_to_existing_update_check {
941 return 2;
942 }
943 if let Some(_) = self.initiator {
944 return 1;
945 }
946 0
947 }
948 }
949
950 impl fidl::encoding::ValueTypeMarker for CheckOptions {
951 type Borrowed<'a> = &'a Self;
952 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
953 value
954 }
955 }
956
957 unsafe impl fidl::encoding::TypeMarker for CheckOptions {
958 type Owned = Self;
959
960 #[inline(always)]
961 fn inline_align(_context: fidl::encoding::Context) -> usize {
962 8
963 }
964
965 #[inline(always)]
966 fn inline_size(_context: fidl::encoding::Context) -> usize {
967 16
968 }
969 }
970
971 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CheckOptions, D>
972 for &CheckOptions
973 {
974 unsafe fn encode(
975 self,
976 encoder: &mut fidl::encoding::Encoder<'_, D>,
977 offset: usize,
978 mut depth: fidl::encoding::Depth,
979 ) -> fidl::Result<()> {
980 encoder.debug_check_bounds::<CheckOptions>(offset);
981 let max_ordinal: u64 = self.max_ordinal_present();
983 encoder.write_num(max_ordinal, offset);
984 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
985 if max_ordinal == 0 {
987 return Ok(());
988 }
989 depth.increment()?;
990 let envelope_size = 8;
991 let bytes_len = max_ordinal as usize * envelope_size;
992 #[allow(unused_variables)]
993 let offset = encoder.out_of_line_offset(bytes_len);
994 let mut _prev_end_offset: usize = 0;
995 if 1 > max_ordinal {
996 return Ok(());
997 }
998
999 let cur_offset: usize = (1 - 1) * envelope_size;
1002
1003 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1005
1006 fidl::encoding::encode_in_envelope_optional::<Initiator, D>(
1011 self.initiator.as_ref().map(<Initiator as fidl::encoding::ValueTypeMarker>::borrow),
1012 encoder,
1013 offset + cur_offset,
1014 depth,
1015 )?;
1016
1017 _prev_end_offset = cur_offset + envelope_size;
1018 if 2 > max_ordinal {
1019 return Ok(());
1020 }
1021
1022 let cur_offset: usize = (2 - 1) * envelope_size;
1025
1026 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1028
1029 fidl::encoding::encode_in_envelope_optional::<bool, D>(
1034 self.allow_attaching_to_existing_update_check
1035 .as_ref()
1036 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1037 encoder,
1038 offset + cur_offset,
1039 depth,
1040 )?;
1041
1042 _prev_end_offset = cur_offset + envelope_size;
1043
1044 Ok(())
1045 }
1046 }
1047
1048 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CheckOptions {
1049 #[inline(always)]
1050 fn new_empty() -> Self {
1051 Self::default()
1052 }
1053
1054 unsafe fn decode(
1055 &mut self,
1056 decoder: &mut fidl::encoding::Decoder<'_, D>,
1057 offset: usize,
1058 mut depth: fidl::encoding::Depth,
1059 ) -> fidl::Result<()> {
1060 decoder.debug_check_bounds::<Self>(offset);
1061 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1062 None => return Err(fidl::Error::NotNullable),
1063 Some(len) => len,
1064 };
1065 if len == 0 {
1067 return Ok(());
1068 };
1069 depth.increment()?;
1070 let envelope_size = 8;
1071 let bytes_len = len * envelope_size;
1072 let offset = decoder.out_of_line_offset(bytes_len)?;
1073 let mut _next_ordinal_to_read = 0;
1075 let mut next_offset = offset;
1076 let end_offset = offset + bytes_len;
1077 _next_ordinal_to_read += 1;
1078 if next_offset >= end_offset {
1079 return Ok(());
1080 }
1081
1082 while _next_ordinal_to_read < 1 {
1084 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1085 _next_ordinal_to_read += 1;
1086 next_offset += envelope_size;
1087 }
1088
1089 let next_out_of_line = decoder.next_out_of_line();
1090 let handles_before = decoder.remaining_handles();
1091 if let Some((inlined, num_bytes, num_handles)) =
1092 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1093 {
1094 let member_inline_size =
1095 <Initiator as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1096 if inlined != (member_inline_size <= 4) {
1097 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1098 }
1099 let inner_offset;
1100 let mut inner_depth = depth.clone();
1101 if inlined {
1102 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1103 inner_offset = next_offset;
1104 } else {
1105 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1106 inner_depth.increment()?;
1107 }
1108 let val_ref = self.initiator.get_or_insert_with(|| fidl::new_empty!(Initiator, D));
1109 fidl::decode!(Initiator, D, val_ref, decoder, inner_offset, inner_depth)?;
1110 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1111 {
1112 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1113 }
1114 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1115 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1116 }
1117 }
1118
1119 next_offset += envelope_size;
1120 _next_ordinal_to_read += 1;
1121 if next_offset >= end_offset {
1122 return Ok(());
1123 }
1124
1125 while _next_ordinal_to_read < 2 {
1127 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1128 _next_ordinal_to_read += 1;
1129 next_offset += envelope_size;
1130 }
1131
1132 let next_out_of_line = decoder.next_out_of_line();
1133 let handles_before = decoder.remaining_handles();
1134 if let Some((inlined, num_bytes, num_handles)) =
1135 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1136 {
1137 let member_inline_size =
1138 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1139 if inlined != (member_inline_size <= 4) {
1140 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1141 }
1142 let inner_offset;
1143 let mut inner_depth = depth.clone();
1144 if inlined {
1145 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1146 inner_offset = next_offset;
1147 } else {
1148 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1149 inner_depth.increment()?;
1150 }
1151 let val_ref = self
1152 .allow_attaching_to_existing_update_check
1153 .get_or_insert_with(|| fidl::new_empty!(bool, D));
1154 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1155 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1156 {
1157 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1158 }
1159 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1160 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1161 }
1162 }
1163
1164 next_offset += envelope_size;
1165
1166 while next_offset < end_offset {
1168 _next_ordinal_to_read += 1;
1169 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1170 next_offset += envelope_size;
1171 }
1172
1173 Ok(())
1174 }
1175 }
1176
1177 impl CheckingForUpdatesData {
1178 #[inline(always)]
1179 fn max_ordinal_present(&self) -> u64 {
1180 0
1181 }
1182 }
1183
1184 impl fidl::encoding::ValueTypeMarker for CheckingForUpdatesData {
1185 type Borrowed<'a> = &'a Self;
1186 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1187 value
1188 }
1189 }
1190
1191 unsafe impl fidl::encoding::TypeMarker for CheckingForUpdatesData {
1192 type Owned = Self;
1193
1194 #[inline(always)]
1195 fn inline_align(_context: fidl::encoding::Context) -> usize {
1196 8
1197 }
1198
1199 #[inline(always)]
1200 fn inline_size(_context: fidl::encoding::Context) -> usize {
1201 16
1202 }
1203 }
1204
1205 unsafe impl<D: fidl::encoding::ResourceDialect>
1206 fidl::encoding::Encode<CheckingForUpdatesData, D> for &CheckingForUpdatesData
1207 {
1208 unsafe fn encode(
1209 self,
1210 encoder: &mut fidl::encoding::Encoder<'_, D>,
1211 offset: usize,
1212 mut depth: fidl::encoding::Depth,
1213 ) -> fidl::Result<()> {
1214 encoder.debug_check_bounds::<CheckingForUpdatesData>(offset);
1215 let max_ordinal: u64 = self.max_ordinal_present();
1217 encoder.write_num(max_ordinal, offset);
1218 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1219 if max_ordinal == 0 {
1221 return Ok(());
1222 }
1223 depth.increment()?;
1224 let envelope_size = 8;
1225 let bytes_len = max_ordinal as usize * envelope_size;
1226 #[allow(unused_variables)]
1227 let offset = encoder.out_of_line_offset(bytes_len);
1228 let mut _prev_end_offset: usize = 0;
1229
1230 Ok(())
1231 }
1232 }
1233
1234 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1235 for CheckingForUpdatesData
1236 {
1237 #[inline(always)]
1238 fn new_empty() -> Self {
1239 Self::default()
1240 }
1241
1242 unsafe fn decode(
1243 &mut self,
1244 decoder: &mut fidl::encoding::Decoder<'_, D>,
1245 offset: usize,
1246 mut depth: fidl::encoding::Depth,
1247 ) -> fidl::Result<()> {
1248 decoder.debug_check_bounds::<Self>(offset);
1249 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1250 None => return Err(fidl::Error::NotNullable),
1251 Some(len) => len,
1252 };
1253 if len == 0 {
1255 return Ok(());
1256 };
1257 depth.increment()?;
1258 let envelope_size = 8;
1259 let bytes_len = len * envelope_size;
1260 let offset = decoder.out_of_line_offset(bytes_len)?;
1261 let mut _next_ordinal_to_read = 0;
1263 let mut next_offset = offset;
1264 let end_offset = offset + bytes_len;
1265
1266 while next_offset < end_offset {
1268 _next_ordinal_to_read += 1;
1269 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1270 next_offset += envelope_size;
1271 }
1272
1273 Ok(())
1274 }
1275 }
1276
1277 impl ErrorCheckingForUpdateData {
1278 #[inline(always)]
1279 fn max_ordinal_present(&self) -> u64 {
1280 0
1281 }
1282 }
1283
1284 impl fidl::encoding::ValueTypeMarker for ErrorCheckingForUpdateData {
1285 type Borrowed<'a> = &'a Self;
1286 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1287 value
1288 }
1289 }
1290
1291 unsafe impl fidl::encoding::TypeMarker for ErrorCheckingForUpdateData {
1292 type Owned = Self;
1293
1294 #[inline(always)]
1295 fn inline_align(_context: fidl::encoding::Context) -> usize {
1296 8
1297 }
1298
1299 #[inline(always)]
1300 fn inline_size(_context: fidl::encoding::Context) -> usize {
1301 16
1302 }
1303 }
1304
1305 unsafe impl<D: fidl::encoding::ResourceDialect>
1306 fidl::encoding::Encode<ErrorCheckingForUpdateData, D> for &ErrorCheckingForUpdateData
1307 {
1308 unsafe fn encode(
1309 self,
1310 encoder: &mut fidl::encoding::Encoder<'_, D>,
1311 offset: usize,
1312 mut depth: fidl::encoding::Depth,
1313 ) -> fidl::Result<()> {
1314 encoder.debug_check_bounds::<ErrorCheckingForUpdateData>(offset);
1315 let max_ordinal: u64 = self.max_ordinal_present();
1317 encoder.write_num(max_ordinal, offset);
1318 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1319 if max_ordinal == 0 {
1321 return Ok(());
1322 }
1323 depth.increment()?;
1324 let envelope_size = 8;
1325 let bytes_len = max_ordinal as usize * envelope_size;
1326 #[allow(unused_variables)]
1327 let offset = encoder.out_of_line_offset(bytes_len);
1328 let mut _prev_end_offset: usize = 0;
1329
1330 Ok(())
1331 }
1332 }
1333
1334 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1335 for ErrorCheckingForUpdateData
1336 {
1337 #[inline(always)]
1338 fn new_empty() -> Self {
1339 Self::default()
1340 }
1341
1342 unsafe fn decode(
1343 &mut self,
1344 decoder: &mut fidl::encoding::Decoder<'_, D>,
1345 offset: usize,
1346 mut depth: fidl::encoding::Depth,
1347 ) -> fidl::Result<()> {
1348 decoder.debug_check_bounds::<Self>(offset);
1349 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1350 None => return Err(fidl::Error::NotNullable),
1351 Some(len) => len,
1352 };
1353 if len == 0 {
1355 return Ok(());
1356 };
1357 depth.increment()?;
1358 let envelope_size = 8;
1359 let bytes_len = len * envelope_size;
1360 let offset = decoder.out_of_line_offset(bytes_len)?;
1361 let mut _next_ordinal_to_read = 0;
1363 let mut next_offset = offset;
1364 let end_offset = offset + bytes_len;
1365
1366 while next_offset < end_offset {
1368 _next_ordinal_to_read += 1;
1369 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1370 next_offset += envelope_size;
1371 }
1372
1373 Ok(())
1374 }
1375 }
1376
1377 impl InstallationDeferredData {
1378 #[inline(always)]
1379 fn max_ordinal_present(&self) -> u64 {
1380 if let Some(_) = self.deferral_reason {
1381 return 2;
1382 }
1383 if let Some(_) = self.update {
1384 return 1;
1385 }
1386 0
1387 }
1388 }
1389
1390 impl fidl::encoding::ValueTypeMarker for InstallationDeferredData {
1391 type Borrowed<'a> = &'a Self;
1392 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1393 value
1394 }
1395 }
1396
1397 unsafe impl fidl::encoding::TypeMarker for InstallationDeferredData {
1398 type Owned = Self;
1399
1400 #[inline(always)]
1401 fn inline_align(_context: fidl::encoding::Context) -> usize {
1402 8
1403 }
1404
1405 #[inline(always)]
1406 fn inline_size(_context: fidl::encoding::Context) -> usize {
1407 16
1408 }
1409 }
1410
1411 unsafe impl<D: fidl::encoding::ResourceDialect>
1412 fidl::encoding::Encode<InstallationDeferredData, D> for &InstallationDeferredData
1413 {
1414 unsafe fn encode(
1415 self,
1416 encoder: &mut fidl::encoding::Encoder<'_, D>,
1417 offset: usize,
1418 mut depth: fidl::encoding::Depth,
1419 ) -> fidl::Result<()> {
1420 encoder.debug_check_bounds::<InstallationDeferredData>(offset);
1421 let max_ordinal: u64 = self.max_ordinal_present();
1423 encoder.write_num(max_ordinal, offset);
1424 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1425 if max_ordinal == 0 {
1427 return Ok(());
1428 }
1429 depth.increment()?;
1430 let envelope_size = 8;
1431 let bytes_len = max_ordinal as usize * envelope_size;
1432 #[allow(unused_variables)]
1433 let offset = encoder.out_of_line_offset(bytes_len);
1434 let mut _prev_end_offset: usize = 0;
1435 if 1 > max_ordinal {
1436 return Ok(());
1437 }
1438
1439 let cur_offset: usize = (1 - 1) * envelope_size;
1442
1443 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1445
1446 fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
1451 self.update.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
1452 encoder,
1453 offset + cur_offset,
1454 depth,
1455 )?;
1456
1457 _prev_end_offset = cur_offset + envelope_size;
1458 if 2 > max_ordinal {
1459 return Ok(());
1460 }
1461
1462 let cur_offset: usize = (2 - 1) * envelope_size;
1465
1466 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1468
1469 fidl::encoding::encode_in_envelope_optional::<InstallationDeferralReason, D>(
1474 self.deferral_reason
1475 .as_ref()
1476 .map(<InstallationDeferralReason as fidl::encoding::ValueTypeMarker>::borrow),
1477 encoder,
1478 offset + cur_offset,
1479 depth,
1480 )?;
1481
1482 _prev_end_offset = cur_offset + envelope_size;
1483
1484 Ok(())
1485 }
1486 }
1487
1488 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1489 for InstallationDeferredData
1490 {
1491 #[inline(always)]
1492 fn new_empty() -> Self {
1493 Self::default()
1494 }
1495
1496 unsafe fn decode(
1497 &mut self,
1498 decoder: &mut fidl::encoding::Decoder<'_, D>,
1499 offset: usize,
1500 mut depth: fidl::encoding::Depth,
1501 ) -> fidl::Result<()> {
1502 decoder.debug_check_bounds::<Self>(offset);
1503 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1504 None => return Err(fidl::Error::NotNullable),
1505 Some(len) => len,
1506 };
1507 if len == 0 {
1509 return Ok(());
1510 };
1511 depth.increment()?;
1512 let envelope_size = 8;
1513 let bytes_len = len * envelope_size;
1514 let offset = decoder.out_of_line_offset(bytes_len)?;
1515 let mut _next_ordinal_to_read = 0;
1517 let mut next_offset = offset;
1518 let end_offset = offset + bytes_len;
1519 _next_ordinal_to_read += 1;
1520 if next_offset >= end_offset {
1521 return Ok(());
1522 }
1523
1524 while _next_ordinal_to_read < 1 {
1526 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1527 _next_ordinal_to_read += 1;
1528 next_offset += envelope_size;
1529 }
1530
1531 let next_out_of_line = decoder.next_out_of_line();
1532 let handles_before = decoder.remaining_handles();
1533 if let Some((inlined, num_bytes, num_handles)) =
1534 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1535 {
1536 let member_inline_size =
1537 <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1538 if inlined != (member_inline_size <= 4) {
1539 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1540 }
1541 let inner_offset;
1542 let mut inner_depth = depth.clone();
1543 if inlined {
1544 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1545 inner_offset = next_offset;
1546 } else {
1547 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1548 inner_depth.increment()?;
1549 }
1550 let val_ref = self.update.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
1551 fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
1552 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1553 {
1554 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1555 }
1556 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1557 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1558 }
1559 }
1560
1561 next_offset += envelope_size;
1562 _next_ordinal_to_read += 1;
1563 if next_offset >= end_offset {
1564 return Ok(());
1565 }
1566
1567 while _next_ordinal_to_read < 2 {
1569 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1570 _next_ordinal_to_read += 1;
1571 next_offset += envelope_size;
1572 }
1573
1574 let next_out_of_line = decoder.next_out_of_line();
1575 let handles_before = decoder.remaining_handles();
1576 if let Some((inlined, num_bytes, num_handles)) =
1577 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1578 {
1579 let member_inline_size =
1580 <InstallationDeferralReason as fidl::encoding::TypeMarker>::inline_size(
1581 decoder.context,
1582 );
1583 if inlined != (member_inline_size <= 4) {
1584 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1585 }
1586 let inner_offset;
1587 let mut inner_depth = depth.clone();
1588 if inlined {
1589 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1590 inner_offset = next_offset;
1591 } else {
1592 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1593 inner_depth.increment()?;
1594 }
1595 let val_ref = self
1596 .deferral_reason
1597 .get_or_insert_with(|| fidl::new_empty!(InstallationDeferralReason, D));
1598 fidl::decode!(
1599 InstallationDeferralReason,
1600 D,
1601 val_ref,
1602 decoder,
1603 inner_offset,
1604 inner_depth
1605 )?;
1606 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1607 {
1608 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1609 }
1610 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1611 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1612 }
1613 }
1614
1615 next_offset += envelope_size;
1616
1617 while next_offset < end_offset {
1619 _next_ordinal_to_read += 1;
1620 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1621 next_offset += envelope_size;
1622 }
1623
1624 Ok(())
1625 }
1626 }
1627
1628 impl InstallationErrorData {
1629 #[inline(always)]
1630 fn max_ordinal_present(&self) -> u64 {
1631 if let Some(_) = self.installation_progress {
1632 return 2;
1633 }
1634 if let Some(_) = self.update {
1635 return 1;
1636 }
1637 0
1638 }
1639 }
1640
1641 impl fidl::encoding::ValueTypeMarker for InstallationErrorData {
1642 type Borrowed<'a> = &'a Self;
1643 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1644 value
1645 }
1646 }
1647
1648 unsafe impl fidl::encoding::TypeMarker for InstallationErrorData {
1649 type Owned = Self;
1650
1651 #[inline(always)]
1652 fn inline_align(_context: fidl::encoding::Context) -> usize {
1653 8
1654 }
1655
1656 #[inline(always)]
1657 fn inline_size(_context: fidl::encoding::Context) -> usize {
1658 16
1659 }
1660 }
1661
1662 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InstallationErrorData, D>
1663 for &InstallationErrorData
1664 {
1665 unsafe fn encode(
1666 self,
1667 encoder: &mut fidl::encoding::Encoder<'_, D>,
1668 offset: usize,
1669 mut depth: fidl::encoding::Depth,
1670 ) -> fidl::Result<()> {
1671 encoder.debug_check_bounds::<InstallationErrorData>(offset);
1672 let max_ordinal: u64 = self.max_ordinal_present();
1674 encoder.write_num(max_ordinal, offset);
1675 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1676 if max_ordinal == 0 {
1678 return Ok(());
1679 }
1680 depth.increment()?;
1681 let envelope_size = 8;
1682 let bytes_len = max_ordinal as usize * envelope_size;
1683 #[allow(unused_variables)]
1684 let offset = encoder.out_of_line_offset(bytes_len);
1685 let mut _prev_end_offset: usize = 0;
1686 if 1 > max_ordinal {
1687 return Ok(());
1688 }
1689
1690 let cur_offset: usize = (1 - 1) * envelope_size;
1693
1694 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1696
1697 fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
1702 self.update.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
1703 encoder,
1704 offset + cur_offset,
1705 depth,
1706 )?;
1707
1708 _prev_end_offset = cur_offset + envelope_size;
1709 if 2 > max_ordinal {
1710 return Ok(());
1711 }
1712
1713 let cur_offset: usize = (2 - 1) * envelope_size;
1716
1717 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1719
1720 fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
1725 self.installation_progress
1726 .as_ref()
1727 .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
1728 encoder,
1729 offset + cur_offset,
1730 depth,
1731 )?;
1732
1733 _prev_end_offset = cur_offset + envelope_size;
1734
1735 Ok(())
1736 }
1737 }
1738
1739 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InstallationErrorData {
1740 #[inline(always)]
1741 fn new_empty() -> Self {
1742 Self::default()
1743 }
1744
1745 unsafe fn decode(
1746 &mut self,
1747 decoder: &mut fidl::encoding::Decoder<'_, D>,
1748 offset: usize,
1749 mut depth: fidl::encoding::Depth,
1750 ) -> fidl::Result<()> {
1751 decoder.debug_check_bounds::<Self>(offset);
1752 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1753 None => return Err(fidl::Error::NotNullable),
1754 Some(len) => len,
1755 };
1756 if len == 0 {
1758 return Ok(());
1759 };
1760 depth.increment()?;
1761 let envelope_size = 8;
1762 let bytes_len = len * envelope_size;
1763 let offset = decoder.out_of_line_offset(bytes_len)?;
1764 let mut _next_ordinal_to_read = 0;
1766 let mut next_offset = offset;
1767 let end_offset = offset + bytes_len;
1768 _next_ordinal_to_read += 1;
1769 if next_offset >= end_offset {
1770 return Ok(());
1771 }
1772
1773 while _next_ordinal_to_read < 1 {
1775 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1776 _next_ordinal_to_read += 1;
1777 next_offset += envelope_size;
1778 }
1779
1780 let next_out_of_line = decoder.next_out_of_line();
1781 let handles_before = decoder.remaining_handles();
1782 if let Some((inlined, num_bytes, num_handles)) =
1783 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1784 {
1785 let member_inline_size =
1786 <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1787 if inlined != (member_inline_size <= 4) {
1788 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1789 }
1790 let inner_offset;
1791 let mut inner_depth = depth.clone();
1792 if inlined {
1793 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1794 inner_offset = next_offset;
1795 } else {
1796 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1797 inner_depth.increment()?;
1798 }
1799 let val_ref = self.update.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
1800 fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
1801 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1802 {
1803 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1804 }
1805 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1806 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1807 }
1808 }
1809
1810 next_offset += envelope_size;
1811 _next_ordinal_to_read += 1;
1812 if next_offset >= end_offset {
1813 return Ok(());
1814 }
1815
1816 while _next_ordinal_to_read < 2 {
1818 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1819 _next_ordinal_to_read += 1;
1820 next_offset += envelope_size;
1821 }
1822
1823 let next_out_of_line = decoder.next_out_of_line();
1824 let handles_before = decoder.remaining_handles();
1825 if let Some((inlined, num_bytes, num_handles)) =
1826 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1827 {
1828 let member_inline_size =
1829 <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
1830 decoder.context,
1831 );
1832 if inlined != (member_inline_size <= 4) {
1833 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1834 }
1835 let inner_offset;
1836 let mut inner_depth = depth.clone();
1837 if inlined {
1838 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1839 inner_offset = next_offset;
1840 } else {
1841 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1842 inner_depth.increment()?;
1843 }
1844 let val_ref = self
1845 .installation_progress
1846 .get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
1847 fidl::decode!(
1848 InstallationProgress,
1849 D,
1850 val_ref,
1851 decoder,
1852 inner_offset,
1853 inner_depth
1854 )?;
1855 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1856 {
1857 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1858 }
1859 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1860 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1861 }
1862 }
1863
1864 next_offset += envelope_size;
1865
1866 while next_offset < end_offset {
1868 _next_ordinal_to_read += 1;
1869 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1870 next_offset += envelope_size;
1871 }
1872
1873 Ok(())
1874 }
1875 }
1876
1877 impl InstallationProgress {
1878 #[inline(always)]
1879 fn max_ordinal_present(&self) -> u64 {
1880 if let Some(_) = self.fraction_completed {
1881 return 1;
1882 }
1883 0
1884 }
1885 }
1886
1887 impl fidl::encoding::ValueTypeMarker for InstallationProgress {
1888 type Borrowed<'a> = &'a Self;
1889 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1890 value
1891 }
1892 }
1893
1894 unsafe impl fidl::encoding::TypeMarker for InstallationProgress {
1895 type Owned = Self;
1896
1897 #[inline(always)]
1898 fn inline_align(_context: fidl::encoding::Context) -> usize {
1899 8
1900 }
1901
1902 #[inline(always)]
1903 fn inline_size(_context: fidl::encoding::Context) -> usize {
1904 16
1905 }
1906 }
1907
1908 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InstallationProgress, D>
1909 for &InstallationProgress
1910 {
1911 unsafe fn encode(
1912 self,
1913 encoder: &mut fidl::encoding::Encoder<'_, D>,
1914 offset: usize,
1915 mut depth: fidl::encoding::Depth,
1916 ) -> fidl::Result<()> {
1917 encoder.debug_check_bounds::<InstallationProgress>(offset);
1918 let max_ordinal: u64 = self.max_ordinal_present();
1920 encoder.write_num(max_ordinal, offset);
1921 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1922 if max_ordinal == 0 {
1924 return Ok(());
1925 }
1926 depth.increment()?;
1927 let envelope_size = 8;
1928 let bytes_len = max_ordinal as usize * envelope_size;
1929 #[allow(unused_variables)]
1930 let offset = encoder.out_of_line_offset(bytes_len);
1931 let mut _prev_end_offset: usize = 0;
1932 if 1 > max_ordinal {
1933 return Ok(());
1934 }
1935
1936 let cur_offset: usize = (1 - 1) * envelope_size;
1939
1940 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1942
1943 fidl::encoding::encode_in_envelope_optional::<f32, D>(
1948 self.fraction_completed
1949 .as_ref()
1950 .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
1951 encoder,
1952 offset + cur_offset,
1953 depth,
1954 )?;
1955
1956 _prev_end_offset = cur_offset + envelope_size;
1957
1958 Ok(())
1959 }
1960 }
1961
1962 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InstallationProgress {
1963 #[inline(always)]
1964 fn new_empty() -> Self {
1965 Self::default()
1966 }
1967
1968 unsafe fn decode(
1969 &mut self,
1970 decoder: &mut fidl::encoding::Decoder<'_, D>,
1971 offset: usize,
1972 mut depth: fidl::encoding::Depth,
1973 ) -> fidl::Result<()> {
1974 decoder.debug_check_bounds::<Self>(offset);
1975 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1976 None => return Err(fidl::Error::NotNullable),
1977 Some(len) => len,
1978 };
1979 if len == 0 {
1981 return Ok(());
1982 };
1983 depth.increment()?;
1984 let envelope_size = 8;
1985 let bytes_len = len * envelope_size;
1986 let offset = decoder.out_of_line_offset(bytes_len)?;
1987 let mut _next_ordinal_to_read = 0;
1989 let mut next_offset = offset;
1990 let end_offset = offset + bytes_len;
1991 _next_ordinal_to_read += 1;
1992 if next_offset >= end_offset {
1993 return Ok(());
1994 }
1995
1996 while _next_ordinal_to_read < 1 {
1998 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1999 _next_ordinal_to_read += 1;
2000 next_offset += envelope_size;
2001 }
2002
2003 let next_out_of_line = decoder.next_out_of_line();
2004 let handles_before = decoder.remaining_handles();
2005 if let Some((inlined, num_bytes, num_handles)) =
2006 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2007 {
2008 let member_inline_size =
2009 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2010 if inlined != (member_inline_size <= 4) {
2011 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2012 }
2013 let inner_offset;
2014 let mut inner_depth = depth.clone();
2015 if inlined {
2016 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2017 inner_offset = next_offset;
2018 } else {
2019 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2020 inner_depth.increment()?;
2021 }
2022 let val_ref =
2023 self.fraction_completed.get_or_insert_with(|| fidl::new_empty!(f32, D));
2024 fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
2025 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2026 {
2027 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2028 }
2029 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2030 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2031 }
2032 }
2033
2034 next_offset += envelope_size;
2035
2036 while next_offset < end_offset {
2038 _next_ordinal_to_read += 1;
2039 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2040 next_offset += envelope_size;
2041 }
2042
2043 Ok(())
2044 }
2045 }
2046
2047 impl InstallingData {
2048 #[inline(always)]
2049 fn max_ordinal_present(&self) -> u64 {
2050 if let Some(_) = self.installation_progress {
2051 return 2;
2052 }
2053 if let Some(_) = self.update {
2054 return 1;
2055 }
2056 0
2057 }
2058 }
2059
2060 impl fidl::encoding::ValueTypeMarker for InstallingData {
2061 type Borrowed<'a> = &'a Self;
2062 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2063 value
2064 }
2065 }
2066
2067 unsafe impl fidl::encoding::TypeMarker for InstallingData {
2068 type Owned = Self;
2069
2070 #[inline(always)]
2071 fn inline_align(_context: fidl::encoding::Context) -> usize {
2072 8
2073 }
2074
2075 #[inline(always)]
2076 fn inline_size(_context: fidl::encoding::Context) -> usize {
2077 16
2078 }
2079 }
2080
2081 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InstallingData, D>
2082 for &InstallingData
2083 {
2084 unsafe fn encode(
2085 self,
2086 encoder: &mut fidl::encoding::Encoder<'_, D>,
2087 offset: usize,
2088 mut depth: fidl::encoding::Depth,
2089 ) -> fidl::Result<()> {
2090 encoder.debug_check_bounds::<InstallingData>(offset);
2091 let max_ordinal: u64 = self.max_ordinal_present();
2093 encoder.write_num(max_ordinal, offset);
2094 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2095 if max_ordinal == 0 {
2097 return Ok(());
2098 }
2099 depth.increment()?;
2100 let envelope_size = 8;
2101 let bytes_len = max_ordinal as usize * envelope_size;
2102 #[allow(unused_variables)]
2103 let offset = encoder.out_of_line_offset(bytes_len);
2104 let mut _prev_end_offset: usize = 0;
2105 if 1 > max_ordinal {
2106 return Ok(());
2107 }
2108
2109 let cur_offset: usize = (1 - 1) * envelope_size;
2112
2113 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2115
2116 fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
2121 self.update.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
2122 encoder,
2123 offset + cur_offset,
2124 depth,
2125 )?;
2126
2127 _prev_end_offset = cur_offset + envelope_size;
2128 if 2 > max_ordinal {
2129 return Ok(());
2130 }
2131
2132 let cur_offset: usize = (2 - 1) * envelope_size;
2135
2136 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2138
2139 fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
2144 self.installation_progress
2145 .as_ref()
2146 .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
2147 encoder,
2148 offset + cur_offset,
2149 depth,
2150 )?;
2151
2152 _prev_end_offset = cur_offset + envelope_size;
2153
2154 Ok(())
2155 }
2156 }
2157
2158 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InstallingData {
2159 #[inline(always)]
2160 fn new_empty() -> Self {
2161 Self::default()
2162 }
2163
2164 unsafe fn decode(
2165 &mut self,
2166 decoder: &mut fidl::encoding::Decoder<'_, D>,
2167 offset: usize,
2168 mut depth: fidl::encoding::Depth,
2169 ) -> fidl::Result<()> {
2170 decoder.debug_check_bounds::<Self>(offset);
2171 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2172 None => return Err(fidl::Error::NotNullable),
2173 Some(len) => len,
2174 };
2175 if len == 0 {
2177 return Ok(());
2178 };
2179 depth.increment()?;
2180 let envelope_size = 8;
2181 let bytes_len = len * envelope_size;
2182 let offset = decoder.out_of_line_offset(bytes_len)?;
2183 let mut _next_ordinal_to_read = 0;
2185 let mut next_offset = offset;
2186 let end_offset = offset + bytes_len;
2187 _next_ordinal_to_read += 1;
2188 if next_offset >= end_offset {
2189 return Ok(());
2190 }
2191
2192 while _next_ordinal_to_read < 1 {
2194 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2195 _next_ordinal_to_read += 1;
2196 next_offset += envelope_size;
2197 }
2198
2199 let next_out_of_line = decoder.next_out_of_line();
2200 let handles_before = decoder.remaining_handles();
2201 if let Some((inlined, num_bytes, num_handles)) =
2202 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2203 {
2204 let member_inline_size =
2205 <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2206 if inlined != (member_inline_size <= 4) {
2207 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2208 }
2209 let inner_offset;
2210 let mut inner_depth = depth.clone();
2211 if inlined {
2212 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2213 inner_offset = next_offset;
2214 } else {
2215 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2216 inner_depth.increment()?;
2217 }
2218 let val_ref = self.update.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
2219 fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
2220 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2221 {
2222 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2223 }
2224 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2225 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2226 }
2227 }
2228
2229 next_offset += envelope_size;
2230 _next_ordinal_to_read += 1;
2231 if next_offset >= end_offset {
2232 return Ok(());
2233 }
2234
2235 while _next_ordinal_to_read < 2 {
2237 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2238 _next_ordinal_to_read += 1;
2239 next_offset += envelope_size;
2240 }
2241
2242 let next_out_of_line = decoder.next_out_of_line();
2243 let handles_before = decoder.remaining_handles();
2244 if let Some((inlined, num_bytes, num_handles)) =
2245 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2246 {
2247 let member_inline_size =
2248 <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
2249 decoder.context,
2250 );
2251 if inlined != (member_inline_size <= 4) {
2252 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2253 }
2254 let inner_offset;
2255 let mut inner_depth = depth.clone();
2256 if inlined {
2257 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2258 inner_offset = next_offset;
2259 } else {
2260 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2261 inner_depth.increment()?;
2262 }
2263 let val_ref = self
2264 .installation_progress
2265 .get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
2266 fidl::decode!(
2267 InstallationProgress,
2268 D,
2269 val_ref,
2270 decoder,
2271 inner_offset,
2272 inner_depth
2273 )?;
2274 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2275 {
2276 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2277 }
2278 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2279 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2280 }
2281 }
2282
2283 next_offset += envelope_size;
2284
2285 while next_offset < end_offset {
2287 _next_ordinal_to_read += 1;
2288 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2289 next_offset += envelope_size;
2290 }
2291
2292 Ok(())
2293 }
2294 }
2295
2296 impl NoUpdateAvailableData {
2297 #[inline(always)]
2298 fn max_ordinal_present(&self) -> u64 {
2299 0
2300 }
2301 }
2302
2303 impl fidl::encoding::ValueTypeMarker for NoUpdateAvailableData {
2304 type Borrowed<'a> = &'a Self;
2305 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2306 value
2307 }
2308 }
2309
2310 unsafe impl fidl::encoding::TypeMarker for NoUpdateAvailableData {
2311 type Owned = Self;
2312
2313 #[inline(always)]
2314 fn inline_align(_context: fidl::encoding::Context) -> usize {
2315 8
2316 }
2317
2318 #[inline(always)]
2319 fn inline_size(_context: fidl::encoding::Context) -> usize {
2320 16
2321 }
2322 }
2323
2324 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NoUpdateAvailableData, D>
2325 for &NoUpdateAvailableData
2326 {
2327 unsafe fn encode(
2328 self,
2329 encoder: &mut fidl::encoding::Encoder<'_, D>,
2330 offset: usize,
2331 mut depth: fidl::encoding::Depth,
2332 ) -> fidl::Result<()> {
2333 encoder.debug_check_bounds::<NoUpdateAvailableData>(offset);
2334 let max_ordinal: u64 = self.max_ordinal_present();
2336 encoder.write_num(max_ordinal, offset);
2337 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2338 if max_ordinal == 0 {
2340 return Ok(());
2341 }
2342 depth.increment()?;
2343 let envelope_size = 8;
2344 let bytes_len = max_ordinal as usize * envelope_size;
2345 #[allow(unused_variables)]
2346 let offset = encoder.out_of_line_offset(bytes_len);
2347 let mut _prev_end_offset: usize = 0;
2348
2349 Ok(())
2350 }
2351 }
2352
2353 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NoUpdateAvailableData {
2354 #[inline(always)]
2355 fn new_empty() -> Self {
2356 Self::default()
2357 }
2358
2359 unsafe fn decode(
2360 &mut self,
2361 decoder: &mut fidl::encoding::Decoder<'_, D>,
2362 offset: usize,
2363 mut depth: fidl::encoding::Depth,
2364 ) -> fidl::Result<()> {
2365 decoder.debug_check_bounds::<Self>(offset);
2366 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2367 None => return Err(fidl::Error::NotNullable),
2368 Some(len) => len,
2369 };
2370 if len == 0 {
2372 return Ok(());
2373 };
2374 depth.increment()?;
2375 let envelope_size = 8;
2376 let bytes_len = len * envelope_size;
2377 let offset = decoder.out_of_line_offset(bytes_len)?;
2378 let mut _next_ordinal_to_read = 0;
2380 let mut next_offset = offset;
2381 let end_offset = offset + bytes_len;
2382
2383 while next_offset < end_offset {
2385 _next_ordinal_to_read += 1;
2386 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2387 next_offset += envelope_size;
2388 }
2389
2390 Ok(())
2391 }
2392 }
2393
2394 impl UpdateInfo {
2395 #[inline(always)]
2396 fn max_ordinal_present(&self) -> u64 {
2397 if let Some(_) = self.urgent {
2398 return 3;
2399 }
2400 if let Some(_) = self.download_size {
2401 return 2;
2402 }
2403 if let Some(_) = self.version_available {
2404 return 1;
2405 }
2406 0
2407 }
2408 }
2409
2410 impl fidl::encoding::ValueTypeMarker for UpdateInfo {
2411 type Borrowed<'a> = &'a Self;
2412 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2413 value
2414 }
2415 }
2416
2417 unsafe impl fidl::encoding::TypeMarker for UpdateInfo {
2418 type Owned = Self;
2419
2420 #[inline(always)]
2421 fn inline_align(_context: fidl::encoding::Context) -> usize {
2422 8
2423 }
2424
2425 #[inline(always)]
2426 fn inline_size(_context: fidl::encoding::Context) -> usize {
2427 16
2428 }
2429 }
2430
2431 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UpdateInfo, D>
2432 for &UpdateInfo
2433 {
2434 unsafe fn encode(
2435 self,
2436 encoder: &mut fidl::encoding::Encoder<'_, D>,
2437 offset: usize,
2438 mut depth: fidl::encoding::Depth,
2439 ) -> fidl::Result<()> {
2440 encoder.debug_check_bounds::<UpdateInfo>(offset);
2441 let max_ordinal: u64 = self.max_ordinal_present();
2443 encoder.write_num(max_ordinal, offset);
2444 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2445 if max_ordinal == 0 {
2447 return Ok(());
2448 }
2449 depth.increment()?;
2450 let envelope_size = 8;
2451 let bytes_len = max_ordinal as usize * envelope_size;
2452 #[allow(unused_variables)]
2453 let offset = encoder.out_of_line_offset(bytes_len);
2454 let mut _prev_end_offset: usize = 0;
2455 if 1 > max_ordinal {
2456 return Ok(());
2457 }
2458
2459 let cur_offset: usize = (1 - 1) * envelope_size;
2462
2463 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2465
2466 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<128>, D>(
2471 self.version_available.as_ref().map(
2472 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
2473 ),
2474 encoder,
2475 offset + cur_offset,
2476 depth,
2477 )?;
2478
2479 _prev_end_offset = cur_offset + envelope_size;
2480 if 2 > max_ordinal {
2481 return Ok(());
2482 }
2483
2484 let cur_offset: usize = (2 - 1) * envelope_size;
2487
2488 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2490
2491 fidl::encoding::encode_in_envelope_optional::<u64, D>(
2496 self.download_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2497 encoder,
2498 offset + cur_offset,
2499 depth,
2500 )?;
2501
2502 _prev_end_offset = cur_offset + envelope_size;
2503 if 3 > max_ordinal {
2504 return Ok(());
2505 }
2506
2507 let cur_offset: usize = (3 - 1) * envelope_size;
2510
2511 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2513
2514 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2519 self.urgent.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2520 encoder,
2521 offset + cur_offset,
2522 depth,
2523 )?;
2524
2525 _prev_end_offset = cur_offset + envelope_size;
2526
2527 Ok(())
2528 }
2529 }
2530
2531 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UpdateInfo {
2532 #[inline(always)]
2533 fn new_empty() -> Self {
2534 Self::default()
2535 }
2536
2537 unsafe fn decode(
2538 &mut self,
2539 decoder: &mut fidl::encoding::Decoder<'_, D>,
2540 offset: usize,
2541 mut depth: fidl::encoding::Depth,
2542 ) -> fidl::Result<()> {
2543 decoder.debug_check_bounds::<Self>(offset);
2544 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2545 None => return Err(fidl::Error::NotNullable),
2546 Some(len) => len,
2547 };
2548 if len == 0 {
2550 return Ok(());
2551 };
2552 depth.increment()?;
2553 let envelope_size = 8;
2554 let bytes_len = len * envelope_size;
2555 let offset = decoder.out_of_line_offset(bytes_len)?;
2556 let mut _next_ordinal_to_read = 0;
2558 let mut next_offset = offset;
2559 let end_offset = offset + bytes_len;
2560 _next_ordinal_to_read += 1;
2561 if next_offset >= end_offset {
2562 return Ok(());
2563 }
2564
2565 while _next_ordinal_to_read < 1 {
2567 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2568 _next_ordinal_to_read += 1;
2569 next_offset += envelope_size;
2570 }
2571
2572 let next_out_of_line = decoder.next_out_of_line();
2573 let handles_before = decoder.remaining_handles();
2574 if let Some((inlined, num_bytes, num_handles)) =
2575 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2576 {
2577 let member_inline_size =
2578 <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
2579 decoder.context,
2580 );
2581 if inlined != (member_inline_size <= 4) {
2582 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2583 }
2584 let inner_offset;
2585 let mut inner_depth = depth.clone();
2586 if inlined {
2587 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2588 inner_offset = next_offset;
2589 } else {
2590 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2591 inner_depth.increment()?;
2592 }
2593 let val_ref = self
2594 .version_available
2595 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<128>, D));
2596 fidl::decode!(
2597 fidl::encoding::BoundedString<128>,
2598 D,
2599 val_ref,
2600 decoder,
2601 inner_offset,
2602 inner_depth
2603 )?;
2604 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2605 {
2606 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2607 }
2608 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2609 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2610 }
2611 }
2612
2613 next_offset += envelope_size;
2614 _next_ordinal_to_read += 1;
2615 if next_offset >= end_offset {
2616 return Ok(());
2617 }
2618
2619 while _next_ordinal_to_read < 2 {
2621 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2622 _next_ordinal_to_read += 1;
2623 next_offset += envelope_size;
2624 }
2625
2626 let next_out_of_line = decoder.next_out_of_line();
2627 let handles_before = decoder.remaining_handles();
2628 if let Some((inlined, num_bytes, num_handles)) =
2629 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2630 {
2631 let member_inline_size =
2632 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2633 if inlined != (member_inline_size <= 4) {
2634 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2635 }
2636 let inner_offset;
2637 let mut inner_depth = depth.clone();
2638 if inlined {
2639 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2640 inner_offset = next_offset;
2641 } else {
2642 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2643 inner_depth.increment()?;
2644 }
2645 let val_ref = self.download_size.get_or_insert_with(|| fidl::new_empty!(u64, D));
2646 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2647 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2648 {
2649 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2650 }
2651 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2652 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2653 }
2654 }
2655
2656 next_offset += envelope_size;
2657 _next_ordinal_to_read += 1;
2658 if next_offset >= end_offset {
2659 return Ok(());
2660 }
2661
2662 while _next_ordinal_to_read < 3 {
2664 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2665 _next_ordinal_to_read += 1;
2666 next_offset += envelope_size;
2667 }
2668
2669 let next_out_of_line = decoder.next_out_of_line();
2670 let handles_before = decoder.remaining_handles();
2671 if let Some((inlined, num_bytes, num_handles)) =
2672 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2673 {
2674 let member_inline_size =
2675 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2676 if inlined != (member_inline_size <= 4) {
2677 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2678 }
2679 let inner_offset;
2680 let mut inner_depth = depth.clone();
2681 if inlined {
2682 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2683 inner_offset = next_offset;
2684 } else {
2685 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2686 inner_depth.increment()?;
2687 }
2688 let val_ref = self.urgent.get_or_insert_with(|| fidl::new_empty!(bool, D));
2689 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2690 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2691 {
2692 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2693 }
2694 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2695 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2696 }
2697 }
2698
2699 next_offset += envelope_size;
2700
2701 while next_offset < end_offset {
2703 _next_ordinal_to_read += 1;
2704 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2705 next_offset += envelope_size;
2706 }
2707
2708 Ok(())
2709 }
2710 }
2711
2712 impl fidl::encoding::ValueTypeMarker for State {
2713 type Borrowed<'a> = &'a Self;
2714 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2715 value
2716 }
2717 }
2718
2719 unsafe impl fidl::encoding::TypeMarker for State {
2720 type Owned = Self;
2721
2722 #[inline(always)]
2723 fn inline_align(_context: fidl::encoding::Context) -> usize {
2724 8
2725 }
2726
2727 #[inline(always)]
2728 fn inline_size(_context: fidl::encoding::Context) -> usize {
2729 16
2730 }
2731 }
2732
2733 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<State, D> for &State {
2734 #[inline]
2735 unsafe fn encode(
2736 self,
2737 encoder: &mut fidl::encoding::Encoder<'_, D>,
2738 offset: usize,
2739 _depth: fidl::encoding::Depth,
2740 ) -> fidl::Result<()> {
2741 encoder.debug_check_bounds::<State>(offset);
2742 encoder.write_num::<u64>(self.ordinal(), offset);
2743 match self {
2744 State::CheckingForUpdates(ref val) => {
2745 fidl::encoding::encode_in_envelope::<CheckingForUpdatesData, D>(
2746 <CheckingForUpdatesData as fidl::encoding::ValueTypeMarker>::borrow(val),
2747 encoder,
2748 offset + 8,
2749 _depth,
2750 )
2751 }
2752 State::ErrorCheckingForUpdate(ref val) => fidl::encoding::encode_in_envelope::<
2753 ErrorCheckingForUpdateData,
2754 D,
2755 >(
2756 <ErrorCheckingForUpdateData as fidl::encoding::ValueTypeMarker>::borrow(val),
2757 encoder,
2758 offset + 8,
2759 _depth,
2760 ),
2761 State::NoUpdateAvailable(ref val) => {
2762 fidl::encoding::encode_in_envelope::<NoUpdateAvailableData, D>(
2763 <NoUpdateAvailableData as fidl::encoding::ValueTypeMarker>::borrow(val),
2764 encoder,
2765 offset + 8,
2766 _depth,
2767 )
2768 }
2769 State::InstallationDeferredByPolicy(ref val) => {
2770 fidl::encoding::encode_in_envelope::<InstallationDeferredData, D>(
2771 <InstallationDeferredData as fidl::encoding::ValueTypeMarker>::borrow(val),
2772 encoder,
2773 offset + 8,
2774 _depth,
2775 )
2776 }
2777 State::InstallingUpdate(ref val) => {
2778 fidl::encoding::encode_in_envelope::<InstallingData, D>(
2779 <InstallingData as fidl::encoding::ValueTypeMarker>::borrow(val),
2780 encoder,
2781 offset + 8,
2782 _depth,
2783 )
2784 }
2785 State::WaitingForReboot(ref val) => {
2786 fidl::encoding::encode_in_envelope::<InstallingData, D>(
2787 <InstallingData as fidl::encoding::ValueTypeMarker>::borrow(val),
2788 encoder,
2789 offset + 8,
2790 _depth,
2791 )
2792 }
2793 State::InstallationError(ref val) => {
2794 fidl::encoding::encode_in_envelope::<InstallationErrorData, D>(
2795 <InstallationErrorData as fidl::encoding::ValueTypeMarker>::borrow(val),
2796 encoder,
2797 offset + 8,
2798 _depth,
2799 )
2800 }
2801 }
2802 }
2803 }
2804
2805 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for State {
2806 #[inline(always)]
2807 fn new_empty() -> Self {
2808 Self::CheckingForUpdates(fidl::new_empty!(CheckingForUpdatesData, D))
2809 }
2810
2811 #[inline]
2812 unsafe fn decode(
2813 &mut self,
2814 decoder: &mut fidl::encoding::Decoder<'_, D>,
2815 offset: usize,
2816 mut depth: fidl::encoding::Depth,
2817 ) -> fidl::Result<()> {
2818 decoder.debug_check_bounds::<Self>(offset);
2819 #[allow(unused_variables)]
2820 let next_out_of_line = decoder.next_out_of_line();
2821 let handles_before = decoder.remaining_handles();
2822 let (ordinal, inlined, num_bytes, num_handles) =
2823 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2824
2825 let member_inline_size = match ordinal {
2826 1 => <CheckingForUpdatesData as fidl::encoding::TypeMarker>::inline_size(
2827 decoder.context,
2828 ),
2829 2 => <ErrorCheckingForUpdateData as fidl::encoding::TypeMarker>::inline_size(
2830 decoder.context,
2831 ),
2832 3 => <NoUpdateAvailableData as fidl::encoding::TypeMarker>::inline_size(
2833 decoder.context,
2834 ),
2835 4 => <InstallationDeferredData as fidl::encoding::TypeMarker>::inline_size(
2836 decoder.context,
2837 ),
2838 5 => <InstallingData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2839 6 => <InstallingData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2840 7 => <InstallationErrorData as fidl::encoding::TypeMarker>::inline_size(
2841 decoder.context,
2842 ),
2843 _ => return Err(fidl::Error::UnknownUnionTag),
2844 };
2845
2846 if inlined != (member_inline_size <= 4) {
2847 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2848 }
2849 let _inner_offset;
2850 if inlined {
2851 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2852 _inner_offset = offset + 8;
2853 } else {
2854 depth.increment()?;
2855 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2856 }
2857 match ordinal {
2858 1 => {
2859 #[allow(irrefutable_let_patterns)]
2860 if let State::CheckingForUpdates(_) = self {
2861 } else {
2863 *self =
2865 State::CheckingForUpdates(fidl::new_empty!(CheckingForUpdatesData, D));
2866 }
2867 #[allow(irrefutable_let_patterns)]
2868 if let State::CheckingForUpdates(ref mut val) = self {
2869 fidl::decode!(
2870 CheckingForUpdatesData,
2871 D,
2872 val,
2873 decoder,
2874 _inner_offset,
2875 depth
2876 )?;
2877 } else {
2878 unreachable!()
2879 }
2880 }
2881 2 => {
2882 #[allow(irrefutable_let_patterns)]
2883 if let State::ErrorCheckingForUpdate(_) = self {
2884 } else {
2886 *self = State::ErrorCheckingForUpdate(fidl::new_empty!(
2888 ErrorCheckingForUpdateData,
2889 D
2890 ));
2891 }
2892 #[allow(irrefutable_let_patterns)]
2893 if let State::ErrorCheckingForUpdate(ref mut val) = self {
2894 fidl::decode!(
2895 ErrorCheckingForUpdateData,
2896 D,
2897 val,
2898 decoder,
2899 _inner_offset,
2900 depth
2901 )?;
2902 } else {
2903 unreachable!()
2904 }
2905 }
2906 3 => {
2907 #[allow(irrefutable_let_patterns)]
2908 if let State::NoUpdateAvailable(_) = self {
2909 } else {
2911 *self =
2913 State::NoUpdateAvailable(fidl::new_empty!(NoUpdateAvailableData, D));
2914 }
2915 #[allow(irrefutable_let_patterns)]
2916 if let State::NoUpdateAvailable(ref mut val) = self {
2917 fidl::decode!(
2918 NoUpdateAvailableData,
2919 D,
2920 val,
2921 decoder,
2922 _inner_offset,
2923 depth
2924 )?;
2925 } else {
2926 unreachable!()
2927 }
2928 }
2929 4 => {
2930 #[allow(irrefutable_let_patterns)]
2931 if let State::InstallationDeferredByPolicy(_) = self {
2932 } else {
2934 *self = State::InstallationDeferredByPolicy(fidl::new_empty!(
2936 InstallationDeferredData,
2937 D
2938 ));
2939 }
2940 #[allow(irrefutable_let_patterns)]
2941 if let State::InstallationDeferredByPolicy(ref mut val) = self {
2942 fidl::decode!(
2943 InstallationDeferredData,
2944 D,
2945 val,
2946 decoder,
2947 _inner_offset,
2948 depth
2949 )?;
2950 } else {
2951 unreachable!()
2952 }
2953 }
2954 5 => {
2955 #[allow(irrefutable_let_patterns)]
2956 if let State::InstallingUpdate(_) = self {
2957 } else {
2959 *self = State::InstallingUpdate(fidl::new_empty!(InstallingData, D));
2961 }
2962 #[allow(irrefutable_let_patterns)]
2963 if let State::InstallingUpdate(ref mut val) = self {
2964 fidl::decode!(InstallingData, D, val, decoder, _inner_offset, depth)?;
2965 } else {
2966 unreachable!()
2967 }
2968 }
2969 6 => {
2970 #[allow(irrefutable_let_patterns)]
2971 if let State::WaitingForReboot(_) = self {
2972 } else {
2974 *self = State::WaitingForReboot(fidl::new_empty!(InstallingData, D));
2976 }
2977 #[allow(irrefutable_let_patterns)]
2978 if let State::WaitingForReboot(ref mut val) = self {
2979 fidl::decode!(InstallingData, D, val, decoder, _inner_offset, depth)?;
2980 } else {
2981 unreachable!()
2982 }
2983 }
2984 7 => {
2985 #[allow(irrefutable_let_patterns)]
2986 if let State::InstallationError(_) = self {
2987 } else {
2989 *self =
2991 State::InstallationError(fidl::new_empty!(InstallationErrorData, D));
2992 }
2993 #[allow(irrefutable_let_patterns)]
2994 if let State::InstallationError(ref mut val) = self {
2995 fidl::decode!(
2996 InstallationErrorData,
2997 D,
2998 val,
2999 decoder,
3000 _inner_offset,
3001 depth
3002 )?;
3003 } else {
3004 unreachable!()
3005 }
3006 }
3007 ordinal => panic!("unexpected ordinal {:?}", ordinal),
3008 }
3009 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3010 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3011 }
3012 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3013 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3014 }
3015 Ok(())
3016 }
3017 }
3018}