fidl_fuchsia_lowpan__common/
fidl_fuchsia_lowpan__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
11pub type ChannelIndex = u16;
13
14pub type InterfaceName = String;
20
21pub type PowerDbm = i8;
31
32pub const MAX_LOWPAN_DEVICES: u32 = 8;
33
34#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct DeviceWatcherWatchDevicesResponse {
36 pub added: Vec<String>,
37 pub removed: Vec<String>,
38}
39
40impl fidl::Persistable for DeviceWatcherWatchDevicesResponse {}
41
42#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46#[repr(C)]
47pub struct MacAddress {
48 pub octets: [u8; 8],
49}
50
51impl fidl::Persistable for MacAddress {}
52
53pub mod device_watcher_ordinals {
54 pub const WATCH_DEVICES: u64 = 0x61e58136ee1f49b8;
55}
56
57mod internal {
58 use super::*;
59
60 impl fidl::encoding::ValueTypeMarker for DeviceWatcherWatchDevicesResponse {
61 type Borrowed<'a> = &'a Self;
62 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
63 value
64 }
65 }
66
67 unsafe impl fidl::encoding::TypeMarker for DeviceWatcherWatchDevicesResponse {
68 type Owned = Self;
69
70 #[inline(always)]
71 fn inline_align(_context: fidl::encoding::Context) -> usize {
72 8
73 }
74
75 #[inline(always)]
76 fn inline_size(_context: fidl::encoding::Context) -> usize {
77 32
78 }
79 }
80
81 unsafe impl<D: fidl::encoding::ResourceDialect>
82 fidl::encoding::Encode<DeviceWatcherWatchDevicesResponse, D>
83 for &DeviceWatcherWatchDevicesResponse
84 {
85 #[inline]
86 unsafe fn encode(
87 self,
88 encoder: &mut fidl::encoding::Encoder<'_, D>,
89 offset: usize,
90 _depth: fidl::encoding::Depth,
91 ) -> fidl::Result<()> {
92 encoder.debug_check_bounds::<DeviceWatcherWatchDevicesResponse>(offset);
93 fidl::encoding::Encode::<DeviceWatcherWatchDevicesResponse, D>::encode(
95 (
96 <fidl::encoding::Vector<fidl::encoding::BoundedString<32>, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.added),
97 <fidl::encoding::Vector<fidl::encoding::BoundedString<32>, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.removed),
98 ),
99 encoder, offset, _depth
100 )
101 }
102 }
103 unsafe impl<
104 D: fidl::encoding::ResourceDialect,
105 T0: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<32>, 8>, D>,
106 T1: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<32>, 8>, D>,
107 > fidl::encoding::Encode<DeviceWatcherWatchDevicesResponse, D> for (T0, T1)
108 {
109 #[inline]
110 unsafe fn encode(
111 self,
112 encoder: &mut fidl::encoding::Encoder<'_, D>,
113 offset: usize,
114 depth: fidl::encoding::Depth,
115 ) -> fidl::Result<()> {
116 encoder.debug_check_bounds::<DeviceWatcherWatchDevicesResponse>(offset);
117 self.0.encode(encoder, offset + 0, depth)?;
121 self.1.encode(encoder, offset + 16, depth)?;
122 Ok(())
123 }
124 }
125
126 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
127 for DeviceWatcherWatchDevicesResponse
128 {
129 #[inline(always)]
130 fn new_empty() -> Self {
131 Self {
132 added: fidl::new_empty!(
133 fidl::encoding::Vector<fidl::encoding::BoundedString<32>, 8>,
134 D
135 ),
136 removed: fidl::new_empty!(
137 fidl::encoding::Vector<fidl::encoding::BoundedString<32>, 8>,
138 D
139 ),
140 }
141 }
142
143 #[inline]
144 unsafe fn decode(
145 &mut self,
146 decoder: &mut fidl::encoding::Decoder<'_, D>,
147 offset: usize,
148 _depth: fidl::encoding::Depth,
149 ) -> fidl::Result<()> {
150 decoder.debug_check_bounds::<Self>(offset);
151 fidl::decode!(
153 fidl::encoding::Vector<fidl::encoding::BoundedString<32>, 8>,
154 D,
155 &mut self.added,
156 decoder,
157 offset + 0,
158 _depth
159 )?;
160 fidl::decode!(
161 fidl::encoding::Vector<fidl::encoding::BoundedString<32>, 8>,
162 D,
163 &mut self.removed,
164 decoder,
165 offset + 16,
166 _depth
167 )?;
168 Ok(())
169 }
170 }
171
172 impl fidl::encoding::ValueTypeMarker for MacAddress {
173 type Borrowed<'a> = &'a Self;
174 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
175 value
176 }
177 }
178
179 unsafe impl fidl::encoding::TypeMarker for MacAddress {
180 type Owned = Self;
181
182 #[inline(always)]
183 fn inline_align(_context: fidl::encoding::Context) -> usize {
184 1
185 }
186
187 #[inline(always)]
188 fn inline_size(_context: fidl::encoding::Context) -> usize {
189 8
190 }
191 #[inline(always)]
192 fn encode_is_copy() -> bool {
193 true
194 }
195
196 #[inline(always)]
197 fn decode_is_copy() -> bool {
198 true
199 }
200 }
201
202 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MacAddress, D>
203 for &MacAddress
204 {
205 #[inline]
206 unsafe fn encode(
207 self,
208 encoder: &mut fidl::encoding::Encoder<'_, D>,
209 offset: usize,
210 _depth: fidl::encoding::Depth,
211 ) -> fidl::Result<()> {
212 encoder.debug_check_bounds::<MacAddress>(offset);
213 unsafe {
214 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
216 (buf_ptr as *mut MacAddress).write_unaligned((self as *const MacAddress).read());
217 }
220 Ok(())
221 }
222 }
223 unsafe impl<
224 D: fidl::encoding::ResourceDialect,
225 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 8>, D>,
226 > fidl::encoding::Encode<MacAddress, D> for (T0,)
227 {
228 #[inline]
229 unsafe fn encode(
230 self,
231 encoder: &mut fidl::encoding::Encoder<'_, D>,
232 offset: usize,
233 depth: fidl::encoding::Depth,
234 ) -> fidl::Result<()> {
235 encoder.debug_check_bounds::<MacAddress>(offset);
236 self.0.encode(encoder, offset + 0, depth)?;
240 Ok(())
241 }
242 }
243
244 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MacAddress {
245 #[inline(always)]
246 fn new_empty() -> Self {
247 Self { octets: fidl::new_empty!(fidl::encoding::Array<u8, 8>, D) }
248 }
249
250 #[inline]
251 unsafe fn decode(
252 &mut self,
253 decoder: &mut fidl::encoding::Decoder<'_, D>,
254 offset: usize,
255 _depth: fidl::encoding::Depth,
256 ) -> fidl::Result<()> {
257 decoder.debug_check_bounds::<Self>(offset);
258 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
259 unsafe {
262 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
263 }
264 Ok(())
265 }
266 }
267}