File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
content/lessons/06_closures_iterators Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff 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.
3131But 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
3735Based 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
You can’t perform that action at this time.
0 commit comments