pub fn digest_once(
text: &str,
origin: Option<Locator>,
breaker: &mut Breaker,
cached: &mut dyn FnMut(&B3Hash) -> Result<Option<Digest>, AxError>,
write_prose: &mut dyn FnMut(&str) -> Result<String, AxError>,
) -> Result<DigestOutcome, AxError>Expand description
Digests one document, once in its life.
cached answers what the store already holds for this content hash;
write_prose is the model call, which the caller owns. The order is
the whole policy: hash, ask the cache, read the structure, and only
then spend a model call — and skip that call entirely once the breaker
is open.
§Errors
Propagates a cache read that fails. A prose failure is not an error
here: it becomes DigestOutcome::Structural, because a document
whose summary failed is still a document with headings.