pub enum AbsentDefault {
Stamped(DefaultValue, DocCitation),
Constructed(DefaultValue, DocCitation),
NotAConstant(DocCitation),
Unverified,
}Expand description
What the engine holds for a label the file does not carry.
The two audited variants describe different engine mechanisms and read
differently in a diagnostic, so they stay apart. They behave identically
for everything this codebase does with them, because a typed view is always
built from bytes and never loaded onto an object that already holds state:
there is no prior value for a carry-over to carry. Both therefore reduce to
“compare against this constant” for the omit rule and the reader guard,
which is why those share one code path over Self::value.
Every variant that claims to know something carries a DocCitation,
which is what keeps the axis a record of audited findings rather than a
second copy of the reader.
Variants§
Stamped(DefaultValue, DocCitation)
The loader stamps this constant whether or not the field was present.
Overwrites whatever the object already held, which is what makes it
distinct from Self::Constructed rather than a rewording of it. A
placeable’s trap flags are the clear case: the constructor arms all
three, and the read stamps 0 over them regardless.
Constructed(DefaultValue, DocCitation)
The loader leaves the object’s own value alone; this is what a freshly constructed one holds.
Reporting the mechanism without the value would leave the question open, so the constructed value is part of the answer rather than a footnote to it.
NotAConstant(DocCitation)
Audited, and the answer is known, but it is not one constant.
Two shapes land here. The value can be a function of a sibling field:
Uti::MaxCharges reuses whatever Charges resolved to, and Utc’s
MovementRate and WalkRate each fall back to the other’s label. Or it
can be structured rather than scalar: an absent Utc::SkillList leaves
eight skill ranks at eight zeroes, which no DefaultValue can hold.
Carries a citation but no encoding of the answer. Encoding a derivation would mean a small expression language in a static table to serve a handful of fields, when the readers already do it in a line or two with the siblings in scope; encoding a structured value would mean a variant per shape. What the schema needs to say is that the value is known, is not a constant, and must never be omitted on write.
Not a synonym for Self::Unverified. Folding these together would
throw away an audit, and it would do real damage downstream: the danger
list a consumer builds is unverified fields weighted by how often their
fallback fires, so filing a known answer as unknown plants a permanent
false alarm in the one output that ranking exists to produce.
Unverified
Nobody has traced what the engine does without this field.
A terminal state, not a gap to be embarrassed about: it is what lets the audited entries be trusted. A writer must emit an unverified field, since omitting it would bet on a substitution nobody has checked.
The one variant with no citation, because there is nothing to cite.
Implementations§
Source§impl AbsentDefault
impl AbsentDefault
Sourcepub fn value(&self) -> Option<DefaultValue>
pub fn value(&self) -> Option<DefaultValue>
The constant the engine ends up holding, when it is one.
None for Self::NotAConstant and Self::Unverified, which is what
keeps both out of the omit rule and out of the reader guard.
Sourcepub fn citation(&self) -> Option<DocCitation>
pub fn citation(&self) -> Option<DocCitation>
The audited finding this entry rests on.
None only for Self::Unverified. Every entry that claims to know
something says where it learned it.
Trait Implementations§
Source§impl Clone for AbsentDefault
impl Clone for AbsentDefault
Source§fn clone(&self) -> AbsentDefault
fn clone(&self) -> AbsentDefault
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AbsentDefault
impl Debug for AbsentDefault
Source§impl PartialEq for AbsentDefault
impl PartialEq for AbsentDefault
Source§fn eq(&self, other: &AbsentDefault) -> bool
fn eq(&self, other: &AbsentDefault) -> bool
self and other values to be equal, and is used by ==.