Skip to main content

ImageFetcher

Type Alias ImageFetcher 

Source
pub type ImageFetcher = fn(&str, Box<dyn FnOnce(Result<Vec<u8>, String>) + Send>);
Expand description

The image stores and the two things a host has to name: a decoder is chosen by the images feature, and the fetcher is registered by whoever has a network. See Image::network. Hands the bytes at url to the callback, once, from wherever suits the platform.

A function pointer and not a closure: this is registered once for the process, and a plain fn needs no allocation, no lifetime and no Sync wrapper to store.