Since an example fits in a toot:
extern crate rand;
fn resultize(i: usize) -> Result<usize, String> {
if rand::random() {
Ok(i)
} else {
Err("whoops!".into())
}
}
fn main() {
let iter = (0..10).map(|i| resultize(i));
let results = iter.collect::<Result<Vec<_>, _>>();
println!("{:?}", results);
}
@balrogboogie
Whoa whoa whoa
Hold on
What's a toot