Proposal
Problem statement
core::iter::StepBy doesn't implement core::iter::FusedIterator.
Motivating examples or use cases
StepBy should be fused whenever the underlying iterator is fused. This causes problems, because range-set-blaze has a trait SortedStarts, which can only be implemented on types which also implement FusedItarator... This prevents us from Implementing SortedStarts for StepBy (which would always be valid, if the inner Iterator implements SortedStarts).
Solution sketch
impl<I: FusedIterator> FusedIterator for StepBy<I> {}
This is correct, as https://github.com/rust-lang/rust/blob/main/library/core/src/iter/adapters/step_by.rs on line 226 calls self.iter.nth(step_size) which is oke to be called after receiving None, if the inner iterator is Fused.
Alternatives
I don't consider it a alternative to always implement FusedIterator on StepBy without a FusedItarator trait bound, as it wouldn't be zero cost to implement this.
Links and related work
internals.rust-lang.org discussion
Proposal
Problem statement
core::iter::StepBydoesn't implementcore::iter::FusedIterator.Motivating examples or use cases
StepBy should be fused whenever the underlying iterator is fused. This causes problems, because range-set-blaze has a trait
SortedStarts, which can only be implemented on types which also implementFusedItarator... This prevents us from ImplementingSortedStartsfor StepBy (which would always be valid, if the inner Iterator implementsSortedStarts).Solution sketch
This is correct, as https://github.com/rust-lang/rust/blob/main/library/core/src/iter/adapters/step_by.rs on line 226 calls
self.iter.nth(step_size)which is oke to be called after receivingNone, if the inner iterator is Fused.Alternatives
I don't consider it a alternative to always implement
FusedIteratoronStepBywithout aFusedItaratortrait bound, as it wouldn't be zero cost to implement this.Links and related work
internals.rust-lang.org discussion