miniblog.
← Back to all posts
Nov 14, 2015 at 20:17
Rust's iterators are fast and can match loops with preallocation!
Reddit - The heart of the internet
www.reddit.com/r/rust/comments/3spfh1/does_collect_allocate_more_than_once_while/
Wilfred Hughes
Related Posts
Mar 20, 2022 at 17:57
Rust's Iterator interface is growing on me. I replaced a bunch of `i += 1; foo.get(i)` loops with explicit calls to `.next()`. It's less code and easier to reason about.
https://twitter.com/carbon_noreply/status/1505603675204452352/photo/1
Wilfred Hughes
Shared words: Rust, iterators, loops Score: 99.7
Jun 23, 2022 at 17:10
The Rust docs include a surprisingly readable example of how `for` loops desugar into essentially a while loop with a pattern match:
std::iter - Rust
Composable external iteration.
Wilfred Hughes
Shared words: Rust, match, loops Score: 74.5
Nov 23, 2022 at 04:43
I feel like Rust often pushes me to use concrete types. It's a lot easier to return a Vec than an impl Iterator. It's not a big problem, but in e.g. Java I'd just say I'm returning some kind of iterator.
Wilfred Hughes
Shared words: Rust, iterators Score: 56.8