fidl_fuchsia_net_root_common/
fidl_fuchsia_net_root_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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12#[repr(u32)]
13pub enum InterfacesGetMacError {
14 NotFound = 1,
16}
17
18impl InterfacesGetMacError {
19 #[inline]
20 pub fn from_primitive(prim: u32) -> Option<Self> {
21 match prim {
22 1 => Some(Self::NotFound),
23 _ => None,
24 }
25 }
26
27 #[inline]
28 pub const fn into_primitive(self) -> u32 {
29 self as u32
30 }
31
32 #[deprecated = "Strict enums should not use `is_unknown`"]
33 #[inline]
34 pub fn is_unknown(&self) -> bool {
35 false
36 }
37}
38
39#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40#[repr(C)]
41pub struct InterfacesGetMacRequest {
42 pub id: u64,
43}
44
45impl fidl::Persistable for InterfacesGetMacRequest {}
46
47#[derive(Clone, Debug, PartialEq)]
48pub struct InterfacesGetMacResponse {
49 pub mac: Option<Box<fidl_fuchsia_net::MacAddress>>,
50}
51
52impl fidl::Persistable for InterfacesGetMacResponse {}
53
54mod internal {
55 use super::*;
56 unsafe impl fidl::encoding::TypeMarker for InterfacesGetMacError {
57 type Owned = Self;
58
59 #[inline(always)]
60 fn inline_align(_context: fidl::encoding::Context) -> usize {
61 std::mem::align_of::<u32>()
62 }
63
64 #[inline(always)]
65 fn inline_size(_context: fidl::encoding::Context) -> usize {
66 std::mem::size_of::<u32>()
67 }
68
69 #[inline(always)]
70 fn encode_is_copy() -> bool {
71 true
72 }
73
74 #[inline(always)]
75 fn decode_is_copy() -> bool {
76 false
77 }
78 }
79
80 impl fidl::encoding::ValueTypeMarker for InterfacesGetMacError {
81 type Borrowed<'a> = Self;
82 #[inline(always)]
83 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
84 *value
85 }
86 }
87
88 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
89 for InterfacesGetMacError
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::<Self>(offset);
99 encoder.write_num(self.into_primitive(), offset);
100 Ok(())
101 }
102 }
103
104 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterfacesGetMacError {
105 #[inline(always)]
106 fn new_empty() -> Self {
107 Self::NotFound
108 }
109
110 #[inline]
111 unsafe fn decode(
112 &mut self,
113 decoder: &mut fidl::encoding::Decoder<'_, D>,
114 offset: usize,
115 _depth: fidl::encoding::Depth,
116 ) -> fidl::Result<()> {
117 decoder.debug_check_bounds::<Self>(offset);
118 let prim = decoder.read_num::<u32>(offset);
119
120 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
121 Ok(())
122 }
123 }
124
125 impl fidl::encoding::ValueTypeMarker for InterfacesGetMacRequest {
126 type Borrowed<'a> = &'a Self;
127 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
128 value
129 }
130 }
131
132 unsafe impl fidl::encoding::TypeMarker for InterfacesGetMacRequest {
133 type Owned = Self;
134
135 #[inline(always)]
136 fn inline_align(_context: fidl::encoding::Context) -> usize {
137 8
138 }
139
140 #[inline(always)]
141 fn inline_size(_context: fidl::encoding::Context) -> usize {
142 8
143 }
144 #[inline(always)]
145 fn encode_is_copy() -> bool {
146 true
147 }
148
149 #[inline(always)]
150 fn decode_is_copy() -> bool {
151 true
152 }
153 }
154
155 unsafe impl<D: fidl::encoding::ResourceDialect>
156 fidl::encoding::Encode<InterfacesGetMacRequest, D> for &InterfacesGetMacRequest
157 {
158 #[inline]
159 unsafe fn encode(
160 self,
161 encoder: &mut fidl::encoding::Encoder<'_, D>,
162 offset: usize,
163 _depth: fidl::encoding::Depth,
164 ) -> fidl::Result<()> {
165 encoder.debug_check_bounds::<InterfacesGetMacRequest>(offset);
166 unsafe {
167 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
169 (buf_ptr as *mut InterfacesGetMacRequest)
170 .write_unaligned((self as *const InterfacesGetMacRequest).read());
171 }
174 Ok(())
175 }
176 }
177 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
178 fidl::encoding::Encode<InterfacesGetMacRequest, D> for (T0,)
179 {
180 #[inline]
181 unsafe fn encode(
182 self,
183 encoder: &mut fidl::encoding::Encoder<'_, D>,
184 offset: usize,
185 depth: fidl::encoding::Depth,
186 ) -> fidl::Result<()> {
187 encoder.debug_check_bounds::<InterfacesGetMacRequest>(offset);
188 self.0.encode(encoder, offset + 0, depth)?;
192 Ok(())
193 }
194 }
195
196 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
197 for InterfacesGetMacRequest
198 {
199 #[inline(always)]
200 fn new_empty() -> Self {
201 Self { id: fidl::new_empty!(u64, D) }
202 }
203
204 #[inline]
205 unsafe fn decode(
206 &mut self,
207 decoder: &mut fidl::encoding::Decoder<'_, D>,
208 offset: usize,
209 _depth: fidl::encoding::Depth,
210 ) -> fidl::Result<()> {
211 decoder.debug_check_bounds::<Self>(offset);
212 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
213 unsafe {
216 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
217 }
218 Ok(())
219 }
220 }
221
222 impl fidl::encoding::ValueTypeMarker for InterfacesGetMacResponse {
223 type Borrowed<'a> = &'a Self;
224 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
225 value
226 }
227 }
228
229 unsafe impl fidl::encoding::TypeMarker for InterfacesGetMacResponse {
230 type Owned = Self;
231
232 #[inline(always)]
233 fn inline_align(_context: fidl::encoding::Context) -> usize {
234 8
235 }
236
237 #[inline(always)]
238 fn inline_size(_context: fidl::encoding::Context) -> usize {
239 8
240 }
241 }
242
243 unsafe impl<D: fidl::encoding::ResourceDialect>
244 fidl::encoding::Encode<InterfacesGetMacResponse, D> for &InterfacesGetMacResponse
245 {
246 #[inline]
247 unsafe fn encode(
248 self,
249 encoder: &mut fidl::encoding::Encoder<'_, D>,
250 offset: usize,
251 _depth: fidl::encoding::Depth,
252 ) -> fidl::Result<()> {
253 encoder.debug_check_bounds::<InterfacesGetMacResponse>(offset);
254 fidl::encoding::Encode::<InterfacesGetMacResponse, D>::encode(
256 (
257 <fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
258 ),
259 encoder, offset, _depth
260 )
261 }
262 }
263 unsafe impl<
264 D: fidl::encoding::ResourceDialect,
265 T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>, D>,
266 > fidl::encoding::Encode<InterfacesGetMacResponse, D> for (T0,)
267 {
268 #[inline]
269 unsafe fn encode(
270 self,
271 encoder: &mut fidl::encoding::Encoder<'_, D>,
272 offset: usize,
273 depth: fidl::encoding::Depth,
274 ) -> fidl::Result<()> {
275 encoder.debug_check_bounds::<InterfacesGetMacResponse>(offset);
276 self.0.encode(encoder, offset + 0, depth)?;
280 Ok(())
281 }
282 }
283
284 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
285 for InterfacesGetMacResponse
286 {
287 #[inline(always)]
288 fn new_empty() -> Self {
289 Self { mac: fidl::new_empty!(fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>, D) }
290 }
291
292 #[inline]
293 unsafe fn decode(
294 &mut self,
295 decoder: &mut fidl::encoding::Decoder<'_, D>,
296 offset: usize,
297 _depth: fidl::encoding::Depth,
298 ) -> fidl::Result<()> {
299 decoder.debug_check_bounds::<Self>(offset);
300 fidl::decode!(
302 fidl::encoding::Boxed<fidl_fuchsia_net::MacAddress>,
303 D,
304 &mut self.mac,
305 decoder,
306 offset + 0,
307 _depth
308 )?;
309 Ok(())
310 }
311 }
312}