diff options
| author | Florian Hartwig <florian.j.hartwig@gmail.com> | 2018-10-30 23:27:05 +0100 |
|---|---|---|
| committer | Florian Hartwig <florian.j.hartwig@gmail.com> | 2018-10-30 23:31:13 +0100 |
| commit | 51fdc2bf1431d6ac1f32531f820a937ddbb70048 (patch) | |
| tree | 08897110f17b6c5165e9b1c9c980627a97d0feae /src/libstd | |
| parent | e8aef7cae14bc7a56859408c90253e9bcc07fcff (diff) | |
Add example of using the indexing operator to HashMap docs
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ef5dae724b2..2bc440a19fb 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -318,6 +318,9 @@ const DISPLACEMENT_THRESHOLD: usize = 128; /// } /// } /// +/// // Look up the value for a key (will panic if the key is not found). +/// println!("Review for Jane: {}", book_reviews["Pride and Prejudice"]); +/// /// // Iterate over everything. /// for (book, review) in &book_reviews { /// println!("{}: \"{}\"", book, review); |
