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

Add iter_mut to Ranges #33

Closed
wants to merge 1 commit into from
Closed

Add iter_mut to Ranges #33

wants to merge 1 commit into from

Conversation

charliermarsh
Copy link
Member

No description provided.

@konstin
Copy link
Member

konstin commented Nov 4, 2024

This is risky because the caller needs to keep up the invariants (order of bounds, unbounded only at the ends). This doesn't mean we can't do this, but we need to add it to the docstring.

Can you describe what you're using it for? Maybe i can find a save abstraction.

@charliermarsh
Copy link
Member Author

@konstin -- I'm using it here to remove a special sentinel from versions before showing them to the user. Would love help.

konstin added a commit that referenced this pull request Nov 5, 2024
@konstin konstin mentioned this pull request Nov 5, 2024
konstin added a commit to pubgrub-rs/pubgrub that referenced this pull request Nov 8, 2024
Add a method to construct ranges from an iterator of arbitrary segments. This allows to `.collect()` an iterator of tuples of bounds. This is more ergonomic than folding the previous ranges with the next segment each time, and also faster.

Split out from #273
Closes astral-sh#33
Fixes #249
konstin added a commit to pubgrub-rs/pubgrub that referenced this pull request Nov 8, 2024
Add a method to construct ranges from an iterator of arbitrary segments. This allows to `.collect()` an iterator of tuples of bounds. This is more ergonomic than folding the previous ranges with the next segment each time, and also faster.

Split out from #273
Closes astral-sh#33
Fixes #249
konstin added a commit to pubgrub-rs/pubgrub that referenced this pull request Nov 8, 2024
Add a method to construct ranges from an iterator of arbitrary segments. This allows to `.collect()` an iterator of tuples of bounds. This is more ergonomic than folding the previous ranges with the next segment each time, and also faster.

Split out from #273
Closes astral-sh#33
Fixes #249
konstin added a commit to pubgrub-rs/pubgrub that referenced this pull request Nov 8, 2024
Add a method to construct ranges from an iterator of arbitrary segments. This allows to `.collect()` an iterator of tuples of bounds. This is more ergonomic than folding the previous ranges with the next segment each time, and also faster.

Split out from #273
Closes astral-sh#33
Fixes #249
konstin added a commit to pubgrub-rs/pubgrub that referenced this pull request Nov 14, 2024
Add a method to construct ranges from an iterator of arbitrary segments. This allows to `.collect()` an iterator of tuples of bounds. This is more ergonomic than folding the previous ranges with the next segment each time, and also faster.

Split out from #273
Closes astral-sh#33
Fixes #249
github-merge-queue bot pushed a commit to pubgrub-rs/pubgrub that referenced this pull request Nov 14, 2024
* Add `FromIter` for `Ranges`

Add a method to construct ranges from an iterator of arbitrary segments. This allows to `.collect()` an iterator of tuples of bounds. This is more ergonomic than folding the previous ranges with the next segment each time, and also faster.

Split out from #273
Closes astral-sh#33
Fixes #249

* Fix ascii art alignment

* Fix algorithm with new proptest

* Sorting comment

* Review
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