Convert a slice or an array to a Vec in Rust
To create a new vector from a slice:
slice.to_vec();
It works for fixed-size arrays too.
Confusingly, you won't find that method on std::slice documentation page.
All useful slice methods are documented at:
Written by Kornel
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rust
Authors
pornel
132.5K
bobwilliams
1.912K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#