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

`From<Vec<T>>` impl for `TinyVec` #135

Open lopopolo opened 3 years ago

lopopolo commented 3 years ago

Hi :wave:

I maintain a crate that abstracts over growable vectors such that they would be appropriate for implementing a Ruby Array. This crate had backends for Vec and SmallVec. Yesterday I added a backend for TinyVec.

PR is here: https://github.com/artichoke/artichoke/pull/1094.

I based the TinyVec backend on the existing backend for SmallVec. Apart from adding a boatload of T: Default bounds, the change was actually really small -- https://github.com/artichoke/artichoke/commit/1935c0543a9c26176494377da8c351a66a181eca.

I appreciated the increased API compatibility with Vec compared to SmallVec, in particular a splice method, which let me simplify several methods.

There were two things I was missing:

Lokathor commented 3 years ago

Those both sound useful.

The impl sounds easy, but the macro one might be harder to slot in because we've already got quite a few macro arms, but you could probably fit it in.