Skip to main content

ImageCache

Struct ImageCache 

Source
pub struct ImageCache { /* private fields */ }
Expand description

Tracks pending, retained, and live image streams. Live images may also occupy the LRU.

Implementations§

Source§

impl ImageCache

Source

pub fn instance(app: &mut App) -> Handle<ImageCache>

The application’s image cache, created on first use.

Source

pub fn put_if_absent( self: Handle<ImageCache>, app: &mut App, key: ImageCacheKey, load: impl FnOnce(&mut App) -> Retained<Handle<ImageStreamCompleter>>, ) -> Retained<Handle<ImageStreamCompleter>>

Shares pending or retained work, starting load only when no entry tracks this key.

Source

pub fn evict( self: Handle<ImageCache>, app: &mut App, key: &ImageCacheKey, ) -> bool

Evicts pending/LRU retention and, by default, live tracking (for invalidating an image).

Source

pub fn evict_with_include_live( self: Handle<ImageCache>, app: &mut App, key: &ImageCacheKey, include_live: bool, ) -> bool

With include_live: false, releases cache retention while preserving reuse by listeners.

Source

pub fn clear(self: Handle<ImageCache>, app: &mut App)

Releases pending listeners and LRU retention; live tracking is preserved.

Source

pub fn clear_live_images(self: Handle<ImageCache>, app: &mut App)

Clears live tracking without detaching consumers’ listeners.

Source

pub fn status_for_key( self: Handle<ImageCache>, app: &App, key: &ImageCacheKey, ) -> ImageCacheStatus

Reports independent pending, LRU, and live membership.

Source

pub fn contains_key( self: Handle<ImageCache>, app: &App, key: &ImageCacheKey, ) -> bool

Whether the key has pending or LRU retention; live-only entries are excluded.

Source

pub fn current_size(self: Handle<ImageCache>, app: &App) -> usize

The number of images retained in the LRU.

Source

pub fn current_size_bytes(self: Handle<ImageCache>, app: &App) -> usize

The decoded bytes charged to LRU entries, excluding live-only images.

Source

pub fn pending_image_count(self: Handle<ImageCache>, app: &App) -> usize

The number of tracked first-frame requests.

Source

pub fn live_decode_count(self: Handle<ImageCache>, app: &App) -> usize

The number of tracked first-frame requests. Use pending_image_count for Flutter’s name.

Source

pub fn live_image_count(self: Handle<ImageCache>, app: &App) -> usize

The number of entries tracked by listener lifetime.

Source

pub fn maximum_size(self: Handle<ImageCache>, app: &App) -> usize

The configured LRU entry limit.

Source

pub fn maximum_size_bytes(self: Handle<ImageCache>, app: &App) -> usize

The configured LRU byte limit.

Source

pub fn set_maximum_size(self: Handle<ImageCache>, app: &mut App, maximum: usize)

Changes the LRU entry budget, clearing pending retention when disabled.

Source

pub fn set_maximum_size_bytes( self: Handle<ImageCache>, app: &mut App, maximum: usize, )

Changes the LRU byte budget, clearing pending retention when disabled.

Trait Implementations§

Source§

impl Default for ImageCache

Source§

fn default() -> ImageCache

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for ImageCache

§

impl !Send for ImageCache

§

impl !Sync for ImageCache

§

impl !UnwindSafe for ImageCache

§

impl Forget for ImageCache

§

impl Freeze for ImageCache
where *const u8 is !null: Freeze, PhantomData<usize>: Freeze, PhantomData<Bucket<ImageCacheKey, PendingImage>>: Freeze, PhantomData<Bucket<ImageCacheKey, CachedImage>>: Freeze, PhantomData<Bucket<ImageCacheKey, LiveImage>>: Freeze,

§

impl Move for ImageCache

§

impl Unpin for ImageCache
where *const u8 is !null: Unpin, Rc<dyn KeyValue>: Unpin, NonZero<u32>: Unpin, Rc<dyn Fn(&mut App, &ImageInfo, bool)>: Unpin, Rc<dyn Fn(&mut App, &ImageChunkEvent)>: Unpin, Rc<dyn Fn(&mut App, &ImageDecodeError)>: Unpin, Rc<Cell<bool>>: Unpin, Rc<Keep>: Unpin, Rc<dyn Fn(&mut App)>: Unpin, *const (): Unpin,

§

impl UnsafeUnpin for ImageCache
where *const u8 is !null: UnsafeUnpin, PhantomData<usize>: UnsafeUnpin, PhantomData<Bucket<ImageCacheKey, PendingImage>>: UnsafeUnpin, PhantomData<Bucket<ImageCacheKey, CachedImage>>: UnsafeUnpin, PhantomData<Bucket<ImageCacheKey, LiveImage>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>