相关疑难解决方法(0)

如何创建HashMap文字?

如何在Rust中创建HashMap文字?在Python中,我可以这样做:

hashmap = {
   'element0': {
       'name': 'My New Element',
       'childs': {
           'child0': {
               'name': 'Child For Element 0',
               'childs': {
                   ...
               }
           }
       }
   },
   ...
}
Run Code Online (Sandbox Code Playgroud)

在Go中这样:

type Node struct {
    name string
    childs map[string]Node
}

hashmap := map[string]Node {
    "element0": Node{
        "My New Element",
        map[string]Node {
            'child0': Node{
                "Child For Element 0",
                map[string]Node {}
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

hashmap rust

55
推荐指数
6
解决办法
1万
查看次数

标签 统计

hashmap ×1

rust ×1