|
10 | 10 | A _call expression_ consists of an expression followed by a parenthesized
|
11 | 11 | expression-list. It invokes a function, providing zero or more input variables.
|
12 | 12 | If the function eventually returns, then the expression completes. For
|
13 |
| -[non-function types](types.html#function-item-types), the expression f(...) uses the |
14 |
| -method on one of the `std::ops::Fn`, `std::ops::FnMut` or `std::ops::FnOnce` |
15 |
| -traits, which differ in whether they take the type by reference, mutable |
16 |
| -reference, or take ownership respectively. An automatic borrow will be taken if |
17 |
| -needed. Rust will also automatically dereference `f` as required. Some examples |
18 |
| -of call expressions: |
| 13 | +[non-function types](types.html#function-item-types), the expression f(...) uses |
| 14 | +the method on one of the [`std::ops::Fn`], [`std::ops::FnMut`] or |
| 15 | +[`std::ops::FnOnce`] traits, which differ in whether they take the type by |
| 16 | +reference, mutable reference, or take ownership respectively. An automatic |
| 17 | +borrow will be taken if needed. Rust will also automatically dereference `f` as |
| 18 | +required. Some examples of call expressions: |
19 | 19 |
|
20 | 20 | ```rust
|
21 | 21 | # fn add(x: i32, y: i32) -> i32 { 0 }
|
@@ -93,6 +93,9 @@ fn main() {
|
93 | 93 |
|
94 | 94 | Refer to [RFC 132] for further details and motivations.
|
95 | 95 |
|
| 96 | +[`std::ops::Fn`]: ../std/ops/trait.Fn.html |
| 97 | +[`std::ops::FnMut`]: ../std/ops/trait.FnMut.html |
| 98 | +[`std::ops::FnOnce`]: ../std/ops/trait.FnOnce.html |
96 | 99 | [RFC 132]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md
|
97 | 100 |
|
98 | 101 | [_Expression_]: expressions.html
|
0 commit comments