我正在尝试构造一个结构,以并行方式将向量中的多个值传递给函数。然后,我想以非并行的方式遍历结果。下面的示例:
extern crate rayon;
use rayon::prelude::*;
struct Data {
j: usize,
val: usize,
}
fn eval(d: &Data) -> (usize, usize) {
(d.j, d.val + 2)
}
fn main() {
let mut recs = Vec::new();
for i in 1..10 {
let d = Data { j: i, val: i };
recs.push(d);
}
let results = recs.par_iter().map(eval);
for r in results {
//error is here
println!("{} {}", r.j, r.val);
}
}
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Timedelta.round.html
如何遍历results
?