Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test double ended specializations #807

Conversation

Philippe-Cholet
Copy link
Member

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.

Similar to `test_specializations` but for `DoubleEndedIterator::{rfold,nth_back}`.
The other difference is that in the macro, I advance the iterator alternatively from both fronts 8 times instead of one front 5 times.

Note that we don't have any `rfold/nth_back` specialization yet but it will come as I intend to do `rfold` specializations alongside `fold` ones.
I previously forgot `repeat_n`.
Copy link
Member

@phimuemue phimuemue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me.

A thought: Should we make test_specializations a macro that by default checks Iterator and DoubledEndedIterator (and all other specialized things), and only omits checks them if actively opted-out?

@Philippe-Cholet
Copy link
Member Author

@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.

@Philippe-Cholet Philippe-Cholet added this pull request to the merge queue Dec 7, 2023
Merged via the queue into rust-itertools:master with commit b07b0ad Dec 7, 2023
8 checks passed
@Philippe-Cholet Philippe-Cholet deleted the test-double-ended-specializations branch December 7, 2023 15:53
@Philippe-Cholet Philippe-Cholet added this to the next milestone Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants