Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to_smallvec for the slice primitive type #116

Closed
sunjay opened this issue Aug 13, 2018 · 2 comments
Closed

Add to_smallvec for the slice primitive type #116

sunjay opened this issue Aug 13, 2018 · 2 comments

Comments

@sunjay
Copy link

@sunjay sunjay commented Aug 13, 2018

The slice primitive type has a to_vec method which makes it convenient to convert a slice to a vector. It would be great if this crate could define an extension trait that added a method called to_smallvec (or some other name) which did the same thing for SmallVec.

This makes it particularly convenient to port code to using SmallVec since you can just import that extension trait instead of converting all the calls to to_vec. 😃

@gootorov
Copy link

@gootorov gootorov commented Aug 15, 2018

As an alternative, it could be done using SmallVec::from_slice() method.

@sunjay
Copy link
Author

@sunjay sunjay commented Aug 15, 2018

Yes, that's what I'm doing now, but going through and replacing lots of to_vec calls is tedious. It would be nice if it was possible to just find and replace the method call. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.