Skip to content

Conversation

aliblong
Copy link
Contributor

@aliblong aliblong commented Dec 4, 2014

Part of #18424

Inspired by #19216

Adds functions for reserving capacity to Vec & VecMap, as per the collections reform. Also adds a capacity() function to VecMap.

The build fails the evec-in-struct debuginfo-gdb test (in my build environment at least), and I have no idea why. I asked around on IRC and Reddit, but didn't get a response.

@alexcrichton
Copy link
Member

The addition of the reserve_index and reserve_index_exact new methods on Vec may actually require a new RFC to add. Recently @aturon and @gankro did some awesome work to create a consistent story for all our collections, and this story currently doesn't include these methods. Could you move these changes to a separate PR? You may also want to discuss with @aturon or @gankro on IRC beforehand to talk about rationale and such.

The addition of the standard capacity, reserve, and reserve_exact functions on VecMap seem great though, and I'd love to whisk them through to bors quickly!

@aliblong
Copy link
Contributor Author

aliblong commented Dec 4, 2014

Okay, I'll resubmit a separate PR for each.

@Gankra
Copy link
Contributor

Gankra commented Dec 4, 2014

reserve and reserve_exact don't super make sense on VecMap, because VecMap's capacity isn't really bound by number of elements. All that matters is that you have space for the largest index you store. Hence reserve_index.

But yes I'm working on an RFC for this.

@aliblong
Copy link
Contributor Author

aliblong commented Dec 4, 2014

@gankro Yeah, it was my thought that reserve_index made more sense. I still submitted #19523 with regular reserve at @alexcrichton's request. I will await the RFC for reserve_index :)

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.

3 participants