SHARE
TWEET

Untitled

a guest Feb 20th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top