tiborschneider / prefix-trie

Apache License 2.0
20 stars 4 forks source link

Add support for the ipnetwork prefix types #3

Closed rwestphal closed 6 months ago

rwestphal commented 6 months ago

In the Rust ecosystem, both the "ipnet" and "ipnetwork" crates are widely used for representing IP prefixes. This crate, however, implements the Prefix trait only for the "ipnet" prefix types.

In this commit, we introduce an optional feature that enables the implementation of the Prefix trait for the Ipv4Network and Ipv6Network types of the "ipnetwork" crate, making this crate more accessible to a wider audience.

tiborschneider commented 6 months ago

I totally agree that it should support ipnetwork types. However, I think that we should also make ipnet an optional dependency (and keep it as a default feature to not break existing code). I will (hopefully) look at it beginning next week. In the mean time, I will merge this, but I will not have time yet to update the thing on crates.io. Thank you for the contribution!

rwestphal commented 6 months ago

@tiborschneider That sounds great! I thought about doing that, but a lot of unit tests and benchmarks use the Ipv4Net type, so I didn't know how that could work. Thank you for writing this crate!

tiborschneider commented 6 months ago

I just published v0.3.0, where both ipnetwork and ipnet are optional dependencies, but ipnet is enabled by default.