fitzgen / bumpalo

A fast bump allocation arena for Rust
https://docs.rs/bumpalo
Apache License 2.0
1.43k stars 112 forks source link

Add `collect_in` for iterators. #12

Closed richard-uk1 closed 4 years ago

richard-uk1 commented 5 years ago

This adds an extension trait for a new iterator method collect_in, that allows using collect on a bump allocator.

I've made the PR to stimulate discussion, it didn't take very long so feel free to reject if you feel it doesn't fit.

richard-uk1 commented 5 years ago

Just out of interest, how will the new collections in std work? Will they take an allocator? Is there some documentation I can read?

fitzgen commented 5 years ago

Just out of interest, how will the new collections in std work? Will they take an allocator? Is there some documentation I can read?

It isn't 100% clear yet (will probably require a new RFC to sort it all out) but the few bits of std::collections that are parameterised over an allocator have additional constructors for passing the allocator in by reference.

richard-uk1 commented 5 years ago

Aa I see, so we can replace this when the time comes. I'll just do the tidying up you've suggested.

fitzgen commented 4 years ago

Going to close this due to inactivity -- @derekdreery if you want to rebase and do the tidying up mentioned above, I'll be happy to reopen and merge in the future!