pub struct FragmentCorpus { /* private fields */ }Expand description
Every fragment file’s text, scanned at most once however many times the packs around it are loaded (ADR-0018).
One proef test loads packs up to four times — the suite, then [run] setup
and [run] teardown, each validated and then run — against different feature
paths but always the same corpus. Rescanning per load measured ~75% of a
run’s total work on a 200-file corpus, and it grows with the corpus, which is
the direction adoption goes.
The memo lives here rather than in the caller because the scan must stay
lazy: load_collecting runs it only when some pack actually has a
ref:, which is what makes CONFIG.md’s “pointing at a corpus you did not
write costs nothing” true of the scan. A caller that scanned eagerly in
order to share the result would buy speed by breaking that promise. Nothing
here reads a file — the texts arrive already read, so core stays sans-IO.
Implementations§
Source§impl FragmentCorpus
impl FragmentCorpus
Sourcepub fn new(sources: Vec<PackSource>, kinds: &[StepKindSpec]) -> Self
pub fn new(sources: Vec<PackSource>, kinds: &[StepKindSpec]) -> Self
A corpus over already-read file texts.
Sourcepub fn with_read_errors(self, errors: Vec<Diag>) -> Self
pub fn with_read_errors(self, errors: Vec<Diag>) -> Self
Record files the caller could not read. They are reported like any other
per-file corpus problem — never sinking their siblings, and never at all
unless something ref:s the corpus.