Glossary: Data Structures and Algorithms in Rust
Closure
Also written: closures
A small nameless function written right where it is needed, with its parameters between bars, such as `|a, b| b.total.cmp(&a.total)`. Closures are often passed to methods like `sort_by_key` and `sort_by` to say what to compare.