fidl_cf_sc_internal_hfphandsfreeprofileconfig_common/
fidl_cf_sc_internal_hfphandsfreeprofileconfig_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 call_waiting_or_three_way_calling: bool,
14    pub cli_presentation_capability: bool,
15    pub ec_or_nr: bool,
16    pub enhanced_voice_recognition: bool,
17    pub enhanced_voice_recognition_with_text: bool,
18    pub remote_volume_control: bool,
19    pub voice_recognition_activation: bool,
20    pub wide_band_speech: bool,
21}
22
23impl fidl::Persistable for Config {}
24
25mod internal {
26    use super::*;
27
28    impl fidl::encoding::ValueTypeMarker for Config {
29        type Borrowed<'a> = &'a Self;
30        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
31            value
32        }
33    }
34
35    unsafe impl fidl::encoding::TypeMarker for Config {
36        type Owned = Self;
37
38        #[inline(always)]
39        fn inline_align(_context: fidl::encoding::Context) -> usize {
40            1
41        }
42
43        #[inline(always)]
44        fn inline_size(_context: fidl::encoding::Context) -> usize {
45            8
46        }
47    }
48
49    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
50        #[inline]
51        unsafe fn encode(
52            self,
53            encoder: &mut fidl::encoding::Encoder<'_, D>,
54            offset: usize,
55            _depth: fidl::encoding::Depth,
56        ) -> fidl::Result<()> {
57            encoder.debug_check_bounds::<Config>(offset);
58            // Delegate to tuple encoding.
59            fidl::encoding::Encode::<Config, D>::encode(
60                (
61                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
62                        &self.call_waiting_or_three_way_calling,
63                    ),
64                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
65                        &self.cli_presentation_capability,
66                    ),
67                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.ec_or_nr),
68                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
69                        &self.enhanced_voice_recognition,
70                    ),
71                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
72                        &self.enhanced_voice_recognition_with_text,
73                    ),
74                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_volume_control),
75                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
76                        &self.voice_recognition_activation,
77                    ),
78                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.wide_band_speech),
79                ),
80                encoder,
81                offset,
82                _depth,
83            )
84        }
85    }
86    unsafe impl<
87            D: fidl::encoding::ResourceDialect,
88            T0: fidl::encoding::Encode<bool, D>,
89            T1: fidl::encoding::Encode<bool, D>,
90            T2: fidl::encoding::Encode<bool, D>,
91            T3: fidl::encoding::Encode<bool, D>,
92            T4: fidl::encoding::Encode<bool, D>,
93            T5: fidl::encoding::Encode<bool, D>,
94            T6: fidl::encoding::Encode<bool, D>,
95            T7: fidl::encoding::Encode<bool, D>,
96        > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
97    {
98        #[inline]
99        unsafe fn encode(
100            self,
101            encoder: &mut fidl::encoding::Encoder<'_, D>,
102            offset: usize,
103            depth: fidl::encoding::Depth,
104        ) -> fidl::Result<()> {
105            encoder.debug_check_bounds::<Config>(offset);
106            // Zero out padding regions. There's no need to apply masks
107            // because the unmasked parts will be overwritten by fields.
108            // Write the fields.
109            self.0.encode(encoder, offset + 0, depth)?;
110            self.1.encode(encoder, offset + 1, depth)?;
111            self.2.encode(encoder, offset + 2, depth)?;
112            self.3.encode(encoder, offset + 3, depth)?;
113            self.4.encode(encoder, offset + 4, depth)?;
114            self.5.encode(encoder, offset + 5, depth)?;
115            self.6.encode(encoder, offset + 6, depth)?;
116            self.7.encode(encoder, offset + 7, depth)?;
117            Ok(())
118        }
119    }
120
121    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
122        #[inline(always)]
123        fn new_empty() -> Self {
124            Self {
125                call_waiting_or_three_way_calling: fidl::new_empty!(bool, D),
126                cli_presentation_capability: fidl::new_empty!(bool, D),
127                ec_or_nr: fidl::new_empty!(bool, D),
128                enhanced_voice_recognition: fidl::new_empty!(bool, D),
129                enhanced_voice_recognition_with_text: fidl::new_empty!(bool, D),
130                remote_volume_control: fidl::new_empty!(bool, D),
131                voice_recognition_activation: fidl::new_empty!(bool, D),
132                wide_band_speech: fidl::new_empty!(bool, D),
133            }
134        }
135
136        #[inline]
137        unsafe fn decode(
138            &mut self,
139            decoder: &mut fidl::encoding::Decoder<'_, D>,
140            offset: usize,
141            _depth: fidl::encoding::Depth,
142        ) -> fidl::Result<()> {
143            decoder.debug_check_bounds::<Self>(offset);
144            // Verify that padding bytes are zero.
145            fidl::decode!(
146                bool,
147                D,
148                &mut self.call_waiting_or_three_way_calling,
149                decoder,
150                offset + 0,
151                _depth
152            )?;
153            fidl::decode!(
154                bool,
155                D,
156                &mut self.cli_presentation_capability,
157                decoder,
158                offset + 1,
159                _depth
160            )?;
161            fidl::decode!(bool, D, &mut self.ec_or_nr, decoder, offset + 2, _depth)?;
162            fidl::decode!(
163                bool,
164                D,
165                &mut self.enhanced_voice_recognition,
166                decoder,
167                offset + 3,
168                _depth
169            )?;
170            fidl::decode!(
171                bool,
172                D,
173                &mut self.enhanced_voice_recognition_with_text,
174                decoder,
175                offset + 4,
176                _depth
177            )?;
178            fidl::decode!(bool, D, &mut self.remote_volume_control, decoder, offset + 5, _depth)?;
179            fidl::decode!(
180                bool,
181                D,
182                &mut self.voice_recognition_activation,
183                decoder,
184                offset + 6,
185                _depth
186            )?;
187            fidl::decode!(bool, D, &mut self.wide_band_speech, decoder, offset + 7, _depth)?;
188            Ok(())
189        }
190    }
191}