1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type BasePortId = u8;
14
15pub const FRAME_FEATURES_RAW: u32 = 1;
20
21pub const MAX_ACCEL_FLAGS: u32 = 16;
30
31pub const MAX_DESCRIPTOR_CHAIN: u8 = 4;
33
34pub const MAX_FRAME_TYPES: u32 = 4;
36
37pub const MAX_PORTS: u8 = 32;
39
40pub const MAX_SESSION_NAME: u32 = 64;
42
43pub const MAX_STATUS_BUFFER: u32 = 50;
46
47bitflags! {
48 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
50 pub struct EthernetFeatures: u32 {
51 const RAW = 1;
56 const ETHERNET_II = 2;
58 const E_802_1_Q = 4;
60 const E_802_1_Q_IN_Q = 8;
64 const E_802_3_LLC_SNAP = 16;
66 }
67}
68
69impl EthernetFeatures {
70 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
71 #[inline(always)]
72 pub fn has_unknown_bits(&self) -> bool {
73 false
74 }
75
76 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
77 #[inline(always)]
78 pub fn get_unknown_bits(&self) -> u32 {
79 0
80 }
81}
82
83bitflags! {
84 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
88 pub struct RxFlags: u32 {
89 const RX_ACCEL_0 = 1;
95 const RX_ACCEL_1 = 2;
96 const RX_ACCEL_2 = 4;
97 const RX_ACCEL_3 = 8;
98 const RX_ACCEL_4 = 16;
99 const RX_ACCEL_5 = 32;
100 const RX_ACCEL_6 = 64;
101 const RX_ACCEL_7 = 128;
102 const RX_ACCEL_8 = 256;
103 const RX_ACCEL_9 = 512;
104 const RX_ACCEL_10 = 1024;
105 const RX_ACCEL_11 = 2048;
106 const RX_ACCEL_12 = 4096;
107 const RX_ACCEL_13 = 8192;
108 const RX_ACCEL_14 = 16384;
109 const RX_ACCEL_15 = 32768;
110 const RX_OVERRUN = 536870912;
117 const RX_VALIDATION_ERROR = 1073741824;
126 const RX_ECHOED_TX = 2147483648;
130 }
131}
132
133impl RxFlags {
134 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
135 #[inline(always)]
136 pub fn has_unknown_bits(&self) -> bool {
137 false
138 }
139
140 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
141 #[inline(always)]
142 pub fn get_unknown_bits(&self) -> u32 {
143 0
144 }
145}
146
147bitflags! {
148 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
150 pub struct SessionFlags: u16 {
151 const PRIMARY = 1;
161 const LISTEN_TX = 2;
169 const REPORT_INVALID_RX = 4;
180 const RECEIVE_RX_POWER_LEASES = 8;
185 }
186}
187
188impl SessionFlags {
189 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
190 #[inline(always)]
191 pub fn has_unknown_bits(&self) -> bool {
192 false
193 }
194
195 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
196 #[inline(always)]
197 pub fn get_unknown_bits(&self) -> u16 {
198 0
199 }
200}
201
202bitflags! {
203 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
205 pub struct StatusFlags: u32 {
206 const ONLINE = 1;
209 }
210}
211
212impl StatusFlags {
213 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
214 #[inline(always)]
215 pub fn has_unknown_bits(&self) -> bool {
216 false
217 }
218
219 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
220 #[inline(always)]
221 pub fn get_unknown_bits(&self) -> u32 {
222 0
223 }
224}
225
226bitflags! {
227 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
231 pub struct TxFlags: u32 {
232 const TX_ACCEL_0 = 1;
238 const TX_ACCEL_1 = 2;
239 const TX_ACCEL_2 = 4;
240 const TX_ACCEL_3 = 8;
241 const TX_ACCEL_4 = 16;
242 const TX_ACCEL_5 = 32;
243 const TX_ACCEL_6 = 64;
244 const TX_ACCEL_7 = 128;
245 const TX_ACCEL_8 = 256;
246 const TX_ACCEL_9 = 512;
247 const TX_ACCEL_10 = 1024;
248 const TX_ACCEL_11 = 2048;
249 const TX_ACCEL_12 = 4096;
250 const TX_ACCEL_13 = 8192;
251 const TX_ACCEL_14 = 16384;
252 const TX_ACCEL_15 = 32768;
253 }
254}
255
256impl TxFlags {
257 #[inline(always)]
258 pub fn from_bits_allow_unknown(bits: u32) -> Self {
259 Self::from_bits_retain(bits)
260 }
261
262 #[inline(always)]
263 pub fn has_unknown_bits(&self) -> bool {
264 self.get_unknown_bits() != 0
265 }
266
267 #[inline(always)]
268 pub fn get_unknown_bits(&self) -> u32 {
269 self.bits() & !Self::all().bits()
270 }
271}
272
273bitflags! {
274 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
278 pub struct TxReturnFlags: u32 {
279 const TX_RET_NOT_SUPPORTED = 1;
284 const TX_RET_OUT_OF_RESOURCES = 2;
288 const TX_RET_NOT_AVAILABLE = 4;
293 const TX_RET_ERROR = 2147483648;
294 }
295}
296
297impl TxReturnFlags {
298 #[inline(always)]
299 pub fn from_bits_allow_unknown(bits: u32) -> Self {
300 Self::from_bits_retain(bits)
301 }
302
303 #[inline(always)]
304 pub fn has_unknown_bits(&self) -> bool {
305 self.get_unknown_bits() != 0
306 }
307
308 #[inline(always)]
309 pub fn get_unknown_bits(&self) -> u32 {
310 self.bits() & !Self::all().bits()
311 }
312}
313
314#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
320#[repr(u16)]
321pub enum DeviceClass {
322 Virtual = 0,
323 Ethernet = 1,
324 Wlan = 2,
325 Ppp = 3,
326 Bridge = 4,
327 WlanAp = 5,
328}
329
330impl DeviceClass {
331 #[inline]
332 pub fn from_primitive(prim: u16) -> Option<Self> {
333 match prim {
334 0 => Some(Self::Virtual),
335 1 => Some(Self::Ethernet),
336 2 => Some(Self::Wlan),
337 3 => Some(Self::Ppp),
338 4 => Some(Self::Bridge),
339 5 => Some(Self::WlanAp),
340 _ => None,
341 }
342 }
343
344 #[inline]
345 pub const fn into_primitive(self) -> u16 {
346 self as u16
347 }
348
349 #[deprecated = "Strict enums should not use `is_unknown`"]
350 #[inline]
351 pub fn is_unknown(&self) -> bool {
352 false
353 }
354}
355
356#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
358pub enum FrameType {
359 Ethernet,
360 Ipv4,
361 Ipv6,
362 #[doc(hidden)]
363 __SourceBreaking {
364 unknown_ordinal: u8,
365 },
366}
367
368#[macro_export]
370macro_rules! FrameTypeUnknown {
371 () => {
372 _
373 };
374}
375
376impl FrameType {
377 #[inline]
378 pub fn from_primitive(prim: u8) -> Option<Self> {
379 match prim {
380 1 => Some(Self::Ethernet),
381 2 => Some(Self::Ipv4),
382 3 => Some(Self::Ipv6),
383 _ => None,
384 }
385 }
386
387 #[inline]
388 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
389 match prim {
390 1 => Self::Ethernet,
391 2 => Self::Ipv4,
392 3 => Self::Ipv6,
393 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
394 }
395 }
396
397 #[inline]
398 pub fn unknown() -> Self {
399 Self::__SourceBreaking { unknown_ordinal: 0xff }
400 }
401
402 #[inline]
403 pub const fn into_primitive(self) -> u8 {
404 match self {
405 Self::Ethernet => 1,
406 Self::Ipv4 => 2,
407 Self::Ipv6 => 3,
408 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
409 }
410 }
411
412 #[inline]
413 pub fn is_unknown(&self) -> bool {
414 match self {
415 Self::__SourceBreaking { unknown_ordinal: _ } => true,
416 _ => false,
417 }
418 }
419}
420
421#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
423#[repr(u32)]
424pub enum InfoType {
425 NoInfo = 0,
427}
428
429impl InfoType {
430 #[inline]
431 pub fn from_primitive(prim: u32) -> Option<Self> {
432 match prim {
433 0 => Some(Self::NoInfo),
434 _ => None,
435 }
436 }
437
438 #[inline]
439 pub const fn into_primitive(self) -> u32 {
440 self as u32
441 }
442
443 #[deprecated = "Strict enums should not use `is_unknown`"]
444 #[inline]
445 pub fn is_unknown(&self) -> bool {
446 false
447 }
448}
449
450#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
452pub enum MacFilterMode {
453 MulticastFilter,
456 MulticastPromiscuous,
459 Promiscuous,
461 #[doc(hidden)]
462 __SourceBreaking { unknown_ordinal: u32 },
463}
464
465#[macro_export]
467macro_rules! MacFilterModeUnknown {
468 () => {
469 _
470 };
471}
472
473impl MacFilterMode {
474 #[inline]
475 pub fn from_primitive(prim: u32) -> Option<Self> {
476 match prim {
477 0 => Some(Self::MulticastFilter),
478 1 => Some(Self::MulticastPromiscuous),
479 2 => Some(Self::Promiscuous),
480 _ => None,
481 }
482 }
483
484 #[inline]
485 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
486 match prim {
487 0 => Self::MulticastFilter,
488 1 => Self::MulticastPromiscuous,
489 2 => Self::Promiscuous,
490 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
491 }
492 }
493
494 #[inline]
495 pub fn unknown() -> Self {
496 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
497 }
498
499 #[inline]
500 pub const fn into_primitive(self) -> u32 {
501 match self {
502 Self::MulticastFilter => 0,
503 Self::MulticastPromiscuous => 1,
504 Self::Promiscuous => 2,
505 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
506 }
507 }
508
509 #[inline]
510 pub fn is_unknown(&self) -> bool {
511 match self {
512 Self::__SourceBreaking { unknown_ordinal: _ } => true,
513 _ => false,
514 }
515 }
516}
517
518#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
524pub enum PortClass {
525 Ethernet,
526 WlanClient,
527 Ppp,
528 Bridge,
529 WlanAp,
530 Virtual,
531 Lowpan,
532 #[doc(hidden)]
533 __SourceBreaking {
534 unknown_ordinal: u16,
535 },
536}
537
538#[macro_export]
540macro_rules! PortClassUnknown {
541 () => {
542 _
543 };
544}
545
546impl PortClass {
547 #[inline]
548 pub fn from_primitive(prim: u16) -> Option<Self> {
549 match prim {
550 1 => Some(Self::Ethernet),
551 2 => Some(Self::WlanClient),
552 3 => Some(Self::Ppp),
553 4 => Some(Self::Bridge),
554 5 => Some(Self::WlanAp),
555 6 => Some(Self::Virtual),
556 7 => Some(Self::Lowpan),
557 _ => None,
558 }
559 }
560
561 #[inline]
562 pub fn from_primitive_allow_unknown(prim: u16) -> Self {
563 match prim {
564 1 => Self::Ethernet,
565 2 => Self::WlanClient,
566 3 => Self::Ppp,
567 4 => Self::Bridge,
568 5 => Self::WlanAp,
569 6 => Self::Virtual,
570 7 => Self::Lowpan,
571 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
572 }
573 }
574
575 #[inline]
576 pub fn unknown() -> Self {
577 Self::__SourceBreaking { unknown_ordinal: 0xffff }
578 }
579
580 #[inline]
581 pub const fn into_primitive(self) -> u16 {
582 match self {
583 Self::Ethernet => 1,
584 Self::WlanClient => 2,
585 Self::Ppp => 3,
586 Self::Bridge => 4,
587 Self::WlanAp => 5,
588 Self::Virtual => 6,
589 Self::Lowpan => 7,
590 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
591 }
592 }
593
594 #[inline]
595 pub fn is_unknown(&self) -> bool {
596 match self {
597 Self::__SourceBreaking { unknown_ordinal: _ } => true,
598 _ => false,
599 }
600 }
601}
602
603#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
608pub enum RxAcceleration {
609 ValidatedEthernetFcs,
611 ValidatedIpv4Checksum,
613 ValidatedTcpChecksum,
615 ValidatedUdpChecksum,
617 #[doc(hidden)]
618 __SourceBreaking { unknown_ordinal: u8 },
619}
620
621#[macro_export]
623macro_rules! RxAccelerationUnknown {
624 () => {
625 _
626 };
627}
628
629impl RxAcceleration {
630 #[inline]
631 pub fn from_primitive(prim: u8) -> Option<Self> {
632 match prim {
633 0 => Some(Self::ValidatedEthernetFcs),
634 1 => Some(Self::ValidatedIpv4Checksum),
635 2 => Some(Self::ValidatedTcpChecksum),
636 3 => Some(Self::ValidatedUdpChecksum),
637 _ => None,
638 }
639 }
640
641 #[inline]
642 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
643 match prim {
644 0 => Self::ValidatedEthernetFcs,
645 1 => Self::ValidatedIpv4Checksum,
646 2 => Self::ValidatedTcpChecksum,
647 3 => Self::ValidatedUdpChecksum,
648 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
649 }
650 }
651
652 #[inline]
653 pub fn unknown() -> Self {
654 Self::__SourceBreaking { unknown_ordinal: 0xff }
655 }
656
657 #[inline]
658 pub const fn into_primitive(self) -> u8 {
659 match self {
660 Self::ValidatedEthernetFcs => 0,
661 Self::ValidatedIpv4Checksum => 1,
662 Self::ValidatedTcpChecksum => 2,
663 Self::ValidatedUdpChecksum => 3,
664 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
665 }
666 }
667
668 #[inline]
669 pub fn is_unknown(&self) -> bool {
670 match self {
671 Self::__SourceBreaking { unknown_ordinal: _ } => true,
672 _ => false,
673 }
674 }
675}
676
677#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
682pub enum TxAcceleration {
683 ComputeEthernetFcs,
686 ComputeIpv4Checksum,
689 ComputeTcpChecksum,
692 ComputeUdpChecksum,
695 #[doc(hidden)]
696 __SourceBreaking { unknown_ordinal: u8 },
697}
698
699#[macro_export]
701macro_rules! TxAccelerationUnknown {
702 () => {
703 _
704 };
705}
706
707impl TxAcceleration {
708 #[inline]
709 pub fn from_primitive(prim: u8) -> Option<Self> {
710 match prim {
711 0 => Some(Self::ComputeEthernetFcs),
712 1 => Some(Self::ComputeIpv4Checksum),
713 2 => Some(Self::ComputeTcpChecksum),
714 3 => Some(Self::ComputeUdpChecksum),
715 _ => None,
716 }
717 }
718
719 #[inline]
720 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
721 match prim {
722 0 => Self::ComputeEthernetFcs,
723 1 => Self::ComputeIpv4Checksum,
724 2 => Self::ComputeTcpChecksum,
725 3 => Self::ComputeUdpChecksum,
726 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
727 }
728 }
729
730 #[inline]
731 pub fn unknown() -> Self {
732 Self::__SourceBreaking { unknown_ordinal: 0xff }
733 }
734
735 #[inline]
736 pub const fn into_primitive(self) -> u8 {
737 match self {
738 Self::ComputeEthernetFcs => 0,
739 Self::ComputeIpv4Checksum => 1,
740 Self::ComputeTcpChecksum => 2,
741 Self::ComputeUdpChecksum => 3,
742 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
743 }
744 }
745
746 #[inline]
747 pub fn is_unknown(&self) -> bool {
748 match self {
749 Self::__SourceBreaking { unknown_ordinal: _ } => true,
750 _ => false,
751 }
752 }
753}
754
755#[derive(Clone, Debug, PartialEq)]
756pub struct DeviceGetInfoResponse {
757 pub info: DeviceInfo,
758}
759
760impl fidl::Persistable for DeviceGetInfoResponse {}
761
762#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
763pub struct Empty;
764
765impl fidl::Persistable for Empty {}
766
767#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
781pub struct FrameTypeSupport {
782 pub type_: FrameType,
784 pub features: u32,
786 pub supported_flags: TxFlags,
788}
789
790impl fidl::Persistable for FrameTypeSupport {}
791
792#[derive(Clone, Debug, PartialEq)]
793pub struct MacAddressingAddMulticastAddressRequest {
794 pub address: fidl_fuchsia_net::MacAddress,
795}
796
797impl fidl::Persistable for MacAddressingAddMulticastAddressRequest {}
798
799#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
800#[repr(C)]
801pub struct MacAddressingAddMulticastAddressResponse {
802 pub status: i32,
803}
804
805impl fidl::Persistable for MacAddressingAddMulticastAddressResponse {}
806
807#[derive(Clone, Debug, PartialEq)]
808pub struct MacAddressingGetUnicastAddressResponse {
809 pub address: fidl_fuchsia_net::MacAddress,
810}
811
812impl fidl::Persistable for MacAddressingGetUnicastAddressResponse {}
813
814#[derive(Clone, Debug, PartialEq)]
815pub struct MacAddressingRemoveMulticastAddressRequest {
816 pub address: fidl_fuchsia_net::MacAddress,
817}
818
819impl fidl::Persistable for MacAddressingRemoveMulticastAddressRequest {}
820
821#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
822#[repr(C)]
823pub struct MacAddressingRemoveMulticastAddressResponse {
824 pub status: i32,
825}
826
827impl fidl::Persistable for MacAddressingRemoveMulticastAddressResponse {}
828
829#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
830pub struct MacAddressingSetModeRequest {
831 pub mode: MacFilterMode,
832}
833
834impl fidl::Persistable for MacAddressingSetModeRequest {}
835
836#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
837#[repr(C)]
838pub struct MacAddressingSetModeResponse {
839 pub status: i32,
840}
841
842impl fidl::Persistable for MacAddressingSetModeResponse {}
843
844#[derive(Clone, Debug, PartialEq)]
845pub struct PortGetInfoResponse {
846 pub info: PortInfo,
847}
848
849impl fidl::Persistable for PortGetInfoResponse {}
850
851#[derive(Clone, Debug, PartialEq)]
852pub struct PortGetStatusResponse {
853 pub status: PortStatus,
854}
855
856impl fidl::Persistable for PortGetStatusResponse {}
857
858#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
860#[repr(C)]
861pub struct PortId {
862 pub base: u8,
866 pub salt: u8,
869}
870
871impl fidl::Persistable for PortId {}
872
873#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
874pub struct PortWatcherWatchResponse {
875 pub event: DevicePortEvent,
876}
877
878impl fidl::Persistable for PortWatcherWatchResponse {}
879
880#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
881pub struct SessionAttachRequest {
882 pub port: PortId,
883 pub rx_frames: Vec<FrameType>,
884}
885
886impl fidl::Persistable for SessionAttachRequest {}
887
888#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
889#[repr(C)]
890pub struct SessionDetachRequest {
891 pub port: PortId,
892}
893
894impl fidl::Persistable for SessionDetachRequest {}
895
896#[derive(Clone, Debug, PartialEq)]
897pub struct StatusWatcherWatchStatusResponse {
898 pub port_status: PortStatus,
899}
900
901impl fidl::Persistable for StatusWatcherWatchStatusResponse {}
902
903#[derive(Clone, Debug, Default, PartialEq)]
905pub struct DeviceBaseInfo {
906 pub rx_depth: Option<u16>,
911 pub tx_depth: Option<u16>,
916 pub buffer_alignment: Option<u32>,
922 pub max_buffer_length: Option<u32>,
926 pub min_rx_buffer_length: Option<u32>,
928 pub min_tx_buffer_length: Option<u32>,
936 pub min_tx_buffer_head: Option<u16>,
939 pub min_tx_buffer_tail: Option<u16>,
942 pub max_buffer_parts: Option<u8>,
944 pub rx_accel: Option<Vec<RxAcceleration>>,
952 pub tx_accel: Option<Vec<TxAcceleration>>,
960 #[doc(hidden)]
961 pub __source_breaking: fidl::marker::SourceBreaking,
962}
963
964impl fidl::Persistable for DeviceBaseInfo {}
965
966#[derive(Clone, Debug, Default, PartialEq)]
968pub struct DeviceInfo {
969 pub min_descriptor_length: Option<u8>,
976 pub descriptor_version: Option<u8>,
978 pub base_info: Option<DeviceBaseInfo>,
980 #[doc(hidden)]
981 pub __source_breaking: fidl::marker::SourceBreaking,
982}
983
984impl fidl::Persistable for DeviceInfo {}
985
986#[derive(Clone, Debug, Default, PartialEq)]
988pub struct PortBaseInfo {
989 pub port_class: Option<PortClass>,
991 pub rx_types: Option<Vec<FrameType>>,
996 pub tx_types: Option<Vec<FrameTypeSupport>>,
1008 #[doc(hidden)]
1009 pub __source_breaking: fidl::marker::SourceBreaking,
1010}
1011
1012impl fidl::Persistable for PortBaseInfo {}
1013
1014#[derive(Clone, Debug, Default, PartialEq)]
1015pub struct PortGetCountersResponse {
1016 pub rx_frames: Option<u64>,
1018 pub rx_bytes: Option<u64>,
1020 pub tx_frames: Option<u64>,
1022 pub tx_bytes: Option<u64>,
1024 #[doc(hidden)]
1025 pub __source_breaking: fidl::marker::SourceBreaking,
1026}
1027
1028impl fidl::Persistable for PortGetCountersResponse {}
1029
1030#[derive(Clone, Debug, Default, PartialEq)]
1032pub struct PortInfo {
1033 pub id: Option<PortId>,
1035 pub base_info: Option<PortBaseInfo>,
1036 #[doc(hidden)]
1037 pub __source_breaking: fidl::marker::SourceBreaking,
1038}
1039
1040impl fidl::Persistable for PortInfo {}
1041
1042#[derive(Clone, Debug, Default, PartialEq)]
1044pub struct PortStatus {
1045 pub flags: Option<StatusFlags>,
1047 pub mtu: Option<u32>,
1052 #[doc(hidden)]
1053 pub __source_breaking: fidl::marker::SourceBreaking,
1054}
1055
1056impl fidl::Persistable for PortStatus {}
1057
1058#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1060pub enum DevicePortEvent {
1061 Existing(PortId),
1063 Added(PortId),
1065 Removed(PortId),
1067 Idle(Empty),
1069}
1070
1071impl DevicePortEvent {
1072 #[inline]
1073 pub fn ordinal(&self) -> u64 {
1074 match *self {
1075 Self::Existing(_) => 1,
1076 Self::Added(_) => 2,
1077 Self::Removed(_) => 3,
1078 Self::Idle(_) => 4,
1079 }
1080 }
1081
1082 #[deprecated = "Strict unions should not use `is_unknown`"]
1083 #[inline]
1084 pub fn is_unknown(&self) -> bool {
1085 false
1086 }
1087}
1088
1089impl fidl::Persistable for DevicePortEvent {}
1090
1091mod internal {
1092 use super::*;
1093 unsafe impl fidl::encoding::TypeMarker for EthernetFeatures {
1094 type Owned = Self;
1095
1096 #[inline(always)]
1097 fn inline_align(_context: fidl::encoding::Context) -> usize {
1098 4
1099 }
1100
1101 #[inline(always)]
1102 fn inline_size(_context: fidl::encoding::Context) -> usize {
1103 4
1104 }
1105 }
1106
1107 impl fidl::encoding::ValueTypeMarker for EthernetFeatures {
1108 type Borrowed<'a> = Self;
1109 #[inline(always)]
1110 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1111 *value
1112 }
1113 }
1114
1115 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1116 for EthernetFeatures
1117 {
1118 #[inline]
1119 unsafe fn encode(
1120 self,
1121 encoder: &mut fidl::encoding::Encoder<'_, D>,
1122 offset: usize,
1123 _depth: fidl::encoding::Depth,
1124 ) -> fidl::Result<()> {
1125 encoder.debug_check_bounds::<Self>(offset);
1126 if self.bits() & Self::all().bits() != self.bits() {
1127 return Err(fidl::Error::InvalidBitsValue);
1128 }
1129 encoder.write_num(self.bits(), offset);
1130 Ok(())
1131 }
1132 }
1133
1134 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EthernetFeatures {
1135 #[inline(always)]
1136 fn new_empty() -> Self {
1137 Self::empty()
1138 }
1139
1140 #[inline]
1141 unsafe fn decode(
1142 &mut self,
1143 decoder: &mut fidl::encoding::Decoder<'_, D>,
1144 offset: usize,
1145 _depth: fidl::encoding::Depth,
1146 ) -> fidl::Result<()> {
1147 decoder.debug_check_bounds::<Self>(offset);
1148 let prim = decoder.read_num::<u32>(offset);
1149 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1150 Ok(())
1151 }
1152 }
1153 unsafe impl fidl::encoding::TypeMarker for RxFlags {
1154 type Owned = Self;
1155
1156 #[inline(always)]
1157 fn inline_align(_context: fidl::encoding::Context) -> usize {
1158 4
1159 }
1160
1161 #[inline(always)]
1162 fn inline_size(_context: fidl::encoding::Context) -> usize {
1163 4
1164 }
1165 }
1166
1167 impl fidl::encoding::ValueTypeMarker for RxFlags {
1168 type Borrowed<'a> = Self;
1169 #[inline(always)]
1170 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1171 *value
1172 }
1173 }
1174
1175 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RxFlags {
1176 #[inline]
1177 unsafe fn encode(
1178 self,
1179 encoder: &mut fidl::encoding::Encoder<'_, D>,
1180 offset: usize,
1181 _depth: fidl::encoding::Depth,
1182 ) -> fidl::Result<()> {
1183 encoder.debug_check_bounds::<Self>(offset);
1184 if self.bits() & Self::all().bits() != self.bits() {
1185 return Err(fidl::Error::InvalidBitsValue);
1186 }
1187 encoder.write_num(self.bits(), offset);
1188 Ok(())
1189 }
1190 }
1191
1192 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RxFlags {
1193 #[inline(always)]
1194 fn new_empty() -> Self {
1195 Self::empty()
1196 }
1197
1198 #[inline]
1199 unsafe fn decode(
1200 &mut self,
1201 decoder: &mut fidl::encoding::Decoder<'_, D>,
1202 offset: usize,
1203 _depth: fidl::encoding::Depth,
1204 ) -> fidl::Result<()> {
1205 decoder.debug_check_bounds::<Self>(offset);
1206 let prim = decoder.read_num::<u32>(offset);
1207 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1208 Ok(())
1209 }
1210 }
1211 unsafe impl fidl::encoding::TypeMarker for SessionFlags {
1212 type Owned = Self;
1213
1214 #[inline(always)]
1215 fn inline_align(_context: fidl::encoding::Context) -> usize {
1216 2
1217 }
1218
1219 #[inline(always)]
1220 fn inline_size(_context: fidl::encoding::Context) -> usize {
1221 2
1222 }
1223 }
1224
1225 impl fidl::encoding::ValueTypeMarker for SessionFlags {
1226 type Borrowed<'a> = Self;
1227 #[inline(always)]
1228 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1229 *value
1230 }
1231 }
1232
1233 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SessionFlags {
1234 #[inline]
1235 unsafe fn encode(
1236 self,
1237 encoder: &mut fidl::encoding::Encoder<'_, D>,
1238 offset: usize,
1239 _depth: fidl::encoding::Depth,
1240 ) -> fidl::Result<()> {
1241 encoder.debug_check_bounds::<Self>(offset);
1242 if self.bits() & Self::all().bits() != self.bits() {
1243 return Err(fidl::Error::InvalidBitsValue);
1244 }
1245 encoder.write_num(self.bits(), offset);
1246 Ok(())
1247 }
1248 }
1249
1250 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionFlags {
1251 #[inline(always)]
1252 fn new_empty() -> Self {
1253 Self::empty()
1254 }
1255
1256 #[inline]
1257 unsafe fn decode(
1258 &mut self,
1259 decoder: &mut fidl::encoding::Decoder<'_, D>,
1260 offset: usize,
1261 _depth: fidl::encoding::Depth,
1262 ) -> fidl::Result<()> {
1263 decoder.debug_check_bounds::<Self>(offset);
1264 let prim = decoder.read_num::<u16>(offset);
1265 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1266 Ok(())
1267 }
1268 }
1269 unsafe impl fidl::encoding::TypeMarker for StatusFlags {
1270 type Owned = Self;
1271
1272 #[inline(always)]
1273 fn inline_align(_context: fidl::encoding::Context) -> usize {
1274 4
1275 }
1276
1277 #[inline(always)]
1278 fn inline_size(_context: fidl::encoding::Context) -> usize {
1279 4
1280 }
1281 }
1282
1283 impl fidl::encoding::ValueTypeMarker for StatusFlags {
1284 type Borrowed<'a> = Self;
1285 #[inline(always)]
1286 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1287 *value
1288 }
1289 }
1290
1291 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusFlags {
1292 #[inline]
1293 unsafe fn encode(
1294 self,
1295 encoder: &mut fidl::encoding::Encoder<'_, D>,
1296 offset: usize,
1297 _depth: fidl::encoding::Depth,
1298 ) -> fidl::Result<()> {
1299 encoder.debug_check_bounds::<Self>(offset);
1300 if self.bits() & Self::all().bits() != self.bits() {
1301 return Err(fidl::Error::InvalidBitsValue);
1302 }
1303 encoder.write_num(self.bits(), offset);
1304 Ok(())
1305 }
1306 }
1307
1308 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusFlags {
1309 #[inline(always)]
1310 fn new_empty() -> Self {
1311 Self::empty()
1312 }
1313
1314 #[inline]
1315 unsafe fn decode(
1316 &mut self,
1317 decoder: &mut fidl::encoding::Decoder<'_, D>,
1318 offset: usize,
1319 _depth: fidl::encoding::Depth,
1320 ) -> fidl::Result<()> {
1321 decoder.debug_check_bounds::<Self>(offset);
1322 let prim = decoder.read_num::<u32>(offset);
1323 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1324 Ok(())
1325 }
1326 }
1327 unsafe impl fidl::encoding::TypeMarker for TxFlags {
1328 type Owned = Self;
1329
1330 #[inline(always)]
1331 fn inline_align(_context: fidl::encoding::Context) -> usize {
1332 4
1333 }
1334
1335 #[inline(always)]
1336 fn inline_size(_context: fidl::encoding::Context) -> usize {
1337 4
1338 }
1339 }
1340
1341 impl fidl::encoding::ValueTypeMarker for TxFlags {
1342 type Borrowed<'a> = Self;
1343 #[inline(always)]
1344 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1345 *value
1346 }
1347 }
1348
1349 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TxFlags {
1350 #[inline]
1351 unsafe fn encode(
1352 self,
1353 encoder: &mut fidl::encoding::Encoder<'_, D>,
1354 offset: usize,
1355 _depth: fidl::encoding::Depth,
1356 ) -> fidl::Result<()> {
1357 encoder.debug_check_bounds::<Self>(offset);
1358 encoder.write_num(self.bits(), offset);
1359 Ok(())
1360 }
1361 }
1362
1363 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxFlags {
1364 #[inline(always)]
1365 fn new_empty() -> Self {
1366 Self::empty()
1367 }
1368
1369 #[inline]
1370 unsafe fn decode(
1371 &mut self,
1372 decoder: &mut fidl::encoding::Decoder<'_, D>,
1373 offset: usize,
1374 _depth: fidl::encoding::Depth,
1375 ) -> fidl::Result<()> {
1376 decoder.debug_check_bounds::<Self>(offset);
1377 let prim = decoder.read_num::<u32>(offset);
1378 *self = Self::from_bits_allow_unknown(prim);
1379 Ok(())
1380 }
1381 }
1382 unsafe impl fidl::encoding::TypeMarker for TxReturnFlags {
1383 type Owned = Self;
1384
1385 #[inline(always)]
1386 fn inline_align(_context: fidl::encoding::Context) -> usize {
1387 4
1388 }
1389
1390 #[inline(always)]
1391 fn inline_size(_context: fidl::encoding::Context) -> usize {
1392 4
1393 }
1394 }
1395
1396 impl fidl::encoding::ValueTypeMarker for TxReturnFlags {
1397 type Borrowed<'a> = Self;
1398 #[inline(always)]
1399 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1400 *value
1401 }
1402 }
1403
1404 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TxReturnFlags {
1405 #[inline]
1406 unsafe fn encode(
1407 self,
1408 encoder: &mut fidl::encoding::Encoder<'_, D>,
1409 offset: usize,
1410 _depth: fidl::encoding::Depth,
1411 ) -> fidl::Result<()> {
1412 encoder.debug_check_bounds::<Self>(offset);
1413 encoder.write_num(self.bits(), offset);
1414 Ok(())
1415 }
1416 }
1417
1418 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxReturnFlags {
1419 #[inline(always)]
1420 fn new_empty() -> Self {
1421 Self::empty()
1422 }
1423
1424 #[inline]
1425 unsafe fn decode(
1426 &mut self,
1427 decoder: &mut fidl::encoding::Decoder<'_, D>,
1428 offset: usize,
1429 _depth: fidl::encoding::Depth,
1430 ) -> fidl::Result<()> {
1431 decoder.debug_check_bounds::<Self>(offset);
1432 let prim = decoder.read_num::<u32>(offset);
1433 *self = Self::from_bits_allow_unknown(prim);
1434 Ok(())
1435 }
1436 }
1437 unsafe impl fidl::encoding::TypeMarker for DeviceClass {
1438 type Owned = Self;
1439
1440 #[inline(always)]
1441 fn inline_align(_context: fidl::encoding::Context) -> usize {
1442 std::mem::align_of::<u16>()
1443 }
1444
1445 #[inline(always)]
1446 fn inline_size(_context: fidl::encoding::Context) -> usize {
1447 std::mem::size_of::<u16>()
1448 }
1449
1450 #[inline(always)]
1451 fn encode_is_copy() -> bool {
1452 true
1453 }
1454
1455 #[inline(always)]
1456 fn decode_is_copy() -> bool {
1457 false
1458 }
1459 }
1460
1461 impl fidl::encoding::ValueTypeMarker for DeviceClass {
1462 type Borrowed<'a> = Self;
1463 #[inline(always)]
1464 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1465 *value
1466 }
1467 }
1468
1469 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceClass {
1470 #[inline]
1471 unsafe fn encode(
1472 self,
1473 encoder: &mut fidl::encoding::Encoder<'_, D>,
1474 offset: usize,
1475 _depth: fidl::encoding::Depth,
1476 ) -> fidl::Result<()> {
1477 encoder.debug_check_bounds::<Self>(offset);
1478 encoder.write_num(self.into_primitive(), offset);
1479 Ok(())
1480 }
1481 }
1482
1483 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceClass {
1484 #[inline(always)]
1485 fn new_empty() -> Self {
1486 Self::Virtual
1487 }
1488
1489 #[inline]
1490 unsafe fn decode(
1491 &mut self,
1492 decoder: &mut fidl::encoding::Decoder<'_, D>,
1493 offset: usize,
1494 _depth: fidl::encoding::Depth,
1495 ) -> fidl::Result<()> {
1496 decoder.debug_check_bounds::<Self>(offset);
1497 let prim = decoder.read_num::<u16>(offset);
1498
1499 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1500 Ok(())
1501 }
1502 }
1503 unsafe impl fidl::encoding::TypeMarker for FrameType {
1504 type Owned = Self;
1505
1506 #[inline(always)]
1507 fn inline_align(_context: fidl::encoding::Context) -> usize {
1508 std::mem::align_of::<u8>()
1509 }
1510
1511 #[inline(always)]
1512 fn inline_size(_context: fidl::encoding::Context) -> usize {
1513 std::mem::size_of::<u8>()
1514 }
1515
1516 #[inline(always)]
1517 fn encode_is_copy() -> bool {
1518 false
1519 }
1520
1521 #[inline(always)]
1522 fn decode_is_copy() -> bool {
1523 false
1524 }
1525 }
1526
1527 impl fidl::encoding::ValueTypeMarker for FrameType {
1528 type Borrowed<'a> = Self;
1529 #[inline(always)]
1530 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1531 *value
1532 }
1533 }
1534
1535 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for FrameType {
1536 #[inline]
1537 unsafe fn encode(
1538 self,
1539 encoder: &mut fidl::encoding::Encoder<'_, D>,
1540 offset: usize,
1541 _depth: fidl::encoding::Depth,
1542 ) -> fidl::Result<()> {
1543 encoder.debug_check_bounds::<Self>(offset);
1544 encoder.write_num(self.into_primitive(), offset);
1545 Ok(())
1546 }
1547 }
1548
1549 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameType {
1550 #[inline(always)]
1551 fn new_empty() -> Self {
1552 Self::unknown()
1553 }
1554
1555 #[inline]
1556 unsafe fn decode(
1557 &mut self,
1558 decoder: &mut fidl::encoding::Decoder<'_, D>,
1559 offset: usize,
1560 _depth: fidl::encoding::Depth,
1561 ) -> fidl::Result<()> {
1562 decoder.debug_check_bounds::<Self>(offset);
1563 let prim = decoder.read_num::<u8>(offset);
1564
1565 *self = Self::from_primitive_allow_unknown(prim);
1566 Ok(())
1567 }
1568 }
1569 unsafe impl fidl::encoding::TypeMarker for InfoType {
1570 type Owned = Self;
1571
1572 #[inline(always)]
1573 fn inline_align(_context: fidl::encoding::Context) -> usize {
1574 std::mem::align_of::<u32>()
1575 }
1576
1577 #[inline(always)]
1578 fn inline_size(_context: fidl::encoding::Context) -> usize {
1579 std::mem::size_of::<u32>()
1580 }
1581
1582 #[inline(always)]
1583 fn encode_is_copy() -> bool {
1584 true
1585 }
1586
1587 #[inline(always)]
1588 fn decode_is_copy() -> bool {
1589 false
1590 }
1591 }
1592
1593 impl fidl::encoding::ValueTypeMarker for InfoType {
1594 type Borrowed<'a> = Self;
1595 #[inline(always)]
1596 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1597 *value
1598 }
1599 }
1600
1601 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for InfoType {
1602 #[inline]
1603 unsafe fn encode(
1604 self,
1605 encoder: &mut fidl::encoding::Encoder<'_, D>,
1606 offset: usize,
1607 _depth: fidl::encoding::Depth,
1608 ) -> fidl::Result<()> {
1609 encoder.debug_check_bounds::<Self>(offset);
1610 encoder.write_num(self.into_primitive(), offset);
1611 Ok(())
1612 }
1613 }
1614
1615 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InfoType {
1616 #[inline(always)]
1617 fn new_empty() -> Self {
1618 Self::NoInfo
1619 }
1620
1621 #[inline]
1622 unsafe fn decode(
1623 &mut self,
1624 decoder: &mut fidl::encoding::Decoder<'_, D>,
1625 offset: usize,
1626 _depth: fidl::encoding::Depth,
1627 ) -> fidl::Result<()> {
1628 decoder.debug_check_bounds::<Self>(offset);
1629 let prim = decoder.read_num::<u32>(offset);
1630
1631 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1632 Ok(())
1633 }
1634 }
1635 unsafe impl fidl::encoding::TypeMarker for MacFilterMode {
1636 type Owned = Self;
1637
1638 #[inline(always)]
1639 fn inline_align(_context: fidl::encoding::Context) -> usize {
1640 std::mem::align_of::<u32>()
1641 }
1642
1643 #[inline(always)]
1644 fn inline_size(_context: fidl::encoding::Context) -> usize {
1645 std::mem::size_of::<u32>()
1646 }
1647
1648 #[inline(always)]
1649 fn encode_is_copy() -> bool {
1650 false
1651 }
1652
1653 #[inline(always)]
1654 fn decode_is_copy() -> bool {
1655 false
1656 }
1657 }
1658
1659 impl fidl::encoding::ValueTypeMarker for MacFilterMode {
1660 type Borrowed<'a> = Self;
1661 #[inline(always)]
1662 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1663 *value
1664 }
1665 }
1666
1667 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MacFilterMode {
1668 #[inline]
1669 unsafe fn encode(
1670 self,
1671 encoder: &mut fidl::encoding::Encoder<'_, D>,
1672 offset: usize,
1673 _depth: fidl::encoding::Depth,
1674 ) -> fidl::Result<()> {
1675 encoder.debug_check_bounds::<Self>(offset);
1676 encoder.write_num(self.into_primitive(), offset);
1677 Ok(())
1678 }
1679 }
1680
1681 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MacFilterMode {
1682 #[inline(always)]
1683 fn new_empty() -> Self {
1684 Self::unknown()
1685 }
1686
1687 #[inline]
1688 unsafe fn decode(
1689 &mut self,
1690 decoder: &mut fidl::encoding::Decoder<'_, D>,
1691 offset: usize,
1692 _depth: fidl::encoding::Depth,
1693 ) -> fidl::Result<()> {
1694 decoder.debug_check_bounds::<Self>(offset);
1695 let prim = decoder.read_num::<u32>(offset);
1696
1697 *self = Self::from_primitive_allow_unknown(prim);
1698 Ok(())
1699 }
1700 }
1701 unsafe impl fidl::encoding::TypeMarker for PortClass {
1702 type Owned = Self;
1703
1704 #[inline(always)]
1705 fn inline_align(_context: fidl::encoding::Context) -> usize {
1706 std::mem::align_of::<u16>()
1707 }
1708
1709 #[inline(always)]
1710 fn inline_size(_context: fidl::encoding::Context) -> usize {
1711 std::mem::size_of::<u16>()
1712 }
1713
1714 #[inline(always)]
1715 fn encode_is_copy() -> bool {
1716 false
1717 }
1718
1719 #[inline(always)]
1720 fn decode_is_copy() -> bool {
1721 false
1722 }
1723 }
1724
1725 impl fidl::encoding::ValueTypeMarker for PortClass {
1726 type Borrowed<'a> = Self;
1727 #[inline(always)]
1728 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1729 *value
1730 }
1731 }
1732
1733 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PortClass {
1734 #[inline]
1735 unsafe fn encode(
1736 self,
1737 encoder: &mut fidl::encoding::Encoder<'_, D>,
1738 offset: usize,
1739 _depth: fidl::encoding::Depth,
1740 ) -> fidl::Result<()> {
1741 encoder.debug_check_bounds::<Self>(offset);
1742 encoder.write_num(self.into_primitive(), offset);
1743 Ok(())
1744 }
1745 }
1746
1747 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortClass {
1748 #[inline(always)]
1749 fn new_empty() -> Self {
1750 Self::unknown()
1751 }
1752
1753 #[inline]
1754 unsafe fn decode(
1755 &mut self,
1756 decoder: &mut fidl::encoding::Decoder<'_, D>,
1757 offset: usize,
1758 _depth: fidl::encoding::Depth,
1759 ) -> fidl::Result<()> {
1760 decoder.debug_check_bounds::<Self>(offset);
1761 let prim = decoder.read_num::<u16>(offset);
1762
1763 *self = Self::from_primitive_allow_unknown(prim);
1764 Ok(())
1765 }
1766 }
1767 unsafe impl fidl::encoding::TypeMarker for RxAcceleration {
1768 type Owned = Self;
1769
1770 #[inline(always)]
1771 fn inline_align(_context: fidl::encoding::Context) -> usize {
1772 std::mem::align_of::<u8>()
1773 }
1774
1775 #[inline(always)]
1776 fn inline_size(_context: fidl::encoding::Context) -> usize {
1777 std::mem::size_of::<u8>()
1778 }
1779
1780 #[inline(always)]
1781 fn encode_is_copy() -> bool {
1782 false
1783 }
1784
1785 #[inline(always)]
1786 fn decode_is_copy() -> bool {
1787 false
1788 }
1789 }
1790
1791 impl fidl::encoding::ValueTypeMarker for RxAcceleration {
1792 type Borrowed<'a> = Self;
1793 #[inline(always)]
1794 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1795 *value
1796 }
1797 }
1798
1799 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RxAcceleration {
1800 #[inline]
1801 unsafe fn encode(
1802 self,
1803 encoder: &mut fidl::encoding::Encoder<'_, D>,
1804 offset: usize,
1805 _depth: fidl::encoding::Depth,
1806 ) -> fidl::Result<()> {
1807 encoder.debug_check_bounds::<Self>(offset);
1808 encoder.write_num(self.into_primitive(), offset);
1809 Ok(())
1810 }
1811 }
1812
1813 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RxAcceleration {
1814 #[inline(always)]
1815 fn new_empty() -> Self {
1816 Self::unknown()
1817 }
1818
1819 #[inline]
1820 unsafe fn decode(
1821 &mut self,
1822 decoder: &mut fidl::encoding::Decoder<'_, D>,
1823 offset: usize,
1824 _depth: fidl::encoding::Depth,
1825 ) -> fidl::Result<()> {
1826 decoder.debug_check_bounds::<Self>(offset);
1827 let prim = decoder.read_num::<u8>(offset);
1828
1829 *self = Self::from_primitive_allow_unknown(prim);
1830 Ok(())
1831 }
1832 }
1833 unsafe impl fidl::encoding::TypeMarker for TxAcceleration {
1834 type Owned = Self;
1835
1836 #[inline(always)]
1837 fn inline_align(_context: fidl::encoding::Context) -> usize {
1838 std::mem::align_of::<u8>()
1839 }
1840
1841 #[inline(always)]
1842 fn inline_size(_context: fidl::encoding::Context) -> usize {
1843 std::mem::size_of::<u8>()
1844 }
1845
1846 #[inline(always)]
1847 fn encode_is_copy() -> bool {
1848 false
1849 }
1850
1851 #[inline(always)]
1852 fn decode_is_copy() -> bool {
1853 false
1854 }
1855 }
1856
1857 impl fidl::encoding::ValueTypeMarker for TxAcceleration {
1858 type Borrowed<'a> = Self;
1859 #[inline(always)]
1860 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1861 *value
1862 }
1863 }
1864
1865 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TxAcceleration {
1866 #[inline]
1867 unsafe fn encode(
1868 self,
1869 encoder: &mut fidl::encoding::Encoder<'_, D>,
1870 offset: usize,
1871 _depth: fidl::encoding::Depth,
1872 ) -> fidl::Result<()> {
1873 encoder.debug_check_bounds::<Self>(offset);
1874 encoder.write_num(self.into_primitive(), offset);
1875 Ok(())
1876 }
1877 }
1878
1879 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxAcceleration {
1880 #[inline(always)]
1881 fn new_empty() -> Self {
1882 Self::unknown()
1883 }
1884
1885 #[inline]
1886 unsafe fn decode(
1887 &mut self,
1888 decoder: &mut fidl::encoding::Decoder<'_, D>,
1889 offset: usize,
1890 _depth: fidl::encoding::Depth,
1891 ) -> fidl::Result<()> {
1892 decoder.debug_check_bounds::<Self>(offset);
1893 let prim = decoder.read_num::<u8>(offset);
1894
1895 *self = Self::from_primitive_allow_unknown(prim);
1896 Ok(())
1897 }
1898 }
1899
1900 impl fidl::encoding::ValueTypeMarker for DeviceGetInfoResponse {
1901 type Borrowed<'a> = &'a Self;
1902 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1903 value
1904 }
1905 }
1906
1907 unsafe impl fidl::encoding::TypeMarker for DeviceGetInfoResponse {
1908 type Owned = Self;
1909
1910 #[inline(always)]
1911 fn inline_align(_context: fidl::encoding::Context) -> usize {
1912 8
1913 }
1914
1915 #[inline(always)]
1916 fn inline_size(_context: fidl::encoding::Context) -> usize {
1917 16
1918 }
1919 }
1920
1921 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetInfoResponse, D>
1922 for &DeviceGetInfoResponse
1923 {
1924 #[inline]
1925 unsafe fn encode(
1926 self,
1927 encoder: &mut fidl::encoding::Encoder<'_, D>,
1928 offset: usize,
1929 _depth: fidl::encoding::Depth,
1930 ) -> fidl::Result<()> {
1931 encoder.debug_check_bounds::<DeviceGetInfoResponse>(offset);
1932 fidl::encoding::Encode::<DeviceGetInfoResponse, D>::encode(
1934 (<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
1935 encoder,
1936 offset,
1937 _depth,
1938 )
1939 }
1940 }
1941 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceInfo, D>>
1942 fidl::encoding::Encode<DeviceGetInfoResponse, D> for (T0,)
1943 {
1944 #[inline]
1945 unsafe fn encode(
1946 self,
1947 encoder: &mut fidl::encoding::Encoder<'_, D>,
1948 offset: usize,
1949 depth: fidl::encoding::Depth,
1950 ) -> fidl::Result<()> {
1951 encoder.debug_check_bounds::<DeviceGetInfoResponse>(offset);
1952 self.0.encode(encoder, offset + 0, depth)?;
1956 Ok(())
1957 }
1958 }
1959
1960 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetInfoResponse {
1961 #[inline(always)]
1962 fn new_empty() -> Self {
1963 Self { info: fidl::new_empty!(DeviceInfo, D) }
1964 }
1965
1966 #[inline]
1967 unsafe fn decode(
1968 &mut self,
1969 decoder: &mut fidl::encoding::Decoder<'_, D>,
1970 offset: usize,
1971 _depth: fidl::encoding::Depth,
1972 ) -> fidl::Result<()> {
1973 decoder.debug_check_bounds::<Self>(offset);
1974 fidl::decode!(DeviceInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
1976 Ok(())
1977 }
1978 }
1979
1980 impl fidl::encoding::ValueTypeMarker for Empty {
1981 type Borrowed<'a> = &'a Self;
1982 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1983 value
1984 }
1985 }
1986
1987 unsafe impl fidl::encoding::TypeMarker for Empty {
1988 type Owned = Self;
1989
1990 #[inline(always)]
1991 fn inline_align(_context: fidl::encoding::Context) -> usize {
1992 1
1993 }
1994
1995 #[inline(always)]
1996 fn inline_size(_context: fidl::encoding::Context) -> usize {
1997 1
1998 }
1999 }
2000
2001 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
2002 #[inline]
2003 unsafe fn encode(
2004 self,
2005 encoder: &mut fidl::encoding::Encoder<'_, D>,
2006 offset: usize,
2007 _depth: fidl::encoding::Depth,
2008 ) -> fidl::Result<()> {
2009 encoder.debug_check_bounds::<Empty>(offset);
2010 encoder.write_num(0u8, offset);
2011 Ok(())
2012 }
2013 }
2014
2015 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
2016 #[inline(always)]
2017 fn new_empty() -> Self {
2018 Self
2019 }
2020
2021 #[inline]
2022 unsafe fn decode(
2023 &mut self,
2024 decoder: &mut fidl::encoding::Decoder<'_, D>,
2025 offset: usize,
2026 _depth: fidl::encoding::Depth,
2027 ) -> fidl::Result<()> {
2028 decoder.debug_check_bounds::<Self>(offset);
2029 match decoder.read_num::<u8>(offset) {
2030 0 => Ok(()),
2031 _ => Err(fidl::Error::Invalid),
2032 }
2033 }
2034 }
2035
2036 impl fidl::encoding::ValueTypeMarker for FrameTypeSupport {
2037 type Borrowed<'a> = &'a Self;
2038 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2039 value
2040 }
2041 }
2042
2043 unsafe impl fidl::encoding::TypeMarker for FrameTypeSupport {
2044 type Owned = Self;
2045
2046 #[inline(always)]
2047 fn inline_align(_context: fidl::encoding::Context) -> usize {
2048 4
2049 }
2050
2051 #[inline(always)]
2052 fn inline_size(_context: fidl::encoding::Context) -> usize {
2053 12
2054 }
2055 }
2056
2057 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FrameTypeSupport, D>
2058 for &FrameTypeSupport
2059 {
2060 #[inline]
2061 unsafe fn encode(
2062 self,
2063 encoder: &mut fidl::encoding::Encoder<'_, D>,
2064 offset: usize,
2065 _depth: fidl::encoding::Depth,
2066 ) -> fidl::Result<()> {
2067 encoder.debug_check_bounds::<FrameTypeSupport>(offset);
2068 fidl::encoding::Encode::<FrameTypeSupport, D>::encode(
2070 (
2071 <FrameType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
2072 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.features),
2073 <TxFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_flags),
2074 ),
2075 encoder,
2076 offset,
2077 _depth,
2078 )
2079 }
2080 }
2081 unsafe impl<
2082 D: fidl::encoding::ResourceDialect,
2083 T0: fidl::encoding::Encode<FrameType, D>,
2084 T1: fidl::encoding::Encode<u32, D>,
2085 T2: fidl::encoding::Encode<TxFlags, D>,
2086 > fidl::encoding::Encode<FrameTypeSupport, D> for (T0, T1, T2)
2087 {
2088 #[inline]
2089 unsafe fn encode(
2090 self,
2091 encoder: &mut fidl::encoding::Encoder<'_, D>,
2092 offset: usize,
2093 depth: fidl::encoding::Depth,
2094 ) -> fidl::Result<()> {
2095 encoder.debug_check_bounds::<FrameTypeSupport>(offset);
2096 unsafe {
2099 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2100 (ptr as *mut u32).write_unaligned(0);
2101 }
2102 self.0.encode(encoder, offset + 0, depth)?;
2104 self.1.encode(encoder, offset + 4, depth)?;
2105 self.2.encode(encoder, offset + 8, depth)?;
2106 Ok(())
2107 }
2108 }
2109
2110 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameTypeSupport {
2111 #[inline(always)]
2112 fn new_empty() -> Self {
2113 Self {
2114 type_: fidl::new_empty!(FrameType, D),
2115 features: fidl::new_empty!(u32, D),
2116 supported_flags: fidl::new_empty!(TxFlags, D),
2117 }
2118 }
2119
2120 #[inline]
2121 unsafe fn decode(
2122 &mut self,
2123 decoder: &mut fidl::encoding::Decoder<'_, D>,
2124 offset: usize,
2125 _depth: fidl::encoding::Depth,
2126 ) -> fidl::Result<()> {
2127 decoder.debug_check_bounds::<Self>(offset);
2128 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2130 let padval = unsafe { (ptr as *const u32).read_unaligned() };
2131 let mask = 0xffffff00u32;
2132 let maskedval = padval & mask;
2133 if maskedval != 0 {
2134 return Err(fidl::Error::NonZeroPadding {
2135 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2136 });
2137 }
2138 fidl::decode!(FrameType, D, &mut self.type_, decoder, offset + 0, _depth)?;
2139 fidl::decode!(u32, D, &mut self.features, decoder, offset + 4, _depth)?;
2140 fidl::decode!(TxFlags, D, &mut self.supported_flags, decoder, offset + 8, _depth)?;
2141 Ok(())
2142 }
2143 }
2144
2145 impl fidl::encoding::ValueTypeMarker for MacAddressingAddMulticastAddressRequest {
2146 type Borrowed<'a> = &'a Self;
2147 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2148 value
2149 }
2150 }
2151
2152 unsafe impl fidl::encoding::TypeMarker for MacAddressingAddMulticastAddressRequest {
2153 type Owned = Self;
2154
2155 #[inline(always)]
2156 fn inline_align(_context: fidl::encoding::Context) -> usize {
2157 1
2158 }
2159
2160 #[inline(always)]
2161 fn inline_size(_context: fidl::encoding::Context) -> usize {
2162 6
2163 }
2164 }
2165
2166 unsafe impl<D: fidl::encoding::ResourceDialect>
2167 fidl::encoding::Encode<MacAddressingAddMulticastAddressRequest, D>
2168 for &MacAddressingAddMulticastAddressRequest
2169 {
2170 #[inline]
2171 unsafe fn encode(
2172 self,
2173 encoder: &mut fidl::encoding::Encoder<'_, D>,
2174 offset: usize,
2175 _depth: fidl::encoding::Depth,
2176 ) -> fidl::Result<()> {
2177 encoder.debug_check_bounds::<MacAddressingAddMulticastAddressRequest>(offset);
2178 fidl::encoding::Encode::<MacAddressingAddMulticastAddressRequest, D>::encode(
2180 (<fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
2181 &self.address,
2182 ),),
2183 encoder,
2184 offset,
2185 _depth,
2186 )
2187 }
2188 }
2189 unsafe impl<
2190 D: fidl::encoding::ResourceDialect,
2191 T0: fidl::encoding::Encode<fidl_fuchsia_net::MacAddress, D>,
2192 > fidl::encoding::Encode<MacAddressingAddMulticastAddressRequest, D> for (T0,)
2193 {
2194 #[inline]
2195 unsafe fn encode(
2196 self,
2197 encoder: &mut fidl::encoding::Encoder<'_, D>,
2198 offset: usize,
2199 depth: fidl::encoding::Depth,
2200 ) -> fidl::Result<()> {
2201 encoder.debug_check_bounds::<MacAddressingAddMulticastAddressRequest>(offset);
2202 self.0.encode(encoder, offset + 0, depth)?;
2206 Ok(())
2207 }
2208 }
2209
2210 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2211 for MacAddressingAddMulticastAddressRequest
2212 {
2213 #[inline(always)]
2214 fn new_empty() -> Self {
2215 Self { address: fidl::new_empty!(fidl_fuchsia_net::MacAddress, D) }
2216 }
2217
2218 #[inline]
2219 unsafe fn decode(
2220 &mut self,
2221 decoder: &mut fidl::encoding::Decoder<'_, D>,
2222 offset: usize,
2223 _depth: fidl::encoding::Depth,
2224 ) -> fidl::Result<()> {
2225 decoder.debug_check_bounds::<Self>(offset);
2226 fidl::decode!(
2228 fidl_fuchsia_net::MacAddress,
2229 D,
2230 &mut self.address,
2231 decoder,
2232 offset + 0,
2233 _depth
2234 )?;
2235 Ok(())
2236 }
2237 }
2238
2239 impl fidl::encoding::ValueTypeMarker for MacAddressingAddMulticastAddressResponse {
2240 type Borrowed<'a> = &'a Self;
2241 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2242 value
2243 }
2244 }
2245
2246 unsafe impl fidl::encoding::TypeMarker for MacAddressingAddMulticastAddressResponse {
2247 type Owned = Self;
2248
2249 #[inline(always)]
2250 fn inline_align(_context: fidl::encoding::Context) -> usize {
2251 4
2252 }
2253
2254 #[inline(always)]
2255 fn inline_size(_context: fidl::encoding::Context) -> usize {
2256 4
2257 }
2258 #[inline(always)]
2259 fn encode_is_copy() -> bool {
2260 true
2261 }
2262
2263 #[inline(always)]
2264 fn decode_is_copy() -> bool {
2265 true
2266 }
2267 }
2268
2269 unsafe impl<D: fidl::encoding::ResourceDialect>
2270 fidl::encoding::Encode<MacAddressingAddMulticastAddressResponse, D>
2271 for &MacAddressingAddMulticastAddressResponse
2272 {
2273 #[inline]
2274 unsafe fn encode(
2275 self,
2276 encoder: &mut fidl::encoding::Encoder<'_, D>,
2277 offset: usize,
2278 _depth: fidl::encoding::Depth,
2279 ) -> fidl::Result<()> {
2280 encoder.debug_check_bounds::<MacAddressingAddMulticastAddressResponse>(offset);
2281 unsafe {
2282 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2284 (buf_ptr as *mut MacAddressingAddMulticastAddressResponse).write_unaligned(
2285 (self as *const MacAddressingAddMulticastAddressResponse).read(),
2286 );
2287 }
2290 Ok(())
2291 }
2292 }
2293 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2294 fidl::encoding::Encode<MacAddressingAddMulticastAddressResponse, D> for (T0,)
2295 {
2296 #[inline]
2297 unsafe fn encode(
2298 self,
2299 encoder: &mut fidl::encoding::Encoder<'_, D>,
2300 offset: usize,
2301 depth: fidl::encoding::Depth,
2302 ) -> fidl::Result<()> {
2303 encoder.debug_check_bounds::<MacAddressingAddMulticastAddressResponse>(offset);
2304 self.0.encode(encoder, offset + 0, depth)?;
2308 Ok(())
2309 }
2310 }
2311
2312 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2313 for MacAddressingAddMulticastAddressResponse
2314 {
2315 #[inline(always)]
2316 fn new_empty() -> Self {
2317 Self { status: fidl::new_empty!(i32, D) }
2318 }
2319
2320 #[inline]
2321 unsafe fn decode(
2322 &mut self,
2323 decoder: &mut fidl::encoding::Decoder<'_, D>,
2324 offset: usize,
2325 _depth: fidl::encoding::Depth,
2326 ) -> fidl::Result<()> {
2327 decoder.debug_check_bounds::<Self>(offset);
2328 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2329 unsafe {
2332 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2333 }
2334 Ok(())
2335 }
2336 }
2337
2338 impl fidl::encoding::ValueTypeMarker for MacAddressingGetUnicastAddressResponse {
2339 type Borrowed<'a> = &'a Self;
2340 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2341 value
2342 }
2343 }
2344
2345 unsafe impl fidl::encoding::TypeMarker for MacAddressingGetUnicastAddressResponse {
2346 type Owned = Self;
2347
2348 #[inline(always)]
2349 fn inline_align(_context: fidl::encoding::Context) -> usize {
2350 1
2351 }
2352
2353 #[inline(always)]
2354 fn inline_size(_context: fidl::encoding::Context) -> usize {
2355 6
2356 }
2357 }
2358
2359 unsafe impl<D: fidl::encoding::ResourceDialect>
2360 fidl::encoding::Encode<MacAddressingGetUnicastAddressResponse, D>
2361 for &MacAddressingGetUnicastAddressResponse
2362 {
2363 #[inline]
2364 unsafe fn encode(
2365 self,
2366 encoder: &mut fidl::encoding::Encoder<'_, D>,
2367 offset: usize,
2368 _depth: fidl::encoding::Depth,
2369 ) -> fidl::Result<()> {
2370 encoder.debug_check_bounds::<MacAddressingGetUnicastAddressResponse>(offset);
2371 fidl::encoding::Encode::<MacAddressingGetUnicastAddressResponse, D>::encode(
2373 (<fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
2374 &self.address,
2375 ),),
2376 encoder,
2377 offset,
2378 _depth,
2379 )
2380 }
2381 }
2382 unsafe impl<
2383 D: fidl::encoding::ResourceDialect,
2384 T0: fidl::encoding::Encode<fidl_fuchsia_net::MacAddress, D>,
2385 > fidl::encoding::Encode<MacAddressingGetUnicastAddressResponse, D> for (T0,)
2386 {
2387 #[inline]
2388 unsafe fn encode(
2389 self,
2390 encoder: &mut fidl::encoding::Encoder<'_, D>,
2391 offset: usize,
2392 depth: fidl::encoding::Depth,
2393 ) -> fidl::Result<()> {
2394 encoder.debug_check_bounds::<MacAddressingGetUnicastAddressResponse>(offset);
2395 self.0.encode(encoder, offset + 0, depth)?;
2399 Ok(())
2400 }
2401 }
2402
2403 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2404 for MacAddressingGetUnicastAddressResponse
2405 {
2406 #[inline(always)]
2407 fn new_empty() -> Self {
2408 Self { address: fidl::new_empty!(fidl_fuchsia_net::MacAddress, D) }
2409 }
2410
2411 #[inline]
2412 unsafe fn decode(
2413 &mut self,
2414 decoder: &mut fidl::encoding::Decoder<'_, D>,
2415 offset: usize,
2416 _depth: fidl::encoding::Depth,
2417 ) -> fidl::Result<()> {
2418 decoder.debug_check_bounds::<Self>(offset);
2419 fidl::decode!(
2421 fidl_fuchsia_net::MacAddress,
2422 D,
2423 &mut self.address,
2424 decoder,
2425 offset + 0,
2426 _depth
2427 )?;
2428 Ok(())
2429 }
2430 }
2431
2432 impl fidl::encoding::ValueTypeMarker for MacAddressingRemoveMulticastAddressRequest {
2433 type Borrowed<'a> = &'a Self;
2434 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2435 value
2436 }
2437 }
2438
2439 unsafe impl fidl::encoding::TypeMarker for MacAddressingRemoveMulticastAddressRequest {
2440 type Owned = Self;
2441
2442 #[inline(always)]
2443 fn inline_align(_context: fidl::encoding::Context) -> usize {
2444 1
2445 }
2446
2447 #[inline(always)]
2448 fn inline_size(_context: fidl::encoding::Context) -> usize {
2449 6
2450 }
2451 }
2452
2453 unsafe impl<D: fidl::encoding::ResourceDialect>
2454 fidl::encoding::Encode<MacAddressingRemoveMulticastAddressRequest, D>
2455 for &MacAddressingRemoveMulticastAddressRequest
2456 {
2457 #[inline]
2458 unsafe fn encode(
2459 self,
2460 encoder: &mut fidl::encoding::Encoder<'_, D>,
2461 offset: usize,
2462 _depth: fidl::encoding::Depth,
2463 ) -> fidl::Result<()> {
2464 encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressRequest>(offset);
2465 fidl::encoding::Encode::<MacAddressingRemoveMulticastAddressRequest, D>::encode(
2467 (<fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
2468 &self.address,
2469 ),),
2470 encoder,
2471 offset,
2472 _depth,
2473 )
2474 }
2475 }
2476 unsafe impl<
2477 D: fidl::encoding::ResourceDialect,
2478 T0: fidl::encoding::Encode<fidl_fuchsia_net::MacAddress, D>,
2479 > fidl::encoding::Encode<MacAddressingRemoveMulticastAddressRequest, D> for (T0,)
2480 {
2481 #[inline]
2482 unsafe fn encode(
2483 self,
2484 encoder: &mut fidl::encoding::Encoder<'_, D>,
2485 offset: usize,
2486 depth: fidl::encoding::Depth,
2487 ) -> fidl::Result<()> {
2488 encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressRequest>(offset);
2489 self.0.encode(encoder, offset + 0, depth)?;
2493 Ok(())
2494 }
2495 }
2496
2497 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2498 for MacAddressingRemoveMulticastAddressRequest
2499 {
2500 #[inline(always)]
2501 fn new_empty() -> Self {
2502 Self { address: fidl::new_empty!(fidl_fuchsia_net::MacAddress, D) }
2503 }
2504
2505 #[inline]
2506 unsafe fn decode(
2507 &mut self,
2508 decoder: &mut fidl::encoding::Decoder<'_, D>,
2509 offset: usize,
2510 _depth: fidl::encoding::Depth,
2511 ) -> fidl::Result<()> {
2512 decoder.debug_check_bounds::<Self>(offset);
2513 fidl::decode!(
2515 fidl_fuchsia_net::MacAddress,
2516 D,
2517 &mut self.address,
2518 decoder,
2519 offset + 0,
2520 _depth
2521 )?;
2522 Ok(())
2523 }
2524 }
2525
2526 impl fidl::encoding::ValueTypeMarker for MacAddressingRemoveMulticastAddressResponse {
2527 type Borrowed<'a> = &'a Self;
2528 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2529 value
2530 }
2531 }
2532
2533 unsafe impl fidl::encoding::TypeMarker for MacAddressingRemoveMulticastAddressResponse {
2534 type Owned = Self;
2535
2536 #[inline(always)]
2537 fn inline_align(_context: fidl::encoding::Context) -> usize {
2538 4
2539 }
2540
2541 #[inline(always)]
2542 fn inline_size(_context: fidl::encoding::Context) -> usize {
2543 4
2544 }
2545 #[inline(always)]
2546 fn encode_is_copy() -> bool {
2547 true
2548 }
2549
2550 #[inline(always)]
2551 fn decode_is_copy() -> bool {
2552 true
2553 }
2554 }
2555
2556 unsafe impl<D: fidl::encoding::ResourceDialect>
2557 fidl::encoding::Encode<MacAddressingRemoveMulticastAddressResponse, D>
2558 for &MacAddressingRemoveMulticastAddressResponse
2559 {
2560 #[inline]
2561 unsafe fn encode(
2562 self,
2563 encoder: &mut fidl::encoding::Encoder<'_, D>,
2564 offset: usize,
2565 _depth: fidl::encoding::Depth,
2566 ) -> fidl::Result<()> {
2567 encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressResponse>(offset);
2568 unsafe {
2569 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2571 (buf_ptr as *mut MacAddressingRemoveMulticastAddressResponse).write_unaligned(
2572 (self as *const MacAddressingRemoveMulticastAddressResponse).read(),
2573 );
2574 }
2577 Ok(())
2578 }
2579 }
2580 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2581 fidl::encoding::Encode<MacAddressingRemoveMulticastAddressResponse, D> for (T0,)
2582 {
2583 #[inline]
2584 unsafe fn encode(
2585 self,
2586 encoder: &mut fidl::encoding::Encoder<'_, D>,
2587 offset: usize,
2588 depth: fidl::encoding::Depth,
2589 ) -> fidl::Result<()> {
2590 encoder.debug_check_bounds::<MacAddressingRemoveMulticastAddressResponse>(offset);
2591 self.0.encode(encoder, offset + 0, depth)?;
2595 Ok(())
2596 }
2597 }
2598
2599 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2600 for MacAddressingRemoveMulticastAddressResponse
2601 {
2602 #[inline(always)]
2603 fn new_empty() -> Self {
2604 Self { status: fidl::new_empty!(i32, D) }
2605 }
2606
2607 #[inline]
2608 unsafe fn decode(
2609 &mut self,
2610 decoder: &mut fidl::encoding::Decoder<'_, D>,
2611 offset: usize,
2612 _depth: fidl::encoding::Depth,
2613 ) -> fidl::Result<()> {
2614 decoder.debug_check_bounds::<Self>(offset);
2615 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2616 unsafe {
2619 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2620 }
2621 Ok(())
2622 }
2623 }
2624
2625 impl fidl::encoding::ValueTypeMarker for MacAddressingSetModeRequest {
2626 type Borrowed<'a> = &'a Self;
2627 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2628 value
2629 }
2630 }
2631
2632 unsafe impl fidl::encoding::TypeMarker for MacAddressingSetModeRequest {
2633 type Owned = Self;
2634
2635 #[inline(always)]
2636 fn inline_align(_context: fidl::encoding::Context) -> usize {
2637 4
2638 }
2639
2640 #[inline(always)]
2641 fn inline_size(_context: fidl::encoding::Context) -> usize {
2642 4
2643 }
2644 }
2645
2646 unsafe impl<D: fidl::encoding::ResourceDialect>
2647 fidl::encoding::Encode<MacAddressingSetModeRequest, D> for &MacAddressingSetModeRequest
2648 {
2649 #[inline]
2650 unsafe fn encode(
2651 self,
2652 encoder: &mut fidl::encoding::Encoder<'_, D>,
2653 offset: usize,
2654 _depth: fidl::encoding::Depth,
2655 ) -> fidl::Result<()> {
2656 encoder.debug_check_bounds::<MacAddressingSetModeRequest>(offset);
2657 fidl::encoding::Encode::<MacAddressingSetModeRequest, D>::encode(
2659 (<MacFilterMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),),
2660 encoder,
2661 offset,
2662 _depth,
2663 )
2664 }
2665 }
2666 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<MacFilterMode, D>>
2667 fidl::encoding::Encode<MacAddressingSetModeRequest, D> for (T0,)
2668 {
2669 #[inline]
2670 unsafe fn encode(
2671 self,
2672 encoder: &mut fidl::encoding::Encoder<'_, D>,
2673 offset: usize,
2674 depth: fidl::encoding::Depth,
2675 ) -> fidl::Result<()> {
2676 encoder.debug_check_bounds::<MacAddressingSetModeRequest>(offset);
2677 self.0.encode(encoder, offset + 0, depth)?;
2681 Ok(())
2682 }
2683 }
2684
2685 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2686 for MacAddressingSetModeRequest
2687 {
2688 #[inline(always)]
2689 fn new_empty() -> Self {
2690 Self { mode: fidl::new_empty!(MacFilterMode, D) }
2691 }
2692
2693 #[inline]
2694 unsafe fn decode(
2695 &mut self,
2696 decoder: &mut fidl::encoding::Decoder<'_, D>,
2697 offset: usize,
2698 _depth: fidl::encoding::Depth,
2699 ) -> fidl::Result<()> {
2700 decoder.debug_check_bounds::<Self>(offset);
2701 fidl::decode!(MacFilterMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
2703 Ok(())
2704 }
2705 }
2706
2707 impl fidl::encoding::ValueTypeMarker for MacAddressingSetModeResponse {
2708 type Borrowed<'a> = &'a Self;
2709 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2710 value
2711 }
2712 }
2713
2714 unsafe impl fidl::encoding::TypeMarker for MacAddressingSetModeResponse {
2715 type Owned = Self;
2716
2717 #[inline(always)]
2718 fn inline_align(_context: fidl::encoding::Context) -> usize {
2719 4
2720 }
2721
2722 #[inline(always)]
2723 fn inline_size(_context: fidl::encoding::Context) -> usize {
2724 4
2725 }
2726 #[inline(always)]
2727 fn encode_is_copy() -> bool {
2728 true
2729 }
2730
2731 #[inline(always)]
2732 fn decode_is_copy() -> bool {
2733 true
2734 }
2735 }
2736
2737 unsafe impl<D: fidl::encoding::ResourceDialect>
2738 fidl::encoding::Encode<MacAddressingSetModeResponse, D> for &MacAddressingSetModeResponse
2739 {
2740 #[inline]
2741 unsafe fn encode(
2742 self,
2743 encoder: &mut fidl::encoding::Encoder<'_, D>,
2744 offset: usize,
2745 _depth: fidl::encoding::Depth,
2746 ) -> fidl::Result<()> {
2747 encoder.debug_check_bounds::<MacAddressingSetModeResponse>(offset);
2748 unsafe {
2749 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2751 (buf_ptr as *mut MacAddressingSetModeResponse)
2752 .write_unaligned((self as *const MacAddressingSetModeResponse).read());
2753 }
2756 Ok(())
2757 }
2758 }
2759 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2760 fidl::encoding::Encode<MacAddressingSetModeResponse, D> for (T0,)
2761 {
2762 #[inline]
2763 unsafe fn encode(
2764 self,
2765 encoder: &mut fidl::encoding::Encoder<'_, D>,
2766 offset: usize,
2767 depth: fidl::encoding::Depth,
2768 ) -> fidl::Result<()> {
2769 encoder.debug_check_bounds::<MacAddressingSetModeResponse>(offset);
2770 self.0.encode(encoder, offset + 0, depth)?;
2774 Ok(())
2775 }
2776 }
2777
2778 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2779 for MacAddressingSetModeResponse
2780 {
2781 #[inline(always)]
2782 fn new_empty() -> Self {
2783 Self { status: fidl::new_empty!(i32, D) }
2784 }
2785
2786 #[inline]
2787 unsafe fn decode(
2788 &mut self,
2789 decoder: &mut fidl::encoding::Decoder<'_, D>,
2790 offset: usize,
2791 _depth: fidl::encoding::Depth,
2792 ) -> fidl::Result<()> {
2793 decoder.debug_check_bounds::<Self>(offset);
2794 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2795 unsafe {
2798 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2799 }
2800 Ok(())
2801 }
2802 }
2803
2804 impl fidl::encoding::ValueTypeMarker for PortGetInfoResponse {
2805 type Borrowed<'a> = &'a Self;
2806 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2807 value
2808 }
2809 }
2810
2811 unsafe impl fidl::encoding::TypeMarker for PortGetInfoResponse {
2812 type Owned = Self;
2813
2814 #[inline(always)]
2815 fn inline_align(_context: fidl::encoding::Context) -> usize {
2816 8
2817 }
2818
2819 #[inline(always)]
2820 fn inline_size(_context: fidl::encoding::Context) -> usize {
2821 16
2822 }
2823 }
2824
2825 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortGetInfoResponse, D>
2826 for &PortGetInfoResponse
2827 {
2828 #[inline]
2829 unsafe fn encode(
2830 self,
2831 encoder: &mut fidl::encoding::Encoder<'_, D>,
2832 offset: usize,
2833 _depth: fidl::encoding::Depth,
2834 ) -> fidl::Result<()> {
2835 encoder.debug_check_bounds::<PortGetInfoResponse>(offset);
2836 fidl::encoding::Encode::<PortGetInfoResponse, D>::encode(
2838 (<PortInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
2839 encoder,
2840 offset,
2841 _depth,
2842 )
2843 }
2844 }
2845 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortInfo, D>>
2846 fidl::encoding::Encode<PortGetInfoResponse, D> for (T0,)
2847 {
2848 #[inline]
2849 unsafe fn encode(
2850 self,
2851 encoder: &mut fidl::encoding::Encoder<'_, D>,
2852 offset: usize,
2853 depth: fidl::encoding::Depth,
2854 ) -> fidl::Result<()> {
2855 encoder.debug_check_bounds::<PortGetInfoResponse>(offset);
2856 self.0.encode(encoder, offset + 0, depth)?;
2860 Ok(())
2861 }
2862 }
2863
2864 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortGetInfoResponse {
2865 #[inline(always)]
2866 fn new_empty() -> Self {
2867 Self { info: fidl::new_empty!(PortInfo, D) }
2868 }
2869
2870 #[inline]
2871 unsafe fn decode(
2872 &mut self,
2873 decoder: &mut fidl::encoding::Decoder<'_, D>,
2874 offset: usize,
2875 _depth: fidl::encoding::Depth,
2876 ) -> fidl::Result<()> {
2877 decoder.debug_check_bounds::<Self>(offset);
2878 fidl::decode!(PortInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
2880 Ok(())
2881 }
2882 }
2883
2884 impl fidl::encoding::ValueTypeMarker for PortGetStatusResponse {
2885 type Borrowed<'a> = &'a Self;
2886 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2887 value
2888 }
2889 }
2890
2891 unsafe impl fidl::encoding::TypeMarker for PortGetStatusResponse {
2892 type Owned = Self;
2893
2894 #[inline(always)]
2895 fn inline_align(_context: fidl::encoding::Context) -> usize {
2896 8
2897 }
2898
2899 #[inline(always)]
2900 fn inline_size(_context: fidl::encoding::Context) -> usize {
2901 16
2902 }
2903 }
2904
2905 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortGetStatusResponse, D>
2906 for &PortGetStatusResponse
2907 {
2908 #[inline]
2909 unsafe fn encode(
2910 self,
2911 encoder: &mut fidl::encoding::Encoder<'_, D>,
2912 offset: usize,
2913 _depth: fidl::encoding::Depth,
2914 ) -> fidl::Result<()> {
2915 encoder.debug_check_bounds::<PortGetStatusResponse>(offset);
2916 fidl::encoding::Encode::<PortGetStatusResponse, D>::encode(
2918 (<PortStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
2919 encoder,
2920 offset,
2921 _depth,
2922 )
2923 }
2924 }
2925 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortStatus, D>>
2926 fidl::encoding::Encode<PortGetStatusResponse, D> for (T0,)
2927 {
2928 #[inline]
2929 unsafe fn encode(
2930 self,
2931 encoder: &mut fidl::encoding::Encoder<'_, D>,
2932 offset: usize,
2933 depth: fidl::encoding::Depth,
2934 ) -> fidl::Result<()> {
2935 encoder.debug_check_bounds::<PortGetStatusResponse>(offset);
2936 self.0.encode(encoder, offset + 0, depth)?;
2940 Ok(())
2941 }
2942 }
2943
2944 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortGetStatusResponse {
2945 #[inline(always)]
2946 fn new_empty() -> Self {
2947 Self { status: fidl::new_empty!(PortStatus, D) }
2948 }
2949
2950 #[inline]
2951 unsafe fn decode(
2952 &mut self,
2953 decoder: &mut fidl::encoding::Decoder<'_, D>,
2954 offset: usize,
2955 _depth: fidl::encoding::Depth,
2956 ) -> fidl::Result<()> {
2957 decoder.debug_check_bounds::<Self>(offset);
2958 fidl::decode!(PortStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
2960 Ok(())
2961 }
2962 }
2963
2964 impl fidl::encoding::ValueTypeMarker for PortId {
2965 type Borrowed<'a> = &'a Self;
2966 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2967 value
2968 }
2969 }
2970
2971 unsafe impl fidl::encoding::TypeMarker for PortId {
2972 type Owned = Self;
2973
2974 #[inline(always)]
2975 fn inline_align(_context: fidl::encoding::Context) -> usize {
2976 1
2977 }
2978
2979 #[inline(always)]
2980 fn inline_size(_context: fidl::encoding::Context) -> usize {
2981 2
2982 }
2983 #[inline(always)]
2984 fn encode_is_copy() -> bool {
2985 true
2986 }
2987
2988 #[inline(always)]
2989 fn decode_is_copy() -> bool {
2990 true
2991 }
2992 }
2993
2994 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortId, D> for &PortId {
2995 #[inline]
2996 unsafe fn encode(
2997 self,
2998 encoder: &mut fidl::encoding::Encoder<'_, D>,
2999 offset: usize,
3000 _depth: fidl::encoding::Depth,
3001 ) -> fidl::Result<()> {
3002 encoder.debug_check_bounds::<PortId>(offset);
3003 unsafe {
3004 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3006 (buf_ptr as *mut PortId).write_unaligned((self as *const PortId).read());
3007 }
3010 Ok(())
3011 }
3012 }
3013 unsafe impl<
3014 D: fidl::encoding::ResourceDialect,
3015 T0: fidl::encoding::Encode<u8, D>,
3016 T1: fidl::encoding::Encode<u8, D>,
3017 > fidl::encoding::Encode<PortId, D> for (T0, T1)
3018 {
3019 #[inline]
3020 unsafe fn encode(
3021 self,
3022 encoder: &mut fidl::encoding::Encoder<'_, D>,
3023 offset: usize,
3024 depth: fidl::encoding::Depth,
3025 ) -> fidl::Result<()> {
3026 encoder.debug_check_bounds::<PortId>(offset);
3027 self.0.encode(encoder, offset + 0, depth)?;
3031 self.1.encode(encoder, offset + 1, depth)?;
3032 Ok(())
3033 }
3034 }
3035
3036 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortId {
3037 #[inline(always)]
3038 fn new_empty() -> Self {
3039 Self { base: fidl::new_empty!(u8, D), salt: fidl::new_empty!(u8, D) }
3040 }
3041
3042 #[inline]
3043 unsafe fn decode(
3044 &mut self,
3045 decoder: &mut fidl::encoding::Decoder<'_, D>,
3046 offset: usize,
3047 _depth: fidl::encoding::Depth,
3048 ) -> fidl::Result<()> {
3049 decoder.debug_check_bounds::<Self>(offset);
3050 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3051 unsafe {
3054 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3055 }
3056 Ok(())
3057 }
3058 }
3059
3060 impl fidl::encoding::ValueTypeMarker for PortWatcherWatchResponse {
3061 type Borrowed<'a> = &'a Self;
3062 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3063 value
3064 }
3065 }
3066
3067 unsafe impl fidl::encoding::TypeMarker for PortWatcherWatchResponse {
3068 type Owned = Self;
3069
3070 #[inline(always)]
3071 fn inline_align(_context: fidl::encoding::Context) -> usize {
3072 8
3073 }
3074
3075 #[inline(always)]
3076 fn inline_size(_context: fidl::encoding::Context) -> usize {
3077 16
3078 }
3079 }
3080
3081 unsafe impl<D: fidl::encoding::ResourceDialect>
3082 fidl::encoding::Encode<PortWatcherWatchResponse, D> for &PortWatcherWatchResponse
3083 {
3084 #[inline]
3085 unsafe fn encode(
3086 self,
3087 encoder: &mut fidl::encoding::Encoder<'_, D>,
3088 offset: usize,
3089 _depth: fidl::encoding::Depth,
3090 ) -> fidl::Result<()> {
3091 encoder.debug_check_bounds::<PortWatcherWatchResponse>(offset);
3092 fidl::encoding::Encode::<PortWatcherWatchResponse, D>::encode(
3094 (<DevicePortEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
3095 encoder,
3096 offset,
3097 _depth,
3098 )
3099 }
3100 }
3101 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DevicePortEvent, D>>
3102 fidl::encoding::Encode<PortWatcherWatchResponse, D> for (T0,)
3103 {
3104 #[inline]
3105 unsafe fn encode(
3106 self,
3107 encoder: &mut fidl::encoding::Encoder<'_, D>,
3108 offset: usize,
3109 depth: fidl::encoding::Depth,
3110 ) -> fidl::Result<()> {
3111 encoder.debug_check_bounds::<PortWatcherWatchResponse>(offset);
3112 self.0.encode(encoder, offset + 0, depth)?;
3116 Ok(())
3117 }
3118 }
3119
3120 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3121 for PortWatcherWatchResponse
3122 {
3123 #[inline(always)]
3124 fn new_empty() -> Self {
3125 Self { event: fidl::new_empty!(DevicePortEvent, D) }
3126 }
3127
3128 #[inline]
3129 unsafe fn decode(
3130 &mut self,
3131 decoder: &mut fidl::encoding::Decoder<'_, D>,
3132 offset: usize,
3133 _depth: fidl::encoding::Depth,
3134 ) -> fidl::Result<()> {
3135 decoder.debug_check_bounds::<Self>(offset);
3136 fidl::decode!(DevicePortEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
3138 Ok(())
3139 }
3140 }
3141
3142 impl fidl::encoding::ValueTypeMarker for SessionAttachRequest {
3143 type Borrowed<'a> = &'a Self;
3144 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3145 value
3146 }
3147 }
3148
3149 unsafe impl fidl::encoding::TypeMarker for SessionAttachRequest {
3150 type Owned = Self;
3151
3152 #[inline(always)]
3153 fn inline_align(_context: fidl::encoding::Context) -> usize {
3154 8
3155 }
3156
3157 #[inline(always)]
3158 fn inline_size(_context: fidl::encoding::Context) -> usize {
3159 24
3160 }
3161 }
3162
3163 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionAttachRequest, D>
3164 for &SessionAttachRequest
3165 {
3166 #[inline]
3167 unsafe fn encode(
3168 self,
3169 encoder: &mut fidl::encoding::Encoder<'_, D>,
3170 offset: usize,
3171 _depth: fidl::encoding::Depth,
3172 ) -> fidl::Result<()> {
3173 encoder.debug_check_bounds::<SessionAttachRequest>(offset);
3174 fidl::encoding::Encode::<SessionAttachRequest, D>::encode(
3176 (
3177 <PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
3178 <fidl::encoding::Vector<FrameType, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.rx_frames),
3179 ),
3180 encoder, offset, _depth
3181 )
3182 }
3183 }
3184 unsafe impl<
3185 D: fidl::encoding::ResourceDialect,
3186 T0: fidl::encoding::Encode<PortId, D>,
3187 T1: fidl::encoding::Encode<fidl::encoding::Vector<FrameType, 4>, D>,
3188 > fidl::encoding::Encode<SessionAttachRequest, D> for (T0, T1)
3189 {
3190 #[inline]
3191 unsafe fn encode(
3192 self,
3193 encoder: &mut fidl::encoding::Encoder<'_, D>,
3194 offset: usize,
3195 depth: fidl::encoding::Depth,
3196 ) -> fidl::Result<()> {
3197 encoder.debug_check_bounds::<SessionAttachRequest>(offset);
3198 unsafe {
3201 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3202 (ptr as *mut u64).write_unaligned(0);
3203 }
3204 self.0.encode(encoder, offset + 0, depth)?;
3206 self.1.encode(encoder, offset + 8, depth)?;
3207 Ok(())
3208 }
3209 }
3210
3211 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionAttachRequest {
3212 #[inline(always)]
3213 fn new_empty() -> Self {
3214 Self {
3215 port: fidl::new_empty!(PortId, D),
3216 rx_frames: fidl::new_empty!(fidl::encoding::Vector<FrameType, 4>, D),
3217 }
3218 }
3219
3220 #[inline]
3221 unsafe fn decode(
3222 &mut self,
3223 decoder: &mut fidl::encoding::Decoder<'_, D>,
3224 offset: usize,
3225 _depth: fidl::encoding::Depth,
3226 ) -> fidl::Result<()> {
3227 decoder.debug_check_bounds::<Self>(offset);
3228 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3230 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3231 let mask = 0xffffffffffff0000u64;
3232 let maskedval = padval & mask;
3233 if maskedval != 0 {
3234 return Err(fidl::Error::NonZeroPadding {
3235 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3236 });
3237 }
3238 fidl::decode!(PortId, D, &mut self.port, decoder, offset + 0, _depth)?;
3239 fidl::decode!(fidl::encoding::Vector<FrameType, 4>, D, &mut self.rx_frames, decoder, offset + 8, _depth)?;
3240 Ok(())
3241 }
3242 }
3243
3244 impl fidl::encoding::ValueTypeMarker for SessionDetachRequest {
3245 type Borrowed<'a> = &'a Self;
3246 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3247 value
3248 }
3249 }
3250
3251 unsafe impl fidl::encoding::TypeMarker for SessionDetachRequest {
3252 type Owned = Self;
3253
3254 #[inline(always)]
3255 fn inline_align(_context: fidl::encoding::Context) -> usize {
3256 1
3257 }
3258
3259 #[inline(always)]
3260 fn inline_size(_context: fidl::encoding::Context) -> usize {
3261 2
3262 }
3263 #[inline(always)]
3264 fn encode_is_copy() -> bool {
3265 true
3266 }
3267
3268 #[inline(always)]
3269 fn decode_is_copy() -> bool {
3270 true
3271 }
3272 }
3273
3274 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionDetachRequest, D>
3275 for &SessionDetachRequest
3276 {
3277 #[inline]
3278 unsafe fn encode(
3279 self,
3280 encoder: &mut fidl::encoding::Encoder<'_, D>,
3281 offset: usize,
3282 _depth: fidl::encoding::Depth,
3283 ) -> fidl::Result<()> {
3284 encoder.debug_check_bounds::<SessionDetachRequest>(offset);
3285 unsafe {
3286 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3288 (buf_ptr as *mut SessionDetachRequest)
3289 .write_unaligned((self as *const SessionDetachRequest).read());
3290 }
3293 Ok(())
3294 }
3295 }
3296 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortId, D>>
3297 fidl::encoding::Encode<SessionDetachRequest, D> for (T0,)
3298 {
3299 #[inline]
3300 unsafe fn encode(
3301 self,
3302 encoder: &mut fidl::encoding::Encoder<'_, D>,
3303 offset: usize,
3304 depth: fidl::encoding::Depth,
3305 ) -> fidl::Result<()> {
3306 encoder.debug_check_bounds::<SessionDetachRequest>(offset);
3307 self.0.encode(encoder, offset + 0, depth)?;
3311 Ok(())
3312 }
3313 }
3314
3315 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionDetachRequest {
3316 #[inline(always)]
3317 fn new_empty() -> Self {
3318 Self { port: fidl::new_empty!(PortId, D) }
3319 }
3320
3321 #[inline]
3322 unsafe fn decode(
3323 &mut self,
3324 decoder: &mut fidl::encoding::Decoder<'_, D>,
3325 offset: usize,
3326 _depth: fidl::encoding::Depth,
3327 ) -> fidl::Result<()> {
3328 decoder.debug_check_bounds::<Self>(offset);
3329 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3330 unsafe {
3333 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3334 }
3335 Ok(())
3336 }
3337 }
3338
3339 impl fidl::encoding::ValueTypeMarker for StatusWatcherWatchStatusResponse {
3340 type Borrowed<'a> = &'a Self;
3341 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3342 value
3343 }
3344 }
3345
3346 unsafe impl fidl::encoding::TypeMarker for StatusWatcherWatchStatusResponse {
3347 type Owned = Self;
3348
3349 #[inline(always)]
3350 fn inline_align(_context: fidl::encoding::Context) -> usize {
3351 8
3352 }
3353
3354 #[inline(always)]
3355 fn inline_size(_context: fidl::encoding::Context) -> usize {
3356 16
3357 }
3358 }
3359
3360 unsafe impl<D: fidl::encoding::ResourceDialect>
3361 fidl::encoding::Encode<StatusWatcherWatchStatusResponse, D>
3362 for &StatusWatcherWatchStatusResponse
3363 {
3364 #[inline]
3365 unsafe fn encode(
3366 self,
3367 encoder: &mut fidl::encoding::Encoder<'_, D>,
3368 offset: usize,
3369 _depth: fidl::encoding::Depth,
3370 ) -> fidl::Result<()> {
3371 encoder.debug_check_bounds::<StatusWatcherWatchStatusResponse>(offset);
3372 fidl::encoding::Encode::<StatusWatcherWatchStatusResponse, D>::encode(
3374 (<PortStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.port_status),),
3375 encoder,
3376 offset,
3377 _depth,
3378 )
3379 }
3380 }
3381 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PortStatus, D>>
3382 fidl::encoding::Encode<StatusWatcherWatchStatusResponse, D> for (T0,)
3383 {
3384 #[inline]
3385 unsafe fn encode(
3386 self,
3387 encoder: &mut fidl::encoding::Encoder<'_, D>,
3388 offset: usize,
3389 depth: fidl::encoding::Depth,
3390 ) -> fidl::Result<()> {
3391 encoder.debug_check_bounds::<StatusWatcherWatchStatusResponse>(offset);
3392 self.0.encode(encoder, offset + 0, depth)?;
3396 Ok(())
3397 }
3398 }
3399
3400 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3401 for StatusWatcherWatchStatusResponse
3402 {
3403 #[inline(always)]
3404 fn new_empty() -> Self {
3405 Self { port_status: fidl::new_empty!(PortStatus, D) }
3406 }
3407
3408 #[inline]
3409 unsafe fn decode(
3410 &mut self,
3411 decoder: &mut fidl::encoding::Decoder<'_, D>,
3412 offset: usize,
3413 _depth: fidl::encoding::Depth,
3414 ) -> fidl::Result<()> {
3415 decoder.debug_check_bounds::<Self>(offset);
3416 fidl::decode!(PortStatus, D, &mut self.port_status, decoder, offset + 0, _depth)?;
3418 Ok(())
3419 }
3420 }
3421
3422 impl DeviceBaseInfo {
3423 #[inline(always)]
3424 fn max_ordinal_present(&self) -> u64 {
3425 if let Some(_) = self.tx_accel {
3426 return 11;
3427 }
3428 if let Some(_) = self.rx_accel {
3429 return 10;
3430 }
3431 if let Some(_) = self.max_buffer_parts {
3432 return 9;
3433 }
3434 if let Some(_) = self.min_tx_buffer_tail {
3435 return 8;
3436 }
3437 if let Some(_) = self.min_tx_buffer_head {
3438 return 7;
3439 }
3440 if let Some(_) = self.min_tx_buffer_length {
3441 return 6;
3442 }
3443 if let Some(_) = self.min_rx_buffer_length {
3444 return 5;
3445 }
3446 if let Some(_) = self.max_buffer_length {
3447 return 4;
3448 }
3449 if let Some(_) = self.buffer_alignment {
3450 return 3;
3451 }
3452 if let Some(_) = self.tx_depth {
3453 return 2;
3454 }
3455 if let Some(_) = self.rx_depth {
3456 return 1;
3457 }
3458 0
3459 }
3460 }
3461
3462 impl fidl::encoding::ValueTypeMarker for DeviceBaseInfo {
3463 type Borrowed<'a> = &'a Self;
3464 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3465 value
3466 }
3467 }
3468
3469 unsafe impl fidl::encoding::TypeMarker for DeviceBaseInfo {
3470 type Owned = Self;
3471
3472 #[inline(always)]
3473 fn inline_align(_context: fidl::encoding::Context) -> usize {
3474 8
3475 }
3476
3477 #[inline(always)]
3478 fn inline_size(_context: fidl::encoding::Context) -> usize {
3479 16
3480 }
3481 }
3482
3483 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceBaseInfo, D>
3484 for &DeviceBaseInfo
3485 {
3486 unsafe fn encode(
3487 self,
3488 encoder: &mut fidl::encoding::Encoder<'_, D>,
3489 offset: usize,
3490 mut depth: fidl::encoding::Depth,
3491 ) -> fidl::Result<()> {
3492 encoder.debug_check_bounds::<DeviceBaseInfo>(offset);
3493 let max_ordinal: u64 = self.max_ordinal_present();
3495 encoder.write_num(max_ordinal, offset);
3496 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3497 if max_ordinal == 0 {
3499 return Ok(());
3500 }
3501 depth.increment()?;
3502 let envelope_size = 8;
3503 let bytes_len = max_ordinal as usize * envelope_size;
3504 #[allow(unused_variables)]
3505 let offset = encoder.out_of_line_offset(bytes_len);
3506 let mut _prev_end_offset: usize = 0;
3507 if 1 > max_ordinal {
3508 return Ok(());
3509 }
3510
3511 let cur_offset: usize = (1 - 1) * envelope_size;
3514
3515 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3517
3518 fidl::encoding::encode_in_envelope_optional::<u16, D>(
3523 self.rx_depth.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3524 encoder,
3525 offset + cur_offset,
3526 depth,
3527 )?;
3528
3529 _prev_end_offset = cur_offset + envelope_size;
3530 if 2 > max_ordinal {
3531 return Ok(());
3532 }
3533
3534 let cur_offset: usize = (2 - 1) * envelope_size;
3537
3538 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3540
3541 fidl::encoding::encode_in_envelope_optional::<u16, D>(
3546 self.tx_depth.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3547 encoder,
3548 offset + cur_offset,
3549 depth,
3550 )?;
3551
3552 _prev_end_offset = cur_offset + envelope_size;
3553 if 3 > max_ordinal {
3554 return Ok(());
3555 }
3556
3557 let cur_offset: usize = (3 - 1) * envelope_size;
3560
3561 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3563
3564 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3569 self.buffer_alignment
3570 .as_ref()
3571 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3572 encoder,
3573 offset + cur_offset,
3574 depth,
3575 )?;
3576
3577 _prev_end_offset = cur_offset + envelope_size;
3578 if 4 > max_ordinal {
3579 return Ok(());
3580 }
3581
3582 let cur_offset: usize = (4 - 1) * envelope_size;
3585
3586 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3588
3589 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3594 self.max_buffer_length
3595 .as_ref()
3596 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3597 encoder,
3598 offset + cur_offset,
3599 depth,
3600 )?;
3601
3602 _prev_end_offset = cur_offset + envelope_size;
3603 if 5 > max_ordinal {
3604 return Ok(());
3605 }
3606
3607 let cur_offset: usize = (5 - 1) * envelope_size;
3610
3611 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3613
3614 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3619 self.min_rx_buffer_length
3620 .as_ref()
3621 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3622 encoder,
3623 offset + cur_offset,
3624 depth,
3625 )?;
3626
3627 _prev_end_offset = cur_offset + envelope_size;
3628 if 6 > max_ordinal {
3629 return Ok(());
3630 }
3631
3632 let cur_offset: usize = (6 - 1) * envelope_size;
3635
3636 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3638
3639 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3644 self.min_tx_buffer_length
3645 .as_ref()
3646 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3647 encoder,
3648 offset + cur_offset,
3649 depth,
3650 )?;
3651
3652 _prev_end_offset = cur_offset + envelope_size;
3653 if 7 > max_ordinal {
3654 return Ok(());
3655 }
3656
3657 let cur_offset: usize = (7 - 1) * envelope_size;
3660
3661 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3663
3664 fidl::encoding::encode_in_envelope_optional::<u16, D>(
3669 self.min_tx_buffer_head
3670 .as_ref()
3671 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3672 encoder,
3673 offset + cur_offset,
3674 depth,
3675 )?;
3676
3677 _prev_end_offset = cur_offset + envelope_size;
3678 if 8 > max_ordinal {
3679 return Ok(());
3680 }
3681
3682 let cur_offset: usize = (8 - 1) * envelope_size;
3685
3686 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3688
3689 fidl::encoding::encode_in_envelope_optional::<u16, D>(
3694 self.min_tx_buffer_tail
3695 .as_ref()
3696 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3697 encoder,
3698 offset + cur_offset,
3699 depth,
3700 )?;
3701
3702 _prev_end_offset = cur_offset + envelope_size;
3703 if 9 > max_ordinal {
3704 return Ok(());
3705 }
3706
3707 let cur_offset: usize = (9 - 1) * envelope_size;
3710
3711 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3713
3714 fidl::encoding::encode_in_envelope_optional::<u8, D>(
3719 self.max_buffer_parts.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3720 encoder,
3721 offset + cur_offset,
3722 depth,
3723 )?;
3724
3725 _prev_end_offset = cur_offset + envelope_size;
3726 if 10 > max_ordinal {
3727 return Ok(());
3728 }
3729
3730 let cur_offset: usize = (10 - 1) * envelope_size;
3733
3734 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3736
3737 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<RxAcceleration, 16>, D>(
3742 self.rx_accel.as_ref().map(<fidl::encoding::Vector<RxAcceleration, 16> as fidl::encoding::ValueTypeMarker>::borrow),
3743 encoder, offset + cur_offset, depth
3744 )?;
3745
3746 _prev_end_offset = cur_offset + envelope_size;
3747 if 11 > max_ordinal {
3748 return Ok(());
3749 }
3750
3751 let cur_offset: usize = (11 - 1) * envelope_size;
3754
3755 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3757
3758 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TxAcceleration, 16>, D>(
3763 self.tx_accel.as_ref().map(<fidl::encoding::Vector<TxAcceleration, 16> as fidl::encoding::ValueTypeMarker>::borrow),
3764 encoder, offset + cur_offset, depth
3765 )?;
3766
3767 _prev_end_offset = cur_offset + envelope_size;
3768
3769 Ok(())
3770 }
3771 }
3772
3773 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceBaseInfo {
3774 #[inline(always)]
3775 fn new_empty() -> Self {
3776 Self::default()
3777 }
3778
3779 unsafe fn decode(
3780 &mut self,
3781 decoder: &mut fidl::encoding::Decoder<'_, D>,
3782 offset: usize,
3783 mut depth: fidl::encoding::Depth,
3784 ) -> fidl::Result<()> {
3785 decoder.debug_check_bounds::<Self>(offset);
3786 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3787 None => return Err(fidl::Error::NotNullable),
3788 Some(len) => len,
3789 };
3790 if len == 0 {
3792 return Ok(());
3793 };
3794 depth.increment()?;
3795 let envelope_size = 8;
3796 let bytes_len = len * envelope_size;
3797 let offset = decoder.out_of_line_offset(bytes_len)?;
3798 let mut _next_ordinal_to_read = 0;
3800 let mut next_offset = offset;
3801 let end_offset = offset + bytes_len;
3802 _next_ordinal_to_read += 1;
3803 if next_offset >= end_offset {
3804 return Ok(());
3805 }
3806
3807 while _next_ordinal_to_read < 1 {
3809 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3810 _next_ordinal_to_read += 1;
3811 next_offset += envelope_size;
3812 }
3813
3814 let next_out_of_line = decoder.next_out_of_line();
3815 let handles_before = decoder.remaining_handles();
3816 if let Some((inlined, num_bytes, num_handles)) =
3817 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3818 {
3819 let member_inline_size =
3820 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3821 if inlined != (member_inline_size <= 4) {
3822 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3823 }
3824 let inner_offset;
3825 let mut inner_depth = depth.clone();
3826 if inlined {
3827 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3828 inner_offset = next_offset;
3829 } else {
3830 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3831 inner_depth.increment()?;
3832 }
3833 let val_ref = self.rx_depth.get_or_insert_with(|| fidl::new_empty!(u16, D));
3834 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3835 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3836 {
3837 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3838 }
3839 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3840 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3841 }
3842 }
3843
3844 next_offset += envelope_size;
3845 _next_ordinal_to_read += 1;
3846 if next_offset >= end_offset {
3847 return Ok(());
3848 }
3849
3850 while _next_ordinal_to_read < 2 {
3852 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3853 _next_ordinal_to_read += 1;
3854 next_offset += envelope_size;
3855 }
3856
3857 let next_out_of_line = decoder.next_out_of_line();
3858 let handles_before = decoder.remaining_handles();
3859 if let Some((inlined, num_bytes, num_handles)) =
3860 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3861 {
3862 let member_inline_size =
3863 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3864 if inlined != (member_inline_size <= 4) {
3865 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3866 }
3867 let inner_offset;
3868 let mut inner_depth = depth.clone();
3869 if inlined {
3870 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3871 inner_offset = next_offset;
3872 } else {
3873 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3874 inner_depth.increment()?;
3875 }
3876 let val_ref = self.tx_depth.get_or_insert_with(|| fidl::new_empty!(u16, D));
3877 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3878 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3879 {
3880 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3881 }
3882 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3883 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3884 }
3885 }
3886
3887 next_offset += envelope_size;
3888 _next_ordinal_to_read += 1;
3889 if next_offset >= end_offset {
3890 return Ok(());
3891 }
3892
3893 while _next_ordinal_to_read < 3 {
3895 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3896 _next_ordinal_to_read += 1;
3897 next_offset += envelope_size;
3898 }
3899
3900 let next_out_of_line = decoder.next_out_of_line();
3901 let handles_before = decoder.remaining_handles();
3902 if let Some((inlined, num_bytes, num_handles)) =
3903 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3904 {
3905 let member_inline_size =
3906 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3907 if inlined != (member_inline_size <= 4) {
3908 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3909 }
3910 let inner_offset;
3911 let mut inner_depth = depth.clone();
3912 if inlined {
3913 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3914 inner_offset = next_offset;
3915 } else {
3916 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3917 inner_depth.increment()?;
3918 }
3919 let val_ref = self.buffer_alignment.get_or_insert_with(|| fidl::new_empty!(u32, D));
3920 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3921 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3922 {
3923 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3924 }
3925 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3926 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3927 }
3928 }
3929
3930 next_offset += envelope_size;
3931 _next_ordinal_to_read += 1;
3932 if next_offset >= end_offset {
3933 return Ok(());
3934 }
3935
3936 while _next_ordinal_to_read < 4 {
3938 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3939 _next_ordinal_to_read += 1;
3940 next_offset += envelope_size;
3941 }
3942
3943 let next_out_of_line = decoder.next_out_of_line();
3944 let handles_before = decoder.remaining_handles();
3945 if let Some((inlined, num_bytes, num_handles)) =
3946 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3947 {
3948 let member_inline_size =
3949 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3950 if inlined != (member_inline_size <= 4) {
3951 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3952 }
3953 let inner_offset;
3954 let mut inner_depth = depth.clone();
3955 if inlined {
3956 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3957 inner_offset = next_offset;
3958 } else {
3959 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3960 inner_depth.increment()?;
3961 }
3962 let val_ref =
3963 self.max_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
3964 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3965 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3966 {
3967 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3968 }
3969 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3970 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3971 }
3972 }
3973
3974 next_offset += envelope_size;
3975 _next_ordinal_to_read += 1;
3976 if next_offset >= end_offset {
3977 return Ok(());
3978 }
3979
3980 while _next_ordinal_to_read < 5 {
3982 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3983 _next_ordinal_to_read += 1;
3984 next_offset += envelope_size;
3985 }
3986
3987 let next_out_of_line = decoder.next_out_of_line();
3988 let handles_before = decoder.remaining_handles();
3989 if let Some((inlined, num_bytes, num_handles)) =
3990 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3991 {
3992 let member_inline_size =
3993 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3994 if inlined != (member_inline_size <= 4) {
3995 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3996 }
3997 let inner_offset;
3998 let mut inner_depth = depth.clone();
3999 if inlined {
4000 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4001 inner_offset = next_offset;
4002 } else {
4003 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4004 inner_depth.increment()?;
4005 }
4006 let val_ref =
4007 self.min_rx_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
4008 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4009 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4010 {
4011 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4012 }
4013 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4014 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4015 }
4016 }
4017
4018 next_offset += envelope_size;
4019 _next_ordinal_to_read += 1;
4020 if next_offset >= end_offset {
4021 return Ok(());
4022 }
4023
4024 while _next_ordinal_to_read < 6 {
4026 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4027 _next_ordinal_to_read += 1;
4028 next_offset += envelope_size;
4029 }
4030
4031 let next_out_of_line = decoder.next_out_of_line();
4032 let handles_before = decoder.remaining_handles();
4033 if let Some((inlined, num_bytes, num_handles)) =
4034 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4035 {
4036 let member_inline_size =
4037 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4038 if inlined != (member_inline_size <= 4) {
4039 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4040 }
4041 let inner_offset;
4042 let mut inner_depth = depth.clone();
4043 if inlined {
4044 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4045 inner_offset = next_offset;
4046 } else {
4047 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4048 inner_depth.increment()?;
4049 }
4050 let val_ref =
4051 self.min_tx_buffer_length.get_or_insert_with(|| fidl::new_empty!(u32, D));
4052 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4053 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4054 {
4055 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4056 }
4057 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4058 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4059 }
4060 }
4061
4062 next_offset += envelope_size;
4063 _next_ordinal_to_read += 1;
4064 if next_offset >= end_offset {
4065 return Ok(());
4066 }
4067
4068 while _next_ordinal_to_read < 7 {
4070 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4071 _next_ordinal_to_read += 1;
4072 next_offset += envelope_size;
4073 }
4074
4075 let next_out_of_line = decoder.next_out_of_line();
4076 let handles_before = decoder.remaining_handles();
4077 if let Some((inlined, num_bytes, num_handles)) =
4078 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4079 {
4080 let member_inline_size =
4081 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4082 if inlined != (member_inline_size <= 4) {
4083 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4084 }
4085 let inner_offset;
4086 let mut inner_depth = depth.clone();
4087 if inlined {
4088 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4089 inner_offset = next_offset;
4090 } else {
4091 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4092 inner_depth.increment()?;
4093 }
4094 let val_ref =
4095 self.min_tx_buffer_head.get_or_insert_with(|| fidl::new_empty!(u16, D));
4096 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4097 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4098 {
4099 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4100 }
4101 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4102 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4103 }
4104 }
4105
4106 next_offset += envelope_size;
4107 _next_ordinal_to_read += 1;
4108 if next_offset >= end_offset {
4109 return Ok(());
4110 }
4111
4112 while _next_ordinal_to_read < 8 {
4114 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4115 _next_ordinal_to_read += 1;
4116 next_offset += envelope_size;
4117 }
4118
4119 let next_out_of_line = decoder.next_out_of_line();
4120 let handles_before = decoder.remaining_handles();
4121 if let Some((inlined, num_bytes, num_handles)) =
4122 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4123 {
4124 let member_inline_size =
4125 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4126 if inlined != (member_inline_size <= 4) {
4127 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4128 }
4129 let inner_offset;
4130 let mut inner_depth = depth.clone();
4131 if inlined {
4132 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4133 inner_offset = next_offset;
4134 } else {
4135 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4136 inner_depth.increment()?;
4137 }
4138 let val_ref =
4139 self.min_tx_buffer_tail.get_or_insert_with(|| fidl::new_empty!(u16, D));
4140 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
4141 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4142 {
4143 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4144 }
4145 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4146 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4147 }
4148 }
4149
4150 next_offset += envelope_size;
4151 _next_ordinal_to_read += 1;
4152 if next_offset >= end_offset {
4153 return Ok(());
4154 }
4155
4156 while _next_ordinal_to_read < 9 {
4158 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4159 _next_ordinal_to_read += 1;
4160 next_offset += envelope_size;
4161 }
4162
4163 let next_out_of_line = decoder.next_out_of_line();
4164 let handles_before = decoder.remaining_handles();
4165 if let Some((inlined, num_bytes, num_handles)) =
4166 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4167 {
4168 let member_inline_size =
4169 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4170 if inlined != (member_inline_size <= 4) {
4171 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4172 }
4173 let inner_offset;
4174 let mut inner_depth = depth.clone();
4175 if inlined {
4176 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4177 inner_offset = next_offset;
4178 } else {
4179 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4180 inner_depth.increment()?;
4181 }
4182 let val_ref = self.max_buffer_parts.get_or_insert_with(|| fidl::new_empty!(u8, D));
4183 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4184 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4185 {
4186 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4187 }
4188 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4189 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4190 }
4191 }
4192
4193 next_offset += envelope_size;
4194 _next_ordinal_to_read += 1;
4195 if next_offset >= end_offset {
4196 return Ok(());
4197 }
4198
4199 while _next_ordinal_to_read < 10 {
4201 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4202 _next_ordinal_to_read += 1;
4203 next_offset += envelope_size;
4204 }
4205
4206 let next_out_of_line = decoder.next_out_of_line();
4207 let handles_before = decoder.remaining_handles();
4208 if let Some((inlined, num_bytes, num_handles)) =
4209 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4210 {
4211 let member_inline_size = <fidl::encoding::Vector<RxAcceleration, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4212 if inlined != (member_inline_size <= 4) {
4213 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4214 }
4215 let inner_offset;
4216 let mut inner_depth = depth.clone();
4217 if inlined {
4218 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4219 inner_offset = next_offset;
4220 } else {
4221 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4222 inner_depth.increment()?;
4223 }
4224 let val_ref = self.rx_accel.get_or_insert_with(
4225 || fidl::new_empty!(fidl::encoding::Vector<RxAcceleration, 16>, D),
4226 );
4227 fidl::decode!(fidl::encoding::Vector<RxAcceleration, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
4228 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4229 {
4230 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4231 }
4232 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4233 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4234 }
4235 }
4236
4237 next_offset += envelope_size;
4238 _next_ordinal_to_read += 1;
4239 if next_offset >= end_offset {
4240 return Ok(());
4241 }
4242
4243 while _next_ordinal_to_read < 11 {
4245 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4246 _next_ordinal_to_read += 1;
4247 next_offset += envelope_size;
4248 }
4249
4250 let next_out_of_line = decoder.next_out_of_line();
4251 let handles_before = decoder.remaining_handles();
4252 if let Some((inlined, num_bytes, num_handles)) =
4253 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4254 {
4255 let member_inline_size = <fidl::encoding::Vector<TxAcceleration, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4256 if inlined != (member_inline_size <= 4) {
4257 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4258 }
4259 let inner_offset;
4260 let mut inner_depth = depth.clone();
4261 if inlined {
4262 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4263 inner_offset = next_offset;
4264 } else {
4265 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4266 inner_depth.increment()?;
4267 }
4268 let val_ref = self.tx_accel.get_or_insert_with(
4269 || fidl::new_empty!(fidl::encoding::Vector<TxAcceleration, 16>, D),
4270 );
4271 fidl::decode!(fidl::encoding::Vector<TxAcceleration, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
4272 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4273 {
4274 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4275 }
4276 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4277 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4278 }
4279 }
4280
4281 next_offset += envelope_size;
4282
4283 while next_offset < end_offset {
4285 _next_ordinal_to_read += 1;
4286 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4287 next_offset += envelope_size;
4288 }
4289
4290 Ok(())
4291 }
4292 }
4293
4294 impl DeviceInfo {
4295 #[inline(always)]
4296 fn max_ordinal_present(&self) -> u64 {
4297 if let Some(_) = self.base_info {
4298 return 3;
4299 }
4300 if let Some(_) = self.descriptor_version {
4301 return 2;
4302 }
4303 if let Some(_) = self.min_descriptor_length {
4304 return 1;
4305 }
4306 0
4307 }
4308 }
4309
4310 impl fidl::encoding::ValueTypeMarker for DeviceInfo {
4311 type Borrowed<'a> = &'a Self;
4312 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4313 value
4314 }
4315 }
4316
4317 unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
4318 type Owned = Self;
4319
4320 #[inline(always)]
4321 fn inline_align(_context: fidl::encoding::Context) -> usize {
4322 8
4323 }
4324
4325 #[inline(always)]
4326 fn inline_size(_context: fidl::encoding::Context) -> usize {
4327 16
4328 }
4329 }
4330
4331 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
4332 for &DeviceInfo
4333 {
4334 unsafe fn encode(
4335 self,
4336 encoder: &mut fidl::encoding::Encoder<'_, D>,
4337 offset: usize,
4338 mut depth: fidl::encoding::Depth,
4339 ) -> fidl::Result<()> {
4340 encoder.debug_check_bounds::<DeviceInfo>(offset);
4341 let max_ordinal: u64 = self.max_ordinal_present();
4343 encoder.write_num(max_ordinal, offset);
4344 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4345 if max_ordinal == 0 {
4347 return Ok(());
4348 }
4349 depth.increment()?;
4350 let envelope_size = 8;
4351 let bytes_len = max_ordinal as usize * envelope_size;
4352 #[allow(unused_variables)]
4353 let offset = encoder.out_of_line_offset(bytes_len);
4354 let mut _prev_end_offset: usize = 0;
4355 if 1 > max_ordinal {
4356 return Ok(());
4357 }
4358
4359 let cur_offset: usize = (1 - 1) * envelope_size;
4362
4363 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4365
4366 fidl::encoding::encode_in_envelope_optional::<u8, D>(
4371 self.min_descriptor_length
4372 .as_ref()
4373 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4374 encoder,
4375 offset + cur_offset,
4376 depth,
4377 )?;
4378
4379 _prev_end_offset = cur_offset + envelope_size;
4380 if 2 > max_ordinal {
4381 return Ok(());
4382 }
4383
4384 let cur_offset: usize = (2 - 1) * envelope_size;
4387
4388 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4390
4391 fidl::encoding::encode_in_envelope_optional::<u8, D>(
4396 self.descriptor_version
4397 .as_ref()
4398 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
4399 encoder,
4400 offset + cur_offset,
4401 depth,
4402 )?;
4403
4404 _prev_end_offset = cur_offset + envelope_size;
4405 if 3 > max_ordinal {
4406 return Ok(());
4407 }
4408
4409 let cur_offset: usize = (3 - 1) * envelope_size;
4412
4413 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4415
4416 fidl::encoding::encode_in_envelope_optional::<DeviceBaseInfo, D>(
4421 self.base_info
4422 .as_ref()
4423 .map(<DeviceBaseInfo as fidl::encoding::ValueTypeMarker>::borrow),
4424 encoder,
4425 offset + cur_offset,
4426 depth,
4427 )?;
4428
4429 _prev_end_offset = cur_offset + envelope_size;
4430
4431 Ok(())
4432 }
4433 }
4434
4435 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
4436 #[inline(always)]
4437 fn new_empty() -> Self {
4438 Self::default()
4439 }
4440
4441 unsafe fn decode(
4442 &mut self,
4443 decoder: &mut fidl::encoding::Decoder<'_, D>,
4444 offset: usize,
4445 mut depth: fidl::encoding::Depth,
4446 ) -> fidl::Result<()> {
4447 decoder.debug_check_bounds::<Self>(offset);
4448 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4449 None => return Err(fidl::Error::NotNullable),
4450 Some(len) => len,
4451 };
4452 if len == 0 {
4454 return Ok(());
4455 };
4456 depth.increment()?;
4457 let envelope_size = 8;
4458 let bytes_len = len * envelope_size;
4459 let offset = decoder.out_of_line_offset(bytes_len)?;
4460 let mut _next_ordinal_to_read = 0;
4462 let mut next_offset = offset;
4463 let end_offset = offset + bytes_len;
4464 _next_ordinal_to_read += 1;
4465 if next_offset >= end_offset {
4466 return Ok(());
4467 }
4468
4469 while _next_ordinal_to_read < 1 {
4471 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4472 _next_ordinal_to_read += 1;
4473 next_offset += envelope_size;
4474 }
4475
4476 let next_out_of_line = decoder.next_out_of_line();
4477 let handles_before = decoder.remaining_handles();
4478 if let Some((inlined, num_bytes, num_handles)) =
4479 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4480 {
4481 let member_inline_size =
4482 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4483 if inlined != (member_inline_size <= 4) {
4484 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4485 }
4486 let inner_offset;
4487 let mut inner_depth = depth.clone();
4488 if inlined {
4489 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4490 inner_offset = next_offset;
4491 } else {
4492 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4493 inner_depth.increment()?;
4494 }
4495 let val_ref =
4496 self.min_descriptor_length.get_or_insert_with(|| fidl::new_empty!(u8, D));
4497 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4498 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4499 {
4500 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4501 }
4502 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4503 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4504 }
4505 }
4506
4507 next_offset += envelope_size;
4508 _next_ordinal_to_read += 1;
4509 if next_offset >= end_offset {
4510 return Ok(());
4511 }
4512
4513 while _next_ordinal_to_read < 2 {
4515 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4516 _next_ordinal_to_read += 1;
4517 next_offset += envelope_size;
4518 }
4519
4520 let next_out_of_line = decoder.next_out_of_line();
4521 let handles_before = decoder.remaining_handles();
4522 if let Some((inlined, num_bytes, num_handles)) =
4523 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4524 {
4525 let member_inline_size =
4526 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4527 if inlined != (member_inline_size <= 4) {
4528 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4529 }
4530 let inner_offset;
4531 let mut inner_depth = depth.clone();
4532 if inlined {
4533 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4534 inner_offset = next_offset;
4535 } else {
4536 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4537 inner_depth.increment()?;
4538 }
4539 let val_ref =
4540 self.descriptor_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
4541 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
4542 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4543 {
4544 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4545 }
4546 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4547 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4548 }
4549 }
4550
4551 next_offset += envelope_size;
4552 _next_ordinal_to_read += 1;
4553 if next_offset >= end_offset {
4554 return Ok(());
4555 }
4556
4557 while _next_ordinal_to_read < 3 {
4559 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4560 _next_ordinal_to_read += 1;
4561 next_offset += envelope_size;
4562 }
4563
4564 let next_out_of_line = decoder.next_out_of_line();
4565 let handles_before = decoder.remaining_handles();
4566 if let Some((inlined, num_bytes, num_handles)) =
4567 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4568 {
4569 let member_inline_size =
4570 <DeviceBaseInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4571 if inlined != (member_inline_size <= 4) {
4572 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4573 }
4574 let inner_offset;
4575 let mut inner_depth = depth.clone();
4576 if inlined {
4577 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4578 inner_offset = next_offset;
4579 } else {
4580 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4581 inner_depth.increment()?;
4582 }
4583 let val_ref =
4584 self.base_info.get_or_insert_with(|| fidl::new_empty!(DeviceBaseInfo, D));
4585 fidl::decode!(DeviceBaseInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
4586 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4587 {
4588 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4589 }
4590 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4591 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4592 }
4593 }
4594
4595 next_offset += envelope_size;
4596
4597 while next_offset < end_offset {
4599 _next_ordinal_to_read += 1;
4600 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4601 next_offset += envelope_size;
4602 }
4603
4604 Ok(())
4605 }
4606 }
4607
4608 impl PortBaseInfo {
4609 #[inline(always)]
4610 fn max_ordinal_present(&self) -> u64 {
4611 if let Some(_) = self.tx_types {
4612 return 3;
4613 }
4614 if let Some(_) = self.rx_types {
4615 return 2;
4616 }
4617 if let Some(_) = self.port_class {
4618 return 1;
4619 }
4620 0
4621 }
4622 }
4623
4624 impl fidl::encoding::ValueTypeMarker for PortBaseInfo {
4625 type Borrowed<'a> = &'a Self;
4626 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4627 value
4628 }
4629 }
4630
4631 unsafe impl fidl::encoding::TypeMarker for PortBaseInfo {
4632 type Owned = Self;
4633
4634 #[inline(always)]
4635 fn inline_align(_context: fidl::encoding::Context) -> usize {
4636 8
4637 }
4638
4639 #[inline(always)]
4640 fn inline_size(_context: fidl::encoding::Context) -> usize {
4641 16
4642 }
4643 }
4644
4645 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortBaseInfo, D>
4646 for &PortBaseInfo
4647 {
4648 unsafe fn encode(
4649 self,
4650 encoder: &mut fidl::encoding::Encoder<'_, D>,
4651 offset: usize,
4652 mut depth: fidl::encoding::Depth,
4653 ) -> fidl::Result<()> {
4654 encoder.debug_check_bounds::<PortBaseInfo>(offset);
4655 let max_ordinal: u64 = self.max_ordinal_present();
4657 encoder.write_num(max_ordinal, offset);
4658 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4659 if max_ordinal == 0 {
4661 return Ok(());
4662 }
4663 depth.increment()?;
4664 let envelope_size = 8;
4665 let bytes_len = max_ordinal as usize * envelope_size;
4666 #[allow(unused_variables)]
4667 let offset = encoder.out_of_line_offset(bytes_len);
4668 let mut _prev_end_offset: usize = 0;
4669 if 1 > max_ordinal {
4670 return Ok(());
4671 }
4672
4673 let cur_offset: usize = (1 - 1) * envelope_size;
4676
4677 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4679
4680 fidl::encoding::encode_in_envelope_optional::<PortClass, D>(
4685 self.port_class
4686 .as_ref()
4687 .map(<PortClass as fidl::encoding::ValueTypeMarker>::borrow),
4688 encoder,
4689 offset + cur_offset,
4690 depth,
4691 )?;
4692
4693 _prev_end_offset = cur_offset + envelope_size;
4694 if 2 > max_ordinal {
4695 return Ok(());
4696 }
4697
4698 let cur_offset: usize = (2 - 1) * envelope_size;
4701
4702 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4704
4705 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FrameType, 4>, D>(
4710 self.rx_types.as_ref().map(<fidl::encoding::Vector<FrameType, 4> as fidl::encoding::ValueTypeMarker>::borrow),
4711 encoder, offset + cur_offset, depth
4712 )?;
4713
4714 _prev_end_offset = cur_offset + envelope_size;
4715 if 3 > max_ordinal {
4716 return Ok(());
4717 }
4718
4719 let cur_offset: usize = (3 - 1) * envelope_size;
4722
4723 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4725
4726 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<FrameTypeSupport, 4>, D>(
4731 self.tx_types.as_ref().map(<fidl::encoding::Vector<FrameTypeSupport, 4> as fidl::encoding::ValueTypeMarker>::borrow),
4732 encoder, offset + cur_offset, depth
4733 )?;
4734
4735 _prev_end_offset = cur_offset + envelope_size;
4736
4737 Ok(())
4738 }
4739 }
4740
4741 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortBaseInfo {
4742 #[inline(always)]
4743 fn new_empty() -> Self {
4744 Self::default()
4745 }
4746
4747 unsafe fn decode(
4748 &mut self,
4749 decoder: &mut fidl::encoding::Decoder<'_, D>,
4750 offset: usize,
4751 mut depth: fidl::encoding::Depth,
4752 ) -> fidl::Result<()> {
4753 decoder.debug_check_bounds::<Self>(offset);
4754 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4755 None => return Err(fidl::Error::NotNullable),
4756 Some(len) => len,
4757 };
4758 if len == 0 {
4760 return Ok(());
4761 };
4762 depth.increment()?;
4763 let envelope_size = 8;
4764 let bytes_len = len * envelope_size;
4765 let offset = decoder.out_of_line_offset(bytes_len)?;
4766 let mut _next_ordinal_to_read = 0;
4768 let mut next_offset = offset;
4769 let end_offset = offset + bytes_len;
4770 _next_ordinal_to_read += 1;
4771 if next_offset >= end_offset {
4772 return Ok(());
4773 }
4774
4775 while _next_ordinal_to_read < 1 {
4777 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4778 _next_ordinal_to_read += 1;
4779 next_offset += envelope_size;
4780 }
4781
4782 let next_out_of_line = decoder.next_out_of_line();
4783 let handles_before = decoder.remaining_handles();
4784 if let Some((inlined, num_bytes, num_handles)) =
4785 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4786 {
4787 let member_inline_size =
4788 <PortClass as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4789 if inlined != (member_inline_size <= 4) {
4790 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4791 }
4792 let inner_offset;
4793 let mut inner_depth = depth.clone();
4794 if inlined {
4795 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4796 inner_offset = next_offset;
4797 } else {
4798 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4799 inner_depth.increment()?;
4800 }
4801 let val_ref = self.port_class.get_or_insert_with(|| fidl::new_empty!(PortClass, D));
4802 fidl::decode!(PortClass, D, val_ref, decoder, inner_offset, inner_depth)?;
4803 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4804 {
4805 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4806 }
4807 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4808 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4809 }
4810 }
4811
4812 next_offset += envelope_size;
4813 _next_ordinal_to_read += 1;
4814 if next_offset >= end_offset {
4815 return Ok(());
4816 }
4817
4818 while _next_ordinal_to_read < 2 {
4820 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4821 _next_ordinal_to_read += 1;
4822 next_offset += envelope_size;
4823 }
4824
4825 let next_out_of_line = decoder.next_out_of_line();
4826 let handles_before = decoder.remaining_handles();
4827 if let Some((inlined, num_bytes, num_handles)) =
4828 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4829 {
4830 let member_inline_size = <fidl::encoding::Vector<FrameType, 4> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4831 if inlined != (member_inline_size <= 4) {
4832 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4833 }
4834 let inner_offset;
4835 let mut inner_depth = depth.clone();
4836 if inlined {
4837 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4838 inner_offset = next_offset;
4839 } else {
4840 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4841 inner_depth.increment()?;
4842 }
4843 let val_ref = self.rx_types.get_or_insert_with(
4844 || fidl::new_empty!(fidl::encoding::Vector<FrameType, 4>, D),
4845 );
4846 fidl::decode!(fidl::encoding::Vector<FrameType, 4>, D, val_ref, decoder, inner_offset, inner_depth)?;
4847 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4848 {
4849 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4850 }
4851 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4852 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4853 }
4854 }
4855
4856 next_offset += envelope_size;
4857 _next_ordinal_to_read += 1;
4858 if next_offset >= end_offset {
4859 return Ok(());
4860 }
4861
4862 while _next_ordinal_to_read < 3 {
4864 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4865 _next_ordinal_to_read += 1;
4866 next_offset += envelope_size;
4867 }
4868
4869 let next_out_of_line = decoder.next_out_of_line();
4870 let handles_before = decoder.remaining_handles();
4871 if let Some((inlined, num_bytes, num_handles)) =
4872 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4873 {
4874 let member_inline_size = <fidl::encoding::Vector<FrameTypeSupport, 4> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4875 if inlined != (member_inline_size <= 4) {
4876 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4877 }
4878 let inner_offset;
4879 let mut inner_depth = depth.clone();
4880 if inlined {
4881 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4882 inner_offset = next_offset;
4883 } else {
4884 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4885 inner_depth.increment()?;
4886 }
4887 let val_ref = self.tx_types.get_or_insert_with(
4888 || fidl::new_empty!(fidl::encoding::Vector<FrameTypeSupport, 4>, D),
4889 );
4890 fidl::decode!(fidl::encoding::Vector<FrameTypeSupport, 4>, D, val_ref, decoder, inner_offset, inner_depth)?;
4891 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4892 {
4893 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4894 }
4895 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4896 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4897 }
4898 }
4899
4900 next_offset += envelope_size;
4901
4902 while next_offset < end_offset {
4904 _next_ordinal_to_read += 1;
4905 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4906 next_offset += envelope_size;
4907 }
4908
4909 Ok(())
4910 }
4911 }
4912
4913 impl PortGetCountersResponse {
4914 #[inline(always)]
4915 fn max_ordinal_present(&self) -> u64 {
4916 if let Some(_) = self.tx_bytes {
4917 return 4;
4918 }
4919 if let Some(_) = self.tx_frames {
4920 return 3;
4921 }
4922 if let Some(_) = self.rx_bytes {
4923 return 2;
4924 }
4925 if let Some(_) = self.rx_frames {
4926 return 1;
4927 }
4928 0
4929 }
4930 }
4931
4932 impl fidl::encoding::ValueTypeMarker for PortGetCountersResponse {
4933 type Borrowed<'a> = &'a Self;
4934 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4935 value
4936 }
4937 }
4938
4939 unsafe impl fidl::encoding::TypeMarker for PortGetCountersResponse {
4940 type Owned = Self;
4941
4942 #[inline(always)]
4943 fn inline_align(_context: fidl::encoding::Context) -> usize {
4944 8
4945 }
4946
4947 #[inline(always)]
4948 fn inline_size(_context: fidl::encoding::Context) -> usize {
4949 16
4950 }
4951 }
4952
4953 unsafe impl<D: fidl::encoding::ResourceDialect>
4954 fidl::encoding::Encode<PortGetCountersResponse, D> for &PortGetCountersResponse
4955 {
4956 unsafe fn encode(
4957 self,
4958 encoder: &mut fidl::encoding::Encoder<'_, D>,
4959 offset: usize,
4960 mut depth: fidl::encoding::Depth,
4961 ) -> fidl::Result<()> {
4962 encoder.debug_check_bounds::<PortGetCountersResponse>(offset);
4963 let max_ordinal: u64 = self.max_ordinal_present();
4965 encoder.write_num(max_ordinal, offset);
4966 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4967 if max_ordinal == 0 {
4969 return Ok(());
4970 }
4971 depth.increment()?;
4972 let envelope_size = 8;
4973 let bytes_len = max_ordinal as usize * envelope_size;
4974 #[allow(unused_variables)]
4975 let offset = encoder.out_of_line_offset(bytes_len);
4976 let mut _prev_end_offset: usize = 0;
4977 if 1 > max_ordinal {
4978 return Ok(());
4979 }
4980
4981 let cur_offset: usize = (1 - 1) * envelope_size;
4984
4985 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4987
4988 fidl::encoding::encode_in_envelope_optional::<u64, D>(
4993 self.rx_frames.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4994 encoder,
4995 offset + cur_offset,
4996 depth,
4997 )?;
4998
4999 _prev_end_offset = cur_offset + envelope_size;
5000 if 2 > max_ordinal {
5001 return Ok(());
5002 }
5003
5004 let cur_offset: usize = (2 - 1) * envelope_size;
5007
5008 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5010
5011 fidl::encoding::encode_in_envelope_optional::<u64, D>(
5016 self.rx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5017 encoder,
5018 offset + cur_offset,
5019 depth,
5020 )?;
5021
5022 _prev_end_offset = cur_offset + envelope_size;
5023 if 3 > max_ordinal {
5024 return Ok(());
5025 }
5026
5027 let cur_offset: usize = (3 - 1) * envelope_size;
5030
5031 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5033
5034 fidl::encoding::encode_in_envelope_optional::<u64, D>(
5039 self.tx_frames.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5040 encoder,
5041 offset + cur_offset,
5042 depth,
5043 )?;
5044
5045 _prev_end_offset = cur_offset + envelope_size;
5046 if 4 > max_ordinal {
5047 return Ok(());
5048 }
5049
5050 let cur_offset: usize = (4 - 1) * envelope_size;
5053
5054 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5056
5057 fidl::encoding::encode_in_envelope_optional::<u64, D>(
5062 self.tx_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5063 encoder,
5064 offset + cur_offset,
5065 depth,
5066 )?;
5067
5068 _prev_end_offset = cur_offset + envelope_size;
5069
5070 Ok(())
5071 }
5072 }
5073
5074 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5075 for PortGetCountersResponse
5076 {
5077 #[inline(always)]
5078 fn new_empty() -> Self {
5079 Self::default()
5080 }
5081
5082 unsafe fn decode(
5083 &mut self,
5084 decoder: &mut fidl::encoding::Decoder<'_, D>,
5085 offset: usize,
5086 mut depth: fidl::encoding::Depth,
5087 ) -> fidl::Result<()> {
5088 decoder.debug_check_bounds::<Self>(offset);
5089 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5090 None => return Err(fidl::Error::NotNullable),
5091 Some(len) => len,
5092 };
5093 if len == 0 {
5095 return Ok(());
5096 };
5097 depth.increment()?;
5098 let envelope_size = 8;
5099 let bytes_len = len * envelope_size;
5100 let offset = decoder.out_of_line_offset(bytes_len)?;
5101 let mut _next_ordinal_to_read = 0;
5103 let mut next_offset = offset;
5104 let end_offset = offset + bytes_len;
5105 _next_ordinal_to_read += 1;
5106 if next_offset >= end_offset {
5107 return Ok(());
5108 }
5109
5110 while _next_ordinal_to_read < 1 {
5112 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5113 _next_ordinal_to_read += 1;
5114 next_offset += envelope_size;
5115 }
5116
5117 let next_out_of_line = decoder.next_out_of_line();
5118 let handles_before = decoder.remaining_handles();
5119 if let Some((inlined, num_bytes, num_handles)) =
5120 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5121 {
5122 let member_inline_size =
5123 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5124 if inlined != (member_inline_size <= 4) {
5125 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5126 }
5127 let inner_offset;
5128 let mut inner_depth = depth.clone();
5129 if inlined {
5130 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5131 inner_offset = next_offset;
5132 } else {
5133 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5134 inner_depth.increment()?;
5135 }
5136 let val_ref = self.rx_frames.get_or_insert_with(|| fidl::new_empty!(u64, D));
5137 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5138 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5139 {
5140 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5141 }
5142 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5143 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5144 }
5145 }
5146
5147 next_offset += envelope_size;
5148 _next_ordinal_to_read += 1;
5149 if next_offset >= end_offset {
5150 return Ok(());
5151 }
5152
5153 while _next_ordinal_to_read < 2 {
5155 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5156 _next_ordinal_to_read += 1;
5157 next_offset += envelope_size;
5158 }
5159
5160 let next_out_of_line = decoder.next_out_of_line();
5161 let handles_before = decoder.remaining_handles();
5162 if let Some((inlined, num_bytes, num_handles)) =
5163 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5164 {
5165 let member_inline_size =
5166 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5167 if inlined != (member_inline_size <= 4) {
5168 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5169 }
5170 let inner_offset;
5171 let mut inner_depth = depth.clone();
5172 if inlined {
5173 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5174 inner_offset = next_offset;
5175 } else {
5176 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5177 inner_depth.increment()?;
5178 }
5179 let val_ref = self.rx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
5180 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5181 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5182 {
5183 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5184 }
5185 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5186 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5187 }
5188 }
5189
5190 next_offset += envelope_size;
5191 _next_ordinal_to_read += 1;
5192 if next_offset >= end_offset {
5193 return Ok(());
5194 }
5195
5196 while _next_ordinal_to_read < 3 {
5198 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5199 _next_ordinal_to_read += 1;
5200 next_offset += envelope_size;
5201 }
5202
5203 let next_out_of_line = decoder.next_out_of_line();
5204 let handles_before = decoder.remaining_handles();
5205 if let Some((inlined, num_bytes, num_handles)) =
5206 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5207 {
5208 let member_inline_size =
5209 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5210 if inlined != (member_inline_size <= 4) {
5211 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5212 }
5213 let inner_offset;
5214 let mut inner_depth = depth.clone();
5215 if inlined {
5216 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5217 inner_offset = next_offset;
5218 } else {
5219 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5220 inner_depth.increment()?;
5221 }
5222 let val_ref = self.tx_frames.get_or_insert_with(|| fidl::new_empty!(u64, D));
5223 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5224 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5225 {
5226 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5227 }
5228 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5229 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5230 }
5231 }
5232
5233 next_offset += envelope_size;
5234 _next_ordinal_to_read += 1;
5235 if next_offset >= end_offset {
5236 return Ok(());
5237 }
5238
5239 while _next_ordinal_to_read < 4 {
5241 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5242 _next_ordinal_to_read += 1;
5243 next_offset += envelope_size;
5244 }
5245
5246 let next_out_of_line = decoder.next_out_of_line();
5247 let handles_before = decoder.remaining_handles();
5248 if let Some((inlined, num_bytes, num_handles)) =
5249 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5250 {
5251 let member_inline_size =
5252 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5253 if inlined != (member_inline_size <= 4) {
5254 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5255 }
5256 let inner_offset;
5257 let mut inner_depth = depth.clone();
5258 if inlined {
5259 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5260 inner_offset = next_offset;
5261 } else {
5262 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5263 inner_depth.increment()?;
5264 }
5265 let val_ref = self.tx_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
5266 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5267 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5268 {
5269 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5270 }
5271 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5272 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5273 }
5274 }
5275
5276 next_offset += envelope_size;
5277
5278 while next_offset < end_offset {
5280 _next_ordinal_to_read += 1;
5281 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5282 next_offset += envelope_size;
5283 }
5284
5285 Ok(())
5286 }
5287 }
5288
5289 impl PortInfo {
5290 #[inline(always)]
5291 fn max_ordinal_present(&self) -> u64 {
5292 if let Some(_) = self.base_info {
5293 return 2;
5294 }
5295 if let Some(_) = self.id {
5296 return 1;
5297 }
5298 0
5299 }
5300 }
5301
5302 impl fidl::encoding::ValueTypeMarker for PortInfo {
5303 type Borrowed<'a> = &'a Self;
5304 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5305 value
5306 }
5307 }
5308
5309 unsafe impl fidl::encoding::TypeMarker for PortInfo {
5310 type Owned = Self;
5311
5312 #[inline(always)]
5313 fn inline_align(_context: fidl::encoding::Context) -> usize {
5314 8
5315 }
5316
5317 #[inline(always)]
5318 fn inline_size(_context: fidl::encoding::Context) -> usize {
5319 16
5320 }
5321 }
5322
5323 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortInfo, D> for &PortInfo {
5324 unsafe fn encode(
5325 self,
5326 encoder: &mut fidl::encoding::Encoder<'_, D>,
5327 offset: usize,
5328 mut depth: fidl::encoding::Depth,
5329 ) -> fidl::Result<()> {
5330 encoder.debug_check_bounds::<PortInfo>(offset);
5331 let max_ordinal: u64 = self.max_ordinal_present();
5333 encoder.write_num(max_ordinal, offset);
5334 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5335 if max_ordinal == 0 {
5337 return Ok(());
5338 }
5339 depth.increment()?;
5340 let envelope_size = 8;
5341 let bytes_len = max_ordinal as usize * envelope_size;
5342 #[allow(unused_variables)]
5343 let offset = encoder.out_of_line_offset(bytes_len);
5344 let mut _prev_end_offset: usize = 0;
5345 if 1 > max_ordinal {
5346 return Ok(());
5347 }
5348
5349 let cur_offset: usize = (1 - 1) * envelope_size;
5352
5353 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5355
5356 fidl::encoding::encode_in_envelope_optional::<PortId, D>(
5361 self.id.as_ref().map(<PortId as fidl::encoding::ValueTypeMarker>::borrow),
5362 encoder,
5363 offset + cur_offset,
5364 depth,
5365 )?;
5366
5367 _prev_end_offset = cur_offset + envelope_size;
5368 if 2 > max_ordinal {
5369 return Ok(());
5370 }
5371
5372 let cur_offset: usize = (2 - 1) * envelope_size;
5375
5376 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5378
5379 fidl::encoding::encode_in_envelope_optional::<PortBaseInfo, D>(
5384 self.base_info
5385 .as_ref()
5386 .map(<PortBaseInfo as fidl::encoding::ValueTypeMarker>::borrow),
5387 encoder,
5388 offset + cur_offset,
5389 depth,
5390 )?;
5391
5392 _prev_end_offset = cur_offset + envelope_size;
5393
5394 Ok(())
5395 }
5396 }
5397
5398 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortInfo {
5399 #[inline(always)]
5400 fn new_empty() -> Self {
5401 Self::default()
5402 }
5403
5404 unsafe fn decode(
5405 &mut self,
5406 decoder: &mut fidl::encoding::Decoder<'_, D>,
5407 offset: usize,
5408 mut depth: fidl::encoding::Depth,
5409 ) -> fidl::Result<()> {
5410 decoder.debug_check_bounds::<Self>(offset);
5411 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5412 None => return Err(fidl::Error::NotNullable),
5413 Some(len) => len,
5414 };
5415 if len == 0 {
5417 return Ok(());
5418 };
5419 depth.increment()?;
5420 let envelope_size = 8;
5421 let bytes_len = len * envelope_size;
5422 let offset = decoder.out_of_line_offset(bytes_len)?;
5423 let mut _next_ordinal_to_read = 0;
5425 let mut next_offset = offset;
5426 let end_offset = offset + bytes_len;
5427 _next_ordinal_to_read += 1;
5428 if next_offset >= end_offset {
5429 return Ok(());
5430 }
5431
5432 while _next_ordinal_to_read < 1 {
5434 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5435 _next_ordinal_to_read += 1;
5436 next_offset += envelope_size;
5437 }
5438
5439 let next_out_of_line = decoder.next_out_of_line();
5440 let handles_before = decoder.remaining_handles();
5441 if let Some((inlined, num_bytes, num_handles)) =
5442 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5443 {
5444 let member_inline_size =
5445 <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5446 if inlined != (member_inline_size <= 4) {
5447 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5448 }
5449 let inner_offset;
5450 let mut inner_depth = depth.clone();
5451 if inlined {
5452 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5453 inner_offset = next_offset;
5454 } else {
5455 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5456 inner_depth.increment()?;
5457 }
5458 let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(PortId, D));
5459 fidl::decode!(PortId, D, val_ref, decoder, inner_offset, inner_depth)?;
5460 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5461 {
5462 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5463 }
5464 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5465 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5466 }
5467 }
5468
5469 next_offset += envelope_size;
5470 _next_ordinal_to_read += 1;
5471 if next_offset >= end_offset {
5472 return Ok(());
5473 }
5474
5475 while _next_ordinal_to_read < 2 {
5477 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5478 _next_ordinal_to_read += 1;
5479 next_offset += envelope_size;
5480 }
5481
5482 let next_out_of_line = decoder.next_out_of_line();
5483 let handles_before = decoder.remaining_handles();
5484 if let Some((inlined, num_bytes, num_handles)) =
5485 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5486 {
5487 let member_inline_size =
5488 <PortBaseInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5489 if inlined != (member_inline_size <= 4) {
5490 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5491 }
5492 let inner_offset;
5493 let mut inner_depth = depth.clone();
5494 if inlined {
5495 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5496 inner_offset = next_offset;
5497 } else {
5498 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5499 inner_depth.increment()?;
5500 }
5501 let val_ref =
5502 self.base_info.get_or_insert_with(|| fidl::new_empty!(PortBaseInfo, D));
5503 fidl::decode!(PortBaseInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5504 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5505 {
5506 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5507 }
5508 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5509 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5510 }
5511 }
5512
5513 next_offset += envelope_size;
5514
5515 while next_offset < end_offset {
5517 _next_ordinal_to_read += 1;
5518 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5519 next_offset += envelope_size;
5520 }
5521
5522 Ok(())
5523 }
5524 }
5525
5526 impl PortStatus {
5527 #[inline(always)]
5528 fn max_ordinal_present(&self) -> u64 {
5529 if let Some(_) = self.mtu {
5530 return 2;
5531 }
5532 if let Some(_) = self.flags {
5533 return 1;
5534 }
5535 0
5536 }
5537 }
5538
5539 impl fidl::encoding::ValueTypeMarker for PortStatus {
5540 type Borrowed<'a> = &'a Self;
5541 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5542 value
5543 }
5544 }
5545
5546 unsafe impl fidl::encoding::TypeMarker for PortStatus {
5547 type Owned = Self;
5548
5549 #[inline(always)]
5550 fn inline_align(_context: fidl::encoding::Context) -> usize {
5551 8
5552 }
5553
5554 #[inline(always)]
5555 fn inline_size(_context: fidl::encoding::Context) -> usize {
5556 16
5557 }
5558 }
5559
5560 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortStatus, D>
5561 for &PortStatus
5562 {
5563 unsafe fn encode(
5564 self,
5565 encoder: &mut fidl::encoding::Encoder<'_, D>,
5566 offset: usize,
5567 mut depth: fidl::encoding::Depth,
5568 ) -> fidl::Result<()> {
5569 encoder.debug_check_bounds::<PortStatus>(offset);
5570 let max_ordinal: u64 = self.max_ordinal_present();
5572 encoder.write_num(max_ordinal, offset);
5573 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5574 if max_ordinal == 0 {
5576 return Ok(());
5577 }
5578 depth.increment()?;
5579 let envelope_size = 8;
5580 let bytes_len = max_ordinal as usize * envelope_size;
5581 #[allow(unused_variables)]
5582 let offset = encoder.out_of_line_offset(bytes_len);
5583 let mut _prev_end_offset: usize = 0;
5584 if 1 > max_ordinal {
5585 return Ok(());
5586 }
5587
5588 let cur_offset: usize = (1 - 1) * envelope_size;
5591
5592 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5594
5595 fidl::encoding::encode_in_envelope_optional::<StatusFlags, D>(
5600 self.flags.as_ref().map(<StatusFlags as fidl::encoding::ValueTypeMarker>::borrow),
5601 encoder,
5602 offset + cur_offset,
5603 depth,
5604 )?;
5605
5606 _prev_end_offset = cur_offset + envelope_size;
5607 if 2 > max_ordinal {
5608 return Ok(());
5609 }
5610
5611 let cur_offset: usize = (2 - 1) * envelope_size;
5614
5615 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5617
5618 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5623 self.mtu.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5624 encoder,
5625 offset + cur_offset,
5626 depth,
5627 )?;
5628
5629 _prev_end_offset = cur_offset + envelope_size;
5630
5631 Ok(())
5632 }
5633 }
5634
5635 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortStatus {
5636 #[inline(always)]
5637 fn new_empty() -> Self {
5638 Self::default()
5639 }
5640
5641 unsafe fn decode(
5642 &mut self,
5643 decoder: &mut fidl::encoding::Decoder<'_, D>,
5644 offset: usize,
5645 mut depth: fidl::encoding::Depth,
5646 ) -> fidl::Result<()> {
5647 decoder.debug_check_bounds::<Self>(offset);
5648 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5649 None => return Err(fidl::Error::NotNullable),
5650 Some(len) => len,
5651 };
5652 if len == 0 {
5654 return Ok(());
5655 };
5656 depth.increment()?;
5657 let envelope_size = 8;
5658 let bytes_len = len * envelope_size;
5659 let offset = decoder.out_of_line_offset(bytes_len)?;
5660 let mut _next_ordinal_to_read = 0;
5662 let mut next_offset = offset;
5663 let end_offset = offset + bytes_len;
5664 _next_ordinal_to_read += 1;
5665 if next_offset >= end_offset {
5666 return Ok(());
5667 }
5668
5669 while _next_ordinal_to_read < 1 {
5671 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5672 _next_ordinal_to_read += 1;
5673 next_offset += envelope_size;
5674 }
5675
5676 let next_out_of_line = decoder.next_out_of_line();
5677 let handles_before = decoder.remaining_handles();
5678 if let Some((inlined, num_bytes, num_handles)) =
5679 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5680 {
5681 let member_inline_size =
5682 <StatusFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5683 if inlined != (member_inline_size <= 4) {
5684 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5685 }
5686 let inner_offset;
5687 let mut inner_depth = depth.clone();
5688 if inlined {
5689 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5690 inner_offset = next_offset;
5691 } else {
5692 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5693 inner_depth.increment()?;
5694 }
5695 let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(StatusFlags, D));
5696 fidl::decode!(StatusFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
5697 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5698 {
5699 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5700 }
5701 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5702 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5703 }
5704 }
5705
5706 next_offset += envelope_size;
5707 _next_ordinal_to_read += 1;
5708 if next_offset >= end_offset {
5709 return Ok(());
5710 }
5711
5712 while _next_ordinal_to_read < 2 {
5714 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5715 _next_ordinal_to_read += 1;
5716 next_offset += envelope_size;
5717 }
5718
5719 let next_out_of_line = decoder.next_out_of_line();
5720 let handles_before = decoder.remaining_handles();
5721 if let Some((inlined, num_bytes, num_handles)) =
5722 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5723 {
5724 let member_inline_size =
5725 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5726 if inlined != (member_inline_size <= 4) {
5727 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5728 }
5729 let inner_offset;
5730 let mut inner_depth = depth.clone();
5731 if inlined {
5732 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5733 inner_offset = next_offset;
5734 } else {
5735 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5736 inner_depth.increment()?;
5737 }
5738 let val_ref = self.mtu.get_or_insert_with(|| fidl::new_empty!(u32, D));
5739 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5740 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5741 {
5742 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5743 }
5744 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5745 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5746 }
5747 }
5748
5749 next_offset += envelope_size;
5750
5751 while next_offset < end_offset {
5753 _next_ordinal_to_read += 1;
5754 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5755 next_offset += envelope_size;
5756 }
5757
5758 Ok(())
5759 }
5760 }
5761
5762 impl fidl::encoding::ValueTypeMarker for DevicePortEvent {
5763 type Borrowed<'a> = &'a Self;
5764 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5765 value
5766 }
5767 }
5768
5769 unsafe impl fidl::encoding::TypeMarker for DevicePortEvent {
5770 type Owned = Self;
5771
5772 #[inline(always)]
5773 fn inline_align(_context: fidl::encoding::Context) -> usize {
5774 8
5775 }
5776
5777 #[inline(always)]
5778 fn inline_size(_context: fidl::encoding::Context) -> usize {
5779 16
5780 }
5781 }
5782
5783 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DevicePortEvent, D>
5784 for &DevicePortEvent
5785 {
5786 #[inline]
5787 unsafe fn encode(
5788 self,
5789 encoder: &mut fidl::encoding::Encoder<'_, D>,
5790 offset: usize,
5791 _depth: fidl::encoding::Depth,
5792 ) -> fidl::Result<()> {
5793 encoder.debug_check_bounds::<DevicePortEvent>(offset);
5794 encoder.write_num::<u64>(self.ordinal(), offset);
5795 match self {
5796 DevicePortEvent::Existing(ref val) => {
5797 fidl::encoding::encode_in_envelope::<PortId, D>(
5798 <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5799 encoder,
5800 offset + 8,
5801 _depth,
5802 )
5803 }
5804 DevicePortEvent::Added(ref val) => fidl::encoding::encode_in_envelope::<PortId, D>(
5805 <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5806 encoder,
5807 offset + 8,
5808 _depth,
5809 ),
5810 DevicePortEvent::Removed(ref val) => {
5811 fidl::encoding::encode_in_envelope::<PortId, D>(
5812 <PortId as fidl::encoding::ValueTypeMarker>::borrow(val),
5813 encoder,
5814 offset + 8,
5815 _depth,
5816 )
5817 }
5818 DevicePortEvent::Idle(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
5819 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
5820 encoder,
5821 offset + 8,
5822 _depth,
5823 ),
5824 }
5825 }
5826 }
5827
5828 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DevicePortEvent {
5829 #[inline(always)]
5830 fn new_empty() -> Self {
5831 Self::Existing(fidl::new_empty!(PortId, D))
5832 }
5833
5834 #[inline]
5835 unsafe fn decode(
5836 &mut self,
5837 decoder: &mut fidl::encoding::Decoder<'_, D>,
5838 offset: usize,
5839 mut depth: fidl::encoding::Depth,
5840 ) -> fidl::Result<()> {
5841 decoder.debug_check_bounds::<Self>(offset);
5842 #[allow(unused_variables)]
5843 let next_out_of_line = decoder.next_out_of_line();
5844 let handles_before = decoder.remaining_handles();
5845 let (ordinal, inlined, num_bytes, num_handles) =
5846 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5847
5848 let member_inline_size = match ordinal {
5849 1 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5850 2 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5851 3 => <PortId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5852 4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5853 _ => return Err(fidl::Error::UnknownUnionTag),
5854 };
5855
5856 if inlined != (member_inline_size <= 4) {
5857 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5858 }
5859 let _inner_offset;
5860 if inlined {
5861 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5862 _inner_offset = offset + 8;
5863 } else {
5864 depth.increment()?;
5865 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5866 }
5867 match ordinal {
5868 1 => {
5869 #[allow(irrefutable_let_patterns)]
5870 if let DevicePortEvent::Existing(_) = self {
5871 } else {
5873 *self = DevicePortEvent::Existing(fidl::new_empty!(PortId, D));
5875 }
5876 #[allow(irrefutable_let_patterns)]
5877 if let DevicePortEvent::Existing(ref mut val) = self {
5878 fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5879 } else {
5880 unreachable!()
5881 }
5882 }
5883 2 => {
5884 #[allow(irrefutable_let_patterns)]
5885 if let DevicePortEvent::Added(_) = self {
5886 } else {
5888 *self = DevicePortEvent::Added(fidl::new_empty!(PortId, D));
5890 }
5891 #[allow(irrefutable_let_patterns)]
5892 if let DevicePortEvent::Added(ref mut val) = self {
5893 fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5894 } else {
5895 unreachable!()
5896 }
5897 }
5898 3 => {
5899 #[allow(irrefutable_let_patterns)]
5900 if let DevicePortEvent::Removed(_) = self {
5901 } else {
5903 *self = DevicePortEvent::Removed(fidl::new_empty!(PortId, D));
5905 }
5906 #[allow(irrefutable_let_patterns)]
5907 if let DevicePortEvent::Removed(ref mut val) = self {
5908 fidl::decode!(PortId, D, val, decoder, _inner_offset, depth)?;
5909 } else {
5910 unreachable!()
5911 }
5912 }
5913 4 => {
5914 #[allow(irrefutable_let_patterns)]
5915 if let DevicePortEvent::Idle(_) = self {
5916 } else {
5918 *self = DevicePortEvent::Idle(fidl::new_empty!(Empty, D));
5920 }
5921 #[allow(irrefutable_let_patterns)]
5922 if let DevicePortEvent::Idle(ref mut val) = self {
5923 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
5924 } else {
5925 unreachable!()
5926 }
5927 }
5928 ordinal => panic!("unexpected ordinal {:?}", ordinal),
5929 }
5930 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5931 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5932 }
5933 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5934 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5935 }
5936 Ok(())
5937 }
5938 }
5939}