itertools icon indicating copy to clipboard operation
itertools copied to clipboard

process_results on the Itertools trait

Open Ten0 opened this issue 3 years ago • 0 comments

A typical use-case for process-results is e.g.

let final_map = itertools::process_results(
    some
        .long()
        .chain()
        .of()
        .iterator()
        .adapters(),
    |it| it.into_group_map(),
)?;

With the chain of iterator adapters getting longer and longer, this writing becomes less and less readable.

=> It would be much nicer to be able to write:

let final_map = some
    .long()
    .chain()
    .of()
    .iterator()
    .adapters()
    .process_results(|it| it.into_group_map())?;

This would be pretty easy to do by adding process_results in the Itertools trait.

Ten0 avatar Jul 07 '21 12:07 Ten0