fn ownership_and_hash_maps() {
    let field_name = String::from("Favorite color");
    let field_value = String::from("Blue");

    let mut map = HashMap::new();
    map.insert(field_name, field_value);

    // field_name and field_value are invalid at this point, try using them and
    // see what compiler error you get!
}
// For types that implement the Copy trait, like i32, the values are copied into
// the hash map. For owned values like String, the values will be moved and the
// hash map will be the owner of those values.
For types that implement the Copy trait, like i32, the values are copied into
the hash map. For owned values like String, the values will be moved and the
hash map will be the owner of those values.
For types that implement the Copy trait like i32 the values are copied into the hash map . For owned values like String the values will be moved and the hash map will be the owner of those values .
fn ownership_and_hash_maps() {
    let field_name = String::from("Favorite color");
    let field_value = String::from("Blue");
    let mut map = HashMap::new();
    map.insert(field_name, field_value);
    // field_name and field_value are invalid at this point, try using them and
    // see what compiler error you get!
}
fn ownership_and_hash_maps ( ) { let field_name = String :: from ( " " ) ; let field_value = String :: from ( " " ) ; let mut map = HashMap :: new ( ) ; map . insert ( field_name , field_value ) ; // field_name and field_value are invalid at this point, try using them and // see what compiler error you get! }
For types that implement the Copy trait, like i32, the values are copied into
the hash map.
For types that implement the Copy trait like i32 the values are copied into the hash map .