Skip to content

Commit cda4f61

Browse files
Merge pull request #99 from Dailiduzhou/fix/MissingEscapeCharacter
Fix escaping of special characters with backslashes
2 parents b97167e + 499a8fa commit cda4f61

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

rust-patterns-book/src/ch07-closures-and-higher-order-functions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ assert_eq!(result, vec![4, 16, 36, 64, 100]);
118118

119119
| Combinator | What It Does | Example |
120120
|-----------|-------------|---------|
121-
| `.map(f)` | Transform each element | `.map(|x| x * 2)` |
122-
| `.filter(p)` | Keep elements where predicate is true | `.filter(|x| x > &5)` |
123-
| `.filter_map(f)` | Map + filter in one step (returns `Option`) | `.filter_map(|x| x.parse().ok())` |
124-
| `.flat_map(f)` | Map then flatten nested iterators | `.flat_map(|s| s.chars())` |
125-
| `.fold(init, f)` | Reduce to single value (like `Aggregate` in C#) | `.fold(0, |acc, x| acc + x)` |
126-
| `.any(p)` / `.all(p)` | Short-circuit boolean check | `.any(|x| x > 100)` |
127-
| `.enumerate()` | Add index | `.enumerate().map(|(i, x)| ...)` |
121+
| `.map(f)` | Transform each element | `.map(\|x\| x * 2)` |
122+
| `.filter(p)` | Keep elements where predicate is true | `.filter(\|x\| x > &5)` |
123+
| `.filter_map(f)` | Map + filter in one step (returns `Option`) | `.filter_map(\|x\| x.parse().ok())` |
124+
| `.flat_map(f)` | Map then flatten nested iterators | `.flat_map(\|s\| s.chars())` |
125+
| `.fold(init, f)` | Reduce to single value (like `Aggregate` in C#) | `.fold(0, \|acc, x\| acc + x)` |
126+
| `.any(p)` / `.all(p)` | Short-circuit boolean check | `.any(\|x\| x > 100)` |
127+
| `.enumerate()` | Add index | `.enumerate().map(\|(i, x)\| ...)` |
128128
| `.zip(other)` | Pair with another iterator | `.zip(labels.iter())` |
129129
| `.take(n)` / `.skip(n)` | First/skip N elements | `.take(10)` |
130130
| `.chain(other)` | Concatenate two iterators | `.chain(extra.iter())` |

0 commit comments

Comments
 (0)