4 ms·
Looks like a good starter Rust project. I am learning Rust and every bit of such blog helps. Just curious to see a .. syntax here: (row..row + count). What doe
by desi_ninja 8y ago
Looks like a good starter Rust project. I am learning Rust and every bit of such blog helps.
Just curious to see a .. syntax here: (row..row + count). What does it mean?
- steamer25 8y agoDot 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); }