Skip to content

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

Open

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.

Activity

  1. cathay4t commented on Jun 18, 2025

    @cathay4t
    Member

    If that is optional feature, I am OK with it.

  2. ssrlive commented on Jun 19, 2025

    @ssrlive
    Author

    Please review this PR and publish a new version. Otherwise, subsequent work cannot be carried out.

  3. cathay4t commented on Oct 28, 2025

    @cathay4t
    Member

    That PR is opened for old repo and only implement serde for DefaultNla.

    Meanwhile, I am wondering what's the use case need serialization/deserialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions