We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1a32a68 commit 3cfceb9Copy full SHA for 3cfceb9
src/libstd/primitive_docs.rs
@@ -525,6 +525,16 @@ mod prim_pointer { }
525
/// for x in &array { }
526
/// ```
527
///
528
+/// You can use a slice pattern to move elements out of an array:
529
+///
530
+/// ```
531
+/// fn move_away(_: String) { /* Do interesting things. */ }
532
533
+/// let [john, roa] = ["John".to_string(), "Roa".to_string()];
534
+/// move_away(john);
535
+/// move_away(roa);
536
537
538
/// [slice]: primitive.slice.html
539
/// [copy]: marker/trait.Copy.html
540
/// [clone]: clone/trait.Clone.html
0 commit comments