about summary refs log tree commit diff
path: root/src/libstd/primitive_docs.rs
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-06-10 13:30:45 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2019-06-10 13:30:45 +0900
commit3cfceb94cfa42e936a9e115c571c0b0de0f1a262 (patch)
tree274a98e2d923455297ad5f55c8f80b249b2b747c /src/libstd/primitive_docs.rs
parent1a32a68f38a9d74209fb710187a1909af8b1979d (diff)
downloadrust-3cfceb94cfa42e936a9e115c571c0b0de0f1a262.tar.gz
rust-3cfceb94cfa42e936a9e115c571c0b0de0f1a262.zip
Add an example
Diffstat (limited to 'src/libstd/primitive_docs.rs')
-rw-r--r--src/libstd/primitive_docs.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs
index 0ba6e99e613..7ed40bfe6d8 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -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