Reputation: 49
For a example:
let record: Vec<Vec<char>> = vec![vec!['.'; 10]; 10];
let example: Vec<String> = record.into_iter().into_iter().collect::<String>().collect::<Vec<String>>();
this doesn't work. how to trans record to example.
Upvotes: 0
Views: 289
Reputation: 42776
You need to iterate and collect each of them to a String
:
let example: Vec<String> = record
.iter()
.map(|v| v.iter().collect::<String>())
.collect();
Upvotes: 4