Closures and Iterators

    2024-10-31 (last edit: 2022-11-14)

    Closures

    Closures (Polish: "domknięcia") are anonymous functions that can access variables from the scope in which they were defined.

    We'll go through the examples from Rust by Example.

    Iterators

    In Rust, there is no hierarchy of types for collections (because there is no inheritance in general). Instead, what makes a collection is that it can be iterated over.

    We'll go through the official docs. Most methods are defined in the Iterator trait.

    Reading