pub struct Forecast {
pub region: GridRegion,
pub generated_at: DateTime<Utc>,
pub data: BTreeMap<DateTime<Utc>, f64>,
}Expand description
A forecast of future MOERs.
To get the Moer this forecast predicts at a given time, use
Forecast::at.
Fields§
§region: GridRegionThe grid region for the forecast.
generated_at: DateTime<Utc>The time when the forecast was generated.
data: BTreeMap<DateTime<Utc>, f64>The forecast itself, mapping the start time of each interval to the emissions rate, in kg CO2 / kWh.
Implementations§
Source§impl Forecast
impl Forecast
Sourcepub fn at(&self, time: DateTime<Utc>) -> Option<Moer>
pub fn at(&self, time: DateTime<Utc>) -> Option<Moer>
Return the forecasted Moer for the given time, or None if the
time is not included in the forecast.
Note: because the forecast data returned by the SGIP Signal API does not include explicit end-times, this method treats the start of the next time interval as the end of the previous one, and therefore treats the start of the last time interval as the end of the forecast range.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Forecast
impl<'de> Deserialize<'de> for Forecast
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Forecast
impl RefUnwindSafe for Forecast
impl Send for Forecast
impl Sync for Forecast
impl Unpin for Forecast
impl UnwindSafe for Forecast
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more