This feature will be very useful for users who have serialization/deserialization needs.
Adding the serde feature is very easy:
- Add it to the
Cargo.toml file
[features]
serde = ["dep:serde", "netlink-packet-route/serde"]
# ...
[dependencies]
serde = { version = "1.0", optional = true, features = ["derive"] }
# ...
- Add it before the structure that needs to be serialized/deserialized
/// Internet Protocol (IP) version.
#[derive(Debug, Clone, Eq, PartialEq, PartialOrd)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum IpVersion {
/// IPv4
V4,
/// IPv6
V6,
}
Basically achieved the goal.