How to idiomatically iterate over a mutable vector while examining other elements

后端 未结 0 1927
谎友^
谎友^ 2021-01-26 04:55

I want to write code like this:

let mut v: Vec = Vec::new();
for e in v.iter_mut() {
  if e.some_predicate() {
    e.val = v.iter().filter(|o| o.som         


        
                      
相关标签:
回答
  • 消灭零回复
提交回复
热议问题