pub trait Query:
Debug
+ Display
+ Send
+ Sync {
// Required methods
fn get_display_name(&self) -> &Option<String>;
fn query_params(&self) -> Vec<(&'static str, String)>;
}Expand description
Abstraction of a query against the OpenWeatherMap API.
Required Methods§
Sourcefn get_display_name(&self) -> &Option<String>
fn get_display_name(&self) -> &Option<String>
Used in logging and included as a label in metrics published by openweathermap_exporter
Sourcefn query_params(&self) -> Vec<(&'static str, String)>
fn query_params(&self) -> Vec<(&'static str, String)>
Query parameters and values that must be added to API call URL.
Implementors§
impl Query for City
Queries weather at a city using q={city},{country_code} as described here.
impl Query for CityId
Queries weather at a city by it’s openweathermap id as described here.
impl Query for Coord
Queries weather at a geographic location using lat={lat},lon={lon} as described here.