std::iter::Iterator provides many methods, but they are all implemented as "default implementations," so that those who implements
Iterator on their own structs / enums can re-implement some of these methods (such as
I found that
impl<A> Iterator for std::pos::Range<A> requires
A: std::iter::Step, which guarantees the values generated by
Range<A> are sorted in ascending order. I thought this meant
is_sorted() methods can be written as one which always returns
true, but the actual implementation wasn't so.
Are there any reasons of this (like, because one can implement
Step that generates numbers not in ascending order)?