Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIs there a way to convert a SmallVec<A> into an A? #85
Comments
|
For comparison, Note that this may not be any faster than copying, since it still needs to move the inner array in order to return it, and a move involves a memcpy. |
Merged
bors-servo
added a commit
that referenced
this issue
Aug 13, 2018
Add into_inner Converts a SmallVec into an array, provided the SmallVec has not been spilled to the heap. Addresses #85. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/115) <!-- Reviewable:end -->
|
Fixed by #115. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have need for a variable-length array that is almost always exactly length 32 -- so I'd like to represent it as a
SmallVec<[T; 32]>. I'd like to convert it to a[T; 32]without copying. It would be cool to add a method that can try doing the conversion if possible and returns the originalSmallVecif it didn't work out:What do you think?