Playground here:
I need to convert the following example into an array of tuples. The tuples will contain:
- The entire vec
- The first n characters of the vec (in this case, the first two only)
The tuples need to be in an array that goes left to right (first column from all, then second, etc)
let vec1 = vec![vec![1, 1,2,2], vec![3, 3,4,4]];
let vec2 = vec![vec![5, 5,6,6], vec![7, 7,8,8]];
let all = vec![vec1, vec2];
// expected result
let result = [
[
([1,1,2,2], [1,1]),
([5,5,6,6], [5,5])
],
[
([3,3,4,4], [3,3]),
([7,7,8,8], [7,7])
],
];
Sorry, for some reason vectors really confuse me in Rust! Any help is appreciated!