Add an example
This commit is contained in:
parent
1a32a68f38
commit
3cfceb94cf
1 changed files with 10 additions and 0 deletions
|
|
@ -525,6 +525,16 @@ mod prim_pointer { }
|
|||
/// for x in &array { }
|
||||
/// ```
|
||||
///
|
||||
/// You can use a slice pattern to move elements out of an array:
|
||||
///
|
||||
/// ```
|
||||
/// fn move_away(_: String) { /* Do interesting things. */ }
|
||||
///
|
||||
/// let [john, roa] = ["John".to_string(), "Roa".to_string()];
|
||||
/// move_away(john);
|
||||
/// move_away(roa);
|
||||
/// ```
|
||||
///
|
||||
/// [slice]: primitive.slice.html
|
||||
/// [copy]: marker/trait.Copy.html
|
||||
/// [clone]: clone/trait.Clone.html
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue