There should be a way to count backwards with a step using a range
Closed this issue · 2 comments
crumblingstatue commented
fn main() {
for i in (0..10).step_by(2).rev() {
println!("{}", i);
}
}
produces the following error:
error: the trait `core::iter::DoubleEndedIterator` is not implemented for the type `core::iter::StepBy<_, core::ops::Range<_>>` [E0277]
Perhaps step_by()
could produce a DoubleEndedIterator on ranges that are double-ended, but I don't know if this is possible.
alexcrichton commented
cc @aturon
steveklabnik commented
#27741 has superceded this issue, so closing in favor of it.