mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-12 02:18:08 +08:00
14 lines
386 B
Rust
Executable File
14 lines
386 B
Rust
Executable File
fn main() {
|
|
// ANCHOR: here
|
|
use std::collections::HashMap;
|
|
|
|
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 和 field_value 不再有效,
|
|
// 尝试使用它们看看会出现什么编译错误!
|
|
// ANCHOR_END: here
|
|
}
|