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

feat: contains_many and simplify works with iter of V not just &V #179

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

Eh2406
Copy link
Member

@Eh2406 Eh2406 commented Jan 12, 2024

contains takes a &V, because if you haven't owned V (even behind the smart pointer Box/Arc/Cow) it is easy to add a &. So contains_many copied that interface and takes an iterator of Item = &V. Unfortunately, if you have an iterator of Item = V (or Item = Box/Arc/Cow of V) it is not straightforward to get a reference.

This came up in the context of semver-pubgrub, whose implementation of contains needs to ignore the BuildMetadata part of the semver version. I will be investigating if there are ways to work around this by expressing =x.y.z.pre as >=x.y.z.pre, <x.y.z.pre.0. But even if semver-pubgrub does not need this functionality it doesn't hurt to make contains_many more flexible.

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

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

Looks good to me. Maybe @konsti would be interested too.

@Eh2406
Copy link
Member Author

Eh2406 commented Feb 2, 2024

I rebased which required some intervention due to #183. So while I was looking at it I noticed that we had not made the symmetric change for simplify. So I added that as well. I will give some time for re-review due to the substantive changes.

@Eh2406 Eh2406 changed the title feat: contains_many works with iter of V not just &V feat: contains_many and simplify works with iter of V not just &V Feb 2, 2024
@Eh2406 Eh2406 added this pull request to the merge queue Feb 2, 2024
Merged via the queue into dev with commit a23e746 Feb 2, 2024
5 checks passed
@Eh2406 Eh2406 deleted the jf/check_v branch February 2, 2024 19:51
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.

3 participants