pub struct VariantCache {
pub capacity: usize,
/* private fields */
}Expand description
A capacity-bounded LRU cache for compiled shader variants.
When the cache exceeds capacity entries the least-recently-accessed
variant is evicted.
Fields§
§capacity: usizeMaximum number of variants to hold.
Implementations§
Source§impl VariantCache
impl VariantCache
Sourcepub fn insert(&mut self, variant: CompiledVariant)
pub fn insert(&mut self, variant: CompiledVariant)
Insert a compiled variant. Evicts the LRU entry if at capacity.
Sourcepub fn get(&mut self, key: &ShaderKey) -> Option<&CompiledVariant>
pub fn get(&mut self, key: &ShaderKey) -> Option<&CompiledVariant>
Look up a variant by key. Bumps its access time on hit.
Sourcepub fn total_binary_bytes(&self) -> usize
pub fn total_binary_bytes(&self) -> usize
Total binary bytes cached.
Auto Trait Implementations§
impl Freeze for VariantCache
impl RefUnwindSafe for VariantCache
impl Send for VariantCache
impl Sync for VariantCache
impl Unpin for VariantCache
impl UnsafeUnpin for VariantCache
impl UnwindSafe for VariantCache
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more