mirror of
https://github.com/darkicewolf50/RustBrock.git
synced 2025-07-07 11:37:13 -06:00
finished ch13.2
This commit is contained in:
20
Iterators and Closures.md
Normal file
20
Iterators and Closures.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Functional Language Features: Iterators and Closures
|
||||
Rust's design has taken inspiration from many exisitng languages and techniques
|
||||
|
||||
One significant influence is *functional programming*
|
||||
|
||||
Programming in a functional style often include using functions as values by passing them in args, returning them form other unfcitons, assigning them to varaibles for later execution and so forth.
|
||||
|
||||
This chapter/section won't debate the issue of what functional programming is or isn't.
|
||||
|
||||
It will discuss some features of Rust that are similar to features in many languages often referred to as functional
|
||||
|
||||
It will cover:
|
||||
- [*Closures*](./Closures.md) - a function-like construct you can store in a variable
|
||||
- [*Iterators*](./Iterators.md) - a way of processing a series of elements
|
||||
- How to use colsure and iterators to improve the I/O project (minigrep)
|
||||
- The preformance of closures and iterators (Spoiler alert: they are faster than you might think!)
|
||||
|
||||
We have already covered some other Rust freatures, such as pattern matchin and enums, that are also influenced by the functional style.
|
||||
|
||||
Mastering closures and iterators is an improtant part of wiritng idiomatic, fast Rust code.
|
Reference in New Issue
Block a user