pub struct Cache<T> {
pub points1: FnvHashMap<usize, Option<T>>,
pub points2: FnvHashMap<usize, Option<[T; 2]>>,
pub points3: FnvHashMap<usize, Option<[T; 3]>>,
pub points4: FnvHashMap<usize, Option<[T; 4]>>,
}
Expand description
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: FnvHashMap<usize, Option<T>>
Stores temporary values of scalars.
points2: FnvHashMap<usize, Option<[T; 2]>>
Stores temporary values of 2D vectors.
points3: FnvHashMap<usize, Option<[T; 3]>>
Stores temporary values of 3D vectors.
points4: FnvHashMap<usize, Option<[T; 4]>>
Stores temporary values of 4D vectors.
Implementations§
Source§impl<T> Cache<T>
impl<T> Cache<T>
Sourcepub fn new(doc: &Reactor<T>) -> Cache<T>where
T: Copy,
pub fn new(doc: &Reactor<T>) -> Cache<T>where
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.
Auto Trait Implementations§
impl<T> Freeze for Cache<T>
impl<T> RefUnwindSafe for Cache<T>where
T: RefUnwindSafe,
impl<T> Send for Cache<T>where
T: Send,
impl<T> Sync for Cache<T>where
T: Sync,
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