From the course: Rust Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

HashMaps

HashMaps - Rust Tutorial

From the course: Rust Essential Training

Start my 1-month free trial

HashMaps

- [Instructor] Another common data type for working with collections is the HashMap, which stores data and key value pairs. Instead of accessing elements using a numeric index, like with a vector, you look up data in a HashMap by providing a key to retrieve the corresponding value. Note this key value pairing only maps one way, so you cannot easily go the other way to provide a value and get the corresponding key or keys. Under the hood, REST uses a hashing function to determine how to store the keys and values in memory so they can be quickly located. If you have experienced programming in other languages, you may have encountered a similar data structure, although often under different names, such as map, hash table, dictionary or associative array. the keys and their corresponding values can be different data types represented with the generic type variables, K and V respectively. However, all of the keys must have the…

Contents