Skip to content

Commit 5f7556c

Browse files
committed
Add an example of completely slicing an object.
1 parent 77acda1 commit 5f7556c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/doc/trpl/primitive-types.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ like arrays:
168168
```rust
169169
let a = [0, 1, 2, 3, 4];
170170
let middle = &a[1..4]; // A slice of a: just the elements 1, 2, and 3
171+
let complete = &a[..]; // A slice containing all of the elements in a
171172
```
172173

173174
Slices have type `&[T]`. We’ll talk about that `T` when we cover

0 commit comments

Comments
 (0)