-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider removing From<IpXXAddr> for IpXXNetwork #190
Comments
Hi 👋 sounds like you want a conversion from Ipv6Addr to Ipv6Network to error out, but that does not happen due to this impl https://github.com/achanda/ipnetwork/blob/master/src/ipv6.rs#L315 so you want to remove those impls. Is that correct? What would the type signature of the single constructor be? |
Thanks for the quick response! Yes, I'm suggesting removing those impls. It'll be a breaking change, but I think one that's good from an API misuse perspective. How about just an |
I agree with this suggestion. A A dedicated constructor is more explicit and harder to accidentally misuse.
I don't agree. They are vague in the same sense IMHO. Converting a network into a single IP can probably be misunderstood what it does. And there is an |
Hi there, thanks for maintaining this crate!
At our workplace we ran into an issue where we were accidentally converting an Ipv6Addr to an Ipv6Network. The conversion seems a bit risky because an address and a network represent different things.
In contrast,
From<Ipv4Network> for IpNetwork
andFrom<Ipv6Network> for IpNetwork
are reasonable to have.Would you consider removing these impls and maybe introducing
single
constructors to represent the single IP use case? That would have made this bug much easier to spot.Thanks!
The text was updated successfully, but these errors were encountered: