fidl_cf_sc_internal_pkgcacheconfig__common/
fidl_cf_sc_internal_pkgcacheconfig__common.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::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_system_image: bool,
16}
17
18impl fidl::Persistable for Config {}
19
20mod internal {
21    use super::*;
22
23    impl fidl::encoding::ValueTypeMarker for Config {
24        type Borrowed<'a> = &'a Self;
25        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
26            value
27        }
28    }
29
30    unsafe impl fidl::encoding::TypeMarker for Config {
31        type Owned = Self;
32
33        #[inline(always)]
34        fn inline_align(_context: fidl::encoding::Context) -> usize {
35            1
36        }
37
38        #[inline(always)]
39        fn inline_size(_context: fidl::encoding::Context) -> usize {
40            3
41        }
42    }
43
44    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
45        #[inline]
46        unsafe fn encode(
47            self,
48            encoder: &mut fidl::encoding::Encoder<'_, D>,
49            offset: usize,
50            _depth: fidl::encoding::Depth,
51        ) -> fidl::Result<()> {
52            encoder.debug_check_bounds::<Config>(offset);
53            // Delegate to tuple encoding.
54            fidl::encoding::Encode::<Config, D>::encode(
55                (
56                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
57                        &self.all_packages_executable,
58                    ),
59                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
60                        &self.enable_upgradable_packages,
61                    ),
62                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.use_system_image),
63                ),
64                encoder,
65                offset,
66                _depth,
67            )
68        }
69    }
70    unsafe impl<
71            D: fidl::encoding::ResourceDialect,
72            T0: fidl::encoding::Encode<bool, D>,
73            T1: fidl::encoding::Encode<bool, D>,
74            T2: fidl::encoding::Encode<bool, D>,
75        > fidl::encoding::Encode<Config, D> for (T0, T1, T2)
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::<Config>(offset);
85            // Zero out padding regions. There's no need to apply masks
86            // because the unmasked parts will be overwritten by fields.
87            // Write the fields.
88            self.0.encode(encoder, offset + 0, depth)?;
89            self.1.encode(encoder, offset + 1, depth)?;
90            self.2.encode(encoder, offset + 2, depth)?;
91            Ok(())
92        }
93    }
94
95    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
96        #[inline(always)]
97        fn new_empty() -> Self {
98            Self {
99                all_packages_executable: fidl::new_empty!(bool, D),
100                enable_upgradable_packages: fidl::new_empty!(bool, D),
101                use_system_image: fidl::new_empty!(bool, D),
102            }
103        }
104
105        #[inline]
106        unsafe fn decode(
107            &mut self,
108            decoder: &mut fidl::encoding::Decoder<'_, D>,
109            offset: usize,
110            _depth: fidl::encoding::Depth,
111        ) -> fidl::Result<()> {
112            decoder.debug_check_bounds::<Self>(offset);
113            // Verify that padding bytes are zero.
114            fidl::decode!(bool, D, &mut self.all_packages_executable, decoder, offset + 0, _depth)?;
115            fidl::decode!(
116                bool,
117                D,
118                &mut self.enable_upgradable_packages,
119                decoder,
120                offset + 1,
121                _depth
122            )?;
123            fidl::decode!(bool, D, &mut self.use_system_image, decoder, offset + 2, _depth)?;
124            Ok(())
125        }
126    }
127}