Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: How to convert between Vectors of different types
I would have expected that if I have implemented From<T>
for S
then I get From<Vec<T>>
for Vec<S>
for free. However looking at the From Documentation I find nothing like this. I also cannot implement this myself, because both Vec
and From
are defined externally.
What is the recommended way to convert from Vec<i32>
to Vec<i64>
, say? In this Playground I wrote a custom from
function to illustrate what I want to do. What's annoying is that this way I won't get into
functions for free.
10 posts - 6 participants
🏷️ rust_feed