HashMaps
Explore the use of HashMaps in Rust to store and manage key-value pairs effectively. Understand how to create, update, and iterate over HashMaps while discovering best practices for handling complex keys and values in your programs.
We'll cover the following...
Hashs, maps, and sets
We need to clarify one thing before going on. Programmers are nerds who like fancy, nerdy-sounding names.
In many programming languages, Rust included, we have HashMaps, HashSets, and Hash-a-lot-of-things. Ultimately, the best way to understand what they are is just to pretend the word hash isn’t there.
In these names, hash refers to a method of storing and retrieving data but does not contribute to our understanding of what these data structures are.
So, for our purposes, HashMap = Map, which is a data structure that maps something to something else.
Similarly, HashSet = Set, which is like a mathematical set. We’ll explore HashSets in ...