Skip to main content

Module digest

Module digest 

Source
Expand description

The digest pipeline: what a long document looks like from outside.

Three rules hold this module together, and each of them exists because a summary is lossy and the loss happens before anyone can check it.

  • A structure tree is mechanical. Headings, their levels and their byte spans are read from the document itself, so this half of a digest is reproducible and never disagrees with the source.
  • Anything a model wrote is suspect. Where a digest and the source conflict, the source wins: at the moment a conflict is noticed the only certain fact is that one of them is wrong, and the source is the one nobody rewrote.
  • A content hash is digested once in its life. The cache is keyed by the hash of the bytes, so the same document costs one digest no matter how many runs meet it.

The model call itself is the caller’s: this module decides what to ask for and what to trust, and bin::assembly owns the provider.

Structs§

Breaker
The circuit breaker around a digester that can fail.
Digest
A digest of one document.
StructureNode
One heading and the bytes beneath it.

Enums§

BreakerVerdict
What the pipeline should do next. Exhaustive on purpose.
DigestOutcome
What one pass over a document produced.

Functions§

digest_once
Digests one document, once in its life.
structure_of
Reads the heading structure of a markdown document.