2022-04-15
1477
#rust
Manish Shivanandhan
99052
Apr 15, 2022 â‹… 5 min read

A deep dive into Rust iterators and closures

Manish Shivanandhan Machine learning, cybersecurity, & AWS professional manishshiva.com

Recent posts:

Exploring The Aha Stack: Astro, Htmx, Alpine — A Complete Tutorial With A Demo Project And Comparison To Other Stacks

Exploring the AHA stack: Tutorial, demo, and comparison

The AHA stack — Astro, htmx, and Alpine — is a solid web development stack for smaller apps that emphasize frontend speed and SEO.

Oyinkansola Awosan
May 3, 2024 â‹… 13 min read
Comparing Hattip Vs Express Js For Modern Application Development

Comparing Hattip vs. Express.js for modern app development

Explore what Hattip is, how it works, its benefits and key features, and the differences between Hattip and Express.js.

Antonello Zanini
May 2, 2024 â‹… 8 min read
Using React Shepherd To Build A Site Tour

Using React Shepherd to build a site tour

React Shepherd stands out as a site tour library due to its elegant UI and out-of-the-box, easy-to-use React Context implementation.

Onuorah Bonaventure
May 1, 2024 â‹… 14 min read
A Guide To Cookies In Next Js

A guide to cookies in Next.js

Cookies are crucial to web development. This article will explore how to handle cookies in your Next.js applications.

Georgey V B
Apr 30, 2024 â‹… 10 min read
View all posts

One Reply to "A deep dive into Rust iterators and closures"

  1. 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));
    }
    }
    “`

Leave a Reply