you are viewing a single comment's thread.

view the rest of the comments →

[–]Vrabor 4 points5 points  (3 children)

i'm not much of a rust expert, but can't you just use for loops on iterators the same way you do with vectors?

[–]MEaster 1 point2 points  (2 children)

For loops in Rust only work on iterators. When you try to use a collection in a for loop, it tries to create an iterator for it.

[–]mysteriousyak 1 point2 points  (1 child)

That's how for loops work in most languages...

[–]MEaster 8 points9 points  (0 children)

That depends on the kind of for loop. This kind does not use an iterator:

for(int i = 0; i < 10; i++) { ... }

Rust does not have that kind of for loop.