- suppose we have:
x: Result<T, E>
then we can do:
x?
- Now, suppose instead we have:
v: Vec<Result<T, E>>;
is there a way to apply ? to the entire Vec? either it returns the first E, or it returns a Vec ?
x: Result<T, E>
then we can do:
x?
v: Vec<Result<T, E>>;
is there a way to apply ? to the entire Vec? either it returns the first E, or it returns a Vec ?
You can use this implementation of FromIterator: v.into_iter().collect()?
. But it would be more efficient to do it before you create the initial Vec.