Skip to main content

Module fingerprint

Module fingerprint 

Source
Expand description

Read-only parser for cargo’s .fingerprint/ state: parses each unit directory into a Unit (kind, hashes, fingerprint JSON, dep-info) and attaches the artifacts that belong to it.

Directory layout as written by cargo:

<build>/<profile>/.fingerprint/<package>-<16hex>/
  <memo-file>            ← TEXT, 16 hex chars = the authoritative memo hash
  <memo-file>.json       ← serialized Fingerprint (schema below)
  dep-<memo-file>        ← binary EncodedDepInfo (not parsed here)
  invoked.timestamp      ← optional, ignorable

<memo-file> names the target kind: lib-serde (lib), build-script-build (compile build script), run-build-script-build (run build script), or the bin name.

JSON schema — mostly opaque HASH NUMBERS plus two human facts: {rustc, features, declared_features, target, profile, path, deps, local, rustflags, config, compile_kind} where features / declared_features are STRINGS containing serialized JSON arrays.

Structs§

ArtifactInfo
Artifacts that belong to a unit, found by suffix (fingerprint dir hash == deps filename suffix) — deps/*-{hex}.rlib|rmeta|so… and, for build script units, the whole build/{hex}/ subtree. Registry and workspace units look identical here.
DepRef
FingerprintJson
Typed view of the serialized Fingerprint schema.
Unit
One parsed .fingerprint/<package>-<16hex>/ directory.

Enums§

UnitKind

Functions§

artifacts_for
classify_kind
The target kind a memo file name implies (lib-serde, build-script-build, …).
dep_edges
Every unit’s dependency edges, resolved to indices in units.
memo_index
Memo hash → index of the unit that owns it. First wins on duplicates.
parse_fingerprint
Parse a serialized <memo>.json fingerprint — from a build dir or from the vault’s stored copy; both hold the same cargo-written bytes.
read_units
Read every unit directory under all .fingerprint/ roots inside the build dir.
resolve_dep
Resolve one dependency edge against a memo index.