Add an example of completely slicing an object.

This commit is contained in:
John Van Enk 2015-04-21 09:21:52 -07:00
parent 77acda1c8e
commit 5f7556cd39

View file

@ -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]`. Well talk about that `T` when we cover