danlehmann / arbitrary-int

A modern and lightweight implementation of arbitrary integers for Rust
MIT License
31 stars 12 forks source link

Range iterators? #29

Closed pickx closed 1 year ago

pickx commented 1 year ago

Currently it is not possible to do something like

for n in u5::MIN..u5::MAX {
    //...
}

Implementing this would be possible if/when step_trait is stable.

Alternatively it is possible to create a new range-like type which implements IntoIterator, produced by something like u5::range(u5::MIN, u5::MAX). The downside of course is that this function would become unnecessary if step_trait is stabilized.

danlehmann commented 1 year ago

Hey, thanks for filing the feature request. I am happy to add an optional feature to support step_trait. I actually have that need from time to time as well.

I'm planning to get this in within a few days.

pickx commented 1 year ago

Hey, thanks for filing the feature request. I am happy to add an optional feature to support step_trait. I actually have that need from time to time as well.

I'm planning to get this in within a few days.

if that is okay with you - I have implemented this already, so perhaps I can open a PR and see whatever additional changes it would require.

danlehmann commented 1 year ago

Oh awesome! Sure, please send over a PR

danlehmann commented 1 year ago

Merged it. Do you want this published on crates.io right away or is it enough to roll this into whatever is the next version?

pickx commented 1 year ago

thanks for merging. I don't need this right now, so feel free to publish this whenever you want.

danlehmann commented 1 year ago

Sounds good. Thanks again for your contribution!