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

Allow the overlapping() function to take ranges by value #76

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

xfbs
Copy link
Contributor

@xfbs xfbs commented Jan 30, 2024

Instead of forcing the user of the overlapping() API to pass a range by reference, which causes the resulting iterator to have a lifetime which depends on this reference, the Borrow trait is used to give the user a choice to use either a reference or pass the range by value. The lifetime of the iterator accordingly depends on which of the two is chosen.

This pull request achieves a similar end as #70, however it does not break the existing API and allows for greater flexibility (giving the user of the API the choice of either passing the range as reference or passing a range by value.

Instead of forcing the user of the API to pass a range by reference,
which causes the resulting iterator to have a lifetime which depends on
this reference, the `Borrow` trait is used to give the user a choice to
use either a reference or pass the range by value. The lifetime of the
iterator accordingly depends on which of the two is chosen.
@jeffparsons
Copy link
Owner

Thanks for this, @xfbs!

@jeffparsons jeffparsons merged commit 8b2ee44 into jeffparsons:master Jan 30, 2024
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.

2 participants