-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add some Vec <-> VecDeque documentation #61447
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
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cc2a280
Add some Vec <-> VecDeque documentation
scottmcm 2da4f9a
Apply suggestions from code review
scottmcm 1f4a262
Put the docs on the methods instead of the impls
scottmcm 8da94ef
Apply suggestions from code review
scottmcm 5168f5d
Add hyperlinks to Vec and VecDeque
scottmcm 0150448
Remove the questionably-useful example
scottmcm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What's the motivation for spending so much time worrying about reallocation here?
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.
I think there is a few open issues where people want to know about our allocation strategy for various
From
impls. In other words, people want to know so they are being explicit about it.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.
Basically, the only thing interesting about these two
From
impls is that they can (sometimes) avoid allocations compared to.into_iter().collect()
. So I want to write an example that shows the lack of reallocation, but I also want to write it in such a way that it's a situation where we'd be ok committing to the lack of reallocation. So I want to make an example that doesn't do things like "well, I happen to know that right now it doesn't reallocate if Iwith_capacity(8)
and don't use all the capacity", because I don't want to write text elaborating why those conditions work.I agree this example is far more complicated than most, though, so would be happy to change it.
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.
I don't know if an example is really helpful at all here, if we don't actually want to guarantee anything.
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.
@sfackler Ok, I removed the example from here.