Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a range parameter to the extract_if method to match the standard library's Vec::extract_if implementation. This is a breaking change that allows users to specify which range of elements should be considered for extraction.
Key changes:
- Added a
range: impl RangeBounds<usize>parameter toextract_ifmethod - Introduced a new
resolve_rangehelper function to normalize range bounds into concrete start/end indices - Updated the
Retainstruct to support ranged operations with astop_lenfield - Added comprehensive test coverage for ranged extraction scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/lib.rs | Added resolve_range helper function, updated extract_if to accept range parameter, refactored drain to use resolve_range |
| src/retain.rs | Modified Retain struct to support ranges with stop_len field, updated new() to accept range parameter, added early termination logic in next(), implemented FusedIterator for ExtractIf |
| src/tests.rs | Updated existing tests to use .. range, added new test cases for ranged extraction including empty ranges and partial ranges |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5f84e2d to
4d09c04
Compare
This matches the std::vec extract_if implementation
due to breaking change from extract_if parameters
4d09c04 to
53f0eb6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This matches the std::vec extract_if implementation