diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-06-10 13:30:45 +0900 |
|---|---|---|
| committer | Yuki Okushi <huyuumi.dev@gmail.com> | 2019-06-10 13:30:45 +0900 |
| commit | 3cfceb94cfa42e936a9e115c571c0b0de0f1a262 (patch) | |
| tree | 274a98e2d923455297ad5f55c8f80b249b2b747c /src/libstd/primitive_docs.rs | |
| parent | 1a32a68f38a9d74209fb710187a1909af8b1979d (diff) | |
| download | rust-3cfceb94cfa42e936a9e115c571c0b0de0f1a262.tar.gz rust-3cfceb94cfa42e936a9e115c571c0b0de0f1a262.zip | |
Add an example
Diffstat (limited to 'src/libstd/primitive_docs.rs')
| -rw-r--r-- | src/libstd/primitive_docs.rs | 10 |
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 |
