Skip to main content

LabelCensus

Struct LabelCensus 

Source
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

Source

pub fn new() -> Self

Creates an empty census.

Source

pub fn observe(&mut self, original: &GffStruct, rewritten: &GffStruct)

Records one file’s original tree and the tree a view rewrote from it.

Source

pub fn files(&self) -> usize

Number of files observed.

Source

pub fn invented(&self) -> InventedLabels

Labels written that the corpus never contained, or InventedLabels::Undecidable when there was nothing to compare against.

Source

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’.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> LabelCensus

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LabelCensus

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for LabelCensus

Source§

fn default() -> LabelCensus

Returns the “default value” for a type. 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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.