
I know about Option, Result, anyhow::Result.

Suppose we have a list of elements
Vec<K>
and we want to transform it into another listVec<V>
. If we havef: (&K) > V
, this straight forward.
Suppose now, that the function f
can fail, so we have f: (&K) > Option<V>
or f: (&K) > anyhow::Result<V>
. Then, if we use collect
, we get either (1) a Vec<V>
or (2) the first error.
Suppose we wanted a different behavior, (Vec<V>, Vec<Err>)
, two vectors  a collection of all the good output, and a collection of all the errors. This is not a difficult function to write. Is there an idiomatic way to do this in Rust ?
[Suppose that the index does not matter, i.e. within both V
and Err
, we have enough info to know which K
it came from]