I mean working in Result / ? / anyhow land inside an iter chain. How to make this work?
fn noodle_something() -> Result<()> {
....
let stuff = collection.iter().filter(|i| i > 42).map(|i| {
let f = foodle(i);
if f.is_somethingwrong(){
bail!("cant froodle a noodle");
f
}
....
}
I dont think this can be made to work because the lambdas for iters are not Result returning, but I know that rust is extremely idiomatic and there may be ways to do this that I cannot see
Result<V, E>—V being the collection you collect your Ok(T) instances into—can becollected from an iterator with Result<T, E> elements. Collecting Result<V, E> is short-circuiting, it stops after the first Err is encountered.