Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. use std::collections::HashMap;
  2.  
  3. fn main() {
  4. let attributes = vec!["id", "loginButton", "class", "btn"];
  5. let attr_map: HashMap<String, String> = attributes
  6. .chunks(2)
  7. .map(|pair| (pair[0].to_string(), pair[1].to_string()))
  8. .collect();
  9. println!("{:?}", attr_map);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement