• Ephera@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      4 years ago

      I can see this being useful for parsing. You often want to report all of the parsing errors to the user in one go, so collecting them into a list or iterator is useful.

      But yeah, still relatively obscure.

      And I’m guessing, “evert” is simply the respective English word: https://en.wiktionary.org/wiki/evert
      As a non-native speaker, I didn’t know that word either…

    • Nutomic@lemmy.mlM
      link
      fedilink
      arrow-up
      0
      ·
      4 years ago

      Its for this pattern which useful, but not intuitive:

      let res = my_collection
      .iter()
      .map(|x| method_that_returns_result(x))
      .collect::<Result<Vec<T>, Error>>()?;
      

      So it turns a Vec<Result, Error> into Result<Vec<T>, Error>, and you can turn it into Vec<T> simply with ?. Otherwise you would probably need a for loop.