📜  rust 从字符串中的分隔数据创建 hashmap - Rust 代码示例

📅  最后修改于: 2022-03-11 14:49:24.935000             🧑  作者: Mango

代码示例1
use std::collections::HashMap;

let states: HashMap<_, _> = "AZ CA ID IN MA OK PA VA"
    .split(' ')
    .zip(
        "Arizona California Idaho Indiana Massachusetts Oklahoma Pennsylvania Virginia"
            .split(' '),
    )
    .collect();