从地图提取数据

时间:2019-05-05 23:39:52

标签: rust

我在Rayon上的代码采用结构FontAwesome.otf, fontawesome-webfont.eot, fontawesome-webfont.svg的内容,并将它们全部放入数组中。

同时,我想获取Value的内容并将其复制到另一个数组中并对其进行处理。

多线程仍然可以正常工作非常重要。

v.list
pub struct Value {
    pub list: Vec<[u8; 32]>,
    pub empty: bool,
}

impl DataMap {
    // This needs to be done at the end as it will take the Ownership of the map
    pub fn extract(&self) -> Vec<[u8; 32]> {
        // This use rayon to parallelize the reading from the BTreemap
        self.par_iter().flat_map(|(_, v)| v.list.clone()).collect()
    }
}

0 个答案:

没有答案