pub struct TextShapingCache { /* private fields */ }Expand description
Bounded DPI-independent text shaping and line-break cache split cleanly from the bitmap GlyphAtlas.
Implementations§
Source§impl TextShapingCache
Split shaping & line-break caching, independent font-chain invalidation, and bounded LRU eviction for TextShapingCache.
impl TextShapingCache
Split shaping & line-break caching, independent font-chain invalidation, and bounded LRU eviction for TextShapingCache.
Sourcepub fn with_budget(budget_bytes: usize) -> Self
pub fn with_budget(budget_bytes: usize) -> Self
Sourcepub fn set_memory_budget(&mut self, max_bytes: usize)
pub fn set_memory_budget(&mut self, max_bytes: usize)
Updates the resident byte budget and immediately evicts cold entries if currently over budget.
§Arguments
&Self- Mutable shaping cache.usize- New maximum resident bytes.
Sourcepub fn invalidate_font_chain(&mut self, new_revision: u64) -> bool
pub fn invalidate_font_chain(&mut self, new_revision: u64) -> bool
Sourcepub fn get_or_shape<F>(
&mut self,
key: TextShapingKey,
shape_fn: F,
) -> &ShapedGlyphRun
pub fn get_or_shape<F>( &mut self, key: TextShapingKey, shape_fn: F, ) -> &ShapedGlyphRun
Sourcepub fn get_or_break_lines<F>(
&mut self,
key: LineBreakKey,
break_fn: F,
) -> &TextLayoutResultwhere
F: FnOnce() -> TextLayoutResult,
pub fn get_or_break_lines<F>(
&mut self,
key: LineBreakKey,
break_fn: F,
) -> &TextLayoutResultwhere
F: FnOnce() -> TextLayoutResult,
Sourcepub fn evict_if_over_budget(&mut self)
pub fn evict_if_over_budget(&mut self)
Evicts coldest entries whenever current resident bytes exceed the configured budget.
§Arguments
&Self- Mutable shaping cache.
Sourcepub fn total_entries(&self) -> usize
pub fn total_entries(&self) -> usize
Source§impl TextShapingCache
impl TextShapingCache
pub fn get_budget_bytes(&self) -> usize
pub fn get_mut_budget_bytes(&mut self) -> &mut usize
pub fn set_budget_bytes(&mut self, val: usize) -> &mut Self
pub fn get_resident_bytes(&self) -> usize
pub fn get_font_chain_revision(&self) -> u64
pub fn get_shaping_hits(&self) -> u64
pub fn get_shaping_misses(&self) -> u64
pub fn get_line_break_hits(&self) -> u64
pub fn get_line_break_misses(&self) -> u64
pub fn get_evictions(&self) -> u64
Trait Implementations§
Source§impl Clone for TextShapingCache
impl Clone for TextShapingCache
Source§impl Debug for TextShapingCache
impl Debug for TextShapingCache
Auto Trait Implementations§
impl Forget for TextShapingCache
impl Freeze for TextShapingCachewhere
*const u8 is !null: Freeze,
PhantomData<(TextShapingKey, ShapedGlyphRun)>: Freeze,
PhantomData<(LineBreakKey, CachedLineBreakEntry)>: Freeze,
impl Move for TextShapingCache
impl RefUnwindSafe for TextShapingCache
impl Send for TextShapingCachewhere
RawTable<(TextShapingKey, ShapedGlyphRun)>: Send,
RawTable<(LineBreakKey, CachedLineBreakEntry)>: Send,
impl Sync for TextShapingCachewhere
RawTable<(TextShapingKey, ShapedGlyphRun)>: Sync,
RawTable<(LineBreakKey, CachedLineBreakEntry)>: Sync,
impl Unpin for TextShapingCache
impl UnsafeUnpin for TextShapingCachewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<(TextShapingKey, ShapedGlyphRun)>: UnsafeUnpin,
PhantomData<(LineBreakKey, CachedLineBreakEntry)>: UnsafeUnpin,
impl UnwindSafe for TextShapingCachewhere
HashMap<TextShapingKey, ShapedGlyphRun>: UnwindSafe,
HashMap<LineBreakKey, CachedLineBreakEntry>: UnwindSafe,
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