pub struct Cache<T> { /* private fields */ }Expand description
A simple cache that stores generated values to avoid recomputation.
Keeps track of the last generated value after clearing.
Implementations§
Source§impl<T> Cache<T>
impl<T> Cache<T>
Sourcepub fn with_group(group: Group) -> Self
pub fn with_group(group: Group) -> Self
Sourcepub fn put(&self, value: T)
pub fn put(&self, value: T)
Puts the given value in the Cache.
Notice that, given this is a cache, a mutable reference is not necessary to call this method. You can safely update the cache in rendering code.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Cache<T>
impl<T> !RefUnwindSafe for Cache<T>
impl<T> Send for Cache<T>where
T: Send,
impl<T> !Sync for Cache<T>
impl<T> Unpin for Cache<T>where
T: Unpin,
impl<T> UnsafeUnpin for Cache<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Cache<T>where
T: UnwindSafe,
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