How to represent a type of vec[uint, vec[uint]]

I collect time series Data in [timestamp, [...values]]

How would I tell the rust compiler about its type?

 struct TimeSeries {

        id: String,
        name: String,
        aggregation: Aggregation, // some enum
        length: u32,
        series: Vec[Array[unix_time, Vec[float]]], // help with this

Rust's arrays are for things that have strictly fixed length known at compile time, and all elements of the same type, so probably not applicable here at all.

You could use Vec<SeriesItem> and

struct SeriesItem { unix_time: u64 /* or SystemTime */, data: Vec<f32> }

If you're looking for a type with anonymous fields, then use tuples (u64, Vec<f32>).


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.