pub struct LabelCensus { /* private fields */ }Expand description
Which labels a view writes that no file was seen to contain, accumulated over a corpus.
value_differences cannot see a label the original lacks: it walks the
rewrite and skips anything the original has no field for. That means a
label renamed on both the read and the write side passes it unremarked,
which is the self-consistent case a faithfulness check exists to catch.
Comparing what gets written against everything the corpus was ever seen to
contain is what closes that.
This has to accumulate across files rather than judge one at a time, because any single file may legitimately omit a field another carries.
Implementations§
Source§impl LabelCensus
impl LabelCensus
Sourcepub fn observe(&mut self, original: &GffStruct, rewritten: &GffStruct)
pub fn observe(&mut self, original: &GffStruct, rewritten: &GffStruct)
Records one file’s original tree and the tree a view rewrote from it.
Sourcepub fn invented(&self) -> InventedLabels
pub fn invented(&self) -> InventedLabels
Labels written that the corpus never contained, or
InventedLabels::Undecidable when there was nothing to compare
against.
Sourcepub fn case_variants(&self) -> Vec<CaseVariantGroup>
pub fn case_variants(&self) -> Vec<CaseVariantGroup>
Families of labels in the corpus differing only by letter case.
Returns only families with more than one spelling, since a lone
spelling has nothing to disagree with. What makes a family worth
attention is when CaseVariantGroup::written does not cover every
spelling: the view then reads some files’ copy of that field and not
others’.
Sourcepub fn misplaced(&self) -> Vec<(&str, &str, &str)>
pub fn misplaced(&self) -> Vec<(&str, &str, &str)>
Field paths whose leaf label appears in the corpus at one level and in the view’s output at another.
This is the wiring-mismatch check, and it exists because nothing else catches the shape. A view that reads a field off the wrong parent finds nothing there, so it writes nothing back: the round-trip is stable, the values that do coincide all match, and every field involved is modelled. It looks like a projection dropping a field it never wanted.
Reported as (leaf, path_in_corpus, path_written). A leaf appearing at
several levels legitimately, which nested formats do, yields one entry
per crossing pair and is for a reader to judge rather than a verdict.
Sourcepub fn partially_modelled_leaves(&self) -> Vec<LeafPathSplit<'_>>
pub fn partially_modelled_leaves(&self) -> Vec<LeafPathSplit<'_>>
Leaf labels the corpus carries at several paths, where the view models some of those paths and not others.
The blind spot this closes is a reviewer’s, not a tool’s. Scanning a
list of unmodelled labels, a leaf that also appears somewhere modelled
reads as covered: the eye matches the name, finds it in the view, and
moves on. OnHeartbeat survived exactly that way, modelled on the ARE
root and dropped inside every nested minigame Scripts struct, and the
inventory that was supposed to surface it counted the root’s and called
the label done.
Distinct from Self::misplaced, which asks whether a path the view
writes exists in any file. Here every path involved is real; the
question is only whether the view covers all of them. A leaf covered at
every path it appears at is not reported, and neither is one covered
nowhere, since Self::unmodelled already lists that.
A mixed result is not automatically a defect. Formats reuse labels at unrelated levels, and a projection may want one and not the other. It is a prompt to decide, with the paths side by side.
Sourcepub fn unmodelled(&self) -> Vec<(&str, &LabelObservation)>
pub fn unmodelled(&self) -> Vec<(&str, &LabelObservation)>
Field paths the corpus contained that the view never writes, each with what was observed under it.
Dropping a field is what a projection does, so this is a starting point for deciding what is worth modelling rather than a defect list. The types come along because they are what makes the follow-on modelling cheap: a label alone still needs looking up.
Trait Implementations§
Source§impl Clone for LabelCensus
impl Clone for LabelCensus
Source§fn clone(&self) -> LabelCensus
fn clone(&self) -> LabelCensus
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more