Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::collections::HashMap;
- fn main() {
- let mut s = "foobar".to_owned();
- let mut m = HashMap::new();
- m.insert("foo".to_owned(), 23);
- if m.contains_key(&s) {
- let length = s.len();
- m.insert(s, length);
- }
- println!("{:?}", m)
- }
Add Comment
Please, Sign In to add comment