
Discover what’s new in The Replay, LogRocket’s newsletter for dev and engineering leaders, in the December 17th issue.

Shruti Kapoor breaks down the React2Shell exploit and discusses lessons that dev teams can take away from one of the biggest security events of the year.

React, Angular, and Vue still lead frontend development, but 2025 performance is shaped by signals, compilers, and hydration. Here’s how they compare.

Learn how to use Drizzle ORM with Expo SQLite in a React Native app, including schema setup, migrations, and type-safe queries powered by TanStack Query.
Would you be interested in joining LogRocket's developer community?
Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Sign up now
One Reply to "A deep dive into Rust iterators and closures"
Is logrocket a content farm? It increasingly pops up when searching for Rust stuff, but it seems to be mostly basic material with links to other texts on the same site.
The click-bait title of this article is misleading. This is not a deep dive, at best it is a superficial introduction. It also contains errors.
1. Closures does not “create a reference to the entities in its scope”, this doesn’t compile:
“`
fn main() {
let foo: String = String::from(“hello”);
let c = |x| {
let y: &String = x;
println!(“{}”, y);
};
c(foo);
}
“`
2. It’s not true that one “cannot iterate through a set of values (arrays, vectors, maps) in Rust using loops”:
“`
fn main() {
let vec = vec![1, 2, 3];
for i in 0..3 {
println!(“{:?}”, vec.get(i));
}
}
“`