pub struct GlyphCache { /* private fields */ }Expand description
Glyph cache with separate regions for normal and double-width glyphs.
- Normal region: slots 0-2047 (2048 single-width glyphs)
- Wide region: slots 2048-4095 (1024 double-width glyphs, 2 slots each)
Implementations§
Source§impl GlyphCache
impl GlyphCache
pub fn new() -> Self
Sourcepub fn get(&mut self, key: &str, style: FontStyle) -> Option<GlyphSlot>
pub fn get(&mut self, key: &str, style: FontStyle) -> Option<GlyphSlot>
Gets the slot for a glyph, marking it as recently used.
Sourcepub fn insert(
&mut self,
key: &str,
style: FontStyle,
) -> (GlyphSlot, Option<(CompactString, FontStyle)>)
pub fn insert( &mut self, key: &str, style: FontStyle, ) -> (GlyphSlot, Option<(CompactString, FontStyle)>)
Inserts a glyph, returning its slot. Evicts LRU if region is full.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Debug for GlyphCache
impl Debug for GlyphCache
Auto Trait Implementations§
impl Freeze for GlyphCache
impl RefUnwindSafe for GlyphCache
impl Send for GlyphCache
impl Sync for GlyphCache
impl Unpin for GlyphCache
impl UnsafeUnpin for GlyphCache
impl UnwindSafe for GlyphCache
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