Skip to content

Commit 75c0318

Browse files
committed
link: Remove [repr(u32)] for LinkFlag
Signed-off-by: Gris Ge <[email protected]>
1 parent 23c724c commit 75c0318

File tree

1 file changed

+38
-39
lines changed

1 file changed

+38
-39
lines changed

src/link/link_flag.rs

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,52 +27,51 @@ pub(crate) struct VecLinkFlag(pub Vec<LinkFlag>);
2727

2828
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
2929
#[non_exhaustive]
30-
#[repr(u32)]
3130
pub enum LinkFlag {
32-
Up = IFF_UP,
33-
Broadcast = IFF_BROADCAST,
34-
Debug = IFF_DEBUG,
35-
Loopback = IFF_LOOPBACK,
36-
Pointopoint = IFF_POINTOPOINT,
37-
Notrailers = IFF_NOTRAILERS,
38-
Running = IFF_RUNNING,
39-
Noarp = IFF_NOARP,
40-
Promisc = IFF_PROMISC,
41-
Allmulti = IFF_ALLMULTI,
42-
Controller = IFF_CONTROLLER,
43-
Port = IFF_PORT,
44-
Multicast = IFF_MULTICAST,
45-
Portsel = IFF_PORTSEL,
46-
Automedia = IFF_AUTOMEDIA,
47-
Dynamic = IFF_DYNAMIC,
48-
LowerUp = IFF_LOWER_UP,
49-
Dormant = IFF_DORMANT,
50-
Echo = IFF_ECHO,
31+
Up,
32+
Broadcast,
33+
Debug,
34+
Loopback,
35+
Pointopoint,
36+
Notrailers,
37+
Running,
38+
Noarp,
39+
Promisc,
40+
Allmulti,
41+
Controller,
42+
Port,
43+
Multicast,
44+
Portsel,
45+
Automedia,
46+
Dynamic,
47+
LowerUp,
48+
Dormant,
49+
Echo,
5150
Other(u32),
5251
}
5352

5453
impl From<u32> for LinkFlag {
5554
fn from(d: u32) -> Self {
5655
match d {
57-
d if (d & IFF_UP) > 0 => Self::Up,
58-
d if (d & IFF_BROADCAST) > 0 => Self::Broadcast,
59-
d if (d & IFF_DEBUG) > 0 => Self::Debug,
60-
d if (d & IFF_LOOPBACK) > 0 => Self::Loopback,
61-
d if (d & IFF_POINTOPOINT) > 0 => Self::Pointopoint,
62-
d if (d & IFF_NOTRAILERS) > 0 => Self::Notrailers,
63-
d if (d & IFF_RUNNING) > 0 => Self::Running,
64-
d if (d & IFF_NOARP) > 0 => Self::Noarp,
65-
d if (d & IFF_PROMISC) > 0 => Self::Promisc,
66-
d if (d & IFF_ALLMULTI) > 0 => Self::Allmulti,
67-
d if (d & IFF_CONTROLLER) > 0 => Self::Controller,
68-
d if (d & IFF_PORT) > 0 => Self::Port,
69-
d if (d & IFF_MULTICAST) > 0 => Self::Multicast,
70-
d if (d & IFF_PORTSEL) > 0 => Self::Portsel,
71-
d if (d & IFF_AUTOMEDIA) > 0 => Self::Automedia,
72-
d if (d & IFF_DYNAMIC) > 0 => Self::Dynamic,
73-
d if (d & IFF_LOWER_UP) > 0 => Self::LowerUp,
74-
d if (d & IFF_DORMANT) > 0 => Self::Dormant,
75-
d if (d & IFF_ECHO) > 0 => Self::Echo,
56+
IFF_UP => Self::Up,
57+
IFF_BROADCAST => Self::Broadcast,
58+
IFF_DEBUG => Self::Debug,
59+
IFF_LOOPBACK => Self::Loopback,
60+
IFF_POINTOPOINT => Self::Pointopoint,
61+
IFF_NOTRAILERS => Self::Notrailers,
62+
IFF_RUNNING => Self::Running,
63+
IFF_NOARP => Self::Noarp,
64+
IFF_PROMISC => Self::Promisc,
65+
IFF_ALLMULTI => Self::Allmulti,
66+
IFF_CONTROLLER => Self::Controller,
67+
IFF_PORT => Self::Port,
68+
IFF_MULTICAST => Self::Multicast,
69+
IFF_PORTSEL => Self::Portsel,
70+
IFF_AUTOMEDIA => Self::Automedia,
71+
IFF_DYNAMIC => Self::Dynamic,
72+
IFF_LOWER_UP => Self::LowerUp,
73+
IFF_DORMANT => Self::Dormant,
74+
IFF_ECHO => Self::Echo,
7675
_ => Self::Other(d),
7776
}
7877
}

0 commit comments

Comments
 (0)