Skip to content

Commit c97ae14

Browse files
committed
06: reposition code sample in closures
1 parent 2171e6f commit c97ae14

File tree

1 file changed

+6
-4
lines changed
  • content/lessons/06_closures_iterators

1 file changed

+6
-4
lines changed

content/lessons/06_closures_iterators/index.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ Closures can capture variables from the environment where they are defined. They
3030
**HOW** closures capture variables is one thing.
3131
But even more important is **WHAT** closures do with their captures.
3232

33-
{{ include_code_sample(path="lessons/06_closures_iterators/closures_capturing.rs", language="rust") }}
34-
3533
### Functions & closures hierarchy
3634

3735
Based on **WHAT** a closure does with its captures, it implements closure traits:
@@ -44,9 +42,13 @@ For completeness, there is a (concrete) type of function pointers:
4442

4543
- `fn` - functions, closures with no captures.
4644

47-
Those traits and the `fn` type form a hierarchy: `fn` < `Fn` < `FnMut` < `FnOnce`
45+
Those traits and the `fn` type form a hierarchy: `fn``Fn``FnMut``FnOnce`
46+
47+
<!--> $$ fn \subseteq Fn \subseteq FnMut \subseteq FnOnce $$ -->
4848

49-
$$ fn \subseteq Fn \subseteq FnMut \subseteq FnOnce $$
49+
The following code sample demonstrates various ways to capture environment (borrowing or moving) and various
50+
51+
{{ include_code_sample(path="lessons/06_closures_iterators/closures_capturing.rs", language="rust") }}
5052

5153
## Examples
5254

0 commit comments

Comments
 (0)