pub(crate) struct Budget {
work: AtomicUsize,
bytes: AtomicUsize,
}Expand description
A font’s preprocessing allowance, shared by lazy cache initializers.
Repeated visits to aliased data consume work again. Allocations consume their requested capacity, even if the resulting cache is later discarded. Neither allowance is replenished between lookup builds or shaping calls.
Fields§
§work: AtomicUsize§bytes: AtomicUsizeImplementations§
Source§impl Budget
impl Budget
pub fn for_table_bytes(bytes: usize) -> Self
pub const fn new(work: usize, bytes: usize) -> Self
pub fn work(&self, visits: usize) -> Result<(), Exhausted>
pub fn alloc<T>(&self, count: usize) -> Result<(), Exhausted>
fn take(counter: &AtomicUsize, amount: usize) -> Result<(), Exhausted>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Budget
impl RefUnwindSafe for Budget
impl Send for Budget
impl Sync for Budget
impl Unpin for Budget
impl UnsafeUnpin for Budget
impl UnwindSafe for Budget
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