Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::collections::HashMap;
- fn main() {
- let attributes = vec!["id", "loginButton", "class", "btn"];
- let attr_map: HashMap<String, String> = attributes
- .chunks(2)
- .map(|pair| (pair[0].to_string(), pair[1].to_string()))
- .collect();
- println!("{:?}", attr_map);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement