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
sourceimpl CacheStorage
impl CacheStorage
Trait Implementations
sourceimpl Clone for CacheStorage
impl Clone for CacheStorage
sourceimpl Debug for CacheStorage
impl Debug for CacheStorage
sourceimpl Default for CacheStorage
impl Default for CacheStorage
sourcefn 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more