Module mask_snapshot

Module mask_snapshot 

Source

Structs§

SnapshotIdentity
The identity a snapshot is only valid for: the tokenizer it was computed against, plus that tokenizer’s vocabulary size.

Enums§

SnapshotError
Errors from reading or writing a mask snapshot. A stale or corrupt snapshot is NOT an error — it is a miss (Ok(0)); only genuine I/O failures surface here.

Functions§

decode
Parse a snapshot. Returns None for ANY reason the bytes are not usable under identity — wrong magic, older format, different usize width, different tokenizer, truncation, checksum mismatch. Those are cache misses, not failures.
encode
Serialize entries into the snapshot byte format.
fnv1a
Fold bytes into an FNV-1a accumulator.
fnv1a_of
FNV-1a over bytes, starting from the standard offset basis.
load_from_file
Load path into cache. Returns the number of entries imported — 0 when the file is absent, stale, or corrupt (a miss).
save_to_file
Write cache’s entries to path, atomically (temp file + rename) so a concurrent reader never observes a half-written snapshot.