Add an example of completely slicing an object.
This commit is contained in:
parent
77acda1c8e
commit
5f7556cd39
1 changed files with 1 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue