Skip to content

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

Merged
merged 2 commits into from
Oct 28, 2014

Conversation

areski
Copy link
Contributor

@areski 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]

@rust-highfive
Copy link
Contributor

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.

@thestinger
Copy link
Contributor

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).
Copy link
Member

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 ).

Copy link
Contributor Author

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
@areski areski force-pushed the pr-fix-vec-doc-example branch from c5a5f5e to fe6847a Compare October 23, 2014 14:46
@areski
Copy link
Contributor Author

areski commented Oct 23, 2014

@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."

@alexcrichton
Copy link
Member

@areski do you want to update this PR with @thestinger's comment?

… as close as possible but not to the minimun
@areski
Copy link
Contributor Author

areski commented Oct 27, 2014

@alexcrichton I just updated the Pr with the feedback, let me know

bors added a commit that referenced this pull request Oct 28, 2014
…hton

- shrink_to_fit example is now more clear by asserting the capacity value
- annotation [0, mid) changed for [0, mid]
@bors bors closed this Oct 28, 2014
@bors bors merged commit a446b68 into rust-lang:master Oct 28, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Oct 29, 2024
fix: Nail destructuring assignment once and for all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants