Building an array of tuples


#1

I’m trying to build an array of tuples from a deserialized json structure to pass to textplot however, I just don’t know how to achieve this in Rust. More details are in the comments on the gist.

Thanks in advance for any help, the Rust community is probably the friendliest I’ve ever seen.


#2

You don’t need an actual array for textplot - you just need a slice. Here is your playground with some ideas of how to get a Vec<(f32, f32)>. You can then deref coerce these Vecs to &[(f32, f32)] and feed them to textplot.


#3

Thank you so much. Now I’m off to read up on iter, enumerate, map and collect.