feat(Itertools): add strip_prefix and strip_prefix_by methods#1104
feat(Itertools): add strip_prefix and strip_prefix_by methods#1104SAY-5 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1104 +/- ##
==========================================
- Coverage 94.38% 94.03% -0.36%
==========================================
Files 48 51 +3
Lines 6665 6657 -8
==========================================
- Hits 6291 6260 -31
- Misses 374 397 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi there, thanks for this. Regarding the API: Currently this only returns Can we - instead of
Returning a bespoke |
|
Makes sense, the failure case is worth exposing. I'll switch the return type to Result<Self, (Self, Self::Item, J::Item, J)> so callers can recover the partially-consumed iterators and the mismatched items. Will push the reworked version shortly. |
Adds
strip_prefixandstrip_prefix_byto theItertoolstrait, the iterator analogue ofstr::strip_prefix, as discussed in #1096.strip_prefixis implemented in terms ofstrip_prefix_by, which takes an equality predicate so the prefix items may differ in type fromSelf::Item. Includes doctests and quickcheck tests that assert parity withstr::strip_prefix.Closes #1096