add example to move
This commit is contained in:
parent
71abce1e5d
commit
b67d6c7e12
1 changed files with 4 additions and 1 deletions
|
@ -875,7 +875,10 @@ mod mod_keyword { }
|
||||||
/// variables, when `move` is used the closures is represented by the `FnOnce` trait.
|
/// variables, when `move` is used the closures is represented by the `FnOnce` trait.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
///
|
/// let capture = "hello";
|
||||||
|
/// let closure = move || {
|
||||||
|
/// println!("we say {}", capture);
|
||||||
|
/// };
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// `move` is often used when [threads] are involved.
|
/// `move` is often used when [threads] are involved.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue