Closed benmaddison closed 2 years ago
Hi @benmaddison , I'm not quite following what it is you're doing and so not sure if this library is the right place for it, can you elaborate a bit more / give an example?
@benmaddison don't know if you ever did go ahead and experiment with this, gonna go ahead and close it but raise it again if you like.
I frequently find myself writing code that should be generic over IP address families, but I'm prevented by the lack of a way to express the bound "has a
prefix_len(&self) -> u8
method", for example.It should be straight-forward (I say without actually having read the code :-)) to create a trait that provides the functions which currently exist on
Ipv4Net
andIpv6Net
, and which have a shared signature, and move the existing implementations of those to trait implementations.@krisprice please let me know if you're open to the principal, and I'll take a stab at a PR.