You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/expressions/closure-expr.md
+7-4
Original file line number
Diff line number
Diff line change
@@ -38,10 +38,13 @@ The closure type implements [`Send`] and [`Sync`] if the type of every captured
38
38
39
39
## Async closures
40
40
41
-
When a closure is marked with the `async` keyword, it is allowed to `await` futures in its body.
42
-
Calling the closure evaluates to a future that corresponds to the computation of the body of the closure.
43
-
This closure implements `AsyncFn`, `AsyncFnMut`, and `AsyncFnOnce` depending on the use of the captured variables in its body.
44
-
It may also implement `Fn`, `FnMut`, and `FnOnce` if the future it returns does not borrow any captured variables from the closure itself.
41
+
Closures marked with the `async` keyword indicate that they are asynchronous in an analogous way to an [async function][items.fn.async].
42
+
43
+
Calling the async closure does not perform any work, but instead evaluates to a value that implements [`Future`] that corresponds to the computation of the body of the closure.
44
+
45
+
Async closures implement [`AsyncFn`], [`AsyncFnMut`], and [`AsyncFnOnce`] depending on the use of the captured variables in its body.
46
+
47
+
Async closures may also implement [`Fn`], [`FnMut`], and [`FnOnce`] if the future it returns does not borrow any captured variables from the closure itself.
45
48
46
49
> **Edition differences**: Async closures are only available beginning with Rust 2018.
0 commit comments