Struct egui::util::cache::CacheStorage
source · pub struct CacheStorage { /* private fields */ }
Expand description
use egui::util::cache::{CacheStorage, ComputerMut, FrameCache};
#[derive(Default)]
struct CharCounter {}
impl ComputerMut<&str, usize> for CharCounter {
fn compute(&mut self, s: &str) -> usize {
s.chars().count()
}
}
type CharCountCache<'a> = FrameCache<usize, CharCounter>;
let mut cache = cache_storage.cache::<CharCountCache<'_>>();
assert_eq!(cache.get("hello"), 5);
Implementations§
source§impl CacheStorage
impl CacheStorage
Trait Implementations§
source§impl Clone for CacheStorage
impl Clone for CacheStorage
source§impl Debug for CacheStorage
impl Debug for CacheStorage
source§impl Default for CacheStorage
impl Default for CacheStorage
source§fn default() -> CacheStorage
fn default() -> CacheStorage
Returns the “default value” for a type. Read more