pub trait ImageCache: 'static {
// Required method
fn load(
&mut self,
resource: &Resource,
window: &mut Window,
cx: &mut App,
) -> Option<Result<Arc<RenderImage>, ImageCacheError>>;
}Expand description
An object that can handle the caching and unloading of images. Implementations of this trait should ensure that images are removed from all windows when they are no longer needed.
Required Methods§
Sourcefn load(
&mut self,
resource: &Resource,
window: &mut Window,
cx: &mut App,
) -> Option<Result<Arc<RenderImage>, ImageCacheError>>
fn load( &mut self, resource: &Resource, window: &mut Window, cx: &mut App, ) -> Option<Result<Arc<RenderImage>, ImageCacheError>>
Load an image given a resource returns the result of loading the image if it has finished loading, or None if it is still loading