#[non_exhaustive]pub struct OpenMeteoRequest {
pub latitude_deg: f64,
pub longitude_deg: f64,
pub time_unix_s: i64,
pub api: OpenMeteoApi,
pub model: Option<String>,
pub endpoint: Option<String>,
}Expand description
What to ask Open-Meteo for: a place, a time and an API.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.latitude_deg: f64Latitude, degrees north, in [-90, 90].
longitude_deg: f64Longitude, degrees east, in [-180, 180].
time_unix_s: i64The launch time, seconds since the Unix epoch (UTC), from 1970 to the year 9999.
api: OpenMeteoApiThe API asked.
model: Option<String>A weather model by Open-Meteo’s name (for example "gfs_seamless"); None lets it choose
the best for the place. Letters, digits and _ only.
endpoint: Option<String>Another server’s endpoint in place of OpenMeteoApi::endpoint, for a self-hosted
Open-Meteo; None for Open-Meteo’s own. It must hold no ? or #.
Implementations§
Source§impl OpenMeteoRequest
impl OpenMeteoRequest
Sourcepub fn new(
latitude_deg: f64,
longitude_deg: f64,
time_unix_s: i64,
api: OpenMeteoApi,
) -> Self
pub fn new( latitude_deg: f64, longitude_deg: f64, time_unix_s: i64, api: OpenMeteoApi, ) -> Self
A request to Open-Meteo’s own servers, with the model left to them.
Sourcepub fn url(&self) -> Result<String, OpenMeteoError>
pub fn url(&self) -> Result<String, OpenMeteoError>
The URL that asks for the two whole hours around the launch time: the hour at or before it and the one after.
The URL is the cache key, so it writes each coordinate to 5 decimals, trailing zeros
dropped and -0 as 0, as crate::elevation does: a site given to 8 decimals or fewer
and rebuilt from radians (−106.91° can come back as −106.91000000000001) finds its saved
answer. Rounding moves the point asked for by at most 0.6 m. The finest grids among
Open-Meteo’s models are about 1 km (MET Nordic’s; its model list,
https://open-meteo.com/en/docs, read 2026-10-06): the shift is over a thousand times
smaller than the spacing of the points the answer comes from.
§Errors
OpenMeteoError::Request when a field is outside the range its doc gives.
Trait Implementations§
Source§impl Clone for OpenMeteoRequest
impl Clone for OpenMeteoRequest
Source§fn clone(&self) -> OpenMeteoRequest
fn clone(&self) -> OpenMeteoRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpenMeteoRequest
impl Debug for OpenMeteoRequest
Source§impl<'de> Deserialize<'de> for OpenMeteoRequest
impl<'de> Deserialize<'de> for OpenMeteoRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for OpenMeteoRequest
impl PartialEq for OpenMeteoRequest
Source§fn eq(&self, other: &OpenMeteoRequest) -> bool
fn eq(&self, other: &OpenMeteoRequest) -> bool
self and other values to be equal, and is used by ==.