(Sorry for the RangeFrom/RangeTo typo, I fixed it)
- about the overflow/wrapping , according to Debug/Release, I am aware of that, I just assume that Debug is the safest option to describe intended code (I accept the overflow panic as expected behaviour)
- yes, the unreachable MAX is documented :
Note also that overflow happens earlier than you might assume: the overflow happens in the call to
next
that yields the maximum value, as the range must be set to a state to yield the next value.
- my question is about why it was designed with this limitation. (compared to
RangeInclusiveIterator
)
I am currently investigating rust behaviour in corner cases and often, the reason behind a design choice is a good way to get very clever information (and sometimes it is just an unwise decision)