pub struct CacheManager {
pub shaping_cache: MultiLevelCache<ShapingCacheKey, Arc<Vec<u8>>>,
pub glyph_cache: MultiLevelCache<GlyphCacheKey, Arc<Vec<u8>>>,
}Expand description
Centralized cache manager for shaping and glyph caches
Fields§
§shaping_cache: MultiLevelCache<ShapingCacheKey, Arc<Vec<u8>>>§glyph_cache: MultiLevelCache<GlyphCacheKey, Arc<Vec<u8>>>Implementations§
Source§impl CacheManager
impl CacheManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a manager with sensible default sizes
Default capacities are conservative to prevent memory issues:
- Shaping: 10,100 entries (shapes are larger)
- Glyphs: 101,000 entries (individual glyphs are smaller)
Sourcepub fn get_shaped(&self, key: &ShapingCacheKey) -> Option<Arc<Vec<u8>>>
pub fn get_shaped(&self, key: &ShapingCacheKey) -> Option<Arc<Vec<u8>>>
Look up previously shaped text
Sourcepub fn cache_shaped(&self, key: ShapingCacheKey, data: Arc<Vec<u8>>)
pub fn cache_shaped(&self, key: ShapingCacheKey, data: Arc<Vec<u8>>)
Save shaping results for next time
Sourcepub fn get_glyph(&self, key: &GlyphCacheKey) -> Option<Arc<Vec<u8>>>
pub fn get_glyph(&self, key: &GlyphCacheKey) -> Option<Arc<Vec<u8>>>
Find a rendered glyph we cached earlier
Sourcepub fn cache_glyph(&self, key: GlyphCacheKey, data: Arc<Vec<u8>>)
pub fn cache_glyph(&self, key: GlyphCacheKey, data: Arc<Vec<u8>>)
Remember this glyph for future renders
Sourcepub fn report_metrics(&self) -> String
pub fn report_metrics(&self) -> String
Human-readable performance report
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CacheManager
impl !RefUnwindSafe for CacheManager
impl Send for CacheManager
impl Sync for CacheManager
impl Unpin for CacheManager
impl UnsafeUnpin for CacheManager
impl !UnwindSafe for CacheManager
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