Struct webrender::ProgramCache
source · pub struct ProgramCache {
entries: RefCell<FastHashMap<ProgramSourceDigest, ProgramCacheEntry>>,
program_cache_handler: Option<Box<dyn ProgramCacheObserver>>,
pending_entries: RefCell<Vec<Arc<ProgramBinary>>>,
}
Fields§
§entries: RefCell<FastHashMap<ProgramSourceDigest, ProgramCacheEntry>>
§program_cache_handler: Option<Box<dyn ProgramCacheObserver>>
Optional trait object that allows the client application to handle ProgramCache updating
pending_entries: RefCell<Vec<Arc<ProgramBinary>>>
Programs that have not yet been cached to disk (by program_cache_handler)
Implementations§
source§impl ProgramCache
impl ProgramCache
pub fn new( program_cache_observer: Option<Box<dyn ProgramCacheObserver>>, ) -> Rc<Self>
sourcefn update_disk_cache(&self, startup_complete: bool)
fn update_disk_cache(&self, startup_complete: bool)
Save any new program binaries to the disk cache, and if startup has just completed then write the list of shaders to load on next startup.
sourcefn add_new_program_binary(&self, program_binary: Arc<ProgramBinary>)
fn add_new_program_binary(&self, program_binary: Arc<ProgramBinary>)
Add a new ProgramBinary to the cache. This function is typically used after compiling and linking a new program. The binary will be saved to disk the next time update_disk_cache() is called.
sourcepub fn report_memory(&self, op: VoidPtrToSizeFn) -> usize
pub fn report_memory(&self, op: VoidPtrToSizeFn) -> usize
Returns the number of bytes allocated for shaders in the cache.
Auto Trait Implementations§
impl !Freeze for ProgramCache
impl !RefUnwindSafe for ProgramCache
impl !Send for ProgramCache
impl !Sync for ProgramCache
impl Unpin for ProgramCache
impl !UnwindSafe for ProgramCache
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