num-iter icon indicating copy to clipboard operation
num-iter copied to clipboard

`ToPrimitive` bound on `Iterator` impl for `Range` and related traits.

Open alercah opened this issue 6 years ago • 2 comments

See this line which references rust-lang/rust#10414, now closed. The modern Range trait in the stdlib uses an unstable Step trait to generate its size_hint; perhaps something similar would work for this crate?

alercah avatar Dec 03 '19 18:12 alercah

Well, core can get away with that because they only support iterating Range with the primitive integer types, which can privately implement Step. For num-iter, we would need a public (stable) trait that external users can implement to make this Range work for their types.

cuviper avatar Dec 03 '19 19:12 cuviper

Yes, agreed, it would need to be stable. But that seems more flexible than requiring ToPrimitive.

alercah avatar Dec 03 '19 19:12 alercah