summaryrefslogtreecommitdiffstats
path: root/src/doc/book/redirects/closures.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/redirects/closures.md')
-rw-r--r--src/doc/book/redirects/closures.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/doc/book/redirects/closures.md b/src/doc/book/redirects/closures.md
new file mode 100644
index 000000000..55b88767f
--- /dev/null
+++ b/src/doc/book/redirects/closures.md
@@ -0,0 +1,28 @@
+% Closures
+
+<small>There is a new edition of the book and this is an old link.</small>
+
+> Anonymous functions you can save in a variable or pass as arguments to other functions.
+
+```rust
+# use std::thread;
+# use std::time::Duration;
+
+let expensive_closure = |num| {
+ println!("calculating slowly...");
+ thread::sleep(Duration::from_secs(2));
+ num
+};
+# expensive_closure(5);
+```
+
+---
+
+Here are the relevant sections in the new and old books:
+
+* **[in the current edition: Ch 13.01 — Closures][2]**
+* <small>[In the first edition: Ch 3.23 — Closures][1]</small>
+
+
+[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/closures.html
+[2]: ch13-01-closures.html