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
33#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34#[repr(C)]
35pub struct InterfacesGetMacRequest {
36 pub id: u64,
37}
38
39impl fidl::Persistable for InterfacesGetMacRequest {}
40
41#[derive(Clone, Debug, PartialEq)]
42pub struct InterfacesGetMacResponse {
43 pub mac: Option<Box<fidl_fuchsia_net__common::MacAddress>>,
44}
45
46impl fidl::Persistable for InterfacesGetMacResponse {}
47
48pub mod filter_ordinals {
49 pub const OPEN_CONTROLLER: u64 = 0x4f8742ed854ea1d1;
50}
51
52pub mod interfaces_ordinals {
53 pub const GET_ADMIN: u64 = 0x3cdcbf2452babedd;
54 pub const GET_MAC: u64 = 0x720643bc62a26d61;
55}
56
57pub mod routes_v4_ordinals {
58 pub const GLOBAL_ROUTE_SET: u64 = 0x3c0b279c61d81812;
59}
60
61pub mod routes_v6_ordinals {
62 pub const GLOBAL_ROUTE_SET: u64 = 0x41336f581f8d6a61;
63}
64
65mod internal {
66 use super::*;
67 unsafe impl fidl::encoding::TypeMarker for InterfacesGetMacError {
68 type Owned = Self;
69
70 #[inline(always)]
71 fn inline_align(_context: fidl::encoding::Context) -> usize {
72 std::mem::align_of::<u32>()
73 }
74
75 #[inline(always)]
76 fn inline_size(_context: fidl::encoding::Context) -> usize {
77 std::mem::size_of::<u32>()
78 }
79
80 #[inline(always)]
81 fn encode_is_copy() -> bool {
82 true
83 }
84
85 #[inline(always)]
86 fn decode_is_copy() -> bool {
87 false
88 }
89 }
90
91 impl fidl::encoding::ValueTypeMarker for InterfacesGetMacError {
92 type Borrowed<'a> = Self;
93 #[inline(always)]
94 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
95 *value
96 }
97 }
98
99 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
100 for InterfacesGetMacError
101 {
102 #[inline]
103 unsafe fn encode(
104 self,
105 encoder: &mut fidl::encoding::Encoder<'_, D>,
106 offset: usize,
107 _depth: fidl::encoding::Depth,
108 ) -> fidl::Result<()> {
109 encoder.debug_check_bounds::<Self>(offset);
110 encoder.write_num(self.into_primitive(), offset);
111 Ok(())
112 }
113 }
114
115 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterfacesGetMacError {
116 #[inline(always)]
117 fn new_empty() -> Self {
118 Self::NotFound
119 }
120
121 #[inline]
122 unsafe fn decode(
123 &mut self,
124 decoder: &mut fidl::encoding::Decoder<'_, D>,
125 offset: usize,
126 _depth: fidl::encoding::Depth,
127 ) -> fidl::Result<()> {
128 decoder.debug_check_bounds::<Self>(offset);
129 let prim = decoder.read_num::<u32>(offset);
130
131 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
132 Ok(())
133 }
134 }
135
136 impl fidl::encoding::ValueTypeMarker for InterfacesGetMacRequest {
137 type Borrowed<'a> = &'a Self;
138 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
139 value
140 }
141 }
142
143 unsafe impl fidl::encoding::TypeMarker for InterfacesGetMacRequest {
144 type Owned = Self;
145
146 #[inline(always)]
147 fn inline_align(_context: fidl::encoding::Context) -> usize {
148 8
149 }
150
151 #[inline(always)]
152 fn inline_size(_context: fidl::encoding::Context) -> usize {
153 8
154 }
155 #[inline(always)]
156 fn encode_is_copy() -> bool {
157 true
158 }
159
160 #[inline(always)]
161 fn decode_is_copy() -> bool {
162 true
163 }
164 }
165
166 unsafe impl<D: fidl::encoding::ResourceDialect>
167 fidl::encoding::Encode<InterfacesGetMacRequest, D> for &InterfacesGetMacRequest
168 {
169 #[inline]
170 unsafe fn encode(
171 self,
172 encoder: &mut fidl::encoding::Encoder<'_, D>,
173 offset: usize,
174 _depth: fidl::encoding::Depth,
175 ) -> fidl::Result<()> {
176 encoder.debug_check_bounds::<InterfacesGetMacRequest>(offset);
177 unsafe {
178 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
180 (buf_ptr as *mut InterfacesGetMacRequest)
181 .write_unaligned((self as *const InterfacesGetMacRequest).read());
182 }
185 Ok(())
186 }
187 }
188 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
189 fidl::encoding::Encode<InterfacesGetMacRequest, D> for (T0,)
190 {
191 #[inline]
192 unsafe fn encode(
193 self,
194 encoder: &mut fidl::encoding::Encoder<'_, D>,
195 offset: usize,
196 depth: fidl::encoding::Depth,
197 ) -> fidl::Result<()> {
198 encoder.debug_check_bounds::<InterfacesGetMacRequest>(offset);
199 self.0.encode(encoder, offset + 0, depth)?;
203 Ok(())
204 }
205 }
206
207 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
208 for InterfacesGetMacRequest
209 {
210 #[inline(always)]
211 fn new_empty() -> Self {
212 Self { id: fidl::new_empty!(u64, D) }
213 }
214
215 #[inline]
216 unsafe fn decode(
217 &mut self,
218 decoder: &mut fidl::encoding::Decoder<'_, D>,
219 offset: usize,
220 _depth: fidl::encoding::Depth,
221 ) -> fidl::Result<()> {
222 decoder.debug_check_bounds::<Self>(offset);
223 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
224 unsafe {
227 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
228 }
229 Ok(())
230 }
231 }
232
233 impl fidl::encoding::ValueTypeMarker for InterfacesGetMacResponse {
234 type Borrowed<'a> = &'a Self;
235 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
236 value
237 }
238 }
239
240 unsafe impl fidl::encoding::TypeMarker for InterfacesGetMacResponse {
241 type Owned = Self;
242
243 #[inline(always)]
244 fn inline_align(_context: fidl::encoding::Context) -> usize {
245 8
246 }
247
248 #[inline(always)]
249 fn inline_size(_context: fidl::encoding::Context) -> usize {
250 8
251 }
252 }
253
254 unsafe impl<D: fidl::encoding::ResourceDialect>
255 fidl::encoding::Encode<InterfacesGetMacResponse, D> for &InterfacesGetMacResponse
256 {
257 #[inline]
258 unsafe fn encode(
259 self,
260 encoder: &mut fidl::encoding::Encoder<'_, D>,
261 offset: usize,
262 _depth: fidl::encoding::Depth,
263 ) -> fidl::Result<()> {
264 encoder.debug_check_bounds::<InterfacesGetMacResponse>(offset);
265 fidl::encoding::Encode::<InterfacesGetMacResponse, D>::encode(
267 (
268 <fidl::encoding::Boxed<fidl_fuchsia_net__common::MacAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
269 ),
270 encoder, offset, _depth
271 )
272 }
273 }
274 unsafe impl<
275 D: fidl::encoding::ResourceDialect,
276 T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_net__common::MacAddress>, D>,
277 > fidl::encoding::Encode<InterfacesGetMacResponse, D> for (T0,)
278 {
279 #[inline]
280 unsafe fn encode(
281 self,
282 encoder: &mut fidl::encoding::Encoder<'_, D>,
283 offset: usize,
284 depth: fidl::encoding::Depth,
285 ) -> fidl::Result<()> {
286 encoder.debug_check_bounds::<InterfacesGetMacResponse>(offset);
287 self.0.encode(encoder, offset + 0, depth)?;
291 Ok(())
292 }
293 }
294
295 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
296 for InterfacesGetMacResponse
297 {
298 #[inline(always)]
299 fn new_empty() -> Self {
300 Self {
301 mac: fidl::new_empty!(
302 fidl::encoding::Boxed<fidl_fuchsia_net__common::MacAddress>,
303 D
304 ),
305 }
306 }
307
308 #[inline]
309 unsafe fn decode(
310 &mut self,
311 decoder: &mut fidl::encoding::Decoder<'_, D>,
312 offset: usize,
313 _depth: fidl::encoding::Depth,
314 ) -> fidl::Result<()> {
315 decoder.debug_check_bounds::<Self>(offset);
316 fidl::decode!(
318 fidl::encoding::Boxed<fidl_fuchsia_net__common::MacAddress>,
319 D,
320 &mut self.mac,
321 decoder,
322 offset + 0,
323 _depth
324 )?;
325 Ok(())
326 }
327 }
328}