These are chat archives for rust-lang/rust

28th
Mar 2018
blup
@blup
Mar 28 2018 22:20
I'm trying to apply a fn over a list of items regardless of whether it errors or not, but the iterator (i've also tried for..in) always stops on the error. I could try using Option instead, but I'd like to understand what I'm doing wrong:
let results = HashMap::new();
items.iter_mut().map(|mut item| {
  match run(&item) {
    Ok(result) => {
      println!("ok", result);
      results.insert(&item.id, result);
      ()
    },
    Err(e) => {
      println!("error", e);
      ()
    },
  }
}).collect::<Vec<_>>();
blup
@blup
Mar 28 2018 22:39
Sorry, I tried a simplified version and it worked. It must be a problem somewhere else.