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