fidl_cf_sc_internal_pkgcacheconfig_common/
fidl_cf_sc_internal_pkgcacheconfig_common.rs1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13 pub all_packages_executable: bool,
14 pub enable_upgradable_packages: bool,
15 pub use_fxblob: bool,
16 pub use_system_image: bool,
17}
18
19impl fidl::Persistable for Config {}
20
21mod internal {
22 use super::*;
23
24 impl fidl::encoding::ValueTypeMarker for Config {
25 type Borrowed<'a> = &'a Self;
26 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
27 value
28 }
29 }
30
31 unsafe impl fidl::encoding::TypeMarker for Config {
32 type Owned = Self;
33
34 #[inline(always)]
35 fn inline_align(_context: fidl::encoding::Context) -> usize {
36 1
37 }
38
39 #[inline(always)]
40 fn inline_size(_context: fidl::encoding::Context) -> usize {
41 4
42 }
43 }
44
45 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
46 #[inline]
47 unsafe fn encode(
48 self,
49 encoder: &mut fidl::encoding::Encoder<'_, D>,
50 offset: usize,
51 _depth: fidl::encoding::Depth,
52 ) -> fidl::Result<()> {
53 encoder.debug_check_bounds::<Config>(offset);
54 fidl::encoding::Encode::<Config, D>::encode(
56 (
57 <bool as fidl::encoding::ValueTypeMarker>::borrow(
58 &self.all_packages_executable,
59 ),
60 <bool as fidl::encoding::ValueTypeMarker>::borrow(
61 &self.enable_upgradable_packages,
62 ),
63 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.use_fxblob),
64 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.use_system_image),
65 ),
66 encoder,
67 offset,
68 _depth,
69 )
70 }
71 }
72 unsafe impl<
73 D: fidl::encoding::ResourceDialect,
74 T0: fidl::encoding::Encode<bool, D>,
75 T1: fidl::encoding::Encode<bool, D>,
76 T2: fidl::encoding::Encode<bool, D>,
77 T3: fidl::encoding::Encode<bool, D>,
78 > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3)
79 {
80 #[inline]
81 unsafe fn encode(
82 self,
83 encoder: &mut fidl::encoding::Encoder<'_, D>,
84 offset: usize,
85 depth: fidl::encoding::Depth,
86 ) -> fidl::Result<()> {
87 encoder.debug_check_bounds::<Config>(offset);
88 self.0.encode(encoder, offset + 0, depth)?;
92 self.1.encode(encoder, offset + 1, depth)?;
93 self.2.encode(encoder, offset + 2, depth)?;
94 self.3.encode(encoder, offset + 3, depth)?;
95 Ok(())
96 }
97 }
98
99 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
100 #[inline(always)]
101 fn new_empty() -> Self {
102 Self {
103 all_packages_executable: fidl::new_empty!(bool, D),
104 enable_upgradable_packages: fidl::new_empty!(bool, D),
105 use_fxblob: fidl::new_empty!(bool, D),
106 use_system_image: fidl::new_empty!(bool, D),
107 }
108 }
109
110 #[inline]
111 unsafe fn decode(
112 &mut self,
113 decoder: &mut fidl::encoding::Decoder<'_, D>,
114 offset: usize,
115 _depth: fidl::encoding::Depth,
116 ) -> fidl::Result<()> {
117 decoder.debug_check_bounds::<Self>(offset);
118 fidl::decode!(bool, D, &mut self.all_packages_executable, decoder, offset + 0, _depth)?;
120 fidl::decode!(
121 bool,
122 D,
123 &mut self.enable_upgradable_packages,
124 decoder,
125 offset + 1,
126 _depth
127 )?;
128 fidl::decode!(bool, D, &mut self.use_fxblob, decoder, offset + 2, _depth)?;
129 fidl::decode!(bool, D, &mut self.use_system_image, decoder, offset + 3, _depth)?;
130 Ok(())
131 }
132 }
133}