Skip to main content

source_digest

Function source_digest 

Source
pub fn source_digest(source: &str) -> u64
Expand description

Digest of one assembled source text, identifying the artifact a build script compiled from it.

A precompiled artifact is only usable if the source still matches the one it was built from, and the name alone cannot say so: hot-reload exists precisely to compile an edited shader, and a build-time artifact keyed by name would shadow the edit. Comparing digests makes the embedded copy a content hit – used whenever the text is unchanged, skipped the moment it is not, in any build and under any flag.

FNV-1a, because it is over a few kilobytes on a path that then either does nothing or invokes a compiler; the cost has to disappear next to both.