Module image_store
Expand description
Async image loading, decode and cache — keyed by URL. Displaying remote
thumbnails on the UI thread would jank every frame, so loads run off the
UI thread — fetched through a caller-supplied Fetcher and decoded as
crate::background::Background jobs, or fetched by the host through a
HostImageLoader — and the decoded peniko::ImageData is cached and
handed back on a later frame; until then the caller paints a placeholder.
No networking here — the toolkit stays HTTP-free, and a no-op fetcher
keeps tests and hermetic offline builds deterministic. Decoding uses the
image crate; cloning a returned ImageData only bumps an Arc.
Structs§
- Host
Image Loader - The loading half of a host-driven
ImageStore. - Image
Completion Ticket - Opaque custody for one admitted asynchronous image decode.
- Image
Store - A cheap-to-clone handle to a shared image cache whose loads run off the
UI thread — on the toolkit’s
BackgroundforImageStore::new, or in the host forImageStore::host_driven.
Functions§
- loads_
in_ flight - Loads in flight (queued or decoding) across every
ImageStorein the process. A screenshot capture waits, within a bound, until this is zero. - paint_
image_ cover - Paint
imgintorectwith acoverfit (fill the rect, preserve aspect, crop the overflow) clipped to a rounded rectangle, matching the shape a procedural placeholder occupied.
Type Aliases§
- Fetcher
- Fetches the raw encoded bytes for a URL, or
Noneon failure. Invoked as background work, so it may block on I/O.