rust_c02_signal

Crates.iorust_c02_signal
lib.rsrust_c02_signal
version0.1.2
sourcesrc
created_at2023-02-07 10:24:01.202815
updated_at2023-02-07 10:38:58.221124
descriptionRust implementation of the C02 Signal API - Very basic atm
homepage
repositoryhttps://github.com/Threpio/rust_c02Signal
max_upload_size
id778650
size32,965
Theo Andresier (Threpio)

documentation

README

C02 API Basic Rust Implementation

DONE:

  • Basic API implementation
  • Client Format
  • Two C02 request implementations.

TODO:

  • Rate Limitation

  • Support of future Electricity Maps commercial API

Example:

use rust_c02_signal;

async fn do_stuff() -> () {
    let c02client = rust_c02_signal::Client::new("API-KEY".to_string());

    // Get the latest data for a country code
    let resp = c02client.latest_cc("GB".to_string()).await;

    println!("{:?}", resp);

    // Get the latest data for a set of long/lat coords
    let resp = c02client.latest_gc(51.5074, 0.1278).await;

    println!("{:?}", resp);
}
Commit count: 5

cargo fmt