krisprice / ipnet

IpNet, Ipv4Net, and Ipv6Net types and methods for Rust
Apache License 2.0
119 stars 25 forks source link

IpAddrRange never ends when start and end are both 0 #11

Closed TyPR124 closed 4 years ago

TyPR124 commented 4 years ago

I noticed this while looking at implementing some of the extra Iterator traits and methods for efficiency. This blocks several possible efficiencies with IpAddrRange and related types.

An easy fix would be to replace start with 1 in the event that start and end are equal (end is already replaced with 0 here)

If this is acceptable, I can open a PR for this, and will likely follow up with some iterator efficiencies.

krisprice commented 4 years ago

Thanks for spotting this. Absolutely, please create a PR for this fix, and if you don't mind adding a test for it as well that would be appreciated. :) Happy to have you improve on iterator efficiencies also.