Rust Data StructuresLesson 26Free preview
Rust HashMap
This lesson is part of Rust · All levels
Summary
This lesson reviews the hashmap data structure in Rust that stores key and value pairs. The key must be unique and apply hashing functionality to instantaneous data search. Developers will learn how to import HashMap from a standard library, insert data, and safely update values.
Key points
- HashMap stores data in the form of Key-Value pairs
- Must be imported explicitly from 'std::collections::HashMap'
- Enter the data using the '.insert' method
- The '.entry().or_insert() method makes it easier to add data if the key is not yet available
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.