801 B
801 B
name = "Vecs and slices" difficulty = 2 exercises = ["access.md"]
Let's now look at some functions on slices and Vecs. Instead of manualy checking things we will follow the type system using Options and Results we saw earlier.
note
Slices (
[T]) represent some memory space containing an arbitrary number of elements of typeT. Since they don't have a size known at compilation time, we can only access them through pointers, commonly&[T](references to slices).
deepening
Vec<T>can be seen as owned[T], it means that every function working on a&[T]can work on a&Vec<T>.