-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 MutableVector::mut_split(self, pred) -> DoubleEndedIterator<&mut [T]> #10757
Conversation
Sorry, I rebased before seeing @cmr r+ |
The tests are buggy, they don't compile. I'll correct that when I can. |
I would expect Is there a common use case for an iterator like this? |
I was also a little confused when reading the documentation about whether the element the predicate is run on is included in the slice of the iterator or not (I think this needs some more explicit working in the function documentation). |
@alexcrichton The However, given the fact that there are multiple ways you could split a slice: At an index, at places where a predicate holds, at chars for strings etc, it is indeed uncertain how the API should look, and what name to give the functions - that seems like a broader issue though. Short term, making As an aside, I'm planning to improve and unify the string API for finding a contained pattern in general, and would then likely try to port whatever I come up with to vectors. |
for For the documentation, it's the same as I needed this iterator during my |
Tests fixed (pass here) and split doc clarified. |
@alexcrichton Remarks? OK? |
looks good to me, could you squash the last two commits together? |
…[T]> This method is the mutable version of ImmutableVector::split. It is a DoubleEndedIterator, making mut_rsplit irrelevent. The size_hint method is not optimal because of rust-lang#9629. At the same time, clarify *split* iterator doc.
@alexcrichton squashed. |
I've renamed `MutableVector::mut_split(at)` to `MutableVector::mut_split_at(at)` to be coherent with ImmutableVector. As specified in the commit log, The `size_hint` method is not optimal because of #9629.
Add missing word "are" changelog: none
I've renamed
MutableVector::mut_split(at)
toMutableVector::mut_split_at(at)
to be coherent with ImmutableVector. As specified in the commit log, Thesize_hint
method is not optimal because of #9629.