pub struct Provenance {
pub sources: SmallVec<[Source; 2]>,
pub confidence: Option<f32>,
}Expand description
Which extraction source(s) contributed to an item, in contribution order, plus a confidence score set only by heuristic tiers.
Fields§
§sources: SmallVec<[Source; 2]>Contributing sources, ordered by contribution (earliest first).
confidence: Option<f32>Set only when a heuristic tier (e.g. Tier B help-text) produced this
item; None for structured/authoritative sources.
Implementations§
Source§impl Provenance
impl Provenance
Sourcepub fn single(source: Source) -> Provenance
pub fn single(source: Source) -> Provenance
A Provenance crediting a single source, with no confidence score.
Sourcepub fn with_confidence(source: Source, confidence: f32) -> Provenance
pub fn with_confidence(source: Source, confidence: f32) -> Provenance
A Provenance crediting a single heuristic source with a confidence
score.
The highest authority on axis among this item’s contributing
sources. 0 if there are no contributing sources.
Sourcepub fn describable(&self) -> bool
pub fn describable(&self) -> bool
Whether an item carrying this provenance could, in principle, have
been described — spec §13’s metric design rules. true when any
contributing source Source::can_describe (a flag merged from
several tiers is describable if even one of them could have
supplied prose, e.g. a synopsis spelling later reconciled against a
structured entry — see help_text::sections::flag_spelling_already_present).
true also when there are no contributing sources at all: an empty
Provenance is not this codebase’s way of saying “usage-synopsis
only,” so it must not silently disappear from a describability
count the way a real HelpTextSynopsis-only item correctly does.
Sourcepub fn absorb(&mut self, other: &Provenance)
pub fn absorb(&mut self, other: &Provenance)
Merge another Provenance into this one: union the source lists
(deduplicated, order preserved) and combine confidence
conservatively (the lower of the two, since overall trust is bounded
by the least-confident contributor).
Trait Implementations§
Source§impl Clone for Provenance
impl Clone for Provenance
Source§fn clone(&self) -> Provenance
fn clone(&self) -> Provenance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more