diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index b884b60365b..044d5e4ed36 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -335,16 +335,18 @@ fn test_resize_policy() { /// println!("{:?} has {} hp", viking, health); /// } /// ``` +/// /// A HashMap with fixed list of elements can be initialized from an array: +/// /// ``` /// use std::collections::HashMap; /// /// fn main() { /// let timber_resources: HashMap<&str, i32> = -/// [ ("Norway", 100), -/// ("Denmark", 50), -/// ("Iceland", 10) ] -/// .iter().cloned().collect(); +/// [("Norway", 100), +/// ("Denmark", 50), +/// ("Iceland", 10)] +/// .iter().cloned().collect(); /// // use the values stored in map /// } /// ``` |
