3 ms·
That was never a concern; it would take signficantly more work to make iterators non-thread-safe. Welcome to Rust. :) EDIT: And if you're referring to the way
by kibwen 13y ago
That was never a concern; it would take signficantly more work to make iterators non-thread-safe. Welcome to Rust. :)
EDIT: And if you're referring to the way that our iterators automatically guarantee that iterator invalidation just can't happen, well, that's simply how borrowed pointers work! No extra effort required (not that borrowed pointers are the easiest thing to grok in the first place, mind you...).
- moomin 13y agoTo clarify, having advance return the result means the design can be used to read from an external queue on multiple threads. C#'s IEnumerable can't do this, because the interface assumes only one consumer. (Edit: I should point out C# is not the only platform that gets this wrong. C++/STL has the same design.)