Skip to main content

fetched

Function fetched 

Source
pub fn fetched(
    url: &str,
    decode: fn(&[u8]) -> Result<ImageData, String>,
) -> Fetched
Expand description

The image stores, for an application that loads its own pictures or sizes the cache. What is known about the image at url, starting the fetch if this is the first ask.

Called from a view, which runs every frame: the first call starts the work and says Loading, and every later one is a lookup. That is what makes it safe to write in a view at all — a fetch per frame would be sixty requests a second for one picture.

A failure is remembered like any other, and for the same reason as milestone 372’s: a URL that 404s will 404 again, and retrying every frame turns one bad link into a permanent load on somebody’s server.