Skip to content

Commit

Permalink
Add an example
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jun 10, 2019
1 parent 1a32a68 commit 3cfceb9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libstd/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3cfceb9

Please sign in to comment.