Skip to content

Commit 9591f93

Browse files
authored
Add speaker note about fn ptrs (#2680)
1 parent 5704f20 commit 9591f93

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/closures/syntax.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,15 @@ fn main() {
3030
not capture any variables from their lexical environment. We will see captures
3131
next.
3232

33+
## More to Explore
34+
35+
- The ability to store functions in variables doesn't just apply to closures,
36+
regular functions can be put in variables and then invoked the same way that
37+
closures can: [Example in the playground][fn-ptr].
38+
39+
- The linked example also demonstrates that closures that don't capture
40+
anything can also coerce to a regular function pointer.
41+
3342
</details>
43+
44+
[fn-ptr]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=817cbeeefc49f3d0d180a3d6d54c8bda

0 commit comments

Comments
 (0)