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> 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.