Expand description
Content fingerprinting for incremental builds. Content fingerprinting for incremental builds.
This module provides BuildCache, which tracks SHA-256-style
fingerprints of content files so that only files modified since the
last build need to be re-processed.
§Overview
- On startup, call
BuildCache::loadto read the previous fingerprint map from.ssg-cache.json. - Call
BuildCache::changed_fileswith the content directory to obtain the list of files whose contents have changed (or are new). - After a successful build, call
BuildCache::updateto record the current fingerprints, thenBuildCache::saveto persist them to disk.
§Example
use std::path::Path;
use ssg::cache::BuildCache;
let cache_path = Path::new(".ssg-cache.json");
let content_dir = Path::new("content");
let mut cache = BuildCache::load(cache_path).unwrap();
let changed = cache.changed_files(content_dir).unwrap();
// … build only `changed` files …
cache.update(content_dir).unwrap();
cache.save().unwrap();Structs§
- Build
Cache - Persisted fingerprint map used for incremental builds.