Crate try_all[][src]

Expand description

Rust iterator extensions to operate on Results effectively.

try_all

Tries all items of the iterator until one fails (or all succeed).

Returns

The iterator of all successes, or the first failure.

Examples

Useful for propagating failures from within closures with ? operator:

fn parse_all_numbers(strs: &Vec<&str>) -> Result<Vec<u64>, std::num::ParseIntError> {
	Ok(strs.iter().map(|s| s.parse()).try_all()?.collect())
}

Traits

TryAll

Trait providing try extensions to Iterators.

TryAllHack

A hack trait to bypass limitations of type checker.