rust-itertools / itertools

Extra iterator adaptors, iterator methods, free functions, and macros.
https://docs.rs/itertools/
Apache License 2.0
2.72k stars 309 forks source link

Test double ended specializations #807

Closed Philippe-Cholet closed 10 months ago

Philippe-Cholet commented 10 months ago

We don't have any rfold/nth_back specialization yet but it will come as I intend to do rfold specializations alongside fold ones (benchmarks are ready too).

Apart from rciter for which I did not add any specialization test, all our double ended iterators are included here.

Philippe-Cholet commented 10 months ago

@phimuemue So opt-in or opt-out? If tomorrow we implement DoubleEndedIterator on some existing iterator, then in both cases, we have to update the test here. Therefore both are not ideal so I think it's merely a preference, and I prefer functions/traits over macro when possible.

I sure would prefer to merge those two functions in whatever form that detect if it needs to be done or not (I mean, checking if each of them should have a double ended test was not really quick to do), here and for benchmarks. But I don't see a way to do it.