Rust question: Why doesn't Rust have a `RandomAccessIterator`? It seems to be there at some point but got removed: <https://www.cs.brandeis.edu/~cs146a/rust/doc-02-21-2015/std/iter/trait.RandomAccessIterator.html>.

And what is the alternative? Implementing `Index` for the iterator?

#rust #rustlang

std::iter::RandomAccessIterator - Rust

API documentation for the Rust `RandomAccessIterator` trait in crate `std`.

@lesley what does it even mean for an iterator to be random-access? Methinks, random-access and iteration are polar opposites. C++ people in their infinite wisdom seemingly just decided to call their container abstraction an iterator, and their iterators - ranges.
@hjvt @lesley C++ calls a container an iterator? Huh? That is a nonsensical statement.

@hjvt @lesley perhaps there is confusion afterall many things in C++ do have convoluted origins.

Maybe this brief story will clear things up.

https://www.jmeiners.com/efficient-programming-with-components/09_iterators.html#History-of-iterators

9. Iterators

@jaeger @hjvt Interesting. "Coordinate" is certainly a more fitting name for C++ iterators.

C++ ranges (at least from the design of C++20) are also not directly the iterator patterns since they also include containers. Range views are probably the closest to iterators in other languages