3 ms·
Dot dot is range notation: https://doc.rust-lang.org/rust-by-example/flow_control/for.html https://doc.rust-lang.org/rust-by-example/flow_control/for.h... Her
by steamer25 8y ago
Dot dot is range notation:
https://doc.rust-lang.org/rust-by-example/flow_control/for.html https://doc.rust-lang.org/rust-by-example/flow_control/for.h...
Here's the reference for the drain() method on vectors which takes the range argument:
https://doc.rust-lang.org/rust-by-example/flow_control/for.html https://doc.rust-lang.org/rust-by-example/flow_control/for.h...
Altogether, it sounds like (I haven't read the whole thing) it's supposed to drain from the current row until the end, including every row in between.
- oconnor663 8y agoA simpler example might be slicing a list: let strings = ["foo", "bar", "baz"]; let slice = &strings[0..2]; // prints "foo" and "bar" for s in slice { println!("{}", s); } Or looping over numbers: // prints 0, 1, 2, 3, and 4 for i in 0..5 { println!("{}", i); }