首页 > 解决方案 > 迭代存储在弧中的dashmap

问题描述


let dashMap:DashMap<String,String>:DashMap::new();

// Then I put it into app_data of Actix to use it as a global variable, 
// which is an Arc.

// Then when I want to use it in iteration : 

for item:RefMulti<String,String> in dashMap.into_iter() {
   ...
}

我需要迭代dashMap。我不确定该怎么做,item因为它是RefMulti类型。我期待(k,v)

我将如何从迭代中访问密钥?有没有一种很好的方法来访问这些(key, value)RefMulti

[用 MRE 更新]

//cargo.toml
actix-web = { version = "4.0.0-beta.6", features=["rustls"] }
dashmap = "4.0.2"

[code] 是一个要点,不能在这里发布。出现格式错误

标签: rust

解决方案


推荐阅读