pub struct ImageCacheKey(/* private fields */);Expand description
What identifies an image in the cache. Flutter’s answer from ImageProvider.obtainKey.
A provider makes one out of a value of its own — an asset’s name and scale, the buffer bytes live in — and two keys match when their concrete types and values match. Anything that changes the decoded pixels belongs in that value, the scale included. Clones compare identical even for a non-reflexive value such as a NaN scale, matching Dart’s map identity check; distinct keys then use their values’ equality and compatible hashes.
Implementations§
Source§impl ImageCacheKey
impl ImageCacheKey
Sourcepub fn new<K>(value: K) -> ImageCacheKey
pub fn new<K>(value: K) -> ImageCacheKey
Creates a key out of whatever a provider uses to tell its images apart.
Values must have stable, symmetric, transitive equality and equal values must hash alike. Identity makes this wrapper reflexive even when a value contains NaN.
Sourcepub fn downcast_ref<K>(&self) -> Option<&K>where
K: 'static,
pub fn downcast_ref<K>(&self) -> Option<&K>where
K: 'static,
Reads the provider’s resolved key when loading. A different key type returns None.
Trait Implementations§
Source§impl Clone for ImageCacheKey
impl Clone for ImageCacheKey
Source§fn clone(&self) -> ImageCacheKey
fn clone(&self) -> ImageCacheKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ImageCacheKey
impl Debug for ImageCacheKey
impl Eq for ImageCacheKey
Source§impl Hash for ImageCacheKey
impl Hash for ImageCacheKey
Auto Trait Implementations§
impl !RefUnwindSafe for ImageCacheKey
impl !Send for ImageCacheKey
impl !Sync for ImageCacheKey
impl !UnwindSafe for ImageCacheKey
impl Forget for ImageCacheKey
impl Freeze for ImageCacheKey
impl Move for ImageCacheKey
impl Unpin for ImageCacheKey
impl UnsafeUnpin for ImageCacheKeywhere
*const RcInner<dyn KeyValue> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn KeyValue>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.