openmeteo-rs 1.0.0

Rust client for the Open-Meteo weather API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use openmeteo_rs::{Client, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let client = Client::new();
    let elevations = client
        .elevation([(52.52, 13.41), (47.3769, 8.5417)])
        .await?;

    for (name, elevation) in ["Berlin", "Zurich"].iter().zip(elevations) {
        match elevation {
            Some(elevation) => println!("{name}: {elevation} m"),
            None => println!("{name}: no elevation coverage"),
        }
    }

    Ok(())
}