Skip to main content

Module interpret

Module interpret 

Source
Expand description

The blob-interpreter seam (roadmap §4.5 follow-up): a dependency-inversion contract so consumers can decode opaque BLOB values in schema context — WebKit Local Storage UTF-16, or the general blob-decoder crate (plist / gzip / JSON / …) — WITHOUT this reader library taking on any decode dependency or MSRV cost.

The library owns the contract + the schema context (BlobContext); a consumer supplies the decoder by implementing BlobInterpreter. Passing None is the default: unchanged behaviour, the raw bytes are surfaced as-is.

Secure by design: Interpretation::lossy is a struct field, so a caller cannot render a lossy decode as a faithful one — the uncertainty is structural, not a side-channel warning.

Structs§

BlobContext
The schema context a BlobInterpreter may use as a decoding prior — e.g. a known table/column (“this column holds UTF-16 Local Storage values”) lifts a structural, low-confidence reading to a high-confidence one.
Interpretation
A consumer-supplied decoding of an opaque BLOB value. The observation of what the bytes are, never a guarantee — lossy records when the decode dropped or substituted data.
LocalStorageInterpreter
The built-in, dependency-free BlobInterpreter for WebKit/Chromium Local Storage. A .localstorage ItemTable.value BLOB holds its string as raw UTF-16-LE (no BOM, no type byte); this decodes it — but ONLY when the schema context identifies the ItemTable column, which is the prior that makes the UTF-16-LE reading confident. An arbitrary BLOB is not this interpreter’s job (that is the general blob-decoder adapter); it returns None.

Traits§

BlobInterpreter
A consumer-supplied interpreter of opaque BLOB values. Implemented OUTSIDE this crate (a blob-decoder adapter, or the built-in Local Storage decoder) so the reader library carries no decode dependency.

Functions§

interpret_values
Apply interpreter to every BLOB in values, returning (column_index, interpretation) for each blob the interpreter recognised. Non-blob values are skipped. interpreter == None yields an empty result — the default, unchanged behaviour, so this passthrough is non-breaking for every existing caller.