Skip to main content

FragmentCorpus

Struct FragmentCorpus 

Source
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

Source

pub fn new(sources: Vec<PackSource>, kinds: &[StepKindSpec]) -> Self

A corpus over already-read file texts.

Source

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.

Source

pub fn empty() -> Self

The empty corpus — no [run] fragments configured, so no ref: can resolve and nothing is ever scanned.

Trait Implementations§

Source§

impl Debug for FragmentCorpus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.