pub trait ImageCacheProxy: Send + Sync {
// Provided methods
fn get(
&mut self,
key: &ImageHash,
source: &ImageSource,
mode: ImageCacheMode,
downscale: Option<ImageDownscale>,
mask: Option<ImageMaskMode>,
) -> ProxyGetResult { ... }
fn data(
&mut self,
key: &ImageHash,
data: &[u8],
image_format: &ImageDataFormat,
mode: ImageCacheMode,
downscale: Option<ImageDownscale>,
mask: Option<ImageMaskMode>,
is_loaded: bool,
) -> Option<ImageVar> { ... }
fn remove(&mut self, key: &ImageHash, purge: bool) -> ProxyRemoveResult { ... }
fn clear(&mut self, purge: bool) { ... }
fn is_data_proxy(&self) -> bool { ... }
}Expand description
A custom proxy in IMAGES.
Implementers can intercept cache requests and redirect to another cache request or returns an image directly.
The methods on this API are synchronous, implementers that do any potential slow processing must output
a loading ImageVar immediately and update it with the finished pixels when ready.
Provided Methods§
Sourcefn get(
&mut self,
key: &ImageHash,
source: &ImageSource,
mode: ImageCacheMode,
downscale: Option<ImageDownscale>,
mask: Option<ImageMaskMode>,
) -> ProxyGetResult
fn get( &mut self, key: &ImageHash, source: &ImageSource, mode: ImageCacheMode, downscale: Option<ImageDownscale>, mask: Option<ImageMaskMode>, ) -> ProxyGetResult
Intercept a get request.
Sourcefn data(
&mut self,
key: &ImageHash,
data: &[u8],
image_format: &ImageDataFormat,
mode: ImageCacheMode,
downscale: Option<ImageDownscale>,
mask: Option<ImageMaskMode>,
is_loaded: bool,
) -> Option<ImageVar>
fn data( &mut self, key: &ImageHash, data: &[u8], image_format: &ImageDataFormat, mode: ImageCacheMode, downscale: Option<ImageDownscale>, mask: Option<ImageMaskMode>, is_loaded: bool, ) -> Option<ImageVar>
Intercept a Data or Static request.
If is_data_proxy also intercept the Read or Download data.
If is_loaded is true the data was read or downloaded and the return var will be bound to an existing var that may already be cached.
If it is false the data was already loaded on the source and the return var will be returned directly, without caching.
Sourcefn remove(&mut self, key: &ImageHash, purge: bool) -> ProxyRemoveResult
fn remove(&mut self, key: &ImageHash, purge: bool) -> ProxyRemoveResult
Intercept a remove request.