1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[doc = " A hostname.\n\n Although the maximum length of a domain or hostname is 255 characters,\n each label within a name must not be longer than 63 characters as per\n [RFC 1035 section 2.3.4](https://tools.ietf.org/html/rfc1035#section-2.3.4).\n A label in a host name is the alphanumeric characters or hyphens, seperated\n by a period (e.g. abc.com has two labels, \'abc\' and \'com\').\n"]
8 pub type Hostname = ::std::string::String;
9
10 #[doc = " A unique non-zero interface identifier.\n"]
11 pub type InterfaceId = u64;
12
13 #[doc = " Ipv4Address is expressed in network byte order, so the most significant byte\n (\"127\" in the address \"127.0.0.1\") will be at index 0.\n"]
14 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
15 #[repr(C)]
16 pub struct Ipv4Address {
17 pub addr: [u8; 4],
18 }
19
20 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Ipv4Address, ___E> for Ipv4Address
21 where
22 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
23 {
24 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, crate::wire::Ipv4Address> = unsafe {
25 ::fidl_next::CopyOptimization::enable_if(
26 true && <[u8; 4] as ::fidl_next::Encode<[u8; 4], ___E>>::COPY_OPTIMIZATION
27 .is_enabled(),
28 )
29 };
30
31 #[inline]
32 fn encode(
33 self,
34 encoder_: &mut ___E,
35 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4Address>,
36 _: (),
37 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
38 ::fidl_next::munge! {
39 let crate::wire::Ipv4Address {
40 addr,
41
42 } = out_;
43 }
44
45 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
46
47 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
48
49 Ok(())
50 }
51 }
52
53 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Ipv4Address, ___E> for &'a Ipv4Address
54 where
55 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
56 {
57 #[inline]
58 fn encode(
59 self,
60 encoder_: &mut ___E,
61 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4Address>,
62 _: (),
63 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
64 ::fidl_next::munge! {
65 let crate::wire::Ipv4Address {
66 addr,
67
68 } = out_;
69 }
70
71 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
72
73 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
74
75 Ok(())
76 }
77 }
78
79 unsafe impl<___E>
80 ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::Ipv4Address>, ___E>
81 for Ipv4Address
82 where
83 ___E: ::fidl_next::Encoder + ?Sized,
84 Ipv4Address: ::fidl_next::Encode<crate::wire::Ipv4Address, ___E>,
85 {
86 #[inline]
87 fn encode_option(
88 this: ::core::option::Option<Self>,
89 encoder: &mut ___E,
90 out: &mut ::core::mem::MaybeUninit<
91 ::fidl_next::wire::Box<'static, crate::wire::Ipv4Address>,
92 >,
93 _: (),
94 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
95 if let Some(inner) = this {
96 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
97 ::fidl_next::wire::Box::encode_present(out);
98 } else {
99 ::fidl_next::wire::Box::encode_absent(out);
100 }
101
102 Ok(())
103 }
104 }
105
106 unsafe impl<'a, ___E>
107 ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::Ipv4Address>, ___E>
108 for &'a Ipv4Address
109 where
110 ___E: ::fidl_next::Encoder + ?Sized,
111 &'a Ipv4Address: ::fidl_next::Encode<crate::wire::Ipv4Address, ___E>,
112 {
113 #[inline]
114 fn encode_option(
115 this: ::core::option::Option<Self>,
116 encoder: &mut ___E,
117 out: &mut ::core::mem::MaybeUninit<
118 ::fidl_next::wire::Box<'static, crate::wire::Ipv4Address>,
119 >,
120 _: (),
121 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
122 if let Some(inner) = this {
123 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
124 ::fidl_next::wire::Box::encode_present(out);
125 } else {
126 ::fidl_next::wire::Box::encode_absent(out);
127 }
128
129 Ok(())
130 }
131 }
132
133 impl ::fidl_next::FromWire<crate::wire::Ipv4Address> for Ipv4Address {
134 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<crate::wire::Ipv4Address, Self> = unsafe {
135 ::fidl_next::CopyOptimization::enable_if(
136 true && <[u8; 4] as ::fidl_next::FromWire<[u8; 4]>>::COPY_OPTIMIZATION.is_enabled(),
137 )
138 };
139
140 #[inline]
141 fn from_wire(wire: crate::wire::Ipv4Address) -> Self {
142 Self { addr: ::fidl_next::FromWire::from_wire(wire.addr) }
143 }
144 }
145
146 impl ::fidl_next::FromWireRef<crate::wire::Ipv4Address> for Ipv4Address {
147 #[inline]
148 fn from_wire_ref(wire: &crate::wire::Ipv4Address) -> Self {
149 Self { addr: ::fidl_next::FromWireRef::from_wire_ref(&wire.addr) }
150 }
151 }
152
153 #[doc = " Ipv6Address is expressed in network byte order, so the most significant byte\n (\"ff\" in the address \"ff02::1\") will be at index 0.\n"]
154 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
155 #[repr(C)]
156 pub struct Ipv6Address {
157 pub addr: [u8; 16],
158 }
159
160 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Ipv6Address, ___E> for Ipv6Address
161 where
162 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
163 {
164 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, crate::wire::Ipv6Address> = unsafe {
165 ::fidl_next::CopyOptimization::enable_if(
166 true && <[u8; 16] as ::fidl_next::Encode<[u8; 16], ___E>>::COPY_OPTIMIZATION
167 .is_enabled(),
168 )
169 };
170
171 #[inline]
172 fn encode(
173 self,
174 encoder_: &mut ___E,
175 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6Address>,
176 _: (),
177 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
178 ::fidl_next::munge! {
179 let crate::wire::Ipv6Address {
180 addr,
181
182 } = out_;
183 }
184
185 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
186
187 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
188
189 Ok(())
190 }
191 }
192
193 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Ipv6Address, ___E> for &'a Ipv6Address
194 where
195 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
196 {
197 #[inline]
198 fn encode(
199 self,
200 encoder_: &mut ___E,
201 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6Address>,
202 _: (),
203 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
204 ::fidl_next::munge! {
205 let crate::wire::Ipv6Address {
206 addr,
207
208 } = out_;
209 }
210
211 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
212
213 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
214
215 Ok(())
216 }
217 }
218
219 unsafe impl<___E>
220 ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::Ipv6Address>, ___E>
221 for Ipv6Address
222 where
223 ___E: ::fidl_next::Encoder + ?Sized,
224 Ipv6Address: ::fidl_next::Encode<crate::wire::Ipv6Address, ___E>,
225 {
226 #[inline]
227 fn encode_option(
228 this: ::core::option::Option<Self>,
229 encoder: &mut ___E,
230 out: &mut ::core::mem::MaybeUninit<
231 ::fidl_next::wire::Box<'static, crate::wire::Ipv6Address>,
232 >,
233 _: (),
234 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
235 if let Some(inner) = this {
236 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
237 ::fidl_next::wire::Box::encode_present(out);
238 } else {
239 ::fidl_next::wire::Box::encode_absent(out);
240 }
241
242 Ok(())
243 }
244 }
245
246 unsafe impl<'a, ___E>
247 ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::Ipv6Address>, ___E>
248 for &'a Ipv6Address
249 where
250 ___E: ::fidl_next::Encoder + ?Sized,
251 &'a Ipv6Address: ::fidl_next::Encode<crate::wire::Ipv6Address, ___E>,
252 {
253 #[inline]
254 fn encode_option(
255 this: ::core::option::Option<Self>,
256 encoder: &mut ___E,
257 out: &mut ::core::mem::MaybeUninit<
258 ::fidl_next::wire::Box<'static, crate::wire::Ipv6Address>,
259 >,
260 _: (),
261 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
262 if let Some(inner) = this {
263 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
264 ::fidl_next::wire::Box::encode_present(out);
265 } else {
266 ::fidl_next::wire::Box::encode_absent(out);
267 }
268
269 Ok(())
270 }
271 }
272
273 impl ::fidl_next::FromWire<crate::wire::Ipv6Address> for Ipv6Address {
274 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<crate::wire::Ipv6Address, Self> = unsafe {
275 ::fidl_next::CopyOptimization::enable_if(
276 true && <[u8; 16] as ::fidl_next::FromWire<[u8; 16]>>::COPY_OPTIMIZATION
277 .is_enabled(),
278 )
279 };
280
281 #[inline]
282 fn from_wire(wire: crate::wire::Ipv6Address) -> Self {
283 Self { addr: ::fidl_next::FromWire::from_wire(wire.addr) }
284 }
285 }
286
287 impl ::fidl_next::FromWireRef<crate::wire::Ipv6Address> for Ipv6Address {
288 #[inline]
289 fn from_wire_ref(wire: &crate::wire::Ipv6Address) -> Self {
290 Self { addr: ::fidl_next::FromWireRef::from_wire_ref(&wire.addr) }
291 }
292 }
293
294 #[doc = " Represents an IP address that may be either v4 or v6.\n"]
295 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
296 pub enum IpAddress {
297 Ipv4(crate::natural::Ipv4Address),
298
299 Ipv6(crate::natural::Ipv6Address),
300 }
301
302 unsafe impl<___E> ::fidl_next::Encode<crate::wire::IpAddress<'static>, ___E> for IpAddress
303 where
304 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
305 ___E: ::fidl_next::Encoder,
306 {
307 #[inline]
308 fn encode(
309 self,
310 encoder: &mut ___E,
311 out: &mut ::core::mem::MaybeUninit<crate::wire::IpAddress<'static>>,
312 _: (),
313 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
314 ::fidl_next::munge!(let crate::wire::IpAddress { raw, _phantom: _ } = out);
315
316 match self {
317 Self::Ipv4(value) => ::fidl_next::wire::Union::encode_as::<
318 ___E,
319 crate::wire::Ipv4Address,
320 >(value, 1, encoder, raw, ())?,
321
322 Self::Ipv6(value) => ::fidl_next::wire::Union::encode_as::<
323 ___E,
324 crate::wire::Ipv6Address,
325 >(value, 2, encoder, raw, ())?,
326 }
327
328 Ok(())
329 }
330 }
331
332 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::IpAddress<'static>, ___E> for &'a IpAddress
333 where
334 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
335 ___E: ::fidl_next::Encoder,
336 {
337 #[inline]
338 fn encode(
339 self,
340 encoder: &mut ___E,
341 out: &mut ::core::mem::MaybeUninit<crate::wire::IpAddress<'static>>,
342 _: (),
343 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
344 ::fidl_next::munge!(let crate::wire::IpAddress { raw, _phantom: _ } = out);
345
346 match self {
347 IpAddress::Ipv4(value) => ::fidl_next::wire::Union::encode_as::<
348 ___E,
349 crate::wire::Ipv4Address,
350 >(value, 1, encoder, raw, ())?,
351
352 IpAddress::Ipv6(value) => ::fidl_next::wire::Union::encode_as::<
353 ___E,
354 crate::wire::Ipv6Address,
355 >(value, 2, encoder, raw, ())?,
356 }
357
358 Ok(())
359 }
360 }
361
362 unsafe impl<___E> ::fidl_next::EncodeOption<crate::wire_optional::IpAddress<'static>, ___E>
363 for IpAddress
364 where
365 ___E: ?Sized,
366 IpAddress: ::fidl_next::Encode<crate::wire::IpAddress<'static>, ___E>,
367 {
368 #[inline]
369 fn encode_option(
370 this: ::core::option::Option<Self>,
371 encoder: &mut ___E,
372 out: &mut ::core::mem::MaybeUninit<crate::wire_optional::IpAddress<'static>>,
373 _: (),
374 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
375 ::fidl_next::munge!(let crate::wire_optional::IpAddress { raw, _phantom: _ } = &mut *out);
376
377 if let Some(inner) = this {
378 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
379 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
380 } else {
381 ::fidl_next::wire::Union::encode_absent(raw);
382 }
383
384 Ok(())
385 }
386 }
387
388 unsafe impl<'a, ___E> ::fidl_next::EncodeOption<crate::wire_optional::IpAddress<'static>, ___E>
389 for &'a IpAddress
390 where
391 ___E: ?Sized,
392 &'a IpAddress: ::fidl_next::Encode<crate::wire::IpAddress<'static>, ___E>,
393 {
394 #[inline]
395 fn encode_option(
396 this: ::core::option::Option<Self>,
397 encoder: &mut ___E,
398 out: &mut ::core::mem::MaybeUninit<crate::wire_optional::IpAddress<'static>>,
399 _: (),
400 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
401 ::fidl_next::munge!(let crate::wire_optional::IpAddress { raw, _phantom: _ } = &mut *out);
402
403 if let Some(inner) = this {
404 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
405 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
406 } else {
407 ::fidl_next::wire::Union::encode_absent(raw);
408 }
409
410 Ok(())
411 }
412 }
413
414 impl<'de> ::fidl_next::FromWire<crate::wire::IpAddress<'de>> for IpAddress {
415 #[inline]
416 fn from_wire(wire: crate::wire::IpAddress<'de>) -> Self {
417 let wire = ::core::mem::ManuallyDrop::new(wire);
418 match wire.raw.ordinal() {
419 1 => Self::Ipv4(::fidl_next::FromWire::from_wire(unsafe {
420 wire.raw.get().read_unchecked::<crate::wire::Ipv4Address>()
421 })),
422
423 2 => Self::Ipv6(::fidl_next::FromWire::from_wire(unsafe {
424 wire.raw.get().read_unchecked::<crate::wire::Ipv6Address>()
425 })),
426
427 _ => unsafe { ::core::hint::unreachable_unchecked() },
428 }
429 }
430 }
431
432 impl<'de> ::fidl_next::FromWireRef<crate::wire::IpAddress<'de>> for IpAddress {
433 #[inline]
434 fn from_wire_ref(wire: &crate::wire::IpAddress<'de>) -> Self {
435 match wire.raw.ordinal() {
436 1 => Self::Ipv4(::fidl_next::FromWireRef::from_wire_ref(unsafe {
437 wire.raw.get().deref_unchecked::<crate::wire::Ipv4Address>()
438 })),
439
440 2 => Self::Ipv6(::fidl_next::FromWireRef::from_wire_ref(unsafe {
441 wire.raw.get().deref_unchecked::<crate::wire::Ipv6Address>()
442 })),
443
444 _ => unsafe { ::core::hint::unreachable_unchecked() },
445 }
446 }
447 }
448
449 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::IpAddress<'de>> for IpAddress {
450 #[inline]
451 fn from_wire_option(
452 wire: crate::wire_optional::IpAddress<'de>,
453 ) -> ::core::option::Option<Self> {
454 if let Some(inner) = wire.into_option() {
455 Some(::fidl_next::FromWire::from_wire(inner))
456 } else {
457 None
458 }
459 }
460 }
461
462 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::IpAddress<'de>> for Box<IpAddress> {
463 #[inline]
464 fn from_wire_option(
465 wire: crate::wire_optional::IpAddress<'de>,
466 ) -> ::core::option::Option<Self> {
467 <
468 IpAddress as ::fidl_next::FromWireOption<crate::wire_optional::IpAddress<'de>>
469 >::from_wire_option(wire).map(Box::new)
470 }
471 }
472
473 impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::IpAddress<'de>> for Box<IpAddress> {
474 #[inline]
475 fn from_wire_option_ref(
476 wire: &crate::wire_optional::IpAddress<'de>,
477 ) -> ::core::option::Option<Self> {
478 if let Some(inner) = wire.as_ref() {
479 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
480 } else {
481 None
482 }
483 }
484 }
485
486 #[doc = " IpVersion is an IP version.\n"]
487 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
488 #[repr(u32)]
489 pub enum IpVersion {
490 V4 = 1,
491 V6 = 2,
492 }
493 impl ::core::convert::TryFrom<u32> for IpVersion {
494 type Error = ::fidl_next::UnknownStrictEnumMemberError;
495 fn try_from(
496 value: u32,
497 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
498 match value {
499 1 => Ok(Self::V4),
500 2 => Ok(Self::V6),
501
502 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
503 }
504 }
505 }
506
507 impl ::std::convert::From<IpVersion> for u32 {
508 fn from(value: IpVersion) -> Self {
509 match value {
510 IpVersion::V4 => 1,
511 IpVersion::V6 => 2,
512 }
513 }
514 }
515
516 unsafe impl<___E> ::fidl_next::Encode<crate::wire::IpVersion, ___E> for IpVersion
517 where
518 ___E: ?Sized,
519 {
520 #[inline]
521 fn encode(
522 self,
523 encoder: &mut ___E,
524 out: &mut ::core::mem::MaybeUninit<crate::wire::IpVersion>,
525 _: (),
526 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
527 ::fidl_next::Encode::encode(&self, encoder, out, ())
528 }
529 }
530
531 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::IpVersion, ___E> for &'a IpVersion
532 where
533 ___E: ?Sized,
534 {
535 #[inline]
536 fn encode(
537 self,
538 encoder: &mut ___E,
539 out: &mut ::core::mem::MaybeUninit<crate::wire::IpVersion>,
540 _: (),
541 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
542 ::fidl_next::munge!(let crate::wire::IpVersion { value } = out);
543 let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
544 IpVersion::V4 => 1,
545
546 IpVersion::V6 => 2,
547 }));
548
549 Ok(())
550 }
551 }
552
553 impl ::core::convert::From<crate::wire::IpVersion> for IpVersion {
554 fn from(wire: crate::wire::IpVersion) -> Self {
555 match u32::from(wire.value) {
556 1 => Self::V4,
557
558 2 => Self::V6,
559
560 _ => unsafe { ::core::hint::unreachable_unchecked() },
561 }
562 }
563 }
564
565 impl ::fidl_next::FromWire<crate::wire::IpVersion> for IpVersion {
566 #[inline]
567 fn from_wire(wire: crate::wire::IpVersion) -> Self {
568 Self::from(wire)
569 }
570 }
571
572 impl ::fidl_next::FromWireRef<crate::wire::IpVersion> for IpVersion {
573 #[inline]
574 fn from_wire_ref(wire: &crate::wire::IpVersion) -> Self {
575 Self::from(*wire)
576 }
577 }
578
579 #[doc = " An IPv4 address with its subnet prefix length.\n"]
580 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
581 #[repr(C)]
582 pub struct Ipv4AddressWithPrefix {
583 pub addr: crate::natural::Ipv4Address,
584
585 pub prefix_len: u8,
586 }
587
588 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Ipv4AddressWithPrefix, ___E>
589 for Ipv4AddressWithPrefix
590 where
591 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
592 {
593 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
594 Self,
595 crate::wire::Ipv4AddressWithPrefix,
596 > = unsafe {
597 ::fidl_next::CopyOptimization::enable_if(
598 true && <crate::natural::Ipv4Address as ::fidl_next::Encode<
599 crate::wire::Ipv4Address,
600 ___E,
601 >>::COPY_OPTIMIZATION
602 .is_enabled()
603 && <u8 as ::fidl_next::Encode<u8, ___E>>::COPY_OPTIMIZATION.is_enabled(),
604 )
605 };
606
607 #[inline]
608 fn encode(
609 self,
610 encoder_: &mut ___E,
611 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4AddressWithPrefix>,
612 _: (),
613 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
614 ::fidl_next::munge! {
615 let crate::wire::Ipv4AddressWithPrefix {
616 addr,
617 prefix_len,
618
619 } = out_;
620 }
621
622 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
623
624 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
625
626 ::fidl_next::Encode::encode(self.prefix_len, encoder_, prefix_len, ())?;
627
628 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(prefix_len.as_mut_ptr()) };
629
630 Ok(())
631 }
632 }
633
634 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Ipv4AddressWithPrefix, ___E>
635 for &'a Ipv4AddressWithPrefix
636 where
637 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
638 {
639 #[inline]
640 fn encode(
641 self,
642 encoder_: &mut ___E,
643 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4AddressWithPrefix>,
644 _: (),
645 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
646 ::fidl_next::munge! {
647 let crate::wire::Ipv4AddressWithPrefix {
648 addr,
649 prefix_len,
650
651 } = out_;
652 }
653
654 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
655
656 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
657
658 ::fidl_next::Encode::encode(&self.prefix_len, encoder_, prefix_len, ())?;
659
660 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(prefix_len.as_mut_ptr()) };
661
662 Ok(())
663 }
664 }
665
666 unsafe impl<___E>
667 ::fidl_next::EncodeOption<
668 ::fidl_next::wire::Box<'static, crate::wire::Ipv4AddressWithPrefix>,
669 ___E,
670 > for Ipv4AddressWithPrefix
671 where
672 ___E: ::fidl_next::Encoder + ?Sized,
673 Ipv4AddressWithPrefix: ::fidl_next::Encode<crate::wire::Ipv4AddressWithPrefix, ___E>,
674 {
675 #[inline]
676 fn encode_option(
677 this: ::core::option::Option<Self>,
678 encoder: &mut ___E,
679 out: &mut ::core::mem::MaybeUninit<
680 ::fidl_next::wire::Box<'static, crate::wire::Ipv4AddressWithPrefix>,
681 >,
682 _: (),
683 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
684 if let Some(inner) = this {
685 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
686 ::fidl_next::wire::Box::encode_present(out);
687 } else {
688 ::fidl_next::wire::Box::encode_absent(out);
689 }
690
691 Ok(())
692 }
693 }
694
695 unsafe impl<'a, ___E>
696 ::fidl_next::EncodeOption<
697 ::fidl_next::wire::Box<'static, crate::wire::Ipv4AddressWithPrefix>,
698 ___E,
699 > for &'a Ipv4AddressWithPrefix
700 where
701 ___E: ::fidl_next::Encoder + ?Sized,
702 &'a Ipv4AddressWithPrefix: ::fidl_next::Encode<crate::wire::Ipv4AddressWithPrefix, ___E>,
703 {
704 #[inline]
705 fn encode_option(
706 this: ::core::option::Option<Self>,
707 encoder: &mut ___E,
708 out: &mut ::core::mem::MaybeUninit<
709 ::fidl_next::wire::Box<'static, crate::wire::Ipv4AddressWithPrefix>,
710 >,
711 _: (),
712 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
713 if let Some(inner) = this {
714 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
715 ::fidl_next::wire::Box::encode_present(out);
716 } else {
717 ::fidl_next::wire::Box::encode_absent(out);
718 }
719
720 Ok(())
721 }
722 }
723
724 impl ::fidl_next::FromWire<crate::wire::Ipv4AddressWithPrefix> for Ipv4AddressWithPrefix {
725 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
726 crate::wire::Ipv4AddressWithPrefix,
727 Self,
728 > = unsafe {
729 ::fidl_next::CopyOptimization::enable_if(
730 true && <crate::natural::Ipv4Address as ::fidl_next::FromWire<
731 crate::wire::Ipv4Address,
732 >>::COPY_OPTIMIZATION
733 .is_enabled()
734 && <u8 as ::fidl_next::FromWire<u8>>::COPY_OPTIMIZATION.is_enabled(),
735 )
736 };
737
738 #[inline]
739 fn from_wire(wire: crate::wire::Ipv4AddressWithPrefix) -> Self {
740 Self {
741 addr: ::fidl_next::FromWire::from_wire(wire.addr),
742
743 prefix_len: ::fidl_next::FromWire::from_wire(wire.prefix_len),
744 }
745 }
746 }
747
748 impl ::fidl_next::FromWireRef<crate::wire::Ipv4AddressWithPrefix> for Ipv4AddressWithPrefix {
749 #[inline]
750 fn from_wire_ref(wire: &crate::wire::Ipv4AddressWithPrefix) -> Self {
751 Self {
752 addr: ::fidl_next::FromWireRef::from_wire_ref(&wire.addr),
753
754 prefix_len: ::fidl_next::FromWireRef::from_wire_ref(&wire.prefix_len),
755 }
756 }
757 }
758
759 #[doc = " An IPv4 socket address, composed of an IPv4 address and a port.\n\n Inspired by the address definition in the [POSIX specification].\n\n [POSIX specification]: https://pubs.opengroup.org/onlinepubs/9699919799/\n"]
760 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
761 #[repr(C)]
762 pub struct Ipv4SocketAddress {
763 pub address: crate::natural::Ipv4Address,
764
765 pub port: u16,
766 }
767
768 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Ipv4SocketAddress, ___E> for Ipv4SocketAddress
769 where
770 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
771 {
772 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
773 Self,
774 crate::wire::Ipv4SocketAddress,
775 > = unsafe {
776 ::fidl_next::CopyOptimization::enable_if(
777 true
778
779 && <
780 crate::natural::Ipv4Address as ::fidl_next::Encode<crate::wire::Ipv4Address, ___E>
781 >::COPY_OPTIMIZATION.is_enabled()
782
783 && <
784 u16 as ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>
785 >::COPY_OPTIMIZATION.is_enabled()
786
787 )
788 };
789
790 #[inline]
791 fn encode(
792 self,
793 encoder_: &mut ___E,
794 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4SocketAddress>,
795 _: (),
796 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
797 ::fidl_next::munge! {
798 let crate::wire::Ipv4SocketAddress {
799 address,
800 port,
801
802 } = out_;
803 }
804
805 ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
806
807 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(address.as_mut_ptr()) };
808
809 ::fidl_next::Encode::encode(self.port, encoder_, port, ())?;
810
811 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(port.as_mut_ptr()) };
812
813 Ok(())
814 }
815 }
816
817 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Ipv4SocketAddress, ___E>
818 for &'a Ipv4SocketAddress
819 where
820 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
821 {
822 #[inline]
823 fn encode(
824 self,
825 encoder_: &mut ___E,
826 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4SocketAddress>,
827 _: (),
828 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
829 ::fidl_next::munge! {
830 let crate::wire::Ipv4SocketAddress {
831 address,
832 port,
833
834 } = out_;
835 }
836
837 ::fidl_next::Encode::encode(&self.address, encoder_, address, ())?;
838
839 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(address.as_mut_ptr()) };
840
841 ::fidl_next::Encode::encode(&self.port, encoder_, port, ())?;
842
843 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(port.as_mut_ptr()) };
844
845 Ok(())
846 }
847 }
848
849 unsafe impl<___E>
850 ::fidl_next::EncodeOption<
851 ::fidl_next::wire::Box<'static, crate::wire::Ipv4SocketAddress>,
852 ___E,
853 > for Ipv4SocketAddress
854 where
855 ___E: ::fidl_next::Encoder + ?Sized,
856 Ipv4SocketAddress: ::fidl_next::Encode<crate::wire::Ipv4SocketAddress, ___E>,
857 {
858 #[inline]
859 fn encode_option(
860 this: ::core::option::Option<Self>,
861 encoder: &mut ___E,
862 out: &mut ::core::mem::MaybeUninit<
863 ::fidl_next::wire::Box<'static, crate::wire::Ipv4SocketAddress>,
864 >,
865 _: (),
866 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
867 if let Some(inner) = this {
868 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
869 ::fidl_next::wire::Box::encode_present(out);
870 } else {
871 ::fidl_next::wire::Box::encode_absent(out);
872 }
873
874 Ok(())
875 }
876 }
877
878 unsafe impl<'a, ___E>
879 ::fidl_next::EncodeOption<
880 ::fidl_next::wire::Box<'static, crate::wire::Ipv4SocketAddress>,
881 ___E,
882 > for &'a Ipv4SocketAddress
883 where
884 ___E: ::fidl_next::Encoder + ?Sized,
885 &'a Ipv4SocketAddress: ::fidl_next::Encode<crate::wire::Ipv4SocketAddress, ___E>,
886 {
887 #[inline]
888 fn encode_option(
889 this: ::core::option::Option<Self>,
890 encoder: &mut ___E,
891 out: &mut ::core::mem::MaybeUninit<
892 ::fidl_next::wire::Box<'static, crate::wire::Ipv4SocketAddress>,
893 >,
894 _: (),
895 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
896 if let Some(inner) = this {
897 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
898 ::fidl_next::wire::Box::encode_present(out);
899 } else {
900 ::fidl_next::wire::Box::encode_absent(out);
901 }
902
903 Ok(())
904 }
905 }
906
907 impl ::fidl_next::FromWire<crate::wire::Ipv4SocketAddress> for Ipv4SocketAddress {
908 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
909 crate::wire::Ipv4SocketAddress,
910 Self,
911 > = unsafe {
912 ::fidl_next::CopyOptimization::enable_if(
913 true && <crate::natural::Ipv4Address as ::fidl_next::FromWire<
914 crate::wire::Ipv4Address,
915 >>::COPY_OPTIMIZATION
916 .is_enabled()
917 && <u16 as ::fidl_next::FromWire<::fidl_next::wire::Uint16>>::COPY_OPTIMIZATION
918 .is_enabled(),
919 )
920 };
921
922 #[inline]
923 fn from_wire(wire: crate::wire::Ipv4SocketAddress) -> Self {
924 Self {
925 address: ::fidl_next::FromWire::from_wire(wire.address),
926
927 port: ::fidl_next::FromWire::from_wire(wire.port),
928 }
929 }
930 }
931
932 impl ::fidl_next::FromWireRef<crate::wire::Ipv4SocketAddress> for Ipv4SocketAddress {
933 #[inline]
934 fn from_wire_ref(wire: &crate::wire::Ipv4SocketAddress) -> Self {
935 Self {
936 address: ::fidl_next::FromWireRef::from_wire_ref(&wire.address),
937
938 port: ::fidl_next::FromWireRef::from_wire_ref(&wire.port),
939 }
940 }
941 }
942
943 #[doc = " An IPv6 address with its subnet prefix length.\n"]
944 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
945 #[repr(C)]
946 pub struct Ipv6AddressWithPrefix {
947 pub addr: crate::natural::Ipv6Address,
948
949 pub prefix_len: u8,
950 }
951
952 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Ipv6AddressWithPrefix, ___E>
953 for Ipv6AddressWithPrefix
954 where
955 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
956 {
957 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
958 Self,
959 crate::wire::Ipv6AddressWithPrefix,
960 > = unsafe {
961 ::fidl_next::CopyOptimization::enable_if(
962 true && <crate::natural::Ipv6Address as ::fidl_next::Encode<
963 crate::wire::Ipv6Address,
964 ___E,
965 >>::COPY_OPTIMIZATION
966 .is_enabled()
967 && <u8 as ::fidl_next::Encode<u8, ___E>>::COPY_OPTIMIZATION.is_enabled(),
968 )
969 };
970
971 #[inline]
972 fn encode(
973 self,
974 encoder_: &mut ___E,
975 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6AddressWithPrefix>,
976 _: (),
977 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
978 ::fidl_next::munge! {
979 let crate::wire::Ipv6AddressWithPrefix {
980 addr,
981 prefix_len,
982
983 } = out_;
984 }
985
986 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
987
988 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
989
990 ::fidl_next::Encode::encode(self.prefix_len, encoder_, prefix_len, ())?;
991
992 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(prefix_len.as_mut_ptr()) };
993
994 Ok(())
995 }
996 }
997
998 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Ipv6AddressWithPrefix, ___E>
999 for &'a Ipv6AddressWithPrefix
1000 where
1001 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1002 {
1003 #[inline]
1004 fn encode(
1005 self,
1006 encoder_: &mut ___E,
1007 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6AddressWithPrefix>,
1008 _: (),
1009 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1010 ::fidl_next::munge! {
1011 let crate::wire::Ipv6AddressWithPrefix {
1012 addr,
1013 prefix_len,
1014
1015 } = out_;
1016 }
1017
1018 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
1019
1020 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
1021
1022 ::fidl_next::Encode::encode(&self.prefix_len, encoder_, prefix_len, ())?;
1023
1024 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(prefix_len.as_mut_ptr()) };
1025
1026 Ok(())
1027 }
1028 }
1029
1030 unsafe impl<___E>
1031 ::fidl_next::EncodeOption<
1032 ::fidl_next::wire::Box<'static, crate::wire::Ipv6AddressWithPrefix>,
1033 ___E,
1034 > for Ipv6AddressWithPrefix
1035 where
1036 ___E: ::fidl_next::Encoder + ?Sized,
1037 Ipv6AddressWithPrefix: ::fidl_next::Encode<crate::wire::Ipv6AddressWithPrefix, ___E>,
1038 {
1039 #[inline]
1040 fn encode_option(
1041 this: ::core::option::Option<Self>,
1042 encoder: &mut ___E,
1043 out: &mut ::core::mem::MaybeUninit<
1044 ::fidl_next::wire::Box<'static, crate::wire::Ipv6AddressWithPrefix>,
1045 >,
1046 _: (),
1047 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1048 if let Some(inner) = this {
1049 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1050 ::fidl_next::wire::Box::encode_present(out);
1051 } else {
1052 ::fidl_next::wire::Box::encode_absent(out);
1053 }
1054
1055 Ok(())
1056 }
1057 }
1058
1059 unsafe impl<'a, ___E>
1060 ::fidl_next::EncodeOption<
1061 ::fidl_next::wire::Box<'static, crate::wire::Ipv6AddressWithPrefix>,
1062 ___E,
1063 > for &'a Ipv6AddressWithPrefix
1064 where
1065 ___E: ::fidl_next::Encoder + ?Sized,
1066 &'a Ipv6AddressWithPrefix: ::fidl_next::Encode<crate::wire::Ipv6AddressWithPrefix, ___E>,
1067 {
1068 #[inline]
1069 fn encode_option(
1070 this: ::core::option::Option<Self>,
1071 encoder: &mut ___E,
1072 out: &mut ::core::mem::MaybeUninit<
1073 ::fidl_next::wire::Box<'static, crate::wire::Ipv6AddressWithPrefix>,
1074 >,
1075 _: (),
1076 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1077 if let Some(inner) = this {
1078 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1079 ::fidl_next::wire::Box::encode_present(out);
1080 } else {
1081 ::fidl_next::wire::Box::encode_absent(out);
1082 }
1083
1084 Ok(())
1085 }
1086 }
1087
1088 impl ::fidl_next::FromWire<crate::wire::Ipv6AddressWithPrefix> for Ipv6AddressWithPrefix {
1089 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
1090 crate::wire::Ipv6AddressWithPrefix,
1091 Self,
1092 > = unsafe {
1093 ::fidl_next::CopyOptimization::enable_if(
1094 true && <crate::natural::Ipv6Address as ::fidl_next::FromWire<
1095 crate::wire::Ipv6Address,
1096 >>::COPY_OPTIMIZATION
1097 .is_enabled()
1098 && <u8 as ::fidl_next::FromWire<u8>>::COPY_OPTIMIZATION.is_enabled(),
1099 )
1100 };
1101
1102 #[inline]
1103 fn from_wire(wire: crate::wire::Ipv6AddressWithPrefix) -> Self {
1104 Self {
1105 addr: ::fidl_next::FromWire::from_wire(wire.addr),
1106
1107 prefix_len: ::fidl_next::FromWire::from_wire(wire.prefix_len),
1108 }
1109 }
1110 }
1111
1112 impl ::fidl_next::FromWireRef<crate::wire::Ipv6AddressWithPrefix> for Ipv6AddressWithPrefix {
1113 #[inline]
1114 fn from_wire_ref(wire: &crate::wire::Ipv6AddressWithPrefix) -> Self {
1115 Self {
1116 addr: ::fidl_next::FromWireRef::from_wire_ref(&wire.addr),
1117
1118 prefix_len: ::fidl_next::FromWireRef::from_wire_ref(&wire.prefix_len),
1119 }
1120 }
1121 }
1122
1123 #[doc = " An IPV6 socket address, composed of an IPv6 address, a port, and a scope identifier.\n\n Inspired by the address definition in the [POSIX specification].\n\n [POSIX specification]: https://pubs.opengroup.org/onlinepubs/9699919799/\n"]
1124 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1125 pub struct Ipv6SocketAddress {
1126 pub address: crate::natural::Ipv6Address,
1127
1128 pub port: u16,
1129
1130 pub zone_index: u64,
1131 }
1132
1133 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Ipv6SocketAddress, ___E> for Ipv6SocketAddress
1134 where
1135 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1136 {
1137 #[inline]
1138 fn encode(
1139 self,
1140 encoder_: &mut ___E,
1141 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6SocketAddress>,
1142 _: (),
1143 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1144 ::fidl_next::munge! {
1145 let crate::wire::Ipv6SocketAddress {
1146 address,
1147 port,
1148 zone_index,
1149
1150 } = out_;
1151 }
1152
1153 ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
1154
1155 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(address.as_mut_ptr()) };
1156
1157 ::fidl_next::Encode::encode(self.port, encoder_, port, ())?;
1158
1159 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(port.as_mut_ptr()) };
1160
1161 ::fidl_next::Encode::encode(self.zone_index, encoder_, zone_index, ())?;
1162
1163 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(zone_index.as_mut_ptr()) };
1164
1165 Ok(())
1166 }
1167 }
1168
1169 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Ipv6SocketAddress, ___E>
1170 for &'a Ipv6SocketAddress
1171 where
1172 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1173 {
1174 #[inline]
1175 fn encode(
1176 self,
1177 encoder_: &mut ___E,
1178 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6SocketAddress>,
1179 _: (),
1180 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1181 ::fidl_next::munge! {
1182 let crate::wire::Ipv6SocketAddress {
1183 address,
1184 port,
1185 zone_index,
1186
1187 } = out_;
1188 }
1189
1190 ::fidl_next::Encode::encode(&self.address, encoder_, address, ())?;
1191
1192 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(address.as_mut_ptr()) };
1193
1194 ::fidl_next::Encode::encode(&self.port, encoder_, port, ())?;
1195
1196 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(port.as_mut_ptr()) };
1197
1198 ::fidl_next::Encode::encode(&self.zone_index, encoder_, zone_index, ())?;
1199
1200 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(zone_index.as_mut_ptr()) };
1201
1202 Ok(())
1203 }
1204 }
1205
1206 unsafe impl<___E>
1207 ::fidl_next::EncodeOption<
1208 ::fidl_next::wire::Box<'static, crate::wire::Ipv6SocketAddress>,
1209 ___E,
1210 > for Ipv6SocketAddress
1211 where
1212 ___E: ::fidl_next::Encoder + ?Sized,
1213 Ipv6SocketAddress: ::fidl_next::Encode<crate::wire::Ipv6SocketAddress, ___E>,
1214 {
1215 #[inline]
1216 fn encode_option(
1217 this: ::core::option::Option<Self>,
1218 encoder: &mut ___E,
1219 out: &mut ::core::mem::MaybeUninit<
1220 ::fidl_next::wire::Box<'static, crate::wire::Ipv6SocketAddress>,
1221 >,
1222 _: (),
1223 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1224 if let Some(inner) = this {
1225 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1226 ::fidl_next::wire::Box::encode_present(out);
1227 } else {
1228 ::fidl_next::wire::Box::encode_absent(out);
1229 }
1230
1231 Ok(())
1232 }
1233 }
1234
1235 unsafe impl<'a, ___E>
1236 ::fidl_next::EncodeOption<
1237 ::fidl_next::wire::Box<'static, crate::wire::Ipv6SocketAddress>,
1238 ___E,
1239 > for &'a Ipv6SocketAddress
1240 where
1241 ___E: ::fidl_next::Encoder + ?Sized,
1242 &'a Ipv6SocketAddress: ::fidl_next::Encode<crate::wire::Ipv6SocketAddress, ___E>,
1243 {
1244 #[inline]
1245 fn encode_option(
1246 this: ::core::option::Option<Self>,
1247 encoder: &mut ___E,
1248 out: &mut ::core::mem::MaybeUninit<
1249 ::fidl_next::wire::Box<'static, crate::wire::Ipv6SocketAddress>,
1250 >,
1251 _: (),
1252 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1253 if let Some(inner) = this {
1254 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1255 ::fidl_next::wire::Box::encode_present(out);
1256 } else {
1257 ::fidl_next::wire::Box::encode_absent(out);
1258 }
1259
1260 Ok(())
1261 }
1262 }
1263
1264 impl ::fidl_next::FromWire<crate::wire::Ipv6SocketAddress> for Ipv6SocketAddress {
1265 #[inline]
1266 fn from_wire(wire: crate::wire::Ipv6SocketAddress) -> Self {
1267 Self {
1268 address: ::fidl_next::FromWire::from_wire(wire.address),
1269
1270 port: ::fidl_next::FromWire::from_wire(wire.port),
1271
1272 zone_index: ::fidl_next::FromWire::from_wire(wire.zone_index),
1273 }
1274 }
1275 }
1276
1277 impl ::fidl_next::FromWireRef<crate::wire::Ipv6SocketAddress> for Ipv6SocketAddress {
1278 #[inline]
1279 fn from_wire_ref(wire: &crate::wire::Ipv6SocketAddress) -> Self {
1280 Self {
1281 address: ::fidl_next::FromWireRef::from_wire_ref(&wire.address),
1282
1283 port: ::fidl_next::FromWireRef::from_wire_ref(&wire.port),
1284
1285 zone_index: ::fidl_next::FromWireRef::from_wire_ref(&wire.zone_index),
1286 }
1287 }
1288 }
1289
1290 #[doc = " Domains for a mark. This allows multiple marks to be set and retrieved\n independently.\n"]
1291 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1292 #[repr(u8)]
1293 pub enum MarkDomain {
1294 Mark1 = 1,
1295 Mark2 = 2,
1296 }
1297 impl ::core::convert::TryFrom<u8> for MarkDomain {
1298 type Error = ::fidl_next::UnknownStrictEnumMemberError;
1299 fn try_from(
1300 value: u8,
1301 ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
1302 match value {
1303 1 => Ok(Self::Mark1),
1304 2 => Ok(Self::Mark2),
1305
1306 _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
1307 }
1308 }
1309 }
1310
1311 impl ::std::convert::From<MarkDomain> for u8 {
1312 fn from(value: MarkDomain) -> Self {
1313 match value {
1314 MarkDomain::Mark1 => 1,
1315 MarkDomain::Mark2 => 2,
1316 }
1317 }
1318 }
1319
1320 unsafe impl<___E> ::fidl_next::Encode<crate::wire::MarkDomain, ___E> for MarkDomain
1321 where
1322 ___E: ?Sized,
1323 {
1324 #[inline]
1325 fn encode(
1326 self,
1327 encoder: &mut ___E,
1328 out: &mut ::core::mem::MaybeUninit<crate::wire::MarkDomain>,
1329 _: (),
1330 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1331 ::fidl_next::Encode::encode(&self, encoder, out, ())
1332 }
1333 }
1334
1335 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::MarkDomain, ___E> for &'a MarkDomain
1336 where
1337 ___E: ?Sized,
1338 {
1339 #[inline]
1340 fn encode(
1341 self,
1342 encoder: &mut ___E,
1343 out: &mut ::core::mem::MaybeUninit<crate::wire::MarkDomain>,
1344 _: (),
1345 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1346 ::fidl_next::munge!(let crate::wire::MarkDomain { value } = out);
1347 let _ = value.write(u8::from(match *self {
1348 MarkDomain::Mark1 => 1,
1349
1350 MarkDomain::Mark2 => 2,
1351 }));
1352
1353 Ok(())
1354 }
1355 }
1356
1357 impl ::core::convert::From<crate::wire::MarkDomain> for MarkDomain {
1358 fn from(wire: crate::wire::MarkDomain) -> Self {
1359 match u8::from(wire.value) {
1360 1 => Self::Mark1,
1361
1362 2 => Self::Mark2,
1363
1364 _ => unsafe { ::core::hint::unreachable_unchecked() },
1365 }
1366 }
1367 }
1368
1369 impl ::fidl_next::FromWire<crate::wire::MarkDomain> for MarkDomain {
1370 #[inline]
1371 fn from_wire(wire: crate::wire::MarkDomain) -> Self {
1372 Self::from(wire)
1373 }
1374 }
1375
1376 impl ::fidl_next::FromWireRef<crate::wire::MarkDomain> for MarkDomain {
1377 #[inline]
1378 fn from_wire_ref(wire: &crate::wire::MarkDomain) -> Self {
1379 Self::from(*wire)
1380 }
1381 }
1382
1383 #[doc = " A MAC address used to identify a network interface on the data link layer within the network.\n"]
1384 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1385 #[repr(C)]
1386 pub struct MacAddress {
1387 pub octets: [u8; 6],
1388 }
1389
1390 unsafe impl<___E> ::fidl_next::Encode<crate::wire::MacAddress, ___E> for MacAddress
1391 where
1392 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1393 {
1394 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, crate::wire::MacAddress> = unsafe {
1395 ::fidl_next::CopyOptimization::enable_if(
1396 true && <[u8; 6] as ::fidl_next::Encode<[u8; 6], ___E>>::COPY_OPTIMIZATION
1397 .is_enabled(),
1398 )
1399 };
1400
1401 #[inline]
1402 fn encode(
1403 self,
1404 encoder_: &mut ___E,
1405 out_: &mut ::core::mem::MaybeUninit<crate::wire::MacAddress>,
1406 _: (),
1407 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1408 ::fidl_next::munge! {
1409 let crate::wire::MacAddress {
1410 octets,
1411
1412 } = out_;
1413 }
1414
1415 ::fidl_next::Encode::encode(self.octets, encoder_, octets, ())?;
1416
1417 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(octets.as_mut_ptr()) };
1418
1419 Ok(())
1420 }
1421 }
1422
1423 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::MacAddress, ___E> for &'a MacAddress
1424 where
1425 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1426 {
1427 #[inline]
1428 fn encode(
1429 self,
1430 encoder_: &mut ___E,
1431 out_: &mut ::core::mem::MaybeUninit<crate::wire::MacAddress>,
1432 _: (),
1433 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1434 ::fidl_next::munge! {
1435 let crate::wire::MacAddress {
1436 octets,
1437
1438 } = out_;
1439 }
1440
1441 ::fidl_next::Encode::encode(&self.octets, encoder_, octets, ())?;
1442
1443 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(octets.as_mut_ptr()) };
1444
1445 Ok(())
1446 }
1447 }
1448
1449 unsafe impl<___E>
1450 ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::MacAddress>, ___E>
1451 for MacAddress
1452 where
1453 ___E: ::fidl_next::Encoder + ?Sized,
1454 MacAddress: ::fidl_next::Encode<crate::wire::MacAddress, ___E>,
1455 {
1456 #[inline]
1457 fn encode_option(
1458 this: ::core::option::Option<Self>,
1459 encoder: &mut ___E,
1460 out: &mut ::core::mem::MaybeUninit<
1461 ::fidl_next::wire::Box<'static, crate::wire::MacAddress>,
1462 >,
1463 _: (),
1464 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1465 if let Some(inner) = this {
1466 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1467 ::fidl_next::wire::Box::encode_present(out);
1468 } else {
1469 ::fidl_next::wire::Box::encode_absent(out);
1470 }
1471
1472 Ok(())
1473 }
1474 }
1475
1476 unsafe impl<'a, ___E>
1477 ::fidl_next::EncodeOption<::fidl_next::wire::Box<'static, crate::wire::MacAddress>, ___E>
1478 for &'a MacAddress
1479 where
1480 ___E: ::fidl_next::Encoder + ?Sized,
1481 &'a MacAddress: ::fidl_next::Encode<crate::wire::MacAddress, ___E>,
1482 {
1483 #[inline]
1484 fn encode_option(
1485 this: ::core::option::Option<Self>,
1486 encoder: &mut ___E,
1487 out: &mut ::core::mem::MaybeUninit<
1488 ::fidl_next::wire::Box<'static, crate::wire::MacAddress>,
1489 >,
1490 _: (),
1491 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1492 if let Some(inner) = this {
1493 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
1494 ::fidl_next::wire::Box::encode_present(out);
1495 } else {
1496 ::fidl_next::wire::Box::encode_absent(out);
1497 }
1498
1499 Ok(())
1500 }
1501 }
1502
1503 impl ::fidl_next::FromWire<crate::wire::MacAddress> for MacAddress {
1504 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<crate::wire::MacAddress, Self> = unsafe {
1505 ::fidl_next::CopyOptimization::enable_if(
1506 true && <[u8; 6] as ::fidl_next::FromWire<[u8; 6]>>::COPY_OPTIMIZATION.is_enabled(),
1507 )
1508 };
1509
1510 #[inline]
1511 fn from_wire(wire: crate::wire::MacAddress) -> Self {
1512 Self { octets: ::fidl_next::FromWire::from_wire(wire.octets) }
1513 }
1514 }
1515
1516 impl ::fidl_next::FromWireRef<crate::wire::MacAddress> for MacAddress {
1517 #[inline]
1518 fn from_wire_ref(wire: &crate::wire::MacAddress) -> Self {
1519 Self { octets: ::fidl_next::FromWireRef::from_wire_ref(&wire.octets) }
1520 }
1521 }
1522
1523 #[doc = " A mark that is used to make route decisions and can be attached to packets.\n"]
1524 pub type Mark = u32;
1525
1526 #[doc = " Includes all the marks the platform supports.\n"]
1527 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1528 pub struct Marks {
1529 pub mark_1: ::core::option::Option<u32>,
1530
1531 pub mark_2: ::core::option::Option<u32>,
1532 }
1533
1534 impl Marks {
1535 fn __max_ordinal(&self) -> usize {
1536 if self.mark_2.is_some() {
1537 return 2;
1538 }
1539
1540 if self.mark_1.is_some() {
1541 return 1;
1542 }
1543
1544 0
1545 }
1546 }
1547
1548 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Marks<'static>, ___E> for Marks
1549 where
1550 ___E: ::fidl_next::Encoder + ?Sized,
1551 {
1552 #[inline]
1553 fn encode(
1554 mut self,
1555 encoder: &mut ___E,
1556 out: &mut ::core::mem::MaybeUninit<crate::wire::Marks<'static>>,
1557 _: (),
1558 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1559 ::fidl_next::munge!(let crate::wire::Marks { table } = out);
1560
1561 let max_ord = self.__max_ordinal();
1562
1563 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1564 ::fidl_next::Wire::zero_padding(&mut out);
1565
1566 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1567 ::fidl_next::wire::Envelope,
1568 >(encoder, max_ord);
1569
1570 for i in 1..=max_ord {
1571 match i {
1572 2 => {
1573 if let Some(value) = self.mark_2.take() {
1574 ::fidl_next::wire::Envelope::encode_value::<
1575 ::fidl_next::wire::Uint32,
1576 ___E,
1577 >(
1578 value, preallocated.encoder, &mut out, ()
1579 )?;
1580 } else {
1581 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1582 }
1583 }
1584
1585 1 => {
1586 if let Some(value) = self.mark_1.take() {
1587 ::fidl_next::wire::Envelope::encode_value::<
1588 ::fidl_next::wire::Uint32,
1589 ___E,
1590 >(
1591 value, preallocated.encoder, &mut out, ()
1592 )?;
1593 } else {
1594 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1595 }
1596 }
1597
1598 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1599 }
1600 unsafe {
1601 preallocated.write_next(out.assume_init_ref());
1602 }
1603 }
1604
1605 ::fidl_next::wire::Table::encode_len(table, max_ord);
1606
1607 Ok(())
1608 }
1609 }
1610
1611 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Marks<'static>, ___E> for &'a Marks
1612 where
1613 ___E: ::fidl_next::Encoder + ?Sized,
1614 {
1615 #[inline]
1616 fn encode(
1617 self,
1618 encoder: &mut ___E,
1619 out: &mut ::core::mem::MaybeUninit<crate::wire::Marks<'static>>,
1620 _: (),
1621 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1622 ::fidl_next::munge!(let crate::wire::Marks { table } = out);
1623
1624 let max_ord = self.__max_ordinal();
1625
1626 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1627 ::fidl_next::Wire::zero_padding(&mut out);
1628
1629 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1630 ::fidl_next::wire::Envelope,
1631 >(encoder, max_ord);
1632
1633 for i in 1..=max_ord {
1634 match i {
1635 2 => {
1636 if let Some(value) = &self.mark_2 {
1637 ::fidl_next::wire::Envelope::encode_value::<
1638 ::fidl_next::wire::Uint32,
1639 ___E,
1640 >(
1641 value, preallocated.encoder, &mut out, ()
1642 )?;
1643 } else {
1644 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1645 }
1646 }
1647
1648 1 => {
1649 if let Some(value) = &self.mark_1 {
1650 ::fidl_next::wire::Envelope::encode_value::<
1651 ::fidl_next::wire::Uint32,
1652 ___E,
1653 >(
1654 value, preallocated.encoder, &mut out, ()
1655 )?;
1656 } else {
1657 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1658 }
1659 }
1660
1661 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1662 }
1663 unsafe {
1664 preallocated.write_next(out.assume_init_ref());
1665 }
1666 }
1667
1668 ::fidl_next::wire::Table::encode_len(table, max_ord);
1669
1670 Ok(())
1671 }
1672 }
1673
1674 impl<'de> ::fidl_next::FromWire<crate::wire::Marks<'de>> for Marks {
1675 #[inline]
1676 fn from_wire(wire_: crate::wire::Marks<'de>) -> Self {
1677 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1678
1679 let mark_1 = wire_.table.get(1);
1680
1681 let mark_2 = wire_.table.get(2);
1682
1683 Self {
1684 mark_1: mark_1.map(|envelope| {
1685 ::fidl_next::FromWire::from_wire(unsafe {
1686 envelope.read_unchecked::<::fidl_next::wire::Uint32>()
1687 })
1688 }),
1689
1690 mark_2: mark_2.map(|envelope| {
1691 ::fidl_next::FromWire::from_wire(unsafe {
1692 envelope.read_unchecked::<::fidl_next::wire::Uint32>()
1693 })
1694 }),
1695 }
1696 }
1697 }
1698
1699 impl<'de> ::fidl_next::FromWireRef<crate::wire::Marks<'de>> for Marks {
1700 #[inline]
1701 fn from_wire_ref(wire: &crate::wire::Marks<'de>) -> Self {
1702 Self {
1703 mark_1: wire.table.get(1).map(|envelope| {
1704 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
1705 envelope.deref_unchecked::<::fidl_next::wire::Uint32>()
1706 })
1707 }),
1708
1709 mark_2: wire.table.get(2).map(|envelope| {
1710 ::fidl_next::FromWireRef::from_wire_ref(unsafe {
1711 envelope.deref_unchecked::<::fidl_next::wire::Uint32>()
1712 })
1713 }),
1714 }
1715 }
1716 }
1717
1718 #[doc = " The metric of a route. Lower metrics indicate higher priority.\n"]
1719 pub type RouteMetric = u32;
1720
1721 #[doc = " Represents an IP socket address that may be either v4 or v6.\n"]
1722 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1723 pub enum SocketAddress {
1724 Ipv4(crate::natural::Ipv4SocketAddress),
1725
1726 Ipv6(crate::natural::Ipv6SocketAddress),
1727 }
1728
1729 unsafe impl<___E> ::fidl_next::Encode<crate::wire::SocketAddress<'static>, ___E> for SocketAddress
1730 where
1731 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1732 ___E: ::fidl_next::Encoder,
1733 {
1734 #[inline]
1735 fn encode(
1736 self,
1737 encoder: &mut ___E,
1738 out: &mut ::core::mem::MaybeUninit<crate::wire::SocketAddress<'static>>,
1739 _: (),
1740 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1741 ::fidl_next::munge!(let crate::wire::SocketAddress { raw, _phantom: _ } = out);
1742
1743 match self {
1744 Self::Ipv4(value) => ::fidl_next::wire::Union::encode_as::<
1745 ___E,
1746 crate::wire::Ipv4SocketAddress,
1747 >(value, 1, encoder, raw, ())?,
1748
1749 Self::Ipv6(value) => ::fidl_next::wire::Union::encode_as::<
1750 ___E,
1751 crate::wire::Ipv6SocketAddress,
1752 >(value, 2, encoder, raw, ())?,
1753 }
1754
1755 Ok(())
1756 }
1757 }
1758
1759 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::SocketAddress<'static>, ___E>
1760 for &'a SocketAddress
1761 where
1762 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1763 ___E: ::fidl_next::Encoder,
1764 {
1765 #[inline]
1766 fn encode(
1767 self,
1768 encoder: &mut ___E,
1769 out: &mut ::core::mem::MaybeUninit<crate::wire::SocketAddress<'static>>,
1770 _: (),
1771 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1772 ::fidl_next::munge!(let crate::wire::SocketAddress { raw, _phantom: _ } = out);
1773
1774 match self {
1775 SocketAddress::Ipv4(value) => ::fidl_next::wire::Union::encode_as::<
1776 ___E,
1777 crate::wire::Ipv4SocketAddress,
1778 >(value, 1, encoder, raw, ())?,
1779
1780 SocketAddress::Ipv6(value) => ::fidl_next::wire::Union::encode_as::<
1781 ___E,
1782 crate::wire::Ipv6SocketAddress,
1783 >(value, 2, encoder, raw, ())?,
1784 }
1785
1786 Ok(())
1787 }
1788 }
1789
1790 unsafe impl<___E> ::fidl_next::EncodeOption<crate::wire_optional::SocketAddress<'static>, ___E>
1791 for SocketAddress
1792 where
1793 ___E: ?Sized,
1794 SocketAddress: ::fidl_next::Encode<crate::wire::SocketAddress<'static>, ___E>,
1795 {
1796 #[inline]
1797 fn encode_option(
1798 this: ::core::option::Option<Self>,
1799 encoder: &mut ___E,
1800 out: &mut ::core::mem::MaybeUninit<crate::wire_optional::SocketAddress<'static>>,
1801 _: (),
1802 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1803 ::fidl_next::munge!(let crate::wire_optional::SocketAddress { raw, _phantom: _ } = &mut *out);
1804
1805 if let Some(inner) = this {
1806 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
1807 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
1808 } else {
1809 ::fidl_next::wire::Union::encode_absent(raw);
1810 }
1811
1812 Ok(())
1813 }
1814 }
1815
1816 unsafe impl<'a, ___E>
1817 ::fidl_next::EncodeOption<crate::wire_optional::SocketAddress<'static>, ___E>
1818 for &'a SocketAddress
1819 where
1820 ___E: ?Sized,
1821 &'a SocketAddress: ::fidl_next::Encode<crate::wire::SocketAddress<'static>, ___E>,
1822 {
1823 #[inline]
1824 fn encode_option(
1825 this: ::core::option::Option<Self>,
1826 encoder: &mut ___E,
1827 out: &mut ::core::mem::MaybeUninit<crate::wire_optional::SocketAddress<'static>>,
1828 _: (),
1829 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1830 ::fidl_next::munge!(let crate::wire_optional::SocketAddress { raw, _phantom: _ } = &mut *out);
1831
1832 if let Some(inner) = this {
1833 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
1834 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
1835 } else {
1836 ::fidl_next::wire::Union::encode_absent(raw);
1837 }
1838
1839 Ok(())
1840 }
1841 }
1842
1843 impl<'de> ::fidl_next::FromWire<crate::wire::SocketAddress<'de>> for SocketAddress {
1844 #[inline]
1845 fn from_wire(wire: crate::wire::SocketAddress<'de>) -> Self {
1846 let wire = ::core::mem::ManuallyDrop::new(wire);
1847 match wire.raw.ordinal() {
1848 1 => Self::Ipv4(::fidl_next::FromWire::from_wire(unsafe {
1849 wire.raw.get().read_unchecked::<crate::wire::Ipv4SocketAddress>()
1850 })),
1851
1852 2 => Self::Ipv6(::fidl_next::FromWire::from_wire(unsafe {
1853 wire.raw.get().read_unchecked::<crate::wire::Ipv6SocketAddress>()
1854 })),
1855
1856 _ => unsafe { ::core::hint::unreachable_unchecked() },
1857 }
1858 }
1859 }
1860
1861 impl<'de> ::fidl_next::FromWireRef<crate::wire::SocketAddress<'de>> for SocketAddress {
1862 #[inline]
1863 fn from_wire_ref(wire: &crate::wire::SocketAddress<'de>) -> Self {
1864 match wire.raw.ordinal() {
1865 1 => Self::Ipv4(::fidl_next::FromWireRef::from_wire_ref(unsafe {
1866 wire.raw.get().deref_unchecked::<crate::wire::Ipv4SocketAddress>()
1867 })),
1868
1869 2 => Self::Ipv6(::fidl_next::FromWireRef::from_wire_ref(unsafe {
1870 wire.raw.get().deref_unchecked::<crate::wire::Ipv6SocketAddress>()
1871 })),
1872
1873 _ => unsafe { ::core::hint::unreachable_unchecked() },
1874 }
1875 }
1876 }
1877
1878 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::SocketAddress<'de>> for SocketAddress {
1879 #[inline]
1880 fn from_wire_option(
1881 wire: crate::wire_optional::SocketAddress<'de>,
1882 ) -> ::core::option::Option<Self> {
1883 if let Some(inner) = wire.into_option() {
1884 Some(::fidl_next::FromWire::from_wire(inner))
1885 } else {
1886 None
1887 }
1888 }
1889 }
1890
1891 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::SocketAddress<'de>>
1892 for Box<SocketAddress>
1893 {
1894 #[inline]
1895 fn from_wire_option(
1896 wire: crate::wire_optional::SocketAddress<'de>,
1897 ) -> ::core::option::Option<Self> {
1898 <SocketAddress as ::fidl_next::FromWireOption<
1899 crate::wire_optional::SocketAddress<'de>,
1900 >>::from_wire_option(wire)
1901 .map(Box::new)
1902 }
1903 }
1904
1905 impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::SocketAddress<'de>>
1906 for Box<SocketAddress>
1907 {
1908 #[inline]
1909 fn from_wire_option_ref(
1910 wire: &crate::wire_optional::SocketAddress<'de>,
1911 ) -> ::core::option::Option<Self> {
1912 if let Some(inner) = wire.as_ref() {
1913 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
1914 } else {
1915 None
1916 }
1917 }
1918 }
1919
1920 #[doc = " An IP address with its subnet prefix length.\n"]
1921 #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1922 pub struct Subnet {
1923 pub addr: crate::natural::IpAddress,
1924
1925 pub prefix_len: u8,
1926 }
1927
1928 unsafe impl<___E> ::fidl_next::Encode<crate::wire::Subnet<'static>, ___E> for Subnet
1929 where
1930 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1931 ___E: ::fidl_next::Encoder,
1932 {
1933 #[inline]
1934 fn encode(
1935 self,
1936 encoder_: &mut ___E,
1937 out_: &mut ::core::mem::MaybeUninit<crate::wire::Subnet<'static>>,
1938 _: (),
1939 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1940 ::fidl_next::munge! {
1941 let crate::wire::Subnet {
1942 addr,
1943 prefix_len,
1944
1945 } = out_;
1946 }
1947
1948 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
1949
1950 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
1951
1952 ::fidl_next::Encode::encode(self.prefix_len, encoder_, prefix_len, ())?;
1953
1954 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(prefix_len.as_mut_ptr()) };
1955
1956 Ok(())
1957 }
1958 }
1959
1960 unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Subnet<'static>, ___E> for &'a Subnet
1961 where
1962 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1963 ___E: ::fidl_next::Encoder,
1964 {
1965 #[inline]
1966 fn encode(
1967 self,
1968 encoder_: &mut ___E,
1969 out_: &mut ::core::mem::MaybeUninit<crate::wire::Subnet<'static>>,
1970 _: (),
1971 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1972 ::fidl_next::munge! {
1973 let crate::wire::Subnet {
1974 addr,
1975 prefix_len,
1976
1977 } = out_;
1978 }
1979
1980 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
1981
1982 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(addr.as_mut_ptr()) };
1983
1984 ::fidl_next::Encode::encode(&self.prefix_len, encoder_, prefix_len, ())?;
1985
1986 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(prefix_len.as_mut_ptr()) };
1987
1988 Ok(())
1989 }
1990 }
1991
1992 unsafe impl<___E>
1993 ::fidl_next::EncodeOption<
1994 ::fidl_next::wire::Box<'static, crate::wire::Subnet<'static>>,
1995 ___E,
1996 > for Subnet
1997 where
1998 ___E: ::fidl_next::Encoder + ?Sized,
1999 Subnet: ::fidl_next::Encode<crate::wire::Subnet<'static>, ___E>,
2000 {
2001 #[inline]
2002 fn encode_option(
2003 this: ::core::option::Option<Self>,
2004 encoder: &mut ___E,
2005 out: &mut ::core::mem::MaybeUninit<
2006 ::fidl_next::wire::Box<'static, crate::wire::Subnet<'static>>,
2007 >,
2008 _: (),
2009 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2010 if let Some(inner) = this {
2011 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2012 ::fidl_next::wire::Box::encode_present(out);
2013 } else {
2014 ::fidl_next::wire::Box::encode_absent(out);
2015 }
2016
2017 Ok(())
2018 }
2019 }
2020
2021 unsafe impl<'a, ___E>
2022 ::fidl_next::EncodeOption<
2023 ::fidl_next::wire::Box<'static, crate::wire::Subnet<'static>>,
2024 ___E,
2025 > for &'a Subnet
2026 where
2027 ___E: ::fidl_next::Encoder + ?Sized,
2028 &'a Subnet: ::fidl_next::Encode<crate::wire::Subnet<'static>, ___E>,
2029 {
2030 #[inline]
2031 fn encode_option(
2032 this: ::core::option::Option<Self>,
2033 encoder: &mut ___E,
2034 out: &mut ::core::mem::MaybeUninit<
2035 ::fidl_next::wire::Box<'static, crate::wire::Subnet<'static>>,
2036 >,
2037 _: (),
2038 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2039 if let Some(inner) = this {
2040 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
2041 ::fidl_next::wire::Box::encode_present(out);
2042 } else {
2043 ::fidl_next::wire::Box::encode_absent(out);
2044 }
2045
2046 Ok(())
2047 }
2048 }
2049
2050 impl<'de> ::fidl_next::FromWire<crate::wire::Subnet<'de>> for Subnet {
2051 #[inline]
2052 fn from_wire(wire: crate::wire::Subnet<'de>) -> Self {
2053 Self {
2054 addr: ::fidl_next::FromWire::from_wire(wire.addr),
2055
2056 prefix_len: ::fidl_next::FromWire::from_wire(wire.prefix_len),
2057 }
2058 }
2059 }
2060
2061 impl<'de> ::fidl_next::FromWireRef<crate::wire::Subnet<'de>> for Subnet {
2062 #[inline]
2063 fn from_wire_ref(wire: &crate::wire::Subnet<'de>) -> Self {
2064 Self {
2065 addr: ::fidl_next::FromWireRef::from_wire_ref(&wire.addr),
2066
2067 prefix_len: ::fidl_next::FromWireRef::from_wire_ref(&wire.prefix_len),
2068 }
2069 }
2070 }
2071}
2072
2073pub mod wire {
2074
2075 pub type Hostname<'de> = ::fidl_next::wire::String<'de>;
2077
2078 pub type InterfaceId = ::fidl_next::wire::Uint64;
2080
2081 #[derive(Clone, Debug)]
2083 #[repr(C)]
2084 pub struct Ipv4Address {
2085 pub addr: [u8; 4],
2086 }
2087
2088 static_assertions::const_assert_eq!(std::mem::size_of::<Ipv4Address>(), 4);
2089 static_assertions::const_assert_eq!(std::mem::align_of::<Ipv4Address>(), 1);
2090
2091 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv4Address, addr), 0);
2092
2093 impl ::fidl_next::Constrained for Ipv4Address {
2094 type Constraint = ();
2095
2096 fn validate(
2097 _: ::fidl_next::Slot<'_, Self>,
2098 _: Self::Constraint,
2099 ) -> Result<(), ::fidl_next::ValidationError> {
2100 Ok(())
2101 }
2102 }
2103
2104 unsafe impl ::fidl_next::Wire for Ipv4Address {
2105 type Narrowed<'de> = Ipv4Address;
2106
2107 #[inline]
2108 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2109 ::fidl_next::munge! {
2110 let Self {
2111 addr,
2112
2113 } = &mut *out_;
2114 }
2115
2116 ::fidl_next::Wire::zero_padding(addr);
2117 }
2118 }
2119
2120 unsafe impl<___D> ::fidl_next::Decode<___D> for Ipv4Address
2121 where
2122 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2123 {
2124 fn decode(
2125 slot_: ::fidl_next::Slot<'_, Self>,
2126 decoder_: &mut ___D,
2127 _: (),
2128 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2129 ::fidl_next::munge! {
2130 let Self {
2131 mut addr,
2132
2133 } = slot_;
2134 }
2135
2136 let _field = addr.as_mut();
2137
2138 ::fidl_next::Decode::decode(addr.as_mut(), decoder_, ())?;
2139
2140 Ok(())
2141 }
2142 }
2143
2144 impl ::fidl_next::IntoNatural for Ipv4Address {
2145 type Natural = crate::natural::Ipv4Address;
2146 }
2147
2148 #[derive(Clone, Debug)]
2150 #[repr(C)]
2151 pub struct Ipv6Address {
2152 pub addr: [u8; 16],
2153 }
2154
2155 static_assertions::const_assert_eq!(std::mem::size_of::<Ipv6Address>(), 16);
2156 static_assertions::const_assert_eq!(std::mem::align_of::<Ipv6Address>(), 1);
2157
2158 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv6Address, addr), 0);
2159
2160 impl ::fidl_next::Constrained for Ipv6Address {
2161 type Constraint = ();
2162
2163 fn validate(
2164 _: ::fidl_next::Slot<'_, Self>,
2165 _: Self::Constraint,
2166 ) -> Result<(), ::fidl_next::ValidationError> {
2167 Ok(())
2168 }
2169 }
2170
2171 unsafe impl ::fidl_next::Wire for Ipv6Address {
2172 type Narrowed<'de> = Ipv6Address;
2173
2174 #[inline]
2175 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2176 ::fidl_next::munge! {
2177 let Self {
2178 addr,
2179
2180 } = &mut *out_;
2181 }
2182
2183 ::fidl_next::Wire::zero_padding(addr);
2184 }
2185 }
2186
2187 unsafe impl<___D> ::fidl_next::Decode<___D> for Ipv6Address
2188 where
2189 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2190 {
2191 fn decode(
2192 slot_: ::fidl_next::Slot<'_, Self>,
2193 decoder_: &mut ___D,
2194 _: (),
2195 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2196 ::fidl_next::munge! {
2197 let Self {
2198 mut addr,
2199
2200 } = slot_;
2201 }
2202
2203 let _field = addr.as_mut();
2204
2205 ::fidl_next::Decode::decode(addr.as_mut(), decoder_, ())?;
2206
2207 Ok(())
2208 }
2209 }
2210
2211 impl ::fidl_next::IntoNatural for Ipv6Address {
2212 type Natural = crate::natural::Ipv6Address;
2213 }
2214
2215 #[repr(transparent)]
2217 pub struct IpAddress<'de> {
2218 pub(crate) raw: ::fidl_next::wire::Union,
2219 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
2220 }
2221
2222 impl<'de> Drop for IpAddress<'de> {
2223 fn drop(&mut self) {
2224 match self.raw.ordinal() {
2225 1 => {
2226 let _ = unsafe { self.raw.get().read_unchecked::<crate::wire::Ipv4Address>() };
2227 }
2228
2229 2 => {
2230 let _ = unsafe { self.raw.get().read_unchecked::<crate::wire::Ipv6Address>() };
2231 }
2232
2233 _ => unsafe { ::core::hint::unreachable_unchecked() },
2234 }
2235 }
2236 }
2237
2238 impl ::fidl_next::Constrained for IpAddress<'_> {
2239 type Constraint = ();
2240
2241 fn validate(
2242 _: ::fidl_next::Slot<'_, Self>,
2243 _: Self::Constraint,
2244 ) -> Result<(), ::fidl_next::ValidationError> {
2245 Ok(())
2246 }
2247 }
2248
2249 unsafe impl ::fidl_next::Wire for IpAddress<'static> {
2250 type Narrowed<'de> = IpAddress<'de>;
2251
2252 #[inline]
2253 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2254 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
2255 ::fidl_next::wire::Union::zero_padding(raw);
2256 }
2257 }
2258
2259 pub mod ip_address {
2260 pub enum Ref<'de> {
2261 Ipv4(&'de crate::wire::Ipv4Address),
2262
2263 Ipv6(&'de crate::wire::Ipv6Address),
2264 }
2265
2266 pub enum Value {
2267 Ipv4(crate::wire::Ipv4Address),
2268
2269 Ipv6(crate::wire::Ipv6Address),
2270 }
2271 }
2272
2273 impl<'de> IpAddress<'de> {
2274 pub fn as_ref(&self) -> crate::wire::ip_address::Ref<'_> {
2275 match self.raw.ordinal() {
2276 1 => crate::wire::ip_address::Ref::Ipv4(unsafe {
2277 self.raw.get().deref_unchecked::<crate::wire::Ipv4Address>()
2278 }),
2279
2280 2 => crate::wire::ip_address::Ref::Ipv6(unsafe {
2281 self.raw.get().deref_unchecked::<crate::wire::Ipv6Address>()
2282 }),
2283
2284 _ => unsafe { ::core::hint::unreachable_unchecked() },
2285 }
2286 }
2287
2288 pub fn into_inner(self) -> crate::wire::ip_address::Value {
2289 let this = ::core::mem::ManuallyDrop::new(self);
2290
2291 match this.raw.ordinal() {
2292 1 => crate::wire::ip_address::Value::Ipv4(unsafe {
2293 this.raw.get().read_unchecked::<crate::wire::Ipv4Address>()
2294 }),
2295
2296 2 => crate::wire::ip_address::Value::Ipv6(unsafe {
2297 this.raw.get().read_unchecked::<crate::wire::Ipv6Address>()
2298 }),
2299
2300 _ => unsafe { ::core::hint::unreachable_unchecked() },
2301 }
2302 }
2303 }
2304
2305 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for IpAddress<'de>
2306 where
2307 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2308 ___D: ::fidl_next::Decoder<'de>,
2309 {
2310 fn decode(
2311 mut slot: ::fidl_next::Slot<'_, Self>,
2312 decoder: &mut ___D,
2313 _: (),
2314 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2315 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
2316 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
2317 1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Ipv4Address>(
2318 raw,
2319 decoder,
2320 (),
2321 )?,
2322
2323 2 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Ipv6Address>(
2324 raw,
2325 decoder,
2326 (),
2327 )?,
2328
2329 ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)),
2330 }
2331
2332 Ok(())
2333 }
2334 }
2335
2336 impl<'de> ::core::fmt::Debug for IpAddress<'de> {
2337 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2338 match self.raw.ordinal() {
2339 1 => unsafe { self.raw.get().deref_unchecked::<crate::wire::Ipv4Address>().fmt(f) },
2340 2 => unsafe { self.raw.get().deref_unchecked::<crate::wire::Ipv6Address>().fmt(f) },
2341 _ => unsafe { ::core::hint::unreachable_unchecked() },
2342 }
2343 }
2344 }
2345
2346 impl<'de> ::fidl_next::IntoNatural for IpAddress<'de> {
2347 type Natural = crate::natural::IpAddress;
2348 }
2349
2350 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
2352 #[repr(transparent)]
2353 pub struct IpVersion {
2354 pub(crate) value: ::fidl_next::wire::Uint32,
2355 }
2356
2357 impl ::fidl_next::Constrained for IpVersion {
2358 type Constraint = ();
2359
2360 fn validate(
2361 _: ::fidl_next::Slot<'_, Self>,
2362 _: Self::Constraint,
2363 ) -> Result<(), ::fidl_next::ValidationError> {
2364 Ok(())
2365 }
2366 }
2367
2368 unsafe impl ::fidl_next::Wire for IpVersion {
2369 type Narrowed<'de> = Self;
2370
2371 #[inline]
2372 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2373 }
2375 }
2376
2377 impl IpVersion {
2378 pub const V4: IpVersion = IpVersion { value: ::fidl_next::wire::Uint32(1) };
2379
2380 pub const V6: IpVersion = IpVersion { value: ::fidl_next::wire::Uint32(2) };
2381 }
2382
2383 unsafe impl<___D> ::fidl_next::Decode<___D> for IpVersion
2384 where
2385 ___D: ?Sized,
2386 {
2387 fn decode(
2388 slot: ::fidl_next::Slot<'_, Self>,
2389 _: &mut ___D,
2390 _: (),
2391 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2392 ::fidl_next::munge!(let Self { value } = slot);
2393
2394 match u32::from(*value) {
2395 1 | 2 => (),
2396 unknown => {
2397 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
2398 }
2399 }
2400
2401 Ok(())
2402 }
2403 }
2404
2405 impl ::core::convert::From<crate::natural::IpVersion> for IpVersion {
2406 fn from(natural: crate::natural::IpVersion) -> Self {
2407 match natural {
2408 crate::natural::IpVersion::V4 => IpVersion::V4,
2409
2410 crate::natural::IpVersion::V6 => IpVersion::V6,
2411 }
2412 }
2413 }
2414
2415 impl ::fidl_next::IntoNatural for IpVersion {
2416 type Natural = crate::natural::IpVersion;
2417 }
2418
2419 #[derive(Clone, Debug)]
2421 #[repr(C)]
2422 pub struct Ipv4AddressWithPrefix {
2423 pub addr: crate::wire::Ipv4Address,
2424
2425 pub prefix_len: u8,
2426 }
2427
2428 static_assertions::const_assert_eq!(std::mem::size_of::<Ipv4AddressWithPrefix>(), 5);
2429 static_assertions::const_assert_eq!(std::mem::align_of::<Ipv4AddressWithPrefix>(), 1);
2430
2431 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv4AddressWithPrefix, addr), 0);
2432
2433 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv4AddressWithPrefix, prefix_len), 4);
2434
2435 impl ::fidl_next::Constrained for Ipv4AddressWithPrefix {
2436 type Constraint = ();
2437
2438 fn validate(
2439 _: ::fidl_next::Slot<'_, Self>,
2440 _: Self::Constraint,
2441 ) -> Result<(), ::fidl_next::ValidationError> {
2442 Ok(())
2443 }
2444 }
2445
2446 unsafe impl ::fidl_next::Wire for Ipv4AddressWithPrefix {
2447 type Narrowed<'de> = Ipv4AddressWithPrefix;
2448
2449 #[inline]
2450 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2451 ::fidl_next::munge! {
2452 let Self {
2453 addr,
2454 prefix_len,
2455
2456 } = &mut *out_;
2457 }
2458
2459 ::fidl_next::Wire::zero_padding(addr);
2460
2461 ::fidl_next::Wire::zero_padding(prefix_len);
2462 }
2463 }
2464
2465 unsafe impl<___D> ::fidl_next::Decode<___D> for Ipv4AddressWithPrefix
2466 where
2467 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2468 {
2469 fn decode(
2470 slot_: ::fidl_next::Slot<'_, Self>,
2471 decoder_: &mut ___D,
2472 _: (),
2473 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2474 ::fidl_next::munge! {
2475 let Self {
2476 mut addr,
2477 mut prefix_len,
2478
2479 } = slot_;
2480 }
2481
2482 let _field = addr.as_mut();
2483
2484 ::fidl_next::Decode::decode(addr.as_mut(), decoder_, ())?;
2485
2486 let _field = prefix_len.as_mut();
2487
2488 ::fidl_next::Decode::decode(prefix_len.as_mut(), decoder_, ())?;
2489
2490 Ok(())
2491 }
2492 }
2493
2494 impl ::fidl_next::IntoNatural for Ipv4AddressWithPrefix {
2495 type Natural = crate::natural::Ipv4AddressWithPrefix;
2496 }
2497
2498 #[derive(Clone, Debug)]
2500 #[repr(C)]
2501 pub struct Ipv4SocketAddress {
2502 pub address: crate::wire::Ipv4Address,
2503
2504 pub port: ::fidl_next::wire::Uint16,
2505 }
2506
2507 static_assertions::const_assert_eq!(std::mem::size_of::<Ipv4SocketAddress>(), 6);
2508 static_assertions::const_assert_eq!(std::mem::align_of::<Ipv4SocketAddress>(), 2);
2509
2510 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv4SocketAddress, address), 0);
2511
2512 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv4SocketAddress, port), 4);
2513
2514 impl ::fidl_next::Constrained for Ipv4SocketAddress {
2515 type Constraint = ();
2516
2517 fn validate(
2518 _: ::fidl_next::Slot<'_, Self>,
2519 _: Self::Constraint,
2520 ) -> Result<(), ::fidl_next::ValidationError> {
2521 Ok(())
2522 }
2523 }
2524
2525 unsafe impl ::fidl_next::Wire for Ipv4SocketAddress {
2526 type Narrowed<'de> = Ipv4SocketAddress;
2527
2528 #[inline]
2529 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2530 ::fidl_next::munge! {
2531 let Self {
2532 address,
2533 port,
2534
2535 } = &mut *out_;
2536 }
2537
2538 ::fidl_next::Wire::zero_padding(address);
2539
2540 ::fidl_next::Wire::zero_padding(port);
2541 }
2542 }
2543
2544 unsafe impl<___D> ::fidl_next::Decode<___D> for Ipv4SocketAddress
2545 where
2546 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2547 {
2548 fn decode(
2549 slot_: ::fidl_next::Slot<'_, Self>,
2550 decoder_: &mut ___D,
2551 _: (),
2552 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2553 ::fidl_next::munge! {
2554 let Self {
2555 mut address,
2556 mut port,
2557
2558 } = slot_;
2559 }
2560
2561 let _field = address.as_mut();
2562
2563 ::fidl_next::Decode::decode(address.as_mut(), decoder_, ())?;
2564
2565 let _field = port.as_mut();
2566
2567 ::fidl_next::Decode::decode(port.as_mut(), decoder_, ())?;
2568
2569 Ok(())
2570 }
2571 }
2572
2573 impl ::fidl_next::IntoNatural for Ipv4SocketAddress {
2574 type Natural = crate::natural::Ipv4SocketAddress;
2575 }
2576
2577 #[derive(Clone, Debug)]
2579 #[repr(C)]
2580 pub struct Ipv6AddressWithPrefix {
2581 pub addr: crate::wire::Ipv6Address,
2582
2583 pub prefix_len: u8,
2584 }
2585
2586 static_assertions::const_assert_eq!(std::mem::size_of::<Ipv6AddressWithPrefix>(), 17);
2587 static_assertions::const_assert_eq!(std::mem::align_of::<Ipv6AddressWithPrefix>(), 1);
2588
2589 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv6AddressWithPrefix, addr), 0);
2590
2591 static_assertions::const_assert_eq!(
2592 std::mem::offset_of!(Ipv6AddressWithPrefix, prefix_len),
2593 16
2594 );
2595
2596 impl ::fidl_next::Constrained for Ipv6AddressWithPrefix {
2597 type Constraint = ();
2598
2599 fn validate(
2600 _: ::fidl_next::Slot<'_, Self>,
2601 _: Self::Constraint,
2602 ) -> Result<(), ::fidl_next::ValidationError> {
2603 Ok(())
2604 }
2605 }
2606
2607 unsafe impl ::fidl_next::Wire for Ipv6AddressWithPrefix {
2608 type Narrowed<'de> = Ipv6AddressWithPrefix;
2609
2610 #[inline]
2611 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2612 ::fidl_next::munge! {
2613 let Self {
2614 addr,
2615 prefix_len,
2616
2617 } = &mut *out_;
2618 }
2619
2620 ::fidl_next::Wire::zero_padding(addr);
2621
2622 ::fidl_next::Wire::zero_padding(prefix_len);
2623 }
2624 }
2625
2626 unsafe impl<___D> ::fidl_next::Decode<___D> for Ipv6AddressWithPrefix
2627 where
2628 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2629 {
2630 fn decode(
2631 slot_: ::fidl_next::Slot<'_, Self>,
2632 decoder_: &mut ___D,
2633 _: (),
2634 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2635 ::fidl_next::munge! {
2636 let Self {
2637 mut addr,
2638 mut prefix_len,
2639
2640 } = slot_;
2641 }
2642
2643 let _field = addr.as_mut();
2644
2645 ::fidl_next::Decode::decode(addr.as_mut(), decoder_, ())?;
2646
2647 let _field = prefix_len.as_mut();
2648
2649 ::fidl_next::Decode::decode(prefix_len.as_mut(), decoder_, ())?;
2650
2651 Ok(())
2652 }
2653 }
2654
2655 impl ::fidl_next::IntoNatural for Ipv6AddressWithPrefix {
2656 type Natural = crate::natural::Ipv6AddressWithPrefix;
2657 }
2658
2659 #[derive(Clone, Debug)]
2661 #[repr(C)]
2662 pub struct Ipv6SocketAddress {
2663 pub address: crate::wire::Ipv6Address,
2664
2665 pub port: ::fidl_next::wire::Uint16,
2666
2667 pub zone_index: ::fidl_next::wire::Uint64,
2668 }
2669
2670 static_assertions::const_assert_eq!(std::mem::size_of::<Ipv6SocketAddress>(), 32);
2671 static_assertions::const_assert_eq!(std::mem::align_of::<Ipv6SocketAddress>(), 8);
2672
2673 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv6SocketAddress, address), 0);
2674
2675 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv6SocketAddress, port), 16);
2676
2677 static_assertions::const_assert_eq!(std::mem::offset_of!(Ipv6SocketAddress, zone_index), 24);
2678
2679 impl ::fidl_next::Constrained for Ipv6SocketAddress {
2680 type Constraint = ();
2681
2682 fn validate(
2683 _: ::fidl_next::Slot<'_, Self>,
2684 _: Self::Constraint,
2685 ) -> Result<(), ::fidl_next::ValidationError> {
2686 Ok(())
2687 }
2688 }
2689
2690 unsafe impl ::fidl_next::Wire for Ipv6SocketAddress {
2691 type Narrowed<'de> = Ipv6SocketAddress;
2692
2693 #[inline]
2694 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2695 ::fidl_next::munge! {
2696 let Self {
2697 address,
2698 port,
2699 zone_index,
2700
2701 } = &mut *out_;
2702 }
2703
2704 ::fidl_next::Wire::zero_padding(address);
2705
2706 ::fidl_next::Wire::zero_padding(port);
2707
2708 ::fidl_next::Wire::zero_padding(zone_index);
2709
2710 unsafe {
2711 out_.as_mut_ptr().cast::<u8>().add(18).write_bytes(0, 6);
2712 }
2713 }
2714 }
2715
2716 unsafe impl<___D> ::fidl_next::Decode<___D> for Ipv6SocketAddress
2717 where
2718 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2719 {
2720 fn decode(
2721 slot_: ::fidl_next::Slot<'_, Self>,
2722 decoder_: &mut ___D,
2723 _: (),
2724 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2725 if slot_.as_bytes()[18..24] != [0u8; 6] {
2726 return Err(::fidl_next::DecodeError::InvalidPadding);
2727 }
2728
2729 ::fidl_next::munge! {
2730 let Self {
2731 mut address,
2732 mut port,
2733 mut zone_index,
2734
2735 } = slot_;
2736 }
2737
2738 let _field = address.as_mut();
2739
2740 ::fidl_next::Decode::decode(address.as_mut(), decoder_, ())?;
2741
2742 let _field = port.as_mut();
2743
2744 ::fidl_next::Decode::decode(port.as_mut(), decoder_, ())?;
2745
2746 let _field = zone_index.as_mut();
2747
2748 ::fidl_next::Decode::decode(zone_index.as_mut(), decoder_, ())?;
2749
2750 Ok(())
2751 }
2752 }
2753
2754 impl ::fidl_next::IntoNatural for Ipv6SocketAddress {
2755 type Natural = crate::natural::Ipv6SocketAddress;
2756 }
2757
2758 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
2760 #[repr(transparent)]
2761 pub struct MarkDomain {
2762 pub(crate) value: u8,
2763 }
2764
2765 impl ::fidl_next::Constrained for MarkDomain {
2766 type Constraint = ();
2767
2768 fn validate(
2769 _: ::fidl_next::Slot<'_, Self>,
2770 _: Self::Constraint,
2771 ) -> Result<(), ::fidl_next::ValidationError> {
2772 Ok(())
2773 }
2774 }
2775
2776 unsafe impl ::fidl_next::Wire for MarkDomain {
2777 type Narrowed<'de> = Self;
2778
2779 #[inline]
2780 fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
2781 }
2783 }
2784
2785 impl MarkDomain {
2786 pub const MARK_1: MarkDomain = MarkDomain { value: 1 };
2787
2788 pub const MARK_2: MarkDomain = MarkDomain { value: 2 };
2789 }
2790
2791 unsafe impl<___D> ::fidl_next::Decode<___D> for MarkDomain
2792 where
2793 ___D: ?Sized,
2794 {
2795 fn decode(
2796 slot: ::fidl_next::Slot<'_, Self>,
2797 _: &mut ___D,
2798 _: (),
2799 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2800 ::fidl_next::munge!(let Self { value } = slot);
2801
2802 match u8::from(*value) {
2803 1 | 2 => (),
2804 unknown => {
2805 return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
2806 }
2807 }
2808
2809 Ok(())
2810 }
2811 }
2812
2813 impl ::core::convert::From<crate::natural::MarkDomain> for MarkDomain {
2814 fn from(natural: crate::natural::MarkDomain) -> Self {
2815 match natural {
2816 crate::natural::MarkDomain::Mark1 => MarkDomain::MARK_1,
2817
2818 crate::natural::MarkDomain::Mark2 => MarkDomain::MARK_2,
2819 }
2820 }
2821 }
2822
2823 impl ::fidl_next::IntoNatural for MarkDomain {
2824 type Natural = crate::natural::MarkDomain;
2825 }
2826
2827 #[derive(Clone, Debug)]
2829 #[repr(C)]
2830 pub struct MacAddress {
2831 pub octets: [u8; 6],
2832 }
2833
2834 static_assertions::const_assert_eq!(std::mem::size_of::<MacAddress>(), 6);
2835 static_assertions::const_assert_eq!(std::mem::align_of::<MacAddress>(), 1);
2836
2837 static_assertions::const_assert_eq!(std::mem::offset_of!(MacAddress, octets), 0);
2838
2839 impl ::fidl_next::Constrained for MacAddress {
2840 type Constraint = ();
2841
2842 fn validate(
2843 _: ::fidl_next::Slot<'_, Self>,
2844 _: Self::Constraint,
2845 ) -> Result<(), ::fidl_next::ValidationError> {
2846 Ok(())
2847 }
2848 }
2849
2850 unsafe impl ::fidl_next::Wire for MacAddress {
2851 type Narrowed<'de> = MacAddress;
2852
2853 #[inline]
2854 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
2855 ::fidl_next::munge! {
2856 let Self {
2857 octets,
2858
2859 } = &mut *out_;
2860 }
2861
2862 ::fidl_next::Wire::zero_padding(octets);
2863 }
2864 }
2865
2866 unsafe impl<___D> ::fidl_next::Decode<___D> for MacAddress
2867 where
2868 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
2869 {
2870 fn decode(
2871 slot_: ::fidl_next::Slot<'_, Self>,
2872 decoder_: &mut ___D,
2873 _: (),
2874 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2875 ::fidl_next::munge! {
2876 let Self {
2877 mut octets,
2878
2879 } = slot_;
2880 }
2881
2882 let _field = octets.as_mut();
2883
2884 ::fidl_next::Decode::decode(octets.as_mut(), decoder_, ())?;
2885
2886 Ok(())
2887 }
2888 }
2889
2890 impl ::fidl_next::IntoNatural for MacAddress {
2891 type Natural = crate::natural::MacAddress;
2892 }
2893
2894 pub type Mark = ::fidl_next::wire::Uint32;
2896
2897 #[repr(C)]
2899 pub struct Marks<'de> {
2900 pub(crate) table: ::fidl_next::wire::Table<'de>,
2901 }
2902
2903 impl<'de> Drop for Marks<'de> {
2904 fn drop(&mut self) {
2905 let _ = self
2906 .table
2907 .get(1)
2908 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
2909
2910 let _ = self
2911 .table
2912 .get(2)
2913 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
2914 }
2915 }
2916
2917 impl ::fidl_next::Constrained for Marks<'_> {
2918 type Constraint = ();
2919
2920 fn validate(
2921 _: ::fidl_next::Slot<'_, Self>,
2922 _: Self::Constraint,
2923 ) -> Result<(), ::fidl_next::ValidationError> {
2924 Ok(())
2925 }
2926 }
2927
2928 unsafe impl ::fidl_next::Wire for Marks<'static> {
2929 type Narrowed<'de> = Marks<'de>;
2930
2931 #[inline]
2932 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2933 ::fidl_next::munge!(let Self { table } = out);
2934 ::fidl_next::wire::Table::zero_padding(table);
2935 }
2936 }
2937
2938 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Marks<'de>
2939 where
2940 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2941 {
2942 fn decode(
2943 slot: ::fidl_next::Slot<'_, Self>,
2944 decoder: &mut ___D,
2945 _: (),
2946 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2947 ::fidl_next::munge!(let Self { table } = slot);
2948
2949 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2950 match ordinal {
2951 0 => unsafe { ::core::hint::unreachable_unchecked() },
2952
2953 1 => {
2954 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
2955 slot.as_mut(),
2956 decoder,
2957 (),
2958 )?;
2959
2960 Ok(())
2961 }
2962
2963 2 => {
2964 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
2965 slot.as_mut(),
2966 decoder,
2967 (),
2968 )?;
2969
2970 Ok(())
2971 }
2972
2973 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2974 }
2975 })
2976 }
2977 }
2978
2979 impl<'de> Marks<'de> {
2980 pub fn mark_1(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
2981 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2982 }
2983
2984 pub fn take_mark_1(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint32> {
2985 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2986 }
2987
2988 pub fn mark_2(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
2989 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2990 }
2991
2992 pub fn take_mark_2(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint32> {
2993 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2994 }
2995 }
2996
2997 impl<'de> ::core::fmt::Debug for Marks<'de> {
2998 fn fmt(
2999 &self,
3000 f: &mut ::core::fmt::Formatter<'_>,
3001 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3002 f.debug_struct("Marks")
3003 .field("mark_1", &self.mark_1())
3004 .field("mark_2", &self.mark_2())
3005 .finish()
3006 }
3007 }
3008
3009 impl<'de> ::fidl_next::IntoNatural for Marks<'de> {
3010 type Natural = crate::natural::Marks;
3011 }
3012
3013 pub type RouteMetric = ::fidl_next::wire::Uint32;
3015
3016 #[repr(transparent)]
3018 pub struct SocketAddress<'de> {
3019 pub(crate) raw: ::fidl_next::wire::Union,
3020 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
3021 }
3022
3023 impl<'de> Drop for SocketAddress<'de> {
3024 fn drop(&mut self) {
3025 match self.raw.ordinal() {
3026 1 => {
3027 let _ = unsafe {
3028 self.raw.get().read_unchecked::<crate::wire::Ipv4SocketAddress>()
3029 };
3030 }
3031
3032 2 => {
3033 let _ = unsafe {
3034 self.raw.get().read_unchecked::<crate::wire::Ipv6SocketAddress>()
3035 };
3036 }
3037
3038 _ => unsafe { ::core::hint::unreachable_unchecked() },
3039 }
3040 }
3041 }
3042
3043 impl ::fidl_next::Constrained for SocketAddress<'_> {
3044 type Constraint = ();
3045
3046 fn validate(
3047 _: ::fidl_next::Slot<'_, Self>,
3048 _: Self::Constraint,
3049 ) -> Result<(), ::fidl_next::ValidationError> {
3050 Ok(())
3051 }
3052 }
3053
3054 unsafe impl ::fidl_next::Wire for SocketAddress<'static> {
3055 type Narrowed<'de> = SocketAddress<'de>;
3056
3057 #[inline]
3058 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3059 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
3060 ::fidl_next::wire::Union::zero_padding(raw);
3061 }
3062 }
3063
3064 pub mod socket_address {
3065 pub enum Ref<'de> {
3066 Ipv4(&'de crate::wire::Ipv4SocketAddress),
3067
3068 Ipv6(&'de crate::wire::Ipv6SocketAddress),
3069 }
3070
3071 pub enum Value {
3072 Ipv4(crate::wire::Ipv4SocketAddress),
3073
3074 Ipv6(crate::wire::Ipv6SocketAddress),
3075 }
3076 }
3077
3078 impl<'de> SocketAddress<'de> {
3079 pub fn as_ref(&self) -> crate::wire::socket_address::Ref<'_> {
3080 match self.raw.ordinal() {
3081 1 => crate::wire::socket_address::Ref::Ipv4(unsafe {
3082 self.raw.get().deref_unchecked::<crate::wire::Ipv4SocketAddress>()
3083 }),
3084
3085 2 => crate::wire::socket_address::Ref::Ipv6(unsafe {
3086 self.raw.get().deref_unchecked::<crate::wire::Ipv6SocketAddress>()
3087 }),
3088
3089 _ => unsafe { ::core::hint::unreachable_unchecked() },
3090 }
3091 }
3092
3093 pub fn into_inner(self) -> crate::wire::socket_address::Value {
3094 let this = ::core::mem::ManuallyDrop::new(self);
3095
3096 match this.raw.ordinal() {
3097 1 => crate::wire::socket_address::Value::Ipv4(unsafe {
3098 this.raw.get().read_unchecked::<crate::wire::Ipv4SocketAddress>()
3099 }),
3100
3101 2 => crate::wire::socket_address::Value::Ipv6(unsafe {
3102 this.raw.get().read_unchecked::<crate::wire::Ipv6SocketAddress>()
3103 }),
3104
3105 _ => unsafe { ::core::hint::unreachable_unchecked() },
3106 }
3107 }
3108 }
3109
3110 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for SocketAddress<'de>
3111 where
3112 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3113 ___D: ::fidl_next::Decoder<'de>,
3114 {
3115 fn decode(
3116 mut slot: ::fidl_next::Slot<'_, Self>,
3117 decoder: &mut ___D,
3118 _: (),
3119 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3120 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
3121 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
3122 1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Ipv4SocketAddress>(
3123 raw,
3124 decoder,
3125 (),
3126 )?,
3127
3128 2 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Ipv6SocketAddress>(
3129 raw,
3130 decoder,
3131 (),
3132 )?,
3133
3134 ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)),
3135 }
3136
3137 Ok(())
3138 }
3139 }
3140
3141 impl<'de> ::core::fmt::Debug for SocketAddress<'de> {
3142 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3143 match self.raw.ordinal() {
3144 1 => unsafe {
3145 self.raw.get().deref_unchecked::<crate::wire::Ipv4SocketAddress>().fmt(f)
3146 },
3147 2 => unsafe {
3148 self.raw.get().deref_unchecked::<crate::wire::Ipv6SocketAddress>().fmt(f)
3149 },
3150 _ => unsafe { ::core::hint::unreachable_unchecked() },
3151 }
3152 }
3153 }
3154
3155 impl<'de> ::fidl_next::IntoNatural for SocketAddress<'de> {
3156 type Natural = crate::natural::SocketAddress;
3157 }
3158
3159 #[derive(Debug)]
3161 #[repr(C)]
3162 pub struct Subnet<'de> {
3163 pub addr: crate::wire::IpAddress<'de>,
3164
3165 pub prefix_len: u8,
3166 }
3167
3168 static_assertions::const_assert_eq!(std::mem::size_of::<Subnet<'_>>(), 24);
3169 static_assertions::const_assert_eq!(std::mem::align_of::<Subnet<'_>>(), 8);
3170
3171 static_assertions::const_assert_eq!(std::mem::offset_of!(Subnet<'_>, addr), 0);
3172
3173 static_assertions::const_assert_eq!(std::mem::offset_of!(Subnet<'_>, prefix_len), 16);
3174
3175 impl ::fidl_next::Constrained for Subnet<'_> {
3176 type Constraint = ();
3177
3178 fn validate(
3179 _: ::fidl_next::Slot<'_, Self>,
3180 _: Self::Constraint,
3181 ) -> Result<(), ::fidl_next::ValidationError> {
3182 Ok(())
3183 }
3184 }
3185
3186 unsafe impl ::fidl_next::Wire for Subnet<'static> {
3187 type Narrowed<'de> = Subnet<'de>;
3188
3189 #[inline]
3190 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
3191 ::fidl_next::munge! {
3192 let Self {
3193 addr,
3194 prefix_len,
3195
3196 } = &mut *out_;
3197 }
3198
3199 ::fidl_next::Wire::zero_padding(addr);
3200
3201 ::fidl_next::Wire::zero_padding(prefix_len);
3202
3203 unsafe {
3204 out_.as_mut_ptr().cast::<u8>().add(17).write_bytes(0, 7);
3205 }
3206 }
3207 }
3208
3209 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for Subnet<'de>
3210 where
3211 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3212 ___D: ::fidl_next::Decoder<'de>,
3213 {
3214 fn decode(
3215 slot_: ::fidl_next::Slot<'_, Self>,
3216 decoder_: &mut ___D,
3217 _: (),
3218 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3219 if slot_.as_bytes()[17..24] != [0u8; 7] {
3220 return Err(::fidl_next::DecodeError::InvalidPadding);
3221 }
3222
3223 ::fidl_next::munge! {
3224 let Self {
3225 mut addr,
3226 mut prefix_len,
3227
3228 } = slot_;
3229 }
3230
3231 let _field = addr.as_mut();
3232
3233 ::fidl_next::Decode::decode(addr.as_mut(), decoder_, ())?;
3234
3235 let _field = prefix_len.as_mut();
3236
3237 ::fidl_next::Decode::decode(prefix_len.as_mut(), decoder_, ())?;
3238
3239 Ok(())
3240 }
3241 }
3242
3243 impl<'de> ::fidl_next::IntoNatural for Subnet<'de> {
3244 type Natural = crate::natural::Subnet;
3245 }
3246}
3247
3248pub mod wire_optional {
3249
3250 #[repr(transparent)]
3251 pub struct IpAddress<'de> {
3252 pub(crate) raw: ::fidl_next::wire::Union,
3253 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
3254 }
3255
3256 impl ::fidl_next::Constrained for IpAddress<'_> {
3257 type Constraint = ();
3258
3259 fn validate(
3260 _: ::fidl_next::Slot<'_, Self>,
3261 _: Self::Constraint,
3262 ) -> Result<(), ::fidl_next::ValidationError> {
3263 Ok(())
3264 }
3265 }
3266
3267 unsafe impl ::fidl_next::Wire for IpAddress<'static> {
3268 type Narrowed<'de> = IpAddress<'de>;
3269
3270 #[inline]
3271 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3272 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
3273 ::fidl_next::wire::Union::zero_padding(raw);
3274 }
3275 }
3276
3277 impl<'de> IpAddress<'de> {
3278 pub fn is_some(&self) -> bool {
3279 self.raw.is_some()
3280 }
3281
3282 pub fn is_none(&self) -> bool {
3283 self.raw.is_none()
3284 }
3285
3286 pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::IpAddress<'de>> {
3287 if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
3288 }
3289
3290 pub fn into_option(self) -> ::core::option::Option<crate::wire::IpAddress<'de>> {
3291 if self.is_some() {
3292 Some(crate::wire::IpAddress {
3293 raw: self.raw,
3294 _phantom: ::core::marker::PhantomData,
3295 })
3296 } else {
3297 None
3298 }
3299 }
3300 }
3301
3302 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for IpAddress<'de>
3303 where
3304 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3305 ___D: ::fidl_next::Decoder<'de>,
3306 {
3307 fn decode(
3308 mut slot: ::fidl_next::Slot<'_, Self>,
3309 decoder: &mut ___D,
3310 _: (),
3311 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3312 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
3313 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
3314 1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Ipv4Address>(
3315 raw,
3316 decoder,
3317 (),
3318 )?,
3319
3320 2 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Ipv6Address>(
3321 raw,
3322 decoder,
3323 (),
3324 )?,
3325
3326 0 => ::fidl_next::wire::Union::decode_absent(raw)?,
3327 _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
3328 }
3329
3330 Ok(())
3331 }
3332 }
3333
3334 impl<'de> ::core::fmt::Debug for IpAddress<'de> {
3335 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3336 self.as_ref().fmt(f)
3337 }
3338 }
3339
3340 impl<'de> ::fidl_next::IntoNatural for IpAddress<'de> {
3341 type Natural = ::core::option::Option<crate::natural::IpAddress>;
3342 }
3343
3344 #[repr(transparent)]
3345 pub struct SocketAddress<'de> {
3346 pub(crate) raw: ::fidl_next::wire::Union,
3347 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
3348 }
3349
3350 impl ::fidl_next::Constrained for SocketAddress<'_> {
3351 type Constraint = ();
3352
3353 fn validate(
3354 _: ::fidl_next::Slot<'_, Self>,
3355 _: Self::Constraint,
3356 ) -> Result<(), ::fidl_next::ValidationError> {
3357 Ok(())
3358 }
3359 }
3360
3361 unsafe impl ::fidl_next::Wire for SocketAddress<'static> {
3362 type Narrowed<'de> = SocketAddress<'de>;
3363
3364 #[inline]
3365 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3366 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
3367 ::fidl_next::wire::Union::zero_padding(raw);
3368 }
3369 }
3370
3371 impl<'de> SocketAddress<'de> {
3372 pub fn is_some(&self) -> bool {
3373 self.raw.is_some()
3374 }
3375
3376 pub fn is_none(&self) -> bool {
3377 self.raw.is_none()
3378 }
3379
3380 pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::SocketAddress<'de>> {
3381 if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
3382 }
3383
3384 pub fn into_option(self) -> ::core::option::Option<crate::wire::SocketAddress<'de>> {
3385 if self.is_some() {
3386 Some(crate::wire::SocketAddress {
3387 raw: self.raw,
3388 _phantom: ::core::marker::PhantomData,
3389 })
3390 } else {
3391 None
3392 }
3393 }
3394 }
3395
3396 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for SocketAddress<'de>
3397 where
3398 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
3399 ___D: ::fidl_next::Decoder<'de>,
3400 {
3401 fn decode(
3402 mut slot: ::fidl_next::Slot<'_, Self>,
3403 decoder: &mut ___D,
3404 _: (),
3405 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3406 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
3407 match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
3408 1 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Ipv4SocketAddress>(
3409 raw,
3410 decoder,
3411 (),
3412 )?,
3413
3414 2 => ::fidl_next::wire::Union::decode_as::<___D, crate::wire::Ipv6SocketAddress>(
3415 raw,
3416 decoder,
3417 (),
3418 )?,
3419
3420 0 => ::fidl_next::wire::Union::decode_absent(raw)?,
3421 _ => ::fidl_next::wire::Union::decode_unknown(raw, decoder)?,
3422 }
3423
3424 Ok(())
3425 }
3426 }
3427
3428 impl<'de> ::core::fmt::Debug for SocketAddress<'de> {
3429 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3430 self.as_ref().fmt(f)
3431 }
3432 }
3433
3434 impl<'de> ::fidl_next::IntoNatural for SocketAddress<'de> {
3435 type Natural = ::core::option::Option<crate::natural::SocketAddress>;
3436 }
3437}
3438
3439pub mod generic {
3440
3441 pub struct Ipv4Address<T0> {
3443 pub addr: T0,
3444 }
3445
3446 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::Ipv4Address, ___E> for Ipv4Address<T0>
3447 where
3448 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3449 T0: ::fidl_next::Encode<[u8; 4], ___E>,
3450 {
3451 #[inline]
3452 fn encode(
3453 self,
3454 encoder_: &mut ___E,
3455 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4Address>,
3456 _: (),
3457 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3458 ::fidl_next::munge! {
3459 let crate::wire::Ipv4Address {
3460 addr,
3461
3462 } = out_;
3463 }
3464
3465 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
3466
3467 Ok(())
3468 }
3469 }
3470
3471 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::Ipv4Address, ___E>
3472 for &'a Ipv4Address<T0>
3473 where
3474 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3475 &'a T0: ::fidl_next::Encode<[u8; 4], ___E>,
3476 {
3477 #[inline]
3478 fn encode(
3479 self,
3480 encoder_: &mut ___E,
3481 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4Address>,
3482 _: (),
3483 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3484 ::fidl_next::munge! {
3485 let crate::wire::Ipv4Address {
3486 addr,
3487
3488 } = out_;
3489 }
3490
3491 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
3492
3493 Ok(())
3494 }
3495 }
3496
3497 pub struct Ipv6Address<T0> {
3499 pub addr: T0,
3500 }
3501
3502 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::Ipv6Address, ___E> for Ipv6Address<T0>
3503 where
3504 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3505 T0: ::fidl_next::Encode<[u8; 16], ___E>,
3506 {
3507 #[inline]
3508 fn encode(
3509 self,
3510 encoder_: &mut ___E,
3511 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6Address>,
3512 _: (),
3513 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3514 ::fidl_next::munge! {
3515 let crate::wire::Ipv6Address {
3516 addr,
3517
3518 } = out_;
3519 }
3520
3521 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
3522
3523 Ok(())
3524 }
3525 }
3526
3527 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::Ipv6Address, ___E>
3528 for &'a Ipv6Address<T0>
3529 where
3530 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3531 &'a T0: ::fidl_next::Encode<[u8; 16], ___E>,
3532 {
3533 #[inline]
3534 fn encode(
3535 self,
3536 encoder_: &mut ___E,
3537 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6Address>,
3538 _: (),
3539 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3540 ::fidl_next::munge! {
3541 let crate::wire::Ipv6Address {
3542 addr,
3543
3544 } = out_;
3545 }
3546
3547 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
3548
3549 Ok(())
3550 }
3551 }
3552
3553 pub struct Ipv4AddressWithPrefix<T0, T1> {
3555 pub addr: T0,
3556
3557 pub prefix_len: T1,
3558 }
3559
3560 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::Ipv4AddressWithPrefix, ___E>
3561 for Ipv4AddressWithPrefix<T0, T1>
3562 where
3563 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3564 T0: ::fidl_next::Encode<crate::wire::Ipv4Address, ___E>,
3565 T1: ::fidl_next::Encode<u8, ___E>,
3566 {
3567 #[inline]
3568 fn encode(
3569 self,
3570 encoder_: &mut ___E,
3571 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4AddressWithPrefix>,
3572 _: (),
3573 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3574 ::fidl_next::munge! {
3575 let crate::wire::Ipv4AddressWithPrefix {
3576 addr,
3577 prefix_len,
3578
3579 } = out_;
3580 }
3581
3582 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
3583
3584 ::fidl_next::Encode::encode(self.prefix_len, encoder_, prefix_len, ())?;
3585
3586 Ok(())
3587 }
3588 }
3589
3590 unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::Ipv4AddressWithPrefix, ___E>
3591 for &'a Ipv4AddressWithPrefix<T0, T1>
3592 where
3593 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3594 &'a T0: ::fidl_next::Encode<crate::wire::Ipv4Address, ___E>,
3595 &'a T1: ::fidl_next::Encode<u8, ___E>,
3596 {
3597 #[inline]
3598 fn encode(
3599 self,
3600 encoder_: &mut ___E,
3601 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4AddressWithPrefix>,
3602 _: (),
3603 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3604 ::fidl_next::munge! {
3605 let crate::wire::Ipv4AddressWithPrefix {
3606 addr,
3607 prefix_len,
3608
3609 } = out_;
3610 }
3611
3612 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
3613
3614 ::fidl_next::Encode::encode(&self.prefix_len, encoder_, prefix_len, ())?;
3615
3616 Ok(())
3617 }
3618 }
3619
3620 pub struct Ipv4SocketAddress<T0, T1> {
3622 pub address: T0,
3623
3624 pub port: T1,
3625 }
3626
3627 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::Ipv4SocketAddress, ___E>
3628 for Ipv4SocketAddress<T0, T1>
3629 where
3630 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3631 T0: ::fidl_next::Encode<crate::wire::Ipv4Address, ___E>,
3632 T1: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
3633 {
3634 #[inline]
3635 fn encode(
3636 self,
3637 encoder_: &mut ___E,
3638 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4SocketAddress>,
3639 _: (),
3640 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3641 ::fidl_next::munge! {
3642 let crate::wire::Ipv4SocketAddress {
3643 address,
3644 port,
3645
3646 } = out_;
3647 }
3648
3649 ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
3650
3651 ::fidl_next::Encode::encode(self.port, encoder_, port, ())?;
3652
3653 Ok(())
3654 }
3655 }
3656
3657 unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::Ipv4SocketAddress, ___E>
3658 for &'a Ipv4SocketAddress<T0, T1>
3659 where
3660 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3661 &'a T0: ::fidl_next::Encode<crate::wire::Ipv4Address, ___E>,
3662 &'a T1: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
3663 {
3664 #[inline]
3665 fn encode(
3666 self,
3667 encoder_: &mut ___E,
3668 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv4SocketAddress>,
3669 _: (),
3670 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3671 ::fidl_next::munge! {
3672 let crate::wire::Ipv4SocketAddress {
3673 address,
3674 port,
3675
3676 } = out_;
3677 }
3678
3679 ::fidl_next::Encode::encode(&self.address, encoder_, address, ())?;
3680
3681 ::fidl_next::Encode::encode(&self.port, encoder_, port, ())?;
3682
3683 Ok(())
3684 }
3685 }
3686
3687 pub struct Ipv6AddressWithPrefix<T0, T1> {
3689 pub addr: T0,
3690
3691 pub prefix_len: T1,
3692 }
3693
3694 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::Ipv6AddressWithPrefix, ___E>
3695 for Ipv6AddressWithPrefix<T0, T1>
3696 where
3697 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3698 T0: ::fidl_next::Encode<crate::wire::Ipv6Address, ___E>,
3699 T1: ::fidl_next::Encode<u8, ___E>,
3700 {
3701 #[inline]
3702 fn encode(
3703 self,
3704 encoder_: &mut ___E,
3705 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6AddressWithPrefix>,
3706 _: (),
3707 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3708 ::fidl_next::munge! {
3709 let crate::wire::Ipv6AddressWithPrefix {
3710 addr,
3711 prefix_len,
3712
3713 } = out_;
3714 }
3715
3716 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
3717
3718 ::fidl_next::Encode::encode(self.prefix_len, encoder_, prefix_len, ())?;
3719
3720 Ok(())
3721 }
3722 }
3723
3724 unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::Ipv6AddressWithPrefix, ___E>
3725 for &'a Ipv6AddressWithPrefix<T0, T1>
3726 where
3727 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3728 &'a T0: ::fidl_next::Encode<crate::wire::Ipv6Address, ___E>,
3729 &'a T1: ::fidl_next::Encode<u8, ___E>,
3730 {
3731 #[inline]
3732 fn encode(
3733 self,
3734 encoder_: &mut ___E,
3735 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6AddressWithPrefix>,
3736 _: (),
3737 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3738 ::fidl_next::munge! {
3739 let crate::wire::Ipv6AddressWithPrefix {
3740 addr,
3741 prefix_len,
3742
3743 } = out_;
3744 }
3745
3746 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
3747
3748 ::fidl_next::Encode::encode(&self.prefix_len, encoder_, prefix_len, ())?;
3749
3750 Ok(())
3751 }
3752 }
3753
3754 pub struct Ipv6SocketAddress<T0, T1, T2> {
3756 pub address: T0,
3757
3758 pub port: T1,
3759
3760 pub zone_index: T2,
3761 }
3762
3763 unsafe impl<___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::Ipv6SocketAddress, ___E>
3764 for Ipv6SocketAddress<T0, T1, T2>
3765 where
3766 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3767 T0: ::fidl_next::Encode<crate::wire::Ipv6Address, ___E>,
3768 T1: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
3769 T2: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
3770 {
3771 #[inline]
3772 fn encode(
3773 self,
3774 encoder_: &mut ___E,
3775 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6SocketAddress>,
3776 _: (),
3777 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3778 ::fidl_next::munge! {
3779 let crate::wire::Ipv6SocketAddress {
3780 address,
3781 port,
3782 zone_index,
3783
3784 } = out_;
3785 }
3786
3787 ::fidl_next::Encode::encode(self.address, encoder_, address, ())?;
3788
3789 ::fidl_next::Encode::encode(self.port, encoder_, port, ())?;
3790
3791 ::fidl_next::Encode::encode(self.zone_index, encoder_, zone_index, ())?;
3792
3793 Ok(())
3794 }
3795 }
3796
3797 unsafe impl<'a, ___E, T0, T1, T2> ::fidl_next::Encode<crate::wire::Ipv6SocketAddress, ___E>
3798 for &'a Ipv6SocketAddress<T0, T1, T2>
3799 where
3800 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3801 &'a T0: ::fidl_next::Encode<crate::wire::Ipv6Address, ___E>,
3802 &'a T1: ::fidl_next::Encode<::fidl_next::wire::Uint16, ___E>,
3803 &'a T2: ::fidl_next::Encode<::fidl_next::wire::Uint64, ___E>,
3804 {
3805 #[inline]
3806 fn encode(
3807 self,
3808 encoder_: &mut ___E,
3809 out_: &mut ::core::mem::MaybeUninit<crate::wire::Ipv6SocketAddress>,
3810 _: (),
3811 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3812 ::fidl_next::munge! {
3813 let crate::wire::Ipv6SocketAddress {
3814 address,
3815 port,
3816 zone_index,
3817
3818 } = out_;
3819 }
3820
3821 ::fidl_next::Encode::encode(&self.address, encoder_, address, ())?;
3822
3823 ::fidl_next::Encode::encode(&self.port, encoder_, port, ())?;
3824
3825 ::fidl_next::Encode::encode(&self.zone_index, encoder_, zone_index, ())?;
3826
3827 Ok(())
3828 }
3829 }
3830
3831 pub struct MacAddress<T0> {
3833 pub octets: T0,
3834 }
3835
3836 unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::MacAddress, ___E> for MacAddress<T0>
3837 where
3838 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3839 T0: ::fidl_next::Encode<[u8; 6], ___E>,
3840 {
3841 #[inline]
3842 fn encode(
3843 self,
3844 encoder_: &mut ___E,
3845 out_: &mut ::core::mem::MaybeUninit<crate::wire::MacAddress>,
3846 _: (),
3847 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3848 ::fidl_next::munge! {
3849 let crate::wire::MacAddress {
3850 octets,
3851
3852 } = out_;
3853 }
3854
3855 ::fidl_next::Encode::encode(self.octets, encoder_, octets, ())?;
3856
3857 Ok(())
3858 }
3859 }
3860
3861 unsafe impl<'a, ___E, T0> ::fidl_next::Encode<crate::wire::MacAddress, ___E> for &'a MacAddress<T0>
3862 where
3863 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3864 &'a T0: ::fidl_next::Encode<[u8; 6], ___E>,
3865 {
3866 #[inline]
3867 fn encode(
3868 self,
3869 encoder_: &mut ___E,
3870 out_: &mut ::core::mem::MaybeUninit<crate::wire::MacAddress>,
3871 _: (),
3872 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3873 ::fidl_next::munge! {
3874 let crate::wire::MacAddress {
3875 octets,
3876
3877 } = out_;
3878 }
3879
3880 ::fidl_next::Encode::encode(&self.octets, encoder_, octets, ())?;
3881
3882 Ok(())
3883 }
3884 }
3885
3886 pub struct Subnet<T0, T1> {
3888 pub addr: T0,
3889
3890 pub prefix_len: T1,
3891 }
3892
3893 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::Subnet<'static>, ___E> for Subnet<T0, T1>
3894 where
3895 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3896 ___E: ::fidl_next::Encoder,
3897 T0: ::fidl_next::Encode<crate::wire::IpAddress<'static>, ___E>,
3898 T1: ::fidl_next::Encode<u8, ___E>,
3899 {
3900 #[inline]
3901 fn encode(
3902 self,
3903 encoder_: &mut ___E,
3904 out_: &mut ::core::mem::MaybeUninit<crate::wire::Subnet<'static>>,
3905 _: (),
3906 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3907 ::fidl_next::munge! {
3908 let crate::wire::Subnet {
3909 addr,
3910 prefix_len,
3911
3912 } = out_;
3913 }
3914
3915 ::fidl_next::Encode::encode(self.addr, encoder_, addr, ())?;
3916
3917 ::fidl_next::Encode::encode(self.prefix_len, encoder_, prefix_len, ())?;
3918
3919 Ok(())
3920 }
3921 }
3922
3923 unsafe impl<'a, ___E, T0, T1> ::fidl_next::Encode<crate::wire::Subnet<'static>, ___E>
3924 for &'a Subnet<T0, T1>
3925 where
3926 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
3927 ___E: ::fidl_next::Encoder,
3928 &'a T0: ::fidl_next::Encode<crate::wire::IpAddress<'static>, ___E>,
3929 &'a T1: ::fidl_next::Encode<u8, ___E>,
3930 {
3931 #[inline]
3932 fn encode(
3933 self,
3934 encoder_: &mut ___E,
3935 out_: &mut ::core::mem::MaybeUninit<crate::wire::Subnet<'static>>,
3936 _: (),
3937 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
3938 ::fidl_next::munge! {
3939 let crate::wire::Subnet {
3940 addr,
3941 prefix_len,
3942
3943 } = out_;
3944 }
3945
3946 ::fidl_next::Encode::encode(&self.addr, encoder_, addr, ())?;
3947
3948 ::fidl_next::Encode::encode(&self.prefix_len, encoder_, prefix_len, ())?;
3949
3950 Ok(())
3951 }
3952 }
3953}
3954
3955pub use self::natural::*;
3956
3957#[doc = " The maximum length of a hostname, as per\n [RFC 1035 section 2.3.4](https://tools.ietf.org/html/rfc1035#section-2.3.4).\n"]
3958pub const MAX_HOSTNAME_SIZE: u64 = 255 as u64;
3959
3960#[doc = " Fuchsia does not have UIDs, we use the `MARK_2` domain mark to store the\n UID of the process that created the sockets when the socket was created\n by a process running in Starnix. This mark should be left unset otherwise.\n"]
3961pub const MARK_DOMAIN_SOCKET_UID: crate::natural::MarkDomain = crate::natural::MarkDomain::Mark2;
3962
3963#[doc = " `MARK_1` domain is used to store the `SO_MARK` value set by Starnix\n processes. If a mark in this domain is absent, it will be reported to\n applications as a `0` since that is the default mark value on Linux.\n"]
3964pub const MARK_DOMAIN_SO_MARK: crate::natural::MarkDomain = crate::natural::MarkDomain::Mark1;