fidl_cf_sc_internal_wlancfgconfig_common/
fidl_cf_sc_internal_wlancfgconfig_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 recovery_enabled: bool,
14 pub recovery_profile: String,
15 pub roaming_policy: String,
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 8
36 }
37
38 #[inline(always)]
39 fn inline_size(_context: fidl::encoding::Context) -> usize {
40 40
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 fidl::encoding::Encode::<Config, D>::encode(
55 (
56 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.recovery_enabled),
57 <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow(
58 &self.recovery_profile,
59 ),
60 <fidl::encoding::BoundedString<512> as fidl::encoding::ValueTypeMarker>::borrow(
61 &self.roaming_policy,
62 ),
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<fidl::encoding::BoundedString<512>, D>,
74 T2: fidl::encoding::Encode<fidl::encoding::BoundedString<512>, 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 unsafe {
88 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
89 (ptr as *mut u64).write_unaligned(0);
90 }
91 self.0.encode(encoder, offset + 0, depth)?;
93 self.1.encode(encoder, offset + 8, depth)?;
94 self.2.encode(encoder, offset + 24, depth)?;
95 Ok(())
96 }
97 }
98
99 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
100 #[inline(always)]
101 fn new_empty() -> Self {
102 Self {
103 recovery_enabled: fidl::new_empty!(bool, D),
104 recovery_profile: fidl::new_empty!(fidl::encoding::BoundedString<512>, D),
105 roaming_policy: fidl::new_empty!(fidl::encoding::BoundedString<512>, D),
106 }
107 }
108
109 #[inline]
110 unsafe fn decode(
111 &mut self,
112 decoder: &mut fidl::encoding::Decoder<'_, D>,
113 offset: usize,
114 _depth: fidl::encoding::Depth,
115 ) -> fidl::Result<()> {
116 decoder.debug_check_bounds::<Self>(offset);
117 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
119 let padval = unsafe { (ptr as *const u64).read_unaligned() };
120 let mask = 0xffffffffffffff00u64;
121 let maskedval = padval & mask;
122 if maskedval != 0 {
123 return Err(fidl::Error::NonZeroPadding {
124 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
125 });
126 }
127 fidl::decode!(bool, D, &mut self.recovery_enabled, decoder, offset + 0, _depth)?;
128 fidl::decode!(
129 fidl::encoding::BoundedString<512>,
130 D,
131 &mut self.recovery_profile,
132 decoder,
133 offset + 8,
134 _depth
135 )?;
136 fidl::decode!(
137 fidl::encoding::BoundedString<512>,
138 D,
139 &mut self.roaming_policy,
140 decoder,
141 offset + 24,
142 _depth
143 )?;
144 Ok(())
145 }
146 }
147}