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