Struct silkenweb_reactive::memo::MemoFrame
source · pub struct MemoFrame(_);
Implementations§
source§impl MemoFrame
impl MemoFrame
sourcepub fn cache<Key, Value, ValueFn>(&self, key: Key, value_fn: ValueFn) -> Valuewhere
Key: 'static + Eq + Hash,
Value: 'static + Clone,
ValueFn: FnOnce() -> Value,
pub fn cache<Key, Value, ValueFn>(&self, key: Key, value_fn: ValueFn) -> Valuewhere
Key: 'static + Eq + Hash,
Value: 'static + Clone,
ValueFn: FnOnce() -> Value,
Lookup a value in the cache.
If a value is not there, it will be generated using value_fn
. All
functional dependencies of value_fn
should be included in key
.
The value will be cached for the next frame, whether it’s new or existing.
It is up to the client to use a key that uniquely identifies the
functional dependencies of variables captured by value_fn
.