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
pub fn cache<FrameCache: CacheTrait + Default>(&mut self) -> &mut FrameCache
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
Auto Trait Implementations§
impl !RefUnwindSafe for CacheStorage
impl Send for CacheStorage
impl Sync for CacheStorage
impl Unpin for CacheStorage
impl !UnwindSafe for CacheStorage
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