-
Notifications
You must be signed in to change notification settings - Fork 185
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 Vec::drain
and String::drain
.
#444
Conversation
could you add tests? |
src/vec/drain.rs
Outdated
pub(super) tail_len: usize, | ||
/// Current remaining range to remove | ||
pub(super) iter: slice::Iter<'a, T>, | ||
pub(super) vec: NonNull<Vec<T, N>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this was built on top of #425 this would allow removing the const N: usize
generic, and replace the pointer with NonNull<VecView<T>>
. #425 does not offer the View
functionality for String
to keep the PR small, but it would be easy to add it.
It is worth considering because merging this PR and releasing before merging #425 would make it a breaking change to remove the const generic, so there would need to be 2 implementation of drain
, one for the view and one for the owned type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree it makes sense to base this on VecView
instead.
d342c97
to
49e98f2
Compare
I can't quite figure out the |
29e1279
to
7d96cd2
Compare
rebased it for you on top of the new VecView impl. |
@Dirbaio, thanks! |
Closes #334 and #365.