rustlings/exercises/collections
Jacob Tinkhauser 9b6c629397
fix(vec1): Have test compare every element in a and v
The previous test would stop comparing elements in array a and vec v upon reaching the last element of either. This resulted in the test passing even if v did not contain all the elements in a. This change to the test fixes that bug and should only pass if all the elements in a and v are present and equal.
2020-11-29 01:35:14 +00:00
..
hashmap1.rs feat: Add HashMap exercises 2020-10-31 01:11:04 +06:00
hashmap2.rs feat: Add HashMap exercises 2020-10-31 01:11:04 +06:00
README.md feat: Add Vec exercises 2020-10-31 01:10:49 +06:00
vec1.rs fix(vec1): Have test compare every element in a and v 2020-11-29 01:35:14 +00:00
vec2.rs feat: Add Vec exercises 2020-10-31 01:10:49 +06:00

Collections

Rust’s standard library includes a number of very useful data structures called collections. Most other data types represent one specific value, but collections can contain multiple values. Unlike the built-in array and tuple types, the data these collections point to is stored on the heap, which means the amount of data does not need to be known at compile time and can grow or shrink as the program runs.

This exercise will get you familiar with two fundamental data structures that are used very often in Rust programs:

  • A vector allows you to store a variable number of values next to each other.
  • A hash map allows you to associate a value with a particular key. You may also know this by the names map in C++, dictionary in Python or an associative array in other languages.

Rust book chapter