2026-02-26 11:38 UTC
TIL that in #rust you can do ...
my_vec
.iter()
.map(|x| something_returning_result(x))
.collect::<Result<Vec<_>>()?;
(also works with Option<Vec<_>>!)
How could I have missed this omg. (;´༎ຶٹ༎ຶ`) Now I finally also understand why type inference is so funky around .collect() :)
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect
Replies (0)
No replies.