jnioche / carbonintensity-api

A simple Rust library to retrieve data from https://api.carbonintensity.org.uk/
Apache License 2.0
9 stars 0 forks source link

Improve outputs for date ranges #2

Closed jnioche closed 10 months ago

jnioche commented 10 months ago

We currently return the whole RegionData

pub struct RegionData {
    regionid: i32,
    dnoregion: Option<String>,
    shortname: String,
    postcode: Option<String>,
    data: Vec<Data>,
}

including the GenerationMix which is pretty verbose. The dates are also returned as strings, which takes further processing.

If #3 gets implemented we would also need to merge the outputs from individual calls into a single output.

jnioche commented 10 months ago

We now return Vec<(NaiveDateTime, i32) Easier to read, easier to integrate in another process