pub struct ColorCache { /* private fields */ }Expand description
Simple hash cache for downgrade results (bounded; clears on overflow).
Implementations§
Source§impl ColorCache
impl ColorCache
Sourcepub fn new(profile: ColorProfile) -> Self
pub fn new(profile: ColorProfile) -> Self
Create a new cache with default capacity (4096 entries).
Sourcepub fn with_capacity(profile: ColorProfile, max_entries: usize) -> Self
pub fn with_capacity(profile: ColorProfile, max_entries: usize) -> Self
Create a new cache with the given maximum entry count.
Sourcepub fn downgrade_rgb(&mut self, rgb: Rgb) -> Color
pub fn downgrade_rgb(&mut self, rgb: Rgb) -> Color
Downgrade an RGB color through the cache, returning the cached result.
Sourcepub fn downgrade_packed(&mut self, color: PackedRgba) -> Color
pub fn downgrade_packed(&mut self, color: PackedRgba) -> Color
Downgrade a PackedRgba color through the cache.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Return current cache statistics.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ColorCache
impl RefUnwindSafe for ColorCache
impl Send for ColorCache
impl Sync for ColorCache
impl Unpin for ColorCache
impl UnsafeUnpin for ColorCache
impl UnwindSafe for ColorCache
Blanket Implementations§
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
Mutably borrows from an owned value. Read more