weather-underground

Crates.ioweather-underground
lib.rsweather-underground
version0.1.3
sourcesrc
created_at2020-10-07 15:07:22.220547
updated_at2022-06-16 07:44:22.675487
descriptionWeather Underground parser library
homepagehttps://github.com/jdrouet/weather-underground
repositoryhttps://github.com/jdrouet/weather-underground
max_upload_size
id296998
size138,827
Jérémie Drouet (jdrouet)

documentation

README

Weather underground library

A simple library to parse responses from weather underground api.

Installation

[dependencies]
weather-underground = "0.1"

Usage

use std::convert::TryFrom;
use std::time::Duration;
use weather_underground as wu;

async {
    let client = wu::create_client(Duration::from_secs(2)).unwrap();
    let api_key = wu::fetch_api_key(&client).await.unwrap();
    let unit = wu::Unit::Metric;
    let result = wu::fetch_observation(&client, api_key.as_str(), "IPARIS18204", &unit).await.unwrap();
    if let Some(response) = result {
        let response = wu::ObservationResponse::try_from(response).unwrap();
        println!("response: {:?}", response);
    } else {
        println!("no data from server");
    }
};
Commit count: 14

cargo fmt