Struct turbine_reactive::Cache
[−]
[src]
pub struct Cache<T> { pub points1: HashMap<usize, Option<T>>, pub points2: HashMap<usize, Option<[T; 2]>>, pub points3: HashMap<usize, Option<[T; 3]>>, pub points4: HashMap<usize, Option<[T; 4]>>, }
Used to store temporary values of shared functions to speed up computation.
By default, all function outputs that are referenced more than once are cached.
To signal that some function output should be cached, None
is stored in a hash map.
When performing the first computation of that output, Some(value)
is stored in the cache.
Fields
points1: HashMap<usize, Option<T>>
Stores temporary values of scalars.
points2: HashMap<usize, Option<[T; 2]>>
Stores temporary values of 2D vectors.
points3: HashMap<usize, Option<[T; 3]>>
Stores temporary values of 3D vectors.
points4: HashMap<usize, Option<[T; 4]>>
Stores temporary values of 4D vectors.
Methods
impl<T> Cache<T>
[src]
fn new(doc: &Reactor<T>) -> Cache<T> where
T: Copy,
[src]
T: Copy,
Creates a new cache for a document.
Analyzes the graph to find function outputs that are referenced more than once.
If new data and functions are added after the cache is created, then these will not be automatically cached, but the behavior should be the same.
fn clear(&mut self)
[src]
Reset cache such that new temporary values can be calculated.