-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Improved examples on Vec documentation #18254
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
Conversation
areski
commented
Oct 23, 2014
- shrink_to_fit example is now more clear by asserting the capacity value
- annotation [0, mid) changed for [0, mid]
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon. |
An assert of the capacity will work right now, but there's no guarantee that it will drop all the way down to the length in the future. It will drop down as close as possible to the length but the allocator may still inform the vector that there is space for a few more elements. |
/// the index `mid` itself) and the second will contain all | ||
/// indices from `[mid, len)` (excluding the index `len` itself). | ||
/// indices from `[mid, len]` (excluding the index `len` itself). |
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.
why is this line changed? If it's exclusive, it should be a ).
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.
Thanks I removed this now, I thought it was a mistake in the annotation
- shrink_to_fit example is now more clear by asserting the capacity value
c5a5f5e
to
fe6847a
Compare
@thestinger thanks for the clarification, then we can dismiss this PR and just add your comment after the line "Shrinks the capacity of the vector as much as possible." |
@areski do you want to update this PR with @thestinger's comment? |
… as close as possible but not to the minimun
@alexcrichton I just updated the Pr with the feedback, let me know |
…hton - shrink_to_fit example is now more clear by asserting the capacity value - annotation [0, mid) changed for [0, mid]
fix: Nail destructuring assignment once and for all