Struct noise::Cache
[−]
[src]
pub struct Cache<Source, T> where
T: Float, {
pub source: Source,
// some fields omitted
}
Noise module that caches the last output value generated by the source module.
If the input coordinates passed to Cache::get
are equal to the previous
call, the module returns the cached result of the previous call to
Source::get
. Otherwise, Source::get
is called with the new coordinates,
overwriting the cache with the result, and returning the result to the
caller.
Caching a noise module is useful if it is used as a source module for multiple noise modules. If a source module is not cached, the source module will redundantly calculate the same output value once for each noise module in which it is included.
Fields
source: Source
Outputs the value to be cached.
Methods
impl<Source, T> Cache<Source, T> where
T: Float,
[src]
T: Float,
Trait Implementations
impl<Source: Clone, T: Clone> Clone for Cache<Source, T> where
T: Float,
[src]
T: Float,
fn clone(&self) -> Cache<Source, T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<Source: Debug, T: Debug> Debug for Cache<Source, T> where
T: Float,
[src]
T: Float,
impl<Source, T> NoiseModule<Point2<T>> for Cache<Source, T> where
Source: NoiseModule<Point2<T>, Output = T>,
T: Float,
[src]
Source: NoiseModule<Point2<T>, Output = T>,
T: Float,
impl<Source, T> NoiseModule<Point3<T>> for Cache<Source, T> where
Source: NoiseModule<Point3<T>, Output = T>,
T: Float,
[src]
Source: NoiseModule<Point3<T>, Output = T>,
T: Float,
impl<Source, T> NoiseModule<Point4<T>> for Cache<Source, T> where
Source: NoiseModule<Point4<T>, Output = T>,
T: Float,
[src]
Source: NoiseModule<Point4<T>, Output = T>,
T: Float,