fidl_cf_sc_internal_pkgcacheconfig/
fidl_cf_sc_internal_pkgcacheconfig.rs

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