SHARE
TWEET

Untitled

a guest Apr 21st, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::collections::HashMap;
  2.  
  3. fn main() {
  4.  
  5.     let values = vec!["a", "b", "c", "d", "e", "f"];
  6.  
  7.     let mut index = HashMap::new();
  8.  
  9.     for (idx, p) in values.iter().enumerate() {
  10.         index.insert(idx, p);
  11.     }
  12.  
  13.     for (k, v) in &index {
  14.         println!("{:?} -> {:?}", k, v);
  15.     }
  16.  
  17.     for v in &values {
  18.         println!("{:?}", v);
  19.     }
  20.    
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top