Skip to main content

fetch

Function fetch 

Source
pub fn fetch<T: Transport>(
    client: &Client<T>,
    request: &OpenMeteoRequest,
    now_s: u64,
) -> Result<(OpenMeteoProfile, Fetched), OpenMeteoError>
Expand description

Fetches request through client and reads it at the request’s time.

The answer comes from the client’s cache while fresh (see OpenMeteoRequest::source); offline, from the cache only. The Fetched says which, carries ATTRIBUTION and holds the body. Only an answer that parses is cached (Client::fetch_checked): one that doesn’t never takes a good copy’s place, and online a stale good copy is returned instead, with the reason.

§Errors

OpenMeteoError::Request for a bad request; OpenMeteoError::Net when the fetch fails, or with NetError::Refused naming what OpenMeteoProfile::parse or OpenMeteoProfile::sounding refused when the only answer there is doesn’t pass them.