2个不稳定版本
| 0.2.0 | 2022年10月20日 | 
|---|---|
| 0.1.0 | 2022年8月8日 | 
#36 in #price
14KB
203 代码行
awattar-api – awattar价格API的Rust客户端
这个包是awattar价格API的客户端。
这个包的API目前不被认为是稳定的,未来版本可能会发生变化。
使用方法
有关完整示例,请查看examples/目录。
将awattar-api添加到你的依赖项
[dependencies]
awattar-api = "0.2.0"
查询价格很简单
use awattar_api::*;
use chrono::Utc;
#[tokio::main]
async fn main() {
    let date = Utc::today().naive_local();
    let prices = PriceData::query_date(AwattarZone::Germany, date)
        .await
        .unwrap();
    for slot in prices.slots_iter() {
        println!(
            "{} - {}: {:.02} €/kWh",
            slot.start(),
            slot.end(),
            slot.price_cents_per_mwh() as f32 / 100_000.00
        );
    }
}
许可证
此包采用MIT许可证。
依赖项
~5–21MB
~274K SLoC