#signal #basic #api #maps #commercial #electricity #c02

bin+lib rust_c02_signal

Rust implementation of the C02 Signal API - Very basic atm

3 releases

0.1.2 Feb 7, 2023
0.1.1 Feb 7, 2023
0.1.0 Feb 7, 2023

#7 in #commercial

MIT license

10KB
93 lines

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);
}

Dependencies

~6–22MB
~294K SLoC