rust - 迭代存储在弧中的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] 是一个要点,不能在这里发布。出现格式错误
解决方案
推荐阅读
- c++ - 正确地重新排序事件序列
- c++ - 收到自己的消息后如何创建或发送消息?
- python-3.x - 用于自动化流程的 Python 代码,以便文本文件包含最近 30 天的数据
- plot - Julia 1.3 中的绘图:未定义绘图的函数
- string - F# 错误 FS001: String' 与类型 'seq 不兼容
- python - 使用 pandas 将信息添加到 Python 中的 Json 文件
- ios - 在 iOS 设备上尝试时 Flutter 签名无效
- javascript - 有没有办法让一个代码适用于具有相同功能的多个按钮?
- android - 如何在同一个活动中注入两个组件?
- c# - 我们的集成测试中的多个数据库上下文似乎间歇性失败,添加 ToList() 并不能解决它