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:

Implementing Infinite Scroll In Next Js With Server Actions

Implementing infinite scroll in Next.js with Server Actions

Infinite scrolling in Next.js no longer requires external libraries — Server Actions let us fetch initial data directly on the server.

Rahul Chhodde
Apr 19, 2024 â‹… 10 min read
Integrating Django Templates With React For Dynamic Webpages

Integrating Django templates with React for dynamic webpages

Create a dynamic demo blog site using Django and React to demonstrate Django’s server-side functionalities and React’s interactive UI.

Kayode Adeniyi
Apr 18, 2024 â‹… 7 min read
Using Aoi Js To Build A Bot For Discord

Using aoi.js to build a bot on Discord

Explore how the aoi.js library makes it easy to create Discord bots with useful functionalities for frontend applications.

Rahul Padalkar
Apr 17, 2024 â‹… 9 min read
Web Components Adoption Guide: Overview, Examples, And Alternatives

Web Components adoption guide: Overview, examples, and alternatives

Evaluate Web Components, a set of standards that allow you to create custom HTML tags for more reusable, manageable code.

Elijah Asaolu
Apr 16, 2024 â‹… 11 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