How can I initialize new Vector using the vec!
macro and automatically fill it up with values from an existing array? Here's the code example:
let a = [10, 20, 30, 40]; // a plain array
let v = vec![??]; // TODO: declare your vector here with the macro for vectors
What can I fill in (syntax wise) instead of the ???
characters?
Vec
implementsFrom<[T; N]>
.let v = a.to_vec();
vec![]
can't create a new Vec from a Slice.