Advertisement
cwchen

[Rust] Iterating a map with its values.

Aug 23rd, 2017
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.28 KB | None | 0 0
  1. use std::collections::HashMap;
  2.  
  3. fn main() {
  4.     let mut hash = HashMap::new();
  5.  
  6.     hash.insert("one", "eins");
  7.     hash.insert("two", "zwei");
  8.     hash.insert("three", "drei");
  9.  
  10.     // Iterate the hash by value
  11.     for v in hash.values() {
  12.         println!("{}", *v);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement