Implement reserve_len and reserve_len_exact for VecMap#20143
Implement reserve_len and reserve_len_exact for VecMap#20143bors merged 1 commit intorust-lang:masterfrom
reserve_len and reserve_len_exact for VecMap#20143Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @gankro |
src/libcollections/vec_map.rs
Outdated
There was a problem hiding this comment.
I settled on the following wording in BitvSet:
/// Reserves capacity for the given `BitvSet` to contain `len` distinct elements. In the case
/// of `BitvSet` this means reallocations will not occur as long as all inserted elements
/// are less than `len`.
///
/// The collection may reserve more space to avoid frequent reallocations.
I worded this to clarify "why len" and future-proof for a possible future where Vec and RingBuf get it. Willing to bikeshed on it, though.
There was a problem hiding this comment.
So then would the correct wording for VecMap be to change the first sentence to
"Reserves capacity for the given VecMap to contain len distinct elements..." and then keep the rest of what I had, or should the second sentence be changed to mirror BitvSet too? Can't quite tell what would make sense
There was a problem hiding this comment.
Yeah s/BitvSet/VecMap; they have basically the same semantics (the high-level documentation even suggests that BitvSet is basically VecSet).
|
Only issue is the method description bikeshed. |
|
Also for posterity, |
13f8241 to
8e7faaa
Compare
|
Method descriptions fixed. |
8e7faaa to
868acdf
Compare
|
Alright, take 3! |
Implement `reserve_len` and `reserve_len_exact` for `VecMap` in accordance with rust-lang/rfcs#509.
Implement
reserve_lenandreserve_len_exactforVecMapin accordance with rust-lang/rfcs#509.