Lokathor / tinyvec

Just, really the littlest Vec you could need. So smol.
https://docs.rs/tinyvec
Apache License 2.0
648 stars 49 forks source link

Add some kind of "into_inner" function to ArrayVec and TinyVec #122

Closed notgull closed 4 years ago

notgull commented 4 years ago

In my program, I use smallvec to collect iterators into arrays. My strategy is:

let my_iterator = { /* ... */ };
let res: [Foobar; 24] = my_iterator.collect::<SmallVec<[Foobar; 24]>>().into_inner().unwrap();

In this scenario, into_inner() returns Result<[Foobar; 24], SmallVec<[Foobar; 24]>>, where Ok(...) is returned if and only if the length is equal to the array capacity.

I would like to use the tinyvec package in this program instead. Is it possible that something close to into_inner() could be implemented on the ArrayVec and TinyVec structures? I would be willing to implement this PR.

Lokathor commented 4 years ago

Yeah, this seems reasonable.