pub struct LocalityWeatherData {
pub device: u8,
pub temperature: f64,
pub humidity: f64,
pub wind_speed: f64,
pub wind_direction: f64,
pub rain_intensity: f64,
pub rain_accumulation: f64,
}Expand description
Locality weather data format
§Example usage
use weather_union::{LocalityId, WeatherUnion};
async fn example(){
let client = WeatherUnion::from_key("api_key".to_string());
let data = client.locality(LocalityId::ZWL001036).await.unwrap(); //Retrieve the data
if data.is_device(){ // confirm returned data is from a device
let is_aws = data.device == 1; // Is the device an automatic weather system?
let is_rgs = data.device == 2; // Is the device a rain gauge system?
let temperature = data.temperature; // query different values like so.
print!("{}", data.wind_speed);
}
}Fields§
§device: u8§temperature: f64§humidity: f64§wind_speed: f64§wind_direction: f64§rain_intensity: f64§rain_accumulation: f64Implementations§
Trait Implementations§
Source§impl Clone for LocalityWeatherData
impl Clone for LocalityWeatherData
Source§fn clone(&self) -> LocalityWeatherData
fn clone(&self) -> LocalityWeatherData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LocalityWeatherData
impl Debug for LocalityWeatherData
impl Copy for LocalityWeatherData
Auto Trait Implementations§
impl Freeze for LocalityWeatherData
impl RefUnwindSafe for LocalityWeatherData
impl Send for LocalityWeatherData
impl Sync for LocalityWeatherData
impl Unpin for LocalityWeatherData
impl UnwindSafe for LocalityWeatherData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more