Skip to main content

One doc tagged with "slice"

View all tags

Slices: A View into a Collection

We've learned about several collection types like String and Vec. A slice is a different kind of collection. It doesn't have ownership of its data. Instead, a slice is a reference to a contiguous sequence of elements in another collection. This allows you to work with a part of a collection without having to copy the data.