pub struct VersionSignals { /* private fields */ }Expand description
The shape evidence a document exhibits.
Built by the reader as it walks a document, then interrogated once at the end — a single facet is not enough to judge a file, and a mixed document must be reported as mixed rather than decided by whichever facet was seen last.
Implementations§
Source§impl VersionSignals
impl VersionSignals
Sourcepub fn observe(&mut self, signal: Signal) -> &mut Self
pub fn observe(&mut self, signal: Signal) -> &mut Self
Records a signal. Repeat observations are idempotent.
Sourcepub fn iter(&self) -> impl Iterator<Item = Signal> + '_
pub fn iter(&self) -> impl Iterator<Item = Signal> + '_
Every observed signal, in a stable order.
Sourcepub fn signals_for_1_0(&self) -> Vec<Signal>
pub fn signals_for_1_0(&self) -> Vec<Signal>
The observed signals that are exclusive to 1.0.
Sourcepub fn signals_for_draft(&self) -> Vec<Signal>
pub fn signals_for_draft(&self) -> Vec<Signal>
The observed signals that indicate a pre-1.0 draft.
Sourcepub fn is_internally_inconsistent(&self) -> bool
pub fn is_internally_inconsistent(&self) -> bool
Whether the document mixes shapes from incompatible revisions.
A document doing this is malformed under both revisions. It is reported, never repaired: choosing which half to believe changes which requirements exist.
Sourcepub fn infer(&self) -> Option<IdsVersion>
pub fn infer(&self) -> Option<IdsVersion>
The revision the shape indicates, if the evidence is unambiguous.
Returns None when nothing was observed, and also when the evidence is
self-contradictory — both are cases where a caller must not receive a
confident answer.