mirror of
https://github.com/rust-lang/rust
synced 2024-09-15 22:50:55 +00:00
rollup merge of #24665: sw17ch/document-complete-slice-syntax
The documentation doesn't appear to describe the `&foo[..]` syntax. I tried looking in `primitive-types.html#slices` and `std/primitive.slice.html`. There's an example of partially slicing an array in trpl and a mention of `&foo[..]` in [the standard library documentation](https://doc.rust-lang.org/std/primitive.slice.html), but neither place, from what I can see, actually describes the behavior of `&foo[..]`. +r? @steveklabnik
This commit is contained in:
commit
1a6c18d660
|
@ -168,6 +168,7 @@ like arrays:
|
|||
```rust
|
||||
let a = [0, 1, 2, 3, 4];
|
||||
let middle = &a[1..4]; // A slice of a: just the elements 1, 2, and 3
|
||||
let complete = &a[..]; // A slice containing all of the elements in a
|
||||
```
|
||||
|
||||
Slices have type `&[T]`. We’ll talk about that `T` when we cover
|
||||
|
|
Loading…
Reference in a new issue