Skip to content

Commit 98bd568

Browse files
authored
Merge pull request rust-lang#135 from brauliobz/grammar_closure_expr
Closures grammar
2 parents d197813 + 7a0d98e commit 98bd568

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/expressions/closure-expr.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Closure expressions
22

3+
> **<sup>Syntax</sup>**
4+
> _ClosureExpression_ :
5+
> &nbsp;&nbsp; `move`<sup>?</sup>
6+
> &nbsp;&nbsp; ( `||` | `|` [_FunctionParameters_]<sup>?</sup> `|` )
7+
> &nbsp;&nbsp; ([_Expression_] | `->` [_TypeNoBounds_]&nbsp;[_BlockExpression_])
8+
39
A _closure expression_ defines a closure and denotes it as a value, in a single
410
expression. A closure expression is a pipe-symbol-delimited (`|`) list of
511
patterns followed by an expression. Type annotations may optionally be added
@@ -56,3 +62,8 @@ ten_times(move |j| println!("{}, {}", word, j));
5662

5763
[block]: expressions/block-expr.html
5864
[function definitions]: items/functions.html
65+
66+
[_Expression_]: expressions.html
67+
[_BlockExpression_]: expressions/block-expr.html
68+
[_TypeNoBounds_]: types.html
69+
[_FunctionParameters_]: items/functions.html

0 commit comments

Comments
 (0)