Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for Vec::resize #27790
Comments
alexcrichton
added
T-libs
B-unstable
E-easy
labels
Aug 13, 2015
This comment has been minimized.
This comment has been minimized.
|
Nominating for 1.5 FCP discussion. |
aturon
added
the
I-nominated
label
Sep 23, 2015
This comment has been minimized.
This comment has been minimized.
|
This issue is now entering its cycle-long FCP for stabilization in 1.5 |
alexcrichton
added
final-comment-period
and removed
I-nominated
labels
Sep 24, 2015
This comment has been minimized.
This comment has been minimized.
|
The growing part is a "critical" component where we need to grow & zerofill a vector. |
steveklabnik
added this to the 1.5 milestone
Oct 1, 2015
This comment has been minimized.
This comment has been minimized.
|
As bluss said, I'd like either The alternative is cumbersome:
A constructor to create a zeroed out buffer of predefined length would also be useful (Vec::with_capacity(x) doesn't work with |
Manishearth
removed
the
E-easy
label
Oct 2, 2015
This comment has been minimized.
This comment has been minimized.
|
I'd like a one-stop way to do what I have to do now: let mut a = Vec::with_capacity(k);
a.resize(k, x); |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@huonw D'oh, thanks! I honestly spent a long time looking for how to do that and couldn't find it. I just found it at https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html I'm very concerned that I've been having a lot of trouble finding out this kind of information (another problem was finding slice syntax information), because it's embedded in text rather than displayed as a "method". Perhaps there should be bulleted documentation for all syntax and macros in its own section? Is it my fault I don't necessarily read whole paragraphs of text that are classified as "examples"? |
This comment has been minimized.
This comment has been minimized.
|
@dhardy The alternative is cumbersome and for now, much less efficient, I'll point out. |
This comment has been minimized.
This comment has been minimized.
|
@bluss thanks. I didn't realise I could create a vec with |
This comment has been minimized.
This comment has been minimized.
|
I'm a bit worried by all the people that don't find |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Yeah, discovery is hard :/ |
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this today and the decision was to stabilize. |
This comment has been minimized.
This comment has been minimized.
|
No comment on the dual role of growing and shrinking? Why have both? Only the grow part seems useful (and only the grow part is unique to this method). |
This comment has been minimized.
This comment has been minimized.
|
@bluss the dual role was frequently requested. I was personally happy when we just had truncate and whatever the growing version was. shrug |
This comment has been minimized.
This comment has been minimized.
|
I see. |
This comment has been minimized.
This comment has been minimized.
|
fwiw this was accepted in collections reform part 2. See e.g. rust-lang/rfcs#509 (comment) for discussion |
alexcrichton commentedAug 13, 2015
This is a tracking issue for the unstable
vec_resizefeature in the standard library. To the best of my knowledge there's no blocker for this beyond "we should decide to have it or not".cc @Gankro