fitzgen / bumpalo

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

Add collect_in for iterators #86

Closed cuviper closed 4 years ago

cuviper commented 4 years ago

Inspired by Iterator::collect and FromIterator, this adds extension trait BumpIterator with collect_in, using a new FromIteratorIn trait for collections to implement.

This unifies the existing inherent from_iter_in methods in each container, and also allows generic tricks like collecting Result or Option with short-circuiting.

cuviper commented 4 years ago

This is a draft because it lacks testing, but I'd like feedback on the idea before I spend more time on it.

cuviper commented 4 years ago

That's fine, this was just a passing idea on my part. I don't have the energy to drive ecosystem changes around this.

It's not clear to me whether your hesitance is leaning yes/no, but I'll just close for now. Maybe someone else will come along and argue that they really need it, and then it can always be revived...

fitzgen commented 4 years ago

Yes, I think closing is the right choice. I do appreciate you exploring this though!

I don't have the energy to drive ecosystem changes around this.

Yeah, I don't really have that energy either. I hope someone does sometime!