pub struct Cache<Source> {
    pub source: Source,
    /* private fields */
}
Expand description

Noise function that caches the last output value generated by the source function.

If the input coordinates passed to Cache::get are equal to the previous call, the function 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 function is useful if it is used as a source function for multiple noise functions. If a source function is not cached, the source function will redundantly calculate the same output value once for each noise function in which it is included.

Fields

source: Source

Outputs the value to be cached.

Implementations

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.