Slices
- Slices borrow data from the sliced type.
Question: What happens if you modify ?
The same is true for the last index, so
&a[2..a.len()]
and are identical.Slices always borrow from another object. In this example,
a
has to remain ‘alive’ (in scope) for at least as long as our slice.