pub trait ForecastSource:
Debug
+ Send
+ Sync {
// Required methods
fn carbon_intensity_forecast(
&self,
region: &str,
hours: usize,
) -> Result<Vec<CarbonForecast>>;
fn energy_price_forecast(
&self,
region: &str,
hours: usize,
) -> Result<Vec<EnergyPriceForecast>>;
}Expand description
Supplies real carbon-intensity and energy-price forecasts for
EnvironmentalMonitor::optimize_scheduling.
Implementations are expected to already hold (or synchronously look up)
this data – e.g. from a cache a caller-owned background task keeps
refreshed from a real grid-carbon-intensity API (WattTime,
Electricity Maps, …) or a utility’s spot-price feed – since
EnvironmentalMonitor performs no network I/O of its own. Without one
attached, EnvironmentalMonitor::optimize_scheduling fails with
EnvironmentalMonitorError::NotConfigured instead of fabricating a
forecast.
Required Methods§
Sourcefn carbon_intensity_forecast(
&self,
region: &str,
hours: usize,
) -> Result<Vec<CarbonForecast>>
fn carbon_intensity_forecast( &self, region: &str, hours: usize, ) -> Result<Vec<CarbonForecast>>
Real carbon-intensity forecast for region, one entry per hour for
the next hours hours.
Sourcefn energy_price_forecast(
&self,
region: &str,
hours: usize,
) -> Result<Vec<EnergyPriceForecast>>
fn energy_price_forecast( &self, region: &str, hours: usize, ) -> Result<Vec<EnergyPriceForecast>>
Real energy-price forecast for region, one entry per hour for the
next hours hours.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".