-
Notifications
You must be signed in to change notification settings - Fork 150
Docs, code cleanup, and misc. fixes for smallvec #40
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
c0f6ad0
to
3ac0159
Compare
@@ -130,13 +150,45 @@ impl<A: Array> Drop for SmallVecData<A> { | |||
} | |||
} | |||
|
|||
|
|||
/// A Vec-like that can store a small number of elements inline. |
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.
`Vec`-like
@@ -245,6 +310,9 @@ impl<A: Array> SmallVec<A> { | |||
} | |||
} | |||
|
|||
/// Reserve capacity for at least `additional` more elements to be inserted. | |||
/// | |||
/// May reserve more space to avoid frequent reallocations. |
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.
Maybe make a note about overflow behaviour. In particular, it is not safe to assume that you can actually fit additional
new elements in it!
if self.spilled() && self.capacity() > len { | ||
if len <= self.inline_size() { | ||
unsafe { | ||
let (ptr, capacity) = match &self.data { |
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 borrow self.data
?
@bors-servo r=Ms2ger
|
📌 Commit 7ca4463 has been approved by |
⚡ Test exempted - status |
Docs, code cleanup, and misc. fixes for smallvec <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/40) <!-- Reviewable:end -->
This change is