Skip to content

How about adding the serde feature to this Crate? #111

@ssrlive

Description

@ssrlive

This feature will be very useful for users who have serialization/deserialization needs.

Adding the serde feature is very easy:

  1. Add it to the Cargo.toml file
[features]
serde = ["dep:serde", "netlink-packet-route/serde"]
# ...

[dependencies]
serde = { version = "1.0", optional = true, features = ["derive"] }
# ...
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions