itertools icon indicating copy to clipboard operation
itertools copied to clipboard

flat_map_ok

Open oberien opened this issue 4 years ago • 3 comments

Similar to #522, which defines flatten_ok, there could also be a flat_map_ok which operates on an IntoIter<Item = Result<T, E>>, applies a function to T if the value is Ok and flattens the result of that function. It should be equivalent to iterator.map_ok(function).flatten_ok().

oberien avatar Feb 11 '21 14:02 oberien

And what about something that acts like iterator.map(function).flatten_ok()?

SkiFire13 avatar Feb 12 '21 13:02 SkiFire13

Hmm, is it really best to have an _ok version of just about everything?

Are these scenarios where it might be better to use something like https://docs.rs/fallible-iterator/0.2.0/fallible_iterator/trait.FallibleIterator.html that's specifically for the Result case?

scottmcm avatar Feb 12 '21 18:02 scottmcm

I feel the two projects should be merged. rust-itertools and fallible-iterator just include similar implementations but different interfaces.

Atry avatar May 27 '23 01:05 Atry