-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
EnhancementNew feature or requestNew feature or request
Description
Hi 👋
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: artichoke/artichoke#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 -- artichoke/artichoke@1935c05.
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:
- There is no equivalent of
vec!orSmallVec::from_elemwith a non-constant length. I had to useiter::repeatlike this:Self(iter::repeat(default).take(len).collect())
- There is no
From<Vec<T>>impl, which forces one to go throughvec::IntoItereven if theTinyVecwould be spilled with thisVec.
Metadata
Metadata
Assignees
Labels
EnhancementNew feature or requestNew feature or request