Trait Query

Source
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§

Source

fn get_display_name(&self) -> &Option<String>

Used in logging and included as a label in metrics published by openweathermap_exporter

Source

fn query_params(&self) -> Vec<(&'static str, String)>

Query parameters and values that must be added to API call URL.

Implementors§

Source§

impl Query for City

Queries weather at a city using q={city},{country_code} as described here.

Source§

impl Query for CityId

Queries weather at a city by it’s openweathermap id as described here.

Source§

impl Query for Coord

Queries weather at a geographic location using lat={lat},lon={lon} as described here.