Crates.io | weathergov |
lib.rs | weathergov |
version | 0.2.1 |
source | src |
created_at | 2018-12-26 18:02:31.791745 |
updated_at | 2019-07-06 14:50:37.494256 |
description | Library that downloads and parses weather information from US government sources |
homepage | |
repository | https://github.com/jimrybarski/weathergov |
max_upload_size | |
id | 103914 |
size | 11,873 |
This is a library for accessing weather data from US government sources. At the moment, it can only retrieve current weather for a given location, though my goal is to add forecast data, and also some methods to help determine which station a given user should use.
fn main() {
match weathergov::get_current_observation("KATT") {
Ok(data) => {
let temperature = match data.temp_c {
Some(d) => format!("{}°C", d.round() as i64),
None => "N/A".to_owned()
};
let weather = data.weather.unwrap_or("N/A".to_owned());
println!("{} {}", weather, temperature);
}
Err(e) => { println!("Error: {:?}", e); }
};
}
This will print something like:
Fair 21°C