fidl_cf_sc_internal_a2dpprofileconfig_common/
fidl_cf_sc_internal_a2dpprofileconfig_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, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13 pub channel_mode: String,
14 pub domain: String,
15 pub enable_aac: bool,
16 pub enable_avrcp_target: bool,
17 pub enable_sink: bool,
18 pub initiator_delay: u32,
19 pub source_type: String,
20}
21
22impl fidl::Persistable for Config {}
23
24mod internal {
25 use super::*;
26
27 impl fidl::encoding::ValueTypeMarker for Config {
28 type Borrowed<'a> = &'a Self;
29 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
30 value
31 }
32 }
33
34 unsafe impl fidl::encoding::TypeMarker for Config {
35 type Owned = Self;
36
37 #[inline(always)]
38 fn inline_align(_context: fidl::encoding::Context) -> usize {
39 8
40 }
41
42 #[inline(always)]
43 fn inline_size(_context: fidl::encoding::Context) -> usize {
44 56
45 }
46 }
47
48 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
49 #[inline]
50 unsafe fn encode(
51 self,
52 encoder: &mut fidl::encoding::Encoder<'_, D>,
53 offset: usize,
54 _depth: fidl::encoding::Depth,
55 ) -> fidl::Result<()> {
56 encoder.debug_check_bounds::<Config>(offset);
57 fidl::encoding::Encode::<Config, D>::encode(
59 (
60 <fidl::encoding::BoundedString<5> as fidl::encoding::ValueTypeMarker>::borrow(
61 &self.channel_mode,
62 ),
63 <fidl::encoding::BoundedString<20> as fidl::encoding::ValueTypeMarker>::borrow(
64 &self.domain,
65 ),
66 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_aac),
67 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_avrcp_target),
68 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_sink),
69 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.initiator_delay),
70 <fidl::encoding::BoundedString<10> as fidl::encoding::ValueTypeMarker>::borrow(
71 &self.source_type,
72 ),
73 ),
74 encoder,
75 offset,
76 _depth,
77 )
78 }
79 }
80 unsafe impl<
81 D: fidl::encoding::ResourceDialect,
82 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<5>, D>,
83 T1: fidl::encoding::Encode<fidl::encoding::BoundedString<20>, D>,
84 T2: fidl::encoding::Encode<bool, D>,
85 T3: fidl::encoding::Encode<bool, D>,
86 T4: fidl::encoding::Encode<bool, D>,
87 T5: fidl::encoding::Encode<u32, D>,
88 T6: fidl::encoding::Encode<fidl::encoding::BoundedString<10>, D>,
89 > fidl::encoding::Encode<Config, D> for (T0, T1, T2, T3, T4, T5, T6)
90 {
91 #[inline]
92 unsafe fn encode(
93 self,
94 encoder: &mut fidl::encoding::Encoder<'_, D>,
95 offset: usize,
96 depth: fidl::encoding::Depth,
97 ) -> fidl::Result<()> {
98 encoder.debug_check_bounds::<Config>(offset);
99 unsafe {
102 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
103 (ptr as *mut u64).write_unaligned(0);
104 }
105 self.0.encode(encoder, offset + 0, depth)?;
107 self.1.encode(encoder, offset + 16, depth)?;
108 self.2.encode(encoder, offset + 32, depth)?;
109 self.3.encode(encoder, offset + 33, depth)?;
110 self.4.encode(encoder, offset + 34, depth)?;
111 self.5.encode(encoder, offset + 36, depth)?;
112 self.6.encode(encoder, offset + 40, depth)?;
113 Ok(())
114 }
115 }
116
117 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
118 #[inline(always)]
119 fn new_empty() -> Self {
120 Self {
121 channel_mode: fidl::new_empty!(fidl::encoding::BoundedString<5>, D),
122 domain: fidl::new_empty!(fidl::encoding::BoundedString<20>, D),
123 enable_aac: fidl::new_empty!(bool, D),
124 enable_avrcp_target: fidl::new_empty!(bool, D),
125 enable_sink: fidl::new_empty!(bool, D),
126 initiator_delay: fidl::new_empty!(u32, D),
127 source_type: fidl::new_empty!(fidl::encoding::BoundedString<10>, D),
128 }
129 }
130
131 #[inline]
132 unsafe fn decode(
133 &mut self,
134 decoder: &mut fidl::encoding::Decoder<'_, D>,
135 offset: usize,
136 _depth: fidl::encoding::Depth,
137 ) -> fidl::Result<()> {
138 decoder.debug_check_bounds::<Self>(offset);
139 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
141 let padval = unsafe { (ptr as *const u64).read_unaligned() };
142 let mask = 0xff000000u64;
143 let maskedval = padval & mask;
144 if maskedval != 0 {
145 return Err(fidl::Error::NonZeroPadding {
146 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
147 });
148 }
149 fidl::decode!(
150 fidl::encoding::BoundedString<5>,
151 D,
152 &mut self.channel_mode,
153 decoder,
154 offset + 0,
155 _depth
156 )?;
157 fidl::decode!(
158 fidl::encoding::BoundedString<20>,
159 D,
160 &mut self.domain,
161 decoder,
162 offset + 16,
163 _depth
164 )?;
165 fidl::decode!(bool, D, &mut self.enable_aac, decoder, offset + 32, _depth)?;
166 fidl::decode!(bool, D, &mut self.enable_avrcp_target, decoder, offset + 33, _depth)?;
167 fidl::decode!(bool, D, &mut self.enable_sink, decoder, offset + 34, _depth)?;
168 fidl::decode!(u32, D, &mut self.initiator_delay, decoder, offset + 36, _depth)?;
169 fidl::decode!(
170 fidl::encoding::BoundedString<10>,
171 D,
172 &mut self.source_type,
173 decoder,
174 offset + 40,
175 _depth
176 )?;
177 Ok(())
178 }
179 }
180}