I want to create range x..y where x > y. For eg 5..-10.
5..-10 produces empty range https://doc.rust-lang.org/std/ops/struct.Range.html
I created this questions to share my solution and potentially someone will come with better idea.
I want to create range x..y where x > y. For eg 5..-10.
5..-10 produces empty range https://doc.rust-lang.org/std/ops/struct.Range.html
I created this questions to share my solution and potentially someone will come with better idea.
We can create valid range y..x (since x > y) and then reverse it
(y..x).rev()
this will produce desired range