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:

Radix Ui Adoption Guide Overview Examples And Alternatives

Radix UI adoption guide: Overview, examples, and alternatives

Radix UI is quickly rising in popularity and has become an excellent go-to solution for building modern design systems and websites.

Nefe Emadamerho-Atori
Apr 25, 2024 â‹… 11 min read
Understanding The Css Revert Layer Keyword, Part Of Css Cascade Layers

Understanding the CSS revert-layer keyword

In this article, we’ll explore CSS cascade layers — and, specifically, the revert-layer keyword — to help you refine your styling strategy.

Chimezie Innocent
Apr 24, 2024 â‹… 6 min read
Exploring Nushell, A Rust Powered, Cross Platform Shell

Exploring Nushell, a Rust-powered, cross-platform shell

Nushell is a modern, performant, extensible shell built with Rust. Explore its pros, cons, and how to install and get started with it.

Oduah Chigozie
Apr 23, 2024 â‹… 6 min read
Exploring Zed, A Newly Open Source Code Editor Written In Rust

Exploring Zed, an open source code editor written in Rust

The Zed code editor sets itself apart with its lightning-fast performance and cutting-edge collaborative features.

Nefe Emadamerho-Atori
Apr 22, 2024 â‹… 7 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